diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2009-04-23 10:42:05 +0000 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2009-04-23 10:42:05 +0000 |
commit | d4420993d60255a2624b522cd085d0129d232bf7 (patch) | |
tree | 205dbc978d16cd7e9ab48d861d18f15928a4035d /dbaccess/source | |
parent | 7599f68cee9141cd16ca7697872b5f83c6ae9ad9 (diff) |
CWS-TOOLING: integrate CWS dbaperf1
2009-04-02 09:12:25 +0200 oj r270372 : CWS-TOOLING: rebase CWS dbaperf1 to trunk@270033 (milestone: DEV300:m45)
2009-03-17 10:20:34 +0100 oj r269577 : add parameter
2009-03-17 10:20:05 +0100 oj r269576 : add parameter
2009-03-12 12:32:24 +0100 oj r269387 : add missing ++
2009-03-11 12:53:35 +0100 oj r269315 : compile error
2009-03-06 08:52:11 +0100 oj r268968 : #i99264# remove duplicate code
2009-03-06 08:20:08 +0100 oj r268966 : add missingheader
2009-03-06 08:17:41 +0100 oj r268965 : add header
2009-03-06 08:15:07 +0100 oj r268964 : #i99708# remove duplicate code
2009-03-06 07:24:11 +0100 oj r268963 : #i99708# remove duplicate code
2009-03-06 07:22:24 +0100 oj r268962 : #i99708# use tenary operator
2009-03-06 07:19:21 +0100 oj r268961 : remove unused rtl_logs
2009-03-06 07:15:55 +0100 oj r268960 : #i99708# extract getLength from for loop
2009-03-06 07:15:35 +0100 oj r268959 : #i99708# extract getLength from for loop
2009-03-06 07:14:57 +0100 oj r268958 : remove unused rtl_logs
2009-03-06 07:13:01 +0100 oj r268957 : insert DBG_ helper
2009-03-06 07:12:17 +0100 oj r268956 : remove unused rtl_logs
2009-03-06 07:10:26 +0100 oj r268955 : remove unused rtl_logs
2009-03-06 07:04:51 +0100 oj r268954 : #i99708# use tenary operator
2009-03-05 12:04:46 +0100 oj r268895 : comment RTL_LOG out
2009-03-05 09:05:07 +0100 oj r268874 : add rtl logfile
2009-03-04 14:21:18 +0100 oj r268828 : #i99708# make static inplace and some method calls in for loop removed
2009-03-04 14:20:34 +0100 oj r268827 : #i99708# impl double check pattern for getInfohelper
2009-03-02 09:31:42 +0100 oj r268636 : add rtl logfile
2009-03-02 08:18:37 +0100 oj r268633 : add rtl logfile
2009-02-27 11:22:16 +0100 oj r268570 : #i99709# change algorithm for marking objects
2009-02-27 11:17:04 +0100 oj r268568 : #i99708# some improvements to load forms, controls faster and replacement of size() call with !empty() which is much faster
2009-02-24 10:09:35 +0100 sb r268383 : #i99290# no longer care to set a sensible context class loader for native threads attached to the VM
2009-02-23 13:44:04 +0100 oj r268354 : #i76606# seekrow changes
2009-02-23 12:27:30 +0100 oj r268349 : deleted
2009-02-20 15:14:23 +0100 oj r268325 : #i76606# some code changes
2009-02-19 14:15:25 +0100 oj r268284 : #i76606# use of simple prep stmt instead of full blown rowset, when source and dest connection are the same use insert into ... ( select ... )
2009-02-19 11:27:55 +0100 oj r268265 : #i76606# insert some RTL_LOG and setObject impl
2009-02-18 14:45:37 +0100 oj r268222 : #i99363# insert RTL_LOG
2009-02-18 14:45:18 +0100 oj r268221 : #i99363# insert RTL_LOG
2009-02-18 11:14:54 +0100 oj r268207 : #i99363# call some impl_ methods to avoid duplicate cechCache calls
2009-02-18 11:10:47 +0100 oj r268206 : #i99363# make isCount inline
2009-02-18 10:33:22 +0100 oj r268203 : #i99363# use bookmarkable if available and inserted some RTL_LOG
2009-02-18 10:32:57 +0100 oj r268202 : #i99363# use bookmarkable if available and inserted some RTL_LOG
2009-02-17 07:29:05 +0100 oj r267843 : #i96897# remove some dll public
2009-02-16 15:01:04 +0100 oj r267816 : #i96897# remove some dll public
2009-02-16 14:25:53 +0100 oj r267810 : #i99264# remove duplicate code
2009-02-16 14:25:33 +0100 oj r267809 : #i99264# remove duplicate code
2009-02-16 14:24:59 +0100 oj r267808 : #i99264# remove duplicate code
2009-02-13 10:56:17 +0100 oj r267703 : #i99191# comment the contextclassloader
2009-02-13 10:32:40 +0100 oj r267700 : reduce call to resultset meta data
2009-02-13 10:27:31 +0100 oj r267699 : reduce call to resultset meta data
2009-02-13 10:27:08 +0100 oj r267698 : reduce call to resultset meta data
Diffstat (limited to 'dbaccess/source')
38 files changed, 3933 insertions, 3224 deletions
diff --git a/dbaccess/source/core/api/BookmarkSet.cxx b/dbaccess/source/core/api/BookmarkSet.cxx index c5a2f8ec8b29..f04638724957 100644 --- a/dbaccess/source/core/api/BookmarkSet.cxx +++ b/dbaccess/source/core/api/BookmarkSet.cxx @@ -45,6 +45,7 @@ #ifndef _DBHELPER_DBEXCEPTION_HXX_ #include <connectivity/dbexception.hxx> #endif +#include <rtl/logfile.hxx> #include <limits> @@ -63,43 +64,51 @@ using namespace ::osl; void OBookmarkSet::construct(const Reference< XResultSet>& _xDriverSet) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OBookmarkSet::construct" ); OCacheSet::construct(_xDriverSet); m_xRowLocate.set(_xDriverSet,UNO_QUERY); } // ----------------------------------------------------------------------------- Any SAL_CALL OBookmarkSet::getBookmark() throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OBookmarkSet::getBookmark" ); return m_xRowLocate->getBookmark(); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OBookmarkSet::moveToBookmark( const Any& bookmark ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OBookmarkSet::moveToBookmark" ); return m_xRowLocate->moveToBookmark(bookmark); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OBookmarkSet::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OBookmarkSet::moveRelativeToBookmark" ); return m_xRowLocate->moveRelativeToBookmark(bookmark,rows); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OBookmarkSet::compareBookmarks( const Any& _first, const Any& _second ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OBookmarkSet::compareBookmarks" ); return m_xRowLocate->compareBookmarks(_first,_second); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OBookmarkSet::hasOrderedBookmarks( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OBookmarkSet::hasOrderedBookmarks" ); return m_xRowLocate->hasOrderedBookmarks(); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OBookmarkSet::hashBookmark( const Any& bookmark ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OBookmarkSet::hashBookmark" ); return m_xRowLocate->hashBookmark(bookmark); } // ------------------------------------------------------------------------- // ::com::sun::star::sdbcx::XDeleteRows Sequence< sal_Int32 > SAL_CALL OBookmarkSet::deleteRows( const Sequence< Any >& rows ,const connectivity::OSQLTable& /*_xTable*/) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OBookmarkSet::deleteRows" ); Reference< ::com::sun::star::sdbcx::XDeleteRows> xDeleteRow(m_xRowLocate,UNO_QUERY); if(xDeleteRow.is()) { @@ -110,6 +119,7 @@ Sequence< sal_Int32 > SAL_CALL OBookmarkSet::deleteRows( const Sequence< Any >& // ------------------------------------------------------------------------- void SAL_CALL OBookmarkSet::insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQLTable& /*_xTable*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OBookmarkSet::insertRow" ); Reference<XRowUpdate> xUpdRow(m_xRowLocate,UNO_QUERY); if(!xUpdRow.is()) ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_XROWUPDATE ), SQL_GENERAL_ERROR, *this ); @@ -133,6 +143,7 @@ void SAL_CALL OBookmarkSet::insertRow( const ORowSetRow& _rInsertRow,const conne // ------------------------------------------------------------------------- void SAL_CALL OBookmarkSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrginalRow,const connectivity::OSQLTable& /*_xTable*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OBookmarkSet::updateRow" ); // OCacheSet::updateRow( _rInsertRow,_rOrginalRow,_xTable); Reference<XRowUpdate> xUpdRow(m_xRowLocate,UNO_QUERY); if(!xUpdRow.is()) @@ -156,6 +167,7 @@ void SAL_CALL OBookmarkSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowS // ------------------------------------------------------------------------- void SAL_CALL OBookmarkSet::deleteRow(const ORowSetRow& /*_rDeleteRow*/ ,const connectivity::OSQLTable& /*_xTable*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OBookmarkSet::deleteRow" ); Reference<XResultSetUpdate> xUpd(m_xRowLocate,UNO_QUERY); xUpd->deleteRow(); @@ -163,10 +175,12 @@ void SAL_CALL OBookmarkSet::deleteRow(const ORowSetRow& /*_rDeleteRow*/ ,const c // ------------------------------------------------------------------------- void SAL_CALL OBookmarkSet::cancelRowUpdates( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OBookmarkSet::cancelRowUpdates" ); } // ------------------------------------------------------------------------- void SAL_CALL OBookmarkSet::moveToInsertRow( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OBookmarkSet::moveToInsertRow" ); Reference<XResultSetUpdate> xUpd(m_xRowLocate,UNO_QUERY); if(xUpd.is()) xUpd->moveToInsertRow(); @@ -174,15 +188,18 @@ void SAL_CALL OBookmarkSet::moveToInsertRow( ) throw(SQLException, RuntimeExcep // ------------------------------------------------------------------------- void SAL_CALL OBookmarkSet::moveToCurrentRow( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OBookmarkSet::moveToCurrentRow" ); } // ------------------------------------------------------------------------- void OBookmarkSet::fillValueRow(ORowSetRow& _rRow,sal_Int32 _nPosition) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OBookmarkSet::fillValueRow" ); OCacheSet::fillValueRow(_rRow,_nPosition); } // ------------------------------------------------------------------------- void OBookmarkSet::updateColumn(sal_Int32 nPos,Reference< XRowUpdate > _xParameter,const ORowSetValue& _rValue) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OBookmarkSet::updateColumn" ); if(_rValue.isBound() && _rValue.isModified()) { if(_rValue.isNull()) diff --git a/dbaccess/source/core/api/CacheSet.cxx b/dbaccess/source/core/api/CacheSet.cxx index 3a8cf7cd94fe..ce21ca9402df 100644 --- a/dbaccess/source/core/api/CacheSet.cxx +++ b/dbaccess/source/core/api/CacheSet.cxx @@ -54,6 +54,7 @@ #ifndef _COM_SUN_STAR_SDBC_XPREPAREDSTATEMENT_HPP_ #include <com/sun/star/sdbc/XPreparedStatement.hpp> #endif +#include <com/sun/star/sdbc/ColumnValue.hpp> #ifndef _COM_SUN_STAR_SDBC_XPARAMETERS_HPP_ #include <com/sun/star/sdbc/XParameters.hpp> #endif @@ -87,6 +88,7 @@ #ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> #endif +#include <rtl/logfile.hxx> using namespace comphelper; @@ -111,12 +113,14 @@ OCacheSet::OCacheSet() ,m_bUpdated(sal_False) ,m_bDeleted(sal_False) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::OCacheSet" ); DBG_CTOR(OCacheSet,NULL); } // ------------------------------------------------------------------------- ::rtl::OUString OCacheSet::getIdentifierQuoteString() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getIdentifierQuoteString" ); ::rtl::OUString sQuote; Reference<XDatabaseMetaData> xMeta; if ( m_xConnection.is() && (xMeta = m_xConnection->getMetaData()).is() ) @@ -126,6 +130,7 @@ OCacheSet::OCacheSet() // ------------------------------------------------------------------------- void OCacheSet::construct( const Reference< XResultSet>& _xDriverSet) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::construct" ); OSL_ENSURE(_xDriverSet.is(),"Invalid resultSet"); if(_xDriverSet.is()) { @@ -134,12 +139,18 @@ void OCacheSet::construct( const Reference< XResultSet>& _xDriverSet) m_xSetMetaData = Reference<XResultSetMetaDataSupplier>(_xDriverSet,UNO_QUERY)->getMetaData(); if ( m_xSetMetaData.is() ) { - sal_Int32 nCount = m_xSetMetaData->getColumnCount(); + const sal_Int32 nCount = m_xSetMetaData->getColumnCount(); + m_aNullable.realloc(nCount); m_aSignedFlags.realloc(nCount); - sal_Bool* pBegin = m_aSignedFlags.getArray(); - for (sal_Int32 i=1; i <= nCount; ++i,++pBegin) + m_aColumnTypes.realloc(nCount); + sal_Bool* pNullableIter = m_aNullable.getArray(); + sal_Bool* pSignedIter = m_aSignedFlags.getArray(); + sal_Int32* pColumnIter = m_aColumnTypes.getArray(); + for (sal_Int32 i=1; i <= nCount; ++i,++pSignedIter,++pColumnIter,++pNullableIter) { - *pBegin = m_xSetMetaData->isSigned(i); + *pNullableIter = m_xSetMetaData->isNullable(i) != ColumnValue::NO_NULLS; + *pSignedIter = m_xSetMetaData->isSigned(i); + *pColumnIter = m_xSetMetaData->getColumnType(i); } } Reference< XStatement> xStmt(m_xDriverSet->getStatement(),UNO_QUERY); @@ -177,6 +188,7 @@ OCacheSet::~OCacheSet() // ----------------------------------------------------------------------------- void OCacheSet::fillTableName(const Reference<XPropertySet>& _xTable) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::fillTableName" ); OSL_ENSURE(_xTable.is(),"OCacheSet::fillTableName: PropertySet is empty!"); if(!m_aComposedTableName.getLength() && _xTable.is() ) { @@ -192,6 +204,7 @@ void OCacheSet::fillTableName(const Reference<XPropertySet>& _xTable) throw(SQL // ------------------------------------------------------------------------- void SAL_CALL OCacheSet::insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQLTable& _xTable ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::insertRow" ); ::rtl::OUString aSql(::rtl::OUString::createFromAscii("INSERT INTO ")); Reference<XPropertySet> xSet(_xTable,UNO_QUERY); fillTableName(xSet); @@ -256,6 +269,7 @@ void OCacheSet::fillParameters( const ORowSetRow& _rRow ,::rtl::OUString& _sParameter ,::std::list< sal_Int32>& _rOrgValues) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::fillParameters" ); // use keys and indexes for excat postioning // first the keys Reference<XKeysSupplier> xKeySup(_xTable,UNO_QUERY); @@ -357,6 +371,7 @@ void OCacheSet::fillParameters( const ORowSetRow& _rRow // ------------------------------------------------------------------------- void SAL_CALL OCacheSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrginalRow,const connectivity::OSQLTable& _xTable ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::updateRow" ); Reference<XPropertySet> xSet(_xTable,UNO_QUERY); fillTableName(xSet); @@ -402,6 +417,7 @@ void SAL_CALL OCacheSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetR // ------------------------------------------------------------------------- void SAL_CALL OCacheSet::deleteRow(const ORowSetRow& _rDeleteRow ,const connectivity::OSQLTable& _xTable ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::deleteRow" ); Reference<XPropertySet> xSet(_xTable,UNO_QUERY); fillTableName(xSet); @@ -488,6 +504,7 @@ void OCacheSet::setParameter(sal_Int32 nPos ,sal_Int32 _nType ,sal_Int32 _nScale) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::setParameter" ); sal_Int32 nType = ( _nType != DataType::OTHER ) ? _nType : _rValue.getTypeKind(); if(!_rValue.isNull()) { @@ -575,217 +592,256 @@ void OCacheSet::setParameter(sal_Int32 nPos // ------------------------------------------------------------------------- void OCacheSet::fillValueRow(ORowSetRow& _rRow,sal_Int32 _nPosition) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::fillValueRow" ); Any aBookmark = getBookmark(); if(!aBookmark.hasValue()) aBookmark = makeAny(_nPosition); connectivity::ORowVector< ORowSetValue >::Vector::iterator aIter = _rRow->get().begin(); + connectivity::ORowVector< ORowSetValue >::Vector::iterator aEnd = _rRow->get().end(); (*aIter) = aBookmark; ++aIter; - for(sal_Int32 i=1;aIter != _rRow->get().end();++aIter,++i) + for(sal_Int32 i=1;aIter != aEnd;++aIter,++i) { - sal_Int32 nType = m_xSetMetaData->getColumnType(i); aIter->setSigned(m_aSignedFlags[i-1]); - aIter->fill(i,nType,this); + aIter->fill(i,m_aColumnTypes[i-1],m_aNullable[i-1],this); } } // ----------------------------------------------------------------------------- sal_Bool SAL_CALL OCacheSet::wasNull( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::wasNull" ); return m_xDriverRow->wasNull(); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OCacheSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getString" ); return m_xDriverRow->getString(columnIndex); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OCacheSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getBoolean" ); return m_xDriverRow->getBoolean(columnIndex); } // ------------------------------------------------------------------------- sal_Int8 SAL_CALL OCacheSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getByte" ); return m_xDriverRow->getByte(columnIndex); } // ------------------------------------------------------------------------- sal_Int16 SAL_CALL OCacheSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getShort" ); return m_xDriverRow->getShort(columnIndex); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OCacheSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getInt" ); return m_xDriverRow->getInt(columnIndex); } // ------------------------------------------------------------------------- sal_Int64 SAL_CALL OCacheSet::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getLong" ); return m_xDriverRow->getLong(columnIndex); } // ------------------------------------------------------------------------- float SAL_CALL OCacheSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getFloat" ); return m_xDriverRow->getFloat(columnIndex); } // ------------------------------------------------------------------------- double SAL_CALL OCacheSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getDouble" ); return m_xDriverRow->getDouble(columnIndex); } // ------------------------------------------------------------------------- Sequence< sal_Int8 > SAL_CALL OCacheSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getBytes" ); return m_xDriverRow->getBytes(columnIndex); } // ------------------------------------------------------------------------- ::com::sun::star::util::Date SAL_CALL OCacheSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getDate" ); return m_xDriverRow->getDate(columnIndex); } // ------------------------------------------------------------------------- ::com::sun::star::util::Time SAL_CALL OCacheSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getTime" ); return m_xDriverRow->getTime(columnIndex); } // ------------------------------------------------------------------------- ::com::sun::star::util::DateTime SAL_CALL OCacheSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getTimestamp" ); return m_xDriverRow->getTimestamp(columnIndex); } // ------------------------------------------------------------------------- Reference< ::com::sun::star::io::XInputStream > SAL_CALL OCacheSet::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getBinaryStream" ); return m_xDriverRow->getBinaryStream(columnIndex); } // ------------------------------------------------------------------------- Reference< ::com::sun::star::io::XInputStream > SAL_CALL OCacheSet::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getCharacterStream" ); return m_xDriverRow->getCharacterStream(columnIndex); } // ------------------------------------------------------------------------- Any SAL_CALL OCacheSet::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getObject" ); return m_xDriverRow->getObject(columnIndex,typeMap); } // ------------------------------------------------------------------------- Reference< XRef > SAL_CALL OCacheSet::getRef( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getRef" ); return m_xDriverRow->getRef(columnIndex); } // ------------------------------------------------------------------------- Reference< XBlob > SAL_CALL OCacheSet::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getBlob" ); return m_xDriverRow->getBlob(columnIndex); } // ------------------------------------------------------------------------- Reference< XClob > SAL_CALL OCacheSet::getClob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getClob" ); return m_xDriverRow->getClob(columnIndex); } // ------------------------------------------------------------------------- Reference< XArray > SAL_CALL OCacheSet::getArray( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getArray" ); return m_xDriverRow->getArray(columnIndex); } // ------------------------------------------------------------------------- // XResultSet sal_Bool SAL_CALL OCacheSet::next( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::next" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; return m_xDriverSet->next(); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OCacheSet::isBeforeFirst( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::isBeforeFirst" ); return m_xDriverSet->isBeforeFirst(); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OCacheSet::isAfterLast( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::isAfterLast" ); return m_xDriverSet->isAfterLast(); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OCacheSet::isFirst( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::isFirst" ); return m_xDriverSet->isFirst(); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OCacheSet::isLast( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::isLast" ); return m_xDriverSet->isLast(); } // ------------------------------------------------------------------------- void SAL_CALL OCacheSet::beforeFirst( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::beforeFirst" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; m_xDriverSet->beforeFirst(); } // ------------------------------------------------------------------------- void SAL_CALL OCacheSet::afterLast( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::afterLast" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; m_xDriverSet->afterLast(); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OCacheSet::first( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::first" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; return m_xDriverSet->first(); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OCacheSet::last( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::last" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; return m_xDriverSet->last(); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OCacheSet::getRow( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getRow" ); return m_xDriverSet->getRow(); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OCacheSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::absolute" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; return m_xDriverSet->absolute(row); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OCacheSet::relative( sal_Int32 rows ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::relative" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; return m_xDriverSet->relative(rows); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OCacheSet::previous( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::previous" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; return m_xDriverSet->previous(); } // ------------------------------------------------------------------------- void SAL_CALL OCacheSet::refreshRow( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::refreshRow" ); m_xDriverSet->refreshRow(); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OCacheSet::rowUpdated( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::rowUpdated" ); return m_xDriverSet->rowUpdated(); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OCacheSet::rowInserted( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::rowInserted" ); return m_xDriverSet->rowInserted(); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OCacheSet::rowDeleted( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::rowDeleted" ); return m_xDriverSet->rowDeleted(); } // ------------------------------------------------------------------------- Reference< XInterface > SAL_CALL OCacheSet::getStatement( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getStatement" ); return m_xDriverSet->getStatement(); } // ----------------------------------------------------------------------------- diff --git a/dbaccess/source/core/api/CacheSet.hxx b/dbaccess/source/core/api/CacheSet.hxx index be096aa31289..6299c0fe2dad 100644 --- a/dbaccess/source/core/api/CacheSet.hxx +++ b/dbaccess/source/core/api/CacheSet.hxx @@ -78,7 +78,9 @@ namespace dbaccess ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData> m_xSetMetaData; ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> m_xConnection; + ::com::sun::star::uno::Sequence<sal_Bool> m_aNullable; ::com::sun::star::uno::Sequence<sal_Bool> m_aSignedFlags; + ::com::sun::star::uno::Sequence<sal_Int32> m_aColumnTypes; ORowSetRow m_aInsertRow; ::rtl::OUString m_aComposedTableName; sal_Bool m_bInserted; diff --git a/dbaccess/source/core/api/FilteredContainer.cxx b/dbaccess/source/core/api/FilteredContainer.cxx index ff93b1fd9e8f..6c11a11ae614 100644 --- a/dbaccess/source/core/api/FilteredContainer.cxx +++ b/dbaccess/source/core/api/FilteredContainer.cxx @@ -36,13 +36,11 @@ #include "FilteredContainer.hxx" #include "RefreshListener.hxx" #include "sdbcoretools.hxx" - #include <com/sun/star/sdbc/XRow.hpp> - #include <connectivity/dbtools.hxx> #include <tools/wldcrd.hxx> #include <tools/diagnose_ex.h> - +#include <rtl/logfile.hxx> #include <boost/optional.hpp> namespace dbaccess @@ -61,35 +59,36 @@ namespace dbaccess using namespace ::cppu; using namespace ::connectivity::sdbcx; - //------------------------------------------------------------------------------ - /** creates a vector of WildCards and reduce the _rTableFilter of the length of WildsCards - */ - sal_Int32 createWildCardVector(Sequence< ::rtl::OUString >& _rTableFilter, ::std::vector< WildCard >& _rOut) +//------------------------------------------------------------------------------ +/** creates a vector of WildCards and reduce the _rTableFilter of the length of WildsCards +*/ +sal_Int32 createWildCardVector(Sequence< ::rtl::OUString >& _rTableFilter, ::std::vector< WildCard >& _rOut) +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "api", "Ocke.Janssen@sun.com", "OFilteredContainer::createWildCardVector" ); + // for wildcard search : remove all table filters which are a wildcard expression and build a WilCard + // for them + ::rtl::OUString* pTableFilters = _rTableFilter.getArray(); + ::rtl::OUString* pEnd = pTableFilters + _rTableFilter.getLength(); + sal_Int32 nShiftPos = 0; + for (sal_Int32 i=0; pEnd != pTableFilters; ++pTableFilters,++i) { - // for wildcard search : remove all table filters which are a wildcard expression and build a WilCard - // for them - ::rtl::OUString* pTableFilters = _rTableFilter.getArray(); - ::rtl::OUString* pEnd = pTableFilters + _rTableFilter.getLength(); - sal_Int32 nShiftPos = 0; - for (sal_Int32 i=0; pEnd != pTableFilters; ++pTableFilters,++i) + if (pTableFilters->indexOf('%') != -1) { - if (pTableFilters->indexOf('%') != -1) - { - _rOut.push_back(WildCard(pTableFilters->replace('%', '*'))); - } - else + _rOut.push_back(WildCard(pTableFilters->replace('%', '*'))); + } + else + { + if (nShiftPos != i) { - if (nShiftPos != i) - { - _rTableFilter.getArray()[nShiftPos] = _rTableFilter.getArray()[i]; - } - ++nShiftPos; + _rTableFilter.getArray()[nShiftPos] = _rTableFilter.getArray()[i]; } + ++nShiftPos; } - // now aTableFilter contains nShiftPos non-wc-strings and aWCSearch all wc-strings - _rTableFilter.realloc(nShiftPos); - return nShiftPos; } + // now aTableFilter contains nShiftPos non-wc-strings and aWCSearch all wc-strings + _rTableFilter.realloc(nShiftPos); + return nShiftPos; +} // ------------------------------------------------------------------------- bool lcl_isElementAllowed( const ::rtl::OUString& _rName, @@ -274,9 +273,7 @@ namespace dbaccess ,m_nInAppend(_nInAppend) ,m_xConnection(_xCon) { - } - // ------------------------------------------------------------------------- void OFilteredContainer::construct(const Reference< XNameAccess >& _rxMasterContainer, const Sequence< ::rtl::OUString >& _rTableFilter, @@ -419,9 +416,11 @@ namespace dbaccess m_pRefreshListener = NULL; m_bConstructed = sal_False; } + // ------------------------------------------------------------------------- void OFilteredContainer::impl_refresh() throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "api", "Ocke.Janssen@sun.com", "OFilteredContainer::impl_refresh" ); if ( m_pRefreshListener ) { m_bConstructed = sal_False; @@ -430,7 +429,6 @@ namespace dbaccess xRefresh->refresh(); m_pRefreshListener->refresh(this); } - } // ----------------------------------------------------------------------------- ::rtl::OUString OFilteredContainer::getNameForObject(const ObjectType& _xObject) diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx index e3bdf43228f9..105443902b45 100644 --- a/dbaccess/source/core/api/KeySet.cxx +++ b/dbaccess/source/core/api/KeySet.cxx @@ -46,6 +46,7 @@ #ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_ #include <com/sun/star/sdbc/XDatabaseMetaData.hpp> #endif +#include <com/sun/star/sdbc/ColumnValue.hpp> #ifndef _COM_SUN_STAR_SDBC_XPREPAREDSTATEMENT_HPP_ #include <com/sun/star/sdbc/XPreparedStatement.hpp> #endif @@ -113,6 +114,7 @@ #include <tools/debug.hxx> #endif #include <string.h> +#include <rtl/logfile.hxx> using namespace dbaccess; using namespace ::connectivity; @@ -165,6 +167,7 @@ OKeySet::OKeySet(const connectivity::OSQLTable& _xTable, ,m_sUpdateTableName(_rUpdateTableName) ,m_bRowCountFinal(sal_False) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::OKeySet" ); DBG_CTOR(OKeySet,NULL); } @@ -193,6 +196,7 @@ OKeySet::~OKeySet() // ----------------------------------------------------------------------------- void OKeySet::construct(const Reference< XResultSet>& _xDriverSet) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::construct" ); OCacheSet::construct(_xDriverSet); Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData(); @@ -307,6 +311,7 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet) // ------------------------------------------------------------------------- Any SAL_CALL OKeySet::getBookmark() throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getBookmark" ); OSL_ENSURE(m_aKeyIter != m_aKeyMap.end() && m_aKeyIter != m_aKeyMap.begin(), "getBookmark is only possible when we stand on a valid row!"); return makeAny(m_aKeyIter->first); @@ -315,6 +320,7 @@ Any SAL_CALL OKeySet::getBookmark() throw(SQLException, RuntimeException) // ------------------------------------------------------------------------- sal_Bool SAL_CALL OKeySet::moveToBookmark( const Any& bookmark ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::moveToBookmark" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; m_aKeyIter = m_aKeyMap.find(::comphelper::getINT32(bookmark)); return m_aKeyIter != m_aKeyMap.end(); @@ -322,6 +328,7 @@ sal_Bool SAL_CALL OKeySet::moveToBookmark( const Any& bookmark ) throw(SQLExcept // ------------------------------------------------------------------------- sal_Bool SAL_CALL OKeySet::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::moveRelativeToBookmark" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; m_aKeyIter = m_aKeyMap.find(::comphelper::getINT32(bookmark)); if(m_aKeyIter != m_aKeyMap.end()) @@ -334,6 +341,7 @@ sal_Bool SAL_CALL OKeySet::moveRelativeToBookmark( const Any& bookmark, sal_Int3 // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OKeySet::compareBookmarks( const Any& _first, const Any& _second ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::compareBookmarks" ); sal_Int32 nFirst = 0, nSecond = 0; _first >>= nFirst; _second >>= nSecond; @@ -343,17 +351,20 @@ sal_Int32 SAL_CALL OKeySet::compareBookmarks( const Any& _first, const Any& _sec // ------------------------------------------------------------------------- sal_Bool SAL_CALL OKeySet::hasOrderedBookmarks( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::hasOrderedBookmarks" ); return sal_True; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OKeySet::hashBookmark( const Any& bookmark ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::hashBookmark" ); return ::comphelper::getINT32(bookmark); } // ------------------------------------------------------------------------- // ::com::sun::star::sdbcx::XDeleteRows Sequence< sal_Int32 > SAL_CALL OKeySet::deleteRows( const Sequence< Any >& rows ,const connectivity::OSQLTable& _xTable) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::deleteRows" ); Reference<XPropertySet> xSet(_xTable,UNO_QUERY); fillTableName(xSet); @@ -438,6 +449,7 @@ Sequence< sal_Int32 > SAL_CALL OKeySet::deleteRows( const Sequence< Any >& rows // ------------------------------------------------------------------------- void SAL_CALL OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrginalRow,const connectivity::OSQLTable& _xTable ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::updateRow" ); Reference<XPropertySet> xSet(_xTable,UNO_QUERY); fillTableName(xSet); @@ -587,6 +599,7 @@ void SAL_CALL OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow // ------------------------------------------------------------------------- void SAL_CALL OKeySet::insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQLTable& _xTable ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::insertRow" ); ::rtl::OUString aSql(::rtl::OUString::createFromAscii("INSERT INTO ")); Reference<XPropertySet> xSet(_xTable,UNO_QUERY); fillTableName(xSet); @@ -671,7 +684,7 @@ void SAL_CALL OKeySet::insertRow( const ORowSetRow& _rInsertRow,const connectivi #endif SelectColumnsMetaData::iterator aFind = m_pKeyColumnNames->find(*aAutoIter); if ( aFind != m_pKeyColumnNames->end() ) - (_rInsertRow->get())[aFind->second.nPosition].fill(i,aFind->second.nType,xRow); + (_rInsertRow->get())[aFind->second.nPosition].fill(i,aFind->second.nType,aFind->second.bNullable,xRow); } bAutoValuesFetched = sal_True; } @@ -724,7 +737,7 @@ void SAL_CALL OKeySet::insertRow( const ORowSetRow& _rInsertRow,const connectivi // we will only fetch values which are keycolumns SelectColumnsMetaData::iterator aFind = m_pKeyColumnNames->find(*aAutoIter); if(aFind != m_pKeyColumnNames->end()) - (_rInsertRow->get())[aFind->second.nPosition].fill(i,aFind->second.nType,xRow); + (_rInsertRow->get())[aFind->second.nPosition].fill(i,aFind->second.nType,aFind->second.bNullable,xRow); } } ::comphelper::disposeComponent(xStatement); @@ -750,6 +763,7 @@ void SAL_CALL OKeySet::insertRow( const ORowSetRow& _rInsertRow,const connectivi // ----------------------------------------------------------------------------- void OKeySet::copyRowValue(const ORowSetRow& _rInsertRow,ORowSetRow& _rKeyRow) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::copyRowValue" ); connectivity::ORowVector< ORowSetValue >::Vector::iterator aIter = _rKeyRow->get().begin(); SelectColumnsMetaData::const_iterator aPosIter = (*m_pKeyColumnNames).begin(); SelectColumnsMetaData::const_iterator aPosEnd = (*m_pKeyColumnNames).end(); @@ -762,6 +776,7 @@ void OKeySet::copyRowValue(const ORowSetRow& _rInsertRow,ORowSetRow& _rKeyRow) // ------------------------------------------------------------------------- void SAL_CALL OKeySet::deleteRow(const ORowSetRow& _rDeleteRow,const connectivity::OSQLTable& _xTable ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::deleteRow" ); Reference<XPropertySet> xSet(_xTable,UNO_QUERY); fillTableName(xSet); @@ -861,19 +876,23 @@ void SAL_CALL OKeySet::deleteRow(const ORowSetRow& _rDeleteRow,const connectivit // ------------------------------------------------------------------------- void SAL_CALL OKeySet::cancelRowUpdates( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::cancelRowUpdates" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; } // ------------------------------------------------------------------------- void SAL_CALL OKeySet::moveToInsertRow( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::moveToInsertRow" ); } // ------------------------------------------------------------------------- void SAL_CALL OKeySet::moveToCurrentRow( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::moveToCurrentRow" ); } // ------------------------------------------------------------------------- Reference<XNameAccess> OKeySet::getKeyColumns() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getKeyColumns" ); // use keys and indexes for excat postioning // first the keys @@ -914,6 +933,7 @@ Reference<XNameAccess> OKeySet::getKeyColumns() const // ----------------------------------------------------------------------------- sal_Bool SAL_CALL OKeySet::next( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::next" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; if(isAfterLast()) @@ -933,16 +953,19 @@ sal_Bool SAL_CALL OKeySet::next( ) throw(SQLException, RuntimeException) // ----------------------------------------------------------------------------- sal_Bool SAL_CALL OKeySet::isBeforeFirst( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::isBeforeFirst" ); return m_aKeyIter == m_aKeyMap.begin(); } // ----------------------------------------------------------------------------- sal_Bool SAL_CALL OKeySet::isAfterLast( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::isAfterLast" ); return m_bRowCountFinal && m_aKeyIter == m_aKeyMap.end(); } // ----------------------------------------------------------------------------- sal_Bool SAL_CALL OKeySet::isFirst( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::isFirst" ); OKeySetMatrix::iterator aTemp = m_aKeyMap.begin(); ++aTemp; return m_aKeyIter == aTemp && m_aKeyIter != m_aKeyMap.end(); @@ -950,6 +973,7 @@ sal_Bool SAL_CALL OKeySet::isFirst( ) throw(SQLException, RuntimeException) // ----------------------------------------------------------------------------- sal_Bool SAL_CALL OKeySet::isLast( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::isLast" ); if(!m_bRowCountFinal) return sal_False; @@ -960,6 +984,7 @@ sal_Bool SAL_CALL OKeySet::isLast( ) throw(SQLException, RuntimeException) // ----------------------------------------------------------------------------- void SAL_CALL OKeySet::beforeFirst( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::beforeFirst" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; m_aKeyIter = m_aKeyMap.begin(); m_xSet = NULL; @@ -968,6 +993,7 @@ void SAL_CALL OKeySet::beforeFirst( ) throw(SQLException, RuntimeException) // ----------------------------------------------------------------------------- void SAL_CALL OKeySet::afterLast( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::afterLast" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; fillAllRows(); m_aKeyIter = m_aKeyMap.end(); @@ -977,6 +1003,7 @@ void SAL_CALL OKeySet::afterLast( ) throw(SQLException, RuntimeException) // ----------------------------------------------------------------------------- sal_Bool SAL_CALL OKeySet::first( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::first" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; m_aKeyIter = m_aKeyMap.begin(); ++m_aKeyIter; @@ -989,6 +1016,7 @@ sal_Bool SAL_CALL OKeySet::first( ) throw(SQLException, RuntimeException) // ----------------------------------------------------------------------------- sal_Bool SAL_CALL OKeySet::last( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::last" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; fillAllRows(); @@ -1000,6 +1028,7 @@ sal_Bool SAL_CALL OKeySet::last( ) throw(SQLException, RuntimeException) // ----------------------------------------------------------------------------- sal_Int32 SAL_CALL OKeySet::getRow( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getRow" ); OSL_ENSURE(!isAfterLast(),"getRow is not allowed when afterlast record!"); OSL_ENSURE(!isBeforeFirst(),"getRow is not allowed when beforefirst record!"); @@ -1008,6 +1037,7 @@ sal_Int32 SAL_CALL OKeySet::getRow( ) throw(SQLException, RuntimeException) // ----------------------------------------------------------------------------- sal_Bool SAL_CALL OKeySet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::absolute" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; OSL_ENSURE(row,"absolute(0) isn't allowed!"); if(row < 0) @@ -1045,6 +1075,7 @@ sal_Bool SAL_CALL OKeySet::absolute( sal_Int32 row ) throw(SQLException, Runtime // ----------------------------------------------------------------------------- sal_Bool SAL_CALL OKeySet::relative( sal_Int32 rows ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::relative" ); if(!rows) { refreshRow(); @@ -1055,6 +1086,7 @@ sal_Bool SAL_CALL OKeySet::relative( sal_Int32 rows ) throw(SQLException, Runtim // ----------------------------------------------------------------------------- sal_Bool SAL_CALL OKeySet::previous( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::previous" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; if(m_aKeyIter != m_aKeyMap.begin()) { @@ -1066,6 +1098,7 @@ sal_Bool SAL_CALL OKeySet::previous( ) throw(SQLException, RuntimeException) // ----------------------------------------------------------------------------- void SAL_CALL OKeySet::refreshRow() throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::refreshRow" ); if(isBeforeFirst() || isAfterLast() || !m_xStatement.is()) return; @@ -1094,6 +1127,7 @@ void SAL_CALL OKeySet::refreshRow() throw(SQLException, RuntimeException) // ----------------------------------------------------------------------------- sal_Bool OKeySet::fetchRow() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::fetchRow" ); // fetch the next row and append on the keyset sal_Bool bRet = sal_False; if ( !m_bRowCountFinal ) @@ -1104,17 +1138,19 @@ sal_Bool OKeySet::fetchRow() connectivity::ORowVector< ORowSetValue >::Vector::iterator aIter = aKeyRow->get().begin(); // first fetch the values needed for the key column SelectColumnsMetaData::const_iterator aPosIter = (*m_pKeyColumnNames).begin(); - for(;aPosIter != (*m_pKeyColumnNames).end();++aPosIter,++aIter) + SelectColumnsMetaData::const_iterator aPosEnd = (*m_pKeyColumnNames).end(); + for(;aPosIter != aPosEnd;++aPosIter,++aIter) { const SelectColumnDescription& rColDesc = aPosIter->second; - aIter->fill(rColDesc.nPosition,rColDesc.nType,m_xDriverRow); + aIter->fill(rColDesc.nPosition,rColDesc.nType,rColDesc.bNullable,m_xDriverRow); } // now fetch the values from the missing columns from other tables aPosIter = (*m_pForeignColumnNames).begin(); - for(;aPosIter != (*m_pForeignColumnNames).end();++aPosIter,++aIter) + aPosEnd = (*m_pForeignColumnNames).end(); + for(;aPosIter != aPosEnd;++aPosIter,++aIter) { const SelectColumnDescription& rColDesc = aPosIter->second; - aIter->fill(rColDesc.nPosition,rColDesc.nType,m_xDriverRow); + aIter->fill(rColDesc.nPosition,rColDesc.nType,rColDesc.bNullable,m_xDriverRow); } m_aKeyIter = m_aKeyMap.insert(OKeySetMatrix::value_type(m_aKeyMap.rbegin()->first+1,OKeySetValue(aKeyRow,0))).first; } @@ -1125,6 +1161,7 @@ sal_Bool OKeySet::fetchRow() // ------------------------------------------------------------------------- void OKeySet::fillAllRows() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::fillAllRows" ); if(!m_bRowCountFinal) { while(fetchRow()) @@ -1134,135 +1171,158 @@ void OKeySet::fillAllRows() // XRow sal_Bool SAL_CALL OKeySet::wasNull( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::wasNull" ); return m_xRow->wasNull(); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OKeySet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getString" ); OSL_ENSURE(m_xRow.is(),"m_xRow is null!"); return m_xRow->getString(columnIndex); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OKeySet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getBoolean" ); OSL_ENSURE(m_xRow.is(),"m_xRow is null!"); return m_xRow->getBoolean(columnIndex); } // ------------------------------------------------------------------------- sal_Int8 SAL_CALL OKeySet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getByte" ); OSL_ENSURE(m_xRow.is(),"m_xRow is null!"); return m_xRow->getByte(columnIndex); } // ------------------------------------------------------------------------- sal_Int16 SAL_CALL OKeySet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getShort" ); OSL_ENSURE(m_xRow.is(),"m_xRow is null!"); return m_xRow->getShort(columnIndex); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OKeySet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getInt" ); OSL_ENSURE(m_xRow.is(),"m_xRow is null!"); return m_xRow->getInt(columnIndex); } // ------------------------------------------------------------------------- sal_Int64 SAL_CALL OKeySet::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getLong" ); OSL_ENSURE(m_xRow.is(),"m_xRow is null!"); return m_xRow->getLong(columnIndex); } // ------------------------------------------------------------------------- float SAL_CALL OKeySet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getFloat" ); OSL_ENSURE(m_xRow.is(),"m_xRow is null!"); return m_xRow->getFloat(columnIndex); } // ------------------------------------------------------------------------- double SAL_CALL OKeySet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getDouble" ); OSL_ENSURE(m_xRow.is(),"m_xRow is null!"); return m_xRow->getDouble(columnIndex); } // ------------------------------------------------------------------------- Sequence< sal_Int8 > SAL_CALL OKeySet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getBytes" ); OSL_ENSURE(m_xRow.is(),"m_xRow is null!"); return m_xRow->getBytes(columnIndex); } // ------------------------------------------------------------------------- ::com::sun::star::util::Date SAL_CALL OKeySet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getDate" ); OSL_ENSURE(m_xRow.is(),"m_xRow is null!"); return m_xRow->getDate(columnIndex); } // ------------------------------------------------------------------------- ::com::sun::star::util::Time SAL_CALL OKeySet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getTime" ); OSL_ENSURE(m_xRow.is(),"m_xRow is null!"); return m_xRow->getTime(columnIndex); } // ------------------------------------------------------------------------- ::com::sun::star::util::DateTime SAL_CALL OKeySet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getTimestamp" ); OSL_ENSURE(m_xRow.is(),"m_xRow is null!"); return m_xRow->getTimestamp(columnIndex); } // ------------------------------------------------------------------------- Reference< ::com::sun::star::io::XInputStream > SAL_CALL OKeySet::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getBinaryStream" ); OSL_ENSURE(m_xRow.is(),"m_xRow is null!"); return m_xRow->getBinaryStream(columnIndex); } // ------------------------------------------------------------------------- Reference< ::com::sun::star::io::XInputStream > SAL_CALL OKeySet::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getCharacterStream" ); OSL_ENSURE(m_xRow.is(),"m_xRow is null!"); return m_xRow->getCharacterStream(columnIndex); } // ------------------------------------------------------------------------- Any SAL_CALL OKeySet::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getObject" ); OSL_ENSURE(m_xRow.is(),"m_xRow is null!"); return m_xRow->getObject(columnIndex,typeMap); } // ------------------------------------------------------------------------- Reference< XRef > SAL_CALL OKeySet::getRef( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getRef" ); OSL_ENSURE(m_xRow.is(),"m_xRow is null!"); return m_xRow->getRef(columnIndex); } // ------------------------------------------------------------------------- Reference< XBlob > SAL_CALL OKeySet::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getBlob" ); OSL_ENSURE(m_xRow.is(),"m_xRow is null!"); return m_xRow->getBlob(columnIndex); } // ------------------------------------------------------------------------- Reference< XClob > SAL_CALL OKeySet::getClob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getClob" ); OSL_ENSURE(m_xRow.is(),"m_xRow is null!"); return m_xRow->getClob(columnIndex); } // ------------------------------------------------------------------------- Reference< XArray > SAL_CALL OKeySet::getArray( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getArray" ); OSL_ENSURE(m_xRow.is(),"m_xRow is null!"); return m_xRow->getArray(columnIndex); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OKeySet::rowUpdated( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::rowUpdated" ); return m_aKeyIter != m_aKeyMap.begin() && m_aKeyIter != m_aKeyMap.end() && m_aKeyIter->second.second == 2; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OKeySet::rowInserted( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::rowInserted" ); return m_aKeyIter != m_aKeyMap.begin() && m_aKeyIter != m_aKeyMap.end() && m_aKeyIter->second.second == 1; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OKeySet::rowDeleted( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::rowDeleted" ); sal_Bool bDeleted = m_bDeleted; m_bDeleted = sal_False; return bDeleted; @@ -1272,6 +1332,7 @@ sal_Bool SAL_CALL OKeySet::rowDeleted( ) throw(SQLException, RuntimeException) const ::rtl::OUString& _sSchema, const ::rtl::OUString& _sTable) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getComposedTableName" ); ::rtl::OUString aComposedName; Reference<XDatabaseMetaData> xMetaData = m_xConnection->getMetaData(); @@ -1340,7 +1401,11 @@ namespace dbaccess if ( xColumnProp->getPropertySetInfo()->hasPropertyByName(PROPERTY_DEFAULTVALUE) ) xColumnProp->getPropertyValue(PROPERTY_DEFAULTVALUE) >>= sColumnDefault; - _rColumnNames[sRealName] = SelectColumnDescription( nPos, nType,nScale, sColumnDefault ); + sal_Int32 bNullable = sal_False; + xColumnProp->getPropertyValue(PROPERTY_ISNULLABLE) >>= bNullable; + + + _rColumnNames[sRealName] = SelectColumnDescription( nPos, nType,nScale,bNullable != sdbc::ColumnValue::NO_NULLS, sColumnDefault ); break; } } diff --git a/dbaccess/source/core/api/KeySet.hxx b/dbaccess/source/core/api/KeySet.hxx index 97f340b926b9..c930d1fe2b2e 100644 --- a/dbaccess/source/core/api/KeySet.hxx +++ b/dbaccess/source/core/api/KeySet.hxx @@ -57,6 +57,7 @@ namespace dbaccess sal_Int32 nPosition; sal_Int32 nType; sal_Int32 nScale; + sal_Bool bNullable; ::rtl::OUString sDefaultValue; @@ -64,14 +65,16 @@ namespace dbaccess :nPosition( 0 ) ,nType( 0 ) ,nScale( 0 ) + ,bNullable(sal_False) ,sDefaultValue() { } - SelectColumnDescription( sal_Int32 _nPosition, sal_Int32 _nType, sal_Int32 _nScale, const ::rtl::OUString& _rDefaultValue ) + SelectColumnDescription( sal_Int32 _nPosition, sal_Int32 _nType, sal_Int32 _nScale,sal_Bool _bNullable, const ::rtl::OUString& _rDefaultValue ) :nPosition( _nPosition ) ,nType( _nType ) ,nScale( _nScale ) + ,bNullable(_bNullable) ,sDefaultValue( _rDefaultValue ) { } diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index e854a91694cf..290c88031349 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -275,6 +275,7 @@ ORowSet::ORowSet( const Reference< ::com::sun::star::lang::XMultiServiceFactory ,m_bCanUpdateInsertedRows(sal_True) ,m_bOwnConnection(sal_False) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::ORowSet" ); m_nResultSetType = ResultSetType::SCROLL_SENSITIVE; m_nResultSetConcurrency = ResultSetConcurrency::UPDATABLE; m_pMySelf = this; @@ -340,6 +341,7 @@ ORowSet::~ORowSet() // ----------------------------------------------------------------------------- void ORowSet::getPropertyDefaultByHandle( sal_Int32 _nHandle, Any& _rDefault ) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getPropertyDefaultByHandle" ); switch( _nHandle ) { case PROPERTY_ID_COMMAND_TYPE: @@ -382,6 +384,7 @@ void ORowSet::getPropertyDefaultByHandle( sal_Int32 _nHandle, Any& _rDefault ) c void SAL_CALL ORowSet::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) throw (Exception) { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setFastPropertyValue_NoBroadcast" ); switch(nHandle) { case PROPERTY_ID_ISMODIFIED: @@ -471,6 +474,7 @@ void SAL_CALL ORowSet::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const // ------------------------------------------------------------------------- void SAL_CALL ORowSet::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getFastPropertyValue" ); if(m_pCache) { switch(nHandle) @@ -513,6 +517,7 @@ void SAL_CALL ORowSet::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const // com::sun::star::XTypeProvider Sequence< Type > SAL_CALL ORowSet::getTypes() throw (RuntimeException) { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getTypes" ); OTypeCollection aTypes(::getCppuType( (const Reference< XPropertySet > *)0 ), ::getCppuType( (const Reference< XFastPropertySet > *)0 ), ::getCppuType( (const Reference< XMultiPropertySet > *)0 ), @@ -522,6 +527,7 @@ Sequence< Type > SAL_CALL ORowSet::getTypes() throw (RuntimeException) // ------------------------------------------------------------------------- Sequence< sal_Int8 > SAL_CALL ORowSet::getImplementationId() throw (RuntimeException) { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getImplementationId" ); static OImplementationId * pId = 0; if (! pId) { @@ -539,6 +545,7 @@ Sequence< sal_Int8 > SAL_CALL ORowSet::getImplementationId() throw (RuntimeExcep // com::sun::star::XInterface Any SAL_CALL ORowSet::queryInterface( const Type & rType ) throw (RuntimeException) { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::queryInterface" ); return ORowSet_BASE1::queryInterface( rType); } // ------------------------------------------------------------------------- @@ -556,6 +563,7 @@ void SAL_CALL ORowSet::release() throw() // com::sun::star::XUnoTunnel sal_Int64 SAL_CALL ORowSet::getSomething( const Sequence< sal_Int8 >& rId ) throw(RuntimeException) { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getSomething" ); if (rId.getLength() == 16 && 0 == rtl_compareMemory(getImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) return reinterpret_cast<sal_Int64>(this); @@ -565,6 +573,7 @@ sal_Int64 SAL_CALL ORowSet::getSomething( const Sequence< sal_Int8 >& rId ) thro // com::sun::star::XAggregation Any SAL_CALL ORowSet::queryAggregation( const Type& rType ) throw(RuntimeException) { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::queryAggregation" ); Any aRet(ORowSetBase::queryInterface(rType)); if (!aRet.hasValue()) aRet = ORowSet_BASE1::queryAggregation(rType); @@ -573,22 +582,26 @@ Any SAL_CALL ORowSet::queryAggregation( const Type& rType ) throw(RuntimeExcepti //------------------------------------------------------------------------------ rtl::OUString ORowSet::getImplementationName_static( ) throw(RuntimeException) { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getImplementationName_static" ); return rtl::OUString::createFromAscii("com.sun.star.comp.dba.ORowSet"); } // ------------------------------------------------------------------------- // ::com::sun::star::XServiceInfo ::rtl::OUString SAL_CALL ORowSet::getImplementationName( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getImplementationName" ); return getImplementationName_static(); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ORowSet::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::supportsService" ); return ::comphelper::findValue(getSupportedServiceNames(), _rServiceName, sal_True).getLength() != 0; } //------------------------------------------------------------------------------ Sequence< ::rtl::OUString > ORowSet::getSupportedServiceNames_static( ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getSupportedServiceNames_static" ); Sequence< rtl::OUString > aSNS( 5 ); aSNS[0] = SERVICE_SDBC_RESULTSET; aSNS[1] = SERVICE_SDBC_ROWSET; @@ -600,11 +613,13 @@ Sequence< ::rtl::OUString > ORowSet::getSupportedServiceNames_static( ) throw ( // ------------------------------------------------------------------------- Sequence< ::rtl::OUString > SAL_CALL ORowSet::getSupportedServiceNames( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getSupportedServiceNames" ); return getSupportedServiceNames_static(); } //------------------------------------------------------------------------------ Reference< XInterface > ORowSet::Create(const Reference< XComponentContext >& _rxContext) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::Create" ); ::comphelper::ComponentContext aContext( _rxContext ); return ORowSet_CreateInstance( aContext.getLegacyServiceFactory() ); } @@ -612,6 +627,7 @@ Reference< XInterface > ORowSet::Create(const Reference< XComponentContext >& _r // OComponentHelper void SAL_CALL ORowSet::disposing() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::disposing" ); OPropertyStateContainer::disposing(); MutexGuard aGuard(m_aMutex); @@ -642,6 +658,7 @@ void SAL_CALL ORowSet::disposing() // ------------------------------------------------------------------------- void ORowSet::freeResources( bool _bComplete ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::freeResources" ); MutexGuard aGuard(m_aMutex); // free all clones @@ -695,6 +712,7 @@ void ORowSet::freeResources( bool _bComplete ) // ------------------------------------------------------------------------- void ORowSet::setActiveConnection( Reference< XConnection >& _rxNewConn, sal_Bool _bFireEvent ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setActiveConnection" ); if (_rxNewConn.get() == m_xActiveConnection.get()) // nothing to do return; @@ -742,6 +760,7 @@ void ORowSet::setActiveConnection( Reference< XConnection >& _rxNewConn, sal_Boo // ::com::sun::star::XEventListener void SAL_CALL ORowSet::disposing( const ::com::sun::star::lang::EventObject& Source ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::disposing" ); // close rowset because the connection is going to be deleted (someone told me :-) Reference<XConnection> xCon(Source.Source,UNO_QUERY); if(m_xActiveConnection == xCon) @@ -759,6 +778,7 @@ void SAL_CALL ORowSet::disposing( const ::com::sun::star::lang::EventObject& Sou // XCloseable void SAL_CALL ORowSet::close( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::close" ); { MutexGuard aGuard( m_aMutex ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); @@ -770,6 +790,7 @@ void SAL_CALL ORowSet::close( ) throw(SQLException, RuntimeException) // comphelper::OPropertyArrayUsageHelper ::cppu::IPropertyArrayHelper* ORowSet::createArrayHelper( ) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::createArrayHelper" ); Sequence< Property > aProps; describeProperties(aProps); return new ::cppu::OPropertyArrayHelper(aProps); @@ -778,12 +799,14 @@ void SAL_CALL ORowSet::close( ) throw(SQLException, RuntimeException) // cppu::OPropertySetHelper ::cppu::IPropertyArrayHelper& SAL_CALL ORowSet::getInfoHelper() { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getInfoHelper" ); typedef ::comphelper::OPropertyArrayUsageHelper<ORowSet> ORowSet_PROP; return *ORowSet_PROP::getArrayHelper(); } // ----------------------------------------------------------------------------- void ORowSet::updateValue(sal_Int32 columnIndex,const ORowSetValue& x) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::updateValue" ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); ::osl::MutexGuard aGuard( *m_pMutex ); @@ -801,71 +824,85 @@ void ORowSet::updateValue(sal_Int32 columnIndex,const ORowSetValue& x) // XRowUpdate void SAL_CALL ORowSet::updateNull( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::updateNull" ); updateValue(columnIndex,ORowSetValue()); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::updateBoolean" ); updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::updateByte" ); updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::updateShort" ); updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::updateInt" ); updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::updateLong" ); updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::updateFloat( sal_Int32 columnIndex, float x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::updateFloat" ); updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::updateDouble( sal_Int32 columnIndex, double x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::updateDouble" ); updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::updateString" ); updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::updateBytes( sal_Int32 columnIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::updateBytes" ); updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::updateDate" ); updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::updateTime" ); updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::updateTimestamp" ); updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::updateBinaryStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::updateBinaryStream" ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); ::osl::MutexGuard aGuard( *m_pMutex ); @@ -896,6 +933,7 @@ void SAL_CALL ORowSet::updateBinaryStream( sal_Int32 columnIndex, const Referenc // ------------------------------------------------------------------------- void SAL_CALL ORowSet::updateCharacterStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::updateCharacterStream" ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); ::osl::MutexGuard aGuard( *m_pMutex ); @@ -912,6 +950,7 @@ void SAL_CALL ORowSet::updateCharacterStream( sal_Int32 columnIndex, const Refer // ------------------------------------------------------------------------- void SAL_CALL ORowSet::updateObject( sal_Int32 columnIndex, const Any& x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::updateObject" ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); ::osl::MutexGuard aGuard( *m_pMutex ); @@ -960,6 +999,7 @@ void SAL_CALL ORowSet::updateObject( sal_Int32 columnIndex, const Any& x ) throw // ------------------------------------------------------------------------- void SAL_CALL ORowSet::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 scale ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::updateNumericObject" ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); ::osl::MutexGuard aGuard( *m_pMutex ); @@ -978,6 +1018,7 @@ void SAL_CALL ORowSet::updateNumericObject( sal_Int32 columnIndex, const Any& x, // XResultSetUpdate void SAL_CALL ORowSet::insertRow( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::insertRow" ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); // insertRow is not allowd when // standing not on the insert row nor @@ -1027,15 +1068,17 @@ void SAL_CALL ORowSet::insertRow( ) throw(SQLException, RuntimeException) // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ORowSet::getRow( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getRow" ); ::osl::MutexGuard aGuard( *m_pMutex ); checkCache(); // check if we are inserting a row - return (m_pCache && ( m_pCache->m_bNew || m_bModified )) ? 0 : ORowSetBase::getRow(); + return (m_pCache && ( m_pCache->m_bNew || m_bModified )) ? 0 : impl_getRow(); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::updateRow( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::updateRow" ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); // not allowed when standing on insert row ::osl::ResettableMutexGuard aGuard( *m_pMutex ); @@ -1073,6 +1116,7 @@ void SAL_CALL ORowSet::updateRow( ) throw(SQLException, RuntimeException) // ------------------------------------------------------------------------- void SAL_CALL ORowSet::deleteRow( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::deleteRow" ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); ::osl::ResettableMutexGuard aGuard( *m_pMutex ); @@ -1090,7 +1134,7 @@ void SAL_CALL ORowSet::deleteRow( ) throw(SQLException, RuntimeException) if ( ( m_pCache->m_nPrivileges & Privilege::DELETE ) != Privilege::DELETE ) throwSQLException( "DELETE privilege not available.", SQL_FUNCTION_SEQUENCE_ERROR, *this ); // TODO: resource - if ( rowDeleted() ) + if ( impl_rowDeleted() ) throwSQLException( "Current row already deleted.", SQL_FUNCTION_SEQUENCE_ERROR, *this ); // TODO: resource @@ -1129,6 +1173,7 @@ void SAL_CALL ORowSet::deleteRow( ) throw(SQLException, RuntimeException) // ------------------------------------------------------------------------- void ORowSet::implCancelRowUpdates( sal_Bool _bNotifyModified ) SAL_THROW( ( SQLException, RuntimeException ) ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::implCancelRowUpdates" ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); ::osl::MutexGuard aGuard( *m_pMutex ); @@ -1166,12 +1211,14 @@ void ORowSet::implCancelRowUpdates( sal_Bool _bNotifyModified ) SAL_THROW( ( SQL // ------------------------------------------------------------------------- void SAL_CALL ORowSet::cancelRowUpdates( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::cancelRowUpdates" ); implCancelRowUpdates( sal_True ); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::addRowSetListener( const Reference< XRowSetListener >& listener ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::addRowSetListener" ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aColumnsMutex ); @@ -1181,6 +1228,7 @@ void SAL_CALL ORowSet::addRowSetListener( const Reference< XRowSetListener >& li // ------------------------------------------------------------------------- void SAL_CALL ORowSet::removeRowSetListener( const Reference< XRowSetListener >& listener ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::removeRowSetListener" ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aColumnsMutex ); @@ -1190,6 +1238,7 @@ void SAL_CALL ORowSet::removeRowSetListener( const Reference< XRowSetListener >& // ----------------------------------------------------------------------------- void ORowSet::notifyAllListeners(::osl::ResettableMutexGuard& _rGuard) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::notifyAllListeners" ); EventObject aEvt(*m_pMySelf); _rGuard.clear(); m_aRowsetListeners.notifyEach( &XRowSetListener::rowSetChanged, aEvt ); @@ -1198,6 +1247,7 @@ void ORowSet::notifyAllListeners(::osl::ResettableMutexGuard& _rGuard) // ------------------------------------------------------------------------- void ORowSet::notifyAllListenersCursorMoved(::osl::ResettableMutexGuard& _rGuard) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::notifyAllListenersCursorMoved" ); EventObject aEvt(*m_pMySelf); _rGuard.clear(); m_aRowsetListeners.notifyEach( &XRowSetListener::cursorMoved, aEvt ); @@ -1206,6 +1256,7 @@ void ORowSet::notifyAllListenersCursorMoved(::osl::ResettableMutexGuard& _rGuard // ------------------------------------------------------------------------- void ORowSet::notifyAllListenersRowChanged(::osl::ResettableMutexGuard& _rGuard, const EventObject& aEvt) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::notifyAllListenersRowChanged" ); _rGuard.clear(); m_aRowsetListeners.notifyEach( &XRowSetListener::rowChanged, aEvt ); _rGuard.reset(); @@ -1213,6 +1264,7 @@ void ORowSet::notifyAllListenersRowChanged(::osl::ResettableMutexGuard& _rGuard, // ------------------------------------------------------------------------- sal_Bool ORowSet::notifyAllListenersCursorBeforeMove(::osl::ResettableMutexGuard& _rGuard) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::notifyAllListenersCursorBeforeMove" ); EventObject aEvt(*m_pMySelf); NOTIFY_LISTERNERS_CHECK(m_aApproveListeners,XRowSetApproveListener,approveCursorMove); return bCheck; @@ -1220,6 +1272,7 @@ sal_Bool ORowSet::notifyAllListenersCursorBeforeMove(::osl::ResettableMutexGuard // ------------------------------------------------------------------------- void ORowSet::notifyAllListenersRowBeforeChange(::osl::ResettableMutexGuard& _rGuard,const RowChangeEvent &aEvt) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::notifyAllListenersRowBeforeChange" ); NOTIFY_LISTERNERS_CHECK(m_aApproveListeners,XRowSetApproveListener,approveRowChange); if ( !bCheck ) m_aErrors.raiseTypedException( sdb::ErrorCondition::ROW_SET_OPERATION_VETOED, *this, ::cppu::UnoType< RowSetVetoException >::get() ); @@ -1227,6 +1280,7 @@ void ORowSet::notifyAllListenersRowBeforeChange(::osl::ResettableMutexGuard& _rG // ------------------------------------------------------------------------- void ORowSet::fireRowcount() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::fireRowcount" ); sal_Int32 nCurrentRowCount( impl_getRowCount() ); sal_Bool bCurrentRowCountFinal( m_pCache->m_bRowCountFinal ); @@ -1251,6 +1305,7 @@ void ORowSet::fireRowcount() // ------------------------------------------------------------------------- void SAL_CALL ORowSet::moveToInsertRow( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::moveToInsertRow" ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); ::osl::ResettableMutexGuard aGuard( *m_pMutex ); @@ -1308,6 +1363,7 @@ void SAL_CALL ORowSet::moveToInsertRow( ) throw(SQLException, RuntimeException) // ------------------------------------------------------------------------- void SAL_CALL ORowSet::moveToCurrentRow( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::moveToCurrentRow" ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); ::osl::ResettableMutexGuard aGuard( *m_pMutex ); @@ -1345,96 +1401,111 @@ void SAL_CALL ORowSet::moveToCurrentRow( ) throw(SQLException, RuntimeException // XRow sal_Bool SAL_CALL ORowSet::wasNull( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::wasNull" ); ::osl::MutexGuard aGuard( *m_pMutex ); checkCache(); - return ( m_pCache && isInsertRow() ) ? ((*m_pCache->m_aInsertRow)->get())[m_nLastColumnIndex].isNull() : ORowSetBase::wasNull(); + return ( m_pCache && isInsertRow() ) ? ((*m_pCache->m_aInsertRow)->get())[m_nLastColumnIndex].isNull() : impl_wasNull(); } // ----------------------------------------------------------------------------- const ORowSetValue& ORowSet::getInsertValue(sal_Int32 columnIndex) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getInsertValue" ); checkCache(); if ( m_pCache && isInsertRow() ) return ((*m_pCache->m_aInsertRow)->get())[m_nLastColumnIndex = columnIndex]; - return getValue(columnIndex); + return impl_getValue(columnIndex); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ORowSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getString" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ORowSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getBoolean" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } // ------------------------------------------------------------------------- sal_Int8 SAL_CALL ORowSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getByte" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } // ------------------------------------------------------------------------- sal_Int16 SAL_CALL ORowSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getShort" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ORowSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getInt" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } // ------------------------------------------------------------------------- sal_Int64 SAL_CALL ORowSet::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getLong" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } // ------------------------------------------------------------------------- float SAL_CALL ORowSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getFloat" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } // ------------------------------------------------------------------------- double SAL_CALL ORowSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getDouble" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } // ------------------------------------------------------------------------- Sequence< sal_Int8 > SAL_CALL ORowSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getBytes" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } // ------------------------------------------------------------------------- ::com::sun::star::util::Date SAL_CALL ORowSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getDate" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } // ------------------------------------------------------------------------- ::com::sun::star::util::Time SAL_CALL ORowSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getTime" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } // ------------------------------------------------------------------------- ::com::sun::star::util::DateTime SAL_CALL ORowSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getTimestamp" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } // ------------------------------------------------------------------------- Reference< ::com::sun::star::io::XInputStream > SAL_CALL ORowSet::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getBinaryStream" ); ::osl::MutexGuard aGuard( *m_pMutex ); if ( m_pCache && isInsertRow() ) { @@ -1447,6 +1518,7 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL ORowSet::getBinaryStrea // ------------------------------------------------------------------------- Reference< ::com::sun::star::io::XInputStream > SAL_CALL ORowSet::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getCharacterStream" ); ::osl::MutexGuard aGuard( *m_pMutex ); if(m_pCache && isInsertRow() ) { @@ -1459,32 +1531,38 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL ORowSet::getCharacterSt // ------------------------------------------------------------------------- Any SAL_CALL ORowSet::getObject( sal_Int32 columnIndex, const Reference< XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getObject" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex).makeAny(); } // ------------------------------------------------------------------------- Reference< XRef > SAL_CALL ORowSet::getRef( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getRef" ); return Reference< XRef >(); } // ------------------------------------------------------------------------- Reference< XBlob > SAL_CALL ORowSet::getBlob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getBlob" ); return Reference< XBlob >(); } // ------------------------------------------------------------------------- Reference< XClob > SAL_CALL ORowSet::getClob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getClob" ); return Reference< XClob >(); } // ------------------------------------------------------------------------- Reference< XArray > SAL_CALL ORowSet::getArray( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getArray" ); return Reference< XArray >(); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::executeWithCompletion( const Reference< XInteractionHandler >& _rxHandler ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::executeWithCompletion" ); if (!_rxHandler.is()) execute(); @@ -1535,6 +1613,7 @@ void SAL_CALL ORowSet::executeWithCompletion( const Reference< XInteractionHandl // ------------------------------------------------------------------------- Reference< XIndexAccess > SAL_CALL ORowSet::getParameters( ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getParameters" ); ::osl::MutexGuard aGuard( *m_pMutex ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); @@ -1562,6 +1641,7 @@ Reference< XIndexAccess > SAL_CALL ORowSet::getParameters( ) throw (RuntimeExce // ------------------------------------------------------------------------- void ORowSet::approveExecution() throw (RowSetVetoException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::approveExecution" ); ::osl::MutexGuard aGuard( m_aColumnsMutex ); EventObject aEvt(*this); @@ -1592,6 +1672,7 @@ void ORowSet::approveExecution() throw (RowSetVetoException, RuntimeException) // ------------------------------------------------------------------------- void SAL_CALL ORowSet::execute( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::execute" ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); // tell everybody that we will change the result set @@ -1617,6 +1698,7 @@ void SAL_CALL ORowSet::execute( ) throw(SQLException, RuntimeException) //------------------------------------------------------------------------------ void ORowSet::setStatementResultSetType( const Reference< XPropertySet >& _rxStatement, sal_Int32 _nDesiredResultSetType, sal_Int32 _nDesiredResultSetConcurrency ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setStatementResultSetType" ); OSL_ENSURE( _rxStatement.is(), "ORowSet::setStatementResultSetType: invalid statement - this will crash!" ); sal_Int32 nResultSetType( _nDesiredResultSetType ); @@ -1667,6 +1749,7 @@ void ORowSet::setStatementResultSetType( const Reference< XPropertySet >& _rxSta // ----------------------------------------------------------------------------- Reference< XResultSet > ORowSet::impl_prepareAndExecute_throw() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::impl_prepareAndExecute_throw" ); ::rtl::OUString sCommandToExecute; sal_Bool bUseEscapeProcessing = impl_initComposer_throw( sCommandToExecute ); @@ -1731,6 +1814,7 @@ Reference< XResultSet > ORowSet::impl_prepareAndExecute_throw() // ----------------------------------------------------------------------------- void ORowSet::impl_initializeColumnSettings_nothrow( const Reference< XPropertySet >& _rxTemplateColumn, const Reference< XPropertySet >& _rxRowSetColumn ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::impl_initializeColumnSettings_nothrow" ); OSL_ENSURE( _rxTemplateColumn.is() && _rxRowSetColumn.is(), "ORowSet::impl_initializeColumnSettings_nothrow: this will crash!" ); @@ -1934,6 +2018,7 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi else { // create the rowset columns + const Reference< XDatabaseMetaData > xDatabaseMetaData( m_xActiveConnection->getMetaData() ); Reference< XResultSetMetaData > xMeta( getMetaData(), UNO_QUERY_THROW ); sal_Int32 nCount = xMeta->getColumnCount(); m_aDataColumns.reserve(nCount+1); @@ -1988,7 +2073,7 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi this, this, i, - m_xActiveConnection->getMetaData(), + xDatabaseMetaData, aDescription, m_aCurrentRow); aColumns->get().push_back(pColumn); @@ -2027,6 +2112,7 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi // XRowSetApproveBroadcaster void SAL_CALL ORowSet::addRowSetApproveListener( const Reference< XRowSetApproveListener >& listener ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::addRowSetApproveListener" ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aColumnsMutex ); @@ -2036,6 +2122,7 @@ void SAL_CALL ORowSet::addRowSetApproveListener( const Reference< XRowSetApprove // ------------------------------------------------------------------------- void SAL_CALL ORowSet::removeRowSetApproveListener( const Reference< XRowSetApproveListener >& listener ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::removeRowSetApproveListener" ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aColumnsMutex ); @@ -2047,6 +2134,7 @@ void SAL_CALL ORowSet::removeRowSetApproveListener( const Reference< XRowSetAppr // XResultSetAccess Reference< XResultSet > SAL_CALL ORowSet::createResultSet( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::createResultSet" ); ::osl::MutexGuard aGuard( m_aColumnsMutex ); if(m_xStatement.is()) @@ -2063,6 +2151,7 @@ Reference< XResultSet > SAL_CALL ORowSet::createResultSet( ) throw(SQLException // ::com::sun::star::util::XCancellable void SAL_CALL ORowSet::cancel( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::cancel" ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); } // ------------------------------------------------------------------------- @@ -2070,6 +2159,7 @@ void SAL_CALL ORowSet::cancel( ) throw(RuntimeException) // ::com::sun::star::sdbcx::XDeleteRows Sequence< sal_Int32 > SAL_CALL ORowSet::deleteRows( const Sequence< Any >& rows ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::deleteRows" ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); if(!m_pCache || m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY) @@ -2123,6 +2213,7 @@ Sequence< sal_Int32 > SAL_CALL ORowSet::deleteRows( const Sequence< Any >& rows // ----------------------------------------------------------------------------- void ORowSet::notifyRowSetAndClonesRowDelete( const Any& _rBookmark ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::notifyRowSetAndClonesRowDelete" ); // notify ourself onDeleteRow( _rBookmark ); // notify the clones @@ -2140,6 +2231,7 @@ void ORowSet::notifyRowSetAndClonesRowDelete( const Any& _rBookmark ) //------------------------------------------------------------------------------ void ORowSet::notifyRowSetAndClonesRowDeleted( const Any& _rBookmark, sal_Int32 _nPos ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::notifyRowSetAndClonesRowDeleted" ); // notify ourself onDeletedRow( _rBookmark, _nPos ); // notify the clones @@ -2157,6 +2249,7 @@ void ORowSet::notifyRowSetAndClonesRowDeleted( const Any& _rBookmark, sal_Int32 //------------------------------------------------------------------------------ Reference< XConnection > ORowSet::calcConnection(const Reference< XInteractionHandler >& _rxHandler) throw( SQLException, RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::calcConnection" ); MutexGuard aGuard(m_aMutex); if (!m_xActiveConnection.is()) { @@ -2201,6 +2294,7 @@ Reference< XConnection > ORowSet::calcConnection(const Reference< XInteractionH //------------------------------------------------------------------------------ Reference< XNameAccess > ORowSet::impl_getTables_throw() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::impl_getTables_throw" ); Reference< XNameAccess > xTables; Reference< XTablesSupplier > xTablesAccess( m_xActiveConnection, UNO_QUERY ); @@ -2241,6 +2335,7 @@ Reference< XNameAccess > ORowSet::impl_getTables_throw() //------------------------------------------------------------------------------ void ORowSet::impl_resetTables_nothrow() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::impl_resetTables_nothrow" ); if ( !m_pTables ) return; @@ -2259,6 +2354,7 @@ void ORowSet::impl_resetTables_nothrow() //------------------------------------------------------------------------------ sal_Bool ORowSet::impl_initComposer_throw( ::rtl::OUString& _out_rCommandToExecute ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::impl_initComposer_throw" ); sal_Bool bUseEscapeProcessing = impl_buildActiveCommand_throw( ); _out_rCommandToExecute = m_aActiveCommand; if ( !bUseEscapeProcessing ) @@ -2309,6 +2405,7 @@ sal_Bool ORowSet::impl_initComposer_throw( ::rtl::OUString& _out_rCommandToExecu //------------------------------------------------------------------------------ sal_Bool ORowSet::impl_buildActiveCommand_throw() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::impl_buildActiveCommand_throw" ); // create the sql command // from a table name or get the command out of a query (not a view) // the last use the command as it is @@ -2419,6 +2516,7 @@ sal_Bool ORowSet::impl_buildActiveCommand_throw() //------------------------------------------------------------------------------ void ORowSet::impl_initParametersContainer_nothrow() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::impl_initParametersContainer_nothrow" ); OSL_PRECOND( !m_pParameters.is(), "ORowSet::impl_initParametersContainer_nothrow: already initialized the parameters!" ); m_pParameters = new param::ParameterWrapperContainer( m_xComposer.get() ); @@ -2433,6 +2531,7 @@ void ORowSet::impl_initParametersContainer_nothrow() //------------------------------------------------------------------------------ void ORowSet::impl_disposeParametersContainer_nothrow() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::impl_disposeParametersContainer_nothrow" ); if ( !m_pParameters.is() ) return; @@ -2451,6 +2550,7 @@ void ORowSet::impl_disposeParametersContainer_nothrow() // ----------------------------------------------------------------------------- ORowSetValue& ORowSet::getParameterStorage(sal_Int32 parameterIndex) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getParameterStorage" ); ::connectivity::checkDisposed( ORowSet_BASE1::rBHelper.bDisposed ); if ( parameterIndex < 1 ) throwInvalidIndexException( *this ); @@ -2477,6 +2577,7 @@ ORowSetValue& ORowSet::getParameterStorage(sal_Int32 parameterIndex) // XParameters void SAL_CALL ORowSet::setNull( sal_Int32 parameterIndex, sal_Int32 /*sqlType*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setNull" ); ::osl::MutexGuard aGuard( m_aColumnsMutex ); getParameterStorage( parameterIndex ).setNull(); @@ -2484,11 +2585,13 @@ void SAL_CALL ORowSet::setNull( sal_Int32 parameterIndex, sal_Int32 /*sqlType*/ // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& /*typeName*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setObjectNull" ); setNull( parameterIndex, sqlType ); } // ----------------------------------------------------------------------------- void ORowSet::setParameter(sal_Int32 parameterIndex, const ORowSetValue& x) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setParameter" ); ::osl::MutexGuard aGuard( m_aColumnsMutex ); getParameterStorage( parameterIndex ) = x; @@ -2497,66 +2600,79 @@ void ORowSet::setParameter(sal_Int32 parameterIndex, const ORowSetValue& x) // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setBoolean" ); setParameter(parameterIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setByte" ); setParameter(parameterIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setShort" ); setParameter(parameterIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setInt" ); setParameter(parameterIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setLong( sal_Int32 parameterIndex, sal_Int64 x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setLong" ); setParameter(parameterIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setFloat( sal_Int32 parameterIndex, float x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setFloat" ); setParameter(parameterIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setDouble( sal_Int32 parameterIndex, double x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setDouble" ); setParameter(parameterIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setString" ); setParameter(parameterIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setBytes( sal_Int32 parameterIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setBytes" ); setParameter(parameterIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setDate( sal_Int32 parameterIndex, const ::com::sun::star::util::Date& x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setDate" ); setParameter(parameterIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setTime( sal_Int32 parameterIndex, const ::com::sun::star::util::Time& x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setTime" ); setParameter(parameterIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setTimestamp( sal_Int32 parameterIndex, const ::com::sun::star::util::DateTime& x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setTimestamp" ); setParameter(parameterIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setBinaryStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setBinaryStream" ); ::osl::MutexGuard aGuard( m_aColumnsMutex ); ORowSetValue& rParamValue( getParameterStorage( parameterIndex ) ); @@ -2575,6 +2691,7 @@ void SAL_CALL ORowSet::setBinaryStream( sal_Int32 parameterIndex, const Referenc // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setCharacterStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setCharacterStream" ); ::osl::MutexGuard aGuard( m_aColumnsMutex ); ORowSetValue& rParamValue( getParameterStorage( parameterIndex ) ); try @@ -2597,6 +2714,7 @@ void SAL_CALL ORowSet::setCharacterStream( sal_Int32 parameterIndex, const Refer // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setObject( sal_Int32 parameterIndex, const Any& x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setObject" ); if ( !::dbtools::implSetObject( this, parameterIndex, x ) ) { // there is no other setXXX call which can handle the value in x throw SQLException(); @@ -2605,6 +2723,7 @@ void SAL_CALL ORowSet::setObject( sal_Int32 parameterIndex, const Any& x ) throw // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setObjectWithInfo( sal_Int32 parameterIndex, const Any& x, sal_Int32 targetSqlType, sal_Int32 /*scale*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setObjectWithInfo" ); ::osl::MutexGuard aGuard( m_aColumnsMutex ); ORowSetValue& rParamValue( getParameterStorage( parameterIndex ) ); setObject( parameterIndex, x ); @@ -2613,26 +2732,31 @@ void SAL_CALL ORowSet::setObjectWithInfo( sal_Int32 parameterIndex, const Any& x // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setRef( sal_Int32 /*parameterIndex*/, const Reference< XRef >& /*x*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setRef" ); ::dbtools::throwFeatureNotImplementedException( "XParameters::setRef", *this ); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setBlob( sal_Int32 /*parameterIndex*/, const Reference< XBlob >& /*x*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setBlob" ); ::dbtools::throwFeatureNotImplementedException( "XParameters::setBlob", *this ); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setClob( sal_Int32 /*parameterIndex*/, const Reference< XClob >& /*x*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setClob" ); ::dbtools::throwFeatureNotImplementedException( "XParameters::setClob", *this ); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setArray( sal_Int32 /*parameterIndex*/, const Reference< XArray >& /*x*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setArray" ); ::dbtools::throwFeatureNotImplementedException( "XParameters::setArray", *this ); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::clearParameters( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::clearParameters" ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aColumnsMutex ); @@ -2644,6 +2768,7 @@ void SAL_CALL ORowSet::clearParameters( ) throw(SQLException, RuntimeException) // ------------------------------------------------------------------------- void ORowSet::firePropertyChange(sal_Int32 _nPos,const ::connectivity::ORowSetValue& _rOldValue) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::firePropertyChange" ); OSL_ENSURE(_nPos < (sal_Int32)m_aDataColumns.size(),"nPos is invalid!"); m_aDataColumns[_nPos]->fireValueChange(_rOldValue); } @@ -2651,6 +2776,7 @@ void ORowSet::firePropertyChange(sal_Int32 _nPos,const ::connectivity::ORowSetVa // ----------------------------------------------------------------------------- void ORowSet::doCancelModification( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::doCancelModification" ); //OSL_ENSURE( isModification(), "ORowSet::doCancelModification: invalid call (no cache!)!" ); if ( isModification() ) m_pCache->cancelRowModification(); @@ -2660,24 +2786,28 @@ void ORowSet::doCancelModification( ) // ----------------------------------------------------------------------------- sal_Bool ORowSet::isModification( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::isModification" ); return isNew(); } // ----------------------------------------------------------------------------- sal_Bool ORowSet::isModified( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::isModified" ); return m_bModified; } // ----------------------------------------------------------------------------- sal_Bool ORowSet::isNew( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::isNew" ); return m_bNew; } // ----------------------------------------------------------------------------- void ORowSet::checkUpdateIterator() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::checkUpdateIterator" ); if(!m_bModified && !m_bNew) { m_pCache->setUpdateIterator(m_aCurrentRow); @@ -2690,11 +2820,12 @@ void ORowSet::checkUpdateIterator() // ----------------------------------------------------------------------------- void ORowSet::checkUpdateConditions(sal_Int32 columnIndex) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::checkUpdateConditions" ); checkCache(); if ( columnIndex <= 0 ) throwSQLException( "Invalid column index", SQL_INVALID_DESCRIPTOR_INDEX, *this ); // TODO: resource - if ( rowDeleted() ) + if ( impl_rowDeleted() ) throwSQLException( "Current row is deleted", SQL_INVALID_CURSOR_POSITION, *this ); // TODO: resource if ( m_aCurrentRow.isNull() ) @@ -2710,6 +2841,7 @@ void ORowSet::checkUpdateConditions(sal_Int32 columnIndex) // ----------------------------------------------------------------------------- void SAL_CALL ORowSet::refreshRow( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::refreshRow" ); ORowSetNotifier aNotifier( this ); // this will call cancelRowModification on the cache if necessary @@ -2761,27 +2893,29 @@ ORowSetClone::ORowSetClone( const ::comphelper::ComponentContext& _rContext, ORo // Locale aLocale; // pConfigMgr->GetDirectConfigProperty(ConfigManager::LOCALE) >>= aLocale; Locale aLocale = SvtSysLocale().GetLocaleData().getLocale(); + const Reference<XDatabaseMetaData> xMetaData( rParent.m_xActiveConnection->getMetaData() ); + const Reference< XResultSetMetaData > xRowMetaData( rParent.getMetaData() ); Sequence< ::rtl::OUString> aSeq = rParent.m_pColumns->getElementNames(); - const ::rtl::OUString* pBegin = aSeq.getConstArray(); - const ::rtl::OUString* pEnd = pBegin + aSeq.getLength(); + const ::rtl::OUString* pIter = aSeq.getConstArray(); + const ::rtl::OUString* pEnd = pIter + aSeq.getLength(); aColumns->get().reserve(aSeq.getLength()+1); - for(sal_Int32 i=1;pBegin != pEnd ;++pBegin,++i) + for(sal_Int32 i=1;pIter != pEnd ;++pIter,++i) { Reference<XPropertySet> xColumn; - rParent.m_pColumns->getByName(*pBegin) >>= xColumn; + rParent.m_pColumns->getByName(*pIter) >>= xColumn; if(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_DESCRIPTION)) aDescription = comphelper::getString(xColumn->getPropertyValue(PROPERTY_DESCRIPTION)); - ORowSetColumn* pColumn = new ORowSetColumn( rParent.getMetaData(), - this, - i, - rParent.m_xActiveConnection->getMetaData(), - aDescription, - m_aCurrentRow); + ORowSetColumn* pColumn = new ORowSetColumn( xRowMetaData, + this, + i, + xMetaData, + aDescription, + m_aCurrentRow); aColumns->get().push_back(pColumn); - pColumn->setName(*pBegin); - aNames.push_back(*pBegin); + pColumn->setName(*pIter); + aNames.push_back(*pIter); m_aDataColumns.push_back(pColumn); pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_ALIGN,xColumn->getPropertyValue(PROPERTY_ALIGN)); @@ -2797,8 +2931,7 @@ ORowSetClone::ORowSetClone( const ::comphelper::ComponentContext& _rContext, ORo pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_CONTROLDEFAULT,xColumn->getPropertyValue(PROPERTY_CONTROLDEFAULT)); } - Reference<XDatabaseMetaData> xMeta = rParent.m_xActiveConnection->getMetaData(); - m_pColumns = new ORowSetDataColumns(xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers(), + m_pColumns = new ORowSetDataColumns(xMetaData.is() && xMetaData->supportsMixedCaseQuotedIdentifiers(), aColumns,*this,m_aMutex,aNames); sal_Int32 nRT = PropertyAttribute::READONLY | PropertyAttribute::TRANSIENT; diff --git a/dbaccess/source/core/api/RowSetBase.cxx b/dbaccess/source/core/api/RowSetBase.cxx index ec56a3ebf6e3..0b2c632e7bc7 100644 --- a/dbaccess/source/core/api/RowSetBase.cxx +++ b/dbaccess/source/core/api/RowSetBase.cxx @@ -81,6 +81,7 @@ #ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> #endif +#include <rtl/logfile.hxx> using namespace dbaccess; using namespace connectivity; @@ -147,6 +148,7 @@ ORowSetBase::ORowSetBase( const ::comphelper::ComponentContext& _rContext, ::cpp ,m_bBeforeFirst(sal_True) // changed from sal_False ,m_bAfterLast(sal_False) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::ORowSetBase" ); DBG_CTOR(ORowSetBase,NULL); sal_Int32 nRBT = PropertyAttribute::READONLY | PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT; @@ -177,12 +179,14 @@ ORowSetBase::~ORowSetBase() //-------------------------------------------------------------------------- Sequence< Type > ORowSetBase::getTypes() throw (RuntimeException) { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getTypes" ); return ::comphelper::concatSequences(ORowSetBase_BASE::getTypes(),OPropertyStateContainer::getTypes()); } // com::sun::star::uno::XInterface //-------------------------------------------------------------------------- Any ORowSetBase::queryInterface( const Type & rType ) throw (RuntimeException) { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::queryInterface" ); Any aRet = ORowSetBase_BASE::queryInterface(rType); if(!aRet.hasValue()) aRet = OPropertyStateContainer::queryInterface(rType); @@ -191,6 +195,7 @@ Any ORowSetBase::queryInterface( const Type & rType ) throw (RuntimeException) // ------------------------------------------------------------------------- void SAL_CALL ORowSetBase::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getFastPropertyValue" ); if(m_pCache) { switch(nHandle) @@ -212,6 +217,7 @@ void SAL_CALL ORowSetBase::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) c // OComponentHelper void SAL_CALL ORowSetBase::disposing(void) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::disposing" ); MutexGuard aGuard(*m_pMutex); if ( m_pColumns ) @@ -227,6 +233,7 @@ void SAL_CALL ORowSetBase::disposing(void) // comphelper::OPropertyArrayUsageHelper ::cppu::IPropertyArrayHelper* ORowSetBase::createArrayHelper( ) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::createArrayHelper" ); Sequence< Property > aProps; describeProperties(aProps); return new ::cppu::OPropertyArrayHelper(aProps); @@ -235,25 +242,36 @@ void SAL_CALL ORowSetBase::disposing(void) // cppu::OPropertySetHelper ::cppu::IPropertyArrayHelper& SAL_CALL ORowSetBase::getInfoHelper() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getInfoHelper" ); return *const_cast<ORowSetBase*>(this)->getArrayHelper(); } // ------------------------------------------------------------------------- // XRow sal_Bool SAL_CALL ORowSetBase::wasNull( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::wasNull" ); ::osl::MutexGuard aGuard( *m_pMutex ); checkCache(); - - - return ((m_nLastColumnIndex != -1) && !m_aCurrentRow.isNull() && m_aCurrentRow != m_pCache->getEnd() && m_aCurrentRow->isValid()) ? ((*m_aCurrentRow)->get())[m_nLastColumnIndex].isNull() : sal_True; + return impl_wasNull(); } // ----------------------------------------------------------------------------- +sal_Bool ORowSetBase::impl_wasNull() +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::impl_wasNull" ); + return ((m_nLastColumnIndex != -1) && !m_aCurrentRow.isNull() && m_aCurrentRow != m_pCache->getEnd() && m_aCurrentRow->isValid()) ? ((*m_aCurrentRow)->get())[m_nLastColumnIndex].isNull() : sal_True; +} // ----------------------------------------------------------------------------- const ORowSetValue& ORowSetBase::getValue(sal_Int32 columnIndex) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getValue" ); checkCache(); - + return impl_getValue(columnIndex); +} +// ----------------------------------------------------------------------------- +const ORowSetValue& ORowSetBase::impl_getValue(sal_Int32 columnIndex) +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::impl_getValue" ); if ( m_bBeforeFirst || m_bAfterLast ) { OSL_ENSURE(0,"ORowSetBase::getValue: Illegal call here (we're before first or after last)!"); @@ -261,7 +279,7 @@ const ORowSetValue& ORowSetBase::getValue(sal_Int32 columnIndex) // TODO: resource } - if ( rowDeleted() ) + if ( impl_rowDeleted() ) { return m_aEmptyValue; } @@ -309,78 +327,91 @@ const ORowSetValue& ORowSetBase::getValue(sal_Int32 columnIndex) // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ORowSetBase::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getString" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getValue(columnIndex); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ORowSetBase::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getBoolean" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getValue(columnIndex); } // ------------------------------------------------------------------------- sal_Int8 SAL_CALL ORowSetBase::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getByte" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getValue(columnIndex); } // ------------------------------------------------------------------------- sal_Int16 SAL_CALL ORowSetBase::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getShort" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getValue(columnIndex); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ORowSetBase::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getInt" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getValue(columnIndex); } // ------------------------------------------------------------------------- sal_Int64 SAL_CALL ORowSetBase::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getLong" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getValue(columnIndex); } // ------------------------------------------------------------------------- float SAL_CALL ORowSetBase::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getFloat" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getValue(columnIndex); } // ------------------------------------------------------------------------- double SAL_CALL ORowSetBase::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getDouble" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getValue(columnIndex); } // ------------------------------------------------------------------------- Sequence< sal_Int8 > SAL_CALL ORowSetBase::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getBytes" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getValue(columnIndex); } // ------------------------------------------------------------------------- ::com::sun::star::util::Date SAL_CALL ORowSetBase::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getDate" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getValue(columnIndex); } // ------------------------------------------------------------------------- ::com::sun::star::util::Time SAL_CALL ORowSetBase::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getTime" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getValue(columnIndex); } // ------------------------------------------------------------------------- ::com::sun::star::util::DateTime SAL_CALL ORowSetBase::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getTimestamp" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getValue(columnIndex); } // ------------------------------------------------------------------------- Reference< ::com::sun::star::io::XInputStream > SAL_CALL ORowSetBase::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getBinaryStream" ); ::osl::MutexGuard aGuard( *m_pMutex ); checkCache(); @@ -391,7 +422,7 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL ORowSetBase::getBinaryS // TODO: resource } - if ( rowDeleted() ) + if ( impl_rowDeleted() ) { return NULL; } @@ -415,11 +446,13 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL ORowSetBase::getBinaryS // ------------------------------------------------------------------------- Reference< ::com::sun::star::io::XInputStream > SAL_CALL ORowSetBase::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getCharacterStream" ); return getBinaryStream(columnIndex); } // ------------------------------------------------------------------------- Any SAL_CALL ORowSetBase::getObject( sal_Int32 columnIndex, const Reference< XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getObject" ); ::osl::MutexGuard aGuard( *m_pMutex ); checkCache(); @@ -428,24 +461,28 @@ Any SAL_CALL ORowSetBase::getObject( sal_Int32 columnIndex, const Reference< XNa // ------------------------------------------------------------------------- Reference< XRef > SAL_CALL ORowSetBase::getRef( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getRef" ); ::dbtools::throwFeatureNotImplementedException( "XRow::getRef", *m_pMySelf ); return NULL; } // ------------------------------------------------------------------------- Reference< XBlob > SAL_CALL ORowSetBase::getBlob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getBlob" ); ::dbtools::throwFeatureNotImplementedException( "XRow::getBlob", *m_pMySelf ); return NULL; } // ------------------------------------------------------------------------- Reference< XClob > SAL_CALL ORowSetBase::getClob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getClob" ); ::dbtools::throwFeatureNotImplementedException( "XRow::getClob", *m_pMySelf ); return NULL; } // ------------------------------------------------------------------------- Reference< XArray > SAL_CALL ORowSetBase::getArray( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getArray" ); ::dbtools::throwFeatureNotImplementedException( "XRow::getArray", *m_pMySelf ); return NULL; } @@ -453,6 +490,7 @@ Reference< XArray > SAL_CALL ORowSetBase::getArray( sal_Int32 /*columnIndex*/ ) // ::com::sun::star::sdbcx::XRowLocate Any SAL_CALL ORowSetBase::getBookmark( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getBookmark" ); DBG_TRACE2("DBACCESS ORowSetBase::getBookmark() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); ::connectivity::checkDisposed(m_rBHelper.bDisposed); ::osl::MutexGuard aGuard( *m_pMutex ); @@ -462,7 +500,7 @@ Any SAL_CALL ORowSetBase::getBookmark( ) throw(SQLException, RuntimeException) throwSQLException( "The rows before the first and after the last row don't have a bookmark.", SQL_INVALID_CURSOR_POSITION, *m_pMySelf ); // TODO: resource - if ( rowDeleted() ) + if ( impl_rowDeleted() ) throwSQLException( "The current row is deleted, and thus doesn't have a bookmark.", SQL_INVALID_CURSOR_POSITION, *m_pMySelf ); // TODO: resource @@ -472,6 +510,7 @@ Any SAL_CALL ORowSetBase::getBookmark( ) throw(SQLException, RuntimeException) // ------------------------------------------------------------------------- sal_Bool SAL_CALL ORowSetBase::moveToBookmark( const Any& bookmark ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::moveToBookmark" ); DBG_TRACE2("DBACCESS ORowSetBase::moveToBookmark(Any) Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); OSL_ENSURE(bookmark.hasValue(),"ORowSetBase::moveToBookmark bookmark has no value!"); ::osl::ResettableMutexGuard aGuard( *m_pMutex ); @@ -492,7 +531,7 @@ sal_Bool SAL_CALL ORowSetBase::moveToBookmark( const Any& bookmark ) throw(SQLEx if ( bRet ) { // check if we are inserting a row - sal_Bool bWasNew = m_pCache->m_bNew || rowDeleted(); + sal_Bool bWasNew = m_pCache->m_bNew || impl_rowDeleted(); ORowSetNotifier aNotifier( this ); // this will call cancelRowModification on the cache if necessary @@ -523,6 +562,7 @@ sal_Bool SAL_CALL ORowSetBase::moveToBookmark( const Any& bookmark ) throw(SQLEx // ------------------------------------------------------------------------- sal_Bool SAL_CALL ORowSetBase::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::moveRelativeToBookmark" ); DBG_TRACE2("DBACCESS ORowSetBase::moveRelativeToBookmark(Any,%i) Clone = %i\n",rows,m_bClone); ::connectivity::checkDisposed(m_rBHelper.bDisposed); @@ -566,6 +606,7 @@ sal_Bool SAL_CALL ORowSetBase::moveRelativeToBookmark( const Any& bookmark, sal_ // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ORowSetBase::compareBookmarks( const Any& _first, const Any& _second ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::compareBookmarks" ); ::osl::MutexGuard aGuard( *m_pMutex ); checkCache(); return m_pCache->compareBookmarks(_first,_second); @@ -573,6 +614,7 @@ sal_Int32 SAL_CALL ORowSetBase::compareBookmarks( const Any& _first, const Any& // ------------------------------------------------------------------------- sal_Bool SAL_CALL ORowSetBase::hasOrderedBookmarks( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::hasOrderedBookmarks" ); ::osl::MutexGuard aGuard( *m_pMutex ); checkCache(); return m_pCache->hasOrderedBookmarks(); @@ -580,6 +622,7 @@ sal_Bool SAL_CALL ORowSetBase::hasOrderedBookmarks( ) throw(SQLException, Runti // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ORowSetBase::hashBookmark( const Any& bookmark ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::hashBookmark" ); ::osl::MutexGuard aGuard( *m_pMutex ); checkCache(); return m_pCache->hashBookmark(bookmark); @@ -589,6 +632,7 @@ sal_Int32 SAL_CALL ORowSetBase::hashBookmark( const Any& bookmark ) throw(SQLExc // XResultSetMetaDataSupplier Reference< XResultSetMetaData > SAL_CALL ORowSetBase::getMetaData( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getMetaData" ); ::connectivity::checkDisposed(m_rBHelper.bDisposed); Reference< XResultSetMetaData > xMeta; @@ -602,6 +646,7 @@ Reference< XResultSetMetaData > SAL_CALL ORowSetBase::getMetaData( ) throw(SQLE // XColumnLocate sal_Int32 SAL_CALL ORowSetBase::findColumn( const ::rtl::OUString& columnName ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::findColumn" ); ::connectivity::checkDisposed(m_rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aColumnsMutex ); @@ -613,6 +658,7 @@ sal_Int32 SAL_CALL ORowSetBase::findColumn( const ::rtl::OUString& columnName ) // ::com::sun::star::sdbcx::XColumnsSupplier Reference< XNameAccess > SAL_CALL ORowSetBase::getColumns( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getColumns" ); ::connectivity::checkDisposed(m_rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aColumnsMutex ); @@ -629,6 +675,7 @@ Reference< XNameAccess > SAL_CALL ORowSetBase::getColumns( ) throw(RuntimeExcep // XResultSet sal_Bool SAL_CALL ORowSetBase::next( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::next" ); DBG_TRACE2("DBACCESS ORowSetBase::next() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); ::osl::ResettableMutexGuard aGuard( *m_pMutex ); checkCache(); @@ -637,7 +684,7 @@ sal_Bool SAL_CALL ORowSetBase::next( ) throw(SQLException, RuntimeException) if ( bRet ) { // check if we are inserting a row - sal_Bool bWasNew = m_pCache->m_bNew || rowDeleted(); + sal_Bool bWasNew = m_pCache->m_bNew || impl_rowDeleted(); ORowSetNotifier aNotifier( this ); // this will call cancelRowModification on the cache if necessary @@ -678,6 +725,7 @@ sal_Bool SAL_CALL ORowSetBase::next( ) throw(SQLException, RuntimeException) // ------------------------------------------------------------------------- sal_Bool SAL_CALL ORowSetBase::isBeforeFirst( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::isBeforeFirst" ); ::connectivity::checkDisposed(m_rBHelper.bDisposed); ::osl::MutexGuard aGuard( *m_pMutex ); checkCache(); @@ -689,6 +737,7 @@ sal_Bool SAL_CALL ORowSetBase::isBeforeFirst( ) throw(SQLException, RuntimeExce // ------------------------------------------------------------------------- sal_Bool SAL_CALL ORowSetBase::isAfterLast( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::isAfterLast" ); ::connectivity::checkDisposed(m_rBHelper.bDisposed); ::osl::MutexGuard aGuard( *m_pMutex ); checkCache(); @@ -699,11 +748,13 @@ sal_Bool SAL_CALL ORowSetBase::isAfterLast( ) throw(SQLException, RuntimeExcept // ------------------------------------------------------------------------- sal_Bool ORowSetBase::isOnFirst() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::isOnFirst" ); return isFirst(); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ORowSetBase::isFirst( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::isFirst" ); DBG_TRACE2("DBACCESS ORowSetBase::isFirst() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); ::connectivity::checkDisposed(m_rBHelper.bDisposed); @@ -713,7 +764,7 @@ sal_Bool SAL_CALL ORowSetBase::isFirst( ) throw(SQLException, RuntimeException) if ( m_bBeforeFirst || m_bAfterLast ) return sal_False; - if ( rowDeleted() ) + if ( impl_rowDeleted() ) return ( m_nDeletedPosition == 1 ); positionCache( MOVE_NONE_REFRESH_ONLY ); @@ -725,11 +776,13 @@ sal_Bool SAL_CALL ORowSetBase::isFirst( ) throw(SQLException, RuntimeException) // ------------------------------------------------------------------------- sal_Bool ORowSetBase::isOnLast() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::isOnLast" ); return isLast(); } // ----------------------------------------------------------------------------- sal_Bool SAL_CALL ORowSetBase::isLast( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::isLast" ); DBG_TRACE2("DBACCESS ORowSetBase::isLast() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); ::connectivity::checkDisposed(m_rBHelper.bDisposed); ::osl::MutexGuard aGuard( *m_pMutex ); @@ -738,7 +791,7 @@ sal_Bool SAL_CALL ORowSetBase::isLast( ) throw(SQLException, RuntimeException) if ( m_bBeforeFirst || m_bAfterLast ) return sal_False; - if ( rowDeleted() ) + if ( impl_rowDeleted() ) { if ( !m_pCache->m_bRowCountFinal ) return sal_False; @@ -755,6 +808,7 @@ sal_Bool SAL_CALL ORowSetBase::isLast( ) throw(SQLException, RuntimeException) // ------------------------------------------------------------------------- void SAL_CALL ORowSetBase::beforeFirst( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::beforeFirst" ); DBG_TRACE2("DBACCESS ORowSetBase::beforeFirst() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); ::connectivity::checkDisposed(m_rBHelper.bDisposed); ::osl::ResettableMutexGuard aGuard( *m_pMutex ); @@ -762,7 +816,7 @@ void SAL_CALL ORowSetBase::beforeFirst( ) throw(SQLException, RuntimeException) checkPositioningAllowed(); // check if we are inserting a row - sal_Bool bWasNew = m_pCache->m_bNew || rowDeleted(); + sal_Bool bWasNew = m_pCache->m_bNew || impl_rowDeleted(); if((bWasNew || !m_bBeforeFirst) && notifyAllListenersCursorBeforeMove(aGuard) ) { @@ -796,13 +850,14 @@ void SAL_CALL ORowSetBase::beforeFirst( ) throw(SQLException, RuntimeException) // ------------------------------------------------------------------------- void SAL_CALL ORowSetBase::afterLast( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::afterLast" ); DBG_TRACE2("DBACCESS ORowSetBase::afterLast() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); ::connectivity::checkDisposed(m_rBHelper.bDisposed); ::osl::ResettableMutexGuard aGuard( *m_pMutex ); checkPositioningAllowed(); - sal_Bool bWasNew = m_pCache->m_bNew || rowDeleted(); + sal_Bool bWasNew = m_pCache->m_bNew || impl_rowDeleted(); if((bWasNew || !m_bAfterLast) && notifyAllListenersCursorBeforeMove(aGuard) ) { @@ -836,6 +891,7 @@ void SAL_CALL ORowSetBase::afterLast( ) throw(SQLException, RuntimeException) sal_Bool SAL_CALL ORowSetBase::move( ::std::mem_fun_t<sal_Bool,ORowSetBase>& _aCheckFunctor, ::std::mem_fun_t<sal_Bool,ORowSetCache>& _aMovementFunctor) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::move" ); DBG_TRACE2("DBACCESS ORowSetBase::move() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); ::connectivity::checkDisposed(m_rBHelper.bDisposed); ::osl::ResettableMutexGuard aGuard( *m_pMutex ); @@ -882,6 +938,7 @@ sal_Bool SAL_CALL ORowSetBase::move( ::std::mem_fun_t<sal_Bool,ORowSetBase>& // ------------------------------------------------------------------------- sal_Bool SAL_CALL ORowSetBase::first( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::first" ); DBG_TRACE2("DBACCESS ORowSetBase::first() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); ::std::mem_fun_t<sal_Bool,ORowSetBase> ioF_tmp(&ORowSetBase::isOnFirst); ::std::mem_fun_t<sal_Bool,ORowSetCache> F_tmp(&ORowSetCache::first); @@ -890,6 +947,7 @@ sal_Bool SAL_CALL ORowSetBase::first( ) throw(SQLException, RuntimeException) // ------------------------------------------------------------------------- sal_Bool SAL_CALL ORowSetBase::last( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::last" ); DBG_TRACE2("DBACCESS ORowSetBase::last() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); ::std::mem_fun_t<sal_Bool,ORowSetBase> ioL_tmp(&ORowSetBase::isOnLast); ::std::mem_fun_t<sal_Bool,ORowSetCache> L_tmp(&ORowSetCache::last); @@ -898,18 +956,23 @@ sal_Bool SAL_CALL ORowSetBase::last( ) throw(SQLException, RuntimeException) // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ORowSetBase::getRow( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getRow" ); DBG_TRACE2("DBACCESS ORowSetBase::getRow() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); ::osl::MutexGuard aGuard( *m_pMutex ); checkCache(); - - + return impl_getRow(); +} +// ------------------------------------------------------------------------- +sal_Int32 ORowSetBase::impl_getRow() +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::impl_getRow" ); sal_Int32 nPos = 0; if ( m_bBeforeFirst ) nPos = 0; else if ( m_bAfterLast ) nPos = impl_getRowCount() + 1; - else if ( rowDeleted() ) + else if ( impl_rowDeleted() ) nPos = m_nDeletedPosition; else if ( !m_bClone && m_pCache->m_bNew ) nPos = 0; @@ -924,12 +987,13 @@ sal_Int32 SAL_CALL ORowSetBase::getRow( ) throw(SQLException, RuntimeException) } nPos = m_pCache->getRow(); } - DBG_TRACE3("DBACCESS ORowSetBase::getRow() = %i Clone = %i ID = %i\n",nPos,m_bClone,osl_getThreadIdentifier(NULL)); + DBG_TRACE3("DBACCESS ORowSetBase::impl_getRow() = %i Clone = %i ID = %i\n",nPos,m_bClone,osl_getThreadIdentifier(NULL)); return nPos; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ORowSetBase::absolute( sal_Int32 row ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::absolute" ); DBG_TRACE2("DBACCESS ORowSetBase::absolute(%i) Clone = %i\n",row,m_bClone); ::connectivity::checkDisposed(m_rBHelper.bDisposed); ::osl::ResettableMutexGuard aGuard( *m_pMutex ); @@ -975,6 +1039,7 @@ sal_Bool SAL_CALL ORowSetBase::absolute( sal_Int32 row ) throw(SQLException, Run // ------------------------------------------------------------------------- sal_Bool SAL_CALL ORowSetBase::relative( sal_Int32 rows ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::relative" ); DBG_TRACE2("DBACCESS ORowSetBase::relative(%i) Clone = %i\n",rows,m_bClone); ::connectivity::checkDisposed(m_rBHelper.bDisposed); @@ -1030,6 +1095,7 @@ sal_Bool SAL_CALL ORowSetBase::relative( sal_Int32 rows ) throw(SQLException, Ru // ------------------------------------------------------------------------- sal_Bool SAL_CALL ORowSetBase::previous( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::previous" ); DBG_TRACE2("DBACCESS ORowSetBase::previous() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); ::connectivity::checkDisposed(m_rBHelper.bDisposed); ::osl::ResettableMutexGuard aGuard( *m_pMutex ); @@ -1082,6 +1148,7 @@ sal_Bool SAL_CALL ORowSetBase::previous( ) throw(SQLException, RuntimeException // ----------------------------------------------------------------------------- void ORowSetBase::setCurrentRow( sal_Bool _bMoved, sal_Bool _bDoNotify, const ORowSetRow& _rOldValues, ::osl::ResettableMutexGuard& _rGuard ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::setCurrentRow" ); DBG_TRACE2("DBACCESS ORowSetBase::setCurrentRow() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); m_bBeforeFirst = m_pCache->isBeforeFirst(); m_bAfterLast = m_pCache->isAfterLast(); @@ -1147,21 +1214,24 @@ void ORowSetBase::setCurrentRow( sal_Bool _bMoved, sal_Bool _bDoNotify, const OR // ----------------------------------------------------------------------------- void ORowSetBase::checkPositioningAllowed() throw( SQLException, RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::checkPositioningAllowed" ); if(!m_pCache || m_nResultSetType == ResultSetType::FORWARD_ONLY) throwFunctionSequenceException(*m_pMySelf); } //------------------------------------------------------------------------------ Reference< XInterface > ORowSetBase::getStatement(void) throw( SQLException, RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getStatement" ); return NULL; } // ------------------------------------------------------------------------- void SAL_CALL ORowSetBase::refreshRow( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::refreshRow" ); ::connectivity::checkDisposed(m_rBHelper.bDisposed); ::osl::MutexGuard aGuard( *m_pMutex ); checkCache(); - if ( rowDeleted() ) + if ( impl_rowDeleted() ) throwSQLException( "The current row is deleted", SQL_INVALID_CURSOR_STATE, Reference< XRowSet >( this ) ); if(!(m_bBeforeFirst || m_bAfterLast)) @@ -1173,14 +1243,11 @@ void SAL_CALL ORowSetBase::refreshRow( ) throw(SQLException, RuntimeException) // ------------------------------------------------------------------------- sal_Bool SAL_CALL ORowSetBase::rowUpdated( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::rowUpdated" ); ::osl::MutexGuard aGuard( *m_pMutex ); checkCache(); - - if ( rowDeleted() ) - return sal_False; - - if ( rowDeleted() ) + if ( impl_rowDeleted() ) return sal_False; return m_pCache->rowUpdated(); @@ -1188,15 +1255,12 @@ sal_Bool SAL_CALL ORowSetBase::rowUpdated( ) throw(SQLException, RuntimeExcepti // ------------------------------------------------------------------------- sal_Bool SAL_CALL ORowSetBase::rowInserted( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::rowInserted" ); ::osl::MutexGuard aGuard( *m_pMutex ); checkCache(); - - if ( rowDeleted() ) - return sal_False; - - if ( rowDeleted() ) + if ( impl_rowDeleted() ) return sal_False; return m_pCache->rowInserted(); @@ -1204,15 +1268,21 @@ sal_Bool SAL_CALL ORowSetBase::rowInserted( ) throw(SQLException, RuntimeExcept // ------------------------------------------------------------------------- sal_Bool SAL_CALL ORowSetBase::rowDeleted( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::rowDeleted" ); ::osl::MutexGuard aGuard( *m_pMutex ); checkCache(); - + return impl_rowDeleted(); +} +// ------------------------------------------------------------------------- +sal_Bool ORowSetBase::impl_rowDeleted( ) +{ return !m_aBookmark.hasValue() && !m_bBeforeFirst && !m_bAfterLast; } // ------------------------------------------------------------------------- // XWarningsSupplier Any SAL_CALL ORowSetBase::getWarnings( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getWarnings" ); ::osl::MutexGuard aGuard( *m_pMutex ); checkCache(); @@ -1225,6 +1295,7 @@ Any SAL_CALL ORowSetBase::getWarnings( ) throw(SQLException, RuntimeException) // ------------------------------------------------------------------------- void SAL_CALL ORowSetBase::clearWarnings( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::clearWarnings" ); ::osl::MutexGuard aGuard( *m_pMutex ); checkCache(); @@ -1236,6 +1307,7 @@ void SAL_CALL ORowSetBase::clearWarnings( ) throw(SQLException, RuntimeExceptio // ------------------------------------------------------------------------- void ORowSetBase::firePropertyChange(const ORowSetRow& _rOldRow) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::firePropertyChange" ); DBG_TRACE2("DBACCESS ORowSetBase::firePropertyChange() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); OSL_ENSURE(m_pColumns,"Columns can not be NULL here!"); #if OSL_DEBUG_LEVEL > 1 @@ -1260,27 +1332,32 @@ void ORowSetBase::firePropertyChange(const ORowSetRow& _rOldRow) // ----------------------------------------------------------------------------- void ORowSetBase::fireRowcount() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::fireRowcount" ); } // ----------------------------------------------------------------------------- sal_Bool ORowSetBase::notifyAllListenersCursorBeforeMove(::osl::ResettableMutexGuard& /*_rGuard*/) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::notifyAllListenersCursorBeforeMove" ); return sal_True; } // ----------------------------------------------------------------------------- void ORowSetBase::notifyAllListenersCursorMoved(::osl::ResettableMutexGuard& /*_rGuard*/) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::notifyAllListenersCursorMoved" ); } // ----------------------------------------------------------------------------- void ORowSetBase::notifyAllListeners(::osl::ResettableMutexGuard& /*_rGuard*/) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::notifyAllListeners" ); } // ----------------------------------------------------------------------------- void ORowSetBase::fireProperty( sal_Int32 _nProperty, sal_Bool _bNew, sal_Bool _bOld ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::fireProperty" ); Any aNew = bool2any( _bNew ); Any aOld = bool2any( _bOld ); fire( &_nProperty, &aNew, &aOld, 1, sal_False ); @@ -1289,6 +1366,7 @@ void ORowSetBase::fireProperty( sal_Int32 _nProperty, sal_Bool _bNew, sal_Bool _ // ----------------------------------------------------------------------------- void ORowSetBase::positionCache( CursorMoveDirection _ePrepareForDirection ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::positionCache" ); DBG_TRACE2("DBACCESS ORowSetBase::positionCache() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); sal_Bool bSuccess = sal_False; @@ -1344,6 +1422,7 @@ void ORowSetBase::positionCache( CursorMoveDirection _ePrepareForDirection ) // ----------------------------------------------------------------------------- void ORowSetBase::checkCache() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::checkCache" ); ::connectivity::checkDisposed(m_rBHelper.bDisposed); if(!m_pCache) throwFunctionSequenceException(*m_pMySelf); @@ -1351,6 +1430,7 @@ void ORowSetBase::checkCache() // ----------------------------------------------------------------------------- void ORowSetBase::movementFailed() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::movementFailed" ); DBG_TRACE2("DBACCESS ORowSetBase::movementFailed() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); m_aOldRow->clearRow(); m_aCurrentRow = m_pCache->getEnd(); @@ -1364,6 +1444,7 @@ void ORowSetBase::movementFailed() // ----------------------------------------------------------------------------- ORowSetRow ORowSetBase::getOldRow(sal_Bool _bWasNew) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getOldRow" ); OSL_ENSURE(m_aOldRow.isValid(),"RowSetRowHElper isn't valid!"); ORowSetRow aOldValues; if ( !_bWasNew && m_aOldRow->getRow().isValid() ) @@ -1373,11 +1454,13 @@ ORowSetRow ORowSetBase::getOldRow(sal_Bool _bWasNew) // ----------------------------------------------------------------------------- void ORowSetBase::getPropertyDefaultByHandle( sal_Int32 /*_nHandle*/, Any& _rDefault ) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getPropertyDefaultByHandle" ); _rDefault.clear(); } // ----------------------------------------------------------------------------- void ORowSetBase::onDeleteRow( const Any& _rBookmark ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::onDeleteRow" ); if ( rowDeleted() ) // not interested in return; @@ -1393,6 +1476,7 @@ void ORowSetBase::onDeleteRow( const Any& _rBookmark ) // ----------------------------------------------------------------------------- void ORowSetBase::onDeletedRow( const Any& _rBookmark, sal_Int32 _nPos ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::onDeletedRow" ); if ( rowDeleted() ) { // if we're a clone, and on a deleted row, and the main RowSet deleted another @@ -1415,6 +1499,7 @@ void ORowSetBase::onDeletedRow( const Any& _rBookmark, sal_Int32 _nPos ) // ----------------------------------------------------------------------------- sal_Int32 ORowSetBase::impl_getRowCount() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::impl_getRowCount" ); sal_Int32 nRowCount( m_pCache->m_nRowCount ); if ( const_cast< ORowSetBase* >( this )->rowDeleted() && !m_pCache->m_bNew ) ++nRowCount; @@ -1447,6 +1532,7 @@ ORowSetNotifier::ORowSetNotifier( ORowSetBase* _pRowSet ) // ----------------------------------------------------------------------------- ORowSetNotifier::~ORowSetNotifier( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetNotifier::~ORowSetNotifier" ); DBG_DTOR(ORowSetNotifier,NULL); } diff --git a/dbaccess/source/core/api/RowSetBase.hxx b/dbaccess/source/core/api/RowSetBase.hxx index cd20e12ee936..d55af88ee4d8 100644 --- a/dbaccess/source/core/api/RowSetBase.hxx +++ b/dbaccess/source/core/api/RowSetBase.hxx @@ -226,6 +226,8 @@ namespace dbaccess // returns a value of a column of the current row const connectivity::ORowSetValue& getValue(sal_Int32 columnIndex); + // the cache has to be checked before calling this method + const connectivity::ORowSetValue& impl_getValue(sal_Int32 columnIndex); // sets the current and the bookmark void setCurrentRow( sal_Bool _bMoved, sal_Bool _bDoNotify, const ORowSetRow& _rOldValues, ::osl::ResettableMutexGuard& _rGuard); void checkPositioningAllowed() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); @@ -270,6 +272,11 @@ namespace dbaccess */ sal_Int32 impl_getRowCount() const; + // the checkCache has to be called before calling this methods + sal_Bool impl_wasNull(); + sal_Int32 impl_getRow(); + sal_Bool impl_rowDeleted(); + public: virtual ~ORowSetBase(); diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx index a967bd0da5f0..46f80a6ab372 100644 --- a/dbaccess/source/core/api/RowSetCache.cxx +++ b/dbaccess/source/core/api/RowSetCache.cxx @@ -31,89 +31,36 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" -#ifndef _COMPHELPER_SEQSTREAM_HXX #include <comphelper/seqstream.hxx> -#endif -#ifndef _COMPHELPER_UNO3_HXX_ #include <comphelper/uno3.hxx> -#endif -#ifndef _COMPHELPER_EXTRACT_HXX_ #include <comphelper/extract.hxx> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XKEYSSUPPLIER_HPP_ #include <com/sun/star/sdbcx/XKeysSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_ #include <com/sun/star/sdbcx/XTablesSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_KEYTYPE_HPP_ #include <com/sun/star/sdbcx/KeyType.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_RESULTSETCONCURRENCY_HPP_ #include <com/sun/star/sdbc/ResultSetConcurrency.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ #include <com/sun/star/sdbc/ColumnValue.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_ #include <com/sun/star/sdbcx/XColumnsSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_PRIVILEGE_HPP_ #include <com/sun/star/sdbcx/Privilege.hpp> -#endif -#ifndef _DBACORE_DATACOLUMN_HXX_ #include "CRowSetDataColumn.hxx" -#endif -#ifndef DBACCESS_CORE_API_CROWSETCOLUMN_HXX #include "CRowSetColumn.hxx" -#endif -#ifndef DBACCESS_CORE_API_ROWSETBASE_HXX #include "RowSetBase.hxx" -#endif -#ifndef _DBHELPER_DBEXCEPTION_HXX_ #include <connectivity/dbexception.hxx> -#endif -#ifndef _CONNECTIVITY_SQLPARSE_HXX #include <connectivity/sqlparse.hxx> -#endif -#ifndef _CONNECTIVITY_SQLNODE_HXX #include <connectivity/sqlnode.hxx> -#endif -#ifndef _CONNECTIVITY_PARSE_SQLITERATOR_HXX_ #include <connectivity/sqliterator.hxx> -#endif -#ifndef _COMPHELPER_PROPERTY_HXX_ #include <comphelper/property.hxx> -#endif -#ifndef _COM_SUN_STAR_SDBCX_COMPAREBOOKMARK_HPP_ #include <com/sun/star/sdbcx/CompareBookmark.hpp> -#endif -#ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> -#endif #include <algorithm> -#ifndef DBACCESS_CORE_API_ROWSETCACHE_HXX #include "RowSetCache.hxx" -#endif -#ifndef _DBA_CORE_RESOURCE_HXX_ #include "core_resource.hxx" -#endif -#ifndef _DBA_CORE_RESOURCE_HRC_ #include "core_resource.hrc" -#endif -#ifndef DBACCESS_CORE_API_BOOKMARKSET_HXX #include "BookmarkSet.hxx" -#endif -#ifndef DBACCESS_CORE_API_STATICSET_HXX #include "StaticSet.hxx" -#endif -#ifndef DBACCESS_CORE_API_KEYSET_HXX #include "KeySet.hxx" -#endif -#ifndef DBACCESS_SHARED_DBASTRINGS_HRC #include "dbastrings.hrc" -#endif +#include <rtl/logfile.hxx> using namespace dbaccess; using namespace dbtools; @@ -158,6 +105,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, ,m_bModified(_bModified) ,m_bNew(_bNew) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::ORowSetCache" ); DBG_CTOR(ORowSetCache,NULL); // check if all keys of the updateable table are fetched @@ -246,41 +194,18 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, } Reference< XPropertySet> xProp(_xRs,UNO_QUERY); - sal_Bool bNeedKeySet = !(xProp->getPropertySetInfo()->hasPropertyByName(PROPERTY_ISBOOKMARKABLE) && - any2bool(xProp->getPropertyValue(PROPERTY_ISBOOKMARKABLE)) && Reference< XRowLocate >(_xRs, UNO_QUERY).is() ); + sal_Bool bBookmarkable = xProp->getPropertySetInfo()->hasPropertyByName(PROPERTY_ISBOOKMARKABLE) && + any2bool(xProp->getPropertyValue(PROPERTY_ISBOOKMARKABLE)) && Reference< XRowLocate >(_xRs, UNO_QUERY).is(); + sal_Bool bNeedKeySet = !bBookmarkable; bNeedKeySet = bNeedKeySet || (xProp->getPropertySetInfo()->hasPropertyByName(PROPERTY_RESULTSETCONCURRENCY) && ::comphelper::getINT32(xProp->getPropertyValue(PROPERTY_RESULTSETCONCURRENCY)) == ResultSetConcurrency::READ_ONLY); // first check if resultset is bookmarkable - if(!bNeedKeySet) + if ( !bNeedKeySet ) { - try - { - m_pCacheSet = new OBookmarkSet(); - m_xCacheSet = m_pCacheSet; - m_pCacheSet->construct(_xRs); - - // check privileges - m_nPrivileges = Privilege::SELECT; - if(Reference<XResultSetUpdate>(_xRs,UNO_QUERY).is()) // this interface is optional so we have to check it - { - Reference<XPropertySet> xTable(m_aUpdateTable,UNO_QUERY); - if(xTable.is() && xTable->getPropertySetInfo()->hasPropertyByName(PROPERTY_PRIVILEGES)) - { - m_nPrivileges = 0; - xTable->getPropertyValue(PROPERTY_PRIVILEGES) >>= m_nPrivileges; - if(!m_nPrivileges) - m_nPrivileges = Privilege::SELECT; - } - } - } - catch(const SQLException&) - { - bNeedKeySet = sal_True; - } - + bNeedKeySet = impl_createBookmarkSet_nothrow(_xRs); } - if(bNeedKeySet) + if ( bNeedKeySet ) { // need to check if we could handle this select clause bAllKeysFound = bAllKeysFound && (nTablesCount == 1 || checkJoin(xConnection,_xAnalyzer,aUpdateTableName)); @@ -288,11 +213,16 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, // || !(comphelper::hasProperty(PROPERTY_CANUPDATEINSERTEDROWS,xProp) && any2bool(xProp->getPropertyValue(PROPERTY_CANUPDATEINSERTEDROWS))) // oj removed because keyset uses only the next// || (xProp->getPropertySetInfo()->hasPropertyByName(PROPERTY_RESULTSETTYPE) && comphelper::getINT32(xProp->getPropertyValue(PROPERTY_RESULTSETTYPE)) == ResultSetType::FORWARD_ONLY) - if(!bAllKeysFound ) + if ( !bAllKeysFound ) { - m_pCacheSet = new OStaticSet(); - m_xCacheSet = m_pCacheSet; - m_pCacheSet->construct(_xRs); + if ( bBookmarkable ) + impl_createBookmarkSet_nothrow(_xRs); + else + { + m_pCacheSet = new OStaticSet(); + m_xCacheSet = m_pCacheSet; + m_pCacheSet->construct(_xRs); + } m_nPrivileges = Privilege::SELECT; } else @@ -368,7 +298,6 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, ::comphelper::getINT32(xProp->getPropertyValue(PROPERTY_RESULTSETCONCURRENCY)) == ResultSetConcurrency::READ_ONLY) m_nPrivileges = Privilege::SELECT; } - // ------------------------------------------------------------------------- ORowSetCache::~ORowSetCache() { @@ -391,10 +320,40 @@ ORowSetCache::~ORowSetCache() DBG_DTOR(ORowSetCache,NULL); } +// ----------------------------------------------------------------------------- +sal_Bool ORowSetCache::impl_createBookmarkSet_nothrow(const Reference< XResultSet >& _xRs) +{ + sal_Bool bRet = sal_False; + try + { + m_pCacheSet = new OBookmarkSet(); + m_xCacheSet = m_pCacheSet; + m_pCacheSet->construct(_xRs); + // check privileges + m_nPrivileges = Privilege::SELECT; + if(Reference<XResultSetUpdate>(_xRs,UNO_QUERY).is()) // this interface is optional so we have to check it + { + Reference<XPropertySet> xTable(m_aUpdateTable,UNO_QUERY); + if(xTable.is() && xTable->getPropertySetInfo()->hasPropertyByName(PROPERTY_PRIVILEGES)) + { + m_nPrivileges = 0; + xTable->getPropertyValue(PROPERTY_PRIVILEGES) >>= m_nPrivileges; + if(!m_nPrivileges) + m_nPrivileges = Privilege::SELECT; + } + } + } + catch(const SQLException&) + { + bRet = sal_True; + } + return bRet; +} // ------------------------------------------------------------------------- void ORowSetCache::setMaxRowSize(sal_Int32 _nSize) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::setMaxRowSize" ); if(_nSize == m_nFetchSize) return; @@ -466,12 +425,14 @@ void ORowSetCache::setMaxRowSize(sal_Int32 _nSize) // XResultSetMetaDataSupplier Reference< XResultSetMetaData > ORowSetCache::getMetaData( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::getMetaData" ); return m_xMetaData; } // ------------------------------------------------------------------------- // ::com::sun::star::sdbcx::XRowLocate Any ORowSetCache::getBookmark( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::getBookmark" ); if(m_bAfterLast) throwFunctionSequenceException(m_xSet.get()); @@ -496,6 +457,7 @@ Any ORowSetCache::getBookmark( ) // ------------------------------------------------------------------------- sal_Bool ORowSetCache::moveToBookmark( const Any& bookmark ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::moveToBookmark" ); if ( m_pCacheSet->moveToBookmark(bookmark) ) { m_bBeforeFirst = sal_False; @@ -526,6 +488,7 @@ sal_Bool ORowSetCache::moveToBookmark( const Any& bookmark ) // ------------------------------------------------------------------------- sal_Bool ORowSetCache::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::moveRelativeToBookmark" ); sal_Bool bRet( moveToBookmark( bookmark ) ); if ( bRet ) { @@ -541,17 +504,20 @@ sal_Bool ORowSetCache::moveRelativeToBookmark( const Any& bookmark, sal_Int32 ro // ------------------------------------------------------------------------- sal_Int32 ORowSetCache::compareBookmarks( const Any& _first, const Any& _second ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::compareBookmarks" ); return (!_first.hasValue() || !_second.hasValue()) ? CompareBookmark::NOT_COMPARABLE : m_pCacheSet->compareBookmarks(_first,_second); } // ------------------------------------------------------------------------- sal_Bool ORowSetCache::hasOrderedBookmarks( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::hasOrderedBookmarks" ); return m_pCacheSet->hasOrderedBookmarks(); } // ------------------------------------------------------------------------- sal_Int32 ORowSetCache::hashBookmark( const Any& bookmark ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::hashBookmark" ); return m_pCacheSet->hashBookmark(bookmark); } @@ -560,6 +526,7 @@ sal_Int32 ORowSetCache::hashBookmark( const Any& bookmark ) // ----------------------------------------------------------------------------- void ORowSetCache::updateValue(sal_Int32 columnIndex,const ORowSetValue& x) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::updateValue" ); checkUpdateConditions(columnIndex); @@ -570,6 +537,7 @@ void ORowSetCache::updateValue(sal_Int32 columnIndex,const ORowSetValue& x) // ------------------------------------------------------------------------- void ORowSetCache::updateBinaryStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::updateBinaryStream" ); checkUpdateConditions(columnIndex); @@ -581,6 +549,7 @@ void ORowSetCache::updateBinaryStream( sal_Int32 columnIndex, const Reference< : // ------------------------------------------------------------------------- void ORowSetCache::updateCharacterStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::updateCharacterStream" ); checkUpdateConditions(columnIndex); @@ -593,6 +562,7 @@ void ORowSetCache::updateCharacterStream( sal_Int32 columnIndex, const Reference // ------------------------------------------------------------------------- void ORowSetCache::updateObject( sal_Int32 columnIndex, const Any& x ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::updateObject" ); checkUpdateConditions(columnIndex); @@ -603,6 +573,7 @@ void ORowSetCache::updateObject( sal_Int32 columnIndex, const Any& x ) // ------------------------------------------------------------------------- void ORowSetCache::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 /*scale*/ ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::updateNumericObject" ); checkUpdateConditions(columnIndex); @@ -614,6 +585,7 @@ void ORowSetCache::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal // XResultSet sal_Bool ORowSetCache::next( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::next" ); if(!isAfterLast()) @@ -638,6 +610,7 @@ sal_Bool ORowSetCache::next( ) // ------------------------------------------------------------------------- sal_Bool ORowSetCache::isBeforeFirst( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::isBeforeFirst" ); // return !m_nPosition; return m_bBeforeFirst; @@ -645,18 +618,21 @@ sal_Bool ORowSetCache::isBeforeFirst( ) // ------------------------------------------------------------------------- sal_Bool ORowSetCache::isAfterLast( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::isAfterLast" ); return m_bAfterLast; } // ------------------------------------------------------------------------- sal_Bool ORowSetCache::isFirst( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::isFirst" ); return m_nPosition == 1; // ask resultset for } // ------------------------------------------------------------------------- sal_Bool ORowSetCache::isLast( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::isLast" ); // return m_bRowCountFinal ? (m_nPosition==m_nRowCount) : m_pCacheSet->isLast(); return m_nPosition == m_nRowCount; @@ -664,6 +640,7 @@ sal_Bool ORowSetCache::isLast( ) // ------------------------------------------------------------------------- sal_Bool ORowSetCache::beforeFirst( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::beforeFirst" ); if(!m_bBeforeFirst) @@ -680,6 +657,7 @@ sal_Bool ORowSetCache::beforeFirst( ) // ------------------------------------------------------------------------- sal_Bool ORowSetCache::afterLast( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::afterLast" ); if(!m_bAfterLast) @@ -703,10 +681,12 @@ sal_Bool ORowSetCache::afterLast( ) // ------------------------------------------------------------------------- sal_Bool ORowSetCache::fillMatrix(sal_Int32& _nNewStartPos,sal_Int32 _nNewEndPos) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::fillMatrix" ); OSL_ENSURE(_nNewStartPos != _nNewEndPos,"ORowSetCache::fillMatrix: StartPos and EndPos can not be equal!"); // fill the whole window with new data ORowSetMatrix::iterator aIter = m_pMatrix->begin(); sal_Bool bCheck = m_pCacheSet->absolute(_nNewStartPos); // -1 no need to + const sal_Int32 nColumnCount = m_xMetaData->getColumnCount(); sal_Int32 i=_nNewStartPos; for(;i<_nNewEndPos;++i,++aIter) @@ -714,7 +694,7 @@ sal_Bool ORowSetCache::fillMatrix(sal_Int32& _nNewStartPos,sal_Int32 _nNewEndPos if(bCheck) { if(!aIter->isValid()) - *aIter = new ORowSetValueVector(m_xMetaData->getColumnCount()); + *aIter = new ORowSetValueVector(nColumnCount); m_pCacheSet->fillValueRow(*aIter,i); } else @@ -740,7 +720,7 @@ sal_Bool ORowSetCache::fillMatrix(sal_Int32& _nNewStartPos,sal_Int32 _nNewEndPos if(bCheck) { if(!aIter->isValid()) - *aIter = new ORowSetValueVector(m_xMetaData->getColumnCount()); + *aIter = new ORowSetValueVector(nColumnCount); m_pCacheSet->fillValueRow(*aIter,nPos++); } bCheck = m_pCacheSet->next(); @@ -772,6 +752,7 @@ sal_Bool ORowSetCache::fillMatrix(sal_Int32& _nNewStartPos,sal_Int32 _nNewEndPos // ------------------------------------------------------------------------- sal_Bool ORowSetCache::moveWindow() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::moveWindow" ); sal_Bool bRet = sal_True; @@ -1009,6 +990,7 @@ sal_Bool ORowSetCache::moveWindow() // ------------------------------------------------------------------------- sal_Bool ORowSetCache::first( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::first" ); // first move to the first row // then check if the cache window is at the begining // when not postionize the window and fill it with data @@ -1034,6 +1016,7 @@ sal_Bool ORowSetCache::first( ) // ------------------------------------------------------------------------- sal_Bool ORowSetCache::last( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::last" ); sal_Bool bRet = m_pCacheSet->last(); if(bRet) { @@ -1073,11 +1056,13 @@ sal_Bool ORowSetCache::last( ) // ------------------------------------------------------------------------- sal_Int32 ORowSetCache::getRow( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::getRow" ); return (isBeforeFirst() || isAfterLast()) ? 0 : m_nPosition; } // ------------------------------------------------------------------------- sal_Bool ORowSetCache::absolute( sal_Int32 row ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::absolute" ); if(!row ) throw SQLException(DBACORE_RESSTRING(RID_STR_NO_ABS_ZERO),NULL,SQLSTATE_GENERAL,1000,Any() ); @@ -1131,6 +1116,7 @@ sal_Bool ORowSetCache::absolute( sal_Int32 row ) // ------------------------------------------------------------------------- sal_Bool ORowSetCache::relative( sal_Int32 rows ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::relative" ); sal_Bool bErg = sal_True; if(rows) { @@ -1159,6 +1145,7 @@ sal_Bool ORowSetCache::relative( sal_Int32 rows ) // ------------------------------------------------------------------------- sal_Bool ORowSetCache::previous( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::previous" ); sal_Bool bRet = sal_False; if(!isBeforeFirst()) { @@ -1190,6 +1177,7 @@ sal_Bool ORowSetCache::previous( ) // ------------------------------------------------------------------------- void ORowSetCache::refreshRow( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::refreshRow" ); if(isAfterLast()) throw SQLException(DBACORE_RESSTRING(RID_STR_NO_REFESH_AFTERLAST),NULL,SQLSTATE_GENERAL,1000,Any() ); OSL_ENSURE(m_aMatrixIter != m_pMatrix->end(),"refreshRow() called for invalid row!"); @@ -1203,17 +1191,20 @@ void ORowSetCache::refreshRow( ) // ------------------------------------------------------------------------- sal_Bool ORowSetCache::rowUpdated( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::rowUpdated" ); return m_pCacheSet->rowUpdated(); } // ------------------------------------------------------------------------- sal_Bool ORowSetCache::rowInserted( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::rowInserted" ); return m_pCacheSet->rowInserted(); } // ------------------------------------------------------------------------- // XResultSetUpdate sal_Bool ORowSetCache::insertRow( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::insertRow" ); if ( !m_bNew || !m_aInsertRow->isValid() ) throw SQLException(DBACORE_RESSTRING(RID_STR_NO_MOVETOINSERTROW_CALLED),NULL,SQLSTATE_GENERAL,1000,Any() ); @@ -1237,6 +1228,7 @@ sal_Bool ORowSetCache::insertRow( ) // ------------------------------------------------------------------------- void ORowSetCache::resetInsertRow(sal_Bool _bClearInsertRow) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::resetInsertRow" ); if ( _bClearInsertRow ) clearInsertRow(); m_bNew = sal_False; @@ -1245,6 +1237,7 @@ void ORowSetCache::resetInsertRow(sal_Bool _bClearInsertRow) // ------------------------------------------------------------------------- void ORowSetCache::cancelRowModification() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::cancelRowModification" ); // clear the insertrow references -> implies that the current row of the rowset changes as well ORowSetCacheMap::iterator aCacheIter = m_aCacheIterators.begin(); ORowSetCacheMap::iterator aCacheEnd = m_aCacheIterators.end(); @@ -1258,6 +1251,7 @@ void ORowSetCache::cancelRowModification() // ------------------------------------------------------------------------- void ORowSetCache::updateRow( ORowSetMatrix::iterator& _rUpdateRow ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::updateRow" ); if(isAfterLast() || isBeforeFirst()) throw SQLException(DBACORE_RESSTRING(RID_STR_NO_UPDATEROW),NULL,SQLSTATE_GENERAL,1000,Any() ); @@ -1281,6 +1275,7 @@ void ORowSetCache::updateRow( ORowSetMatrix::iterator& _rUpdateRow ) // ------------------------------------------------------------------------- bool ORowSetCache::deleteRow( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::deleteRow" ); if(isAfterLast() || isBeforeFirst()) throw SQLException(DBACORE_RESSTRING(RID_STR_NO_DELETEROW),NULL,SQLSTATE_GENERAL,1000,Any() ); @@ -1309,6 +1304,7 @@ bool ORowSetCache::deleteRow( ) // ------------------------------------------------------------------------- void ORowSetCache::cancelRowUpdates( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::cancelRowUpdates" ); m_bNew = m_bModified = sal_False; if(!m_nPosition) { @@ -1327,6 +1323,7 @@ void ORowSetCache::cancelRowUpdates( ) // ------------------------------------------------------------------------- void ORowSetCache::moveToInsertRow( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::moveToInsertRow" ); m_bNew = sal_True; m_bUpdated = m_bAfterLast = sal_False; @@ -1346,6 +1343,7 @@ void ORowSetCache::moveToInsertRow( ) // ------------------------------------------------------------------------- ORowSetCacheIterator ORowSetCache::createIterator(ORowSetBase* _pRowSet) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::createIterator" ); ORowSetCacheIterator_Helper aHelper; aHelper.aIterator = m_pMatrix->end(); @@ -1355,6 +1353,7 @@ ORowSetCacheIterator ORowSetCache::createIterator(ORowSetBase* _pRowSet) // ----------------------------------------------------------------------------- void ORowSetCache::rotateCacheIterator(ORowSetMatrix::difference_type _nDist) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::rotateCacheIterator" ); if(_nDist) { // now correct the iterator in our iterator vector @@ -1383,6 +1382,7 @@ void ORowSetCache::rotateCacheIterator(ORowSetMatrix::difference_type _nDist) // ------------------------------------------------------------------------- void ORowSetCache::setUpdateIterator(const ORowSetMatrix::iterator& _rOriginalRow) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::setUpdateIterator" ); m_aInsertRow = m_pInsertMatrix->begin(); if(!m_aInsertRow->isValid()) *m_aInsertRow = new ORowSetValueVector(m_xMetaData->getColumnCount()); @@ -1396,6 +1396,7 @@ void ORowSetCache::setUpdateIterator(const ORowSetMatrix::iterator& _rOriginalRo // ----------------------------------------------------------------------------- void ORowSetCache::checkPositionFlags() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::checkPositionFlags" ); if(m_bRowCountFinal) { m_bAfterLast = m_nPosition > m_nRowCount; @@ -1406,12 +1407,14 @@ void ORowSetCache::checkPositionFlags() // ----------------------------------------------------------------------------- void ORowSetCache::checkUpdateConditions(sal_Int32 columnIndex) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::checkUpdateConditions" ); if(m_bAfterLast || columnIndex >= (sal_Int32)(*m_aInsertRow)->get().size()) throwFunctionSequenceException(m_xSet.get()); } //------------------------------------------------------------------------------ sal_Bool ORowSetCache::checkInnerJoin(const ::connectivity::OSQLParseNode *pNode,const Reference< XConnection>& _xConnection,const ::rtl::OUString& _sUpdateTableName) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::checkInnerJoin" ); sal_Bool bOk = sal_False; if (pNode->count() == 3 && // Ausdruck is geklammert SQL_ISPUNCTUATION(pNode->getChild(0),"(") && @@ -1453,6 +1456,7 @@ sal_Bool ORowSetCache::checkJoin(const Reference< XConnection>& _xConnection, const Reference< XSingleSelectQueryAnalyzer >& _xAnalyzer, const ::rtl::OUString& _sUpdateTableName ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::checkJoin" ); sal_Bool bOk = sal_False; ::rtl::OUString sSql = _xAnalyzer->getQuery(); ::rtl::OUString sErrorMsg; @@ -1511,6 +1515,7 @@ sal_Bool ORowSetCache::checkJoin(const Reference< XConnection>& _xConnection, // ----------------------------------------------------------------------------- void ORowSetCache::clearInsertRow() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::clearInsertRow" ); // we don't unbound the bookmark column if ( m_aInsertRow != m_pInsertMatrix->end() && m_aInsertRow->isValid() ) { @@ -1527,6 +1532,7 @@ void ORowSetCache::clearInsertRow() // ----------------------------------------------------------------------------- ORowSetMatrix::iterator ORowSetCache::calcPosition() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::calcPosition" ); sal_Int32 nValue = (m_nPosition - m_nStartPos) - 1; CHECK_MATRIX_POS(nValue); return ( nValue < 0 || nValue >= static_cast<sal_Int32>(m_pMatrix->size()) ) ? m_pMatrix->end() : (m_pMatrix->begin() + nValue); @@ -1535,6 +1541,7 @@ ORowSetMatrix::iterator ORowSetCache::calcPosition() const TORowSetOldRowHelperRef ORowSetCache::registerOldRow() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::registerOldRow" ); TORowSetOldRowHelperRef pRef = new ORowSetOldRowHelper(ORowSetRow()); m_aOldRows.push_back(pRef); return pRef; @@ -1542,6 +1549,7 @@ TORowSetOldRowHelperRef ORowSetCache::registerOldRow() // ----------------------------------------------------------------------------- void ORowSetCache::deregisterOldRow(const TORowSetOldRowHelperRef& _rRow) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::deregisterOldRow" ); for (TOldRowSetRows::iterator aOldRowIter = m_aOldRows.begin(); aOldRowIter != m_aOldRows.end(); ++aOldRowIter) { if ( aOldRowIter->getBodyPtr() == _rRow.getBodyPtr() ) @@ -1555,6 +1563,7 @@ void ORowSetCache::deregisterOldRow(const TORowSetOldRowHelperRef& _rRow) // ----------------------------------------------------------------------------- sal_Bool ORowSetCache::reFillMatrix(sal_Int32 _nNewStartPos,sal_Int32 _nNewEndPos) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::reFillMatrix" ); for (TOldRowSetRows::iterator aOldRowIter = m_aOldRows.begin(); aOldRowIter != m_aOldRows.end(); ++aOldRowIter) { if ( aOldRowIter->isValid() && aOldRowIter->getBody().getRow().isValid() ) @@ -1569,6 +1578,7 @@ sal_Bool ORowSetCache::reFillMatrix(sal_Int32 _nNewStartPos,sal_Int32 _nNewEndPo // ----------------------------------------------------------------------------- sal_Bool ORowSetCache::fill(ORowSetMatrix::iterator& _aIter,const ORowSetMatrix::iterator& _aEnd,sal_Int32& _nPos,sal_Bool _bCheck) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::fill" ); sal_Int32 nColumnCount = m_xMetaData->getColumnCount(); for(; _bCheck && _aIter != _aEnd;) { diff --git a/dbaccess/source/core/api/RowSetCache.hxx b/dbaccess/source/core/api/RowSetCache.hxx index 8e9d5b987437..f89a1cd82caa 100644 --- a/dbaccess/source/core/api/RowSetCache.hxx +++ b/dbaccess/source/core/api/RowSetCache.hxx @@ -163,6 +163,8 @@ namespace dbaccess sal_Bool reFillMatrix(sal_Int32 _nNewStartPos,sal_Int32 nNewEndPos); sal_Bool fillMatrix(sal_Int32 &_nNewStartPos,sal_Int32 _nNewEndPos); sal_Bool moveWindow(); + // returns true when a keyset needs to be created. + sal_Bool impl_createBookmarkSet_nothrow(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >& _xRs); void firePropertyChange(sal_Int32 _nColumnIndex,const ::connectivity::ORowSetValue& _rOldValue); @@ -187,7 +189,7 @@ namespace dbaccess // is called when after a moveToInsertRow a movement (next, etc) was called void cancelRowModification(); public: - ORowSetCache(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >&, + ORowSetCache(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >& _xRs, const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryAnalyzer >& _xAnalyzer, const ::comphelper::ComponentContext& _rContext, const ::rtl::OUString& _rUpdateTableName, diff --git a/dbaccess/source/core/api/RowSetCacheIterator.cxx b/dbaccess/source/core/api/RowSetCacheIterator.cxx index 59f3fa334b47..f309bde0537f 100644 --- a/dbaccess/source/core/api/RowSetCacheIterator.cxx +++ b/dbaccess/source/core/api/RowSetCacheIterator.cxx @@ -39,7 +39,7 @@ #ifndef DBACCESS_CORE_API_ROWSETBASE_HXX #include "RowSetBase.hxx" #endif - +#include <rtl/logfile.hxx> using namespace dbaccess; ORowSetCacheIterator::ORowSetCacheIterator(const ORowSetCacheIterator& _rRH) @@ -47,6 +47,7 @@ ORowSetCacheIterator::ORowSetCacheIterator(const ORowSetCacheIterator& _rRH) , m_pCache(_rRH.m_pCache) ,m_pRowSet(_rRH.m_pRowSet) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCacheIterator::ORowSetCacheIterator" ); } // ----------------------------------------------------------------------------- ORowSetCacheIterator::operator ORowSetMatrix::iterator() @@ -126,11 +127,13 @@ bool ORowSetCacheIterator::operator ==(const ORowSetMatrix::iterator& _rRH) cons // ----------------------------------------------------------------------------- void ORowSetCacheIterator::setBookmark(const ::com::sun::star::uno::Any& _rBookmark) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCacheIterator::setBookmark" ); m_aIter->second.aBookmark = _rBookmark; } // ----------------------------------------------------------------------------- sal_Bool ORowSetCacheIterator::isNull() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCacheIterator::isNull" ); sal_Bool bRet = !m_pCache || !m_pRowSet || m_aIter == m_pCache->m_aCacheIterators.end(); if ( !bRet ) { @@ -147,5 +150,6 @@ sal_Bool ORowSetCacheIterator::isNull() const // ----------------------------------------------------------------------------- ::osl::Mutex* ORowSetCacheIterator::getMutex() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCacheIterator::getMutex" ); return m_pRowSet ? m_pRowSet->getMutex() : NULL; } diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx index 34aeb94c0586..4583dd3dfabf 100644 --- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx +++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx @@ -209,6 +209,7 @@ OSingleSelectQueryComposer::OSingleSelectQueryComposer(const Reference< XNameAcc ,m_pTables(NULL) ,m_nBoolCompareMode( BooleanComparisonMode::EQUAL_INTEGER ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::OSingleSelectQueryComposer" ); DBG_CTOR(OSingleSelectQueryComposer,NULL); if ( !m_aContext.is() || !m_xConnection.is() || !m_xConnectionTables.is() ) @@ -268,6 +269,7 @@ OSingleSelectQueryComposer::~OSingleSelectQueryComposer() // OComponentHelper void SAL_CALL OSingleSelectQueryComposer::disposing(void) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::disposing" ); OSubComponent::disposing(); MutexGuard aGuard(m_aMutex); @@ -289,6 +291,7 @@ IMPLEMENT_PROPERTYCONTAINER_DEFAULTS(OSingleSelectQueryComposer) // com::sun::star::lang::XUnoTunnel sal_Int64 SAL_CALL OSingleSelectQueryComposer::getSomething( const Sequence< sal_Int8 >& rId ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getSomething" ); if (rId.getLength() == 16 && 0 == rtl_compareMemory(getImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) return reinterpret_cast<sal_Int64>(this); @@ -299,6 +302,7 @@ sal_Int64 SAL_CALL OSingleSelectQueryComposer::getSomething( const Sequence< sal // XSingleSelectQueryAnalyzer ::rtl::OUString SAL_CALL OSingleSelectQueryComposer::getQuery( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getQuery" ); ::connectivity::checkDisposed(OSubComponent::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); @@ -345,29 +349,33 @@ void OSingleSelectQueryComposer::setQuery_Impl( const ::rtl::OUString& command ) // ----------------------------------------------------------------------------- Sequence< Sequence< PropertyValue > > SAL_CALL OSingleSelectQueryComposer::getStructuredHavingClause( ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getStructuredHavingClause" ); TGetParseNode F_tmp(&OSQLParseTreeIterator::getSimpleHavingTree); return getStructuredCondition(F_tmp); } // ------------------------------------------------------------------------- Sequence< Sequence< PropertyValue > > SAL_CALL OSingleSelectQueryComposer::getStructuredFilter( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getStructuredFilter" ); TGetParseNode F_tmp(&OSQLParseTreeIterator::getSimpleWhereTree); return getStructuredCondition(F_tmp); } // ----------------------------------------------------------------------------- void SAL_CALL OSingleSelectQueryComposer::appendHavingClauseByColumn( const Reference< XPropertySet >& column, sal_Bool andCriteria ) throw (SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::appendHavingClauseByColumn" ); ::std::mem_fun1_t<bool,OSingleSelectQueryComposer,::rtl::OUString> F_tmp(&OSingleSelectQueryComposer::implSetHavingClause); setConditionByColumn(column,andCriteria,F_tmp); } // ----------------------------------------------------------------------------- void SAL_CALL OSingleSelectQueryComposer::appendFilterByColumn( const Reference< XPropertySet >& column, sal_Bool andCriteria ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::appendFilterByColumn" ); ::std::mem_fun1_t<bool,OSingleSelectQueryComposer,::rtl::OUString> F_tmp(&OSingleSelectQueryComposer::implSetFilter); setConditionByColumn(column,andCriteria,F_tmp); } -// ------------------------------------------------------------------------- -void SAL_CALL OSingleSelectQueryComposer::appendOrderByColumn( const Reference< XPropertySet >& column, sal_Bool ascending ) throw(SQLException, RuntimeException) +// ----------------------------------------------------------------------------- +::rtl::OUString OSingleSelectQueryComposer::impl_getColumnName_throw(const Reference< XPropertySet >& column) { ::connectivity::checkDisposed(OSubComponent::rBHelper.bDisposed); @@ -382,9 +390,7 @@ void SAL_CALL OSingleSelectQueryComposer::appendOrderByColumn( const Reference< throw SQLException(DBACORE_RESSTRING(RID_STR_COLUMN_NOT_VALID),*this,SQLSTATE_GENERAL,1000,makeAny(aErr) ); } - ::osl::MutexGuard aGuard( m_aMutex ); - - ::rtl::OUString aName,aAppendOrder; + ::rtl::OUString aName,aNewName; column->getPropertyValue(PROPERTY_NAME) >>= aName; if ( !m_xMetaData->supportsOrderByUnrelated() && m_aCurrentColumns[SelectColumns] && !m_aCurrentColumns[SelectColumns]->hasByName(aName)) @@ -396,7 +402,6 @@ void SAL_CALL OSingleSelectQueryComposer::appendOrderByColumn( const Reference< // filter anhaengen // select ohne where und order by aufbauen - ::rtl::OUString aSql(m_aPureSelectSQL); ::rtl::OUString aQuote = m_xMetaData->getIdentifierQuoteString(); if ( m_aCurrentColumns[SelectColumns]->hasByName(aName) ) { @@ -414,7 +419,7 @@ void SAL_CALL OSingleSelectQueryComposer::appendOrderByColumn( const Reference< if ( sRealName == aName ) { if ( bFunction ) - aAppendOrder += aName; + aNewName = aName; else { if(sTableName.indexOf('.',0) != -1) @@ -426,22 +431,29 @@ void SAL_CALL OSingleSelectQueryComposer::appendOrderByColumn( const Reference< else sTableName = ::dbtools::quoteName(aQuote,sTableName); - aAppendOrder = sTableName; - aAppendOrder += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".")); - aAppendOrder += ::dbtools::quoteName(aQuote,sRealName); + aNewName = sTableName; + aNewName += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".")); + aNewName += ::dbtools::quoteName(aQuote,sRealName); } } else - aAppendOrder += ::dbtools::quoteName(aQuote,aName); + aNewName = ::dbtools::quoteName(aQuote,aName); } else - aAppendOrder = getTableAlias(column) + ::dbtools::quoteName(aQuote,aName); - + aNewName = getTableAlias(column) + ::dbtools::quoteName(aQuote,aName); + return aNewName; +} +// ------------------------------------------------------------------------- +void SAL_CALL OSingleSelectQueryComposer::appendOrderByColumn( const Reference< XPropertySet >& column, sal_Bool ascending ) throw(SQLException, RuntimeException) +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::appendOrderByColumn" ); + ::osl::MutexGuard aGuard( m_aMutex ); + ::rtl::OUString sColumnName( impl_getColumnName_throw(column) ); ::rtl::OUString sOrder = getOrder(); - if ( (sOrder.getLength() != 0) && aAppendOrder.getLength() ) + if ( (sOrder.getLength() != 0) && sColumnName.getLength() ) sOrder += COMMA; - sOrder += aAppendOrder; - if ( !ascending && aAppendOrder.getLength() ) + sOrder += sColumnName; + if ( !ascending && sColumnName.getLength() ) sOrder += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" DESC ")); setOrder(sOrder); @@ -450,69 +462,18 @@ void SAL_CALL OSingleSelectQueryComposer::appendOrderByColumn( const Reference< // ------------------------------------------------------------------------- void SAL_CALL OSingleSelectQueryComposer::appendGroupByColumn( const Reference< XPropertySet >& column) throw(SQLException, RuntimeException) { - ::connectivity::checkDisposed(OSubComponent::rBHelper.bDisposed); - - if ( !column.is() - || !m_aCurrentColumns[SelectColumns] - || !column->getPropertySetInfo()->hasPropertyByName(PROPERTY_NAME) - ) - { - String sError(DBACORE_RESSTRING(RID_STR_COLUMN_UNKNOWN_PROP)); - sError.SearchAndReplaceAscii("%value", ::rtl::OUString(PROPERTY_NAME)); - SQLException aErr(sError,*this,SQLSTATE_GENERAL,1000,Any() ); - throw SQLException(DBACORE_RESSTRING(RID_STR_COLUMN_NOT_VALID),*this,SQLSTATE_GENERAL,1000,makeAny(aErr) ); - } - + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::appendGroupByColumn" ); ::osl::MutexGuard aGuard( m_aMutex ); - - ::rtl::OUString aName,aAppendOrder; - column->getPropertyValue(PROPERTY_NAME) >>= aName; - - if ( !m_xMetaData->supportsGroupByUnrelated() && m_aCurrentColumns[SelectColumns] && !m_aCurrentColumns[SelectColumns]->hasByName(aName)) - { - String sError(DBACORE_RESSTRING(RID_STR_COLUMN_MUST_VISIBLE)); - sError.SearchAndReplaceAscii("%name", aName); - throw SQLException(sError,*this,SQLSTATE_GENERAL,1000,Any() ); - } - - // filter anhaengen - // select ohne where und order by aufbauen - ::rtl::OUString aSql(m_aPureSelectSQL); - ::rtl::OUString aQuote = m_xMetaData->getIdentifierQuoteString(); - if ( m_aCurrentColumns[SelectColumns]->hasByName(aName) ) - { - Reference<XPropertySet> xColumn; - m_aCurrentColumns[SelectColumns]->getByName(aName) >>= xColumn; - OSL_ENSURE(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_REALNAME),"Property REALNAME not available!"); - OSL_ENSURE(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_TABLENAME),"Property TABLENAME not available!"); - - ::rtl::OUString sRealName,sTableName; - xColumn->getPropertyValue(PROPERTY_REALNAME) >>= sRealName; - xColumn->getPropertyValue(PROPERTY_TABLENAME) >>= sTableName; - if(sTableName.indexOf('.',0) != -1) - { - ::rtl::OUString aCatlog,aSchema,aTable; - ::dbtools::qualifiedNameComponents(m_xMetaData,sTableName,aCatlog,aSchema,aTable,::dbtools::eInDataManipulation); - sTableName = ::dbtools::composeTableName( m_xMetaData, aCatlog, aSchema, aTable, sal_True, ::dbtools::eInDataManipulation ); - } - else - sTableName = ::dbtools::quoteName(aQuote,sTableName); - - aAppendOrder = sTableName; - aAppendOrder += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".")); - aAppendOrder += ::dbtools::quoteName(aQuote,sRealName); - } - else - aAppendOrder = getTableAlias(column) + ::dbtools::quoteName(aQuote,aName); - + ::rtl::OUString sColumnName( impl_getColumnName_throw(column) ); OrderCreator aComposer; aComposer.append( getGroup() ); - aComposer.append( aAppendOrder ); + aComposer.append( sColumnName ); setGroup( aComposer.getComposedAndClear() ); } // ------------------------------------------------------------------------- ::rtl::OUString OSingleSelectQueryComposer::composeStatementFromParts( const ::std::vector< ::rtl::OUString >& _rParts ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::composeStatementFromParts" ); DBG_ASSERT( _rParts.size() == (size_t)SQLPartCount, "OSingleSelectQueryComposer::composeStatementFromParts: invalid parts array!" ); ::rtl::OUStringBuffer aSql( m_aPureSelectSQL ); @@ -529,6 +490,7 @@ void SAL_CALL OSingleSelectQueryComposer::appendGroupByColumn( const Reference< // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OSingleSelectQueryComposer::getElementaryQuery() throw (::com::sun::star::uno::RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getElementaryQuery" ); return composeStatementFromParts( m_aElementaryParts ); } @@ -586,6 +548,7 @@ namespace // ------------------------------------------------------------------------- void OSingleSelectQueryComposer::setSingleAdditiveClause( SQLPart _ePart, const ::rtl::OUString& _rClause ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::setSingleAdditiveClause" ); ::connectivity::checkDisposed(OSubComponent::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); @@ -644,22 +607,26 @@ void OSingleSelectQueryComposer::setSingleAdditiveClause( SQLPart _ePart, const // ------------------------------------------------------------------------- void SAL_CALL OSingleSelectQueryComposer::setFilter( const ::rtl::OUString& filter ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::setFilter" ); setSingleAdditiveClause( Where, filter ); } // ------------------------------------------------------------------------- void SAL_CALL OSingleSelectQueryComposer::setOrder( const ::rtl::OUString& order ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::setOrder" ); setSingleAdditiveClause( Order, order ); } // ----------------------------------------------------------------------------- void SAL_CALL OSingleSelectQueryComposer::setGroup( const ::rtl::OUString& group ) throw (SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::setGroup" ); setSingleAdditiveClause( Group, group ); } // ------------------------------------------------------------------------- void SAL_CALL OSingleSelectQueryComposer::setHavingClause( const ::rtl::OUString& filter ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::setHavingClause" ); setSingleAdditiveClause( Having, filter ); } @@ -667,6 +634,7 @@ void SAL_CALL OSingleSelectQueryComposer::setHavingClause( const ::rtl::OUString // XTablesSupplier Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getTables( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getTables" ); ::connectivity::checkDisposed(OSubComponent::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); @@ -686,6 +654,7 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getTables( ) thro // XColumnsSupplier Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getColumns" ); ::connectivity::checkDisposed(OSubComponent::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); if ( !!m_aCurrentColumns[SelectColumns] ) @@ -855,6 +824,7 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) thr sal_Bool OSingleSelectQueryComposer::setORCriteria(OSQLParseNode* pCondition, OSQLParseTreeIterator& _rIterator, ::std::vector< ::std::vector < PropertyValue > >& rFilters, const Reference< ::com::sun::star::util::XNumberFormatter > & xFormatter) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::setORCriteria" ); // Runde Klammern um den Ausdruck if (pCondition->count() == 3 && SQL_ISPUNCTUATION(pCondition->getChild(0),"(") && @@ -893,6 +863,7 @@ sal_Bool OSingleSelectQueryComposer::setORCriteria(OSQLParseNode* pCondition, OS sal_Bool OSingleSelectQueryComposer::setANDCriteria( OSQLParseNode * pCondition, OSQLParseTreeIterator& _rIterator, ::std::vector < PropertyValue >& rFilter, const Reference< XNumberFormatter > & xFormatter) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::setANDCriteria" ); // Runde Klammern if (SQL_ISRULE(pCondition,boolean_primary)) { @@ -982,6 +953,7 @@ sal_Bool OSingleSelectQueryComposer::setANDCriteria( OSQLParseNode * pCondition, // ----------------------------------------------------------------------------- sal_Int32 OSingleSelectQueryComposer::getPredicateType(OSQLParseNode * _pPredicate) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getPredicateType" ); sal_Int32 nPredicate = SQLFilterOperator::EQUAL; switch (_pPredicate->getNodeType()) { @@ -1012,6 +984,7 @@ sal_Int32 OSingleSelectQueryComposer::getPredicateType(OSQLParseNode * _pPredica sal_Bool OSingleSelectQueryComposer::setComparsionPredicate(OSQLParseNode * pCondition, OSQLParseTreeIterator& _rIterator, ::std::vector < PropertyValue >& rFilter, const Reference< ::com::sun::star::util::XNumberFormatter > & xFormatter) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::setComparsionPredicate" ); DBG_ASSERT(SQL_ISRULE(pCondition, comparison_predicate),"setComparsionPredicate: pCondition ist kein ComparsionPredicate"); if (SQL_ISRULE(pCondition->getChild(0), column_ref) || SQL_ISRULE(pCondition->getChild(pCondition->count()-1), column_ref)) @@ -1138,6 +1111,7 @@ sal_Bool OSingleSelectQueryComposer::setComparsionPredicate(OSQLParseNode * pCon //-------------------------------------------------------------------------------------------------- ::rtl::OUString OSingleSelectQueryComposer::getColumnName( ::connectivity::OSQLParseNode* pColumnRef, OSQLParseTreeIterator& _rIterator ) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getColumnName" ); ::rtl::OUString aTableRange, aColumnName; _rIterator.getColumnRange(pColumnRef,aColumnName,aTableRange); return aColumnName; @@ -1145,6 +1119,7 @@ sal_Bool OSingleSelectQueryComposer::setComparsionPredicate(OSQLParseNode * pCon //------------------------------------------------------------------------------ ::rtl::OUString SAL_CALL OSingleSelectQueryComposer::getFilter( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getFilter" ); ::connectivity::checkDisposed(OSubComponent::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); return getSQLPart(Where,m_aAdditiveIterator,sal_False); @@ -1152,6 +1127,7 @@ sal_Bool OSingleSelectQueryComposer::setComparsionPredicate(OSQLParseNode * pCon // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OSingleSelectQueryComposer::getOrder( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getOrder" ); ::connectivity::checkDisposed(OSubComponent::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); return getSQLPart(Order,m_aAdditiveIterator,sal_False); @@ -1159,6 +1135,7 @@ sal_Bool OSingleSelectQueryComposer::setComparsionPredicate(OSQLParseNode * pCon // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OSingleSelectQueryComposer::getGroup( ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getGroup" ); ::connectivity::checkDisposed(OSubComponent::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); return getSQLPart(Group,m_aAdditiveIterator,sal_False); @@ -1166,6 +1143,7 @@ sal_Bool OSingleSelectQueryComposer::setComparsionPredicate(OSQLParseNode * pCon // ----------------------------------------------------------------------------- ::rtl::OUString OSingleSelectQueryComposer::getHavingClause() throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getHavingClause" ); ::connectivity::checkDisposed(OSubComponent::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); return getSQLPart(Having,m_aAdditiveIterator,sal_False); @@ -1173,6 +1151,7 @@ sal_Bool OSingleSelectQueryComposer::setComparsionPredicate(OSQLParseNode * pCon // ----------------------------------------------------------------------------- ::rtl::OUString OSingleSelectQueryComposer::getTableAlias(const Reference< XPropertySet >& column) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getTableAlias" ); ::rtl::OUString sReturn; if(m_pTables && m_pTables->getCount() > 1) { @@ -1247,6 +1226,7 @@ sal_Bool OSingleSelectQueryComposer::setComparsionPredicate(OSQLParseNode * pCon // ----------------------------------------------------------------------------- Reference< XIndexAccess > SAL_CALL OSingleSelectQueryComposer::getParameters( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getParameters" ); // now set the Parameters if ( !m_aCurrentColumns[ParameterColumns] ) { @@ -1262,6 +1242,7 @@ Reference< XIndexAccess > SAL_CALL OSingleSelectQueryComposer::getParameters( ) // ----------------------------------------------------------------------------- void OSingleSelectQueryComposer::clearParametersCollection() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::clearParametersCollection" ); if ( m_aCurrentColumns[ParameterColumns] ) { m_aCurrentColumns[ParameterColumns]->disposing(); @@ -1272,6 +1253,7 @@ void OSingleSelectQueryComposer::clearParametersCollection() // ----------------------------------------------------------------------------- void OSingleSelectQueryComposer::clearCurrentCollections() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::clearCurrentCollections" ); ::std::vector<OPrivateColumns*>::iterator aIter = m_aCurrentColumns.begin(); ::std::vector<OPrivateColumns*>::iterator aEnd = m_aCurrentColumns.end(); for (;aIter != aEnd;++aIter) @@ -1295,6 +1277,7 @@ void OSingleSelectQueryComposer::clearCurrentCollections() Reference< XIndexAccess > OSingleSelectQueryComposer::setCurrentColumns( EColumnType _eType, const ::vos::ORef< OSQLColumns >& _rCols ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::setCurrentColumns" ); ::connectivity::checkDisposed(OSubComponent::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); @@ -1312,16 +1295,19 @@ Reference< XIndexAccess > OSingleSelectQueryComposer::setCurrentColumns( EColumn // ----------------------------------------------------------------------------- Reference< XIndexAccess > SAL_CALL OSingleSelectQueryComposer::getGroupColumns( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getGroupColumns" ); return setCurrentColumns( GroupByColumns, m_aAdditiveIterator.getGroupColumns() ); } // ------------------------------------------------------------------------- Reference< XIndexAccess > SAL_CALL OSingleSelectQueryComposer::getOrderColumns( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getOrderColumns" ); return setCurrentColumns( OrderColumns, m_aAdditiveIterator.getOrderColumns() ); } // ----------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OSingleSelectQueryComposer::getQueryWithSubstitution( ) throw (SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getQueryWithSubstitution" ); ::osl::MutexGuard aGuard( m_aMutex ); ::connectivity::checkDisposed(OSubComponent::rBHelper.bDisposed); @@ -1340,6 +1326,7 @@ Reference< XIndexAccess > SAL_CALL OSingleSelectQueryComposer::getOrderColumns( // ----------------------------------------------------------------------------- ::rtl::OUString OSingleSelectQueryComposer::getStatementPart( TGetParseNode& _aGetFunctor, OSQLParseTreeIterator& _rIterator ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getStatementPart" ); ::rtl::OUString sResult; const OSQLParseNode* pNode = _aGetFunctor( &_rIterator ); @@ -1427,16 +1414,19 @@ namespace // ----------------------------------------------------------------------------- void SAL_CALL OSingleSelectQueryComposer::setStructuredFilter( const Sequence< Sequence< PropertyValue > >& filter ) throw (SQLException, ::com::sun::star::lang::IllegalArgumentException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::setStructuredFilter" ); setFilter(lcl_getCondition(filter)); } // ----------------------------------------------------------------------------- void SAL_CALL OSingleSelectQueryComposer::setStructuredHavingClause( const Sequence< Sequence< PropertyValue > >& filter ) throw (SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::setStructuredHavingClause" ); setHavingClause(lcl_getCondition(filter)); } // ----------------------------------------------------------------------------- void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropertySet >& column, sal_Bool andCriteria ,::std::mem_fun1_t<bool,OSingleSelectQueryComposer,::rtl::OUString>& _aSetFunctor) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::setConditionByColumn" ); ::connectivity::checkDisposed(OSubComponent::rBHelper.bDisposed); if ( !column.is() @@ -1578,6 +1568,7 @@ void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropert // ----------------------------------------------------------------------------- Sequence< Sequence< PropertyValue > > OSingleSelectQueryComposer::getStructuredCondition( TGetParseNode& _aGetFunctor ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getStructuredCondition" ); ::connectivity::checkDisposed(OSubComponent::rBHelper.bDisposed); MutexGuard aGuard(m_aMutex); @@ -1666,6 +1657,7 @@ Sequence< Sequence< PropertyValue > > OSingleSelectQueryComposer::getStructuredC // ----------------------------------------------------------------------------- ::rtl::OUString OSingleSelectQueryComposer::getKeyword( SQLPart _ePart ) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getKeyword" ); ::rtl::OUString sKeyword; switch(_ePart) { @@ -1691,6 +1683,7 @@ Sequence< Sequence< PropertyValue > > OSingleSelectQueryComposer::getStructuredC // ----------------------------------------------------------------------------- ::rtl::OUString OSingleSelectQueryComposer::getSQLPart( SQLPart _ePart, OSQLParseTreeIterator& _rIterator, sal_Bool _bWithKeyword ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getSQLPart" ); TGetParseNode F_tmp(&OSQLParseTreeIterator::getSimpleWhereTree); ::rtl::OUString sKeyword( getKeyword( _ePart ) ); switch(_ePart) diff --git a/dbaccess/source/core/api/StaticSet.cxx b/dbaccess/source/core/api/StaticSet.cxx index 80f54f2b47fa..2565b0d0c466 100644 --- a/dbaccess/source/core/api/StaticSet.cxx +++ b/dbaccess/source/core/api/StaticSet.cxx @@ -58,6 +58,7 @@ #ifndef _COMPHELPER_TYPES_HXX_ #include <comphelper/types.hxx> #endif +#include <rtl/logfile.hxx> using namespace dbaccess; using namespace connectivity; @@ -74,29 +75,34 @@ using namespace ::osl; // ------------------------------------------------------------------------- void OStaticSet::fillValueRow(ORowSetRow& _rRow,sal_Int32 /*_nPosition*/) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::fillValueRow" ); _rRow = *m_aSetIter; } // ------------------------------------------------------------------------- // ::com::sun::star::sdbcx::XRowLocate Any SAL_CALL OStaticSet::getBookmark() throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::getBookmark" ); return makeAny(getRow()); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OStaticSet::moveToBookmark( const Any& bookmark ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::moveToBookmark" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; return absolute(::comphelper::getINT32(bookmark)); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OStaticSet::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::moveRelativeToBookmark" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; return absolute(::comphelper::getINT32(bookmark)+rows); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OStaticSet::compareBookmarks( const Any& _first, const Any& _second ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::compareBookmarks" ); sal_Int32 nFirst = 0, nSecond = 0; _first >>= nFirst; _second >>= nSecond; @@ -105,16 +111,19 @@ sal_Int32 SAL_CALL OStaticSet::compareBookmarks( const Any& _first, const Any& _ // ------------------------------------------------------------------------- sal_Bool SAL_CALL OStaticSet::hasOrderedBookmarks( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::hasOrderedBookmarks" ); return sal_True; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OStaticSet::hashBookmark( const Any& bookmark ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::hashBookmark" ); return ::comphelper::getINT32(bookmark); } // ------------------------------------------------------------------------- sal_Bool OStaticSet::fetchRow() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::fetchRow" ); sal_Bool bRet = sal_False; if ( !m_bEnd ) bRet = m_xDriverSet->next(); @@ -132,6 +141,7 @@ sal_Bool OStaticSet::fetchRow() // ------------------------------------------------------------------------- void OStaticSet::fillAllRows() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::fillAllRows" ); if(!m_bEnd) { while(m_xDriverSet->next()) @@ -149,6 +159,7 @@ void OStaticSet::fillAllRows() // XResultSet sal_Bool SAL_CALL OStaticSet::next( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::next" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; if(isAfterLast()) @@ -166,32 +177,38 @@ sal_Bool SAL_CALL OStaticSet::next( ) throw(SQLException, RuntimeException) // ------------------------------------------------------------------------- sal_Bool SAL_CALL OStaticSet::isBeforeFirst( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::isBeforeFirst" ); return m_aSetIter == m_aSet.begin(); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OStaticSet::isAfterLast( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::isAfterLast" ); return m_aSetIter == m_aSet.end() && m_bEnd; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OStaticSet::isFirst( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::isFirst" ); return m_aSetIter == m_aSet.begin()+1; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OStaticSet::isLast( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::isLast" ); return m_aSetIter == m_aSet.end()-1 && m_bEnd; } // ------------------------------------------------------------------------- void SAL_CALL OStaticSet::beforeFirst( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::beforeFirst" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; m_aSetIter = m_aSet.begin(); } // ------------------------------------------------------------------------- void SAL_CALL OStaticSet::afterLast( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::afterLast" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; fillAllRows(); m_aSetIter = m_aSet.end(); @@ -199,6 +216,7 @@ void SAL_CALL OStaticSet::afterLast( ) throw(SQLException, RuntimeException) // ------------------------------------------------------------------------- sal_Bool SAL_CALL OStaticSet::first( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::first" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; m_aSetIter = m_aSet.begin()+1; if(m_aSetIter == m_aSet.end() && !fetchRow()) @@ -209,6 +227,7 @@ sal_Bool SAL_CALL OStaticSet::first( ) throw(SQLException, RuntimeException) // ------------------------------------------------------------------------- sal_Bool SAL_CALL OStaticSet::last( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::last" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; fillAllRows(); m_aSetIter = m_aSet.end()-1; @@ -218,6 +237,7 @@ sal_Bool SAL_CALL OStaticSet::last( ) throw(SQLException, RuntimeException) // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OStaticSet::getRow( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::getRow" ); OSL_ENSURE(!isAfterLast(),"getRow is not allowed when afterlast record!"); OSL_ENSURE(!isBeforeFirst(),"getRow is not allowed when beforefirst record!"); @@ -228,6 +248,7 @@ sal_Int32 SAL_CALL OStaticSet::getRow( ) throw(SQLException, RuntimeException) // ------------------------------------------------------------------------- sal_Bool SAL_CALL OStaticSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::absolute" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; OSL_ENSURE(row,"OStaticSet::absolute: INVALID row number!"); // if row greater 0 than count from end - row means last @@ -268,6 +289,7 @@ sal_Bool SAL_CALL OStaticSet::absolute( sal_Int32 row ) throw(SQLException, Runt // ------------------------------------------------------------------------- sal_Bool SAL_CALL OStaticSet::relative( sal_Int32 rows ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::relative" ); if(!rows) return sal_True; @@ -277,6 +299,7 @@ sal_Bool SAL_CALL OStaticSet::relative( sal_Int32 rows ) throw(SQLException, Run // ------------------------------------------------------------------------- sal_Bool SAL_CALL OStaticSet::previous( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::previous" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; if(m_aSetIter != m_aSet.begin()) @@ -287,25 +310,30 @@ sal_Bool SAL_CALL OStaticSet::previous( ) throw(SQLException, RuntimeException) // ------------------------------------------------------------------------- void SAL_CALL OStaticSet::refreshRow( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::refreshRow" ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OStaticSet::rowUpdated( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::rowUpdated" ); return m_bUpdated; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OStaticSet::rowInserted( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::rowInserted" ); return m_bInserted; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OStaticSet::rowDeleted( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::rowDeleted" ); return m_bDeleted; } // ------------------------------------------------------------------------- Sequence< sal_Int32 > SAL_CALL OStaticSet::deleteRows( const Sequence< Any >& rows,const connectivity::OSQLTable& _xTable ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::deleteRows" ); Sequence< sal_Int32 > aRet(rows.getLength()); const Any* pBegin = rows.getConstArray(); const Any* pEnd = pBegin + rows.getLength(); @@ -319,6 +347,7 @@ Sequence< sal_Int32 > SAL_CALL OStaticSet::deleteRows( const Sequence< Any >& ro // ------------------------------------------------------------------------- void SAL_CALL OStaticSet::insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQLTable& _xTable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::insertRow" ); OCacheSet::insertRow( _rInsertRow,_xTable); if(m_bInserted) { @@ -331,11 +360,13 @@ void SAL_CALL OStaticSet::insertRow( const ORowSetRow& _rInsertRow,const connect // ------------------------------------------------------------------------- void SAL_CALL OStaticSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrginalRow,const connectivity::OSQLTable& _xTable ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::updateRow" ); OCacheSet::updateRow( _rInsertRow,_rOrginalRow,_xTable); } // ------------------------------------------------------------------------- void SAL_CALL OStaticSet::deleteRow(const ORowSetRow& _rDeleteRow ,const connectivity::OSQLTable& _xTable ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::deleteRow" ); OCacheSet::deleteRow(_rDeleteRow,_xTable); if(m_bDeleted) { @@ -348,14 +379,17 @@ void SAL_CALL OStaticSet::deleteRow(const ORowSetRow& _rDeleteRow ,const connect // ------------------------------------------------------------------------- void SAL_CALL OStaticSet::cancelRowUpdates( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::cancelRowUpdates" ); } // ------------------------------------------------------------------------- void SAL_CALL OStaticSet::moveToInsertRow( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::moveToInsertRow" ); } // ------------------------------------------------------------------------- void SAL_CALL OStaticSet::moveToCurrentRow( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::moveToCurrentRow" ); } // ------------------------------------------------------------------------- diff --git a/dbaccess/source/core/api/TableDeco.cxx b/dbaccess/source/core/api/TableDeco.cxx index 2ddf7c3e9d3d..b0fa5b7492c6 100644 --- a/dbaccess/source/core/api/TableDeco.cxx +++ b/dbaccess/source/core/api/TableDeco.cxx @@ -98,6 +98,7 @@ #ifndef DBA_CONTAINERMEDIATOR_HXX #include "ContainerMediator.hxx" #endif +#include <rtl/logfile.hxx> using namespace dbaccess; using namespace ::com::sun::star::uno; @@ -129,6 +130,7 @@ ODBTableDecorator::ODBTableDecorator( const Reference< XConnection >& _rxConnect ,m_nPrivileges(-1) ,m_pColumns(NULL) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::ODBTableDecorator" ); DBG_CTOR(ODBTableDecorator, NULL); ODataSettings::registerPropertiesFor(this); } @@ -143,6 +145,7 @@ ODBTableDecorator::~ODBTableDecorator() //-------------------------------------------------------------------------- Sequence< sal_Int8 > ODBTableDecorator::getImplementationId() throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::getImplementationId" ); static OImplementationId * pId = 0; if (! pId) { @@ -160,6 +163,7 @@ Sequence< sal_Int8 > ODBTableDecorator::getImplementationId() throw (RuntimeExce //------------------------------------------------------------------------------ void SAL_CALL ODBTableDecorator::disposing() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::disposing" ); OPropertySetHelper::disposing(); OTableDescriptor_BASE::disposing(); @@ -181,6 +185,7 @@ sal_Bool SAL_CALL ODBTableDecorator::convertFastPropertyValue( const Any& rValue ) throw (::com::sun::star::lang::IllegalArgumentException) { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::convertFastPropertyValue" ); sal_Bool bRet = sal_True; switch(nHandle) { @@ -226,6 +231,7 @@ sal_Bool SAL_CALL ODBTableDecorator::convertFastPropertyValue( // ----------------------------------------------------------------------------- void ODBTableDecorator::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle, const Any& _rValue) throw (Exception) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::setFastPropertyValue_NoBroadcast" ); switch(_nHandle) { case PROPERTY_ID_PRIVILEGES: @@ -293,6 +299,7 @@ void ODBTableDecorator::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle, con //------------------------------------------------------------------------------ void ODBTableDecorator::getFastPropertyValue(Any& _rValue, sal_Int32 _nHandle) const { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::getFastPropertyValue" ); switch(_nHandle) { case PROPERTY_ID_PRIVILEGES: @@ -373,6 +380,7 @@ void ODBTableDecorator::getFastPropertyValue(Any& _rValue, sal_Int32 _nHandle) c // ------------------------------------------------------------------------- void ODBTableDecorator::construct() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::construct" ); sal_Bool bNotFound = sal_True; Reference<XPropertySet> xProp(m_xTable,UNO_QUERY); if ( xProp.is() ) @@ -387,6 +395,7 @@ void ODBTableDecorator::construct() // ----------------------------------------------------------------------------- ::cppu::IPropertyArrayHelper* ODBTableDecorator::createArrayHelper(sal_Int32 /*_nId*/) const { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::createArrayHelper" ); Reference<XPropertySet> xProp(m_xTable,UNO_QUERY); Reference<XPropertySetInfo> xInfo = xProp->getPropertySetInfo(); @@ -416,6 +425,7 @@ void ODBTableDecorator::construct() // ----------------------------------------------------------------------------- ::cppu::IPropertyArrayHelper & SAL_CALL ODBTableDecorator::getInfoHelper() { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::getInfoHelper" ); Reference<XPropertySet> xProp(m_xTable,UNO_QUERY); Reference<XPropertySetInfo> xInfo = xProp->getPropertySetInfo(); @@ -437,6 +447,7 @@ IMPLEMENT_SERVICE_INFO1(ODBTableDecorator, "com.sun.star.sdb.dbaccess.ODBTableDe // ------------------------------------------------------------------------- Any SAL_CALL ODBTableDecorator::queryInterface( const Type & rType ) throw(RuntimeException) { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::queryInterface" ); Any aRet; if(m_xTable.is()) { @@ -454,6 +465,7 @@ Any SAL_CALL ODBTableDecorator::queryInterface( const Type & rType ) throw(Runti // ------------------------------------------------------------------------- Sequence< Type > SAL_CALL ODBTableDecorator::getTypes( ) throw(RuntimeException) { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::getTypes" ); Reference<XTypeProvider> xTypes(m_xTable,UNO_QUERY); OSL_ENSURE(xTypes.is(),"Table must be a TypePropvider!"); return xTypes->getTypes(); @@ -464,6 +476,7 @@ Sequence< Type > SAL_CALL ODBTableDecorator::getTypes( ) throw(RuntimeException //------------------------------------------------------------------------------ void SAL_CALL ODBTableDecorator::rename( const ::rtl::OUString& _rNewName ) throw(SQLException, ElementExistException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::rename" ); ::osl::MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OTableDescriptor_BASE::rBHelper.bDisposed); Reference<XRename> xRename(m_xTable,UNO_QUERY); @@ -482,6 +495,7 @@ void SAL_CALL ODBTableDecorator::rename( const ::rtl::OUString& _rNewName ) thro //------------------------------------------------------------------------------ void SAL_CALL ODBTableDecorator::alterColumnByName( const ::rtl::OUString& _rName, const Reference< XPropertySet >& _rxDescriptor ) throw(SQLException, NoSuchElementException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::alterColumnByName" ); ::osl::MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OTableDescriptor_BASE::rBHelper.bDisposed); Reference<XAlterTable> xAlter(m_xTable,UNO_QUERY); @@ -498,6 +512,7 @@ void SAL_CALL ODBTableDecorator::alterColumnByName( const ::rtl::OUString& _rNam //------------------------------------------------------------------------------ void SAL_CALL ODBTableDecorator::alterColumnByIndex( sal_Int32 _nIndex, const Reference< XPropertySet >& _rxDescriptor ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::alterColumnByIndex" ); ::osl::MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OTableDescriptor_BASE::rBHelper.bDisposed); Reference<XAlterTable> xAlter(m_xTable,UNO_QUERY); @@ -513,6 +528,7 @@ void SAL_CALL ODBTableDecorator::alterColumnByIndex( sal_Int32 _nIndex, const Re // ----------------------------------------------------------------------------- Reference< XNameAccess> ODBTableDecorator::getIndexes() throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::getIndexes" ); ::osl::MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OTableDescriptor_BASE::rBHelper.bDisposed); return Reference< XIndexesSupplier>(m_xTable,UNO_QUERY)->getIndexes(); @@ -520,6 +536,7 @@ Reference< XNameAccess> ODBTableDecorator::getIndexes() throw (RuntimeException) // ------------------------------------------------------------------------- Reference< XIndexAccess> ODBTableDecorator::getKeys() throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::getKeys" ); ::osl::MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OTableDescriptor_BASE::rBHelper.bDisposed); return Reference< XKeysSupplier>(m_xTable,UNO_QUERY)->getKeys(); @@ -527,6 +544,7 @@ Reference< XIndexAccess> ODBTableDecorator::getKeys() throw (RuntimeException) // ------------------------------------------------------------------------- Reference< XNameAccess> ODBTableDecorator::getColumns() throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::getColumns" ); ::osl::MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OTableDescriptor_BASE::rBHelper.bDisposed); @@ -538,6 +556,7 @@ Reference< XNameAccess> ODBTableDecorator::getColumns() throw (RuntimeException) // ----------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODBTableDecorator::getName() throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::getName" ); ::osl::MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OTableDescriptor_BASE::rBHelper.bDisposed); Reference<XNamed> xName(m_xTable,UNO_QUERY); @@ -547,6 +566,7 @@ Reference< XNameAccess> ODBTableDecorator::getColumns() throw (RuntimeException) // ----------------------------------------------------------------------------- sal_Int64 SAL_CALL ODBTableDecorator::getSomething( const Sequence< sal_Int8 >& rId ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::getSomething" ); if (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) return reinterpret_cast<sal_Int64>(this); @@ -559,6 +579,7 @@ sal_Int64 SAL_CALL ODBTableDecorator::getSomething( const Sequence< sal_Int8 >& // ----------------------------------------------------------------------------- Sequence< sal_Int8 > ODBTableDecorator::getUnoTunnelImplementationId() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::getUnoTunnelImplementationId" ); static ::cppu::OImplementationId * pId = 0; if (! pId) { @@ -574,6 +595,7 @@ Sequence< sal_Int8 > ODBTableDecorator::getUnoTunnelImplementationId() // ----------------------------------------------------------------------------- void ODBTableDecorator::fillPrivileges() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::fillPrivileges" ); // somebody is asking for the privileges an we do not know them, yet m_nPrivileges = 0; try @@ -604,6 +626,7 @@ void ODBTableDecorator::fillPrivileges() const // ----------------------------------------------------------------------------- Reference< XPropertySet > SAL_CALL ODBTableDecorator::createDataDescriptor( ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::createDataDescriptor" ); ::osl::MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OTableDescriptor_BASE::rBHelper.bDisposed); @@ -623,11 +646,13 @@ Reference< XPropertySet > SAL_CALL ODBTableDecorator::createDataDescriptor( ) t // ----------------------------------------------------------------------------- Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL ODBTableDecorator::getPropertySetInfo( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::getPropertySetInfo" ); return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); } // ----------------------------------------------------------------------------- void ODBTableDecorator::refreshColumns() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::refreshColumns" ); ::osl::MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OTableDescriptor_BASE::rBHelper.bDisposed); @@ -665,6 +690,7 @@ void ODBTableDecorator::refreshColumns() // ----------------------------------------------------------------------------- OColumn* ODBTableDecorator::createColumn(const ::rtl::OUString& _rName) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::createColumn" ); OColumn* pReturn = NULL; Reference<XNameAccess> xNames; @@ -688,11 +714,13 @@ OColumn* ODBTableDecorator::createColumn(const ::rtl::OUString& _rName) const // ----------------------------------------------------------------------------- void ODBTableDecorator::columnAppended( const Reference< XPropertySet >& /*_rxSourceDescriptor*/ ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::columnAppended" ); // not interested in } // ----------------------------------------------------------------------------- void ODBTableDecorator::columnDropped(const ::rtl::OUString& _sName) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::columnDropped" ); Reference<XDrop> xDrop(m_xColumnDefinitions,UNO_QUERY); if ( xDrop.is() && m_xColumnDefinitions->hasByName(_sName) ) xDrop->dropByName(_sName); @@ -701,6 +729,7 @@ void ODBTableDecorator::columnDropped(const ::rtl::OUString& _sName) // ----------------------------------------------------------------------------- Reference< XPropertySet > ODBTableDecorator::createColumnDescriptor() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::createColumnDescriptor" ); Reference<XDataDescriptorFactory> xNames; if(m_xTable.is()) xNames.set(m_xTable->getColumns(),UNO_QUERY); @@ -723,6 +752,7 @@ void SAL_CALL ODBTableDecorator::release() throw() // ----------------------------------------------------------------------------- void SAL_CALL ODBTableDecorator::setName( const ::rtl::OUString& /*aName*/ ) throw (::com::sun::star::uno::RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::setName" ); throwFunctionNotSupportedException( "XNamed::setName", *this ); } diff --git a/dbaccess/source/core/api/callablestatement.cxx b/dbaccess/source/core/api/callablestatement.cxx index 0e00dc7c607f..7d72a93a8563 100644 --- a/dbaccess/source/core/api/callablestatement.cxx +++ b/dbaccess/source/core/api/callablestatement.cxx @@ -48,6 +48,7 @@ #ifndef DBACCESS_SHARED_DBASTRINGS_HRC #include "dbastrings.hrc" #endif +#include <rtl/logfile.hxx> using namespace dbaccess; using namespace ::com::sun::star::sdbc; @@ -62,6 +63,7 @@ using namespace ::osl; //-------------------------------------------------------------------------- Sequence< Type > OCallableStatement::getTypes() throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getTypes" ); OTypeCollection aTypes(::getCppuType( (const Reference< XRow > *)0 ), ::getCppuType( (const Reference< XOutParameters > *)0 ), OPreparedStatement::getTypes() ); @@ -72,6 +74,7 @@ Sequence< Type > OCallableStatement::getTypes() throw (RuntimeException) //-------------------------------------------------------------------------- Sequence< sal_Int8 > OCallableStatement::getImplementationId() throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getImplementationId" ); static OImplementationId * pId = 0; if (! pId) { @@ -89,6 +92,7 @@ Sequence< sal_Int8 > OCallableStatement::getImplementationId() throw (RuntimeExc //-------------------------------------------------------------------------- Any OCallableStatement::queryInterface( const Type & rType ) throw (RuntimeException) { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::queryInterface" ); Any aIface = OPreparedStatement::queryInterface( rType ); if (!aIface.hasValue()) aIface = ::cppu::queryInterface( @@ -114,12 +118,14 @@ void OCallableStatement::release() throw () //------------------------------------------------------------------------------ rtl::OUString OCallableStatement::getImplementationName( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getImplementationName" ); return rtl::OUString::createFromAscii("com.sun.star.sdb.OCallableStatement"); } //------------------------------------------------------------------------------ Sequence< ::rtl::OUString > OCallableStatement::getSupportedServiceNames( ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getSupportedServiceNames" ); Sequence< ::rtl::OUString > aSNS( 2 ); aSNS.getArray()[0] = SERVICE_SDBC_CALLABLESTATEMENT; aSNS.getArray()[1] = SERVICE_SDB_CALLABLESTATEMENT; @@ -130,6 +136,7 @@ Sequence< ::rtl::OUString > OCallableStatement::getSupportedServiceNames( ) thr //------------------------------------------------------------------------------ void SAL_CALL OCallableStatement::registerOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::registerOutParameter" ); MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed); @@ -141,6 +148,7 @@ void SAL_CALL OCallableStatement::registerOutParameter( sal_Int32 parameterIndex //------------------------------------------------------------------------------ void SAL_CALL OCallableStatement::registerNumericOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, sal_Int32 scale ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::registerNumericOutParameter" ); MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed); @@ -151,6 +159,7 @@ void SAL_CALL OCallableStatement::registerNumericOutParameter( sal_Int32 paramet //------------------------------------------------------------------------------ sal_Bool SAL_CALL OCallableStatement::wasNull( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::wasNull" ); MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed); @@ -160,6 +169,7 @@ sal_Bool SAL_CALL OCallableStatement::wasNull( ) throw(SQLException, RuntimeExc //------------------------------------------------------------------------------ ::rtl::OUString SAL_CALL OCallableStatement::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getString" ); MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed); @@ -169,6 +179,7 @@ sal_Bool SAL_CALL OCallableStatement::wasNull( ) throw(SQLException, RuntimeExc //------------------------------------------------------------------------------ sal_Bool SAL_CALL OCallableStatement::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getBoolean" ); MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed); @@ -178,6 +189,7 @@ sal_Bool SAL_CALL OCallableStatement::getBoolean( sal_Int32 columnIndex ) throw( //------------------------------------------------------------------------------ sal_Int8 SAL_CALL OCallableStatement::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getByte" ); MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed); @@ -187,6 +199,7 @@ sal_Int8 SAL_CALL OCallableStatement::getByte( sal_Int32 columnIndex ) throw(SQL //------------------------------------------------------------------------------ sal_Int16 SAL_CALL OCallableStatement::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getShort" ); MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed); return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getShort( columnIndex ); @@ -195,6 +208,7 @@ sal_Int16 SAL_CALL OCallableStatement::getShort( sal_Int32 columnIndex ) throw(S //------------------------------------------------------------------------------ sal_Int32 SAL_CALL OCallableStatement::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getInt" ); MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed); return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getInt( columnIndex ); @@ -203,6 +217,7 @@ sal_Int32 SAL_CALL OCallableStatement::getInt( sal_Int32 columnIndex ) throw(SQL //------------------------------------------------------------------------------ sal_Int64 SAL_CALL OCallableStatement::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getLong" ); MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed); return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getLong( columnIndex ); @@ -211,6 +226,7 @@ sal_Int64 SAL_CALL OCallableStatement::getLong( sal_Int32 columnIndex ) throw(SQ //------------------------------------------------------------------------------ float SAL_CALL OCallableStatement::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getFloat" ); MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed); return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getFloat( columnIndex ); @@ -219,6 +235,7 @@ float SAL_CALL OCallableStatement::getFloat( sal_Int32 columnIndex ) throw(SQLEx //------------------------------------------------------------------------------ double SAL_CALL OCallableStatement::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getDouble" ); MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed); return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getDouble( columnIndex ); @@ -227,6 +244,7 @@ double SAL_CALL OCallableStatement::getDouble( sal_Int32 columnIndex ) throw(SQL //------------------------------------------------------------------------------ Sequence< sal_Int8 > SAL_CALL OCallableStatement::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getBytes" ); MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed); return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getBytes( columnIndex ); @@ -235,6 +253,7 @@ Sequence< sal_Int8 > SAL_CALL OCallableStatement::getBytes( sal_Int32 columnInde //------------------------------------------------------------------------------ ::com::sun::star::util::Date SAL_CALL OCallableStatement::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getDate" ); MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed); return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getDate( columnIndex ); @@ -243,6 +262,7 @@ Sequence< sal_Int8 > SAL_CALL OCallableStatement::getBytes( sal_Int32 columnInde //------------------------------------------------------------------------------ ::com::sun::star::util::Time SAL_CALL OCallableStatement::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getTime" ); MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed); return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getTime( columnIndex ); @@ -251,6 +271,7 @@ Sequence< sal_Int8 > SAL_CALL OCallableStatement::getBytes( sal_Int32 columnInde //------------------------------------------------------------------------------ ::com::sun::star::util::DateTime SAL_CALL OCallableStatement::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getTimestamp" ); MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed); @@ -260,6 +281,7 @@ Sequence< sal_Int8 > SAL_CALL OCallableStatement::getBytes( sal_Int32 columnInde //------------------------------------------------------------------------------ Reference< ::com::sun::star::io::XInputStream > SAL_CALL OCallableStatement::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getBinaryStream" ); MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed); @@ -269,6 +291,7 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL OCallableStatement::get //------------------------------------------------------------------------------ Reference< ::com::sun::star::io::XInputStream > SAL_CALL OCallableStatement::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getCharacterStream" ); MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed); @@ -278,6 +301,7 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL OCallableStatement::get //------------------------------------------------------------------------------ Any SAL_CALL OCallableStatement::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getObject" ); MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed); @@ -287,6 +311,7 @@ Any SAL_CALL OCallableStatement::getObject( sal_Int32 columnIndex, const Referen //------------------------------------------------------------------------------ Reference< XRef > SAL_CALL OCallableStatement::getRef( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getRef" ); MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed); return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getRef( columnIndex ); @@ -295,6 +320,7 @@ Reference< XRef > SAL_CALL OCallableStatement::getRef( sal_Int32 columnIndex ) t //------------------------------------------------------------------------------ Reference< XBlob > SAL_CALL OCallableStatement::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getBlob" ); MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed); return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getBlob( columnIndex ); @@ -303,6 +329,7 @@ Reference< XBlob > SAL_CALL OCallableStatement::getBlob( sal_Int32 columnIndex ) //------------------------------------------------------------------------------ Reference< XClob > SAL_CALL OCallableStatement::getClob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getClob" ); MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed); return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getClob( columnIndex ); @@ -311,6 +338,7 @@ Reference< XClob > SAL_CALL OCallableStatement::getClob( sal_Int32 columnIndex ) //------------------------------------------------------------------------------ Reference< XArray > SAL_CALL OCallableStatement::getArray( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getArray" ); MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed); return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getArray( columnIndex ); diff --git a/dbaccess/source/core/api/querycomposer.cxx b/dbaccess/source/core/api/querycomposer.cxx index 6213c44bfa7d..2e30ceaa7fe8 100644 --- a/dbaccess/source/core/api/querycomposer.cxx +++ b/dbaccess/source/core/api/querycomposer.cxx @@ -101,6 +101,7 @@ #include "composertools.hxx" #endif #include <algorithm> +#include <rtl/logfile.hxx> using namespace dbaccess; using namespace dbtools; @@ -125,6 +126,7 @@ DBG_NAME(OQueryComposer) OQueryComposer::OQueryComposer(const Reference< XConnection>& _xConnection) : OSubComponent(m_aMutex,_xConnection) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OQueryComposer::OQueryComposer" ); DBG_CTOR(OQueryComposer,NULL); OSL_ENSURE(_xConnection.is()," Connection cant be null!"); @@ -140,6 +142,7 @@ OQueryComposer::~OQueryComposer() // ----------------------------------------------------------------------------- void SAL_CALL OQueryComposer::disposing() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OQueryComposer::disposing" ); ::comphelper::disposeComponent(m_xComposerHelper); ::comphelper::disposeComponent(m_xComposer); } @@ -147,11 +150,13 @@ void SAL_CALL OQueryComposer::disposing() // ::com::sun::star::lang::XTypeProvider Sequence< Type > SAL_CALL OQueryComposer::getTypes() throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OQueryComposer::getTypes" ); return ::comphelper::concatSequences(OSubComponent::getTypes(),OQueryComposer_BASE::getTypes()); } // ------------------------------------------------------------------------- Sequence< sal_Int8 > SAL_CALL OQueryComposer::getImplementationId() throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OQueryComposer::getImplementationId" ); static OImplementationId * pId = 0; if (! pId) { @@ -168,6 +173,7 @@ Sequence< sal_Int8 > SAL_CALL OQueryComposer::getImplementationId() throw (Runti // com::sun::star::lang::XUnoTunnel sal_Int64 SAL_CALL OQueryComposer::getSomething( const Sequence< sal_Int8 >& rId ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OQueryComposer::getSomething" ); if (rId.getLength() == 16 && 0 == rtl_compareMemory(getImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) return reinterpret_cast<sal_Int64>(this); @@ -176,6 +182,7 @@ sal_Int64 SAL_CALL OQueryComposer::getSomething( const Sequence< sal_Int8 >& rId // ------------------------------------------------------------------------- Any SAL_CALL OQueryComposer::queryInterface( const Type & rType ) throw(RuntimeException) { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OQueryComposer::queryInterface" ); Any aRet = OSubComponent::queryInterface(rType); if(!aRet.hasValue()) aRet = OQueryComposer_BASE::queryInterface(rType); @@ -186,16 +193,19 @@ Any SAL_CALL OQueryComposer::queryInterface( const Type & rType ) throw(RuntimeE //------------------------------------------------------------------------------ rtl::OUString OQueryComposer::getImplementationName( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OQueryComposer::getImplementationName" ); return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.dbaccess.OQueryComposer")); } //------------------------------------------------------------------------------ sal_Bool OQueryComposer::supportsService( const ::rtl::OUString& _rServiceName ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OQueryComposer::supportsService" ); return ::comphelper::findValue(getSupportedServiceNames(), _rServiceName, sal_True).getLength() != 0; } //------------------------------------------------------------------------------ Sequence< ::rtl::OUString > OQueryComposer::getSupportedServiceNames( ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OQueryComposer::getSupportedServiceNames" ); Sequence< rtl::OUString > aSNS( 1 ); aSNS[0] = SERVICE_SDB_SQLQUERYCOMPOSER; return aSNS; @@ -204,6 +214,7 @@ Sequence< ::rtl::OUString > OQueryComposer::getSupportedServiceNames( ) throw ( // XSQLQueryComposer ::rtl::OUString SAL_CALL OQueryComposer::getQuery( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OQueryComposer::getQuery" ); ::connectivity::checkDisposed(OSubComponent::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); @@ -216,6 +227,7 @@ Sequence< ::rtl::OUString > OQueryComposer::getSupportedServiceNames( ) throw ( // ------------------------------------------------------------------------- void SAL_CALL OQueryComposer::setQuery( const ::rtl::OUString& command ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OQueryComposer::setQuery" ); ::connectivity::checkDisposed(OSubComponent::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); @@ -227,6 +239,7 @@ void SAL_CALL OQueryComposer::setQuery( const ::rtl::OUString& command ) throw(S // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OQueryComposer::getComposedQuery( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OQueryComposer::getComposedQuery" ); ::connectivity::checkDisposed(OSubComponent::rBHelper.bDisposed); MutexGuard aGuard(m_aMutex); @@ -236,6 +249,7 @@ void SAL_CALL OQueryComposer::setQuery( const ::rtl::OUString& command ) throw(S // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OQueryComposer::getFilter( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OQueryComposer::getFilter" ); ::connectivity::checkDisposed(OSubComponent::rBHelper.bDisposed); MutexGuard aGuard(m_aMutex); FilterCreator aFilterCreator; @@ -245,6 +259,7 @@ void SAL_CALL OQueryComposer::setQuery( const ::rtl::OUString& command ) throw(S // ------------------------------------------------------------------------- Sequence< Sequence< PropertyValue > > SAL_CALL OQueryComposer::getStructuredFilter( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OQueryComposer::getStructuredFilter" ); ::connectivity::checkDisposed(OSubComponent::rBHelper.bDisposed); MutexGuard aGuard(m_aMutex); @@ -253,6 +268,7 @@ Sequence< Sequence< PropertyValue > > SAL_CALL OQueryComposer::getStructuredFilt // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OQueryComposer::getOrder( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OQueryComposer::getOrder" ); ::connectivity::checkDisposed(OSubComponent::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); @@ -263,6 +279,7 @@ Sequence< Sequence< PropertyValue > > SAL_CALL OQueryComposer::getStructuredFilt // ----------------------------------------------------------------------------- void SAL_CALL OQueryComposer::appendFilterByColumn( const Reference< XPropertySet >& column ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OQueryComposer::appendFilterByColumn" ); ::connectivity::checkDisposed(OSubComponent::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); @@ -279,6 +296,7 @@ void SAL_CALL OQueryComposer::appendFilterByColumn( const Reference< XPropertySe // ------------------------------------------------------------------------- void SAL_CALL OQueryComposer::appendOrderByColumn( const Reference< XPropertySet >& column, sal_Bool ascending ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OQueryComposer::appendOrderByColumn" ); ::connectivity::checkDisposed(OSubComponent::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); @@ -295,6 +313,7 @@ void SAL_CALL OQueryComposer::appendOrderByColumn( const Reference< XPropertySet // ------------------------------------------------------------------------- void SAL_CALL OQueryComposer::setFilter( const ::rtl::OUString& filter ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OQueryComposer::setFilter" ); ::connectivity::checkDisposed(OSubComponent::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); @@ -311,6 +330,7 @@ void SAL_CALL OQueryComposer::setFilter( const ::rtl::OUString& filter ) throw(S // ------------------------------------------------------------------------- void SAL_CALL OQueryComposer::setOrder( const ::rtl::OUString& order ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OQueryComposer::setOrder" ); ::connectivity::checkDisposed(OSubComponent::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); @@ -329,6 +349,7 @@ void SAL_CALL OQueryComposer::setOrder( const ::rtl::OUString& order ) throw(SQL // XTablesSupplier Reference< XNameAccess > SAL_CALL OQueryComposer::getTables( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OQueryComposer::getTables" ); ::connectivity::checkDisposed(OSubComponent::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); @@ -338,6 +359,7 @@ Reference< XNameAccess > SAL_CALL OQueryComposer::getTables( ) throw(RuntimeExc // XColumnsSupplier Reference< XNameAccess > SAL_CALL OQueryComposer::getColumns( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OQueryComposer::getColumns" ); ::connectivity::checkDisposed(OSubComponent::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); @@ -346,6 +368,7 @@ Reference< XNameAccess > SAL_CALL OQueryComposer::getColumns( ) throw(RuntimeEx // ------------------------------------------------------------------------- Reference< XIndexAccess > SAL_CALL OQueryComposer::getParameters( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OQueryComposer::getParameters" ); ::connectivity::checkDisposed(OSubComponent::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); diff --git a/dbaccess/source/core/api/resultset.cxx b/dbaccess/source/core/api/resultset.cxx index de1c5a18c8fa..d924f5faf738 100644 --- a/dbaccess/source/core/api/resultset.cxx +++ b/dbaccess/source/core/api/resultset.cxx @@ -1,1121 +1,1211 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: resultset.cxx,v $ - * $Revision: 1.21 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_dbaccess.hxx" -#ifndef _DBA_COREAPI_RESULTSET_HXX_ -#include <resultset.hxx> -#endif -#ifndef DBACCESS_SHARED_DBASTRINGS_HRC -#include "dbastrings.hrc" -#endif -#ifndef _DBASHARED_APITOOLS_HXX_ -#include "apitools.hxx" -#endif -#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ -#include <com/sun/star/lang/DisposedException.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_RESULTSETTYPE_HPP_ -#include <com/sun/star/sdbc/ResultSetType.hpp> -#endif -#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ -#include <cppuhelper/typeprovider.hxx> -#endif -#ifndef _COMPHELPER_PROPERTY_HXX_ -#include <comphelper/property.hxx> -#endif -#ifndef _COMPHELPER_SEQUENCE_HXX_ -#include <comphelper/sequence.hxx> -#endif -#ifndef _COMPHELPER_TYPES_HXX_ -#include <comphelper/types.hxx> -#endif -#ifndef _TOOLS_DEBUG_HXX //autogen -#include <tools/debug.hxx> -#endif -#ifndef TOOLS_DIAGNOSE_EX_H -#include <tools/diagnose_ex.h> -#endif -#ifndef _DBA_COREAPI_DATACOLUMN_HXX_ -#include <datacolumn.hxx> -#endif -#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_ -#include <com/sun/star/beans/PropertyAttribute.hpp> -#endif -#ifndef _DBHELPER_DBEXCEPTION_HXX_ -#include <connectivity/dbexception.hxx> -#endif -#ifndef _CONNECTIVITY_DBTOOLS_HXX_ -#include <connectivity/dbtools.hxx> -#endif -#ifndef _CPPUHELPER_EXC_HLP_HXX_ -#include <cppuhelper/exc_hlp.hxx> -#endif -#ifndef _OSL_THREAD_H_ -#include <osl/thread.h> -#endif - - -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::sdbcx; -//using namespace ::com::sun::star::sdb; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::container; -using namespace ::cppu; -using namespace ::osl; -using namespace dbaccess; -using namespace dbtools; - -DBG_NAME(OResultSet) - -//-------------------------------------------------------------------------- -OResultSet::OResultSet(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >& _xResultSet, - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xStatement, - sal_Bool _bCaseSensitive) - :OResultSetBase(m_aMutex) - ,OPropertySetHelper(OResultSetBase::rBHelper) - ,m_xDelegatorResultSet(_xResultSet) - ,m_aWarnings( Reference< XWarningsSupplier >( _xResultSet, UNO_QUERY ) ) - ,m_bIsBookmarkable(sal_False) -{ - DBG_CTOR(OResultSet, NULL); - - m_pColumns = new OColumns(*this, m_aMutex, _bCaseSensitive, ::std::vector< ::rtl::OUString>(), NULL,NULL); - - try - { - m_aStatement = _xStatement; - m_xDelegatorResultSetUpdate = m_xDelegatorResultSetUpdate.query( m_xDelegatorResultSet ); - m_xDelegatorRow = m_xDelegatorRow.query( m_xDelegatorResultSet ); - m_xDelegatorRowUpdate = m_xDelegatorRowUpdate.query( m_xDelegatorResultSet ); - - Reference< XPropertySet > xSet(m_xDelegatorResultSet, UNO_QUERY); - xSet->getPropertyValue(PROPERTY_RESULTSETTYPE) >>= m_nResultSetType; - xSet->getPropertyValue(PROPERTY_RESULTSETCONCURRENCY) >>= m_nResultSetConcurrency; - - // test for Bookmarks - if (ResultSetType::FORWARD_ONLY != m_nResultSetType) - { - Reference <XPropertySetInfo > xInfo(xSet->getPropertySetInfo()); - if (xInfo->hasPropertyByName(PROPERTY_ISBOOKMARKABLE)) - { - m_bIsBookmarkable = ::comphelper::getBOOL(xSet->getPropertyValue(PROPERTY_ISBOOKMARKABLE)); - OSL_ENSURE( !m_bIsBookmarkable || Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY).is(), - "OResultSet::OResultSet: aggregate is inconsistent in it's bookmarkable attribute!" ); - m_bIsBookmarkable = m_bIsBookmarkable && Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY).is(); - } - } - } - catch(Exception&) - { - } -} - -//-------------------------------------------------------------------------- -OResultSet::~OResultSet() -{ - m_pColumns->acquire(); - m_pColumns->disposing(); - delete m_pColumns; - - DBG_DTOR(OResultSet, NULL); -} - -// com::sun::star::lang::XTypeProvider -//-------------------------------------------------------------------------- -Sequence< Type > OResultSet::getTypes() throw (RuntimeException) -{ - OTypeCollection aTypes(::getCppuType( (const Reference< XPropertySet > *)0 ), - OResultSetBase::getTypes()); - - return aTypes.getTypes(); -} - -//-------------------------------------------------------------------------- -Sequence< sal_Int8 > OResultSet::getImplementationId() throw (RuntimeException) -{ - static OImplementationId * pId = 0; - if (! pId) - { - MutexGuard aGuard( Mutex::getGlobalMutex() ); - if (! pId) - { - static OImplementationId aId; - pId = &aId; - } - } - return pId->getImplementationId(); -} - -// com::sun::star::uno::XInterface -//-------------------------------------------------------------------------- -Any OResultSet::queryInterface( const Type & rType ) throw (RuntimeException) -{ - Any aIface = OResultSetBase::queryInterface( rType ); - if (!aIface.hasValue()) - aIface = ::cppu::queryInterface( - rType, - static_cast< XPropertySet * >( this )); - - return aIface; -} - -//-------------------------------------------------------------------------- -void OResultSet::acquire() throw () -{ - OResultSetBase::acquire(); -} - -//-------------------------------------------------------------------------- -void OResultSet::release() throw () -{ - OResultSetBase::release(); -} - - -// OResultSetBase -//------------------------------------------------------------------------------ -void OResultSet::disposing() -{ - OPropertySetHelper::disposing(); - - MutexGuard aGuard(m_aMutex); - - // free the columns - m_pColumns->disposing(); - - // close the pending result set - Reference< XCloseable > (m_xDelegatorResultSet, UNO_QUERY)->close(); - - m_xDelegatorResultSet = NULL; - m_xDelegatorRow = NULL; - m_xDelegatorRowUpdate = NULL; - - m_aStatement = Reference< XInterface >(); -} - -// XCloseable -//------------------------------------------------------------------------------ -void OResultSet::close(void) throw( SQLException, RuntimeException ) -{ - { - MutexGuard aGuard( m_aMutex ); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - } - dispose(); -} - -// XServiceInfo -//------------------------------------------------------------------------------ -rtl::OUString OResultSet::getImplementationName( ) throw(RuntimeException) -{ - return rtl::OUString::createFromAscii("com.sun.star.sdb.OResultSet"); -} - -//------------------------------------------------------------------------------ -sal_Bool OResultSet::supportsService( const ::rtl::OUString& _rServiceName ) throw (RuntimeException) -{ - return ::comphelper::findValue(getSupportedServiceNames(), _rServiceName, sal_True).getLength() != 0; -} - -//------------------------------------------------------------------------------ -Sequence< ::rtl::OUString > OResultSet::getSupportedServiceNames( ) throw (RuntimeException) -{ - Sequence< ::rtl::OUString > aSNS( 2 ); - aSNS[0] = SERVICE_SDBC_RESULTSET; - aSNS[1] = SERVICE_SDB_RESULTSET; - return aSNS; -} - -// com::sun::star::beans::XPropertySet -//------------------------------------------------------------------------------ -Reference< XPropertySetInfo > OResultSet::getPropertySetInfo() throw (RuntimeException) -{ - return createPropertySetInfo( getInfoHelper() ) ; -} - -// comphelper::OPropertyArrayUsageHelper -//------------------------------------------------------------------------------ -::cppu::IPropertyArrayHelper* OResultSet::createArrayHelper( ) const -{ - BEGIN_PROPERTY_HELPER(6) - DECL_PROP1(CURSORNAME, ::rtl::OUString, READONLY); - DECL_PROP0(FETCHDIRECTION, sal_Int32); - DECL_PROP0(FETCHSIZE, sal_Int32); - DECL_PROP1_BOOL(ISBOOKMARKABLE, READONLY); - DECL_PROP1(RESULTSETCONCURRENCY, sal_Int32, READONLY); - DECL_PROP1(RESULTSETTYPE, sal_Int32, READONLY); - END_PROPERTY_HELPER(); -} - -// cppu::OPropertySetHelper -//------------------------------------------------------------------------------ -::cppu::IPropertyArrayHelper& OResultSet::getInfoHelper() -{ - return *getArrayHelper(); -} - -//------------------------------------------------------------------------------ -sal_Bool OResultSet::convertFastPropertyValue(Any & rConvertedValue, Any & rOldValue, sal_Int32 nHandle, const Any& rValue ) throw( IllegalArgumentException ) -{ - // be lazy ... - rConvertedValue = rValue; - getFastPropertyValue( rOldValue, nHandle ); - return sal_True; -} - -//------------------------------------------------------------------------------ -void OResultSet::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) throw (Exception) -{ - // set it for the driver result set - Reference< XPropertySet > xSet(m_xDelegatorResultSet, UNO_QUERY); - switch (nHandle) - { - case PROPERTY_ID_FETCHDIRECTION: - xSet->setPropertyValue(PROPERTY_FETCHDIRECTION, rValue); - break; - case PROPERTY_ID_FETCHSIZE: - xSet->setPropertyValue(PROPERTY_FETCHSIZE, rValue); - break; - default: - DBG_ERROR("unknown Property"); - } -} - -//------------------------------------------------------------------------------ -void OResultSet::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const -{ - switch (nHandle) - { - case PROPERTY_ID_ISBOOKMARKABLE: - { - sal_Bool bVal = m_bIsBookmarkable; - rValue.setValue(&bVal, getBooleanCppuType()); - } break; - default: - { - // get the property name - ::rtl::OUString aPropName; - sal_Int16 nAttributes; - const_cast<OResultSet*>(this)->getInfoHelper(). - fillPropertyMembersByHandle(&aPropName, &nAttributes, nHandle); - OSL_ENSURE(aPropName.getLength(), "property not found?"); - - // now read the value - rValue = Reference< XPropertySet >(m_xDelegatorResultSet, UNO_QUERY)->getPropertyValue(aPropName); - } - } -} - -// XWarningsSupplier -//------------------------------------------------------------------------------ -Any OResultSet::getWarnings(void) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - return m_aWarnings.getWarnings(); -} - -//------------------------------------------------------------------------------ -void OResultSet::clearWarnings(void) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - m_aWarnings.clearWarnings(); -} - -// ::com::sun::star::sdbc::XResultSetMetaDataSupplier -//------------------------------------------------------------------------------ -Reference< XResultSetMetaData > OResultSet::getMetaData(void) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - return Reference< XResultSetMetaDataSupplier >(m_xDelegatorResultSet, UNO_QUERY)->getMetaData(); -} - -// ::com::sun::star::sdbc::XColumnLocate -//------------------------------------------------------------------------------ -sal_Int32 OResultSet::findColumn(const rtl::OUString& columnName) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - return Reference< XColumnLocate >(m_xDelegatorResultSet, UNO_QUERY)->findColumn(columnName); -} - -//------------------------------------------------------------------------------ -namespace -{ - static Reference< XDatabaseMetaData > lcl_getDBMetaDataFromStatement_nothrow( const Reference< XInterface >& _rxStatement ) - { - Reference< XDatabaseMetaData > xDBMetaData; - try - { - Reference< XStatement > xStatement( _rxStatement, UNO_QUERY ); - Reference< XPreparedStatement > xPreparedStatement( _rxStatement, UNO_QUERY ); - Reference< XConnection > xConn; - if ( xStatement.is() ) - xConn = xStatement->getConnection(); - else if ( xPreparedStatement.is() ) - xConn = xPreparedStatement->getConnection(); - if ( xConn.is() ) - xDBMetaData = xConn->getMetaData(); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return xDBMetaData; - } -} -// ::com::sun::star::sdbcx::XColumnsSupplier -//------------------------------------------------------------------------------ -Reference< ::com::sun::star::container::XNameAccess > OResultSet::getColumns(void) throw( RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - // do we have to populate the columns - if (!m_pColumns->isInitialized()) - { - // get the metadata - Reference< XResultSetMetaData > xMetaData = Reference< XResultSetMetaDataSupplier >(m_xDelegatorResultSet, UNO_QUERY)->getMetaData(); - - sal_Int32 nColCount = 0; - // do we have columns - try - { - Reference< XDatabaseMetaData > xDBMetaData( lcl_getDBMetaDataFromStatement_nothrow( getStatement() ) ); - nColCount = xMetaData->getColumnCount(); - - for ( sal_Int32 i = 0; i < nColCount; ++i) - { - // retrieve the name of the column - rtl::OUString sName = xMetaData->getColumnName(i + 1); - ODataColumn* pColumn = new ODataColumn(xMetaData, m_xDelegatorRow, m_xDelegatorRowUpdate, i + 1, xDBMetaData); - - // don't silently assume that the name is unique - result set implementations - // are allowed to return duplicate names, but we are required to have - // unique column names - if ( m_pColumns->hasByName( sName ) ) - sName = ::dbtools::createUniqueName( m_pColumns, sName ); - - m_pColumns->append( sName, pColumn ); - } - } - catch ( const SQLException& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - m_pColumns->setInitialized(); - - #if OSL_DEBUG_LEVEL > 0 - // some sanity checks. Especially in case we auto-adjusted the column names above, - // this might be reasonable - try - { - const Reference< XNameAccess > xColNames( static_cast< XNameAccess* >( m_pColumns ), UNO_SET_THROW ); - const Sequence< ::rtl::OUString > aNames( xColNames->getElementNames() ); - OSL_POSTCOND( aNames.getLength() == nColCount, - "OResultSet::getColumns: invalid column count!" ); - for ( const ::rtl::OUString* pName = aNames.getConstArray(); - pName != aNames.getConstArray() + aNames.getLength(); - ++pName - ) - { - Reference< XPropertySet > xColProps( xColNames->getByName( *pName ), UNO_QUERY_THROW ); - ::rtl::OUString sName; - OSL_VERIFY( xColProps->getPropertyValue( PROPERTY_NAME ) >>= sName ); - OSL_POSTCOND( sName == *pName, "OResultSet::getColumns: invalid column name!" ); - } - - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - #endif - } - return m_pColumns; -} - -// ::com::sun::star::sdbc::XRow -//------------------------------------------------------------------------------ -sal_Bool OResultSet::wasNull(void) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - return m_xDelegatorRow->wasNull(); -} -//------------------------------------------------------------------------------ -rtl::OUString OResultSet::getString(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - return m_xDelegatorRow->getString(columnIndex); -} -//------------------------------------------------------------------------------ -sal_Bool OResultSet::getBoolean(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - return m_xDelegatorRow->getBoolean(columnIndex); -} -//------------------------------------------------------------------------------ -sal_Int8 OResultSet::getByte(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - return m_xDelegatorRow->getByte(columnIndex); -} -//------------------------------------------------------------------------------ -sal_Int16 OResultSet::getShort(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - return m_xDelegatorRow->getShort(columnIndex); -} -//------------------------------------------------------------------------------ -sal_Int32 OResultSet::getInt(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - return m_xDelegatorRow->getInt(columnIndex); -} -//------------------------------------------------------------------------------ -sal_Int64 OResultSet::getLong(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - return m_xDelegatorRow->getLong(columnIndex); -} -//------------------------------------------------------------------------------ -float OResultSet::getFloat(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - return m_xDelegatorRow->getFloat(columnIndex); -} -//------------------------------------------------------------------------------ -double OResultSet::getDouble(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - return m_xDelegatorRow->getDouble(columnIndex); -} -//------------------------------------------------------------------------------ -Sequence< sal_Int8 > OResultSet::getBytes(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - return m_xDelegatorRow->getBytes(columnIndex); -} -//------------------------------------------------------------------------------ -::com::sun::star::util::Date OResultSet::getDate(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - return m_xDelegatorRow->getDate(columnIndex); -} -//------------------------------------------------------------------------------ -::com::sun::star::util::Time OResultSet::getTime(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - return m_xDelegatorRow->getTime(columnIndex); -} -//------------------------------------------------------------------------------ -::com::sun::star::util::DateTime OResultSet::getTimestamp(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - return m_xDelegatorRow->getTimestamp(columnIndex); -} -//------------------------------------------------------------------------------ -Reference< ::com::sun::star::io::XInputStream > OResultSet::getBinaryStream(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - return m_xDelegatorRow->getBinaryStream(columnIndex); -} -//------------------------------------------------------------------------------ -Reference< ::com::sun::star::io::XInputStream > OResultSet::getCharacterStream(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - return m_xDelegatorRow->getCharacterStream(columnIndex); -} -//------------------------------------------------------------------------------ -Any OResultSet::getObject(sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess > & typeMap) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - return m_xDelegatorRow->getObject(columnIndex, typeMap); -} -//------------------------------------------------------------------------------ -Reference< XRef > OResultSet::getRef(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - return m_xDelegatorRow->getRef(columnIndex); -} -//------------------------------------------------------------------------------ -Reference< XBlob > OResultSet::getBlob(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - return m_xDelegatorRow->getBlob(columnIndex); -} -//------------------------------------------------------------------------------ -Reference< XClob > OResultSet::getClob(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - return m_xDelegatorRow->getClob(columnIndex); -} -//------------------------------------------------------------------------------ -Reference< XArray > OResultSet::getArray(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - return m_xDelegatorRow->getArray(columnIndex); -} - -// ::com::sun::star::sdbc::XRowUpdate -//------------------------------------------------------------------------------ -void OResultSet::updateNull(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - checkReadOnly(); - - m_xDelegatorRowUpdate->updateNull(columnIndex); -} - -//------------------------------------------------------------------------------ -void OResultSet::updateBoolean(sal_Int32 columnIndex, sal_Bool x) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - checkReadOnly(); - - m_xDelegatorRowUpdate->updateBoolean(columnIndex, x); -} -//------------------------------------------------------------------------------ -void OResultSet::updateByte(sal_Int32 columnIndex, sal_Int8 x) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - checkReadOnly(); - - m_xDelegatorRowUpdate->updateByte(columnIndex, x); -} -//------------------------------------------------------------------------------ -void OResultSet::updateShort(sal_Int32 columnIndex, sal_Int16 x) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - checkReadOnly(); - - m_xDelegatorRowUpdate->updateShort(columnIndex, x); -} -//------------------------------------------------------------------------------ -void OResultSet::updateInt(sal_Int32 columnIndex, sal_Int32 x) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - checkReadOnly(); - - m_xDelegatorRowUpdate->updateInt(columnIndex, x); -} -//------------------------------------------------------------------------------ -void OResultSet::updateLong(sal_Int32 columnIndex, sal_Int64 x) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - checkReadOnly(); - - m_xDelegatorRowUpdate->updateLong(columnIndex, x); -} -//------------------------------------------------------------------------------ -void OResultSet::updateFloat(sal_Int32 columnIndex, float x) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - checkReadOnly(); - - m_xDelegatorRowUpdate->updateFloat(columnIndex, x); -} -//------------------------------------------------------------------------------ -void OResultSet::updateDouble(sal_Int32 columnIndex, double x) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - checkReadOnly(); - - m_xDelegatorRowUpdate->updateDouble(columnIndex, x); -} -//------------------------------------------------------------------------------ -void OResultSet::updateString(sal_Int32 columnIndex, const rtl::OUString& x) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - checkReadOnly(); - - m_xDelegatorRowUpdate->updateString(columnIndex, x); -} -//------------------------------------------------------------------------------ -void OResultSet::updateBytes(sal_Int32 columnIndex, const Sequence< sal_Int8 >& x) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - checkReadOnly(); - - m_xDelegatorRowUpdate->updateBytes(columnIndex, x); -} -//------------------------------------------------------------------------------ -void OResultSet::updateDate(sal_Int32 columnIndex, const ::com::sun::star::util::Date& x) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - checkReadOnly(); - - m_xDelegatorRowUpdate->updateDate(columnIndex, x); -} -//------------------------------------------------------------------------------ -void OResultSet::updateTime(sal_Int32 columnIndex, const ::com::sun::star::util::Time& x) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - checkReadOnly(); - - m_xDelegatorRowUpdate->updateTime(columnIndex, x); -} -//------------------------------------------------------------------------------ -void OResultSet::updateTimestamp(sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - checkReadOnly(); - - m_xDelegatorRowUpdate->updateTimestamp(columnIndex, x); -} -//------------------------------------------------------------------------------ -void OResultSet::updateBinaryStream(sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream > & x, sal_Int32 length) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - checkReadOnly(); - - m_xDelegatorRowUpdate->updateBinaryStream(columnIndex, x, length); -} -//------------------------------------------------------------------------------ -void OResultSet::updateCharacterStream(sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream > & x, sal_Int32 length) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - checkReadOnly(); - - m_xDelegatorRowUpdate->updateCharacterStream(columnIndex, x, length); -} -//------------------------------------------------------------------------------ -void OResultSet::updateNumericObject(sal_Int32 columnIndex, const Any& x, sal_Int32 scale) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - checkReadOnly(); - - m_xDelegatorRowUpdate->updateNumericObject(columnIndex, x, scale); -} - -//------------------------------------------------------------------------------ -void OResultSet::updateObject(sal_Int32 columnIndex, const Any& x) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - checkReadOnly(); - - m_xDelegatorRowUpdate->updateObject(columnIndex, x); -} - -// ::com::sun::star::sdbc::XResultSet -//------------------------------------------------------------------------------ -sal_Bool OResultSet::next(void) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - return m_xDelegatorResultSet->next(); -} - -//------------------------------------------------------------------------------ -sal_Bool OResultSet::isBeforeFirst(void) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - return m_xDelegatorResultSet->isBeforeFirst(); -} - -//------------------------------------------------------------------------------ -sal_Bool OResultSet::isAfterLast(void) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - return m_xDelegatorResultSet->isAfterLast(); -} - -//------------------------------------------------------------------------------ -sal_Bool OResultSet::isFirst(void) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - return m_xDelegatorResultSet->isFirst(); -} - -//------------------------------------------------------------------------------ -sal_Bool OResultSet::isLast(void) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - return m_xDelegatorResultSet->isLast(); -} - -//------------------------------------------------------------------------------ -void OResultSet::beforeFirst(void) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - m_xDelegatorResultSet->beforeFirst(); -} - -//------------------------------------------------------------------------------ -void OResultSet::afterLast(void) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - m_xDelegatorResultSet->afterLast(); -} - -//------------------------------------------------------------------------------ -sal_Bool OResultSet::first(void) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - return m_xDelegatorResultSet->first(); -} - -//------------------------------------------------------------------------------ -sal_Bool OResultSet::last(void) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - return m_xDelegatorResultSet->last(); -} - -//------------------------------------------------------------------------------ -sal_Int32 OResultSet::getRow(void) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - return m_xDelegatorResultSet->getRow(); -} - -//------------------------------------------------------------------------------ -sal_Bool OResultSet::absolute(sal_Int32 row) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - return m_xDelegatorResultSet->absolute(row); -} - -//------------------------------------------------------------------------------ -sal_Bool OResultSet::relative(sal_Int32 rows) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - return m_xDelegatorResultSet->relative(rows); -} - -//------------------------------------------------------------------------------ -sal_Bool OResultSet::previous(void) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - return m_xDelegatorResultSet->previous(); -} - -//------------------------------------------------------------------------------ -void OResultSet::refreshRow(void) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - m_xDelegatorResultSet->refreshRow(); -} - -//------------------------------------------------------------------------------ -sal_Bool OResultSet::rowUpdated(void) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - return m_xDelegatorResultSet->rowUpdated(); -} - -//------------------------------------------------------------------------------ -sal_Bool OResultSet::rowInserted(void) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - return m_xDelegatorResultSet->rowInserted(); -} - -//------------------------------------------------------------------------------ -sal_Bool OResultSet::rowDeleted(void) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - return m_xDelegatorResultSet->rowDeleted(); -} - -//------------------------------------------------------------------------------ -Reference< XInterface > OResultSet::getStatement(void) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - return m_aStatement; -} - -// ::com::sun::star::sdbcx::XRowLocate -//------------------------------------------------------------------------------ -Any OResultSet::getBookmark(void) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - checkBookmarkable(); - - return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->getBookmark(); -} - -//------------------------------------------------------------------------------ -sal_Bool OResultSet::moveToBookmark(const Any& bookmark) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - checkBookmarkable(); - - return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->moveToBookmark(bookmark); -} - -//------------------------------------------------------------------------------ -sal_Bool OResultSet::moveRelativeToBookmark(const Any& bookmark, sal_Int32 rows) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - checkBookmarkable(); - - return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->moveRelativeToBookmark(bookmark, rows); -} - -//------------------------------------------------------------------------------ -sal_Int32 OResultSet::compareBookmarks(const Any& _first, const Any& _second) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - checkBookmarkable(); - - return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->compareBookmarks(_first, _second); -} - -//------------------------------------------------------------------------------ -sal_Bool OResultSet::hasOrderedBookmarks(void) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - checkBookmarkable(); - - return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->hasOrderedBookmarks(); -} - -//------------------------------------------------------------------------------ -sal_Int32 OResultSet::hashBookmark(const Any& bookmark) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - checkBookmarkable(); - - return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->hashBookmark(bookmark); -} - -// ::com::sun::star::sdbc::XResultSetUpdate -//------------------------------------------------------------------------------ -void OResultSet::insertRow(void) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - checkReadOnly(); - - m_xDelegatorResultSetUpdate->insertRow(); -} - -//------------------------------------------------------------------------------ -void OResultSet::updateRow(void) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - checkReadOnly(); - - m_xDelegatorResultSetUpdate->updateRow(); -} - -//------------------------------------------------------------------------------ -void OResultSet::deleteRow(void) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - checkReadOnly(); - - m_xDelegatorResultSetUpdate->deleteRow(); -} - -//------------------------------------------------------------------------------ -void OResultSet::cancelRowUpdates(void) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - checkReadOnly(); - - m_xDelegatorResultSetUpdate->cancelRowUpdates(); -} - -//------------------------------------------------------------------------------ -void OResultSet::moveToInsertRow(void) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - checkReadOnly(); - - m_xDelegatorResultSetUpdate->moveToInsertRow(); -} - -//------------------------------------------------------------------------------ -void OResultSet::moveToCurrentRow(void) throw( SQLException, RuntimeException ) -{ - MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - - checkReadOnly(); - - m_xDelegatorResultSetUpdate->moveToCurrentRow(); -} - -// ----------------------------------------------------------------------------- -void OResultSet::checkReadOnly() const -{ - if ( ( m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY ) - || !m_xDelegatorResultSetUpdate.is() - ) - throwSQLException( "The result set is read-only.", SQL_GENERAL_ERROR, *const_cast< OResultSet* >( this ) ); -} - -// ----------------------------------------------------------------------------- -void OResultSet::checkBookmarkable() const -{ - if ( !m_bIsBookmarkable ) - throwSQLException( "The result set does not have bookmark support.", SQL_GENERAL_ERROR, *const_cast< OResultSet* >( this ) ); -} -// ----------------------------------------------------------------------------- - +/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: resultset.cxx,v $
+ * $Revision: 1.21 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_dbaccess.hxx"
+#ifndef _DBA_COREAPI_RESULTSET_HXX_
+#include <resultset.hxx>
+#endif
+#ifndef DBACCESS_SHARED_DBASTRINGS_HRC
+#include "dbastrings.hrc"
+#endif
+#ifndef _DBASHARED_APITOOLS_HXX_
+#include "apitools.hxx"
+#endif
+#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_
+#include <com/sun/star/lang/DisposedException.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_RESULTSETTYPE_HPP_
+#include <com/sun/star/sdbc/ResultSetType.hpp>
+#endif
+#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
+#include <cppuhelper/typeprovider.hxx>
+#endif
+#ifndef _COMPHELPER_PROPERTY_HXX_
+#include <comphelper/property.hxx>
+#endif
+#ifndef _COMPHELPER_SEQUENCE_HXX_
+#include <comphelper/sequence.hxx>
+#endif
+#ifndef _COMPHELPER_TYPES_HXX_
+#include <comphelper/types.hxx>
+#endif
+#ifndef _TOOLS_DEBUG_HXX //autogen
+#include <tools/debug.hxx>
+#endif
+#ifndef TOOLS_DIAGNOSE_EX_H
+#include <tools/diagnose_ex.h>
+#endif
+#ifndef _DBA_COREAPI_DATACOLUMN_HXX_
+#include <datacolumn.hxx>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#endif
+#ifndef _DBHELPER_DBEXCEPTION_HXX_
+#include <connectivity/dbexception.hxx>
+#endif
+#ifndef _CONNECTIVITY_DBTOOLS_HXX_
+#include <connectivity/dbtools.hxx>
+#endif
+#ifndef _CPPUHELPER_EXC_HLP_HXX_
+#include <cppuhelper/exc_hlp.hxx>
+#endif
+#ifndef _OSL_THREAD_H_
+#include <osl/thread.h>
+#endif
+#include <rtl/logfile.hxx>
+
+
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::sdbcx;
+//using namespace ::com::sun::star::sdb;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+using namespace ::cppu;
+using namespace ::osl;
+using namespace dbaccess;
+using namespace dbtools;
+
+DBG_NAME(OResultSet)
+
+//--------------------------------------------------------------------------
+OResultSet::OResultSet(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >& _xResultSet,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xStatement,
+ sal_Bool _bCaseSensitive)
+ :OResultSetBase(m_aMutex)
+ ,OPropertySetHelper(OResultSetBase::rBHelper)
+ ,m_xDelegatorResultSet(_xResultSet)
+ ,m_aWarnings( Reference< XWarningsSupplier >( _xResultSet, UNO_QUERY ) )
+ ,m_bIsBookmarkable(sal_False)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::OResultSet" );
+ DBG_CTOR(OResultSet, NULL);
+
+ m_pColumns = new OColumns(*this, m_aMutex, _bCaseSensitive, ::std::vector< ::rtl::OUString>(), NULL,NULL);
+
+ try
+ {
+ m_aStatement = _xStatement;
+ m_xDelegatorResultSetUpdate = m_xDelegatorResultSetUpdate.query( m_xDelegatorResultSet );
+ m_xDelegatorRow = m_xDelegatorRow.query( m_xDelegatorResultSet );
+ m_xDelegatorRowUpdate = m_xDelegatorRowUpdate.query( m_xDelegatorResultSet );
+
+ Reference< XPropertySet > xSet(m_xDelegatorResultSet, UNO_QUERY);
+ xSet->getPropertyValue(PROPERTY_RESULTSETTYPE) >>= m_nResultSetType;
+ xSet->getPropertyValue(PROPERTY_RESULTSETCONCURRENCY) >>= m_nResultSetConcurrency;
+
+ // test for Bookmarks
+ if (ResultSetType::FORWARD_ONLY != m_nResultSetType)
+ {
+ Reference <XPropertySetInfo > xInfo(xSet->getPropertySetInfo());
+ if (xInfo->hasPropertyByName(PROPERTY_ISBOOKMARKABLE))
+ {
+ m_bIsBookmarkable = ::comphelper::getBOOL(xSet->getPropertyValue(PROPERTY_ISBOOKMARKABLE));
+ OSL_ENSURE( !m_bIsBookmarkable || Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY).is(),
+ "OResultSet::OResultSet: aggregate is inconsistent in it's bookmarkable attribute!" );
+ m_bIsBookmarkable = m_bIsBookmarkable && Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY).is();
+ }
+ }
+ }
+ catch(Exception&)
+ {
+ }
+}
+
+//--------------------------------------------------------------------------
+OResultSet::~OResultSet()
+{
+ m_pColumns->acquire();
+ m_pColumns->disposing();
+ delete m_pColumns;
+
+ DBG_DTOR(OResultSet, NULL);
+}
+
+// com::sun::star::lang::XTypeProvider
+//--------------------------------------------------------------------------
+Sequence< Type > OResultSet::getTypes() throw (RuntimeException)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getTypes" );
+ OTypeCollection aTypes(::getCppuType( (const Reference< XPropertySet > *)0 ),
+ OResultSetBase::getTypes());
+
+ return aTypes.getTypes();
+}
+
+//--------------------------------------------------------------------------
+Sequence< sal_Int8 > OResultSet::getImplementationId() throw (RuntimeException)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getImplementationId" );
+ static OImplementationId * pId = 0;
+ if (! pId)
+ {
+ MutexGuard aGuard( Mutex::getGlobalMutex() );
+ if (! pId)
+ {
+ static OImplementationId aId;
+ pId = &aId;
+ }
+ }
+ return pId->getImplementationId();
+}
+
+// com::sun::star::uno::XInterface
+//--------------------------------------------------------------------------
+Any OResultSet::queryInterface( const Type & rType ) throw (RuntimeException)
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::queryInterface" );
+ Any aIface = OResultSetBase::queryInterface( rType );
+ if (!aIface.hasValue())
+ aIface = ::cppu::queryInterface(
+ rType,
+ static_cast< XPropertySet * >( this ));
+
+ return aIface;
+}
+
+//--------------------------------------------------------------------------
+void OResultSet::acquire() throw ()
+{
+ OResultSetBase::acquire();
+}
+
+//--------------------------------------------------------------------------
+void OResultSet::release() throw ()
+{
+ OResultSetBase::release();
+}
+
+
+// OResultSetBase
+//------------------------------------------------------------------------------
+void OResultSet::disposing()
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::disposing" );
+ OPropertySetHelper::disposing();
+
+ MutexGuard aGuard(m_aMutex);
+
+ // free the columns
+ m_pColumns->disposing();
+
+ // close the pending result set
+ Reference< XCloseable > (m_xDelegatorResultSet, UNO_QUERY)->close();
+
+ m_xDelegatorResultSet = NULL;
+ m_xDelegatorRow = NULL;
+ m_xDelegatorRowUpdate = NULL;
+
+ m_aStatement = Reference< XInterface >();
+}
+
+// XCloseable
+//------------------------------------------------------------------------------
+void OResultSet::close(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::close" );
+ {
+ MutexGuard aGuard( m_aMutex );
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+ }
+ dispose();
+}
+
+// XServiceInfo
+//------------------------------------------------------------------------------
+rtl::OUString OResultSet::getImplementationName( ) throw(RuntimeException)
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getImplementationName" );
+ return rtl::OUString::createFromAscii("com.sun.star.sdb.OResultSet");
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::supportsService( const ::rtl::OUString& _rServiceName ) throw (RuntimeException)
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::supportsService" );
+ return ::comphelper::findValue(getSupportedServiceNames(), _rServiceName, sal_True).getLength() != 0;
+}
+
+//------------------------------------------------------------------------------
+Sequence< ::rtl::OUString > OResultSet::getSupportedServiceNames( ) throw (RuntimeException)
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getSupportedServiceNames" );
+ Sequence< ::rtl::OUString > aSNS( 2 );
+ aSNS[0] = SERVICE_SDBC_RESULTSET;
+ aSNS[1] = SERVICE_SDB_RESULTSET;
+ return aSNS;
+}
+
+// com::sun::star::beans::XPropertySet
+//------------------------------------------------------------------------------
+Reference< XPropertySetInfo > OResultSet::getPropertySetInfo() throw (RuntimeException)
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getPropertySetInfo" );
+ return createPropertySetInfo( getInfoHelper() ) ;
+}
+
+// comphelper::OPropertyArrayUsageHelper
+//------------------------------------------------------------------------------
+::cppu::IPropertyArrayHelper* OResultSet::createArrayHelper( ) const
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::createArrayHelper" );
+ BEGIN_PROPERTY_HELPER(6)
+ DECL_PROP1(CURSORNAME, ::rtl::OUString, READONLY);
+ DECL_PROP0(FETCHDIRECTION, sal_Int32);
+ DECL_PROP0(FETCHSIZE, sal_Int32);
+ DECL_PROP1_BOOL(ISBOOKMARKABLE, READONLY);
+ DECL_PROP1(RESULTSETCONCURRENCY, sal_Int32, READONLY);
+ DECL_PROP1(RESULTSETTYPE, sal_Int32, READONLY);
+ END_PROPERTY_HELPER();
+}
+
+// cppu::OPropertySetHelper
+//------------------------------------------------------------------------------
+::cppu::IPropertyArrayHelper& OResultSet::getInfoHelper()
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getInfoHelper" );
+ return *getArrayHelper();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::convertFastPropertyValue(Any & rConvertedValue, Any & rOldValue, sal_Int32 nHandle, const Any& rValue ) throw( IllegalArgumentException )
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::convertFastPropertyValue" );
+ // be lazy ...
+ rConvertedValue = rValue;
+ getFastPropertyValue( rOldValue, nHandle );
+ return sal_True;
+}
+
+//------------------------------------------------------------------------------
+void OResultSet::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) throw (Exception)
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::setFastPropertyValue_NoBroadcast" );
+ // set it for the driver result set
+ Reference< XPropertySet > xSet(m_xDelegatorResultSet, UNO_QUERY);
+ switch (nHandle)
+ {
+ case PROPERTY_ID_FETCHDIRECTION:
+ xSet->setPropertyValue(PROPERTY_FETCHDIRECTION, rValue);
+ break;
+ case PROPERTY_ID_FETCHSIZE:
+ xSet->setPropertyValue(PROPERTY_FETCHSIZE, rValue);
+ break;
+ default:
+ DBG_ERROR("unknown Property");
+ }
+}
+
+//------------------------------------------------------------------------------
+void OResultSet::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getFastPropertyValue" );
+ switch (nHandle)
+ {
+ case PROPERTY_ID_ISBOOKMARKABLE:
+ {
+ sal_Bool bVal = m_bIsBookmarkable;
+ rValue.setValue(&bVal, getBooleanCppuType());
+ } break;
+ default:
+ {
+ // get the property name
+ ::rtl::OUString aPropName;
+ sal_Int16 nAttributes;
+ const_cast<OResultSet*>(this)->getInfoHelper().
+ fillPropertyMembersByHandle(&aPropName, &nAttributes, nHandle);
+ OSL_ENSURE(aPropName.getLength(), "property not found?");
+
+ // now read the value
+ rValue = Reference< XPropertySet >(m_xDelegatorResultSet, UNO_QUERY)->getPropertyValue(aPropName);
+ }
+ }
+}
+
+// XWarningsSupplier
+//------------------------------------------------------------------------------
+Any OResultSet::getWarnings(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getWarnings" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+ return m_aWarnings.getWarnings();
+}
+
+//------------------------------------------------------------------------------
+void OResultSet::clearWarnings(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::clearWarnings" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+ m_aWarnings.clearWarnings();
+}
+
+// ::com::sun::star::sdbc::XResultSetMetaDataSupplier
+//------------------------------------------------------------------------------
+Reference< XResultSetMetaData > OResultSet::getMetaData(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getMetaData" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return Reference< XResultSetMetaDataSupplier >(m_xDelegatorResultSet, UNO_QUERY)->getMetaData();
+}
+
+// ::com::sun::star::sdbc::XColumnLocate
+//------------------------------------------------------------------------------
+sal_Int32 OResultSet::findColumn(const rtl::OUString& columnName) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::findColumn" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return Reference< XColumnLocate >(m_xDelegatorResultSet, UNO_QUERY)->findColumn(columnName);
+}
+
+//------------------------------------------------------------------------------
+namespace
+{
+ static Reference< XDatabaseMetaData > lcl_getDBMetaDataFromStatement_nothrow( const Reference< XInterface >& _rxStatement )
+ {
+ Reference< XDatabaseMetaData > xDBMetaData;
+ try
+ {
+ Reference< XStatement > xStatement( _rxStatement, UNO_QUERY );
+ Reference< XPreparedStatement > xPreparedStatement( _rxStatement, UNO_QUERY );
+ Reference< XConnection > xConn;
+ if ( xStatement.is() )
+ xConn = xStatement->getConnection();
+ else if ( xPreparedStatement.is() )
+ xConn = xPreparedStatement->getConnection();
+ if ( xConn.is() )
+ xDBMetaData = xConn->getMetaData();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return xDBMetaData;
+ }
+}
+// ::com::sun::star::sdbcx::XColumnsSupplier
+//------------------------------------------------------------------------------
+Reference< ::com::sun::star::container::XNameAccess > OResultSet::getColumns(void) throw( RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getColumns" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ // do we have to populate the columns
+ if (!m_pColumns->isInitialized())
+ {
+ // get the metadata
+ Reference< XResultSetMetaData > xMetaData = Reference< XResultSetMetaDataSupplier >(m_xDelegatorResultSet, UNO_QUERY)->getMetaData();
+
+ sal_Int32 nColCount = 0;
+ // do we have columns
+ try
+ {
+ Reference< XDatabaseMetaData > xDBMetaData( lcl_getDBMetaDataFromStatement_nothrow( getStatement() ) );
+ nColCount = xMetaData->getColumnCount();
+
+ for ( sal_Int32 i = 0; i < nColCount; ++i)
+ {
+ // retrieve the name of the column
+ rtl::OUString sName = xMetaData->getColumnName(i + 1);
+ ODataColumn* pColumn = new ODataColumn(xMetaData, m_xDelegatorRow, m_xDelegatorRowUpdate, i + 1, xDBMetaData);
+
+ // don't silently assume that the name is unique - result set implementations
+ // are allowed to return duplicate names, but we are required to have
+ // unique column names
+ if ( m_pColumns->hasByName( sName ) )
+ sName = ::dbtools::createUniqueName( m_pColumns, sName );
+
+ m_pColumns->append( sName, pColumn );
+ }
+ }
+ catch ( const SQLException& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ m_pColumns->setInitialized();
+
+ #if OSL_DEBUG_LEVEL > 0
+ // some sanity checks. Especially in case we auto-adjusted the column names above,
+ // this might be reasonable
+ try
+ {
+ const Reference< XNameAccess > xColNames( static_cast< XNameAccess* >( m_pColumns ), UNO_SET_THROW );
+ const Sequence< ::rtl::OUString > aNames( xColNames->getElementNames() );
+ OSL_POSTCOND( aNames.getLength() == nColCount,
+ "OResultSet::getColumns: invalid column count!" );
+ for ( const ::rtl::OUString* pName = aNames.getConstArray();
+ pName != aNames.getConstArray() + aNames.getLength();
+ ++pName
+ )
+ {
+ Reference< XPropertySet > xColProps( xColNames->getByName( *pName ), UNO_QUERY_THROW );
+ ::rtl::OUString sName;
+ OSL_VERIFY( xColProps->getPropertyValue( PROPERTY_NAME ) >>= sName );
+ OSL_POSTCOND( sName == *pName, "OResultSet::getColumns: invalid column name!" );
+ }
+
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ #endif
+ }
+ return m_pColumns;
+}
+
+// ::com::sun::star::sdbc::XRow
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::wasNull(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::wasNull" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->wasNull();
+}
+//------------------------------------------------------------------------------
+rtl::OUString OResultSet::getString(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getString" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getString(columnIndex);
+}
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::getBoolean(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getBoolean" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getBoolean(columnIndex);
+}
+//------------------------------------------------------------------------------
+sal_Int8 OResultSet::getByte(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getByte" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getByte(columnIndex);
+}
+//------------------------------------------------------------------------------
+sal_Int16 OResultSet::getShort(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getShort" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getShort(columnIndex);
+}
+//------------------------------------------------------------------------------
+sal_Int32 OResultSet::getInt(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getInt" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getInt(columnIndex);
+}
+//------------------------------------------------------------------------------
+sal_Int64 OResultSet::getLong(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getLong" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getLong(columnIndex);
+}
+//------------------------------------------------------------------------------
+float OResultSet::getFloat(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getFloat" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getFloat(columnIndex);
+}
+//------------------------------------------------------------------------------
+double OResultSet::getDouble(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getDouble" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getDouble(columnIndex);
+}
+//------------------------------------------------------------------------------
+Sequence< sal_Int8 > OResultSet::getBytes(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getBytes" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getBytes(columnIndex);
+}
+//------------------------------------------------------------------------------
+::com::sun::star::util::Date OResultSet::getDate(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getDate" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getDate(columnIndex);
+}
+//------------------------------------------------------------------------------
+::com::sun::star::util::Time OResultSet::getTime(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getTime" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getTime(columnIndex);
+}
+//------------------------------------------------------------------------------
+::com::sun::star::util::DateTime OResultSet::getTimestamp(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getTimestamp" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getTimestamp(columnIndex);
+}
+//------------------------------------------------------------------------------
+Reference< ::com::sun::star::io::XInputStream > OResultSet::getBinaryStream(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getBinaryStream" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getBinaryStream(columnIndex);
+}
+//------------------------------------------------------------------------------
+Reference< ::com::sun::star::io::XInputStream > OResultSet::getCharacterStream(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getCharacterStream" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getCharacterStream(columnIndex);
+}
+//------------------------------------------------------------------------------
+Any OResultSet::getObject(sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess > & typeMap) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getObject" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getObject(columnIndex, typeMap);
+}
+//------------------------------------------------------------------------------
+Reference< XRef > OResultSet::getRef(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getRef" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getRef(columnIndex);
+}
+//------------------------------------------------------------------------------
+Reference< XBlob > OResultSet::getBlob(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getBlob" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getBlob(columnIndex);
+}
+//------------------------------------------------------------------------------
+Reference< XClob > OResultSet::getClob(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getClob" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getClob(columnIndex);
+}
+//------------------------------------------------------------------------------
+Reference< XArray > OResultSet::getArray(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getArray" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getArray(columnIndex);
+}
+
+// ::com::sun::star::sdbc::XRowUpdate
+//------------------------------------------------------------------------------
+void OResultSet::updateNull(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateNull" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateNull(columnIndex);
+}
+
+//------------------------------------------------------------------------------
+void OResultSet::updateBoolean(sal_Int32 columnIndex, sal_Bool x) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateBoolean" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateBoolean(columnIndex, x);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateByte(sal_Int32 columnIndex, sal_Int8 x) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateByte" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateByte(columnIndex, x);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateShort(sal_Int32 columnIndex, sal_Int16 x) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateShort" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateShort(columnIndex, x);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateInt(sal_Int32 columnIndex, sal_Int32 x) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateInt" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateInt(columnIndex, x);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateLong(sal_Int32 columnIndex, sal_Int64 x) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateLong" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateLong(columnIndex, x);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateFloat(sal_Int32 columnIndex, float x) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateFloat" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateFloat(columnIndex, x);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateDouble(sal_Int32 columnIndex, double x) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateDouble" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateDouble(columnIndex, x);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateString(sal_Int32 columnIndex, const rtl::OUString& x) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateString" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateString(columnIndex, x);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateBytes(sal_Int32 columnIndex, const Sequence< sal_Int8 >& x) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateBytes" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateBytes(columnIndex, x);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateDate(sal_Int32 columnIndex, const ::com::sun::star::util::Date& x) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateDate" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateDate(columnIndex, x);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateTime(sal_Int32 columnIndex, const ::com::sun::star::util::Time& x) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateTime" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateTime(columnIndex, x);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateTimestamp(sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateTimestamp" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateTimestamp(columnIndex, x);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateBinaryStream(sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream > & x, sal_Int32 length) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateBinaryStream" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateBinaryStream(columnIndex, x, length);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateCharacterStream(sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream > & x, sal_Int32 length) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateCharacterStream" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateCharacterStream(columnIndex, x, length);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateNumericObject(sal_Int32 columnIndex, const Any& x, sal_Int32 scale) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateNumericObject" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateNumericObject(columnIndex, x, scale);
+}
+
+//------------------------------------------------------------------------------
+void OResultSet::updateObject(sal_Int32 columnIndex, const Any& x) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateObject" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateObject(columnIndex, x);
+}
+
+// ::com::sun::star::sdbc::XResultSet
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::next(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::next" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->next();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::isBeforeFirst(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::isBeforeFirst" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->isBeforeFirst();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::isAfterLast(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::isAfterLast" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->isAfterLast();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::isFirst(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::isFirst" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->isFirst();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::isLast(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::isLast" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->isLast();
+}
+
+//------------------------------------------------------------------------------
+void OResultSet::beforeFirst(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::beforeFirst" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ m_xDelegatorResultSet->beforeFirst();
+}
+
+//------------------------------------------------------------------------------
+void OResultSet::afterLast(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::afterLast" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ m_xDelegatorResultSet->afterLast();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::first(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::first" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->first();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::last(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::last" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->last();
+}
+
+//------------------------------------------------------------------------------
+sal_Int32 OResultSet::getRow(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getRow" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->getRow();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::absolute(sal_Int32 row) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::absolute" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->absolute(row);
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::relative(sal_Int32 rows) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::relative" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->relative(rows);
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::previous(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::previous" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->previous();
+}
+
+//------------------------------------------------------------------------------
+void OResultSet::refreshRow(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::refreshRow" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ m_xDelegatorResultSet->refreshRow();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::rowUpdated(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::rowUpdated" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->rowUpdated();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::rowInserted(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::rowInserted" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->rowInserted();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::rowDeleted(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::rowDeleted" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->rowDeleted();
+}
+
+//------------------------------------------------------------------------------
+Reference< XInterface > OResultSet::getStatement(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getStatement" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_aStatement;
+}
+
+// ::com::sun::star::sdbcx::XRowLocate
+//------------------------------------------------------------------------------
+Any OResultSet::getBookmark(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getBookmark" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkBookmarkable();
+
+ return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->getBookmark();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::moveToBookmark(const Any& bookmark) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::moveToBookmark" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkBookmarkable();
+
+ return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->moveToBookmark(bookmark);
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::moveRelativeToBookmark(const Any& bookmark, sal_Int32 rows) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::moveRelativeToBookmark" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkBookmarkable();
+
+ return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->moveRelativeToBookmark(bookmark, rows);
+}
+
+//------------------------------------------------------------------------------
+sal_Int32 OResultSet::compareBookmarks(const Any& _first, const Any& _second) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::compareBookmarks" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkBookmarkable();
+
+ return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->compareBookmarks(_first, _second);
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::hasOrderedBookmarks(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::hasOrderedBookmarks" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkBookmarkable();
+
+ return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->hasOrderedBookmarks();
+}
+
+//------------------------------------------------------------------------------
+sal_Int32 OResultSet::hashBookmark(const Any& bookmark) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::hashBookmark" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkBookmarkable();
+
+ return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->hashBookmark(bookmark);
+}
+
+// ::com::sun::star::sdbc::XResultSetUpdate
+//------------------------------------------------------------------------------
+void OResultSet::insertRow(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::insertRow" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorResultSetUpdate->insertRow();
+}
+
+//------------------------------------------------------------------------------
+void OResultSet::updateRow(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateRow" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorResultSetUpdate->updateRow();
+}
+
+//------------------------------------------------------------------------------
+void OResultSet::deleteRow(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::deleteRow" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorResultSetUpdate->deleteRow();
+}
+
+//------------------------------------------------------------------------------
+void OResultSet::cancelRowUpdates(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::cancelRowUpdates" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorResultSetUpdate->cancelRowUpdates();
+}
+
+//------------------------------------------------------------------------------
+void OResultSet::moveToInsertRow(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::moveToInsertRow" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorResultSetUpdate->moveToInsertRow();
+}
+
+//------------------------------------------------------------------------------
+void OResultSet::moveToCurrentRow(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::moveToCurrentRow" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorResultSetUpdate->moveToCurrentRow();
+}
+
+// -----------------------------------------------------------------------------
+void OResultSet::checkReadOnly() const
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::checkReadOnly" );
+ if ( ( m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY )
+ || !m_xDelegatorResultSetUpdate.is()
+ )
+ throwSQLException( "The result set is read-only.", SQL_GENERAL_ERROR, *const_cast< OResultSet* >( this ) );
+}
+
+// -----------------------------------------------------------------------------
+void OResultSet::checkBookmarkable() const
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::checkBookmarkable" );
+ if ( !m_bIsBookmarkable )
+ throwSQLException( "The result set does not have bookmark support.", SQL_GENERAL_ERROR, *const_cast< OResultSet* >( this ) );
+}
+// -----------------------------------------------------------------------------
+
diff --git a/dbaccess/source/core/api/statement.cxx b/dbaccess/source/core/api/statement.cxx index 475bcabe215f..ac658ea1bba8 100644 --- a/dbaccess/source/core/api/statement.cxx +++ b/dbaccess/source/core/api/statement.cxx @@ -66,6 +66,7 @@ #ifndef _DBHELPER_DBEXCEPTION_HXX_ #include <connectivity/dbexception.hxx> #endif +#include <rtl/logfile.hxx> using namespace ::com::sun::star::sdb; using namespace ::com::sun::star::sdbc; @@ -88,6 +89,7 @@ OStatementBase::OStatementBase(const Reference< XConnection > & _xConn, ,m_bEscapeProcessing( sal_True ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::OStatementBase" ); DBG_CTOR(OStatementBase, NULL); OSL_ENSURE(_xStatement.is() ,"Statement is NULL!"); m_xAggregateAsSet.set(_xStatement,UNO_QUERY); @@ -104,6 +106,7 @@ OStatementBase::~OStatementBase() //-------------------------------------------------------------------------- Sequence< Type > OStatementBase::getTypes() throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::getTypes" ); OTypeCollection aTypes(::getCppuType( (const Reference< XPropertySet > *)0 ), ::getCppuType( (const Reference< XWarningsSupplier > *)0 ), ::getCppuType( (const Reference< XCloseable > *)0 ), @@ -122,6 +125,7 @@ Sequence< Type > OStatementBase::getTypes() throw (RuntimeException) //-------------------------------------------------------------------------- Any OStatementBase::queryInterface( const Type & rType ) throw (RuntimeException) { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::queryInterface" ); Any aIface = OSubComponent::queryInterface( rType ); if (!aIface.hasValue()) { @@ -158,6 +162,7 @@ void OStatementBase::release() throw () //------------------------------------------------------------------------------ void OStatementBase::disposeResultSet() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::disposeResultSet" ); // free the cursor if alive Reference< XComponent > xComp(m_aResultSet.get(), UNO_QUERY); if (xComp.is()) @@ -169,6 +174,7 @@ void OStatementBase::disposeResultSet() //------------------------------------------------------------------------------ void OStatementBase::disposing() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::disposing" ); OPropertySetHelper::disposing(); MutexGuard aGuard(m_aMutex); @@ -202,6 +208,7 @@ void OStatementBase::disposing() //------------------------------------------------------------------------------ void OStatementBase::close(void) throw( SQLException, RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::close" ); { MutexGuard aGuard( m_aMutex ); ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed); @@ -213,6 +220,7 @@ void OStatementBase::close(void) throw( SQLException, RuntimeException ) //------------------------------------------------------------------------------ Reference< XPropertySetInfo > OStatementBase::getPropertySetInfo() throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::getPropertySetInfo" ); return createPropertySetInfo( getInfoHelper() ) ; } @@ -220,6 +228,7 @@ Reference< XPropertySetInfo > OStatementBase::getPropertySetInfo() throw (Runtim //------------------------------------------------------------------------------ ::cppu::IPropertyArrayHelper* OStatementBase::createArrayHelper( ) const { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::createArrayHelper" ); BEGIN_PROPERTY_HELPER(10) DECL_PROP0(CURSORNAME, ::rtl::OUString); DECL_PROP0_BOOL(ESCAPE_PROCESSING); @@ -238,12 +247,14 @@ Reference< XPropertySetInfo > OStatementBase::getPropertySetInfo() throw (Runtim //------------------------------------------------------------------------------ ::cppu::IPropertyArrayHelper& OStatementBase::getInfoHelper() { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::getInfoHelper" ); return *getArrayHelper(); } //------------------------------------------------------------------------------ sal_Bool OStatementBase::convertFastPropertyValue( Any & rConvertedValue, Any & rOldValue, sal_Int32 nHandle, const Any& rValue ) throw( IllegalArgumentException ) { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::convertFastPropertyValue" ); sal_Bool bModified(sal_False); switch (nHandle) { @@ -279,6 +290,7 @@ sal_Bool OStatementBase::convertFastPropertyValue( Any & rConvertedValue, Any & //------------------------------------------------------------------------------ void OStatementBase::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) throw (Exception) { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::setFastPropertyValue_NoBroadcast" ); switch ( nHandle ) { case PROPERTY_ID_USEBOOKMARKS: @@ -309,6 +321,7 @@ void OStatementBase::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const //------------------------------------------------------------------------------ void OStatementBase::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::getFastPropertyValue" ); switch (nHandle) { case PROPERTY_ID_USEBOOKMARKS: @@ -336,6 +349,7 @@ void OStatementBase::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) cons //------------------------------------------------------------------------------ Any OStatementBase::getWarnings(void) throw( SQLException, RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::getWarnings" ); MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed); @@ -345,6 +359,7 @@ Any OStatementBase::getWarnings(void) throw( SQLException, RuntimeException ) //------------------------------------------------------------------------------ void OStatementBase::clearWarnings(void) throw( SQLException, RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::clearWarnings" ); MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed); @@ -355,6 +370,7 @@ void OStatementBase::clearWarnings(void) throw( SQLException, RuntimeException ) //------------------------------------------------------------------------------ void OStatementBase::cancel(void) throw( RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::cancel" ); // no blocking as cancel is typically called from a different thread ClearableMutexGuard aCancelGuard(m_aCancelMutex); if (m_xAggregateAsCancellable.is()) @@ -366,6 +382,7 @@ void OStatementBase::cancel(void) throw( RuntimeException ) //------------------------------------------------------------------------------ Reference< XResultSet > SAL_CALL OStatementBase::getResultSet( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::getResultSet" ); MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed); @@ -380,6 +397,7 @@ Reference< XResultSet > SAL_CALL OStatementBase::getResultSet( ) throw(SQLExcep //------------------------------------------------------------------------------ sal_Int32 SAL_CALL OStatementBase::getUpdateCount( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::getUpdateCount" ); MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed); @@ -394,6 +412,7 @@ sal_Int32 SAL_CALL OStatementBase::getUpdateCount( ) throw(SQLException, Runtim //------------------------------------------------------------------------------ sal_Bool SAL_CALL OStatementBase::getMoreResults( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::getMoreResults" ); MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed); @@ -413,6 +432,7 @@ sal_Bool SAL_CALL OStatementBase::getMoreResults( ) throw(SQLException, Runtime //------------------------------------------------------------------------------ void SAL_CALL OStatementBase::addBatch( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::addBatch" ); MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed); @@ -427,6 +447,7 @@ void SAL_CALL OStatementBase::addBatch( ) throw(SQLException, RuntimeException) //------------------------------------------------------------------------------ void SAL_CALL OStatementBase::clearBatch( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::clearBatch" ); MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed); @@ -441,6 +462,7 @@ void SAL_CALL OStatementBase::clearBatch( ) throw(SQLException, RuntimeExceptio //------------------------------------------------------------------------------ Sequence< sal_Int32 > SAL_CALL OStatementBase::executeBatch( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::executeBatch" ); MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed); @@ -457,6 +479,7 @@ Sequence< sal_Int32 > SAL_CALL OStatementBase::executeBatch( ) throw(SQLExcepti // ----------------------------------------------------------------------------- Reference< XResultSet > SAL_CALL OStatementBase::getGeneratedValues( ) throw (SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::getGeneratedValues" ); MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed); Reference< XGeneratedResultSet > xGRes(m_xAggregateAsSet, UNO_QUERY); @@ -474,6 +497,7 @@ OStatement::OStatement( const Reference< XConnection >& _xConn, const Reference< :OStatementBase( _xConn, _xStatement ) ,m_bAttemptedComposerCreation( false ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatement::OStatement" ); m_xAggregateStatement.set( _xStatement, UNO_QUERY_THROW ); } @@ -485,18 +509,21 @@ IMPLEMENT_FORWARD_XTYPEPROVIDER2( OStatement, OStatementBase, OStatement_IFACE ) //------------------------------------------------------------------------------ rtl::OUString OStatement::getImplementationName( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatement::getImplementationName" ); return rtl::OUString::createFromAscii("com.sun.star.sdb.OStatement"); } //------------------------------------------------------------------------------ sal_Bool OStatement::supportsService( const ::rtl::OUString& _rServiceName ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatement::supportsService" ); return ::comphelper::findValue(getSupportedServiceNames(), _rServiceName, sal_True).getLength() != 0; } //------------------------------------------------------------------------------ Sequence< ::rtl::OUString > OStatement::getSupportedServiceNames( ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatement::getSupportedServiceNames" ); Sequence< ::rtl::OUString > aSNS( 1 ); aSNS.getArray()[0] = SERVICE_SDBC_STATEMENT; return aSNS; @@ -506,6 +533,7 @@ Sequence< ::rtl::OUString > OStatement::getSupportedServiceNames( ) throw (Runt //------------------------------------------------------------------------------ Reference< XResultSet > OStatement::executeQuery( const rtl::OUString& _rSQL ) throw( SQLException, RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatement::executeQuery" ); MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed); @@ -533,6 +561,7 @@ Reference< XResultSet > OStatement::executeQuery( const rtl::OUString& _rSQL ) t //------------------------------------------------------------------------------ sal_Int32 OStatement::executeUpdate( const rtl::OUString& _rSQL ) throw( SQLException, RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatement::executeUpdate" ); MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed); @@ -545,6 +574,7 @@ sal_Int32 OStatement::executeUpdate( const rtl::OUString& _rSQL ) throw( SQLExce //------------------------------------------------------------------------------ sal_Bool OStatement::execute( const rtl::OUString& _rSQL ) throw( SQLException, RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatement::execute" ); MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed); @@ -557,12 +587,14 @@ sal_Bool OStatement::execute( const rtl::OUString& _rSQL ) throw( SQLException, //------------------------------------------------------------------------------ Reference< XConnection > OStatement::getConnection(void) throw( SQLException, RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatement::getConnection" ); return Reference< XConnection >( m_xParent, UNO_QUERY ); } // ----------------------------------------------------------------------------- void SAL_CALL OStatement::disposing() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatement::disposing" ); OStatementBase::disposing(); m_xComposer.clear(); m_xAggregateStatement.clear(); @@ -571,6 +603,7 @@ void SAL_CALL OStatement::disposing() // ----------------------------------------------------------------------------- ::rtl::OUString OStatement::impl_doEscapeProcessing_nothrow( const ::rtl::OUString& _rSQL ) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatement::impl_doEscapeProcessing_nothrow" ); if ( !m_bEscapeProcessing ) return _rSQL; try @@ -600,6 +633,7 @@ void SAL_CALL OStatement::disposing() // ----------------------------------------------------------------------------- bool OStatement::impl_ensureComposer_nothrow() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatement::impl_ensureComposer_nothrow" ); if ( m_bAttemptedComposerCreation ) return m_xComposer.is(); diff --git a/dbaccess/source/core/api/table.cxx b/dbaccess/source/core/api/table.cxx index d3430103a191..9d2772a5f3ef 100644 --- a/dbaccess/source/core/api/table.cxx +++ b/dbaccess/source/core/api/table.cxx @@ -102,6 +102,7 @@ #ifndef DBA_CONTAINERMEDIATOR_HXX #include "ContainerMediator.hxx" #endif +#include <rtl/logfile.hxx> using namespace dbaccess; using namespace connectivity; @@ -135,6 +136,7 @@ ODBTable::ODBTable(connectivity::sdbcx::OCollection* _pTables ,m_xColumnDefinitions(_xColumnDefinitions) ,m_nPrivileges(0) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::ODBTable" ); DBG_CTOR(ODBTable, NULL); DBG_ASSERT(getMetaData().is(), "ODBTable::ODBTable : invalid conn !"); DBG_ASSERT(_rName.getLength(), "ODBTable::ODBTable : name !"); @@ -150,6 +152,7 @@ ODBTable::ODBTable(connectivity::sdbcx::OCollection* _pTables :OTable_Base(_pTables,_rxConn, _rxConn->getMetaData().is() && _rxConn->getMetaData()->supportsMixedCaseQuotedIdentifiers()) ,m_nPrivileges(-1) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::ODBTable" ); } // ------------------------------------------------------------------------- ODBTable::~ODBTable() @@ -162,6 +165,7 @@ IMPLEMENT_FORWARD_REFCOUNT(ODBTable,OTable_Base) //-------------------------------------------------------------------------- OColumn* ODBTable::createColumn(const ::rtl::OUString& _rName) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::createColumn" ); OColumn* pReturn = NULL; Reference<XPropertySet> xProp; @@ -185,11 +189,13 @@ OColumn* ODBTable::createColumn(const ::rtl::OUString& _rName) const // ----------------------------------------------------------------------------- void ODBTable::columnAppended( const Reference< XPropertySet >& /*_rxSourceDescriptor*/ ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::columnAppended" ); // not interested in } // ----------------------------------------------------------------------------- void ODBTable::columnDropped(const ::rtl::OUString& _sName) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::columnDropped" ); Reference<XDrop> xDrop(m_xColumnDefinitions,UNO_QUERY); if ( xDrop.is() && m_xColumnDefinitions->hasByName(_sName) ) { @@ -199,6 +205,7 @@ void ODBTable::columnDropped(const ::rtl::OUString& _sName) //-------------------------------------------------------------------------- Sequence< sal_Int8 > ODBTable::getImplementationId() throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::getImplementationId" ); static OImplementationId * pId = 0; if (! pId) { @@ -216,6 +223,7 @@ Sequence< sal_Int8 > ODBTable::getImplementationId() throw (RuntimeException) //------------------------------------------------------------------------------ void SAL_CALL ODBTable::disposing() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::disposing" ); OPropertySetHelper::disposing(); OTable_Base::disposing(); m_xColumnDefinitions = NULL; @@ -226,6 +234,7 @@ void SAL_CALL ODBTable::disposing() //------------------------------------------------------------------------------ void ODBTable::getFastPropertyValue(Any& _rValue, sal_Int32 _nHandle) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::getFastPropertyValue" ); if ((PROPERTY_ID_PRIVILEGES == _nHandle) && (-1 == m_nPrivileges)) { // somebody is asking for the privileges an we do not know them, yet const_cast<ODBTable*>(this)->m_nPrivileges = ::dbtools::getTablePrivileges(getMetaData(),m_CatalogName,m_SchemaName, m_Name); @@ -236,6 +245,7 @@ void ODBTable::getFastPropertyValue(Any& _rValue, sal_Int32 _nHandle) const // ------------------------------------------------------------------------- void ODBTable::construct() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::construct" ); ::osl::MutexGuard aGuard(m_aMutex); // we don't collect the privileges here, this is potentially expensive. Instead we determine them on request. @@ -296,6 +306,7 @@ void ODBTable::construct() // ----------------------------------------------------------------------------- ::cppu::IPropertyArrayHelper* ODBTable::createArrayHelper( sal_Int32 _nId) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::createArrayHelper" ); Sequence< Property > aProps; describeProperties(aProps); if(!_nId) @@ -328,6 +339,7 @@ IMPLEMENT_SERVICE_INFO1(ODBTable, "com.sun.star.sdb.dbaccess.ODBTable", SERVICE_ // ------------------------------------------------------------------------- Any SAL_CALL ODBTable::queryInterface( const Type & rType ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::getInfoHelper" ); Any aRet; if(rType == getCppuType( (Reference<XRename>*)0)) return Any(); @@ -340,6 +352,7 @@ Any SAL_CALL ODBTable::queryInterface( const Type & rType ) throw(RuntimeExcepti // ------------------------------------------------------------------------- Sequence< Type > SAL_CALL ODBTable::getTypes( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::getTypes" ); Type aRenameType = getCppuType( (Reference<XRename>*)0); Type aAlterType = getCppuType( (Reference<XAlterTable>*)0); @@ -362,6 +375,7 @@ Sequence< Type > SAL_CALL ODBTable::getTypes( ) throw(RuntimeException) //------------------------------------------------------------------------------ void SAL_CALL ODBTable::rename( const ::rtl::OUString& /*_rNewName*/ ) throw(SQLException, ElementExistException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::rename" ); throw SQLException(DBACORE_RESSTRING(RID_STR_NO_TABLE_RENAME),*this,SQLSTATE_GENERAL,1000,Any() ); } @@ -369,6 +383,7 @@ void SAL_CALL ODBTable::rename( const ::rtl::OUString& /*_rNewName*/ ) throw(SQL //------------------------------------------------------------------------------ void SAL_CALL ODBTable::alterColumnByName( const ::rtl::OUString& _rName, const Reference< XPropertySet >& _rxDescriptor ) throw(SQLException, NoSuchElementException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::alterColumnByName" ); ::osl::MutexGuard aGuard(m_aMutex); checkDisposed( connectivity::sdbcx::OTableDescriptor_BASE::rBHelper.bDisposed); @@ -424,6 +439,7 @@ void SAL_CALL ODBTable::alterColumnByName( const ::rtl::OUString& _rName, const // ----------------------------------------------------------------------------- sal_Int64 SAL_CALL ODBTable::getSomething( const Sequence< sal_Int8 >& rId ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::getSomething" ); sal_Int64 nRet(0); if (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) nRet = reinterpret_cast<sal_Int64>(this); @@ -435,6 +451,7 @@ sal_Int64 SAL_CALL ODBTable::getSomething( const Sequence< sal_Int8 >& rId ) thr // ----------------------------------------------------------------------------- Sequence< sal_Int8 > ODBTable::getUnoTunnelImplementationId() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::getUnoTunnelImplementationId" ); static ::cppu::OImplementationId * pId = 0; if (! pId) { @@ -450,11 +467,13 @@ Sequence< sal_Int8 > ODBTable::getUnoTunnelImplementationId() // ----------------------------------------------------------------------------- Reference< XPropertySet > ODBTable::createColumnDescriptor() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::createColumnDescriptor" ); return new OTableColumnDescriptor(); } // ----------------------------------------------------------------------------- sdbcx::OCollection* ODBTable::createColumns(const TStringVector& _rNames) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::createColumns" ); Reference<XDatabaseMetaData> xMeta = getMetaData(); OColumns* pCol = new OColumns(*this, m_aMutex, NULL, isCaseSensitive(), _rNames, this,this, xMeta.is() && xMeta->supportsAlterTableWithAddColumn(), @@ -468,11 +487,13 @@ sdbcx::OCollection* ODBTable::createColumns(const TStringVector& _rNames) // ----------------------------------------------------------------------------- sdbcx::OCollection* ODBTable::createKeys(const TStringVector& _rNames) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::createKeys" ); return new connectivity::OKeysHelper(this,m_aMutex,_rNames); } // ----------------------------------------------------------------------------- sdbcx::OCollection* ODBTable::createIndexes(const TStringVector& _rNames) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::createIndexes" ); return new OIndexes(this,m_aMutex,_rNames,NULL); } // ----------------------------------------------------------------------------- diff --git a/dbaccess/source/core/api/tablecontainer.cxx b/dbaccess/source/core/api/tablecontainer.cxx index 269a5aca69ba..59737c5fc5d3 100644 --- a/dbaccess/source/core/api/tablecontainer.cxx +++ b/dbaccess/source/core/api/tablecontainer.cxx @@ -31,99 +31,38 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" -#ifndef _DBA_CORE_TABLECONTAINER_HXX_ #include "tablecontainer.hxx" -#endif -#ifndef DBACCESS_SHARED_DBASTRINGS_HRC #include "dbastrings.hrc" -#endif -#ifndef _DBA_CORE_TABLE_HXX_ #include "table.hxx" -#endif -#ifndef _COMPHELPER_PROPERTY_HXX_ #include <comphelper/property.hxx> -#endif -#ifndef _COMPHELPER_PROCESSFACTORY_HXX_ #include <comphelper/processfactory.hxx> -#endif -#ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> -#endif -#ifndef _COMPHELPER_ENUMHELPER_HXX_ #include <comphelper/enumhelper.hxx> -#endif -#ifndef _DBA_CORE_RESOURCE_HXX_ #include "core_resource.hxx" -#endif -#ifndef _DBA_CORE_RESOURCE_HRC_ #include "core_resource.hrc" -#endif -#ifndef _COM_SUN_STAR_SDB_COMMANDTYPE_HPP_ #include <com/sun/star/sdb/CommandType.hpp> -#endif -#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ #include <com/sun/star/beans/XPropertySet.hpp> -#endif -#ifndef _COM_SUN_STAR_BEANS_PROPERTYSTATE_HPP_ #include <com/sun/star/beans/PropertyState.hpp> -#endif -#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSTATE_HPP_ #include <com/sun/star/beans/XPropertyState.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_ #include <com/sun/star/sdbc/XConnection.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_ #include <com/sun/star/sdbc/XDatabaseMetaData.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_ #include <com/sun/star/sdbcx/XColumnsSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_ #include <com/sun/star/sdbcx/XTablesSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_KEYRULE_HPP_ #include <com/sun/star/sdbc/KeyRule.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_KEYTYPE_HPP_ #include <com/sun/star/sdbcx/KeyType.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ #include <com/sun/star/sdbc/ColumnValue.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ #include <com/sun/star/sdbc/XRow.hpp> -#endif -#ifndef _COMPHELPER_TYPES_HXX_ #include <comphelper/types.hxx> -#endif -#ifndef _CONNECTIVITY_DBTOOLS_HXX_ #include <connectivity/dbtools.hxx> -#endif -#ifndef _COMPHELPER_EXTRACT_HXX_ #include <comphelper/extract.hxx> -#endif -#ifndef _DBHELPER_DBEXCEPTION_HXX_ #include <connectivity/dbexception.hxx> -#endif -#ifndef _DBA_CORE_TABLEDECORATOR_HXX_ #include "TableDeco.hxx" -#endif -#ifndef DBACORE_SDBCORETOOLS_HXX #include "sdbcoretools.hxx" -#endif -#ifndef DBA_CONTAINERMEDIATOR_HXX #include "ContainerMediator.hxx" -#endif -#ifndef _DBACORE_DEFINITIONCOLUMN_HXX_ #include "definitioncolumn.hxx" -#endif -#ifndef DBACCESS_OBJECTNAMEAPPROVAL_HXX #include "objectnameapproval.hxx" -#endif -#ifndef _STRING_HXX #include <tools/string.hxx> -#endif +#include <rtl/logfile.hxx> #ifndef TOOLS_DIAGNOSE_EX_H #include <tools/diagnose_ex.h> #endif @@ -194,6 +133,7 @@ OTableContainer::OTableContainer(::cppu::OWeakObject& _rParent, //------------------------------------------------------------------------------ OTableContainer::~OTableContainer() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "api", "Ocke.Janssen@sun.com", "OTableContainer::OTableContainer" ); // dispose(); DBG_DTOR(OTableContainer, NULL); } @@ -201,6 +141,7 @@ OTableContainer::~OTableContainer() // ----------------------------------------------------------------------------- void OTableContainer::removeMasterContainerListener() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "api", "Ocke.Janssen@sun.com", "OTableContainer::removeMasterContainerListener" ); try { Reference<XContainer> xCont( m_xMasterContainer, UNO_QUERY_THROW ); @@ -223,7 +164,6 @@ void OTableContainer::removeMasterContainerListener() // XServiceInfo //------------------------------------------------------------------------------ IMPLEMENT_SERVICE_INFO2(OTableContainer, "com.sun.star.sdb.dbaccess.OTableContainer", SERVICE_SDBCX_CONTAINER, SERVICE_SDBCX_TABLES) - // ----------------------------------------------------------------------------- namespace { @@ -259,6 +199,7 @@ void lcl_createDefintionObject(const ::rtl::OUString& _rName // ------------------------------------------------------------------------- connectivity::sdbcx::ObjectType OTableContainer::createObject(const ::rtl::OUString& _rName) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "api", "Ocke.Janssen@sun.com", "OTableContainer::createObject" ); Reference<XColumnsSupplier > xSup; if(m_xMasterContainer.is() && m_xMasterContainer->hasByName(_rName)) xSup.set(m_xMasterContainer->getByName(_rName),UNO_QUERY); @@ -330,6 +271,7 @@ connectivity::sdbcx::ObjectType OTableContainer::createObject(const ::rtl::OUStr // ----------------------------------------------------------------------------- Reference< XPropertySet > OTableContainer::createDescriptor() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "api", "Ocke.Janssen@sun.com", "OTableContainer::createDescriptor" ); Reference< XPropertySet > xRet; // frist we have to look if the master tables does support this @@ -355,6 +297,7 @@ Reference< XPropertySet > OTableContainer::createDescriptor() // XAppend ObjectType OTableContainer::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "api", "Ocke.Janssen@sun.com", "OTableContainer::appendObject" ); // append the new table with a create stmt ::rtl::OUString aName = getString(descriptor->getPropertyValue(PROPERTY_NAME)); if(m_xMasterContainer.is() && m_xMasterContainer->hasByName(aName)) @@ -446,6 +389,7 @@ ObjectType OTableContainer::appendObject( const ::rtl::OUString& _rForName, cons // XDrop void OTableContainer::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "api", "Ocke.Janssen@sun.com", "OTableContainer::dropObject" ); m_bInDrop = sal_True; try { @@ -510,6 +454,7 @@ void OTableContainer::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElement // ----------------------------------------------------------------------------- void SAL_CALL OTableContainer::elementInserted( const ContainerEvent& Event ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "api", "Ocke.Janssen@sun.com", "OTableContainer::elementInserted" ); ::osl::MutexGuard aGuard(m_rMutex); ::rtl::OUString sName; Event.Accessor >>= sName; @@ -528,10 +473,12 @@ void SAL_CALL OTableContainer::elementInserted( const ContainerEvent& Event ) th // ----------------------------------------------------------------------------- void SAL_CALL OTableContainer::elementRemoved( const ContainerEvent& /*Event*/ ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "api", "Ocke.Janssen@sun.com", "OTableContainer::elementRemoved" ); } // ----------------------------------------------------------------------------- void SAL_CALL OTableContainer::elementReplaced( const ContainerEvent& Event ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "api", "Ocke.Janssen@sun.com", "OTableContainer::elementReplaced" ); // create a new config entry { ::rtl::OUString sOldComposedName,sNewComposedName; @@ -544,6 +491,7 @@ void SAL_CALL OTableContainer::elementReplaced( const ContainerEvent& Event ) th // ----------------------------------------------------------------------------- void SAL_CALL OTableContainer::disposing() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "api", "Ocke.Janssen@sun.com", "OTableContainer::disposing" ); OFilteredContainer::disposing(); // say our listeners goobye m_xTableDefinitions = NULL; @@ -552,6 +500,7 @@ void SAL_CALL OTableContainer::disposing() // ----------------------------------------------------------------------------- void SAL_CALL OTableContainer::disposing( const ::com::sun::star::lang::EventObject& /*Source*/ ) throw (::com::sun::star::uno::RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "api", "Ocke.Janssen@sun.com", "OTableContainer::disposing" ); } // ----------------------------------------------------------------------------- diff --git a/dbaccess/source/core/dataaccess/connection.cxx b/dbaccess/source/core/dataaccess/connection.cxx index 4eab4145bd9c..654fe9696280 100644 --- a/dbaccess/source/core/dataaccess/connection.cxx +++ b/dbaccess/source/core/dataaccess/connection.cxx @@ -31,87 +31,35 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" -#ifndef _DBA_CORE_CONNECTION_HXX_ #include "connection.hxx" -#endif - -#ifndef DBACCESS_SHARED_DBASTRINGS_HRC #include "dbastrings.hrc" -#endif -#ifndef _DBA_COREDATAACCESS_DATASOURCE_HXX_ #include "datasource.hxx" -#endif -#ifndef _DBA_CORE_RESOURCE_HRC_ #include "core_resource.hrc" -#endif -#ifndef _DBA_CORE_RESOURCE_HXX_ #include "core_resource.hxx" -#endif -#ifndef _DBA_COREAPI_STATEMENT_HXX_ #include "statement.hxx" -#endif -#ifndef _DBA_COREAPI_PREPAREDSTATEMENT_HXX_ #include "preparedstatement.hxx" -#endif -#ifndef _DBA_COREAPI_CALLABLESTATEMENT_HXX_ #include "callablestatement.hxx" -#endif -#ifndef DBA_CONTAINERMEDIATOR_HXX #include "ContainerMediator.hxx" -#endif -#ifndef DBACCESS_CORE_API_SINGLESELECTQUERYCOMPOSER_HXX #include "SingleSelectQueryComposer.hxx" -#endif -#ifndef DBACCESS_CORE_API_QUERYCOMPOSER_HXX #include "querycomposer.hxx" -#endif /** === begin UNO includes === **/ -#ifndef _COM_SUN_STAR_SDB_COMMANDTYPE_HPP_ #include <com/sun/star/sdb/CommandType.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XDRIVERACCESS_HPP_ #include <com/sun/star/sdbc/XDriverAccess.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XDATADEFINITIONSUPPLIER_HPP_ #include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_REFLECTION_XPROXYFACTORY_HPP_ #include <com/sun/star/reflection/XProxyFactory.hpp> -#endif -#ifndef _COM_SUN_STAR_BEANS_NAMEDVALUE_HPP_ #include <com/sun/star/beans/NamedValue.hpp> -#endif /** === end UNO includes === **/ - -#ifndef _CONNECTIVITY_DBTOOLS_HXX_ #include <connectivity/dbtools.hxx> -#endif -#ifndef CONNECTIVITY_INC_CONNECTIVITY_DBMETADATA_HXX #include <connectivity/dbmetadata.hxx> -#endif -#ifndef _DBHELPER_DBEXCEPTION_HXX_ #include <connectivity/dbexception.hxx> -#endif - -#ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> -#endif -#ifndef TOOLS_DIAGNOSE_EX_H #include <tools/diagnose_ex.h> -#endif -#ifndef _COMPHELPER_EXTRACT_HXX_ #include <comphelper/extract.hxx> -#endif -#ifndef _COMPHELPER_UNO3_HXX_ #include <comphelper/uno3.hxx> -#endif -#ifndef _COMPHELPER_SEQUENCE_HXX_ #include <comphelper/sequence.hxx> -#endif -#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ #include <cppuhelper/typeprovider.hxx> -#endif +#include <rtl/logfile.hxx> using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; @@ -139,17 +87,20 @@ namespace dbaccess //------------------------------------------------------------------------------ rtl::OUString OConnection::getImplementationName( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::getImplementationName" ); return rtl::OUString::createFromAscii("com.sun.star.comp.dbaccess.Connection"); } //------------------------------------------------------------------------------ sal_Bool OConnection::supportsService( const ::rtl::OUString& _rServiceName ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::supportsService" ); return findValue(getSupportedServiceNames(), _rServiceName, sal_True).getLength() != 0; } //------------------------------------------------------------------------------ Sequence< ::rtl::OUString > OConnection::getSupportedServiceNames( ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::getSupportedServiceNames" ); Sequence< ::rtl::OUString > aSupported = OConnectionWrapper::getSupportedServiceNames(); if ( 0 == findValue( aSupported, SERVICE_SDB_CONNECTION, sal_True ).getLength() ) @@ -166,6 +117,7 @@ Sequence< ::rtl::OUString > OConnection::getSupportedServiceNames( ) throw (Run //------------------------------------------------------------------------------ void OConnection::close(void) throw( SQLException, RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::close" ); // being closed is the same as being disposed dispose(); } @@ -173,6 +125,7 @@ void OConnection::close(void) throw( SQLException, RuntimeException ) //------------------------------------------------------------------------------ sal_Bool OConnection::isClosed(void) throw( SQLException, RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::isClosed" ); MutexGuard aGuard(m_aMutex); return !m_xMasterConnection.is(); } @@ -181,6 +134,7 @@ sal_Bool OConnection::isClosed(void) throw( SQLException, RuntimeException ) //------------------------------------------------------------------------------ Reference< XStatement > OConnection::createStatement(void) throw( SQLException, RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::createStatement" ); MutexGuard aGuard(m_aMutex); checkDisposed(); @@ -196,6 +150,7 @@ Reference< XStatement > OConnection::createStatement(void) throw( SQLException, //------------------------------------------------------------------------------ Reference< XPreparedStatement > OConnection::prepareStatement(const rtl::OUString& sql) throw( SQLException, RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::prepareStatement" ); MutexGuard aGuard(m_aMutex); checkDisposed(); @@ -213,6 +168,7 @@ Reference< XPreparedStatement > OConnection::prepareStatement(const rtl::OUStri //------------------------------------------------------------------------------ Reference< XPreparedStatement > OConnection::prepareCall(const rtl::OUString& sql) throw( SQLException, RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::prepareCall" ); MutexGuard aGuard(m_aMutex); checkDisposed(); @@ -229,6 +185,7 @@ Reference< XPreparedStatement > OConnection::prepareCall(const rtl::OUString& s //------------------------------------------------------------------------------ rtl::OUString OConnection::nativeSQL(const rtl::OUString& sql) throw( SQLException, RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::nativeSQL" ); MutexGuard aGuard(m_aMutex); checkDisposed(); return m_xMasterConnection->nativeSQL(sql); @@ -237,6 +194,7 @@ rtl::OUString OConnection::nativeSQL(const rtl::OUString& sql) throw( SQLExcepti //------------------------------------------------------------------------------ void OConnection::setAutoCommit(sal_Bool autoCommit) throw( SQLException, RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::setAutoCommit" ); MutexGuard aGuard(m_aMutex); checkDisposed(); m_xMasterConnection->setAutoCommit(autoCommit); @@ -245,6 +203,7 @@ void OConnection::setAutoCommit(sal_Bool autoCommit) throw( SQLException, Runtim //------------------------------------------------------------------------------ sal_Bool OConnection::getAutoCommit(void) throw( SQLException, RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::getAutoCommit" ); MutexGuard aGuard(m_aMutex); checkDisposed(); return m_xMasterConnection->getAutoCommit(); @@ -253,6 +212,7 @@ sal_Bool OConnection::getAutoCommit(void) throw( SQLException, RuntimeException //------------------------------------------------------------------------------ void OConnection::commit(void) throw( SQLException, RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::commit" ); MutexGuard aGuard(m_aMutex); checkDisposed(); m_xMasterConnection->commit(); @@ -261,6 +221,7 @@ void OConnection::commit(void) throw( SQLException, RuntimeException ) //------------------------------------------------------------------------------ void OConnection::rollback(void) throw( SQLException, RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::rollback" ); MutexGuard aGuard(m_aMutex); checkDisposed(); m_xMasterConnection->rollback(); @@ -269,6 +230,7 @@ void OConnection::rollback(void) throw( SQLException, RuntimeException ) //------------------------------------------------------------------------------ Reference< XDatabaseMetaData > OConnection::getMetaData(void) throw( SQLException, RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::getMetaData" ); MutexGuard aGuard(m_aMutex); checkDisposed(); return m_xMasterConnection->getMetaData(); @@ -277,6 +239,7 @@ Reference< XDatabaseMetaData > OConnection::getMetaData(void) throw( SQLExcepti //------------------------------------------------------------------------------ void OConnection::setReadOnly(sal_Bool readOnly) throw( SQLException, RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::setReadOnly" ); MutexGuard aGuard(m_aMutex); checkDisposed(); m_xMasterConnection->setReadOnly(readOnly); @@ -285,6 +248,7 @@ void OConnection::setReadOnly(sal_Bool readOnly) throw( SQLException, RuntimeExc //------------------------------------------------------------------------------ sal_Bool OConnection::isReadOnly(void) throw( SQLException, RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::isReadOnly" ); MutexGuard aGuard(m_aMutex); checkDisposed(); return m_xMasterConnection->isReadOnly(); @@ -293,6 +257,7 @@ sal_Bool OConnection::isReadOnly(void) throw( SQLException, RuntimeException ) //------------------------------------------------------------------------------ void OConnection::setCatalog(const rtl::OUString& catalog) throw( SQLException, RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::setCatalog" ); MutexGuard aGuard(m_aMutex); checkDisposed(); m_xMasterConnection->setCatalog(catalog); @@ -301,6 +266,7 @@ void OConnection::setCatalog(const rtl::OUString& catalog) throw( SQLException, //------------------------------------------------------------------------------ rtl::OUString OConnection::getCatalog(void) throw( SQLException, RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::getCatalog" ); MutexGuard aGuard(m_aMutex); checkDisposed(); return m_xMasterConnection->getCatalog(); @@ -309,6 +275,7 @@ rtl::OUString OConnection::getCatalog(void) throw( SQLException, RuntimeExceptio //------------------------------------------------------------------------------ void OConnection::setTransactionIsolation(sal_Int32 level) throw( SQLException, RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::setTransactionIsolation" ); MutexGuard aGuard(m_aMutex); checkDisposed(); m_xMasterConnection->setTransactionIsolation(level); @@ -317,6 +284,7 @@ void OConnection::setTransactionIsolation(sal_Int32 level) throw( SQLException, //------------------------------------------------------------------------------ sal_Int32 OConnection::getTransactionIsolation(void) throw( SQLException, RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::getTransactionIsolation" ); MutexGuard aGuard(m_aMutex); checkDisposed(); return m_xMasterConnection->getTransactionIsolation(); @@ -325,6 +293,7 @@ sal_Int32 OConnection::getTransactionIsolation(void) throw( SQLException, Runtim //------------------------------------------------------------------------------ Reference< XNameAccess > OConnection::getTypeMap(void) throw( SQLException, RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::getTypeMap" ); MutexGuard aGuard(m_aMutex); checkDisposed(); return m_xMasterConnection->getTypeMap(); @@ -333,6 +302,7 @@ Reference< XNameAccess > OConnection::getTypeMap(void) throw( SQLException, Run //------------------------------------------------------------------------------ void OConnection::setTypeMap(const Reference< XNameAccess > & typeMap) throw( SQLException, RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::setTypeMap" ); MutexGuard aGuard(m_aMutex); checkDisposed(); m_xMasterConnection->setTypeMap(typeMap); @@ -361,6 +331,7 @@ OConnection::OConnection(ODatabaseSource& _rDB ,m_bSupportsUsers(sal_False) ,m_bSupportsGroups(sal_False) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::OConnection" ); DBG_CTOR(OConnection,NULL); osl_incrementInterlockedCount(&m_refCount); @@ -454,6 +425,7 @@ OConnection::~OConnection() //-------------------------------------------------------------------------- Any SAL_CALL OConnection::getWarnings() throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::getWarnings" ); MutexGuard aGuard(m_aMutex); checkDisposed(); return m_aWarnings.getWarnings(); @@ -462,6 +434,7 @@ Any SAL_CALL OConnection::getWarnings() throw(SQLException, RuntimeException) //-------------------------------------------------------------------------- void SAL_CALL OConnection::clearWarnings( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::clearWarnings" ); MutexGuard aGuard(m_aMutex); checkDisposed(); m_aWarnings.clearWarnings(); @@ -489,6 +462,7 @@ namespace //-------------------------------------------------------------------------- Sequence< Type > OConnection::getTypes() throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::getTypes" ); TypeBag aNormalizedTypes; lcl_copyTypes( aNormalizedTypes, OSubComponent::getTypes() ); @@ -510,6 +484,7 @@ Sequence< Type > OConnection::getTypes() throw (RuntimeException) //-------------------------------------------------------------------------- Sequence< sal_Int8 > OConnection::getImplementationId() throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::getImplementationId" ); return getUnoTunnelImplementationId(); } @@ -536,12 +511,16 @@ Any OConnection::queryInterface( const Type & rType ) throw (RuntimeException) //-------------------------------------------------------------------------- void OConnection::acquire() throw () { + // include this one when you want to see who calls it (call graph) + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::acquire" ); OSubComponent::acquire(); } //-------------------------------------------------------------------------- void OConnection::release() throw () { + // include this one when you want to see who calls it (call graph) + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::release" ); OSubComponent::release(); } @@ -549,6 +528,7 @@ void OConnection::release() throw () //------------------------------------------------------------------------------ void OConnection::disposing() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::disposing" ); MutexGuard aGuard(m_aMutex); OSubComponent::disposing(); @@ -592,6 +572,7 @@ void OConnection::disposing() //------------------------------------------------------------------------------ Reference< XInterface > OConnection::getParent(void) throw( RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::getParent" ); MutexGuard aGuard(m_aMutex); checkDisposed(); return m_xParent; @@ -600,6 +581,7 @@ Reference< XInterface > OConnection::getParent(void) throw( RuntimeException ) //------------------------------------------------------------------------------ void OConnection::setParent(const Reference< XInterface > & /*Parent*/) throw( NoSupportException, RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::setParent" ); throw NoSupportException(); } @@ -607,6 +589,7 @@ void OConnection::setParent(const Reference< XInterface > & /*Parent*/) throw( N //------------------------------------------------------------------------------ Reference< XSQLQueryComposer > OConnection::createQueryComposer(void) throw( RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::createQueryComposer" ); MutexGuard aGuard(m_aMutex); checkDisposed(); @@ -618,6 +601,7 @@ Reference< XSQLQueryComposer > OConnection::createQueryComposer(void) throw( Ru // ----------------------------------------------------------------------------- void OConnection::refresh(const Reference< XNameAccess >& _rToBeRefreshed) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::refresh" ); if ( _rToBeRefreshed == Reference< XNameAccess >(m_pTables) ) { if (!m_pTables->isInitialized()) @@ -655,6 +639,7 @@ void OConnection::refresh(const Reference< XNameAccess >& _rToBeRefreshed) //------------------------------------------------------------------------------ Reference< XNameAccess > OConnection::getTables() throw( RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::getTables" ); MutexGuard aGuard(m_aMutex); checkDisposed(); @@ -665,6 +650,7 @@ Reference< XNameAccess > OConnection::getTables() throw( RuntimeException ) // ----------------------------------------------------------------------------- Reference< XNameAccess > SAL_CALL OConnection::getViews( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::getViews" ); MutexGuard aGuard(m_aMutex); checkDisposed(); @@ -676,6 +662,7 @@ Reference< XNameAccess > SAL_CALL OConnection::getViews( ) throw(RuntimeExcepti //------------------------------------------------------------------------------ Reference< XNameAccess > OConnection::getQueries(void) throw( RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::getQueries" ); MutexGuard aGuard(m_aMutex); checkDisposed(); @@ -686,6 +673,7 @@ Reference< XNameAccess > OConnection::getQueries(void) throw( RuntimeException //------------------------------------------------------------------------------ Reference< XPreparedStatement > SAL_CALL OConnection::prepareCommand( const ::rtl::OUString& command, sal_Int32 commandType ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::prepareCommand" ); MutexGuard aGuard(m_aMutex); checkDisposed(); @@ -717,6 +705,7 @@ Reference< XPreparedStatement > SAL_CALL OConnection::prepareCommand( const ::r // ----------------------------------------------------------------------------- Reference< XInterface > SAL_CALL OConnection::createInstance( const ::rtl::OUString& _sServiceSpecifier ) throw (Exception, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::createInstance" ); Reference< XServiceInfo > xRet; if ( ( SERVICE_NAME_SINGLESELECTQUERYCOMPOSER == _sServiceSpecifier ) || ( _sServiceSpecifier.equalsAscii( "com.sun.star.sdb.SingleSelectQueryAnalyzer" ) ) @@ -730,11 +719,13 @@ Reference< XInterface > SAL_CALL OConnection::createInstance( const ::rtl::OUStr // ----------------------------------------------------------------------------- Reference< XInterface > SAL_CALL OConnection::createInstanceWithArguments( const ::rtl::OUString& _sServiceSpecifier, const Sequence< Any >& /*Arguments*/ ) throw (Exception, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::createInstanceWithArguments" ); return createInstance(_sServiceSpecifier); } // ----------------------------------------------------------------------------- Sequence< ::rtl::OUString > SAL_CALL OConnection::getAvailableServiceNames( ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::getAvailableServiceNames" ); Sequence< ::rtl::OUString > aRet(1); aRet[0] = SERVICE_NAME_SINGLESELECTQUERYCOMPOSER; return aRet; @@ -742,6 +733,7 @@ Sequence< ::rtl::OUString > SAL_CALL OConnection::getAvailableServiceNames( ) t // ----------------------------------------------------------------------------- Reference< XTablesSupplier > OConnection::getMasterTables() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::getMasterTables" ); // check if out "master connection" can supply tables if(!m_xMasterTables.is()) { @@ -761,6 +753,7 @@ Reference< XTablesSupplier > OConnection::getMasterTables() // XUsersSupplier Reference< XNameAccess > SAL_CALL OConnection::getUsers( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::getUsers" ); MutexGuard aGuard(m_aMutex); checkDisposed(); @@ -771,6 +764,7 @@ Reference< XNameAccess > SAL_CALL OConnection::getUsers( ) throw(RuntimeExcepti // XGroupsSupplier Reference< XNameAccess > SAL_CALL OConnection::getGroups( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::getGroups" ); MutexGuard aGuard(m_aMutex); checkDisposed(); Reference<XGroupsSupplier> xGrp(getMasterTables(),UNO_QUERY); @@ -780,6 +774,7 @@ Reference< XNameAccess > SAL_CALL OConnection::getGroups( ) throw(RuntimeExcept // ----------------------------------------------------------------------------- void OConnection::impl_loadConnectionTools_throw() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::impl_loadConnectionTools_throw" ); Sequence< Any > aArguments( 1 ); aArguments[0] <<= NamedValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Connection" ) ), makeAny( Reference< XConnection >( this ) ) ); @@ -790,6 +785,7 @@ void OConnection::impl_loadConnectionTools_throw() // ----------------------------------------------------------------------------- Reference< tools::XTableName > SAL_CALL OConnection::createTableName( ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::createTableName" ); MutexGuard aGuard(m_aMutex); checkDisposed(); impl_loadConnectionTools_throw(); @@ -800,6 +796,7 @@ Reference< tools::XTableName > SAL_CALL OConnection::createTableName( ) throw ( // ----------------------------------------------------------------------------- Reference< tools::XObjectNames > SAL_CALL OConnection::getObjectNames( ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::getObjectNames" ); MutexGuard aGuard(m_aMutex); checkDisposed(); impl_loadConnectionTools_throw(); @@ -810,6 +807,7 @@ Reference< tools::XObjectNames > SAL_CALL OConnection::getObjectNames( ) throw // ----------------------------------------------------------------------------- Reference< tools::XDataSourceMetaData > SAL_CALL OConnection::getDataSourceMetaData( ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::getDataSourceMetaData" ); MutexGuard aGuard(m_aMutex); checkDisposed(); impl_loadConnectionTools_throw(); @@ -819,6 +817,7 @@ Reference< tools::XDataSourceMetaData > SAL_CALL OConnection::getDataSourceMetaD // ----------------------------------------------------------------------------- Reference< ::com::sun::star::container::XNameAccess > SAL_CALL OConnection::getFieldsByCommandDescriptor( ::sal_Int32 commandType, const ::rtl::OUString& command, ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& keepFieldsAlive ) throw (::com::sun::star::sdbc::SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::getFieldsByCommandDescriptor" ); MutexGuard aGuard(m_aMutex); checkDisposed(); impl_loadConnectionTools_throw(); @@ -828,6 +827,7 @@ Reference< ::com::sun::star::container::XNameAccess > SAL_CALL OConnection::getF //-------------------------------------------------------------------- Reference< XSingleSelectQueryComposer > SAL_CALL OConnection::getComposer( ::sal_Int32 commandType, const ::rtl::OUString& command ) throw (::com::sun::star::uno::RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::getComposer" ); MutexGuard aGuard(m_aMutex); checkDisposed(); impl_loadConnectionTools_throw(); @@ -838,6 +838,7 @@ Reference< XSingleSelectQueryComposer > SAL_CALL OConnection::getComposer( ::sal // ----------------------------------------------------------------------------- void OConnection::impl_checkTableQueryNames_nothrow() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::impl_checkTableQueryNames_nothrow" ); DatabaseMetaData aMeta( static_cast< XConnection* >( this ) ); if ( !aMeta.supportsSubqueriesInFrom() ) // nothing to do @@ -873,6 +874,7 @@ void OConnection::impl_checkTableQueryNames_nothrow() // ----------------------------------------------------------------------------- Reference< XGraphic > SAL_CALL OConnection::getTableIcon( const ::rtl::OUString& _TableName, ::sal_Int32 _ColorMode ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::getTableIcon" ); Reference< XGraphic > xReturn; // ask our aggregate @@ -890,6 +892,7 @@ Reference< XGraphic > SAL_CALL OConnection::getTableIcon( const ::rtl::OUString& // ----------------------------------------------------------------------------- Reference< XInterface > SAL_CALL OConnection::getTableEditor( const Reference< XDatabaseDocumentUI >& _DocumentUI, const ::rtl::OUString& _TableName ) throw (IllegalArgumentException, WrappedTargetException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::getTableEditor" ); Reference< XInterface > xReturn; // ask our aggregate diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx index fe2f1d8ecd59..2f4577d57628 100644 --- a/dbaccess/source/core/dataaccess/datasource.cxx +++ b/dbaccess/source/core/dataaccess/datasource.cxx @@ -77,7 +77,7 @@ #include <typelib/typedescription.hxx> #include <unotools/confignode.hxx> #include <unotools/sharedunocomponent.hxx> - +#include <rtl/logfile.hxx> #include <algorithm> using namespace ::com::sun::star::sdbc; @@ -106,448 +106,448 @@ namespace dbaccess { //........................................................................ - //============================================================ - //= FlushNotificationAdapter - //============================================================ - typedef ::cppu::WeakImplHelper1< XFlushListener > FlushNotificationAdapter_Base; - /** helper class which implements a XFlushListener, and forwards all - notification events to another XFlushListener - - The speciality is that the foreign XFlushListener instance, to which - the notifications are forwarded, is held weak. +//============================================================ +//= FlushNotificationAdapter +//============================================================ +typedef ::cppu::WeakImplHelper1< XFlushListener > FlushNotificationAdapter_Base; +/** helper class which implements a XFlushListener, and forwards all + notification events to another XFlushListener + + The speciality is that the foreign XFlushListener instance, to which + the notifications are forwarded, is held weak. + + Thus, the class can be used with XFlushable instance which hold + their listeners with a hard reference, if you simply do not *want* + to be held hard-ref-wise. +*/ +class FlushNotificationAdapter : public FlushNotificationAdapter_Base +{ +private: + WeakReference< XFlushable > m_aBroadcaster; + WeakReference< XFlushListener > m_aListener; - Thus, the class can be used with XFlushable instance which hold - their listeners with a hard reference, if you simply do not *want* - to be held hard-ref-wise. - */ - class FlushNotificationAdapter : public FlushNotificationAdapter_Base +public: + static void installAdapter( const Reference< XFlushable >& _rxBroadcaster, const Reference< XFlushListener >& _rxListener ) { - private: - WeakReference< XFlushable > m_aBroadcaster; - WeakReference< XFlushListener > m_aListener; - - public: - static void installAdapter( const Reference< XFlushable >& _rxBroadcaster, const Reference< XFlushListener >& _rxListener ) - { - Reference< XFlushListener > xAdapter( new FlushNotificationAdapter( _rxBroadcaster, _rxListener ) ); - } - - protected: - FlushNotificationAdapter( const Reference< XFlushable >& _rxBroadcaster, const Reference< XFlushListener >& _rxListener ); - ~FlushNotificationAdapter(); - - void SAL_CALL impl_dispose( bool _bRevokeListener ); + Reference< XFlushListener > xAdapter( new FlushNotificationAdapter( _rxBroadcaster, _rxListener ) ); + } - protected: - // XFlushListener - virtual void SAL_CALL flushed( const ::com::sun::star::lang::EventObject& rEvent ) throw (::com::sun::star::uno::RuntimeException); - // XEventListener - virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); - }; +protected: + FlushNotificationAdapter( const Reference< XFlushable >& _rxBroadcaster, const Reference< XFlushListener >& _rxListener ); + ~FlushNotificationAdapter(); + + void SAL_CALL impl_dispose( bool _bRevokeListener ); + +protected: + // XFlushListener + virtual void SAL_CALL flushed( const ::com::sun::star::lang::EventObject& rEvent ) throw (::com::sun::star::uno::RuntimeException); + // XEventListener + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); +}; + +//------------------------------------------------------------ +DBG_NAME( FlushNotificationAdapter ) +//------------------------------------------------------------ +FlushNotificationAdapter::FlushNotificationAdapter( const Reference< XFlushable >& _rxBroadcaster, const Reference< XFlushListener >& _rxListener ) + :m_aBroadcaster( _rxBroadcaster ) + ,m_aListener( _rxListener ) +{ + DBG_CTOR( FlushNotificationAdapter, NULL ); + DBG_ASSERT( _rxBroadcaster.is(), "FlushNotificationAdapter::FlushNotificationAdapter: invalid flushable!" ); - //------------------------------------------------------------ - DBG_NAME( FlushNotificationAdapter ) - //------------------------------------------------------------ - FlushNotificationAdapter::FlushNotificationAdapter( const Reference< XFlushable >& _rxBroadcaster, const Reference< XFlushListener >& _rxListener ) - :m_aBroadcaster( _rxBroadcaster ) - ,m_aListener( _rxListener ) + osl_incrementInterlockedCount( &m_refCount ); { - DBG_CTOR( FlushNotificationAdapter, NULL ); - DBG_ASSERT( _rxBroadcaster.is(), "FlushNotificationAdapter::FlushNotificationAdapter: invalid flushable!" ); - - osl_incrementInterlockedCount( &m_refCount ); - { - if ( _rxBroadcaster.is() ) - _rxBroadcaster->addFlushListener( this ); - } - osl_decrementInterlockedCount( &m_refCount ); - DBG_ASSERT( m_refCount == 1, "FlushNotificationAdapter::FlushNotificationAdapter: broadcaster isn't holding by hard ref!?" ); + if ( _rxBroadcaster.is() ) + _rxBroadcaster->addFlushListener( this ); } + osl_decrementInterlockedCount( &m_refCount ); + DBG_ASSERT( m_refCount == 1, "FlushNotificationAdapter::FlushNotificationAdapter: broadcaster isn't holding by hard ref!?" ); +} + +//------------------------------------------------------------ +FlushNotificationAdapter::~FlushNotificationAdapter() +{ + DBG_DTOR( FlushNotificationAdapter, NULL ); +} - //------------------------------------------------------------ - FlushNotificationAdapter::~FlushNotificationAdapter() +//-------------------------------------------------------------------- +void SAL_CALL FlushNotificationAdapter::impl_dispose( bool _bRevokeListener ) +{ + Reference< XFlushListener > xKeepAlive( this ); + + if ( _bRevokeListener ) { - DBG_DTOR( FlushNotificationAdapter, NULL ); + Reference< XFlushable > xFlushable( m_aBroadcaster ); + if ( xFlushable.is() ) + xFlushable->removeFlushListener( this ); } - //-------------------------------------------------------------------- - void SAL_CALL FlushNotificationAdapter::impl_dispose( bool _bRevokeListener ) - { - Reference< XFlushListener > xKeepAlive( this ); + m_aListener = Reference< XFlushListener >(); + m_aBroadcaster = Reference< XFlushable >(); +} - if ( _bRevokeListener ) - { - Reference< XFlushable > xFlushable( m_aBroadcaster ); - if ( xFlushable.is() ) - xFlushable->removeFlushListener( this ); - } +//-------------------------------------------------------------------- +void SAL_CALL FlushNotificationAdapter::flushed( const EventObject& rEvent ) throw (RuntimeException) +{ + Reference< XFlushListener > xListener( m_aListener ); + if ( xListener.is() ) + xListener->flushed( rEvent ); + else + impl_dispose( true ); +} - m_aListener = Reference< XFlushListener >(); - m_aBroadcaster = Reference< XFlushable >(); - } +//-------------------------------------------------------------------- +void SAL_CALL FlushNotificationAdapter::disposing( const EventObject& Source ) throw (RuntimeException) +{ + DBG_ASSERT( Source.Source == m_aBroadcaster.get(), "FlushNotificationAdapter::disposing: where did this come from?" ); - //-------------------------------------------------------------------- - void SAL_CALL FlushNotificationAdapter::flushed( const EventObject& rEvent ) throw (RuntimeException) - { - Reference< XFlushListener > xListener( m_aListener ); - if ( xListener.is() ) - xListener->flushed( rEvent ); - else - impl_dispose( true ); - } + Reference< XFlushListener > xListener( m_aListener ); + if ( xListener.is() ) + xListener->disposing( Source ); - //-------------------------------------------------------------------- - void SAL_CALL FlushNotificationAdapter::disposing( const EventObject& Source ) throw (RuntimeException) - { - DBG_ASSERT( Source.Source == m_aBroadcaster.get(), "FlushNotificationAdapter::disposing: where did this come from?" ); + impl_dispose( false ); +} - Reference< XFlushListener > xListener( m_aListener ); - if ( xListener.is() ) - xListener->disposing( Source ); +//============================================================ +//= OAuthenticationContinuation +//============================================================ +class OAuthenticationContinuation : public OInteraction< XInteractionSupplyAuthentication > +{ + sal_Bool m_bRemberPassword : 1; // remember the password for this session ? + + ::rtl::OUString m_sUser; // the user + ::rtl::OUString m_sPassword; // the user's password + +public: + OAuthenticationContinuation(); + + sal_Bool SAL_CALL canSetRealm( ) throw(RuntimeException); + void SAL_CALL setRealm( const ::rtl::OUString& Realm ) throw(RuntimeException); + sal_Bool SAL_CALL canSetUserName( ) throw(RuntimeException); + void SAL_CALL setUserName( const ::rtl::OUString& UserName ) throw(RuntimeException); + sal_Bool SAL_CALL canSetPassword( ) throw(RuntimeException); + void SAL_CALL setPassword( const ::rtl::OUString& Password ) throw(RuntimeException); + Sequence< RememberAuthentication > SAL_CALL getRememberPasswordModes( RememberAuthentication& Default ) throw(RuntimeException); + void SAL_CALL setRememberPassword( RememberAuthentication Remember ) throw(RuntimeException); + sal_Bool SAL_CALL canSetAccount( ) throw(RuntimeException); + void SAL_CALL setAccount( const ::rtl::OUString& Account ) throw(RuntimeException); + Sequence< RememberAuthentication > SAL_CALL getRememberAccountModes( RememberAuthentication& Default ) throw(RuntimeException); + void SAL_CALL setRememberAccount( RememberAuthentication Remember ) throw(RuntimeException); + + ::rtl::OUString getUser() const { return m_sUser; } + ::rtl::OUString getPassword() const { return m_sPassword; } + sal_Bool getRememberPassword() const { return m_bRemberPassword; } +}; - impl_dispose( false ); - } +//-------------------------------------------------------------------------- +OAuthenticationContinuation::OAuthenticationContinuation() + :m_bRemberPassword(sal_True) // TODO: a meaningfull default +{ +} - //============================================================ - //= OAuthenticationContinuation - //============================================================ - class OAuthenticationContinuation : public OInteraction< XInteractionSupplyAuthentication > - { - sal_Bool m_bRemberPassword : 1; // remember the password for this session ? +//-------------------------------------------------------------------------- +sal_Bool SAL_CALL OAuthenticationContinuation::canSetRealm( ) throw(RuntimeException) +{ + return sal_False; +} - ::rtl::OUString m_sUser; // the user - ::rtl::OUString m_sPassword; // the user's password +//-------------------------------------------------------------------------- +void SAL_CALL OAuthenticationContinuation::setRealm( const ::rtl::OUString& /*Realm*/ ) throw(RuntimeException) +{ + DBG_ERROR("OAuthenticationContinuation::setRealm: not supported!"); +} - public: - OAuthenticationContinuation(); - - sal_Bool SAL_CALL canSetRealm( ) throw(RuntimeException); - void SAL_CALL setRealm( const ::rtl::OUString& Realm ) throw(RuntimeException); - sal_Bool SAL_CALL canSetUserName( ) throw(RuntimeException); - void SAL_CALL setUserName( const ::rtl::OUString& UserName ) throw(RuntimeException); - sal_Bool SAL_CALL canSetPassword( ) throw(RuntimeException); - void SAL_CALL setPassword( const ::rtl::OUString& Password ) throw(RuntimeException); - Sequence< RememberAuthentication > SAL_CALL getRememberPasswordModes( RememberAuthentication& Default ) throw(RuntimeException); - void SAL_CALL setRememberPassword( RememberAuthentication Remember ) throw(RuntimeException); - sal_Bool SAL_CALL canSetAccount( ) throw(RuntimeException); - void SAL_CALL setAccount( const ::rtl::OUString& Account ) throw(RuntimeException); - Sequence< RememberAuthentication > SAL_CALL getRememberAccountModes( RememberAuthentication& Default ) throw(RuntimeException); - void SAL_CALL setRememberAccount( RememberAuthentication Remember ) throw(RuntimeException); - - ::rtl::OUString getUser() const { return m_sUser; } - ::rtl::OUString getPassword() const { return m_sPassword; } - sal_Bool getRememberPassword() const { return m_bRemberPassword; } - }; +//-------------------------------------------------------------------------- +sal_Bool SAL_CALL OAuthenticationContinuation::canSetUserName( ) throw(RuntimeException) +{ + // we alwas allow this, even if the database document is read-only. In this case, + // it's simply that the user cannot store the new user name. + return sal_True; +} - //-------------------------------------------------------------------------- - OAuthenticationContinuation::OAuthenticationContinuation() - :m_bRemberPassword(sal_True) // TODO: a meaningfull default - { - } +//-------------------------------------------------------------------------- +void SAL_CALL OAuthenticationContinuation::setUserName( const ::rtl::OUString& _rUser ) throw(RuntimeException) +{ + m_sUser = _rUser; +} - //-------------------------------------------------------------------------- - sal_Bool SAL_CALL OAuthenticationContinuation::canSetRealm( ) throw(RuntimeException) - { - return sal_False; - } +//-------------------------------------------------------------------------- +sal_Bool SAL_CALL OAuthenticationContinuation::canSetPassword( ) throw(RuntimeException) +{ + return sal_True; +} - //-------------------------------------------------------------------------- - void SAL_CALL OAuthenticationContinuation::setRealm( const ::rtl::OUString& /*Realm*/ ) throw(RuntimeException) - { - DBG_ERROR("OAuthenticationContinuation::setRealm: not supported!"); - } +//-------------------------------------------------------------------------- +void SAL_CALL OAuthenticationContinuation::setPassword( const ::rtl::OUString& _rPassword ) throw(RuntimeException) +{ + m_sPassword = _rPassword; +} - //-------------------------------------------------------------------------- - sal_Bool SAL_CALL OAuthenticationContinuation::canSetUserName( ) throw(RuntimeException) - { - // we alwas allow this, even if the database document is read-only. In this case, - // it's simply that the user cannot store the new user name. - return sal_True; - } +//-------------------------------------------------------------------------- +Sequence< RememberAuthentication > SAL_CALL OAuthenticationContinuation::getRememberPasswordModes( RememberAuthentication& _reDefault ) throw(RuntimeException) +{ + Sequence< RememberAuthentication > aReturn(1); + _reDefault = aReturn[0] = RememberAuthentication_SESSION; + return aReturn; +} - //-------------------------------------------------------------------------- - void SAL_CALL OAuthenticationContinuation::setUserName( const ::rtl::OUString& _rUser ) throw(RuntimeException) - { - m_sUser = _rUser; - } +//-------------------------------------------------------------------------- +void SAL_CALL OAuthenticationContinuation::setRememberPassword( RememberAuthentication _eRemember ) throw(RuntimeException) +{ + m_bRemberPassword = (RememberAuthentication_NO != _eRemember); +} - //-------------------------------------------------------------------------- - sal_Bool SAL_CALL OAuthenticationContinuation::canSetPassword( ) throw(RuntimeException) - { - return sal_True; - } +//-------------------------------------------------------------------------- +sal_Bool SAL_CALL OAuthenticationContinuation::canSetAccount( ) throw(RuntimeException) +{ + return sal_False; +} - //-------------------------------------------------------------------------- - void SAL_CALL OAuthenticationContinuation::setPassword( const ::rtl::OUString& _rPassword ) throw(RuntimeException) - { - m_sPassword = _rPassword; - } +//-------------------------------------------------------------------------- +void SAL_CALL OAuthenticationContinuation::setAccount( const ::rtl::OUString& ) throw(RuntimeException) +{ + DBG_ERROR("OAuthenticationContinuation::setAccount: not supported!"); +} - //-------------------------------------------------------------------------- - Sequence< RememberAuthentication > SAL_CALL OAuthenticationContinuation::getRememberPasswordModes( RememberAuthentication& _reDefault ) throw(RuntimeException) - { - Sequence< RememberAuthentication > aReturn(1); - _reDefault = aReturn[0] = RememberAuthentication_SESSION; - return aReturn; - } +//-------------------------------------------------------------------------- +Sequence< RememberAuthentication > SAL_CALL OAuthenticationContinuation::getRememberAccountModes( RememberAuthentication& _reDefault ) throw(RuntimeException) +{ + Sequence < RememberAuthentication > aReturn(1); + aReturn[0] = RememberAuthentication_NO; + _reDefault = RememberAuthentication_NO; + return aReturn; +} - //-------------------------------------------------------------------------- - void SAL_CALL OAuthenticationContinuation::setRememberPassword( RememberAuthentication _eRemember ) throw(RuntimeException) - { - m_bRemberPassword = (RememberAuthentication_NO != _eRemember); - } +//-------------------------------------------------------------------------- +void SAL_CALL OAuthenticationContinuation::setRememberAccount( RememberAuthentication /*Remember*/ ) throw(RuntimeException) +{ + DBG_ERROR("OAuthenticationContinuation::setRememberAccount: not supported!"); +} - //-------------------------------------------------------------------------- - sal_Bool SAL_CALL OAuthenticationContinuation::canSetAccount( ) throw(RuntimeException) +/** The class OSharedConnectionManager implements a structure to share connections. + It owns the master connections which will be disposed when the last connection proxy is gone. +*/ +typedef ::cppu::WeakImplHelper1< XEventListener > OConnectionHelper_BASE; +// need to hold the digest +struct TDigestHolder +{ + sal_uInt8 m_pBuffer[RTL_DIGEST_LENGTH_SHA1]; + TDigestHolder() { - return sal_False; + m_pBuffer[0] = 0; } - //-------------------------------------------------------------------------- - void SAL_CALL OAuthenticationContinuation::setAccount( const ::rtl::OUString& ) throw(RuntimeException) - { - DBG_ERROR("OAuthenticationContinuation::setAccount: not supported!"); - } +}; - //-------------------------------------------------------------------------- - Sequence< RememberAuthentication > SAL_CALL OAuthenticationContinuation::getRememberAccountModes( RememberAuthentication& _reDefault ) throw(RuntimeException) - { - Sequence < RememberAuthentication > aReturn(1); - aReturn[0] = RememberAuthentication_NO; - _reDefault = RememberAuthentication_NO; - return aReturn; - } +class OSharedConnectionManager : public OConnectionHelper_BASE +{ - //-------------------------------------------------------------------------- - void SAL_CALL OAuthenticationContinuation::setRememberAccount( RememberAuthentication /*Remember*/ ) throw(RuntimeException) + // contains the currently used master connections + typedef struct { - DBG_ERROR("OAuthenticationContinuation::setRememberAccount: not supported!"); - } + Reference< XConnection > xMasterConnection; + oslInterlockedCount nALiveCount; + } TConnectionHolder; - /** The class OSharedConnectionManager implements a structure to share connections. - It owns the master connections which will be disposed when the last connection proxy is gone. - */ - typedef ::cppu::WeakImplHelper1< XEventListener > OConnectionHelper_BASE; - // need to hold the digest - struct TDigestHolder + // the less-compare functor, used for the stl::map + struct TDigestLess : public ::std::binary_function< TDigestHolder, TDigestHolder, bool> { - sal_uInt8 m_pBuffer[RTL_DIGEST_LENGTH_SHA1]; - TDigestHolder() + bool operator() (const TDigestHolder& x, const TDigestHolder& y) const { - m_pBuffer[0] = 0; + sal_uInt32 i; + for(i=0;i < RTL_DIGEST_LENGTH_SHA1 && (x.m_pBuffer[i] >= y.m_pBuffer[i]); ++i) + ; + return i < RTL_DIGEST_LENGTH_SHA1; } - }; - class OSharedConnectionManager : public OConnectionHelper_BASE - { + typedef ::std::map< TDigestHolder,TConnectionHolder,TDigestLess> TConnectionMap; // holds the master connections + typedef ::std::map< Reference< XConnection >,TConnectionMap::iterator> TSharedConnectionMap;// holds the shared connections - // contains the currently used master connections - typedef struct - { - Reference< XConnection > xMasterConnection; - oslInterlockedCount nALiveCount; - } TConnectionHolder; - - // the less-compare functor, used for the stl::map - struct TDigestLess : public ::std::binary_function< TDigestHolder, TDigestHolder, bool> - { - bool operator() (const TDigestHolder& x, const TDigestHolder& y) const - { - sal_uInt32 i; - for(i=0;i < RTL_DIGEST_LENGTH_SHA1 && (x.m_pBuffer[i] >= y.m_pBuffer[i]); ++i) - ; - return i < RTL_DIGEST_LENGTH_SHA1; - } - }; - - typedef ::std::map< TDigestHolder,TConnectionHolder,TDigestLess> TConnectionMap; // holds the master connections - typedef ::std::map< Reference< XConnection >,TConnectionMap::iterator> TSharedConnectionMap;// holds the shared connections + ::osl::Mutex m_aMutex; + TConnectionMap m_aConnections; // remeber the master connection in conjunction with the digest + TSharedConnectionMap m_aSharedConnection; // the shared connections with conjunction with an iterator into the connections map + Reference< XProxyFactory > m_xProxyFactory; - ::osl::Mutex m_aMutex; - TConnectionMap m_aConnections; // remeber the master connection in conjunction with the digest - TSharedConnectionMap m_aSharedConnection; // the shared connections with conjunction with an iterator into the connections map - Reference< XProxyFactory > m_xProxyFactory; +protected: + ~OSharedConnectionManager(); - protected: - ~OSharedConnectionManager(); +public: + OSharedConnectionManager(const Reference< XMultiServiceFactory >& _rxServiceFactory); - public: - OSharedConnectionManager(const Reference< XMultiServiceFactory >& _rxServiceFactory); - - void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(RuntimeException); - Reference<XConnection> getConnection( const rtl::OUString& url, - const rtl::OUString& user, - const rtl::OUString& password, - const Sequence< PropertyValue >& _aInfo, - ODatabaseSource* _pDataSource); - void addEventListener(const Reference<XConnection>& _rxConnection,TConnectionMap::iterator& _rIter); - }; + void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(RuntimeException); + Reference<XConnection> getConnection( const rtl::OUString& url, + const rtl::OUString& user, + const rtl::OUString& password, + const Sequence< PropertyValue >& _aInfo, + ODatabaseSource* _pDataSource); + void addEventListener(const Reference<XConnection>& _rxConnection,TConnectionMap::iterator& _rIter); +}; - DBG_NAME(OSharedConnectionManager) - OSharedConnectionManager::OSharedConnectionManager(const Reference< XMultiServiceFactory >& _rxServiceFactory) - { - DBG_CTOR(OSharedConnectionManager,NULL); - m_xProxyFactory.set(_rxServiceFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.reflection.ProxyFactory"))),UNO_QUERY); - } +DBG_NAME(OSharedConnectionManager) +OSharedConnectionManager::OSharedConnectionManager(const Reference< XMultiServiceFactory >& _rxServiceFactory) +{ + DBG_CTOR(OSharedConnectionManager,NULL); + m_xProxyFactory.set(_rxServiceFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.reflection.ProxyFactory"))),UNO_QUERY); +} - OSharedConnectionManager::~OSharedConnectionManager() - { - DBG_DTOR(OSharedConnectionManager,NULL); - } +OSharedConnectionManager::~OSharedConnectionManager() +{ + DBG_DTOR(OSharedConnectionManager,NULL); +} - void SAL_CALL OSharedConnectionManager::disposing( const ::com::sun::star::lang::EventObject& Source ) throw(RuntimeException) +void SAL_CALL OSharedConnectionManager::disposing( const ::com::sun::star::lang::EventObject& Source ) throw(RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + Reference<XConnection> xConnection(Source.Source,UNO_QUERY); + TSharedConnectionMap::iterator aFind = m_aSharedConnection.find(xConnection); + if ( m_aSharedConnection.end() != aFind ) { - MutexGuard aGuard(m_aMutex); - Reference<XConnection> xConnection(Source.Source,UNO_QUERY); - TSharedConnectionMap::iterator aFind = m_aSharedConnection.find(xConnection); - if ( m_aSharedConnection.end() != aFind ) + osl_decrementInterlockedCount(&aFind->second->second.nALiveCount); + if ( !aFind->second->second.nALiveCount ) { - osl_decrementInterlockedCount(&aFind->second->second.nALiveCount); - if ( !aFind->second->second.nALiveCount ) - { - ::comphelper::disposeComponent(aFind->second->second.xMasterConnection); - m_aConnections.erase(aFind->second); - } - m_aSharedConnection.erase(aFind); + ::comphelper::disposeComponent(aFind->second->second.xMasterConnection); + m_aConnections.erase(aFind->second); } + m_aSharedConnection.erase(aFind); } +} - Reference<XConnection> OSharedConnectionManager::getConnection( const rtl::OUString& url, - const rtl::OUString& user, - const rtl::OUString& password, - const Sequence< PropertyValue >& _aInfo, - ODatabaseSource* _pDataSource) - { - MutexGuard aGuard(m_aMutex); - TConnectionMap::key_type nId; - Sequence< PropertyValue > aInfoCopy(_aInfo); - sal_Int32 nPos = aInfoCopy.getLength(); - aInfoCopy.realloc( nPos + 2 ); - aInfoCopy[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TableFilter")); - aInfoCopy[nPos++].Value <<= _pDataSource->m_pImpl->m_aTableFilter; - aInfoCopy[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TableTypeFilter")); - aInfoCopy[nPos++].Value <<= _pDataSource->m_pImpl->m_aTableTypeFilter; // #22377# OJ - - ::rtl::OUString sUser = user; - ::rtl::OUString sPassword = password; - if ((0 == sUser.getLength()) && (0 == sPassword.getLength()) && (0 != _pDataSource->m_pImpl->m_sUser.getLength())) - { // ease the usage of this method. data source which are intended to have a user automatically - // fill in the user/password combination if the caller of this method does not specify otherwise - // 86951 - 05/08/2001 - frank.schoenheit@germany.sun.com - sUser = _pDataSource->m_pImpl->m_sUser; - if (0 != _pDataSource->m_pImpl->m_aPassword.getLength()) - sPassword = _pDataSource->m_pImpl->m_aPassword; - } - - ::connectivity::OConnectionWrapper::createUniqueId(url,aInfoCopy,nId.m_pBuffer,sUser,sPassword); - TConnectionMap::iterator aIter = m_aConnections.find(nId); - - if ( m_aConnections.end() == aIter ) - { - TConnectionHolder aHolder; - aHolder.nALiveCount = 0; // will be incremented by addListener - aHolder.xMasterConnection = _pDataSource->buildIsolatedConnection(user,password); - aIter = m_aConnections.insert(TConnectionMap::value_type(nId,aHolder)).first; - } +Reference<XConnection> OSharedConnectionManager::getConnection( const rtl::OUString& url, + const rtl::OUString& user, + const rtl::OUString& password, + const Sequence< PropertyValue >& _aInfo, + ODatabaseSource* _pDataSource) +{ + MutexGuard aGuard(m_aMutex); + TConnectionMap::key_type nId; + Sequence< PropertyValue > aInfoCopy(_aInfo); + sal_Int32 nPos = aInfoCopy.getLength(); + aInfoCopy.realloc( nPos + 2 ); + aInfoCopy[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TableFilter")); + aInfoCopy[nPos++].Value <<= _pDataSource->m_pImpl->m_aTableFilter; + aInfoCopy[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TableTypeFilter")); + aInfoCopy[nPos++].Value <<= _pDataSource->m_pImpl->m_aTableTypeFilter; // #22377# OJ + + ::rtl::OUString sUser = user; + ::rtl::OUString sPassword = password; + if ((0 == sUser.getLength()) && (0 == sPassword.getLength()) && (0 != _pDataSource->m_pImpl->m_sUser.getLength())) + { // ease the usage of this method. data source which are intended to have a user automatically + // fill in the user/password combination if the caller of this method does not specify otherwise + // 86951 - 05/08/2001 - frank.schoenheit@germany.sun.com + sUser = _pDataSource->m_pImpl->m_sUser; + if (0 != _pDataSource->m_pImpl->m_aPassword.getLength()) + sPassword = _pDataSource->m_pImpl->m_aPassword; + } - Reference<XConnection> xRet; - if ( aIter->second.xMasterConnection.is() ) - { - Reference< XAggregation > xConProxy = m_xProxyFactory->createProxy(aIter->second.xMasterConnection.get()); - xRet = new OSharedConnection(xConProxy); - m_aSharedConnection.insert(TSharedConnectionMap::value_type(xRet,aIter)); - addEventListener(xRet,aIter); - } + ::connectivity::OConnectionWrapper::createUniqueId(url,aInfoCopy,nId.m_pBuffer,sUser,sPassword); + TConnectionMap::iterator aIter = m_aConnections.find(nId); - return xRet; + if ( m_aConnections.end() == aIter ) + { + TConnectionHolder aHolder; + aHolder.nALiveCount = 0; // will be incremented by addListener + aHolder.xMasterConnection = _pDataSource->buildIsolatedConnection(user,password); + aIter = m_aConnections.insert(TConnectionMap::value_type(nId,aHolder)).first; } - void OSharedConnectionManager::addEventListener(const Reference<XConnection>& _rxConnection,TConnectionMap::iterator& _rIter) + + Reference<XConnection> xRet; + if ( aIter->second.xMasterConnection.is() ) { - Reference<XComponent> xComp(_rxConnection,UNO_QUERY); - xComp->addEventListener(this); - OSL_ENSURE( m_aConnections.end() != _rIter , "Iterator is end!"); - osl_incrementInterlockedCount(&_rIter->second.nALiveCount); + Reference< XAggregation > xConProxy = m_xProxyFactory->createProxy(aIter->second.xMasterConnection.get()); + xRet = new OSharedConnection(xConProxy); + m_aSharedConnection.insert(TSharedConnectionMap::value_type(xRet,aIter)); + addEventListener(xRet,aIter); } - //---------------------------------------------------------------------- - namespace + return xRet; +} +void OSharedConnectionManager::addEventListener(const Reference<XConnection>& _rxConnection,TConnectionMap::iterator& _rIter) +{ + Reference<XComponent> xComp(_rxConnection,UNO_QUERY); + xComp->addEventListener(this); + OSL_ENSURE( m_aConnections.end() != _rIter , "Iterator is end!"); + osl_incrementInterlockedCount(&_rIter->second.nALiveCount); +} + +//---------------------------------------------------------------------- +namespace +{ + //------------------------------------------------------------------ + Sequence< PropertyValue > lcl_filterDriverProperties( const Reference< XDriver >& _xDriver, const ::rtl::OUString& _sUrl, + const Sequence< PropertyValue >& _rDataSourceSettings, const AsciiPropertyValue* _pKnownSettings ) { - //------------------------------------------------------------------ - Sequence< PropertyValue > lcl_filterDriverProperties( const Reference< XDriver >& _xDriver, const ::rtl::OUString& _sUrl, - const Sequence< PropertyValue >& _rDataSourceSettings, const AsciiPropertyValue* _pKnownSettings ) + if ( _xDriver.is() ) { - if ( _xDriver.is() ) - { - Sequence< DriverPropertyInfo > aDriverInfo(_xDriver->getPropertyInfo(_sUrl,_rDataSourceSettings)); + Sequence< DriverPropertyInfo > aDriverInfo(_xDriver->getPropertyInfo(_sUrl,_rDataSourceSettings)); - const PropertyValue* pDataSourceSetting = _rDataSourceSettings.getConstArray(); - const PropertyValue* pEnd = pDataSourceSetting + _rDataSourceSettings.getLength(); + const PropertyValue* pDataSourceSetting = _rDataSourceSettings.getConstArray(); + const PropertyValue* pEnd = pDataSourceSetting + _rDataSourceSettings.getLength(); - ::std::vector< PropertyValue > aRet; + ::std::vector< PropertyValue > aRet; - for ( ; pDataSourceSetting != pEnd ; ++pDataSourceSetting ) + for ( ; pDataSourceSetting != pEnd ; ++pDataSourceSetting ) + { + sal_Bool bAllowSetting = sal_False; + const AsciiPropertyValue* pSetting = _pKnownSettings; + for ( ; pSetting->AsciiName; ++pSetting ) { - sal_Bool bAllowSetting = sal_False; - const AsciiPropertyValue* pSetting = _pKnownSettings; - for ( ; pSetting->AsciiName; ++pSetting ) - { - if ( !pDataSourceSetting->Name.compareToAscii( pSetting->AsciiName ) ) - { // the particular data source setting is known - - const DriverPropertyInfo* pAllowedDriverSetting = aDriverInfo.getConstArray(); - const DriverPropertyInfo* pDriverSettingsEnd = pAllowedDriverSetting + aDriverInfo.getLength(); - for ( ; pAllowedDriverSetting != pDriverSettingsEnd; ++pAllowedDriverSetting ) - { - if ( !pAllowedDriverSetting->Name.compareToAscii( pSetting->AsciiName ) ) - { // the driver also allows this setting - bAllowSetting = sal_True; - break; - } + if ( !pDataSourceSetting->Name.compareToAscii( pSetting->AsciiName ) ) + { // the particular data source setting is known + + const DriverPropertyInfo* pAllowedDriverSetting = aDriverInfo.getConstArray(); + const DriverPropertyInfo* pDriverSettingsEnd = pAllowedDriverSetting + aDriverInfo.getLength(); + for ( ; pAllowedDriverSetting != pDriverSettingsEnd; ++pAllowedDriverSetting ) + { + if ( !pAllowedDriverSetting->Name.compareToAscii( pSetting->AsciiName ) ) + { // the driver also allows this setting + bAllowSetting = sal_True; + break; } - break; } - } - if ( bAllowSetting || !pSetting->AsciiName ) - { // if the driver allows this particular setting, or if the setting is completely unknown, - // we pass it to the driver - aRet.push_back( *pDataSourceSetting ); + break; } } - if ( !aRet.empty() ) - return Sequence< PropertyValue >(&(*aRet.begin()),aRet.size()); + if ( bAllowSetting || !pSetting->AsciiName ) + { // if the driver allows this particular setting, or if the setting is completely unknown, + // we pass it to the driver + aRet.push_back( *pDataSourceSetting ); + } } - return Sequence< PropertyValue >(); + if ( !aRet.empty() ) + return Sequence< PropertyValue >(&(*aRet.begin()),aRet.size()); } + return Sequence< PropertyValue >(); + } - //------------------------------------------------------------------ - typedef ::std::map< ::rtl::OUString, sal_Int32 > PropertyAttributeCache; + //------------------------------------------------------------------ + typedef ::std::map< ::rtl::OUString, sal_Int32 > PropertyAttributeCache; - //------------------------------------------------------------------ - struct IsDefaultAndNotRemoveable : public ::std::unary_function< PropertyValue, bool > - { - private: - const PropertyAttributeCache& m_rAttribs; + //------------------------------------------------------------------ + struct IsDefaultAndNotRemoveable : public ::std::unary_function< PropertyValue, bool > + { + private: + const PropertyAttributeCache& m_rAttribs; - public: - IsDefaultAndNotRemoveable( const PropertyAttributeCache& _rAttribs ) : m_rAttribs( _rAttribs ) { } + public: + IsDefaultAndNotRemoveable( const PropertyAttributeCache& _rAttribs ) : m_rAttribs( _rAttribs ) { } - bool operator()( const PropertyValue& _rProp ) - { - if ( _rProp.State != PropertyState_DEFAULT_VALUE ) - return false; + bool operator()( const PropertyValue& _rProp ) + { + if ( _rProp.State != PropertyState_DEFAULT_VALUE ) + return false; - bool bRemoveable = true; + bool bRemoveable = true; - PropertyAttributeCache::const_iterator pos = m_rAttribs.find( _rProp.Name ); - OSL_ENSURE( pos != m_rAttribs.end(), "IsDefaultAndNotRemoveable: illegal property name!" ); - if ( pos != m_rAttribs.end() ) - bRemoveable = ( ( pos->second & PropertyAttribute::REMOVEABLE ) != 0 ); + PropertyAttributeCache::const_iterator pos = m_rAttribs.find( _rProp.Name ); + OSL_ENSURE( pos != m_rAttribs.end(), "IsDefaultAndNotRemoveable: illegal property name!" ); + if ( pos != m_rAttribs.end() ) + bRemoveable = ( ( pos->second & PropertyAttribute::REMOVEABLE ) != 0 ); - return !bRemoveable; - } - }; - } + return !bRemoveable; + } + }; +} //============================================================ //= ODatabaseContext //============================================================ @@ -566,6 +566,7 @@ ODatabaseSource::ODatabaseSource(const ::rtl::Reference<ODatabaseModelImpl>& _pI ,m_aBookmarks( *this, getMutex() ) ,m_aFlushListeners( getMutex() ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::ODatabaseSource" ); // some kind of default DBG_CTOR(ODatabaseSource,NULL); } @@ -584,6 +585,7 @@ ODatabaseSource::~ODatabaseSource() //-------------------------------------------------------------------------- void ODatabaseSource::setName( const Reference< XDocumentDataSource >& _rxDocument, const ::rtl::OUString& _rNewName, DBContextAccess ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::setName" ); ODatabaseSource& rModelImpl = dynamic_cast< ODatabaseSource& >( *_rxDocument.get() ); ::osl::MutexGuard aGuard( rModelImpl.m_aMutex ); @@ -595,6 +597,7 @@ void ODatabaseSource::setName( const Reference< XDocumentDataSource >& _rxDocume //-------------------------------------------------------------------------- Sequence< Type > ODatabaseSource::getTypes() throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::getTypes" ); OTypeCollection aPropertyHelperTypes( ::getCppuType( (const Reference< XFastPropertySet > *)0 ), ::getCppuType( (const Reference< XPropertySet > *)0 ), ::getCppuType( (const Reference< XMultiPropertySet > *)0 )); @@ -611,6 +614,7 @@ Sequence< Type > ODatabaseSource::getTypes() throw (RuntimeException) //-------------------------------------------------------------------------- Sequence< sal_Int8 > ODatabaseSource::getImplementationId() throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::getImplementationId" ); static OImplementationId * pId = 0; if (! pId) { @@ -628,6 +632,7 @@ Sequence< sal_Int8 > ODatabaseSource::getImplementationId() throw (RuntimeExcept //-------------------------------------------------------------------------- Any ODatabaseSource::queryInterface( const Type & rType ) throw (RuntimeException) { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::queryInterface" ); Any aIface = OSubComponent::queryInterface( rType ); if (!aIface.hasValue()) { @@ -647,17 +652,20 @@ Any ODatabaseSource::queryInterface( const Type & rType ) throw (RuntimeExceptio //-------------------------------------------------------------------------- void ODatabaseSource::acquire() throw () { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::acquire" ); OSubComponent::acquire(); } //-------------------------------------------------------------------------- void ODatabaseSource::release() throw () { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::release" ); OSubComponent::release(); } // ----------------------------------------------------------------------------- void SAL_CALL ODatabaseSource::disposing( const ::com::sun::star::lang::EventObject& Source ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::disposing" ); if ( m_pImpl.is() ) m_pImpl->disposing(Source); } @@ -665,23 +673,27 @@ void SAL_CALL ODatabaseSource::disposing( const ::com::sun::star::lang::EventObj //------------------------------------------------------------------------------ rtl::OUString ODatabaseSource::getImplementationName( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::getImplementationName" ); return getImplementationName_static(); } //------------------------------------------------------------------------------ rtl::OUString ODatabaseSource::getImplementationName_static( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::getImplementationName_static" ); return rtl::OUString::createFromAscii("com.sun.star.comp.dba.ODatabaseSource"); } //------------------------------------------------------------------------------ Sequence< ::rtl::OUString > ODatabaseSource::getSupportedServiceNames( ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::getSupportedServiceNames" ); return getSupportedServiceNames_static(); } //------------------------------------------------------------------------------ Reference< XInterface > ODatabaseSource::Create( const Reference< XComponentContext >& _rxContext ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::Create" ); ::comphelper::ComponentContext aContext( _rxContext ); Reference< XSingleServiceFactory > xDBContext( aContext.createComponent( (::rtl::OUString)SERVICE_SDB_DATABASECONTEXT ), UNO_QUERY_THROW ); return xDBContext->createInstance(); @@ -690,6 +702,7 @@ Reference< XInterface > ODatabaseSource::Create( const Reference< XComponentCont //------------------------------------------------------------------------------ Sequence< ::rtl::OUString > ODatabaseSource::getSupportedServiceNames_static( ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::getSupportedServiceNames_static" ); Sequence< ::rtl::OUString > aSNS( 2 ); aSNS[0] = SERVICE_SDB_DATASOURCE; aSNS[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.DocumentDataSource")); @@ -699,12 +712,14 @@ Sequence< ::rtl::OUString > ODatabaseSource::getSupportedServiceNames_static( ) //------------------------------------------------------------------------------ sal_Bool ODatabaseSource::supportsService( const ::rtl::OUString& _rServiceName ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::supportsService" ); return ::comphelper::findValue(getSupportedServiceNames(), _rServiceName, sal_True).getLength() != 0; } // OComponentHelper //------------------------------------------------------------------------------ void ODatabaseSource::disposing() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::disposing" ); OSubComponent::disposing(); OPropertySetHelper::disposing(); @@ -718,6 +733,7 @@ void ODatabaseSource::disposing() //------------------------------------------------------------------------------ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const ::rtl::OUString& _rUid, const ::rtl::OUString& _rPwd) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::buildLowLevelConnection" ); Reference< XConnection > xReturn; Reference< XDriverManager > xManager; @@ -827,6 +843,7 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const ::rtl::O //------------------------------------------------------------------------------ Reference< XPropertySetInfo > ODatabaseSource::getPropertySetInfo() throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::getPropertySetInfo" ); return createPropertySetInfo( getInfoHelper() ) ; } @@ -834,6 +851,7 @@ Reference< XPropertySetInfo > ODatabaseSource::getPropertySetInfo() throw (Runt //------------------------------------------------------------------------------ ::cppu::IPropertyArrayHelper* ODatabaseSource::createArrayHelper( ) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::createArrayHelper" ); BEGIN_PROPERTY_HELPER(13) DECL_PROP1(INFO, Sequence< PropertyValue >, BOUND); DECL_PROP1_BOOL(ISPASSWORDREQUIRED, BOUND); @@ -861,6 +879,7 @@ Reference< XPropertySetInfo > ODatabaseSource::getPropertySetInfo() throw (Runt //------------------------------------------------------------------------------ sal_Bool ODatabaseSource::convertFastPropertyValue(Any & rConvertedValue, Any & rOldValue, sal_Int32 nHandle, const Any& rValue ) throw( IllegalArgumentException ) { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::convertFastPropertyValue" ); sal_Bool bModified(sal_False); if ( m_pImpl.is() ) { @@ -1008,6 +1027,7 @@ namespace //------------------------------------------------------------------------------ void ODatabaseSource::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) throw (Exception) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::setFastPropertyValue_NoBroadcast" ); if ( m_pImpl.is() ) { switch(nHandle) @@ -1053,6 +1073,7 @@ void ODatabaseSource::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const //------------------------------------------------------------------------------ void ODatabaseSource::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::getFastPropertyValue" ); if ( m_pImpl.is() ) { switch (nHandle) @@ -1141,6 +1162,7 @@ void ODatabaseSource::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) con //------------------------------------------------------------------------------ void ODatabaseSource::setLoginTimeout(sal_Int32 seconds) throw( SQLException, RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::setLoginTimeout" ); ModelMethodGuard aGuard( *this ); m_pImpl->m_nLoginTimeout = seconds; } @@ -1148,6 +1170,7 @@ void ODatabaseSource::setLoginTimeout(sal_Int32 seconds) throw( SQLException, Ru //------------------------------------------------------------------------------ sal_Int32 ODatabaseSource::getLoginTimeout(void) throw( SQLException, RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::getLoginTimeout" ); ModelMethodGuard aGuard( *this ); return m_pImpl->m_nLoginTimeout; } @@ -1157,26 +1180,31 @@ sal_Int32 ODatabaseSource::getLoginTimeout(void) throw( SQLException, RuntimeExc //------------------------------------------------------------------------------ Reference< XConnection > SAL_CALL ODatabaseSource::connectWithCompletion( const Reference< XInteractionHandler >& _rxHandler ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::connectWithCompletion" ); return connectWithCompletion(_rxHandler,sal_False); } // ----------------------------------------------------------------------------- Reference< XConnection > ODatabaseSource::getConnection(const rtl::OUString& user, const rtl::OUString& password) throw( SQLException, RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::getConnection" ); return getConnection(user,password,sal_False); } // ----------------------------------------------------------------------------- Reference< XConnection > SAL_CALL ODatabaseSource::getIsolatedConnection( const ::rtl::OUString& user, const ::rtl::OUString& password ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::getIsolatedConnection" ); return getConnection(user,password,sal_True); } // ----------------------------------------------------------------------------- Reference< XConnection > SAL_CALL ODatabaseSource::getIsolatedConnectionWithCompletion( const Reference< XInteractionHandler >& _rxHandler ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::getIsolatedConnectionWithCompletion" ); return connectWithCompletion(_rxHandler,sal_True); } // ----------------------------------------------------------------------------- Reference< XConnection > SAL_CALL ODatabaseSource::connectWithCompletion( const Reference< XInteractionHandler >& _rxHandler,sal_Bool _bIsolated ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::connectWithCompletion" ); ModelMethodGuard aGuard( *this ); if (!_rxHandler.is()) @@ -1264,6 +1292,7 @@ Reference< XConnection > SAL_CALL ODatabaseSource::connectWithCompletion( const // ----------------------------------------------------------------------------- Reference< XConnection > ODatabaseSource::buildIsolatedConnection(const rtl::OUString& user, const rtl::OUString& password) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::buildIsolatedConnection" ); Reference< XConnection > xConn; Reference< XConnection > xSdbcConn = buildLowLevelConnection(user, password); DBG_ASSERT( xSdbcConn.is(), "ODatabaseSource::buildIsolatedConnection: invalid return value of buildLowLevelConnection!" ); @@ -1278,6 +1307,7 @@ Reference< XConnection > ODatabaseSource::buildIsolatedConnection(const rtl::OUS //------------------------------------------------------------------------------ Reference< XConnection > ODatabaseSource::getConnection(const rtl::OUString& user, const rtl::OUString& password,sal_Bool _bIsolated) throw( SQLException, RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::getConnection" ); ModelMethodGuard aGuard( *this ); Reference< XConnection > xConn; @@ -1310,6 +1340,7 @@ Reference< XConnection > ODatabaseSource::getConnection(const rtl::OUString& use //------------------------------------------------------------------------------ Reference< XNameAccess > SAL_CALL ODatabaseSource::getBookmarks( ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::getBookmarks" ); ModelMethodGuard aGuard( *this ); return static_cast< XNameContainer* >(&m_aBookmarks); } @@ -1317,6 +1348,7 @@ Reference< XNameAccess > SAL_CALL ODatabaseSource::getBookmarks( ) throw (Runti //------------------------------------------------------------------------------ Reference< XNameAccess > SAL_CALL ODatabaseSource::getQueryDefinitions( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::getQueryDefinitions" ); ModelMethodGuard aGuard( *this ); Reference< XNameAccess > xContainer = m_pImpl->m_xCommandDefinitions; @@ -1333,6 +1365,7 @@ Reference< XNameAccess > SAL_CALL ODatabaseSource::getQueryDefinitions( ) throw( //------------------------------------------------------------------------------ Reference< XNameAccess > ODatabaseSource::getTables() throw( RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::getTables" ); ModelMethodGuard aGuard( *this ); Reference< XNameAccess > xContainer = m_pImpl->m_xTableDefinitions; @@ -1347,6 +1380,7 @@ Reference< XNameAccess > ODatabaseSource::getTables() throw( RuntimeException ) // ----------------------------------------------------------------------------- void SAL_CALL ODatabaseSource::flush( ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::flush" ); try { // SYNCHRONIZED -> @@ -1376,6 +1410,7 @@ void SAL_CALL ODatabaseSource::flush( ) throw (RuntimeException) // ----------------------------------------------------------------------------- void SAL_CALL ODatabaseSource::flushed( const EventObject& /*rEvent*/ ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::flushed" ); ModelMethodGuard aGuard( *this ); // Okay, this is some hack. @@ -1409,16 +1444,19 @@ void SAL_CALL ODatabaseSource::flushed( const EventObject& /*rEvent*/ ) throw (R // ----------------------------------------------------------------------------- void SAL_CALL ODatabaseSource::addFlushListener( const Reference< ::com::sun::star::util::XFlushListener >& _xListener ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::addFlushListener" ); m_aFlushListeners.addInterface(_xListener); } // ----------------------------------------------------------------------------- void SAL_CALL ODatabaseSource::removeFlushListener( const Reference< ::com::sun::star::util::XFlushListener >& _xListener ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::removeFlushListener" ); m_aFlushListeners.removeInterface(_xListener); } // ----------------------------------------------------------------------------- void SAL_CALL ODatabaseSource::elementInserted( const ContainerEvent& /*Event*/ ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::elementInserted" ); ModelMethodGuard aGuard( *this ); if ( m_pImpl.is() ) m_pImpl->setModified(sal_True); @@ -1426,6 +1464,7 @@ void SAL_CALL ODatabaseSource::elementInserted( const ContainerEvent& /*Event*/ // ----------------------------------------------------------------------------- void SAL_CALL ODatabaseSource::elementRemoved( const ContainerEvent& /*Event*/ ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::elementRemoved" ); ModelMethodGuard aGuard( *this ); if ( m_pImpl.is() ) m_pImpl->setModified(sal_True); @@ -1433,6 +1472,7 @@ void SAL_CALL ODatabaseSource::elementRemoved( const ContainerEvent& /*Event*/ ) // ----------------------------------------------------------------------------- void SAL_CALL ODatabaseSource::elementReplaced( const ContainerEvent& /*Event*/ ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::elementReplaced" ); ModelMethodGuard aGuard( *this ); if ( m_pImpl.is() ) m_pImpl->setModified(sal_True); @@ -1441,6 +1481,7 @@ void SAL_CALL ODatabaseSource::elementReplaced( const ContainerEvent& /*Event*/ // XDocumentDataSource Reference< XOfficeDatabaseDocument > SAL_CALL ODatabaseSource::getDatabaseDocument() throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::getDatabaseDocument" ); ModelMethodGuard aGuard( *this ); Reference< XModel > xModel( m_pImpl->getModel_noCreate() ); @@ -1452,11 +1493,13 @@ Reference< XOfficeDatabaseDocument > SAL_CALL ODatabaseSource::getDatabaseDocume // ----------------------------------------------------------------------------- Reference< XInterface > ODatabaseSource::getThis() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::getThis" ); return *const_cast< ODatabaseSource* >( this ); } // ----------------------------------------------------------------------------- void ODatabaseSource::impl_insertJavaDriverClassPath_nothrow(Sequence< PropertyValue >& _rDriverInfo) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::impl_insertJavaDriverClassPath_nothrow" ); Reference< XPropertySet > xPropertySet( m_pImpl->m_xSettings, UNO_QUERY_THROW ); ::rtl::OUString sJavaDriverClass; xPropertySet->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("JavaDriverClass"))) >>= sJavaDriverClass; diff --git a/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx b/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx index 05d86616a5c1..946de25ca364 100644 --- a/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx +++ b/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx @@ -217,6 +217,10 @@ namespace dbaccess */ ::rtl::OUString composeStatementFromParts( const ::std::vector< ::rtl::OUString >& _rParts ); + /** return the name of the column. + */ + ::rtl::OUString impl_getColumnName_throw(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& column); + protected: virtual ~OSingleSelectQueryComposer(); public: diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx index 679a4d4f20e7..50f0e4594c7f 100644 --- a/dbaccess/source/ui/browser/brwctrlr.cxx +++ b/dbaccess/source/ui/browser/brwctrlr.cxx @@ -194,6 +194,7 @@ #ifndef DBAUI_QUERYORDER_HXX #include "queryorder.hxx" #endif +#include <rtl/logfile.hxx> #include <svx/svxdlg.hxx> //CHINA001 //#include <svx/fmresids.hrc> //CHINA001 @@ -422,6 +423,7 @@ void SAL_CALL SbaXDataBrowserController::FormControllerImpl::disposing(const ::c //------------------------------------------------------------------ Sequence< Type > SAL_CALL SbaXDataBrowserController::getTypes( ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::getTypes" ); return ::comphelper::concatSequences( SbaXDataBrowserController_Base::getTypes(), m_pFormControllerImpl->getTypes() @@ -431,6 +433,7 @@ Sequence< Type > SAL_CALL SbaXDataBrowserController::getTypes( ) throw (Runtime //------------------------------------------------------------------ Sequence< sal_Int8 > SAL_CALL SbaXDataBrowserController::getImplementationId( ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::getImplementationId" ); static ::cppu::OImplementationId * pId = 0; if (! pId) { @@ -447,6 +450,7 @@ Sequence< sal_Int8 > SAL_CALL SbaXDataBrowserController::getImplementationId( ) //------------------------------------------------------------------ Any SAL_CALL SbaXDataBrowserController::queryInterface(const Type& _rType) throw (RuntimeException) { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::queryInterface" ); // check for our additional interfaces Any aRet = SbaXDataBrowserController_Base::queryInterface(_rType); @@ -481,6 +485,7 @@ SbaXDataBrowserController::SbaXDataBrowserController(const Reference< ::com::sun ,m_bClosingKillOpen( sal_False ) ,m_bErrorOccured( sal_False ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::SbaXDataBrowserController" ); DBG_CTOR(SbaXDataBrowserController,NULL); // create the form controller aggregate @@ -499,6 +504,7 @@ SbaXDataBrowserController::SbaXDataBrowserController(const Reference< ::com::sun //------------------------------------------------------------------------------ SbaXDataBrowserController::~SbaXDataBrowserController() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::~SbaXDataBrowserController" ); // deleteView(); // release the aggregated form controller if (m_xFormControllerImpl.is()) @@ -513,6 +519,7 @@ SbaXDataBrowserController::~SbaXDataBrowserController() // ----------------------------------------------------------------------- void SbaXDataBrowserController::startFrameListening( const Reference< XFrame >& _rxFrame ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::startFrameListening" ); SbaXDataBrowserController_Base::startFrameListening( _rxFrame ); Reference< XFrameActionListener > xAggListener; @@ -526,6 +533,7 @@ void SbaXDataBrowserController::startFrameListening( const Reference< XFrame >& // ----------------------------------------------------------------------- void SbaXDataBrowserController::stopFrameListening( const Reference< XFrame >& _rxFrame ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::stopFrameListening" ); SbaXDataBrowserController_Base::stopFrameListening( _rxFrame ); Reference< XFrameActionListener > xAggListener; @@ -539,6 +547,7 @@ void SbaXDataBrowserController::stopFrameListening( const Reference< XFrame >& _ // ----------------------------------------------------------------------------- sal_Bool SbaXDataBrowserController::reloadForm(const Reference< XLoadable >& _rxLoadable) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::reloadForm" ); WaitObject aWO(getBrowserView()); setLoadingStarted(); @@ -555,6 +564,7 @@ sal_Bool SbaXDataBrowserController::reloadForm(const Reference< XLoadable >& _rx // ----------------------------------------------------------------------------- void SbaXDataBrowserController::initFormatter() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::initFormatter" ); // --------------------------------------------------------------- // create a formatter working with the connections format supplier Reference< ::com::sun::star::util::XNumberFormatsSupplier > xSupplier(::dbtools::getNumberFormats(::dbtools::getConnection(m_xRowSet), sal_True,getORB())); @@ -573,6 +583,7 @@ void SbaXDataBrowserController::initFormatter() // ----------------------------------------------------------------------------- void SbaXDataBrowserController::describeSupportedFeatures() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::describeSupportedFeatures" ); SbaXDataBrowserController_Base::describeSupportedFeatures(); implDescribeSupportedFeature( ".uno:FormSlots/undoRecord", ID_BROWSER_UNDORECORD, CommandGroup::CONTROLS ); implDescribeSupportedFeature( ".uno:FormController/undoRecord", ID_BROWSER_UNDORECORD, CommandGroup::CONTROLS ); @@ -596,6 +607,7 @@ void SbaXDataBrowserController::describeSupportedFeatures() //------------------------------------------------------------------------------ sal_Bool SbaXDataBrowserController::Construct(Window* pParent) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::Construct" ); // --------------------------------------------- // create/initialize the form and the grid model m_xRowSet = CreateForm(); @@ -712,34 +724,40 @@ sal_Bool SbaXDataBrowserController::Construct(Window* pParent) //------------------------------------------------------------------------------ sal_Bool SbaXDataBrowserController::LoadForm() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::LoadForm" ); reloadForm( m_xLoadable ); return sal_True; } //------------------------------------------------------------------------------ void SbaXDataBrowserController::AddColumnListener(const Reference< XPropertySet > & /*xCol*/) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::AddColumnListener" ); // we're not interested in any column properties ... } //------------------------------------------------------------------------------ void SbaXDataBrowserController::RemoveColumnListener(const Reference< XPropertySet > & /*xCol*/) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::RemoveColumnListener" ); } //------------------------------------------------------------------------------ Reference< XRowSet > SbaXDataBrowserController::CreateForm() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::CreateForm" ); return Reference< XRowSet > (getORB()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.form.component.Form")), UNO_QUERY); } //------------------------------------------------------------------------------ Reference< ::com::sun::star::form::XFormComponent > SbaXDataBrowserController::CreateGridModel() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::CreateGridModel" ); return Reference< ::com::sun::star::form::XFormComponent > (getORB()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.form.component.GridControl")), UNO_QUERY); } // ------------------------------------------------------------------------- void SbaXDataBrowserController::addModelListeners(const Reference< ::com::sun::star::awt::XControlModel > & _xGridControlModel) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::addModelListeners" ); // ... all the grid columns addColumnListeners(_xGridControlModel); @@ -756,6 +774,7 @@ void SbaXDataBrowserController::addModelListeners(const Reference< ::com::sun::s // ------------------------------------------------------------------------- void SbaXDataBrowserController::removeModelListeners(const Reference< XControlModel > & _xGridControlModel) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::removeModelListeners" ); // every single column model Reference< XIndexContainer > xColumns(_xGridControlModel, UNO_QUERY); if (xColumns.is()) @@ -780,6 +799,7 @@ void SbaXDataBrowserController::removeModelListeners(const Reference< XControlMo // ------------------------------------------------------------------------- void SbaXDataBrowserController::addControlListeners(const Reference< ::com::sun::star::awt::XControl > & _xGridControl) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::addControlListeners" ); // to ge the 'modified' for the current cell Reference< XModifyBroadcaster > xBroadcaster(getBrowserView()->getGridControl(), UNO_QUERY); if (xBroadcaster.is()) @@ -799,6 +819,7 @@ void SbaXDataBrowserController::addControlListeners(const Reference< ::com::sun: // ------------------------------------------------------------------------- void SbaXDataBrowserController::removeControlListeners(const Reference< ::com::sun::star::awt::XControl > & _xGridControl) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::removeControlListeners" ); Reference< XModifyBroadcaster > xBroadcaster(_xGridControl, UNO_QUERY); if (xBroadcaster.is()) xBroadcaster->removeModifyListener(static_cast<XModifyListener*>(this)); @@ -815,6 +836,7 @@ void SbaXDataBrowserController::removeControlListeners(const Reference< ::com::s //------------------------------------------------------------------ void SAL_CALL SbaXDataBrowserController::focusGained(const FocusEvent& /*e*/) throw( RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::focusGained" ); // notify our activate listeners (registered on the form controller aggregate) EventObject aEvt(*this); ::cppu::OInterfaceIteratorHelper aIter(m_pFormControllerImpl->m_aActivateListeners); @@ -825,6 +847,7 @@ void SAL_CALL SbaXDataBrowserController::focusGained(const FocusEvent& /*e*/) th //------------------------------------------------------------------ void SAL_CALL SbaXDataBrowserController::focusLost(const FocusEvent& e) throw( RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::focusLost" ); // some general checks if (!getBrowserView() || !getBrowserView()->getGridControl().is()) return; @@ -859,18 +882,21 @@ void SAL_CALL SbaXDataBrowserController::focusLost(const FocusEvent& e) throw( R // ------------------------------------------------------------------------- void SbaXDataBrowserController::disposingGridControl(const ::com::sun::star::lang::EventObject& /*Source*/) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::disposingGridControl" ); removeControlListeners(getBrowserView()->getGridControl()); } // ------------------------------------------------------------------------- void SbaXDataBrowserController::disposingGridModel(const ::com::sun::star::lang::EventObject& /*Source*/) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::disposingGridModel" ); removeModelListeners(getControlModel()); } // ------------------------------------------------------------------------- void SbaXDataBrowserController::disposingFormModel(const ::com::sun::star::lang::EventObject& Source) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::disposingFormModel" ); Reference< XPropertySet > xSourceSet(Source.Source, UNO_QUERY); if (xSourceSet.is()) { @@ -899,12 +925,14 @@ void SbaXDataBrowserController::disposingFormModel(const ::com::sun::star::lang: // ------------------------------------------------------------------------- void SbaXDataBrowserController::disposingColumnModel(const ::com::sun::star::lang::EventObject& Source) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::disposingColumnModel" ); RemoveColumnListener(Reference< XPropertySet > (Source.Source, UNO_QUERY)); } // ------------------------------------------------------------------------- void SbaXDataBrowserController::disposing(const EventObject& Source) throw( RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::disposing" ); // if it's a component other than our aggregate, forward it to the aggregate if ( m_xFormControllerImpl != Source.Source ) { @@ -945,6 +973,7 @@ void SbaXDataBrowserController::disposing(const EventObject& Source) throw( Runt // ----------------------------------------------------------------------- void SAL_CALL SbaXDataBrowserController::setIdentifier( const ::rtl::OUString& _Identifier ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::setIdentifier" ); ::osl::MutexGuard aGuard( getMutex() ); m_sModuleIdentifier = _Identifier; } @@ -952,6 +981,7 @@ void SAL_CALL SbaXDataBrowserController::setIdentifier( const ::rtl::OUString& _ // ----------------------------------------------------------------------- ::rtl::OUString SAL_CALL SbaXDataBrowserController::getIdentifier( ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::getIdentifier" ); ::osl::MutexGuard aGuard( getMutex() ); return m_sModuleIdentifier; } @@ -959,6 +989,7 @@ void SAL_CALL SbaXDataBrowserController::setIdentifier( const ::rtl::OUString& _ // ----------------------------------------------------------------------- void SbaXDataBrowserController::propertyChange(const PropertyChangeEvent& evt) throw ( RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::propertyChange" ); Reference< XPropertySet > xSource(evt.Source, UNO_QUERY); if (!xSource.is()) return; @@ -983,37 +1014,40 @@ void SbaXDataBrowserController::propertyChange(const PropertyChangeEvent& evt) t InvalidateAll(); } + // the filter or the sort criterias have changed ? -> update our parser - if (m_xParser.is()) + if (evt.PropertyName.equals(PROPERTY_ACTIVECOMMAND)) { - if (evt.PropertyName.equals(PROPERTY_ACTIVECOMMAND)) - { + initializeParser(); + if (m_xParser.is()) DO_SAFE( m_xParser->setElementaryQuery(::comphelper::getString(evt.NewValue)), "SbaXDataBrowserController::propertyChange : could not forward the new query to my parser !" ); - } - else if (evt.PropertyName.equals(PROPERTY_FILTER)) + } + else if (evt.PropertyName.equals(PROPERTY_FILTER)) + { + initializeParser(); + if ( m_xParser.is() && m_xParser->getFilter() != ::comphelper::getString(evt.NewValue)) { - if (m_xParser->getFilter() != ::comphelper::getString(evt.NewValue)) - { - DO_SAFE( m_xParser->setFilter(::comphelper::getString(evt.NewValue)), "SbaXDataBrowserController::propertyChange : could not forward the new filter to my parser !" ); - } - InvalidateFeature(ID_BROWSER_REMOVEFILTER); + DO_SAFE( m_xParser->setFilter(::comphelper::getString(evt.NewValue)), "SbaXDataBrowserController::propertyChange : could not forward the new filter to my parser !" ); } - else if (evt.PropertyName.equals(PROPERTY_HAVING_CLAUSE)) + InvalidateFeature(ID_BROWSER_REMOVEFILTER); + } + else if (evt.PropertyName.equals(PROPERTY_HAVING_CLAUSE)) + { + initializeParser(); + if ( m_xParser.is() && m_xParser->getHavingClause() != ::comphelper::getString(evt.NewValue)) { - if (m_xParser->getHavingClause() != ::comphelper::getString(evt.NewValue)) - { - DO_SAFE( m_xParser->setHavingClause(::comphelper::getString(evt.NewValue)), "SbaXDataBrowserController::propertyChange : could not forward the new filter to my parser !" ); - } - InvalidateFeature(ID_BROWSER_REMOVEFILTER); + DO_SAFE( m_xParser->setHavingClause(::comphelper::getString(evt.NewValue)), "SbaXDataBrowserController::propertyChange : could not forward the new filter to my parser !" ); } - else if (evt.PropertyName.equals(PROPERTY_ORDER)) + InvalidateFeature(ID_BROWSER_REMOVEFILTER); + } + else if (evt.PropertyName.equals(PROPERTY_ORDER)) + { + initializeParser(); + if ( m_xParser.is() && m_xParser->getOrder() != ::comphelper::getString(evt.NewValue)) { - if (m_xParser->getOrder() != ::comphelper::getString(evt.NewValue)) - { - DO_SAFE( m_xParser->setOrder(::comphelper::getString(evt.NewValue)), "SbaXDataBrowserController::propertyChange : could not forward the new order to my parser !" ); - } - InvalidateFeature(ID_BROWSER_REMOVEFILTER); + DO_SAFE( m_xParser->setOrder(::comphelper::getString(evt.NewValue)), "SbaXDataBrowserController::propertyChange : could not forward the new order to my parser !" ); } + InvalidateFeature(ID_BROWSER_REMOVEFILTER); } // a new record count ? -> may be our search availability has changed @@ -1030,12 +1064,14 @@ void SbaXDataBrowserController::propertyChange(const PropertyChangeEvent& evt) t //------------------------------------------------------------------------ void SbaXDataBrowserController::modified(const ::com::sun::star::lang::EventObject& /*aEvent*/) throw( RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::modified" ); setCurrentModified( sal_True ); } // ----------------------------------------------------------------------- void SbaXDataBrowserController::elementInserted(const ::com::sun::star::container::ContainerEvent& evt) throw( RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::elementInserted" ); DBG_ASSERT(Reference< XInterface >(evt.Source, UNO_QUERY).get() == Reference< XInterface >(getControlModel(), UNO_QUERY).get(), "SbaXDataBrowserController::elementInserted: where did this come from (not from the grid model)?!"); Reference< XPropertySet > xNewColumn(evt.Element,UNO_QUERY); @@ -1046,6 +1082,7 @@ void SbaXDataBrowserController::elementInserted(const ::com::sun::star::containe // ----------------------------------------------------------------------- void SbaXDataBrowserController::elementRemoved(const ::com::sun::star::container::ContainerEvent& evt) throw( RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::elementRemoved" ); DBG_ASSERT(Reference< XInterface >(evt.Source, UNO_QUERY).get() == Reference< XInterface >(getControlModel(), UNO_QUERY).get(), "SbaXDataBrowserController::elementRemoved: where did this come from (not from the grid model)?!"); Reference< XPropertySet > xOldColumn(evt.Element,UNO_QUERY); @@ -1056,6 +1093,7 @@ void SbaXDataBrowserController::elementRemoved(const ::com::sun::star::container // ----------------------------------------------------------------------- void SbaXDataBrowserController::elementReplaced(const ::com::sun::star::container::ContainerEvent& evt) throw( RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::elementReplaced" ); DBG_ASSERT(Reference< XInterface >(evt.Source, UNO_QUERY).get() == Reference< XInterface >(getControlModel(), UNO_QUERY).get(), "SbaXDataBrowserController::elementReplaced: where did this come from (not from the grid model)?!"); Reference< XPropertySet > xOldColumn(evt.ReplacedElement,UNO_QUERY); @@ -1070,6 +1108,7 @@ void SbaXDataBrowserController::elementReplaced(const ::com::sun::star::containe // ----------------------------------------------------------------------- sal_Bool SbaXDataBrowserController::suspend(sal_Bool /*bSuspend*/) throw( RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::suspend" ); // have a pending open operation ? if (PendingLoad()) { @@ -1120,6 +1159,7 @@ sal_Bool SbaXDataBrowserController::suspend(sal_Bool /*bSuspend*/) throw( Runtim // ----------------------------------------------------------------------- void SbaXDataBrowserController::disposing() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::disposing" ); // and dispose the aggregate if (m_xFormControllerImpl.is()) { @@ -1219,6 +1259,7 @@ void SbaXDataBrowserController::disposing() //------------------------------------------------------------------------------ void SbaXDataBrowserController::frameAction(const ::com::sun::star::frame::FrameActionEvent& aEvent) throw( RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::frameAction" ); ::osl::MutexGuard aGuard( getMutex() ); SbaXDataBrowserController_Base::frameAction( aEvent ); @@ -1256,6 +1297,7 @@ void SbaXDataBrowserController::frameAction(const ::com::sun::star::frame::Frame //------------------------------------------------------------------------------ void SbaXDataBrowserController::errorOccured(const ::com::sun::star::sdb::SQLErrorEvent& aEvent) throw( RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::errorOccured" ); SQLExceptionInfo aInfo(aEvent.Reason); if ( aInfo.isValid() ) { @@ -1270,6 +1312,7 @@ void SbaXDataBrowserController::errorOccured(const ::com::sun::star::sdb::SQLErr //------------------------------------------------------------------------------ sal_Bool SbaXDataBrowserController::approveParameter(const ::com::sun::star::form::DatabaseParameterEvent& aEvent) throw( RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::approveParameter" ); if (aEvent.Source != getRowSet()) { // not my data source -> allow anything @@ -1355,12 +1398,14 @@ sal_Bool SbaXDataBrowserController::approveParameter(const ::com::sun::star::for //------------------------------------------------------------------------------ sal_Bool SbaXDataBrowserController::approveReset(const ::com::sun::star::lang::EventObject& /*rEvent*/) throw( RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::approveReset" ); return sal_True; } //------------------------------------------------------------------------------ void SbaXDataBrowserController::resetted(const ::com::sun::star::lang::EventObject& rEvent) throw( RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::resetted" ); DBG_ASSERT(rEvent.Source == getControlModel(), "SbaXDataBrowserController::resetted : where did this come from ?"); (void)rEvent; setCurrentModified( sal_False ); @@ -1369,6 +1414,7 @@ void SbaXDataBrowserController::resetted(const ::com::sun::star::lang::EventObje //------------------------------------------------------------------------------ sal_Bool SbaXDataBrowserController::confirmDelete(const ::com::sun::star::sdb::RowChangeEvent& /*aEvent*/) throw( RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::confirmDelete" ); if (QueryBox(getBrowserView(), ModuleRes(QUERY_BRW_DELETE_ROWS)).Execute() != RET_YES) return sal_False; @@ -1377,6 +1423,7 @@ sal_Bool SbaXDataBrowserController::confirmDelete(const ::com::sun::star::sdb::R //------------------------------------------------------------------------------ FeatureState SbaXDataBrowserController::GetState(sal_uInt16 nId) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::GetState" ); FeatureState aReturn; // (disabled automatically) @@ -1390,7 +1437,10 @@ FeatureState SbaXDataBrowserController::GetState(sal_uInt16 nId) const { case ID_BROWSER_REMOVEFILTER: if (!m_xParser.is()) - break; + { + aReturn.bEnabled = false; + return aReturn; + } // any filter or sort order set ? aReturn.bEnabled = m_xParser->getFilter().getLength() || m_xParser->getHavingClause().getLength() || m_xParser->getOrder().getLength(); return aReturn; @@ -1463,7 +1513,8 @@ FeatureState SbaXDataBrowserController::GetState(sal_uInt16 nId) const case ID_BROWSER_AUTOFILTER: { // a native statement can't be filtered or sorted - if (!m_xParser.is()) + const Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY); + if ( !::comphelper::getBOOL(xFormSet->getPropertyValue(PROPERTY_ESCAPE_PROCESSING))) break; Reference< XPropertySet > xCurrentField = getBoundField(); @@ -1471,8 +1522,7 @@ FeatureState SbaXDataBrowserController::GetState(sal_uInt16 nId) const break; aReturn.bEnabled = ::comphelper::getBOOL(xCurrentField->getPropertyValue(PROPERTY_ISSEARCHABLE)); - Reference< XRowSet > xRow = getRowSet(); - Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY); + const Reference< XRowSet > xRow = getRowSet(); if(aReturn.bEnabled && xRow.is()) // check if we stand on a valid row aReturn.bEnabled = !(xRow->isBeforeFirst() || xRow->isAfterLast() || xRow->rowDeleted() || ::comphelper::getINT32(xFormSet->getPropertyValue(PROPERTY_ROWCOUNT)) == 0); } @@ -1480,17 +1530,19 @@ FeatureState SbaXDataBrowserController::GetState(sal_uInt16 nId) const case ID_BROWSER_ORDERCRIT: case ID_BROWSER_FILTERCRIT: - if (!m_xParser.is()) - break; { + const Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY); + if ( !::comphelper::getBOOL(xFormSet->getPropertyValue(PROPERTY_ESCAPE_PROCESSING))) + break; + Reference< XPropertySet > xCurrentField = getBoundField(); // we are not in the handle column aReturn.bEnabled = getBrowserView()->getVclControl()->GetCurColumnId() != 0 && xCurrentField.is() && ::comphelper::getBOOL(xCurrentField->getPropertyValue(PROPERTY_ISSEARCHABLE)); - Reference< XRowSet > xRow = getRowSet(); - Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY); + const Reference< XRowSet > xRow = getRowSet(); + if(aReturn.bEnabled && xRow.is()) // check if we stand on a valid row aReturn.bEnabled = !(xRow->isBeforeFirst() || xRow->isAfterLast() || xRow->rowDeleted() || ::comphelper::getINT32(xFormSet->getPropertyValue(PROPERTY_ROWCOUNT)) == 0); // a native statement can't be filtered or sorted @@ -1578,6 +1630,7 @@ FeatureState SbaXDataBrowserController::GetState(sal_uInt16 nId) const //------------------------------------------------------------------------------ void SbaXDataBrowserController::applyParserOrder(const ::rtl::OUString& _rOldOrder) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::applyParserOrder" ); Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY); if (!m_xLoadable.is()) { @@ -1620,6 +1673,7 @@ void SbaXDataBrowserController::applyParserOrder(const ::rtl::OUString& _rOldOrd //------------------------------------------------------------------------------ void SbaXDataBrowserController::applyParserFilter(const ::rtl::OUString& _rOldFilter, sal_Bool _bOldFilterApplied,const ::rtl::OUString& _sOldHaving) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::applyParserFilter" ); Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY); if (!m_xLoadable.is()) { @@ -1668,6 +1722,7 @@ void SbaXDataBrowserController::applyParserFilter(const ::rtl::OUString& _rOldFi //------------------------------------------------------------------------------ void SbaXDataBrowserController::ExecuteFilterSortCrit(sal_Bool bFilter) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::ExecuteFilterSortCrit" ); if (!SaveModified()) return; @@ -1678,8 +1733,9 @@ void SbaXDataBrowserController::ExecuteFilterSortCrit(sal_Bool bFilter) getRowSet()->rowDeleted()) return; - ::rtl::OUString sOldVal = bFilter ? m_xParser->getFilter() : m_xParser->getOrder(); - ::rtl::OUString sOldHaving = m_xParser->getHavingClause(); + initializeParser(); + const ::rtl::OUString sOldVal = bFilter ? m_xParser->getFilter() : m_xParser->getOrder(); + const ::rtl::OUString sOldHaving = m_xParser->getHavingClause(); try { Reference< ::com::sun::star::sdbcx::XColumnsSupplier> xSup = getColumnsSupplier(); @@ -1736,6 +1792,7 @@ void SbaXDataBrowserController::ExecuteFilterSortCrit(sal_Bool bFilter) //------------------------------------------------------------------------------ void SbaXDataBrowserController::ExecuteSearch() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::ExecuteSearch" ); // calculate the control source of the active field Reference< ::com::sun::star::form::XGrid > xGrid(getBrowserView()->getGridControl(), UNO_QUERY); DBG_ASSERT(xGrid.is(), "SbaXDataBrowserController::ExecuteSearch : the control should have an ::com::sun::star::form::XGrid interface !"); @@ -1794,6 +1851,7 @@ void SbaXDataBrowserController::ExecuteSearch() //------------------------------------------------------------------------------ void SbaXDataBrowserController::Execute(sal_uInt16 nId, const Sequence< PropertyValue >& _rArgs) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::Execute" ); sal_Bool bSortUp = sal_True; switch (nId) @@ -1915,7 +1973,8 @@ void SbaXDataBrowserController::Execute(sal_uInt16 nId, const Sequence< Property if (!xField.is()) break; - ::rtl::OUString sOldSort = m_xParser->getOrder(); + initializeParser(); + const ::rtl::OUString sOldSort = m_xParser->getOrder(); sal_Bool bParserSuccess = sal_False; HANDLE_SQL_ERRORS( m_xParser->setOrder(::rtl::OUString()); m_xParser->appendOrderByColumn(xField, bSortUp), @@ -1945,6 +2004,7 @@ void SbaXDataBrowserController::Execute(sal_uInt16 nId, const Sequence< Property sal_Bool bHaving = sal_False; ::rtl::OUString sName; xField->getPropertyValue(PROPERTY_NAME) >>= sName; + initializeParser(); Reference< XColumnsSupplier > xColumnsSupplier(m_xParser, UNO_QUERY); Reference< ::com::sun::star::container::XNameAccess > xCols = xColumnsSupplier.is() ? xColumnsSupplier->getColumns() : Reference< ::com::sun::star::container::XNameAccess > (); if ( xCols.is() && xCols->hasByName(sName) ) @@ -1955,8 +2015,8 @@ void SbaXDataBrowserController::Execute(sal_uInt16 nId, const Sequence< Property xProp->getPropertyValue(sAgg) >>= bHaving; } - ::rtl::OUString sOldFilter = m_xParser->getFilter(); - ::rtl::OUString sOldHaving = m_xParser->getHavingClause(); + const ::rtl::OUString sOldFilter = m_xParser->getFilter(); + const ::rtl::OUString sOldHaving = m_xParser->getHavingClause(); Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY); sal_Bool bApplied = ::comphelper::getBOOL(xFormSet->getPropertyValue(PROPERTY_APPLYFILTER)); @@ -2086,6 +2146,7 @@ void SbaXDataBrowserController::Execute(sal_uInt16 nId, const Sequence< Property //------------------------------------------------------------------------------ sal_Bool SbaXDataBrowserController::SaveModified(sal_Bool bAskFor) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::SaveModified" ); if ( bAskFor && GetState(ID_BROWSER_SAVERECORD).bEnabled ) { getBrowserView()->getVclControl()->GrabFocus(); @@ -2136,6 +2197,7 @@ sal_Bool SbaXDataBrowserController::SaveModified(sal_Bool bAskFor) //------------------------------------------------------------------------------ sal_Bool SbaXDataBrowserController::CommitCurrent() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::CommitCurrent" ); if (!getBrowserView()) return sal_True; @@ -2157,6 +2219,7 @@ sal_Bool SbaXDataBrowserController::CommitCurrent() //------------------------------------------------------------------------------ void SbaXDataBrowserController::setCurrentModified( sal_Bool _bSet ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::setCurrentModified" ); m_bCurrentlyModified = _bSet; InvalidateFeature( ID_BROWSER_SAVERECORD ); InvalidateFeature( ID_BROWSER_UNDORECORD ); @@ -2165,12 +2228,14 @@ void SbaXDataBrowserController::setCurrentModified( sal_Bool _bSet ) //------------------------------------------------------------------------------ void SbaXDataBrowserController::RowChanged() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::RowChanged" ); setCurrentModified( sal_False ); } //------------------------------------------------------------------------------ void SbaXDataBrowserController::ColumnChanged() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::ColumnChanged" ); InvalidateFeature(ID_BROWSER_SORTUP); InvalidateFeature(ID_BROWSER_SORTDOWN); InvalidateFeature(ID_BROWSER_ORDERCRIT); @@ -2184,12 +2249,14 @@ void SbaXDataBrowserController::ColumnChanged() //------------------------------------------------------------------------------ void SbaXDataBrowserController::SelectionChanged() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::SelectionChanged" ); // not interested in } //------------------------------------------------------------------------------ void SbaXDataBrowserController::CellActivated() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::CellActivated" ); m_aInvalidateClipboard.Start(); OnInvalidateClipboard( NULL ); } @@ -2197,6 +2264,7 @@ void SbaXDataBrowserController::CellActivated() //------------------------------------------------------------------------------ void SbaXDataBrowserController::CellDeactivated() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::CellDeactivated" ); m_aInvalidateClipboard.Stop(); OnInvalidateClipboard( NULL ); } @@ -2262,6 +2330,7 @@ IMPL_LINK(SbaXDataBrowserController, OnInvalidateClipboard, AutoTimer*, _pTimer) // ------------------------------------------------------------------------- Reference< XPropertySet > SbaXDataBrowserController::getBoundField(sal_uInt16 nViewPos) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::SaveData" ); Reference< XPropertySet > xEmptyReturn; // get the current column from the grid @@ -2464,27 +2533,41 @@ IMPL_LINK(SbaXDataBrowserController, OnAsyncGetCellFocus, void*, EMPTYARG) //------------------------------------------------------------------------------ void SbaXDataBrowserController::criticalFail() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::criticalFail" ); InvalidateAll(); } //------------------------------------------------------------------------------ void SbaXDataBrowserController::LoadFinished(sal_Bool /*bWasSynch*/) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::LoadFinished" ); if (isValid() && !loadingCancelled()) { // -------------------------------- // switch the control to alive mode getBrowserView()->getGridControl()->setDesignMode(sal_False); + // ------------------------------- + InvalidateAll(); + + m_aAsyncGetCellFocus.Call(); + } +} +// ----------------------------------------------------------------------------- +void SbaXDataBrowserController::initializeParser() const +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::initializeParser" ); + if ( !m_xParser.is() ) + { // ---------------------------------------------- // create a parser (needed for filtering/sorting) try { - Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY); + const Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY); if (::comphelper::getBOOL(xFormSet->getPropertyValue(PROPERTY_ESCAPE_PROCESSING))) { // (only if the statement isn't native) // (it is allowed to use the PROPERTY_ISPASSTHROUGH : _after_ loading a form it is valid) - Reference<XMultiServiceFactory> xFactory(::dbtools::getConnection(getRowSet()),UNO_QUERY); + const Reference<XMultiServiceFactory> xFactory(::dbtools::getConnection(getRowSet()),UNO_QUERY); if ( xFactory.is() ) m_xParser.set(xFactory->createInstance(SERVICE_NAME_SINGLESELECTQUERYCOMPOSER),UNO_QUERY); } @@ -2500,20 +2583,16 @@ void SbaXDataBrowserController::LoadFinished(sal_Bool /*bWasSynch*/) } catch(Exception&) { - DBG_WARNING("SbaXDataBrowserController::LoadFinished: something went wrong while creating the parser !"); + DBG_WARNING("SbaXDataBrowserController::initializeParser: something went wrong while creating the parser !"); m_xParser = NULL; // no further handling, we ignore the error } - - // ------------------------------- - InvalidateAll(); - - m_aAsyncGetCellFocus.Call(); } } //------------------------------------------------------------------------------ void SbaXDataBrowserController::loaded(const EventObject& /*aEvent*/) throw( RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::loaded" ); // not interested in // we're loading within an separate thread and have a handling for it's "finished event" } @@ -2521,12 +2600,14 @@ void SbaXDataBrowserController::loaded(const EventObject& /*aEvent*/) throw( Run //------------------------------------------------------------------------------ void SbaXDataBrowserController::unloading(const EventObject& /*aEvent*/) throw( RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::unloading" ); // not interested in } //------------------------------------------------------------------------------ void SbaXDataBrowserController::unloaded(const EventObject& /*aEvent*/) throw( RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::unloaded" ); InvalidateAll(); // do this asynchron, there are other listeners reacting on this message ... // (it's a little hack : the grid columns are listening to this event, too, and their bound field may @@ -2546,12 +2627,14 @@ void SbaXDataBrowserController::unloaded(const EventObject& /*aEvent*/) throw( R //------------------------------------------------------------------------------ void SbaXDataBrowserController::reloading(const EventObject& /*aEvent*/) throw( RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::reloading" ); // not interested in } //------------------------------------------------------------------------------ void SbaXDataBrowserController::reloaded(const EventObject& /*aEvent*/) throw( RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::reloaded" ); InvalidateAll(); // do this asynchronously, there are other listeners reacting on this message ... // (it's a little hack : the grid columns are listening to this event, too, and their bound field may @@ -2562,6 +2645,7 @@ void SbaXDataBrowserController::reloaded(const EventObject& /*aEvent*/) throw( R //------------------------------------------------------------------------------ void SbaXDataBrowserController::enterFormAction() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::enterFormAction" ); if (!m_nFormActionNestingLevel) // first action -> reset flag m_bErrorOccured = false; @@ -2572,6 +2656,7 @@ void SbaXDataBrowserController::enterFormAction() //------------------------------------------------------------------------------ void SbaXDataBrowserController::leaveFormAction() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::leaveFormAction" ); DBG_ASSERT(m_nFormActionNestingLevel > 0, "SbaXDataBrowserController::leaveFormAction : invalid call !"); --m_nFormActionNestingLevel; } @@ -2579,21 +2664,32 @@ void SbaXDataBrowserController::leaveFormAction() // ------------------------------------------------------------------------- sal_Bool SbaXDataBrowserController::isLoaded() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::isLoaded" ); return m_xLoadable.is() && m_xLoadable->isLoaded(); } // ------------------------------------------------------------------------- sal_Bool SbaXDataBrowserController::isValidCursor() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::isValidCursor" ); if (!m_xColumnsSupplier.is()) return sal_False; Reference< ::com::sun::star::container::XNameAccess > xCols = m_xColumnsSupplier->getColumns(); if (!xCols.is() || !xCols->hasElements()) return sal_False; - Reference<XPropertySet> xProp(m_xRowSet,UNO_QUERY); - return ::cppu::any2bool(xProp->getPropertyValue(PROPERTY_ISNEW)) || !(m_xRowSet->isBeforeFirst() || m_xRowSet->isAfterLast()) || - (m_xParser.is() && (m_xParser->getFilter().getLength() || m_xParser->getHavingClause().getLength() || m_xParser->getOrder().getLength())); + sal_Bool bIsValid = !(m_xRowSet->isBeforeFirst() || m_xRowSet->isAfterLast()); + if ( !bIsValid ) + { + Reference<XPropertySet> xProp(m_xRowSet,UNO_QUERY); + bIsValid = ::cppu::any2bool(xProp->getPropertyValue(PROPERTY_ISNEW)); + if ( !bIsValid ) + { + initializeParser(); + bIsValid = (m_xParser.is() && (m_xParser->getFilter().getLength() || m_xParser->getHavingClause().getLength() || m_xParser->getOrder().getLength())); + } + } // if ( !bIsValid ) + return bIsValid; } //================================================================== @@ -2935,6 +3031,7 @@ IMPL_LINK(LoadFormThread::ThreadStopper, OnDeleteInMainThread, LoadFormThread::T // ----------------------------------------------------------------------------- sal_Int16 SbaXDataBrowserController::getCurrentColumnPosition() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::getCurrentColumnPosition" ); Reference< ::com::sun::star::form::XGrid > xGrid(getBrowserView()->getGridControl(), UNO_QUERY); sal_Int16 nViewPos = -1; try @@ -2948,6 +3045,7 @@ sal_Int16 SbaXDataBrowserController::getCurrentColumnPosition() // ----------------------------------------------------------------------------- void SbaXDataBrowserController::setCurrentColumnPosition( sal_Int16 _nPos ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::setCurrentColumnPosition" ); Reference< ::com::sun::star::form::XGrid > xGrid(getBrowserView()->getGridControl(), UNO_QUERY); try { @@ -2959,6 +3057,7 @@ void SbaXDataBrowserController::setCurrentColumnPosition( sal_Int16 _nPos ) // ----------------------------------------------------------------------------- void SbaXDataBrowserController::BeforeDrop() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::BeforeDrop" ); Reference< ::com::sun::star::sdb::XSQLErrorBroadcaster > xFormError(getRowSet(), UNO_QUERY); if (xFormError.is()) xFormError->removeSQLErrorListener((::com::sun::star::sdb::XSQLErrorListener*)this); @@ -2966,6 +3065,7 @@ void SbaXDataBrowserController::BeforeDrop() // ----------------------------------------------------------------------------- void SbaXDataBrowserController::AfterDrop() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::AfterDrop" ); Reference< ::com::sun::star::sdb::XSQLErrorBroadcaster > xFormError(getRowSet(), UNO_QUERY); if (xFormError.is()) xFormError->addSQLErrorListener((::com::sun::star::sdb::XSQLErrorListener*)this); @@ -2973,6 +3073,7 @@ void SbaXDataBrowserController::AfterDrop() // ----------------------------------------------------------------------------- void SbaXDataBrowserController::addColumnListeners(const Reference< ::com::sun::star::awt::XControlModel > & _xGridControlModel) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::addColumnListeners" ); // ... all the grid columns Reference< ::com::sun::star::container::XIndexContainer > xColumns(_xGridControlModel, UNO_QUERY); if (xColumns.is()) @@ -2988,6 +3089,7 @@ void SbaXDataBrowserController::addColumnListeners(const Reference< ::com::sun:: // ----------------------------------------------------------------------------- sal_Bool SbaXDataBrowserController::InitializeGridModel(const Reference< ::com::sun::star::form::XFormComponent > & /*xGrid*/) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::InitializeGridModel" ); return sal_True; } //.................................................................. diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx index 86dc62eda2de..57a4a9270c25 100644 --- a/dbaccess/source/ui/browser/unodatbr.cxx +++ b/dbaccess/source/ui/browser/unodatbr.cxx @@ -133,6 +133,7 @@ #include <vcl/toolbox.hxx> #include <vcl/waitobj.hxx> #include <vcl/wrkwin.hxx> +#include <rtl/logfile.hxx> #include <memory> @@ -194,21 +195,25 @@ void SafeRemovePropertyListener(const Reference< XPropertySet > & xSet, const :: //------------------------------------------------------------------------- ::rtl::OUString SAL_CALL SbaTableQueryBrowser::getImplementationName() throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getImplementationName" ); return getImplementationName_Static(); } //------------------------------------------------------------------------- ::comphelper::StringSequence SAL_CALL SbaTableQueryBrowser::getSupportedServiceNames() throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getSupportedServiceNames" ); return getSupportedServiceNames_Static(); } // ------------------------------------------------------------------------- ::rtl::OUString SbaTableQueryBrowser::getImplementationName_Static() throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getImplementationName_Static" ); return ::rtl::OUString::createFromAscii("org.openoffice.comp.dbu.ODatasourceBrowser"); } //------------------------------------------------------------------------- ::comphelper::StringSequence SbaTableQueryBrowser::getSupportedServiceNames_Static() throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getSupportedServiceNames_Static" ); ::comphelper::StringSequence aSupported(1); aSupported.getArray()[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdb.DataSourceBrowser"); return aSupported; @@ -216,6 +221,7 @@ void SafeRemovePropertyListener(const Reference< XPropertySet > & xSet, const :: //------------------------------------------------------------------------- Reference< XInterface > SAL_CALL SbaTableQueryBrowser::Create(const Reference<XMultiServiceFactory >& _rxFactory) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::Create" ); ::vos::OGuard aGuard(Application::GetSolarMutex()); return *(new SbaTableQueryBrowser(_rxFactory)); } @@ -238,6 +244,7 @@ SbaTableQueryBrowser::SbaTableQueryBrowser(const Reference< XMultiServiceFactory ,m_bInSuspend(sal_False) ,m_bEnableBrowser(sal_True) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::SbaTableQueryBrowser" ); DBG_CTOR(SbaTableQueryBrowser,NULL); } @@ -257,6 +264,7 @@ SbaTableQueryBrowser::~SbaTableQueryBrowser() //------------------------------------------------------------------------------ Any SAL_CALL SbaTableQueryBrowser::queryInterface(const Type& _rType) throw (RuntimeException) { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::queryInterface" ); if ( _rType.equals( XScriptInvocationContext::static_type() ) ) { OSL_PRECOND( !!m_aDocScriptSupport, "SbaTableQueryBrowser::queryInterface: did not initialize this, yet!" ); @@ -274,6 +282,7 @@ Any SAL_CALL SbaTableQueryBrowser::queryInterface(const Type& _rType) throw (Run //------------------------------------------------------------------------------ Sequence< Type > SAL_CALL SbaTableQueryBrowser::getTypes( ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getTypes" ); Sequence< Type > aTypes( ::comphelper::concatSequences( SbaXDataBrowserController::getTypes(), SbaTableQueryBrowser_Base::getTypes() @@ -297,6 +306,7 @@ Sequence< Type > SAL_CALL SbaTableQueryBrowser::getTypes( ) throw (RuntimeExcep //------------------------------------------------------------------------------ Sequence< sal_Int8 > SAL_CALL SbaTableQueryBrowser::getImplementationId( ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getImplementationId" ); static ::cppu::OImplementationId * pId = 0; if (! pId) { @@ -313,6 +323,7 @@ Sequence< sal_Int8 > SAL_CALL SbaTableQueryBrowser::getImplementationId( ) thro //------------------------------------------------------------------------------ void SAL_CALL SbaTableQueryBrowser::disposing() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::disposing" ); ::vos::OGuard aGuard(Application::GetSolarMutex()); // doin' a lot of VCL stuff here -> lock the SolarMutex @@ -351,6 +362,7 @@ void SAL_CALL SbaTableQueryBrowser::disposing() //------------------------------------------------------------------------------ sal_Bool SbaTableQueryBrowser::Construct(Window* pParent) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::Construct" ); if (!SbaXDataBrowserController::Construct(pParent)) return sal_False; @@ -419,6 +431,7 @@ sal_Bool SbaTableQueryBrowser::Construct(Window* pParent) // ------------------------------------------------------------------------- sal_Bool SbaTableQueryBrowser::InitializeForm(const Reference< ::com::sun::star::sdbc::XRowSet > & _rxForm) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::InitializeForm" ); if(!m_pCurrentlyDisplayed) return sal_True; @@ -475,6 +488,7 @@ sal_Bool SbaTableQueryBrowser::InitializeForm(const Reference< ::com::sun::star: //------------------------------------------------------------------------------ void SbaTableQueryBrowser::initializePreviewMode() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::initializePreviewMode" ); if ( getBrowserView() && getBrowserView()->getVclControl() ) { getBrowserView()->getVclControl()->AlwaysEnableInput( FALSE ); @@ -493,6 +507,7 @@ void SbaTableQueryBrowser::initializePreviewMode() //------------------------------------------------------------------------------ sal_Bool SbaTableQueryBrowser::InitializeGridModel(const Reference< ::com::sun::star::form::XFormComponent > & xGrid) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::InitializeGridModel" ); try { Reference< ::com::sun::star::form::XGridColumnFactory > xColFactory(xGrid, UNO_QUERY); @@ -723,6 +738,7 @@ Reference<XPropertySet> getColumnHelper(SvLBoxEntry* _pCurrentlyDisplayed,const // ----------------------------------------------------------------------- void SbaTableQueryBrowser::transferChangedControlProperty(const ::rtl::OUString& _rProperty, const Any& _rNewValue) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::transferChangedControlProperty" ); if(m_pCurrentlyDisplayed) { DBTreeListUserData* pData = static_cast<DBTreeListUserData*>(m_pCurrentlyDisplayed->GetUserData()); @@ -736,6 +752,7 @@ void SbaTableQueryBrowser::transferChangedControlProperty(const ::rtl::OUString& // ----------------------------------------------------------------------- void SbaTableQueryBrowser::propertyChange(const PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::propertyChange" ); SbaXDataBrowserController::propertyChange(evt); try @@ -844,6 +861,7 @@ void SbaTableQueryBrowser::propertyChange(const PropertyChangeEvent& evt) throw( // ----------------------------------------------------------------------- sal_Bool SbaTableQueryBrowser::suspend(sal_Bool bSuspend) throw( RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::suspend" ); vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::MutexGuard aGuard( getMutex() ); if ( getView() && getView()->IsInModalMode() ) @@ -868,6 +886,7 @@ sal_Bool SbaTableQueryBrowser::suspend(sal_Bool bSuspend) throw( RuntimeExceptio // ------------------------------------------------------------------------- void SAL_CALL SbaTableQueryBrowser::statusChanged( const FeatureStateEvent& _rEvent ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::statusChanged" ); // search the external dispatcher causing this call Reference< XDispatch > xSource(_rEvent.Source, UNO_QUERY); ExternalFeaturesMap::iterator aLoop; @@ -922,6 +941,7 @@ void SAL_CALL SbaTableQueryBrowser::statusChanged( const FeatureStateEvent& _rEv // ------------------------------------------------------------------------- void SbaTableQueryBrowser::checkDocumentDataSource() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::checkDocumentDataSource" ); SvLBoxEntry* pDataSourceEntry = NULL; SvLBoxEntry* pContainerEntry = NULL; SvLBoxEntry* pObjectEntry = getObjectEntry( m_aDocumentDataSource, &pDataSourceEntry, &pContainerEntry, sal_False ); @@ -959,6 +979,7 @@ void SbaTableQueryBrowser::checkDocumentDataSource() // ------------------------------------------------------------------------- void SbaTableQueryBrowser::extractDescriptorProps(const ::svx::ODataAccessDescriptor& _rDescriptor, ::rtl::OUString& _rDataSource, ::rtl::OUString& _rCommand, sal_Int32& _rCommandType, sal_Bool& _rEscapeProcessing) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::extractDescriptorProps" ); _rDataSource = _rDescriptor.getDataSource(); if ( _rDescriptor.has(daCommand) ) _rDescriptor[daCommand] >>= _rCommand; @@ -1010,6 +1031,7 @@ namespace // ------------------------------------------------------------------------- String SbaTableQueryBrowser::getDataSourceAcessor( SvLBoxEntry* _pDataSourceEntry ) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getDataSourceAcessor" ); DBG_ASSERT( _pDataSourceEntry, "SbaTableQueryBrowser::getDataSourceAcessor: invalid entry!" ); DBTreeListUserData* pData = static_cast< DBTreeListUserData* >( _pDataSourceEntry->GetUserData() ); @@ -1023,6 +1045,7 @@ SvLBoxEntry* SbaTableQueryBrowser::getObjectEntry(const ::rtl::OUString& _rDataS SvLBoxEntry** _ppDataSourceEntry, SvLBoxEntry** _ppContainerEntry, sal_Bool _bExpandAncestors, const SharedConnection& _rxConnection ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getObjectEntry" ); if (_ppDataSourceEntry) *_ppDataSourceEntry = NULL; if (_ppContainerEntry) @@ -1097,6 +1120,7 @@ SvLBoxEntry* SbaTableQueryBrowser::getObjectEntry(const ::svx::ODataAccessDescri SvLBoxEntry** _ppDataSourceEntry, SvLBoxEntry** _ppContainerEntry, sal_Bool _bExpandAncestors) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getObjectEntry" ); // extract the props from the descriptor ::rtl::OUString sDataSource; ::rtl::OUString sCommand; @@ -1110,6 +1134,7 @@ SvLBoxEntry* SbaTableQueryBrowser::getObjectEntry(const ::svx::ODataAccessDescri // ------------------------------------------------------------------------- void SbaTableQueryBrowser::connectExternalDispatches() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::connectExternalDispatches" ); Reference< XDispatchProvider > xProvider( getFrame(), UNO_QUERY ); DBG_ASSERT(xProvider.is(), "SbaTableQueryBrowser::connectExternalDispatches: no DispatchProvider !"); if (xProvider.is()) @@ -1176,6 +1201,7 @@ void SbaTableQueryBrowser::connectExternalDispatches() // ------------------------------------------------------------------------- void SbaTableQueryBrowser::implCheckExternalSlot( sal_uInt16 _nId ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::implCheckExternalSlot" ); if ( !m_xMainToolbar.is() ) return; @@ -1198,6 +1224,7 @@ void SbaTableQueryBrowser::implCheckExternalSlot( sal_uInt16 _nId ) // ------------------------------------------------------------------------- void SAL_CALL SbaTableQueryBrowser::disposing( const EventObject& _rSource ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::disposing" ); // our frame ? Reference< ::com::sun::star::frame::XFrame > xSourceFrame(_rSource.Source, UNO_QUERY); if (m_xCurrentFrameParent.is() && (xSourceFrame == m_xCurrentFrameParent)) @@ -1260,6 +1287,7 @@ void SAL_CALL SbaTableQueryBrowser::disposing( const EventObject& _rSource ) thr // ------------------------------------------------------------------------- void SbaTableQueryBrowser::implRemoveStatusListeners() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::implRemoveStatusListeners" ); // clear all old dispatches for ( ExternalFeaturesMap::const_iterator aLoop = m_aExternalFeatures.begin(); aLoop != m_aExternalFeatures.end(); @@ -1284,6 +1312,7 @@ void SbaTableQueryBrowser::implRemoveStatusListeners() // ------------------------------------------------------------------------- sal_Bool SAL_CALL SbaTableQueryBrowser::select( const Any& _rSelection ) throw (IllegalArgumentException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::select" ); ::vos::OGuard aGuard(Application::GetSolarMutex()); // doin' a lot of VCL stuff here -> lock the SolarMutex @@ -1313,6 +1342,7 @@ sal_Bool SAL_CALL SbaTableQueryBrowser::select( const Any& _rSelection ) throw ( // ------------------------------------------------------------------------- Any SAL_CALL SbaTableQueryBrowser::getSelection( ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getSelection" ); Any aReturn; try @@ -1340,18 +1370,21 @@ Any SAL_CALL SbaTableQueryBrowser::getSelection( ) throw (RuntimeException) // ------------------------------------------------------------------------- void SAL_CALL SbaTableQueryBrowser::addSelectionChangeListener( const Reference< XSelectionChangeListener >& _rxListener ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::addSelectionChangeListener" ); m_aSelectionListeners.addInterface(_rxListener); } // ------------------------------------------------------------------------- void SAL_CALL SbaTableQueryBrowser::removeSelectionChangeListener( const Reference< XSelectionChangeListener >& _rxListener ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::removeSelectionChangeListener" ); m_aSelectionListeners.removeInterface(_rxListener); } // ------------------------------------------------------------------------- void SbaTableQueryBrowser::attachFrame(const Reference< ::com::sun::star::frame::XFrame > & _xFrame) throw( RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::attachFrame" ); implRemoveStatusListeners(); if (m_xCurrentFrameParent.is()) @@ -1396,6 +1429,7 @@ void SbaTableQueryBrowser::attachFrame(const Reference< ::com::sun::star::frame: // ------------------------------------------------------------------------- void SbaTableQueryBrowser::addModelListeners(const Reference< ::com::sun::star::awt::XControlModel > & _xGridControlModel) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::addModelListeners" ); SbaXDataBrowserController::addModelListeners(_xGridControlModel); Reference< XPropertySet > xSourceSet(_xGridControlModel, UNO_QUERY); if (xSourceSet.is()) @@ -1413,6 +1447,7 @@ void SbaTableQueryBrowser::addModelListeners(const Reference< ::com::sun::star:: // ------------------------------------------------------------------------- void SbaTableQueryBrowser::removeModelListeners(const Reference< ::com::sun::star::awt::XControlModel > & _xGridControlModel) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::removeModelListeners" ); SbaXDataBrowserController::removeModelListeners(_xGridControlModel); Reference< XPropertySet > xSourceSet(_xGridControlModel, UNO_QUERY); if (xSourceSet.is()) @@ -1428,6 +1463,7 @@ void SbaTableQueryBrowser::removeModelListeners(const Reference< ::com::sun::sta // ------------------------------------------------------------------------- void SbaTableQueryBrowser::RowChanged() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::RowChanged" ); if(getBrowserView()) { SbaGridControl* pControl = getBrowserView()->getVclControl(); @@ -1440,6 +1476,7 @@ void SbaTableQueryBrowser::RowChanged() // ------------------------------------------------------------------------- void SbaTableQueryBrowser::ColumnChanged() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::ColumnChanged" ); if(getBrowserView()) { SbaGridControl* pControl = getBrowserView()->getVclControl(); @@ -1451,6 +1488,7 @@ void SbaTableQueryBrowser::ColumnChanged() //------------------------------------------------------------------------------ void SbaTableQueryBrowser::AddColumnListener(const Reference< XPropertySet > & xCol) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::AddColumnListener" ); SbaXDataBrowserController::AddColumnListener(xCol); SafeAddPropertyListener(xCol, PROPERTY_WIDTH, static_cast<XPropertyChangeListener*>(this)); SafeAddPropertyListener(xCol, PROPERTY_HIDDEN, static_cast<XPropertyChangeListener*>(this)); @@ -1461,6 +1499,7 @@ void SbaTableQueryBrowser::AddColumnListener(const Reference< XPropertySet > & x //------------------------------------------------------------------------------ void SbaTableQueryBrowser::RemoveColumnListener(const Reference< XPropertySet > & xCol) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::RemoveColumnListener" ); SbaXDataBrowserController::RemoveColumnListener(xCol); SafeRemovePropertyListener(xCol, PROPERTY_WIDTH, static_cast<XPropertyChangeListener*>(this)); SafeRemovePropertyListener(xCol, PROPERTY_HIDDEN, static_cast<XPropertyChangeListener*>(this)); @@ -1471,6 +1510,7 @@ void SbaTableQueryBrowser::RemoveColumnListener(const Reference< XPropertySet > //------------------------------------------------------------------------------ void SbaTableQueryBrowser::criticalFail() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::criticalFail" ); SbaXDataBrowserController::criticalFail(); unloadAndCleanup( sal_False ); } @@ -1478,6 +1518,7 @@ void SbaTableQueryBrowser::criticalFail() //------------------------------------------------------------------------------ void SbaTableQueryBrowser::LoadFinished(sal_Bool _bWasSynch) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::LoadFinished" ); SbaXDataBrowserController::LoadFinished(_bWasSynch); m_sQueryCommand = ::rtl::OUString(); @@ -1518,6 +1559,7 @@ void SbaTableQueryBrowser::LoadFinished(sal_Bool _bWasSynch) //------------------------------------------------------------------------------ sal_Bool SbaTableQueryBrowser::getExternalSlotState( sal_uInt16 _nId ) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getExternalSlotState" ); sal_Bool bEnabled = sal_False; ExternalFeaturesMap::const_iterator aPos = m_aExternalFeatures.find( _nId ); if ( ( m_aExternalFeatures.end() != aPos ) && aPos->second.xDispatcher.is() ) @@ -1528,6 +1570,7 @@ sal_Bool SbaTableQueryBrowser::getExternalSlotState( sal_uInt16 _nId ) const //------------------------------------------------------------------------------ FeatureState SbaTableQueryBrowser::GetState(sal_uInt16 nId) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::GetState" ); FeatureState aReturn; // (disabled automatically) @@ -1723,6 +1766,7 @@ FeatureState SbaTableQueryBrowser::GetState(sal_uInt16 nId) const //------------------------------------------------------------------------------ void SbaTableQueryBrowser::Execute(sal_uInt16 nId, const Sequence< PropertyValue >& aArgs) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::Execute" ); switch (nId) { default: @@ -1913,6 +1957,7 @@ void SbaTableQueryBrowser::implAddDatasource(const String& _rDbName, Image& _rDb String& _rQueryName, Image& _rQueryImage, String& _rTableName, Image& _rTableImage, const SharedConnection& _rxConnection) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::implAddDatasource" ); vos::OGuard aGuard( Application::GetSolarMutex() ); // initialize the names/images if necessary if (!_rQueryName.Len()) @@ -1966,6 +2011,7 @@ void SbaTableQueryBrowser::implAddDatasource(const String& _rDbName, Image& _rDb // ------------------------------------------------------------------------- void SbaTableQueryBrowser::initializeTreeModel() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::initializeTreeModel" ); if (m_xDatabaseContext.is()) { Image aDBImage, aQueriesImage, aTablesImage; @@ -1984,6 +2030,7 @@ sal_Bool SbaTableQueryBrowser::populateTree(const Reference<XNameAccess>& _xName SvLBoxEntry* _pParent, EntryType _eEntryType) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::populateTree" ); DBTreeListUserData* pData = static_cast<DBTreeListUserData*>(_pParent->GetUserData()); if(pData) // don't ask if the nameaccess is already set see OnExpandEntry views and tables pData->xContainer = _xNameAccess; @@ -2014,6 +2061,7 @@ sal_Bool SbaTableQueryBrowser::populateTree(const Reference<XNameAccess>& _xName //------------------------------------------------------------------------------ void SbaTableQueryBrowser::implAppendEntry( SvLBoxEntry* _pParent, const String& _rName, void* _pUserData, EntryType _eEntryType ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::implAppendEntry" ); ::std::auto_ptr< ImageProvider > pImageProvider( getImageProviderFor( _pParent ) ); Image aImage, aImageHC; @@ -2030,6 +2078,7 @@ void SbaTableQueryBrowser::implAppendEntry( SvLBoxEntry* _pParent, const String& //------------------------------------------------------------------------------ IMPL_LINK(SbaTableQueryBrowser, OnExpandEntry, SvLBoxEntry*, _pParent) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::OnExpandEntry" ); if (_pParent->HasChilds()) // nothing to to ... return 1L; @@ -2132,6 +2181,7 @@ IMPL_LINK(SbaTableQueryBrowser, OnExpandEntry, SvLBoxEntry*, _pParent) //------------------------------------------------------------------------------ sal_Bool SbaTableQueryBrowser::ensureEntryObject( SvLBoxEntry* _pEntry ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::ensureEntryObject" ); DBG_ASSERT(_pEntry, "SbaTableQueryBrowser::ensureEntryObject: invalid argument!"); if (!_pEntry) return sal_False; @@ -2191,6 +2241,7 @@ sal_Bool SbaTableQueryBrowser::ensureEntryObject( SvLBoxEntry* _pEntry ) //------------------------------------------------------------------------------ sal_Bool SbaTableQueryBrowser::implSelect(const ::svx::ODataAccessDescriptor& _rDescriptor,sal_Bool _bSelectDirect) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::implSelect(_rDescriptor,_bSelectDirect)" ); // extract the props ::rtl::OUString sDataSource; ::rtl::OUString sCommand; @@ -2206,6 +2257,7 @@ sal_Bool SbaTableQueryBrowser::implSelect(const ::svx::ODataAccessDescriptor& _r sal_Bool SbaTableQueryBrowser::implLoadAnything(const ::rtl::OUString& _rDataSourceName, const ::rtl::OUString& _rCommand, const sal_Int32 _nCommandType, const sal_Bool _bEscapeProcessing, const SharedConnection& _rxConnection) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::implLoadAnything" ); Reference<XPropertySet> xProp(getRowSet(),UNO_QUERY); if(xProp.is()) { @@ -2287,6 +2339,7 @@ sal_Bool SbaTableQueryBrowser::implSelect(const ::rtl::OUString& _rDataSourceNam const SharedConnection& _rxConnection ,sal_Bool _bSelectDirect) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::implSelect(_rDataSourceName,_rCommand,...)" ); if (_rDataSourceName.getLength() && _rCommand.getLength() && (-1 != _nCommandType)) { SvLBoxEntry* pDataSource = NULL; @@ -2332,6 +2385,7 @@ IMPL_LINK(SbaTableQueryBrowser, OnSelectionChange, void*, /*NOINTERESTEDIN*/) //------------------------------------------------------------------------------ bool SbaTableQueryBrowser::implSelect( SvLBoxEntry* _pEntry ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::implSelect(_pEntry)" ); if ( !_pEntry ) return false; @@ -2525,6 +2579,7 @@ bool SbaTableQueryBrowser::implSelect( SvLBoxEntry* _pEntry ) // ----------------------------------------------------------------------------- SvLBoxEntry* SbaTableQueryBrowser::getEntryFromContainer(const Reference<XNameAccess>& _rxNameAccess) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getEntryFromContainer" ); DBTreeListBox& rListBox = m_pTreeView->getListBox(); SvLBoxEntry* pContainer = NULL; SvLBoxEntry* pDSLoop = rListBox.FirstChild(NULL); @@ -2549,6 +2604,7 @@ SvLBoxEntry* SbaTableQueryBrowser::getEntryFromContainer(const Reference<XNameAc // ------------------------------------------------------------------------- void SAL_CALL SbaTableQueryBrowser::elementInserted( const ContainerEvent& _rEvent ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::elementInserted" ); vos::OGuard aSolarGuard( Application::GetSolarMutex() ); Reference< XNameAccess > xNames(_rEvent.Source, UNO_QUERY); @@ -2597,6 +2653,7 @@ void SAL_CALL SbaTableQueryBrowser::elementInserted( const ContainerEvent& _rEve // ------------------------------------------------------------------------- sal_Bool SbaTableQueryBrowser::isCurrentlyDisplayedChanged(const String& _sName,SvLBoxEntry* _pContainer) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::isCurrentlyDisplayedChanged" ); return m_pCurrentlyDisplayed && getEntryType(m_pCurrentlyDisplayed) == getChildType(_pContainer) && m_pTreeView->getListBox().GetParent(m_pCurrentlyDisplayed) == _pContainer @@ -2605,6 +2662,7 @@ sal_Bool SbaTableQueryBrowser::isCurrentlyDisplayedChanged(const String& _sName, // ------------------------------------------------------------------------- void SAL_CALL SbaTableQueryBrowser::elementRemoved( const ContainerEvent& _rEvent ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::elementRemoved" ); ::vos::OGuard aSolarGuard(Application::GetSolarMutex()); Reference< XNameAccess > xNames(_rEvent.Source, UNO_QUERY); @@ -2714,6 +2772,7 @@ void SAL_CALL SbaTableQueryBrowser::elementRemoved( const ContainerEvent& _rEven // ------------------------------------------------------------------------- void SAL_CALL SbaTableQueryBrowser::elementReplaced( const ContainerEvent& _rEvent ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::elementReplaced" ); ::vos::OGuard aSolarGuard(Application::GetSolarMutex()); Reference< XNameAccess > xNames(_rEvent.Source, UNO_QUERY); @@ -2786,6 +2845,7 @@ void SAL_CALL SbaTableQueryBrowser::elementReplaced( const ContainerEvent& _rEve // ------------------------------------------------------------------------- void SbaTableQueryBrowser::impl_releaseConnection( SharedConnection& _rxConnection ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::impl_releaseConnection" ); // remove as event listener Reference< XComponent > xComponent( _rxConnection, UNO_QUERY ); if ( xComponent.is() ) @@ -2814,6 +2874,7 @@ void SbaTableQueryBrowser::impl_releaseConnection( SharedConnection& _rxConnecti // ------------------------------------------------------------------------- void SbaTableQueryBrowser::disposeConnection( SvLBoxEntry* _pDSEntry ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::disposeConnection" ); DBG_ASSERT( _pDSEntry, "SbaTableQueryBrowser::disposeConnection: invalid entry (NULL)!" ); DBG_ASSERT( impl_isDataSourceEntry( _pDSEntry ), "SbaTableQueryBrowser::disposeConnection: invalid entry (not top-level)!" ); @@ -2828,6 +2889,7 @@ void SbaTableQueryBrowser::disposeConnection( SvLBoxEntry* _pDSEntry ) // ------------------------------------------------------------------------- void SbaTableQueryBrowser::closeConnection(SvLBoxEntry* _pDSEntry,sal_Bool _bDisposeConnection) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::closeConnection" ); DBG_ASSERT(_pDSEntry, "SbaTableQueryBrowser::closeConnection: invalid entry (NULL)!"); DBG_ASSERT( impl_isDataSourceEntry( _pDSEntry ), "SbaTableQueryBrowser::closeConnection: invalid entry (not top-level)!"); @@ -2864,6 +2926,7 @@ void SbaTableQueryBrowser::closeConnection(SvLBoxEntry* _pDSEntry,sal_Bool _bDis // ------------------------------------------------------------------------- void SbaTableQueryBrowser::unloadAndCleanup( sal_Bool _bDisposeConnection ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::unloadAndCleanup" ); if (!m_pCurrentlyDisplayed) // nothing to do return; @@ -2951,6 +3014,7 @@ namespace // ------------------------------------------------------------------------- void SbaTableQueryBrowser::impl_initialize() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::impl_initialize" ); ::vos::OGuard aGuard(Application::GetSolarMutex()); // doin' a lot of VCL stuff here -> lock the SolarMutex @@ -3130,12 +3194,14 @@ void SbaTableQueryBrowser::impl_initialize() // ------------------------------------------------------------------------- sal_Bool SbaTableQueryBrowser::haveExplorer() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::haveExplorer" ); return m_pTreeView && m_pTreeView->IsVisible(); } // ------------------------------------------------------------------------- void SbaTableQueryBrowser::hideExplorer() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::hideExplorer" ); if (!haveExplorer()) return; if (!getBrowserView()) @@ -3151,6 +3217,7 @@ void SbaTableQueryBrowser::hideExplorer() // ------------------------------------------------------------------------- void SbaTableQueryBrowser::showExplorer() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::showExplorer" ); if (haveExplorer()) return; @@ -3167,6 +3234,7 @@ void SbaTableQueryBrowser::showExplorer() // ----------------------------------------------------------------------------- sal_Bool SbaTableQueryBrowser::ensureConnection(SvLBoxEntry* _pAnyEntry, SharedConnection& _rConnection) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::ensureConnection" ); SvLBoxEntry* pDSEntry = m_pTreeView->getListBox().GetRootLevelParent(_pAnyEntry); DBTreeListUserData* pDSData = pDSEntry @@ -3179,6 +3247,7 @@ sal_Bool SbaTableQueryBrowser::ensureConnection(SvLBoxEntry* _pAnyEntry, SharedC // ----------------------------------------------------------------------------- ::std::auto_ptr< ImageProvider > SbaTableQueryBrowser::getImageProviderFor( SvLBoxEntry* _pAnyEntry ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getImageProviderFor" ); ::std::auto_ptr< ImageProvider > pImageProvider( new ImageProvider ); SharedConnection xConnection; if ( getExistentConnectionFor( _pAnyEntry, xConnection ) ) @@ -3189,6 +3258,7 @@ sal_Bool SbaTableQueryBrowser::ensureConnection(SvLBoxEntry* _pAnyEntry, SharedC // ----------------------------------------------------------------------------- sal_Bool SbaTableQueryBrowser::getExistentConnectionFor( SvLBoxEntry* _pAnyEntry, SharedConnection& _rConnection ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getExistentConnectionFor" ); SvLBoxEntry* pDSEntry = m_pTreeView->getListBox().GetRootLevelParent( _pAnyEntry ); DBTreeListUserData* pDSData = pDSEntry @@ -3203,6 +3273,7 @@ sal_Bool SbaTableQueryBrowser::getExistentConnectionFor( SvLBoxEntry* _pAnyEntry // ----------------------------------------------------------------------------- bool SbaTableQueryBrowser::impl_isDataSourceEntry( SvLBoxEntry* _pEntry ) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::impl_isDataSourceEntry" ); return m_pTreeModel->GetRootLevelParent( _pEntry ) == _pEntry; } #endif @@ -3210,6 +3281,7 @@ bool SbaTableQueryBrowser::impl_isDataSourceEntry( SvLBoxEntry* _pEntry ) const // ----------------------------------------------------------------------------- sal_Bool SbaTableQueryBrowser::ensureConnection( SvLBoxEntry* _pDSEntry, void* pDSData, SharedConnection& _rConnection ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::ensureConnection" ); DBG_ASSERT( impl_isDataSourceEntry( _pDSEntry ), "SbaTableQueryBrowser::ensureConnection: this entry does not denote a data source!" ); if(_pDSEntry) { @@ -3312,6 +3384,7 @@ IMPL_LINK( SbaTableQueryBrowser, OnTreeEntryCompare, const SvSortData*, _pSortDa // ----------------------------------------------------------------------------- void SbaTableQueryBrowser::implAdministrate( SvLBoxEntry* _pApplyTo ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::implAdministrate" ); OSL_PRECOND( _pApplyTo, "SbaTableQueryBrowser::implAdministrate: illegal entry!" ); if ( !_pApplyTo ) return; @@ -3369,6 +3442,7 @@ void SbaTableQueryBrowser::implAdministrate( SvLBoxEntry* _pApplyTo ) // ----------------------------------------------------------------------------- sal_Bool SbaTableQueryBrowser::requestQuickHelp( const SvLBoxEntry* _pEntry, String& _rText ) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::requestQuickHelp" ); const DBTreeListUserData* pData = static_cast< const DBTreeListUserData* >( _pEntry->GetUserData() ); if ( ( pData->eType == etDatasource ) && pData->sAccessor.Len() ) { @@ -3381,6 +3455,7 @@ sal_Bool SbaTableQueryBrowser::requestQuickHelp( const SvLBoxEntry* _pEntry, Str // ----------------------------------------------------------------------------- PopupMenu* SbaTableQueryBrowser::getContextMenu( Control& _rControl ) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getContextMenu" ); OSL_PRECOND( &m_pTreeView->getListBox() == &_rControl, "SbaTableQueryBrowser::getContextMenu: where does this come from?" ); if ( &m_pTreeView->getListBox() != &_rControl ) @@ -3392,18 +3467,21 @@ PopupMenu* SbaTableQueryBrowser::getContextMenu( Control& _rControl ) const // ----------------------------------------------------------------------------- IController& SbaTableQueryBrowser::getCommandController() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getCommandController" ); return *this; } // ----------------------------------------------------------------------------- ::cppu::OInterfaceContainerHelper* SbaTableQueryBrowser::getContextMenuInterceptors() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getContextMenuInterceptors" ); return &m_aContextMenuInterceptors; } // ----------------------------------------------------------------------------- Any SbaTableQueryBrowser::getCurrentSelection( Control& _rControl ) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getCurrentSelection" ); OSL_PRECOND( &m_pTreeView->getListBox() == &_rControl, "SbaTableQueryBrowser::getCurrentSelection: where does this come from?" ); @@ -3445,6 +3523,7 @@ Any SbaTableQueryBrowser::getCurrentSelection( Control& _rControl ) const // ----------------------------------------------------------------------------- sal_Bool SbaTableQueryBrowser::implGetQuerySignature( ::rtl::OUString& _rCommand, sal_Bool& _bEscapeProcessing ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::implGetQuerySignature" ); _rCommand = ::rtl::OUString(); _bEscapeProcessing = sal_False; @@ -3493,6 +3572,7 @@ sal_Bool SbaTableQueryBrowser::implGetQuerySignature( ::rtl::OUString& _rCommand //------------------------------------------------------------------------------ void SbaTableQueryBrowser::frameAction(const ::com::sun::star::frame::FrameActionEvent& aEvent) throw( RuntimeException ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::frameAction" ); if (aEvent.Frame == m_xCurrentFrameParent) { if(aEvent.Action == FrameAction_COMPONENT_DETACHING) @@ -3507,6 +3587,7 @@ void SbaTableQueryBrowser::frameAction(const ::com::sun::star::frame::FrameActio // ----------------------------------------------------------------------------- void SbaTableQueryBrowser::clearGridColumns(const Reference< XNameContainer >& _xColContainer) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::clearGridColumns" ); // first we have to clear the grid Sequence< ::rtl::OUString > aNames = _xColContainer->getElementNames(); const ::rtl::OUString* pIter = aNames.getConstArray(); @@ -3522,6 +3603,7 @@ void SbaTableQueryBrowser::clearGridColumns(const Reference< XNameContainer >& _ // ----------------------------------------------------------------------------- sal_Bool SbaTableQueryBrowser::isHiContrast() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::isHiContrast" ); sal_Bool bRet = sal_False; if ( m_pTreeView ) bRet = m_pTreeView->getListBox().GetBackground().GetColor().IsDark(); @@ -3530,6 +3612,7 @@ sal_Bool SbaTableQueryBrowser::isHiContrast() const // ----------------------------------------------------------------------------- void SbaTableQueryBrowser::loadMenu(const Reference< XFrame >& _xFrame) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::loadMenu" ); if ( m_bShowMenu ) { OGenericUnoController::loadMenu(_xFrame); @@ -3551,6 +3634,7 @@ void SbaTableQueryBrowser::loadMenu(const Reference< XFrame >& _xFrame) // ----------------------------------------------------------------------------- ::rtl::OUString SbaTableQueryBrowser::getPrivateTitle() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getPrivateTitle" ); ::rtl::OUString sTitle; if ( m_pCurrentlyDisplayed ) { @@ -3575,6 +3659,7 @@ void SbaTableQueryBrowser::loadMenu(const Reference< XFrame >& _xFrame) // ----------------------------------------------------------------------------- sal_Bool SbaTableQueryBrowser::preReloadForm() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::preReloadForm" ); sal_Bool bIni = sal_False; if ( !m_pCurrentlyDisplayed ) { @@ -3603,6 +3688,7 @@ sal_Bool SbaTableQueryBrowser::preReloadForm() // ----------------------------------------------------------------------------- void SbaTableQueryBrowser::postReloadForm() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::postReloadForm" ); InitializeGridModel(getFormComponent()); LoadFinished(sal_True); //updateTitle(); @@ -3611,6 +3697,7 @@ void SbaTableQueryBrowser::postReloadForm() //------------------------------------------------------------------------------ Reference< XEmbeddedScripts > SAL_CALL SbaTableQueryBrowser::getScriptContainer() throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getScriptContainer" ); Reference< XEmbeddedScripts > xScripts( m_xCurrentDatabaseDocument, UNO_QUERY ); OSL_ENSURE( xScripts.is() || !m_xCurrentDatabaseDocument.is(), "SbaTableQueryBrowser::getScriptContainer: invalid database document!" ); @@ -3620,6 +3707,7 @@ Reference< XEmbeddedScripts > SAL_CALL SbaTableQueryBrowser::getScriptContainer( //------------------------------------------------------------------------------ void SAL_CALL SbaTableQueryBrowser::registerContextMenuInterceptor( const Reference< XContextMenuInterceptor >& _Interceptor ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::registerContextMenuInterceptor" ); if ( _Interceptor.is() ) m_aContextMenuInterceptors.addInterface( _Interceptor ); } @@ -3627,6 +3715,7 @@ void SAL_CALL SbaTableQueryBrowser::registerContextMenuInterceptor( const Refere //------------------------------------------------------------------------------ void SAL_CALL SbaTableQueryBrowser::releaseContextMenuInterceptor( const Reference< XContextMenuInterceptor >& _Interceptor ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::releaseContextMenuInterceptor" ); m_aContextMenuInterceptors.removeInterface( _Interceptor ); } diff --git a/dbaccess/source/ui/inc/DExport.hxx b/dbaccess/source/ui/inc/DExport.hxx index 2160351d6e7d..63aeee18cc8c 100644 --- a/dbaccess/source/ui/inc/DExport.hxx +++ b/dbaccess/source/ui/inc/DExport.hxx @@ -30,49 +30,22 @@ #ifndef DBAUI_DATABASEEXPORT_HXX #define DBAUI_DATABASEEXPORT_HXX -#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ #include <com/sun/star/sdbc/XResultSet.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATA_HPP_ #include <com/sun/star/sdbc/XResultSetMetaData.hpp> -#endif -#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ #include <com/sun/star/beans/XPropertySet.hpp> -#endif -#ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATTER_HPP_ #include <com/sun/star/util/XNumberFormatter.hpp> -#endif -#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ #include <com/sun/star/container/XNameAccess.hpp> -#endif -#ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_ #include <com/sun/star/container/XIndexAccess.hpp> -#endif -#ifndef _COM_SUN_STAR_LANG_LOCALE_HPP_ #include <com/sun/star/lang/Locale.hpp> -#endif -#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#endif +#include <com/sun/star/util/Date.hpp> #include <vector> -#ifndef _STRING_HXX #include <tools/string.hxx> -#endif -#ifndef _COMPHELPER_STLTYPES_HXX_ #include <comphelper/stl_types.hxx> -#endif -#ifndef DBAUI_TYPEINFO_HXX #include "TypeInfo.hxx" -#endif -#ifndef DBAUI_WIZ_TYPESELECT_HXX #include "WTypeSelect.hxx" -#endif -#ifndef _DBAUI_COMMON_TYPES_HXX_ #include "commontypes.hxx" -#endif -#ifndef DBAUI_IUPDATEHELPER_HXX #include "IUpdateHelper.hxx" -#endif #include "WTypeSelect.hxx" namespace com { namespace sun { namespace star { @@ -117,9 +90,9 @@ namespace dbaui ::boost::shared_ptr<IUpdateHelper> m_pUpdateHelper; ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > m_xResultSet; // - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > m_xResultSetMetaData; // ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > m_xFormatter; // a number formatter working with the connection's NumberFormatsSupplier ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory> m_xFactory; + ::com::sun::star::util::Date m_aNullDate; SvNumberFormatter* m_pFormatter; SvStream& m_rInputStream; diff --git a/dbaccess/source/ui/inc/brwctrlr.hxx b/dbaccess/source/ui/inc/brwctrlr.hxx index 04d73cf778ec..19a0971e4981 100644 --- a/dbaccess/source/ui/inc/brwctrlr.hxx +++ b/dbaccess/source/ui/inc/brwctrlr.hxx @@ -98,7 +98,8 @@ namespace dbaui ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent > m_xGridModel; // the model of our grid ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > m_xFormatter; // a number formatter working with the connection's NumberFormatsSupplier ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > m_xFormControllerImpl; - ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer > m_xParser; // for sorting 'n filtering + mutable ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer > + m_xParser; // for sorting 'n filtering AutoTimer m_aInvalidateClipboard; // for testing the state of the CUT/COPY/PASTE-slots @@ -337,6 +338,7 @@ namespace dbaui // execute the search slot void ExecuteSearch(); + void initializeParser() const; // changes the mutable member m_xParser void applyParserFilter(const ::rtl::OUString& _rOldFilter, sal_Bool _bOldFilterApplied,const ::rtl::OUString& _sOldHaving = ::rtl::OUString()); void applyParserOrder(const ::rtl::OUString& _rOldOrder); diff --git a/dbaccess/source/ui/misc/DExport.cxx b/dbaccess/source/ui/misc/DExport.cxx index b366695301a0..dc71f6588828 100644 --- a/dbaccess/source/ui/misc/DExport.cxx +++ b/dbaccess/source/ui/misc/DExport.cxx @@ -34,128 +34,48 @@ #include "DExport.hxx" #include "moduledbu.hxx" -#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_ #include <com/sun/star/sdbcx/XTablesSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XDATADESCRIPTORFACTORY_HPP_ #include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_ #include <com/sun/star/sdbcx/XColumnsSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XAPPEND_HPP_ #include <com/sun/star/sdbcx/XAppend.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_KEYTYPE_HPP_ #include <com/sun/star/sdbcx/KeyType.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ #include <com/sun/star/sdbc/DataType.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ #include <com/sun/star/sdbc/ColumnValue.hpp> -#endif -#ifndef _COM_SUN_STAR_SDB_COMMANDTYPE_HPP_ #include <com/sun/star/sdb/CommandType.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATASUPPLIER_HPP_ #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ #include <com/sun/star/sdbc/XRow.hpp> -#endif -#ifndef _COM_SUN_STAR_UTIL_NUMBERFORMAT_HPP_ #include <com/sun/star/util/NumberFormat.hpp> -#endif -#ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATTYPES_HPP_ #include <com/sun/star/util/XNumberFormatTypes.hpp> -#endif -#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC #include "dbustrings.hrc" -#endif -#ifndef _DBU_MISC_HRC_ #include "dbu_misc.hrc" -#endif -#ifndef _DBHELPER_DBCONVERSION_HXX_ #include <connectivity/dbconversion.hxx> -#endif -#ifndef _SFXHTML_HXX #include <sfx2/sfxhtml.hxx> -#endif -#ifndef _NUMUNO_HXX #include <svtools/numuno.hxx> -#endif -#ifndef _CONNECTIVITY_DBTOOLS_HXX_ #include <connectivity/dbtools.hxx> -#endif -#ifndef _COMPHELPER_EXTRACT_HXX_ #include <comphelper/extract.hxx> -#endif -#ifndef DBAUI_TYPEINFO_HXX #include "TypeInfo.hxx" -#endif -#ifndef DBAUI_FIELDDESCRIPTIONS_HXX #include "FieldDescriptions.hxx" -#endif -#ifndef DBAUI_TOOLS_HXX #include "UITools.hxx" -#endif -#ifndef _UTL_CONFIGMGR_HXX_ #include <unotools/configmgr.hxx> -#endif #include <memory> -#ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> -#endif -#ifndef TOOLS_DIAGNOSE_EX_H #include <tools/diagnose_ex.h> -#endif -#ifndef INCLUDED_I18NPOOL_MSLANGID_HXX #include <i18npool/mslangid.hxx> -#endif -#ifndef _COM_SUN_STAR_AWT_FONTDESCRIPTOR_HPP_ #include <com/sun/star/awt/FontDescriptor.hpp> -#endif -#ifndef DBAUI_WIZ_COPYTABLEDIALOG_HXX #include "WCopyTable.hxx" -#endif -#ifndef DBAUI_WIZ_EXTENDPAGES_HXX #include "WExtendPages.hxx" -#endif -#ifndef DBAUI_WIZARD_CPAGE_HXX #include "WCPage.hxx" -#endif -#ifndef INCLUDED_SVTOOLS_SYSLOCALE_HXX #include <svtools/syslocale.hxx> -#endif -#ifndef _DBHELPER_DBEXCEPTION_HXX_ #include <connectivity/dbexception.hxx> -#endif -#ifndef _CONNECTIVITY_FILE_VALUE_HXX_ #include <connectivity/FValue.hxx> -#endif -#ifndef _COM_SUN_STAR_SDBC_SQLWARNING_HPP_ #include <com/sun/star/sdbc/SQLWarning.hpp> -#endif -#ifndef _COM_SUN_STAR_SDB_SQLCONTEXT_HPP_ #include <com/sun/star/sdb/SQLContext.hpp> -#endif -#ifndef _COM_SUN_STAR_SDB_APPLICATION_COPYTABLEOPERATION_HPP_ #include <com/sun/star/sdb/application/CopyTableOperation.hpp> -#endif -#ifndef _DBAUI_SQLMESSAGE_HXX_ #include "sqlmessage.hxx" -#endif -#ifndef DBAUI_UPDATEHELPERIMPL_HXX #include "UpdateHelperImpl.hxx" -#endif -#ifndef _SV_MSGBOX_HXX #include <vcl/msgbox.hxx> -#endif -#ifndef _CPPUHELPER_EXC_HLP_HXX_ #include <cppuhelper/exc_hlp.hxx> -#endif - +#include <rtl/logfile.hxx> using namespace dbaui; using namespace utl; @@ -205,6 +125,7 @@ ODatabaseExport::ODatabaseExport(sal_Int32 nRows, ,m_bCheckOnly(sal_False) ,m_bAppendFirstLine(false) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ODatabaseExport::ODatabaseExport" ); DBG_CTOR(ODatabaseExport,NULL); m_nRows += nRows; @@ -261,6 +182,7 @@ ODatabaseExport::ODatabaseExport(const SharedConnection& _rxConnection, ,m_bCheckOnly(sal_False) ,m_bAppendFirstLine(false) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ODatabaseExport::ODatabaseExport" ); DBG_CTOR(ODatabaseExport,NULL); try { @@ -281,8 +203,9 @@ ODatabaseExport::ODatabaseExport(const SharedConnection& _rxConnection, { ::connectivity::ORowSetValue aValue; ::std::vector<sal_Int32> aTypes; - Reference<XResultSetMetaData> xResultSetMetaData = Reference<XResultSetMetaDataSupplier>(xSet,UNO_QUERY)->getMetaData(); - Reference<XRow> xRow(xSet,UNO_QUERY); + ::std::vector<sal_Bool> aNullable; + Reference<XResultSetMetaData> xResultSetMetaData = Reference<XResultSetMetaDataSupplier>(xSet,UNO_QUERY_THROW)->getMetaData(); + Reference<XRow> xRow(xSet,UNO_QUERY_THROW); while(xSet->next()) { if ( aTypes.empty() ) @@ -291,18 +214,23 @@ ODatabaseExport::ODatabaseExport(const SharedConnection& _rxConnection, if ( nCount < 1 ) nCount = 18; aTypes.reserve(nCount+1); + aNullable.reserve(nCount+1); aTypes.push_back(-1); + aNullable.push_back(sal_False); for (sal_Int32 j = 1; j <= nCount ; ++j) + { + aNullable.push_back(xResultSetMetaData->isNullable(j) != ColumnValue::NO_NULLS ); aTypes.push_back(xResultSetMetaData->getColumnType(j)); + } } sal_Int32 nPos = 1; OSL_ENSURE((nPos) < static_cast<sal_Int32>(aTypes.size()),"aTypes: Illegal index for vector"); - aValue.fill(nPos,aTypes[nPos],xRow); + aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); ::rtl::OUString sTypeName = aValue; ++nPos; OSL_ENSURE((nPos) < static_cast<sal_Int32>(aTypes.size()),"aTypes: Illegal index for vector"); - aValue.fill(nPos,aTypes[nPos],xRow); + aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); sal_Int32 nType = aValue; ++nPos; @@ -314,43 +242,43 @@ ODatabaseExport::ODatabaseExport(const SharedConnection& _rxConnection, m_pTypeInfo->nType = nType; OSL_ENSURE((nPos) < static_cast<sal_Int32>(aTypes.size()),"aTypes: Illegal index for vector"); - aValue.fill(nPos,aTypes[nPos],xRow); + aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); m_pTypeInfo->nPrecision = aValue; ++nPos; - aValue.fill(nPos,aTypes[nPos],xRow); + aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); m_pTypeInfo->aLiteralPrefix = aValue; ++nPos; - aValue.fill(nPos,aTypes[nPos],xRow); + aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); m_pTypeInfo->aLiteralSuffix = aValue; ++nPos; - aValue.fill(nPos,aTypes[nPos],xRow); + aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); m_pTypeInfo->aCreateParams = aValue; ++nPos; - aValue.fill(nPos,aTypes[nPos],xRow); + aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); m_pTypeInfo->bNullable = (sal_Int32)aValue == ColumnValue::NULLABLE; ++nPos; - aValue.fill(nPos,aTypes[nPos],xRow); + aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); m_pTypeInfo->bCaseSensitive = (sal_Bool)aValue; ++nPos; - aValue.fill(nPos,aTypes[nPos],xRow); + aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); m_pTypeInfo->nSearchType = aValue; ++nPos; - aValue.fill(nPos,aTypes[nPos],xRow); + aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); m_pTypeInfo->bUnsigned = (sal_Bool)aValue; ++nPos; - aValue.fill(nPos,aTypes[nPos],xRow); + aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); m_pTypeInfo->bCurrency = (sal_Bool)aValue; ++nPos; - aValue.fill(nPos,aTypes[nPos],xRow); + aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); m_pTypeInfo->bAutoIncrement = (sal_Bool)aValue; ++nPos; - aValue.fill(nPos,aTypes[nPos],xRow); + aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); m_pTypeInfo->aLocalTypeName = aValue; ++nPos; - aValue.fill(nPos,aTypes[nPos],xRow); + aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); m_pTypeInfo->nMinimumScale = aValue; ++nPos; - aValue.fill(nPos,aTypes[nPos],xRow); + aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); m_pTypeInfo->nMaximumScale = aValue; // check if values are less than zero like it happens in a oracle jdbc driver @@ -382,6 +310,7 @@ ODatabaseExport::~ODatabaseExport() // ----------------------------------------------------------------------------- void ODatabaseExport::insertValueIntoColumn() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ODatabaseExport::insertValueIntoColumn" ); DBG_CHKTHIS(ODatabaseExport,NULL); if(m_nColumnPos < sal_Int32(m_vDestVector.size())) { @@ -399,7 +328,7 @@ void ODatabaseExport::insertValueIntoColumn() // if(m_nDefToken != LANGUAGE_DONTKNOW) // falls Sprache anders als Systemsprache // m_pNF->ChangeIntl((LanguageType)m_nDefToken); - if(!m_sTextToken.Len() && m_xResultSetMetaData->isNullable(nPos)) + if ( !m_sTextToken.Len() && pField->IsNullable() ) m_pUpdateHelper->updateNull(nPos,pField->GetType()); else { @@ -408,11 +337,7 @@ void ODatabaseExport::insertValueIntoColumn() OSL_ENSURE((nNewPos) < static_cast<sal_Int32>(m_vColumnTypes.size()),"Illegal index for vector"); if (m_vColumnTypes[nNewPos] != DataType::VARCHAR && m_vColumnTypes[nNewPos] != DataType::CHAR && m_vColumnTypes[nNewPos] != DataType::LONGVARCHAR ) { - Reference< XNumberFormatsSupplier > xSupplier = m_xFormatter->getNumberFormatsSupplier(); - Reference<XPropertySet> xNumberFormatSettings = xSupplier->getNumberFormatSettings(); - com::sun::star::util::Date aNullDate; - xNumberFormatSettings->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NullDate"))) >>= aNullDate; - + RTL_LOGFILE_CONTEXT_TRACE( aLogger, "ODatabaseExport::insertValueIntoColumn != DataType::VARCHAR" ); ensureFormatter(); bool bNumberFormatError = false; if ( m_pFormatter && m_sNumToken.Len() ) @@ -424,6 +349,7 @@ void ODatabaseExport::insertValueIntoColumn() } else { + Reference< XNumberFormatsSupplier > xSupplier = m_xFormatter->getNumberFormatsSupplier(); Reference<XNumberFormatTypes> xNumType(xSupplier->getNumberFormats(),UNO_QUERY); sal_Int16 nFormats[] = { NumberFormat::DATETIME ,NumberFormat::DATETIME @@ -457,6 +383,7 @@ void ODatabaseExport::insertValueIntoColumn() { try { + Reference< XNumberFormatsSupplier > xSupplier = m_xFormatter->getNumberFormatsSupplier(); Reference< XNumberFormats > xFormats = xSupplier->getNumberFormats(); Reference<XPropertySet> xProp = xFormats->getByKey(nNumberFormat); sal_Int16 nType = 0; @@ -465,7 +392,7 @@ void ODatabaseExport::insertValueIntoColumn() { case NumberFormat::DATE: case NumberFormat::DATETIME: - fOutNumber = ::dbtools::DBTypeConversion::toStandardDbDate(aNullDate,fOutNumber); + fOutNumber = ::dbtools::DBTypeConversion::toStandardDbDate(m_aNullDate,fOutNumber); break; default: ; @@ -491,6 +418,7 @@ void ODatabaseExport::insertValueIntoColumn() // ----------------------------------------------------------------------------- sal_Int16 ODatabaseExport::CheckString(const String& aCheckToken, sal_Int16 _nOldNumberFormat) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ODatabaseExport::CheckString" ); DBG_CHKTHIS(ODatabaseExport,NULL); double fOutNumber = 0.0; sal_Int16 nNumberFormat = 0; @@ -627,6 +555,7 @@ sal_Int16 ODatabaseExport::CheckString(const String& aCheckToken, sal_Int16 _nOl // ----------------------------------------------------------------------------- void ODatabaseExport::SetColumnTypes(const TColumnVector* _pList,const OTypeInfoMap* _pInfoMap) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ODatabaseExport::SetColumnTypes" ); DBG_CHKTHIS(ODatabaseExport,NULL); if(_pList && _pInfoMap) { @@ -700,6 +629,7 @@ void ODatabaseExport::SetColumnTypes(const TColumnVector* _pList,const OTypeInfo // ----------------------------------------------------------------------------- void ODatabaseExport::CreateDefaultColumn(const ::rtl::OUString& _rColumnName) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ODatabaseExport::CreateDefaultColumn" ); DBG_CHKTHIS(ODatabaseExport,NULL); Reference< XDatabaseMetaData> xDestMetaData(m_xConnection->getMetaData()); sal_Int32 nMaxNameLen(xDestMetaData->getMaxColumnNameLength()); @@ -752,41 +682,44 @@ void ODatabaseExport::CreateDefaultColumn(const ::rtl::OUString& _rColumnName) // ----------------------------------------------------------------------------- sal_Bool ODatabaseExport::createRowSet() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ODatabaseExport::createRowSet" ); DBG_CHKTHIS(ODatabaseExport,NULL); - Reference<XResultSet> xDestSet(m_xFactory->createInstance(::rtl::OUString::createFromAscii("com.sun.star.sdb.RowSet")),UNO_QUERY); - Reference<XPropertySet > xProp(xDestSet,UNO_QUERY); - if(xProp.is()) - { - ::rtl::OUString sDestName = ::dbtools::composeTableName( - m_xConnection->getMetaData(), m_xTable, ::dbtools::eInDataManipulation, false, false, false ); - - xProp->setPropertyValue(PROPERTY_ACTIVE_CONNECTION,makeAny(m_xConnection.getTyped())); - xProp->setPropertyValue(PROPERTY_COMMAND_TYPE,makeAny(CommandType::TABLE)); - xProp->setPropertyValue(PROPERTY_COMMAND,makeAny(sDestName)); - xProp->setPropertyValue(PROPERTY_IGNORERESULT,::cppu::bool2any(sal_True)); - Reference<XRowSet> xRowSet(xProp,UNO_QUERY); - xRowSet->execute(); - - Reference< XResultSetMetaDataSupplier> xSrcMetaSup(xRowSet,UNO_QUERY_THROW); - m_xResultSetMetaData = xSrcMetaSup->getMetaData(); - - if ( ::dbtools::canInsert(xProp) ) - { - m_pUpdateHelper.reset(new ORowUpdateHelper(xRowSet)); - OSL_ENSURE(m_xResultSetMetaData.is(),"No ResultSetMetaData!"); - TPositions::iterator aIter = m_vColumns.begin(); - for (;aIter != m_vColumns.end() ; ++aIter) - aIter->first = aIter->second; - } - else + //Reference<XResultSet> xDestSet(m_xFactory->createInstance(::rtl::OUString::createFromAscii("com.sun.star.sdb.RowSet")),UNO_QUERY); + //Reference<XPropertySet > xProp(xDestSet,UNO_QUERY); + //if(xProp.is()) + //{ + // ::rtl::OUString sDestName = ::dbtools::composeTableName( + // m_xConnection->getMetaData(), m_xTable, ::dbtools::eInDataManipulation, false, false, false ); + + // xProp->setPropertyValue(PROPERTY_ACTIVE_CONNECTION,makeAny(m_xConnection.getTyped())); + // xProp->setPropertyValue(PROPERTY_COMMAND_TYPE,makeAny(CommandType::TABLE)); + // xProp->setPropertyValue(PROPERTY_COMMAND,makeAny(sDestName)); + // xProp->setPropertyValue(PROPERTY_IGNORERESULT,::cppu::bool2any(sal_True)); + // xProp->setPropertyValue(PROPERTY_FETCHSIZE,sal_Int32(1)); + // Reference<XRowSet> xRowSet(xProp,UNO_QUERY); + // xRowSet->execute(); + + // Reference< XResultSetMetaDataSupplier> xSrcMetaSup(xRowSet,UNO_QUERY_THROW); + // m_xResultSetMetaData = xSrcMetaSup->getMetaData(); + + // if ( ::dbtools::canInsert(xProp) ) + // { + // m_pUpdateHelper.reset(new ORowUpdateHelper(xRowSet)); + // OSL_ENSURE(m_xResultSetMetaData.is(),"No ResultSetMetaData!"); + // TPositions::iterator aIter = m_vColumns.begin(); + // for (;aIter != m_vColumns.end() ; ++aIter) + // aIter->first = aIter->second; + // } + // else m_pUpdateHelper.reset(new OParameterUpdateHelper(createPreparedStatment(m_xConnection->getMetaData(),m_xTable,m_vColumns))); - } + //} return m_pUpdateHelper.get() != NULL; } // ----------------------------------------------------------------------------- sal_Bool ODatabaseExport::executeWizard(const ::rtl::OUString& _rTableName,const Any& _aTextColor,const FontDescriptor& _rFont) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ODatabaseExport::executeWizard" ); DBG_CHKTHIS(ODatabaseExport,NULL); bool bHaveDefaultTable = ( m_sDefaultTableName.getLength() != 0 ); @@ -852,6 +785,7 @@ sal_Bool ODatabaseExport::executeWizard(const ::rtl::OUString& _rTableName,const //--------------------------------------------------------------------------------- void ODatabaseExport::showErrorDialog(const ::com::sun::star::sdbc::SQLException& e) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ODatabaseExport::showErrorDialog" ); if(!m_bDontAskAgain) { String aMsg(e.Message); @@ -868,6 +802,7 @@ void ODatabaseExport::showErrorDialog(const ::com::sun::star::sdbc::SQLException // ----------------------------------------------------------------------------- void ODatabaseExport::adjustFormat() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ODatabaseExport::adjustFormat" ); if ( m_sTextToken.Len() ) { sal_Int32 nNewPos = m_bIsAutoIncrement ? m_nColumnPos+1 : m_nColumnPos; @@ -890,6 +825,7 @@ void ODatabaseExport::adjustFormat() // ----------------------------------------------------------------------------- void ODatabaseExport::eraseTokens() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ODatabaseExport::eraseTokens" ); m_sTextToken.Erase(); m_sNumToken.Erase(); m_sValToken.Erase(); @@ -897,12 +833,15 @@ void ODatabaseExport::eraseTokens() // ----------------------------------------------------------------------------- void ODatabaseExport::ensureFormatter() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ODatabaseExport::ensureFormatter" ); if ( !m_pFormatter ) { Reference< XNumberFormatsSupplier > xSupplier = m_xFormatter->getNumberFormatsSupplier(); Reference< XUnoTunnel > xTunnel(xSupplier,UNO_QUERY); SvNumberFormatsSupplierObj* pSupplierImpl = (SvNumberFormatsSupplierObj*)sal::static_int_cast< sal_IntPtr >(xTunnel->getSomething(SvNumberFormatsSupplierObj::getUnoTunnelId())); m_pFormatter = pSupplierImpl ? pSupplierImpl->GetNumberFormatter() : NULL; + Reference<XPropertySet> xNumberFormatSettings = xSupplier->getNumberFormatSettings(); + xNumberFormatSettings->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NullDate"))) >>= m_aNullDate; } } // ----------------------------------------------------------------------------- @@ -910,6 +849,7 @@ Reference< XPreparedStatement > ODatabaseExport::createPreparedStatment( const R ,const Reference<XPropertySet>& _xDestTable ,const TPositions& _rvColumns) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ODatabaseExport::createPreparedStatment" ); ::rtl::OUString aSql(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("INSERT INTO "))); ::rtl::OUString sComposedTableName = ::dbtools::composeTableName( _xMetaData, _xDestTable, ::dbtools::eInDataManipulation, false, false, true ); diff --git a/dbaccess/source/ui/misc/HtmlReader.cxx b/dbaccess/source/ui/misc/HtmlReader.cxx index 5d86ec271179..5da5c7bf7d36 100644 --- a/dbaccess/source/ui/misc/HtmlReader.cxx +++ b/dbaccess/source/ui/misc/HtmlReader.cxx @@ -30,117 +30,44 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" -#ifndef DBAUI_HTMLREADER_HXX #include "HtmlReader.hxx" -#endif -#ifndef _DBHELPER_DBCONVERSION_HXX_ #include <connectivity/dbconversion.hxx> -#endif -#ifndef _CONNECTIVITY_DBTOOLS_HXX_ #include <connectivity/dbtools.hxx> -#endif -#ifndef _TOOLS_TENCCVT_HXX #include <tools/tenccvt.hxx> -#endif -#ifndef _COMPHELPER_EXTRACT_HXX_ #include <comphelper/extract.hxx> -#endif -#ifndef _DBU_MISC_HRC_ #include "dbu_misc.hrc" -#endif -#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC #include "dbustrings.hrc" -#endif -#ifndef _SFXHTML_HXX #include <sfx2/sfxhtml.hxx> -#endif -#ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> -#endif -#ifndef _TOOLS_TENCCVT_HXX #include <tools/tenccvt.hxx> -#endif -#ifndef _DBAUI_MODULE_DBU_HXX_ #include "moduledbu.hxx" -#endif -#ifndef _COM_SUN_STAR_SDBCX_XDATADESCRIPTORFACTORY_HPP_ #include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_ #include <com/sun/star/sdbcx/XColumnsSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XAPPEND_HPP_ #include <com/sun/star/sdbcx/XAppend.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ #include <com/sun/star/sdbc/DataType.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ #include <com/sun/star/sdbc/ColumnValue.hpp> -#endif -#ifndef _COM_SUN_STAR_AWT_FONTDESCRIPTOR_HPP_ #include <com/sun/star/awt/FontDescriptor.hpp> -#endif -#ifndef _COM_SUN_STAR_AWT_FONTWEIGHT_HPP_ #include <com/sun/star/awt/FontWeight.hpp> -#endif -#ifndef _COM_SUN_STAR_AWT_FONTSTRIKEOUT_HPP_ #include <com/sun/star/awt/FontStrikeout.hpp> -#endif -#ifndef _COM_SUN_STAR_AWT_FONTSLANT_HPP_ #include <com/sun/star/awt/FontSlant.hpp> -#endif -#ifndef _COM_SUN_STAR_AWT_FONTUNDERLINE_HPP_ #include <com/sun/star/awt/FontUnderline.hpp> -#endif -#ifndef _COM_SUN_STAR_UTIL_NUMBERFORMAT_HPP_ #include <com/sun/star/util/NumberFormat.hpp> -#endif -#ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATTYPES_HPP_ #include <com/sun/star/util/XNumberFormatTypes.hpp> -#endif -#ifndef _HTMLTOKN_H #include <svtools/htmltokn.h> -#endif -#ifndef _HTMLKYWD_HXX #include <svtools/htmlkywd.hxx> -#endif -#ifndef _TOOLS_COLOR_HXX #include <tools/color.hxx> -#endif -#ifndef DBAUI_WIZ_COPYTABLEDIALOG_HXX #include "WCopyTable.hxx" -#endif -#ifndef DBAUI_WIZ_EXTENDPAGES_HXX #include "WExtendPages.hxx" -#endif -#ifndef DBAUI_WIZ_NAMEMATCHING_HXX #include "WNameMatch.hxx" -#endif -#ifndef DBAUI_WIZ_COLUMNSELECT_HXX #include "WColumnSelect.hxx" -#endif -#ifndef DBAUI_ENUMTYPES_HXX #include "QEnumTypes.hxx" -#endif -#ifndef DBAUI_WIZARD_CPAGE_HXX #include "WCPage.hxx" -#endif -#ifndef TOOLS_INETMIME_HXX #include <tools/inetmime.hxx> -#endif -#ifndef _INETTYPE_HXX #include <svtools/inettype.hxx> -#endif -#ifndef _RTL_TENCINFO_H #include <rtl/tencinfo.h> -#endif -#ifndef DBAUI_TOOLS_HXX #include "UITools.hxx" -#endif -#ifndef _SV_SVAPP_HXX #include <vcl/svapp.hxx> -#endif +#include <rtl/logfile.hxx> using namespace dbaui; using namespace ::com::sun::star::uno; @@ -182,6 +109,7 @@ OHTMLReader::OHTMLReader(SvStream& rIn,const SharedConnection& _rxConnection, ,m_bMetaOptions(sal_False) ,m_bSDNum(sal_False) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OHTMLReader::OHTMLReader" ); DBG_CTOR(OHTMLReader,NULL); SetSrcEncoding( GetExtendedCompatibilityTextEncoding( RTL_TEXTENCODING_ISO_8859_1 ) ); // If the file starts with a BOM, switch to UCS2. @@ -203,6 +131,7 @@ OHTMLReader::OHTMLReader(SvStream& rIn, ,m_bMetaOptions(sal_False) ,m_bSDNum(sal_False) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OHTMLReader::OHTMLReader" ); DBG_CTOR(OHTMLReader,NULL); SetSrcEncoding( GetExtendedCompatibilityTextEncoding( RTL_TEXTENCODING_ISO_8859_1 ) ); // If the file starts with a BOM, switch to UCS2. @@ -216,6 +145,7 @@ OHTMLReader::~OHTMLReader() // --------------------------------------------------------------------------- SvParserState OHTMLReader::CallParser() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OHTMLReader::CallParser" ); DBG_CHKTHIS(OHTMLReader,NULL); rInput.Seek(STREAM_SEEK_TO_BEGIN); rInput.ResetError(); @@ -226,6 +156,7 @@ SvParserState OHTMLReader::CallParser() // ----------------------------------------------------------------------------- void OHTMLReader::NextToken( int nToken ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OHTMLReader::NextToken" ); DBG_CHKTHIS(OHTMLReader,NULL); if(m_bError || !m_nRows) // falls Fehler oder keine Rows mehr zur "Uberpr"ufung dann gleich zur"uck return; @@ -396,6 +327,7 @@ void OHTMLReader::NextToken( int nToken ) // ----------------------------------------------------------------------------- void OHTMLReader::fetchOptions() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OHTMLReader::fetchOptions" ); m_bInTbl = TRUE; const HTMLOptions* options = GetOptions(); sal_Int16 nArrLen = options->Count(); @@ -420,6 +352,7 @@ void OHTMLReader::fetchOptions() //--------------------------------------------------------------------------------- void OHTMLReader::TableDataOn(SvxCellHorJustify& eVal,int nToken) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OHTMLReader::TableDataOn" ); DBG_CHKTHIS(OHTMLReader,NULL); sal_Bool bHorJustifyCenterTH = (nToken == HTML_TABLEHEADER_ON); const HTMLOptions* pHtmlOptions = GetOptions(); @@ -453,6 +386,7 @@ void OHTMLReader::TableDataOn(SvxCellHorJustify& eVal,int nToken) //--------------------------------------------------------------------------------- void OHTMLReader::TableFontOn(FontDescriptor& _rFont,sal_Int32 &_rTextColor) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OHTMLReader::TableFontOn" ); DBG_CHKTHIS(OHTMLReader,NULL); const HTMLOptions* pHtmlOptions = GetOptions(); sal_Int16 nArrLen = pHtmlOptions->Count(); @@ -502,6 +436,7 @@ void OHTMLReader::TableFontOn(FontDescriptor& _rFont,sal_Int32 &_rTextColor) // --------------------------------------------------------------------------- sal_Int16 OHTMLReader::GetWidthPixel( const HTMLOption* pOption ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OHTMLReader::GetWidthPixel" ); DBG_CHKTHIS(OHTMLReader,NULL); const String& rOptVal = pOption->GetString(); if ( rOptVal.Search('%') != STRING_NOTFOUND ) @@ -523,6 +458,7 @@ sal_Int16 OHTMLReader::GetWidthPixel( const HTMLOption* pOption ) // --------------------------------------------------------------------------- sal_Bool OHTMLReader::CreateTable(int nToken) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OHTMLReader::CreateTable" ); DBG_CHKTHIS(OHTMLReader,NULL); String aTempName(ModuleRes(STR_TBL_TITLE)); aTempName = aTempName.GetToken(0,' '); @@ -637,6 +573,7 @@ sal_Bool OHTMLReader::CreateTable(int nToken) // ----------------------------------------------------------------------------- void OHTMLReader::setTextEncoding() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OHTMLReader::setTextEncoding" ); DBG_CHKTHIS(OHTMLReader,NULL); m_bMetaOptions = sal_True; USHORT nContentOption = HTML_O_CONTENT; @@ -657,12 +594,14 @@ void OHTMLReader::setTextEncoding() // ----------------------------------------------------------------------------- void OHTMLReader::release() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OHTMLReader::release" ); DBG_CHKTHIS(OHTMLReader,NULL); ReleaseRef(); } // ----------------------------------------------------------------------------- TypeSelectionPageFactory OHTMLReader::getTypeSelectionPageFactory() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OHTMLReader::getTypeSelectionPageFactory" ); DBG_CHKTHIS(OHTMLReader,NULL); return &OWizHTMLExtend::Create; } diff --git a/dbaccess/source/ui/misc/RowSetDrop.cxx b/dbaccess/source/ui/misc/RowSetDrop.cxx index 3098e4b88eb6..54b7c4cf36a6 100644 --- a/dbaccess/source/ui/misc/RowSetDrop.cxx +++ b/dbaccess/source/ui/misc/RowSetDrop.cxx @@ -31,31 +31,16 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" -#ifndef DBAUI_TOKENWRITER_HXX #include "TokenWriter.hxx" -#endif -#ifndef _COM_SUN_STAR_SDBC_XCOLUMNLOCATE_HPP_ #include <com/sun/star/sdbc/XColumnLocate.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATASUPPLIER_HPP_ #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> -#endif -#ifndef _DBU_MISC_HRC_ #include "dbu_misc.hrc" -#endif -#ifndef _DBAUI_SQLMESSAGE_HXX_ #include "sqlmessage.hxx" -#endif -#ifndef _SV_MSGBOX_HXX #include <vcl/msgbox.hxx> -#endif -#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC #include "dbustrings.hrc" -#endif -#ifndef _COM_SUN_STAR_SDBC_XROWUPDATE_HPP_ #include <com/sun/star/sdbc/XRowUpdate.hpp> -#endif #include <functional> +#include <rtl/logfile.hxx> using namespace dbaui; using namespace ::com::sun::star::uno; @@ -80,11 +65,13 @@ ORowSetImportExport::ORowSetImportExport( Window* _pParent, ,m_pParent(_pParent) ,m_bAlreadyAsked(sal_False) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ORowSetImportExport::ORowSetImportExport" ); OSL_ENSURE(_pParent,"Window can't be null!"); } // ----------------------------------------------------------------------------- void ORowSetImportExport::initialize() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ORowSetImportExport::initialize" ); ODatabaseImportExport::initialize(); // do namemapping Reference<XColumnLocate> xColumnLocate(m_xResultSet,UNO_QUERY); @@ -124,11 +111,13 @@ void ORowSetImportExport::initialize() // ----------------------------------------------------------------------------- BOOL ORowSetImportExport::Write() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ORowSetImportExport::Write" ); return TRUE; } // ----------------------------------------------------------------------------- BOOL ORowSetImportExport::Read() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ORowSetImportExport::Read" ); // check if there is any column to copy if(::std::find_if(m_aColumnMapping.begin(),m_aColumnMapping.end(), ::std::bind2nd(::std::greater<sal_Int32>(),0)) == m_aColumnMapping.end()) @@ -183,6 +172,7 @@ BOOL ORowSetImportExport::Read() // ----------------------------------------------------------------------------- sal_Bool ORowSetImportExport::insertNewRow() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ORowSetImportExport::insertNewRow" ); try { m_xTargetResultSetUpdate->moveToInsertRow(); diff --git a/dbaccess/source/ui/misc/RtfReader.cxx b/dbaccess/source/ui/misc/RtfReader.cxx index 8f77e5d9a51d..34540ad11684 100644 --- a/dbaccess/source/ui/misc/RtfReader.cxx +++ b/dbaccess/source/ui/misc/RtfReader.cxx @@ -30,90 +30,34 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" -#ifndef DBAUI_RTFREADER_HXX #include "RtfReader.hxx" -#endif -#ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XDATADESCRIPTORFACTORY_HPP_ #include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_ #include <com/sun/star/sdbcx/XColumnsSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XAPPEND_HPP_ #include <com/sun/star/sdbcx/XAppend.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ #include <com/sun/star/sdbc/DataType.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ #include <com/sun/star/sdbc/ColumnValue.hpp> -#endif -#ifndef _COM_SUN_STAR_AWT_FONTDESCRIPTOR_HPP_ #include <com/sun/star/awt/FontDescriptor.hpp> -#endif -#ifndef _COM_SUN_STAR_AWT_FONTWEIGHT_HPP_ #include <com/sun/star/awt/FontWeight.hpp> -#endif -#ifndef _COM_SUN_STAR_AWT_FONTSTRIKEOUT_HPP_ #include <com/sun/star/awt/FontStrikeout.hpp> -#endif -#ifndef _COM_SUN_STAR_AWT_FONTSLANT_HPP_ #include <com/sun/star/awt/FontSlant.hpp> -#endif -#ifndef _COM_SUN_STAR_AWT_FONTUNDERLINE_HPP_ #include <com/sun/star/awt/FontUnderline.hpp> -#endif -#ifndef _COM_SUN_STAR_UTIL_NUMBERFORMAT_HPP_ #include <com/sun/star/util/NumberFormat.hpp> -#endif -#ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATTYPES_HPP_ #include <com/sun/star/util/XNumberFormatTypes.hpp> -#endif -#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC #include "dbustrings.hrc" -#endif -#ifndef _RTFTOKEN_H #include <svtools/rtftoken.h> -#endif -#ifndef _DBU_MISC_HRC_ #include "dbu_misc.hrc" -#endif -#ifndef _SV_MSGBOX_HXX #include <vcl/msgbox.hxx> -#endif -#ifndef _DBHELPER_DBCONVERSION_HXX_ #include <connectivity/dbconversion.hxx> -#endif -#ifndef _CONNECTIVITY_DBTOOLS_HXX_ #include <connectivity/dbtools.hxx> -#endif -#ifndef _COMPHELPER_EXTRACT_HXX_ #include <comphelper/extract.hxx> -#endif -#ifndef _TOOLS_COLOR_HXX #include <tools/color.hxx> -#endif -#ifndef DBAUI_WIZ_EXTENDPAGES_HXX #include "WExtendPages.hxx" -#endif -#ifndef _DBAUI_MODULE_DBU_HXX_ #include "moduledbu.hxx" -#endif -#ifndef DBAUI_ENUMTYPES_HXX #include "QEnumTypes.hxx" -#endif -//#ifndef DBAUI_WIZARD_CPAGE_HXX -//#include "WCPage.hxx" -//#endif -#ifndef DBAUI_TOOLS_HXX #include "UITools.hxx" -#endif -#ifndef _SV_SVAPP_HXX #include <vcl/svapp.hxx> -#endif +#include <rtl/logfile.hxx> using namespace dbaui; using namespace ::com::sun::star::uno; @@ -136,6 +80,7 @@ ORTFReader::ORTFReader( SvStream& rIn, :SvRTFParser(rIn) ,ODatabaseExport( _rxConnection, _rxNumberF, _rM, pList, _pInfoMap, rIn ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ORTFReader::ORTFReader" ); DBG_CTOR(ORTFReader,NULL); m_bAppendFirstLine = false; } @@ -151,6 +96,7 @@ ORTFReader::ORTFReader(SvStream& rIn, :SvRTFParser(rIn) ,ODatabaseExport( nRows, _rColumnPositions, _rxNumberF, _rM, pList, _pInfoMap, _bAutoIncrementEnabled, rIn ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ORTFReader::ORTFReader" ); DBG_CTOR(ORTFReader,NULL); m_bAppendFirstLine = false; } @@ -162,6 +108,7 @@ ORTFReader::~ORTFReader() // --------------------------------------------------------------------------- SvParserState ORTFReader::CallParser() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ORTFReader::CallParser" ); DBG_CHKTHIS(ORTFReader,NULL); rInput.Seek(STREAM_SEEK_TO_BEGIN); rInput.ResetError(); @@ -172,6 +119,7 @@ SvParserState ORTFReader::CallParser() // --------------------------------------------------------------------------- void ORTFReader::NextToken( int nToken ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ORTFReader::NextToken" ); DBG_CHKTHIS(ORTFReader,NULL); if(m_bError || !m_nRows) // falls Fehler oder keine Rows mehr zur "Uberpr"ufung dann gleich zur"uck return; @@ -326,6 +274,7 @@ void ORTFReader::NextToken( int nToken ) // --------------------------------------------------------------------------- sal_Bool ORTFReader::CreateTable(int nToken) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ORTFReader::CreateTable" ); DBG_CHKTHIS(ORTFReader,NULL); String aTableName(ModuleRes(STR_TBL_TITLE)); aTableName = aTableName.GetToken(0,' '); @@ -412,6 +361,7 @@ sal_Bool ORTFReader::CreateTable(int nToken) // ----------------------------------------------------------------------------- void ORTFReader::release() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ORTFReader::release" ); DBG_CHKTHIS(ORTFReader,NULL); ReleaseRef(); } @@ -419,6 +369,7 @@ void ORTFReader::release() // ----------------------------------------------------------------------------- TypeSelectionPageFactory ORTFReader::getTypeSelectionPageFactory() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ORTFReader::getTypeSelectionPageFactory" ); DBG_CHKTHIS(ORTFReader,NULL); return &OWizRTFExtend::Create; } diff --git a/dbaccess/source/ui/misc/TableCopyHelper.cxx b/dbaccess/source/ui/misc/TableCopyHelper.cxx index b2760e4d2e51..4b1258677037 100644 --- a/dbaccess/source/ui/misc/TableCopyHelper.cxx +++ b/dbaccess/source/ui/misc/TableCopyHelper.cxx @@ -140,6 +140,7 @@ #ifndef DBAUI_DBEXCHANGE_HXX #include "dbexchange.hxx" #endif +#include <rtl/logfile.hxx> //........................................................................ namespace dbaui { @@ -162,6 +163,7 @@ using namespace ::com::sun::star::ucb; OTableCopyHelper::OTableCopyHelper(OGenericUnoController* _pControler) :m_pController(_pControler) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OTableCopyHelper::OTableCopyHelper" ); } // ----------------------------------------------------------------------------- @@ -174,6 +176,7 @@ void OTableCopyHelper::insertTable(sal_Int32 _nCommandType ,const ::rtl::OUString& _sDestDataSourceName ,const Reference<XConnection>& _xDestConnection) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OTableCopyHelper::insertTable" ); if ( CommandType::QUERY != _nCommandType && CommandType::TABLE != _nCommandType ) { DBG_ERROR( "OTableCopyHelper::insertTable: invalid call (no supported format found)!" ); @@ -230,6 +233,7 @@ void OTableCopyHelper::insertTable(sal_Int32 _nCommandType void OTableCopyHelper::pasteTable( const ::svx::ODataAccessDescriptor& _rPasteData, const ::rtl::OUString& _sDestDataSourceName, const SharedConnection& _xDestConnection ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OTableCopyHelper::pasteTable" ); Reference<XConnection> xSrcConnection; ::rtl::OUString sCommand, sSrcDataSourceName = _rPasteData.getDataSource(); @@ -285,6 +289,7 @@ void OTableCopyHelper::pasteTable( SotFormatStringId _nFormatId ,const ::rtl::OUString& _sDestDataSourceName ,const SharedConnection& _xConnection) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OTableCopyHelper::pasteTable" ); if ( _nFormatId == SOT_FORMATSTR_ID_DBACCESS_TABLE || _nFormatId == SOT_FORMATSTR_ID_DBACCESS_QUERY ) { if ( ODataAccessObjectTransferable::canExtractObjectDescriptor(_rTransData.GetDataFlavorExVector()) ) @@ -327,6 +332,7 @@ void OTableCopyHelper::pasteTable( const TransferableDataHelper& _rTransData ,const ::rtl::OUString& _sDestDataSourceName ,const SharedConnection& _xConnection) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OTableCopyHelper::pasteTable" ); if ( _rTransData.HasFormat(SOT_FORMATSTR_ID_DBACCESS_TABLE) || _rTransData.HasFormat(SOT_FORMATSTR_ID_DBACCESS_QUERY) ) pasteTable( SOT_FORMATSTR_ID_DBACCESS_TABLE,_rTransData,_sDestDataSourceName,_xConnection); else if ( _rTransData.HasFormat(SOT_FORMATSTR_ID_HTML) ) @@ -338,6 +344,7 @@ void OTableCopyHelper::pasteTable( const TransferableDataHelper& _rTransData // ----------------------------------------------------------------------------- sal_Bool OTableCopyHelper::copyTagTable(OTableCopyHelper::DropDescriptor& _rDesc, sal_Bool _bCheck,const SharedConnection& _xConnection) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OTableCopyHelper::copyTagTable" ); Reference<XEventListener> xEvt; ODatabaseImportExport* pImport = NULL; if ( _rDesc.bHtml ) @@ -360,6 +367,7 @@ sal_Bool OTableCopyHelper::copyTagTable(OTableCopyHelper::DropDescriptor& _rDesc // ----------------------------------------------------------------------------- sal_Bool OTableCopyHelper::isTableFormat(const TransferableDataHelper& _rClipboard) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OTableCopyHelper::isTableFormat" ); sal_Bool bTableFormat = _rClipboard.HasFormat(SOT_FORMATSTR_ID_DBACCESS_TABLE) || _rClipboard.HasFormat(SOT_FORMATSTR_ID_DBACCESS_QUERY) || _rClipboard.HasFormat(SOT_FORMAT_RTF) @@ -372,6 +380,7 @@ sal_Bool OTableCopyHelper::copyTagTable(const TransferableDataHelper& _aDroppedD ,DropDescriptor& _rAsyncDrop ,const SharedConnection& _xConnection) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OTableCopyHelper::copyTagTable" ); sal_Bool bRet = sal_False; sal_Bool bHtml = _aDroppedData.HasFormat(SOT_FORMATSTR_ID_HTML); if ( bHtml || _aDroppedData.HasFormat(SOT_FORMAT_RTF) ) @@ -407,6 +416,7 @@ void OTableCopyHelper::asyncCopyTagTable( DropDescriptor& _rDesc ,const ::rtl::OUString& _sDestDataSourceName ,const SharedConnection& _xConnection) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OTableCopyHelper::asyncCopyTagTable" ); if ( _rDesc.aHtmlRtfStorage.Is() ) { copyTagTable(_rDesc,sal_False,_xConnection); diff --git a/dbaccess/source/ui/misc/TokenWriter.cxx b/dbaccess/source/ui/misc/TokenWriter.cxx index 0910808a5f9d..09f9f45d6ffd 100644 --- a/dbaccess/source/ui/misc/TokenWriter.cxx +++ b/dbaccess/source/ui/misc/TokenWriter.cxx @@ -30,101 +30,42 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" -#ifndef DBAUI_TOKENWRITER_HXX #include "TokenWriter.hxx" -#endif -#ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> -#endif -#ifndef TOOLS_DIAGNOSE_EX_H #include <tools/diagnose_ex.h> -#endif -#ifndef DBAUI_RTFREADER_HXX #include "RtfReader.hxx" -#endif -#ifndef DBAUI_HTMLREADER_HXX #include "HtmlReader.hxx" -#endif -#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC #include "dbustrings.hrc" -#endif -#ifndef _CONNECTIVITY_DBTOOLS_HXX_ #include <connectivity/dbtools.hxx> -#endif -#ifndef _COMPHELPER_TYPES_HXX_ #include <comphelper/types.hxx> -#endif -#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_ #include <com/sun/star/sdbc/XConnection.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_ #include <com/sun/star/sdbcx/XColumnsSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATASUPPLIER_HPP_ #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XROWSET_HPP_ #include <com/sun/star/sdbc/XRowSet.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_ #include <com/sun/star/sdbcx/XTablesSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDB_XQUERIESSUPPLIER_HPP_ #include <com/sun/star/sdb/XQueriesSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XDATASOURCE_HPP_ #include <com/sun/star/sdbc/XDataSource.hpp> -#endif -#ifndef _COM_SUN_STAR_AWT_FONTWEIGHT_HPP_ #include <com/sun/star/awt/FontWeight.hpp> -#endif -#ifndef _COM_SUN_STAR_AWT_FONTSTRIKEOUT_HPP_ #include <com/sun/star/awt/FontStrikeout.hpp> -#endif -#ifndef _COM_SUN_STAR_AWT_FONTSLANT_HPP_ #include <com/sun/star/awt/FontSlant.hpp> -#endif -#ifndef _COM_SUN_STAR_AWT_FONTUNDERLINE_HPP_ #include <com/sun/star/awt/FontUnderline.hpp> -#endif #include <com/sun/star/document/XDocumentProperties.hpp> -#ifndef _HTMLKYWD_HXX #include <svtools/htmlkywd.hxx> -#endif -#ifndef _RTFKEYWD_HXX #include <svtools/rtfkeywd.hxx> -#endif -#ifndef _TOOLS_COLOR_HXX #include <tools/color.hxx> -#endif -#ifndef _HTMLOUT_HXX #include <svtools/htmlout.hxx> -#endif -#ifndef _FRMHTMLW_HXX #include <sfx2/frmhtmlw.hxx> -#endif -#ifndef _NUMUNO_HXX #include <svtools/numuno.hxx> -#endif -#ifndef _SV_SVAPP_HXX #include <vcl/svapp.hxx> -#endif -#ifndef DBAUI_TOOLS_HXX #include "UITools.hxx" -#endif -#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ #include <toolkit/helper/vclunohelper.hxx> -#endif -#ifndef _SV_OUTDEV_HXX #include <vcl/outdev.hxx> -#endif -#ifndef _RTFOUT_HXX #include <svtools/rtfout.hxx> -#endif #include <svx/htmlcfg.hxx> #include <connectivity/formattedcolumnvalue.hxx> #include <svtools/syslocale.hxx> #include <comphelper/componentcontext.hxx> +#include <rtl/logfile.hxx> using namespace dbaui; using namespace dbtools; @@ -170,6 +111,7 @@ ODatabaseImportExport::ODatabaseImportExport(const ::svx::ODataAccessDescriptor& ,m_bInInitialize(sal_False) ,m_bCheckOnly(sal_False) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ODatabaseImportExport::ODatabaseImportExport" ); DBG_CTOR(ODatabaseImportExport,NULL); m_eDestEnc = osl_getThreadTextEncoding(); @@ -200,6 +142,7 @@ ODatabaseImportExport::ODatabaseImportExport( const ::dbtools::SharedConnection& ,m_bInInitialize(sal_False) ,m_bCheckOnly(sal_False) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ODatabaseImportExport::ODatabaseImportExport" ); DBG_CTOR(ODatabaseImportExport,NULL); m_eDestEnc = osl_getThreadTextEncoding(); try @@ -226,6 +169,7 @@ ODatabaseImportExport::~ODatabaseImportExport() // ----------------------------------------------------------------------------- void ODatabaseImportExport::dispose() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ODatabaseImportExport::disposing" ); DBG_CHKTHIS(ODatabaseImportExport,NULL); // remove me as listener Reference< XComponent > xComponent(m_xConnection, UNO_QUERY); @@ -247,6 +191,7 @@ void ODatabaseImportExport::dispose() // ----------------------------------------------------------------------------- void SAL_CALL ODatabaseImportExport::disposing( const EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ODatabaseImportExport::disposing" ); DBG_CHKTHIS(ODatabaseImportExport,NULL); Reference<XConnection> xCon(Source.Source,UNO_QUERY); if(m_xConnection.is() && m_xConnection == xCon) @@ -261,12 +206,14 @@ void SAL_CALL ODatabaseImportExport::disposing( const EventObject& Source ) thro // ----------------------------------------------------------------------------- void ODatabaseImportExport::initialize( const ODataAccessDescriptor& _aDataDescriptor ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ODatabaseImportExport::initialize" ); impl_initFromDescriptor( _aDataDescriptor, true ); } // ----------------------------------------------------------------------------- void ODatabaseImportExport::impl_initFromDescriptor( const ODataAccessDescriptor& _aDataDescriptor, bool _bPlusDefaultInit) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ODatabaseImportExport::impl_initFromDescriptor" ); DBG_CHKTHIS(ODatabaseImportExport,NULL); if ( !_bPlusDefaultInit ) { @@ -312,6 +259,7 @@ void ODatabaseImportExport::impl_initFromDescriptor( const ODataAccessDescriptor // ----------------------------------------------------------------------------- void ODatabaseImportExport::initialize() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ODatabaseImportExport::initialize" ); DBG_CHKTHIS(ODatabaseImportExport,NULL); m_bInInitialize = sal_True; m_bNeedToReInitialize = false; @@ -423,6 +371,7 @@ BOOL ODatabaseImportExport::Read() // ----------------------------------------------------------------------------- void ODatabaseImportExport::impl_initializeRowMember_throw() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ODatabaseImportExport::impl_initializeRowMember_throw" ); if ( !m_xRow.is() && m_xResultSet.is() ) { m_xRow.set(m_xResultSet,UNO_QUERY); @@ -434,6 +383,7 @@ void ODatabaseImportExport::impl_initializeRowMember_throw() //====================================================================== BOOL ORTFImportExport::Write() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ORTFImportExport::Write" ); ODatabaseImportExport::Write(); (*m_pStream) << '{' << sRTF_RTF; (*m_pStream) << sRTF_ANSI << ODatabaseImportExport::sNewLine; @@ -691,6 +641,7 @@ BOOL ORTFImportExport::Write() //------------------------------------------------------------------- BOOL ORTFImportExport::Read() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ORTFImportExport::Read" ); ODatabaseImportExport::Read(); SvParserState eState = SVPAR_ERROR; if ( m_pStream ) @@ -745,6 +696,7 @@ OHTMLImportExport::OHTMLImportExport(const ::svx::ODataAccessDescriptor& _aDataD ,m_bCheckFont(FALSE) #endif { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OHTMLImportExport::OHTMLImportExport" ); // set HTML configuration SvxHtmlOptions* pHtmlOptions = SvxHtmlOptions::Get(); m_eDestEnc = pHtmlOptions->GetTextEncoding(); @@ -754,6 +706,7 @@ OHTMLImportExport::OHTMLImportExport(const ::svx::ODataAccessDescriptor& _aDataD //------------------------------------------------------------------- BOOL OHTMLImportExport::Write() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OHTMLImportExport::Write" ); ODatabaseImportExport::Write(); if(m_xObject.is()) { @@ -772,6 +725,7 @@ BOOL OHTMLImportExport::Write() //------------------------------------------------------------------- BOOL OHTMLImportExport::Read() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OHTMLImportExport::Read" ); ODatabaseImportExport::Read(); SvParserState eState = SVPAR_ERROR; if ( m_pStream ) @@ -793,6 +747,7 @@ BOOL OHTMLImportExport::Read() //------------------------------------------------------------------- void OHTMLImportExport::WriteHeader() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OHTMLImportExport::WriteHeader" ); uno::Reference<document::XDocumentProperties> xDocProps( m_xFactory->createInstance(::rtl::OUString::createFromAscii( "com.sun.star.document.DocumentProperties")), @@ -811,6 +766,7 @@ void OHTMLImportExport::WriteHeader() //----------------------------------------------------------------------- void OHTMLImportExport::WriteBody() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OHTMLImportExport::WriteBody" ); IncIndent(1); TAG_ON_LF( sHTML_style ); @@ -849,6 +805,7 @@ void OHTMLImportExport::WriteBody() //----------------------------------------------------------------------- void OHTMLImportExport::WriteTables() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OHTMLImportExport::WriteTables" ); ::rtl::OString aStrOut = sHTML_table; aStrOut = aStrOut + " "; aStrOut = aStrOut + sHTML_frame; @@ -1023,6 +980,7 @@ void OHTMLImportExport::WriteTables() void OHTMLImportExport::WriteCell( sal_Int32 nFormat,sal_Int32 nWidthPixel,sal_Int32 nHeightPixel,const char* pChar, const String& rValue,const char* pHtmlTag) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OHTMLImportExport::WriteCell" ); ::rtl::OString aStrTD = pHtmlTag; nWidthPixel = nWidthPixel ? nWidthPixel : 86; @@ -1098,6 +1056,7 @@ void OHTMLImportExport::WriteCell( sal_Int32 nFormat,sal_Int32 nWidthPixel,sal_I //----------------------------------------------------------------------- void OHTMLImportExport::FontOn() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OHTMLImportExport::FontOn" ); #ifdef DBG_UTIL m_bCheckFont = TRUE; #endif @@ -1128,6 +1087,7 @@ void OHTMLImportExport::FontOn() //----------------------------------------------------------------------- inline void OHTMLImportExport::FontOff() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OHTMLImportExport::FontOff" ); DBG_ASSERT(m_bCheckFont,"Kein FontOn() gerufen"); TAG_OFF( sHTML_font ); #ifdef DBG_UTIL @@ -1137,6 +1097,7 @@ inline void OHTMLImportExport::FontOff() //----------------------------------------------------------------------- void OHTMLImportExport::IncIndent( sal_Int16 nVal ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OHTMLImportExport::IncIndent" ); sIndent[m_nIndent] = '\t'; m_nIndent = m_nIndent + nVal; if ( m_nIndent < 0 ) diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx index c5bfe2470b49..e38da91c606c 100644 --- a/dbaccess/source/ui/misc/UITools.cxx +++ b/dbaccess/source/ui/misc/UITools.cxx @@ -97,6 +97,7 @@ #ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATA_HPP_ #include <com/sun/star/sdbc/XResultSetMetaData.hpp> #endif +#include <com/sun/star/sdbc/ColumnValue.hpp> #ifndef _COM_SUN_STAR_TASK_XINTERACTIONHANDLER_HPP_ #include <com/sun/star/task/XInteractionHandler.hpp> #endif @@ -686,6 +687,7 @@ void fillTypeInfo( const Reference< ::com::sun::star::sdbc::XConnection>& _rxCo Reference<XResultSetMetaData> xResultSetMetaData = Reference<XResultSetMetaDataSupplier>(xRs,UNO_QUERY)->getMetaData(); ::connectivity::ORowSetValue aValue; ::std::vector<sal_Int32> aTypes; + ::std::vector<sal_Bool> aNullable; // Loop on the result set until we reach end of file while (xRs->next()) { @@ -699,55 +701,58 @@ void fillTypeInfo( const Reference< ::com::sun::star::sdbc::XConnection>& _rxCo aTypes.reserve(nCount+1); aTypes.push_back(-1); for (sal_Int32 j = 1; j <= nCount ; ++j) + { aTypes.push_back(xResultSetMetaData->getColumnType(j)); + aNullable.push_back(xResultSetMetaData->isNullable(j) != ColumnValue::NO_NULLS); + } } - aValue.fill(nPos,aTypes[nPos],xRow); + aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); pInfo->aTypeName = aValue; ++nPos; - aValue.fill(nPos,aTypes[nPos],xRow); + aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); pInfo->nType = aValue; ++nPos; - aValue.fill(nPos,aTypes[nPos],xRow); + aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); pInfo->nPrecision = aValue; ++nPos; - aValue.fill(nPos,aTypes[nPos],xRow); + aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); pInfo->aLiteralPrefix = aValue; ++nPos; - aValue.fill(nPos,aTypes[nPos],xRow); + aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); pInfo->aLiteralSuffix = aValue; ++nPos; - aValue.fill(nPos,aTypes[nPos],xRow); + aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); pInfo->aCreateParams = aValue; ++nPos; - aValue.fill(nPos,aTypes[nPos],xRow); + aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); pInfo->bNullable = (sal_Int32)aValue == ColumnValue::NULLABLE; ++nPos; - aValue.fill(nPos,aTypes[nPos],xRow); + aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); pInfo->bCaseSensitive = (sal_Bool)aValue; ++nPos; - aValue.fill(nPos,aTypes[nPos],xRow); + aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); pInfo->nSearchType = aValue; ++nPos; - aValue.fill(nPos,aTypes[nPos],xRow); + aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); pInfo->bUnsigned = (sal_Bool)aValue; ++nPos; - aValue.fill(nPos,aTypes[nPos],xRow); + aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); pInfo->bCurrency = (sal_Bool)aValue; ++nPos; - aValue.fill(nPos,aTypes[nPos],xRow); + aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); pInfo->bAutoIncrement = (sal_Bool)aValue; ++nPos; - aValue.fill(nPos,aTypes[nPos],xRow); + aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); pInfo->aLocalTypeName = aValue; ++nPos; - aValue.fill(nPos,aTypes[nPos],xRow); + aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); pInfo->nMinimumScale = aValue; ++nPos; - aValue.fill(nPos,aTypes[nPos],xRow); + aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); pInfo->nMaximumScale = aValue; nPos = 18; - aValue.fill(nPos,aTypes[nPos],xRow); + aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); // check if values are less than zero like it happens in a oracle jdbc driver if( pInfo->nPrecision < 0) diff --git a/dbaccess/source/ui/misc/UpdateHelperImpl.hxx b/dbaccess/source/ui/misc/UpdateHelperImpl.hxx index ed40973dafa8..a0a9e63fc183 100644 --- a/dbaccess/source/ui/misc/UpdateHelperImpl.hxx +++ b/dbaccess/source/ui/misc/UpdateHelperImpl.hxx @@ -30,24 +30,14 @@ #ifndef DBAUI_UPDATEHELPERIMPL_HXX #define DBAUI_UPDATEHELPERIMPL_HXX -#ifndef _COM_SUN_STAR_SDBC_XRESULTSETUPDATE_HPP_ #include <com/sun/star/sdbc/XResultSetUpdate.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XROWUPDATE_HPP_ #include <com/sun/star/sdbc/XRowUpdate.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XPARAMETERS_HPP_ #include <com/sun/star/sdbc/XParameters.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XPREPAREDSTATEMENT_HPP_ #include <com/sun/star/sdbc/XPreparedStatement.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XROWSET_HPP_ #include <com/sun/star/sdbc/XRowSet.hpp> -#endif -#ifndef DBAUI_IUPDATEHELPER_HXX +#include <com/sun/star/sdbc/XResultSetMetaData.hpp> #include "IUpdateHelper.hxx" -#endif +#include <rtl/logfile.hxx> namespace dbaui { @@ -102,18 +92,22 @@ namespace dbaui virtual ~OParameterUpdateHelper() {} virtual void updateString(sal_Int32 _nPos, const ::rtl::OUString& _sValue) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OParameterUpdateHelper::updateString" ); m_xParameters->setString(_nPos, _sValue); } virtual void updateDouble(sal_Int32 _nPos,const double& _nValue) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OParameterUpdateHelper::updateDouble" ); m_xParameters->setDouble(_nPos, _nValue); } virtual void updateInt(sal_Int32 _nPos,const sal_Int32& _nValue) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OParameterUpdateHelper::updateInt" ); m_xParameters->setInt(_nPos, _nValue); } virtual void updateNull(sal_Int32 _nPos, ::sal_Int32 sqlType) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OParameterUpdateHelper::updateNull" ); m_xParameters->setNull(_nPos,sqlType); } virtual void moveToInsertRow() @@ -121,6 +115,7 @@ namespace dbaui } virtual void insertRow() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OParameterUpdateHelper::insertRow" ); m_xPrepared->executeUpdate(); } }; diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx index ca3408bd0285..0cd8ae2dbeb4 100644 --- a/dbaccess/source/ui/misc/WCopyTable.cxx +++ b/dbaccess/source/ui/misc/WCopyTable.cxx @@ -64,6 +64,7 @@ #include <comphelper/types.hxx> #include <connectivity/dbtools.hxx> +#include <rtl/logfile.hxx> #include <rtl/ustrbuf.hxx> #include <tools/debug.hxx> #include <tools/diagnose_ex.h> @@ -585,6 +586,7 @@ OCopyTableWizard::OCopyTableWizard( Window * pParent, const ::rtl::OUString& _rD ,m_ePressed( WIZARD_NONE ) ,m_bCreatePrimaryKeyColumn(sal_False) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::OCopyTableWizard" ); DBG_CTOR(OCopyTableWizard,NULL); construct(); @@ -668,6 +670,7 @@ OCopyTableWizard::OCopyTableWizard( Window* pParent, const ::rtl::OUString& _rDe ,m_ePressed( WIZARD_NONE ) ,m_bCreatePrimaryKeyColumn(sal_False) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::OCopyTableWizard" ); DBG_CTOR(OCopyTableWizard,NULL); construct(); ODatabaseExport::TColumnVector::const_iterator aIter = _rSourceColVec.begin(); @@ -695,6 +698,7 @@ OCopyTableWizard::OCopyTableWizard( Window* pParent, const ::rtl::OUString& _rDe // ----------------------------------------------------------------------------- void OCopyTableWizard::construct() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::construct" ); AddButton( &m_pbHelp, WIZARDDIALOG_BUTTON_STDOFFSET_X ); AddButton( &m_pbCancel, WIZARDDIALOG_BUTTON_STDOFFSET_X ); AddButton( &m_pbPrev ); @@ -790,6 +794,7 @@ IMPL_LINK( OCopyTableWizard, ImplNextHdl, PushButton*, EMPTYARG ) // ----------------------------------------------------------------------- sal_Bool OCopyTableWizard::CheckColumns(sal_Int32& _rnBreakPos) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::CheckColumns" ); sal_Bool bRet = sal_True; m_vColumnPos.clear(); m_vColumnTypes.clear(); @@ -959,12 +964,14 @@ IMPL_LINK( OCopyTableWizard, ImplOKHdl, OKButton*, EMPTYARG ) //------------------------------------------------------------------------ sal_Bool OCopyTableWizard::shouldCreatePrimaryKey() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::shouldCreatePrimaryKey" ); return m_bCreatePrimaryKeyColumn; } // ----------------------------------------------------------------------- void OCopyTableWizard::setCreatePrimaryKey( bool _bDoCreate, const ::rtl::OUString& _rSuggestedName ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::setCreatePrimaryKey" ); m_bCreatePrimaryKeyColumn = _bDoCreate; if ( _rSuggestedName.getLength() ) m_aKeyName = _rSuggestedName; @@ -996,6 +1003,7 @@ IMPL_LINK( OCopyTableWizard, ImplActivateHdl, WizardDialog*, EMPTYARG ) // ----------------------------------------------------------------------- void OCopyTableWizard::CheckButtons() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::CheckButtons" ); if(GetCurLevel() == 0) // erste Seite hat kein PrevButton { if(m_nPageCount > 1) @@ -1019,6 +1027,7 @@ void OCopyTableWizard::CheckButtons() // ----------------------------------------------------------------------- void OCopyTableWizard::EnableButton(Wizard_Button_Style eStyle,sal_Bool bEnable) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::EnableButton" ); // CheckButtons(); Button* pButton; if(eStyle == WIZARD_NEXT) @@ -1033,18 +1042,21 @@ void OCopyTableWizard::EnableButton(Wizard_Button_Style eStyle,sal_Bool bEnable) // ----------------------------------------------------------------------- long OCopyTableWizard::DeactivatePage() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::DeactivatePage" ); OWizardPage* pPage = (OWizardPage*)GetPage(GetCurLevel()); return pPage ? pPage->LeavePage() : sal_False; } // ----------------------------------------------------------------------- void OCopyTableWizard::AddWizardPage(OWizardPage* pPage) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::AddWizardPage" ); AddPage(pPage); ++m_nPageCount; } // ----------------------------------------------------------------------------- void OCopyTableWizard::insertColumn(sal_Int32 _nPos,OFieldDescription* _pField) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::insertColumn" ); OSL_ENSURE(_pField,"FieldDescrioption is null!"); if ( _pField ) { @@ -1062,6 +1074,7 @@ void OCopyTableWizard::insertColumn(sal_Int32 _nPos,OFieldDescription* _pField) // ----------------------------------------------------------------------------- void OCopyTableWizard::replaceColumn(sal_Int32 _nPos,OFieldDescription* _pField,const ::rtl::OUString& _sOldName) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::replaceColumn" ); OSL_ENSURE(_pField,"FieldDescrioption is null!"); if ( _pField ) { @@ -1075,12 +1088,14 @@ void OCopyTableWizard::replaceColumn(sal_Int32 _nPos,OFieldDescription* _pField, // ----------------------------------------------------------------------------- void OCopyTableWizard::impl_loadSourceData() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::impl_loadSourceData" ); loadData( m_rSourceObject, m_vSourceColumns, m_vSourceVec ); } // ----------------------------------------------------------------------------- void OCopyTableWizard::loadData( const ICopyTableSourceObject& _rSourceObject, ODatabaseExport::TColumns& _rColumns, ODatabaseExport::TColumnVector& _rColVector ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::loadData" ); for ( ODatabaseExport::TColumns::iterator col = _rColumns.begin(); col != _rColumns.end(); ++col ) delete col->second; @@ -1141,12 +1156,14 @@ void OCopyTableWizard::loadData( const ICopyTableSourceObject& _rSourceObject, // ----------------------------------------------------------------------------- void OCopyTableWizard::clearDestColumns() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::clearDestColumns" ); clearColumns(m_vDestColumns,m_aDestVec); } // ----------------------------------------------------------------------------- void OCopyTableWizard::appendColumns( Reference<XColumnsSupplier>& _rxColSup, const ODatabaseExport::TColumnVector* _pVec, sal_Bool _bKeyColumns) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::appendColumns" ); // now append the columns OSL_ENSURE(_rxColSup.is(),"No columns supplier"); if(!_rxColSup.is()) @@ -1196,6 +1213,7 @@ void OCopyTableWizard::appendColumns( Reference<XColumnsSupplier>& _rxColSup, co // ----------------------------------------------------------------------------- void OCopyTableWizard::appendKey( Reference<XKeysSupplier>& _rxSup, const ODatabaseExport::TColumnVector* _pVec) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::appendKey" ); if(!_rxSup.is()) return; // the database doesn't support keys OSL_ENSURE(_rxSup.is(),"No XKeysSupplier!"); @@ -1223,6 +1241,7 @@ void OCopyTableWizard::appendKey( Reference<XKeysSupplier>& _rxSup, const ODatab // ----------------------------------------------------------------------------- Reference< XPropertySet > OCopyTableWizard::createView() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::createView" ); ::rtl::OUString sCommand( m_rSourceObject.getSelectStatement() ); OSL_ENSURE( sCommand.getLength(), "OCopyTableWizard::createView: no statement in the source object!" ); // there are legitimate cases in which getSelectStatement does not provide a statement, @@ -1232,6 +1251,7 @@ Reference< XPropertySet > OCopyTableWizard::createView() const // ----------------------------------------------------------------------------- Reference< XPropertySet > OCopyTableWizard::createTable() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::createTable" ); Reference< XPropertySet > xTable; Reference<XTablesSupplier> xSup( m_xDestConnection, UNO_QUERY ); @@ -1356,6 +1376,7 @@ Reference< XPropertySet > OCopyTableWizard::createTable() // ----------------------------------------------------------------------------- bool OCopyTableWizard::supportsPrimaryKey( const Reference< XConnection >& _rxConnection ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::supportsPrimaryKey" ); OSL_PRECOND( _rxConnection.is(), "OCopyTableWizard::supportsPrimaryKey: invalid connection!" ); bool bSupports( false ); @@ -1377,6 +1398,7 @@ bool OCopyTableWizard::supportsPrimaryKey( const Reference< XConnection >& _rxCo // ----------------------------------------------------------------------------- bool OCopyTableWizard::supportsViews( const Reference< XConnection >& _rxConnection ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::supportsViews" ); OSL_PRECOND( _rxConnection.is(), "OCopyTableWizard::supportsViews: invalid connection!" ); if ( !_rxConnection.is() ) return false; @@ -1419,6 +1441,7 @@ bool OCopyTableWizard::supportsViews( const Reference< XConnection >& _rxConnect // ----------------------------------------------------------------------------- sal_Int32 OCopyTableWizard::getMaxColumnNameLength() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::getMaxColumnNameLength" ); sal_Int32 nLen = 0; if ( m_xDestConnection.is() ) { @@ -1437,11 +1460,13 @@ sal_Int32 OCopyTableWizard::getMaxColumnNameLength() const // ----------------------------------------------------------------------------- void OCopyTableWizard::setOperation( const sal_Int16 _nOperation ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::setOperation" ); m_nOperation = _nOperation; } // ----------------------------------------------------------------------------- sal_Int16 OCopyTableWizard::getOperation() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::getOperation" ); return m_nOperation; } // ----------------------------------------------------------------------------- @@ -1450,6 +1475,7 @@ sal_Int16 OCopyTableWizard::getOperation() const const ::rtl::OUString& _sExtraChars, sal_Int32 _nMaxNameLen) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::convertColumnName" ); ::rtl::OUString sAlias = _sColumnName; if ( isSQL92CheckEnabled( m_xDestConnection ) ) sAlias = ::dbtools::convertName2SQLName(_sColumnName,_sExtraChars); @@ -1484,12 +1510,14 @@ sal_Int16 OCopyTableWizard::getOperation() const // ----------------------------------------------------------------------------- void OCopyTableWizard::removeColumnNameFromNameMap(const ::rtl::OUString& _sName) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::removeColumnNameFromNameMap" ); m_mNameMapping.erase(_sName); } // ----------------------------------------------------------------------------- sal_Bool OCopyTableWizard::supportsType(sal_Int32 _nDataType,sal_Int32& _rNewDataType) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::supportsType" ); sal_Bool bRet = m_aDestTypeInfo.find(_nDataType) != m_aDestTypeInfo.end(); if ( bRet ) _rNewDataType = _nDataType; @@ -1499,6 +1527,7 @@ sal_Bool OCopyTableWizard::supportsType(sal_Int32 _nDataType,sal_Int32& _rNewDat // ----------------------------------------------------------------------------- TOTypeInfoSP OCopyTableWizard::convertType(const TOTypeInfoSP& _pType,sal_Bool& _bNotConvert) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::convertType" ); if ( !m_bInterConnectionCopy ) // no need to convert if the source and destination connection are the same return _pType; @@ -1577,6 +1606,7 @@ TOTypeInfoSP OCopyTableWizard::convertType(const TOTypeInfoSP& _pType,sal_Bool& // ----------------------------------------------------------------------------- ::rtl::OUString OCopyTableWizard::createUniqueName(const ::rtl::OUString& _sName) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::createUniqueName" ); ::rtl::OUString sName = _sName; Sequence< ::rtl::OUString > aColumnNames( m_rSourceObject.getColumnNames() ); if ( aColumnNames.getLength() ) @@ -1598,6 +1628,7 @@ TOTypeInfoSP OCopyTableWizard::convertType(const TOTypeInfoSP& _pType,sal_Bool& // ----------------------------------------------------------------------------- void OCopyTableWizard::showColumnTypeNotSupported(const ::rtl::OUString& _rColumnName) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::showColumnTypeNotSupported" ); String sMessage( ModuleRes( STR_UNKNOWN_TYPE_FOUND ) ); sMessage.SearchAndReplaceAscii("#1",_rColumnName); diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx index 476f87d4a7a8..511edcd4bb07 100644 --- a/dbaccess/source/ui/uno/copytablewizard.cxx +++ b/dbaccess/source/ui/uno/copytablewizard.cxx @@ -73,6 +73,7 @@ #include <cppuhelper/exc_hlp.hxx> #include <cppuhelper/implbase1.hxx> #include <rtl/ustrbuf.hxx> +#include <rtl/logfile.hxx> #include <svtools/genericunodialog.hxx> #include <tools/diagnose_ex.h> #include <unotools/sharedunocomponent.hxx> @@ -291,6 +292,11 @@ namespace dbaui */ void impl_doCopy_nothrow(); + /** creates the INSERT INTO statement + @param _xTable The destination table. + */ + ::rtl::OUString impl_getSelectStatement_nothrow(const Reference< XPropertySet >& _xTable); + /** creates the statement which, when executed, will produce the source data to copy If the source object refers to a query which contains parameters, those parameters @@ -344,1143 +350,1223 @@ private: sal_Int16 m_nOverrideExecutionResult; }; - //========================================================================= - //= MethodGuard - //========================================================================= - class CopyTableAccessGuard - { - public: - CopyTableAccessGuard( CopyTableWizard& _rWizard ) - :m_rWizard( _rWizard ) - { - m_rWizard.getMutex().acquire(); - if ( !m_rWizard.isInitialized() ) - throw NotInitializedException(); - } - - ~CopyTableAccessGuard() - { - m_rWizard.getMutex().release(); - } - - private: - CopyTableWizard& m_rWizard; - }; - - //========================================================================= - //------------------------------------------------------------------------- - CopyTableWizard::CopyTableWizard( const Reference< XMultiServiceFactory >& _rxORB ) - :CopyTableWizard_Base( _rxORB ) - ,m_aContext( _rxORB ) - ,m_nOperation( CopyTableOperation::CopyDefinitionAndData ) - ,m_sDestinationTable() - ,m_aPrimaryKeyName( sal_False, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ID" ) )) - ,m_xSourceConnection() - ,m_nCommandType( CommandType::COMMAND ) - ,m_pSourceObject() - ,m_aSourceSelection() - ,m_bSourceSelectionBookmarks( true ) - ,m_xDestConnection() - ,m_aCopyTableListeners( m_aMutex ) - ,m_nOverrideExecutionResult( -1 ) +//========================================================================= +//= MethodGuard +//========================================================================= +class CopyTableAccessGuard +{ +public: + CopyTableAccessGuard( CopyTableWizard& _rWizard ) + :m_rWizard( _rWizard ) { + m_rWizard.getMutex().acquire(); + if ( !m_rWizard.isInitialized() ) + throw NotInitializedException(); } - //------------------------------------------------------------------------- - CopyTableWizard::~CopyTableWizard() + ~CopyTableAccessGuard() { - acquire(); - - // protect some members whose dtor might potentially throw - try { m_xSourceConnection.clear(); } - catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); } - try { m_xDestConnection.clear(); } - catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); } - - // TODO: shouldn't we have explicit disposal support? If a listener is registered - // at our instance, and perhaps holds this our instance by a hard ref, then we'll never - // destroyed. - // However, adding XComponent support to the GenericUNODialog probably requires - // some thinking - would it break existing clients which do not call a dispose, then? + m_rWizard.getMutex().release(); } - //------------------------------------------------------------------------- - Reference< XInterface > CopyTableWizard::Create( const Reference< XMultiServiceFactory >& _rxFactory ) - { - return *( new CopyTableWizard( _rxFactory ) ); - } +private: + CopyTableWizard& m_rWizard; +}; + +//========================================================================= +//------------------------------------------------------------------------- +CopyTableWizard::CopyTableWizard( const Reference< XMultiServiceFactory >& _rxORB ) + :CopyTableWizard_Base( _rxORB ) + ,m_aContext( _rxORB ) + ,m_nOperation( CopyTableOperation::CopyDefinitionAndData ) + ,m_sDestinationTable() + ,m_aPrimaryKeyName( sal_False, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ID" ) )) + ,m_xSourceConnection() + ,m_nCommandType( CommandType::COMMAND ) + ,m_pSourceObject() + ,m_aSourceSelection() + ,m_bSourceSelectionBookmarks( true ) + ,m_xDestConnection() + ,m_aCopyTableListeners( m_aMutex ) + ,m_nOverrideExecutionResult( -1 ) +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::CopyTableWizard" ); +} - //------------------------------------------------------------------------- - ::rtl::OUString SAL_CALL CopyTableWizard::getImplementationName() throw(RuntimeException) - { - return getImplementationName_Static(); - } +//------------------------------------------------------------------------- +CopyTableWizard::~CopyTableWizard() +{ + acquire(); + + // protect some members whose dtor might potentially throw + try { m_xSourceConnection.clear(); } + catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); } + try { m_xDestConnection.clear(); } + catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); } + + // TODO: shouldn't we have explicit disposal support? If a listener is registered + // at our instance, and perhaps holds this our instance by a hard ref, then we'll never + // destroyed. + // However, adding XComponent support to the GenericUNODialog probably requires + // some thinking - would it break existing clients which do not call a dispose, then? +} - //------------------------------------------------------------------------- - ::rtl::OUString CopyTableWizard::getImplementationName_Static() throw(RuntimeException) - { - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.comp.dbu.CopyTableWizard" ) ); - } +//------------------------------------------------------------------------- +Reference< XInterface > CopyTableWizard::Create( const Reference< XMultiServiceFactory >& _rxFactory ) +{ + return *( new CopyTableWizard( _rxFactory ) ); +} - //------------------------------------------------------------------------- - ::comphelper::StringSequence SAL_CALL CopyTableWizard::getSupportedServiceNames() throw(RuntimeException) - { - return getSupportedServiceNames_Static(); - } +//------------------------------------------------------------------------- +::rtl::OUString SAL_CALL CopyTableWizard::getImplementationName() throw(RuntimeException) +{ + return getImplementationName_Static(); +} - //------------------------------------------------------------------------- - ::comphelper::StringSequence CopyTableWizard::getSupportedServiceNames_Static() throw(RuntimeException) - { - ::comphelper::StringSequence aSupported(1); - aSupported.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.application.CopyTableWizard" ) ); - return aSupported; - } +//------------------------------------------------------------------------- +::rtl::OUString CopyTableWizard::getImplementationName_Static() throw(RuntimeException) +{ + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.comp.dbu.CopyTableWizard" ) ); +} - //------------------------------------------------------------------------- - Reference< XPropertySetInfo > SAL_CALL CopyTableWizard::getPropertySetInfo() throw(RuntimeException) - { - Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); - return xInfo; - } +//------------------------------------------------------------------------- +::comphelper::StringSequence SAL_CALL CopyTableWizard::getSupportedServiceNames() throw(RuntimeException) +{ + return getSupportedServiceNames_Static(); +} - //-------------------------------------------------------------------- - ::sal_Int16 SAL_CALL CopyTableWizard::getOperation() throw (RuntimeException) - { - CopyTableAccessGuard aGuard( *this ); - return m_nOperation; - } +//------------------------------------------------------------------------- +::comphelper::StringSequence CopyTableWizard::getSupportedServiceNames_Static() throw(RuntimeException) +{ + ::comphelper::StringSequence aSupported(1); + aSupported.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.application.CopyTableWizard" ) ); + return aSupported; +} - //-------------------------------------------------------------------- - void SAL_CALL CopyTableWizard::setOperation( ::sal_Int16 _operation ) throw (IllegalArgumentException, RuntimeException) - { - CopyTableAccessGuard aGuard( *this ); - - if ( ( _operation != CopyTableOperation::CopyDefinitionAndData ) - && ( _operation != CopyTableOperation::CopyDefinitionOnly ) - && ( _operation != CopyTableOperation::CreateAsView ) - && ( _operation != CopyTableOperation::AppendData ) - ) - throw IllegalArgumentException( ::rtl::OUString(), *this, 1 ); - - if ( ( _operation == CopyTableOperation::CreateAsView ) - && !OCopyTableWizard::supportsViews( m_xDestConnection ) - ) - throw IllegalArgumentException( - String( ModuleRes( STR_CTW_NO_VIEWS_SUPPORT ) ), - *this, - 1 - ); +//------------------------------------------------------------------------- +Reference< XPropertySetInfo > SAL_CALL CopyTableWizard::getPropertySetInfo() throw(RuntimeException) +{ + Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); + return xInfo; +} - m_nOperation = _operation; - } +//-------------------------------------------------------------------- +::sal_Int16 SAL_CALL CopyTableWizard::getOperation() throw (RuntimeException) +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::getOperation" ); + CopyTableAccessGuard aGuard( *this ); + return m_nOperation; +} - //-------------------------------------------------------------------- - ::rtl::OUString SAL_CALL CopyTableWizard::getDestinationTableName() throw (RuntimeException) - { - CopyTableAccessGuard aGuard( *this ); - return m_sDestinationTable; - } +//-------------------------------------------------------------------- +void SAL_CALL CopyTableWizard::setOperation( ::sal_Int16 _operation ) throw (IllegalArgumentException, RuntimeException) +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::setOperation" ); + CopyTableAccessGuard aGuard( *this ); + + if ( ( _operation != CopyTableOperation::CopyDefinitionAndData ) + && ( _operation != CopyTableOperation::CopyDefinitionOnly ) + && ( _operation != CopyTableOperation::CreateAsView ) + && ( _operation != CopyTableOperation::AppendData ) + ) + throw IllegalArgumentException( ::rtl::OUString(), *this, 1 ); + + if ( ( _operation == CopyTableOperation::CreateAsView ) + && !OCopyTableWizard::supportsViews( m_xDestConnection ) + ) + throw IllegalArgumentException( + String( ModuleRes( STR_CTW_NO_VIEWS_SUPPORT ) ), + *this, + 1 + ); - //-------------------------------------------------------------------- - void SAL_CALL CopyTableWizard::setDestinationTableName( const ::rtl::OUString& _destinationTableName ) throw (RuntimeException) - { - CopyTableAccessGuard aGuard( *this ); - m_sDestinationTable = _destinationTableName; - } + m_nOperation = _operation; +} - //-------------------------------------------------------------------- - Optional< ::rtl::OUString > SAL_CALL CopyTableWizard::getCreatePrimaryKey() throw (RuntimeException) - { - CopyTableAccessGuard aGuard( *this ); - return m_aPrimaryKeyName; - } +//-------------------------------------------------------------------- +::rtl::OUString SAL_CALL CopyTableWizard::getDestinationTableName() throw (RuntimeException) +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::getDestinationTableName" ); + CopyTableAccessGuard aGuard( *this ); + return m_sDestinationTable; +} - //-------------------------------------------------------------------- - void SAL_CALL CopyTableWizard::setCreatePrimaryKey( const Optional< ::rtl::OUString >& _newPrimaryKey ) throw (IllegalArgumentException, RuntimeException) - { - CopyTableAccessGuard aGuard( *this ); +//-------------------------------------------------------------------- +void SAL_CALL CopyTableWizard::setDestinationTableName( const ::rtl::OUString& _destinationTableName ) throw (RuntimeException) +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::setDestinationTableName" ); + CopyTableAccessGuard aGuard( *this ); + m_sDestinationTable = _destinationTableName; +} - if ( _newPrimaryKey.IsPresent && !OCopyTableWizard::supportsPrimaryKey( m_xDestConnection ) ) - throw IllegalArgumentException( - String( ModuleRes( STR_CTW_NO_PRIMARY_KEY_SUPPORT ) ), - *this, - 1 - ); +//-------------------------------------------------------------------- +Optional< ::rtl::OUString > SAL_CALL CopyTableWizard::getCreatePrimaryKey() throw (RuntimeException) +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::getCreatePrimaryKey" ); + CopyTableAccessGuard aGuard( *this ); + return m_aPrimaryKeyName; +} - m_aPrimaryKeyName = _newPrimaryKey; - } +//-------------------------------------------------------------------- +void SAL_CALL CopyTableWizard::setCreatePrimaryKey( const Optional< ::rtl::OUString >& _newPrimaryKey ) throw (IllegalArgumentException, RuntimeException) +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::setCreatePrimaryKey" ); + CopyTableAccessGuard aGuard( *this ); + + if ( _newPrimaryKey.IsPresent && !OCopyTableWizard::supportsPrimaryKey( m_xDestConnection ) ) + throw IllegalArgumentException( + String( ModuleRes( STR_CTW_NO_PRIMARY_KEY_SUPPORT ) ), + *this, + 1 + ); - //-------------------------------------------------------------------- - void SAL_CALL CopyTableWizard::addCopyTableListener( const Reference< XCopyTableListener >& _rxListener ) throw (RuntimeException) - { - CopyTableAccessGuard aGuard( *this ); - if ( _rxListener.is() ) - m_aCopyTableListeners.addInterface( _rxListener ); - } + m_aPrimaryKeyName = _newPrimaryKey; +} - //-------------------------------------------------------------------- - void SAL_CALL CopyTableWizard::removeCopyTableListener( const Reference< XCopyTableListener >& _rxListener ) throw (RuntimeException) - { - CopyTableAccessGuard aGuard( *this ); - if ( _rxListener.is() ) - m_aCopyTableListeners.removeInterface( _rxListener ); - } +//-------------------------------------------------------------------- +void SAL_CALL CopyTableWizard::addCopyTableListener( const Reference< XCopyTableListener >& _rxListener ) throw (RuntimeException) +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::addCopyTableListener" ); + CopyTableAccessGuard aGuard( *this ); + if ( _rxListener.is() ) + m_aCopyTableListeners.addInterface( _rxListener ); +} - //-------------------------------------------------------------------- - void SAL_CALL CopyTableWizard::setTitle( const ::rtl::OUString& _rTitle ) throw (RuntimeException) - { - CopyTableAccessGuard aGuard( *this ); - CopyTableWizard_DialogBase::setTitle( _rTitle ); - } +//-------------------------------------------------------------------- +void SAL_CALL CopyTableWizard::removeCopyTableListener( const Reference< XCopyTableListener >& _rxListener ) throw (RuntimeException) +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::removeCopyTableListener" ); + CopyTableAccessGuard aGuard( *this ); + if ( _rxListener.is() ) + m_aCopyTableListeners.removeInterface( _rxListener ); +} - //-------------------------------------------------------------------- - ::sal_Int16 SAL_CALL CopyTableWizard::execute( ) throw (RuntimeException) - { - CopyTableAccessGuard aGuard( *this ); +//-------------------------------------------------------------------- +void SAL_CALL CopyTableWizard::setTitle( const ::rtl::OUString& _rTitle ) throw (RuntimeException) +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::setTitle" ); + CopyTableAccessGuard aGuard( *this ); + CopyTableWizard_DialogBase::setTitle( _rTitle ); +} - m_nOverrideExecutionResult = -1; - sal_Int16 nExecutionResult = CopyTableWizard_DialogBase::execute(); - if ( m_nOverrideExecutionResult ) - nExecutionResult = m_nOverrideExecutionResult; +//-------------------------------------------------------------------- +::sal_Int16 SAL_CALL CopyTableWizard::execute( ) throw (RuntimeException) +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::execute" ); + CopyTableAccessGuard aGuard( *this ); - return nExecutionResult; - } + m_nOverrideExecutionResult = -1; + sal_Int16 nExecutionResult = CopyTableWizard_DialogBase::execute(); + if ( m_nOverrideExecutionResult ) + nExecutionResult = m_nOverrideExecutionResult; - //------------------------------------------------------------------------- - OCopyTableWizard& CopyTableWizard::impl_getDialog_throw() - { - OCopyTableWizard* pWizard = dynamic_cast< OCopyTableWizard* >( m_pDialog ); - if ( !pWizard ) - throw DisposedException( ::rtl::OUString(), *this ); - return *pWizard; - } + return nExecutionResult; +} - //------------------------------------------------------------------------- - const OCopyTableWizard& CopyTableWizard::impl_getDialog_throw() const - { - const OCopyTableWizard* pWizard = dynamic_cast< const OCopyTableWizard* >( m_pDialog ); - if ( !pWizard ) - throw DisposedException( ::rtl::OUString(), *const_cast< CopyTableWizard* >( this ) ); - return *pWizard; - } +//------------------------------------------------------------------------- +OCopyTableWizard& CopyTableWizard::impl_getDialog_throw() +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::impl_getDialog_throw" ); + OCopyTableWizard* pWizard = dynamic_cast< OCopyTableWizard* >( m_pDialog ); + if ( !pWizard ) + throw DisposedException( ::rtl::OUString(), *this ); + return *pWizard; +} - //------------------------------------------------------------------------- - void CopyTableWizard::impl_attributesToDialog_nothrow( OCopyTableWizard& _rDialog ) const - { - // primary key column - _rDialog.setCreatePrimaryKey( m_aPrimaryKeyName.IsPresent, m_aPrimaryKeyName.Value ); +//------------------------------------------------------------------------- +const OCopyTableWizard& CopyTableWizard::impl_getDialog_throw() const +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::impl_getDialog_throw" ); + const OCopyTableWizard* pWizard = dynamic_cast< const OCopyTableWizard* >( m_pDialog ); + if ( !pWizard ) + throw DisposedException( ::rtl::OUString(), *const_cast< CopyTableWizard* >( this ) ); + return *pWizard; +} - // everything else was passed at construction time already - } +//------------------------------------------------------------------------- +void CopyTableWizard::impl_attributesToDialog_nothrow( OCopyTableWizard& _rDialog ) const +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::impl_attributesToDialog_nothrow" ); + // primary key column + _rDialog.setCreatePrimaryKey( m_aPrimaryKeyName.IsPresent, m_aPrimaryKeyName.Value ); - //------------------------------------------------------------------------- - void CopyTableWizard::impl_dialogToAttributes_nothrow( const OCopyTableWizard& _rDialog ) - { - m_aPrimaryKeyName.IsPresent = _rDialog.shouldCreatePrimaryKey(); - if ( m_aPrimaryKeyName.IsPresent ) - m_aPrimaryKeyName.Value = _rDialog.getPrimaryKeyName(); - else - m_aPrimaryKeyName.Value = ::rtl::OUString(); + // everything else was passed at construction time already +} - m_sDestinationTable = _rDialog.getName(); +//------------------------------------------------------------------------- +void CopyTableWizard::impl_dialogToAttributes_nothrow( const OCopyTableWizard& _rDialog ) +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::impl_dialogToAttributes_nothrow" ); + m_aPrimaryKeyName.IsPresent = _rDialog.shouldCreatePrimaryKey(); + if ( m_aPrimaryKeyName.IsPresent ) + m_aPrimaryKeyName.Value = _rDialog.getPrimaryKeyName(); + else + m_aPrimaryKeyName.Value = ::rtl::OUString(); - m_nOperation = _rDialog.getOperation(); - } + m_sDestinationTable = _rDialog.getName(); - //------------------------------------------------------------------------- - namespace - { - //..................................................................... - /** tries to obtain the InteractionHandler associated with a given data source + m_nOperation = _rDialog.getOperation(); +} - If the data source is a sdb-level data source, it will have a DatabaseDocument associated - with it. This doocument may have an InteractionHandler used while loading it. +//------------------------------------------------------------------------- +namespace +{ + //..................................................................... + /** tries to obtain the InteractionHandler associated with a given data source - @throws RuntimeException - if it occures during invoking any of the data source's methods, or if any of the involved - components violates its contract by not providing the required interfaces - */ - InteractionHandler lcl_getInteractionHandler_throw( const Reference< XDataSource >& _rxDataSource, const InteractionHandler& _rFallback ) - { - InteractionHandler xHandler( _rFallback ); + If the data source is a sdb-level data source, it will have a DatabaseDocument associated + with it. This doocument may have an InteractionHandler used while loading it. - // try to obtain the document model - Reference< XModel > xDocumentModel; - Reference< XDocumentDataSource > xDocDataSource( _rxDataSource, UNO_QUERY ); - if ( xDocDataSource.is() ) - xDocumentModel.set( xDocDataSource->getDatabaseDocument(), UNO_QUERY_THROW ); + @throws RuntimeException + if it occures during invoking any of the data source's methods, or if any of the involved + components violates its contract by not providing the required interfaces + */ + InteractionHandler lcl_getInteractionHandler_throw( const Reference< XDataSource >& _rxDataSource, const InteractionHandler& _rFallback ) + { + InteractionHandler xHandler( _rFallback ); - // see whether the document model can provide a handler - if ( xDocumentModel.is() ) - { - ::comphelper::NamedValueCollection aModelArgs( xDocumentModel->getArgs() ); - xHandler = aModelArgs.getOrDefault( "InteractionHandler", xHandler ); - } + // try to obtain the document model + Reference< XModel > xDocumentModel; + Reference< XDocumentDataSource > xDocDataSource( _rxDataSource, UNO_QUERY ); + if ( xDocDataSource.is() ) + xDocumentModel.set( xDocDataSource->getDatabaseDocument(), UNO_QUERY_THROW ); - return xHandler; + // see whether the document model can provide a handler + if ( xDocumentModel.is() ) + { + ::comphelper::NamedValueCollection aModelArgs( xDocumentModel->getArgs() ); + xHandler = aModelArgs.getOrDefault( "InteractionHandler", xHandler ); } - //..................................................................... - /** tries to obtain the InteractionHandler associated with a given connection - If the connection belongs to a sdb-level data source, then this data source - is examined for an interaction handler. Else, <NULL/> is returned. + return xHandler; + } + //..................................................................... + /** tries to obtain the InteractionHandler associated with a given connection - @throws RuntimeException - if it occures during invoking any of the data source's methods, or if any of the involved - components violates its contract by not providing the required interfaces - */ - InteractionHandler lcl_getInteractionHandler_throw( const Reference< XConnection >& _rxConnection, const InteractionHandler& _rFallback ) - { - // try whether there is a data source which the connection belongs to - Reference< XDataSource > xDataSource; - Reference< XChild > xAsChild( _rxConnection, UNO_QUERY ); - if ( xAsChild.is() ) - xDataSource = xDataSource.query( xAsChild->getParent() ); + If the connection belongs to a sdb-level data source, then this data source + is examined for an interaction handler. Else, <NULL/> is returned. - if ( xDataSource.is() ) - return lcl_getInteractionHandler_throw( xDataSource, _rFallback ); + @throws RuntimeException + if it occures during invoking any of the data source's methods, or if any of the involved + components violates its contract by not providing the required interfaces + */ + InteractionHandler lcl_getInteractionHandler_throw( const Reference< XConnection >& _rxConnection, const InteractionHandler& _rFallback ) + { + // try whether there is a data source which the connection belongs to + Reference< XDataSource > xDataSource; + Reference< XChild > xAsChild( _rxConnection, UNO_QUERY ); + if ( xAsChild.is() ) + xDataSource = xDataSource.query( xAsChild->getParent() ); - return _rFallback; - } + if ( xDataSource.is() ) + return lcl_getInteractionHandler_throw( xDataSource, _rFallback ); + + return _rFallback; } +} - //------------------------------------------------------------------------- - Reference< XPropertySet > CopyTableWizard::impl_ensureDataAccessDescriptor_throw( - const Sequence< Any >& _rAllArgs, const sal_Int16 _nArgPos, SharedConnection& _out_rxConnection, - InteractionHandler& _out_rxDocInteractionHandler ) const +//------------------------------------------------------------------------- +Reference< XPropertySet > CopyTableWizard::impl_ensureDataAccessDescriptor_throw( + const Sequence< Any >& _rAllArgs, const sal_Int16 _nArgPos, SharedConnection& _out_rxConnection, + InteractionHandler& _out_rxDocInteractionHandler ) const +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::impl_ensureDataAccessDescriptor_throw" ); + Reference< XPropertySet > xDescriptor; + _rAllArgs[ _nArgPos ] >>= xDescriptor; + + // the descriptor must be non-NULL, of course + bool bIsValid = xDescriptor.is(); + + // it must support the proper service + if ( bIsValid ) { - Reference< XPropertySet > xDescriptor; - _rAllArgs[ _nArgPos ] >>= xDescriptor; + Reference< XServiceInfo > xSI( xDescriptor, UNO_QUERY ); + bIsValid = ( xSI.is() + && xSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.DataAccessDescriptor" ) ) ) + ); + } - // the descriptor must be non-NULL, of course - bool bIsValid = xDescriptor.is(); + // it must be able to provide a connection + if ( bIsValid ) + { + _out_rxConnection = impl_extractConnection_throw( xDescriptor, _out_rxDocInteractionHandler ); + bIsValid = _out_rxConnection.is(); + } - // it must support the proper service - if ( bIsValid ) - { - Reference< XServiceInfo > xSI( xDescriptor, UNO_QUERY ); - bIsValid = ( xSI.is() - && xSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.DataAccessDescriptor" ) ) ) - ); - } + if ( !bIsValid ) + { + throw IllegalArgumentException( + String( ModuleRes( STR_CTW_INVALID_DATA_ACCESS_DESCRIPTOR ) ), + *const_cast< CopyTableWizard* >( this ), + _nArgPos + 1 + ); + } - // it must be able to provide a connection - if ( bIsValid ) - { - _out_rxConnection = impl_extractConnection_throw( xDescriptor, _out_rxDocInteractionHandler ); - bIsValid = _out_rxConnection.is(); - } + return xDescriptor; +} - if ( !bIsValid ) +//------------------------------------------------------------------------- +namespace +{ + bool lcl_hasNonEmptyStringValue_throw( const Reference< XPropertySet >& _rxDescriptor, + const Reference< XPropertySetInfo > _rxPSI, const ::rtl::OUString& _rPropertyName ) + { + ::rtl::OUString sValue; + if ( _rxPSI->hasPropertyByName( _rPropertyName ) ) { - throw IllegalArgumentException( - String( ModuleRes( STR_CTW_INVALID_DATA_ACCESS_DESCRIPTOR ) ), - *const_cast< CopyTableWizard* >( this ), - _nArgPos + 1 - ); + OSL_VERIFY( _rxDescriptor->getPropertyValue( _rPropertyName ) >>= sValue ); } + return sValue.getLength() > 0; + } +} - return xDescriptor; +//------------------------------------------------------------------------- +void CopyTableWizard::impl_checkForUnsupportedSettings_throw( const Reference< XPropertySet >& _rxSourceDescriptor ) const +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::impl_checkForUnsupportedSettings_throw" ); + OSL_PRECOND( _rxSourceDescriptor.is(), "CopyTableWizard::impl_checkForUnsupportedSettings_throw: illegal argument!" ); + Reference< XPropertySetInfo > xPSI( _rxSourceDescriptor->getPropertySetInfo(), UNO_SET_THROW ); + ::rtl::OUString sUnsupportedSetting; + + // in theory, we could allow to use a mere result set as copy source. However, since this is currently + // not implemented at all, we report this in the initialization phase already + if ( xPSI->hasPropertyByName( PROPERTY_RESULT_SET ) ) + { + Reference< XResultSet > xSource( _rxSourceDescriptor->getPropertyValue( PROPERTY_RESULT_SET ), UNO_QUERY ); + if ( xSource.is() ) + sUnsupportedSetting = PROPERTY_RESULT_SET; } - //------------------------------------------------------------------------- - namespace + if ( sUnsupportedSetting.getLength() == 0 ) { - bool lcl_hasNonEmptyStringValue_throw( const Reference< XPropertySet >& _rxDescriptor, - const Reference< XPropertySetInfo > _rxPSI, const ::rtl::OUString& _rPropertyName ) + const ::rtl::OUString aSettings[] = { + PROPERTY_FILTER, PROPERTY_ORDER, PROPERTY_HAVING_CLAUSE, PROPERTY_GROUP_BY + }; + for ( size_t i=0; i < sizeof( aSettings ) / sizeof( aSettings[0] ); ++i ) { - ::rtl::OUString sValue; - if ( _rxPSI->hasPropertyByName( _rPropertyName ) ) + if ( lcl_hasNonEmptyStringValue_throw( _rxSourceDescriptor, xPSI, aSettings[i] ) ) { - OSL_VERIFY( _rxDescriptor->getPropertyValue( _rPropertyName ) >>= sValue ); + sUnsupportedSetting = aSettings[i]; + break; } - return sValue.getLength() > 0; } } - //------------------------------------------------------------------------- - void CopyTableWizard::impl_checkForUnsupportedSettings_throw( const Reference< XPropertySet >& _rxSourceDescriptor ) const + if ( sUnsupportedSetting.getLength() != 0 ) { - OSL_PRECOND( _rxSourceDescriptor.is(), "CopyTableWizard::impl_checkForUnsupportedSettings_throw: illegal argument!" ); - Reference< XPropertySetInfo > xPSI( _rxSourceDescriptor->getPropertySetInfo(), UNO_SET_THROW ); - ::rtl::OUString sUnsupportedSetting; + ::rtl::OUString sMessage( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unsupported setting in the copy source descriptor: $name$." ) ) ); + // TODO: resource + sMessage = sMessage.replaceAt( sMessage.indexOfAsciiL( "$name$", 6 ), 6, sUnsupportedSetting ); + throw IllegalArgumentException( + sMessage, + *const_cast< CopyTableWizard* >( this ), + 1 + ); + } - // in theory, we could allow to use a mere result set as copy source. However, since this is currently - // not implemented at all, we report this in the initialization phase already - if ( xPSI->hasPropertyByName( PROPERTY_RESULT_SET ) ) - { - Reference< XResultSet > xSource( _rxSourceDescriptor->getPropertyValue( PROPERTY_RESULT_SET ), UNO_QUERY ); - if ( xSource.is() ) - sUnsupportedSetting = PROPERTY_RESULT_SET; - } +} - if ( sUnsupportedSetting.getLength() == 0 ) - { - const ::rtl::OUString aSettings[] = { - PROPERTY_FILTER, PROPERTY_ORDER, PROPERTY_HAVING_CLAUSE, PROPERTY_GROUP_BY - }; - for ( size_t i=0; i < sizeof( aSettings ) / sizeof( aSettings[0] ); ++i ) - { - if ( lcl_hasNonEmptyStringValue_throw( _rxSourceDescriptor, xPSI, aSettings[i] ) ) - { - sUnsupportedSetting = aSettings[i]; - break; - } - } - } +//------------------------------------------------------------------------- +::std::auto_ptr< ICopyTableSourceObject > CopyTableWizard::impl_extractSourceObject_throw( const Reference< XPropertySet >& _rxDescriptor, sal_Int32& _out_rCommandType ) const +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::impl_extractSourceObject_throw" ); + OSL_PRECOND( _rxDescriptor.is() && m_xSourceConnection.is(), "CopyTableWizard::impl_extractSourceObject_throw: illegal arguments!" ); + + impl_checkForUnsupportedSettings_throw( _rxDescriptor ); + + Reference< XPropertySetInfo > xPSI( _rxDescriptor->getPropertySetInfo(), UNO_SET_THROW ); + if ( !xPSI->hasPropertyByName( PROPERTY_COMMAND ) + || !xPSI->hasPropertyByName( PROPERTY_COMMAND_TYPE ) + ) + throw IllegalArgumentException( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Expecting a table or query specification." ) ), + *const_cast< CopyTableWizard* >( this ), + 1 + ); - if ( sUnsupportedSetting.getLength() != 0 ) - { - ::rtl::OUString sMessage( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unsupported setting in the copy source descriptor: $name$." ) ) ); - // TODO: resource - sMessage = sMessage.replaceAt( sMessage.indexOfAsciiL( "$name$", 6 ), 6, sUnsupportedSetting ); - throw IllegalArgumentException( - sMessage, - *const_cast< CopyTableWizard* >( this ), - 1 - ); - } + ::rtl::OUString sCommand; + _out_rCommandType = CommandType::COMMAND; + OSL_VERIFY( _rxDescriptor->getPropertyValue( PROPERTY_COMMAND ) >>= sCommand ); + OSL_VERIFY( _rxDescriptor->getPropertyValue( PROPERTY_COMMAND_TYPE ) >>= _out_rCommandType ); + ::std::auto_ptr< ICopyTableSourceObject > pSourceObject; + Reference< XNameAccess > xContainer; + switch ( _out_rCommandType ) + { + case CommandType::TABLE: + { + Reference< XTablesSupplier > xSuppTables( m_xSourceConnection.getTyped(), UNO_QUERY ); + if ( xSuppTables.is() ) + xContainer.set( xSuppTables->getTables(), UNO_SET_THROW ); } - - //------------------------------------------------------------------------- - ::std::auto_ptr< ICopyTableSourceObject > CopyTableWizard::impl_extractSourceObject_throw( const Reference< XPropertySet >& _rxDescriptor, sal_Int32& _out_rCommandType ) const + break; + case CommandType::QUERY: { - OSL_PRECOND( _rxDescriptor.is() && m_xSourceConnection.is(), "CopyTableWizard::impl_extractSourceObject_throw: illegal arguments!" ); + Reference< XQueriesSupplier > xSuppQueries( m_xSourceConnection.getTyped(), UNO_QUERY ); + if ( xSuppQueries.is() ) + xContainer.set( xSuppQueries->getQueries(), UNO_SET_THROW ); + } + break; + default: + throw IllegalArgumentException( + String( ModuleRes( STR_CTW_ONLY_TABLES_AND_QUERIES_SUPPORT ) ), + *const_cast< CopyTableWizard* >( this ), + 1 + ); + } - impl_checkForUnsupportedSettings_throw( _rxDescriptor ); + if ( xContainer.is() ) + { + pSourceObject.reset( new ObjectCopySource( m_xSourceConnection, + Reference< XPropertySet >( xContainer->getByName( sCommand ), UNO_QUERY_THROW ) ) ); + } + else + { + // our source connection is an SDBC level connection only, not a SDBCX level one + // Which means it cannot provide the to-be-copied object as component. - Reference< XPropertySetInfo > xPSI( _rxDescriptor->getPropertySetInfo(), UNO_SET_THROW ); - if ( !xPSI->hasPropertyByName( PROPERTY_COMMAND ) - || !xPSI->hasPropertyByName( PROPERTY_COMMAND_TYPE ) - ) + if ( _out_rCommandType == CommandType::QUERY ) + // we cannot copy a query if the connection cannot provide it ... throw IllegalArgumentException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Expecting a table or query specification." ) ), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "To copy a query, your connection must be able to provide queries." ) ), + // TODO: resource *const_cast< CopyTableWizard* >( this ), 1 ); + pSourceObject.reset( new NamedTableCopySource( m_xSourceConnection, sCommand ) ); + } - ::rtl::OUString sCommand; - _out_rCommandType = CommandType::COMMAND; - OSL_VERIFY( _rxDescriptor->getPropertyValue( PROPERTY_COMMAND ) >>= sCommand ); - OSL_VERIFY( _rxDescriptor->getPropertyValue( PROPERTY_COMMAND_TYPE ) >>= _out_rCommandType ); + return pSourceObject; +} - ::std::auto_ptr< ICopyTableSourceObject > pSourceObject; - Reference< XNameAccess > xContainer; - switch ( _out_rCommandType ) - { - case CommandType::TABLE: - { - Reference< XTablesSupplier > xSuppTables( m_xSourceConnection.getTyped(), UNO_QUERY ); - if ( xSuppTables.is() ) - xContainer.set( xSuppTables->getTables(), UNO_SET_THROW ); - } +//------------------------------------------------------------------------- +SharedConnection CopyTableWizard::impl_extractConnection_throw( const Reference< XPropertySet >& _rxDataSourceDescriptor, + InteractionHandler& _out_rxDocInteractionHandler ) const +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::impl_extractConnection_throw" ); + SharedConnection xConnection; + + OSL_PRECOND( _rxDataSourceDescriptor.is(), "CopyTableWizard::impl_extractConnection_throw: no descriptor!" ); + if ( !_rxDataSourceDescriptor.is() ) + return xConnection; + + InteractionHandler xInteractionHandler; + + do + { + Reference< XPropertySetInfo > xPSI( _rxDataSourceDescriptor->getPropertySetInfo(), UNO_SET_THROW ); + + // if there's an ActiveConnection, use it + if ( xPSI->hasPropertyByName( PROPERTY_ACTIVE_CONNECTION ) ) + { + Reference< XConnection > xPure; + OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_ACTIVE_CONNECTION ) >>= xPure ); + xConnection.reset( xPure, SharedConnection::NoTakeOwnership ); + } + if ( xConnection.is() ) + { + xInteractionHandler = lcl_getInteractionHandler_throw( xConnection.getTyped(), m_xInteractionHandler ); + OSL_POSTCOND( xInteractionHandler.is(), "CopyTableWizard::impl_extractConnection_throw: lcl_getInteractionHandler_throw returned nonsense!" ); break; - case CommandType::QUERY: + } + + // there could be a DataSourceName or a DatabaseLocation, describing the css.sdb.DataSource + ::rtl::OUString sDataSource, sDatabaseLocation; + if ( xPSI->hasPropertyByName( PROPERTY_DATASOURCENAME ) ) + OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_DATASOURCENAME ) >>= sDataSource ); + if ( xPSI->hasPropertyByName( PROPERTY_DATABASE_LOCATION ) ) + OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_DATABASE_LOCATION ) >>= sDatabaseLocation ); + + // need a DatabaseContext for loading the data source + Reference< XNameAccess > xDatabaseContext( m_aContext.createComponent( "com.sun.star.sdb.DatabaseContext" ), UNO_QUERY_THROW ); + Reference< XDataSource > xDataSource; + if ( sDataSource.getLength() ) + xDataSource.set( xDatabaseContext->getByName( sDataSource ), UNO_QUERY_THROW ); + if ( !xDataSource.is() && sDatabaseLocation.getLength() ) + xDataSource.set( xDatabaseContext->getByName( sDatabaseLocation ), UNO_QUERY_THROW ); + + if ( xDataSource.is() ) + { + // first, try connecting with completion + xInteractionHandler = lcl_getInteractionHandler_throw( xDataSource, m_xInteractionHandler ); + OSL_POSTCOND( xInteractionHandler.is(), "CopyTableWizard::impl_extractConnection_throw: lcl_getInteractionHandler_throw returned nonsense!" ); + if ( xInteractionHandler.is() ) { - Reference< XQueriesSupplier > xSuppQueries( m_xSourceConnection.getTyped(), UNO_QUERY ); - if ( xSuppQueries.is() ) - xContainer.set( xSuppQueries->getQueries(), UNO_SET_THROW ); - } - break; - default: - throw IllegalArgumentException( - String( ModuleRes( STR_CTW_ONLY_TABLES_AND_QUERIES_SUPPORT ) ), - *const_cast< CopyTableWizard* >( this ), - 1 - ); + Reference< XCompletedConnection > xInteractiveConnection( xDataSource, UNO_QUERY ); + if ( xInteractiveConnection.is() ) + xConnection.reset( xInteractiveConnection->connectWithCompletion( xInteractionHandler ), SharedConnection::TakeOwnership ); } - if ( xContainer.is() ) + // interactively connecting was not successful or possible -> connect without interaction + if ( !xConnection.is() ) { - pSourceObject.reset( new ObjectCopySource( m_xSourceConnection, - Reference< XPropertySet >( xContainer->getByName( sCommand ), UNO_QUERY_THROW ) ) ); + xConnection.reset( xDataSource->getConnection( ::rtl::OUString(), ::rtl::OUString() ), SharedConnection::TakeOwnership ); } - else - { - // our source connection is an SDBC level connection only, not a SDBCX level one - // Which means it cannot provide the to-be-copied object as component. + } - if ( _out_rCommandType == CommandType::QUERY ) - // we cannot copy a query if the connection cannot provide it ... - throw IllegalArgumentException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "To copy a query, your connection must be able to provide queries." ) ), - // TODO: resource - *const_cast< CopyTableWizard* >( this ), - 1 - ); - pSourceObject.reset( new NamedTableCopySource( m_xSourceConnection, sCommand ) ); - } + if ( xConnection.is() ) + break; - return pSourceObject; + // finally, there could be a ConnectionResource/ConnectionInfo + ::rtl::OUString sConnectionResource; + Sequence< PropertyValue > aConnectionInfo; + if ( xPSI->hasPropertyByName( PROPERTY_CONNECTION_RESOURCE ) ) + OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_CONNECTION_RESOURCE ) >>= sConnectionResource ); + if ( xPSI->hasPropertyByName( PROPERTY_CONNECTION_INFO ) ) + OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_CONNECTION_INFO ) >>= aConnectionInfo ); + + Reference< XDriverManager > xDriverManager; + xDriverManager.set( m_aContext.createComponent( "com.sun.star.sdbc.ConnectionPool" ), UNO_QUERY ); + if ( !xDriverManager.is() ) + // no connection pool installed + xDriverManager.set( m_aContext.createComponent( "com.sun.star.sdbc.DriverManager" ), UNO_QUERY_THROW ); + + if ( aConnectionInfo.getLength() ) + xConnection.set( xDriverManager->getConnectionWithInfo( sConnectionResource, aConnectionInfo ), UNO_SET_THROW ); + else + xConnection.set( xDriverManager->getConnection( sConnectionResource ), UNO_SET_THROW ); } + while ( false ); + + if ( xInteractionHandler != m_xInteractionHandler ) + _out_rxDocInteractionHandler = xInteractionHandler; + + return xConnection; +} + +//------------------------------------------------------------------------- +::utl::SharedUNOComponent< XPreparedStatement > CopyTableWizard::impl_createSourceStatement_throw() const +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::impl_createSourceStatement_throw" ); + OSL_PRECOND( m_xSourceConnection.is(), "CopyTableWizard::impl_createSourceStatement_throw: illegal call!" ); + if ( !m_xSourceConnection.is() ) + throw RuntimeException( ::rtl::OUString(), *const_cast< CopyTableWizard* >( this ) ); - //------------------------------------------------------------------------- - SharedConnection CopyTableWizard::impl_extractConnection_throw( const Reference< XPropertySet >& _rxDataSourceDescriptor, - InteractionHandler& _out_rxDocInteractionHandler ) const + ::utl::SharedUNOComponent< XPreparedStatement > xStatement; + switch ( m_nCommandType ) { - SharedConnection xConnection; + case CommandType::TABLE: + xStatement.set( m_pSourceObject->getPreparedSelectStatement(), UNO_SET_THROW ); + break; - OSL_PRECOND( _rxDataSourceDescriptor.is(), "CopyTableWizard::impl_extractConnection_throw: no descriptor!" ); - if ( !_rxDataSourceDescriptor.is() ) - return xConnection; + case CommandType::QUERY: + { + ::rtl::OUString sQueryCommand( m_pSourceObject->getSelectStatement() ); + xStatement.set( m_pSourceObject->getPreparedSelectStatement(), UNO_SET_THROW ); - InteractionHandler xInteractionHandler; + // check whether we have to fill in parameter values + // create and fill a composer - do - { - Reference< XPropertySetInfo > xPSI( _rxDataSourceDescriptor->getPropertySetInfo(), UNO_SET_THROW ); + Reference< XMultiServiceFactory > xFactory( m_xSourceConnection, UNO_QUERY ); + ::utl::SharedUNOComponent< XSingleSelectQueryComposer > xComposer; + if ( xFactory.is() ) + // note: connections below the sdb-level are allowed to not support the XMultiServiceFactory interface + xComposer.set( xFactory->createInstance( SERVICE_NAME_SINGLESELECTQUERYCOMPOSER ), UNO_QUERY ); - // if there's an ActiveConnection, use it - if ( xPSI->hasPropertyByName( PROPERTY_ACTIVE_CONNECTION ) ) + if ( xComposer.is() ) { - Reference< XConnection > xPure; - OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_ACTIVE_CONNECTION ) >>= xPure ); - xConnection.reset( xPure, SharedConnection::NoTakeOwnership ); + xComposer->setQuery( sQueryCommand ); + + Reference< XParameters > xStatementParams( xStatement, UNO_QUERY ); + OSL_ENSURE( xStatementParams.is(), "CopyTableWizard::impl_createSourceStatement_throw: no access to the statement's parameters!" ); + // the statement should be a css.sdbc.PreparedStatement (this is what + // we created), and a prepared statement is required to support XParameters + if ( xStatementParams.is() ) + { + OSL_ENSURE( m_xInteractionHandler.is(), + "CopyTableWizard::impl_createSourceStatement_throw: no interaction handler for the parameters request!" ); + // we should always have an interaction handler - as last fallback, we create an own one in ::initialize + + if ( m_xInteractionHandler.is() ) + ::dbtools::askForParameters( xComposer, xStatementParams, m_xSourceConnection, m_xInteractionHandler ); + } } - if ( xConnection.is() ) + } + break; + + default: + // this should not have survived initialization phase + throw RuntimeException( ::rtl::OUString(), *const_cast< CopyTableWizard* >( this ) ); + } + + return xStatement; +} + +//------------------------------------------------------------------------- +namespace +{ + class ValueTransfer + { + public: + ValueTransfer( const sal_Int32& _rSourcePos, const sal_Int32& _rDestPos, const ::std::vector< sal_Int32 >& _rColTypes, + const Reference< XRow >& _rxSource, const Reference< XParameters >& _rxDest ) + :m_rSourcePos( _rSourcePos ) + ,m_rDestPos( _rDestPos ) + ,m_rColTypes( _rColTypes ) + ,m_xSource( _rxSource ) + ,m_xDest( _rxDest ) { - xInteractionHandler = lcl_getInteractionHandler_throw( xConnection.getTyped(), m_xInteractionHandler ); - OSL_POSTCOND( xInteractionHandler.is(), "CopyTableWizard::impl_extractConnection_throw: lcl_getInteractionHandler_throw returned nonsense!" ); - break; } - // there could be a DataSourceName or a DatabaseLocation, describing the css.sdb.DataSource - ::rtl::OUString sDataSource, sDatabaseLocation; - if ( xPSI->hasPropertyByName( PROPERTY_DATASOURCENAME ) ) - OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_DATASOURCENAME ) >>= sDataSource ); - if ( xPSI->hasPropertyByName( PROPERTY_DATABASE_LOCATION ) ) - OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_DATABASE_LOCATION ) >>= sDatabaseLocation ); + template< typename VALUE_TYPE > + void transferValue( VALUE_TYPE ( SAL_CALL XRow::*_pGetter )( sal_Int32 ), + void (SAL_CALL XParameters::*_pSetter)( sal_Int32, VALUE_TYPE ) ) + { + VALUE_TYPE value( (m_xSource.get()->*_pGetter)( m_rSourcePos ) ); + if ( m_xSource->wasNull() ) + m_xDest->setNull( m_rDestPos, m_rColTypes[ m_rSourcePos ] ); + else + (m_xDest.get()->*_pSetter)( m_rDestPos, value ); + } - // need a DatabaseContext for loading the data source - Reference< XNameAccess > xDatabaseContext( m_aContext.createComponent( "com.sun.star.sdb.DatabaseContext" ), UNO_QUERY_THROW ); - Reference< XDataSource > xDataSource; - if ( sDataSource.getLength() ) - xDataSource.set( xDatabaseContext->getByName( sDataSource ), UNO_QUERY_THROW ); - if ( !xDataSource.is() && sDatabaseLocation.getLength() ) - xDataSource.set( xDatabaseContext->getByName( sDatabaseLocation ), UNO_QUERY_THROW ); + template< typename VALUE_TYPE > + void transferComplexValue( VALUE_TYPE ( SAL_CALL XRow::*_pGetter )( sal_Int32 ), + void (SAL_CALL XParameters::*_pSetter)( sal_Int32, const VALUE_TYPE& ) ) + { + VALUE_TYPE value( (m_xSource.get()->*_pGetter)( m_rSourcePos ) ); + if ( m_xSource->wasNull() ) + m_xDest->setNull( m_rDestPos, m_rColTypes[ m_rSourcePos ] ); + else + (m_xDest.get()->*_pSetter)( m_rDestPos, value ); + } - if ( xDataSource.is() ) - { - // first, try connecting with completion - xInteractionHandler = lcl_getInteractionHandler_throw( xDataSource, m_xInteractionHandler ); - OSL_POSTCOND( xInteractionHandler.is(), "CopyTableWizard::impl_extractConnection_throw: lcl_getInteractionHandler_throw returned nonsense!" ); - if ( xInteractionHandler.is() ) - { - Reference< XCompletedConnection > xInteractiveConnection( xDataSource, UNO_QUERY ); - if ( xInteractiveConnection.is() ) - xConnection.reset( xInteractiveConnection->connectWithCompletion( xInteractionHandler ), SharedConnection::TakeOwnership ); - } + private: + const sal_Int32& m_rSourcePos; + const sal_Int32& m_rDestPos; + const ::std::vector< sal_Int32 > m_rColTypes; + const Reference< XRow > m_xSource; + const Reference< XParameters > m_xDest; + }; +} - // interactively connecting was not successful or possible -> connect without interaction - if ( !xConnection.is() ) +//------------------------------------------------------------------------- +bool CopyTableWizard::impl_processCopyError_nothrow( const CopyTableRowEvent& _rEvent ) +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::impl_processCopyError_nothrow" ); + Reference< XCopyTableListener > xListener; + try + { + ::cppu::OInterfaceIteratorHelper aIter( m_aCopyTableListeners ); + while ( aIter.hasMoreElements() ) + { + xListener.set( aIter.next(), UNO_QUERY_THROW ); + sal_Int16 nListenerChoice = xListener->copyRowError( _rEvent ); + switch ( nListenerChoice ) { - xConnection.reset( xDataSource->getConnection( ::rtl::OUString(), ::rtl::OUString() ), SharedConnection::TakeOwnership ); + case CopyTableContinuation::Proceed: return true; // continue copying + case CopyTableContinuation::CallNextHandler: continue; // continue the loop, ask next listener + case CopyTableContinuation::Cancel: return false; // cancel copying + case CopyTableContinuation::AskUser: break; // stop asking the listeners, ask the user + + default: + OSL_ENSURE( false, "CopyTableWizard::impl_processCopyError_nothrow: invalid listener response!" ); + // ask next listener + continue; } } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } - if ( xConnection.is() ) - break; + // no listener felt responsible for the error, or a listener told to ask the user + + try + { + SQLContext aError; + aError.Context = *this; + aError.Message = String( ModuleRes( STR_ERROR_OCCURED_WHILE_COPYING ) ); - // finally, there could be a ConnectionResource/ConnectionInfo - ::rtl::OUString sConnectionResource; - Sequence< PropertyValue > aConnectionInfo; - if ( xPSI->hasPropertyByName( PROPERTY_CONNECTION_RESOURCE ) ) - OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_CONNECTION_RESOURCE ) >>= sConnectionResource ); - if ( xPSI->hasPropertyByName( PROPERTY_CONNECTION_INFO ) ) - OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_CONNECTION_INFO ) >>= aConnectionInfo ); - - Reference< XDriverManager > xDriverManager; - xDriverManager.set( m_aContext.createComponent( "com.sun.star.sdbc.ConnectionPool" ), UNO_QUERY ); - if ( !xDriverManager.is() ) - // no connection pool installed - xDriverManager.set( m_aContext.createComponent( "com.sun.star.sdbc.DriverManager" ), UNO_QUERY_THROW ); - - if ( aConnectionInfo.getLength() ) - xConnection.set( xDriverManager->getConnectionWithInfo( sConnectionResource, aConnectionInfo ), UNO_SET_THROW ); + ::dbtools::SQLExceptionInfo aInfo( _rEvent.Error ); + if ( aInfo.isValid() ) + aError.NextException = _rEvent.Error; else - xConnection.set( xDriverManager->getConnection( sConnectionResource ), UNO_SET_THROW ); + { + // a non-SQL exception happend + Exception aException; + OSL_VERIFY( _rEvent.Error >>= aException ); + SQLContext aContext; + aContext.Context = aException.Context; + aContext.Message = aException.Message; + aContext.Details = _rEvent.Error.getValueTypeName(); + aError.NextException <<= aContext; } - while ( false ); - if ( xInteractionHandler != m_xInteractionHandler ) - _out_rxDocInteractionHandler = xInteractionHandler; + ::rtl::Reference< ::comphelper::OInteractionRequest > xRequest( new ::comphelper::OInteractionRequest( makeAny( aError ) ) ); - return xConnection; - } + ::rtl::Reference< ::comphelper::OInteractionApprove > xYes = new ::comphelper::OInteractionApprove; + xRequest->addContinuation( xYes.get() ); + xRequest->addContinuation( new ::comphelper::OInteractionDisapprove ); - //------------------------------------------------------------------------- - ::utl::SharedUNOComponent< XPreparedStatement > CopyTableWizard::impl_createSourceStatement_throw() const + OSL_ENSURE( m_xInteractionHandler.is(), + "CopyTableWizard::impl_processCopyError_nothrow: we always should have an interaction handler!" ); + if ( m_xInteractionHandler.is() ) + m_xInteractionHandler->handle( xRequest.get() ); + + if ( xYes->wasSelected() ) + // continue copying + return true; + } + catch( const Exception& ) { - OSL_PRECOND( m_xSourceConnection.is(), "CopyTableWizard::impl_createSourceStatement_throw: illegal call!" ); - if ( !m_xSourceConnection.is() ) - throw RuntimeException( ::rtl::OUString(), *const_cast< CopyTableWizard* >( this ) ); + DBG_UNHANDLED_EXCEPTION(); + } - ::utl::SharedUNOComponent< XPreparedStatement > xStatement; - switch ( m_nCommandType ) - { - case CommandType::TABLE: - xStatement.set( m_pSourceObject->getPreparedSelectStatement(), UNO_SET_THROW ); - break; + // cancel copying + return false; +} - case CommandType::QUERY: - { - ::rtl::OUString sQueryCommand( m_pSourceObject->getSelectStatement() ); - xStatement.set( m_pSourceObject->getPreparedSelectStatement(), UNO_SET_THROW ); +//------------------------------------------------------------------------- +void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSourceResultSet, + const Reference< XPropertySet >& _rxDestTable ) +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::impl_copyRows_throw" ); + OSL_PRECOND( m_xDestConnection.is(), "CopyTableWizard::impl_copyRows_throw: illegal call!" ); + if ( !m_xDestConnection.is() ) + throw RuntimeException( ::rtl::OUString(), *this ); - // check whether we have to fill in parameter values - // create and fill a composer + Reference< XDatabaseMetaData > xDestMetaData( m_xDestConnection->getMetaData(), UNO_QUERY_THROW ); - Reference< XMultiServiceFactory > xFactory( m_xSourceConnection, UNO_QUERY ); - ::utl::SharedUNOComponent< XSingleSelectQueryComposer > xComposer; - if ( xFactory.is() ) - // note: connections below the sdb-level are allowed to not support the XMultiServiceFactory interface - xComposer.set( xFactory->createInstance( SERVICE_NAME_SINGLESELECTQUERYCOMPOSER ), UNO_QUERY ); + const OCopyTableWizard& rWizard = impl_getDialog_throw(); + ODatabaseExport::TPositions aColumnMapping = rWizard.GetColumnPositions(); + bool bAutoIncrement = rWizard.shouldCreatePrimaryKey(); - if ( xComposer.is() ) - { - xComposer->setQuery( sQueryCommand ); + Reference< XRow > xRow ( _rxSourceResultSet, UNO_QUERY_THROW ); + Reference< XRowLocate > xRowLocate ( _rxSourceResultSet, UNO_QUERY ); - Reference< XParameters > xStatementParams( xStatement, UNO_QUERY ); - OSL_ENSURE( xStatementParams.is(), "CopyTableWizard::impl_createSourceStatement_throw: no access to the statement's parameters!" ); - // the statement should be a css.sdbc.PreparedStatement (this is what - // we created), and a prepared statement is required to support XParameters - if ( xStatementParams.is() ) - { - OSL_ENSURE( m_xInteractionHandler.is(), - "CopyTableWizard::impl_createSourceStatement_throw: no interaction handler for the parameters request!" ); - // we should always have an interaction handler - as last fallback, we create an own one in ::initialize + bool bSelectedRecordsOnly = m_aSourceSelection.getLength() > 0; + if ( bSelectedRecordsOnly && m_bSourceSelectionBookmarks && !xRowLocate.is() ) + { + ::dbtools::throwGenericSQLException( + String( ModuleRes( STR_CTW_COPY_SOURCE_NEEDS_BOOKMARKS ) ), + *this + ); + } - if ( m_xInteractionHandler.is() ) - ::dbtools::askForParameters( xComposer, xStatementParams, m_xSourceConnection, m_xInteractionHandler ); - } - } - } - break; + Reference< XResultSetMetaDataSupplier > xSuppResMeta( _rxSourceResultSet, UNO_QUERY_THROW ); + Reference< XResultSetMetaData> xMeta( xSuppResMeta->getMetaData() ); - default: - // this should not have survived initialization phase - throw RuntimeException( ::rtl::OUString(), *const_cast< CopyTableWizard* >( this ) ); - } + // we need a vector which all types + sal_Int32 nCount = xMeta->getColumnCount(); + ::std::vector< sal_Int32 > aSourceColTypes; + aSourceColTypes.reserve( nCount + 1 ); + aSourceColTypes.push_back( -1 ); // just to avoid a everytime i-1 call - return xStatement; - } + for ( sal_Int32 k=1; k <= nCount; ++k ) + aSourceColTypes.push_back( xMeta->getColumnType( k ) ); - //------------------------------------------------------------------------- - namespace - { - class ValueTransfer - { - public: - ValueTransfer( const sal_Int32& _rSourcePos, const sal_Int32& _rDestPos, const ::std::vector< sal_Int32 >& _rColTypes, - const Reference< XRow >& _rxSource, const Reference< XParameters >& _rxDest ) - :m_rSourcePos( _rSourcePos ) - ,m_rDestPos( _rDestPos ) - ,m_rColTypes( _rColTypes ) - ,m_xSource( _rxSource ) - ,m_xDest( _rxDest ) - { - } + // now create, fill and execute the prepared statement + Reference< XPreparedStatement > xStatement( ODatabaseExport::createPreparedStatment( xDestMetaData, _rxDestTable, aColumnMapping ), UNO_SET_THROW ); + Reference< XParameters > xStatementParams( xStatement, UNO_QUERY_THROW ); - template< typename VALUE_TYPE > - void transferValue( VALUE_TYPE ( SAL_CALL XRow::*_pGetter )( sal_Int32 ), - void (SAL_CALL XParameters::*_pSetter)( sal_Int32, VALUE_TYPE ) ) - { - VALUE_TYPE value( (m_xSource.get()->*_pGetter)( m_rSourcePos ) ); - if ( m_xSource->wasNull() ) - m_xDest->setNull( m_rDestPos, m_rColTypes[ m_rSourcePos ] ); - else - (m_xDest.get()->*_pSetter)( m_rDestPos, value ); - } + sal_Int32 nRowCount = 0; + const Any* pSelectedRow = m_aSourceSelection.getConstArray(); + const Any* pSelEnd = pSelectedRow + m_aSourceSelection.getLength(); + bool bContinue = false; - template< typename VALUE_TYPE > - void transferComplexValue( VALUE_TYPE ( SAL_CALL XRow::*_pGetter )( sal_Int32 ), - void (SAL_CALL XParameters::*_pSetter)( sal_Int32, const VALUE_TYPE& ) ) - { - VALUE_TYPE value( (m_xSource.get()->*_pGetter)( m_rSourcePos ) ); - if ( m_xSource->wasNull() ) - m_xDest->setNull( m_rDestPos, m_rColTypes[ m_rSourcePos ] ); - else - (m_xDest.get()->*_pSetter)( m_rDestPos, value ); - } + CopyTableRowEvent aCopyEvent; + aCopyEvent.Source = *this; + aCopyEvent.SourceData = _rxSourceResultSet; - private: - const sal_Int32& m_rSourcePos; - const sal_Int32& m_rDestPos; - const ::std::vector< sal_Int32 > m_rColTypes; - const Reference< XRow > m_xSource; - const Reference< XParameters > m_xDest; - }; - } - - //------------------------------------------------------------------------- - bool CopyTableWizard::impl_processCopyError_nothrow( const CopyTableRowEvent& _rEvent ) + do // loop as long as there are more rows or the selection ends { - Reference< XCopyTableListener > xListener; - try + bContinue = false; + if ( bSelectedRecordsOnly ) { - ::cppu::OInterfaceIteratorHelper aIter( m_aCopyTableListeners ); - while ( aIter.hasMoreElements() ) + if ( pSelectedRow != pSelEnd ) { - xListener.set( aIter.next(), UNO_QUERY_THROW ); - sal_Int16 nListenerChoice = xListener->copyRowError( _rEvent ); - switch ( nListenerChoice ) + if ( m_bSourceSelectionBookmarks ) { - case CopyTableContinuation::Proceed: return true; // continue copying - case CopyTableContinuation::CallNextHandler: continue; // continue the loop, ask next listener - case CopyTableContinuation::Cancel: return false; // cancel copying - case CopyTableContinuation::AskUser: break; // stop asking the listeners, ask the user - - default: - OSL_ENSURE( false, "CopyTableWizard::impl_processCopyError_nothrow: invalid listener response!" ); - // ask next listener - continue; + xRowLocate->moveToBookmark( *pSelectedRow ); } + else + { + sal_Int32 nPos = 0; + OSL_VERIFY( *pSelectedRow >>= nPos ); + bContinue = _rxSourceResultSet->absolute( nPos ); + } + ++pSelectedRow; } } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } + else + bContinue = _rxSourceResultSet->next(); - // no listener felt responsible for the error, or a listener told to ask the user + if ( !bContinue ) + break; + ++nRowCount; + sal_Bool bInsertAutoIncrement = sal_True; + ODatabaseExport::TPositions::const_iterator aPosIter = aColumnMapping.begin(); + + aCopyEvent.Error.clear(); try { - SQLContext aError; - aError.Context = *this; - aError.Message = String( ModuleRes( STR_ERROR_OCCURED_WHILE_COPYING ) ); - - ::dbtools::SQLExceptionInfo aInfo( _rEvent.Error ); - if ( aInfo.isValid() ) - aError.NextException = _rEvent.Error; - else - { - // a non-SQL exception happend - Exception aException; - OSL_VERIFY( _rEvent.Error >>= aException ); - SQLContext aContext; - aContext.Context = aException.Context; - aContext.Message = aException.Message; - aContext.Details = _rEvent.Error.getValueTypeName(); - aError.NextException <<= aContext; - } + // notify listeners + m_aCopyTableListeners.notifyEach( &XCopyTableListener::copyingRow, aCopyEvent ); - ::rtl::Reference< ::comphelper::OInteractionRequest > xRequest( new ::comphelper::OInteractionRequest( makeAny( aError ) ) ); + sal_Int32 nDestColumn( 0 ); + sal_Int32 nSourceColumn( 1 ); + ValueTransfer aTransfer( nSourceColumn, nDestColumn, aSourceColTypes, xRow, xStatementParams ); - ::rtl::Reference< ::comphelper::OInteractionApprove > xYes = new ::comphelper::OInteractionApprove; - xRequest->addContinuation( xYes.get() ); - xRequest->addContinuation( new ::comphelper::OInteractionDisapprove ); - - OSL_ENSURE( m_xInteractionHandler.is(), - "CopyTableWizard::impl_processCopyError_nothrow: we always should have an interaction handler!" ); - if ( m_xInteractionHandler.is() ) - m_xInteractionHandler->handle( xRequest.get() ); - - if ( xYes->wasSelected() ) - // continue copying - return true; - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - - // cancel copying - return false; - } - - //------------------------------------------------------------------------- - void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSourceResultSet, - const Reference< XPropertySet >& _rxDestTable ) - { - OSL_PRECOND( m_xDestConnection.is(), "CopyTableWizard::impl_copyRows_throw: illegal call!" ); - if ( !m_xDestConnection.is() ) - throw RuntimeException( ::rtl::OUString(), *this ); - - Reference< XDatabaseMetaData > xDestMetaData( m_xDestConnection->getMetaData(), UNO_QUERY_THROW ); + for ( ; aPosIter != aColumnMapping.end(); ++aPosIter ) + { + nDestColumn = aPosIter->first; + if ( nDestColumn == COLUMN_POSITION_NOT_FOUND ) + { + ++nSourceColumn; + // otherwise we don't get the correct value when only the 2nd source column was selected + continue; + } - const OCopyTableWizard& rWizard = impl_getDialog_throw(); - ODatabaseExport::TPositions aColumnMapping = rWizard.GetColumnPositions(); - bool bAutoIncrement = rWizard.shouldCreatePrimaryKey(); + if ( bAutoIncrement && bInsertAutoIncrement ) + { + xStatementParams->setInt( 1, nRowCount ); + bInsertAutoIncrement = sal_False; + continue; + } - Reference< XRow > xRow ( _rxSourceResultSet, UNO_QUERY_THROW ); - Reference< XRowLocate > xRowLocate ( _rxSourceResultSet, UNO_QUERY ); + if ( ( nSourceColumn < 1 ) || ( nSourceColumn >= (sal_Int32)aSourceColTypes.size() ) ) + { // ( we have to check here against 1 because the parameters are 1 based) + ::dbtools::throwSQLException( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Internal error: invalid column type index." ) ), + ::dbtools::SQL_INVALID_DESCRIPTOR_INDEX, + *this + ); + } - bool bSelectedRecordsOnly = m_aSourceSelection.getLength() > 0; - if ( bSelectedRecordsOnly && m_bSourceSelectionBookmarks && !xRowLocate.is() ) - { - ::dbtools::throwGenericSQLException( - String( ModuleRes( STR_CTW_COPY_SOURCE_NEEDS_BOOKMARKS ) ), - *this - ); - } + switch ( aSourceColTypes[ nSourceColumn ] ) + { + case DataType::DOUBLE: + case DataType::REAL: + aTransfer.transferValue( &XRow::getDouble, &XParameters::setDouble ); + break; - Reference< XResultSetMetaDataSupplier > xSuppResMeta( _rxSourceResultSet, UNO_QUERY_THROW ); - Reference< XResultSetMetaData> xMeta( xSuppResMeta->getMetaData() ); + case DataType::CHAR: + case DataType::VARCHAR: + case DataType::LONGVARCHAR: + case DataType::DECIMAL: + case DataType::NUMERIC: + aTransfer.transferComplexValue( &XRow::getString, &XParameters::setString ); + break; - // we need a vector which all types - sal_Int32 nCount = xMeta->getColumnCount(); - ::std::vector< sal_Int32 > aSourceColTypes; - aSourceColTypes.reserve( nCount + 1 ); - aSourceColTypes.push_back( -1 ); // just to avoid a everytime i-1 call + case DataType::BIGINT: + aTransfer.transferValue( &XRow::getLong, &XParameters::setLong ); + break; - for ( sal_Int32 k=1; k <= nCount; ++k ) - aSourceColTypes.push_back( xMeta->getColumnType( k ) ); + case DataType::FLOAT: + aTransfer.transferValue( &XRow::getFloat, &XParameters::setFloat ); + break; - // now create, fill and execute the prepared statement - Reference< XPreparedStatement > xStatement( ODatabaseExport::createPreparedStatment( xDestMetaData, _rxDestTable, aColumnMapping ), UNO_SET_THROW ); - Reference< XParameters > xStatementParams( xStatement, UNO_QUERY_THROW ); + case DataType::LONGVARBINARY: + case DataType::BINARY: + case DataType::VARBINARY: + aTransfer.transferComplexValue( &XRow::getBytes, &XParameters::setBytes ); + break; - sal_Int32 nRowCount = 0; - const Any* pSelectedRow = m_aSourceSelection.getConstArray(); - const Any* pSelEnd = pSelectedRow + m_aSourceSelection.getLength(); - bool bContinue = false; + case DataType::DATE: + aTransfer.transferComplexValue( &XRow::getDate, &XParameters::setDate ); + break; - CopyTableRowEvent aCopyEvent; - aCopyEvent.Source = *this; - aCopyEvent.SourceData = _rxSourceResultSet; + case DataType::TIME: + aTransfer.transferComplexValue( &XRow::getTime, &XParameters::setTime ); + break; - do // loop as long as there are more rows or the selection ends - { - bContinue = false; - if ( bSelectedRecordsOnly ) - { - if ( pSelectedRow != pSelEnd ) - { - if ( m_bSourceSelectionBookmarks ) - { - xRowLocate->moveToBookmark( *pSelectedRow ); - } - else - { - sal_Int32 nPos = 0; - OSL_VERIFY( *pSelectedRow >>= nPos ); - bContinue = _rxSourceResultSet->absolute( nPos ); - } - ++pSelectedRow; - } - } - else - bContinue = _rxSourceResultSet->next(); + case DataType::TIMESTAMP: + aTransfer.transferComplexValue( &XRow::getTimestamp, &XParameters::setTimestamp ); + break; - if ( !bContinue ) - break; + case DataType::BIT: + case DataType::BOOLEAN: + aTransfer.transferValue( &XRow::getBoolean, &XParameters::setBoolean ); + break; - ++nRowCount; - sal_Bool bInsertAutoIncrement = sal_True; - ODatabaseExport::TPositions::const_iterator aPosIter = aColumnMapping.begin(); + case DataType::TINYINT: + aTransfer.transferValue( &XRow::getByte, &XParameters::setByte ); + break; - aCopyEvent.Error.clear(); - try - { - // notify listeners - m_aCopyTableListeners.notifyEach( &XCopyTableListener::copyingRow, aCopyEvent ); + case DataType::SMALLINT: + aTransfer.transferValue( &XRow::getShort, &XParameters::setShort ); + break; - sal_Int32 nDestColumn( 0 ); - sal_Int32 nSourceColumn( 1 ); - ValueTransfer aTransfer( nSourceColumn, nDestColumn, aSourceColTypes, xRow, xStatementParams ); + case DataType::INTEGER: + aTransfer.transferValue( &XRow::getInt, &XParameters::setInt ); + break; - for ( ; aPosIter != aColumnMapping.end(); ++aPosIter ) - { - nDestColumn = aPosIter->first; - if ( nDestColumn == COLUMN_POSITION_NOT_FOUND ) + default: { - ++nSourceColumn; - // otherwise we don't get the correct value when only the 2nd source column was selected - continue; - } + ::rtl::OUString aMessage( String( ModuleRes( STR_CTW_UNSUPPORTED_COLUMN_TYPE ) ) ); - if ( bAutoIncrement && bInsertAutoIncrement ) - { - xStatementParams->setInt( 1, nRowCount ); - bInsertAutoIncrement = sal_False; - continue; - } + aMessage.replaceAt( aMessage.indexOfAsciiL( "$type$", 6 ), 6, ::rtl::OUString::valueOf( aSourceColTypes[ nSourceColumn ] ) ); + aMessage.replaceAt( aMessage.indexOfAsciiL( "$pos$", 5 ), 5, ::rtl::OUString::valueOf( nSourceColumn ) ); - if ( ( nSourceColumn < 1 ) || ( nSourceColumn >= (sal_Int32)aSourceColTypes.size() ) ) - { // ( we have to check here against 1 because the parameters are 1 based) ::dbtools::throwSQLException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Internal error: invalid column type index." ) ), - ::dbtools::SQL_INVALID_DESCRIPTOR_INDEX, + aMessage, + ::dbtools::SQL_INVALID_SQL_DATA_TYPE, *this ); } - - switch ( aSourceColTypes[ nSourceColumn ] ) - { - case DataType::DOUBLE: - case DataType::REAL: - aTransfer.transferValue( &XRow::getDouble, &XParameters::setDouble ); - break; - - case DataType::CHAR: - case DataType::VARCHAR: - case DataType::LONGVARCHAR: - case DataType::DECIMAL: - case DataType::NUMERIC: - aTransfer.transferComplexValue( &XRow::getString, &XParameters::setString ); - break; - - case DataType::BIGINT: - aTransfer.transferValue( &XRow::getLong, &XParameters::setLong ); - break; - - case DataType::FLOAT: - aTransfer.transferValue( &XRow::getFloat, &XParameters::setFloat ); - break; - - case DataType::LONGVARBINARY: - case DataType::BINARY: - case DataType::VARBINARY: - aTransfer.transferComplexValue( &XRow::getBytes, &XParameters::setBytes ); - break; - - case DataType::DATE: - aTransfer.transferComplexValue( &XRow::getDate, &XParameters::setDate ); - break; - - case DataType::TIME: - aTransfer.transferComplexValue( &XRow::getTime, &XParameters::setTime ); - break; - - case DataType::TIMESTAMP: - aTransfer.transferComplexValue( &XRow::getTimestamp, &XParameters::setTimestamp ); - break; - - case DataType::BIT: - case DataType::BOOLEAN: - aTransfer.transferValue( &XRow::getBoolean, &XParameters::setBoolean ); - break; - - case DataType::TINYINT: - aTransfer.transferValue( &XRow::getByte, &XParameters::setByte ); - break; - - case DataType::SMALLINT: - aTransfer.transferValue( &XRow::getShort, &XParameters::setShort ); - break; - - case DataType::INTEGER: - aTransfer.transferValue( &XRow::getInt, &XParameters::setInt ); - break; - - default: - { - ::rtl::OUString aMessage( String( ModuleRes( STR_CTW_UNSUPPORTED_COLUMN_TYPE ) ) ); - - aMessage.replaceAt( aMessage.indexOfAsciiL( "$type$", 6 ), 6, ::rtl::OUString::valueOf( aSourceColTypes[ nSourceColumn ] ) ); - aMessage.replaceAt( aMessage.indexOfAsciiL( "$pos$", 5 ), 5, ::rtl::OUString::valueOf( nSourceColumn ) ); - - ::dbtools::throwSQLException( - aMessage, - ::dbtools::SQL_INVALID_SQL_DATA_TYPE, - *this - ); - } - } - ++nSourceColumn; } - xStatement->executeUpdate(); - - // notify listeners - m_aCopyTableListeners.notifyEach( &XCopyTableListener::copiedRow, aCopyEvent ); - } - catch( const Exception& ) - { - aCopyEvent.Error = ::cppu::getCaughtException(); + ++nSourceColumn; } + xStatement->executeUpdate(); - if ( aCopyEvent.Error.hasValue() ) - bContinue = impl_processCopyError_nothrow( aCopyEvent ); + // notify listeners + m_aCopyTableListeners.notifyEach( &XCopyTableListener::copiedRow, aCopyEvent ); } - while( bContinue ); + catch( const Exception& ) + { + aCopyEvent.Error = ::cppu::getCaughtException(); + } + + if ( aCopyEvent.Error.hasValue() ) + bContinue = impl_processCopyError_nothrow( aCopyEvent ); } - //------------------------------------------------------------------------- - void CopyTableWizard::impl_doCopy_nothrow() + while( bContinue ); +} +//------------------------------------------------------------------------- +void CopyTableWizard::impl_doCopy_nothrow() +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::impl_doCopy_nothrow" ); + Any aError; + + try { - Any aError; + OCopyTableWizard& rWizard( impl_getDialog_throw() ); - try + WaitObject aWO( rWizard.GetParent() ); + Reference< XPropertySet > xTable; + + switch ( rWizard.getOperation() ) { - OCopyTableWizard& rWizard( impl_getDialog_throw() ); + case CopyTableOperation::CopyDefinitionOnly: + case CopyTableOperation::CopyDefinitionAndData: + { + xTable = rWizard.createTable(); - WaitObject aWO( rWizard.GetParent() ); - Reference< XPropertySet > xTable; + if( !xTable.is() ) + { + OSL_ENSURE( false, "CopyTableWizard::impl_doCopy_nothrow: createTable should throw here, shouldn't it?" ); + break; + } + + if( CopyTableOperation::CopyDefinitionOnly == rWizard.getOperation() ) + break; + } + // run through - switch ( rWizard.getOperation() ) + case CopyTableOperation::AppendData: { - case CopyTableOperation::CopyDefinitionOnly: - case CopyTableOperation::CopyDefinitionAndData: + + if ( !xTable.is() ) { xTable = rWizard.createTable(); - - if( !xTable.is() ) + if ( !xTable.is() ) { OSL_ENSURE( false, "CopyTableWizard::impl_doCopy_nothrow: createTable should throw here, shouldn't it?" ); break; } - - if( CopyTableOperation::CopyDefinitionOnly == rWizard.getOperation() ) - break; } - // run through - case CopyTableOperation::AppendData: + bool bServerCopy = CommandType::TABLE == m_nCommandType && m_xSourceConnection.getTyped() == m_xDestConnection.getTyped() && !m_aSourceSelection.getLength(); + try { - - if ( !xTable.is() ) + if ( bServerCopy ) { - xTable = rWizard.createTable(); - if ( !xTable.is() ) - { - OSL_ENSURE( false, "CopyTableWizard::impl_doCopy_nothrow: createTable should throw here, shouldn't it?" ); - break; - } + m_xDestConnection->createStatement()->executeUpdate( impl_getSelectStatement_nothrow(xTable) ); } + } + catch( const Exception& e ) + { + (void)e; + bServerCopy = false; + } + if ( !bServerCopy ) + { ::utl::SharedUNOComponent< XPreparedStatement > xStatement( impl_createSourceStatement_throw(), UNO_SET_THROW ); Reference< XResultSet > xSourceResultSet( xStatement->executeQuery() ); impl_copyRows_throw( xSourceResultSet, xTable ); } - break; - - case CopyTableOperation::CreateAsView: - rWizard.createView(); - break; - - default: - OSL_ENSURE( false, "CopyTableWizard::impl_doCopy_nothrow: What operation, please?" ); - break; } - } - catch( const Exception& ) - { - aError = ::cppu::getCaughtException(); + break; - // silence the error of the user cancelling the parameter's dialog - SQLException aSQLError; - if ( ( aError >>= aSQLError ) && ( aSQLError.ErrorCode == ::dbtools::ParameterInteractionCancelled ) ) - { - aError.clear(); - m_nOverrideExecutionResult = RET_CANCEL; - } + case CopyTableOperation::CreateAsView: + rWizard.createView(); + break; + + default: + OSL_ENSURE( false, "CopyTableWizard::impl_doCopy_nothrow: What operation, please?" ); + break; } + } + catch( const Exception& ) + { + aError = ::cppu::getCaughtException(); - if ( aError.hasValue() && m_xInteractionHandler.is() ) + // silence the error of the user cancelling the parameter's dialog + SQLException aSQLError; + if ( ( aError >>= aSQLError ) && ( aSQLError.ErrorCode == ::dbtools::ParameterInteractionCancelled ) ) { - try - { - ::rtl::Reference< ::comphelper::OInteractionRequest > xRequest( new ::comphelper::OInteractionRequest( aError ) ); - m_xInteractionHandler->handle( xRequest.get() ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } + aError.clear(); + m_nOverrideExecutionResult = RET_CANCEL; } } - //------------------------------------------------------------------------- - void SAL_CALL CopyTableWizard::initialize( const Sequence< Any >& _rArguments ) throw (Exception, RuntimeException) + if ( aError.hasValue() && m_xInteractionHandler.is() ) { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( isInitialized() ) - throw AlreadyInitializedException( ::rtl::OUString(), *this ); - - sal_Int32 nArgCount( _rArguments.getLength() ); - if ( ( nArgCount != 2 ) && ( nArgCount != 3 ) ) - throw IllegalArgumentException( - String( ModuleRes( STR_CTW_ILLEGAL_PARAMETER_COUNT ) ), - *this, - 1 - ); - try { - if ( nArgCount == 3 ) - { // ->createWithInteractionHandler - if ( !( _rArguments[2] >>= m_xInteractionHandler ) ) - throw IllegalArgumentException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "The given interaction handler is invalid." ) ), - // TODO: resource - *this, - 3 - ); - } - if ( !m_xInteractionHandler.is() ) - m_xInteractionHandler.set( m_aContext.createComponent( "com.sun.star.sdb.InteractionHandler" ), UNO_QUERY_THROW ); - - InteractionHandler xSourceDocHandler; - Reference< XPropertySet > xSourceDescriptor( impl_ensureDataAccessDescriptor_throw( _rArguments, 0, m_xSourceConnection, xSourceDocHandler ) ); - m_pSourceObject = impl_extractSourceObject_throw( xSourceDescriptor, m_nCommandType ); - - InteractionHandler xDestDocHandler; - impl_ensureDataAccessDescriptor_throw( _rArguments, 1, m_xDestConnection, xDestDocHandler ); - - if ( xDestDocHandler.is() && !m_xInteractionHandler.is() ) - m_xInteractionHandler = xDestDocHandler; + ::rtl::Reference< ::comphelper::OInteractionRequest > xRequest( new ::comphelper::OInteractionRequest( aError ) ); + m_xInteractionHandler->handle( xRequest.get() ); } - catch( const RuntimeException& ) { throw; } - catch( const IllegalArgumentException& ) { throw; } - catch( const SQLException& ) { throw; } catch( const Exception& ) { - throw WrappedTargetException( - String( ModuleRes( STR_CTW_ERROR_DURING_INITIALIZATION ) ), - *this, - ::cppu::getCaughtException() - ); + DBG_UNHANDLED_EXCEPTION(); } } - - //------------------------------------------------------------------------- - ::cppu::IPropertyArrayHelper& CopyTableWizard::getInfoHelper() +} +// ----------------------------------------------------------------------------- +::rtl::OUString CopyTableWizard::impl_getSelectStatement_nothrow(const Reference< XPropertySet >& _xTable) +{ + const Reference<XColumnsSupplier> xDestColsSup(_xTable,UNO_QUERY_THROW); + const Sequence< ::rtl::OUString> aDestColumnNames = xDestColsSup->getColumns()->getElementNames(); + const Sequence< ::rtl::OUString > aColumnNames = m_pSourceObject->getColumnNames(); + const Reference< XDatabaseMetaData > xDestMetaData( m_xDestConnection->getMetaData(), UNO_QUERY_THROW ); + const ::rtl::OUString sQuote = xDestMetaData->getIdentifierQuoteString(); + ::rtl::OUStringBuffer sColumns; + // 1st check if the columns matching + const OCopyTableWizard& rWizard = impl_getDialog_throw(); + ODatabaseExport::TPositions aColumnMapping = rWizard.GetColumnPositions(); + ODatabaseExport::TPositions::const_iterator aPosIter = aColumnMapping.begin(); + for ( sal_Int32 i = 0; aPosIter != aColumnMapping.end() ; ++aPosIter,++i ) { - return *getArrayHelper(); - } + if ( COLUMN_POSITION_NOT_FOUND != aPosIter->second ) + { + if ( sColumns.getLength() ) + sColumns.appendAscii(","); + sColumns.append(sQuote); + sColumns.append(aDestColumnNames[aPosIter->second - 1]); + sColumns.append(sQuote); + } + } // for ( ; aPosIter != aColumnMapping.end() ; ++aPosIter ) + ::rtl::OUStringBuffer sSql; + sSql.appendAscii("INSERT INTO "); + const ::rtl::OUString sComposedTableName = ::dbtools::composeTableName( xDestMetaData, _xTable, ::dbtools::eInDataManipulation, false, false, true ); + sSql.append( sComposedTableName ); + sSql.appendAscii(" ( "); + sSql.append( sColumns ); + sSql.appendAscii(" ) ( "); + sSql.append( m_pSourceObject->getSelectStatement()); + sSql.appendAscii(" )"); + + return sSql.makeStringAndClear(); +} +//------------------------------------------------------------------------- +void SAL_CALL CopyTableWizard::initialize( const Sequence< Any >& _rArguments ) throw (Exception, RuntimeException) +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::initialize" ); + ::osl::MutexGuard aGuard( m_aMutex ); + if ( isInitialized() ) + throw AlreadyInitializedException( ::rtl::OUString(), *this ); + + sal_Int32 nArgCount( _rArguments.getLength() ); + if ( ( nArgCount != 2 ) && ( nArgCount != 3 ) ) + throw IllegalArgumentException( + String( ModuleRes( STR_CTW_ILLEGAL_PARAMETER_COUNT ) ), + *this, + 1 + ); - //------------------------------------------------------------------------------ - ::cppu::IPropertyArrayHelper* CopyTableWizard::createArrayHelper( ) const + try { - Sequence< Property > aProps; - describeProperties( aProps ); - return new ::cppu::OPropertyArrayHelper( aProps ); - } + if ( nArgCount == 3 ) + { // ->createWithInteractionHandler + if ( !( _rArguments[2] >>= m_xInteractionHandler ) ) + throw IllegalArgumentException( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "The given interaction handler is invalid." ) ), + // TODO: resource + *this, + 3 + ); + } + if ( !m_xInteractionHandler.is() ) + m_xInteractionHandler.set( m_aContext.createComponent( "com.sun.star.sdb.InteractionHandler" ), UNO_QUERY_THROW ); - //------------------------------------------------------------------------------ - Dialog* CopyTableWizard::createDialog( Window* _pParent ) + InteractionHandler xSourceDocHandler; + Reference< XPropertySet > xSourceDescriptor( impl_ensureDataAccessDescriptor_throw( _rArguments, 0, m_xSourceConnection, xSourceDocHandler ) ); + m_pSourceObject = impl_extractSourceObject_throw( xSourceDescriptor, m_nCommandType ); + + InteractionHandler xDestDocHandler; + impl_ensureDataAccessDescriptor_throw( _rArguments, 1, m_xDestConnection, xDestDocHandler ); + + if ( xDestDocHandler.is() && !m_xInteractionHandler.is() ) + m_xInteractionHandler = xDestDocHandler; + } + catch( const RuntimeException& ) { throw; } + catch( const IllegalArgumentException& ) { throw; } + catch( const SQLException& ) { throw; } + catch( const Exception& ) { - OSL_PRECOND( isInitialized(), "CopyTableWizard::createDialog: not initialized!" ); - // this should have been prevented in ::execute already - - OCopyTableWizard* pWizard = new OCopyTableWizard( - _pParent, - m_sDestinationTable, - m_nOperation, - *m_pSourceObject, - m_xSourceConnection.getTyped(), - m_xDestConnection.getTyped(), - m_aContext.getLegacyServiceFactory() + throw WrappedTargetException( + String( ModuleRes( STR_CTW_ERROR_DURING_INITIALIZATION ) ), + *this, + ::cppu::getCaughtException() ); + } +} - impl_attributesToDialog_nothrow( *pWizard ); +//------------------------------------------------------------------------- +::cppu::IPropertyArrayHelper& CopyTableWizard::getInfoHelper() +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::getInfoHelper" ); + return *getArrayHelper(); +} - return pWizard; - } +//------------------------------------------------------------------------------ +::cppu::IPropertyArrayHelper* CopyTableWizard::createArrayHelper( ) const +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::createArrayHelper" ); + Sequence< Property > aProps; + describeProperties( aProps ); + return new ::cppu::OPropertyArrayHelper( aProps ); +} - //------------------------------------------------------------------------------ - void CopyTableWizard::executedDialog( sal_Int16 _nExecutionResult ) - { - CopyTableWizard_DialogBase::executedDialog( _nExecutionResult ); +//------------------------------------------------------------------------------ +Dialog* CopyTableWizard::createDialog( Window* _pParent ) +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::createDialog" ); + OSL_PRECOND( isInitialized(), "CopyTableWizard::createDialog: not initialized!" ); + // this should have been prevented in ::execute already + + OCopyTableWizard* pWizard = new OCopyTableWizard( + _pParent, + m_sDestinationTable, + m_nOperation, + *m_pSourceObject, + m_xSourceConnection.getTyped(), + m_xDestConnection.getTyped(), + m_aContext.getLegacyServiceFactory() + ); + + impl_attributesToDialog_nothrow( *pWizard ); + + return pWizard; +} - if ( _nExecutionResult == RET_OK ) - impl_doCopy_nothrow(); +//------------------------------------------------------------------------------ +void CopyTableWizard::executedDialog( sal_Int16 _nExecutionResult ) +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::executedDialog" ); + CopyTableWizard_DialogBase::executedDialog( _nExecutionResult ); - // do this after impl_doCopy_nothrow: The attributes may change during copying, for instance - // if the user entered an unqualified table name - impl_dialogToAttributes_nothrow( impl_getDialog_throw() ); - } + if ( _nExecutionResult == RET_OK ) + impl_doCopy_nothrow(); + + // do this after impl_doCopy_nothrow: The attributes may change during copying, for instance + // if the user entered an unqualified table name + impl_dialogToAttributes_nothrow( impl_getDialog_throw() ); +} //........................................................................ } // namespace dbaui |