dba33f: don't ask every driver for a tables keys and consolidate some code fragments

This commit is contained in:
Ocke Janssen [oj]
2010-02-08 14:07:46 +01:00
parent 6726468497
commit d16fa93c41
8 changed files with 33 additions and 102 deletions

View File

@@ -971,39 +971,7 @@ void OTableController::loadData()
// -----------------------------------------------------------------------------
Reference<XNameAccess> OTableController::getKeyColumns() const
{
// use keys and indexes for excat postioning
// first the keys
Reference<XKeysSupplier> xKeySup(m_xTable,UNO_QUERY);
Reference<XIndexAccess> xKeys;
if(xKeySup.is())
xKeys = xKeySup->getKeys();
Reference<XColumnsSupplier> xKeyColsSup;
Reference<XNameAccess> xKeyColumns;
if(xKeys.is())
{
Reference<XPropertySet> xProp;
sal_Int32 nCount = xKeys->getCount();
for(sal_Int32 i=0;i< nCount;++i)
{
xKeys->getByIndex(i) >>= xProp;
OSL_ENSURE(xProp.is(),"Key is invalid: NULL!");
if ( xProp.is() )
{
sal_Int32 nKeyType = 0;
xProp->getPropertyValue(PROPERTY_TYPE) >>= nKeyType;
if(KeyType::PRIMARY == nKeyType)
{
xKeyColsSup.set(xProp,UNO_QUERY);
OSL_ENSURE(xKeyColsSup.is(),"Columnsupplier is null!");
xKeyColumns = xKeyColsSup->getColumns();
break;
}
}
}
}
return xKeyColumns;
return getPrimaryKeyColumns_throw(m_xTable);
}
// -----------------------------------------------------------------------------
sal_Bool OTableController::checkColumns(sal_Bool _bNew) throw(::com::sun::star::sdbc::SQLException)