User: vg Date: 05/03/23 01:40:20 Modified: /dba/connectivity/source/commontools/ TIndexes.cxx
Log: INTEGRATION: CWS dba26 (1.3.54); FILE MERGED 2005/03/14 13:56:35 fs 1.3.54.2: RESYNC: (1.3-1.4); FILE MERGED 2005/03/08 11:27:45 oj 1.3.54.1: #i44439# check if index is primary key index File Changes: Directory: /dba/connectivity/source/commontools/ ================================================ File [changed]: TIndexes.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/commontools/TIndexes.cxx?r1=1.5&r2=1.6 Delta lines: +21 -5 -------------------- --- TIndexes.cxx 18 Mar 2005 09:56:54 -0000 1.5 +++ TIndexes.cxx 23 Mar 2005 09:40:18 -0000 1.6 @@ -88,7 +88,6 @@ #ifndef _RTL_USTRBUF_HXX_ #include <rtl/ustrbuf.hxx> #endif - using namespace connectivity; using namespace connectivity::sdbcx; using namespace ::com::sun::star::uno; @@ -129,8 +128,8 @@ m_pTable->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_SCHEMANAME)) >>= aSchema; m_pTable->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME)) >>= aTable; - - Reference< XResultSet > xResult = m_pTable->getMetaData()->getIndexInfo(m_pTable->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_CATALOGNAME)),aSchema,aTable,sal_False,sal_False); + Any aCatalog = m_pTable->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_CATALOGNAME)); + Reference< XResultSet > xResult = m_pTable->getMetaData()->getIndexInfo(aCatalog,aSchema,aTable,sal_False,sal_False); if ( xResult.is() ) { @@ -140,9 +139,26 @@ sal_Bool bUnique = !xRow->getBoolean(4); if((!aQualifier.getLength() || xRow->getString(5) == aQualifier ) && xRow->getString(6) == aName) { + sal_Int32 nClustered = xRow->getShort(7); + sal_Bool bPrimarKeyIndex = sal_False; + xRow = NULL; + xResult = NULL; + try + { + xResult = m_pTable->getMetaData()->getPrimaryKeys(aCatalog,aSchema,aTable); + xRow.set(xResult,UNO_QUERY); + + if ( xRow.is() && xResult->next() ) // there can be only one primary key + { + bPrimarKeyIndex = xRow->getString(6) == aName; + } + } + catch(Exception) + { + } OIndexHelper* pRet = new OIndexHelper(m_pTable,aName,aQualifier,bUnique, - sal_False, - xRow->getShort(7) == IndexType::CLUSTERED); + bPrimarKeyIndex, + nClustered == IndexType::CLUSTERED); xRet = pRet; break; } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
