diff --git a/dbaccess/source/core/api/CIndexes.hxx b/dbaccess/source/core/api/CIndexes.hxx index a25a23e00803..b79568dad2d5 100644 --- a/dbaccess/source/core/api/CIndexes.hxx +++ b/dbaccess/source/core/api/CIndexes.hxx @@ -2,9 +2,9 @@ * * $RCSfile: CIndexes.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-19 00:15:37 $ + * last change: $Author: oj $ $Date: 2000-11-15 15:57:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -76,6 +76,7 @@ namespace dbaccess { class OIndexes : public connectivity::sdbcx::OCollection { + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xIndexes; ODBTable* m_pTable; protected: virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); @@ -83,6 +84,7 @@ namespace dbaccess virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); public: OIndexes(ODBTable* _pTable, + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxIndexes, ::osl::Mutex& _rMutex, const ::std::vector< ::rtl::OUString> &_rVector ) : connectivity::sdbcx::OCollection(*_pTable,sal_True,_rMutex,_rVector) diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx index ec88711165b5..fac94f75419d 100644 --- a/dbaccess/source/core/api/KeySet.cxx +++ b/dbaccess/source/core/api/KeySet.cxx @@ -2,9 +2,9 @@ * * $RCSfile: KeySet.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: oj $ $Date: 2000-10-30 09:24:02 $ + * last change: $Author: oj $ $Date: 2000-11-15 15:57:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -108,7 +108,10 @@ OKeySet::OKeySet(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc: // ------------------------------------------------------------------------- Any SAL_CALL OKeySet::getBookmark( const ORowSetRow& _rRow ) throw(SQLException, RuntimeException) { - return makeAny(m_xDriverSet->getRow()); + sal_Int32 nPos = m_xDriverSet->getRow(); + if(!nPos) + return Any(); + return makeAny(nPos); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OKeySet::compareBookmarks( const Any& first, const Any& second ) throw(SQLException, RuntimeException) @@ -276,6 +279,9 @@ void SAL_CALL OKeySet::moveToCurrentRow( ) throw(SQLException, RuntimeException /*------------------------------------------------------------------------ $Log: not supported by cvs2svn $ + Revision 1.5 2000/10/30 09:24:02 oj + use tablecontainer if no tablesupplier is supported + Revision 1.4 2000/10/25 07:30:24 oj make strings unique for lib's diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index 1616b74fbfb8..f82268aeb244 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -2,9 +2,9 @@ * * $RCSfile: RowSet.cxx,v $ * - * $Revision: 1.18 $ + * $Revision: 1.19 $ * - * last change: $Author: oj $ $Date: 2000-11-14 13:28:20 $ + * last change: $Author: oj $ $Date: 2000-11-15 15:57:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -265,6 +265,7 @@ ORowSet::ORowSet(const Reference< ::com::sun::star::lang::XMultiServiceFactory > ,m_bRebuildConnOnExecute(sal_False) ,m_bNew(sal_False) ,m_bIsBookmarable(sal_True) + ,m_bCanUpdateInsertedRows(sal_True) ,m_pTables(NULL) { m_pMySelf = this; @@ -291,7 +292,7 @@ ORowSet::ORowSet(const Reference< ::com::sun::star::lang::XMultiServiceFactory > // sdbcx.ResultSet Properties registerProperty(PROPERTY_ISBOOKMARKABLE, PROPERTY_ID_ISBOOKMARKABLE, nRT, &m_bIsBookmarable, ::getBooleanCppuType()); - + registerProperty(PROPERTY_CANUPDATEINSERTEDROWS,PROPERTY_ID_CANUPDATEINSERTEDROWS, nRT, &m_bCanUpdateInsertedRows, ::getBooleanCppuType()); // sdbc.ResultSet Properties // registerProperty(PROPERTY_CURSORNAME, PROPERTY_ID_CURSORNAME, PropertyAttribute::READONLY, &m_aCursorName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); registerProperty(PROPERTY_RESULTSETCONCURRENCY, PROPERTY_ID_RESULTSETCONCURRENCY, PropertyAttribute::TRANSIENT, &m_nResultSetConcurrency,::getCppuType(reinterpret_cast< sal_Int32*>(NULL))); @@ -990,6 +991,8 @@ void SAL_CALL ORowSet::insertRow( ) throw(SQLException, RuntimeException) // fire property modified if(!m_bModified) fireProperty(PROPERTY_ID_ISMODIFIED,sal_False,sal_True); + ORowSetMatrix::iterator aOldValues = m_pCache->m_pMatrix->end(); + ORowSetBase::firePropertyChange(aOldValues); fireRowcount(); } } diff --git a/dbaccess/source/core/api/RowSet.hxx b/dbaccess/source/core/api/RowSet.hxx index f69a0d211194..2063efae2c90 100644 --- a/dbaccess/source/core/api/RowSet.hxx +++ b/dbaccess/source/core/api/RowSet.hxx @@ -2,9 +2,9 @@ * * $RCSfile: RowSet.hxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: oj $ $Date: 2000-11-03 14:40:45 $ + * last change: $Author: oj $ $Date: 2000-11-15 15:57:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -185,6 +185,7 @@ namespace dbaccess sal_Bool m_bRebuildConnOnExecute ; sal_Bool m_bIsBookmarable ; sal_Bool m_bNew ; + sal_Bool m_bCanUpdateInsertedRows; private: ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > calcConnection() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); @@ -436,6 +437,9 @@ namespace dbaccess /*------------------------------------------------------------------------ $Log: not supported by cvs2svn $ + Revision 1.8 2000/11/03 14:40:45 oj + some problems with refcount resolved + Revision 1.7 2000/10/31 15:21:51 fs added XCompletedExecution interface & implementation diff --git a/dbaccess/source/core/api/RowSetBase.cxx b/dbaccess/source/core/api/RowSetBase.cxx index e9520d4a5ac6..04623479101d 100644 --- a/dbaccess/source/core/api/RowSetBase.cxx +++ b/dbaccess/source/core/api/RowSetBase.cxx @@ -2,9 +2,9 @@ * * $RCSfile: RowSetBase.cxx,v $ * - * $Revision: 1.13 $ + * $Revision: 1.14 $ * - * last change: $Author: oj $ $Date: 2000-11-14 13:28:20 $ + * last change: $Author: oj $ $Date: 2000-11-15 15:57:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -483,6 +483,7 @@ sal_Bool SAL_CALL ORowSetBase::moveToBookmark( const Any& bookmark ) throw(SQLEx sal_Bool bRet = m_pCache->moveToBookmark(bookmark); if(bRet) { + m_bAfterLast = m_bBeforeFirst = sal_False; // all false because we stand on a valid row m_aBookmark = bookmark; m_aCurrentRow = m_pCache->m_aMatrixIter; notifyAllListenersCursorMoved(); @@ -776,23 +777,24 @@ sal_Bool SAL_CALL ORowSetBase::first( ) throw(SQLException, RuntimeException) m_bAfterLast = m_bBeforeFirst = sal_False; // all false sal_Bool bMoved = sal_False; - if(!isFirst()) + if(!isFirst() || bWasNew) { notifyAllListenersCursorBeforeMove(); bMoved = sal_True; } sal_Bool bRet = m_pCache->first(); - if(bMoved && bRet) + if(bRet) { m_aBookmark = m_pCache->getBookmark(); m_aCurrentRow = m_pCache->m_aMatrixIter; - notifyAllListenersCursorMoved(); + if(bMoved) + notifyAllListenersCursorMoved(); firePropertyChange(aOldValues); } else { - m_bAfterLast = m_bBeforeFirst = sal_True; // all false + m_bAfterLast = m_bBeforeFirst = sal_True; // all true m_aCurrentRow = m_pCache->getEnd(); } fireRowcount(); @@ -821,22 +823,23 @@ sal_Bool SAL_CALL ORowSetBase::last( ) throw(SQLException, RuntimeException) m_bAfterLast = m_bBeforeFirst = sal_False; // all false sal_Bool bMoved = sal_False; - if(!isLast()) + if(!isLast() || bWasNew) { notifyAllListenersCursorBeforeMove(); bMoved = sal_True; } sal_Bool bRet = m_pCache->last(); - if(bMoved && bRet) + if(bRet) { m_aBookmark = m_pCache->getBookmark(); m_aCurrentRow = m_pCache->m_aMatrixIter; - notifyAllListenersCursorMoved(); + if(bMoved) + notifyAllListenersCursorMoved(); firePropertyChange(aOldValues); } else { - m_bAfterLast = m_bBeforeFirst = sal_True; // all false + m_bAfterLast = m_bBeforeFirst = sal_True; // all true m_aCurrentRow = m_pCache->getEnd(); } @@ -1089,7 +1092,7 @@ void ORowSetBase::firePropertyChange(const ORowSetMatrix::iterator& _rOldRow) } } } - catch(...) + catch(Exception&) { OSL_ENSHURE(0,"firePropertyChange: Exception"); } diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx index 612918011d42..6c537b59ba6d 100644 --- a/dbaccess/source/core/api/RowSetCache.cxx +++ b/dbaccess/source/core/api/RowSetCache.cxx @@ -2,9 +2,9 @@ * * $RCSfile: RowSetCache.cxx,v $ * - * $Revision: 1.13 $ + * $Revision: 1.14 $ * - * last change: $Author: oj $ $Date: 2000-11-14 13:28:20 $ + * last change: $Author: oj $ $Date: 2000-11-15 15:57:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -104,6 +104,9 @@ #ifndef _DBHELPER_DBEXCEPTION_HXX_ #include #endif +#ifndef _COMPHELPER_PROPERTY_HXX_ +#include +#endif using namespace dbaccess; using namespace dbtools; @@ -210,10 +213,14 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, else { if(!bAllKeysFound || (xProp->getPropertySetInfo()->hasPropertyByName(PROPERTY_RESULTSETTYPE) && - comphelper::getINT32(xProp->getPropertyValue(PROPERTY_RESULTSETTYPE)) == ResultSetType::FORWARD_ONLY)) + comphelper::getINT32(xProp->getPropertyValue(PROPERTY_RESULTSETTYPE)) == ResultSetType::FORWARD_ONLY) || + !(comphelper::hasProperty(PROPERTY_CANUPDATEINSERTEDROWS,xProp) && any2bool(xProp->getPropertyValue(PROPERTY_CANUPDATEINSERTEDROWS)))) { m_pCacheSet = new OStaticSet(_xRs); - m_nPrivileges = Privilege::SELECT; + if(bAllKeysFound) + m_nPrivileges |= Privilege::INSERT | Privilege::DELETE | Privilege::UPDATE; + else + m_nPrivileges = Privilege::SELECT; } else { @@ -810,7 +817,7 @@ sal_Bool SAL_CALL ORowSetCache::isFirst( ) throw(SQLException, RuntimeException // ------------------------------------------------------------------------- sal_Bool SAL_CALL ORowSetCache::isLast( ) throw(SQLException, RuntimeException) { - return m_bRowCountFinal ? m_bLast : m_pCacheSet->isLast(); + return m_bRowCountFinal ? (m_nPosition==m_nRowCount) : m_pCacheSet->isLast(); } // ------------------------------------------------------------------------- void SAL_CALL ORowSetCache::beforeFirst( ) throw(SQLException, RuntimeException) @@ -1489,6 +1496,9 @@ void SAL_CALL ORowSetCache::clearWarnings( ) throw(SQLException, RuntimeExcepti /*------------------------------------------------------------------------ $Log: not supported by cvs2svn $ + Revision 1.13 2000/11/14 13:28:20 oj + change for rowset when getRow returns 0 + Revision 1.12 2000/11/10 16:05:41 oj check for afterlast and before first diff --git a/dbaccess/source/core/api/StaticSet.cxx b/dbaccess/source/core/api/StaticSet.cxx index 91e3c6c9a44f..6556fd6cbb79 100644 --- a/dbaccess/source/core/api/StaticSet.cxx +++ b/dbaccess/source/core/api/StaticSet.cxx @@ -2,9 +2,9 @@ * * $RCSfile: StaticSet.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: oj $ $Date: 2000-11-14 13:28:20 $ + * last change: $Author: oj $ $Date: 2000-11-15 15:57:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -105,18 +105,20 @@ void OStaticSet::fillValueRow(ORowSetRow& _rRow,sal_Int32 _nPosition) // ::com::sun::star::sdbcx::XRowLocate Any SAL_CALL OStaticSet::getBookmark( const ORowSetRow& _rRow ) throw(SQLException, RuntimeException) { - return makeAny((sal_Int32)getRow()); + return makeAny(sal_Int32(getRow()-1)); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OStaticSet::moveToBookmark( const Any& bookmark ) throw(SQLException, RuntimeException) { m_aSetIter = m_aSet.begin() + getINT32(bookmark); + OSL_ENSHURE((m_aSet.size() - (m_aSet.end() - m_aSetIter)) >= 0,"Current row is not valid!"); return m_aSetIter != m_aSet.end(); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OStaticSet::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) throw(SQLException, RuntimeException) { - m_aSetIter = m_aSet.begin() + getINT32(bookmark) + rows - 1; + m_aSetIter = m_aSet.begin() + getINT32(bookmark) + rows; + OSL_ENSHURE((m_aSet.size() - (m_aSet.end() - m_aSetIter)) >= 0,"Current row is not valid!"); return m_aSetIter != m_aSet.end(); } // ------------------------------------------------------------------------- @@ -141,7 +143,7 @@ sal_Int32 SAL_CALL OStaticSet::hashBookmark( const Any& bookmark ) throw(SQLExce sal_Bool OStaticSet::fetchRow() { sal_Bool bRet; - if(bRet = m_xDriverSet->next()) + if(!m_bEnd && (bRet = m_xDriverSet->next())) { m_aSet.push_back(new connectivity::ORowVector< ORowSetValue >(m_xSetMetaData->getColumnCount())); m_aSetIter = m_aSet.end() - 1; @@ -161,6 +163,7 @@ void OStaticSet::fillAllRows() { ORowSetRow pRow = new connectivity::ORowVector< ORowSetValue >(m_xSetMetaData->getColumnCount()); m_aSet.push_back(pRow); + m_aSetIter = m_aSet.end() - 1; (*pRow)[0] = (sal_Int32)(m_aSet.size() -1); OCacheSet::fillValueRow(pRow,(*pRow)[0]); } @@ -178,26 +181,27 @@ sal_Bool SAL_CALL OStaticSet::next( ) throw(SQLException, RuntimeException) if(m_bBeforeFirst) { if(fetchRow()) - m_bBeforeFirst = sal_False; + m_bBeforeFirst = sal_False;// just when the first next failed } else { ++m_aSetIter; - if(m_aSetIter == m_aSet.end()) - fetchRow(); + if(m_aSetIter == m_aSet.end() && !fetchRow()) + m_aSetIter = m_aSet.end(); } } else { if(m_bBeforeFirst) { - m_aSetIter = m_aSet.begin(); - m_bBeforeFirst = sal_False; + m_aSetIter = m_aSet.begin(); + m_bBeforeFirst = sal_False; } - else + else if(m_aSetIter != m_aSet.end()) ++m_aSetIter; } - + OSL_ENSHURE((m_aSet.size() - (m_aSet.end() - m_aSetIter)) >= 0,"Current row is not valid!"); + OSL_ENSHURE(m_aSetIter <= m_aSet.end(),"Iterator behind end()!"); return m_aSetIter != m_aSet.end(); } // ------------------------------------------------------------------------- @@ -225,6 +229,7 @@ void SAL_CALL OStaticSet::beforeFirst( ) throw(SQLException, RuntimeException) { m_bBeforeFirst = sal_True; m_aSetIter = m_aSet.end(); + OSL_ENSHURE((m_aSet.size() - (m_aSet.end() - m_aSetIter)) >= 0,"Current row is not valid!"); } // ------------------------------------------------------------------------- void SAL_CALL OStaticSet::afterLast( ) throw(SQLException, RuntimeException) @@ -232,14 +237,19 @@ void SAL_CALL OStaticSet::afterLast( ) throw(SQLException, RuntimeException) m_bBeforeFirst = sal_False; fillAllRows(); m_aSetIter = m_aSet.end(); + OSL_ENSHURE((m_aSet.size() - (m_aSet.end() - m_aSetIter)) >= 0,"Current row is not valid!"); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OStaticSet::first( ) throw(SQLException, RuntimeException) { m_bBeforeFirst = sal_False; m_aSetIter = m_aSet.begin(); - if(m_aSetIter == m_aSet.end()) - fetchRow(); + if(m_aSetIter == m_aSet.end() && !fetchRow()) + m_bBeforeFirst = sal_True; + + OSL_ENSHURE((m_aSet.size() - (m_aSet.end() - m_aSetIter)) >= 0,"Current row is not valid!"); + OSL_ENSHURE(m_aSetIter <= m_aSet.end(),"Iterator behind end()!"); + return m_aSetIter != m_aSet.end(); } // ------------------------------------------------------------------------- @@ -249,14 +259,22 @@ sal_Bool SAL_CALL OStaticSet::last( ) throw(SQLException, RuntimeException) fillAllRows(); if(m_aSet.size()) m_aSetIter = m_aSet.end()-1; - return m_aSetIter != m_aSet.end(); + + OSL_ENSHURE((m_aSet.size() - (m_aSet.end() - m_aSetIter)) >= 0,"Current row is not valid!"); + OSL_ENSHURE(m_aSetIter <= m_aSet.end(),"Iterator behind end()!"); + + return !(m_bBeforeFirst = (m_aSetIter == m_aSet.end())); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OStaticSet::getRow( ) throw(SQLException, RuntimeException) { if(isAfterLast()) - return m_aSet.size() - (m_aSet.end() - m_aSetIter); - return m_aSet.size() - (m_aSet.end() - m_aSetIter) + 1; + return m_aSet.size(); + if(isBeforeFirst()) + return 0; + sal_Int32 nPos = m_aSet.size() - (m_aSet.end() - m_aSetIter) +1; + OSL_ENSHURE(nPos >= 0,"RowPos is < 0"); + return nPos; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OStaticSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException) @@ -275,8 +293,9 @@ sal_Bool SAL_CALL OStaticSet::absolute( sal_Int32 row ) throw(SQLException, Runt else { m_aSetIter = m_aSet.end() + row; - if(m_aSetIter == m_aSet.begin()-1) - m_bBeforeFirst = sal_True; + if(m_bBeforeFirst = (m_aSetIter == m_aSet.begin()-1)) + m_aSetIter = m_aSet.end(); + } } @@ -287,13 +306,16 @@ sal_Bool SAL_CALL OStaticSet::absolute( sal_Int32 row ) throw(SQLException, Runt { if(!m_bEnd) { - for(sal_Int32 i=m_aSet.size();i < row;++i) - fetchRow(); + sal_Bool bNext = sal_True; + for(sal_Int32 i=m_aSet.size();i < row && bNext;++i) + bNext = fetchRow(); } - if(row > (m_aSet.size()+1)) // + 1 because it can be after the last one - m_aSetIter = m_aSet.end(); // check again + if(row > (m_aSet.size()+1)) // + 1 because it can be after the last one + m_aSetIter = m_aSet.end(); // check again else m_aSetIter = m_aSet.begin() + row -1; + + m_bBeforeFirst = !m_aSet.size(); } else m_aSetIter = m_aSet.begin() + row -1; @@ -301,6 +323,8 @@ sal_Bool SAL_CALL OStaticSet::absolute( sal_Int32 row ) throw(SQLException, Runt else throw SQLException(); + OSL_ENSHURE((m_aSet.size() - (m_aSet.end() - m_aSetIter)) >= 0,"Current row is not valid!"); + OSL_ENSHURE(m_aSetIter <= m_aSet.end(),"Iterator behind end()!"); return m_aSetIter != m_aSet.end(); } // ------------------------------------------------------------------------- @@ -316,12 +340,13 @@ sal_Bool SAL_CALL OStaticSet::previous( ) throw(SQLException, RuntimeException) return sal_False; if(m_aSetIter == m_aSet.begin()) { - m_aSetIter = m_aSet.end(); - m_bBeforeFirst = sal_True; + m_aSetIter = m_aSet.end(); + m_bBeforeFirst = sal_True; } else --m_aSetIter; + OSL_ENSHURE((m_aSet.size() - (m_aSet.end() - m_aSetIter)) >= 0,"Current row is not valid!"); return sal_True; } // ------------------------------------------------------------------------- @@ -361,7 +386,7 @@ void SAL_CALL OStaticSet::insertRow( const ORowSetRow& _rInsertRow,const connect { OCacheSet::insertRow( _rInsertRow,_xTable); if(m_bInserted) - m_aSet.push_back(new ORowVector< ORowSetValue >(*_rInsertRow)); // we don't where the new row is so we append it to the current rows + m_aSet.push_back(new ORowVector< ORowSetValue >(*_rInsertRow)); // we don't know where the new row is so we append it to the current rows } // ------------------------------------------------------------------------- void SAL_CALL OStaticSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrginalRow,const connectivity::OSQLTable& _xTable ) throw(SQLException, RuntimeException) @@ -392,6 +417,9 @@ void SAL_CALL OStaticSet::moveToCurrentRow( ) throw(SQLException, RuntimeExcept /*------------------------------------------------------------------------ $Log: not supported by cvs2svn $ + Revision 1.4 2000/11/14 13:28:20 oj + change for rowset when getRow returns 0 + Revision 1.3 2000/10/25 07:30:24 oj make strings unique for lib's diff --git a/dbaccess/source/core/api/makefile.mk b/dbaccess/source/core/api/makefile.mk index 565506550bbc..dcd143b926a2 100644 --- a/dbaccess/source/core/api/makefile.mk +++ b/dbaccess/source/core/api/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.3 $ +# $Revision: 1.4 $ # -# last change: $Author: oj $ $Date: 2000-10-25 07:30:24 $ +# last change: $Author: oj $ $Date: 2000-11-15 15:57:40 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -81,6 +81,7 @@ SLOFILES= \ $(SLO)$/CRowSetColumn.obj \ $(SLO)$/querycomposer.obj \ $(SLO)$/CIndex.obj \ + $(SLO)$/CIndexes.obj \ $(SLO)$/CIndexColumns.obj \ $(SLO)$/CKey.obj \ $(SLO)$/CKeys.obj \ diff --git a/dbaccess/source/core/api/table.cxx b/dbaccess/source/core/api/table.cxx index 1f9601a6513d..221c28cb4ff9 100644 --- a/dbaccess/source/core/api/table.cxx +++ b/dbaccess/source/core/api/table.cxx @@ -2,9 +2,9 @@ * * $RCSfile: table.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: oj $ $Date: 2000-11-14 13:28:20 $ + * last change: $Author: oj $ $Date: 2000-11-15 15:57:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -438,35 +438,46 @@ void ODBTable::refreshKeys() // ------------------------------------------------------------------------- void ODBTable::refreshIndexes() { - /* - Any aVal; - if(m_CatalogName.getLength()) - aVal <<= m_CatalogName; - ::std::vector< ::rtl::OUString> aVector; - // fill indexes - Reference< XResultSet > xResult = m_xMetaData->getIndexInfo(aVal, - m_SchemaName,m_Name,sal_False,sal_False); - - if(xResult.is()) + Reference xNames; + if(m_xTable.is()) { - Reference< XRow > xRow(xResult,UNO_QUERY); - ::rtl::OUString aName,aDot = ::rtl::OUString::createFromAscii("."); - while(xResult->next()) + Reference xIndexSup(m_xTable,UNO_QUERY); + xNames = xIndexSup->getIndexes(); + Sequence< ::rtl::OUString> aNames = xNames->getElementNames(); + const ::rtl::OUString* pBegin = aNames.getConstArray(); + const ::rtl::OUString* pEnd = pBegin + aNames.getLength(); + for(;pBegin != pEnd;++pBegin) + aVector.push_back(*pBegin); + } + else + { + Any aVal; + if(m_CatalogName.getLength()) + aVal <<= m_CatalogName; + + // fill indexes + Reference< XResultSet > xResult = m_xMetaData->getIndexInfo(aVal,m_SchemaName,m_Name,sal_False,sal_False); + + if(xResult.is()) { - aName = xRow->getString(5); - if(aName.getLength()) - aName += aDot; - aName += xRow->getString(6); - if(aName.getLength()) - aVector.push_back(aName); + Reference< XRow > xRow(xResult,UNO_QUERY); + ::rtl::OUString aName,aDot = ::rtl::OUString::createFromAscii("."); + while(xResult->next()) + { + aName = xRow->getString(5); + if(aName.getLength()) + aName += aDot; + aName += xRow->getString(6); + if(aName.getLength()) + aVector.push_back(aName); + } } } if(m_pIndexes) delete m_pIndexes; - m_pIndexes = new OIndexes(this,m_aMutex,aVector); - */ + m_pIndexes = new OIndexes(this,xNames,m_aMutex,aVector); } // ----------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODBTable::getName() throw(RuntimeException)