Tag: cws_src680_dba26 User: oj Date: 05/03/08 03:27:48 Modified: /dba/connectivity/source/commontools/ TIndexes.cxx
Log: #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.3&r2=1.3.54.1 Delta lines: +24 -7 -------------------- --- TIndexes.cxx 22 Oct 2004 08:41:22 -0000 1.3 +++ TIndexes.cxx 8 Mar 2005 11:27:45 -0000 1.3.54.1 @@ -2,9 +2,9 @@ * * $RCSfile: TIndexes.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.3.54.1 $ * - * last change: $Author: rt $ $Date: 2004/10/22 08:41:22 $ + * last change: $Author: oj $ $Date: 2005/03/08 11:27:45 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -126,8 +126,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() ) { @@ -137,9 +137,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]
