diff options
Diffstat (limited to 'dbaccess/source')
25 files changed, 311 insertions, 259 deletions
diff --git a/dbaccess/source/core/api/CRowSetColumn.cxx b/dbaccess/source/core/api/CRowSetColumn.cxx index 361e3bb0f847..323b92243e22 100644 --- a/dbaccess/source/core/api/CRowSetColumn.cxx +++ b/dbaccess/source/core/api/CRowSetColumn.cxx @@ -2,9 +2,9 @@ * * $RCSfile: CRowSetColumn.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: fs $ $Date: 2001-06-26 09:30:20 $ + * last change: $Author: oj $ $Date: 2001-08-24 06:25:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -233,31 +233,3 @@ Sequence< Type > ORowSetColumn::getTypes() throw (RuntimeException) return aTypes.getTypes(); } //-------------------------------------------------------------------------- -//Sequence< sal_Int8 > ORowSetColumn::getImplementationId() throw (RuntimeException) -//{ -// static OImplementationId * pId = 0; -// if (! pId) -// { -// MutexGuard aGuard( Mutex::getGlobalMutex() ); -// if (! pId) -// { -// static OImplementationId aId; -// pId = &aId; -// } -// } -// return pId->getImplementationId(); -//} -// ------------------------------------------------------------------------- -void ORowSetColumn::fireValueChange(const ::com::sun::star::uno::Any& _rOldValue) -{ - sal_Int32 nHandle = PROPERTY_ID_VALUE; - Any aVal; - - getFastPropertyValue(aVal,PROPERTY_ID_VALUE); - if(!::comphelper::compare(aVal,_rOldValue)) - { - m_aOldValue = _rOldValue; - - fire(&nHandle, &aVal, &_rOldValue, 1, sal_False ); - } -} diff --git a/dbaccess/source/core/api/CRowSetColumn.hxx b/dbaccess/source/core/api/CRowSetColumn.hxx index 9441008e9b3d..a7d239c3813e 100644 --- a/dbaccess/source/core/api/CRowSetColumn.hxx +++ b/dbaccess/source/core/api/CRowSetColumn.hxx @@ -2,9 +2,9 @@ * * $RCSfile: CRowSetColumn.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: oj $ $Date: 2001-01-22 07:36:07 $ + * last change: $Author: oj $ $Date: 2001-08-24 06:25:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -115,7 +115,7 @@ namespace dbaccess // OColumn virtual OColumnSettings* getSettings() { return static_cast<ORowSetColumn*>(this); } - virtual void fireValueChange(const ::com::sun::star::uno::Any& _rOldValue); + // virtual void fireValueChange(const ::connectivity::ORowSetValue& _rOldValue); }; } diff --git a/dbaccess/source/core/api/CRowSetDataColumn.cxx b/dbaccess/source/core/api/CRowSetDataColumn.cxx index 77f3d40b66c0..0c8933ce4349 100644 --- a/dbaccess/source/core/api/CRowSetDataColumn.cxx +++ b/dbaccess/source/core/api/CRowSetDataColumn.cxx @@ -2,9 +2,9 @@ * * $RCSfile: CRowSetDataColumn.cxx,v $ * - * $Revision: 1.17 $ + * $Revision: 1.18 $ * - * last change: $Author: oj $ $Date: 2001-08-15 13:04:23 $ + * last change: $Author: oj $ $Date: 2001-08-24 06:25:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -251,17 +251,15 @@ Sequence< sal_Int8 > ORowSetDataColumn::getImplementationId() throw (RuntimeExce return pId->getImplementationId(); } // ------------------------------------------------------------------------- -void ORowSetDataColumn::fireValueChange(const ::com::sun::star::uno::Any& _rOldValue) +void ORowSetDataColumn::fireValueChange(const ORowSetValue& _rOldValue) { - sal_Int32 nHandle = PROPERTY_ID_VALUE; - Any aVal; - - getFastPropertyValue(aVal,PROPERTY_ID_VALUE); - if(!::comphelper::compare(aVal,_rOldValue)) + if(!((*(*m_aColumnValue))[m_nPos] == _rOldValue)) { - m_aOldValue = _rOldValue; + sal_Int32 nHandle = PROPERTY_ID_VALUE; + m_aOldValue = _rOldValue.makeAny(); + Any aNew = (*(*m_aColumnValue))[m_nPos].makeAny(); - fire(&nHandle, &aVal, &_rOldValue, 1, sal_False ); + fire(&nHandle, &aNew, &m_aOldValue, 1, sal_False ); } } diff --git a/dbaccess/source/core/api/CRowSetDataColumn.hxx b/dbaccess/source/core/api/CRowSetDataColumn.hxx index 893283e30d43..5833dc98ebae 100644 --- a/dbaccess/source/core/api/CRowSetDataColumn.hxx +++ b/dbaccess/source/core/api/CRowSetDataColumn.hxx @@ -2,9 +2,9 @@ * * $RCSfile: CRowSetDataColumn.hxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: oj $ $Date: 2001-05-02 12:47:51 $ + * last change: $Author: oj $ $Date: 2001-08-24 06:25:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -119,7 +119,7 @@ namespace dbaccess virtual OColumnSettings* getSettings() { return static_cast<ORowSetDataColumn*>(this); } - virtual void fireValueChange(const ::com::sun::star::uno::Any& _rOldValue); + virtual void fireValueChange(const ::connectivity::ORowSetValue& _rOldValue); }; // ------------------------------------------------------------------------- // typedef connectivity::ORefVector< ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> > diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index b18d23a836ba..40e29085704c 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.86 $ + * $Revision: 1.87 $ * - * last change: $Author: oj $ $Date: 2001-08-14 07:50:38 $ + * last change: $Author: oj $ $Date: 2001-08-24 06:25:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -738,7 +738,7 @@ void ORowSet::updateValue(sal_Int32 columnIndex,const ORowSetValue& x) checkUpdateConditions(columnIndex); checkUpdateIterator(); - Any aOldValue((*(*m_aCurrentRow))[columnIndex].makeAny()); + ::connectivity::ORowSetValue aOldValue((*(*m_aCurrentRow))[columnIndex]); m_pCache->updateValue(columnIndex,x); // we have to notify all listeners (*(*m_aCurrentRow))[columnIndex] = x; @@ -821,11 +821,11 @@ void SAL_CALL ORowSet::updateBinaryStream( sal_Int32 columnIndex, const Referenc checkUpdateConditions(columnIndex); checkUpdateIterator(); - Any aOldValue; + ::connectivity::ORowSetValue aOldValue; if((*(*m_aCurrentRow))[columnIndex].getTypeKind() == DataType::BLOB) { m_pCache->updateBinaryStream(columnIndex,x,length); - aOldValue = (*(*m_aCurrentRow))[columnIndex].makeAny(); + aOldValue = (*(*m_aCurrentRow))[columnIndex]; (*(*m_aCurrentRow))[columnIndex] = makeAny(x); } else @@ -834,7 +834,7 @@ void SAL_CALL ORowSet::updateBinaryStream( sal_Int32 columnIndex, const Referenc if(x.is()) x->readSomeBytes(aSeq,length); updateValue(columnIndex,aSeq); - aOldValue = (*(*m_aCurrentRow))[columnIndex].makeAny(); + aOldValue = (*(*m_aCurrentRow))[columnIndex]; (*(*m_aCurrentRow))[columnIndex] = aSeq; } @@ -852,7 +852,7 @@ void SAL_CALL ORowSet::updateCharacterStream( sal_Int32 columnIndex, const Refer checkUpdateIterator(); m_pCache->updateCharacterStream(columnIndex,x,length); - Any aOldValue((*(*m_aCurrentRow))[columnIndex].makeAny()); + ::connectivity::ORowSetValue aOldValue((*(*m_aCurrentRow))[columnIndex]); (*(*m_aCurrentRow))[columnIndex] = makeAny(x); firePropertyChange(columnIndex-1 ,aOldValue); fireProperty(PROPERTY_ID_ISMODIFIED,sal_True,sal_False); @@ -869,7 +869,7 @@ void SAL_CALL ORowSet::updateObject( sal_Int32 columnIndex, const Any& x ) throw if (!::dbtools::implUpdateObject(this, columnIndex, x)) { // there is no other updateXXX call which can handle the value in x - Any aOldValue((*(*m_aCurrentRow))[columnIndex].makeAny()); + ::connectivity::ORowSetValue aOldValue((*(*m_aCurrentRow))[columnIndex]); m_pCache->updateObject(columnIndex,x); // we have to notify all listeners (*(*m_aCurrentRow))[columnIndex] = x; @@ -886,7 +886,7 @@ void SAL_CALL ORowSet::updateNumericObject( sal_Int32 columnIndex, const Any& x, checkUpdateConditions(columnIndex); checkUpdateIterator(); - Any aOldValue((*(*m_aCurrentRow))[columnIndex].makeAny()); + ::connectivity::ORowSetValue aOldValue((*(*m_aCurrentRow))[columnIndex]); m_pCache->updateNumericObject(columnIndex,x,scale); // we have to notify all listeners (*(*m_aCurrentRow))[columnIndex] = x; @@ -2115,7 +2115,7 @@ void SAL_CALL ORowSet::clearParameters( ) throw(SQLException, RuntimeException) m_aParameterRow.clear(); } // ------------------------------------------------------------------------- -void ORowSet::firePropertyChange(sal_Int32 _nPos,const Any& _rOldValue) +void ORowSet::firePropertyChange(sal_Int32 _nPos,const ::connectivity::ORowSetValue& _rOldValue) { OSL_ENSURE(_nPos < m_aDataColumns.size(),"nPos is invalid!"); m_aDataColumns[_nPos]->fireValueChange(_rOldValue); diff --git a/dbaccess/source/core/api/RowSet.hxx b/dbaccess/source/core/api/RowSet.hxx index c01a9b620cf8..9b27dee6f490 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.26 $ + * $Revision: 1.27 $ * - * last change: $Author: fs $ $Date: 2001-08-06 11:01:19 $ + * last change: $Author: oj $ $Date: 2001-08-24 06:25:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -203,7 +203,7 @@ namespace dbaccess // fire a change for one column // _nPos starts at zero - void firePropertyChange(sal_Int32 _nPos,const ::com::sun::star::uno::Any& _rNewValue); + void firePropertyChange(sal_Int32 _nPos,const ::connectivity::ORowSetValue& _rNewValue); // inform the clones that we have deleted some records void notifyClonesRowDeleted(const ::com::sun::star::uno::Any& _rBookmark); // inform the clones that we will delete some records @@ -464,6 +464,9 @@ namespace dbaccess /*------------------------------------------------------------------------ $Log: not supported by cvs2svn $ + Revision 1.26 2001/08/06 11:01:19 fs + #87960# moved the listers from the base class herein / call the listers in :disposing() + Revision 1.25 2001/07/30 08:53:02 oj #90015# use ORowSetValue as const ref diff --git a/dbaccess/source/core/api/RowSetBase.cxx b/dbaccess/source/core/api/RowSetBase.cxx index d6caaa2e2b4e..0eec2fc9dc9b 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.47 $ + * $Revision: 1.48 $ * - * last change: $Author: oj $ $Date: 2001-08-14 07:50:38 $ + * last change: $Author: oj $ $Date: 2001-08-24 06:25:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -192,9 +192,9 @@ Sequence< Type > ORowSetBase::getTypes() throw (RuntimeException) //-------------------------------------------------------------------------- Any ORowSetBase::queryInterface( const Type & rType ) throw (RuntimeException) { - Any aRet = OPropertyContainer::queryInterface(rType); + Any aRet = ORowSetBase_BASE::queryInterface(rType); if(!aRet.hasValue()) - aRet = ORowSetBase_BASE::queryInterface(rType); + aRet = OPropertyContainer::queryInterface(rType); return aRet; } // ------------------------------------------------------------------------- @@ -264,8 +264,7 @@ const ORowSetValue& ORowSetBase::getValue(sal_Int32 columnIndex) if(m_aCurrentRow && m_aCurrentRow != m_pCache->getEnd()) return (*(*m_aCurrentRow))[m_nLastColumnIndex = columnIndex]; else - { - OSL_ENSURE(m_aCurrentRow && (m_bBeforeFirst || m_bAfterLast),"ORowSetBase::getValue: we don't stand on a valid row! Row is equal to end of matrix"); + { // currentrow is null when the clone move the window if(!m_aCurrentRow) { positionCache(); @@ -274,6 +273,7 @@ const ORowSetValue& ORowSetBase::getValue(sal_Int32 columnIndex) OSL_ENSURE(m_aCurrentRow,"ORowSetBase::getValue: we don't stand on a valid row! Row is null."); return getValue(columnIndex); } + OSL_ENSURE(m_aCurrentRow && (m_bBeforeFirst || m_bAfterLast),"ORowSetBase::getValue: we don't stand on a valid row! Row is equal to end of matrix"); } // we should normally never reach this here return m_aEmptyValue; @@ -925,6 +925,7 @@ void ORowSetBase::setCurrentRow(sal_Bool _bMoved,const ORowSetMatrix::iterator& m_aBookmark = m_pCache->getBookmark(); OSL_ENSURE(m_aBookmark.hasValue(),"Bookmark has no value!"); m_aCurrentRow = m_pCache->m_aMatrixIter; + OSL_ENSURE(m_aCurrentRow,"CurrentRow is null!"); m_aCurrentRow.setBookmark(m_aBookmark); OSL_ENSURE((*(*m_aCurrentRow))[0].makeAny().hasValue(),"Bookamrk has no value!"); @@ -1029,8 +1030,8 @@ void ORowSetBase::firePropertyChange(const ORowSetMatrix::iterator& _rOldRow) sal_Int32 i=0; try { - for(TDataColumns::iterator aIter = m_aDataColumns.begin();aIter != m_aDataColumns.begin();++aIter) - (*aIter)->fireValueChange(aRow.isValid() ? (*aRow)[i+1].makeAny() : Any()); + for(TDataColumns::iterator aIter = m_aDataColumns.begin();aIter != m_aDataColumns.end();++aIter) + (*aIter)->fireValueChange(aRow.isValid() ? (*aRow)[i+1] : ::connectivity::ORowSetValue()); } catch(Exception&) { @@ -1064,6 +1065,7 @@ void ORowSetBase::movementFailed() m_bAfterLast = m_pCache->isAfterLast(); m_aBookmark = Any(); m_aCurrentRow.setBookmark(m_aBookmark); + OSL_ENSURE(m_bBeforeFirst || m_bAfterLast,"BeforeFirst or AfterLast is wrong!"); } // ----------------------------------------------------------------------------- diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx index 42a8b96b1323..3801b9ffbccb 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.45 $ + * $Revision: 1.46 $ * - * last change: $Author: oj $ $Date: 2001-08-09 13:12:51 $ + * last change: $Author: oj $ $Date: 2001-08-24 06:25:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1177,10 +1177,12 @@ sal_Bool SAL_CALL ORowSetCache::last( ) throw(SQLException, RuntimeException) moveWindow(); // we have to repositioning because moveWindow can modify the cache m_pCacheSet->last(); - if(m_nPosition > m_nFetchSize) - m_aMatrixIter = m_pMatrix->end() -1; - else - m_aMatrixIter = m_pMatrix->begin() + m_nPosition - 1; +// if(m_nPosition > m_nFetchSize) +// m_aMatrixIter = m_pMatrix->end() -1; +// else +// m_aMatrixIter = m_pMatrix->begin() + m_nPosition - 1; + OSL_ENSURE(((m_nPosition - m_nStartPos) - 1) < (sal_Int32)m_pMatrix->size(),"Position is behind end()!"); + m_aMatrixIter = m_pMatrix->begin() + (m_nPosition - m_nStartPos) - 1; // if row == -1 that means it stands on the last } else { diff --git a/dbaccess/source/core/api/RowSetCache.hxx b/dbaccess/source/core/api/RowSetCache.hxx index 2daa04044e37..c4dc4fdaba02 100644 --- a/dbaccess/source/core/api/RowSetCache.hxx +++ b/dbaccess/source/core/api/RowSetCache.hxx @@ -2,9 +2,9 @@ * * $RCSfile: RowSetCache.hxx,v $ * - * $Revision: 1.14 $ + * $Revision: 1.15 $ * - * last change: $Author: oj $ $Date: 2001-08-09 13:12:51 $ + * last change: $Author: oj $ $Date: 2001-08-24 06:25:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -197,7 +197,7 @@ namespace dbaccess sal_Bool fillMatrix(sal_Int32 &_nNewStartPos,sal_Int32 _nNewEndPos); sal_Bool moveWindow(); - void firePropertyChange(sal_Int32 _nColumnIndex,const ::com::sun::star::uno::Any& _rOldValue); + void firePropertyChange(sal_Int32 _nColumnIndex,const ::connectivity::ORowSetValue& _rOldValue); void rotateCacheIterator(sal_Int16 _nDist); void updateValue(sal_Int32 columnIndex,const connectivity::ORowSetValue& x); @@ -331,6 +331,9 @@ namespace dbaccess /*------------------------------------------------------------------------ $Log: not supported by cvs2svn $ + Revision 1.14 2001/08/09 13:12:51 oj + #90801# clear insertrow after insert + Revision 1.13 2001/07/24 13:25:25 oj #89430# move ORowSetValue into dbtools diff --git a/dbaccess/source/core/api/column.cxx b/dbaccess/source/core/api/column.cxx index 964b9b0514d3..66c9c104e141 100644 --- a/dbaccess/source/core/api/column.cxx +++ b/dbaccess/source/core/api/column.cxx @@ -2,9 +2,9 @@ * * $RCSfile: column.cxx,v $ * - * $Revision: 1.29 $ + * $Revision: 1.30 $ * - * last change: $Author: oj $ $Date: 2001-08-15 13:04:23 $ + * last change: $Author: oj $ $Date: 2001-08-24 06:25:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -318,7 +318,7 @@ OColumnSettings* OColumn::getSettings() return NULL; } // ----------------------------------------------------------------------------- -void OColumn::fireValueChange(const ::com::sun::star::uno::Any& _rOldValue) +void OColumn::fireValueChange(const ::connectivity::ORowSetValue& _rOldValue) { } // ----------------------------------------------------------------------------- diff --git a/dbaccess/source/core/api/querycomposer.cxx b/dbaccess/source/core/api/querycomposer.cxx index 399a042b4744..c9a7b958b574 100644 --- a/dbaccess/source/core/api/querycomposer.cxx +++ b/dbaccess/source/core/api/querycomposer.cxx @@ -2,9 +2,9 @@ * * $RCSfile: querycomposer.cxx,v $ * - * $Revision: 1.39 $ + * $Revision: 1.40 $ * - * last change: $Author: oj $ $Date: 2001-08-14 14:20:13 $ + * last change: $Author: oj $ $Date: 2001-08-24 06:25:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -268,6 +268,7 @@ OQueryComposer::OQueryComposer(const Reference< XNameAccess>& _xTableSupplier, const Reference< XMultiServiceFactory >& _xServiceFactory) : OSubComponent(m_aMutex,_xConnection) , m_xConnection(_xConnection) + , m_xMetaData(_xConnection->getMetaData()) , m_pSqlParseNode(NULL) , m_aSqlIterator(_xTableSupplier,_xConnection->getMetaData(),NULL) , m_xTableSupplier(_xTableSupplier) @@ -412,20 +413,20 @@ void SAL_CALL OQueryComposer::setQuery( const ::rtl::OUString& command ) throw(S } m_aWorkSql = STR_SELECT; - m_pSqlParseNode->getChild(1)->parseNodeToStr(m_aWorkSql,m_xConnection->getMetaData()); - m_pSqlParseNode->getChild(2)->parseNodeToStr(m_aWorkSql,m_xConnection->getMetaData()); + m_pSqlParseNode->getChild(1)->parseNodeToStr(m_aWorkSql,m_xMetaData); + m_pSqlParseNode->getChild(2)->parseNodeToStr(m_aWorkSql,m_xMetaData); m_aWorkSql += STR_FROM; - m_pSqlParseNode->getChild(3)->getChild(0)->getChild(1)->parseNodeToStr(m_aWorkSql,m_xConnection->getMetaData()); + m_pSqlParseNode->getChild(3)->getChild(0)->getChild(1)->parseNodeToStr(m_aWorkSql,m_xMetaData); m_aFilter = m_aOrgFilter = m_aOrgOrder = m_aOrder = ::rtl::OUString(); const OSQLParseNode* pWhereNode = m_aSqlIterator.getWhereTree(); if(pWhereNode) - pWhereNode->getChild(1)->parseNodeToStr(m_aOrgFilter,m_xConnection->getMetaData()); + pWhereNode->getChild(1)->parseNodeToStr(m_aOrgFilter,m_xMetaData); const OSQLParseNode* pOrderNode = m_aSqlIterator.getOrderTree(); if(pOrderNode) // parse without "ORDER BY" - pOrderNode->getChild(2)->parseNodeToStr(m_aOrgOrder,m_xConnection->getMetaData()); + pOrderNode->getChild(2)->parseNodeToStr(m_aOrgOrder,m_xMetaData); // first clear the tables and columns clearCurrentCollections(); @@ -445,7 +446,7 @@ void SAL_CALL OQueryComposer::setQuery( const ::rtl::OUString& command ) throw(S Reference<XResultSetMetaData> xMeta = xResMetaDataSup->getMetaData(); sal_Int32 nCount = xMeta.is() ? xMeta->getColumnCount() : sal_Int32(0); - ::comphelper::UStringMixEqual bCase(m_xConnection->getMetaData()->storesMixedCaseQuotedIdentifiers()); + ::comphelper::UStringMixEqual bCase(m_xMetaData->storesMixedCaseQuotedIdentifiers()); for(sal_Int32 i=1;i<=nCount;++i) { ::rtl::OUString sName = xMeta->getColumnName(i); @@ -465,7 +466,7 @@ void SAL_CALL OQueryComposer::setQuery( const ::rtl::OUString& command ) throw(S Reference<XPropertySet> xProp(*aFind2,UNO_QUERY); if(xProp.is() && xProp->getPropertySetInfo()->hasPropertyByName(PROPERTY_REALNAME)) { - ::connectivity::parse::OParseColumn* pColumn = new ::connectivity::parse::OParseColumn(xProp,m_xConnection->getMetaData()->storesMixedCaseQuotedIdentifiers()); + ::connectivity::parse::OParseColumn* pColumn = new ::connectivity::parse::OParseColumn(xProp,m_xMetaData->storesMixedCaseQuotedIdentifiers()); pColumn->setName(sName); pColumn->setRealName(::comphelper::getString(xProp->getPropertyValue(PROPERTY_REALNAME))); pColumn->setTableName(::comphelper::getString(xProp->getPropertyValue(PROPERTY_TABLENAME))); @@ -482,7 +483,7 @@ void SAL_CALL OQueryComposer::setQuery( const ::rtl::OUString& command ) throw(S for(OSQLColumns::const_iterator aIter = aCols->begin(); aIter != aCols->end();++aIter) aNames.push_back(getString((*aIter)->getPropertyValue(PROPERTY_NAME))); } - m_pColumns = new OPrivateColumns(aCols,m_xConnection->getMetaData()->storesMixedCaseQuotedIdentifiers(),*this,m_aMutex,aNames); + m_pColumns = new OPrivateColumns(aCols,m_xMetaData->storesMixedCaseQuotedIdentifiers(),*this,m_aMutex,aNames); getTables(); getParameters(); @@ -496,7 +497,7 @@ void SAL_CALL OQueryComposer::setQuery( const ::rtl::OUString& command ) throw(S ::rtl::OUString aResult; if (m_pSqlParseNode) - m_pSqlParseNode->parseNodeToStr(aResult,m_xConnection->getMetaData()); + m_pSqlParseNode->parseNodeToStr(aResult,m_xMetaData); else aResult = getQuery(); return aResult; @@ -609,7 +610,7 @@ void SAL_CALL OQueryComposer::appendFilterByColumn( const Reference< XPropertySe column->getPropertyValue(PROPERTY_VALUE) >>= aValue; ::rtl::OUString aSql; - ::rtl::OUString aQuote = m_xConnection->getMetaData()->getIdentifierQuoteString(); + ::rtl::OUString aQuote = m_xMetaData->getIdentifierQuoteString(); if(m_pColumns->hasByName(aName)) { Reference<XPropertySet> xColumn; @@ -623,8 +624,8 @@ void SAL_CALL OQueryComposer::appendFilterByColumn( const Reference< XPropertySe if(sTableName.indexOf('.',0) != -1) { ::rtl::OUString aCatlog,aSchema,aTable; - ::dbtools::qualifiedNameComponents(m_xConnection->getMetaData(),sTableName,aCatlog,aSchema,aTable); - ::dbtools::composeTableName(m_xConnection->getMetaData(),aCatlog,aSchema,aTable,sTableName,sal_True); + ::dbtools::qualifiedNameComponents(m_xMetaData,sTableName,aCatlog,aSchema,aTable); + ::dbtools::composeTableName(m_xMetaData,aCatlog,aSchema,aTable,sTableName,sal_True); } else sTableName = ::dbtools::quoteName(aQuote,sTableName); @@ -721,13 +722,13 @@ void SAL_CALL OQueryComposer::appendOrderByColumn( const Reference< XPropertySet ::rtl::OUString aName,aAppendOrder; column->getPropertyValue(PROPERTY_NAME) >>= aName; - if(!m_xConnection->getMetaData()->supportsOrderByUnrelated() && !m_pColumns->hasByName(aName)) + if(!m_xMetaData->supportsOrderByUnrelated() && !m_pColumns->hasByName(aName)) throw SQLException(::rtl::OUString::createFromAscii("Column not in select clause!"),*this,::rtl::OUString::createFromAscii("HY000"),1000,Any()); // filter anhaengen // select ohne where und order by aufbauen ::rtl::OUString aSql(m_aWorkSql); - ::rtl::OUString aQuote = m_xConnection->getMetaData()->getIdentifierQuoteString(); + ::rtl::OUString aQuote = m_xMetaData->getIdentifierQuoteString(); if(m_pColumns->hasByName(aName)) { Reference<XPropertySet> xColumn; @@ -741,8 +742,8 @@ void SAL_CALL OQueryComposer::appendOrderByColumn( const Reference< XPropertySet if(sTableName.indexOf('.',0) != -1) { ::rtl::OUString aCatlog,aSchema,aTable; - ::dbtools::qualifiedNameComponents(m_xConnection->getMetaData(),sTableName,aCatlog,aSchema,aTable); - ::dbtools::composeTableName(m_xConnection->getMetaData(),aCatlog,aSchema,aTable,sTableName,sal_True); + ::dbtools::qualifiedNameComponents(m_xMetaData,sTableName,aCatlog,aSchema,aTable); + ::dbtools::composeTableName(m_xMetaData,aCatlog,aSchema,aTable,sTableName,sal_True); } else sTableName = ::dbtools::quoteName(aQuote,sTableName); @@ -814,7 +815,7 @@ Reference< XNameAccess > SAL_CALL OQueryComposer::getTables( ) throw(RuntimeExc for(OSQLTables::const_iterator aIter = aTables.begin(); aIter != aTables.end();++aIter) aNames.push_back(aIter->first); - m_pTables = new OPrivateTables(aTables,m_xConnection->getMetaData()->storesMixedCaseQuotedIdentifiers(),*this,m_aMutex,aNames); + m_pTables = new OPrivateTables(aTables,m_xMetaData->storesMixedCaseQuotedIdentifiers(),*this,m_aMutex,aNames); } return m_pTables; @@ -900,10 +901,10 @@ sal_Bool OQueryComposer::setANDCriteria(OSQLParseNode * pCondition, ::rtl::OUString aColumnName; - // pCondition->parseNodeToStr(aValue,m_xConnection->getMetaData(), xFormatter, m_aLocale,m_sDecimalSep.toChar()); - pCondition->parseNodeToStr(aValue,m_xConnection->getMetaData(),NULL); - // pCondition->getChild(0)->parseNodeToStr(aColumnName,m_xConnection->getMetaData(), xFormatter, m_aLocale,m_sDecimalSep.toChar()); - pCondition->getChild(0)->parseNodeToStr(aColumnName,m_xConnection->getMetaData(), NULL); + // pCondition->parseNodeToStr(aValue,m_xMetaData, xFormatter, m_aLocale,m_sDecimalSep.toChar()); + pCondition->parseNodeToStr(aValue,m_xMetaData,NULL); + // pCondition->getChild(0)->parseNodeToStr(aColumnName,m_xMetaData, xFormatter, m_aLocale,m_sDecimalSep.toChar()); + pCondition->getChild(0)->parseNodeToStr(aColumnName,m_xMetaData, NULL); // don't display the column name aValue = aValue.copy(aColumnName.getLength()); @@ -1002,7 +1003,7 @@ sal_Bool OQueryComposer::setComparsionPredicate(OSQLParseNode * pCondition, // go forward for (;i < pCondition->count();i++) - pCondition->getChild(i)->parseNodeToPredicateStr(aValue,m_xConnection->getMetaData(), xFormatter, m_aLocale,m_sDecimalSep.toChar()); + pCondition->getChild(i)->parseNodeToPredicateStr(aValue,m_xMetaData, xFormatter, m_aLocale,m_sDecimalSep.toChar()); } else if (SQL_ISRULE(pCondition->getChild(pCondition->count()-1), column_ref)) { @@ -1044,7 +1045,7 @@ sal_Bool OQueryComposer::setComparsionPredicate(OSQLParseNode * pCondition, // go backward for (; i >= 0; i--) - pCondition->getChild(i)->parseNodeToPredicateStr(aValue,m_xConnection->getMetaData(), xFormatter, m_aLocale,m_sDecimalSep.toChar()); + pCondition->getChild(i)->parseNodeToPredicateStr(aValue,m_xMetaData, xFormatter, m_aLocale,m_sDecimalSep.toChar()); } else return sal_False; @@ -1060,8 +1061,8 @@ sal_Bool OQueryComposer::setComparsionPredicate(OSQLParseNode * pCondition, ::rtl::OUString aValue; ::rtl::OUString aColumnName; - pCondition->parseNodeToPredicateStr(aValue,m_xConnection->getMetaData(), xFormatter, m_aLocale,m_sDecimalSep.toChar()); - pCondition->getChild(0)->parseNodeToPredicateStr(aColumnName,m_xConnection->getMetaData(), xFormatter, m_aLocale,m_sDecimalSep.toChar()); + pCondition->parseNodeToPredicateStr(aValue,m_xMetaData, xFormatter, m_aLocale,m_sDecimalSep.toChar()); + pCondition->getChild(0)->parseNodeToPredicateStr(aColumnName,m_xMetaData, xFormatter, m_aLocale,m_sDecimalSep.toChar()); // don't display the column name aValue = aValue.copy(aColumnName.getLength()); @@ -1083,13 +1084,13 @@ sal_Bool OQueryComposer::setComparsionPredicate(OSQLParseNode * pCondition, // Feldnamen sal_uInt16 i; for (i=0;i< pLhs->count();i++) - pCondition->getChild(i)->parseNodeToPredicateStr(aName,m_xConnection->getMetaData(), xFormatter, m_aLocale,m_sDecimalSep.toChar()); + pCondition->getChild(i)->parseNodeToPredicateStr(aName,m_xMetaData, xFormatter, m_aLocale,m_sDecimalSep.toChar()); // Kriterium aItem.Handle = pCondition->getChild(1)->getNodeType(); aValue = pCondition->getChild(1)->getTokenValue(); for(i=0;i< pRhs->count();i++) - pCondition->getChild(i)->parseNodeToPredicateStr(aValue,m_xConnection->getMetaData(), xFormatter, m_aLocale,m_sDecimalSep.toChar()); + pCondition->getChild(i)->parseNodeToPredicateStr(aValue,m_xMetaData, xFormatter, m_aLocale,m_sDecimalSep.toChar()); aItem.Name = aName; aItem.Value <<= aValue; @@ -1147,11 +1148,11 @@ void OQueryComposer::resetIterator(const ::rtl::OUString& aSql) ::rtl::OUString aResult; const OSQLParseNode* pGroupBy = m_aSqlIterator.getGroupByTree(); if(pGroupBy) - pGroupBy->parseNodeToStr(aResult,m_xConnection->getMetaData()); + pGroupBy->parseNodeToStr(aResult,m_xMetaData); const OSQLParseNode* pHaving = m_aSqlIterator.getHavingTree(); if(pHaving) - pHaving->parseNodeToStr(aResult,m_xConnection->getMetaData()); + pHaving->parseNodeToStr(aResult,m_xMetaData); return aResult; } // ----------------------------------------------------------------------------- @@ -1190,7 +1191,7 @@ void OQueryComposer::resetIterator(const ::rtl::OUString& aSql) } else { - ::dbtools::composeTableName(m_xConnection->getMetaData(),aCatalog,aSchema,aTable,aComposedName,sal_False); + ::dbtools::composeTableName(m_xMetaData,aCatalog,aSchema,aTable,aComposedName,sal_False); // first check if this is the table we want to or has it a tablealias @@ -1221,7 +1222,7 @@ void OQueryComposer::resetIterator(const ::rtl::OUString& aSql) } if(pBegin != pEnd) { - ::dbtools::composeTableName(m_xConnection->getMetaData(),aCatalog,aSchema,aTable,sReturn,sal_True); + ::dbtools::composeTableName(m_xMetaData,aCatalog,aSchema,aTable,sReturn,sal_True); sReturn += ::rtl::OUString::createFromAscii("."); } } @@ -1237,7 +1238,7 @@ Reference< XIndexAccess > SAL_CALL OQueryComposer::getParameters( ) throw(Runti ::std::vector< ::rtl::OUString> aNames; for(OSQLColumns::const_iterator aIter = aCols->begin(); aIter != aCols->end();++aIter) aNames.push_back(getString((*aIter)->getPropertyValue(PROPERTY_NAME))); - m_pParameters = new OPrivateColumns(aCols,m_xConnection->getMetaData()->storesMixedCaseQuotedIdentifiers(),*this,m_aMutex,aNames); + m_pParameters = new OPrivateColumns(aCols,m_xMetaData->storesMixedCaseQuotedIdentifiers(),*this,m_aMutex,aNames); } return m_pParameters; diff --git a/dbaccess/source/core/api/tablecontainer.cxx b/dbaccess/source/core/api/tablecontainer.cxx index f3164c148c2c..3e3b43d56496 100644 --- a/dbaccess/source/core/api/tablecontainer.cxx +++ b/dbaccess/source/core/api/tablecontainer.cxx @@ -2,9 +2,9 @@ * * $RCSfile: tablecontainer.cxx,v $ * - * $Revision: 1.32 $ + * $Revision: 1.33 $ * - * last change: $Author: oj $ $Date: 2001-08-14 07:50:38 $ + * last change: $Author: oj $ $Date: 2001-08-24 06:25:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -476,13 +476,6 @@ Reference< XNamed > OTableContainer::createObject(const ::rtl::OUString& _rName) m_xMasterTables->getByName(_rName) >>= xProp; Reference<XColumnsSupplier > xSup(xProp,UNO_QUERY); - ::rtl::OUString sCatalog,sSchema,sTable; - ::dbtools::qualifiedNameComponents(m_xMetaData, - _rName, - sCatalog, - sSchema, - sTable); - OConfigurationNode aTableConfig; if(m_aTablesConfig.isValid()) { @@ -499,6 +492,12 @@ Reference< XNamed > OTableContainer::createObject(const ::rtl::OUString& _rName) return new ODBTableDecorator(aTableConfig,m_xMetaData,xSup); else { + ::rtl::OUString sCatalog,sSchema,sTable; + ::dbtools::qualifiedNameComponents(m_xMetaData, + _rName, + sCatalog, + sSchema, + sTable); Any aCatalog; if(sCatalog.getLength()) aCatalog <<= sCatalog; diff --git a/dbaccess/source/core/dataaccess/connection.cxx b/dbaccess/source/core/dataaccess/connection.cxx index 13c2908e900f..dda90cc37441 100644 --- a/dbaccess/source/core/dataaccess/connection.cxx +++ b/dbaccess/source/core/dataaccess/connection.cxx @@ -2,9 +2,9 @@ * * $RCSfile: connection.cxx,v $ * - * $Revision: 1.19 $ + * $Revision: 1.20 $ * - * last change: $Author: oj $ $Date: 2001-07-19 10:01:25 $ + * last change: $Author: oj $ $Date: 2001-08-24 06:28:16 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -649,11 +649,14 @@ Reference< XNameAccess > OConnection::getTables() throw( RuntimeException ) { // check if out "master connection" can supply tables Reference< XDriverAccess> xManager(m_xORB->createInstance(SERVICE_SDBC_DRIVERMANAGER), UNO_QUERY); - Reference< XDataDefinitionSupplier > xSupp(xManager->getDriverByURL(m_xMasterConnection->getMetaData()->getURL()),UNO_QUERY); + Reference< XDriver > xDriver = xManager->getDriverByURL(m_xMasterConnection->getMetaData()->getURL()); + OSL_ENSURE(xDriver.is(),"NO driver found for url already connected to!"); + Reference< XDataDefinitionSupplier > xSupp(xDriver,UNO_QUERY); Reference< XTablesSupplier > xMasterTables; if(xSupp.is()) xMasterTables = xSupp->getDataDefinitionByConnection(m_xMasterConnection); + if (xMasterTables.is() && xMasterTables->getTables().is()) { // yes -> wrap them m_pTables->construct(xMasterTables->getTables(),m_aTableFilter, m_aTableTypeFilter); diff --git a/dbaccess/source/core/inc/column.hxx b/dbaccess/source/core/inc/column.hxx index 8ea514d1b634..767c7b81346c 100644 --- a/dbaccess/source/core/inc/column.hxx +++ b/dbaccess/source/core/inc/column.hxx @@ -2,9 +2,9 @@ * * $RCSfile: column.hxx,v $ * - * $Revision: 1.13 $ + * $Revision: 1.14 $ * - * last change: $Author: fs $ $Date: 2001-07-19 11:42:36 $ + * last change: $Author: oj $ $Date: 2001-08-24 06:28:17 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -128,6 +128,9 @@ #ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ #include <connectivity/sdbcx/VCollection.hxx> #endif +#ifndef _CONNECTIVITY_FILE_VALUE_HXX_ +#include <connectivity/FValue.hxx> +#endif #ifndef _UNOTOOLS_CONFIGNODE_HXX_ #include <unotools/confignode.hxx> #endif @@ -213,7 +216,7 @@ namespace dbaccess @see OColumns::loadSettings */ virtual OColumnSettings* getSettings(); - virtual void fireValueChange(const ::com::sun::star::uno::Any& _rOldValue); + virtual void fireValueChange(const ::connectivity::ORowSetValue& _rOldValue); }; //************************************************************ diff --git a/dbaccess/source/core/inc/querycomposer.hxx b/dbaccess/source/core/inc/querycomposer.hxx index 6c8e54128539..a26da024cce9 100644 --- a/dbaccess/source/core/inc/querycomposer.hxx +++ b/dbaccess/source/core/inc/querycomposer.hxx @@ -2,9 +2,9 @@ * * $RCSfile: querycomposer.hxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: oj $ $Date: 2001-08-14 14:20:13 $ + * last change: $Author: oj $ $Date: 2001-08-24 06:28:17 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -129,6 +129,7 @@ namespace dbaccess ::std::vector<OPrivateTables*> m_aTablesCollection; ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> m_xConnection; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> m_xMetaData; ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> m_xTableSupplier; ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > m_xNumberFormatsSupplier; ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> m_xColumns; diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx index 76b3bd0ee867..5190dd225701 100644 --- a/dbaccess/source/ui/browser/brwctrlr.cxx +++ b/dbaccess/source/ui/browser/brwctrlr.cxx @@ -2,9 +2,9 @@ * * $RCSfile: brwctrlr.cxx,v $ * - * $Revision: 1.50 $ + * $Revision: 1.51 $ * - * last change: $Author: fs $ $Date: 2001-08-23 14:41:10 $ + * last change: $Author: oj $ $Date: 2001-08-24 06:31:34 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -502,19 +502,23 @@ Sequence< sal_Int8 > SAL_CALL SbaXDataBrowserController::getImplementationId( ) Any SAL_CALL SbaXDataBrowserController::queryInterface(const Type& _rType) throw (RuntimeException) { // check for our additional interfaces - Any aRet = SbaXDataBrowserController_Base::queryInterface(_rType); + Any aRet = OGenericUnoController::queryInterface(_rType); // check for the base controllers interfaces if (!aRet.hasValue()) - aRet = OGenericUnoController::queryInterface(_rType); + { + aRet = SbaXDataBrowserController_Base::queryInterface(_rType); - // check for our aggregate (implementing the XFormController) - if (!aRet.hasValue()) - aRet = m_xFormControllerImpl->queryAggregation(_rType); + // check for our aggregate (implementing the XFormController) + if (!aRet.hasValue()) + { + aRet = m_xFormControllerImpl->queryAggregation(_rType); - // check for the property set interfaces - if (!aRet.hasValue()) - aRet = OPropertySetHelper::queryInterface(_rType); + // check for the property set interfaces + if (!aRet.hasValue()) + aRet = OPropertySetHelper::queryInterface(_rType); + } + } // no more to offer return aRet; @@ -2459,8 +2463,8 @@ sal_Bool SbaXDataBrowserController::isValidCursor() const Reference< ::com::sun::star::sdbcx::XColumnsSupplier > xSupplyCols(m_xRowSet, UNO_QUERY); if (!xSupplyCols.is()) return sal_False; - Reference< ::com::sun::star::container::XIndexAccess > xCols(xSupplyCols->getColumns(), UNO_QUERY); - if (!xCols.is() || (xCols->getCount() == 0)) + Reference< ::com::sun::star::container::XNameAccess > xCols = xSupplyCols->getColumns(); + if (!xCols.is() || !xCols->hasElements()) return sal_False; Reference<XPropertySet> xProp(m_xRowSet,UNO_QUERY); diff --git a/dbaccess/source/ui/browser/dsbrowserDnD.cxx b/dbaccess/source/ui/browser/dsbrowserDnD.cxx index 6d688b0b1f36..c92ee7a7bea7 100644 --- a/dbaccess/source/ui/browser/dsbrowserDnD.cxx +++ b/dbaccess/source/ui/browser/dsbrowserDnD.cxx @@ -2,9 +2,9 @@ * * $RCSfile: dsbrowserDnD.cxx,v $ * - * $Revision: 1.25 $ + * $Revision: 1.26 $ * - * last change: $Author: oj $ $Date: 2001-07-30 06:20:24 $ + * last change: $Author: oj $ $Date: 2001-08-24 06:31:34 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -843,6 +843,12 @@ namespace dbaui // now create,fill and execute the prepared statement Reference< XPreparedStatement > xPrep(_xMetaData->getConnection()->prepareStatement(aSql)); Reference< XParameters > xParameter(xPrep,UNO_QUERY); + ::std::vector<sal_Int32> aColumnTypes; + aColumnTypes.reserve(nCount+1); + aColumnTypes.push_back(-1); // just to avoid a everytime i-1 call + for(sal_Int32 k=1;k <= nCount;++k) + aColumnTypes.push_back(xMeta->getColumnType(k)); + sal_Int32 nRowCount = 0; while(xSrcRs->next()) @@ -859,8 +865,7 @@ namespace dbaui xParameter->setInt(1,nRowCount); continue; } - sal_Int32 nType = xMeta->getColumnType(i); - switch(nType) + switch(aColumnTypes[i]) { case DataType::CHAR: case DataType::VARCHAR: @@ -915,7 +920,7 @@ namespace dbaui OSL_ENSURE(0,"Unknown type"); } if(xRow->wasNull()) - xParameter->setNull(nPos,nType); + xParameter->setNull(nPos,aColumnTypes[i]); } xPrep->executeUpdate(); } @@ -1086,6 +1091,9 @@ namespace dbaui /************************************************************************* * history: * $Log: not supported by cvs2svn $ + * Revision 1.25 2001/07/30 06:20:24 oj + * #90291# check if table should be appended + * * Revision 1.24 2001/07/26 14:12:01 oj * #90291# check if table should be appended * diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx index ee0577d05cf4..4274563a2f0d 100644 --- a/dbaccess/source/ui/browser/unodatbr.cxx +++ b/dbaccess/source/ui/browser/unodatbr.cxx @@ -2,9 +2,9 @@ * * $RCSfile: unodatbr.cxx,v $ * - * $Revision: 1.100 $ + * $Revision: 1.101 $ * - * last change: $Author: fs $ $Date: 2001-08-16 14:09:46 $ + * last change: $Author: oj $ $Date: 2001-08-24 06:31:34 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -2515,26 +2515,27 @@ IMPL_LINK(SbaTableQueryBrowser, OnSelectEntry, SvLBoxEntry*, _pEntry) // ----------------------------------------------------------------------------- SvLBoxEntry* SbaTableQueryBrowser::getEntryFromContainer(const Reference<XNameAccess>& _rxNameAccess) { - SvLBoxEntry* pDSLoop = m_pTreeView->getListBox()->FirstChild(NULL); + DBTreeListBox* pListBox = m_pTreeView->getListBox(); + SvLBoxEntry* pDSLoop = pListBox->FirstChild(NULL); SvLBoxEntry* pContainer = NULL; while (pDSLoop) { - pContainer = m_pTreeView->getListBox()->GetEntry(pDSLoop, CONTAINER_QUERIES); + pContainer = pListBox->GetEntry(pDSLoop, CONTAINER_QUERIES); DBTreeListModel::DBTreeListUserData* pQueriesData = static_cast<DBTreeListModel::DBTreeListUserData*>(pContainer->GetUserData()); if(pQueriesData && pQueriesData->xObject.get() == _rxNameAccess.get()) break; - pContainer = m_pTreeView->getListBox()->GetEntry(pDSLoop, CONTAINER_TABLES); + pContainer = pListBox->GetEntry(pDSLoop, CONTAINER_TABLES); DBTreeListModel::DBTreeListUserData* pTablesData = static_cast<DBTreeListModel::DBTreeListUserData*>(pContainer->GetUserData()); if(pTablesData && pTablesData->xObject.get() == _rxNameAccess.get()) break; - pContainer = m_pTreeView->getListBox()->GetEntry(pDSLoop, CONTAINER_BOOKMARKS); + pContainer = pListBox->GetEntry(pDSLoop, CONTAINER_BOOKMARKS); DBTreeListModel::DBTreeListUserData* pBookmarksData = static_cast<DBTreeListModel::DBTreeListUserData*>(pContainer->GetUserData()); if(pBookmarksData && pBookmarksData->xObject.get() == _rxNameAccess.get()) break; - pDSLoop = m_pTreeView->getListBox()->NextSibling(pDSLoop); + pDSLoop = pListBox->NextSibling(pDSLoop); pContainer = NULL; } return pContainer; diff --git a/dbaccess/source/ui/dlg/adtabdlg.cxx b/dbaccess/source/ui/dlg/adtabdlg.cxx index 9bef0d869e4c..47ed949925d7 100644 --- a/dbaccess/source/ui/dlg/adtabdlg.cxx +++ b/dbaccess/source/ui/dlg/adtabdlg.cxx @@ -2,9 +2,9 @@ * * $RCSfile: adtabdlg.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: fme $ $Date: 2001-06-21 15:07:11 $ + * last change: $Author: oj $ $Date: 2001-08-24 06:39:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -114,7 +114,7 @@ using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::sdbcx; using namespace dbtools; -DBG_NAME(OAddTableDlg); +DBG_NAME(OAddTableDlg) //------------------------------------------------------------------------------ OAddTableDlg::OAddTableDlg( Window* pParent) :ModelessDialog( pParent, ModuleRes(DLG_JOIN_TABADD) ) @@ -125,6 +125,7 @@ OAddTableDlg::OAddTableDlg( Window* pParent) ,aHelpButton( this, ResId( PB_HELP ) ) ,aFixedLineTable( this, ResId( FL_TABLE ) ) ,aDefaultString( ResId( STR_DEFAULT ) ) + ,m_bInitialized(sal_False) { DBG_CTOR(OAddTableDlg,NULL); m_pTableView = static_cast<OJoinTableView*>(pParent); @@ -158,17 +159,11 @@ OAddTableDlg::~OAddTableDlg() //------------------------------------------------------------------------------ void OAddTableDlg::Update() { -// if (m_pShellAttachedTo == pNewShell) -// return; -// -// m_pShellAttachedTo = pNewShell; -// if (m_pShellAttachedTo) -// { -// xDatabase = m_pShellAttachedTo->GetDocShell()->GetJoinDocDatabase(); - UpdateTableList(sal_True); -// } - - //DetermineAddTable(); + if(!m_bInitialized) + { + UpdateTableList(m_pTableView->getDesignView()->getController()->isViewAllowed()); + m_bInitialized = sal_True; + } } //------------------------------------------------------------------------------ @@ -258,15 +253,19 @@ void OAddTableDlg::UpdateTableList(BOOL bViewsAllowed) xTables = xTableSupp->getTables(); // get the views supplier and the views - xViewSupp = Reference< XViewsSupplier >(xTableSupp, UNO_QUERY); - if (xViewSupp.is()) - xViews = xViewSupp->getViews(); - Sequence< ::rtl::OUString> sTables,sViews; if (xTables.is()) sTables = xTables->getElementNames(); - if (xViews.is()) - sViews = xViews->getElementNames(); + if(bViewsAllowed) + { + xViewSupp = Reference< XViewsSupplier >(xTableSupp, UNO_QUERY); + if (xViewSupp.is()) + { + xViews = xViewSupp->getViews(); + if (xViews.is()) + sViews = xViews->getElementNames(); + } + } aTableList.UpdateTableList(Reference< XConnection>(xTableSupp,UNO_QUERY)->getMetaData(),sTables,sViews); /* diff --git a/dbaccess/source/ui/inc/RelationController.hxx b/dbaccess/source/ui/inc/RelationController.hxx index 99f058ae0aec..48b60b9ebd67 100644 --- a/dbaccess/source/ui/inc/RelationController.hxx +++ b/dbaccess/source/ui/inc/RelationController.hxx @@ -2,9 +2,9 @@ * * $RCSfile: RelationController.hxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: oj $ $Date: 2001-06-28 14:26:45 $ + * last change: $Author: oj $ $Date: 2001-08-24 06:32:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -97,6 +97,7 @@ namespace dbaui short saveModified(); // load the window positions out of the datasource void loadLayoutInformation(); + void loadTableData(const ::com::sun::star::uno::Any& _aTable); public: ORelationController(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM); diff --git a/dbaccess/source/ui/inc/adtabdlg.hxx b/dbaccess/source/ui/inc/adtabdlg.hxx index 84d48658673a..5a3c4b0c49c7 100644 --- a/dbaccess/source/ui/inc/adtabdlg.hxx +++ b/dbaccess/source/ui/inc/adtabdlg.hxx @@ -2,9 +2,9 @@ * * $RCSfile: adtabdlg.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: fme $ $Date: 2001-06-21 15:21:14 $ + * last change: $Author: oj $ $Date: 2001-08-24 06:32:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -104,6 +104,7 @@ namespace dbaui String aDefaultString; OJoinTableView* m_pTableView; + sal_Bool m_bInitialized; BOOL IsAddAllowed(); void AddTable(); diff --git a/dbaccess/source/ui/querydesign/JoinController.cxx b/dbaccess/source/ui/querydesign/JoinController.cxx index dfaaf999737e..26b0472adee9 100644 --- a/dbaccess/source/ui/querydesign/JoinController.cxx +++ b/dbaccess/source/ui/querydesign/JoinController.cxx @@ -2,9 +2,9 @@ * * $RCSfile: JoinController.cxx,v $ * - * $Revision: 1.14 $ + * $Revision: 1.15 $ * - * last change: $Author: fs $ $Date: 2001-08-23 14:39:09 $ + * last change: $Author: oj $ $Date: 2001-08-24 06:38:23 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -163,6 +163,9 @@ #ifndef DBAUI_QYDLGTAB_HXX #include "adtabdlg.hxx" #endif +#ifndef _SV_WAITOBJ_HXX +#include <vcl/waitobj.hxx> +#endif using namespace ::com::sun::star::uno; using namespace ::com::sun::star::io; @@ -184,6 +187,7 @@ DBG_NAME(OJoinController); OJoinController::OJoinController(const Reference< XMultiServiceFactory >& _rM) : OJoinController_BASE(_rM) ,m_bEditable(sal_True) ,m_bModified(sal_False) + ,m_bViewsAllowed(sal_True) ,m_pAddTabDlg(NULL) { DBG_CTOR(OJoinController,NULL); @@ -351,7 +355,13 @@ void OJoinController::Execute(sal_uInt16 _nId) m_pView->GrabFocus(); } else if(getJoinView()->getTableView()->IsAddAllowed()) + { + { + WaitObject aWaitCursor(getView()); + m_pAddTabDlg->Update(); + } m_pAddTabDlg->Show(!m_pAddTabDlg->IsVisible()); + } break; } InvalidateFeature(_nId); diff --git a/dbaccess/source/ui/querydesign/JoinDesignView.cxx b/dbaccess/source/ui/querydesign/JoinDesignView.cxx index 8dc76c7ee1ea..bf7bf99f6e9b 100644 --- a/dbaccess/source/ui/querydesign/JoinDesignView.cxx +++ b/dbaccess/source/ui/querydesign/JoinDesignView.cxx @@ -2,9 +2,9 @@ * * $RCSfile: JoinDesignView.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: fs $ $Date: 2001-08-23 14:39:09 $ + * last change: $Author: oj $ $Date: 2001-08-24 06:38:23 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -163,7 +163,7 @@ void OJoinDesignView::Construct() // ----------------------------------------------------------------------------- void OJoinDesignView::initialize() { - getAddTableDialog()->Update(); + // getAddTableDialog()->Update(); } // ------------------------------------------------------------------------- void OJoinDesignView::resizeDocumentView(Rectangle& _rPlayground) diff --git a/dbaccess/source/ui/relationdesign/RelationController.cxx b/dbaccess/source/ui/relationdesign/RelationController.cxx index dd2c1f9f3131..9aab3a5f66ff 100644 --- a/dbaccess/source/ui/relationdesign/RelationController.cxx +++ b/dbaccess/source/ui/relationdesign/RelationController.cxx @@ -2,9 +2,9 @@ * * $RCSfile: RelationController.cxx,v $ * - * $Revision: 1.21 $ + * $Revision: 1.22 $ * - * last change: $Author: fs $ $Date: 2001-08-23 14:46:27 $ + * last change: $Author: oj $ $Date: 2001-08-24 06:34:53 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -184,6 +184,9 @@ #ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> #endif +#ifndef _SV_WAITOBJ_HXX +#include <vcl/waitobj.hxx> +#endif extern "C" void SAL_CALL createRegistryInfo_ORelationControl() { @@ -244,6 +247,7 @@ ORelationController::ORelationController(const Reference< XMultiServiceFactory > ,m_bRelationsPossible(sal_True) { DBG_CTOR(ORelationController,NULL); + m_bViewsAllowed = sal_False; InvalidateAll(); } // ----------------------------------------------------------------------------- @@ -483,100 +487,137 @@ ToolBox* ORelationController::CreateToolBox(Window* _pParent) // ----------------------------------------------------------------------------- void ORelationController::loadData() { + WaitObject aWaitCursor(getView()); try { if(!m_xTables.is()) return; + // this may take some time + Reference< XDatabaseMetaData> xMetaData = getConnection()->getMetaData(); Sequence< ::rtl::OUString> aNames = m_xTables->getElementNames(); const ::rtl::OUString* pBegin = aNames.getConstArray(); const ::rtl::OUString* pEnd = pBegin + aNames.getLength(); for(;pBegin != pEnd;++pBegin) { + ::rtl::OUString sCatalog,sSchema,sTable; + ::dbtools::qualifiedNameComponents(xMetaData, + *pBegin, + sCatalog, + sSchema, + sTable); + Any aCatalog; + if(sCatalog.getLength()) + aCatalog <<= sCatalog; + + Reference< XResultSet > xResult = xMetaData->getImportedKeys(aCatalog, sSchema,sTable); + if(xResult.is() && xResult->next()) + loadTableData(m_xTables->getByName(*pBegin)); + } + } + catch(SQLException& e) + { + showError(SQLExceptionInfo(e)); + } + catch(Exception&) + { + } +} +// ----------------------------------------------------------------------------- +void ORelationController::loadTableData(const Any& _aTable) +{ + // Reference<XIndexAccess> xTables(m_xTables,UNO_QUERY); + +// Sequence< ::rtl::OUString> aNames = m_xTables->getElementNames(); +// const ::rtl::OUString* pBegin = aNames.getConstArray(); +// const ::rtl::OUString* pEnd = pBegin + aNames.getLength(); +// for(;pBegin != pEnd;++pBegin) +// { +// Reference<XKeysSupplier> xKeySup; +// m_xTables->getByName(*pBegin) >>= xKeySup; + Reference<XIndexAccess> xKeys; + // sal_Int32 nCount = xTables->getCount(); + // for(sal_Int32 i = 0; i< nCount ;++i) + // { Reference<XKeysSupplier> xKeySup; - m_xTables->getByName(*pBegin) >>= xKeySup; - Reference<XIndexAccess> xKeys; + _aTable >>= xKeySup; + if(xKeySup.is()) - xKeys = xKeySup->getKeys(); - if(xKeys.is()) { - Reference<XPropertySet> xKey; - for(sal_Int32 i=0;i< xKeys->getCount();++i) + xKeys = xKeySup->getKeys(); + if(xKeys.is()) { - xKeys->getByIndex(i) >>= xKey; - sal_Int32 nKeyType = 0; - xKey->getPropertyValue(PROPERTY_TYPE) >>= nKeyType; - if(KeyType::FOREIGN == nKeyType) + Reference<XPropertySet> xKey; + for(sal_Int32 i=0;i< xKeys->getCount();++i) { - ::rtl::OUString sSourceName,sReferencedTable; - Reference<XPropertySet> xTableProp(xKeySup,UNO_QUERY); - - ::dbaui::composeTableName(getMetaData(),xTableProp,sSourceName,sal_False); - xKey->getPropertyValue(PROPERTY_REFERENCEDTABLE) >>= sReferencedTable; - ////////////////////////////////////////////////////////////////////// - // insert windows - if( !existsTable(sSourceName) ) + xKeys->getByIndex(i) >>= xKey; + sal_Int32 nKeyType = 0; + xKey->getPropertyValue(PROPERTY_TYPE) >>= nKeyType; + if(KeyType::FOREIGN == nKeyType) { - OTableWindowData* pData = new OTableWindowData(sSourceName, sSourceName); - pData->ShowAll(FALSE); - m_vTableData.push_back(pData); - } + ::rtl::OUString sSourceName,sReferencedTable; + Reference<XPropertySet> xTableProp(xKeySup,UNO_QUERY); - if( !existsTable(sReferencedTable) ) - { - OTableWindowData* pData = new OTableWindowData(sReferencedTable, sReferencedTable); - pData->ShowAll(FALSE); - m_vTableData.push_back(pData); - } + ::dbaui::composeTableName(getConnection()->getMetaData(),xTableProp,sSourceName,sal_False); + xKey->getPropertyValue(PROPERTY_REFERENCEDTABLE) >>= sReferencedTable; + ////////////////////////////////////////////////////////////////////// + // insert windows + if( !existsTable(sSourceName) ) + { + OTableWindowData* pData = new OTableWindowData(sSourceName, sSourceName); + pData->ShowAll(FALSE); + m_vTableData.push_back(pData); + } - ::rtl::OUString sKeyName; - xKey->getPropertyValue(PROPERTY_NAME) >>= sKeyName; - ////////////////////////////////////////////////////////////////////// - // insert connection - ORelationTableConnectionData* pTabConnData = new ORelationTableConnectionData( m_xTables, sSourceName, sReferencedTable, sKeyName ); - m_vTableConnectionData.push_back(pTabConnData); - ////////////////////////////////////////////////////////////////////// - // insert columns - Reference<XColumnsSupplier> xColsSup(xKey,UNO_QUERY); - OSL_ENSURE(xColsSup.is(),"Key is no XColumnsSupplier!"); - Reference<XNameAccess> xColumns = xColsSup->getColumns(); - Sequence< ::rtl::OUString> aNames = xColumns->getElementNames(); - const ::rtl::OUString* pBegin = aNames.getConstArray(); - const ::rtl::OUString* pEnd = pBegin + aNames.getLength(); - ::rtl::OUString sColumnName,sRelatedName; - for(sal_uInt16 j=0;pBegin != pEnd;++pBegin,++j) - { - Reference<XPropertySet> xPropSet; - xColumns->getByName(*pBegin) >>= xPropSet; - xPropSet->getPropertyValue(PROPERTY_NAME) >>= sColumnName; - xPropSet->getPropertyValue(PROPERTY_RELATEDCOLUMN) >>= sRelatedName; - pTabConnData->SetConnLine( j, sColumnName, sRelatedName ); - } - ////////////////////////////////////////////////////////////////////// - // Update/Del-Flags setzen - sal_Int32 nUpdateRule, - nDeleteRule; - xKey->getPropertyValue(PROPERTY_UPDATERULE) >>= nUpdateRule; - xKey->getPropertyValue(PROPERTY_DELETERULE) >>= nDeleteRule; + if( !existsTable(sReferencedTable) ) + { + OTableWindowData* pData = new OTableWindowData(sReferencedTable, sReferencedTable); + pData->ShowAll(FALSE); + m_vTableData.push_back(pData); + } + + ::rtl::OUString sKeyName; + xKey->getPropertyValue(PROPERTY_NAME) >>= sKeyName; + ////////////////////////////////////////////////////////////////////// + // insert connection + ORelationTableConnectionData* pTabConnData = new ORelationTableConnectionData( m_xTables, sSourceName, sReferencedTable, sKeyName ); + m_vTableConnectionData.push_back(pTabConnData); + ////////////////////////////////////////////////////////////////////// + // insert columns + Reference<XColumnsSupplier> xColsSup(xKey,UNO_QUERY); + OSL_ENSURE(xColsSup.is(),"Key is no XColumnsSupplier!"); + Reference<XNameAccess> xColumns = xColsSup->getColumns(); + Sequence< ::rtl::OUString> aNames = xColumns->getElementNames(); + const ::rtl::OUString* pBegin = aNames.getConstArray(); + const ::rtl::OUString* pEnd = pBegin + aNames.getLength(); + ::rtl::OUString sColumnName,sRelatedName; + for(sal_uInt16 j=0;pBegin != pEnd;++pBegin,++j) + { + Reference<XPropertySet> xPropSet; + xColumns->getByName(*pBegin) >>= xPropSet; + xPropSet->getPropertyValue(PROPERTY_NAME) >>= sColumnName; + xPropSet->getPropertyValue(PROPERTY_RELATEDCOLUMN) >>= sRelatedName; + pTabConnData->SetConnLine( j, sColumnName, sRelatedName ); + } + ////////////////////////////////////////////////////////////////////// + // Update/Del-Flags setzen + sal_Int32 nUpdateRule, + nDeleteRule; + xKey->getPropertyValue(PROPERTY_UPDATERULE) >>= nUpdateRule; + xKey->getPropertyValue(PROPERTY_DELETERULE) >>= nDeleteRule; - pTabConnData->SetUpdateRules( nUpdateRule ); - pTabConnData->SetDeleteRules( nDeleteRule ); + pTabConnData->SetUpdateRules( nUpdateRule ); + pTabConnData->SetDeleteRules( nDeleteRule ); - ////////////////////////////////////////////////////////////////////// - // Kardinalitaet setzen - pTabConnData->SetCardinality(); + ////////////////////////////////////////////////////////////////////// + // Kardinalitaet setzen + pTabConnData->SetCardinality(); + } } } } - } - } - catch(SQLException& e) - { - showError(SQLExceptionInfo(e)); - } - catch(Exception&) - { - } + // } + } // ----------------------------------------------------------------------------- diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx index 673fabce41e3..fe42291b7149 100644 --- a/dbaccess/source/ui/tabledesign/TableController.cxx +++ b/dbaccess/source/ui/tabledesign/TableController.cxx @@ -2,9 +2,9 @@ * * $RCSfile: TableController.cxx,v $ * - * $Revision: 1.51 $ + * $Revision: 1.52 $ * - * last change: $Author: fs $ $Date: 2001-08-23 14:44:32 $ + * last change: $Author: oj $ $Date: 2001-08-24 06:40:35 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -591,7 +591,7 @@ sal_Bool OTableController::doSaveDoc(sal_Bool _bSaveAs) stopTableListening(); m_xTable = NULL; } - reload(); // a error occured so we have to reload + // reload(); // a error occured so we have to reload } return !aInfo.isValid(); } |