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 | b9392a36645d8632b97ad79240f483b3a1683b61 (patch) | |
tree | a7596b538b33f0eb9a47d83a0a19972e72a54da4 /connectivity/source | |
parent | caae90c2a21d3ed30250ebb79dbcc06737f7356b (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 'connectivity/source')
101 files changed, 2798 insertions, 5782 deletions
diff --git a/connectivity/source/commontools/FValue.cxx b/connectivity/source/commontools/FValue.cxx index ffd67f9ef0fa..a6da2b165612 100644 --- a/connectivity/source/commontools/FValue.cxx +++ b/connectivity/source/commontools/FValue.cxx @@ -36,6 +36,7 @@ #include "connectivity/CommonTools.hxx" #include <connectivity/dbconversion.hxx> #include <com/sun/star/io/XInputStream.hpp> +#include <rtl/logfile.hxx> using namespace connectivity; using namespace dbtools; @@ -47,10 +48,12 @@ using namespace ::com::sun::star::io; namespace { static sal_Bool isStorageCompatible(sal_Int32 _eType1, sal_Int32 _eType2) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::isStorageCompatible" ); sal_Bool bIsCompatible = sal_True; if (_eType1 != _eType2) { + RTL_LOGFILE_CONTEXT_TRACE( aLogger, "ORowSetValue::isStorageCompatible _eType1 != _eType2" ); switch (_eType1) { case DataType::CHAR: @@ -196,65 +199,65 @@ namespace tracing // ----------------------------------------------------------------------------- void ORowSetValue::setTypeKind(sal_Int32 _eType) { - if (!m_bNull) - if (!isStorageCompatible(_eType, m_eTypeKind)) + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::setTypeKind" ); + if ( !m_bNull && !isStorageCompatible(_eType, m_eTypeKind) ) + { + switch(_eType) { - switch(_eType) - { - case DataType::VARCHAR: - case DataType::CHAR: - case DataType::DECIMAL: - case DataType::NUMERIC: - case DataType::LONGVARCHAR: - (*this) = getString(); - break; - case DataType::BIGINT: - (*this) = getLong(); - break; + case DataType::VARCHAR: + case DataType::CHAR: + case DataType::DECIMAL: + case DataType::NUMERIC: + case DataType::LONGVARCHAR: + (*this) = getString(); + break; + case DataType::BIGINT: + (*this) = getLong(); + break; - case DataType::FLOAT: - (*this) = getFloat(); - break; - case DataType::DOUBLE: - case DataType::REAL: - (*this) = getDouble(); - break; - case DataType::TINYINT: - (*this) = getInt8(); - break; - case DataType::SMALLINT: - (*this) = getInt16(); - break; - case DataType::INTEGER: - (*this) = getInt32(); - break; - case DataType::BIT: - case DataType::BOOLEAN: - (*this) = getBool(); - break; - case DataType::DATE: - (*this) = getDate(); - break; - case DataType::TIME: - (*this) = getTime(); - break; - case DataType::TIMESTAMP: - (*this) = getDateTime(); - break; - case DataType::BINARY: - case DataType::VARBINARY: - case DataType::LONGVARBINARY: - (*this) = getSequence(); - break; - case DataType::BLOB: - case DataType::CLOB: - case DataType::OBJECT: - (*this) = getAny(); - break; - default: - OSL_ENSURE(0,"ORowSetValue:operator==(): UNSPUPPORTED TYPE!"); - } + case DataType::FLOAT: + (*this) = getFloat(); + break; + case DataType::DOUBLE: + case DataType::REAL: + (*this) = getDouble(); + break; + case DataType::TINYINT: + (*this) = getInt8(); + break; + case DataType::SMALLINT: + (*this) = getInt16(); + break; + case DataType::INTEGER: + (*this) = getInt32(); + break; + case DataType::BIT: + case DataType::BOOLEAN: + (*this) = getBool(); + break; + case DataType::DATE: + (*this) = getDate(); + break; + case DataType::TIME: + (*this) = getTime(); + break; + case DataType::TIMESTAMP: + (*this) = getDateTime(); + break; + case DataType::BINARY: + case DataType::VARBINARY: + case DataType::LONGVARBINARY: + (*this) = getSequence(); + break; + case DataType::BLOB: + case DataType::CLOB: + case DataType::OBJECT: + (*this) = getAny(); + break; + default: + OSL_ENSURE(0,"ORowSetValue:operator==(): UNSPUPPORTED TYPE!"); } + } m_eTypeKind = _eType; } @@ -262,6 +265,7 @@ void ORowSetValue::setTypeKind(sal_Int32 _eType) // ----------------------------------------------------------------------------- void ORowSetValue::free() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::free" ); if(!m_bNull) { switch(m_eTypeKind) @@ -348,7 +352,7 @@ ORowSetValue& ORowSetValue::operator=(const ORowSetValue& _rRH) if(&_rRH == this) return *this; - if ( m_eTypeKind != _rRH.m_eTypeKind || _rRH.m_bNull || m_bSigned != _rRH.m_bSigned) + if ( m_eTypeKind != _rRH.m_eTypeKind || (_rRH.m_bNull && !m_bNull) || m_bSigned != _rRH.m_bSigned) free(); m_bBound = _rRH.m_bBound; @@ -581,7 +585,7 @@ ORowSetValue& ORowSetValue::operator=(const ::rtl::OUString& _rRH) ORowSetValue& ORowSetValue::operator=(const double& _rRH) { - if(m_eTypeKind != DataType::DOUBLE) + if( !isStorageCompatible(m_eTypeKind,DataType::DOUBLE) ) free(); if(m_bNull) @@ -848,6 +852,7 @@ bool ORowSetValue::operator==(const ORowSetValue& _rRH) const // ------------------------------------------------------------------------- Any ORowSetValue::makeAny() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::makeAny" ); Any rValue; if(isBound() && !isNull()) { @@ -939,6 +944,7 @@ Any ORowSetValue::makeAny() const // ------------------------------------------------------------------------- ::rtl::OUString ORowSetValue::getString( ) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getString" ); ::rtl::OUString aRet; if(!m_bNull) { @@ -1014,6 +1020,7 @@ Any ORowSetValue::makeAny() const // ------------------------------------------------------------------------- sal_Bool ORowSetValue::getBool() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getBool" ); sal_Bool bRet = sal_False; if(!m_bNull) { @@ -1084,6 +1091,7 @@ sal_Bool ORowSetValue::getBool() const // ------------------------------------------------------------------------- sal_Int8 ORowSetValue::getInt8() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getInt8" ); sal_Int8 nRet = 0; @@ -1148,6 +1156,7 @@ sal_Int8 ORowSetValue::getInt8() const // ------------------------------------------------------------------------- sal_Int16 ORowSetValue::getInt16() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getInt16" ); sal_Int16 nRet = 0; @@ -1212,6 +1221,7 @@ sal_Int16 ORowSetValue::getInt16() const // ------------------------------------------------------------------------- sal_Int32 ORowSetValue::getInt32() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getInt32" ); sal_Int32 nRet = 0; if(!m_bNull) { @@ -1276,6 +1286,7 @@ sal_Int32 ORowSetValue::getInt32() const // ------------------------------------------------------------------------- sal_Int64 ORowSetValue::getLong() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getLong" ); sal_Int64 nRet = 0; if(!m_bNull) { @@ -1340,6 +1351,7 @@ sal_Int64 ORowSetValue::getLong() const // ------------------------------------------------------------------------- float ORowSetValue::getFloat() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getFloat" ); float nRet = 0; if(!m_bNull) { @@ -1408,6 +1420,7 @@ float ORowSetValue::getFloat() const // ------------------------------------------------------------------------- double ORowSetValue::getDouble() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getDouble" ); double nRet = 0; @@ -1478,6 +1491,7 @@ double ORowSetValue::getDouble() const // ------------------------------------------------------------------------- void ORowSetValue::setFromDouble(const double& _rVal,sal_Int32 _nDatatype) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::setFromDouble" ); free(); m_bNull = sal_False; @@ -1564,6 +1578,7 @@ void ORowSetValue::setFromDouble(const double& _rVal,sal_Int32 _nDatatype) // ----------------------------------------------------------------------------- Sequence<sal_Int8> ORowSetValue::getSequence() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getSequence" ); Sequence<sal_Int8> aSeq; if (!m_bNull) { @@ -1605,6 +1620,7 @@ Sequence<sal_Int8> ORowSetValue::getSequence() const // ----------------------------------------------------------------------------- ::com::sun::star::util::Date ORowSetValue::getDate() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getDate" ); ::com::sun::star::util::Date aValue; if(!m_bNull) { @@ -1643,6 +1659,7 @@ Sequence<sal_Int8> ORowSetValue::getSequence() const // ----------------------------------------------------------------------------- ::com::sun::star::util::Time ORowSetValue::getTime() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getTime" ); ::com::sun::star::util::Time aValue; if(!m_bNull) { @@ -1680,6 +1697,7 @@ Sequence<sal_Int8> ORowSetValue::getSequence() const // ----------------------------------------------------------------------------- ::com::sun::star::util::DateTime ORowSetValue::getDateTime() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getDateTime" ); ::com::sun::star::util::DateTime aValue; if(!m_bNull) { @@ -1726,6 +1744,7 @@ Sequence<sal_Int8> ORowSetValue::getSequence() const // ----------------------------------------------------------------------------- void ORowSetValue::setSigned(sal_Bool _bMod) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::setSigned" ); if ( m_bSigned != _bMod ) { m_bSigned = _bMod; @@ -1792,6 +1811,15 @@ void ORowSetValue::fill(sal_Int32 _nPos, sal_Int32 _nType, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow>& _xRow) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::fill" ); + fill(_nPos,_nType,sal_True,_xRow); +} +void ORowSetValue::fill(sal_Int32 _nPos, + sal_Int32 _nType, + sal_Bool _bNullable, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow>& _xRow) +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::fill" ); sal_Bool bReadData = sal_True; switch(_nType) { @@ -1863,13 +1891,14 @@ void ORowSetValue::fill(sal_Int32 _nPos, bReadData = sal_False; break; } - if ( bReadData && _xRow->wasNull() ) + if ( bReadData && _bNullable && _xRow->wasNull() ) setNull(); setTypeKind(_nType); } // ----------------------------------------------------------------------------- void ORowSetValue::fill(const Any& _rValue) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::fill" ); switch (_rValue.getValueType().getTypeClass()) { case TypeClass_VOID: diff --git a/connectivity/source/drivers/ado/APreparedStatement.cxx b/connectivity/source/drivers/ado/APreparedStatement.cxx index a9f8f7d87c6e..ac05163d416f 100644 --- a/connectivity/source/drivers/ado/APreparedStatement.cxx +++ b/connectivity/source/drivers/ado/APreparedStatement.cxx @@ -41,6 +41,7 @@ #include <comphelper/sequence.hxx> #include "connectivity/dbexception.hxx" #include "connectivity/dbtools.hxx" +#include "resource/ado_res.hrc" #include <limits> @@ -433,9 +434,16 @@ void SAL_CALL OPreparedStatement::setObjectNull( sal_Int32 parameterIndex, sal_I } // ------------------------------------------------------------------------- -void SAL_CALL OPreparedStatement::setObject( sal_Int32 /*parameterIndex*/, const Any& /*x*/ ) throw(SQLException, RuntimeException) +void SAL_CALL OPreparedStatement::setObject( sal_Int32 parameterIndex, const Any& x ) throw(SQLException, RuntimeException) { - ::dbtools::throwFeatureNotImplementedException( "XParameters::setObject", *this ); + if(!::dbtools::implSetObject(this,parameterIndex,x)) + { + const ::rtl::OUString sError( m_pConnection->getResources().getResourceStringWithSubstitution( + STR_UNKNOWN_PARA_TYPE, + "$position$", ::rtl::OUString::valueOf(parameterIndex) + ) ); + ::dbtools::throwGenericSQLException(sError,*this); + } // setObject (parameterIndex, x, sqlType, 0); } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/ado/makefile.mk b/connectivity/source/drivers/ado/makefile.mk index d74d12c546b2..1aace34e4de6 100644 --- a/connectivity/source/drivers/ado/makefile.mk +++ b/connectivity/source/drivers/ado/makefile.mk @@ -34,6 +34,7 @@ PRJ=..$/..$/.. PRJINC=..$/.. PRJNAME=connectivity TARGET=ado +VISIBILITY_HIDDEN=TRUE # ENABLE_EXCEPTIONS=TRUE diff --git a/connectivity/source/drivers/calc/CCatalog.cxx b/connectivity/source/drivers/calc/CCatalog.cxx index bb08d7d3975e..94e056817daa 100644 --- a/connectivity/source/drivers/calc/CCatalog.cxx +++ b/connectivity/source/drivers/calc/CCatalog.cxx @@ -37,6 +37,7 @@ #include "calc/CTables.hxx" #include <com/sun/star/sdbc/XRow.hpp> #include <com/sun/star/sdbc/XResultSet.hpp> +#include <rtl/logfile.hxx> using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; @@ -49,10 +50,12 @@ using namespace connectivity::calc; // ------------------------------------------------------------------------- OCalcCatalog::OCalcCatalog(OCalcConnection* _pCon) : file::OFileCatalog(_pCon) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcCatalog::OCalcCatalog" ); } // ------------------------------------------------------------------------- void OCalcCatalog::refreshTables() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcCatalog::refreshTables" ); TStringVector aVector; Sequence< ::rtl::OUString > aTypes; OCalcConnection::ODocHolder aDocHodler(((OCalcConnection*)m_pConnection)); @@ -71,8 +74,8 @@ void OCalcCatalog::refreshTables() m_pTables = new OCalcTables(m_xMetaData,*this,m_aMutex,aVector); // this avoids that the document will be loaded a 2nd time when one table will be accessed. - if ( m_pTables && m_pTables->hasElements() ) - m_pTables->getByIndex(0); + //if ( m_pTables && m_pTables->hasElements() ) + // m_pTables->getByIndex(0); } // ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/calc/CConnection.cxx b/connectivity/source/drivers/calc/CConnection.cxx index d295f390ded4..77467dda0bc3 100644 --- a/connectivity/source/drivers/calc/CConnection.cxx +++ b/connectivity/source/drivers/calc/CConnection.cxx @@ -49,6 +49,7 @@ #include <svtools/pathoptions.hxx> #include <connectivity/dbexception.hxx> #include <cppuhelper/exc_hlp.hxx> +#include <rtl/logfile.hxx> using namespace connectivity::calc; using namespace connectivity::file; @@ -69,6 +70,7 @@ using namespace ::com::sun::star::sheet; OCalcConnection::OCalcConnection(ODriver* _pDriver) : OConnection(_pDriver),m_nDocCount(0) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcConnection::OCalcConnection" ); // m_aFilenameExtension is not used } @@ -79,6 +81,7 @@ OCalcConnection::~OCalcConnection() void OCalcConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyValue >& info) throw(SQLException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcConnection::construct" ); // open file sal_Int32 nLen = url.indexOf(':'); @@ -114,10 +117,12 @@ void OCalcConnection::construct(const ::rtl::OUString& url,const Sequence< Prope } } // for(;pIter != pEnd;++pIter) ODocHolder aDocHodler(this); // just to test that the doc can be loaded + acquireDoc(); } // ----------------------------------------------------------------------------- Reference< XSpreadsheetDocument> OCalcConnection::acquireDoc() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcConnection::acquireDoc" ); if ( m_xDoc.is() ) { osl_incrementInterlockedCount(&m_nDocCount); @@ -190,14 +195,17 @@ Reference< XSpreadsheetDocument> OCalcConnection::acquireDoc() // ----------------------------------------------------------------------------- void OCalcConnection::releaseDoc() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcConnection::releaseDoc" ); if ( osl_decrementInterlockedCount(&m_nDocCount) == 0 ) ::comphelper::disposeComponent( m_xDoc ); } // ----------------------------------------------------------------------------- void OCalcConnection::disposing() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcConnection::disposing" ); ::osl::MutexGuard aGuard(m_aMutex); + m_nDocCount = 0; ::comphelper::disposeComponent( m_xDoc ); OConnection::disposing(); @@ -212,6 +220,7 @@ IMPLEMENT_SERVICE_INFO(OCalcConnection, "com.sun.star.sdbc.drivers.calc.Connecti Reference< XDatabaseMetaData > SAL_CALL OCalcConnection::getMetaData( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcConnection::getMetaData" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OConnection_BASE::rBHelper.bDisposed); @@ -230,6 +239,7 @@ Reference< XDatabaseMetaData > SAL_CALL OCalcConnection::getMetaData( ) throw(S ::com::sun::star::uno::Reference< XTablesSupplier > OCalcConnection::createCatalog() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcConnection::createCatalog" ); ::osl::MutexGuard aGuard( m_aMutex ); Reference< XTablesSupplier > xTab = m_xCatalog; if(!xTab.is()) @@ -245,6 +255,7 @@ Reference< XDatabaseMetaData > SAL_CALL OCalcConnection::getMetaData( ) throw(S Reference< XStatement > SAL_CALL OCalcConnection::createStatement( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcConnection::createStatement" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OConnection_BASE::rBHelper.bDisposed); @@ -259,6 +270,7 @@ Reference< XStatement > SAL_CALL OCalcConnection::createStatement( ) throw(SQLE Reference< XPreparedStatement > SAL_CALL OCalcConnection::prepareStatement( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcConnection::prepareStatement" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OConnection_BASE::rBHelper.bDisposed); @@ -275,6 +287,7 @@ Reference< XPreparedStatement > SAL_CALL OCalcConnection::prepareStatement( cons Reference< XPreparedStatement > SAL_CALL OCalcConnection::prepareCall( const ::rtl::OUString& /*sql*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcConnection::prepareCall" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OConnection_BASE::rBHelper.bDisposed); diff --git a/connectivity/source/drivers/calc/CDatabaseMetaData.cxx b/connectivity/source/drivers/calc/CDatabaseMetaData.cxx index 6305c84be6e7..4123a2c0ae89 100644 --- a/connectivity/source/drivers/calc/CDatabaseMetaData.cxx +++ b/connectivity/source/drivers/calc/CDatabaseMetaData.cxx @@ -32,16 +32,12 @@ #include "precompiled_connectivity.hxx" -#ifndef _CONNECTIVITY_CALC_OCALCDATABASEMETADATA_HXX_ #include "calc/CDatabaseMetaData.hxx" -#endif #include "calc/CConnection.hxx" #include <com/sun/star/sdbc/DataType.hpp> #include <com/sun/star/sdbc/ResultSetType.hpp> #include <com/sun/star/sdbc/ColumnValue.hpp> -#ifndef _COM_SUN_STAR_BEANS_XPropertySet_HPP_ #include <com/sun/star/beans/XPropertySet.hpp> -#endif #include <com/sun/star/sdbc/ResultSetConcurrency.hpp> #include <com/sun/star/sdbcx/XColumnsSupplier.hpp> #include <com/sun/star/sdbcx/XIndexesSupplier.hpp> @@ -55,6 +51,7 @@ #include "FDatabaseMetaDataResultSet.hxx" #include <com/sun/star/lang/XUnoTunnel.hpp> #include <comphelper/types.hxx> +#include <rtl/logfile.hxx> using namespace connectivity::calc; using namespace connectivity::file; @@ -70,6 +67,7 @@ using namespace ::com::sun::star::sheet; OCalcDatabaseMetaData::OCalcDatabaseMetaData(OConnection* _pCon) :ODatabaseMetaData(_pCon) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcDatabaseMetaData::OCalcDatabaseMetaData" ); } // ------------------------------------------------------------------------- @@ -81,6 +79,7 @@ OCalcDatabaseMetaData::~OCalcDatabaseMetaData() // ------------------------------------------------------------------------- Reference< XResultSet > OCalcDatabaseMetaData::impl_getTypeInfo_throw( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcDatabaseMetaData::impl_getTypeInfo_throw" ); ::osl::MutexGuard aGuard( m_aMutex ); ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTypeInfo); @@ -163,6 +162,7 @@ Reference< XResultSet > SAL_CALL OCalcDatabaseMetaData::getColumns( const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcDatabaseMetaData::getColumns" ); ::osl::MutexGuard aGuard( m_aMutex ); @@ -180,33 +180,32 @@ Reference< XResultSet > SAL_CALL OCalcDatabaseMetaData::getColumns( aRow[10] = new ORowSetValueDecorator((sal_Int32)10); Sequence< ::rtl::OUString> aTabNames(xNames->getElementNames()); - const ::rtl::OUString* pTabBegin = aTabNames.getConstArray(); - const ::rtl::OUString* pTabEnd = pTabBegin + aTabNames.getLength(); - for(;pTabBegin != pTabEnd;++pTabBegin) + const ::rtl::OUString* pTabIter = aTabNames.getConstArray(); + const ::rtl::OUString* pTabEnd = pTabIter + aTabNames.getLength(); + for(;pTabIter != pTabEnd;++pTabIter) { - if(match(tableNamePattern,*pTabBegin,'\0')) + if(match(tableNamePattern,*pTabIter,'\0')) { - Reference< XColumnsSupplier> xTable; - xNames->getByName(*pTabBegin) >>= xTable; + const Reference< XColumnsSupplier> xTable(xNames->getByName(*pTabIter),UNO_QUERY_THROW); OSL_ENSURE(xTable.is(),"Table not found! Normallya exception had to be thrown here!"); - aRow[3] = new ORowSetValueDecorator(*pTabBegin); + aRow[3] = new ORowSetValueDecorator(*pTabIter); - Reference< XNameAccess> xColumns = xTable->getColumns(); + const Reference< XNameAccess> xColumns = xTable->getColumns(); if(!xColumns.is()) throw SQLException(); - Sequence< ::rtl::OUString> aColNames(xColumns->getElementNames()); + const Sequence< ::rtl::OUString> aColNames(xColumns->getElementNames()); - const ::rtl::OUString* pBegin = aColNames.getConstArray(); - const ::rtl::OUString* pEnd = pBegin + aColNames.getLength(); + const ::rtl::OUString* pColumnIter = aColNames.getConstArray(); + const ::rtl::OUString* pEnd = pColumnIter + aColNames.getLength(); Reference< XPropertySet> xColumn; - for(sal_Int32 i=1;pBegin != pEnd;++pBegin,++i) + for(sal_Int32 i=1;pColumnIter != pEnd;++pColumnIter,++i) { - if(match(columnNamePattern,*pBegin,'\0')) + if(match(columnNamePattern,*pColumnIter,'\0')) { - aRow[4] = new ORowSetValueDecorator( *pBegin); + aRow[4] = new ORowSetValueDecorator( *pColumnIter); - xColumns->getByName(*pBegin) >>= xColumn; + xColumns->getByName(*pColumnIter) >>= xColumn; OSL_ENSURE(xColumn.is(),"Columns contains a column who isn't a fastpropertyset!"); aRow[5] = new ORowSetValueDecorator(::comphelper::getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))); aRow[6] = new ORowSetValueDecorator(::comphelper::getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)))); @@ -259,6 +258,7 @@ Reference< XResultSet > SAL_CALL OCalcDatabaseMetaData::getColumns( ::rtl::OUString SAL_CALL OCalcDatabaseMetaData::getURL( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcDatabaseMetaData::getURL" ); ::osl::MutexGuard aGuard( m_aMutex ); return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:calc:")) + m_pConnection->getURL(); @@ -268,6 +268,7 @@ Reference< XResultSet > SAL_CALL OCalcDatabaseMetaData::getColumns( sal_Int32 SAL_CALL OCalcDatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcDatabaseMetaData::getMaxBinaryLiteralLength" ); return STRING_MAXLEN; } @@ -275,21 +276,25 @@ sal_Int32 SAL_CALL OCalcDatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQ sal_Int32 SAL_CALL OCalcDatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcDatabaseMetaData::getMaxCharLiteralLength" ); return STRING_MAXLEN; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OCalcDatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcDatabaseMetaData::getMaxColumnNameLength" ); return STRING_MAXLEN; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OCalcDatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcDatabaseMetaData::getMaxColumnsInIndex" ); return 1; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OCalcDatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcDatabaseMetaData::getMaxColumnsInTable" ); return 256; } @@ -394,6 +399,7 @@ Reference< XResultSet > SAL_CALL OCalcDatabaseMetaData::getTables( const ::rtl::OUString& tableNamePattern, const Sequence< ::rtl::OUString >& types ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcDatabaseMetaData::getTables" ); ::osl::MutexGuard aGuard( m_aMutex ); ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTables); diff --git a/connectivity/source/drivers/calc/CResultSet.cxx b/connectivity/source/drivers/calc/CResultSet.cxx index 81d3d9b6a4cc..5b5854565ff6 100644 --- a/connectivity/source/drivers/calc/CResultSet.cxx +++ b/connectivity/source/drivers/calc/CResultSet.cxx @@ -129,9 +129,6 @@ sal_Bool SAL_CALL OCalcResultSet::moveRelativeToBookmark( const Any& bookmark, // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OCalcResultSet::compareBookmarks( const Any& lhs, const Any& rhs ) throw( SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - return (lhs == rhs) ? 0 : 2; } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/calc/CTable.cxx b/connectivity/source/drivers/calc/CTable.cxx index 74c2c6d51305..2d35c16c11dd 100644 --- a/connectivity/source/drivers/calc/CTable.cxx +++ b/connectivity/source/drivers/calc/CTable.cxx @@ -64,6 +64,7 @@ #include <connectivity/dbexception.hxx> #include <connectivity/dbconversion.hxx> #include <comphelper/types.hxx> +#include <rtl/logfile.hxx> using namespace connectivity; using namespace connectivity::calc; @@ -85,31 +86,31 @@ using namespace ::com::sun::star::util; void lcl_UpdateArea( const Reference<XCellRange>& xUsedRange, sal_Int32& rEndCol, sal_Int32& rEndRow ) { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::lcl_UpdateArea" ); // update rEndCol, rEndRow if any non-empty cell in xUsedRange is right/below - Reference<XCellRangesQuery> xUsedQuery( xUsedRange, UNO_QUERY ); + const Reference<XCellRangesQuery> xUsedQuery( xUsedRange, UNO_QUERY ); if ( xUsedQuery.is() ) { const sal_Int16 nContentFlags = CellFlags::STRING | CellFlags::VALUE | CellFlags::DATETIME | CellFlags::FORMULA | CellFlags::ANNOTATION; - Reference<XSheetCellRanges> xUsedRanges = xUsedQuery->queryContentCells( nContentFlags ); - Sequence<CellRangeAddress> aAddresses = xUsedRanges->getRangeAddresses(); + const Reference<XSheetCellRanges> xUsedRanges = xUsedQuery->queryContentCells( nContentFlags ); + const Sequence<CellRangeAddress> aAddresses = xUsedRanges->getRangeAddresses(); - sal_Int32 nCount = aAddresses.getLength(); + const sal_Int32 nCount = aAddresses.getLength(); const CellRangeAddress* pData = aAddresses.getConstArray(); for ( sal_Int32 i=0; i<nCount; i++ ) { - if ( pData[i].EndColumn > rEndCol ) - rEndCol = pData[i].EndColumn; - if ( pData[i].EndRow > rEndRow ) - rEndRow = pData[i].EndRow; + rEndCol = pData[i].EndColumn > rEndCol ? pData[i].EndColumn : rEndCol; + rEndRow = pData[i].EndRow > rEndRow ? pData[i].EndRow : rEndRow; } } } void lcl_GetDataArea( const Reference<XSpreadsheet>& xSheet, sal_Int32& rColumnCount, sal_Int32& rRowCount ) { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::lcl_GetDataArea" ); Reference<XSheetCellCursor> xCursor = xSheet->createCursor(); Reference<XCellRangeAddressable> xRange( xCursor, UNO_QUERY ); if ( !xRange.is() ) @@ -159,14 +160,15 @@ void lcl_GetDataArea( const Reference<XSpreadsheet>& xSheet, sal_Int32& rColumnC CellContentType lcl_GetContentOrResultType( const Reference<XCell>& xCell ) { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::lcl_GetContentOrResultType" ); CellContentType eCellType = xCell->getType(); if ( eCellType == CellContentType_FORMULA ) { Reference<XPropertySet> xProp( xCell, UNO_QUERY ); try { - Any aTypeAny = xProp->getPropertyValue( ::rtl::OUString::createFromAscii("FormulaResultType") ); - aTypeAny >>= eCellType; // type of formula result + static ::rtl::OUString s_FormulaResultType(RTL_CONSTASCII_USTRINGPARAM("FormulaResultType")); + xProp->getPropertyValue( s_FormulaResultType ) >>= eCellType; // type of formula result } catch (UnknownPropertyException&) { @@ -178,6 +180,7 @@ CellContentType lcl_GetContentOrResultType( const Reference<XCell>& xCell ) Reference<XCell> lcl_GetUsedCell( const Reference<XSpreadsheet>& xSheet, sal_Int32 nDocColumn, sal_Int32 nDocRow ) { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::lcl_GetUsedCell" ); Reference<XCell> xCell = xSheet->getCellByPosition( nDocColumn, nDocRow ); if ( xCell.is() && xCell->getType() == CellContentType_EMPTY ) { @@ -215,6 +218,7 @@ Reference<XCell> lcl_GetUsedCell( const Reference<XSpreadsheet>& xSheet, sal_Int bool lcl_HasTextInColumn( const Reference<XSpreadsheet>& xSheet, sal_Int32 nDocColumn, sal_Int32 nDocRow ) { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::lcl_HasTextInColumn" ); // look for any text cell or text result in the column Reference<XCellRangeAddressable> xAddr( xSheet, UNO_QUERY ); @@ -244,6 +248,7 @@ void lcl_GetColumnInfo( const Reference<XSpreadsheet>& xSheet, const Reference<X sal_Int32 nDocColumn, sal_Int32 nStartRow, sal_Bool bHasHeaders, ::rtl::OUString& rName, sal_Int32& rDataType, sal_Bool& rCurrency ) { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::lcl_GetColumnInfo" ); //! avoid duplicate field names // get column name from first row, if range contains headers @@ -267,7 +272,7 @@ void lcl_GetColumnInfo( const Reference<XSpreadsheet>& xSheet, const Reference<X { rCurrency = sal_False; // set to true for currency below - CellContentType eCellType = lcl_GetContentOrResultType( xDataCell ); + const CellContentType eCellType = lcl_GetContentOrResultType( xDataCell ); // #i35178# use "text" type if there is any text cell in the column if ( eCellType == CellContentType_TEXT || lcl_HasTextInColumn( xSheet, nDocColumn, nDataRow ) ) rDataType = DataType::VARCHAR; @@ -278,15 +283,15 @@ void lcl_GetColumnInfo( const Reference<XSpreadsheet>& xSheet, const Reference<X sal_Int16 nNumType = NumberFormat::NUMBER; try { - Any aNumAny = xProp->getPropertyValue( ::rtl::OUString::createFromAscii("NumberFormat") ); + static ::rtl::OUString s_NumberFormat(RTL_CONSTASCII_USTRINGPARAM("NumberFormat")); sal_Int32 nKey = 0; - if ( aNumAny >>= nKey ) + + if ( xProp->getPropertyValue( s_NumberFormat ) >>= nKey ) { - Reference<XPropertySet> xFormat = xFormats->getByKey( nKey ); + const Reference<XPropertySet> xFormat = xFormats->getByKey( nKey ); if ( xFormat.is() ) { - Any aTypeAny = xFormat->getPropertyValue( OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE) ); - aTypeAny >>= nNumType; + xFormat->getPropertyValue( OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE) ) >>= nNumType; } } } @@ -332,106 +337,109 @@ void lcl_SetValue( ORowSetValue& rValue, const Reference<XSpreadsheet>& xSheet, const ::Date& rNullDate, sal_Int32 nDBRow, sal_Int32 nDBColumn, sal_Int32 nType ) { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::lcl_SetValue" ); sal_Int32 nDocColumn = nStartCol + nDBColumn - 1; // database counts from 1 sal_Int32 nDocRow = nStartRow + nDBRow - 1; if (bHasHeaders) ++nDocRow; - Reference<XCell> xCell = xSheet->getCellByPosition( nDocColumn, nDocRow ); + const Reference<XCell> xCell = xSheet->getCellByPosition( nDocColumn, nDocRow ); if ( xCell.is() ) { - CellContentType eCellType = lcl_GetContentOrResultType( xCell ); - switch (nType) + if ( DataType::VARCHAR == nType ) { - case DataType::VARCHAR: - { - // no difference between empty cell and empty string in spreadsheet - Reference<XText> xText( xCell, UNO_QUERY ); - if ( xText.is() ) - rValue = xText->getString(); - } - break; - case DataType::DECIMAL: - if ( eCellType == CellContentType_VALUE ) - rValue = xCell->getValue(); // double - else - rValue.setNull(); - break; - case DataType::BIT: - if ( eCellType == CellContentType_VALUE ) - rValue = (sal_Bool)( xCell->getValue() != 0.0 ); - else - rValue.setNull(); - break; - case DataType::DATE: - if ( eCellType == CellContentType_VALUE ) - { - ::Date aDate( rNullDate ); - aDate += (long)::rtl::math::approxFloor( xCell->getValue() ); - ::com::sun::star::util::Date aDateStruct( aDate.GetDay(), aDate.GetMonth(), aDate.GetYear() ); - rValue = aDateStruct; - } - else - rValue.setNull(); - break; - case DataType::TIME: - if ( eCellType == CellContentType_VALUE ) - { - double fCellVal = xCell->getValue(); - double fTime = fCellVal - rtl::math::approxFloor( fCellVal ); - long nIntTime = (long)rtl::math::round( fTime * 8640000.0 ); - if ( nIntTime == 8640000 ) - nIntTime = 0; // 23:59:59.995 and above is 00:00:00.00 - ::com::sun::star::util::Time aTime; - aTime.HundredthSeconds = (sal_uInt16)( nIntTime % 100 ); - nIntTime /= 100; - aTime.Seconds = (sal_uInt16)( nIntTime % 60 ); - nIntTime /= 60; - aTime.Minutes = (sal_uInt16)( nIntTime % 60 ); - nIntTime /= 60; - OSL_ENSURE( nIntTime < 24, "error in time calculation" ); - aTime.Hours = (sal_uInt16) nIntTime; - rValue = aTime; - } - else - rValue.setNull(); - break; - case DataType::TIMESTAMP: - if ( eCellType == CellContentType_VALUE ) - { - double fCellVal = xCell->getValue(); - double fDays = ::rtl::math::approxFloor( fCellVal ); - double fTime = fCellVal - fDays; - long nIntDays = (long)fDays; - long nIntTime = (long)::rtl::math::round( fTime * 8640000.0 ); - if ( nIntTime == 8640000 ) + // no difference between empty cell and empty string in spreadsheet + const Reference<XText> xText( xCell, UNO_QUERY ); + if ( xText.is() ) + rValue = xText->getString(); + } + else + { + CellContentType eCellType = lcl_GetContentOrResultType( xCell ); + switch (nType) + { + case DataType::DECIMAL: + if ( eCellType == CellContentType_VALUE ) + rValue = xCell->getValue(); // double + else + rValue.setNull(); + break; + case DataType::BIT: + if ( eCellType == CellContentType_VALUE ) + rValue = (sal_Bool)( xCell->getValue() != 0.0 ); + else + rValue.setNull(); + break; + case DataType::DATE: + if ( eCellType == CellContentType_VALUE ) + { + ::Date aDate( rNullDate ); + aDate += (long)::rtl::math::approxFloor( xCell->getValue() ); + ::com::sun::star::util::Date aDateStruct( aDate.GetDay(), aDate.GetMonth(), aDate.GetYear() ); + rValue = aDateStruct; + } + else + rValue.setNull(); + break; + case DataType::TIME: + if ( eCellType == CellContentType_VALUE ) { - nIntTime = 0; // 23:59:59.995 and above is 00:00:00.00 - ++nIntDays; // (next day) + double fCellVal = xCell->getValue(); + double fTime = fCellVal - rtl::math::approxFloor( fCellVal ); + long nIntTime = (long)rtl::math::round( fTime * 8640000.0 ); + if ( nIntTime == 8640000 ) + nIntTime = 0; // 23:59:59.995 and above is 00:00:00.00 + ::com::sun::star::util::Time aTime; + aTime.HundredthSeconds = (sal_uInt16)( nIntTime % 100 ); + nIntTime /= 100; + aTime.Seconds = (sal_uInt16)( nIntTime % 60 ); + nIntTime /= 60; + aTime.Minutes = (sal_uInt16)( nIntTime % 60 ); + nIntTime /= 60; + OSL_ENSURE( nIntTime < 24, "error in time calculation" ); + aTime.Hours = (sal_uInt16) nIntTime; + rValue = aTime; } + else + rValue.setNull(); + break; + case DataType::TIMESTAMP: + if ( eCellType == CellContentType_VALUE ) + { + double fCellVal = xCell->getValue(); + double fDays = ::rtl::math::approxFloor( fCellVal ); + double fTime = fCellVal - fDays; + long nIntDays = (long)fDays; + long nIntTime = (long)::rtl::math::round( fTime * 8640000.0 ); + if ( nIntTime == 8640000 ) + { + nIntTime = 0; // 23:59:59.995 and above is 00:00:00.00 + ++nIntDays; // (next day) + } - ::com::sun::star::util::DateTime aDateTime; + ::com::sun::star::util::DateTime aDateTime; - aDateTime.HundredthSeconds = (sal_uInt16)( nIntTime % 100 ); - nIntTime /= 100; - aDateTime.Seconds = (sal_uInt16)( nIntTime % 60 ); - nIntTime /= 60; - aDateTime.Minutes = (sal_uInt16)( nIntTime % 60 ); - nIntTime /= 60; - OSL_ENSURE( nIntTime < 24, "error in time calculation" ); - aDateTime.Hours = (sal_uInt16) nIntTime; + aDateTime.HundredthSeconds = (sal_uInt16)( nIntTime % 100 ); + nIntTime /= 100; + aDateTime.Seconds = (sal_uInt16)( nIntTime % 60 ); + nIntTime /= 60; + aDateTime.Minutes = (sal_uInt16)( nIntTime % 60 ); + nIntTime /= 60; + OSL_ENSURE( nIntTime < 24, "error in time calculation" ); + aDateTime.Hours = (sal_uInt16) nIntTime; - ::Date aDate( rNullDate ); - aDate += nIntDays; - aDateTime.Day = aDate.GetDay(); - aDateTime.Month = aDate.GetMonth(); - aDateTime.Year = aDate.GetYear(); + ::Date aDate( rNullDate ); + aDate += nIntDays; + aDateTime.Day = aDate.GetDay(); + aDateTime.Month = aDate.GetMonth(); + aDateTime.Year = aDate.GetYear(); - rValue = aDateTime; - } - else - rValue.setNull(); - break; + rValue = aDateTime; + } + else + rValue.setNull(); + break; + } // switch (nType) } } @@ -442,6 +450,7 @@ void lcl_SetValue( ORowSetValue& rValue, const Reference<XSpreadsheet>& xSheet, ::rtl::OUString lcl_GetColumnStr( sal_Int32 nColumn ) { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::lcl_GetColumnStr" ); if ( nColumn < 26 ) return ::rtl::OUString::valueOf( (sal_Unicode) ( 'A' + nColumn ) ); else @@ -456,6 +465,7 @@ void lcl_SetValue( ORowSetValue& rValue, const Reference<XSpreadsheet>& xSheet, void OCalcTable::fillColumns() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::fillColumns" ); if ( !m_xSheet.is() ) throw SQLException(); @@ -463,6 +473,7 @@ void OCalcTable::fillColumns() aStrFieldName.AssignAscii("Column"); ::rtl::OUString aTypeName; ::comphelper::UStringMixEqual aCase(m_pConnection->getMetaData()->storesMixedCaseQuotedIdentifiers()); + const sal_Bool bStoresMixedCaseQuotedIdentifiers = getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers(); for (sal_Int32 i = 0; i < m_nDataCols; i++) { @@ -482,7 +493,10 @@ void OCalcTable::fillColumns() switch ( eType ) { case DataType::VARCHAR: - aTypeName = ::rtl::OUString::createFromAscii("VARCHAR"); + { + static const ::rtl::OUString s_sType(RTL_CONSTASCII_USTRINGPARAM("VARCHAR")); + aTypeName = s_sType; + } break; case DataType::DECIMAL: aTypeName = ::rtl::OUString::createFromAscii("DECIMAL"); @@ -517,7 +531,7 @@ void OCalcTable::fillColumns() sdbcx::OColumn* pColumn = new sdbcx::OColumn( aAlias, aTypeName, ::rtl::OUString(), ColumnValue::NULLABLE, nPrecision, nDecimals, eType, sal_False, sal_False, bCurrency, - getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers() ); + bStoresMixedCaseQuotedIdentifiers); Reference< XPropertySet> xCol = pColumn; m_aColumns->get().push_back(xCol); m_aTypes.push_back(eType); @@ -545,10 +559,12 @@ OCalcTable::OCalcTable(sdbcx::OCollection* _pTables,OCalcConnection* _pConnectio ,m_nDataRows(0) ,m_bHasHeaders(sal_False) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::OCalcTable" ); } // ----------------------------------------------------------------------------- void OCalcTable::construct() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::construct" ); // get sheet object Reference< XSpreadsheetDocument> xDoc = m_pConnection->acquireDoc(); if (xDoc.is()) @@ -631,6 +647,7 @@ void OCalcTable::construct() // ------------------------------------------------------------------------- void OCalcTable::refreshColumns() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::refreshColumns" ); ::osl::MutexGuard aGuard( m_aMutex ); TStringVector aVector; @@ -647,12 +664,14 @@ void OCalcTable::refreshColumns() // ------------------------------------------------------------------------- void OCalcTable::refreshIndexes() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::refreshIndexes" ); // Calc table has no index } // ------------------------------------------------------------------------- void SAL_CALL OCalcTable::disposing(void) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::disposing" ); OFileTable::disposing(); ::osl::MutexGuard aGuard(m_aMutex); m_aColumns = NULL; @@ -664,6 +683,7 @@ void SAL_CALL OCalcTable::disposing(void) // ------------------------------------------------------------------------- Sequence< Type > SAL_CALL OCalcTable::getTypes( ) throw(RuntimeException) { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::getTypes" ); Sequence< Type > aTypes = OTable_TYPEDEF::getTypes(); ::std::vector<Type> aOwnTypes; aOwnTypes.reserve(aTypes.getLength()); @@ -695,13 +715,14 @@ Any SAL_CALL OCalcTable::queryInterface( const Type & rType ) throw(RuntimeExcep rType == ::getCppuType((const Reference<XDataDescriptorFactory>*)0)) return Any(); - Any aRet = ::cppu::queryInterface(rType,static_cast< ::com::sun::star::lang::XUnoTunnel*> (this)); + const Any aRet = ::cppu::queryInterface(rType,static_cast< ::com::sun::star::lang::XUnoTunnel*> (this)); return aRet.hasValue() ? aRet : OTable_TYPEDEF::queryInterface(rType); } //-------------------------------------------------------------------------- Sequence< sal_Int8 > OCalcTable::getUnoTunnelImplementationId() { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::getUnoTunnelImplementationId" ); static ::cppu::OImplementationId * pId = 0; if (! pId) { @@ -719,6 +740,7 @@ Sequence< sal_Int8 > OCalcTable::getUnoTunnelImplementationId() //------------------------------------------------------------------ sal_Int64 OCalcTable::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException) { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::getSomething" ); return (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) ? reinterpret_cast< sal_Int64 >( this ) : OCalcTable_BASE::getSomething(rId); @@ -726,11 +748,13 @@ sal_Int64 OCalcTable::getSomething( const Sequence< sal_Int8 > & rId ) throw (Ru //------------------------------------------------------------------ sal_Int32 OCalcTable::getCurrentLastPos() const { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::getCurrentLastPos" ); return m_nDataRows; } //------------------------------------------------------------------ sal_Bool OCalcTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::seekRow" ); // ---------------------------------------------------------- // Positionierung vorbereiten: @@ -804,6 +828,7 @@ End: sal_Bool OCalcTable::fetchRow( OValueRefRow& _rRow, const OSQLColumns & _rCols, sal_Bool _bUseTableDefs, sal_Bool bRetrieveData ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::fetchRow" ); // read the bookmark BOOL bIsCurRecordDeleted = sal_False; @@ -817,7 +842,8 @@ sal_Bool OCalcTable::fetchRow( OValueRefRow& _rRow, const OSQLColumns & _rCols, OSQLColumns::Vector::const_iterator aIter = _rCols.get().begin(); OSQLColumns::Vector::const_iterator aEnd = _rCols.get().end(); - for (OValueRefVector::Vector::size_type i = 1; aIter != aEnd && i < _rRow->get().size(); + const OValueRefVector::Vector::size_type nCount = _rRow->get().size(); + for (OValueRefVector::Vector::size_type i = 1; aIter != aEnd && i < nCount; ++aIter, i++) { if ( (_rRow->get())[i]->isBound() ) @@ -838,6 +864,7 @@ sal_Bool OCalcTable::fetchRow( OValueRefRow& _rRow, const OSQLColumns & _rCols, // ------------------------------------------------------------------------- void OCalcTable::FileClose() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::FileClose" ); ::osl::MutexGuard aGuard(m_aMutex); OCalcTable_BASE::FileClose(); diff --git a/connectivity/source/drivers/calc/CTables.cxx b/connectivity/source/drivers/calc/CTables.cxx index 1b12d1ed9d15..3fae15175ee8 100644 --- a/connectivity/source/drivers/calc/CTables.cxx +++ b/connectivity/source/drivers/calc/CTables.cxx @@ -38,6 +38,7 @@ #endif #include "calc/CCatalog.hxx" #include <comphelper/types.hxx> +#include <rtl/logfile.hxx> using namespace ::comphelper; using namespace connectivity; @@ -53,6 +54,7 @@ namespace starutil = ::com::sun::star::util; sdbcx::ObjectType OCalcTables::createObject(const ::rtl::OUString& _rName) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTables::createObject" ); OCalcTable* pTable = new OCalcTable(this,(OCalcConnection*)static_cast<OFileCatalog&>(m_rParent).getConnection(), _rName,::rtl::OUString::createFromAscii("TABLE")); sdbcx::ObjectType xRet = pTable; diff --git a/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx b/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx index 5fa378cc06dd..469656bcbf11 100644 --- a/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx +++ b/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx @@ -38,9 +38,7 @@ #include <com/sun/star/sdbc/DataType.hpp> #include <com/sun/star/sdbc/ResultSetType.hpp> #include <com/sun/star/sdbc/ColumnValue.hpp> -#ifndef _COM_SUN_STAR_BEANS_XPropertySet_HPP_ #include <com/sun/star/beans/XPropertySet.hpp> -#endif #include <com/sun/star/sdbc/ResultSetConcurrency.hpp> #include <com/sun/star/sdbcx/XColumnsSupplier.hpp> #include <com/sun/star/sdbcx/XIndexesSupplier.hpp> @@ -52,6 +50,7 @@ #include <comphelper/extract.hxx> #include <comphelper/types.hxx> #include <ucbhelper/content.hxx> +#include <rtl/logfile.hxx> using namespace ::comphelper; using namespace connectivity::dbase; @@ -66,6 +65,7 @@ using namespace ::com::sun::star::lang; ODbaseDatabaseMetaData::ODbaseDatabaseMetaData(::connectivity::file::OConnection* _pCon) :ODatabaseMetaData(_pCon) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::ODbaseDatabaseMetaData" ); } // ------------------------------------------------------------------------- ODbaseDatabaseMetaData::~ODbaseDatabaseMetaData() @@ -74,6 +74,7 @@ ODbaseDatabaseMetaData::~ODbaseDatabaseMetaData() // ------------------------------------------------------------------------- Reference< XResultSet > ODbaseDatabaseMetaData::impl_getTypeInfo_throw( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::impl_getTypeInfo_throw" ); ::osl::MutexGuard aGuard( m_aMutex ); ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTypeInfo); @@ -151,6 +152,7 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getColumns( const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::getColumns" ); ::osl::MutexGuard aGuard( m_aMutex ); @@ -241,6 +243,7 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getIndexInfo( const Any& /*catalog*/, const ::rtl::OUString& /*schema*/, const ::rtl::OUString& table, sal_Bool unique, sal_Bool /*approximate*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::getIndexInfo" ); ::osl::MutexGuard aGuard( m_aMutex ); Reference< XTablesSupplier > xTables = m_pConnection->createCatalog(); @@ -316,47 +319,56 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getIndexInfo( // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODbaseDatabaseMetaData::getURL( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::getURL" ); ::osl::MutexGuard aGuard( m_aMutex ); return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:dbase:")) + m_pConnection->getURL(); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODbaseDatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::getMaxBinaryLiteralLength" ); return STRING_MAXLEN; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODbaseDatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::getMaxCharLiteralLength" ); return 254; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODbaseDatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::getMaxColumnNameLength" ); return 10; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODbaseDatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::getMaxColumnsInIndex" ); return 1; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODbaseDatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::getMaxColumnsInTable" ); return 128; } // ----------------------------------------------------------------------------- sal_Bool SAL_CALL ODbaseDatabaseMetaData::supportsAlterTableWithAddColumn( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::supportsAlterTableWithAddColumn" ); return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODbaseDatabaseMetaData::supportsAlterTableWithDropColumn( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::supportsAlterTableWithDropColumn" ); return sal_False; } // ----------------------------------------------------------------------------- sal_Bool SAL_CALL ODbaseDatabaseMetaData::isReadOnly( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::isReadOnly" ); ::osl::MutexGuard aGuard( m_aMutex ); sal_Bool bReadOnly = sal_False; @@ -369,11 +381,13 @@ sal_Bool SAL_CALL ODbaseDatabaseMetaData::isReadOnly( ) throw(SQLException, Run // ----------------------------------------------------------------------------- sal_Bool ODbaseDatabaseMetaData::impl_storesMixedCaseQuotedIdentifiers_throw( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::impl_storesMixedCaseQuotedIdentifiers_throw" ); return sal_True; } // ----------------------------------------------------------------------------- sal_Bool ODbaseDatabaseMetaData::impl_supportsMixedCaseQuotedIdentifiers_throw( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::impl_supportsMixedCaseQuotedIdentifiers_throw" ); return sal_True; } // ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/dbase/DNoException.cxx b/connectivity/source/drivers/dbase/DNoException.cxx index 5bfb36c58ab9..32f2f5e78f67 100644 --- a/connectivity/source/drivers/dbase/DNoException.cxx +++ b/connectivity/source/drivers/dbase/DNoException.cxx @@ -38,6 +38,7 @@ #include <sal/types.h> #include <algorithm> +#include <rtl/logfile.hxx> using namespace connectivity; using namespace connectivity::dbase; @@ -46,6 +47,7 @@ using namespace com::sun::star::sdbc; //------------------------------------------------------------------ sal_Bool ODbaseTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::seekRow" ); // ---------------------------------------------------------- // Positionierung vorbereiten: OSL_ENSURE(m_pFileStream,"ODbaseTable::seekRow: FileStream is NULL!"); @@ -130,6 +132,7 @@ End: // ----------------------------------------------------------------------------- BOOL ODbaseTable::ReadMemo(ULONG nBlockNo, ORowSetValue& aVariable) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::ReadMemo" ); BOOL bIsText = TRUE; // SdbConnection* pConnection = GetConnection(); @@ -231,6 +234,7 @@ BOOL ODbaseTable::ReadMemo(ULONG nBlockNo, ORowSetValue& aVariable) // ----------------------------------------------------------------------------- void ODbaseTable::AllocBuffer() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::AllocBuffer" ); UINT16 nSize = m_aHeader.db_slng; OSL_ENSURE(nSize > 0, "Size too small"); @@ -250,6 +254,7 @@ void ODbaseTable::AllocBuffer() // ----------------------------------------------------------------------------- BOOL ODbaseTable::WriteBuffer() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::WriteBuffer" ); OSL_ENSURE(m_nFilePos >= 1,"SdbDBFCursor::FileFetchRow: ungueltige Record-Position"); // Auf gewuenschten Record positionieren: @@ -260,6 +265,7 @@ BOOL ODbaseTable::WriteBuffer() // ----------------------------------------------------------------------------- sal_Int32 ODbaseTable::getCurrentLastPos() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::getCurrentLastPos" ); return m_aHeader.db_anz; } // ----------------------------------------------------------------------------- @@ -270,6 +276,7 @@ sal_Int32 ODbaseTable::getCurrentLastPos() const //------------------------------------------------------------------ void ONDXNode::Read(SvStream &rStream, ODbaseIndex& rIndex) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXNode::Read" ); rStream >> aKey.nRecord; // schluessel if (rIndex.getHeader().db_keytype) @@ -303,6 +310,7 @@ union //------------------------------------------------------------------ void ONDXNode::Write(SvStream &rStream, const ONDXPage& rPage) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXNode::Write" ); const ODbaseIndex& rIndex = rPage.GetIndex(); if (!rIndex.isUnique() || rPage.IsLeaf()) rStream << (sal_uInt32)aKey.nRecord; // schluessel @@ -337,6 +345,7 @@ void ONDXNode::Write(SvStream &rStream, const ONDXPage& rPage) const //------------------------------------------------------------------ ONDXPagePtr& ONDXNode::GetChild(ODbaseIndex* pIndex, ONDXPage* pParent) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXNode::GetChild" ); if (!aChild.Is() && pIndex) { aChild = pIndex->CreatePage(aChild.GetPagePos(),pParent,aChild.HasPage()); @@ -350,12 +359,14 @@ ONDXPagePtr& ONDXNode::GetChild(ODbaseIndex* pIndex, ONDXPage* pParent) //------------------------------------------------------------------ BOOL ONDXKey::IsText(sal_Int32 eType) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXKey::IsText" ); return eType == DataType::VARCHAR || eType == DataType::CHAR; } //------------------------------------------------------------------ StringCompare ONDXKey::Compare(const ONDXKey& rKey) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXKey::Compare" ); // DBG_ASSERT(is(), "Falscher Indexzugriff"); StringCompare eResult; @@ -394,11 +405,13 @@ StringCompare ONDXKey::Compare(const ONDXKey& rKey) const // ----------------------------------------------------------------------------- void ONDXKey::setValue(const ORowSetValue& _rVal) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXKey::setValue" ); xValue = _rVal; } // ----------------------------------------------------------------------------- const ORowSetValue& ONDXKey::getValue() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXKey::getValue" ); return xValue; } // ----------------------------------------------------------------------------- @@ -422,6 +435,7 @@ ONDXPagePtr::ONDXPagePtr(const ONDXPagePtr& rRef) :ONDXPageRef(rRef) ,nPagePos(rRef.nPagePos) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXPagePtr::ONDXPagePtr" ); } //------------------------------------------------------------------ @@ -429,6 +443,7 @@ ONDXPagePtr::ONDXPagePtr(ONDXPage* pRefPage) :ONDXPageRef(pRefPage) ,nPagePos(0) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXPagePtr::ONDXPagePtr" ); if (pRefPage) nPagePos = pRefPage->GetPagePos(); } @@ -505,6 +520,7 @@ SvStream& connectivity::dbase::operator << (SvStream &rStream, const ONDXPage& r //------------------------------------------------------------------ void ONDXPage::PrintPage() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXPage::PrintPage" ); DBG_TRACE4("\nSDB: -----------Page: %d Parent: %d Count: %d Child: %d-----", nPagePos, HasParent() ? aParent->GetPagePos() : 0 ,nCount, aChild.GetPagePos()); @@ -546,12 +562,14 @@ void ONDXPage::PrintPage() // ----------------------------------------------------------------------------- BOOL ONDXPage::IsFull() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXPage::IsFull" ); return Count() == rIndex.getHeader().db_maxkeys; } // ----------------------------------------------------------------------------- //------------------------------------------------------------------ USHORT ONDXPage::Search(const ONDXKey& rSearch) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXPage::Search" ); // binare Suche spaeter USHORT i = 0xFFFF; while (++i < Count()) @@ -564,6 +582,7 @@ USHORT ONDXPage::Search(const ONDXKey& rSearch) //------------------------------------------------------------------ USHORT ONDXPage::Search(const ONDXPage* pPage) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXPage::Search" ); USHORT i = 0xFFFF; while (++i < Count()) if (((*this)[i]).GetChild() == pPage) @@ -578,6 +597,7 @@ USHORT ONDXPage::Search(const ONDXPage* pPage) void ONDXPage::SearchAndReplace(const ONDXKey& rSearch, ONDXKey& rReplace) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXPage::SearchAndReplace" ); OSL_ENSURE(rSearch != rReplace,"Invalid here:rSearch == rReplace"); if (rSearch != rReplace) { @@ -610,6 +630,7 @@ const ONDXNode& ONDXPage::operator[] (USHORT nPos) const // ----------------------------------------------------------------------------- void ONDXPage::Remove(USHORT nPos) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXPage::Remove" ); DBG_ASSERT(nCount > nPos, "falscher Indexzugriff"); for (USHORT i = nPos; i < (nCount-1); i++) diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index 78c818a46eb0..5449235eb739 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -61,6 +61,7 @@ #include "connectivity/FValue.hxx" #include "connectivity/dbconversion.hxx" #include "resource/dbase_res.hrc" +#include <rtl/logfile.hxx> #include <algorithm> @@ -108,6 +109,7 @@ sal_Int32 lcl_getFileSize(SvStream& _rStream) // ------------------------------------------------------------------------- void ODbaseTable::readHeader() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::readHeader" ); OSL_ENSURE(m_pFileStream,"No Stream available!"); if(!m_pFileStream) return; @@ -198,6 +200,7 @@ void ODbaseTable::readHeader() // ------------------------------------------------------------------------- void ODbaseTable::fillColumns() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::fillColumns" ); m_pFileStream->Seek(STREAM_SEEK_TO_BEGIN); m_pFileStream->Seek(32L); @@ -313,6 +316,7 @@ ODbaseTable::ODbaseTable(sdbcx::OCollection* _pTables,ODbaseConnection* _pConnec ,m_pMemoStream(NULL) ,m_bWriteableMemo(sal_False) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::ODbaseTable" ); // initialize the header m_aHeader.db_typ = dBaseIII; m_aHeader.db_anz = 0; @@ -335,12 +339,14 @@ ODbaseTable::ODbaseTable(sdbcx::OCollection* _pTables,ODbaseConnection* _pConnec ,m_pMemoStream(NULL) ,m_bWriteableMemo(sal_False) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::ODbaseTable" ); m_eEncoding = getConnection()->getTextEncoding(); } // ----------------------------------------------------------------------------- void ODbaseTable::construct() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::construct" ); // initialize the header m_aHeader.db_typ = dBaseIII; m_aHeader.db_anz = 0; @@ -424,6 +430,7 @@ void ODbaseTable::construct() //------------------------------------------------------------------ BOOL ODbaseTable::ReadMemoHeader() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::ReadMemoHeader" ); m_pMemoStream->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN); m_pMemoStream->RefreshBuffer(); // sicherstellen das die Kopfinformationen tatsaechlich neu gelesen werden m_pMemoStream->Seek(0L); @@ -473,6 +480,7 @@ BOOL ODbaseTable::ReadMemoHeader() // ------------------------------------------------------------------------- String ODbaseTable::getEntry(OConnection* _pConnection,const ::rtl::OUString& _sName ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::getEntry" ); ::rtl::OUString sURL; try { @@ -516,6 +524,7 @@ String ODbaseTable::getEntry(OConnection* _pConnection,const ::rtl::OUString& _s // ------------------------------------------------------------------------- void ODbaseTable::refreshColumns() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::refreshColumns" ); ::osl::MutexGuard aGuard( m_aMutex ); TStringVector aVector; @@ -532,6 +541,7 @@ void ODbaseTable::refreshColumns() // ------------------------------------------------------------------------- void ODbaseTable::refreshIndexes() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::refreshIndexes" ); TStringVector aVector; if(m_pFileStream && (!m_pIndexes || m_pIndexes->getCount() == 0)) { @@ -577,6 +587,7 @@ void ODbaseTable::refreshIndexes() // ------------------------------------------------------------------------- void SAL_CALL ODbaseTable::disposing(void) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::disposing" ); OFileTable::disposing(); ::osl::MutexGuard aGuard(m_aMutex); m_aColumns = NULL; @@ -584,6 +595,7 @@ void SAL_CALL ODbaseTable::disposing(void) // ------------------------------------------------------------------------- Sequence< Type > SAL_CALL ODbaseTable::getTypes( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::getTypes" ); Sequence< Type > aTypes = OTable_TYPEDEF::getTypes(); ::std::vector<Type> aOwnTypes; aOwnTypes.reserve(aTypes.getLength()); @@ -607,6 +619,7 @@ Sequence< Type > SAL_CALL ODbaseTable::getTypes( ) throw(RuntimeException) // ------------------------------------------------------------------------- Any SAL_CALL ODbaseTable::queryInterface( const Type & rType ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::queryInterface" ); if( rType == ::getCppuType((const Reference<XKeysSupplier>*)0) || rType == ::getCppuType((const Reference<XDataDescriptorFactory>*)0)) return Any(); @@ -618,6 +631,7 @@ Any SAL_CALL ODbaseTable::queryInterface( const Type & rType ) throw(RuntimeExce //-------------------------------------------------------------------------- Sequence< sal_Int8 > ODbaseTable::getUnoTunnelImplementationId() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::getUnoTunnelImplementationId" ); static ::cppu::OImplementationId * pId = 0; if (! pId) { @@ -635,6 +649,7 @@ Sequence< sal_Int8 > ODbaseTable::getUnoTunnelImplementationId() //------------------------------------------------------------------ sal_Int64 ODbaseTable::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::getSomething" ); return (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) ? reinterpret_cast< sal_Int64 >( this ) : ODbaseTable_BASE::getSomething(rId); @@ -642,6 +657,7 @@ sal_Int64 ODbaseTable::getSomething( const Sequence< sal_Int8 > & rId ) throw (R //------------------------------------------------------------------ sal_Bool ODbaseTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols, sal_Bool _bUseTableDefs,sal_Bool bRetrieveData) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::fetchRow" ); // Einlesen der Daten BOOL bIsCurRecordDeleted = ((char)m_pBuffer[0] == '*') ? TRUE : sal_False; @@ -802,6 +818,7 @@ sal_Bool ODbaseTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols, s // ------------------------------------------------------------------------- void ODbaseTable::FileClose() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::FileClose" ); ::osl::MutexGuard aGuard(m_aMutex); // falls noch nicht alles geschrieben wurde if (m_pMemoStream && m_pMemoStream->IsWritable()) @@ -815,6 +832,7 @@ void ODbaseTable::FileClose() // ------------------------------------------------------------------------- BOOL ODbaseTable::CreateImpl() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::CreateImpl" ); OSL_ENSURE(!m_pFileStream, "SequenceError"); if ( m_pConnection->isCheckEnabled() && ::dbtools::convertName2SQLName(m_Name,::rtl::OUString()) != m_Name ) @@ -931,6 +949,7 @@ BOOL ODbaseTable::CreateImpl() // ----------------------------------------------------------------------------- void ODbaseTable::throwInvalidColumnType(const sal_uInt16 _nErrorId,const ::rtl::OUString& _sColumnName) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::throwInvalidColumnType" ); try { // we have to drop the file because it is corrupted now @@ -950,6 +969,7 @@ void ODbaseTable::throwInvalidColumnType(const sal_uInt16 _nErrorId,const ::rtl: // erzeugt grundsaetzlich dBase IV Datei Format BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::CreateFile" ); bCreateMemo = sal_False; Date aDate; // aktuelles Datum @@ -1127,6 +1147,7 @@ BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo) // erzeugt grundsaetzlich dBase III Datei Format BOOL ODbaseTable::CreateMemoFile(const INetURLObject& aFile) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::CreateMemoFile" ); // Makro zum Filehandling fuers Erzeugen von Tabellen m_pMemoStream = createStream_simpleError( aFile.GetMainURL(INetURLObject::NO_DECODE),STREAM_READWRITE | STREAM_SHARE_DENYWRITE); @@ -1158,6 +1179,7 @@ BOOL ODbaseTable::CreateMemoFile(const INetURLObject& aFile) //------------------------------------------------------------------ BOOL ODbaseTable::Drop_Static(const ::rtl::OUString& _sUrl,sal_Bool _bHasMemoFields,OCollection* _pIndexes ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::Drop_Static" ); INetURLObject aURL; aURL.SetURL(_sUrl); @@ -1208,6 +1230,7 @@ BOOL ODbaseTable::Drop_Static(const ::rtl::OUString& _sUrl,sal_Bool _bHasMemoFie // ----------------------------------------------------------------------------- BOOL ODbaseTable::DropImpl() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::DropImpl" ); FileClose(); if(!m_pIndexes) @@ -1226,6 +1249,7 @@ BOOL ODbaseTable::DropImpl() //------------------------------------------------------------------ BOOL ODbaseTable::InsertRow(OValueRefVector& rRow, BOOL bFlush,const Reference<XIndexAccess>& _xCols) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::InsertRow" ); // Buffer mit Leerzeichen fuellen AllocBuffer(); memset(m_pBuffer, ' ', m_aHeader.db_slng); @@ -1282,6 +1306,7 @@ BOOL ODbaseTable::InsertRow(OValueRefVector& rRow, BOOL bFlush,const Reference<X //------------------------------------------------------------------ BOOL ODbaseTable::UpdateRow(OValueRefVector& rRow, OValueRefRow& pOrgRow,const Reference<XIndexAccess>& _xCols) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::UpdateRow" ); // Buffer mit Leerzeichen fuellen AllocBuffer(); @@ -1311,6 +1336,7 @@ BOOL ODbaseTable::UpdateRow(OValueRefVector& rRow, OValueRefRow& pOrgRow,const R //------------------------------------------------------------------ BOOL ODbaseTable::DeleteRow(const OSQLColumns& _rCols) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::DeleteRow" ); // Einfach das Loesch-Flag setzen (egal, ob es schon gesetzt war // oder nicht): // Auf gewuenschten Record positionieren: @@ -1364,6 +1390,7 @@ BOOL ODbaseTable::DeleteRow(const OSQLColumns& _rCols) // ------------------------------------------------------------------------- Reference<XPropertySet> ODbaseTable::isUniqueByColumnName(sal_Int32 _nColumnPos) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::isUniqueByColumnName" ); if(!m_pIndexes) refreshIndexes(); if(m_pIndexes->hasElements()) @@ -1398,6 +1425,7 @@ double toDouble(const ByteString& rString) //------------------------------------------------------------------ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const Reference<XIndexAccess>& _xCols) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::UpdateBuffer" ); OSL_ENSURE(m_pBuffer,"Buffer is NULL!"); if ( !m_pBuffer ) return FALSE; @@ -1684,6 +1712,7 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const // ----------------------------------------------------------------------------- BOOL ODbaseTable::WriteMemo(ORowSetValue& aVariable, ULONG& rBlockNr) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::WriteMemo" ); // wird die BlockNr 0 vorgegeben, wird der block ans Ende gehaengt BYTE nHeader[4]; @@ -1816,6 +1845,7 @@ BOOL ODbaseTable::WriteMemo(ORowSetValue& aVariable, ULONG& rBlockNr) // XAlterTable void SAL_CALL ODbaseTable::alterColumnByName( const ::rtl::OUString& colName, const Reference< XPropertySet >& descriptor ) throw(SQLException, NoSuchElementException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::alterColumnByName" ); ::osl::MutexGuard aGuard(m_aMutex); checkDisposed(OTableDescriptor_BASE::rBHelper.bDisposed); @@ -1828,6 +1858,7 @@ void SAL_CALL ODbaseTable::alterColumnByName( const ::rtl::OUString& colName, co // ------------------------------------------------------------------------- void SAL_CALL ODbaseTable::alterColumnByIndex( sal_Int32 index, const Reference< XPropertySet >& descriptor ) throw(SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::alterColumnByIndex" ); ::osl::MutexGuard aGuard(m_aMutex); checkDisposed(OTableDescriptor_BASE::rBHelper.bDisposed); @@ -1843,6 +1874,7 @@ void ODbaseTable::alterColumn(sal_Int32 index, const Reference< XPropertySet >& descriptor , const Reference< XDataDescriptorFactory >& xOldColumn ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::alterColumn" ); if(index < 0 || index >= m_pColumns->getCount()) throw IndexOutOfBoundsException(::rtl::OUString::valueOf(index),*this); @@ -1948,11 +1980,13 @@ void ODbaseTable::alterColumn(sal_Int32 index, // ----------------------------------------------------------------------------- Reference< XDatabaseMetaData> ODbaseTable::getMetaData() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::getMetaData" ); return getConnection()->getMetaData(); } // ------------------------------------------------------------------------- void SAL_CALL ODbaseTable::rename( const ::rtl::OUString& newName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::rename" ); ::osl::MutexGuard aGuard(m_aMutex); checkDisposed(OTableDescriptor_BASE::rBHelper.bDisposed); if(m_pTables && m_pTables->hasByName(newName)) @@ -2011,6 +2045,7 @@ namespace // ------------------------------------------------------------------------- void SAL_CALL ODbaseTable::renameImpl( const ::rtl::OUString& newName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::getEntry" ); ::osl::MutexGuard aGuard(m_aMutex); FileClose(); @@ -2026,6 +2061,7 @@ void SAL_CALL ODbaseTable::renameImpl( const ::rtl::OUString& newName ) throw(:: // ----------------------------------------------------------------------------- void ODbaseTable::addColumn(const Reference< XPropertySet >& _xNewColumn) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::addColumn" ); String sTempName = createTempFile(); ODbaseTable* pNewTable = new ODbaseTable(m_pTables,static_cast<ODbaseConnection*>(m_pConnection)); @@ -2098,6 +2134,7 @@ void ODbaseTable::addColumn(const Reference< XPropertySet >& _xNewColumn) // ----------------------------------------------------------------------------- void ODbaseTable::dropColumn(sal_Int32 _nPos) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::dropColumn" ); String sTempName = createTempFile(); ODbaseTable* pNewTable = new ODbaseTable(m_pTables,static_cast<ODbaseConnection*>(m_pConnection)); @@ -2153,6 +2190,7 @@ void ODbaseTable::dropColumn(sal_Int32 _nPos) // ----------------------------------------------------------------------------- String ODbaseTable::createTempFile() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::createTempFile" ); ::rtl::OUString aIdent = m_pConnection->getContent()->getIdentifier()->getContentIdentifier(); if ( aIdent.lastIndexOf('/') != (aIdent.getLength()-1) ) aIdent += ::rtl::OUString::createFromAscii("/"); @@ -2177,6 +2215,7 @@ String ODbaseTable::createTempFile() // ----------------------------------------------------------------------------- void ODbaseTable::copyData(ODbaseTable* _pNewTable,sal_Int32 _nPos) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::copyData" ); sal_Int32 nPos = _nPos + 1; // +1 because we always have the bookmark clumn as well OValueRefRow aRow = new OValueRefVector(m_pColumns->getCount()); OValueRefRow aInsertRow; @@ -2234,6 +2273,7 @@ void ODbaseTable::copyData(ODbaseTable* _pNewTable,sal_Int32 _nPos) // ----------------------------------------------------------------------------- void ODbaseTable::throwInvalidDbaseFormat() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::throwInvalidDbaseFormat" ); FileClose(); // no dbase file @@ -2246,12 +2286,14 @@ void ODbaseTable::throwInvalidDbaseFormat() // ----------------------------------------------------------------------------- void ODbaseTable::refreshHeader() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::refreshHeader" ); if ( m_aHeader.db_anz == 0 ) readHeader(); } //------------------------------------------------------------------ sal_Bool ODbaseTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::seekRow" ); // ---------------------------------------------------------- // Positionierung vorbereiten: OSL_ENSURE(m_pFileStream,"ODbaseTable::seekRow: FileStream is NULL!"); @@ -2336,6 +2378,7 @@ End: // ----------------------------------------------------------------------------- BOOL ODbaseTable::ReadMemo(ULONG nBlockNo, ORowSetValue& aVariable) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::ReadMemo" ); BOOL bIsText = TRUE; // SdbConnection* pConnection = GetConnection(); @@ -2437,6 +2480,7 @@ BOOL ODbaseTable::ReadMemo(ULONG nBlockNo, ORowSetValue& aVariable) // ----------------------------------------------------------------------------- void ODbaseTable::AllocBuffer() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::AllocBuffer" ); UINT16 nSize = m_aHeader.db_slng; OSL_ENSURE(nSize > 0, "Size too small"); @@ -2456,6 +2500,7 @@ void ODbaseTable::AllocBuffer() // ----------------------------------------------------------------------------- BOOL ODbaseTable::WriteBuffer() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::WriteBuffer" ); OSL_ENSURE(m_nFilePos >= 1,"SdbDBFCursor::FileFetchRow: ungueltige Record-Position"); // Auf gewuenschten Record positionieren: @@ -2466,5 +2511,6 @@ BOOL ODbaseTable::WriteBuffer() // ----------------------------------------------------------------------------- sal_Int32 ODbaseTable::getCurrentLastPos() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::getCurrentLastPos" ); return m_aHeader.db_anz; } diff --git a/connectivity/source/drivers/evoab2/NPreparedStatement.cxx b/connectivity/source/drivers/evoab2/NPreparedStatement.cxx index 9228b28e761d..357a9a094da5 100644 --- a/connectivity/source/drivers/evoab2/NPreparedStatement.cxx +++ b/connectivity/source/drivers/evoab2/NPreparedStatement.cxx @@ -261,9 +261,16 @@ void SAL_CALL OEvoabPreparedStatement::setObjectNull( sal_Int32 /*parameterIndex } // ------------------------------------------------------------------------- -void SAL_CALL OEvoabPreparedStatement::setObject( sal_Int32 /*parameterIndex*/, const Any& /*x*/ ) throw(SQLException, RuntimeException) +void SAL_CALL OEvoabPreparedStatement::setObject( sal_Int32 parameterIndex, const Any& x ) throw(SQLException, RuntimeException) { - ::dbtools::throwFunctionNotSupportedException( "XParameters::setObject", *this ); + if(!::dbtools::implSetObject(this,parameterIndex,x)) + { + const ::rtl::OUString sError( m_pConnection->getResources().getResourceStringWithSubstitution( + STR_UNKNOWN_PARA_TYPE, + "$position$", ::rtl::OUString::valueOf(parameterIndex) + ) ); + ::dbtools::throwGenericSQLException(sError,*this); + } } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/evoab2/makefile.mk b/connectivity/source/drivers/evoab2/makefile.mk index 86eaf8919b6c..3e59c8ecb442 100644 --- a/connectivity/source/drivers/evoab2/makefile.mk +++ b/connectivity/source/drivers/evoab2/makefile.mk @@ -34,6 +34,7 @@ PRJINC=..$/.. PRJNAME=connectivity TARGET=evoab2 ENABLE_EXCEPTIONS=TRUE +VISIBILITY_HIDDEN=TRUE .IF "$(ENABLE_EVOAB2)"!="TRUE" dummy: diff --git a/connectivity/source/drivers/file/FCatalog.cxx b/connectivity/source/drivers/file/FCatalog.cxx index 9a7c0d3458eb..8f51eedc1cfe 100644 --- a/connectivity/source/drivers/file/FCatalog.cxx +++ b/connectivity/source/drivers/file/FCatalog.cxx @@ -31,15 +31,11 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_connectivity.hxx" #include "file/FCatalog.hxx" -#ifndef _CONNECTIVITY_FILE_BCONNECTION_HXX_ #include "file/FConnection.hxx" -#endif #include "file/FTables.hxx" #include <com/sun/star/sdbc/XRow.hpp> #include <com/sun/star/sdbc/XResultSet.hpp> -//#ifndef _CONNECTIVITY_FILE_OEMPTYCOLLECTION_HXX_ -//#include "file/FEmptyCollection.hxx" -//#endif +#include <rtl/logfile.hxx> using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; @@ -53,10 +49,12 @@ using namespace connectivity::file; OFileCatalog::OFileCatalog(OConnection* _pCon) : connectivity::sdbcx::OCatalog(_pCon) ,m_pConnection(_pCon) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileCatalog::OFileCatalog" ); } // ------------------------------------------------------------------------- void SAL_CALL OFileCatalog::disposing() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileCatalog::disposing" ); ::osl::MutexGuard aGuard(m_aMutex); typedef connectivity::sdbcx::OCatalog OFileCatalog_BASE; @@ -66,11 +64,13 @@ void SAL_CALL OFileCatalog::disposing() // ----------------------------------------------------------------------------- ::rtl::OUString OFileCatalog::buildName(const Reference< XRow >& _xRow) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileCatalog::buildName" ); return _xRow->getString(3); } // ------------------------------------------------------------------------- void OFileCatalog::refreshTables() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileCatalog::refreshTables" ); TStringVector aVector; Sequence< ::rtl::OUString > aTypes; Reference< XResultSet > xResult = m_xMetaData->getTables(Any(), @@ -86,6 +86,7 @@ void OFileCatalog::refreshTables() // ------------------------------------------------------------------------- Any SAL_CALL OFileCatalog::queryInterface( const Type & rType ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileCatalog::queryInterface" ); if( rType == ::getCppuType((const Reference<XGroupsSupplier>*)0) || rType == ::getCppuType((const Reference<XUsersSupplier>*)0) || rType == ::getCppuType((const Reference<XViewsSupplier>*)0)) @@ -98,6 +99,7 @@ Any SAL_CALL OFileCatalog::queryInterface( const Type & rType ) throw(RuntimeExc // ----------------------------------------------------------------------------- Sequence< Type > SAL_CALL OFileCatalog::getTypes( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileCatalog::getTypes" ); typedef sdbcx::OCatalog OFileCatalog_BASE; Sequence< Type > aTypes = OFileCatalog_BASE::getTypes(); diff --git a/connectivity/source/drivers/file/FDatabaseMetaData.cxx b/connectivity/source/drivers/file/FDatabaseMetaData.cxx index 872f6aef995b..9fbee2f229d3 100644 --- a/connectivity/source/drivers/file/FDatabaseMetaData.cxx +++ b/connectivity/source/drivers/file/FDatabaseMetaData.cxx @@ -47,6 +47,7 @@ #include <ucbhelper/content.hxx> #include <ucbhelper/contentbroker.hxx> #include <tools/debug.hxx> +#include <rtl/logfile.hxx> using namespace com::sun::star::ucb; @@ -64,6 +65,7 @@ DBG_NAME( file_ODatabaseMetaData ) ODatabaseMetaData::ODatabaseMetaData(OConnection* _pCon) : ::connectivity::ODatabaseMetaDataBase(_pCon,_pCon->getConnectionInfo()) ,m_pConnection(_pCon) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::ODatabaseMetaData" ); DBG_CTOR( file_ODatabaseMetaData, NULL ); } // ------------------------------------------------------------------------- @@ -74,11 +76,13 @@ ODatabaseMetaData::~ODatabaseMetaData() // ------------------------------------------------------------------------- Reference< XResultSet > ODatabaseMetaData::impl_getTypeInfo_throw( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::impl_getTypeInfo_throw" ); return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eTypeInfo ); } // ------------------------------------------------------------------------- ::rtl::OUString ODatabaseMetaData::impl_getCatalogSeparator_throw( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::impl_getCatalogSeparator_throw" ); return ::rtl::OUString(); } // ------------------------------------------------------------------------- @@ -86,6 +90,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns( const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, const ::rtl::OUString& /*tableNamePattern*/, const ::rtl::OUString& /*columnNamePattern*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getColumns" ); OSL_ENSURE(0,"Should be overloaded!"); return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eColumns ); } @@ -184,6 +189,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, const ::rtl::OUString& tableNamePattern, const Sequence< ::rtl::OUString >& types ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getTables" ); ::osl::MutexGuard aGuard( m_aMutex ); @@ -332,67 +338,80 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getMaxBinaryLiteralLength" ); return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxRowSize( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getMaxRowSize" ); return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCatalogNameLength( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getMaxCatalogNameLength" ); return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getMaxCharLiteralLength" ); return STRING_MAXLEN; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getMaxColumnNameLength" ); return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getMaxColumnsInIndex" ); return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCursorNameLength( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getMaxCursorNameLength" ); return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxConnections( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getMaxConnections" ); return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getMaxColumnsInTable" ); return 0; } // ------------------------------------------------------------------------- sal_Int32 ODatabaseMetaData::impl_getMaxStatements_throw( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::impl_getMaxStatements_throw" ); return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTableNameLength( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getMaxTableNameLength" ); return 0; } // ------------------------------------------------------------------------- sal_Int32 ODatabaseMetaData::impl_getMaxTablesInSelect_throw( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::impl_getMaxTablesInSelect_throw" ); return 1; } // ------------------------------------------------------------------------- Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges( const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, const ::rtl::OUString& tableNamePattern ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getTablePrivileges" ); ::osl::MutexGuard aGuard( m_aMutex ); ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eTablePrivileges ); @@ -461,192 +480,230 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges( // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::doesMaxRowSizeIncludeBlobs" ); return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::storesLowerCaseQuotedIdentifiers" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseIdentifiers( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::storesLowerCaseIdentifiers" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool ODatabaseMetaData::impl_storesMixedCaseQuotedIdentifiers_throw( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::impl_storesMixedCaseQuotedIdentifiers_throw" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseIdentifiers( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::storesMixedCaseIdentifiers" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::storesUpperCaseQuotedIdentifiers" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseIdentifiers( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::storesUpperCaseIdentifiers" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool ODatabaseMetaData::impl_supportsAlterTableWithAddColumn_throw( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::impl_supportsAlterTableWithAddColumn_throw" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool ODatabaseMetaData::impl_supportsAlterTableWithDropColumn_throw( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::impl_supportsAlterTableWithDropColumn_throw" ); return sal_False; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxIndexLength( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getMaxIndexLength" ); return 0; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsNonNullableColumns( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsNonNullableColumns" ); return sal_False; } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getCatalogTerm( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getCatalogTerm" ); return ::rtl::OUString(); } // ------------------------------------------------------------------------- ::rtl::OUString ODatabaseMetaData::impl_getIdentifierQuoteString_throw( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::impl_getIdentifierQuoteString_throw" ); static const ::rtl::OUString sQuote = ::rtl::OUString::createFromAscii("\""); return sQuote; } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getExtraNameCharacters( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getExtraNameCharacters" ); return ::rtl::OUString(); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsDifferentTableCorrelationNames( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsDifferentTableCorrelationNames" ); return sal_True; } // ------------------------------------------------------------------------- sal_Bool ODatabaseMetaData::impl_isCatalogAtStart_throw( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::impl_isCatalogAtStart_throw" ); return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::dataDefinitionIgnoredInTransactions" ); return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::dataDefinitionCausesTransactionCommit" ); return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsDataManipulationTransactionsOnly" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedDelete( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsPositionedDelete" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedUpdate( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsPositionedUpdate" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossRollback( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsOpenStatementsAcrossRollback" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossCommit( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsOpenStatementsAcrossCommit" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossCommit( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsOpenCursorsAcrossCommit" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossRollback( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsOpenCursorsAcrossRollback" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 /*level*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsTransactionIsolationLevel" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool ODatabaseMetaData::impl_supportsSchemasInDataManipulation_throw( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::impl_supportsSchemasInDataManipulation_throw" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsANSI92FullSQL" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92EntryLevelSQL( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsANSI92EntryLevelSQL" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsIntegrityEnhancementFacility" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsSchemasInIndexDefinitions" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool ODatabaseMetaData::impl_supportsSchemasInTableDefinitions_throw( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::impl_supportsSchemasInTableDefinitions_throw" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool ODatabaseMetaData::impl_supportsCatalogsInTableDefinitions_throw( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::impl_supportsCatalogsInTableDefinitions_throw" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInIndexDefinitions( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsCatalogsInIndexDefinitions" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool ODatabaseMetaData::impl_supportsCatalogsInDataManipulation_throw( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::impl_supportsCatalogsInDataManipulation_throw" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsOuterJoins( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsOuterJoins" ); return sal_False; } // ------------------------------------------------------------------------- Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getTableTypes" ); ::osl::MutexGuard aGuard( m_aMutex ); ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eTableTypes ); @@ -665,347 +722,416 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) throw(SQLE // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatementLength( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getMaxStatementLength" ); return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxProcedureNameLength( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getMaxProcedureNameLength" ); return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxSchemaNameLength( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getMaxSchemaNameLength" ); return 0; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactions( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsTransactions" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::allProceduresAreCallable( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::allProceduresAreCallable" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsStoredProcedures( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsStoredProcedures" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsSelectForUpdate( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsSelectForUpdate" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::allTablesAreSelectable( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::allTablesAreSelectable" ); return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::isReadOnly( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::isReadOnly" ); return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFiles( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::usesLocalFiles" ); return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFilePerTable( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::usesLocalFilePerTable" ); return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsTypeConversion( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsTypeConversion" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::nullPlusNonNullIsNull( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::nullPlusNonNullIsNull" ); return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsColumnAliasing( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsColumnAliasing" ); return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsTableCorrelationNames( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsTableCorrelationNames" ); return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsConvert( sal_Int32 /*fromType*/, sal_Int32 /*toType*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsConvert" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsExpressionsInOrderBy( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsExpressionsInOrderBy" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupBy( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsGroupBy" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByBeyondSelect( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsGroupByBeyondSelect" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByUnrelated( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsGroupByUnrelated" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleTransactions( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsMultipleTransactions" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleResultSets( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsMultipleResultSets" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsLikeEscapeClause( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsLikeEscapeClause" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsOrderByUnrelated( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsOrderByUnrelated" ); return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsUnion( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsUnion" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsUnionAll( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsUnionAll" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseIdentifiers( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsMixedCaseIdentifiers" ); return sal_True; } // ------------------------------------------------------------------------- sal_Bool ODatabaseMetaData::impl_supportsMixedCaseQuotedIdentifiers_throw( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::impl_supportsMixedCaseQuotedIdentifiers_throw" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtEnd( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::nullsAreSortedAtEnd" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtStart( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::nullsAreSortedAtStart" ); return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedHigh( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::nullsAreSortedHigh" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedLow( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::nullsAreSortedLow" ); return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsSchemasInProcedureCalls" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsCatalogsInProcedureCalls" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsCorrelatedSubqueries" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInComparisons( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsSubqueriesInComparisons" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInExists( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsSubqueriesInExists" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInIns( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsSubqueriesInIns" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInQuantifieds( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsSubqueriesInQuantifieds" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsANSI92IntermediateSQL" ); return sal_False; } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getURL( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getURL" ); static const ::rtl::OUString aValue = ::rtl::OUString::createFromAscii("sdbc:file:"); return aValue; } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getUserName( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getUserName" ); return ::rtl::OUString(); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverName( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getDriverName" ); return ::rtl::OUString(); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverVersion( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getDriverVersion" ); return ::rtl::OUString::valueOf((sal_Int32)1); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductVersion( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getDatabaseProductVersion" ); return ::rtl::OUString::valueOf((sal_Int32)0); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductName( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getDatabaseProductName" ); return ::rtl::OUString(); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getProcedureTerm( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getProcedureTerm" ); return ::rtl::OUString(); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getSchemaTerm( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getSchemaTerm" ); return ::rtl::OUString(); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMajorVersion( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getDriverMajorVersion" ); return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getDefaultTransactionIsolation( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getDefaultTransactionIsolation" ); return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMinorVersion( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getDriverMinorVersion" ); return 0; } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getSQLKeywords( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getSQLKeywords" ); return ::rtl::OUString(); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getSearchStringEscape( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getSearchStringEscape" ); return ::rtl::OUString(); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getStringFunctions( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getStringFunctions" ); return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UCASE,LCASE,ASCII,LENGTH,OCTET_LENGTH,CHAR_LENGTH,CHARACTER_LENGTH,CHAR,CONCAT,LOCATE,SUBSTRING,LTRIM,RTRIM,SPACE,REPLACE,REPEAT,INSERT,LEFT,RIGHT")); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getTimeDateFunctions( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getTimeDateFunctions" ); return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DAYOFWEEK,DAYOFMONTH,DAYOFYEAR,MONTH,DAYNAME,MONTHNAME,QUARTER,WEEK,YEAR,HOUR,MINUTE,SECOND,CURDATE,CURTIME,NOW")); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getSystemFunctions( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getSystemFunctions" ); return ::rtl::OUString(); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getNumericFunctions( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getNumericFunctions" ); return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ABS,SIGN,MOD,FLOOR,CEILING,ROUND,EXP,LN,LOG,LOG10,POWER,SQRT,PI,COS,SIN,TAN,ACOS,ASIN,ATAN,ATAN2,DEGREES,RADIANS")); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsExtendedSQLGrammar( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsExtendedSQLGrammar" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsCoreSQLGrammar( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsCoreSQLGrammar" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsMinimumSQLGrammar( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsMinimumSQLGrammar" ); return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsFullOuterJoins( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsFullOuterJoins" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsLimitedOuterJoins( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsLimitedOuterJoins" ); return sal_False; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInGroupBy( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getMaxColumnsInGroupBy" ); return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInOrderBy( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getMaxColumnsInOrderBy" ); return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInSelect( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getMaxColumnsInSelect" ); return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxUserNameLength( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getMaxUserNameLength" ); return 0; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetType( sal_Int32 setType ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsResultSetType" ); switch(setType) { case ResultSetType::FORWARD_ONLY: @@ -1019,6 +1145,7 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetType( sal_Int32 setType ) // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 /*concurrency*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsResultSetConcurrency" ); switch(setType) { case ResultSetType::FORWARD_ONLY: @@ -1032,56 +1159,67 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetConcurrency( sal_Int32 set // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::ownUpdatesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::ownUpdatesAreVisible" ); return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::ownDeletesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::ownDeletesAreVisible" ); return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::ownInsertsAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::ownInsertsAreVisible" ); return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::othersUpdatesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::othersUpdatesAreVisible" ); return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::othersDeletesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::othersDeletesAreVisible" ); return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::othersInsertsAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::othersInsertsAreVisible" ); return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::updatesAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::updatesAreDetected" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::deletesAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::deletesAreDetected" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::insertsAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::insertsAreDetected" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsBatchUpdates( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsBatchUpdates" ); return sal_False; } // ------------------------------------------------------------------------- Reference< XResultSet > SAL_CALL ODatabaseMetaData::getUDTs( const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, const ::rtl::OUString& /*typeNamePattern*/, const Sequence< sal_Int32 >& /*types*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getUDTs" ); return NULL; } diff --git a/connectivity/source/drivers/file/FDriver.cxx b/connectivity/source/drivers/file/FDriver.cxx index ae46e1e28aa2..103e25adc1b8 100644 --- a/connectivity/source/drivers/file/FDriver.cxx +++ b/connectivity/source/drivers/file/FDriver.cxx @@ -38,6 +38,7 @@ #include "connectivity/dbexception.hxx" #include "resource/common_res.hrc" #include "resource/sharedresources.hxx" +#include <rtl/logfile.hxx> using namespace connectivity::file; @@ -52,10 +53,12 @@ OFileDriver::OFileDriver(const ::com::sun::star::uno::Reference< ::com::sun::sta : ODriver_BASE(m_aMutex) ,m_xFactory(_rxFactory) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileDriver::OFileDriver" ); } // -------------------------------------------------------------------------------- void OFileDriver::disposing() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileDriver::disposing" ); ::osl::MutexGuard aGuard(m_aMutex); @@ -79,7 +82,7 @@ rtl::OUString OFileDriver::getImplementationName_Static( ) throw(RuntimeExcepti //------------------------------------------------------------------------------ Sequence< ::rtl::OUString > OFileDriver::getSupportedServiceNames_Static( ) throw (RuntimeException) { - Sequence< ::rtl::OUString > aSNS( 2 ); + Sequence< ::rtl::OUString > aSNS( 2 ); aSNS[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.Driver"); aSNS[1] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.Driver"); return aSNS; @@ -112,6 +115,7 @@ Sequence< ::rtl::OUString > SAL_CALL OFileDriver::getSupportedServiceNames( ) t // -------------------------------------------------------------------------------- Reference< XConnection > SAL_CALL OFileDriver::connect( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileDriver::connect" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(ODriver_BASE::rBHelper.bDisposed); @@ -126,11 +130,13 @@ Reference< XConnection > SAL_CALL OFileDriver::connect( const ::rtl::OUString& u sal_Bool SAL_CALL OFileDriver::acceptsURL( const ::rtl::OUString& url ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileDriver::acceptsURL" ); return (!url.compareTo(::rtl::OUString::createFromAscii("sdbc:file:"),10)); } // -------------------------------------------------------------------------------- Sequence< DriverPropertyInfo > SAL_CALL OFileDriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& /*info*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileDriver::getPropertyInfo" ); if ( acceptsURL(url) ) { ::std::vector< DriverPropertyInfo > aDriverInfo; @@ -193,11 +199,13 @@ Sequence< DriverPropertyInfo > SAL_CALL OFileDriver::getPropertyInfo( const ::rt // -------------------------------------------------------------------------------- sal_Int32 SAL_CALL OFileDriver::getMajorVersion( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileDriver::getMajorVersion" ); return 1; } // -------------------------------------------------------------------------------- sal_Int32 SAL_CALL OFileDriver::getMinorVersion( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileDriver::getMinorVersion" ); return 0; } // -------------------------------------------------------------------------------- @@ -205,6 +213,7 @@ sal_Int32 SAL_CALL OFileDriver::getMinorVersion( ) throw(RuntimeException) // XDataDefinitionSupplier Reference< XTablesSupplier > SAL_CALL OFileDriver::getDataDefinitionByConnection( const Reference< ::com::sun::star::sdbc::XConnection >& connection ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileDriver::getDataDefinitionByConnection" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(ODriver_BASE::rBHelper.bDisposed); @@ -232,6 +241,7 @@ Reference< XTablesSupplier > SAL_CALL OFileDriver::getDataDefinitionByConnection // -------------------------------------------------------------------------------- Reference< XTablesSupplier > SAL_CALL OFileDriver::getDataDefinitionByURL( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileDriver::getDataDefinitionByURL" ); if ( ! acceptsURL(url) ) { ::connectivity::SharedResources aResources; diff --git a/connectivity/source/drivers/file/FNoException.cxx b/connectivity/source/drivers/file/FNoException.cxx index 8d0ff84972b6..39a4d2b8f43a 100644 --- a/connectivity/source/drivers/file/FNoException.cxx +++ b/connectivity/source/drivers/file/FNoException.cxx @@ -38,6 +38,7 @@ #include <connectivity/FValue.hxx> #include <tools/debug.hxx> #include "TKeyValue.hxx" +#include <rtl/logfile.hxx> using namespace connectivity; using namespace connectivity::file; @@ -85,19 +86,9 @@ void OSQLAnalyzer::bindParameterRow(OValueRefRow& _pRow) } } // ----------------------------------------------------------------------------- -sal_Bool OResultSet::isCount() const -{ - return (m_pParseTree && - m_pParseTree->count() > 2 && - SQL_ISRULE(m_pParseTree->getChild(2),scalar_exp_commalist) && - SQL_ISRULE(m_pParseTree->getChild(2)->getChild(0),derived_column) && - SQL_ISRULE(m_pParseTree->getChild(2)->getChild(0)->getChild(0),general_set_fct) && - m_pParseTree->getChild(2)->getChild(0)->getChild(0)->count() == 4 - ); -} -// ----------------------------------------------------------------------------- void OPreparedStatement::scanParameter(OSQLParseNode* pParseNode,::std::vector< OSQLParseNode*>& _rParaNodes) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::scanParameter" ); DBG_ASSERT(pParseNode != NULL,"OResultSet: interner Fehler: ungueltiger ParseNode"); // Parameter Name-Regel gefunden? @@ -118,6 +109,7 @@ void OPreparedStatement::scanParameter(OSQLParseNode* pParseNode,::std::vector< // ----------------------------------------------------------------------------- OKeyValue* OResultSet::GetOrderbyKeyValue(OValueRefRow& _rRow) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::GetOrderbyKeyValue" ); UINT32 nBookmarkValue = Abs((sal_Int32)(_rRow->get())[0]->getValue()); OKeyValue* pKeyValue = OKeyValue::createKeyValue((UINT32)nBookmarkValue); diff --git a/connectivity/source/drivers/file/FPreparedStatement.cxx b/connectivity/source/drivers/file/FPreparedStatement.cxx index 0278a1ae8035..722037ae6ea6 100644 --- a/connectivity/source/drivers/file/FPreparedStatement.cxx +++ b/connectivity/source/drivers/file/FPreparedStatement.cxx @@ -49,6 +49,7 @@ #include <com/sun/star/sdbc/ColumnValue.hpp> #include <tools/debug.hxx> #include "resource/file_res.hrc" +#include <rtl/logfile.hxx> using namespace connectivity; using namespace comphelper; @@ -70,18 +71,21 @@ OPreparedStatement::OPreparedStatement( OConnection* _pConnection) : OStatement_BASE2( _pConnection ) ,m_pResultSet(NULL) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::OPreparedStatement" ); DBG_CTOR( file_OPreparedStatement, NULL ); } // ------------------------------------------------------------------------- OPreparedStatement::~OPreparedStatement() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::~OPreparedStatement" ); DBG_DTOR( file_OPreparedStatement, NULL ); } // ------------------------------------------------------------------------- void OPreparedStatement::disposing() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::disposing" ); ::osl::MutexGuard aGuard(m_aMutex); clearMyResultSet(); @@ -108,6 +112,7 @@ void OPreparedStatement::disposing() // ------------------------------------------------------------------------- void OPreparedStatement::construct(const ::rtl::OUString& sql) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::construct" ); OStatement_Base::construct(sql); m_aParameterRow = new OValueRefVector(); @@ -136,6 +141,7 @@ void OPreparedStatement::construct(const ::rtl::OUString& sql) throw(SQLExcepti Any SAL_CALL OPreparedStatement::queryInterface( const Type & rType ) throw(RuntimeException) { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::queryInterface" ); Any aRet = OStatement_BASE2::queryInterface(rType); return aRet.hasValue() ? aRet : ::cppu::queryInterface( rType, static_cast< XPreparedStatement*>(this), @@ -145,6 +151,7 @@ Any SAL_CALL OPreparedStatement::queryInterface( const Type & rType ) throw(Runt // ------------------------------------------------------------------------- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL OPreparedStatement::getTypes( ) throw(::com::sun::star::uno::RuntimeException) { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::getTypes" ); ::cppu::OTypeCollection aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference< XPreparedStatement > *)0 ), ::getCppuType( (const ::com::sun::star::uno::Reference< XParameters > *)0 ), ::getCppuType( (const ::com::sun::star::uno::Reference< XResultSetMetaDataSupplier > *)0 )); @@ -155,6 +162,7 @@ Any SAL_CALL OPreparedStatement::queryInterface( const Type & rType ) throw(Runt Reference< XResultSetMetaData > SAL_CALL OPreparedStatement::getMetaData( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::getMetaData" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); @@ -167,6 +175,7 @@ Reference< XResultSetMetaData > SAL_CALL OPreparedStatement::getMetaData( ) thr void SAL_CALL OPreparedStatement::close( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::close" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); @@ -177,6 +186,7 @@ void SAL_CALL OPreparedStatement::close( ) throw(SQLException, RuntimeException sal_Bool SAL_CALL OPreparedStatement::execute( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::execute" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); @@ -188,6 +198,7 @@ sal_Bool SAL_CALL OPreparedStatement::execute( ) throw(SQLException, RuntimeExc sal_Int32 SAL_CALL OPreparedStatement::executeUpdate( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::executeUpdate" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); @@ -199,12 +210,14 @@ sal_Int32 SAL_CALL OPreparedStatement::executeUpdate( ) throw(SQLException, Run void SAL_CALL OPreparedStatement::setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setString" ); setParameter(parameterIndex,x); } // ------------------------------------------------------------------------- Reference< XConnection > SAL_CALL OPreparedStatement::getConnection( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::getConnection" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); @@ -214,6 +227,7 @@ Reference< XConnection > SAL_CALL OPreparedStatement::getConnection( ) throw(SQ Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::executeQuery" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); @@ -223,34 +237,40 @@ Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery( ) throw(SQLE void SAL_CALL OPreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setBoolean" ); setParameter(parameterIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setByte" ); setParameter(parameterIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::setDate( sal_Int32 parameterIndex, const Date& aData ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setDate" ); setParameter(parameterIndex,DBTypeConversion::toDouble(aData)); } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::setTime( sal_Int32 parameterIndex, const Time& aVal ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setTime" ); setParameter(parameterIndex,DBTypeConversion::toDouble(aVal)); } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::setTimestamp( sal_Int32 parameterIndex, const DateTime& aVal ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setTimestamp" ); setParameter(parameterIndex,DBTypeConversion::toDouble(aVal)); } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::setDouble( sal_Int32 parameterIndex, double x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setDouble" ); setParameter(parameterIndex,x); } @@ -258,24 +278,28 @@ void SAL_CALL OPreparedStatement::setDouble( sal_Int32 parameterIndex, double x void SAL_CALL OPreparedStatement::setFloat( sal_Int32 parameterIndex, float x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setFloat" ); setParameter(parameterIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setInt" ); setParameter(parameterIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::setLong( sal_Int32 /*parameterIndex*/, sal_Int64 /*aVal*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setLong" ); throwFeatureNotImplementedException( "XParameters::setLong", *this ); } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 /*sqlType*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setNull" ); ::osl::MutexGuard aGuard( m_aMutex ); checkAndResizeParameters(parameterIndex); @@ -288,30 +312,35 @@ void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 / void SAL_CALL OPreparedStatement::setClob( sal_Int32 /*parameterIndex*/, const Reference< XClob >& /*x*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setClob" ); throwFeatureNotImplementedException( "XParameters::setClob", *this ); } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::setBlob( sal_Int32 /*parameterIndex*/, const Reference< XBlob >& /*x*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setBlob" ); throwFeatureNotImplementedException( "XParameters::setBlob", *this ); } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::setArray( sal_Int32 /*parameterIndex*/, const Reference< XArray >& /*x*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setArray" ); throwFeatureNotImplementedException( "XParameters::setArray", *this ); } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::setRef( sal_Int32 /*parameterIndex*/, const Reference< XRef >& /*x*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setRef" ); throwFeatureNotImplementedException( "XParameters::setRef", *this ); } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, const Any& x, sal_Int32 sqlType, sal_Int32 scale ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setObjectWithInfo" ); switch(sqlType) { case DataType::DECIMAL: @@ -327,28 +356,36 @@ void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, c void SAL_CALL OPreparedStatement::setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& /*typeName*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setObjectNull" ); setNull(parameterIndex,sqlType); } // ------------------------------------------------------------------------- -void SAL_CALL OPreparedStatement::setObject( sal_Int32 /*parameterIndex*/, const Any& /*x*/ ) throw(SQLException, RuntimeException) +void SAL_CALL OPreparedStatement::setObject( sal_Int32 parameterIndex, const Any& x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OStatement_BASE::rBHelper.bDisposed); - - throwFeatureNotImplementedException( "XParameters::setObject", *this ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setObject" ); + if(!::dbtools::implSetObject(this,parameterIndex,x)) + { + const ::rtl::OUString sError( m_pConnection->getResources().getResourceStringWithSubstitution( + STR_UNKNOWN_PARA_TYPE, + "$position$", ::rtl::OUString::valueOf(parameterIndex) + ) ); + ::dbtools::throwGenericSQLException(sError,*this); + } // setObject (parameterIndex, x, sqlType, 0); } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setShort" ); setParameter(parameterIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::setBytes( sal_Int32 parameterIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setBytes" ); setParameter(parameterIndex,x); } // ------------------------------------------------------------------------- @@ -356,12 +393,14 @@ void SAL_CALL OPreparedStatement::setBytes( sal_Int32 parameterIndex, const Sequ void SAL_CALL OPreparedStatement::setCharacterStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setCharacterStream" ); setBinaryStream(parameterIndex,x,length ); } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::setBinaryStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setBinaryStream" ); if(!x.is()) ::dbtools::throwFunctionSequenceException(*this); @@ -373,6 +412,7 @@ void SAL_CALL OPreparedStatement::setBinaryStream( sal_Int32 parameterIndex, con void SAL_CALL OPreparedStatement::clearParameters( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::clearParameters" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); @@ -382,11 +422,13 @@ void SAL_CALL OPreparedStatement::clearParameters( ) throw(SQLException, Runtim // ------------------------------------------------------------------------- OResultSet* OPreparedStatement::createResultSet() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::createResultSet" ); return new OResultSet(this,m_aSQLIterator); } // ----------------------------------------------------------------------------- Reference<XResultSet> OPreparedStatement::initResultSet() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::initResultSet" ); m_pResultSet->clear(); Reference<XResultSet> xRs(m_pResultSet); @@ -413,6 +455,7 @@ void SAL_CALL OPreparedStatement::release() throw() // ----------------------------------------------------------------------------- void OPreparedStatement::checkAndResizeParameters(sal_Int32 parameterIndex) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::checkAndResizeParameters" ); ::connectivity::checkDisposed(OStatement_BASE::rBHelper.bDisposed); if ( m_aAssignValues.isValid() && (parameterIndex < 1 || parameterIndex >= static_cast<sal_Int32>(m_aParameterIndexes.size())) ) throwInvalidIndexException(*this); @@ -430,6 +473,7 @@ void OPreparedStatement::checkAndResizeParameters(sal_Int32 parameterIndex) // ----------------------------------------------------------------------------- void OPreparedStatement::setParameter(sal_Int32 parameterIndex, const ORowSetValue& x) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setParameter" ); ::osl::MutexGuard aGuard( m_aMutex ); checkAndResizeParameters(parameterIndex); @@ -441,6 +485,7 @@ void OPreparedStatement::setParameter(sal_Int32 parameterIndex, const ORowSetVal // ----------------------------------------------------------------------------- UINT32 OPreparedStatement::AddParameter(OSQLParseNode * pParameter, const Reference<XPropertySet>& _xCol) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::AddParameter" ); OSL_UNUSED( pParameter ); OSL_ENSURE(SQL_ISRULE(pParameter,parameter),"OResultSet::AddParameter: Argument ist kein Parameter"); OSL_ENSURE(pParameter->count() > 0,"OResultSet: Fehler im Parse Tree"); @@ -484,6 +529,7 @@ UINT32 OPreparedStatement::AddParameter(OSQLParseNode * pParameter, const Refere // ----------------------------------------------------------------------------- void OPreparedStatement::describeColumn(OSQLParseNode* _pParameter,OSQLParseNode* _pNode,const OSQLTable& _xTable) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::describeColumn" ); Reference<XPropertySet> xProp; if(SQL_ISRULE(_pNode,column_ref)) { @@ -503,6 +549,7 @@ void OPreparedStatement::describeColumn(OSQLParseNode* _pParameter,OSQLParseNode // ------------------------------------------------------------------------- void OPreparedStatement::describeParameter() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::describeParameter" ); ::std::vector< OSQLParseNode*> aParseNodes; scanParameter(m_pParseTree,aParseNodes); if ( !aParseNodes.empty() ) @@ -523,6 +570,7 @@ void OPreparedStatement::describeParameter() // ----------------------------------------------------------------------------- void OPreparedStatement::initializeResultSet(OResultSet* _pResult) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::initializeResultSet" ); OStatement_Base::initializeResultSet(_pResult); m_pResultSet->setParameterColumns(m_xParamColumns); @@ -570,6 +618,7 @@ void OPreparedStatement::initializeResultSet(OResultSet* _pResult) // ----------------------------------------------------------------------------- void OPreparedStatement::parseParamterElem(const String& _sColumnName,OSQLParseNode* pRow_Value_Constructor_Elem) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::parseParamterElem" ); Reference<XPropertySet> xCol; m_xColNames->getByName(_sColumnName) >>= xCol; sal_Int32 nParameter = -1; diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx index f1da3b94ca81..ca86fb2a3d73 100644 --- a/connectivity/source/drivers/file/FResultSet.cxx +++ b/connectivity/source/drivers/file/FResultSet.cxx @@ -62,6 +62,7 @@ #include <comphelper/types.hxx> #include "resource/file_res.hrc" #include "resource/sharedresources.hxx" +#include <rtl/logfile.hxx> using namespace ::comphelper; @@ -121,6 +122,7 @@ OResultSet::OResultSet(OStatement_Base* pStmt,OSQLParseTreeIterator& _aSQLIte ,m_nLastVisitedPos(-1) ,m_nRowCountResult(-1) ,m_nCurrentPosition(0) + ,m_nColumnCount(0) ,m_bWasNull(sal_False) ,m_bEOF(sal_False) ,m_bLastRecord(sal_False) @@ -129,9 +131,18 @@ OResultSet::OResultSet(OStatement_Base* pStmt,OSQLParseTreeIterator& _aSQLIte ,m_bRowInserted(sal_False) ,m_bRowDeleted(sal_False) ,m_bShowDeleted(pStmt->getOwnConnection()->showDeleted()) + ,m_bIsCount(sal_False) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::OResultSet" ); DBG_CTOR( file_OResultSet, NULL ); osl_incrementInterlockedCount( &m_refCount ); + m_bIsCount = (m_pParseTree && + m_pParseTree->count() > 2 && + SQL_ISRULE(m_pParseTree->getChild(2),scalar_exp_commalist) && + SQL_ISRULE(m_pParseTree->getChild(2)->getChild(0),derived_column) && + SQL_ISRULE(m_pParseTree->getChild(2)->getChild(0)->getChild(0),general_set_fct) && + m_pParseTree->getChild(2)->getChild(0)->getChild(0)->count() == 4 + ); m_nResultSetConcurrency = isCount() ? ResultSetConcurrency::READ_ONLY : ResultSetConcurrency::UPDATABLE; construct(); @@ -142,6 +153,7 @@ OResultSet::OResultSet(OStatement_Base* pStmt,OSQLParseTreeIterator& _aSQLIte // ------------------------------------------------------------------------- OResultSet::~OResultSet() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::~OResultSet" ); osl_incrementInterlockedCount( &m_refCount ); disposing(); DBG_DTOR( file_OResultSet, NULL ); @@ -149,6 +161,7 @@ OResultSet::~OResultSet() // ------------------------------------------------------------------------- void OResultSet::construct() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::construct" ); registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE), PROPERTY_ID_FETCHSIZE, 0,&m_nFetchSize, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE), PROPERTY_ID_RESULTSETTYPE, PropertyAttribute::READONLY,&m_nResultSetType, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION), PROPERTY_ID_FETCHDIRECTION, 0,&m_nFetchDirection, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); @@ -157,6 +170,7 @@ void OResultSet::construct() // ------------------------------------------------------------------------- void OResultSet::disposing(void) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::disposing" ); OPropertySetHelper::disposing(); ::osl::MutexGuard aGuard(m_aMutex); @@ -181,6 +195,7 @@ void OResultSet::disposing(void) // ----------------------------------------------------------------------------- void OResultSet::clear() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::clear" ); m_pFileSet = NULL; DELETEZ(m_pSortIndex); @@ -192,12 +207,14 @@ void OResultSet::clear() // ------------------------------------------------------------------------- Any SAL_CALL OResultSet::queryInterface( const Type & rType ) throw(RuntimeException) { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::queryInterface" ); Any aRet = OPropertySetHelper::queryInterface(rType); return aRet.hasValue() ? aRet : OResultSet_BASE::queryInterface(rType); } // ------------------------------------------------------------------------- Sequence< Type > SAL_CALL OResultSet::getTypes( ) throw(RuntimeException) { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getTypes" ); ::osl::MutexGuard aGuard( m_aMutex ); OTypeCollection aTypes( ::getCppuType( (const Reference< ::com::sun::star::beans::XMultiPropertySet > *)0 ), @@ -210,6 +227,7 @@ Sequence< Type > SAL_CALL OResultSet::getTypes( ) throw(RuntimeException) sal_Int32 SAL_CALL OResultSet::findColumn( const ::rtl::OUString& columnName ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::findColumn" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); @@ -226,6 +244,7 @@ sal_Int32 SAL_CALL OResultSet::findColumn( const ::rtl::OUString& columnName ) t // ----------------------------------------------------------------------------- const ORowSetValue& OResultSet::getValue(sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getValue" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); @@ -239,67 +258,78 @@ const ORowSetValue& OResultSet::getValue(sal_Int32 columnIndex ) throw(::com::su // ----------------------------------------------------------------------------- void OResultSet::checkIndex(sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException) { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::checkIndex" ); if ( columnIndex <= 0 // || columnIndex > (sal_Int32)m_xColumns->size() - || columnIndex >= (sal_Int32)m_aSelectRow->get().size() ) + || columnIndex >= m_nColumnCount ) ::dbtools::throwInvalidIndexException(*this); } // ------------------------------------------------------------------------- Reference< ::com::sun::star::io::XInputStream > SAL_CALL OResultSet::getBinaryStream( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getBinaryStream" ); return NULL; } // ------------------------------------------------------------------------- Reference< ::com::sun::star::io::XInputStream > SAL_CALL OResultSet::getCharacterStream( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getCharacterStream" ); return NULL; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getBoolean" ); return getValue(columnIndex); } // ------------------------------------------------------------------------- sal_Int8 SAL_CALL OResultSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getByte" ); return getValue(columnIndex); } // ------------------------------------------------------------------------- Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getBytes" ); return getValue(columnIndex); } // ------------------------------------------------------------------------- ::com::sun::star::util::Date SAL_CALL OResultSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getDate" ); return getValue(columnIndex); } // ------------------------------------------------------------------------- double SAL_CALL OResultSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getDouble" ); return getValue(columnIndex); } // ------------------------------------------------------------------------- float SAL_CALL OResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getFloat" ); return getValue(columnIndex); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OResultSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getInt" ); return getValue(columnIndex); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OResultSet::getRow( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getRow" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); @@ -311,12 +341,14 @@ sal_Int32 SAL_CALL OResultSet::getRow( ) throw(SQLException, RuntimeException) sal_Int64 SAL_CALL OResultSet::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getLong" ); return getValue(columnIndex); } // ------------------------------------------------------------------------- Reference< XResultSetMetaData > SAL_CALL OResultSet::getMetaData( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getMetaData" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); @@ -328,6 +360,7 @@ Reference< XResultSetMetaData > SAL_CALL OResultSet::getMetaData( ) throw(SQLEx // ------------------------------------------------------------------------- Reference< XArray > SAL_CALL OResultSet::getArray( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getArray" ); return NULL; } @@ -335,50 +368,59 @@ Reference< XArray > SAL_CALL OResultSet::getArray( sal_Int32 /*columnIndex*/ ) t Reference< XClob > SAL_CALL OResultSet::getClob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getClob" ); return NULL; } // ------------------------------------------------------------------------- Reference< XBlob > SAL_CALL OResultSet::getBlob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getBlob" ); return NULL; } // ------------------------------------------------------------------------- Reference< XRef > SAL_CALL OResultSet::getRef( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getRef" ); return NULL; } // ------------------------------------------------------------------------- Any SAL_CALL OResultSet::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getObject" ); return getValue(columnIndex).makeAny(); } // ------------------------------------------------------------------------- sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getShort" ); return getValue(columnIndex); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OResultSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getString" ); return getValue(columnIndex); } // ------------------------------------------------------------------------- ::com::sun::star::util::Time SAL_CALL OResultSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getTime" ); return getValue(columnIndex); } // ------------------------------------------------------------------------- ::com::sun::star::util::DateTime SAL_CALL OResultSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getTimestamp" ); return getValue(columnIndex); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSet::isAfterLast( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::isAfterLast" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); @@ -388,6 +430,7 @@ sal_Bool SAL_CALL OResultSet::isAfterLast( ) throw(SQLException, RuntimeExcepti // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSet::isFirst( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::isFirst" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); @@ -397,6 +440,7 @@ sal_Bool SAL_CALL OResultSet::isFirst( ) throw(SQLException, RuntimeException) // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSet::isLast( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::isLast" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); @@ -406,6 +450,7 @@ sal_Bool SAL_CALL OResultSet::isLast( ) throw(SQLException, RuntimeException) // ------------------------------------------------------------------------- void SAL_CALL OResultSet::beforeFirst( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::beforeFirst" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); @@ -416,6 +461,7 @@ void SAL_CALL OResultSet::beforeFirst( ) throw(SQLException, RuntimeException) // ------------------------------------------------------------------------- void SAL_CALL OResultSet::afterLast( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::afterLast" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); @@ -428,12 +474,14 @@ void SAL_CALL OResultSet::afterLast( ) throw(SQLException, RuntimeException) void SAL_CALL OResultSet::close( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::close" ); dispose(); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSet::first( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::first" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); return m_pTable ? m_aSkipDeletedSet.skipDeleted(IResultSetHelper::FIRST,1,sal_True) : sal_False; @@ -442,6 +490,7 @@ sal_Bool SAL_CALL OResultSet::first( ) throw(SQLException, RuntimeException) sal_Bool SAL_CALL OResultSet::last( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::last" ); // here I know definitely that I stand on the last record ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); @@ -450,6 +499,7 @@ sal_Bool SAL_CALL OResultSet::last( ) throw(SQLException, RuntimeException) // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::absolute" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); return m_pTable ? m_aSkipDeletedSet.skipDeleted(IResultSetHelper::ABSOLUTE,row,sal_True) : sal_False; @@ -457,6 +507,7 @@ sal_Bool SAL_CALL OResultSet::absolute( sal_Int32 row ) throw(SQLException, Runt // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::relative" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); return m_pTable ? m_aSkipDeletedSet.skipDeleted(IResultSetHelper::RELATIVE,row,sal_True) : sal_False; @@ -464,6 +515,7 @@ sal_Bool SAL_CALL OResultSet::relative( sal_Int32 row ) throw(SQLException, Runt // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSet::previous( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::previous" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); return m_pTable ? m_aSkipDeletedSet.skipDeleted(IResultSetHelper::PRIOR,0,sal_True) : sal_False; @@ -471,6 +523,7 @@ sal_Bool SAL_CALL OResultSet::previous( ) throw(SQLException, RuntimeException) // ------------------------------------------------------------------------- Reference< XInterface > SAL_CALL OResultSet::getStatement( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getStatement" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); @@ -481,6 +534,7 @@ Reference< XInterface > SAL_CALL OResultSet::getStatement( ) throw(SQLException sal_Bool SAL_CALL OResultSet::rowDeleted( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::rowDeleted" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); @@ -498,6 +552,7 @@ sal_Bool SAL_CALL OResultSet::rowInserted( ) throw(SQLException, RuntimeExcepti // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSet::rowUpdated( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::rowInserted" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); @@ -508,6 +563,7 @@ sal_Bool SAL_CALL OResultSet::rowUpdated( ) throw(SQLException, RuntimeExceptio sal_Bool SAL_CALL OResultSet::isBeforeFirst( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::isBeforeFirst" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); @@ -517,6 +573,7 @@ sal_Bool SAL_CALL OResultSet::isBeforeFirst( ) throw(SQLException, RuntimeExcep // ------------------------------------------------------------------------- sal_Bool OResultSet::evaluate() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::evaluate" ); OSL_ENSURE(m_pSQLAnalyzer,"OResultSet::evaluate: Analyzer isn't set!"); sal_Bool bRet = sal_True; while(!m_pSQLAnalyzer->evaluateRestriction()) @@ -549,6 +606,7 @@ sal_Bool OResultSet::evaluate() sal_Bool SAL_CALL OResultSet::next( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::next" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); @@ -558,6 +616,7 @@ sal_Bool SAL_CALL OResultSet::next( ) throw(SQLException, RuntimeException) sal_Bool SAL_CALL OResultSet::wasNull( ) throw(SQLException, RuntimeException) { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::wasNull" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); @@ -567,19 +626,23 @@ sal_Bool SAL_CALL OResultSet::wasNull( ) throw(SQLException, RuntimeException) void SAL_CALL OResultSet::cancel( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::cancel" ); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::clearWarnings( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::clearWarnings" ); } // ------------------------------------------------------------------------- Any SAL_CALL OResultSet::getWarnings( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getWarnings" ); return Any(); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::insertRow( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::insertRow" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); @@ -604,6 +667,7 @@ void SAL_CALL OResultSet::insertRow( ) throw(SQLException, RuntimeException) // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateRow( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateRow" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); @@ -618,6 +682,7 @@ void SAL_CALL OResultSet::updateRow( ) throw(SQLException, RuntimeException) // ------------------------------------------------------------------------- void SAL_CALL OResultSet::deleteRow() throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::deleteRow" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); @@ -641,6 +706,7 @@ void SAL_CALL OResultSet::deleteRow() throw(SQLException, RuntimeException) // ------------------------------------------------------------------------- void SAL_CALL OResultSet::cancelRowUpdates( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::cancelRowUpdates" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); @@ -664,6 +730,7 @@ void SAL_CALL OResultSet::cancelRowUpdates( ) throw(SQLException, RuntimeExcept void SAL_CALL OResultSet::moveToInsertRow( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::moveToInsertRow" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); @@ -683,10 +750,12 @@ void SAL_CALL OResultSet::moveToInsertRow( ) throw(SQLException, RuntimeExcepti void SAL_CALL OResultSet::moveToCurrentRow( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::moveToCurrentRow" ); } // ------------------------------------------------------------------------- void OResultSet::updateValue(sal_Int32 columnIndex ,const ORowSetValue& x) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateValue" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); @@ -700,6 +769,7 @@ void OResultSet::updateValue(sal_Int32 columnIndex ,const ORowSetValue& x) throw void SAL_CALL OResultSet::updateNull( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateNull" ); ORowSetValue aEmpty; updateValue(columnIndex,aEmpty); } @@ -707,71 +777,84 @@ void SAL_CALL OResultSet::updateNull( sal_Int32 columnIndex ) throw(SQLException void SAL_CALL OResultSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateBoolean" ); updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateByte" ); updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateShort" ); updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateInt" ); updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateLong( sal_Int32 /*columnIndex*/, sal_Int64 /*x*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateLong" ); ::dbtools::throwFeatureNotImplementedException( "XRowUpdate::updateLong", *this ); } // ----------------------------------------------------------------------- void SAL_CALL OResultSet::updateFloat( sal_Int32 columnIndex, float x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateFloat" ); updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateDouble( sal_Int32 columnIndex, double x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateDouble" ); updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateString" ); updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateBytes( sal_Int32 columnIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateBytes" ); updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateDate" ); updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateTime" ); updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateTimestamp" ); updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateBinaryStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateBinaryStream" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); @@ -785,17 +868,20 @@ void SAL_CALL OResultSet::updateBinaryStream( sal_Int32 columnIndex, const Refer // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateCharacterStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateCharacterStream" ); updateBinaryStream(columnIndex,x,length); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::refreshRow( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::refreshRow" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateObject( sal_Int32 columnIndex, const Any& x ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateObject" ); if (!::dbtools::implUpdateObject(this, columnIndex, x)) throw SQLException(); } @@ -803,12 +889,14 @@ void SAL_CALL OResultSet::updateObject( sal_Int32 columnIndex, const Any& x ) th void SAL_CALL OResultSet::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 /*scale*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateNumericObject" ); if (!::dbtools::implUpdateObject(this, columnIndex, x)) throw SQLException(); } // ------------------------------------------------------------------------- IPropertyArrayHelper* OResultSet::createArrayHelper( ) const { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::createArrayHelper" ); Sequence< Property > aProps; describeProperties(aProps); return new ::cppu::OPropertyArrayHelper(aProps); @@ -816,6 +904,7 @@ IPropertyArrayHelper* OResultSet::createArrayHelper( ) const // ------------------------------------------------------------------------- IPropertyArrayHelper & OResultSet::getInfoHelper() { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getInfoHelper" ); return *const_cast<OResultSet*>(this)->getArrayHelper(); } @@ -825,6 +914,7 @@ BOOL OResultSet::ExecuteRow(IResultSetHelper::Movement eFirstCursorPosition, BOOL bEvaluate, BOOL bRetrieveData) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::ExecuteRow" ); OSL_ENSURE(m_pSQLAnalyzer,"OResultSet::ExecuteRow: Analyzer isn't set!"); // Fuer weitere Fetch-Operationen werden diese Angaben ggf. veraendert ... @@ -956,6 +1046,7 @@ again: //------------------------------------------------------------------- BOOL OResultSet::Move(IResultSetHelper::Movement eCursorPosition, INT32 nOffset, BOOL bRetrieveData) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::Move" ); //IgnoreDeletedRows: // @@ -1171,6 +1262,7 @@ Error: // ------------------------------------------------------------------------- void OResultSet::sortRows() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::sortRows" ); if (!m_pSQLAnalyzer->hasRestriction() && m_aOrderbyColumnNumber.size() == 1) { // Ist nur ein Feld fuer die Sortierung angegeben @@ -1274,6 +1366,7 @@ void OResultSet::sortRows() // ------------------------------------------------------------------------- BOOL OResultSet::OpenImpl() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::OpenImpl" ); OSL_ENSURE(m_pSQLAnalyzer,"No analyzer set with setSqlAnalyzer!"); if(!m_pTable) { @@ -1402,9 +1495,9 @@ BOOL OResultSet::OpenImpl() // Aber Achtung: es wird davon ausgegangen, das die FilePositionen als Folge 1..n // abgelegt werden! { - if(m_pTable->getCurrentLastPos() > 0) - m_pFileSet->get().reserve(m_pTable->getCurrentLastPos() ); - for (sal_Int32 i = 0; i < m_pTable->getCurrentLastPos(); i++) + if ( m_nLastVisitedPos > 0) + m_pFileSet->get().reserve( m_nLastVisitedPos ); + for (sal_Int32 i = 0; i < m_nLastVisitedPos; i++) m_pFileSet->get().push_back(i + 1); } } @@ -1559,6 +1652,7 @@ BOOL OResultSet::OpenImpl() //-------------------------------------------------------------------------- Sequence< sal_Int8 > OResultSet::getUnoTunnelImplementationId() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getUnoTunnelImplementationId" ); static ::cppu::OImplementationId * pId = 0; if (! pId) { @@ -1576,6 +1670,7 @@ Sequence< sal_Int8 > OResultSet::getUnoTunnelImplementationId() //------------------------------------------------------------------ sal_Int64 OResultSet::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getSomething" ); return (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) ? reinterpret_cast< sal_Int64 >( this ) : 0; @@ -1589,6 +1684,7 @@ void OResultSet::setBoundedColumns(const OValueRefRow& _rRow, const Reference<XDatabaseMetaData>& _xMetaData, ::std::vector<sal_Int32>& _rColMapping) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::setBoundedColumns" ); ::comphelper::UStringMixEqual aCase(_xMetaData->storesMixedCaseQuotedIdentifiers()); Reference<XPropertySet> xTableColumn; @@ -1699,7 +1795,6 @@ void OResultSet::setBoundedColumns(const OValueRefRow& _rRow, } } // ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- void SAL_CALL OResultSet::acquire() throw() { OResultSet_BASE::acquire(); @@ -1712,11 +1807,13 @@ void SAL_CALL OResultSet::release() throw() // ----------------------------------------------------------------------------- Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OResultSet::getPropertySetInfo( ) throw(RuntimeException) { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getPropertySetInfo" ); return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); } // ----------------------------------------------------------------------------- void OResultSet::doTableSpecials(const OSQLTable& _xTable) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::doTableSpecials" ); Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(_xTable,UNO_QUERY); if(xTunnel.is()) { @@ -1728,6 +1825,7 @@ void OResultSet::doTableSpecials(const OSQLTable& _xTable) // ----------------------------------------------------------------------------- void OResultSet::clearInsertRow() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::clearInsertRow" ); m_aRow->setDeleted(sal_False); // set to false here because this is the new row OValueRefVector::Vector::iterator aIter = m_aInsertRow->get().begin(); const OValueRefVector::Vector::iterator aEnd = m_aInsertRow->get().end(); @@ -1746,6 +1844,7 @@ void OResultSet::clearInsertRow() // ----------------------------------------------------------------------------- void OResultSet::initializeRow(OValueRefRow& _rRow,sal_Int32 _nColumnCount) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::initializeRow" ); if(!_rRow.isValid()) { _rRow = new OValueRefVector(_nColumnCount); @@ -1756,31 +1855,37 @@ void OResultSet::initializeRow(OValueRefRow& _rRow,sal_Int32 _nColumnCount) // ----------------------------------------------------------------------------- sal_Bool OResultSet::fillIndexValues(const Reference< XColumnsSupplier> &/*_xIndex*/) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::fillIndexValues" ); return sal_False; } // ----------------------------------------------------------------------------- sal_Bool OResultSet::move(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nOffset, sal_Bool _bRetrieveData) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::move" ); return Move(_eCursorPosition,_nOffset,_bRetrieveData); } // ----------------------------------------------------------------------------- sal_Int32 OResultSet::getDriverPos() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getDriverPos" ); return (m_aRow->get())[0]->getValue(); } // ----------------------------------------------------------------------------- sal_Bool OResultSet::deletedVisible() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::deletedVisible" ); return m_bShowDeleted; } // ----------------------------------------------------------------------------- sal_Bool OResultSet::isRowDeleted() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::isRowDeleted" ); return m_aRow->isDeleted(); } // ----------------------------------------------------------------------------- void SAL_CALL OResultSet::disposing( const EventObject& Source ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::disposing" ); // Reference<XInterface> xInt = m_pTable; Reference<XPropertySet> xProp = m_pTable; if(m_pTable && Source.Source == xProp) diff --git a/connectivity/source/drivers/file/FResultSetMetaData.cxx b/connectivity/source/drivers/file/FResultSetMetaData.cxx index 8ebc0ed1281c..7b64a6e2f220 100644 --- a/connectivity/source/drivers/file/FResultSetMetaData.cxx +++ b/connectivity/source/drivers/file/FResultSetMetaData.cxx @@ -35,6 +35,7 @@ #include <comphelper/extract.hxx> #include "connectivity/dbexception.hxx" #include <comphelper/types.hxx> +#include <rtl/logfile.hxx> using namespace ::comphelper; using namespace connectivity; @@ -53,6 +54,7 @@ OResultSetMetaData::OResultSetMetaData(const ::vos::ORef<connectivity::OSQLColum ,m_xColumns(_rxColumns) ,m_pTable(_pTable) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::OResultSetMetaData" ); } // ------------------------------------------------------------------------- @@ -63,18 +65,21 @@ OResultSetMetaData::~OResultSetMetaData() // ----------------------------------------------------------------------------- void OResultSetMetaData::checkColumnIndex(sal_Int32 column) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::checkColumnIndex" ); if(column <= 0 || column > (sal_Int32)(sal_Int32)m_xColumns->get().size()) throwInvalidIndexException(*this); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::getColumnDisplaySize" ); return getPrecision(column); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OResultSetMetaData::getColumnType( sal_Int32 column ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::getColumnType" ); checkColumnIndex(column); return getINT32((m_xColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))); } @@ -82,24 +87,28 @@ sal_Int32 SAL_CALL OResultSetMetaData::getColumnType( sal_Int32 column ) throw(S sal_Int32 SAL_CALL OResultSetMetaData::getColumnCount( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::getColumnCount" ); return (m_xColumns->get()).size(); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSetMetaData::isCaseSensitive( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::isCaseSensitive" ); return sal_False; } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OResultSetMetaData::getSchemaName( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::getSchemaName" ); return ::rtl::OUString(); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OResultSetMetaData::getColumnName( sal_Int32 column ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::getColumnName" ); checkColumnIndex(column); Any aName((m_xColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))); @@ -108,33 +117,39 @@ sal_Bool SAL_CALL OResultSetMetaData::isCaseSensitive( sal_Int32 /*column*/ ) th // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OResultSetMetaData::getTableName( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::getTableName" ); return m_aTableName; } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OResultSetMetaData::getCatalogName( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::getCatalogName" ); return ::rtl::OUString(); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OResultSetMetaData::getColumnTypeName( sal_Int32 column ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::getColumnTypeName" ); checkColumnIndex(column); return getString((m_xColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME))); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OResultSetMetaData::getColumnLabel( sal_Int32 column ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::getColumnLabel" ); return getColumnName(column); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OResultSetMetaData::getColumnServiceName( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::getColumnServiceName" ); return ::rtl::OUString(); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSetMetaData::isCurrency( sal_Int32 column ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::isCurrency" ); checkColumnIndex(column); return getBOOL((m_xColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY))); } @@ -142,22 +157,26 @@ sal_Bool SAL_CALL OResultSetMetaData::isCurrency( sal_Int32 column ) throw(SQLEx sal_Bool SAL_CALL OResultSetMetaData::isAutoIncrement( sal_Int32 /*setCatalogcolumn*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::isAutoIncrement" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSetMetaData::isSigned( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::isSigned" ); return sal_True; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OResultSetMetaData::getPrecision( sal_Int32 column ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::getPrecision" ); checkColumnIndex(column); return getINT32((m_xColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OResultSetMetaData::getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::getScale" ); checkColumnIndex(column); return getINT32((m_xColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE))); } @@ -165,6 +184,7 @@ sal_Int32 SAL_CALL OResultSetMetaData::getScale( sal_Int32 column ) throw(::com: sal_Int32 SAL_CALL OResultSetMetaData::isNullable( sal_Int32 column ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::isNullable" ); checkColumnIndex(column); return getINT32((m_xColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))); } @@ -172,27 +192,30 @@ sal_Int32 SAL_CALL OResultSetMetaData::isNullable( sal_Int32 column ) throw(SQLE sal_Bool SAL_CALL OResultSetMetaData::isSearchable( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::isSearchable" ); return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSetMetaData::isReadOnly( sal_Int32 column ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::isReadOnly" ); checkColumnIndex(column); - sal_Bool bReadOnly = (m_xColumns->get())[column-1]->getPropertySetInfo()->hasPropertyByName(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FUNCTION)) && - ::cppu::any2bool((m_xColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FUNCTION))); - - return bReadOnly || m_pTable->isReadOnly(); + return m_pTable->isReadOnly() || ( + (m_xColumns->get())[column-1]->getPropertySetInfo()->hasPropertyByName(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FUNCTION)) && + ::cppu::any2bool((m_xColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FUNCTION)))); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSetMetaData::isDefinitelyWritable( sal_Int32 column ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::isDefinitelyWritable" ); return !isReadOnly(column); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSetMetaData::isWritable( sal_Int32 column ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::isWritable" ); return !isReadOnly(column); } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/file/FStatement.cxx b/connectivity/source/drivers/file/FStatement.cxx index 42828dcb75e7..2692f02d7614 100644 --- a/connectivity/source/drivers/file/FStatement.cxx +++ b/connectivity/source/drivers/file/FStatement.cxx @@ -48,6 +48,7 @@ #include "resource/file_res.hrc" #include <algorithm> #include <tools/debug.hxx> +#include <rtl/logfile.hxx> #define THROW_SQL(x) \ OTools::ThrowException(x,m_aStatementHandle,SQL_HANDLE_STMT,*this) @@ -89,6 +90,7 @@ OStatement_Base::OStatement_Base(OConnection* _pConnection ) ,m_bEscapeProcessing(sal_True) ,rBHelper(OStatement_BASE::rBHelper) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::OStatement_Base" ); DBG_CTOR( file_OStatement_Base, NULL ); m_pConnection->acquire(); @@ -118,6 +120,7 @@ OStatement_Base::~OStatement_Base() //------------------------------------------------------------------------------ void OStatement_Base::disposeResultSet() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::disposeResultSet" ); // free the cursor if alive Reference< XComponent > xComp(m_xResultSet.get(), UNO_QUERY); if (xComp.is()) @@ -177,15 +180,17 @@ void SAL_CALL OStatement_BASE2::release() throw() //----------------------------------------------------------------------------- Any SAL_CALL OStatement_Base::queryInterface( const Type & rType ) throw(RuntimeException) { - Any aRet = OStatement_BASE::queryInterface(rType); + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::queryInterface" ); + const Any aRet = OStatement_BASE::queryInterface(rType); return aRet.hasValue() ? aRet : OPropertySetHelper::queryInterface(rType); } // ------------------------------------------------------------------------- Sequence< Type > SAL_CALL OStatement_Base::getTypes( ) throw(RuntimeException) { - ::cppu::OTypeCollection aTypes( ::getCppuType( (const Reference< ::com::sun::star::beans::XMultiPropertySet > *)0 ), - ::getCppuType( (const Reference< ::com::sun::star::beans::XFastPropertySet > *)0 ), - ::getCppuType( (const Reference< ::com::sun::star::beans::XPropertySet > *)0 )); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::getTypes" ); + ::cppu::OTypeCollection aTypes( ::getCppuType( (const Reference< ::com::sun::star::beans::XMultiPropertySet > *)0 ), + ::getCppuType( (const Reference< ::com::sun::star::beans::XFastPropertySet > *)0 ), + ::getCppuType( (const Reference< ::com::sun::star::beans::XPropertySet > *)0 )); return ::comphelper::concatSequences(aTypes.getTypes(),OStatement_BASE::getTypes()); } @@ -193,11 +198,13 @@ Sequence< Type > SAL_CALL OStatement_Base::getTypes( ) throw(RuntimeException) void SAL_CALL OStatement_Base::cancel( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::cancel" ); } // ------------------------------------------------------------------------- void SAL_CALL OStatement_Base::close( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::close" ); { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); @@ -208,6 +215,7 @@ void SAL_CALL OStatement_Base::close( ) throw(SQLException, RuntimeException) void OStatement_Base::reset() throw (SQLException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::reset" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); @@ -224,6 +232,7 @@ void OStatement_Base::reset() throw (SQLException) void OStatement_Base::clearMyResultSet () throw (SQLException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::clearMyResultSet " ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); @@ -244,6 +253,7 @@ void OStatement_Base::clearMyResultSet () throw (SQLException) void OStatement_Base::setWarning (const SQLWarning &ex) throw( SQLException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::setWarning " ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); @@ -254,6 +264,7 @@ void OStatement_Base::setWarning (const SQLWarning &ex) throw( SQLException) // ------------------------------------------------------------------------- Any SAL_CALL OStatement_Base::getWarnings( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::getWarnings" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); @@ -262,6 +273,7 @@ Any SAL_CALL OStatement_Base::getWarnings( ) throw(SQLException, RuntimeExcepti // ------------------------------------------------------------------------- void SAL_CALL OStatement_Base::clearWarnings( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::clearWarnings" ); ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); @@ -270,6 +282,7 @@ void SAL_CALL OStatement_Base::clearWarnings( ) throw(SQLException, RuntimeExce // ------------------------------------------------------------------------- ::cppu::IPropertyArrayHelper* OStatement_Base::createArrayHelper( ) const { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::createArrayHelper" ); Sequence< Property > aProps; describeProperties(aProps); return new ::cppu::OPropertyArrayHelper(aProps); @@ -278,6 +291,7 @@ void SAL_CALL OStatement_Base::clearWarnings( ) throw(SQLException, RuntimeExce // ------------------------------------------------------------------------- ::cppu::IPropertyArrayHelper & OStatement_Base::getInfoHelper() { + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::getInfoHelper" ); return *const_cast<OStatement_Base*>(this)->getArrayHelper(); } // ------------------------------------------------------------------------- @@ -350,6 +364,7 @@ sal_Int32 SAL_CALL OStatement::executeUpdate( const ::rtl::OUString& sql ) throw // ----------------------------------------------------------------------------- void SAL_CALL OStatement_Base::disposing(void) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::disposing" ); if(m_aEvaluateRow.isValid()) { m_aEvaluateRow->get().clear(); @@ -361,6 +376,7 @@ void SAL_CALL OStatement_Base::disposing(void) // ----------------------------------------------------------------------------- Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OStatement_Base::getPropertySetInfo( ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::getPropertySetInfo" ); return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); } // ----------------------------------------------------------------------------- @@ -372,11 +388,13 @@ Any SAL_CALL OStatement::queryInterface( const Type & rType ) throw(RuntimeExcep // ----------------------------------------------------------------------------- OSQLAnalyzer* OStatement_Base::createAnalyzer() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::createAnalyzer" ); return new OSQLAnalyzer(m_pConnection); } // ----------------------------------------------------------------------------- void OStatement_Base::anylizeSQL() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::anylizeSQL" ); OSL_ENSURE(m_pSQLAnalyzer,"OResultSet::anylizeSQL: Analyzer isn't set!"); // start analysing the statement m_pSQLAnalyzer->setOrigColumns(m_xColNames); @@ -408,6 +426,7 @@ void OStatement_Base::anylizeSQL() void OStatement_Base::setOrderbyColumn( OSQLParseNode* pColumnRef, OSQLParseNode* pAscendingDescending) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::setOrderbyColumn" ); ::rtl::OUString aColumnName; if (pColumnRef->count() == 1) aColumnName = pColumnRef->getChild(0)->getTokenValue(); @@ -456,6 +475,7 @@ void OStatement_Base::setOrderbyColumn( OSQLParseNode* pColumnRef, // ----------------------------------------------------------------------------- void OStatement_Base::construct(const ::rtl::OUString& sql) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::construct" ); ::rtl::OUString aErr; m_pParseTree = m_aParser.parseTree(aErr,sql); if(m_pParseTree) @@ -531,6 +551,7 @@ void OStatement_Base::construct(const ::rtl::OUString& sql) throw(SQLException, // ----------------------------------------------------------------------------- void OStatement_Base::createColumnMapping() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::createColumnMapping" ); // initialize the column index map (mapping select columns to table columns) ::vos::ORef<connectivity::OSQLColumns> xColumns = m_aSQLIterator.getSelectColumns(); m_aColMapping.resize(xColumns->get().size() + 1); @@ -544,6 +565,7 @@ void OStatement_Base::createColumnMapping() // ----------------------------------------------------------------------------- void OStatement_Base::initializeResultSet(OResultSet* _pResult) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::initializeResultSet" ); GetAssignValues(); _pResult->setSqlAnalyzer(m_pSQLAnalyzer); @@ -562,6 +584,7 @@ void OStatement_Base::initializeResultSet(OResultSet* _pResult) // ----------------------------------------------------------------------------- void OStatement_Base::GetAssignValues() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::GetAssignValues" ); if (m_pParseTree == NULL) { ::dbtools::throwFunctionSequenceException(*this); @@ -729,6 +752,7 @@ void OStatement_Base::GetAssignValues() // ------------------------------------------------------------------------- void OStatement_Base::ParseAssignValues(const ::std::vector< String>& aColumnNameList,OSQLParseNode* pRow_Value_Constructor_Elem,xub_StrLen nIndex) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::ParseAssignValues" ); OSL_ENSURE(nIndex <= aColumnNameList.size(),"SdbFileCursor::ParseAssignValues: nIndex > aColumnNameList.GetTokenCount()"); String aColumnName(aColumnNameList[nIndex]); OSL_ENSURE(aColumnName.Len() > 0,"OResultSet: Column-Name nicht gefunden"); @@ -760,6 +784,7 @@ void OStatement_Base::SetAssignValue(const String& aColumnName, BOOL bSetNull, UINT32 nParameter) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::SetAssignValue" ); Reference<XPropertySet> xCol; m_xColNames->getByName(aColumnName) >>= xCol; sal_Int32 nId = Reference<XColumnLocate>(m_xColNames,UNO_QUERY)->findColumn(aColumnName); @@ -842,8 +867,11 @@ void OStatement_Base::SetAssignValue(const String& aColumnName, // ----------------------------------------------------------------------------- void OStatement_Base::parseParamterElem(const String& /*_sColumnName*/,OSQLParseNode* /*pRow_Value_Constructor_Elem*/) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::parseParamterElem" ); // do nothing here } - } -} +// ============================================================================= + } // namespace file +// ============================================================================= +}// namespace connectivity // ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/file/FStringFunctions.cxx b/connectivity/source/drivers/file/FStringFunctions.cxx index 221e95ce07df..e3eeb52f2d7d 100644 --- a/connectivity/source/drivers/file/FStringFunctions.cxx +++ b/connectivity/source/drivers/file/FStringFunctions.cxx @@ -32,12 +32,14 @@ #include "precompiled_connectivity.hxx" #include "file/FStringFunctions.hxx" +#include <rtl/logfile.hxx> using namespace connectivity; using namespace connectivity::file; //------------------------------------------------------------------ ORowSetValue OOp_Upper::operate(const ORowSetValue& lhs) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_Upper::operate" ); if ( lhs.isNull() ) return lhs; @@ -46,6 +48,7 @@ ORowSetValue OOp_Upper::operate(const ORowSetValue& lhs) const //------------------------------------------------------------------ ORowSetValue OOp_Lower::operate(const ORowSetValue& lhs) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_Lower::operate" ); if ( lhs.isNull() ) return lhs; @@ -54,6 +57,7 @@ ORowSetValue OOp_Lower::operate(const ORowSetValue& lhs) const //------------------------------------------------------------------ ORowSetValue OOp_Ascii::operate(const ORowSetValue& lhs) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_Ascii::operate" ); if ( lhs.isNull() ) return lhs; ::rtl::OString sStr(::rtl::OUStringToOString(lhs,RTL_TEXTENCODING_ASCII_US)); @@ -63,6 +67,7 @@ ORowSetValue OOp_Ascii::operate(const ORowSetValue& lhs) const //------------------------------------------------------------------ ORowSetValue OOp_CharLength::operate(const ORowSetValue& lhs) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_CharLength::operate" ); if ( lhs.isNull() ) return lhs; @@ -71,6 +76,7 @@ ORowSetValue OOp_CharLength::operate(const ORowSetValue& lhs) const //------------------------------------------------------------------ ORowSetValue OOp_Char::operate(const ::std::vector<ORowSetValue>& lhs) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_Char::operate" ); if ( lhs.empty() ) return ORowSetValue(); @@ -92,6 +98,7 @@ ORowSetValue OOp_Char::operate(const ::std::vector<ORowSetValue>& lhs) const //------------------------------------------------------------------ ORowSetValue OOp_Concat::operate(const ::std::vector<ORowSetValue>& lhs) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_Concat::operate" ); if ( lhs.empty() ) return ORowSetValue(); @@ -111,6 +118,7 @@ ORowSetValue OOp_Concat::operate(const ::std::vector<ORowSetValue>& lhs) const //------------------------------------------------------------------ ORowSetValue OOp_Locate::operate(const ::std::vector<ORowSetValue>& lhs) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_Locate::operate" ); ::std::vector<ORowSetValue>::const_iterator aIter = lhs.begin(); ::std::vector<ORowSetValue>::const_iterator aEnd = lhs.end(); for (; aIter != aEnd; ++aIter) @@ -129,6 +137,7 @@ ORowSetValue OOp_Locate::operate(const ::std::vector<ORowSetValue>& lhs) const //------------------------------------------------------------------ ORowSetValue OOp_SubString::operate(const ::std::vector<ORowSetValue>& lhs) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_SubString::operate" ); ::std::vector<ORowSetValue>::const_iterator aIter = lhs.begin(); ::std::vector<ORowSetValue>::const_iterator aEnd = lhs.end(); for (; aIter != aEnd; ++aIter) @@ -147,6 +156,7 @@ ORowSetValue OOp_SubString::operate(const ::std::vector<ORowSetValue>& lhs) cons //------------------------------------------------------------------ ORowSetValue OOp_LTrim::operate(const ORowSetValue& lhs) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_LTrim::operate" ); if ( lhs.isNull() ) return lhs; @@ -157,6 +167,7 @@ ORowSetValue OOp_LTrim::operate(const ORowSetValue& lhs) const //------------------------------------------------------------------ ORowSetValue OOp_RTrim::operate(const ORowSetValue& lhs) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_RTrim::operate" ); if ( lhs.isNull() ) return lhs; @@ -167,6 +178,7 @@ ORowSetValue OOp_RTrim::operate(const ORowSetValue& lhs) const //------------------------------------------------------------------ ORowSetValue OOp_Space::operate(const ORowSetValue& lhs) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_Space::operate" ); if ( lhs.isNull() ) return lhs; @@ -182,6 +194,7 @@ ORowSetValue OOp_Space::operate(const ORowSetValue& lhs) const //------------------------------------------------------------------ ORowSetValue OOp_Replace::operate(const ::std::vector<ORowSetValue>& lhs) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_Replace::operate" ); if ( lhs.size() != 3 ) return ORowSetValue(); @@ -200,6 +213,7 @@ ORowSetValue OOp_Replace::operate(const ::std::vector<ORowSetValue>& lhs) const //------------------------------------------------------------------ ORowSetValue OOp_Repeat::operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_Repeat::operate" ); if ( lhs.isNull() || rhs.isNull() ) return lhs; @@ -214,6 +228,7 @@ ORowSetValue OOp_Repeat::operate(const ORowSetValue& lhs,const ORowSetValue& rhs //------------------------------------------------------------------ ORowSetValue OOp_Insert::operate(const ::std::vector<ORowSetValue>& lhs) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_Insert::operate" ); if ( lhs.size() != 4 ) return ORowSetValue(); @@ -227,6 +242,7 @@ ORowSetValue OOp_Insert::operate(const ::std::vector<ORowSetValue>& lhs) const //------------------------------------------------------------------ ORowSetValue OOp_Left::operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_Left::operate" ); if ( lhs.isNull() || rhs.isNull() ) return lhs; @@ -239,6 +255,7 @@ ORowSetValue OOp_Left::operate(const ORowSetValue& lhs,const ORowSetValue& rhs) //------------------------------------------------------------------ ORowSetValue OOp_Right::operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_Right::operate" ); if ( lhs.isNull() || rhs.isNull() ) return lhs; diff --git a/connectivity/source/drivers/file/FTable.cxx b/connectivity/source/drivers/file/FTable.cxx index af75570a1096..a2544d7640a7 100644 --- a/connectivity/source/drivers/file/FTable.cxx +++ b/connectivity/source/drivers/file/FTable.cxx @@ -41,6 +41,7 @@ #include <com/sun/star/sdbc/ColumnValue.hpp> #include <unotools/ucbstreamhelper.hxx> #include <tools/debug.hxx> +#include <rtl/logfile.hxx> using namespace connectivity; using namespace connectivity::file; @@ -60,6 +61,7 @@ OFileTable::OFileTable(sdbcx::OCollection* _pTables,OConnection* _pConnection) ,m_nBufferSize(0) ,m_bWriteable(sal_False) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::OFileTable" ); DBG_CTOR( file_OFileTable, NULL ); construct(); TStringVector aVector; @@ -86,6 +88,7 @@ OFileTable::OFileTable( sdbcx::OCollection* _pTables,OConnection* _pConnection, ,m_nBufferSize(0) ,m_bWriteable(sal_False) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::OFileTable" ); DBG_CTOR( file_OFileTable, NULL ); m_aColumns = new OSQLColumns(); construct(); @@ -99,6 +102,7 @@ OFileTable::~OFileTable( ) // ------------------------------------------------------------------------- void OFileTable::refreshColumns() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::refreshColumns" ); TStringVector aVector; Reference< XResultSet > xResult = m_pConnection->getMetaData()->getColumns(Any(), m_SchemaName,m_Name,::rtl::OUString::createFromAscii("%")); @@ -118,14 +122,17 @@ void OFileTable::refreshColumns() // ------------------------------------------------------------------------- void OFileTable::refreshKeys() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::refreshKeys" ); } // ------------------------------------------------------------------------- void OFileTable::refreshIndexes() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::refreshIndexes" ); } // ------------------------------------------------------------------------- Any SAL_CALL OFileTable::queryInterface( const Type & rType ) throw(RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::queryInterface" ); if( rType == ::getCppuType((const Reference<XKeysSupplier>*)0) || rType == ::getCppuType((const Reference<XRename>*)0) || rType == ::getCppuType((const Reference<XAlterTable>*)0) || @@ -138,6 +145,7 @@ Any SAL_CALL OFileTable::queryInterface( const Type & rType ) throw(RuntimeExcep // ------------------------------------------------------------------------- void SAL_CALL OFileTable::disposing(void) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::disposing" ); OTable::disposing(); ::osl::MutexGuard aGuard(m_aMutex); @@ -147,6 +155,7 @@ void SAL_CALL OFileTable::disposing(void) //-------------------------------------------------------------------------- Sequence< sal_Int8 > OFileTable::getUnoTunnelImplementationId() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::getUnoTunnelImplementationId" ); static ::cppu::OImplementationId * pId = 0; if (! pId) { @@ -164,6 +173,7 @@ Sequence< sal_Int8 > OFileTable::getUnoTunnelImplementationId() //------------------------------------------------------------------ sal_Int64 OFileTable::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::getSomething" ); return (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) ? reinterpret_cast< sal_Int64 >( this ) : OTable_TYPEDEF::getSomething(rId); @@ -171,6 +181,7 @@ sal_Int64 OFileTable::getSomething( const Sequence< sal_Int8 > & rId ) throw (Ru // ----------------------------------------------------------------------------- void OFileTable::FileClose() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::FileClose" ); ::osl::MutexGuard aGuard(m_aMutex); if (m_pFileStream && m_pFileStream->IsWritable()) @@ -186,7 +197,6 @@ void OFileTable::FileClose() } } // ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- void SAL_CALL OFileTable::acquire() throw() { OTable_TYPEDEF::acquire(); @@ -199,32 +209,38 @@ void SAL_CALL OFileTable::release() throw() // ----------------------------------------------------------------------------- BOOL OFileTable::InsertRow(OValueRefVector& /*rRow*/, BOOL /*bFlush*/,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& /*_xCols*/) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::InsertRow" ); return sal_False; } // ----------------------------------------------------------------------------- BOOL OFileTable::DeleteRow(const OSQLColumns& /*_rCols*/) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::DeleteRow" ); return sal_False; } // ----------------------------------------------------------------------------- BOOL OFileTable::UpdateRow(OValueRefVector& /*rRow*/, OValueRefRow& /*pOrgRow*/,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& /*_xCols*/) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::UpdateRow" ); return sal_False; } // ----------------------------------------------------------------------------- void OFileTable::addColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& /*descriptor*/) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::addColumn" ); OSL_ENSURE( false, "OFileTable::addColumn: not implemented!" ); } // ----------------------------------------------------------------------------- void OFileTable::dropColumn(sal_Int32 /*_nPos*/) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::dropColumn" ); OSL_ENSURE( false, "OFileTable::addColumn: not implemented!" ); } // ----------------------------------------------------------------------------- SvStream* OFileTable::createStream_simpleError( const String& _rFileName, StreamMode _eOpenMode) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::createStream_simpleError" ); utl::UcbLockBytesHandler* p_null_dummy=NULL; SvStream* pReturn = ::utl::UcbStreamHelper::CreateStream( _rFileName, _eOpenMode, (_eOpenMode & STREAM_NOCREATE) == STREAM_NOCREATE ,p_null_dummy); if (pReturn && (ERRCODE_NONE != pReturn->GetErrorCode())) @@ -238,6 +254,7 @@ SvStream* OFileTable::createStream_simpleError( const String& _rFileName, Stream // ----------------------------------------------------------------------------- void OFileTable::refreshHeader() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::refreshHeader" ); } // ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/file/fcode.cxx b/connectivity/source/drivers/file/fcode.cxx index 1cd8543cd5f7..0bd0d354ba02 100644 --- a/connectivity/source/drivers/file/fcode.cxx +++ b/connectivity/source/drivers/file/fcode.cxx @@ -40,6 +40,7 @@ #include <com/sun/star/sdb/SQLFilterOperator.hpp> #include <comphelper/types.hxx> #include <com/sun/star/sdb/SQLFilterOperator.hpp> +#include <rtl/logfile.hxx> using namespace ::comphelper; using namespace connectivity; @@ -101,6 +102,7 @@ OOperandRow::OOperandRow(sal_uInt16 _nPos, sal_Int32 _rType) //------------------------------------------------------------------ void OOperandRow::bindValue(const OValueRefRow& _pRow) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOperandRow::OOperandRow" ); OSL_ENSURE(_pRow.isValid(),"NO EMPTY row allowed!"); m_pRow = _pRow; OSL_ENSURE(m_pRow.isValid() && m_nRowPos < m_pRow->get().size(),"Invalid RowPos is >= vector.size()"); @@ -109,12 +111,14 @@ void OOperandRow::bindValue(const OValueRefRow& _pRow) // ----------------------------------------------------------------------------- void OOperandRow::setValue(const ORowSetValue& _rVal) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOperandRow::setValue" ); OSL_ENSURE(m_pRow.isValid() && m_nRowPos < m_pRow->get().size(),"Invalid RowPos is >= vector.size()"); (*(m_pRow->get())[m_nRowPos]) = _rVal; } //------------------------------------------------------------------ const ORowSetValue& OOperandRow::getValue() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOperandRow::getValue" ); OSL_ENSURE(m_pRow.isValid() && m_nRowPos < m_pRow->get().size(),"Invalid RowPos is >= vector.size()"); return (m_pRow->get())[m_nRowPos]->getValue(); } @@ -122,6 +126,7 @@ const ORowSetValue& OOperandRow::getValue() const // ----------------------------------------------------------------------------- void OOperandValue::setValue(const ORowSetValue& _rVal) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOperandValue::setValue" ); m_aValue = _rVal; } // ------------------------------------------------------------------------- @@ -164,12 +169,14 @@ OOperandParam::OOperandParam(OSQLParseNode* pNode, sal_Int32 _nPos) //------------------------------------------------------------------ const ORowSetValue& OOperandValue::getValue() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOperandValue::getValue" ); return m_aValue; } //------------------------------------------------------------------ OOperandConst::OOperandConst(const OSQLParseNode& rColumnRef, const rtl::OUString& aStrValue) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOperandConst::OOperandConst" ); switch (rColumnRef.getNodeType()) { case SQL_NODE_STRING: @@ -215,6 +222,7 @@ sal_uInt16 OOperator::getRequestedOperands() const {return 2;} //------------------------------------------------------------------ sal_Bool OBoolOperator::operate(const OOperand*, const OOperand*) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OBoolOperator::operate" ); return sal_False; } @@ -222,6 +230,7 @@ sal_Bool OBoolOperator::operate(const OOperand*, const OOperand*) const //------------------------------------------------------------------ void OBoolOperator::Exec(OCodeStack& rCodeStack) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OBoolOperator::Exec" ); OOperand *pRight = rCodeStack.top(); rCodeStack.pop(); OOperand *pLeft = rCodeStack.top(); @@ -237,21 +246,28 @@ void OBoolOperator::Exec(OCodeStack& rCodeStack) //------------------------------------------------------------------ sal_Bool OOp_AND::operate(const OOperand* pLeft, const OOperand* pRight) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_AND::operate" ); return pLeft->isValid() && pRight->isValid(); } //------------------------------------------------------------------ sal_Bool OOp_OR::operate(const OOperand* pLeft, const OOperand* pRight) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_OR::operate" ); return pLeft->isValid() || pRight->isValid(); } //------------------------------------------------------------------ -sal_uInt16 OOp_ISNULL::getRequestedOperands() const {return 1;} +sal_uInt16 OOp_ISNULL::getRequestedOperands() const +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_ISNULL::getRequestedOperands" ); + return 1; +} //------------------------------------------------------------------ void OOp_ISNULL::Exec(OCodeStack& rCodeStack) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_ISNULL::Exec" ); OOperand* pOperand = rCodeStack.top(); rCodeStack.pop(); @@ -263,6 +279,7 @@ void OOp_ISNULL::Exec(OCodeStack& rCodeStack) //------------------------------------------------------------------ sal_Bool OOp_ISNULL::operate(const OOperand* pOperand, const OOperand*) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_ISNULL::operate" ); return pOperand->getValue().isNull(); } @@ -275,6 +292,7 @@ sal_Bool OOp_ISNOTNULL::operate(const OOperand* pOperand, const OOperand*) const //------------------------------------------------------------------ sal_Bool OOp_LIKE::operate(const OOperand* pLeft, const OOperand* pRight) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_ISNULL::operate" ); sal_Bool bMatch; ORowSetValue aLH(pLeft->getValue()); ORowSetValue aRH(pRight->getValue()); @@ -291,12 +309,14 @@ sal_Bool OOp_LIKE::operate(const OOperand* pLeft, const OOperand* pRight) const //------------------------------------------------------------------ sal_Bool OOp_NOTLIKE::operate(const OOperand* pLeft, const OOperand* pRight) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_NOTLIKE::operate" ); return !OOp_LIKE::operate(pLeft, pRight); } //------------------------------------------------------------------ sal_Bool OOp_COMPARE::operate(const OOperand* pLeft, const OOperand* pRight) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_COMPARE::operate" ); ORowSetValue aLH(pLeft->getValue()); ORowSetValue aRH(pRight->getValue()); @@ -366,6 +386,7 @@ sal_Bool OOp_COMPARE::operate(const OOperand* pLeft, const OOperand* pRight) con //------------------------------------------------------------------ void ONumOperator::Exec(OCodeStack& rCodeStack) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ONumOperator::Exec" ); OOperand *pRight = rCodeStack.top(); rCodeStack.pop(); @@ -381,34 +402,40 @@ void ONumOperator::Exec(OCodeStack& rCodeStack) //------------------------------------------------------------------ double OOp_ADD::operate(const double& fLeft,const double& fRight) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_ADD::operate" ); return fLeft + fRight; } //------------------------------------------------------------------ double OOp_SUB::operate(const double& fLeft,const double& fRight) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_SUB::operate" ); return fLeft - fRight; } //------------------------------------------------------------------ double OOp_MUL::operate(const double& fLeft,const double& fRight) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_MUL::operate" ); return fLeft * fRight; } //------------------------------------------------------------------ double OOp_DIV::operate(const double& fLeft,const double& fRight) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_DIV::operate" ); return fLeft / fRight; } // ----------------------------------------------------------------------------- OEvaluateSet* OOperandAttr::preProcess(OBoolOperator* /*pOp*/, OOperand* /*pRight*/) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOperandAttr::preProcess" ); return NULL; } //------------------------------------------------------------------ void ONthOperator::Exec(OCodeStack& rCodeStack) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ONthOperator::Exec" ); ::std::vector<ORowSetValue> aValues; ::std::vector<OOperand*> aOperands; OOperand* pOperand; @@ -436,6 +463,7 @@ void ONthOperator::Exec(OCodeStack& rCodeStack) //------------------------------------------------------------------ void OBinaryOperator::Exec(OCodeStack& rCodeStack) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OBinaryOperator::Exec" ); OOperand *pRight = rCodeStack.top(); rCodeStack.pop(); OOperand *pLeft = rCodeStack.top(); @@ -453,6 +481,7 @@ void OBinaryOperator::Exec(OCodeStack& rCodeStack) //------------------------------------------------------------------ void OUnaryOperator::Exec(OCodeStack& rCodeStack) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OUnaryOperator::Exec" ); OSL_ENSURE(!rCodeStack.empty(),"Stack is empty!"); OOperand* pOperand = rCodeStack.top(); rCodeStack.pop(); diff --git a/connectivity/source/drivers/file/quotedstring.cxx b/connectivity/source/drivers/file/quotedstring.cxx index 7dffe9b445d0..5cf56aec9375 100644 --- a/connectivity/source/drivers/file/quotedstring.cxx +++ b/connectivity/source/drivers/file/quotedstring.cxx @@ -31,6 +31,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_connectivity.hxx" #include "file/quotedstring.hxx" +#include <rtl/logfile.hxx> namespace connectivity { @@ -40,7 +41,9 @@ namespace connectivity //------------------------------------------------------------------ xub_StrLen QuotedTokenizedString::GetTokenCount( sal_Unicode cTok, sal_Unicode cStrDel ) const { - if ( !Len() ) + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "QuotedTokenizedString::GetTokenCount" ); + const xub_StrLen nLen = m_sString.Len(); + if ( !nLen ) return 0; xub_StrLen nTokCount = 1; @@ -48,27 +51,29 @@ namespace connectivity BOOL bInString = FALSE; // Befinden wir uns INNERHALB eines (cStrDel delimited) String? // Suche bis Stringende nach dem ersten nicht uebereinstimmenden Zeichen - for( xub_StrLen i = 0; i < Len(); i++ ) + for( xub_StrLen i = 0; i < nLen; ++i ) { + const sal_Unicode cChar = m_sString.GetChar(i); if (bStart) { bStart = FALSE; // Erstes Zeichen ein String-Delimiter? - if ((*this).GetChar(i) == cStrDel) + if ( cChar == cStrDel ) { bInString = TRUE; // dann sind wir jetzt INNERHALB des Strings! continue; // dieses Zeichen ueberlesen! } } - if (bInString) { + if (bInString) + { // Wenn jetzt das String-Delimiter-Zeichen auftritt ... - if ( (*this).GetChar(i) == cStrDel ) + if ( cChar == cStrDel ) { - if ((i+1 < Len()) && ((*this).GetChar(i+1) == cStrDel)) + if ((i+1 < nLen) && (m_sString.GetChar(i+1) == cStrDel)) { // Verdoppeltes String-Delimiter-Zeichen: - i++; // kein String-Ende, naechstes Zeichen ueberlesen. + ++i; // kein String-Ende, naechstes Zeichen ueberlesen. } else { @@ -76,11 +81,13 @@ namespace connectivity bInString = FALSE; } } - } else { + } // if (bInString) + else + { // Stimmt das Tokenzeichen ueberein, dann erhoehe TokCount - if ( (*this).GetChar(i) == cTok ) + if ( cChar == cTok ) { - nTokCount++; + ++nTokCount; bStart = TRUE; } } @@ -93,29 +100,36 @@ namespace connectivity //------------------------------------------------------------------ void QuotedTokenizedString::GetTokenSpecial( String& _rStr,xub_StrLen& nStartPos, sal_Unicode cTok, sal_Unicode cStrDel ) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "QuotedTokenizedString::GetTokenCount" ); _rStr.Erase(); - xub_StrLen nLen = Len(); + const xub_StrLen nLen = m_sString.Len(); if ( nLen ) { - BOOL bInString = (nStartPos < nLen) && ((*this).GetChar(nStartPos) == cStrDel); // Befinden wir uns INNERHALB eines (cStrDel delimited) String? + BOOL bInString = (nStartPos < nLen) && (m_sString.GetChar(nStartPos) == cStrDel); // Befinden wir uns INNERHALB eines (cStrDel delimited) String? // Erstes Zeichen ein String-Delimiter? if (bInString ) ++nStartPos; // dieses Zeichen ueberlesen! + if ( nStartPos >= nLen ) + return; + + sal_Unicode* pData = _rStr.AllocBuffer(nLen - nStartPos); + const sal_Unicode* pStart = pData; // Suche bis Stringende nach dem ersten nicht uebereinstimmenden Zeichen for( xub_StrLen i = nStartPos; i < nLen; ++i ) { + const sal_Unicode cChar = m_sString.GetChar(i); if (bInString) { // Wenn jetzt das String-Delimiter-Zeichen auftritt ... - if ( (*this).GetChar(i) == cStrDel ) + if ( cChar == cStrDel ) { - if ((i+1 < nLen) && ((*this).GetChar(i+1) == cStrDel)) + if ((i+1 < nLen) && (m_sString.GetChar(i+1) == cStrDel)) { // Verdoppeltes String-Delimiter-Zeichen: - ++i; // kein String-Ende, naechstes Zeichen ueberlesen. - - _rStr += (*this).GetChar(i); // Zeichen gehoert zum Resultat-String + // kein String-Ende, naechstes Zeichen ueberlesen. + ++i; + *pData++ = m_sString.GetChar(i); // Zeichen gehoert zum Resultat-String } else { @@ -125,14 +139,14 @@ namespace connectivity } else { - _rStr += (*this).GetChar(i); // Zeichen gehoert zum Resultat-String + *pData++ = cChar; // Zeichen gehoert zum Resultat-String } } else { // Stimmt das Tokenzeichen ueberein, dann erhoehe nTok - if ( (*this).GetChar(i) == cTok ) + if ( cChar == cTok ) { // Vorzeitiger Abbruch der Schleife moeglich, denn // wir haben, was wir wollten. @@ -141,10 +155,11 @@ namespace connectivity } else { - _rStr += (*this).GetChar(i); // Zeichen gehoert zum Resultat-String + *pData++ = cChar; // Zeichen gehoert zum Resultat-String } } - } + } // for( xub_StrLen i = nStartPos; i < nLen; ++i ) + _rStr.ReleaseBufferAccess(xub_StrLen(pData - pStart)); } } } diff --git a/connectivity/source/drivers/flat/EDatabaseMetaData.cxx b/connectivity/source/drivers/flat/EDatabaseMetaData.cxx index 450f484369dd..c24ad8c5fab6 100644 --- a/connectivity/source/drivers/flat/EDatabaseMetaData.cxx +++ b/connectivity/source/drivers/flat/EDatabaseMetaData.cxx @@ -45,6 +45,7 @@ #include <com/sun/star/lang/XUnoTunnel.hpp> #include <comphelper/extract.hxx> #include <comphelper/types.hxx> +#include <rtl/logfile.hxx> using namespace ::comphelper; @@ -61,14 +62,17 @@ using namespace ::com::sun::star::container; OFlatDatabaseMetaData::OFlatDatabaseMetaData(::connectivity::file::OConnection* _pCon) :ODatabaseMetaData(_pCon) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "flat", "Ocke.Janssen@sun.com", "OFlatDatabaseMetaData::OFlatDatabaseMetaData" ); } // ------------------------------------------------------------------------- OFlatDatabaseMetaData::~OFlatDatabaseMetaData() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "flat", "Ocke.Janssen@sun.com", "OFlatDatabaseMetaData::~OFlatDatabaseMetaData" ); } // ------------------------------------------------------------------------- Reference< XResultSet > OFlatDatabaseMetaData::impl_getTypeInfo_throw( ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "flat", "Ocke.Janssen@sun.com", "OFlatDatabaseMetaData::impl_getTypeInfo_throw" ); ::osl::MutexGuard aGuard( m_aMutex ); ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTypeInfo); @@ -169,6 +173,7 @@ Reference< XResultSet > SAL_CALL OFlatDatabaseMetaData::getColumns( const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "flat", "Ocke.Janssen@sun.com", "OFlatDatabaseMetaData::getColumns" ); ::osl::MutexGuard aGuard( m_aMutex ); Reference< XTablesSupplier > xTables = m_pConnection->createCatalog(); @@ -256,6 +261,7 @@ Reference< XResultSet > SAL_CALL OFlatDatabaseMetaData::getColumns( // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OFlatDatabaseMetaData::getURL( ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "flat", "Ocke.Janssen@sun.com", "OFlatDatabaseMetaData::getURL" ); ::osl::MutexGuard aGuard( m_aMutex ); return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:flat:")) + m_pConnection->getURL(); } diff --git a/connectivity/source/drivers/flat/ENoException.cxx b/connectivity/source/drivers/flat/ENoException.cxx deleted file mode 100644 index e64f615cde31..000000000000 --- a/connectivity/source/drivers/flat/ENoException.cxx +++ /dev/null @@ -1,324 +0,0 @@ -/************************************************************************* - * - * 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: ENoException.cxx,v $ - * $Revision: 1.10 $ - * - * 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_connectivity.hxx" -#include "flat/ETable.hxx" -#include "flat/EConnection.hxx" - -using namespace connectivity; -using namespace connectivity::flat; - -//------------------------------------------------------------------ -xub_StrLen OFlatString::GetTokenCount( sal_Unicode cTok, sal_Unicode cStrDel ) const -{ - if ( !Len() ) - return 0; - - xub_StrLen nTokCount = 1; - BOOL bStart = TRUE; // Stehen wir auf dem ersten Zeichen im Token? - BOOL bInString = FALSE; // Befinden wir uns INNERHALB eines (cStrDel delimited) String? - - // Suche bis Stringende nach dem ersten nicht uebereinstimmenden Zeichen - for( xub_StrLen i = 0; i < Len(); i++ ) - { - if (bStart) - { - bStart = FALSE; - // Erstes Zeichen ein String-Delimiter? - if ((*this).GetChar(i) == cStrDel) - { - bInString = TRUE; // dann sind wir jetzt INNERHALB des Strings! - continue; // dieses Zeichen ueberlesen! - } - } - - if (bInString) { - // Wenn jetzt das String-Delimiter-Zeichen auftritt ... - if ( (*this).GetChar(i) == cStrDel ) - { - if ((i+1 < Len()) && ((*this).GetChar(i+1) == cStrDel)) - { - // Verdoppeltes String-Delimiter-Zeichen: - i++; // kein String-Ende, naechstes Zeichen ueberlesen. - } - else - { - // String-Ende - bInString = FALSE; - } - } - } else { - // Stimmt das Tokenzeichen ueberein, dann erhoehe TokCount - if ( (*this).GetChar(i) == cTok ) - { - nTokCount++; - bStart = TRUE; - } - } - } - - return nTokCount; -} - -//------------------------------------------------------------------ -void OFlatString::GetTokenSpecial( String& _rStr,xub_StrLen& nStartPos, sal_Unicode cTok, sal_Unicode cStrDel ) const -{ - _rStr.Erase(); - xub_StrLen nLen = Len(); - if ( nLen ) - { - BOOL bInString = (nStartPos < nLen) && ((*this).GetChar(nStartPos) == cStrDel); // Befinden wir uns INNERHALB eines (cStrDel delimited) String? - - // Erstes Zeichen ein String-Delimiter? - if (bInString ) - ++nStartPos; // dieses Zeichen ueberlesen! - // Suche bis Stringende nach dem ersten nicht uebereinstimmenden Zeichen - xub_StrLen i = nStartPos; - for( ; i < nLen; ++i ) - { - if (bInString) - { - // Wenn jetzt das String-Delimiter-Zeichen auftritt ... - if ( (*this).GetChar(i) == cStrDel ) - { - if ((i+1 < nLen) && ((*this).GetChar(i+1) == cStrDel)) - { - // Verdoppeltes String-Delimiter-Zeichen: - ++i; // kein String-Ende, naechstes Zeichen ueberlesen. - - _rStr += (*this).GetChar(i); // Zeichen gehoert zum Resultat-String - } - else - { - // String-Ende - bInString = FALSE; - } - } - else - { - _rStr += (*this).GetChar(i); // Zeichen gehoert zum Resultat-String - } - - } - else - { - // Stimmt das Tokenzeichen ueberein, dann erhoehe nTok - if ( (*this).GetChar(i) == cTok ) - { - // Vorzeitiger Abbruch der Schleife moeglich, denn - // wir haben, was wir wollten. - nStartPos = i+1; - break; - } - else - { - _rStr += (*this).GetChar(i); // Zeichen gehoert zum Resultat-String - } - } - } - if ( i == nLen && nStartPos < i ) - nStartPos = nLen; - } -} -// ----------------------------------------------------------------------------- -sal_Bool OFlatTable::checkHeaderLine() -{ - if (m_nFilePos == 0 && ((OFlatConnection*)m_pConnection)->isHeaderLine()) - { - BOOL bRead2; - do - { - bRead2 = m_pFileStream->ReadByteStringLine(m_aCurrentLine,m_pConnection->getTextEncoding()); - } - while(bRead2 && !m_aCurrentLine.Len()); - - m_nFilePos = m_pFileStream->Tell(); - if (m_pFileStream->IsEof()) - return sal_False; - } - return sal_True; -} -//------------------------------------------------------------------ -sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos) -{ - if ( !m_pFileStream ) - return sal_False; - OFlatConnection* pConnection = (OFlatConnection*)m_pConnection; - // ---------------------------------------------------------- - // Positionierung vorbereiten: - - m_nFilePos = nCurPos; - - switch(eCursorPosition) - { - case IResultSetHelper::FIRST: - m_nFilePos = 0; - m_nRowPos = 1; - // run through - case IResultSetHelper::NEXT: - if(eCursorPosition != IResultSetHelper::FIRST) - ++m_nRowPos; - m_pFileStream->Seek(m_nFilePos); - if (m_pFileStream->IsEof() || !checkHeaderLine()) - { - m_nMaxRowCount = m_nRowPos; - return sal_False; - } - - m_aRowToFilePos.insert(::std::map<sal_Int32,sal_Int32>::value_type(m_nRowPos,m_nFilePos)); - - m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding()); - if (m_pFileStream->IsEof()) - { - m_nMaxRowCount = m_nRowPos; - return sal_False; - } - nCurPos = m_pFileStream->Tell(); - break; - case IResultSetHelper::PRIOR: - --m_nRowPos; - if(m_nRowPos > 0) - { - m_nFilePos = m_aRowToFilePos.find(m_nRowPos)->second; - m_pFileStream->Seek(m_nFilePos); - if (m_pFileStream->IsEof() || !checkHeaderLine()) - return sal_False; - m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding()); - if (m_pFileStream->IsEof()) - return sal_False; - nCurPos = m_pFileStream->Tell(); - } - else - m_nRowPos = 0; - - break; - - break; - case IResultSetHelper::LAST: - if(m_nMaxRowCount) - { - m_nFilePos = m_aRowToFilePos.rbegin()->second; - m_nRowPos = m_aRowToFilePos.rbegin()->first; - m_pFileStream->Seek(m_nFilePos); - if (m_pFileStream->IsEof() || !checkHeaderLine()) - return sal_False; - m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding()); - if (m_pFileStream->IsEof()) - return sal_False; - nCurPos = m_pFileStream->Tell(); - } - else - { - while(seekRow(IResultSetHelper::NEXT,1,nCurPos)) ; // run through after last row - // now I know all - seekRow(IResultSetHelper::PRIOR,1,nCurPos); - } - break; - case IResultSetHelper::RELATIVE: - if(nOffset > 0) - { - for(sal_Int32 i = 0;i<nOffset;++i) - seekRow(IResultSetHelper::NEXT,1,nCurPos); - } - else if(nOffset < 0) - { - for(sal_Int32 i = nOffset;i;++i) - seekRow(IResultSetHelper::PRIOR,1,nCurPos); - } - break; - case IResultSetHelper::ABSOLUTE: - { - if(nOffset < 0) - nOffset = m_nRowPos + nOffset; - ::std::map<sal_Int32,sal_Int32>::const_iterator aIter = m_aRowToFilePos.find(nOffset); - if(aIter != m_aRowToFilePos.end()) - { - m_nFilePos = aIter->second; - m_pFileStream->Seek(m_nFilePos); - if (m_pFileStream->IsEof() || !checkHeaderLine()) - return sal_False; - m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding()); - if (m_pFileStream->IsEof()) - return sal_False; - nCurPos = m_pFileStream->Tell(); - } - else if(m_nMaxRowCount && nOffset > m_nMaxRowCount) // offset is outside the table - { - m_nRowPos = m_nMaxRowCount; - return sal_False; - } - else - { - aIter = m_aRowToFilePos.upper_bound(nOffset); - if(aIter == m_aRowToFilePos.end()) - { - m_nRowPos = m_aRowToFilePos.rbegin()->first; - nCurPos = m_nFilePos = m_aRowToFilePos.rbegin()->second; - while(m_nRowPos != nOffset) - seekRow(IResultSetHelper::NEXT,1,nCurPos); - } - else - { - --aIter; - m_nRowPos = aIter->first; - m_nFilePos = aIter->second; - m_pFileStream->Seek(m_nFilePos); - if (m_pFileStream->IsEof() || !checkHeaderLine()) - return sal_False; - m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding()); - if (m_pFileStream->IsEof()) - return sal_False; - nCurPos = m_pFileStream->Tell(); - } - } - } - - break; - case IResultSetHelper::BOOKMARK: - m_pFileStream->Seek(nOffset); - if (m_pFileStream->IsEof()) - return sal_False; - - m_nFilePos = m_pFileStream->Tell(); // Byte-Position in der Datei merken (am ZeilenANFANG) - m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding()); - if (m_pFileStream->IsEof()) - return sal_False; - nCurPos = m_pFileStream->Tell(); - break; - } - - - return sal_True; -} -// ----------------------------------------------------------------------------- - - - diff --git a/connectivity/source/drivers/flat/EResultSet.cxx b/connectivity/source/drivers/flat/EResultSet.cxx index 631e1c7dd44c..278c45e0ed55 100644 --- a/connectivity/source/drivers/flat/EResultSet.cxx +++ b/connectivity/source/drivers/flat/EResultSet.cxx @@ -87,7 +87,7 @@ Any SAL_CALL OFlatResultSet::queryInterface( const Type & rType ) throw(RuntimeE || rType == ::getCppuType((const Reference<XRowUpdate>*)0)) return Any(); - Any aRet = OResultSet::queryInterface(rType); + const Any aRet = OResultSet::queryInterface(rType); return aRet.hasValue() ? aRet : OFlatResultSet_BASE::queryInterface(rType); } // ------------------------------------------------------------------------- @@ -117,10 +117,9 @@ Sequence< Type > SAL_CALL OFlatResultSet::getTypes( ) throw( RuntimeException) Any SAL_CALL OFlatResultSet::getBookmark( ) throw( SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - return makeAny((sal_Int32)(m_aRow->get())[0]->getValue()); + return makeAny((sal_Int32)(m_aRow->get())[0]->getValue()); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OFlatResultSet::moveToBookmark( const Any& bookmark ) throw( SQLException, RuntimeException) diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx index a4ab45c997c5..b91bee0917f6 100644 --- a/connectivity/source/drivers/flat/ETable.cxx +++ b/connectivity/source/drivers/flat/ETable.cxx @@ -55,6 +55,7 @@ #include <comphelper/types.hxx> #include "file/quotedstring.hxx" #include <svtools/syslocale.hxx> +#include <rtl/logfile.hxx> using namespace ::comphelper; using namespace connectivity; @@ -73,34 +74,37 @@ using namespace ::com::sun::star::lang; // ------------------------------------------------------------------------- void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "flat", "Ocke.Janssen@sun.com", "OFlatTable::fillColumns" ); BOOL bRead = TRUE; QuotedTokenizedString aHeaderLine; OFlatConnection* pConnection = (OFlatConnection*)m_pConnection; - if (pConnection->isHeaderLine()) + const rtl_TextEncoding nEncoding = m_pConnection->getTextEncoding(); + const sal_Bool bHasHeaderLine = pConnection->isHeaderLine(); + if ( bHasHeaderLine ) { while(bRead && !aHeaderLine.Len()) { - bRead = m_pFileStream->ReadByteStringLine(aHeaderLine,pConnection->getTextEncoding()); + bRead = m_pFileStream->ReadByteStringLine(aHeaderLine,nEncoding); } + m_nStartRowFilePos = m_pFileStream->Tell(); } // read first row QuotedTokenizedString aFirstLine; + bRead = m_pFileStream->ReadByteStringLine(aFirstLine,nEncoding); - bRead = m_pFileStream->ReadByteStringLine(aFirstLine,pConnection->getTextEncoding()); - - if (!pConnection->isHeaderLine() || !aHeaderLine.Len()) + if ( !bHasHeaderLine || !aHeaderLine.Len()) { while(bRead && !aFirstLine.Len()) { - bRead = m_pFileStream->ReadByteStringLine(aFirstLine,pConnection->getTextEncoding()); + bRead = m_pFileStream->ReadByteStringLine(aFirstLine,nEncoding); } // use first row as headerline because we need the number of columns aHeaderLine = aFirstLine; } // column count - xub_StrLen nFieldCount = aHeaderLine.GetTokenCount(pConnection->getFieldDelimiter(),pConnection->getStringDelimiter()); + const xub_StrLen nFieldCount = aHeaderLine.GetTokenCount(m_cFieldDelimiter,m_cStringDelimiter); if(!m_aColumns.isValid()) m_aColumns = new OSQLColumns(); @@ -111,16 +115,16 @@ void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale) m_aPrecisions.clear(); m_aScales.clear(); // reserve some space - m_aColumns->get().reserve(nFieldCount); - m_aTypes.reserve(nFieldCount); - m_aPrecisions.reserve(nFieldCount); - m_aScales.reserve(nFieldCount); + m_aColumns->get().reserve(nFieldCount+1); + m_aTypes.reserve(nFieldCount+1); + m_aPrecisions.reserve(nFieldCount+1); + m_aScales.reserve(nFieldCount+1); - sal_Bool bCase = getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers(); + const sal_Bool bCase = m_pConnection->getMetaData()->storesMixedCaseQuotedIdentifiers(); CharClass aCharClass(pConnection->getDriver()->getFactory(),_aLocale); // read description - sal_Unicode cDecimalDelimiter = pConnection->getDecimalDelimiter(); - sal_Unicode cThousandDelimiter = pConnection->getThousandDelimiter(); + const sal_Unicode cDecimalDelimiter = pConnection->getDecimalDelimiter(); + const sal_Unicode cThousandDelimiter = pConnection->getThousandDelimiter(); String aColumnName; ::rtl::OUString aTypeName; ::comphelper::UStringMixEqual aCase(bCase); @@ -129,9 +133,9 @@ void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale) xub_StrLen nStartPosFirstLine2 = 0; for (xub_StrLen i = 0; i < nFieldCount; i++) { - if (pConnection->isHeaderLine()) + if ( bHasHeaderLine ) { - aHeaderLine.GetTokenSpecial(aColumnName,nStartPosHeaderLine,pConnection->getFieldDelimiter(),pConnection->getStringDelimiter()); + aHeaderLine.GetTokenSpecial(aColumnName,nStartPosHeaderLine,m_cFieldDelimiter,m_cStringDelimiter); if ( !aColumnName.Len() ) { aColumnName = 'C'; @@ -153,9 +157,9 @@ void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale) // first without fielddelimiter String aField; - aFirstLine.GetTokenSpecial(aField,nStartPosFirstLine,pConnection->getFieldDelimiter(),'\0'); + aFirstLine.GetTokenSpecial(aField,nStartPosFirstLine,m_cFieldDelimiter,'\0'); if (aField.Len() == 0 || - (pConnection->getStringDelimiter() && pConnection->getStringDelimiter() == aField.GetChar(0))) + (m_cStringDelimiter && m_cStringDelimiter == aField.GetChar(0))) { bNumeric = FALSE; nStartPosFirstLine2 = nStartPosFirstLine; @@ -163,8 +167,8 @@ void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale) else { String aField2; - if ( pConnection->getStringDelimiter() != '\0' ) - aFirstLine.GetTokenSpecial(aField2,nStartPosFirstLine2,pConnection->getFieldDelimiter(),pConnection->getStringDelimiter()); + if ( m_cStringDelimiter != '\0' ) + aFirstLine.GetTokenSpecial(aField2,nStartPosFirstLine2,m_cFieldDelimiter,m_cStringDelimiter); else aField2 = aField; @@ -178,7 +182,7 @@ void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale) xub_StrLen nDot = 0; for (xub_StrLen j = 0; j < aField2.Len(); j++) { - sal_Unicode c = aField2.GetChar(j); + const sal_Unicode c = aField2.GetChar(j); // nur Ziffern und Dezimalpunkt und Tausender-Trennzeichen? if ((!cDecimalDelimiter || c != cDecimalDelimiter) && (!cThousandDelimiter || c != cThousandDelimiter) && @@ -200,10 +204,10 @@ void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale) if (bNumeric && cThousandDelimiter) { // Ist der Trenner richtig angegeben? - String aValue = aField2.GetToken(0,cDecimalDelimiter); + const String aValue = aField2.GetToken(0,cDecimalDelimiter); for (sal_Int32 j = aValue.Len() - 4; j >= 0; j -= 4) { - sal_Unicode c = aValue.GetChar(static_cast<sal_uInt16>(j)); + const sal_Unicode c = aValue.GetChar(static_cast<sal_uInt16>(j)); // nur Ziffern und Dezimalpunkt und Tausender-Trennzeichen? if (c == cThousandDelimiter && j) continue; @@ -237,12 +241,14 @@ void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale) if(nPrecision) { eType = DataType::DECIMAL; - aTypeName = ::rtl::OUString::createFromAscii("DECIMAL"); + static const ::rtl::OUString s_sDECIMAL(RTL_CONSTASCII_USTRINGPARAM("DECIMAL")); + aTypeName = s_sDECIMAL; } else { eType = DataType::DOUBLE; - aTypeName = ::rtl::OUString::createFromAscii("DOUBLE"); + static const ::rtl::OUString s_sDOUBLE(RTL_CONSTASCII_USTRINGPARAM("DOUBLE")); + aTypeName = s_sDOUBLE; } } else @@ -256,21 +262,33 @@ void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale) { case NUMBERFORMAT_DATE: eType = DataType::DATE; - aTypeName = ::rtl::OUString::createFromAscii("DATE"); + { + static const ::rtl::OUString s_sDATE(RTL_CONSTASCII_USTRINGPARAM("DATE")); + aTypeName = s_sDATE; + } break; case NUMBERFORMAT_DATETIME: eType = DataType::TIMESTAMP; - aTypeName = ::rtl::OUString::createFromAscii("TIMESTAMP"); + { + static const ::rtl::OUString s_sTIMESTAMP(RTL_CONSTASCII_USTRINGPARAM("TIMESTAMP")); + aTypeName = s_sTIMESTAMP; + } break; case NUMBERFORMAT_TIME: eType = DataType::TIME; - aTypeName = ::rtl::OUString::createFromAscii("TIME"); + { + static const ::rtl::OUString s_sTIME(RTL_CONSTASCII_USTRINGPARAM("TIME")); + aTypeName = s_sTIME; + } break; default: eType = DataType::VARCHAR; nPrecision = 0; // nyi: Daten koennen aber laenger sein! nScale = 0; - aTypeName = ::rtl::OUString::createFromAscii("VARCHAR"); + { + static const ::rtl::OUString s_sVARCHAR(RTL_CONSTASCII_USTRINGPARAM("VARCHAR")); + aTypeName = s_sVARCHAR; + } }; nFlags |= ColumnSearch::CHAR; } @@ -300,7 +318,7 @@ void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale) m_aPrecisions.push_back(nPrecision); m_aScales.push_back(nScale); } - m_pFileStream->Seek(STREAM_SEEK_TO_BEGIN); + m_pFileStream->Seek(m_nStartRowFilePos); } // ------------------------------------------------------------------------- OFlatTable::OFlatTable(sdbcx::OCollection* _pTables,OFlatConnection* _pConnection, @@ -314,14 +332,20 @@ OFlatTable::OFlatTable(sdbcx::OCollection* _pTables,OFlatConnection* _pConnectio _Description, _SchemaName, _CatalogName) + ,m_nStartRowFilePos(0) ,m_nRowPos(0) ,m_nMaxRowCount(0) + ,m_cStringDelimiter(_pConnection->getStringDelimiter()) + ,m_cFieldDelimiter(_pConnection->getFieldDelimiter()) + ,m_bNeedToReadLine(false) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "flat", "Ocke.Janssen@sun.com", "OFlatTable::OFlatTable" ); } // ----------------------------------------------------------------------------- void OFlatTable::construct() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "flat", "Ocke.Janssen@sun.com", "OFlatTable::construct" ); SvtSysLocale aLocale; ::com::sun::star::lang::Locale aAppLocale(aLocale.GetLocaleDataPtr()->getLocale()); Sequence< ::com::sun::star::uno::Any > aArg(1); @@ -330,6 +354,8 @@ void OFlatTable::construct() Reference< ::com::sun::star::util::XNumberFormatsSupplier > xSupplier(m_pConnection->getDriver()->getFactory()->createInstanceWithArguments(::rtl::OUString::createFromAscii("com.sun.star.util.NumberFormatsSupplier"),aArg),UNO_QUERY); m_xNumberFormatter = Reference< ::com::sun::star::util::XNumberFormatter >(m_pConnection->getDriver()->getFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.util.NumberFormatter")),UNO_QUERY); m_xNumberFormatter->attachNumberFormatsSupplier(xSupplier); + Reference<XPropertySet> xProp(xSupplier->getNumberFormatSettings(),UNO_QUERY); + xProp->getPropertyValue(::rtl::OUString::createFromAscii("NullDate")) >>= m_aNullDate; INetURLObject aURL; aURL.SetURL(getEntry()); @@ -363,6 +389,7 @@ void OFlatTable::construct() // ------------------------------------------------------------------------- String OFlatTable::getEntry() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "flat", "Ocke.Janssen@sun.com", "OFlatTable::getEntry" ); ::rtl::OUString sURL; try { @@ -407,6 +434,7 @@ String OFlatTable::getEntry() // ------------------------------------------------------------------------- void OFlatTable::refreshColumns() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "flat", "Ocke.Janssen@sun.com", "OFlatTable::refreshColumns" ); ::osl::MutexGuard aGuard( m_aMutex ); TStringVector aVector; @@ -424,6 +452,7 @@ void OFlatTable::refreshColumns() // ------------------------------------------------------------------------- void SAL_CALL OFlatTable::disposing(void) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "flat", "Ocke.Janssen@sun.com", "OFlatTable::disposing" ); OFileTable::disposing(); ::osl::MutexGuard aGuard(m_aMutex); m_aColumns = NULL; @@ -485,6 +514,7 @@ Sequence< sal_Int8 > OFlatTable::getUnoTunnelImplementationId() //------------------------------------------------------------------ sal_Int64 OFlatTable::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "flat", "Ocke.Janssen@sun.com", "OFlatTable::getSomething" ); return (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) ? reinterpret_cast< sal_Int64 >( this ) : OFlatTable_BASE::getSomething(rId); @@ -492,21 +522,32 @@ sal_Int64 OFlatTable::getSomething( const Sequence< sal_Int8 > & rId ) throw (Ru //------------------------------------------------------------------ sal_Bool OFlatTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols,sal_Bool bIsTable,sal_Bool bRetrieveData) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "flat", "Ocke.Janssen@sun.com", "OFlatTable::fetchRow" ); *(_rRow->get())[0] = m_nFilePos; if (!bRetrieveData) return TRUE; + if ( m_bNeedToReadLine ) + { + sal_Int32 nCurrentPos = 0; + m_pFileStream->Seek(m_nFilePos); + readLine(nCurrentPos); + m_bNeedToReadLine = false; + } OFlatConnection* pConnection = (OFlatConnection*)m_pConnection; + const sal_Unicode cDecimalDelimiter = pConnection->getDecimalDelimiter(); + const sal_Unicode cThousandDelimiter = pConnection->getThousandDelimiter(); // Felder: xub_StrLen nStartPos = 0; String aStr; OSQLColumns::Vector::const_iterator aIter = _rCols.get().begin(); OSQLColumns::Vector::const_iterator aEnd = _rCols.get().end(); - for (OValueRefVector::Vector::size_type i = 1; aIter != aEnd && i < _rRow->get().size(); + const OValueRefVector::Vector::size_type nCount = _rRow->get().size(); + for (OValueRefVector::Vector::size_type i = 1; aIter != aEnd && i < nCount; ++aIter, i++) { - m_aCurrentLine.GetTokenSpecial(aStr,nStartPos,pConnection->getFieldDelimiter(),pConnection->getStringDelimiter()); + m_aCurrentLine.GetTokenSpecial(aStr,nStartPos,m_cFieldDelimiter,m_cStringDelimiter); if (aStr.Len() == 0) (_rRow->get())[i]->setNull(); @@ -532,21 +573,17 @@ sal_Bool OFlatTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols,sal case DataType::DATE: case DataType::TIME: { - double nRes = 0.0; try { - nRes = m_xNumberFormatter->convertStringToNumber(::com::sun::star::util::NumberFormat::ALL,aStr); - Reference<XPropertySet> xProp(m_xNumberFormatter->getNumberFormatsSupplier()->getNumberFormatSettings(),UNO_QUERY); - com::sun::star::util::Date aDate; - xProp->getPropertyValue(::rtl::OUString::createFromAscii("NullDate")) >>= aDate; + double nRes = m_xNumberFormatter->convertStringToNumber(::com::sun::star::util::NumberFormat::ALL,aStr); switch(nType) { case DataType::DATE: - *(_rRow->get())[i] = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toDate(nRes,aDate)); + *(_rRow->get())[i] = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toDate(nRes,m_aNullDate)); break; case DataType::TIMESTAMP: - *(_rRow->get())[i] = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toDateTime(nRes,aDate)); + *(_rRow->get())[i] = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toDateTime(nRes,m_aNullDate)); break; default: *(_rRow->get())[i] = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toTime(nRes)); @@ -562,33 +599,47 @@ sal_Bool OFlatTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols,sal case DataType::DECIMAL: // #99178# OJ case DataType::NUMERIC: { - sal_Unicode cDecimalDelimiter = pConnection->getDecimalDelimiter(); - sal_Unicode cThousandDelimiter = pConnection->getThousandDelimiter(); + String aStrConverted; + if ( DataType::INTEGER != nType ) + { + sal_Unicode* pData = aStrConverted.AllocBuffer(aStr.Len()); + const sal_Unicode* pStart = pData; - OSL_ENSURE(cDecimalDelimiter && nType != DataType::INTEGER || - !cDecimalDelimiter && nType == DataType::INTEGER, - "FalscherTyp"); + OSL_ENSURE(cDecimalDelimiter && nType != DataType::INTEGER || + !cDecimalDelimiter && nType == DataType::INTEGER, + "FalscherTyp"); - // In Standard-Notation (DezimalPUNKT ohne Tausender-Komma) umwandeln: - for (xub_StrLen j = 0; j < aStr.Len(); ++j) - { - if (cDecimalDelimiter && aStr.GetChar(j) == cDecimalDelimiter) - aStrConverted += '.'; - else if ( aStr.GetChar(j) == '.' ) // special case, if decimal seperator isn't '.' we have to vut the string after it - continue; // #99189# OJ - else if (cThousandDelimiter && aStr.GetChar(j) == cThousandDelimiter) + // In Standard-Notation (DezimalPUNKT ohne Tausender-Komma) umwandeln: + for (xub_StrLen j = 0; j < aStr.Len(); ++j) { - // weglassen - } - else - aStrConverted += aStr.GetChar(j) ; + const sal_Unicode cChar = aStr.GetChar(j); + if (cDecimalDelimiter && cChar == cDecimalDelimiter) + *pData++ = '.'; + //aStrConverted.Append( '.' ); + else if ( cChar == '.' ) // special case, if decimal seperator isn't '.' we have to put the string after it + continue; // #99189# OJ + else if (cThousandDelimiter && cChar == cThousandDelimiter) + { + // weglassen + } + else + *pData++ = cChar; + //aStrConverted.Append(cChar); + } // for (xub_StrLen j = 0; j < aStr.Len(); ++j) + aStrConverted.ReleaseBufferAccess(xub_StrLen(pData - pStart)); + } // if ( DataType::INTEGER != nType ) + else + { + aStrConverted = aStr; + if ( cThousandDelimiter ) + aStrConverted.EraseAllChars(cThousandDelimiter); } - double nVal = ::rtl::math::stringToDouble(aStrConverted,'.',',',NULL,NULL); + const double nVal = ::rtl::math::stringToDouble(aStrConverted,'.',',',NULL,NULL); // #99178# OJ if ( DataType::DECIMAL == nType || DataType::NUMERIC == nType ) - *(_rRow->get())[i] = ORowSetValue(String::CreateFromDouble(nVal)); + *(_rRow->get())[i] = ::rtl::OUString::valueOf(nVal); else *(_rRow->get())[i] = nVal; } break; @@ -599,63 +650,51 @@ sal_Bool OFlatTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols,sal *(_rRow->get())[i] = ORowSetValue(aStr); } break; - } + } // switch(nType) + (_rRow->get())[i]->setTypeKind(nType); } } return sal_True; } // ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- -sal_Bool OFlatTable::checkHeaderLine() -{ - if (m_nFilePos == 0 && ((OFlatConnection*)m_pConnection)->isHeaderLine()) - { - BOOL bRead2; - do - { - bRead2 = m_pFileStream->ReadByteStringLine(m_aCurrentLine,m_pConnection->getTextEncoding()); - } - while(bRead2 && !m_aCurrentLine.Len()); - - m_nFilePos = m_pFileStream->Tell(); - if (m_pFileStream->IsEof()) - return sal_False; - } - return sal_True; -} -//------------------------------------------------------------------ sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos) { - if ( !m_pFileStream ) - return sal_False; + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "flat", "Ocke.Janssen@sun.com", "OFlatTable::seekRow" ); + OSL_ENSURE(m_pFileStream,"OFlatTable::seekRow: FileStream is NULL!"); // ---------------------------------------------------------- // Positionierung vorbereiten: - m_nFilePos = nCurPos; switch(eCursorPosition) { case IResultSetHelper::FIRST: - m_nFilePos = 0; - m_nRowPos = 1; + m_nRowPos = 0; // run through case IResultSetHelper::NEXT: - if(eCursorPosition != IResultSetHelper::FIRST) - ++m_nRowPos; - m_pFileStream->Seek(m_nFilePos); - if (m_pFileStream->IsEof() || !checkHeaderLine()) { - m_nMaxRowCount = m_nRowPos; - return sal_False; - } - - m_aRowToFilePos.insert(::std::map<sal_Int32,sal_Int32>::value_type(m_nRowPos,m_nFilePos)); + ++m_nRowPos; + ::std::map<sal_Int32,TRowPositionsInFile::iterator>::const_iterator aFind = m_aRowPosToFilePos.find(m_nRowPos); + m_bNeedToReadLine = aFind != m_aRowPosToFilePos.end(); + if ( m_bNeedToReadLine ) + { + m_nFilePos = aFind->second->first; + nCurPos = aFind->second->second; + } // if ( m_bNeedToReadLine ) + else + { + if ( m_nRowPos == 1 ) + m_nFilePos = m_nStartRowFilePos; + m_pFileStream->Seek(m_nFilePos); + if ( m_pFileStream->IsEof() || !readLine(nCurPos) /*|| !checkHeaderLine()*/) + { + m_nMaxRowCount = m_nRowPos; + return sal_False; + } // if ( m_pFileStream->IsEof() || !readLine(nCurPos) /*|| !checkHeaderLine()*/) - if ( !readLine(nCurPos)) - { - m_nMaxRowCount = m_nRowPos; - return sal_False; + TRowPositionsInFile::iterator aPos = m_aFilePosToEndLinePos.insert(TRowPositionsInFile::value_type(m_nFilePos,nCurPos)).first; + m_aRowPosToFilePos.insert(::std::map<sal_Int32,TRowPositionsInFile::iterator>::value_type(m_nRowPos,aPos)); + } } break; @@ -663,28 +702,27 @@ sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int --m_nRowPos; if(m_nRowPos > 0) { - m_nFilePos = m_aRowToFilePos.find(m_nRowPos)->second; - m_pFileStream->Seek(m_nFilePos); - if (m_pFileStream->IsEof() || !checkHeaderLine()) - return sal_False; - if ( !readLine(nCurPos) ) - return sal_False; + TRowPositionsInFile::iterator aPositions = m_aRowPosToFilePos[m_nRowPos]; + m_nFilePos = aPositions->first; + nCurPos = aPositions->second; + m_bNeedToReadLine = true; } else m_nRowPos = 0; break; case IResultSetHelper::LAST: - if(m_nMaxRowCount) + if ( m_nMaxRowCount ) { - m_nFilePos = m_aRowToFilePos.rbegin()->second; - m_nRowPos = m_aRowToFilePos.rbegin()->first; - m_pFileStream->Seek(m_nFilePos); - if (m_pFileStream->IsEof() || !checkHeaderLine()) - return sal_False; - - if ( !readLine(nCurPos) ) - return sal_False; + ::std::map<sal_Int32,TRowPositionsInFile::iterator>::reverse_iterator aLastPos = m_aRowPosToFilePos.rbegin(); + m_nRowPos = aLastPos->first; + m_nFilePos = aLastPos->second->first; + nCurPos = aLastPos->second->second; + + //m_pFileStream->Seek(m_nFilePos); + m_bNeedToReadLine = true; + //if ( m_pFileStream->IsEof() /*|| !checkHeaderLine()*/ || !readLine(nCurPos) ) + // return sal_False; } else { @@ -709,15 +747,15 @@ sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int { if(nOffset < 0) nOffset = m_nRowPos + nOffset; - ::std::map<sal_Int32,sal_Int32>::const_iterator aIter = m_aRowToFilePos.find(nOffset); - if(aIter != m_aRowToFilePos.end()) + ::std::map<sal_Int32,TRowPositionsInFile::iterator>::const_iterator aIter = m_aRowPosToFilePos.find(nOffset); + if(aIter != m_aRowPosToFilePos.end()) { - m_nFilePos = aIter->second; - m_pFileStream->Seek(m_nFilePos); - if (m_pFileStream->IsEof() || !checkHeaderLine()) - return sal_False; - if ( !readLine(nCurPos) ) - return sal_False; + m_nFilePos = aIter->second->first; + nCurPos = aIter->second->second; + //m_pFileStream->Seek(m_nFilePos); + m_bNeedToReadLine = true; + //if ( m_pFileStream->IsEof() /*|| !checkHeaderLine()*/ || !readLine(nCurPos) ) + // return sal_False; } else if(m_nMaxRowCount && nOffset > m_nMaxRowCount) // offset is outside the table { @@ -726,11 +764,12 @@ sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int } else { - aIter = m_aRowToFilePos.upper_bound(nOffset); - if(aIter == m_aRowToFilePos.end()) + aIter = m_aRowPosToFilePos.upper_bound(nOffset); + if(aIter == m_aRowPosToFilePos.end()) { - m_nRowPos = m_aRowToFilePos.rbegin()->first; - nCurPos = m_nFilePos = m_aRowToFilePos.rbegin()->second; + ::std::map<sal_Int32,TRowPositionsInFile::iterator>::reverse_iterator aLastPos = m_aRowPosToFilePos.rbegin(); + m_nRowPos = aLastPos->first; + nCurPos = m_nFilePos = aLastPos->second->first; while(m_nRowPos != nOffset) seekRow(IResultSetHelper::NEXT,1,nCurPos); } @@ -738,48 +777,55 @@ sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int { --aIter; m_nRowPos = aIter->first; - m_nFilePos = aIter->second; - m_pFileStream->Seek(m_nFilePos); - if (m_pFileStream->IsEof() || !checkHeaderLine()) - return sal_False; - if ( !readLine(nCurPos) ) - return sal_False; + m_nFilePos = aIter->second->first; + nCurPos = aIter->second->second; + //m_pFileStream->Seek(m_nFilePos); + m_bNeedToReadLine = true; + //if ( m_pFileStream->IsEof() /*|| !checkHeaderLine()*/ || !readLine(nCurPos) ) + // return sal_False; } } } break; case IResultSetHelper::BOOKMARK: - m_pFileStream->Seek(nOffset); - if (m_pFileStream->IsEof()) - return sal_False; - - m_nFilePos = m_pFileStream->Tell(); // Byte-Position in der Datei merken (am ZeilenANFANG) - - if ( !readLine(nCurPos) ) - return sal_False; - break; + { + TRowPositionsInFile::const_iterator aFind = m_aFilePosToEndLinePos.find(nOffset); + m_bNeedToReadLine = aFind != m_aFilePosToEndLinePos.end(); + if ( m_bNeedToReadLine ) + nCurPos = aFind->second; + else + { + m_nFilePos = nOffset; + m_pFileStream->Seek(nOffset); + if (m_pFileStream->IsEof() || !readLine(nCurPos) ) + return sal_False; + } + break; + } } + //nCurPos = m_nFilePos; return sal_True; } // ----------------------------------------------------------------------------- sal_Bool OFlatTable::readLine(sal_Int32& _rnCurrentPos) { - m_pFileStream->ReadByteStringLine(m_aCurrentLine,m_pConnection->getTextEncoding()); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "flat", "Ocke.Janssen@sun.com", "OFlatTable::readLine" ); + const rtl_TextEncoding nEncoding = m_pConnection->getTextEncoding(); + m_pFileStream->ReadByteStringLine(m_aCurrentLine,nEncoding); if (m_pFileStream->IsEof()) return sal_False; - OFlatConnection* pConnection = static_cast<OFlatConnection*>(m_pConnection); - QuotedTokenizedString sLine = m_aCurrentLine; - while( (sLine.GetTokenCount(pConnection->getStringDelimiter()) % 2) != 1 ) + QuotedTokenizedString sLine = m_aCurrentLine; // check if the string continues on next line + while( (sLine.GetString().GetTokenCount(m_cStringDelimiter) % 2) != 1 ) { - m_pFileStream->ReadByteStringLine(sLine,m_pConnection->getTextEncoding()); + m_pFileStream->ReadByteStringLine(sLine,nEncoding); if ( !m_pFileStream->IsEof() ) { - m_aCurrentLine.Append('\n'); - m_aCurrentLine += sLine; + m_aCurrentLine.GetString().Append('\n'); + m_aCurrentLine.GetString() += sLine.GetString(); sLine = m_aCurrentLine; } else diff --git a/connectivity/source/drivers/jdbc/Array.cxx b/connectivity/source/drivers/jdbc/Array.cxx index 8a1b6e4290a0..ef5e5c681701 100644 --- a/connectivity/source/drivers/jdbc/Array.cxx +++ b/connectivity/source/drivers/jdbc/Array.cxx @@ -44,91 +44,43 @@ jclass java_sql_Array::theClass = 0; java_sql_Array::~java_sql_Array() {} -jclass java_sql_Array::getMyClass() +jclass java_sql_Array::getMyClass() const { // die Klasse muss nur einmal geholt werden, daher statisch - if( !theClass ){ - SDBThreadAttach t; - if( !t.pEnv ) return (jclass)NULL; - jclass tempClass = t.pEnv->FindClass( "java/sql/Array" ); - jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); - t.pEnv->DeleteLocalRef( tempClass ); - saveClassRef( globClass ); - } + if( !theClass ) + theClass = findMyClass("java/sql/Array"); + return theClass; } -void java_sql_Array::saveClassRef( jclass pClass ) -{ - if( pClass==NULL ) - return; - // der uebergebe Klassen-Handle ist schon global, daher einfach speichern - theClass = pClass; -} ::rtl::OUString SAL_CALL java_sql_Array::getBaseTypeName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - ::rtl::OUString aStr; - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/lang/String;"; - static const char * cMethodName = "getBaseTypeName"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); - if( mID ){ - jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID); - ThrowSQLException(t.pEnv,*this); - aStr = JavaString2String(t.pEnv,out); - // und aufraeumen - } //mID - } //t.pEnv - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! - return aStr; + static jmethodID mID(NULL); + return callStringMethod("getBaseTypeName",mID); } sal_Int32 SAL_CALL java_sql_Array::getBaseType( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { - jint out(0); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "()I"; - static const char * cMethodName = "getBaseType"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); - if( mID ){ - out = t.pEnv->CallIntMethod( object, mID ); - ThrowSQLException(t.pEnv,*this); - // und aufraeumen - } //mID - } //t.pEnv - return (sal_Int32)out; + static jmethodID mID(NULL); + return callIntMethod("getBaseType",mID); } ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL java_sql_Array::getArray( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { jobjectArray out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { jobject obj = convertTypeMapToJavaMap(t.pEnv,typeMap); static const char * cSignature = "(Ljava/util/Map;)[Ljava/lang/Object;"; static const char * cMethodName = "getArray"; + static jmethodID mID(NULL); + obtainMethodId(t.pEnv, cMethodName,cSignature, mID); // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); - if( mID ){ - out = (jobjectArray)t.pEnv->CallObjectMethod( object, mID, obj); - ThrowSQLException(t.pEnv,*this); - // und aufraeumen - t.pEnv->DeleteLocalRef(obj); - } //mID + out = (jobjectArray)t.pEnv->CallObjectMethod( object, mID, obj); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + t.pEnv->DeleteLocalRef(obj); } //t.pEnv return ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >();//copyArrayAndDelete< ::com::sun::star::uno::Any,jobject>(t.pEnv,out); } @@ -137,21 +89,18 @@ sal_Int32 SAL_CALL java_sql_Array::getBaseType( ) throw(::com::sun::star::sdbc: { jobjectArray out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { jobject obj = convertTypeMapToJavaMap(t.pEnv,typeMap); static const char * cSignature = "(IILjava/util/Map;)[Ljava/lang/Object;"; static const char * cMethodName = "getArray"; // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); - if( mID ){ - out = (jobjectArray)t.pEnv->CallObjectMethod( object, mID, index,count,obj); - ThrowSQLException(t.pEnv,*this); - // und aufraeumen - t.pEnv->DeleteLocalRef(obj); - } //mID + static jmethodID mID(NULL); + obtainMethodId(t.pEnv, cMethodName,cSignature, mID); + out = (jobjectArray)t.pEnv->CallObjectMethod( object, mID, index,count,obj); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + t.pEnv->DeleteLocalRef(obj); } //t.pEnv return ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >();//copyArrayAndDelete< ::com::sun::star::uno::Any,jobject>(t.pEnv,out); } @@ -160,22 +109,19 @@ sal_Int32 SAL_CALL java_sql_Array::getBaseType( ) throw(::com::sun::star::sdbc: { jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { // Parameter konvertieren jobject obj = convertTypeMapToJavaMap(t.pEnv,typeMap); // temporaere Variable initialisieren static const char * cSignature = "(Ljava/util/Map;)Ljava/sql/ResultSet;"; static const char * cMethodName = "getResultSet"; // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); - if( mID ){ - out = t.pEnv->CallObjectMethod( object, mID, obj); - ThrowSQLException(t.pEnv,*this); - // und aufraeumen - t.pEnv->DeleteLocalRef(obj); - } //mID + static jmethodID mID(NULL); + obtainMethodId(t.pEnv, cMethodName,cSignature, mID); + out = t.pEnv->CallObjectMethod( object, mID, obj); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + t.pEnv->DeleteLocalRef(obj); } //t.pEnv // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! // return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out ); @@ -186,22 +132,19 @@ sal_Int32 SAL_CALL java_sql_Array::getBaseType( ) throw(::com::sun::star::sdbc: { jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { // Parameter konvertieren jobject obj = convertTypeMapToJavaMap(t.pEnv,typeMap); // temporaere Variable initialisieren static const char * cSignature = "(Ljava/util/Map;)Ljava/sql/ResultSet;"; static const char * cMethodName = "getResultSetAtIndex"; // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); - if( mID ){ - out = t.pEnv->CallObjectMethod( object, mID, index,count,obj); - ThrowSQLException(t.pEnv,*this); - // und aufraeumen - t.pEnv->DeleteLocalRef(obj); - } //mID + static jmethodID mID(NULL); + obtainMethodId(t.pEnv, cMethodName,cSignature, mID); + out = t.pEnv->CallObjectMethod( object, mID, index,count,obj); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + t.pEnv->DeleteLocalRef(obj); } //t.pEnv // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! // return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out ); diff --git a/connectivity/source/drivers/jdbc/Blob.cxx b/connectivity/source/drivers/jdbc/Blob.cxx index b95c2e4ea0ba..364469399f2b 100644 --- a/connectivity/source/drivers/jdbc/Blob.cxx +++ b/connectivity/source/drivers/jdbc/Blob.cxx @@ -56,46 +56,28 @@ java_sql_Blob::~java_sql_Blob() SDBThreadAttach::releaseRef(); } -jclass java_sql_Blob::getMyClass() +jclass java_sql_Blob::getMyClass() const { // die Klasse muss nur einmal geholt werden, daher statisch - if( !theClass ){ - SDBThreadAttach t; - if( !t.pEnv ) return (jclass)NULL; - jclass tempClass = t.pEnv->FindClass( "java/sql/Blob" ); - jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); - t.pEnv->DeleteLocalRef( tempClass ); - saveClassRef( globClass ); - } + if( !theClass ) + theClass = findMyClass("java/sql/Blob"); return theClass; } -void java_sql_Blob::saveClassRef( jclass pClass ) -{ - if( pClass==NULL ) - return; - // der uebergebe Klassen-Handle ist schon global, daher einfach speichern - theClass = pClass; -} - sal_Int64 SAL_CALL java_sql_Blob::length( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { jlong out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { // temporaere Variable initialisieren static const char * cSignature = "()J"; static const char * cMethodName = "length"; // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallLongMethod( object, mID ); - ThrowSQLException(t.pEnv,*this); - // und aufraeumen - } //mID + static jmethodID mID(NULL); + obtainMethodId(t.pEnv, cMethodName,cSignature, mID); + out = t.pEnv->CallLongMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); } //t.pEnv return (sal_Int64)out; } @@ -104,26 +86,22 @@ sal_Int64 SAL_CALL java_sql_Blob::length( ) throw(::com::sun::star::sdbc::SQLEx SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); ::com::sun::star::uno::Sequence< sal_Int8 > aSeq; - if( t.pEnv ){ + { // temporaere Variable initialisieren static const char * cSignature = "(JI)[B"; static const char * cMethodName = "getBytes"; // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - jbyteArray out = (jbyteArray)t.pEnv->CallObjectMethod( object, mID,pos,count); - ThrowSQLException(t.pEnv,*this); - if(out) - { - jboolean p = sal_False; - aSeq.realloc(t.pEnv->GetArrayLength(out)); - memcpy(aSeq.getArray(),t.pEnv->GetByteArrayElements(out,&p),aSeq.getLength()); - t.pEnv->DeleteLocalRef(out); - } - // und aufraeumen - } //mID + static jmethodID mID(NULL); + obtainMethodId(t.pEnv, cMethodName,cSignature, mID); + jbyteArray out = (jbyteArray)t.pEnv->CallObjectMethod( object, mID,pos,count); + ThrowSQLException(t.pEnv,*this); + if(out) + { + jboolean p = sal_False; + aSeq.realloc(t.pEnv->GetArrayLength(out)); + memcpy(aSeq.getArray(),t.pEnv->GetByteArrayElements(out,&p),aSeq.getLength()); + t.pEnv->DeleteLocalRef(out); + } } //t.pEnv // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return aSeq; @@ -131,21 +109,9 @@ sal_Int64 SAL_CALL java_sql_Blob::length( ) throw(::com::sun::star::sdbc::SQLEx ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL java_sql_Blob::getBinaryStream( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { - jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "()Ljava/io/InputStream;"; - static const char * cMethodName = "getBinaryStream"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallObjectMethod( object, mID); - ThrowSQLException(t.pEnv,*this); - } //mID - } //t.pEnv + static jmethodID mID(NULL); + jobject out = callObjectMethod(t.pEnv,"getBinaryStream","()Ljava/io/InputStream;", mID); // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out==0 ? 0 : new java_io_InputStream( t.pEnv, out ); } @@ -154,24 +120,20 @@ sal_Int64 SAL_CALL java_sql_Blob::position( const ::com::sun::star::uno::Sequenc { jlong out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { // temporaere Variable initialisieren static const char * cSignature = "([BI)J"; static const char * cMethodName = "position"; // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - // Parameter konvertieren - jbyteArray pByteArray = t.pEnv->NewByteArray(pattern.getLength()); - t.pEnv->SetByteArrayRegion(pByteArray,0,pattern.getLength(),(jbyte*)pattern.getConstArray()); - out = t.pEnv->CallLongMethod( object, mID, pByteArray,start ); - t.pEnv->DeleteLocalRef(pByteArray); - ThrowSQLException(t.pEnv,*this); - // und aufraeumen - } //mID + static jmethodID mID(NULL); + obtainMethodId(t.pEnv, cMethodName,cSignature, mID); + // Parameter konvertieren + jbyteArray pByteArray = t.pEnv->NewByteArray(pattern.getLength()); + t.pEnv->SetByteArrayRegion(pByteArray,0,pattern.getLength(),(jbyte*)pattern.getConstArray()); + out = t.pEnv->CallLongMethod( object, mID, pByteArray,start ); + t.pEnv->DeleteLocalRef(pByteArray); + ThrowSQLException(t.pEnv,*this); } //t.pEnv return (sal_Int64)out; } diff --git a/connectivity/source/drivers/jdbc/Boolean.cxx b/connectivity/source/drivers/jdbc/Boolean.cxx index 5f396e40ccc6..cac868d4792f 100644 --- a/connectivity/source/drivers/jdbc/Boolean.cxx +++ b/connectivity/source/drivers/jdbc/Boolean.cxx @@ -41,43 +41,26 @@ jclass java_lang_Boolean::theClass = 0; java_lang_Boolean::~java_lang_Boolean() {} -jclass java_lang_Boolean::getMyClass() +jclass java_lang_Boolean::getMyClass() const { // die Klasse muss nur einmal geholt werden, daher statisch - if( !theClass ){ - SDBThreadAttach t; - if( !t.pEnv ) return (jclass)NULL; - jclass tempClass = t.pEnv->FindClass("java/lang/Boolean"); OSL_ENSURE(tempClass,"Java : FindClass nicht erfolgreich!"); - jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); - t.pEnv->DeleteLocalRef( tempClass ); - saveClassRef( globClass ); + if( !theClass ) + { + theClass = findMyClass("java/lang/Boolean"); } return theClass; } -void java_lang_Boolean::saveClassRef( jclass pClass ) +java_lang_Boolean::java_lang_Boolean( sal_Bool _par0 ): java_lang_Object( NULL, (jobject)NULL ) { - if( pClass==NULL ) - return; - // der uebergebe Klassen-Handle ist schon global, daher einfach speichern - theClass = pClass; -} - -java_lang_Boolean::java_lang_Boolean( sal_Bool _par0 ): java_lang_Object( NULL, (jobject)NULL ){ SDBThreadAttach t; - if( !t.pEnv ) - return; - jvalue args[1]; - // Parameter konvertieren - args[0].z = _par0; // Java-Call fuer den Konstruktor absetzen // temporaere Variable initialisieren static const char * cSignature = "(Z)V"; jobject tempObj; - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), "<init>", cSignature );OSL_ENSURE(mID,"Unknown method id!"); - tempObj = t.pEnv->NewObjectA( getMyClass(), mID, args ); + static jmethodID mID(NULL); + obtainMethodId(t.pEnv, "<init>",cSignature, mID); + tempObj = t.pEnv->NewObject( getMyClass(), mID, _par0 ); saveRef( t.pEnv, tempObj ); t.pEnv->DeleteLocalRef( tempObj ); // und aufraeumen diff --git a/connectivity/source/drivers/jdbc/CallableStatement.cxx b/connectivity/source/drivers/jdbc/CallableStatement.cxx index 921ba6704105..8cea582940d3 100644 --- a/connectivity/source/drivers/jdbc/CallableStatement.cxx +++ b/connectivity/source/drivers/jdbc/CallableStatement.cxx @@ -83,78 +83,22 @@ Any SAL_CALL java_sql_CallableStatement::queryInterface( const Type & rType ) th // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_CallableStatement::wasNull( ) throw(starsdbc::SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); - jboolean out(sal_False); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - - { - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "()Z"; - static const char * cMethodName = "wasNull"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallBooleanMethod( object, mID ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv - return out; + static jmethodID mID(NULL); + return callBooleanMethod( "wasNull", mID ); } sal_Bool SAL_CALL java_sql_CallableStatement::getBoolean( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); - jboolean out(sal_False); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - - { - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "(I)Z"; - static const char * cMethodName = "getBoolean"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallBooleanMethod( object, mID, columnIndex ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv - return out; + static jmethodID mID(NULL); + return callBooleanMethodWithIntArg( "getBoolean", mID,columnIndex ); } sal_Int8 SAL_CALL java_sql_CallableStatement::getByte( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); - jbyte out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - - { - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "(I)B"; - static const char * cMethodName = "getByte"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallByteMethod( object, mID, columnIndex); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv - return out; + createStatement(t.pEnv); + static jmethodID mID(NULL); + jbyte (JNIEnv::*pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallByteMethod; + return callMethodWithIntArg<jbyte>(pCallMethod,"getByte","(I)B",mID,columnIndex); } Sequence< sal_Int8 > SAL_CALL java_sql_CallableStatement::getBytes( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) { @@ -163,205 +107,78 @@ Sequence< sal_Int8 > SAL_CALL java_sql_CallableStatement::getBytes( sal_Int32 co Sequence< sal_Int8 > aSeq; SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + createStatement(t.pEnv); + static jmethodID mID(NULL); + jbyteArray out = (jbyteArray)callObjectMethodWithIntArg(t.pEnv,"getBytes","(I)[B", mID, columnIndex); + if (out) { - createStatement(t.pEnv); - static const char * cSignature = "(I)[B"; - static const char * cMethodName = "getBytes"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - jbyteArray out(0); - out = (jbyteArray)t.pEnv->CallObjectMethod( object, mID, columnIndex); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - if (out) - { - jboolean p = sal_False; - aSeq.realloc(t.pEnv->GetArrayLength(out)); - memcpy(aSeq.getArray(),t.pEnv->GetByteArrayElements(out,&p),aSeq.getLength()); - t.pEnv->DeleteLocalRef(out); - } - // und aufraeumen - } //mID - } //t.pEnv + jboolean p = sal_False; + aSeq.realloc(t.pEnv->GetArrayLength(out)); + memcpy(aSeq.getArray(),t.pEnv->GetByteArrayElements(out,&p),aSeq.getLength()); + t.pEnv->DeleteLocalRef(out); + } return aSeq; } ::com::sun::star::util::Date SAL_CALL java_sql_CallableStatement::getDate( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); - jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - - { - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/sql/Date;"; - static const char * cMethodName = "getDate"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallObjectMethod( object, mID, columnIndex ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + createStatement(t.pEnv); + static jmethodID mID(NULL); + jobject out = callObjectMethodWithIntArg(t.pEnv,"getDate","(I)Ljava/sql/Date;", mID, columnIndex); return out ? static_cast <com::sun::star::util::Date>(java_sql_Date( t.pEnv, out )) : ::com::sun::star::util::Date(); } double SAL_CALL java_sql_CallableStatement::getDouble( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); - jdouble out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - { - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "(I)D"; - static const char * cMethodName = "getDouble"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallDoubleMethod( object, mID, columnIndex); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv - return out; + createStatement(t.pEnv); + static jmethodID mID(NULL); + double (JNIEnv::*pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallDoubleMethod; + return callMethodWithIntArg<double>(pCallMethod,"getDouble","(I)D",mID,columnIndex); } float SAL_CALL java_sql_CallableStatement::getFloat( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); - jfloat out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - - { - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "(I)F"; - static const char * cMethodName = "getFloat"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallFloatMethod( object, mID, columnIndex ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv - return out; + createStatement(t.pEnv); + static jmethodID mID(NULL); + jfloat (JNIEnv::*pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallFloatMethod; + return callMethodWithIntArg<jfloat>(pCallMethod,"getFloat","(I)F",mID,columnIndex); } sal_Int32 SAL_CALL java_sql_CallableStatement::getInt( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); - jint out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - - { - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "(I)I"; - static const char * cMethodName = "getInt"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallIntMethod( object, mID, columnIndex ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv - return (sal_Int32)out; + createStatement(t.pEnv); + static jmethodID mID(NULL); + return callIntMethodWithIntArg("getInt",mID,columnIndex); } sal_Int64 SAL_CALL java_sql_CallableStatement::getLong( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); - jlong out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "(I)J"; - static const char * cMethodName = "getLong"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallLongMethod( object, mID, columnIndex ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv - return out; + createStatement(t.pEnv); + static jmethodID mID(NULL); + jlong (JNIEnv::*pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallLongMethod; + return callMethodWithIntArg<jlong>(pCallMethod,"getLong","(I)J",mID,columnIndex); } Any SAL_CALL java_sql_CallableStatement::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& /*typeMap*/ ) throw(starsdbc::SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); - jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/lang/Object;"; - static const char * cMethodName = "getObject"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallObjectMethod( object, mID, columnIndex); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv + createStatement(t.pEnv); + static jmethodID mID(NULL); + /*jobject out = */callObjectMethodWithIntArg(t.pEnv,"getObject","(I)Ljava/lang/Object;", mID, columnIndex); // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return Any(); //out==0 ? 0 : new java_lang_Object( t.pEnv, out ); } sal_Int16 SAL_CALL java_sql_CallableStatement::getShort( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); - jshort out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "(I)S"; - static const char * cMethodName = "getShort"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallShortMethod( object, mID, columnIndex); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv - return (sal_Int16)out; + createStatement(t.pEnv); + static jmethodID mID(NULL); + jshort (JNIEnv::*pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallShortMethod; + return callMethodWithIntArg<jshort>(pCallMethod,"getShort","(I)S",mID,columnIndex); } ::rtl::OUString SAL_CALL java_sql_CallableStatement::getString( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) @@ -369,74 +186,27 @@ sal_Int16 SAL_CALL java_sql_CallableStatement::getShort( sal_Int32 columnIndex ) ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - ::rtl::OUString aStr; - if( t.pEnv ){ - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/lang/String;"; - static const char * cMethodName = "getString"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, columnIndex ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - aStr = JavaString2String(t.pEnv,out); - // und aufraeumen - } //mID - } //t.pEnv - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! - return aStr; + createStatement(t.pEnv); + static jmethodID mID(NULL); + return callStringMethodWithIntArg("getString",mID,columnIndex); } ::com::sun::star::util::Time SAL_CALL java_sql_CallableStatement::getTime( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); - jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - - { - // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/sql/Time;"; - static const char * cMethodName = "getTime"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallObjectMethod( object, mID, columnIndex); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv + createStatement(t.pEnv); + static jmethodID mID(NULL); + jobject out = callObjectMethodWithIntArg(t.pEnv,"getTime","(I)Ljava/sql/Time;", mID, columnIndex); // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out ? static_cast <com::sun::star::util::Time> (java_sql_Time( t.pEnv, out )) : ::com::sun::star::util::Time(); } ::com::sun::star::util::DateTime SAL_CALL java_sql_CallableStatement::getTimestamp( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); - jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/sql/Timestamp;"; - static const char * cMethodName = "getTimestamp"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallObjectMethod( object, mID, columnIndex); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv + createStatement(t.pEnv); + static jmethodID mID(NULL); + jobject out = callObjectMethodWithIntArg(t.pEnv,"getTimestamp","(I)Ljava/sql/Timestamp;", mID, columnIndex); // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out ? static_cast <com::sun::star::util::DateTime> (java_sql_Timestamp( t.pEnv, out )) : ::com::sun::star::util::DateTime(); } @@ -446,7 +216,7 @@ void SAL_CALL java_sql_CallableStatement::registerOutParameter( sal_Int32 parame ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { createStatement(t.pEnv); @@ -454,17 +224,13 @@ void SAL_CALL java_sql_CallableStatement::registerOutParameter( sal_Int32 parame static const char * cSignature = "(IILjava/lang/String;)V"; static const char * cMethodName = "registerOutParameter"; // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) - { - // Parameter konvertieren - jstring str = convertwchar_tToJavaString(t.pEnv,typeName); - t.pEnv->CallVoidMethod( object, mID, parameterIndex,sqlType,str); - t.pEnv->DeleteLocalRef(str); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } + static jmethodID mID(NULL); + obtainMethodId(t.pEnv, cMethodName,cSignature, mID); + // Parameter konvertieren + jstring str = convertwchar_tToJavaString(t.pEnv,typeName); + t.pEnv->CallVoidMethod( object, mID, parameterIndex,sqlType,str); + t.pEnv->DeleteLocalRef(str); + ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); } } void SAL_CALL java_sql_CallableStatement::registerNumericOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) @@ -472,48 +238,30 @@ void SAL_CALL java_sql_CallableStatement::registerNumericOutParameter( sal_Int32 ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { createStatement(t.pEnv); // temporaere Variable initialisieren static const char * cSignature = "(III)V"; static const char * cMethodName = "registerOutParameter"; // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) - { - t.pEnv->CallVoidMethod( object, mID, parameterIndex,sqlType,scale); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } + static jmethodID mID(NULL); + obtainMethodId(t.pEnv, cMethodName,cSignature, mID); + t.pEnv->CallVoidMethod( object, mID, parameterIndex,sqlType,scale); + ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); } } jclass java_sql_CallableStatement::theClass = 0; -jclass java_sql_CallableStatement::getMyClass() +jclass java_sql_CallableStatement::getMyClass() const { // die Klasse muss nur einmal geholt werden, daher statisch - if( !theClass ){ - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( !t.pEnv ) return (jclass)0; - jclass tempClass = t.pEnv->FindClass("java/sql/CallableStatement"); OSL_ENSURE(tempClass,"Java : FindClass nicht erfolgreich!"); - jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); - t.pEnv->DeleteLocalRef( tempClass ); - saveClassRef( globClass ); - } + if( !theClass ) + theClass = findMyClass("java/sql/CallableStatement"); return theClass; } -void java_sql_CallableStatement::saveClassRef( jclass pClass ) -{ - if( pClass==0 ) - return; - // der uebergebe Klassen-Handle ist schon global, daher einfach speichern - theClass = pClass; -} - Reference< ::com::sun::star::io::XInputStream > SAL_CALL java_sql_CallableStatement::getBinaryStream( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) { Reference< starsdbc::XBlob > xBlob = getBlob(columnIndex); @@ -527,99 +275,39 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL java_sql_CallableStatem Reference< starsdbc::XArray > SAL_CALL java_sql_CallableStatement::getArray( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); - jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/sql/Array;"; - static const char * cMethodName = "getArray"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallObjectMethod( object, mID, columnIndex); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv + createStatement(t.pEnv); + static jmethodID mID(NULL); + jobject out = callObjectMethodWithIntArg(t.pEnv,"getArray","(I)Ljava/sql/Array;", mID, columnIndex); // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out==0 ? 0 : new java_sql_Array( t.pEnv, out ); } Reference< starsdbc::XClob > SAL_CALL java_sql_CallableStatement::getClob( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); - jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/sql/Clob;"; - static const char * cMethodName = "getClob"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallObjectMethod( object, mID, columnIndex); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv + createStatement(t.pEnv); + static jmethodID mID(NULL); + jobject out = callObjectMethodWithIntArg(t.pEnv,"getClob","(I)Ljava/sql/Clob;", mID, columnIndex); // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out==0 ? 0 : new java_sql_Clob( t.pEnv, out ); } Reference< starsdbc::XBlob > SAL_CALL java_sql_CallableStatement::getBlob( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); - jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/sql/Blob;"; - static const char * cMethodName = "getBlob"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallObjectMethod( object, mID, columnIndex); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv + createStatement(t.pEnv); + static jmethodID mID(NULL); + jobject out = callObjectMethodWithIntArg(t.pEnv,"getBlob","(I)Ljava/sql/Blob;", mID, columnIndex); // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out==0 ? 0 : new java_sql_Blob( t.pEnv, out ); } Reference< starsdbc::XRef > SAL_CALL java_sql_CallableStatement::getRef( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); - jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/sql/Ref;"; - static const char * cMethodName = "getRef"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallObjectMethod( object, mID, columnIndex); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv + createStatement(t.pEnv); + static jmethodID mID(NULL); + jobject out = callObjectMethodWithIntArg(t.pEnv,"getRef","(I)Ljava/sql/Ref;", mID, columnIndex); // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out==0 ? 0 : new java_sql_Ref( t.pEnv, out ); } @@ -650,7 +338,7 @@ void java_sql_CallableStatement::createStatement(JNIEnv* /*_pEnv*/) // Parameter konvertieren jstring str = convertwchar_tToJavaString(t.pEnv,m_sSqlStatement); - static jmethodID mID = NULL; + static jmethodID mID(NULL); if ( !mID ) mID = t.pEnv->GetMethodID( m_pConnection->getMyClass(), cMethodName, cSignature ); if( mID ){ diff --git a/connectivity/source/drivers/jdbc/Class.cxx b/connectivity/source/drivers/jdbc/Class.cxx index 6d233f710522..052cd0ef2736 100644 --- a/connectivity/source/drivers/jdbc/Class.cxx +++ b/connectivity/source/drivers/jdbc/Class.cxx @@ -44,33 +44,19 @@ jclass java_lang_Class::theClass = 0; java_lang_Class::~java_lang_Class() {} -jclass java_lang_Class::getMyClass() +jclass java_lang_Class::getMyClass() const { // die Klasse muss nur einmal geholt werden, daher statisch - if( !theClass ){ - SDBThreadAttach t; - if( !t.pEnv ) return (jclass)NULL; - jclass tempClass = t.pEnv->FindClass("java/lang/Class"); OSL_ENSURE(tempClass,"Java : FindClass nicht erfolgreich!"); - jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); - t.pEnv->DeleteLocalRef( tempClass ); - saveClassRef( globClass ); - } + if( !theClass ) + theClass = findMyClass("java/lang/Class"); return theClass; } -void java_lang_Class::saveClassRef( jclass pClass ) -{ - if( pClass==NULL ) - return; - // der uebergebe Klassen-Handle ist schon global, daher einfach speichern - theClass = pClass; -} - java_lang_Class * java_lang_Class::forName( const ::rtl::OUString& _par0 ) { jobject out(NULL); SDBThreadAttach t; - if( t.pEnv ) + { ::rtl::OString sClassName = ::rtl::OUStringToOString(_par0, RTL_TEXTENCODING_JAVA_UTF8); sClassName = sClassName.replace('.','/'); @@ -81,93 +67,10 @@ java_lang_Class * java_lang_Class::forName( const ::rtl::OUString& _par0 ) return out==0 ? NULL : new java_lang_Class( t.pEnv, out ); } -sal_Bool java_lang_Class::isAssignableFrom( java_lang_Class * _par0 ) -{ - jboolean out(0); - SDBThreadAttach t; - if( t.pEnv ){ - - // temporaere Variable initialisieren - static const char * cSignature = "(Ljava/lang/Class;)Z"; - static const char * cMethodName = "isAssignableFrom"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - jvalue args[1]; - // Parameter konvertieren - args[0].l = _par0 != NULL ? ((java_lang_Object *)_par0)->getJavaObject() : NULL; - out = t.pEnv->CallBooleanMethod( object, mID, args[0].l ); - ThrowSQLException(t.pEnv,0); - // und aufraeumen - } //mID - } //t.pEnv - return out; -} - -java_lang_Object * java_lang_Class::newInstance() -{ - jobject out(NULL); - SDBThreadAttach t; - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "()Ljava/lang/Object;"; - static const char * cMethodName = "newInstance"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallObjectMethod( object, mID); - ThrowSQLException(t.pEnv,0); - } //mID - } //t.pEnv - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! - return out==0 ? NULL : new java_lang_Object( t.pEnv, out ); -} - jobject java_lang_Class::newInstanceObject() { - jobject out(NULL); SDBThreadAttach t; - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "()Ljava/lang/Object;"; - static const char * cMethodName = "newInstance"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallObjectMethod( object, mID); - ThrowSQLException(t.pEnv,0); - } //mID - } //t.pEnv - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! - return out; -} - -::rtl::OUString java_lang_Class::getName() -{ - SDBThreadAttach t; - ::rtl::OUString aStr; - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "()Ljava/lang/String;"; - static const char * cMethodName = "getName"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID); - ThrowSQLException(t.pEnv,0); - aStr = JavaString2String(t.pEnv, (jstring)out ); - } //mID - } //t.pEnv - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! - return aStr; + static jmethodID mID(NULL); + return callObjectMethod(t.pEnv,"newInstance","()Ljava/lang/Object;", mID); } diff --git a/connectivity/source/drivers/jdbc/Clob.cxx b/connectivity/source/drivers/jdbc/Clob.cxx index 8396be5912f3..632504448e06 100644 --- a/connectivity/source/drivers/jdbc/Clob.cxx +++ b/connectivity/source/drivers/jdbc/Clob.cxx @@ -51,46 +51,28 @@ java_sql_Clob::~java_sql_Clob() SDBThreadAttach::releaseRef(); } -jclass java_sql_Clob::getMyClass() +jclass java_sql_Clob::getMyClass() const { // die Klasse muss nur einmal geholt werden, daher statisch - if( !theClass ){ - SDBThreadAttach t; - if( !t.pEnv ) return (jclass)NULL; - jclass tempClass = t.pEnv->FindClass( "java/sql/Clob" ); - jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); - t.pEnv->DeleteLocalRef( tempClass ); - saveClassRef( globClass ); - } + if( !theClass ) + theClass = findMyClass("java/sql/Clob"); return theClass; } -void java_sql_Clob::saveClassRef( jclass pClass ) -{ - if( pClass==NULL ) - return; - // der uebergebe Klassen-Handle ist schon global, daher einfach speichern - theClass = pClass; -} - sal_Int64 SAL_CALL java_sql_Clob::length( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { jlong out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { // temporaere Variable initialisieren static const char * cSignature = "()J"; static const char * cMethodName = "length"; // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallLongMethod( object, mID ); - ThrowSQLException(t.pEnv,*this); - // und aufraeumen - } //mID + static jmethodID mID(NULL); + obtainMethodId(t.pEnv, cMethodName,cSignature, mID); + out = t.pEnv->CallLongMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); } //t.pEnv return (sal_Int64)out; } @@ -99,20 +81,16 @@ sal_Int64 SAL_CALL java_sql_Clob::length( ) throw(::com::sun::star::sdbc::SQLEx { SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); ::rtl::OUString aStr; - if( t.pEnv ){ + { // temporaere Variable initialisieren static const char * cSignature = "(JI)Ljava/lang/String;"; static const char * cMethodName = "getSubString"; // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID,pos,subStringLength); - ThrowSQLException(t.pEnv,*this); - aStr = JavaString2String(t.pEnv,out); - // und aufraeumen - } //mID + static jmethodID mID(NULL); + obtainMethodId(t.pEnv, cMethodName,cSignature, mID); + jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID,pos,subStringLength); + ThrowSQLException(t.pEnv,*this); + aStr = JavaString2String(t.pEnv,out); } //t.pEnv // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return aStr; @@ -120,21 +98,10 @@ sal_Int64 SAL_CALL java_sql_Clob::length( ) throw(::com::sun::star::sdbc::SQLEx ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL java_sql_Clob::getCharacterStream( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { - jobject out(0); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "()Ljava/io/Reader;"; - static const char * cMethodName = "getCharacterStream"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallObjectMethod( object, mID); - ThrowSQLException(t.pEnv,*this); - } //mID - } //t.pEnv + SDBThreadAttach t; + static jmethodID mID(NULL); + jobject out = callObjectMethod(t.pEnv,"getCharacterStream","()Ljava/io/Reader;", mID); + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out==0 ? 0 : new java_io_Reader( t.pEnv, out ); } @@ -143,7 +110,7 @@ sal_Int64 SAL_CALL java_sql_Clob::position( const ::rtl::OUString& searchstr, sa { jlong out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { jvalue args[1]; // Parameter konvertieren @@ -152,15 +119,11 @@ sal_Int64 SAL_CALL java_sql_Clob::position( const ::rtl::OUString& searchstr, sa static const char * cSignature = "(Ljava/lang/String;I)J"; static const char * cMethodName = "position"; // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallLongMethod( object, mID, args[0].l,start ); - ThrowSQLException(t.pEnv,*this); - t.pEnv->DeleteLocalRef((jstring)args[0].l); - // und aufraeumen - } //mID + static jmethodID mID(NULL); + obtainMethodId(t.pEnv, cMethodName,cSignature, mID); + out = t.pEnv->CallLongMethod( object, mID, args[0].l,start ); + ThrowSQLException(t.pEnv,*this); + t.pEnv->DeleteLocalRef((jstring)args[0].l); } //t.pEnv return (sal_Int64)out; } diff --git a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx index 765c8a5e2ffb..0899f1566b51 100644 --- a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx +++ b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx @@ -62,17 +62,11 @@ java_sql_DatabaseMetaData::~java_sql_DatabaseMetaData() SDBThreadAttach::releaseRef(); } -jclass java_sql_DatabaseMetaData::getMyClass() +jclass java_sql_DatabaseMetaData::getMyClass() const { // die Klasse muss nur einmal geholt werden, daher statisch - if( !theClass ){ - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( !t.pEnv ) return (jclass)0; - jclass tempClass = t.pEnv->FindClass("java/sql/DatabaseMetaData"); OSL_ENSURE(tempClass,"Java : FindClass nicht erfolgreich!"); - jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); - t.pEnv->DeleteLocalRef( tempClass ); - saveClassRef( globClass ); - } + if( !theClass ) + theClass = findMyClass("java/sql/DatabaseMetaData"); return theClass; } // ----------------------------------------------------------------------------- @@ -86,49 +80,41 @@ java_sql_DatabaseMetaData::java_sql_DatabaseMetaData( JNIEnv * pEnv, jobject myO } // ------------------------------------------------------------------------- -void java_sql_DatabaseMetaData::saveClassRef( jclass pClass ) -{ - if( pClass==0 ) - return; - // der uebergebe Klassen-Handle ist schon global, daher einfach speichern - theClass = pClass; -} -// ------------------------------------------------------------------------- Reference< XResultSet > java_sql_DatabaseMetaData::impl_getTypeInfo_throw( ) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callResultSetMethod( "getTypeInfo", mID ); } // ------------------------------------------------------------------------- Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getCatalogs( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callResultSetMethod( "getCatalogs", mID ); } // ------------------------------------------------------------------------- ::rtl::OUString java_sql_DatabaseMetaData::impl_getCatalogSeparator_throw( ) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callStringMethod( "getCatalogSeparator", mID ); } // ------------------------------------------------------------------------- Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getSchemas( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callResultSetMethod( "getSchemas", mID ); } // ------------------------------------------------------------------------- Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getColumnPrivileges( const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callResultSetMethodWithStrings( "getColumnPrivileges", mID, catalog, schema, table, &columnNamePattern ); } // ------------------------------------------------------------------------- Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getColumns( const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callResultSetMethodWithStrings( "getColumns", mID, catalog, schemaPattern, tableNamePattern, &columnNamePattern ); } @@ -143,109 +129,100 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTables( jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) + static jmethodID mID(NULL); + obtainMethodId(t.pEnv, cMethodName,cSignature, mID); + OSL_VERIFY_RES( !isExceptionOccured(t.pEnv,sal_True),"Exception occured!"); + jvalue args[4]; + + args[3].l = 0; + sal_Int32 typeFilterCount = _types.getLength(); + if ( typeFilterCount ) { - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + jobjectArray pObjArray = static_cast< jobjectArray >( t.pEnv->NewObjectArray( (jsize)typeFilterCount, java_lang_String::getMyClass(), 0 ) ); OSL_VERIFY_RES( !isExceptionOccured( t.pEnv, sal_True ), "Exception occured!" ); - } - OSL_ENSURE( mID, "Unknown method id!" ); - if( mID ) - { - jvalue args[4]; - - args[3].l = 0; - sal_Int32 typeFilterCount = _types.getLength(); - if ( typeFilterCount ) + const ::rtl::OUString* typeFilter = _types.getConstArray(); + bool bIncludeAllTypes = false; + for ( sal_Int32 i=0; i<typeFilterCount; ++i, ++typeFilter ) { - jobjectArray pObjArray = static_cast< jobjectArray >( t.pEnv->NewObjectArray( (jsize)typeFilterCount, java_lang_String::getMyClass(), 0 ) ); - OSL_VERIFY_RES( !isExceptionOccured( t.pEnv, sal_True ), "Exception occured!" ); - - const ::rtl::OUString* typeFilter = _types.getConstArray(); - bool bIncludeAllTypes = false; - for ( sal_Int32 i=0; i<typeFilterCount; ++i, ++typeFilter ) - { - if ( typeFilter->equalsAsciiL( "%", 1 ) ) - { - bIncludeAllTypes = true; - break; - } - jstring aT = convertwchar_tToJavaString( t.pEnv, *typeFilter ); - t.pEnv->SetObjectArrayElement( pObjArray, (jsize)i, aT ); - OSL_VERIFY_RES( !isExceptionOccured( t.pEnv, sal_True ), "Exception occured!" ); - } - - if ( bIncludeAllTypes ) - { - // the SDBC API allows to pass "%" as table type filter, but in JDBC, "all table types" - // is represented by the table type being <null/> - t.pEnv->DeleteLocalRef( pObjArray ); - OSL_VERIFY_RES( !isExceptionOccured( t.pEnv, sal_True ), "Exception occured!" ); - } - else + if ( typeFilter->equalsAsciiL( "%", 1 ) ) { - args[3].l = pObjArray; + bIncludeAllTypes = true; + break; } - } - - // if we are to display "all catalogs", then respect m_aCatalogRestriction - Any aCatalogFilter( catalog ); - if ( !aCatalogFilter.hasValue() ) - aCatalogFilter = m_pConnection->getCatalogRestriction(); - // similar for schema - Any aSchemaFilter; - if ( schemaPattern.equalsAsciiL( "%", 1 ) ) - aSchemaFilter = m_pConnection->getSchemaRestriction(); - else - aSchemaFilter <<= schemaPattern; - - args[0].l = aCatalogFilter.hasValue() ? convertwchar_tToJavaString( t.pEnv, ::comphelper::getString( aCatalogFilter ) ) : NULL; - args[1].l = aSchemaFilter.hasValue() ? convertwchar_tToJavaString( t.pEnv, ::comphelper::getString( aSchemaFilter ) ) : NULL; - args[2].l = convertwchar_tToJavaString(t.pEnv,tableNamePattern); - out = t.pEnv->CallObjectMethod( object, mID, args[0].l, args[1].l,args[2].l,args[3].l); - jthrowable jThrow = t.pEnv->ExceptionOccurred(); - if ( jThrow ) - t.pEnv->ExceptionClear();// we have to clear the exception here because we want to handle it below - - if ( aCatalogFilter.hasValue() ) - { - t.pEnv->DeleteLocalRef((jstring)args[0].l); - OSL_VERIFY_RES( !isExceptionOccured( t.pEnv, sal_True ), "Exception occured!" ); - } - if(args[1].l) - { - t.pEnv->DeleteLocalRef((jstring)args[1].l); + jstring aT = convertwchar_tToJavaString( t.pEnv, *typeFilter ); + t.pEnv->SetObjectArrayElement( pObjArray, (jsize)i, aT ); OSL_VERIFY_RES( !isExceptionOccured( t.pEnv, sal_True ), "Exception occured!" ); } - if(tableNamePattern.getLength()) + + if ( bIncludeAllTypes ) { - t.pEnv->DeleteLocalRef((jstring)args[2].l); + // the SDBC API allows to pass "%" as table type filter, but in JDBC, "all table types" + // is represented by the table type being <null/> + t.pEnv->DeleteLocalRef( pObjArray ); OSL_VERIFY_RES( !isExceptionOccured( t.pEnv, sal_True ), "Exception occured!" ); } - //for(INT16 i=0;i<len;i++) - if ( args[3].l ) + else { - t.pEnv->DeleteLocalRef( (jobjectArray)args[3].l ); - OSL_VERIFY_RES( !isExceptionOccured( t.pEnv, sal_True ), "Exception occured!" ); + args[3].l = pObjArray; } + } - if ( jThrow ) + // if we are to display "all catalogs", then respect m_aCatalogRestriction + Any aCatalogFilter( catalog ); + if ( !aCatalogFilter.hasValue() ) + aCatalogFilter = m_pConnection->getCatalogRestriction(); + // similar for schema + Any aSchemaFilter; + if ( schemaPattern.equalsAsciiL( "%", 1 ) ) + aSchemaFilter = m_pConnection->getSchemaRestriction(); + else + aSchemaFilter <<= schemaPattern; + + args[0].l = aCatalogFilter.hasValue() ? convertwchar_tToJavaString( t.pEnv, ::comphelper::getString( aCatalogFilter ) ) : NULL; + args[1].l = aSchemaFilter.hasValue() ? convertwchar_tToJavaString( t.pEnv, ::comphelper::getString( aSchemaFilter ) ) : NULL; + args[2].l = convertwchar_tToJavaString(t.pEnv,tableNamePattern); + out = t.pEnv->CallObjectMethod( object, mID, args[0].l, args[1].l,args[2].l,args[3].l); + jthrowable jThrow = t.pEnv->ExceptionOccurred(); + if ( jThrow ) + t.pEnv->ExceptionClear();// we have to clear the exception here because we want to handle it below + if ( aCatalogFilter.hasValue() ) + { + t.pEnv->DeleteLocalRef((jstring)args[0].l); + OSL_VERIFY_RES( !isExceptionOccured( t.pEnv, sal_True ), "Exception occured!" ); + } + if(args[1].l) + { + t.pEnv->DeleteLocalRef((jstring)args[1].l); + OSL_VERIFY_RES( !isExceptionOccured( t.pEnv, sal_True ), "Exception occured!" ); + } + if(tableNamePattern.getLength()) + { + t.pEnv->DeleteLocalRef((jstring)args[2].l); + OSL_VERIFY_RES( !isExceptionOccured( t.pEnv, sal_True ), "Exception occured!" ); + } + //for(INT16 i=0;i<len;i++) + if ( args[3].l ) + { + t.pEnv->DeleteLocalRef( (jobjectArray)args[3].l ); + OSL_VERIFY_RES( !isExceptionOccured( t.pEnv, sal_True ), "Exception occured!" ); + } + + if ( jThrow ) + { + if ( t.pEnv->IsInstanceOf( jThrow,java_sql_SQLException_BASE::getMyClass() ) ) { - if ( t.pEnv->IsInstanceOf( jThrow,java_sql_SQLException_BASE::getMyClass() ) ) - { - java_sql_SQLException_BASE* pException = new java_sql_SQLException_BASE( t.pEnv, jThrow ); - SQLException e( pException->getMessage(), - *this, - pException->getSQLState(), - pException->getErrorCode(), - Any() - ); - delete pException; - throw e; - } + java_sql_SQLException_BASE* pException = new java_sql_SQLException_BASE( t.pEnv, jThrow ); + SQLException e( pException->getMessage(), + *this, + pException->getSQLState(), + pException->getErrorCode(), + Any() + ); + delete pException; + throw e; } } } @@ -260,114 +237,114 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTables( Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getProcedureColumns( const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern, const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callResultSetMethodWithStrings( "getProcedureColumns", mID, catalog, schemaPattern, procedureNamePattern, &columnNamePattern ); } // ------------------------------------------------------------------------- Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getProcedures( const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callResultSetMethodWithStrings( "getProcedures", mID, catalog, schemaPattern, procedureNamePattern ); } // ------------------------------------------------------------------------- Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getVersionColumns( const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callResultSetMethodWithStrings( "getVersionColumns", mID, catalog, schema, table ); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callIntMethod( "getMaxBinaryLiteralLength", mID ); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxRowSize( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callIntMethod( "getMaxRowSize", mID ); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxCatalogNameLength( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callIntMethod( "getMaxCatalogNameLength", mID ); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callIntMethod( "getMaxCharLiteralLength", mID ); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callIntMethod( "getMaxColumnNameLength", mID ); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callIntMethod( "getMaxColumnsInIndex", mID ); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxCursorNameLength( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callIntMethod( "getMaxCursorNameLength", mID ); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxConnections( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callIntMethod( "getMaxConnections", mID ); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callIntMethod( "getMaxColumnsInTable", mID ); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxStatementLength( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callIntMethod( "getMaxStatementLength", mID ); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxTableNameLength( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callIntMethod( "getMaxTableNameLength", mID ); } // ------------------------------------------------------------------------- sal_Int32 java_sql_DatabaseMetaData::impl_getMaxTablesInSelect_throw( ) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callIntMethod( "getMaxTablesInSelect", mID ); } // ------------------------------------------------------------------------- Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getExportedKeys( const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callResultSetMethodWithStrings( "getExportedKeys", mID, catalog, schema, table ); } // ------------------------------------------------------------------------- Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getImportedKeys( const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callResultSetMethodWithStrings( "getImportedKeys", mID, catalog, schema, table ); } // ------------------------------------------------------------------------- Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getPrimaryKeys( const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callResultSetMethodWithStrings( "getPrimaryKeys", mID, catalog, schema, table ); } // ------------------------------------------------------------------------- @@ -382,31 +359,28 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getIndexInfo( jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - jvalue args[5]; - // Parameter konvertieren - args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(catalog)) : 0; - args[1].l = schema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schema); - args[2].l = convertwchar_tToJavaString(t.pEnv,table); - args[3].z = unique; - args[4].z = approximate; - out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[1].l,args[2].l,args[3].z,args[4].z ); - - // und aufraeumen - if(catalog.hasValue()) - t.pEnv->DeleteLocalRef((jstring)args[0].l); - if(args[1].l) - t.pEnv->DeleteLocalRef((jstring)args[1].l); - if(table.getLength()) - t.pEnv->DeleteLocalRef((jstring)args[2].l); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } + static jmethodID mID(NULL); + obtainMethodId(t.pEnv, cMethodName,cSignature, mID); + jvalue args[5]; + // Parameter konvertieren + args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(catalog)) : 0; + args[1].l = schema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schema); + args[2].l = convertwchar_tToJavaString(t.pEnv,table); + args[3].z = unique; + args[4].z = approximate; + out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[1].l,args[2].l,args[3].z,args[4].z ); + + // und aufraeumen + if(catalog.hasValue()) + t.pEnv->DeleteLocalRef((jstring)args[0].l); + if(args[1].l) + t.pEnv->DeleteLocalRef((jstring)args[1].l); + if(table.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[2].l); + ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); } if ( !out ) return NULL; @@ -426,29 +400,26 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getBestRowIdentifier jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - jvalue args[3]; - // Parameter konvertieren - args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(catalog)) : 0; - args[1].l = schema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schema); - args[2].l = convertwchar_tToJavaString(t.pEnv,table); - out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[1].l,args[2].l,scope,nullable); - - // und aufraeumen - if(catalog.hasValue()) - t.pEnv->DeleteLocalRef((jstring)args[0].l); - if(args[1].l) - t.pEnv->DeleteLocalRef((jstring)args[1].l); - if(table.getLength()) - t.pEnv->DeleteLocalRef((jstring)args[2].l); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } + static jmethodID mID(NULL); + obtainMethodId(t.pEnv, cMethodName,cSignature, mID); + jvalue args[3]; + // Parameter konvertieren + args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(catalog)) : 0; + args[1].l = schema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schema); + args[2].l = convertwchar_tToJavaString(t.pEnv,table); + out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[1].l,args[2].l,scope,nullable); + + // und aufraeumen + if(catalog.hasValue()) + t.pEnv->DeleteLocalRef((jstring)args[0].l); + if(args[1].l) + t.pEnv->DeleteLocalRef((jstring)args[1].l); + if(table.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[2].l); + ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); } if ( !out ) @@ -464,7 +435,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTablePrivileges( if ( m_pConnection->isIgnoreDriverPrivilegesEnabled() ) return new OResultSetPrivileges(this,catalog,schemaPattern,tableNamePattern); - static jmethodID mID = NULL; + static jmethodID mID(NULL); Reference< XResultSet > xReturn( impl_callResultSetMethodWithStrings( "getTablePrivileges", mID, catalog, schemaPattern, tableNamePattern ) ); if ( xReturn.is() ) @@ -546,38 +517,35 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getCrossReference( jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - jvalue args[6]; - // Parameter konvertieren - args[0].l = primaryCatalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(primaryCatalog)) : 0; - args[1].l = primarySchema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,primarySchema); - args[2].l = convertwchar_tToJavaString(t.pEnv,primaryTable); - args[3].l = foreignCatalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(foreignCatalog)) : 0; - args[4].l = foreignSchema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,foreignSchema); - args[5].l = convertwchar_tToJavaString(t.pEnv,foreignTable); - out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[2].l,args[2].l,args[3].l,args[4].l,args[5].l ); - - // und aufraeumen - if(primaryCatalog.hasValue()) - t.pEnv->DeleteLocalRef((jstring)args[0].l); - if(args[1].l) - t.pEnv->DeleteLocalRef((jstring)args[1].l); - if(primaryTable.getLength()) - t.pEnv->DeleteLocalRef((jstring)args[2].l); - if(foreignCatalog.hasValue()) - t.pEnv->DeleteLocalRef((jstring)args[3].l); - if(args[4].l) - t.pEnv->DeleteLocalRef((jstring)args[4].l); - if(foreignTable.getLength()) - t.pEnv->DeleteLocalRef((jstring)args[5].l); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } + static jmethodID mID(NULL); + obtainMethodId(t.pEnv, cMethodName,cSignature, mID); + jvalue args[6]; + // Parameter konvertieren + args[0].l = primaryCatalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(primaryCatalog)) : 0; + args[1].l = primarySchema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,primarySchema); + args[2].l = convertwchar_tToJavaString(t.pEnv,primaryTable); + args[3].l = foreignCatalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(foreignCatalog)) : 0; + args[4].l = foreignSchema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,foreignSchema); + args[5].l = convertwchar_tToJavaString(t.pEnv,foreignTable); + out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[2].l,args[2].l,args[3].l,args[4].l,args[5].l ); + + // und aufraeumen + if(primaryCatalog.hasValue()) + t.pEnv->DeleteLocalRef((jstring)args[0].l); + if(args[1].l) + t.pEnv->DeleteLocalRef((jstring)args[1].l); + if(primaryTable.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[2].l); + if(foreignCatalog.hasValue()) + t.pEnv->DeleteLocalRef((jstring)args[3].l); + if(args[4].l) + t.pEnv->DeleteLocalRef((jstring)args[4].l); + if(foreignTable.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[5].l); + ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); } if ( !out ) @@ -591,26 +559,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getCrossReference( sal_Bool java_sql_DatabaseMetaData::impl_callBooleanMethod( const char* _pMethodName, jmethodID& _inout_MethodID ) { m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD, _pMethodName ); - - jboolean out( sal_False ); - - SDBThreadAttach t; - OSL_ENSURE( t.pEnv, "java_sql_DatabaseMetaData::impl_callBooleanMethod: no Java enviroment anymore!" ); - if ( t.pEnv ) - { - // obtain method ID - if ( !_inout_MethodID ) - _inout_MethodID = t.pEnv->GetMethodID( getMyClass(), _pMethodName, "()Z" ); - OSL_ENSURE( _inout_MethodID, "java_sql_DatabaseMetaData::impl_callBooleanMethod:: unknown method id!" ); - - // call method - if ( _inout_MethodID ) - { - out = t.pEnv->CallBooleanMethod( object, _inout_MethodID ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } - } - + jboolean out( java_lang_Object::callBooleanMethod(_pMethodName,_inout_MethodID) ); m_aLogger.log< const sal_Char*, sal_Int16>( LogLevel::FINEST, STR_LOG_META_DATA_RESULT, _pMethodName, out ); return out; } @@ -620,26 +569,7 @@ sal_Bool java_sql_DatabaseMetaData::impl_callBooleanMethod( const char* _pMethod { m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD, _pMethodName ); - ::rtl::OUString sReturn; - - SDBThreadAttach t; - OSL_ENSURE( t.pEnv, "java_sql_DatabaseMetaData::impl_callStringMethod: no Java enviroment anymore!" ); - if( t.pEnv ) - { - // obtain method ID - if ( !_inout_MethodID ) - _inout_MethodID = t.pEnv->GetMethodID( getMyClass(), _pMethodName, "()Ljava/lang/String;" ); - OSL_ENSURE( _inout_MethodID, "java_sql_DatabaseMetaData::impl_callStringMethod: unknown method id!" ); - - // call method - if ( _inout_MethodID ) - { - jstring out = (jstring)t.pEnv->CallObjectMethod( object, _inout_MethodID ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - sReturn = JavaString2String( t.pEnv, out ); - } - } - + const ::rtl::OUString sReturn( callStringMethod(_pMethodName,_inout_MethodID) ); if ( m_aLogger.isLoggable( LogLevel::FINEST ) ) { ::rtl::OUString sLoggedResult( sReturn ); @@ -655,28 +585,9 @@ sal_Bool java_sql_DatabaseMetaData::impl_callBooleanMethod( const char* _pMethod sal_Int32 java_sql_DatabaseMetaData::impl_callIntMethod( const char* _pMethodName, jmethodID& _inout_MethodID ) { m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD, _pMethodName ); - - jint out( 0 ); - - SDBThreadAttach t; - OSL_ENSURE( t.pEnv, "java_sql_DatabaseMetaData::impl_callIntMethod: no Java enviroment anymore!" ); - if( t.pEnv ) - { - // obtain method ID - if ( !_inout_MethodID ) - _inout_MethodID = t.pEnv->GetMethodID( getMyClass(), _pMethodName, "()I" ); - OSL_ENSURE( _inout_MethodID, "java_sql_DatabaseMetaData::impl_callIntMethod: unknown method id!" ); - - // call method - if ( _inout_MethodID ) - { - out = t.pEnv->CallIntMethod( object, _inout_MethodID ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } - } - + sal_Int32 out( (sal_Int32)callIntMethod(_pMethodName,_inout_MethodID) ); m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_RESULT, _pMethodName, (sal_Int32)out ); - return (sal_Int32)out; + return out; } // ------------------------------------------------------------------------- @@ -684,23 +595,7 @@ sal_Bool java_sql_DatabaseMetaData::impl_callBooleanMethodWithIntArg( const char { m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD_ARG1, _pMethodName, _nArgument ); - jboolean out( sal_False ); - SDBThreadAttach t; - OSL_ENSURE( t.pEnv, "java_sql_DatabaseMetaData::impl_callBooleanMethodWithIntArg: no Java enviroment anymore!" ); - if ( t.pEnv ) - { - // obtain method ID - if ( !_inout_MethodID ) - _inout_MethodID = t.pEnv->GetMethodID( getMyClass(), _pMethodName, "(I)Z" ); - OSL_ENSURE( _inout_MethodID, "java_sql_DatabaseMetaData::impl_callBooleanMethodWithIntArg: unknown method id!" ); - - // call method - if ( _inout_MethodID ) - { - out = t.pEnv->CallBooleanMethod( object, _inout_MethodID, _nArgument ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } - } + jboolean out( callBooleanMethodWithIntArg(_pMethodName,_inout_MethodID,_nArgument) ); m_aLogger.log< const sal_Char*, sal_Int16 >( LogLevel::FINEST, STR_LOG_META_DATA_RESULT, _pMethodName, out ); return out; @@ -709,30 +604,9 @@ sal_Bool java_sql_DatabaseMetaData::impl_callBooleanMethodWithIntArg( const char // ------------------------------------------------------------------------- Reference< XResultSet > java_sql_DatabaseMetaData::impl_callResultSetMethod( const char* _pMethodName, jmethodID& _inout_MethodID ) { - m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD, _pMethodName ); - - jobject out(0); - SDBThreadAttach t; - OSL_ENSURE( t.pEnv, "java_sql_DatabaseMetaData::impl_callResultSetMethod: no Java enviroment anymore!" ); - if ( t.pEnv ) - { - // obtain method ID - if ( !_inout_MethodID ) - _inout_MethodID = t.pEnv->GetMethodID( getMyClass(), _pMethodName, "()Ljava/sql/ResultSet;" ); - OSL_ENSURE( _inout_MethodID, "java_sql_DatabaseMetaData::impl_callResultSetMethod: unknown method id!" ); - - // call method - if ( _inout_MethodID ) - { - out = t.pEnv->CallObjectMethod( object, _inout_MethodID ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } - } - - if ( !out ) - return NULL; - + m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD, _pMethodName ); + jobject out(callResultSetMethod(t.env(),_pMethodName,_inout_MethodID)); m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_SUCCESS, _pMethodName ); return new java_sql_ResultSet( t.pEnv, out, m_aLogger,*m_pConnection); } @@ -762,18 +636,16 @@ Reference< XResultSet > java_sql_DatabaseMetaData::impl_callResultSetMethodWithS SDBThreadAttach t; OSL_ENSURE( t.pEnv, "java_sql_DatabaseMetaData::impl_callResultSetMethodWithStrings: no Java enviroment anymore!" ); - if ( t.pEnv ) + { const char* pSignature = _pOptionalAdditionalString ? "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;" : "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;"; // obtain method ID - if ( !_inout_MethodID ) - _inout_MethodID = t.pEnv->GetMethodID( getMyClass(), _pMethodName, pSignature ); - OSL_ENSURE( _inout_MethodID, "java_sql_DatabaseMetaData::impl_callResultSetMethodWithStrings: unknown method id!" ); + obtainMethodId(t.pEnv, _pMethodName,pSignature, _inout_MethodID); // call method - if ( _inout_MethodID ) + { jvalue args[4]; // convert parameters @@ -812,320 +684,320 @@ Reference< XResultSet > java_sql_DatabaseMetaData::impl_callResultSetMethodWithS // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "doesMaxRowSizeIncludeBlobs", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::storesLowerCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "storesLowerCaseQuotedIdentifiers", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::storesLowerCaseIdentifiers( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "storesLowerCaseIdentifiers", mID ); } // ------------------------------------------------------------------------- sal_Bool java_sql_DatabaseMetaData::impl_storesMixedCaseQuotedIdentifiers_throw( ) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "storesMixedCaseQuotedIdentifiers", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::storesMixedCaseIdentifiers( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "storesMixedCaseIdentifiers", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::storesUpperCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "storesUpperCaseQuotedIdentifiers", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::storesUpperCaseIdentifiers( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "storesUpperCaseIdentifiers", mID ); } // ------------------------------------------------------------------------- sal_Bool java_sql_DatabaseMetaData::impl_supportsAlterTableWithAddColumn_throw( ) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsAlterTableWithAddColumn", mID ); } // ------------------------------------------------------------------------- sal_Bool java_sql_DatabaseMetaData::impl_supportsAlterTableWithDropColumn_throw( ) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsAlterTableWithDropColumn", mID ); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxIndexLength( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callIntMethod( "getMaxIndexLength", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsNonNullableColumns( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsNonNullableColumns", mID ); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getCatalogTerm( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callStringMethod( "getCatalogTerm", mID ); } // ------------------------------------------------------------------------- ::rtl::OUString java_sql_DatabaseMetaData::impl_getIdentifierQuoteString_throw( ) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callStringMethod( "getIdentifierQuoteString", mID ); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getExtraNameCharacters( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callStringMethod( "getExtraNameCharacters", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsDifferentTableCorrelationNames( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsDifferentTableCorrelationNames", mID ); } // ------------------------------------------------------------------------- sal_Bool java_sql_DatabaseMetaData::impl_isCatalogAtStart_throw( ) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "isCatalogAtStart", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "dataDefinitionIgnoredInTransactions", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "dataDefinitionCausesTransactionCommit", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsDataManipulationTransactionsOnly", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsDataDefinitionAndDataManipulationTransactions", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsPositionedDelete( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsPositionedDelete", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsPositionedUpdate( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsPositionedUpdate", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsOpenStatementsAcrossRollback( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsOpenStatementsAcrossRollback", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsOpenStatementsAcrossCommit( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsOpenStatementsAcrossCommit", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsOpenCursorsAcrossCommit( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsOpenCursorsAcrossCommit", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsOpenCursorsAcrossRollback( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsOpenCursorsAcrossRollback", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 level ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethodWithIntArg( "supportsTransactionIsolationLevel", mID, level ); } // ------------------------------------------------------------------------- sal_Bool java_sql_DatabaseMetaData::impl_supportsSchemasInDataManipulation_throw( ) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsSchemasInDataManipulation", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsANSI92FullSQL", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsANSI92EntryLevelSQL( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsANSI92EntryLevelSQL", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsIntegrityEnhancementFacility", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsSchemasInIndexDefinitions", mID ); } // ------------------------------------------------------------------------- sal_Bool java_sql_DatabaseMetaData::impl_supportsSchemasInTableDefinitions_throw( ) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsSchemasInTableDefinitions", mID ); } // ------------------------------------------------------------------------- sal_Bool java_sql_DatabaseMetaData::impl_supportsCatalogsInTableDefinitions_throw( ) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsCatalogsInTableDefinitions", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsCatalogsInIndexDefinitions( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsCatalogsInIndexDefinitions", mID ); } // ------------------------------------------------------------------------- sal_Bool java_sql_DatabaseMetaData::impl_supportsCatalogsInDataManipulation_throw( ) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsCatalogsInDataManipulation", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsOuterJoins( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsOuterJoins", mID ); } // ------------------------------------------------------------------------- Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTableTypes( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callResultSetMethod( "getTableTypes", mID ); } // ------------------------------------------------------------------------- sal_Int32 java_sql_DatabaseMetaData::impl_getMaxStatements_throw( ) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callIntMethod( "getMaxStatements", mID ); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxProcedureNameLength( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callIntMethod( "getMaxProcedureNameLength", mID ); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxSchemaNameLength( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callIntMethod( "getMaxSchemaNameLength", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsTransactions( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsTransactions", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::allProceduresAreCallable( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "allProceduresAreCallable", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsStoredProcedures( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsStoredProcedures", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSelectForUpdate( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsSelectForUpdate", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::allTablesAreSelectable( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "allTablesAreSelectable", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::isReadOnly( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "isReadOnly", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::usesLocalFiles( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "usesLocalFiles", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::usesLocalFilePerTable( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "usesLocalFilePerTable", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsTypeConversion( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsTypeConversion", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::nullPlusNonNullIsNull( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "nullPlusNonNullIsNull", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsColumnAliasing( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsColumnAliasing", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsTableCorrelationNames( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsTableCorrelationNames", mID ); } // ------------------------------------------------------------------------- @@ -1136,18 +1008,12 @@ sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsConvert( sal_Int32 fromType jboolean out( sal_False ); SDBThreadAttach t; - if ( t.pEnv ) - { - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), pMethodName, "(II)Z" ); - OSL_ENSURE( mID, "java_sql_DatabaseMetaData::supportsConvert: unknown method id!" ); - if ( mID ) - { - out = t.pEnv->CallBooleanMethod( object, mID, fromType, toType ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } + { + static jmethodID mID(NULL); + obtainMethodId(t.pEnv, pMethodName,"(II)Z", mID); + out = t.pEnv->CallBooleanMethod( object, mID, fromType, toType ); + ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); } m_aLogger.log< const sal_Char*, sal_Int16 >( LogLevel::FINEST, STR_LOG_META_DATA_RESULT, pMethodName, out ); @@ -1156,157 +1022,157 @@ sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsConvert( sal_Int32 fromType // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsExpressionsInOrderBy( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsExpressionsInOrderBy", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsGroupBy( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsGroupBy", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsGroupByBeyondSelect( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsGroupByBeyondSelect", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsGroupByUnrelated( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsGroupByUnrelated", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsMultipleTransactions( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsMultipleTransactions", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsMultipleResultSets( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsMultipleResultSets", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsLikeEscapeClause( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsLikeEscapeClause", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsOrderByUnrelated( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsOrderByUnrelated", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsUnion( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsUnion", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsUnionAll( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsUnionAll", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsMixedCaseIdentifiers( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsMixedCaseIdentifiers", mID ); } // ------------------------------------------------------------------------- sal_Bool java_sql_DatabaseMetaData::impl_supportsMixedCaseQuotedIdentifiers_throw( ) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsMixedCaseQuotedIdentifiers", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::nullsAreSortedAtEnd( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "nullsAreSortedAtEnd", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::nullsAreSortedAtStart( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "nullsAreSortedAtStart", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::nullsAreSortedHigh( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "nullsAreSortedHigh", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::nullsAreSortedLow( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "nullsAreSortedLow", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsSchemasInProcedureCalls", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsSchemasInPrivilegeDefinitions", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsCatalogsInProcedureCalls", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsCatalogsInPrivilegeDefinitions", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsCorrelatedSubqueries", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSubqueriesInComparisons( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsSubqueriesInComparisons", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSubqueriesInExists( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsSubqueriesInExists", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSubqueriesInIns( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsSubqueriesInIns", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSubqueriesInQuantifieds( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsSubqueriesInQuantifieds", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsANSI92IntermediateSQL", mID ); } // ------------------------------------------------------------------------- @@ -1315,7 +1181,7 @@ sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsANSI92IntermediateSQL( ) t ::rtl::OUString sURL = m_pConnection->getURL(); if ( !sURL.getLength() ) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); sURL = impl_callStringMethod( "getURL", mID ); } return sURL; @@ -1323,157 +1189,157 @@ sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsANSI92IntermediateSQL( ) t // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getUserName( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callStringMethod( "getUserName", mID ); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getDriverName( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callStringMethod( "getDriverName", mID ); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getDriverVersion( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callStringMethod( "getDriverVersion", mID ); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getDatabaseProductVersion( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callStringMethod( "getDatabaseProductVersion", mID ); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getDatabaseProductName( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callStringMethod( "getDatabaseProductName", mID ); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getProcedureTerm( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callStringMethod( "getProcedureTerm", mID ); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getSchemaTerm( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callStringMethod( "getSchemaTerm", mID ); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getDriverMajorVersion( ) throw(RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callIntMethod( "getDriverMajorVersion", mID ); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getDefaultTransactionIsolation( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callIntMethod( "getDefaultTransactionIsolation", mID ); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getDriverMinorVersion( ) throw(RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callIntMethod( "getDriverMinorVersion", mID ); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getSQLKeywords( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callStringMethod( "getSQLKeywords", mID ); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getSearchStringEscape( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callStringMethod( "getSearchStringEscape", mID ); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getStringFunctions( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callStringMethod( "getStringFunctions", mID ); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getTimeDateFunctions( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callStringMethod( "getTimeDateFunctions", mID ); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getSystemFunctions( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callStringMethod( "getSystemFunctions", mID ); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getNumericFunctions( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callStringMethod( "getNumericFunctions", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsExtendedSQLGrammar( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsExtendedSQLGrammar", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsCoreSQLGrammar( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsCoreSQLGrammar", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsMinimumSQLGrammar( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsMinimumSQLGrammar", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsFullOuterJoins( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsFullOuterJoins", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsLimitedOuterJoins( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsLimitedOuterJoins", mID ); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxColumnsInGroupBy( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callIntMethod( "getMaxColumnsInGroupBy", mID ); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxColumnsInOrderBy( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callIntMethod( "getMaxColumnsInOrderBy", mID ); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxColumnsInSelect( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callIntMethod( "getMaxColumnsInSelect", mID ); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxUserNameLength( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callIntMethod( "getMaxUserNameLength", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsResultSetType( sal_Int32 setType ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethodWithIntArg( "supportsResultSetType", mID, setType ); } // ------------------------------------------------------------------------- @@ -1484,18 +1350,12 @@ sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsResultSetConcurrency( sal_I jboolean out( sal_False ); SDBThreadAttach t; - if ( t.pEnv ) - { - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), pMethodName, "(II)Z" ); - OSL_ENSURE( mID, "java_sql_DatabaseMetaData::supportsResultSetConcurrency: unknown method id!" ); - if ( mID ) - { - out = t.pEnv->CallBooleanMethod( object, mID, setType, concurrency); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } + { + static jmethodID mID(NULL); + obtainMethodId(t.pEnv, pMethodName,"(II)Z", mID); + out = t.pEnv->CallBooleanMethod( object, mID, setType, concurrency); + ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); } m_aLogger.log< const sal_Char*, sal_Int16 >( LogLevel::FINEST, STR_LOG_META_DATA_RESULT, pMethodName, out ); @@ -1504,61 +1364,61 @@ sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsResultSetConcurrency( sal_I // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::ownUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethodWithIntArg( "ownUpdatesAreVisible", mID, setType ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::ownDeletesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethodWithIntArg( "ownDeletesAreVisible", mID, setType ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::ownInsertsAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethodWithIntArg( "ownInsertsAreVisible", mID, setType ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::othersUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethodWithIntArg( "othersUpdatesAreVisible", mID, setType ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::othersDeletesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethodWithIntArg( "othersDeletesAreVisible", mID, setType ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::othersInsertsAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethodWithIntArg( "othersInsertsAreVisible", mID, setType ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::updatesAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethodWithIntArg( "updatesAreDetected", mID, setType ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::deletesAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethodWithIntArg( "deletesAreDetected", mID, setType ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::insertsAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethodWithIntArg( "insertsAreDetected", mID, setType ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsBatchUpdates( ) throw(SQLException, RuntimeException) { - static jmethodID mID = NULL; + static jmethodID mID(NULL); return impl_callBooleanMethod( "supportsBatchUpdates", mID ); } // ------------------------------------------------------------------------- @@ -1568,16 +1428,14 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getUDTs( { jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { static const char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[I)Ljava/sql/ResultSet;"; static const char * cMethodName = "getUDTs"; // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) + static jmethodID mID(NULL); + obtainMethodId(t.pEnv, cMethodName,cSignature, mID); { jvalue args[4]; // temporaere Variable initialisieren diff --git a/connectivity/source/drivers/jdbc/Date.cxx b/connectivity/source/drivers/jdbc/Date.cxx index 7962066f093c..06044ea984c1 100644 --- a/connectivity/source/drivers/jdbc/Date.cxx +++ b/connectivity/source/drivers/jdbc/Date.cxx @@ -43,27 +43,14 @@ jclass java_util_Date::theClass = 0; java_util_Date::~java_util_Date() {} -jclass java_util_Date::getMyClass() +jclass java_util_Date::getMyClass() const { // die Klasse muss nur einmal geholt werden, daher statisch - if( !theClass ){ - SDBThreadAttach t; - if( !t.pEnv ) return (jclass)NULL; - jclass tempClass = t.pEnv->FindClass( "java/util/Date" ); - jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); - t.pEnv->DeleteLocalRef( tempClass ); - saveClassRef( globClass ); - } + if( !theClass ) + theClass = findMyClass("java/util/Date"); return theClass; } -void java_util_Date::saveClassRef( jclass pClass ) -{ - if( pClass==NULL ) - return; - // der uebergebe Klassen-Handle ist schon global, daher einfach speichern - theClass = pClass; -} // ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/jdbc/DriverManager.cxx b/connectivity/source/drivers/jdbc/DriverManager.cxx deleted file mode 100644 index fc7fbe9b5dd4..000000000000 --- a/connectivity/source/drivers/jdbc/DriverManager.cxx +++ /dev/null @@ -1,113 +0,0 @@ -/************************************************************************* - * - * 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: DriverManager.cxx,v $ - * $Revision: 1.12 $ - * - * 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_connectivity.hxx" -#include "java/sql/DriverManager.hxx" -#include "java/tools.hxx" - -using namespace connectivity; -//************************************************************** -//************ Class: java.sql.DriverManager -//************************************************************** - -jclass java_sql_DriverManager::theClass = 0; - -java_sql_DriverManager::~java_sql_DriverManager() -{} - -jclass java_sql_DriverManager::getMyClass() -{ - // die Klasse muss nur einmal geholt werden, daher statisch - if( !theClass ){ - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( !t.pEnv ) return (jclass)0; - jclass tempClass = t.pEnv->FindClass("java/sql/DriverManager"); OSL_ENSURE(tempClass,"Java : FindClass nicht erfolgreich!"); - jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); - t.pEnv->DeleteLocalRef( tempClass ); - saveClassRef( globClass ); - } - return theClass; -} - -void java_sql_DriverManager::saveClassRef( jclass pClass ) -{ - if( pClass==0 ) - return; - // der uebergebe Klassen-Handle ist schon global, daher einfach speichern - theClass = pClass; -} - -jobject java_sql_DriverManager::getDriver(const ::rtl::OUString &url) -{ - jobject out(0); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - { - jvalue args[1]; - // Parameter konvertieren - args[0].l = convertwchar_tToJavaString(t.pEnv,url); - // temporaere Variable initialisieren - static const char * cSignature = "(Ljava/lang/String;)Ljava/sql/Driver;"; - static const char * cMethodName = "getDriver"; - // Java-Call absetzen - static jmethodID mID = t.pEnv->GetStaticMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) - { - out = t.pEnv->CallStaticObjectMethod( getMyClass(), mID, args[0].l ); - // und aufraeumen - - } //mID - t.pEnv->DeleteLocalRef((jstring)args[0].l); - return t.pEnv->NewGlobalRef( out ); - } //t.pEnv - - return out; -} - - -void java_sql_DriverManager::setLoginTimeout(sal_Int32 _par0) -{ - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "(I)V"; - static const char * cMethodName = "setLoginTimeout"; - // Java-Call absetzen - static jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) - t.pEnv->CallStaticVoidMethod(getMyClass(), mID, _par0); - ThrowSQLException(t.pEnv,0); - } //t.pEnv - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! -} - - diff --git a/connectivity/source/drivers/jdbc/DriverPropertyInfo.cxx b/connectivity/source/drivers/jdbc/DriverPropertyInfo.cxx index e95c07659f38..795067b37e99 100644 --- a/connectivity/source/drivers/jdbc/DriverPropertyInfo.cxx +++ b/connectivity/source/drivers/jdbc/DriverPropertyInfo.cxx @@ -52,31 +52,15 @@ jclass java_sql_DriverPropertyInfo::theClass = 0; java_sql_DriverPropertyInfo::~java_sql_DriverPropertyInfo() {} // -------------------------------------------------------------------------------- -jclass java_sql_DriverPropertyInfo::getMyClass() +jclass java_sql_DriverPropertyInfo::getMyClass() const { // die Klasse muss nur einmal geholt werden, daher statisch if( !theClass ) - { - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( !t.pEnv ) return (jclass)0; - jclass tempClass = t.pEnv->FindClass("java/sql/DriverPropertyInfo"); - OSL_ENSURE(tempClass,"Java : FindClass nicht erfolgreich!"); - jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); - t.pEnv->DeleteLocalRef( tempClass ); - saveClassRef( globClass ); - } + theClass = findMyClass("java/sql/DriverPropertyInfo"); return theClass; } // -------------------------------------------------------------------------------- -void java_sql_DriverPropertyInfo::saveClassRef( jclass pClass ) -{ - if( pClass==0 ) - return; - // der uebergebe Klassen-Handle ist schon global, daher einfach speichern - theClass = pClass; -} -// -------------------------------------------------------------------------------- java_sql_DriverPropertyInfo::operator starsdbc::DriverPropertyInfo() { starsdbc::DriverPropertyInfo aInfo; @@ -89,64 +73,64 @@ java_sql_DriverPropertyInfo::operator starsdbc::DriverPropertyInfo() return aInfo; } // -------------------------------------------------------------------------------- -::rtl::OUString java_sql_DriverPropertyInfo::name() const +::rtl::OUString java_sql_DriverPropertyInfo::name() { ::rtl::OUString aStr; SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { - jfieldID id = t.pEnv->GetFieldID(java_sql_DriverPropertyInfo::getMyClass(),"name","Ljava/lang/String;"); + jfieldID id = t.pEnv->GetFieldID(getMyClass(),"name","Ljava/lang/String;"); if(id) aStr = JavaString2String(t.pEnv,(jstring)t.pEnv->GetObjectField( object, id)); } //t.pEnv return aStr; } // -------------------------------------------------------------------------------- -::rtl::OUString java_sql_DriverPropertyInfo::description() const +::rtl::OUString java_sql_DriverPropertyInfo::description() { ::rtl::OUString aStr; SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { - jfieldID id = t.pEnv->GetFieldID(java_sql_DriverPropertyInfo::getMyClass(),"description","Ljava/lang/String;"); + jfieldID id = t.pEnv->GetFieldID(getMyClass(),"description","Ljava/lang/String;"); if(id) aStr = JavaString2String(t.pEnv,(jstring)t.pEnv->GetObjectField( object, id)); } //t.pEnv return aStr; } // -------------------------------------------------------------------------------- -::rtl::OUString java_sql_DriverPropertyInfo::value() const +::rtl::OUString java_sql_DriverPropertyInfo::value() { ::rtl::OUString aStr; SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { - jfieldID id = t.pEnv->GetFieldID(java_sql_DriverPropertyInfo::getMyClass(),"value","Ljava/lang/String;"); + jfieldID id = t.pEnv->GetFieldID(getMyClass(),"value","Ljava/lang/String;"); if(id) aStr = JavaString2String(t.pEnv,(jstring)t.pEnv->GetObjectField( object, id)); } //t.pEnv return aStr; } // -------------------------------------------------------------------------------- -sal_Bool java_sql_DriverPropertyInfo::required() const +sal_Bool java_sql_DriverPropertyInfo::required() { jboolean out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { - jfieldID id = t.pEnv->GetFieldID(java_sql_DriverPropertyInfo::getMyClass(),"required","Z"); + jfieldID id = t.pEnv->GetFieldID(getMyClass(),"required","Z"); if(id) out = t.pEnv->GetBooleanField( object, id); } //t.pEnv return out; } // -------------------------------------------------------------------------------- -Sequence< ::rtl::OUString> java_sql_DriverPropertyInfo::choices() const +Sequence< ::rtl::OUString> java_sql_DriverPropertyInfo::choices() { SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { - jfieldID id = t.pEnv->GetFieldID(java_sql_DriverPropertyInfo::getMyClass(),"choices","[Ljava/lang/String;"); + jfieldID id = t.pEnv->GetFieldID(getMyClass(),"choices","[Ljava/lang/String;"); if(id) { const java_lang_String * pEmpty = NULL; diff --git a/connectivity/source/drivers/jdbc/Exception.cxx b/connectivity/source/drivers/jdbc/Exception.cxx index 61246d7f5857..a2290c5c1dba 100644 --- a/connectivity/source/drivers/jdbc/Exception.cxx +++ b/connectivity/source/drivers/jdbc/Exception.cxx @@ -41,25 +41,11 @@ jclass java_lang_Exception::theClass = 0; java_lang_Exception::~java_lang_Exception() {} -jclass java_lang_Exception::getMyClass() +jclass java_lang_Exception::getMyClass() const { // die Klasse muss nur einmal geholt werden, daher statisch - if( !theClass ){ - SDBThreadAttach t; - if( !t.pEnv ) return (jclass)NULL; - jclass tempClass = t.pEnv->FindClass("java/lang/Exception"); OSL_ENSURE(tempClass,"Java : FindClass nicht erfolgreich!"); - jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); - t.pEnv->DeleteLocalRef( tempClass ); - saveClassRef( globClass ); - } + if( !theClass ) + theClass = findMyClass("java/lang/Exception"); return theClass; } -void java_lang_Exception::saveClassRef( jclass pClass ) -{ - if( pClass==NULL ) - return; - // der uebergebe Klassen-Handle ist schon global, daher einfach speichern - theClass = pClass; -} - diff --git a/connectivity/source/drivers/jdbc/InputStream.cxx b/connectivity/source/drivers/jdbc/InputStream.cxx index 32e893f5c665..522c1f67973e 100644 --- a/connectivity/source/drivers/jdbc/InputStream.cxx +++ b/connectivity/source/drivers/jdbc/InputStream.cxx @@ -51,27 +51,14 @@ java_io_InputStream::~java_io_InputStream() SDBThreadAttach::releaseRef(); } -jclass java_io_InputStream::getMyClass() +jclass java_io_InputStream::getMyClass() const { // die Klasse muss nur einmal geholt werden, daher statisch - if( !theClass ){ - SDBThreadAttach t; - if( !t.pEnv ) return (jclass)NULL; - jclass tempClass = t.pEnv->FindClass( "java/io/InputStream" ); - jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); - t.pEnv->DeleteLocalRef( tempClass ); - saveClassRef( globClass ); - } + if( !theClass ) + theClass = findMyClass("java/io/InputStream"); return theClass; } -void java_io_InputStream::saveClassRef( jclass pClass ) -{ - if( pClass==NULL ) - return; - // der uebergebe Klassen-Handle ist schon global, daher einfach speichern - theClass = pClass; -} sal_Int32 SAL_CALL java_io_InputStream::readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) { @@ -80,61 +67,19 @@ sal_Int32 SAL_CALL java_io_InputStream::readSomeBytes( ::com::sun::star::uno::Se void SAL_CALL java_io_InputStream::skipBytes( sal_Int32 nBytesToSkip ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) { - jint out(0); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - { - static const char * cSignature = "(I)I"; - static const char * cMethodName = "skip"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) - { - out = t.pEnv->CallIntMethod( object, mID,nBytesToSkip); - ThrowSQLException(t.pEnv,*this); - } - } //t.pEnv + static jmethodID mID(NULL); + callIntMethodWithIntArg("skip",mID,nBytesToSkip); } sal_Int32 SAL_CALL java_io_InputStream::available( ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) { - jboolean out(sal_False); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - { - static const char * cSignature = "()Z"; - static const char * cMethodName = "available"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) - { - out = t.pEnv->CallBooleanMethod( object, mID); - ThrowSQLException(t.pEnv,*this); - } - } //t.pEnv - return out; + static jmethodID mID(NULL); + return callIntMethod("available",mID); } void SAL_CALL java_io_InputStream::closeInput( ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) { - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - { - static const char * cSignature = "()V"; - static const char * cMethodName = "close"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) - { - t.pEnv->CallVoidMethod( object, mID); - ThrowSQLException(t.pEnv,*this); - } - } //t.pEnv + static jmethodID mID(NULL); + callVoidMethod("close",mID); } // ----------------------------------------------------- sal_Int32 SAL_CALL java_io_InputStream::readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) @@ -143,25 +88,21 @@ sal_Int32 SAL_CALL java_io_InputStream::readBytes( ::com::sun::star::uno::Sequen throw ::com::sun::star::io::BufferSizeExceededException(); jint out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { jbyteArray pByteArray = t.pEnv->NewByteArray(nBytesToRead); static const char * cSignature = "([BII)I"; static const char * cMethodName = "read"; // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) + static jmethodID mID(NULL); + obtainMethodId(t.pEnv, cMethodName,cSignature, mID); + out = t.pEnv->CallIntMethod( object, mID, pByteArray, 0, nBytesToRead ); + if ( !out ) + ThrowSQLException(t.pEnv,*this); + if(out > 0) { - out = t.pEnv->CallIntMethod( object, mID, pByteArray, 0, nBytesToRead ); - if ( !out ) - ThrowSQLException(t.pEnv,*this); - if(out > 0) - { - jboolean p = sal_False; - memcpy(aData.getArray(),t.pEnv->GetByteArrayElements(pByteArray,&p),out); - } + jboolean p = sal_False; + memcpy(aData.getArray(),t.pEnv->GetByteArrayElements(pByteArray,&p),out); } t.pEnv->DeleteLocalRef((jbyteArray)pByteArray); } //t.pEnv diff --git a/connectivity/source/drivers/jdbc/JBigDecimal.cxx b/connectivity/source/drivers/jdbc/JBigDecimal.cxx index a3a3c185c96a..e7f3f2bb00cb 100644 --- a/connectivity/source/drivers/jdbc/JBigDecimal.cxx +++ b/connectivity/source/drivers/jdbc/JBigDecimal.cxx @@ -43,29 +43,16 @@ jclass java_math_BigDecimal::theClass = 0; java_math_BigDecimal::~java_math_BigDecimal() {} -jclass java_math_BigDecimal::getMyClass() +jclass java_math_BigDecimal::getMyClass() const { // die Klasse muss nur einmal geholt werden, daher statisch - if( !theClass ){ - SDBThreadAttach t; - if( !t.pEnv ) return (jclass)NULL; - jclass tempClass = t.pEnv->FindClass("java/math/BigDecimal"); OSL_ENSURE(tempClass,"Java : FindClass nicht erfolgreich!"); - jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); - t.pEnv->DeleteLocalRef( tempClass ); - saveClassRef( globClass ); - } + if( !theClass ) + theClass = findMyClass("java/math/BigDecimal"); return theClass; } -void java_math_BigDecimal::saveClassRef( jclass pClass ) +java_math_BigDecimal::java_math_BigDecimal( const ::rtl::OUString& _par0 ): java_lang_Object( NULL, (jobject)NULL ) { - if( pClass==NULL ) - return; - // der uebergebe Klassen-Handle ist schon global, daher einfach speichern - theClass = pClass; -} - -java_math_BigDecimal::java_math_BigDecimal( const ::rtl::OUString& _par0 ): java_lang_Object( NULL, (jobject)NULL ){ SDBThreadAttach t; if( !t.pEnv ) return; @@ -73,9 +60,8 @@ java_math_BigDecimal::java_math_BigDecimal( const ::rtl::OUString& _par0 ): java // temporaere Variable initialisieren static const char * cSignature = "(Ljava/lang/String;)V"; jobject tempObj; - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), "<init>", cSignature );OSL_ENSURE(mID,"Unknown method id!"); + static jmethodID mID(NULL); + obtainMethodId(t.pEnv, "<init>",cSignature, mID); jstring str = convertwchar_tToJavaString(t.pEnv,_par0.replace(',','.')); tempObj = t.pEnv->NewObject( getMyClass(), mID, str ); @@ -86,7 +72,8 @@ java_math_BigDecimal::java_math_BigDecimal( const ::rtl::OUString& _par0 ): java // und aufraeumen } -java_math_BigDecimal::java_math_BigDecimal( const double& _par0 ): java_lang_Object( NULL, (jobject)NULL ){ +java_math_BigDecimal::java_math_BigDecimal( const double& _par0 ): java_lang_Object( NULL, (jobject)NULL ) +{ SDBThreadAttach t; if( !t.pEnv ) return; @@ -94,9 +81,8 @@ java_math_BigDecimal::java_math_BigDecimal( const double& _par0 ): java_lang_Obj // temporaere Variable initialisieren static const char * cSignature = "(D)V"; jobject tempObj; - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), "<init>", cSignature );OSL_ENSURE(mID,"Unknown method id!"); + static jmethodID mID(NULL); + obtainMethodId(t.pEnv, "<init>",cSignature, mID); tempObj = t.pEnv->NewObject( getMyClass(), mID, _par0 ); saveRef( t.pEnv, tempObj ); t.pEnv->DeleteLocalRef( tempObj ); diff --git a/connectivity/source/drivers/jdbc/JConnection.cxx b/connectivity/source/drivers/jdbc/JConnection.cxx index 0730d6e9964d..96325511807f 100644 --- a/connectivity/source/drivers/jdbc/JConnection.cxx +++ b/connectivity/source/drivers/jdbc/JConnection.cxx @@ -289,11 +289,9 @@ java_sql_Connection::~java_sql_Connection() if ( xTest.is() ) { SDBThreadAttach t; - if( t.pEnv ) + clearObject(*t.pEnv); + { - if( object ) - t.pEnv->DeleteGlobalRef( object ); - object = NULL; if ( m_pDriverobject ) t.pEnv->DeleteGlobalRef( m_pDriverobject ); m_pDriverobject = NULL; @@ -321,69 +319,27 @@ void java_sql_Connection::disposing() if ( object ) { - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "()V"; - static const char * cMethodName = "close"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) - t.pEnv->CallVoidMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //t.pEnv + static jmethodID mID(NULL); + callVoidMethod("close",mID); } } // ------------------------------------------------------------------------- -jclass java_sql_Connection::getMyClass() +jclass java_sql_Connection::getMyClass() const { // die Klasse muss nur einmal geholt werden, daher statisch - if( !theClass ){ - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( !t.pEnv ) return (jclass)0; - jclass tempClass = t.pEnv->FindClass("java/sql/Connection"); OSL_ENSURE(tempClass,"Java : FindClass nicht erfolgreich!"); - jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); - t.pEnv->DeleteLocalRef( tempClass ); - saveClassRef( globClass ); - } + if( !theClass ) + theClass = findMyClass("java/sql/Connection"); return theClass; } // ------------------------------------------------------------------------- -void java_sql_Connection::saveClassRef( jclass pClass ) -{ - if( pClass==0 ) - return; - // der uebergebe Klassen-Handle ist schon global, daher einfach speichern - theClass = pClass; -} -// ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL java_sql_Connection::getCatalog( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(java_sql_Connection_BASE::rBHelper.bDisposed); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - ::rtl::OUString aStr; - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "()Ljava/lang/String;"; - static const char * cMethodName = "getCatalog"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - aStr = JavaString2String(t.pEnv,out); - } //mID - } //t.pEnv - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! - return aStr; + static jmethodID mID(NULL); + return callStringMethod("getCatalog",mID); } // ------------------------------------------------------------------------- Reference< XDatabaseMetaData > SAL_CALL java_sql_Connection::getMetaData( ) throw(SQLException, RuntimeException) @@ -395,24 +351,11 @@ Reference< XDatabaseMetaData > SAL_CALL java_sql_Connection::getMetaData( ) thr Reference< XDatabaseMetaData > xMetaData = m_xMetaData; if(!xMetaData.is()) { - jobject out(0);//(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - - // temporaere Variable initialisieren - static const char * cSignature = "()Ljava/sql/DatabaseMetaData;"; - static const char * cMethodName = "getMetaData"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) - out = t.pEnv->CallObjectMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //t.pEnv + static jmethodID mID(NULL); + jobject out = callObjectMethod(t.pEnv,"getMetaData","()Ljava/sql/DatabaseMetaData;", mID); if(out) { - xMetaData = new java_sql_DatabaseMetaData( t.pEnv, out, *this ); m_xMetaData = xMetaData; } @@ -428,193 +371,54 @@ void SAL_CALL java_sql_Connection::close( ) throw(SQLException, RuntimeExceptio // ------------------------------------------------------------------------- void SAL_CALL java_sql_Connection::commit( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(java_sql_Connection_BASE::rBHelper.bDisposed); - - - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - - // temporaere Variable initialisieren - static const char * cSignature = "()V"; - static const char * cMethodName = "commit"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv + static jmethodID mID(NULL); + callVoidMethod("commit",mID); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_Connection::isClosed( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - jboolean out(0); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - - // temporaere Variable initialisieren - static const char * cSignature = "()Z"; - static const char * cMethodName = "isClosed"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallBooleanMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv - return out && java_sql_Connection_BASE::rBHelper.bDisposed; + static jmethodID mID(NULL); + return callBooleanMethod( "isClosed", mID ) && java_sql_Connection_BASE::rBHelper.bDisposed; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_Connection::isReadOnly( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(java_sql_Connection_BASE::rBHelper.bDisposed); - - - jboolean out(sal_False); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "()Z"; - static const char * cMethodName = "isReadOnly"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallBooleanMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv - return out; + static jmethodID mID(NULL); + return callBooleanMethod( "isReadOnly", mID ); } // ------------------------------------------------------------------------- void SAL_CALL java_sql_Connection::setCatalog( const ::rtl::OUString& catalog ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(java_sql_Connection_BASE::rBHelper.bDisposed); - - - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "(Ljava/lang/String;)V"; - static const char * cMethodName = "setCatalog"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) - { - // Parameter konvertieren - jstring str = convertwchar_tToJavaString(t.pEnv,catalog); - t.pEnv->CallVoidMethod( object, mID, str ); - - t.pEnv->DeleteLocalRef(str); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } - } //t.pEnv + static jmethodID mID(NULL); + callVoidMethodWithStringArg("setCatalog",mID,catalog); } // ------------------------------------------------------------------------- void SAL_CALL java_sql_Connection::rollback( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(java_sql_Connection_BASE::rBHelper.bDisposed); - - - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "()V"; - static const char * cMethodName = "rollback"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv + static jmethodID mID(NULL); + callVoidMethod("rollback",mID); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_Connection::getAutoCommit( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(java_sql_Connection_BASE::rBHelper.bDisposed); - - - jboolean out(0); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - - // temporaere Variable initialisieren - static const char * cSignature = "()Z"; - static const char * cMethodName = "getAutoCommit"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) - out = t.pEnv->CallBooleanMethod( object, mID ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //t.pEnv - return out; + static jmethodID mID(NULL); + return callBooleanMethod( "getAutoCommit", mID ); } // ------------------------------------------------------------------------- void SAL_CALL java_sql_Connection::setReadOnly( sal_Bool readOnly ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(java_sql_Connection_BASE::rBHelper.bDisposed); - - - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - - // temporaere Variable initialisieren - static const char * cSignature = "(Z)V"; - static const char * cMethodName = "setReadOnly"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID, (jboolean)readOnly ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv + static jmethodID mID(NULL); + callVoidMethodWithBoolArg("setReadOnly",mID,readOnly); } // ------------------------------------------------------------------------- void SAL_CALL java_sql_Connection::setAutoCommit( sal_Bool autoCommit ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(java_sql_Connection_BASE::rBHelper.bDisposed); - - - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - - // temporaere Variable initialisieren - static const char * cSignature = "(Z)V"; - static const char * cMethodName = "setAutoCommit"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID, (jboolean)autoCommit ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv + static jmethodID mID(NULL); + callVoidMethodWithBoolArg("setAutoCommit",mID,autoCommit); } // ------------------------------------------------------------------------- Reference< ::com::sun::star::container::XNameAccess > SAL_CALL java_sql_Connection::getTypeMap( ) throw(SQLException, RuntimeException) @@ -622,23 +426,9 @@ Reference< ::com::sun::star::container::XNameAccess > SAL_CALL java_sql_Connecti ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(java_sql_Connection_BASE::rBHelper.bDisposed); - - jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "()Ljava/util/Map;"; - static const char * cMethodName = "getTypeMap"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallObjectMethod( object, mID ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv + static jmethodID mID(NULL); + /*jobject out = */callObjectMethod(t.pEnv,"getTypeMap","()Ljava/util/Map;", mID); // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return 0;// ? 0 : Map2XNameAccess( t.pEnv, out ); } @@ -657,23 +447,8 @@ sal_Int32 SAL_CALL java_sql_Connection::getTransactionIsolation( ) throw(SQLExc ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(java_sql_Connection_BASE::rBHelper.bDisposed); - - jint out(0); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - - // temporaere Variable initialisieren - static const char * cSignature = "()I"; - static const char * cMethodName = "getTransactionIsolation"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) - out = t.pEnv->CallIntMethod( object, mID ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //t.pEnv - return out; + static jmethodID mID(NULL); + return callIntMethod("getTransactionIsolation",mID); } // ------------------------------------------------------------------------- void SAL_CALL java_sql_Connection::setTransactionIsolation( sal_Int32 level ) throw(SQLException, RuntimeException) @@ -681,22 +456,8 @@ void SAL_CALL java_sql_Connection::setTransactionIsolation( sal_Int32 level ) th ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(java_sql_Connection_BASE::rBHelper.bDisposed); - - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "(I)V"; - static const char * cMethodName = "setTransactionIsolation"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID, level ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv + static jmethodID mID(NULL); + callVoidMethodWithIntArg("setTransactionIsolation",mID,level); } // ------------------------------------------------------------------------- Reference< XStatement > SAL_CALL java_sql_Connection::createStatement( ) throw(SQLException, RuntimeException) @@ -783,26 +544,21 @@ Reference< XPreparedStatement > SAL_CALL java_sql_Connection::prepareCall( const ::rtl::OUString aStr; SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { // temporaere Variable initialisieren static const char * cSignature = "(Ljava/lang/String;)Ljava/lang/String;"; static const char * cMethodName = "nativeSQL"; // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) - { - // Parameter konvertieren - jstring str = convertwchar_tToJavaString(t.pEnv,sql); - - jobject out = t.pEnv->CallObjectMethod( object, mID, str ); - t.pEnv->DeleteLocalRef(str); - aStr = JavaString2String(t.pEnv, (jstring)out ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - + static jmethodID mID(NULL); + obtainMethodId(t.pEnv, cMethodName,cSignature, mID); + // Parameter konvertieren + jstring str = convertwchar_tToJavaString(t.pEnv,sql); + + jobject out = t.pEnv->CallObjectMethod( object, mID, str ); + t.pEnv->DeleteLocalRef(str); + aStr = JavaString2String(t.pEnv, (jstring)out ); + ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); } //t.pEnv m_aLogger.log( LogLevel::FINER, STR_LOG_NATIVE_SQL, sql, aStr ); @@ -812,24 +568,8 @@ Reference< XPreparedStatement > SAL_CALL java_sql_Connection::prepareCall( const // ------------------------------------------------------------------------- void SAL_CALL java_sql_Connection::clearWarnings( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(java_sql_Connection_BASE::rBHelper.bDisposed); - - SDBThreadAttach t; - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "()V"; - static const char * cMethodName = "clearWarnings"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } - } + static jmethodID mID(NULL); + callVoidMethod("clearWarnings",mID); } // ------------------------------------------------------------------------- Any SAL_CALL java_sql_Connection::getWarnings( ) throw(SQLException, RuntimeException) @@ -837,22 +577,9 @@ Any SAL_CALL java_sql_Connection::getWarnings( ) throw(SQLException, RuntimeExc ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(java_sql_Connection_BASE::rBHelper.bDisposed); - jobject out(NULL); SDBThreadAttach t; - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "()Ljava/sql/SQLWarning;"; - static const char * cMethodName = "getWarnings"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallObjectMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv + static jmethodID mID(NULL); + jobject out = callObjectMethod(t.pEnv,"getWarnings","()Ljava/sql/SQLWarning;", mID); // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! if( out ) { @@ -961,8 +688,8 @@ void java_sql_Connection::loadDriverFromProperties( const ::rtl::OUString& _sDri m_pDriverClassLoader.reset(); // here I try to find the class for jdbc driver - java_sql_SQLException_BASE::getMyClass(); - java_lang_Throwable::getMyClass(); + java_sql_SQLException_BASE::st_getMyClass(); + java_lang_Throwable::st_getMyClass(); if ( !_sDriverClass.getLength() ) { @@ -1005,7 +732,7 @@ void java_sql_Connection::loadDriverFromProperties( const ::rtl::OUString& _sDri if( t.pEnv && m_pDriverobject ) m_pDriverobject = t.pEnv->NewGlobalRef( m_pDriverobject ); - if( t.pEnv ) + { jclass tempClass = t.pEnv->GetObjectClass(m_pDriverobject); if ( m_pDriverobject ) @@ -1084,10 +811,9 @@ sal_Bool java_sql_Connection::construct(const ::rtl::OUString& url, static const char * cMethodName = "connect"; // Java-Call absetzen jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( m_Driver_theClass, cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - if( mID ) + if ( !mID )
+ mID = t.pEnv->GetMethodID( m_Driver_theClass, cMethodName, cSignature ); + if ( mID ) { jvalue args[2]; // Parameter konvertieren diff --git a/connectivity/source/drivers/jdbc/JDriver.cxx b/connectivity/source/drivers/jdbc/JDriver.cxx index b392a4b61a79..7d2bafa0d29c 100644 --- a/connectivity/source/drivers/jdbc/JDriver.cxx +++ b/connectivity/source/drivers/jdbc/JDriver.cxx @@ -33,7 +33,6 @@ #include "java/sql/Driver.hxx" #include "java/lang/Object.hxx" #include "java/lang/Class.hxx" -#include "java/sql/DriverManager.hxx" #include "java/sql/DriverPropertyInfo.hxx" #include "java/sql/Connection.hxx" #include "java/util/Property.hxx" diff --git a/connectivity/source/drivers/jdbc/JStatement.cxx b/connectivity/source/drivers/jdbc/JStatement.cxx index 5ff18bb2c130..f4d798973611 100644 --- a/connectivity/source/drivers/jdbc/JStatement.cxx +++ b/connectivity/source/drivers/jdbc/JStatement.cxx @@ -96,20 +96,8 @@ void SAL_CALL OStatement_BASE2::disposing() if ( object ) { - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "()V"; - static const char * cMethodName = "close"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv + static jmethodID mID(NULL); + callVoidMethod("close",mID); } ::comphelper::disposeComponent(m_xGeneratedStatement); @@ -121,17 +109,11 @@ void SAL_CALL OStatement_BASE2::disposing() java_sql_Statement_Base::disposing(); } // ------------------------------------------------------------------------- -jclass java_sql_Statement_Base::getMyClass() +jclass java_sql_Statement_Base::getMyClass() const { // die Klasse muss nur einmal geholt werden, daher statisch - if( !theClass ){ - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( !t.pEnv ) return (jclass)0; - jclass tempClass = t.pEnv->FindClass("java/sql/Statement"); OSL_ENSURE(tempClass,"Java : FindClass nicht erfolgreich!"); - jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); - t.pEnv->DeleteLocalRef( tempClass ); - saveClassRef( globClass ); - } + if( !theClass ) + theClass = findMyClass("java/sql/Statement"); return theClass; } // ----------------------------------------------------------------------------- @@ -143,14 +125,6 @@ void SAL_CALL java_sql_Statement_Base::disposing(void) } // ------------------------------------------------------------------------- -void java_sql_Statement_Base::saveClassRef( jclass pClass ) -{ - if( pClass==0 ) - return; - // der uebergebe Klassen-Handle ist schon global, daher einfach speichern - theClass = pClass; -} -//----------------------------------------------------------------------------- void SAL_CALL OStatement_BASE2::release() throw() { relase_ChildImpl(); @@ -190,23 +164,17 @@ Reference< XResultSet > SAL_CALL java_sql_Statement_Base::getGeneratedValues( ) jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + createStatement(t.pEnv); + // temporaere Variable initialisieren + try { - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "()Ljava/sql/ResultSet;"; - static const char * cMethodName = "getGeneratedKeys"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallObjectMethod( object, mID); - // und aufraeumen - // ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - connectivity::isExceptionOccured(t.pEnv,sal_True); - } //mID - } //t.pEnv + static jmethodID mID(NULL); + out = callResultSetMethod(t.env(),"getGeneratedKeys",mID); + } + catch(const SQLException&) + { + // ignore + } Reference< XResultSet > xRes; if ( !out ) @@ -234,23 +202,9 @@ Reference< XResultSet > SAL_CALL java_sql_Statement_Base::getGeneratedValues( ) void SAL_CALL java_sql_Statement_Base::cancel( ) throw(RuntimeException) { SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); - if( t.pEnv ){ - - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "()V"; - static const char * cMethodName = "cancel"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv + createStatement(t.pEnv); + static jmethodID mID(NULL); + callVoidMethod("cancel",mID); } // ------------------------------------------------------------------------- @@ -268,20 +222,11 @@ void SAL_CALL java_sql_Statement_Base::close( ) throw(::com::sun::star::sdbc::S void SAL_CALL java_sql_Statement::clearBatch( ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) { SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "()V"; - static const char * cMethodName = "clearBatch"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID + static jmethodID mID(NULL); + callVoidMethod("clearBatch",mID); } //t.pEnv } // ------------------------------------------------------------------------- @@ -294,8 +239,6 @@ sal_Bool SAL_CALL java_sql_Statement_Base::execute( const ::rtl::OUString& sql ) jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - - if( t.pEnv ) { createStatement(t.pEnv); m_sSqlStatement = sql; @@ -303,23 +246,20 @@ sal_Bool SAL_CALL java_sql_Statement_Base::execute( const ::rtl::OUString& sql ) static const char * cSignature = "(Ljava/lang/String;)Z"; static const char * cMethodName = "execute"; // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - // Parameter konvertieren - jdbc::LocalRef< jstring > str( t.env(), convertwchar_tToJavaString( t.pEnv, sql ) ); - { - jdbc::ContextClassLoaderScope ccl( t.env(), - m_pConnection ? m_pConnection->getDriverClassLoader() : jdbc::GlobalRef< jobject >(), - m_aLogger, - *this - ); - - out = t.pEnv->CallBooleanMethod( object, mID, str.get() ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } - } //mID + static jmethodID mID(NULL); + obtainMethodId(t.pEnv, cMethodName,cSignature, mID); + // Parameter konvertieren + jdbc::LocalRef< jstring > str( t.env(), convertwchar_tToJavaString( t.pEnv, sql ) ); + { + jdbc::ContextClassLoaderScope ccl( t.env(), + m_pConnection ? m_pConnection->getDriverClassLoader() : jdbc::GlobalRef< jobject >(), + m_aLogger, + *this + ); + + out = t.pEnv->CallBooleanMethod( object, mID, str.get() ); + ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); + } } //t.pEnv return out; } @@ -333,7 +273,7 @@ Reference< XResultSet > SAL_CALL java_sql_Statement_Base::executeQuery( const :: jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { createStatement(t.pEnv); m_sSqlStatement = sql; @@ -341,23 +281,20 @@ Reference< XResultSet > SAL_CALL java_sql_Statement_Base::executeQuery( const :: static const char * cSignature = "(Ljava/lang/String;)Ljava/sql/ResultSet;"; static const char * cMethodName = "executeQuery"; // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - // Parameter konvertieren - jdbc::LocalRef< jstring > str( t.env(), convertwchar_tToJavaString( t.pEnv, sql ) ); - { - jdbc::ContextClassLoaderScope ccl( t.env(), - m_pConnection ? m_pConnection->getDriverClassLoader() : jdbc::GlobalRef< jobject >(), - m_aLogger, - *this - ); - - out = t.pEnv->CallObjectMethod( object, mID, str.get() ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } - } //mID + static jmethodID mID(NULL); + obtainMethodId(t.pEnv, cMethodName,cSignature, mID); + // Parameter konvertieren + jdbc::LocalRef< jstring > str( t.env(), convertwchar_tToJavaString( t.pEnv, sql ) ); + { + jdbc::ContextClassLoaderScope ccl( t.env(), + m_pConnection ? m_pConnection->getDriverClassLoader() : jdbc::GlobalRef< jobject >(), + m_aLogger, + *this + ); + + out = t.pEnv->CallObjectMethod( object, mID, str.get() ); + ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); + } } //t.pEnv // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out, m_aLogger, *m_pConnection,this ); @@ -383,24 +320,10 @@ void SAL_CALL java_sql_Statement::addBatch( const ::rtl::OUString& sql ) throw(: ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - + { createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "(Ljava/lang/String;)V"; - static const char * cMethodName = "addBatch"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - // Parameter konvertieren - jstring str = convertwchar_tToJavaString(t.pEnv,sql); - t.pEnv->CallVoidMethod( object, mID, str ); - // und aufraeumen - t.pEnv->DeleteLocalRef(str); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID + static jmethodID mID(NULL); + callVoidMethodWithStringArg("addBatch",mID,sql); } //t.pEnv } // ------------------------------------------------------------------------- @@ -411,27 +334,16 @@ Sequence< sal_Int32 > SAL_CALL java_sql_Statement::executeBatch( ) throw(::com: checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); Sequence< sal_Int32 > aSeq; SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "()[I"; - static const char * cMethodName = "executeBatch"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - jintArray out = (jintArray)t.pEnv->CallObjectMethod( object, mID ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - if (out) - { - jboolean p = sal_False; - aSeq.realloc(t.pEnv->GetArrayLength(out)); - memcpy(aSeq.getArray(),t.pEnv->GetIntArrayElements(out,&p),aSeq.getLength()); - t.pEnv->DeleteLocalRef(out); - } - } //mID - } //t.pEnv + createStatement(t.pEnv); + static jmethodID mID(NULL); + jintArray out = (jintArray)callObjectMethod(t.pEnv,"executeBatch","()[I", mID); + if (out) + { + jboolean p = sal_False; + aSeq.realloc(t.pEnv->GetArrayLength(out)); + memcpy(aSeq.getArray(),t.pEnv->GetIntArrayElements(out,&p),aSeq.getLength()); + t.pEnv->DeleteLocalRef(out); + } return aSeq; } // ------------------------------------------------------------------------- @@ -443,58 +355,21 @@ sal_Int32 SAL_CALL java_sql_Statement_Base::executeUpdate( const ::rtl::OUString checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); m_aLogger.log( LogLevel::FINE, STR_LOG_EXECUTE_UPDATE, sql ); - jint out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - createStatement(t.pEnv); - m_sSqlStatement = sql; - // temporaere Variable initialisieren - static const char * cSignature = "(Ljava/lang/String;)I"; - static const char * cMethodName = "executeUpdate"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - // Parameter konvertieren - jdbc::LocalRef< jstring > str( t.env(), convertwchar_tToJavaString( t.pEnv, sql ) ); - { - jdbc::ContextClassLoaderScope ccl( t.env(), - m_pConnection ? m_pConnection->getDriverClassLoader() : jdbc::GlobalRef< jobject >(), - m_aLogger, - *this - ); - - out = t.pEnv->CallIntMethod( object, mID, str.get() ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } - } //mID - } //t.pEnv - return (sal_Int32)out; + createStatement(t.pEnv); + m_sSqlStatement = sql; + static jmethodID mID(NULL); + return callIntMethodWithStringArg("executeUpdate",mID,sql); } // ------------------------------------------------------------------------- Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL java_sql_Statement_Base::getResultSet( ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); - jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + createStatement(t.pEnv); + static jmethodID mID(NULL); + jobject out = callResultSetMethod(t.env(),"getResultSet",mID); - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "()Ljava/sql/ResultSet;"; - static const char * cMethodName = "getResultSet"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallObjectMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out, m_aLogger, *m_pConnection,this ); } @@ -502,78 +377,29 @@ Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL java_sql_Statement_Base sal_Int32 SAL_CALL java_sql_Statement_Base::getUpdateCount( ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); - jint out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "()I"; - static const char * cMethodName = "getUpdateCount"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallIntMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv - + createStatement(t.pEnv); + static jmethodID mID(NULL); + sal_Int32 out = callIntMethod("getUpdateCount",mID); m_aLogger.log( LogLevel::FINER, STR_LOG_UPDATE_COUNT, (sal_Int32)out ); - return (sal_Int32)out; + return out; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_Statement_Base::getMoreResults( ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); - jboolean out(sal_False); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - { - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "()Z"; - static const char * cMethodName = "getMoreResults"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallBooleanMethod( object, mID ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv - return out; + static jmethodID mID(NULL); + return callBooleanMethod( "getMoreResults", mID ); } // ------------------------------------------------------------------------- // ------------------------------------------------------------------------- Any SAL_CALL java_sql_Statement_Base::getWarnings( ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); - jobject out(NULL); SDBThreadAttach t; - if( t.pEnv ) - { - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "()Ljava/sql/SQLWarning;"; - static const char * cMethodName = "getWarnings"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallObjectMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv + createStatement(t.pEnv); + static jmethodID mID(NULL); + jobject out = callObjectMethod(t.pEnv,"getWarnings","()Ljava/sql/SQLWarning;", mID); // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! if( out ) { @@ -591,192 +417,72 @@ void SAL_CALL java_sql_Statement_Base::clearWarnings( ) throw(::com::sun::star: ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; - if( t.pEnv ) + { createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "()V"; - static const char * cMethodName = "clearWarnings"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } + static jmethodID mID(NULL); + callVoidMethod("clearWarnings",mID); } } //------------------------------------------------------------------------------ sal_Int32 java_sql_Statement_Base::getQueryTimeOut() throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); - jint out(0); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "()I"; - static const char * cMethodName = "getQueryTimeOut"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallIntMethod( object, mID); - isExceptionOccured(t.pEnv,sal_True); - - } //mID - } //t.pEnv - return (sal_Int32)out; + static jmethodID mID(NULL); + return impl_getProperty("getQueryTimeOut",mID); } //------------------------------------------------------------------------------ sal_Int32 java_sql_Statement_Base::getMaxRows() throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); - jint out(0); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "()I"; - static const char * cMethodName = "getMaxRows"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallIntMethod( object, mID); - isExceptionOccured(t.pEnv,sal_True); - - } //mID - } //t.pEnv - return (sal_Int32)out; + static jmethodID mID(NULL); + return impl_getProperty("getMaxRows",mID); } //------------------------------------------------------------------------------ sal_Int32 java_sql_Statement_Base::getResultSetConcurrency() throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); - jint out(0); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv && object ){ - // temporaere Variable initialisieren - static const char * cSignature = "()I"; - static const char * cMethodName = "getResultSetConcurrency"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallIntMethod( object, mID); - isExceptionOccured(t.pEnv,sal_True); - - } //mID - } //t.pEnv - else - out = m_nResultSetConcurrency; - return (sal_Int32)out; + static jmethodID mID(NULL); + return impl_getProperty("getResultSetConcurrency",mID,m_nResultSetConcurrency); } //------------------------------------------------------------------------------ sal_Int32 java_sql_Statement_Base::getResultSetType() throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); - jint out(0); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv && object ){ - // temporaere Variable initialisieren - static const char * cSignature = "()I"; - static const char * cMethodName = "getResultSetType"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallIntMethod( object, mID); - isExceptionOccured(t.pEnv,sal_True); + static jmethodID mID(NULL); + return impl_getProperty("getResultSetType",mID,m_nResultSetType); +} +//------------------------------------------------------------------------------ +sal_Int32 java_sql_Statement_Base::impl_getProperty(const char* _pMethodName, jmethodID& _inout_MethodID,sal_Int32 _nDefault) +{ + sal_Int32 out = _nDefault; + if ( object ) + out = callIntMethod(_pMethodName,_inout_MethodID,true); - } //mID - } //t.pEnv - else - out = m_nResultSetType; - return (sal_Int32)out; + return out; } //------------------------------------------------------------------------------ -sal_Int32 java_sql_Statement_Base::getFetchDirection() throw(SQLException, RuntimeException) +sal_Int32 java_sql_Statement_Base::impl_getProperty(const char* _pMethodName, jmethodID& _inout_MethodID) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); - jint out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "()I"; - static const char * cMethodName = "getFetchDirection"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallIntMethod( object, mID); - isExceptionOccured(t.pEnv,sal_True); + createStatement(t.pEnv); + return callIntMethod(_pMethodName,_inout_MethodID,true); +} - } //mID - } //t.pEnv - return (sal_Int32)out; +//------------------------------------------------------------------------------ +sal_Int32 java_sql_Statement_Base::getFetchDirection() throw(SQLException, RuntimeException) +{ + static jmethodID mID(NULL); + return impl_getProperty("getFetchDirection",mID); } //------------------------------------------------------------------------------ sal_Int32 java_sql_Statement_Base::getFetchSize() throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); - jint out(0); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "()I"; - static const char * cMethodName = "getFetchSize"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallIntMethod( object, mID); - isExceptionOccured(t.pEnv,sal_True); - - } //mID - } //t.pEnv - return (sal_Int32)out; + static jmethodID mID(NULL); + return impl_getProperty("getFetchSize",mID); } //------------------------------------------------------------------------------ sal_Int32 java_sql_Statement_Base::getMaxFieldSize() throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); - jint out(0); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "()I"; - static const char * cMethodName = "getMaxFieldSize"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallIntMethod( object, mID); - isExceptionOccured(t.pEnv,sal_True); - - } //mID - } //t.pEnv - return (sal_Int32)out; + static jmethodID mID(NULL); + return impl_getProperty("getMaxFieldSize",mID); } //------------------------------------------------------------------------------ ::rtl::OUString java_sql_Statement_Base::getCursorName() throw(SQLException, RuntimeException) @@ -784,26 +490,16 @@ sal_Int32 java_sql_Statement_Base::getMaxFieldSize() throw(SQLException, Runtime ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - ::rtl::OUString aStr; - if( t.pEnv ) + createStatement(t.pEnv); + static jmethodID mID(NULL); + try { - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "()Ljava/lang/String;"; - static const char * cMethodName = "getCursorName"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID); - isExceptionOccured(t.pEnv,sal_True); - - aStr = JavaString2String(t.pEnv,out); - } //mID - } //t.pEnv - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! - return aStr; + return callStringMethod("getCursorName",mID); + } + catch(const SQLException&) + { + } + return ::rtl::OUString(); } //------------------------------------------------------------------------------ void java_sql_Statement_Base::setQueryTimeOut(sal_Int32 _par0) throw(SQLException, RuntimeException) @@ -811,22 +507,9 @@ void java_sql_Statement_Base::setQueryTimeOut(sal_Int32 _par0) throw(SQLExceptio ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "(I)V"; - static const char * cMethodName = "setQueryTimeOut"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) - { - t.pEnv->CallVoidMethod( object, mID,_par0); - isExceptionOccured(t.pEnv,sal_True); - - } //mID - } //t.pEnv + createStatement(t.pEnv); + static jmethodID mID(NULL); + callVoidMethodWithIntArg("setQueryTimeOut",mID,_par0,true); } //------------------------------------------------------------------------------ @@ -838,20 +521,9 @@ void java_sql_Statement_Base::setEscapeProcessing(sal_Bool _par0) throw(SQLExcep SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); m_bEscapeProcessing = _par0; - if( t.pEnv ) - { - createStatement( t.pEnv ); - static const char * cSignature = "(Z)V"; - static const char * cMethodName = "setEscapeProcessing"; - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) - { - t.pEnv->CallVoidMethod( object, mID,_par0); - isExceptionOccured(t.pEnv,sal_True); - } - } + createStatement( t.pEnv ); + static jmethodID mID(NULL); + callVoidMethodWithBoolArg("setEscapeProcessing",mID,_par0,true); } //------------------------------------------------------------------------------ @@ -860,21 +532,9 @@ void java_sql_Statement_Base::setMaxRows(sal_Int32 _par0) throw(SQLException, Ru ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "(I)V"; - static const char * cMethodName = "setMaxRows"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID,_par0); - isExceptionOccured(t.pEnv,sal_True); - - } //mID - } //t.pEnv + createStatement(t.pEnv); + static jmethodID mID(NULL); + callVoidMethodWithIntArg("setMaxRows",mID,_par0,true); } //------------------------------------------------------------------------------ void java_sql_Statement_Base::setResultSetConcurrency(sal_Int32 _par0) throw(SQLException, RuntimeException) @@ -884,15 +544,7 @@ void java_sql_Statement_Base::setResultSetConcurrency(sal_Int32 _par0) throw(SQL m_aLogger.log( LogLevel::FINE, STR_LOG_RESULT_SET_CONCURRENCY, (sal_Int32)_par0 ); m_nResultSetConcurrency = _par0; - if( object ) - { - SDBThreadAttach t; - if( t.pEnv ) - { - t.pEnv->DeleteGlobalRef( object ); - object = NULL; - } - } + clearObject(); } //------------------------------------------------------------------------------ void java_sql_Statement_Base::setResultSetType(sal_Int32 _par0) throw(SQLException, RuntimeException) @@ -902,15 +554,7 @@ void java_sql_Statement_Base::setResultSetType(sal_Int32 _par0) throw(SQLExcepti m_aLogger.log( LogLevel::FINE, STR_LOG_RESULT_SET_TYPE, (sal_Int32)_par0 ); m_nResultSetType = _par0; - if( object ) - { - SDBThreadAttach t; - if( t.pEnv ) - { - t.pEnv->DeleteGlobalRef( object ); - object = NULL; - } - } + clearObject(); } //------------------------------------------------------------------------------ void java_sql_Statement_Base::setFetchDirection(sal_Int32 _par0) throw(SQLException, RuntimeException) @@ -919,22 +563,9 @@ void java_sql_Statement_Base::setFetchDirection(sal_Int32 _par0) throw(SQLExcept checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); m_aLogger.log( LogLevel::FINER, STR_LOG_FETCH_DIRECTION, (sal_Int32)_par0 ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "(I)V"; - static const char * cMethodName = "setFetchDirection"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID,_par0); - isExceptionOccured(t.pEnv,sal_True); - - } //mID - } //t.pEnv - + createStatement(t.pEnv); + static jmethodID mID(NULL); + callVoidMethodWithIntArg("setFetchDirection",mID,_par0,true); } //------------------------------------------------------------------------------ void java_sql_Statement_Base::setFetchSize(sal_Int32 _par0) throw(SQLException, RuntimeException) @@ -944,22 +575,9 @@ void java_sql_Statement_Base::setFetchSize(sal_Int32 _par0) throw(SQLException, m_aLogger.log( LogLevel::FINER, STR_LOG_FETCH_SIZE, (sal_Int32)_par0 ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "(I)V"; - static const char * cMethodName = "setFetchSize"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID,_par0); - isExceptionOccured(t.pEnv,sal_True); - - } //mID - } //t.pEnv - + createStatement(t.pEnv); + static jmethodID mID(NULL); + callVoidMethodWithIntArg("setFetchSize",mID,_par0,true); } //------------------------------------------------------------------------------ void java_sql_Statement_Base::setMaxFieldSize(sal_Int32 _par0) throw(SQLException, RuntimeException) @@ -967,22 +585,9 @@ void java_sql_Statement_Base::setMaxFieldSize(sal_Int32 _par0) throw(SQLExceptio ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "(I)V"; - static const char * cMethodName = "setMaxFieldSize"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID,_par0); - isExceptionOccured(t.pEnv,sal_True); - - } //mID - } //t.pEnv - + createStatement(t.pEnv); + static jmethodID mID(NULL); + callVoidMethodWithIntArg("setMaxFieldSize",mID,_par0,true); } //------------------------------------------------------------------------------ void java_sql_Statement_Base::setCursorName(const ::rtl::OUString &_par0) throw(SQLException, RuntimeException) @@ -990,24 +595,10 @@ void java_sql_Statement_Base::setCursorName(const ::rtl::OUString &_par0) throw( ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "(Ljava/lang/String;)V"; - static const char * cMethodName = "setCursorName"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - // Parameter konvertieren - jstring str = convertwchar_tToJavaString(t.pEnv,_par0); - t.pEnv->CallVoidMethod( object, mID,str); - isExceptionOccured(t.pEnv,sal_True); - - t.pEnv->DeleteLocalRef(str); - isExceptionOccured(t.pEnv,sal_True); - } //mID + static jmethodID mID(NULL); + callVoidMethodWithStringArg("setCursorName",mID,_par0); } //t.pEnv } @@ -1161,27 +752,14 @@ jclass java_sql_Statement::theClass = 0; java_sql_Statement::~java_sql_Statement() {} -jclass java_sql_Statement::getMyClass() +jclass java_sql_Statement::getMyClass() const { // die Klasse muss nur einmal geholt werden, daher statisch - if( !theClass ){ - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( !t.pEnv ) return (jclass)0; - jclass tempClass = t.pEnv->FindClass("java/sql/Statement"); OSL_ENSURE(tempClass,"Java : FindClass nicht erfolgreich!"); - jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); - t.pEnv->DeleteLocalRef( tempClass ); - saveClassRef( globClass ); - } + if( !theClass ) + theClass = findMyClass("java/sql/Statement"); return theClass; } -void java_sql_Statement::saveClassRef( jclass pClass ) -{ - if( pClass==0 ) - return; - // der uebergebe Klassen-Handle ist schon global, daher einfach speichern - theClass = pClass; -} // ----------------------------------------------------------------------------- void java_sql_Statement::createStatement(JNIEnv* _pEnv) { @@ -1194,7 +772,7 @@ void java_sql_Statement::createStatement(JNIEnv* _pEnv) static const char * cMethodName = "createStatement"; // Java-Call absetzen jobject out = NULL; - static jmethodID mID = NULL; + static jmethodID mID(NULL); if ( !mID ) mID = _pEnv->GetMethodID( m_pConnection->getMyClass(), cMethodName, cSignature ); if( mID ){ diff --git a/connectivity/source/drivers/jdbc/Object.cxx b/connectivity/source/drivers/jdbc/Object.cxx index 6e550134a90c..6f4e78550dc0 100644 --- a/connectivity/source/drivers/jdbc/Object.cxx +++ b/connectivity/source/drivers/jdbc/Object.cxx @@ -45,7 +45,7 @@ #include <com/sun/star/uno/Sequence.hxx> #include "resource/jdbc_log.hrc" - +#include <rtl/logfile.hxx> #include <comphelper/logging.hxx> #include <memory> @@ -112,17 +112,10 @@ void SDBThreadAttach::releaseRef() // statische Variablen der Klasse: jclass java_lang_Object::theClass = 0; -jclass java_lang_Object::getMyClass() +jclass java_lang_Object::getMyClass() const { if( !theClass ) - { - SDBThreadAttach t; - - if( !t.pEnv ) return (jclass)NULL; - jclass tempClass = t.pEnv->FindClass( "java/lang/Object" ); - theClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); - t.pEnv->DeleteLocalRef( tempClass ); - } + theClass = findMyClass("java/lang/Object"); return theClass; } // der eigentliche Konstruktor @@ -146,9 +139,7 @@ java_lang_Object::~java_lang_Object() if( object ) { SDBThreadAttach t; - if( t.pEnv ) - t.pEnv->DeleteGlobalRef( object ); - object = NULL; + clearObject(*t.pEnv); } SDBThreadAttach::releaseRef(); } @@ -166,65 +157,30 @@ void java_lang_Object::clearObject() if( object ) { SDBThreadAttach t; - if( t.pEnv ) - t.pEnv->DeleteGlobalRef( object ); - object = NULL; + clearObject(*t.pEnv); } } // der protected-Konstruktor fuer abgeleitete Klassen void java_lang_Object::saveRef( JNIEnv * pXEnv, jobject myObj ) { OSL_ENSURE( myObj, "object in c++ -> Java Wrapper" ); - if( pXEnv && myObj ) + if( myObj ) object = pXEnv->NewGlobalRef( myObj ); } java_lang_Class * java_lang_Object::getClass() { - jobject out; SDBThreadAttach t; - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "()Ljava/lang/Class;"; - static const char * cMethodName = "getClass"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) - { - out = t.pEnv->CallObjectMethodA( object, mID, NULL ); - ThrowSQLException(t.pEnv,NULL); - return new java_lang_Class( t.pEnv, out ); - } //mID - } //pEnv - return NULL; + static jmethodID mID(NULL); + jobject out = callObjectMethod(t.pEnv,"getClass","()Ljava/lang/Class;", mID); + return out ? new java_lang_Class( t.pEnv, out ) : NULL; } ::rtl::OUString java_lang_Object::toString() const { - - SDBThreadAttach t; - ::rtl::OUString aStr; - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "()Ljava/lang/String;"; - static const char * cMethodName = "toString"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) - { - jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID); - ThrowSQLException(t.pEnv,NULL); - aStr = JavaString2String(t.pEnv,out); - } //mID - } //pEnv - return aStr; + static jmethodID mID(NULL); + return callStringMethod("toString",mID); } // -------------------------------------------------------------------------------- @@ -240,14 +196,14 @@ namespace _pEnvironment->ExceptionClear(); // we have to clear the exception here because we want to handle it itself - if ( _pEnvironment->IsInstanceOf( jThrow, java_sql_SQLException_BASE::getMyClass() ) ) + if ( _pEnvironment->IsInstanceOf( jThrow, java_sql_SQLException_BASE::st_getMyClass() ) ) { ::std::auto_ptr< java_sql_SQLException_BASE > pException( new java_sql_SQLException_BASE( _pEnvironment, jThrow ) ); _out_rException = SQLException( pException->getMessage(), _rxContext, pException->getSQLState(), pException->getErrorCode(), Any() ); return true; } - else if ( _pEnvironment->IsInstanceOf( jThrow, java_lang_Throwable::getMyClass() ) ) + else if ( _pEnvironment->IsInstanceOf( jThrow, java_lang_Throwable::st_getMyClass() ) ) { ::std::auto_ptr< java_lang_Throwable > pThrow( new java_lang_Throwable( _pEnvironment, jThrow ) ); ::rtl::OUString sMessage = pThrow->getMessage(); @@ -283,5 +239,204 @@ void java_lang_Object::ThrowSQLException( JNIEnv* _pEnvironment, const Reference if ( lcl_translateJNIExceptionToUNOException( _pEnvironment, _rxContext, aException ) ) throw aException; } +// ----------------------------------------------------------------------------- +void java_lang_Object::obtainMethodId(JNIEnv* _pEnv,const char* _pMethodName, const char* _pSignature,jmethodID& _inout_MethodID) const +{ + if ( !_inout_MethodID ) + { + _inout_MethodID = _pEnv->GetMethodID( getMyClass(), _pMethodName, _pSignature ); + OSL_ENSURE( _inout_MethodID, _pSignature ); + if ( !_inout_MethodID ) + throw SQLException(); + } // if ( !_inout_MethodID ) +} +// ----------------------------------------------------------------------------- +sal_Bool java_lang_Object::callBooleanMethod( const char* _pMethodName, jmethodID& _inout_MethodID ) const +{ + jboolean out( sal_False ); + SDBThreadAttach t; + OSL_ENSURE( t.pEnv, "java_lang_Object::callBooleanMethod: no Java enviroment anymore!" ); + obtainMethodId(t.pEnv, _pMethodName,"()Z", _inout_MethodID); + // call method + out = t.pEnv->CallBooleanMethod( object, _inout_MethodID ); + ThrowSQLException( t.pEnv, NULL ); + + return out; +} +// ----------------------------------------------------------------------------- +sal_Bool java_lang_Object::callBooleanMethodWithIntArg( const char* _pMethodName, jmethodID& _inout_MethodID, sal_Int32 _nArgument ) const +{ + jboolean out( sal_False ); + SDBThreadAttach t; + OSL_ENSURE( t.pEnv, "java_lang_Object::callBooleanMethodWithIntArg: no Java enviroment anymore!" ); + obtainMethodId(t.pEnv, _pMethodName,"(I)Z", _inout_MethodID); + // call method + out = t.pEnv->CallBooleanMethod( object, _inout_MethodID, _nArgument ); + ThrowSQLException( t.pEnv, NULL ); + + return out; +} +// ------------------------------------------------------------------------- +jobject java_lang_Object::callResultSetMethod( JNIEnv& _rEnv,const char* _pMethodName, jmethodID& _inout_MethodID ) const +{ + // call method + jobject out = callObjectMethod(&_rEnv,_pMethodName,"()Ljava/sql/ResultSet;", _inout_MethodID); + return out; +} +// ------------------------------------------------------------------------- +sal_Int32 java_lang_Object::callIntMethod( const char* _pMethodName, jmethodID& _inout_MethodID,bool _bIgnoreException ) const +{ + SDBThreadAttach t; + OSL_ENSURE( t.pEnv, "java_lang_Object::callIntMethod: no Java enviroment anymore!" ); + obtainMethodId(t.pEnv, _pMethodName,"()I", _inout_MethodID); + + // call method + jint out( t.pEnv->CallIntMethod( object, _inout_MethodID ) ); + if ( _bIgnoreException ) + isExceptionOccured(t.pEnv,sal_True); + else + ThrowSQLException( t.pEnv, NULL ); + + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 java_lang_Object::callIntMethodWithIntArg( const char* _pMethodName, jmethodID& _inout_MethodID,sal_Int32 _nArgument ) const +{ + SDBThreadAttach t; + OSL_ENSURE( t.pEnv, "java_lang_Object::callIntMethod: no Java enviroment anymore!" ); + obtainMethodId(t.pEnv, _pMethodName,"(I)I", _inout_MethodID); + // call method + jint out( t.pEnv->CallIntMethod( object, _inout_MethodID , _nArgument) ); + ThrowSQLException( t.pEnv, NULL ); + + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +void java_lang_Object::callVoidMethod( const char* _pMethodName, jmethodID& _inout_MethodID) const +{ + SDBThreadAttach t; + OSL_ENSURE( t.pEnv, "java_lang_Object::callIntMethod: no Java enviroment anymore!" ); + obtainMethodId(t.pEnv, _pMethodName,"()V", _inout_MethodID); + + // call method + t.pEnv->CallVoidMethod( object, _inout_MethodID ); + ThrowSQLException( t.pEnv, NULL ); +} +// ------------------------------------------------------------------------- +void java_lang_Object::callVoidMethodWithIntArg( const char* _pMethodName, jmethodID& _inout_MethodID, sal_Int32 _nArgument,bool _bIgnoreException ) const +{ + SDBThreadAttach t; + OSL_ENSURE( t.pEnv, "java_lang_Object::callIntMethod: no Java enviroment anymore!" ); + obtainMethodId(t.pEnv, _pMethodName,"(I)V", _inout_MethodID); + + // call method + t.pEnv->CallVoidMethod( object, _inout_MethodID,_nArgument ); + if ( _bIgnoreException ) + isExceptionOccured(t.pEnv,sal_True); + else + ThrowSQLException( t.pEnv, NULL ); +} +// ------------------------------------------------------------------------- +void java_lang_Object::callVoidMethodWithBoolArg( const char* _pMethodName, jmethodID& _inout_MethodID, sal_Int32 _nArgument,bool _bIgnoreException ) const +{ + SDBThreadAttach t; + OSL_ENSURE( t.pEnv, "java_lang_Object::callIntMethod: no Java enviroment anymore!" ); + obtainMethodId(t.pEnv, _pMethodName,"(Z)V", _inout_MethodID); + // call method + t.pEnv->CallVoidMethod( object, _inout_MethodID,_nArgument ); + if ( _bIgnoreException ) + isExceptionOccured(t.pEnv,sal_True); + else + ThrowSQLException( t.pEnv, NULL ); +} +// ----------------------------------------------------------------------------- +::rtl::OUString java_lang_Object::callStringMethod( const char* _pMethodName, jmethodID& _inout_MethodID ) const +{ + SDBThreadAttach t; + OSL_ENSURE( t.pEnv, "java_lang_Object::callStringMethod: no Java enviroment anymore!" ); + + // call method + jstring out = (jstring)callObjectMethod(t.pEnv,_pMethodName,"()Ljava/lang/String;", _inout_MethodID); + return JavaString2String( t.pEnv, out ); +} +// ----------------------------------------------------------------------------- +jobject java_lang_Object::callObjectMethod( JNIEnv * _pEnv,const char* _pMethodName,const char* _pSignature, jmethodID& _inout_MethodID ) const +{ + // obtain method ID + obtainMethodId(_pEnv, _pMethodName,_pSignature, _inout_MethodID); + // call method + jobject out = _pEnv->CallObjectMethod( object, _inout_MethodID); + ThrowSQLException( _pEnv, NULL ); + return out; +} + +// ----------------------------------------------------------------------------- +jobject java_lang_Object::callObjectMethodWithIntArg( JNIEnv * _pEnv,const char* _pMethodName,const char* _pSignature, jmethodID& _inout_MethodID , sal_Int32 _nArgument) const +{ + obtainMethodId(_pEnv, _pMethodName,_pSignature, _inout_MethodID); + // call method + jobject out = _pEnv->CallObjectMethod( object, _inout_MethodID,_nArgument ); + ThrowSQLException( _pEnv, NULL ); + return out; +} +// ----------------------------------------------------------------------------- +::rtl::OUString java_lang_Object::callStringMethodWithIntArg( const char* _pMethodName, jmethodID& _inout_MethodID , sal_Int32 _nArgument) const +{ + SDBThreadAttach t; + OSL_ENSURE( t.pEnv, "java_lang_Object::callStringMethod: no Java enviroment anymore!" ); + jstring out = (jstring)callObjectMethodWithIntArg(t.pEnv,_pMethodName,"(I)Ljava/lang/String;",_inout_MethodID,_nArgument); + return JavaString2String( t.pEnv, out ); +} +// ------------------------------------------------------------------------- +void java_lang_Object::callVoidMethodWithStringArg( const char* _pMethodName, jmethodID& _inout_MethodID,const ::rtl::OUString& _nArgument ) const +{ + SDBThreadAttach t; + OSL_ENSURE( t.pEnv, "java_lang_Object::callIntMethod: no Java enviroment anymore!" ); + obtainMethodId(t.pEnv, _pMethodName,"(Ljava/lang/String;)V", _inout_MethodID); + + jstring str = convertwchar_tToJavaString(t.pEnv,_nArgument); + // call method + t.pEnv->CallVoidMethod( object, _inout_MethodID , str); + t.pEnv->DeleteLocalRef(str); + ThrowSQLException( t.pEnv, NULL ); +} +// ------------------------------------------------------------------------- +sal_Int32 java_lang_Object::callIntMethodWithStringArg( const char* _pMethodName, jmethodID& _inout_MethodID,const ::rtl::OUString& _nArgument ) const +{ + SDBThreadAttach t; + OSL_ENSURE( t.pEnv, "java_lang_Object::callIntMethodWithStringArg: no Java enviroment anymore!" ); + obtainMethodId(t.pEnv, _pMethodName,"(Ljava/lang/String;)I", _inout_MethodID); + + //TODO: Check if the code below is needed + //jdbc::LocalRef< jstring > str( t.env(), convertwchar_tToJavaString( t.pEnv, sql ) ); + //{ + // jdbc::ContextClassLoaderScope ccl( t.env(), + // m_pConnection ? m_pConnection->getDriverClassLoader() : jdbc::GlobalRef< jobject >(), + // m_aLogger, + // *this + // ); + + jstring str = convertwchar_tToJavaString(t.pEnv,_nArgument); + // call method + jint out = t.pEnv->CallIntMethod( object, _inout_MethodID , str); + t.pEnv->DeleteLocalRef(str); + ThrowSQLException( t.pEnv, NULL ); + return (sal_Int32)out; +} +// ----------------------------------------------------------------------------- +jclass java_lang_Object::findMyClass(const char* _pClassName) +{ + // die Klasse muss nur einmal geholt werden, daher statisch + SDBThreadAttach t; + jclass tempClass = t.pEnv->FindClass(_pClassName); OSL_ENSURE(tempClass,"Java : FindClass nicht erfolgreich!"); + if(!tempClass) + { + t.pEnv->ExceptionDescribe(); + t.pEnv->ExceptionClear(); + } + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + return globClass; +} diff --git a/connectivity/source/drivers/jdbc/PreparedStatement.cxx b/connectivity/source/drivers/jdbc/PreparedStatement.cxx index 281e29fd5919..beef4792ba1e 100644 --- a/connectivity/source/drivers/jdbc/PreparedStatement.cxx +++ b/connectivity/source/drivers/jdbc/PreparedStatement.cxx @@ -73,33 +73,15 @@ java_sql_PreparedStatement::~java_sql_PreparedStatement() } // ----------------------------------------------------------------------------- -jclass java_sql_PreparedStatement::getMyClass() +jclass java_sql_PreparedStatement::getMyClass() const { // die Klasse muss nur einmal geholt werden, daher statisch if( !theClass ) - { - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - { - jclass tempClass = t.pEnv->FindClass("java/sql/PreparedStatement"); OSL_ENSURE(tempClass,"Java : FindClass nicht erfolgreich!"); - jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); - t.pEnv->DeleteLocalRef( tempClass ); - saveClassRef( globClass ); - } - } + theClass = findMyClass("java/sql/PreparedStatement"); return theClass; } // ------------------------------------------------------------------------- -void java_sql_PreparedStatement::saveClassRef( jclass pClass ) -{ - if( pClass==0 ) - return; - // der uebergebe Klassen-Handle ist schon global, daher einfach speichern - theClass = pClass; -} -// ------------------------------------------------------------------------- - ::com::sun::star::uno::Any SAL_CALL java_sql_PreparedStatement::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { ::com::sun::star::uno::Any aRet = OStatement_BASE2::queryInterface(rType); @@ -127,24 +109,8 @@ sal_Bool SAL_CALL java_sql_PreparedStatement::execute( ) throw(::com::sun::star ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); - jboolean out(sal_False); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - createStatement(t.pEnv); - - // temporaere Variable initialisieren - static const char * cSignature = "()Z"; - static const char * cMethodName = "execute"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallBooleanMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv - return out; + static jmethodID mID(NULL); + return callBooleanMethod( "execute", mID ); } // ------------------------------------------------------------------------- @@ -153,25 +119,8 @@ sal_Int32 SAL_CALL java_sql_PreparedStatement::executeUpdate( ) throw(::com::su ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); m_aLogger.log( LogLevel::FINE, STR_LOG_EXECUTING_PREPARED_UPDATE ); - - jint out(0); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - createStatement(t.pEnv); - - // temporaere Variable initialisieren - static const char * cSignature = "()I"; - static const char * cMethodName = "executeUpdate"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallIntMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv - return (sal_Int32)out; + static jmethodID mID(NULL); + return impl_getProperty("executeUpdate",mID); } // ------------------------------------------------------------------------- @@ -182,21 +131,18 @@ void SAL_CALL java_sql_PreparedStatement::setString( sal_Int32 parameterIndex, c m_aLogger.log( LogLevel::FINER, STR_LOG_STRING_PARAMETER, parameterIndex, x ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ // temporaere Variable initialisieren + { // temporaere Variable initialisieren createStatement(t.pEnv); static const char * cSignature = "(ILjava/lang/String;)V"; static const char * cMethodName = "setString"; // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - jstring str = convertwchar_tToJavaString(t.pEnv,x); - t.pEnv->CallVoidMethod( object, mID, parameterIndex,str); - // und aufraeumen - t.pEnv->DeleteLocalRef(str); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID + static jmethodID mID(NULL); + obtainMethodId(t.pEnv, cMethodName,cSignature, mID); + jstring str = convertwchar_tToJavaString(t.pEnv,x); + t.pEnv->CallVoidMethod( object, mID, parameterIndex,str); + // und aufraeumen + t.pEnv->DeleteLocalRef(str); + ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); } //t.pEnv } // ------------------------------------------------------------------------- @@ -213,23 +159,10 @@ void SAL_CALL java_sql_PreparedStatement::setString( sal_Int32 parameterIndex, c ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); - jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - createStatement(t.pEnv); - - // temporaere Variable initialisieren - static const char * cSignature = "()Ljava/sql/ResultSet;"; - static const char * cMethodName = "executeQuery"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallObjectMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } - } + createStatement(t.pEnv); + static jmethodID mID(NULL); + jobject out = callResultSetMethod(t.env(),"executeQuery",mID); return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out, m_aLogger, *m_pConnection,this); } @@ -242,21 +175,9 @@ void SAL_CALL java_sql_PreparedStatement::setBoolean( sal_Int32 parameterIndex, checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "(IZ)V"; - static const char * cMethodName = "setBoolean"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID, parameterIndex,x); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv + createStatement(t.pEnv); + static jmethodID mID(NULL); + callVoidMethod("setBoolean", "(IZ)V", mID, parameterIndex, x); } // ------------------------------------------------------------------------- @@ -267,21 +188,9 @@ void SAL_CALL java_sql_PreparedStatement::setByte( sal_Int32 parameterIndex, sal checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "(IB)V"; - static const char * cMethodName = "setByte"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID, parameterIndex,x); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv + createStatement(t.pEnv); + static jmethodID mID(NULL); + callVoidMethod("setByte", "(IB)V", mID, parameterIndex, x); } // ------------------------------------------------------------------------- @@ -292,26 +201,10 @@ void SAL_CALL java_sql_PreparedStatement::setDate( sal_Int32 parameterIndex, con checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - createStatement(t.pEnv); - - // temporaere Variable initialisieren - static const char * cSignature = "(ILjava/sql/Date;)V"; - static const char * cMethodName = "setDate"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - jvalue args[1]; - // Parameter konvertieren - java_sql_Date aT(x); - args[0].l = aT.getJavaObject(); - t.pEnv->CallVoidMethod( object, mID, parameterIndex,args[0].l); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv + createStatement(t.pEnv); + java_sql_Date aT(x); + static jmethodID mID(NULL); + callVoidMethod("setDate", "(ILjava/sql/Date;)V", mID, parameterIndex, aT.getJavaObject()); } // ------------------------------------------------------------------------- @@ -323,27 +216,10 @@ void SAL_CALL java_sql_PreparedStatement::setTime( sal_Int32 parameterIndex, con checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - createStatement(t.pEnv); - - // temporaere Variable initialisieren - static const char * cSignature = "(ILjava/sql/Time;)V"; - static const char * cMethodName = "setTime"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - jvalue args[2]; - // Parameter konvertieren - args[0].i = (sal_Int32)parameterIndex; - java_sql_Time aT(x); - args[1].l = aT.getJavaObject(); - t.pEnv->CallVoidMethod( object, mID, parameterIndex,args[1].l); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv + createStatement(t.pEnv); + java_sql_Time aT(x); + static jmethodID mID(NULL); + callVoidMethod("setTime", "(ILjava/sql/Time;)V", mID, parameterIndex, aT.getJavaObject()); } // ------------------------------------------------------------------------- @@ -354,26 +230,10 @@ void SAL_CALL java_sql_PreparedStatement::setTimestamp( sal_Int32 parameterIndex checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - createStatement(t.pEnv); - - // temporaere Variable initialisieren - static const char * cSignature = "(ILjava/sql/Timestamp;)V"; - static const char * cMethodName = "setTimestamp"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - jvalue args[1]; - // Parameter konvertieren - java_sql_Timestamp aT(x); - args[0].l = aT.getJavaObject(); - t.pEnv->CallVoidMethod( object, mID, parameterIndex,args[0].l); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv + createStatement(t.pEnv); + static jmethodID mID(NULL); + java_sql_Timestamp aD(x); + callVoidMethod("setTimestamp", "(ILjava/sql/Timestamp;)V", mID, parameterIndex, aD.getJavaObject()); } // ------------------------------------------------------------------------- void SAL_CALL java_sql_PreparedStatement::setDouble( sal_Int32 parameterIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) @@ -383,21 +243,9 @@ void SAL_CALL java_sql_PreparedStatement::setDouble( sal_Int32 parameterIndex, d checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "(ID)V"; - static const char * cMethodName = "setDouble"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID, parameterIndex,x); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv + createStatement(t.pEnv); + static jmethodID mID(NULL); + callVoidMethod("setDouble", "(ID)V", mID, parameterIndex, x); } // ------------------------------------------------------------------------- @@ -408,21 +256,9 @@ void SAL_CALL java_sql_PreparedStatement::setFloat( sal_Int32 parameterIndex, fl checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "(IF)V"; - static const char * cMethodName = "setFloat"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID, parameterIndex,x); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv + createStatement(t.pEnv); + static jmethodID mID(NULL); + callVoidMethod("setFloat", "(IF)V", mID, parameterIndex, x); } // ------------------------------------------------------------------------- @@ -433,21 +269,9 @@ void SAL_CALL java_sql_PreparedStatement::setInt( sal_Int32 parameterIndex, sal_ checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "(II)V"; - static const char * cMethodName = "setInt"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID, parameterIndex,x); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv + createStatement(t.pEnv); + static jmethodID mID(NULL); + callVoidMethod("setInt", "(II)V", mID, parameterIndex, x); } // ------------------------------------------------------------------------- @@ -458,21 +282,9 @@ void SAL_CALL java_sql_PreparedStatement::setLong( sal_Int32 parameterIndex, sal checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "(IJ)V"; - static const char * cMethodName = "setLong"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID, parameterIndex,x); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv + createStatement(t.pEnv); + static jmethodID mID(NULL); + callVoidMethod("setLong", "(IJ)V", mID, parameterIndex, x); } // ------------------------------------------------------------------------- @@ -483,21 +295,9 @@ void SAL_CALL java_sql_PreparedStatement::setNull( sal_Int32 parameterIndex, sal checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "(II)V"; - static const char * cMethodName = "setNull"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID, parameterIndex,sqlType); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv + createStatement(t.pEnv); + static jmethodID mID(NULL); + callVoidMethod("setNull", "(II)V", mID, parameterIndex, sqlType); } // ------------------------------------------------------------------------- @@ -532,17 +332,16 @@ void SAL_CALL java_sql_PreparedStatement::setObjectWithInfo( sal_Int32 parameter checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { createStatement(t.pEnv); // temporaere Variable initialisieren static const char * cSignature = "(ILjava/lang/Object;II)V"; static const char * cMethodName = "setObject"; // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + static jmethodID mID(NULL); + obtainMethodId(t.pEnv, cMethodName,cSignature, mID); + { jobject obj = NULL; double nTemp = 0.0; switch(targetSqlType) @@ -592,22 +391,9 @@ void SAL_CALL java_sql_PreparedStatement::setObjectNull( sal_Int32 parameterInde checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - createStatement(t.pEnv); - - // temporaere Variable initialisieren - static const char * cSignature = "(ILjava/lang/Object;)V"; - static const char * cMethodName = "setObject"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID, parameterIndex,0); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv + createStatement(t.pEnv); + static jmethodID mID(NULL); + callVoidMethod<jobject>("setObject", "(ILjava/lang/Object;)V", mID, parameterIndex, NULL); } // ------------------------------------------------------------------------- @@ -631,21 +417,9 @@ void SAL_CALL java_sql_PreparedStatement::setShort( sal_Int32 parameterIndex, sa checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "(IS)V"; - static const char * cMethodName = "setShort"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID, parameterIndex,x); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv + createStatement(t.pEnv); + static jmethodID mID(NULL); + callVoidMethod("setShort", "(IS)V", mID, parameterIndex, x); } // ------------------------------------------------------------------------- @@ -656,24 +430,20 @@ void SAL_CALL java_sql_PreparedStatement::setBytes( sal_Int32 parameterIndex, co checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { createStatement(t.pEnv); // temporaere Variable initialisieren static const char * cSignature = "(I[B)V"; static const char * cMethodName = "setBytes"; // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - jbyteArray pByteArray = t.pEnv->NewByteArray(x.getLength()); - t.pEnv->SetByteArrayRegion(pByteArray,0,x.getLength(),(jbyte*)x.getConstArray()); - t.pEnv->CallVoidMethod( object, mID, parameterIndex,pByteArray); - t.pEnv->DeleteLocalRef(pByteArray); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID + static jmethodID mID(NULL); + obtainMethodId(t.pEnv, cMethodName,cSignature, mID); + jbyteArray pByteArray = t.pEnv->NewByteArray(x.getLength()); + t.pEnv->SetByteArrayRegion(pByteArray,0,x.getLength(),(jbyte*)x.getConstArray()); + t.pEnv->CallVoidMethod( object, mID, parameterIndex,pByteArray); + t.pEnv->DeleteLocalRef(pByteArray); + ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); } //t.pEnv } // ------------------------------------------------------------------------- @@ -685,48 +455,43 @@ void SAL_CALL java_sql_PreparedStatement::setCharacterStream( sal_Int32 paramete checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { createStatement(t.pEnv); // temporaere Variable initialisieren static const char * cSignature = "(ILjava/io/InputStream;I)V"; static const char * cMethodName = "setCharacterStream"; // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) - { - Sequence< sal_Int8 > aSeq; - if ( x.is() ) - x->readBytes( aSeq, length ); - sal_Int32 actualLength = aSeq.getLength(); - - jvalue args2[3]; - jbyteArray pByteArray = t.pEnv->NewByteArray( actualLength ); - t.pEnv->SetByteArrayRegion(pByteArray,0,actualLength,(jbyte*)aSeq.getConstArray()); - args2[0].l = pByteArray; - args2[1].i = 0; - args2[2].i = actualLength; - // temporaere Variable initialisieren - const char * cSignatureStream = "([BII)V"; - // Java-Call absetzen - jclass aClass = t.pEnv->FindClass("java/io/CharArrayInputStream"); - static jmethodID mID2 = NULL; - if ( !mID2 ) - mID2 = t.pEnv->GetMethodID( aClass, "<init>", cSignatureStream ); - jobject tempObj = NULL; - if(mID2) - tempObj = t.pEnv->NewObjectA( aClass, mID2, args2 ); - - t.pEnv->CallVoidMethod( object, mID, parameterIndex,tempObj,actualLength); - // und aufraeumen - t.pEnv->DeleteLocalRef(pByteArray); - t.pEnv->DeleteLocalRef(tempObj); - t.pEnv->DeleteLocalRef(aClass); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } - + static jmethodID mID(NULL); + obtainMethodId(t.pEnv, cMethodName,cSignature, mID); + Sequence< sal_Int8 > aSeq; + if ( x.is() ) + x->readBytes( aSeq, length ); + sal_Int32 actualLength = aSeq.getLength(); + + jvalue args2[3]; + jbyteArray pByteArray = t.pEnv->NewByteArray( actualLength ); + t.pEnv->SetByteArrayRegion(pByteArray,0,actualLength,(jbyte*)aSeq.getConstArray()); + args2[0].l = pByteArray; + args2[1].i = 0; + args2[2].i = actualLength; + // temporaere Variable initialisieren + const char * cSignatureStream = "([BII)V"; + // Java-Call absetzen + jclass aClass = t.pEnv->FindClass("java/io/CharArrayInputStream"); + static jmethodID mID2 = NULL; + if ( !mID2 ) + mID2 = t.pEnv->GetMethodID( aClass, "<init>", cSignatureStream ); + jobject tempObj = NULL; + if(mID2) + tempObj = t.pEnv->NewObjectA( aClass, mID2, args2 ); + + t.pEnv->CallVoidMethod( object, mID, parameterIndex,tempObj,actualLength); + // und aufraeumen + t.pEnv->DeleteLocalRef(pByteArray); + t.pEnv->DeleteLocalRef(tempObj); + t.pEnv->DeleteLocalRef(aClass); + ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); } //t.pEnv } // ------------------------------------------------------------------------- @@ -738,16 +503,14 @@ void SAL_CALL java_sql_PreparedStatement::setBinaryStream( sal_Int32 parameterIn checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { createStatement(t.pEnv); // temporaere Variable initialisieren static const char * cSignature = "(ILjava/io/InputStream;I)V"; static const char * cMethodName = "setBinaryStream"; // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) + static jmethodID mID(NULL); + obtainMethodId(t.pEnv, cMethodName,cSignature, mID); { Sequence< sal_Int8 > aSeq; if ( x.is() ) @@ -789,20 +552,11 @@ void SAL_CALL java_sql_PreparedStatement::clearParameters( ) throw(::com::sun:: checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; - if( t.pEnv ){ + { createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "()V"; - static const char * cMethodName = "clearParameters"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID + static jmethodID mID(NULL); + callVoidMethod("clearParameters",mID); } //t.pEnv } // ------------------------------------------------------------------------- @@ -811,20 +565,10 @@ void SAL_CALL java_sql_PreparedStatement::clearBatch( ) throw(::com::sun::star: ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { createStatement(t.pEnv); - - // temporaere Variable initialisieren - static const char * cSignature = "()V"; - static const char * cMethodName = "clearBatch"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID + static jmethodID mID(NULL); + callVoidMethod("clearBatch",mID); } //t.pEnv } // ------------------------------------------------------------------------- @@ -834,19 +578,10 @@ void SAL_CALL java_sql_PreparedStatement::addBatch( ) throw(::com::sun::star::sd ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "()V"; - static const char * cMethodName = "addBatch"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID + static jmethodID mID(NULL); + callVoidMethod("addBatch",mID); } //t.pEnv } // ------------------------------------------------------------------------- @@ -857,27 +592,16 @@ void SAL_CALL java_sql_PreparedStatement::addBatch( ) throw(::com::sun::star::sd checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); ::com::sun::star::uno::Sequence< sal_Int32 > aSeq; SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "()[I"; - static const char * cMethodName = "executeBatch"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - jintArray out = (jintArray)t.pEnv->CallObjectMethod( object, mID ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - if(out) - { - jboolean p = sal_False; - aSeq.realloc(t.pEnv->GetArrayLength(out)); - memcpy(aSeq.getArray(),t.pEnv->GetIntArrayElements(out,&p),aSeq.getLength()); - t.pEnv->DeleteLocalRef(out); - } - } //mID - } //t.pEnv + createStatement(t.pEnv); + static jmethodID mID(NULL); + jintArray out = (jintArray)callObjectMethod(t.pEnv,"executeBatch","()[I", mID); + if(out) + { + jboolean p = sal_False; + aSeq.realloc(t.pEnv->GetArrayLength(out)); + memcpy(aSeq.getArray(),t.pEnv->GetIntArrayElements(out,&p),aSeq.getLength()); + t.pEnv->DeleteLocalRef(out); + } return aSeq; } // ------------------------------------------------------------------------- @@ -885,28 +609,14 @@ void SAL_CALL java_sql_PreparedStatement::addBatch( ) throw(::com::sun::star::sd { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); - jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - { - createStatement(t.pEnv); - // temporaere Variable initialisieren - static const char * cSignature = "()Ljava/sql/ResultSetMetaData;"; - static const char * cMethodName = "getMetaData"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallObjectMethod( object, mID ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } - } + createStatement(t.pEnv); + static jmethodID mID(NULL); + jobject out = callObjectMethod(t.pEnv,"getMetaData","()Ljava/sql/ResultSetMetaData;", mID); return out==0 ? 0 : new java_sql_ResultSetMetaData( t.pEnv, out, m_aLogger,*m_pConnection ); } // ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- void SAL_CALL java_sql_PreparedStatement::acquire() throw() { OStatement_BASE2::acquire(); @@ -932,7 +642,7 @@ void java_sql_PreparedStatement::createStatement(JNIEnv* _pEnv) args[0].l = convertwchar_tToJavaString(_pEnv,m_sSqlStatement); // Java-Call absetzen jobject out = NULL; - static jmethodID mID = NULL; + static jmethodID mID(NULL); if ( !mID ) mID = _pEnv->GetMethodID( m_pConnection->getMyClass(), cMethodName, cSignature ); if( mID ) diff --git a/connectivity/source/drivers/jdbc/Reader.cxx b/connectivity/source/drivers/jdbc/Reader.cxx index cf3f6c386bbb..7460e519f8ca 100644 --- a/connectivity/source/drivers/jdbc/Reader.cxx +++ b/connectivity/source/drivers/jdbc/Reader.cxx @@ -51,28 +51,14 @@ java_io_Reader::~java_io_Reader() SDBThreadAttach::releaseRef(); } -jclass java_io_Reader::getMyClass() +jclass java_io_Reader::getMyClass() const { // die Klasse muss nur einmal geholt werden, daher statisch - if( !theClass ){ - SDBThreadAttach t; - if( !t.pEnv ) return (jclass)NULL; - jclass tempClass = t.pEnv->FindClass( "java/io/Reader" ); - jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); - t.pEnv->DeleteLocalRef( tempClass ); - saveClassRef( globClass ); - } + if( !theClass ) + theClass = findMyClass("java/io/Reader"); return theClass; } -void java_io_Reader::saveClassRef( jclass pClass ) -{ - if( pClass==NULL ) - return; - // der uebergebe Klassen-Handle ist schon global, daher einfach speichern - theClass = pClass; -} - sal_Int32 SAL_CALL java_io_Reader::readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) { return readBytes(aData,nMaxBytesToRead); @@ -80,62 +66,31 @@ sal_Int32 SAL_CALL java_io_Reader::readSomeBytes( ::com::sun::star::uno::Sequenc void SAL_CALL java_io_Reader::skipBytes( sal_Int32 nBytesToSkip ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) { - jint out(0); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - { - static const char * cSignature = "(I)I"; - static const char * cMethodName = "skip"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) - { - out = t.pEnv->CallIntMethod( object, mID,nBytesToSkip); - ThrowSQLException(t.pEnv,*this); - } - } //t.pEnv + static jmethodID mID(NULL); + callIntMethodWithIntArg("skip",mID,nBytesToSkip); } sal_Int32 SAL_CALL java_io_Reader::available( ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) { jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { static const char * cSignature = "()Z"; static const char * cMethodName = "available"; // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) - { - out = t.pEnv->CallBooleanMethod( object, mID); - ThrowSQLException(t.pEnv,*this); - } + static jmethodID mID(NULL); + obtainMethodId(t.pEnv, cMethodName,cSignature, mID); + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); } //t.pEnv return out; } void SAL_CALL java_io_Reader::closeInput( ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) { - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - { - static const char * cSignature = "()V"; - static const char * cMethodName = "close"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) - { - t.pEnv->CallVoidMethod( object, mID); - ThrowSQLException(t.pEnv,*this); - } - } //t.pEnv + static jmethodID mID(NULL); + callVoidMethod("close",mID); } // ----------------------------------------------------- sal_Int32 SAL_CALL java_io_Reader::readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) @@ -143,28 +98,24 @@ sal_Int32 SAL_CALL java_io_Reader::readBytes( ::com::sun::star::uno::Sequence< s OSL_ENSURE(aData.getLength() < nBytesToRead," Sequence is smaller than BytesToRead"); jint out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { jcharArray pCharArray = t.pEnv->NewCharArray(nBytesToRead); static const char * cSignature = "([CII)I"; static const char * cMethodName = "read"; // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) + static jmethodID mID(NULL); + obtainMethodId(t.pEnv, cMethodName,cSignature, mID); + out = t.pEnv->CallIntMethod( object, mID, pCharArray, 0, nBytesToRead ); + if ( !out ) + ThrowSQLException(t.pEnv,*this); + if(out > 0) { - out = t.pEnv->CallIntMethod( object, mID, pCharArray, 0, nBytesToRead ); - if ( !out ) - ThrowSQLException(t.pEnv,*this); - if(out > 0) - { - jboolean p = sal_False; - if(aData.getLength() < out) - aData.realloc(out-aData.getLength()); + jboolean p = sal_False; + if(aData.getLength() < out) + aData.realloc(out-aData.getLength()); - memcpy(aData.getArray(),t.pEnv->GetCharArrayElements(pCharArray,&p),out); - } + memcpy(aData.getArray(),t.pEnv->GetCharArrayElements(pCharArray,&p),out); } t.pEnv->DeleteLocalRef((jcharArray)pCharArray); } //t.pEnv diff --git a/connectivity/source/drivers/jdbc/Ref.cxx b/connectivity/source/drivers/jdbc/Ref.cxx index d522ff4e22ba..dd91d1bd4aec 100644 --- a/connectivity/source/drivers/jdbc/Ref.cxx +++ b/connectivity/source/drivers/jdbc/Ref.cxx @@ -48,48 +48,17 @@ java_sql_Ref::~java_sql_Ref() SDBThreadAttach::releaseRef(); } -jclass java_sql_Ref::getMyClass() +jclass java_sql_Ref::getMyClass() const { // die Klasse muss nur einmal geholt werden, daher statisch - if( !theClass ){ - SDBThreadAttach t; - if( !t.pEnv ) return (jclass)NULL; - jclass tempClass = t.pEnv->FindClass( "java/sql/Ref" ); - jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); - t.pEnv->DeleteLocalRef( tempClass ); - saveClassRef( globClass ); - } + if( !theClass ) + theClass = findMyClass("java/sql/Ref"); return theClass; } -void java_sql_Ref::saveClassRef( jclass pClass ) -{ - if( pClass==NULL ) - return; - // der uebergebe Klassen-Handle ist schon global, daher einfach speichern - theClass = pClass; -} - ::rtl::OUString SAL_CALL java_sql_Ref::getBaseTypeName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - ::rtl::OUString aStr; - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "()Ljava/lang/String;"; - static const char * cMethodName = "getBaseTypeName"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID); - ThrowSQLException(t.pEnv,*this); - aStr = JavaString2String(t.pEnv,out); - // und aufraeumen - } //mID - } //t.pEnv - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! - return aStr; + static jmethodID mID(NULL); + return callStringMethod("getBaseTypeName",mID); } diff --git a/connectivity/source/drivers/jdbc/ResultSet.cxx b/connectivity/source/drivers/jdbc/ResultSet.cxx index 23270f3ea3ac..9b8de989bb51 100644 --- a/connectivity/source/drivers/jdbc/ResultSet.cxx +++ b/connectivity/source/drivers/jdbc/ResultSet.cxx @@ -86,10 +86,10 @@ java_sql_ResultSet::java_sql_ResultSet( JNIEnv * pEnv, jobject myObj, const java osl_incrementInterlockedCount(&m_refCount); if ( pStmt ) m_xStatement = *pStmt; + osl_decrementInterlockedCount(&m_refCount); } // ----------------------------------------------------------------------------- - java_sql_ResultSet::~java_sql_ResultSet() { if ( !java_sql_ResultSet_BASE::rBHelper.bDisposed && !java_sql_ResultSet_BASE::rBHelper.bInDispose ) @@ -100,29 +100,15 @@ java_sql_ResultSet::~java_sql_ResultSet() } } -jclass java_sql_ResultSet::getMyClass() +jclass java_sql_ResultSet::getMyClass() const { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getMyClass" ); // die Klasse muss nur einmal geholt werden, daher statisch - if( !theClass ){ - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( !t.pEnv ) return (jclass)0; - jclass tempClass = t.pEnv->FindClass("java/sql/ResultSet"); OSL_ENSURE(tempClass,"Java : FindClass nicht erfolgreich!"); - jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); - t.pEnv->DeleteLocalRef( tempClass ); - saveClassRef( globClass ); - } + if( !theClass ) + theClass = findMyClass("java/sql/ResultSet"); return theClass; } -void java_sql_ResultSet::saveClassRef( jclass pClass ) -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::saveClassRef" ); - if( pClass==0 ) - return; - // der uebergebe Klassen-Handle ist schon global, daher einfach speichern - theClass = pClass; -} // ------------------------------------------------------------------------- void java_sql_ResultSet::disposing(void) { @@ -134,22 +120,10 @@ void java_sql_ResultSet::disposing(void) if( object ) { SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "()V"; - static const char * cMethodName = "close"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - clearObject(*t.pEnv); - } - } //t.pEnv + static jmethodID mID(NULL); + callVoidMethod("close",mID); + clearObject(*t.pEnv); + } SDBThreadAttach::releaseRef(); } @@ -175,52 +149,17 @@ void java_sql_ResultSet::disposing(void) sal_Int32 SAL_CALL java_sql_ResultSet::findColumn( const ::rtl::OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::findColumn" ); - jint out(0); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - - // temporaere Variable initialisieren - static const char * cSignature = "(Ljava/lang/String;)I"; - static const char * cMethodName = "findColumn"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - // Parameter konvertieren - jstring str = convertwchar_tToJavaString(t.pEnv,columnName); - out = t.pEnv->CallIntMethod( object, mID, str ); - // und aufraeumen - t.pEnv->DeleteLocalRef(str); - - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv - return (sal_Int32)out; + static jmethodID mID(NULL); + return callIntMethodWithStringArg("findColumn",mID,columnName); } // ------------------------------------------------------------------------- - - Reference< ::com::sun::star::io::XInputStream > SAL_CALL java_sql_ResultSet::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getBinaryStream" ); - jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/io/InputStream;"; - static const char * cMethodName = "getBinaryStream"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallObjectMethod( object, mID, columnIndex); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv + static jmethodID mID(NULL); + jobject out = callObjectMethodWithIntArg(t.pEnv,"getBinaryStream","(I)Ljava/io/InputStream;", mID, columnIndex); + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out==0 ? 0 : new java_io_InputStream( t.pEnv, out ); } @@ -228,23 +167,10 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL java_sql_ResultSet::get Reference< ::com::sun::star::io::XInputStream > SAL_CALL java_sql_ResultSet::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getCharacterStream" ); - jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/io/Reader;"; - static const char * cMethodName = "getCharacterStream"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallObjectMethod( object, mID, columnIndex); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv + static jmethodID mID(NULL); + jobject out = callObjectMethodWithIntArg(t.pEnv,"getCharacterStream","(I)Ljava/io/Reader;", mID, columnIndex); + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out==0 ? 0 : new java_io_Reader( t.pEnv, out ); } @@ -253,77 +179,34 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL java_sql_ResultSet::get sal_Bool SAL_CALL java_sql_ResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getBoolean" ); - jboolean out(sal_False); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "(I)Z"; - static const char * cMethodName = "getBoolean"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallBooleanMethod( object, mID, columnIndex ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv - return out; + static jmethodID mID(NULL); + return callBooleanMethodWithIntArg( "getBoolean", mID,columnIndex ); } // ------------------------------------------------------------------------- sal_Int8 SAL_CALL java_sql_ResultSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getByte" ); - jbyte out(0); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "(I)B"; - static const char * cMethodName = "getByte"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallByteMethod( object, mID, columnIndex); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv - return out; + static jmethodID mID(NULL); + jbyte (JNIEnv::*pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallByteMethod; + return callMethodWithIntArg<jbyte>(pCallMethod,"getByte","(I)B",mID,columnIndex); } // ------------------------------------------------------------------------- Sequence< sal_Int8 > SAL_CALL java_sql_ResultSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getBytes" ); - Sequence< sal_Int8 > aSeq; + Sequence< sal_Int8 > aSeq; SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + static jmethodID mID(NULL); + jbyteArray out = (jbyteArray)callObjectMethodWithIntArg(t.pEnv,"getBytes","(I)[B", mID, columnIndex); + if (out) { - static const char * cSignature = "(I)[B"; - static const char * cMethodName = "getBytes"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - jbyteArray out = (jbyteArray)t.pEnv->CallObjectMethod( object, mID, columnIndex); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - if (out) - { - jboolean p = sal_False; - aSeq.realloc(t.pEnv->GetArrayLength(out)); - memcpy(aSeq.getArray(),t.pEnv->GetByteArrayElements(out,&p),aSeq.getLength()); - t.pEnv->DeleteLocalRef(out); - } - // und aufraeumen - } //mID - } //t.pEnv + jboolean p = sal_False; + aSeq.realloc(t.pEnv->GetArrayLength(out)); + memcpy(aSeq.getArray(),t.pEnv->GetByteArrayElements(out,&p),aSeq.getLength()); + t.pEnv->DeleteLocalRef(out); + } return aSeq; } // ------------------------------------------------------------------------- @@ -331,23 +214,9 @@ Sequence< sal_Int8 > SAL_CALL java_sql_ResultSet::getBytes( sal_Int32 columnInde ::com::sun::star::util::Date SAL_CALL java_sql_ResultSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getDate" ); - jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/sql/Date;"; - static const char * cMethodName = "getDate"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallObjectMethod( object, mID, columnIndex ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv + static jmethodID mID(NULL); + jobject out = callObjectMethodWithIntArg(t.pEnv,"getDate","(I)Ljava/sql/Date;", mID, columnIndex); // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out ? static_cast <com::sun::star::util::Date> (java_sql_Date( t.pEnv, out )) : ::com::sun::star::util::Date(); } @@ -356,141 +225,52 @@ Sequence< sal_Int8 > SAL_CALL java_sql_ResultSet::getBytes( sal_Int32 columnInde double SAL_CALL java_sql_ResultSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getDouble" ); - jdouble out(0); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "(I)D"; - static const char * cMethodName = "getDouble"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallDoubleMethod( object, mID, columnIndex); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv - return out; + static jmethodID mID(NULL); + jdouble (JNIEnv::*pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallDoubleMethod; + return callMethodWithIntArg<double>(pCallMethod,"getDouble","(I)D",mID,columnIndex); } // ------------------------------------------------------------------------- float SAL_CALL java_sql_ResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getFloat" ); - jfloat out(0); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "(I)F"; - static const char * cMethodName = "getFloat"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallFloatMethod( object, mID, columnIndex ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv - return out; + static jmethodID mID(NULL); + jfloat (JNIEnv::*pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallFloatMethod; + return callMethodWithIntArg<jfloat>(pCallMethod,"getFloat","(I)F",mID,columnIndex); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL java_sql_ResultSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getInt" ); - jint out(0); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "(I)I"; - static const char * cMethodName = "getInt"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallIntMethod( object, mID, columnIndex ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv - return (sal_Int32)out; + static jmethodID mID(NULL); + return callIntMethodWithIntArg("getInt",mID,columnIndex); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL java_sql_ResultSet::getRow( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getRow" ); - jint out(0); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "()I"; - static const char * cMethodName = "getRow"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallIntMethod( object, mID ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv - return (sal_Int32)out; + static jmethodID mID(NULL); + return callIntMethod("getRow",mID); } // ------------------------------------------------------------------------- sal_Int64 SAL_CALL java_sql_ResultSet::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getLong" ); - jlong out(0); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "(I)J"; - static const char * cMethodName = "getLong"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallLongMethod( object, mID, columnIndex ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv - return out; + static jmethodID mID(NULL); + jlong (JNIEnv::*pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallLongMethod; + return callMethodWithIntArg<jlong>(pCallMethod,"getLong","(I)L",mID,columnIndex); } // ------------------------------------------------------------------------- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL java_sql_ResultSet::getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getMetaData" ); - jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - - { - // temporaere Variable initialisieren - static const char * cSignature = "()Ljava/sql/ResultSetMetaData;"; - static const char * cMethodName = "getMetaData"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallObjectMethod( object, mID ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } - } + static jmethodID mID(NULL); + jobject out = callObjectMethod(t.pEnv,"getMetaData","()Ljava/sql/ResultSetMetaData;", mID); return out==0 ? 0 : new java_sql_ResultSetMetaData( t.pEnv, out, m_aLogger,*m_pConnection ); } @@ -498,22 +278,10 @@ sal_Int64 SAL_CALL java_sql_ResultSet::getLong( sal_Int32 columnIndex ) throw(SQ Reference< XArray > SAL_CALL java_sql_ResultSet::getArray( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getArray" ); - jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/sql/Array;"; - static const char * cMethodName = "getArray"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallObjectMethod( object, mID, columnIndex); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv + static jmethodID mID(NULL); + jobject out = callObjectMethodWithIntArg(t.pEnv,"getArray","(I)Ljava/sql/Array;", mID, columnIndex); + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out==0 ? 0 : new java_sql_Array( t.pEnv, out ); } @@ -522,22 +290,9 @@ Reference< XArray > SAL_CALL java_sql_ResultSet::getArray( sal_Int32 columnIndex Reference< XClob > SAL_CALL java_sql_ResultSet::getClob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getClob" ); - jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/sql/Clob;"; - static const char * cMethodName = "getClob"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallObjectMethod( object, mID, columnIndex); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv + static jmethodID mID(NULL); + jobject out = callObjectMethodWithIntArg(t.pEnv,"getClob","(I)Ljava/sql/Clob;", mID, columnIndex); // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out==0 ? 0 : new java_sql_Clob( t.pEnv, out ); } @@ -545,22 +300,9 @@ Reference< XClob > SAL_CALL java_sql_ResultSet::getClob( sal_Int32 columnIndex ) Reference< XBlob > SAL_CALL java_sql_ResultSet::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getBlob" ); - jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/sql/Blob;"; - static const char * cMethodName = "getBlob"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallObjectMethod( object, mID, columnIndex); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv + static jmethodID mID(NULL); + jobject out = callObjectMethodWithIntArg(t.pEnv,"getBlob","(I)Ljava/sql/Blob;", mID, columnIndex); // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out==0 ? 0 : new java_sql_Blob( t.pEnv, out ); } @@ -569,22 +311,10 @@ Reference< XBlob > SAL_CALL java_sql_ResultSet::getBlob( sal_Int32 columnIndex ) Reference< XRef > SAL_CALL java_sql_ResultSet::getRef( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getRef" ); - jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/sql/Ref;"; - static const char * cMethodName = "getRef"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallObjectMethod( object, mID, columnIndex); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv + static jmethodID mID(NULL); + jobject out = callObjectMethodWithIntArg(t.pEnv,"getRef","(I)Ljava/sql/Ref;", mID, columnIndex); + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out==0 ? 0 : new java_sql_Ref( t.pEnv, out ); } @@ -595,24 +325,27 @@ Any SAL_CALL java_sql_ResultSet::getObject( sal_Int32 columnIndex, const Referen RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getObject" ); jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { jvalue args[2]; // Parameter konvertieren args[0].i = (sal_Int32)columnIndex; args[1].l = convertTypeMapToJavaMap(t.pEnv,typeMap); // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/lang/Object;"; - static const char * cMethodName = "getObject"; // Java-Call absetzen - static jmethodID mID = NULL; + static jmethodID mID(NULL); if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(I)Ljava/lang/Object;"; + static const char * cMethodName = "getObject"; + + obtainMethodId(t.pEnv, cMethodName,cSignature, mID); + } + out = t.pEnv->CallObjectMethodA( object, mID, args); t.pEnv->DeleteLocalRef((jstring)args[1].l); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen - } //mID + } //t.pEnv // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out==0 ? Any() : Any();//new java_lang_Object( t.pEnv, out ); @@ -622,23 +355,9 @@ Any SAL_CALL java_sql_ResultSet::getObject( sal_Int32 columnIndex, const Referen sal_Int16 SAL_CALL java_sql_ResultSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getShort" ); - jshort out(0); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "(I)S"; - static const char * cMethodName = "getShort"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallShortMethod( object, mID, columnIndex); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv - return (sal_Int16)out; + static jmethodID mID(NULL); + jshort (JNIEnv::*pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallShortMethod; + return callMethodWithIntArg<jshort>(pCallMethod,"getShort","(I)S",mID,columnIndex); } // ------------------------------------------------------------------------- @@ -646,25 +365,8 @@ sal_Int16 SAL_CALL java_sql_ResultSet::getShort( sal_Int32 columnIndex ) throw(S ::rtl::OUString SAL_CALL java_sql_ResultSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getString" ); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - ::rtl::OUString aStr; - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/lang/String;"; - static const char * cMethodName = "getString"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, columnIndex ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - aStr = JavaString2String(t.pEnv,out); - // und aufraeumen - } //mID - } //t.pEnv - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! - return aStr; + static jmethodID mID(NULL); + return callStringMethodWithIntArg("getString",mID,columnIndex); } // ------------------------------------------------------------------------- @@ -672,23 +374,9 @@ sal_Int16 SAL_CALL java_sql_ResultSet::getShort( sal_Int32 columnIndex ) throw(S ::com::sun::star::util::Time SAL_CALL java_sql_ResultSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getTime" ); - jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/sql/Time;"; - static const char * cMethodName = "getTime"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallObjectMethod( object, mID, columnIndex); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv + static jmethodID mID(NULL); + jobject out = callObjectMethodWithIntArg(t.pEnv,"getTime","(I)Ljava/sql/Time;", mID, columnIndex); // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out ? static_cast <com::sun::star::util::Time> (java_sql_Time( t.pEnv, out )) : ::com::sun::star::util::Time(); } @@ -698,22 +386,9 @@ sal_Int16 SAL_CALL java_sql_ResultSet::getShort( sal_Int32 columnIndex ) throw(S ::com::sun::star::util::DateTime SAL_CALL java_sql_ResultSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getTimestamp" ); - jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/sql/Timestamp;"; - static const char * cMethodName = "getTimestamp"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallObjectMethod( object, mID, columnIndex); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv + static jmethodID mID(NULL); + jobject out = callObjectMethodWithIntArg(t.pEnv,"getTimestamp","(I)Ljava/sql/Timestamp;", mID, columnIndex); // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out ? static_cast <com::sun::star::util::DateTime> (java_sql_Timestamp( t.pEnv, out )) : ::com::sun::star::util::DateTime(); } @@ -722,112 +397,36 @@ sal_Int16 SAL_CALL java_sql_ResultSet::getShort( sal_Int32 columnIndex ) throw(S sal_Bool SAL_CALL java_sql_ResultSet::isAfterLast( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::isAfterLast" ); - jboolean out(sal_False); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - - { - // temporaere Variable initialisieren - static const char * cSignature = "()Z"; - static const char * cMethodName = "isAfterLast"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallBooleanMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv - return out; + static jmethodID mID(NULL); + return callBooleanMethod( "isAfterLast", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_ResultSet::isFirst( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::isFirst" ); - jboolean out(sal_False); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - - { - // temporaere Variable initialisieren - static const char * cSignature = "()Z"; - static const char * cMethodName = "isFirst"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallBooleanMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv - return out; + static jmethodID mID(NULL); + return callBooleanMethod( "isFirst", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_ResultSet::isLast( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::isLast" ); - jboolean out(sal_False); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - - { - // temporaere Variable initialisieren - static const char * cSignature = "()Z"; - static const char * cMethodName = "isLast"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallBooleanMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv - return out; + static jmethodID mID(NULL); + return callBooleanMethod( "isLast", mID ); } // ------------------------------------------------------------------------- void SAL_CALL java_sql_ResultSet::beforeFirst( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::beforeFirst" ); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - - { - // temporaere Variable initialisieren - static const char * cSignature = "()V"; - static const char * cMethodName = "isBeforeFirst"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv + static jmethodID mID(NULL); + callVoidMethod("beforeFirst",mID); } // ------------------------------------------------------------------------- void SAL_CALL java_sql_ResultSet::afterLast( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::afterLast" ); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - - { - // temporaere Variable initialisieren - static const char * cSignature = "()V"; - static const char * cMethodName = "afterLast"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv + static jmethodID mID(NULL); + callVoidMethod("afterLast",mID); } // ------------------------------------------------------------------------- @@ -841,113 +440,37 @@ void SAL_CALL java_sql_ResultSet::close( ) throw(::com::sun::star::sdbc::SQLExc sal_Bool SAL_CALL java_sql_ResultSet::first( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::first" ); - jboolean out(sal_False); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "()Z"; - static const char * cMethodName = "first"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallBooleanMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv - return out; + static jmethodID mID(NULL); + return callBooleanMethod( "first", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_ResultSet::last( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::last" ); - jboolean out(sal_False); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "()Z"; - static const char * cMethodName = "last"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallBooleanMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv - return out; + static jmethodID mID(NULL); + return callBooleanMethod( "last", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_ResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::absolute" ); - jboolean out(sal_False); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "(I)Z"; - static const char * cMethodName = "absolute"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallBooleanMethod( object, mID,row); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv - return out; + static jmethodID mID(NULL); + return callBooleanMethodWithIntArg( "absolute", mID,row ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_ResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::relative" ); - jboolean out(sal_False); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "(I)Z"; - static const char * cMethodName = "relative"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallBooleanMethod( object, mID,row); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv - return out; + static jmethodID mID(NULL); + return callBooleanMethodWithIntArg( "relative", mID,row ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_ResultSet::previous( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::previous" ); - jboolean out(sal_False); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - - { - // temporaere Variable initialisieren - static const char * cSignature = "()Z"; - static const char * cMethodName = "previous"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallBooleanMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv - return out; + static jmethodID mID(NULL); + return callBooleanMethod( "previous", mID ); } // ------------------------------------------------------------------------- Reference< XInterface > SAL_CALL java_sql_ResultSet::getStatement( ) throw(SQLException, RuntimeException) @@ -960,200 +483,70 @@ Reference< XInterface > SAL_CALL java_sql_ResultSet::getStatement( ) throw(SQLE sal_Bool SAL_CALL java_sql_ResultSet::rowDeleted( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::rowDeleted" ); - jboolean out(sal_False); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "()Z"; - static const char * cMethodName = "rowDeleted"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallBooleanMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv - return out; + static jmethodID mID(NULL); + return callBooleanMethod( "rowDeleted", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_ResultSet::rowInserted( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::rowInserted" ); - jboolean out(sal_False); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "()Z"; - static const char * cMethodName = "rowInserted"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallBooleanMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv - return out; + static jmethodID mID(NULL); + return callBooleanMethod( "rowInserted", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_ResultSet::rowUpdated( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::rowUpdated" ); - jboolean out(sal_False); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "()Z"; - static const char * cMethodName = "rowUpdated"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallBooleanMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv - return out; + static jmethodID mID(NULL); + return callBooleanMethod( "rowUpdated", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_ResultSet::isBeforeFirst( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::isBeforeFirst" ); - jboolean out(sal_False); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "()Z"; - static const char * cMethodName = "isBeforeFirst"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallBooleanMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv - return out; + static jmethodID mID(NULL); + return callBooleanMethod( "isBeforeFirst", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_ResultSet::next( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::next" ); - jboolean out(sal_False); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - - { - // temporaere Variable initialisieren - static const char * cSignature = "()Z"; - static const char * cMethodName = "next"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallBooleanMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv - return out; + static jmethodID mID(NULL); + return callBooleanMethod( "next", mID ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_ResultSet::wasNull( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::wasNull" ); - jboolean out(sal_False); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "()Z"; - static const char * cMethodName = "wasNull"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallBooleanMethod( object, mID ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv - return out; + static jmethodID mID(NULL); + return callBooleanMethod( "wasNull", mID ); } // ------------------------------------------------------------------------- void SAL_CALL java_sql_ResultSet::cancel( ) throw(::com::sun::star::uno::RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::cancel" ); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "()V"; - static const char * cMethodName = "cancel"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv + static jmethodID mID(NULL); + callVoidMethod("cancel",mID); } // ------------------------------------------------------------------------- // ------------------------------------------------------------------------- void SAL_CALL java_sql_ResultSet::clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::clearWarnings" ); - SDBThreadAttach t; - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "()V"; - static const char * cMethodName = "clearWarnings"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } - } + static jmethodID mID(NULL); + callVoidMethod("clearWarnings",mID); } // ------------------------------------------------------------------------- ::com::sun::star::uno::Any SAL_CALL java_sql_ResultSet::getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getWarnings" ); - jobject out(NULL); SDBThreadAttach t; - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "()Ljava/sql/SQLWarning;"; - static const char * cMethodName = "getWarnings"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallObjectMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv + static jmethodID mID(NULL); + jobject out = callObjectMethod(t.pEnv,"getWarnings","()Ljava/sql/SQLWarning;", mID); // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! if( out ) { @@ -1170,247 +563,91 @@ void SAL_CALL java_sql_ResultSet::clearWarnings( ) throw(::com::sun::star::sdbc void SAL_CALL java_sql_ResultSet::insertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::insertRow" ); - SDBThreadAttach t; - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "()V"; - static const char * cMethodName = "insertRow"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } - } + static jmethodID mID(NULL); + callVoidMethod("insertRow",mID); } // ------------------------------------------------------------------------- void SAL_CALL java_sql_ResultSet::updateRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateRow" ); - SDBThreadAttach t; - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "()V"; - static const char * cMethodName = "updateRow"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } - } + static jmethodID mID(NULL); + callVoidMethod("updateRow",mID); } // ------------------------------------------------------------------------- void SAL_CALL java_sql_ResultSet::deleteRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::deleteRow" ); - SDBThreadAttach t; - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "()V"; - static const char * cMethodName = "deleteRow"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } - } + static jmethodID mID(NULL); + callVoidMethod("deleteRow",mID); } // ------------------------------------------------------------------------- void SAL_CALL java_sql_ResultSet::cancelRowUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::cancelRowUpdates" ); - SDBThreadAttach t; - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "()V"; - static const char * cMethodName = "cancelRowUpdates"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } - } + static jmethodID mID(NULL); + callVoidMethod("cancelRowUpdates",mID); } // ------------------------------------------------------------------------- void SAL_CALL java_sql_ResultSet::moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::moveToInsertRow" ); - SDBThreadAttach t; - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "()V"; - static const char * cMethodName = "moveToInsertRow"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } - } + static jmethodID mID(NULL); + callVoidMethod("moveToInsertRow",mID); } // ------------------------------------------------------------------------- void SAL_CALL java_sql_ResultSet::moveToCurrentRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::moveToCurrentRow" ); - SDBThreadAttach t; - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "()V"; - static const char * cMethodName = "moveToCurrentRow"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } - } + static jmethodID mID(NULL); + callVoidMethod("moveToCurrentRow",mID); } // ------------------------------------------------------------------------- void SAL_CALL java_sql_ResultSet::updateNull( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateNull" ); - SDBThreadAttach t; - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "(I)V"; - static const char * cMethodName = "updateNull"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID,columnIndex); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } - } + static jmethodID mID(NULL); + callVoidMethodWithIntArg("updateNull",mID,columnIndex); } // ------------------------------------------------------------------------- void SAL_CALL java_sql_ResultSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateBoolean" ); - SDBThreadAttach t; - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "(IZ)V"; - static const char * cMethodName = "updateBoolean"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID,columnIndex,x); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } - } + static jmethodID mID(NULL); + callVoidMethod("updateBoolean", "(IZ)V", mID, columnIndex, x); } // ------------------------------------------------------------------------- void SAL_CALL java_sql_ResultSet::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateByte" ); - SDBThreadAttach t; - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "(IB)V"; - static const char * cMethodName = "updateByte"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID,columnIndex,x); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } - } + static jmethodID mID(NULL); + callVoidMethod("updateByte", "(IB)V", mID, columnIndex, x); } // ------------------------------------------------------------------------- void SAL_CALL java_sql_ResultSet::updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateShort" ); - SDBThreadAttach t; - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "(IS)V"; - static const char * cMethodName = "updateShort"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID,columnIndex,x); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } - } + static jmethodID mID(NULL); + callVoidMethod("updateShort", "(IS)V", mID, columnIndex, x); } // ------------------------------------------------------------------------- void SAL_CALL java_sql_ResultSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateInt" ); - SDBThreadAttach t; - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "(II)V"; - static const char * cMethodName = "updateInt"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID,columnIndex,x); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } - } + static jmethodID mID(NULL); + callVoidMethod("updateInt", "(II)V", mID, columnIndex, x); } // ------------------------------------------------------------------------- void SAL_CALL java_sql_ResultSet::updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateLong" ); - SDBThreadAttach t; - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "(IJ)V"; - static const char * cMethodName = "updateLong"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID,columnIndex,x); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } - } + static jmethodID mID(NULL); + callVoidMethod("updateLong", "(IJ)V", mID, columnIndex, x); } // ------------------------------------------------------------------------- @@ -1418,42 +655,16 @@ void SAL_CALL java_sql_ResultSet::updateLong( sal_Int32 columnIndex, sal_Int64 x void SAL_CALL java_sql_ResultSet::updateFloat( sal_Int32 columnIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateFloat" ); - SDBThreadAttach t; - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "(IF)V"; - static const char * cMethodName = "updateFloat"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID,columnIndex,x); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } - } + static jmethodID mID(NULL); + callVoidMethod("updateFloat", "(IF)V", mID, columnIndex, x); } // ------------------------------------------------------------------------- void SAL_CALL java_sql_ResultSet::updateDouble( sal_Int32 columnIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateDouble" ); - SDBThreadAttach t; - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "(ID)V"; - static const char * cMethodName = "updateDouble"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID,columnIndex,x); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } - } + static jmethodID mID(NULL); + callVoidMethod("updateDouble", "(ID)V", mID, columnIndex, x); } // ------------------------------------------------------------------------- @@ -1461,17 +672,20 @@ void SAL_CALL java_sql_ResultSet::updateString( sal_Int32 columnIndex, const ::r { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateString" ); SDBThreadAttach t; - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "(ILjava/lang/String;)V"; - static const char * cMethodName = "updateString"; // Java-Call absetzen - static jmethodID mID = NULL; + static jmethodID mID(NULL); if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) + { + static const char * cSignature = "(ILjava/lang/String;)V"; + static const char * cMethodName = "updateString"; + + obtainMethodId(t.pEnv, cMethodName,cSignature, mID); + } + { // Parameter konvertieren jstring str = convertwchar_tToJavaString(t.pEnv,x); @@ -1487,16 +701,19 @@ void SAL_CALL java_sql_ResultSet::updateBytes( sal_Int32 columnIndex, const ::co { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateBytes" ); SDBThreadAttach t; - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "(I[B)V"; - static const char * cMethodName = "updateBytes"; // Java-Call absetzen - static jmethodID mID = NULL; + static jmethodID mID(NULL); if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) + { + static const char * cSignature = "(I[B)V"; + static const char * cMethodName = "updateBytes"; + + obtainMethodId(t.pEnv, cMethodName,cSignature, mID); + } + { jbyteArray aArray = t.pEnv->NewByteArray(x.getLength()); t.pEnv->SetByteArrayRegion(aArray,0,x.getLength(),(jbyte*)x.getConstArray()); @@ -1512,79 +729,27 @@ void SAL_CALL java_sql_ResultSet::updateBytes( sal_Int32 columnIndex, const ::co void SAL_CALL java_sql_ResultSet::updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateDate" ); - SDBThreadAttach t; - if( t.pEnv ) - { - - // temporaere Variable initialisieren - static const char * cSignature = "(ILjava/sql/Date;)V"; - static const char * cMethodName = "updateDate"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) - { - jvalue args[1]; - // Parameter konvertieren - java_sql_Date aD(x); - args[0].l = aD.getJavaObject(); - t.pEnv->CallVoidMethod( object, mID,columnIndex,args[0].l); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } - } + java_sql_Date aD(x); + static jmethodID mID(NULL); + callVoidMethod("updateDate", "(ILjava/sql/Date;)V", mID, columnIndex, aD.getJavaObject()); } // ------------------------------------------------------------------------- void SAL_CALL java_sql_ResultSet::updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateTime" ); - SDBThreadAttach t; - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "(ILjava/sql/Time;)V"; - static const char * cMethodName = "updateTime"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) - { - jvalue args[1]; - // Parameter konvertieren - java_sql_Time aD(x); - args[0].l = aD.getJavaObject(); - t.pEnv->CallVoidMethod( object, mID,columnIndex,args[0].l); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } - } + java_sql_Time aD(x); + static jmethodID mID(NULL); + callVoidMethod("updateTime", "(ILjava/sql/Time;)V", mID, columnIndex, aD.getJavaObject()); } // ------------------------------------------------------------------------- void SAL_CALL java_sql_ResultSet::updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateTimestamp" ); - SDBThreadAttach t; - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "(I;Ljava/sql/Timestamp;)V"; - static const char * cMethodName = "updateTimestamp"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) - { - jvalue args[1]; - java_sql_Timestamp aD(x); - // Parameter konvertieren - args[0].l = aD.getJavaObject(); - t.pEnv->CallVoidMethod( object, mID,columnIndex,args[0].l); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } - } + java_sql_Timestamp aD(x); + static jmethodID mID(NULL); + callVoidMethod("updateTimestamp", "(ILjava/sql/Timestamp;)V", mID, columnIndex, aD.getJavaObject()); } // ------------------------------------------------------------------------- @@ -1622,17 +787,20 @@ void SAL_CALL java_sql_ResultSet::updateNumericObject( sal_Int32 columnIndex, co try { SDBThreadAttach t; - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "(ILjava/lang/Object;I)V"; - static const char * cMethodName = "updateObject"; // Java-Call absetzen - static jmethodID mID = NULL; + static jmethodID mID(NULL); if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) + { + static const char * cSignature = "(ILjava/lang/Object;I)V"; + static const char * cMethodName = "updateObject"; + + obtainMethodId(t.pEnv, cMethodName,cSignature, mID); + } + { // Parameter konvertieren double nTemp = 0.0; @@ -1658,182 +826,58 @@ void SAL_CALL java_sql_ResultSet::updateNumericObject( sal_Int32 columnIndex, co sal_Int32 java_sql_ResultSet::getResultSetConcurrency() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getResultSetConcurrency" ); - jint out(0); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "()I"; - static const char * cMethodName = "getConcurrency"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallIntMethod( object, mID); - // special case here most JDBC 1.x doesn't support this feature so we just clear the exception when they occured - isExceptionOccured(t.pEnv,sal_True); - - } //mID - } //t.pEnv - return (sal_Int32)out; + static jmethodID mID(NULL); + return callIntMethod("getConcurrency",mID,true); } -// ------------------------------------------------------------------------- //------------------------------------------------------------------------------ sal_Int32 java_sql_ResultSet::getResultSetType() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getResultSetType" ); - jint out(0); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "()I"; - static const char * cMethodName = "getType"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallIntMethod( object, mID); - // special case here most JDBC 1.x doesn't support this feature so we just clear the exception when they occured - isExceptionOccured(t.pEnv,sal_True); - - } //mID - } //t.pEnv - return (sal_Int32)out; + static jmethodID mID(NULL); + return callIntMethod("getType",mID,true); } //------------------------------------------------------------------------------ sal_Int32 java_sql_ResultSet::getFetchDirection() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getFetchDirection" ); - jint out(0); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "()I"; - static const char * cMethodName = "getFetchDirection"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallIntMethod( object, mID); - // special case here most JDBC 1.x doesn't support this feature so we just clear the exception when they occured - isExceptionOccured(t.pEnv,sal_True); - - } //mID - } //t.pEnv - return (sal_Int32)out; + static jmethodID mID(NULL); + return callIntMethod("getFetchDirection",mID,true); } //------------------------------------------------------------------------------ sal_Int32 java_sql_ResultSet::getFetchSize() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getFetchSize" ); - jint out(0); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "()I"; - static const char * cMethodName = "getFetchSize"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallIntMethod( object, mID); - // special case here most JDBC 1.x doesn't support this feature so we just clear the exception when they occured - isExceptionOccured(t.pEnv,sal_True); - - } //mID - } //t.pEnv - return (sal_Int32)out; + static jmethodID mID(NULL); + return callIntMethod("getFetchSize",mID,true); } //------------------------------------------------------------------------------ ::rtl::OUString java_sql_ResultSet::getCursorName() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getCursorName" ); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - ::rtl::OUString aStr; - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "()Ljava/lang/String;"; - static const char * cMethodName = "getCursorName"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *const_cast< java_sql_ResultSet* >( this ) ); - aStr = JavaString2String(t.pEnv,out); - } - } - - return aStr; + static jmethodID mID(NULL); + return callStringMethod("getCursorName",mID); } //------------------------------------------------------------------------------ void java_sql_ResultSet::setFetchDirection(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::setFetchDirection" ); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "(I)V"; - static const char * cMethodName = "setFetchDirection"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID,_par0); - // special case here most JDBC 1.x doesn't support this feature so we just clear the exception when they occured - isExceptionOccured(t.pEnv,sal_True); - - } //mID - } //t.pEnv - + static jmethodID mID(NULL); + callVoidMethodWithIntArg("setFetchDirection",mID,_par0,true); } //------------------------------------------------------------------------------ void SAL_CALL java_sql_ResultSet::refreshRow( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::refreshRow" ); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) - { - // temporaere Variable initialisieren - static const char * cSignature = "()V"; - static const char * cMethodName = "refreshRow"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv + static jmethodID mID(NULL); + callVoidMethod("refreshRow",mID); } //------------------------------------------------------------------------------ void java_sql_ResultSet::setFetchSize(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::setFetchSize" ); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "(I)V"; - static const char * cMethodName = "setFetchSize"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID,_par0); - // special case here most JDBC 1.x doesn't support this feature so we just clear the exception when they occured - isExceptionOccured(t.pEnv,sal_True); - } //mID - } //t.pEnv - + static jmethodID mID(NULL); + callVoidMethodWithIntArg("setFetchSize",mID,_par0,true); } // ------------------------------------------------------------------------- ::cppu::IPropertyArrayHelper* java_sql_ResultSet::createArrayHelper( ) const @@ -1853,7 +897,7 @@ void java_sql_ResultSet::setFetchSize(sal_Int32 _par0) throw(::com::sun::star::s // ------------------------------------------------------------------------- ::cppu::IPropertyArrayHelper & java_sql_ResultSet::getInfoHelper() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getInfoHelper" ); + //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getInfoHelper" ); return *const_cast<java_sql_ResultSet*>(this)->getArrayHelper(); } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/jdbc/ResultSetMetaData.cxx b/connectivity/source/drivers/jdbc/ResultSetMetaData.cxx index 12bc7a3b1c3b..3b61f31826c2 100644 --- a/connectivity/source/drivers/jdbc/ResultSetMetaData.cxx +++ b/connectivity/source/drivers/jdbc/ResultSetMetaData.cxx @@ -33,6 +33,8 @@ #include "java/sql/ResultSetMetaData.hxx" #include "java/sql/Connection.hxx" #include "java/tools.hxx" +#include <rtl/logfile.hxx> + using namespace connectivity; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; @@ -40,6 +42,8 @@ using namespace ::com::sun::star::beans; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::container; using namespace ::com::sun::star::lang; + +#define NULLABLE_UNDEFINED 99 //************************************************************** //************ Class: java.sql.ResultSetMetaData //************************************************************** @@ -49,7 +53,9 @@ java_sql_ResultSetMetaData::java_sql_ResultSetMetaData( JNIEnv * pEnv, jobject m :java_lang_Object( pEnv, myObj ) ,m_aLogger( _rResultSetLogger ) ,m_pConnection( &_rCon ) + ,m_nColumnCount(-1) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::java_sql_ResultSetMetaData" ); SDBThreadAttach::addRef(); } java_sql_ResultSetMetaData::~java_sql_ResultSetMetaData() @@ -57,499 +63,179 @@ java_sql_ResultSetMetaData::~java_sql_ResultSetMetaData() SDBThreadAttach::releaseRef(); } -jclass java_sql_ResultSetMetaData::getMyClass() +jclass java_sql_ResultSetMetaData::getMyClass() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getMyClass" ); // die Klasse muss nur einmal geholt werden, daher statisch - if( !theClass ){ - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( !t.pEnv ) return (jclass)0; - jclass tempClass = t.pEnv->FindClass("java/sql/ResultSetMetaData"); OSL_ENSURE(tempClass,"Java : FindClass nicht erfolgreich!"); - jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); - t.pEnv->DeleteLocalRef( tempClass ); - saveClassRef( globClass ); - } + if( !theClass ) + theClass = findMyClass("java/sql/ResultSetMetaData"); return theClass; } // ------------------------------------------------------------------------- -void java_sql_ResultSetMetaData::saveClassRef( jclass pClass ) -{ - if( pClass==0 ) - return; - // der uebergebe Klassen-Handle ist schon global, daher einfach speichern - theClass = pClass; -} -// ------------------------------------------------------------------------- - sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) throw(SQLException, RuntimeException) { - jint out(0); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - - // temporaere Variable initialisieren - static const char * cSignature = "(I)I"; - static const char * cMethodName = "getColumnDisplaySize"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallIntMethod( object, mID,column); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv - return (sal_Int32)out; + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnDisplaySize" ); + static jmethodID mID(NULL); + return callIntMethodWithIntArg("getColumnDisplaySize",mID,column); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getColumnType( sal_Int32 column ) throw(SQLException, RuntimeException) { - jint out(0); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - - // temporaere Variable initialisieren - static const char * cSignature = "(I)I"; - static const char * cMethodName = "getColumnType"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallIntMethod( object, mID,column); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv - return (sal_Int32)out; + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnType" ); + static jmethodID mID(NULL); + return callIntMethodWithIntArg("getColumnType",mID,column); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getColumnCount( ) throw(SQLException, RuntimeException) { - jint out(0); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnCount" ); + if ( m_nColumnCount == -1 ) + { + static jmethodID mID(NULL); + m_nColumnCount = callIntMethod("getColumnCount",mID); + } // if ( m_nColumnCount == -1 ) + return m_nColumnCount; - // temporaere Variable initialisieren - static const char * cSignature = "()I"; - static const char * cMethodName = "getColumnCount"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallIntMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv - return (sal_Int32)out; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCaseSensitive( sal_Int32 column ) throw(SQLException, RuntimeException) { - jboolean out(sal_False); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "(I)Z"; - static const char * cMethodName = "isCaseSensitive"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) - out = t.pEnv->CallBooleanMethod( object, mID, column ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //t.pEnv - return out; + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isCaseSensitive" ); + static jmethodID mID(NULL); + return callBooleanMethodWithIntArg( "isCaseSensitive", mID,column ); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getSchemaName( sal_Int32 column ) throw(SQLException, RuntimeException) { - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - ::rtl::OUString aStr; - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/lang/String;"; - static const char * cMethodName = "getSchemaName"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) - { - jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, column ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - aStr = JavaString2String(t.pEnv,out); - } - - // und aufraeumen - } //t.pEnv - return aStr; + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getSchemaName" ); + static jmethodID mID(NULL); + return callStringMethodWithIntArg("getSchemaName",mID,column); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnName( sal_Int32 column ) throw(SQLException, RuntimeException) { - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - ::rtl::OUString aStr; - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/lang/String;"; - static const char * cMethodName = "getColumnName"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) - { - jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, column ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - aStr = JavaString2String(t.pEnv,out); - } - - // und aufraeumen - } //t.pEnv - return aStr; + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnName" ); + static jmethodID mID(NULL); + return callStringMethodWithIntArg("getColumnName",mID,column); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getTableName( sal_Int32 column ) throw(SQLException, RuntimeException) { - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - ::rtl::OUString aStr; - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/lang/String;"; - static const char * cMethodName = "getTableName"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) - { - jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, column ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - aStr = JavaString2String(t.pEnv,out); - } - - // und aufraeumen - } //t.pEnv - return aStr; + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getTableName" ); + static jmethodID mID(NULL); + return callStringMethodWithIntArg("getTableName",mID,column); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getCatalogName( sal_Int32 column ) throw(SQLException, RuntimeException) { - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - ::rtl::OUString aStr; - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/lang/String;"; - static const char * cMethodName = "getCatalogName"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) - { - jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, column ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - aStr = JavaString2String(t.pEnv,out); - } - - // und aufraeumen - } //t.pEnv - return aStr; + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getCatalogName" ); + static jmethodID mID(NULL); + return callStringMethodWithIntArg("getCatalogName",mID,column); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnTypeName( sal_Int32 column ) throw(SQLException, RuntimeException) { - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - ::rtl::OUString aStr; - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/lang/String;"; - static const char * cMethodName = "getColumnTypeName"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) - { - jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, column ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - aStr = JavaString2String(t.pEnv,out); - } - - // und aufraeumen - } //t.pEnv - return aStr; + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnTypeName" ); + static jmethodID mID(NULL); + return callStringMethodWithIntArg("getColumnTypeName",mID,column); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnLabel( sal_Int32 column ) throw(SQLException, RuntimeException) { - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - ::rtl::OUString aStr; - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/lang/String;"; - static const char * cMethodName = "getColumnLabel"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) - { - jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, column ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - aStr = JavaString2String(t.pEnv,out); - } - - // und aufraeumen - } //t.pEnv - return aStr; + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnLabel" ); + static jmethodID mID(NULL); + return callStringMethodWithIntArg("getColumnLabel",mID,column); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnServiceName( sal_Int32 column ) throw(SQLException, RuntimeException) { - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - ::rtl::OUString aStr; - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/lang/String;"; - static const char * cMethodName = "getColumnClassName"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) - { - jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, column ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - aStr = JavaString2String(t.pEnv,out); - } - - // und aufraeumen - } //t.pEnv - return aStr; + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnServiceName" ); + static jmethodID mID(NULL); + return callStringMethodWithIntArg("getColumnClassName",mID,column); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCurrency( sal_Int32 column ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isCurrency" ); if ( m_pConnection->isIgnoreCurrencyEnabled() ) return sal_False; - jboolean out(sal_False); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "(I)Z"; - static const char * cMethodName = "isCurrency"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) - out = t.pEnv->CallBooleanMethod( object, mID, column ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //t.pEnv - return out; + static jmethodID mID(NULL); + return callBooleanMethodWithIntArg( "isCurrency", mID,column ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_ResultSetMetaData::isAutoIncrement( sal_Int32 column ) throw(SQLException, RuntimeException) { - jboolean out(sal_False); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "(I)Z"; - static const char * cMethodName = "isAutoIncrement"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) - out = t.pEnv->CallBooleanMethod( object, mID, column); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //t.pEnv - return out; + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isAutoIncrement" ); + static jmethodID mID(NULL); + return callBooleanMethodWithIntArg( "isAutoIncrement", mID,column ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_ResultSetMetaData::isSigned( sal_Int32 column ) throw(SQLException, RuntimeException) { - jboolean out(sal_False); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "(I)Z"; - static const char * cMethodName = "isSigned"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) - out = t.pEnv->CallBooleanMethod( object, mID, column); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //t.pEnv - return out; + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isSigned" ); + static jmethodID mID(NULL); + return callBooleanMethodWithIntArg( "isSigned", mID,column ); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getPrecision( sal_Int32 column ) throw(SQLException, RuntimeException) { - jint out(0); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "(I)I"; - static const char * cMethodName = "getPrecision"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallIntMethod( object, mID, column ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv - return (sal_Int32)out; + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getPrecision" ); + static jmethodID mID(NULL); + return callIntMethodWithIntArg("getPrecision",mID,column); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { - jint out(0); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "(I)I"; - static const char * cMethodName = "getScale"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallIntMethod( object, mID, column ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv - return (sal_Int32)out; + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getScale" ); + static jmethodID mID(NULL); + return callIntMethodWithIntArg("getScale",mID,column); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL java_sql_ResultSetMetaData::isNullable( sal_Int32 column ) throw(SQLException, RuntimeException) { - jint out(0); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "(I)I"; - static const char * cMethodName = "isNullable"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallIntMethod( object, mID, column ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv - return (sal_Int32)out; + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isNullable" ); + static jmethodID mID(NULL); + return callIntMethodWithIntArg("isNullable",mID,column); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_ResultSetMetaData::isSearchable( sal_Int32 column ) throw(SQLException, RuntimeException) { - jboolean out(sal_False); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "(I)Z"; - static const char * cMethodName = "isSearchable"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallBooleanMethod( object, mID, column ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv - return out; + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isSearchable" ); + static jmethodID mID(NULL); + return callBooleanMethodWithIntArg( "isSearchable", mID,column ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_ResultSetMetaData::isReadOnly( sal_Int32 column ) throw(SQLException, RuntimeException) { - jboolean out(sal_False); - SDBThreadAttach t; - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "(I)Z"; - static const char * cMethodName = "isReadOnly"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallBooleanMethod( object, mID, column ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv - return out; + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isReadOnly" ); + static jmethodID mID(NULL); + return callBooleanMethodWithIntArg( "isReadOnly", mID,column ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_ResultSetMetaData::isDefinitelyWritable( sal_Int32 column ) throw(SQLException, RuntimeException) { - jboolean out(sal_False); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "(I)Z"; - static const char * cMethodName = "isDefinitelyWritable"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallBooleanMethod( object, mID, column ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv - return out; + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isDefinitelyWritable" ); + static jmethodID mID(NULL); + return callBooleanMethodWithIntArg( "isDefinitelyWritable", mID,column ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_ResultSetMetaData::isWritable( sal_Int32 column ) throw(SQLException, RuntimeException) { - jboolean out(sal_False); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "(I)Z"; - static const char * cMethodName = "isWritable"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallBooleanMethod( object, mID, column ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen - } //mID - } //t.pEnv - return out; + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isWritable" ); + static jmethodID mID(NULL); + return callBooleanMethodWithIntArg( "isWritable", mID,column ); } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/jdbc/SQLException.cxx b/connectivity/source/drivers/jdbc/SQLException.cxx index 21b8f19dad2a..cdc195643cba 100644 --- a/connectivity/source/drivers/jdbc/SQLException.cxx +++ b/connectivity/source/drivers/jdbc/SQLException.cxx @@ -63,52 +63,23 @@ java_sql_SQLException_BASE::~java_sql_SQLException_BASE() {} -jclass java_sql_SQLException_BASE::getMyClass() +jclass java_sql_SQLException_BASE::getMyClass() const { - // die Klasse muss nur einmal geholt werden, daher statisch - if( !theClass ){ - SDBThreadAttach t; - if( !t.pEnv ) return (jclass)NULL; - jclass tempClass = t.pEnv->FindClass("java/sql/SQLException"); - OSL_ENSURE(tempClass,"Java : FindClass nicht erfolgreich!"); - if(!tempClass) - { - t.pEnv->ExceptionDescribe(); - t.pEnv->ExceptionClear(); - } - jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); - t.pEnv->DeleteLocalRef( tempClass ); - saveClassRef( globClass ); - } - return theClass; + return st_getMyClass(); } - -void java_sql_SQLException_BASE::saveClassRef( jclass pClass ) +jclass java_sql_SQLException_BASE::st_getMyClass() { - if( pClass==NULL ) - return; - // der uebergebe Klassen-Handle ist schon global, daher einfach speichern - theClass = pClass; + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ) + theClass = findMyClass("java/sql/SQLException"); + return theClass; } starsdbc::SQLException java_sql_SQLException_BASE::getNextException() const { - jobject out = NULL; SDBThreadAttach t; - if( t.pEnv ){ - - // temporaere Variable initialisieren - static const char * cSignature = "()Ljava/sql/SQLException;"; - static const char * cMethodName = "getNextException"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallObjectMethod( object, mID); - ThrowSQLException(t.pEnv,0); - } //mID - } //t.pEnv + static jmethodID mID(NULL); + jobject out = callObjectMethod(t.pEnv,"getNextException","()Ljava/sql/SQLException;", mID); // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! if( out ) { @@ -121,44 +92,12 @@ starsdbc::SQLException java_sql_SQLException_BASE::getNextException() const ::rtl::OUString java_sql_SQLException_BASE::getSQLState() const { - SDBThreadAttach t; - ::rtl::OUString aStr; - if( t.pEnv ){ - - // temporaere Variable initialisieren - static const char * cSignature = "()Ljava/lang/String;"; - static const char * cMethodName = "getSQLState"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - jstring out = (jstring) t.pEnv->CallObjectMethod( object, mID); - ThrowSQLException(t.pEnv,0); - aStr = JavaString2String(t.pEnv,out); - } //mID - } //t.pEnv - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! - return aStr; + static jmethodID mID(NULL); + return callStringMethod("getSQLState",mID); } sal_Int32 java_sql_SQLException_BASE::getErrorCode() const { - jint out(0); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ - - // temporaere Variable initialisieren - static const char * cSignature = "()I"; - static const char * cMethodName = "getErrorCode"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallIntMethod( object, mID); - ThrowSQLException(t.pEnv,0); - } //mID - } //t.pEnv - return (sal_Int32)out; + static jmethodID mID(NULL); + return callIntMethod("getErrorCode",mID); } diff --git a/connectivity/source/drivers/jdbc/SQLWarning.cxx b/connectivity/source/drivers/jdbc/SQLWarning.cxx index 55a96396b6dc..95ad8c4ca62b 100644 --- a/connectivity/source/drivers/jdbc/SQLWarning.cxx +++ b/connectivity/source/drivers/jdbc/SQLWarning.cxx @@ -41,25 +41,11 @@ jclass java_sql_SQLWarning_BASE::theClass = 0; java_sql_SQLWarning_BASE::~java_sql_SQLWarning_BASE() {} -jclass java_sql_SQLWarning_BASE::getMyClass() +jclass java_sql_SQLWarning_BASE::getMyClass() const { // die Klasse muss nur einmal geholt werden, daher statisch - if( !theClass ){ - SDBThreadAttach t; - if( !t.pEnv ) return (jclass)NULL; - jclass tempClass = t.pEnv->FindClass( "java/sql/SQLWarning" ); - jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); - t.pEnv->DeleteLocalRef( tempClass ); - saveClassRef( globClass ); - } + if( !theClass ) + theClass = findMyClass("java/sql/SQLWarning"); return theClass; } -void java_sql_SQLWarning_BASE::saveClassRef( jclass pClass ) -{ - if( pClass==NULL ) - return; - // der uebergebe Klassen-Handle ist schon global, daher einfach speichern - theClass = pClass; -} - diff --git a/connectivity/source/drivers/jdbc/String.cxx b/connectivity/source/drivers/jdbc/String.cxx index 02a2d7f25106..2f436f264464 100644 --- a/connectivity/source/drivers/jdbc/String.cxx +++ b/connectivity/source/drivers/jdbc/String.cxx @@ -42,30 +42,19 @@ jclass java_lang_String::theClass = 0; java_lang_String::~java_lang_String() {} -jclass java_lang_String::getMyClass() +jclass java_lang_String::getMyClass() const +{ + return st_getMyClass(); +} +jclass java_lang_String::st_getMyClass() { // die Klasse muss nur einmal geholt werden, daher statisch - if( !theClass ){ - SDBThreadAttach t; - if( !t.pEnv ) return (jclass)NULL; - jclass tempClass = t.pEnv->FindClass("java/lang/String"); - OSL_ENSURE(tempClass,"Java : FindClass nicht erfolgreich!"); - jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); - t.pEnv->DeleteLocalRef( tempClass ); - saveClassRef( globClass ); - } + if( !theClass ) + theClass = findMyClass("java/lang/String"); return theClass; } //-------------------------------------------------------------------------- -void java_lang_String::saveClassRef( jclass pClass ) -{ - if( pClass==NULL ) - return; - // der uebergebe Klassen-Handle ist schon global, daher einfach speichern - theClass = pClass; -} -//-------------------------------------------------------------------------- java_lang_String::java_lang_String( const ::rtl::OUString& _par0 ): java_lang_Object( NULL, (jobject)NULL ) { SDBThreadAttach t; @@ -78,9 +67,8 @@ java_lang_String::java_lang_String( const ::rtl::OUString& _par0 ): java_lang_Ob // temporaere Variable initialisieren static const char * cSignature = "(Ljava/lang/String;)V"; jobject tempObj; - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), "<init>", cSignature );OSL_ENSURE(mID,"Unknown method id!"); + static jmethodID mID(NULL); + obtainMethodId(t.pEnv, "<init>",cSignature, mID); tempObj = t.pEnv->NewObjectA( getMyClass(), mID, args ); saveRef( t.pEnv, tempObj ); t.pEnv->DeleteLocalRef( tempObj ); diff --git a/connectivity/source/drivers/jdbc/Throwable.cxx b/connectivity/source/drivers/jdbc/Throwable.cxx index c97cbd5018c5..bdf6743157b0 100644 --- a/connectivity/source/drivers/jdbc/Throwable.cxx +++ b/connectivity/source/drivers/jdbc/Throwable.cxx @@ -42,98 +42,30 @@ jclass java_lang_Throwable::theClass = 0; java_lang_Throwable::~java_lang_Throwable() {} -jclass java_lang_Throwable::getMyClass() +jclass java_lang_Throwable::getMyClass() const { - // die Klasse muss nur einmal geholt werden, daher statisch - if( !theClass ){ - SDBThreadAttach t; - if( !t.pEnv ) return (jclass)NULL; - jclass tempClass = t.pEnv->FindClass("java/lang/Throwable"); OSL_ENSURE(tempClass,"Java : FindClass nicht erfolgreich!"); - jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); - t.pEnv->DeleteLocalRef( tempClass ); - saveClassRef( globClass ); - } - return theClass; + return st_getMyClass(); } -// ----------------------------------------------------------------------------- - -void java_lang_Throwable::saveClassRef( jclass pClass ) +jclass java_lang_Throwable::st_getMyClass() { - if( pClass==NULL ) - return; - // der uebergebe Klassen-Handle ist schon global, daher einfach speichern - theClass = pClass; + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ) + theClass = findMyClass("java/lang/Throwable"); + return theClass; } // ----------------------------------------------------------------------------- ::rtl::OUString java_lang_Throwable::getMessage() const { - ::rtl::OUString aStr; - SDBThreadAttach t; - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "()Ljava/lang/String;"; - static const char * cMethodName = "getMessage"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID); - ThrowSQLException(t.pEnv,NULL); - - aStr = JavaString2String(t.pEnv,out); - } //mID - } //t.pEnv - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! - return aStr; + static jmethodID mID(NULL); + return callStringMethod("getMessage",mID); } // ----------------------------------------------------------------------------- ::rtl::OUString java_lang_Throwable::getLocalizedMessage() const { - ::rtl::OUString aStr; - SDBThreadAttach t; - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "()Ljava/lang/String;"; - static const char * cMethodName = "getLocalizedMessage"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID); - ThrowSQLException(t.pEnv,NULL); - - aStr = JavaString2String(t.pEnv,out); - } //mID - } //t.pEnv - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! - return aStr; -} -// ----------------------------------------------------------------------------- -::rtl::OUString java_lang_Throwable::toString() const -{ - ::rtl::OUString aStr; - SDBThreadAttach t; - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "()Ljava/lang/String;"; - static const char * cMethodName = "toString"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID); - ThrowSQLException(t.pEnv,NULL); - - aStr = JavaString2String(t.pEnv,out); - } //mID - } //t.pEnv - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! - return aStr; + static jmethodID mID(NULL); + return callStringMethod("getLocalizedMessage",mID); } // ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/jdbc/Timestamp.cxx b/connectivity/source/drivers/jdbc/Timestamp.cxx index 75f589c2a861..8c30f7a14efc 100644 --- a/connectivity/source/drivers/jdbc/Timestamp.cxx +++ b/connectivity/source/drivers/jdbc/Timestamp.cxx @@ -57,7 +57,7 @@ java_sql_Date::java_sql_Date( const ::com::sun::star::util::Date& _rOut ) : java // temporaere Variable initialisieren static const char * cSignature = "(Ljava/lang/String;)Ljava/sql/Date;"; jobject tempObj; - static jmethodID mID = NULL; + static jmethodID mID(NULL); if ( !mID ) mID = t.pEnv->GetStaticMethodID( getMyClass(), "valueOf", cSignature );OSL_ENSURE(mID,"Unknown method id!"); tempObj = t.pEnv->CallStaticObjectMethod( getMyClass(), mID, args[0].l ); @@ -69,29 +69,15 @@ java_sql_Date::java_sql_Date( const ::com::sun::star::util::Date& _rOut ) : java java_sql_Date::~java_sql_Date() {} -jclass java_sql_Date::getMyClass() +jclass java_sql_Date::getMyClass() const { // die Klasse muss nur einmal geholt werden, daher statisch - if( !theClass ){ - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( !t.pEnv ) return (jclass)0; - jclass tempClass = t.pEnv->FindClass("java/sql/Date"); OSL_ENSURE(tempClass,"Java : FindClass nicht erfolgreich!"); - jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); - t.pEnv->DeleteLocalRef( tempClass ); - saveClassRef( globClass ); - } + if( !theClass ) + theClass = findMyClass("java/sql/Date"); return theClass; } // ----------------------------------------------------------------------------- -void java_sql_Date::saveClassRef( jclass pClass ) -{ - if( pClass==0 ) - return; - // der uebergebe Klassen-Handle ist schon global, daher einfach speichern - theClass = pClass; -} -// ----------------------------------------------------------------------------- java_sql_Date::operator ::com::sun::star::util::Date() { return ::dbtools::DBTypeConversion::toDate(toString()); @@ -106,28 +92,14 @@ jclass java_sql_Time::theClass = 0; java_sql_Time::~java_sql_Time() {} -jclass java_sql_Time::getMyClass() +jclass java_sql_Time::getMyClass() const { // die Klasse muss nur einmal geholt werden, daher statisch - if( !theClass ){ - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( !t.pEnv ) return (jclass)0; - jclass tempClass = t.pEnv->FindClass("java/sql/Time"); OSL_ENSURE(tempClass,"Java : FindClass nicht erfolgreich!"); - jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); - t.pEnv->DeleteLocalRef( tempClass ); - saveClassRef( globClass ); - } + if( !theClass ) + theClass = findMyClass("java/sql/Time"); return theClass; } -void java_sql_Time::saveClassRef( jclass pClass ) -{ - if( pClass==0 ) - return; - // der uebergebe Klassen-Handle ist schon global, daher einfach speichern - theClass = pClass; -} - java_sql_Time::java_sql_Time( const ::com::sun::star::util::Time& _rOut ): java_util_Date( NULL, (jobject)NULL ) { SDBThreadAttach t; @@ -143,7 +115,7 @@ java_sql_Time::java_sql_Time( const ::com::sun::star::util::Time& _rOut ): java_ // temporaere Variable initialisieren static const char * cSignature = "(Ljava/lang/String;)Ljava/sql/Time;"; jobject tempObj; - static jmethodID mID = NULL; + static jmethodID mID(NULL); if ( !mID ) mID = t.pEnv->GetStaticMethodID( getMyClass(), "valueOf", cSignature );OSL_ENSURE(mID,"Unknown method id!"); tempObj = t.pEnv->CallStaticObjectMethod( getMyClass(), mID, args[0].l ); @@ -166,28 +138,14 @@ jclass java_sql_Timestamp::theClass = 0; java_sql_Timestamp::~java_sql_Timestamp() {} -jclass java_sql_Timestamp::getMyClass() +jclass java_sql_Timestamp::getMyClass() const { // die Klasse muss nur einmal geholt werden, daher statisch - if( !theClass ){ - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( !t.pEnv ) return (jclass)0; - jclass tempClass = t.pEnv->FindClass("java/sql/Timestamp"); OSL_ENSURE(tempClass,"Java : FindClass nicht erfolgreich!"); - jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); - t.pEnv->DeleteLocalRef( tempClass ); - saveClassRef( globClass ); - } + if( !theClass ) + theClass = findMyClass("java/sql/Timestamp"); return theClass; } -void java_sql_Timestamp::saveClassRef( jclass pClass ) -{ - if( pClass==0 ) - return; - // der uebergebe Klassen-Handle ist schon global, daher einfach speichern - theClass = pClass; -} - java_sql_Timestamp::java_sql_Timestamp(const ::com::sun::star::util::DateTime& _rOut) :java_util_Date( NULL, (jobject)NULL ) { @@ -205,7 +163,7 @@ java_sql_Timestamp::java_sql_Timestamp(const ::com::sun::star::util::DateTime& _ // temporaere Variable initialisieren static const char * cSignature = "(Ljava/lang/String;)Ljava/sql/Timestamp;"; jobject tempObj; - static jmethodID mID = NULL; + static jmethodID mID(NULL); if ( !mID ) mID = t.pEnv->GetStaticMethodID( getMyClass(), "valueOf", cSignature );OSL_ENSURE(mID,"Unknown method id!"); tempObj = t.pEnv->CallStaticObjectMethod( getMyClass(), mID, args[0].l ); @@ -217,40 +175,14 @@ java_sql_Timestamp::java_sql_Timestamp(const ::com::sun::star::util::DateTime& _ sal_Int32 java_sql_Timestamp::getNanos() { - jint out(0); - SDBThreadAttach t; - if( t.pEnv ){ - - // temporaere Variable initialisieren - static const char * cSignature = "()I"; - static const char * cMethodName = "getNanos"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallIntMethod( object, mID); - } //mID - } //t.pEnv - return (sal_Int32)out; + static jmethodID mID(NULL); + return callIntMethod("getNanos",mID); } void java_sql_Timestamp::setNanos( sal_Int32 _par0 ) { - SDBThreadAttach t; - if( t.pEnv ){ - // temporaere Variable initialisieren - static const char * cSignature = "(I)V"; - static const char * cMethodName = "setNanos"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - t.pEnv->CallVoidMethod( object, mID, _par0 ); - // und aufraeumen - } //mID - } //t.pEnv + static jmethodID mID(NULL); + callVoidMethodWithIntArg("setNanos",mID,_par0); } // ----------------------------------------------------------------------------- java_sql_Timestamp::operator ::com::sun::star::util::DateTime() diff --git a/connectivity/source/drivers/jdbc/makefile.mk b/connectivity/source/drivers/jdbc/makefile.mk index 58287b0bf86a..b8d6a54dd065 100644 --- a/connectivity/source/drivers/jdbc/makefile.mk +++ b/connectivity/source/drivers/jdbc/makefile.mk @@ -60,7 +60,6 @@ SLOFILES=\ $(SLO)$/ConnectionLog.obj \ $(SLO)$/DatabaseMetaData.obj \ $(SLO)$/Date.obj \ - $(SLO)$/DriverManager.obj \ $(SLO)$/DriverPropertyInfo.obj \ $(SLO)$/Exception.obj \ $(SLO)$/InputStream.obj \ diff --git a/connectivity/source/drivers/jdbc/tools.cxx b/connectivity/source/drivers/jdbc/tools.cxx index 9888bb6f683d..6f50a6b1affd 100644 --- a/connectivity/source/drivers/jdbc/tools.cxx +++ b/connectivity/source/drivers/jdbc/tools.cxx @@ -52,7 +52,7 @@ void java_util_Properties::setProperty(const ::rtl::OUString key, const ::rtl::O { SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); jobject out(0); - if( t.pEnv ) + { jvalue args[2]; // Parameter konvertieren @@ -62,14 +62,10 @@ void java_util_Properties::setProperty(const ::rtl::OUString key, const ::rtl::O static const char * cSignature = "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Object;"; static const char * cMethodName = "setProperty"; // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) - { - out = t.pEnv->CallObjectMethod(object, mID, args[0].l,args[1].l); - ThrowSQLException(t.pEnv,NULL); - } + static jmethodID mID(NULL); + obtainMethodId(t.pEnv, cMethodName,cSignature, mID); + out = t.pEnv->CallObjectMethod(object, mID, args[0].l,args[1].l); + ThrowSQLException(t.pEnv,NULL); t.pEnv->DeleteLocalRef((jstring)args[1].l); t.pEnv->DeleteLocalRef((jstring)args[0].l); ThrowSQLException(t.pEnv,0); @@ -83,27 +79,14 @@ jclass java_util_Properties::theClass = 0; java_util_Properties::~java_util_Properties() {} -jclass java_util_Properties::getMyClass() +jclass java_util_Properties::getMyClass() const { // die Klasse muss nur einmal geholt werden, daher statisch - if( !theClass ){ - SDBThreadAttach t; - if( !t.pEnv ) return (jclass)NULL; - jclass tempClass = t.pEnv->FindClass( "java/util/Properties" ); - jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); - t.pEnv->DeleteLocalRef( tempClass ); - saveClassRef( globClass ); - } + if( !theClass ) + theClass = findMyClass("java/util/Properties"); return theClass; } -void java_util_Properties::saveClassRef( jclass pClass ) -{ - if( pClass==NULL ) - return; - // der uebergebe Klassen-Handle ist schon global, daher einfach speichern - theClass = pClass; -} //-------------------------------------------------------------------------- java_util_Properties::java_util_Properties( ): java_lang_Object( NULL, (jobject)NULL ) { @@ -114,9 +97,8 @@ java_util_Properties::java_util_Properties( ): java_lang_Object( NULL, (jobject) // temporaere Variable initialisieren static const char * cSignature = "()V"; jobject tempObj; - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), "<init>", cSignature );OSL_ENSURE(mID,"Unknown method id!"); + static jmethodID mID(NULL); + obtainMethodId(t.pEnv, "<init>",cSignature, mID); tempObj = t.pEnv->NewObject( getMyClass(), mID); saveRef( t.pEnv, tempObj ); t.pEnv->DeleteLocalRef( tempObj ); @@ -218,7 +200,7 @@ sal_Bool connectivity::isExceptionOccured(JNIEnv *pEnv,sal_Bool _bClear) if ( _bClear ) pEnv->ExceptionClear(); #if OSL_DEBUG_LEVEL > 1 - if(pEnv->IsInstanceOf(pThrowable,java_sql_SQLException_BASE::getMyClass())) + if(pEnv->IsInstanceOf(pThrowable,java_sql_SQLException_BASE::st_getMyClass())) { java_sql_SQLException_BASE* pException = new java_sql_SQLException_BASE(pEnv,pThrowable); diff --git a/connectivity/source/drivers/kab/KPreparedStatement.cxx b/connectivity/source/drivers/kab/KPreparedStatement.cxx index f9389ef70b8c..d4f340f10625 100644 --- a/connectivity/source/drivers/kab/KPreparedStatement.cxx +++ b/connectivity/source/drivers/kab/KPreparedStatement.cxx @@ -34,6 +34,7 @@ #include "KPreparedStatement.hxx" #include "propertyids.hxx" #include <connectivity/dbexception.hxx> +#include <connectivity/dbtools.hxx> #include "resource/kab_res.hrc" #include "resource/sharedresources.hxx" @@ -321,12 +322,12 @@ void SAL_CALL KabPreparedStatement::setCharacterStream(sal_Int32, const Referenc ::dbtools::throwFunctionNotSupportedException("setCharacterStream", NULL); } // ------------------------------------------------------------------------- -void SAL_CALL KabPreparedStatement::setObject(sal_Int32, const Any&) throw(SQLException, RuntimeException) +void SAL_CALL KabPreparedStatement::setObject(sal_Int32 parameterIndex, const Any& x) throw(SQLException, RuntimeException) { - - - -::dbtools::throwFunctionNotSupportedException("setObject", NULL); + if(!::dbtools::implSetObject(this,parameterIndex,x)) + { + throw SQLException(); + } } // ------------------------------------------------------------------------- void SAL_CALL KabPreparedStatement::setObjectWithInfo(sal_Int32, const Any&, sal_Int32, sal_Int32) throw(SQLException, RuntimeException) diff --git a/connectivity/source/drivers/macab/MacabPreparedStatement.cxx b/connectivity/source/drivers/macab/MacabPreparedStatement.cxx index b79b01ba0dff..9d1163ea1475 100755 --- a/connectivity/source/drivers/macab/MacabPreparedStatement.cxx +++ b/connectivity/source/drivers/macab/MacabPreparedStatement.cxx @@ -35,6 +35,7 @@ #include "MacabAddressBook.hxx" #include "propertyids.hxx" #include <connectivity/dbexception.hxx> +#include "connectivity/dbtools.hxx" #include "resource/macab_res.hrc" #include "resource/sharedresources.hxx" @@ -334,12 +335,16 @@ void SAL_CALL MacabPreparedStatement::setCharacterStream(sal_Int32, const Refere ::dbtools::throwFunctionNotSupportedException("setCharacterStream", NULL); } // ------------------------------------------------------------------------- -void SAL_CALL MacabPreparedStatement::setObject(sal_Int32, const Any&) throw(SQLException, RuntimeException) +void SAL_CALL MacabPreparedStatement::setObject(sal_Int32 parameterIndex, const Any& x) throw(SQLException, RuntimeException) { - - - -::dbtools::throwFunctionNotSupportedException("setObject", NULL); + if(!::dbtools::implSetObject(this,parameterIndex,x)) + { + const ::rtl::OUString sError( m_pConnection->getResources().getResourceStringWithSubstitution( + STR_UNKNOWN_PARA_TYPE, + "$position$", ::rtl::OUString::valueOf(parameterIndex) + ) ); + ::dbtools::throwGenericSQLException(sError,*this); + } } // ------------------------------------------------------------------------- void SAL_CALL MacabPreparedStatement::setObjectWithInfo(sal_Int32, const Any&, sal_Int32, sal_Int32) throw(SQLException, RuntimeException) diff --git a/connectivity/source/drivers/macab/makefile.mk b/connectivity/source/drivers/macab/makefile.mk index 4b6cc65fa058..67f40f2d45cf 100755 --- a/connectivity/source/drivers/macab/makefile.mk +++ b/connectivity/source/drivers/macab/makefile.mk @@ -34,7 +34,7 @@ PRJINC=..$/.. PRJNAME=connectivity TARGET=macab TARGET2=$(TARGET)drv - +VISIBILITY_HIDDEN=TRUE ENABLE_EXCEPTIONS=TRUE # --- Settings ---------------------------------- diff --git a/connectivity/source/drivers/mozab/makefile.mk b/connectivity/source/drivers/mozab/makefile.mk index c2f0f2220d42..2e3443cd9529 100644 --- a/connectivity/source/drivers/mozab/makefile.mk +++ b/connectivity/source/drivers/mozab/makefile.mk @@ -33,6 +33,7 @@ PRJINC=..$/.. PRJNAME=connectivity TARGET=mozab TARGET2=$(TARGET)drv +VISIBILITY_HIDDEN=TRUE .IF ( "$(SYSTEM_MOZILLA)" == "YES" && "$(WITH_MOZILLA)" == "YES") || "$(WITH_MOZILLA)" == "NO" || ( "$(OS)" == "MACOSX" ) all: diff --git a/connectivity/source/inc/calc/CResultSet.hxx b/connectivity/source/inc/calc/CResultSet.hxx index ca65e6c767c3..35ed1f360789 100644 --- a/connectivity/source/inc/calc/CResultSet.hxx +++ b/connectivity/source/inc/calc/CResultSet.hxx @@ -63,6 +63,7 @@ namespace connectivity OCalcResultSet( file::OStatement_Base* pStmt,connectivity::OSQLParseTreeIterator& _aSQLIterator); + private: // XInterface virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); virtual void SAL_CALL acquire() throw(); @@ -82,6 +83,8 @@ namespace connectivity // XDeleteRows virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL deleteRows( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool isRowDeleted() const { return sal_False; } + }; } } diff --git a/connectivity/source/inc/file/FDateFunctions.hxx b/connectivity/source/inc/file/FDateFunctions.hxx index 91c8f887ecb2..17671d75624f 100644 --- a/connectivity/source/inc/file/FDateFunctions.hxx +++ b/connectivity/source/inc/file/FDateFunctions.hxx @@ -45,7 +45,7 @@ namespace connectivity > SELECT DAYOFWEEK('1998-02-03'); -> 3 */ - class OOO_DLLPUBLIC_FILE OOp_DayOfWeek : public OUnaryOperator + class OOp_DayOfWeek : public OUnaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs) const; @@ -57,7 +57,7 @@ namespace connectivity > SELECT DAYOFMONTH('1998-02-03'); -> 3 */ - class OOO_DLLPUBLIC_FILE OOp_DayOfMonth : public OUnaryOperator + class OOp_DayOfMonth : public OUnaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs) const; @@ -70,7 +70,7 @@ namespace connectivity -> 34 */ - class OOO_DLLPUBLIC_FILE OOp_DayOfYear : public OUnaryOperator + class OOp_DayOfYear : public OUnaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs) const; @@ -82,7 +82,7 @@ namespace connectivity > SELECT MONTH('1998-02-03'); -> 2 */ - class OOO_DLLPUBLIC_FILE OOp_Month : public OUnaryOperator + class OOp_Month : public OUnaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs) const; @@ -95,7 +95,7 @@ namespace connectivity -> 'Thursday' */ - class OOO_DLLPUBLIC_FILE OOp_DayName : public OUnaryOperator + class OOp_DayName : public OUnaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs) const; @@ -108,7 +108,7 @@ namespace connectivity -> 'February' */ - class OOO_DLLPUBLIC_FILE OOp_MonthName : public OUnaryOperator + class OOp_MonthName : public OUnaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs) const; @@ -121,7 +121,7 @@ namespace connectivity -> 2 */ - class OOO_DLLPUBLIC_FILE OOp_Quarter : public OUnaryOperator + class OOp_Quarter : public OUnaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs) const; @@ -146,7 +146,7 @@ namespace connectivity -> 53 */ - class OOO_DLLPUBLIC_FILE OOp_Week : public ONthOperator + class OOp_Week : public ONthOperator { protected: virtual ORowSetValue operate(const ::std::vector<ORowSetValue>& lhs) const; @@ -158,7 +158,7 @@ namespace connectivity > SELECT YEAR('98-02-03'); -> 1998 */ - class OOO_DLLPUBLIC_FILE OOp_Year : public OUnaryOperator + class OOp_Year : public OUnaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs) const; @@ -170,7 +170,7 @@ namespace connectivity > SELECT HOUR('10:05:03'); -> 10 */ - class OOO_DLLPUBLIC_FILE OOp_Hour : public OUnaryOperator + class OOp_Hour : public OUnaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs) const; @@ -183,7 +183,7 @@ namespace connectivity -> 5 */ - class OOO_DLLPUBLIC_FILE OOp_Minute : public OUnaryOperator + class OOp_Minute : public OUnaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs) const; @@ -195,7 +195,7 @@ namespace connectivity > SELECT SECOND('10:05:03'); -> 3 */ - class OOO_DLLPUBLIC_FILE OOp_Second : public OUnaryOperator + class OOp_Second : public OUnaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs) const; @@ -208,7 +208,7 @@ namespace connectivity > SELECT CURDATE(); -> '1997-12-15' */ - class OOO_DLLPUBLIC_FILE OOp_CurDate : public ONthOperator + class OOp_CurDate : public ONthOperator { protected: virtual ORowSetValue operate(const ::std::vector<ORowSetValue>& lhs) const; @@ -221,7 +221,7 @@ namespace connectivity > SELECT CURTIME(); -> '23:50:26' */ - class OOO_DLLPUBLIC_FILE OOp_CurTime : public ONthOperator + class OOp_CurTime : public ONthOperator { protected: virtual ORowSetValue operate(const ::std::vector<ORowSetValue>& lhs) const; @@ -233,7 +233,7 @@ namespace connectivity > SELECT NOW(); -> '1997-12-15 23:50:26' */ - class OOO_DLLPUBLIC_FILE OOp_Now : public ONthOperator + class OOp_Now : public ONthOperator { protected: virtual ORowSetValue operate(const ::std::vector<ORowSetValue>& lhs) const; diff --git a/connectivity/source/inc/file/FNumericFunctions.hxx b/connectivity/source/inc/file/FNumericFunctions.hxx index 85bde51a25b4..f2e382ee9a27 100644 --- a/connectivity/source/inc/file/FNumericFunctions.hxx +++ b/connectivity/source/inc/file/FNumericFunctions.hxx @@ -48,7 +48,7 @@ namespace connectivity -> 32 */ - class OOO_DLLPUBLIC_FILE OOp_Abs : public OUnaryOperator + class OOp_Abs : public OUnaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs) const; @@ -65,7 +65,7 @@ namespace connectivity -> 1 */ - class OOO_DLLPUBLIC_FILE OOp_Sign : public OUnaryOperator + class OOp_Sign : public OUnaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs) const; @@ -84,7 +84,7 @@ namespace connectivity > SELECT 29 MOD 9; -> 2 */ - class OOO_DLLPUBLIC_FILE OOp_Mod : public OBinaryOperator + class OOp_Mod : public OBinaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const; @@ -99,7 +99,7 @@ namespace connectivity -> -2 */ - class OOO_DLLPUBLIC_FILE OOp_Floor : public OUnaryOperator + class OOp_Floor : public OUnaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs) const; @@ -114,7 +114,7 @@ namespace connectivity -> -1 */ - class OOO_DLLPUBLIC_FILE OOp_Ceiling : public OUnaryOperator + class OOp_Ceiling : public OUnaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs) const; @@ -137,7 +137,7 @@ namespace connectivity > SELECT ROUND(23.298, -1); -> 20 */ - class OOO_DLLPUBLIC_FILE OOp_Round : public ONthOperator + class OOp_Round : public ONthOperator { protected: virtual ORowSetValue operate(const ::std::vector<ORowSetValue>& lhs) const; @@ -151,7 +151,7 @@ namespace connectivity > SELECT EXP(-2); -> 0.135335 */ - class OOO_DLLPUBLIC_FILE OOp_Exp : public OUnaryOperator + class OOp_Exp : public OUnaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs) const; @@ -166,7 +166,7 @@ namespace connectivity -> NULL */ - class OOO_DLLPUBLIC_FILE OOp_Ln : public OUnaryOperator + class OOp_Ln : public OUnaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs) const; @@ -188,7 +188,7 @@ namespace connectivity > SELECT LOG(1,100); -> NULL */ - class OOO_DLLPUBLIC_FILE OOp_Log : public ONthOperator + class OOp_Log : public ONthOperator { protected: virtual ORowSetValue operate(const ::std::vector<ORowSetValue>& lhs) const; @@ -204,7 +204,7 @@ namespace connectivity > SELECT LOG10(-100); -> NULL */ - class OOO_DLLPUBLIC_FILE OOp_Log10 : public OUnaryOperator + class OOp_Log10 : public OUnaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs) const; @@ -218,7 +218,7 @@ namespace connectivity > SELECT POW(2,-2); -> 0.250000 */ - class OOO_DLLPUBLIC_FILE OOp_Pow : public OBinaryOperator + class OOp_Pow : public OBinaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const; @@ -232,7 +232,7 @@ namespace connectivity > SELECT SQRT(20); -> 4.472136 */ - class OOO_DLLPUBLIC_FILE OOp_Sqrt : public OUnaryOperator + class OOp_Sqrt : public OUnaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs) const; @@ -247,7 +247,7 @@ namespace connectivity -> 3.141592653589793116 */ - class OOO_DLLPUBLIC_FILE OOp_Pi : public ONthOperator + class OOp_Pi : public ONthOperator { protected: virtual ORowSetValue operate(const ::std::vector<ORowSetValue>& lhs) const; @@ -259,7 +259,7 @@ namespace connectivity > SELECT COS(PI()); -> -1.000000 */ - class OOO_DLLPUBLIC_FILE OOp_Cos : public OUnaryOperator + class OOp_Cos : public OUnaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs = ORowSetValue()) const; @@ -272,7 +272,7 @@ namespace connectivity -> 0.000000 */ - class OOO_DLLPUBLIC_FILE OOp_Sin : public OUnaryOperator + class OOp_Sin : public OUnaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs = ORowSetValue()) const; @@ -283,7 +283,7 @@ namespace connectivity > SELECT TAN(PI()+1); -> 1.557408 */ - class OOO_DLLPUBLIC_FILE OOp_Tan : public OUnaryOperator + class OOp_Tan : public OUnaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs = ORowSetValue()) const; @@ -299,7 +299,7 @@ namespace connectivity > SELECT ACOS(0); -> 1.570796 */ - class OOO_DLLPUBLIC_FILE OOp_ACos : public OUnaryOperator + class OOp_ACos : public OUnaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs = ORowSetValue()) const; @@ -313,7 +313,7 @@ namespace connectivity > SELECT ASIN('foo'); -> 0.000000 */ - class OOO_DLLPUBLIC_FILE OOp_ASin : public OUnaryOperator + class OOp_ASin : public OUnaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs = ORowSetValue()) const; @@ -327,7 +327,7 @@ namespace connectivity > SELECT ATAN(-2); -> -1.107149 */ - class OOO_DLLPUBLIC_FILE OOp_ATan : public OUnaryOperator + class OOp_ATan : public OUnaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs = ORowSetValue()) const; @@ -342,7 +342,7 @@ namespace connectivity -> 1.570796 */ - class OOO_DLLPUBLIC_FILE OOp_ATan2 : public OBinaryOperator + class OOp_ATan2 : public OBinaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const; @@ -354,7 +354,7 @@ namespace connectivity > SELECT DEGREES(PI()); -> 180.000000 */ - class OOO_DLLPUBLIC_FILE OOp_Degrees : public OUnaryOperator + class OOp_Degrees : public OUnaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs = ORowSetValue()) const; @@ -367,7 +367,7 @@ namespace connectivity -> 1.570796 */ - class OOO_DLLPUBLIC_FILE OOp_Radians : public OUnaryOperator + class OOp_Radians : public OUnaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs = ORowSetValue()) const; diff --git a/connectivity/source/inc/file/FResultSet.hxx b/connectivity/source/inc/file/FResultSet.hxx index be1d03b79262..c9472a6e28de 100644 --- a/connectivity/source/inc/file/FResultSet.hxx +++ b/connectivity/source/inc/file/FResultSet.hxx @@ -153,6 +153,7 @@ namespace connectivity sal_Int32 m_nLastVisitedPos; sal_Int32 m_nRowCountResult; sal_Int32 m_nCurrentPosition; // current position of the resultset is returned when ask for getRow() + sal_Int32 m_nColumnCount; sal_Bool m_bWasNull; sal_Bool m_bEOF; // after last record sal_Bool m_bLastRecord; @@ -162,6 +163,7 @@ namespace connectivity sal_Bool m_bRowInserted; sal_Bool m_bRowDeleted; sal_Bool m_bShowDeleted; + sal_Bool m_bIsCount; void initializeRow(OValueRefRow& _rRow,sal_Int32 _nColumnCount); void construct(); @@ -176,7 +178,7 @@ namespace connectivity BOOL IsSorted() const { return !m_aOrderbyColumnNumber.empty() && m_aOrderbyColumnNumber[0] != SQL_COLUMN_NOTFOUND;} // return true when the select statement is "select count(*) from table" - sal_Bool isCount() const; + inline sal_Bool isCount() const { return m_bIsCount; } void checkIndex(sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException); const ORowSetValue& getValue(sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException); @@ -310,7 +312,11 @@ namespace connectivity inline void setParameterColumns(const ::vos::ORef<connectivity::OSQLColumns>& _xParamColumns) { m_xParamColumns = _xParamColumns; } inline void setAssignValues(const ORefAssignValues& _aAssignValues) { m_aAssignValues = _aAssignValues; } inline void setBindingRow(const OValueRefRow& _aRow) { m_aRow = _aRow; } - inline void setSelectRow(const OValueRefRow& _rRow) { m_aSelectRow = _rRow; } + inline void setSelectRow(const OValueRefRow& _rRow) + { + m_aSelectRow = _rRow; + m_nColumnCount = m_aSelectRow->get().size(); + } inline void setColumnMapping(const ::std::vector<sal_Int32>& _aColumnMapping) { m_aColMapping = _aColumnMapping; } inline void setSqlAnalyzer(OSQLAnalyzer* _pSQLAnalyzer) { m_pSQLAnalyzer = _pSQLAnalyzer; } diff --git a/connectivity/source/inc/file/FStringFunctions.hxx b/connectivity/source/inc/file/FStringFunctions.hxx index aa7b48b94462..cdfdf2a85ca9 100644 --- a/connectivity/source/inc/file/FStringFunctions.hxx +++ b/connectivity/source/inc/file/FStringFunctions.hxx @@ -47,7 +47,7 @@ namespace connectivity -> 'HEJ' */ - class OOO_DLLPUBLIC_FILE OOp_Upper : public OUnaryOperator + class OOp_Upper : public OUnaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs) const; @@ -61,7 +61,7 @@ namespace connectivity -> 'quadratically' */ - class OOO_DLLPUBLIC_FILE OOp_Lower : public OUnaryOperator + class OOp_Lower : public OUnaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs) const; @@ -78,7 +78,7 @@ namespace connectivity -> 100 */ - class OOO_DLLPUBLIC_FILE OOp_Ascii : public OUnaryOperator + class OOp_Ascii : public OUnaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs) const; @@ -96,7 +96,7 @@ namespace connectivity -> 4 */ - class OOO_DLLPUBLIC_FILE OOp_CharLength : public OUnaryOperator + class OOp_CharLength : public OUnaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs) const; @@ -111,7 +111,7 @@ namespace connectivity -> 'MMM' */ - class OOO_DLLPUBLIC_FILE OOp_Char : public ONthOperator + class OOp_Char : public ONthOperator { protected: virtual ORowSetValue operate(const ::std::vector<ORowSetValue>& lhs) const; @@ -128,7 +128,7 @@ namespace connectivity -> '14.3' */ - class OOO_DLLPUBLIC_FILE OOp_Concat : public ONthOperator + class OOp_Concat : public ONthOperator { protected: virtual ORowSetValue operate(const ::std::vector<ORowSetValue>& lhs) const; @@ -149,7 +149,7 @@ namespace connectivity -> 7 */ - class OOO_DLLPUBLIC_FILE OOp_Locate : public ONthOperator + class OOp_Locate : public ONthOperator { protected: virtual ORowSetValue operate(const ::std::vector<ORowSetValue>& lhs) const; @@ -171,7 +171,7 @@ namespace connectivity -> 'ratica' */ - class OOO_DLLPUBLIC_FILE OOp_SubString : public ONthOperator + class OOp_SubString : public ONthOperator { protected: virtual ORowSetValue operate(const ::std::vector<ORowSetValue>& lhs) const; @@ -184,7 +184,7 @@ namespace connectivity -> 'barbar' */ - class OOO_DLLPUBLIC_FILE OOp_LTrim : public OUnaryOperator + class OOp_LTrim : public OUnaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs) const; @@ -197,7 +197,7 @@ namespace connectivity -> 'barbar' */ - class OOO_DLLPUBLIC_FILE OOp_RTrim : public OUnaryOperator + class OOp_RTrim : public OUnaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs) const; @@ -210,7 +210,7 @@ namespace connectivity -> ' ' */ - class OOO_DLLPUBLIC_FILE OOp_Space : public OUnaryOperator + class OOp_Space : public OUnaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs) const; @@ -223,7 +223,7 @@ namespace connectivity -> 'WwWwWw.OOo.com' */ - class OOO_DLLPUBLIC_FILE OOp_Replace : public ONthOperator + class OOp_Replace : public ONthOperator { protected: virtual ORowSetValue operate(const ::std::vector<ORowSetValue>& lhs) const; @@ -236,7 +236,7 @@ namespace connectivity -> 'OOoOOoOOo' */ - class OOO_DLLPUBLIC_FILE OOp_Repeat : public OBinaryOperator + class OOp_Repeat : public OBinaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const; @@ -249,7 +249,7 @@ namespace connectivity -> 'QuWhattic' */ - class OOO_DLLPUBLIC_FILE OOp_Insert : public ONthOperator + class OOp_Insert : public ONthOperator { protected: virtual ORowSetValue operate(const ::std::vector<ORowSetValue>& lhs) const; @@ -262,7 +262,7 @@ namespace connectivity -> 'fooba' */ - class OOO_DLLPUBLIC_FILE OOp_Left : public OBinaryOperator + class OOp_Left : public OBinaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const; @@ -274,7 +274,7 @@ namespace connectivity > SELECT RIGHT('foobarbar', 4); -> 'rbar' */ - class OOO_DLLPUBLIC_FILE OOp_Right : public OBinaryOperator + class OOp_Right : public OBinaryOperator { protected: virtual ORowSetValue operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const; diff --git a/connectivity/source/inc/file/fcode.hxx b/connectivity/source/inc/file/fcode.hxx index ebb1984a080c..f916beb91aae 100644 --- a/connectivity/source/inc/file/fcode.hxx +++ b/connectivity/source/inc/file/fcode.hxx @@ -129,7 +129,7 @@ namespace connectivity }; // Parameter fuer ein Praedikat - class OOO_DLLPUBLIC_FILE OOperandParam : public OOperandRow + class OOperandParam : public OOperandRow { public: OOperandParam(connectivity::OSQLParseNode* pNode, sal_Int32 _nPos); @@ -139,7 +139,7 @@ namespace connectivity }; // WerteOperanden - class OOO_DLLPUBLIC_FILE OOperandValue : public OOperand + class OOperandValue : public OOperand { protected: ORowSetValue m_aValue; @@ -161,7 +161,7 @@ namespace connectivity // Konstanten - class OOO_DLLPUBLIC_FILE OOperandConst : public OOperandValue + class OOperandConst : public OOperandValue { public: OOperandConst(const connectivity::OSQLParseNode& rColumnRef, const rtl::OUString& aStrValue); @@ -171,7 +171,7 @@ namespace connectivity // Ergebnis Operanden - class OOO_DLLPUBLIC_FILE OOperandResult : public OOperandValue + class OOperandResult : public OOperandValue { protected: OOperandResult(const ORowSetValue& _rVar, sal_Int32 eDbType) @@ -185,7 +185,7 @@ namespace connectivity }; - class OOO_DLLPUBLIC_FILE OOperandResultBOOL : public OOperandResult + class OOperandResultBOOL : public OOperandResult { public: OOperandResultBOOL(sal_Bool bResult) : OOperandResult(::com::sun::star::sdbc::DataType::BIT) @@ -195,7 +195,7 @@ namespace connectivity } }; - class OOO_DLLPUBLIC_FILE OOperandResultNUM : public OOperandResult + class OOperandResultNUM : public OOperandResult { public: OOperandResultNUM(double fNum) : OOperandResult(::com::sun::star::sdbc::DataType::DOUBLE) @@ -208,7 +208,7 @@ namespace connectivity /** special stop operand is appended when a list of arguments ends */ - class OOO_DLLPUBLIC_FILE OStopOperand : public OOperandValue + class OStopOperand : public OOperandValue { public: OStopOperand(){} @@ -237,7 +237,7 @@ namespace connectivity }; - class OOO_DLLPUBLIC_FILE OOp_AND : public OBoolOperator + class OOp_AND : public OBoolOperator { public: TYPEINFO(); @@ -246,7 +246,7 @@ namespace connectivity virtual sal_Bool operate(const OOperand*, const OOperand*) const; }; - class OOO_DLLPUBLIC_FILE OOp_OR : public OBoolOperator + class OOp_OR : public OBoolOperator { public: TYPEINFO(); @@ -284,7 +284,7 @@ namespace connectivity virtual sal_Bool operate(const OOperand*, const OOperand*) const; }; - class OOO_DLLPUBLIC_FILE OOp_NOTLIKE : public OOp_LIKE + class OOp_NOTLIKE : public OOp_LIKE { public: TYPEINFO(); @@ -309,7 +309,7 @@ namespace connectivity // numerische Operatoren - class OOO_DLLPUBLIC_FILE ONumOperator : public OOperator + class ONumOperator : public OOperator { public: virtual void Exec(OCodeStack&); @@ -320,25 +320,25 @@ namespace connectivity virtual double operate(const double& fLeft,const double& fRight) const = 0; }; - class OOO_DLLPUBLIC_FILE OOp_ADD : public ONumOperator + class OOp_ADD : public ONumOperator { protected: virtual double operate(const double& fLeft,const double& fRight) const; }; - class OOO_DLLPUBLIC_FILE OOp_SUB : public ONumOperator + class OOp_SUB : public ONumOperator { protected: virtual double operate(const double& fLeft,const double& fRight) const; }; - class OOO_DLLPUBLIC_FILE OOp_MUL : public ONumOperator + class OOp_MUL : public ONumOperator { protected: virtual double operate(const double& fLeft,const double& fRight) const; }; - class OOO_DLLPUBLIC_FILE OOp_DIV : public ONumOperator + class OOp_DIV : public ONumOperator { protected: virtual double operate(const double& fLeft,const double& fRight) const; @@ -350,7 +350,7 @@ namespace connectivity } // operator - class OOO_DLLPUBLIC_FILE ONthOperator : public OOperator + class ONthOperator : public OOperator { public: virtual void Exec(OCodeStack&); @@ -361,7 +361,7 @@ namespace connectivity virtual ORowSetValue operate(const ::std::vector<ORowSetValue>& lhs) const = 0; }; - class OOO_DLLPUBLIC_FILE OBinaryOperator : public OOperator + class OBinaryOperator : public OOperator { public: virtual void Exec(OCodeStack&); @@ -372,7 +372,7 @@ namespace connectivity virtual ORowSetValue operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const = 0; }; - class OOO_DLLPUBLIC_FILE OUnaryOperator : public OOperator + class OUnaryOperator : public OOperator { public: virtual void Exec(OCodeStack&); diff --git a/connectivity/source/inc/file/fcomp.hxx b/connectivity/source/inc/file/fcomp.hxx index 713238abd949..1f5dd4fbeb82 100644 --- a/connectivity/source/inc/file/fcomp.hxx +++ b/connectivity/source/inc/file/fcomp.hxx @@ -46,7 +46,7 @@ namespace connectivity class OSQLAnalyzer; typedef::std::vector<OCode*> OCodeList; - class OOO_DLLPUBLIC_FILE OPredicateCompiler : public ::vos::OReference + class OPredicateCompiler : public ::vos::OReference { friend class OPredicateInterpreter; friend class OSQLAnalyzer; @@ -92,7 +92,7 @@ namespace connectivity }; - class OOO_DLLPUBLIC_FILE OPredicateInterpreter : + class OPredicateInterpreter : public ::vos::OReference { OCodeStack m_aStack; diff --git a/connectivity/source/inc/file/quotedstring.hxx b/connectivity/source/inc/file/quotedstring.hxx index fa5b468275e1..139c0c6c1673 100644 --- a/connectivity/source/inc/file/quotedstring.hxx +++ b/connectivity/source/inc/file/quotedstring.hxx @@ -40,13 +40,18 @@ namespace connectivity // Ableitung von String mit ueberladenen GetToken/GetTokenCount-Methoden // Speziell fuer FLAT FILE-Format: Strings koennen gequotet sein //================================================================== - class OOO_DLLPUBLIC_FILE QuotedTokenizedString : public String + class OOO_DLLPUBLIC_FILE QuotedTokenizedString { + String m_sString; public: - QuotedTokenizedString(){} + QuotedTokenizedString() {} + QuotedTokenizedString(const String& _sString) : m_sString(_sString){} - xub_StrLen GetTokenCount( sal_Unicode cTok = ';', sal_Unicode cStrDel = '\0' ) const; + xub_StrLen GetTokenCount( sal_Unicode cTok , sal_Unicode cStrDel ) const; void GetTokenSpecial( String& _rStr,xub_StrLen& nStartPos, sal_Unicode cTok = ';', sal_Unicode cStrDel = '\0' ) const; + inline String& GetString() { return m_sString; } + inline xub_StrLen Len() const { return m_sString.Len(); } + inline operator String&() { return m_sString; } }; } diff --git a/connectivity/source/inc/flat/ETable.hxx b/connectivity/source/inc/flat/ETable.hxx index f775562b3820..b52898655111 100644 --- a/connectivity/source/inc/flat/ETable.hxx +++ b/connectivity/source/inc/flat/ETable.hxx @@ -46,24 +46,30 @@ namespace connectivity typedef ::std::map< ::rtl::OUString, ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed>, comphelper::UStringMixLess > OContainer; + typedef ::std::map<sal_Int32, sal_Int32> TRowPositionsInFile; class OFlatTable : public OFlatTable_BASE { // maps a row postion to a file position - ::std::map<sal_Int32,sal_Int32> m_aRowToFilePos; + TRowPositionsInFile m_aFilePosToEndLinePos; + ::std::map<sal_Int32, TRowPositionsInFile::iterator> + m_aRowPosToFilePos; ::std::vector<sal_Int32> m_aTypes; // holds all type for columns just to avoid to ask the propertyset ::std::vector<sal_Int32> m_aPrecisions; // same as aboth ::std::vector<sal_Int32> m_aScales; QuotedTokenizedString m_aCurrentLine; ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > m_xNumberFormatter; + ::com::sun::star::util::Date m_aNullDate; + sal_Int32 m_nStartRowFilePos; sal_Int32 m_nRowPos; sal_Int32 m_nMaxRowCount; // will be set if stream is once eof + sal_Unicode m_cStringDelimiter; // delimiter for strings m_cStringDelimiter blabla m_cStringDelimiter + sal_Unicode m_cFieldDelimiter; // look at the name + bool m_bNeedToReadLine; private: void fillColumns(const ::com::sun::star::lang::Locale& _aLocale); BOOL CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo); sal_Bool readLine(sal_Int32& _rnCurrentPos); - - sal_Bool checkHeaderLine(); public: virtual void refreshColumns(); diff --git a/connectivity/source/inc/java/io/InputStream.hxx b/connectivity/source/inc/java/io/InputStream.hxx index 90150a2bf5d8..ba6f4e258a2e 100644 --- a/connectivity/source/inc/java/io/InputStream.hxx +++ b/connectivity/source/inc/java/io/InputStream.hxx @@ -46,11 +46,9 @@ namespace connectivity protected: // statische Daten fuer die Klasse static jclass theClass; - // der Destruktor um den Object-Counter zu aktualisieren - static void saveClassRef( jclass pClass ); virtual ~java_io_InputStream(); public: - static jclass getMyClass(); + virtual jclass getMyClass() const; // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: java_io_InputStream( JNIEnv * pEnv, jobject myObj ); // XInputStream diff --git a/connectivity/source/inc/java/io/Reader.hxx b/connectivity/source/inc/java/io/Reader.hxx index 67e8e8c28d48..11b3d53c316c 100644 --- a/connectivity/source/inc/java/io/Reader.hxx +++ b/connectivity/source/inc/java/io/Reader.hxx @@ -46,11 +46,9 @@ namespace connectivity protected: // statische Daten fuer die Klasse static jclass theClass; - // der Destruktor um den Object-Counter zu aktualisieren - static void saveClassRef( jclass pClass ); virtual ~java_io_Reader(); public: - static jclass getMyClass(); + virtual jclass getMyClass() const; // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: java_io_Reader( JNIEnv * pEnv, jobject myObj ); diff --git a/connectivity/source/inc/java/lang/Boolean.hxx b/connectivity/source/inc/java/lang/Boolean.hxx index 3a9d92de3e81..2f33ea27bc11 100644 --- a/connectivity/source/inc/java/lang/Boolean.hxx +++ b/connectivity/source/inc/java/lang/Boolean.hxx @@ -41,10 +41,8 @@ namespace connectivity protected: // statische Daten fuer die Klasse static jclass theClass; - // der Destruktor um den Object-Counter zu aktualisieren - static void saveClassRef( jclass pClass ); public: - static jclass getMyClass(); + virtual jclass getMyClass() const; virtual ~java_lang_Boolean(); // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: java_lang_Boolean( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} diff --git a/connectivity/source/inc/java/lang/Class.hxx b/connectivity/source/inc/java/lang/Class.hxx index 87cda1554da1..aa6d7c2a836d 100644 --- a/connectivity/source/inc/java/lang/Class.hxx +++ b/connectivity/source/inc/java/lang/Class.hxx @@ -41,18 +41,13 @@ namespace connectivity protected: // statische Daten fuer die Klasse static jclass theClass; - // der Destruktor um den Object-Counter zu aktualisieren - static void saveClassRef( jclass pClass ); public: - static jclass getMyClass(); + virtual jclass getMyClass() const; virtual ~java_lang_Class(); // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: java_lang_Class( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} static java_lang_Class * forName( const ::rtl::OUString &_par0 ); - sal_Bool isAssignableFrom( java_lang_Class * _par0 ); - java_lang_Object * newInstance(); - ::rtl::OUString getName(); // return the jre object jobject newInstanceObject(); diff --git a/connectivity/source/inc/java/lang/Exception.hxx b/connectivity/source/inc/java/lang/Exception.hxx index cc5705780a26..a308a0e14928 100644 --- a/connectivity/source/inc/java/lang/Exception.hxx +++ b/connectivity/source/inc/java/lang/Exception.hxx @@ -42,10 +42,8 @@ namespace connectivity protected: // statische Daten fuer die Klasse static jclass theClass; - // der Destruktor um den Object-Counter zu aktualisieren - static void saveClassRef( jclass pClass ); public: - static jclass getMyClass(); + virtual jclass getMyClass() const; virtual ~java_lang_Exception(); // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: java_lang_Exception( JNIEnv * pEnv, jobject myObj ) : java_lang_Throwable( pEnv, myObj ){} diff --git a/connectivity/source/inc/java/lang/Object.hxx b/connectivity/source/inc/java/lang/Object.hxx index a0485d6289bd..4c441b75c1e9 100644 --- a/connectivity/source/inc/java/lang/Object.hxx +++ b/connectivity/source/inc/java/lang/Object.hxx @@ -40,6 +40,7 @@ #include <osl/diagnose.h> #include <jvmaccess/virtualmachine.hxx> #include <memory> +#include <functional> #include <boost/shared_ptr.hpp> //===================================================================== @@ -65,6 +66,7 @@ namespace connectivity { jvmaccess::VirtualMachine::AttachGuard m_aGuard; SDBThreadAttach(SDBThreadAttach&); + SDBThreadAttach& operator= (SDBThreadAttach&); public: SDBThreadAttach(); ~SDBThreadAttach(); @@ -82,14 +84,14 @@ namespace connectivity } }; //===================================================================== + //===================================================================== class java_lang_Class; class java_lang_Object { // Zuweisungsoperator und Copy Konstruktor sind verboten - java_lang_Object& operator = (java_lang_Object&) { return *this;}; - java_lang_Object(java_lang_Object&) {}; + java_lang_Object& operator= (java_lang_Object&); + java_lang_Object(java_lang_Object&); - static jclass getMyClass(); // nur zum Zerstoeren des C++ Pointers in vom JSbxObject // abgeleiteten Java Objekten ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory; @@ -102,6 +104,8 @@ namespace connectivity // neu in SJ2: static jclass theClass; // die Klasse braucht nur einmal angefordert werden ! + virtual jclass getMyClass() const; + public: // der Konstruktor, der fuer die abgeleiteten Klassen verwendet // werden soll. @@ -130,6 +134,45 @@ namespace connectivity ); static ::rtl::Reference< jvmaccess::VirtualMachine > getVM(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory=NULL); + + static jclass findMyClass(const char* _pClassName); + void obtainMethodId(JNIEnv* _pEnv, const char* _pMethodName, const char* _pSignature, jmethodID& _inout_MethodID) const; + + sal_Bool callBooleanMethod( const char* _pMethodName, jmethodID& _inout_MethodID ) const; + sal_Bool callBooleanMethodWithIntArg( const char* _pMethodName, jmethodID& _inout_MethodID, sal_Int32 _nArgument ) const; + jobject callResultSetMethod( JNIEnv& _rEnv, const char* _pMethodName, jmethodID& _inout_MethodID ) const; + sal_Int32 callIntMethod( const char* _pMethodName, jmethodID& _inout_MethodID,bool _bIgnoreException = false ) const; + sal_Int32 callIntMethodWithIntArg( const char* _pMethodName, jmethodID& _inout_MethodID, sal_Int32 _nArgument ) const; + sal_Int32 callIntMethodWithStringArg( const char* _pMethodName, jmethodID& _inout_MethodID,const ::rtl::OUString& _nArgument ) const; + ::rtl::OUString callStringMethod( const char* _pMethodName, jmethodID& _inout_MethodID ) const; + ::rtl::OUString callStringMethodWithIntArg( const char* _pMethodName, jmethodID& _inout_MethodID , sal_Int32 _nArgument) const; + void callVoidMethod( const char* _pMethodName, jmethodID& _inout_MethodID) const; + void callVoidMethodWithIntArg( const char* _pMethodName, jmethodID& _inout_MethodID, sal_Int32 _nArgument,bool _bIgnoreException = false ) const; + void callVoidMethodWithBoolArg( const char* _pMethodName, jmethodID& _inout_MethodID, sal_Int32 _nArgument,bool _bIgnoreException = false ) const; + void callVoidMethodWithStringArg( const char* _pMethodName, jmethodID& _inout_MethodID, const ::rtl::OUString& _nArgument ) const; + jobject callObjectMethod( JNIEnv * pEnv, const char* _pMethodName, const char* _pSignature, jmethodID& _inout_MethodID ) const; + jobject callObjectMethodWithIntArg( JNIEnv * pEnv, const char* _pMethodName, const char* _pSignature, jmethodID& _inout_MethodID , sal_Int32 _nArgument) const; + + template< typename T > + T callMethodWithIntArg(T (JNIEnv::*pCallMethod)( jobject obj, jmethodID methodID, ... ) ,const char* _pMethodName, const char* _pSignature, jmethodID& _inout_MethodID , sal_Int32 _nArgument) const + { + SDBThreadAttach t; + obtainMethodId(t.pEnv, _pMethodName,_pSignature, _inout_MethodID); + T out = (t.pEnv->*pCallMethod)( object, _inout_MethodID,_nArgument); + ThrowSQLException( t.pEnv, NULL ); + return out; + } + + template< typename T > + void callVoidMethod(const char* _pMethodName, const char* _pSignature, jmethodID& _inout_MethodID,sal_Int32 _nArgument, const T& _aValue) const + { + SDBThreadAttach t; + obtainMethodId(t.pEnv, _pMethodName,_pSignature, _inout_MethodID); + t.pEnv->CallVoidMethod( object, _inout_MethodID,_nArgument,_aValue); + ThrowSQLException( t.pEnv, NULL ); + } + + }; } #endif //_CONNECTIVITY_JAVA_LANG_OBJJECT_HXX_ diff --git a/connectivity/source/inc/java/lang/String.hxx b/connectivity/source/inc/java/lang/String.hxx index 4315f4844945..49fb7810a642 100644 --- a/connectivity/source/inc/java/lang/String.hxx +++ b/connectivity/source/inc/java/lang/String.hxx @@ -39,16 +39,16 @@ namespace connectivity protected: // statische Daten fuer die Klasse static jclass theClass; - // der Destruktor um den Object-Counter zu aktualisieren - static void saveClassRef( jclass pClass ); public: - static jclass getMyClass(); + virtual jclass getMyClass() const; virtual ~java_lang_String(); // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: java_lang_String( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} java_lang_String( const ::rtl::OUString& _par0 ); operator ::rtl::OUString(); + + static jclass st_getMyClass(); }; } diff --git a/connectivity/source/inc/java/lang/Throwable.hxx b/connectivity/source/inc/java/lang/Throwable.hxx index 1605763b77ad..dd9b02f6a687 100644 --- a/connectivity/source/inc/java/lang/Throwable.hxx +++ b/connectivity/source/inc/java/lang/Throwable.hxx @@ -42,16 +42,15 @@ namespace connectivity protected: // statische Daten fuer die Klasse static jclass theClass; - // der Destruktor um den Object-Counter zu aktualisieren - static void saveClassRef( jclass pClass ); public: - static jclass getMyClass(); + virtual jclass getMyClass() const; virtual ~java_lang_Throwable(); // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: java_lang_Throwable( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} ::rtl::OUString getMessage() const; ::rtl::OUString getLocalizedMessage() const; - virtual ::rtl::OUString toString() const; + + static jclass st_getMyClass(); }; } #endif // _CONNECTIVITY_JAVA_LANG_THROWABLE_HXX_ diff --git a/connectivity/source/inc/java/math/BigDecimal.hxx b/connectivity/source/inc/java/math/BigDecimal.hxx index 5744e5af2788..e75c6ad4261b 100644 --- a/connectivity/source/inc/java/math/BigDecimal.hxx +++ b/connectivity/source/inc/java/math/BigDecimal.hxx @@ -40,10 +40,8 @@ namespace connectivity { // statische Daten fuer die Klasse static jclass theClass; - // der Destruktor um den Object-Counter zu aktualisieren - static void saveClassRef( jclass pClass ); public: - static jclass getMyClass(); + virtual jclass getMyClass() const; virtual ~java_math_BigDecimal(); // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: java_math_BigDecimal( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} diff --git a/connectivity/source/inc/java/sql/Array.hxx b/connectivity/source/inc/java/sql/Array.hxx index be21acba8d90..d3395b272643 100644 --- a/connectivity/source/inc/java/sql/Array.hxx +++ b/connectivity/source/inc/java/sql/Array.hxx @@ -46,10 +46,8 @@ namespace connectivity protected: // statische Daten fuer die Klasse static jclass theClass; - // der Destruktor um den Object-Counter zu aktualisieren - static void saveClassRef( jclass pClass ); public: - static jclass getMyClass(); + virtual jclass getMyClass() const; virtual ~java_sql_Array(); // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: java_sql_Array( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} diff --git a/connectivity/source/inc/java/sql/Blob.hxx b/connectivity/source/inc/java/sql/Blob.hxx index ca344e878897..9c54b48bb9b1 100644 --- a/connectivity/source/inc/java/sql/Blob.hxx +++ b/connectivity/source/inc/java/sql/Blob.hxx @@ -47,11 +47,9 @@ namespace connectivity protected: // statische Daten fuer die Klasse static jclass theClass; - // der Destruktor um den Object-Counter zu aktualisieren - static void saveClassRef( jclass pClass ); virtual ~java_sql_Blob(); public: - static jclass getMyClass(); + virtual jclass getMyClass() const; // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: java_sql_Blob( JNIEnv * pEnv, jobject myObj ); diff --git a/connectivity/source/inc/java/sql/CallableStatement.hxx b/connectivity/source/inc/java/sql/CallableStatement.hxx index 397dd90053fd..aa820a974902 100644 --- a/connectivity/source/inc/java/sql/CallableStatement.hxx +++ b/connectivity/source/inc/java/sql/CallableStatement.hxx @@ -48,14 +48,12 @@ namespace connectivity protected: // statische Daten fuer die Klasse static jclass theClass; - // der Destruktor um den Object-Counter zu aktualisieren - static void saveClassRef( jclass pClass ); virtual void createStatement(JNIEnv* _pEnv); virtual ~java_sql_CallableStatement(); public: DECLARE_SERVICE_INFO(); - static jclass getMyClass(); + virtual jclass getMyClass() const; // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: java_sql_CallableStatement( JNIEnv * pEnv, java_sql_Connection& _rCon, const ::rtl::OUString& sql ); diff --git a/connectivity/source/inc/java/sql/Clob.hxx b/connectivity/source/inc/java/sql/Clob.hxx index 41bedb347d81..8265a515a15b 100644 --- a/connectivity/source/inc/java/sql/Clob.hxx +++ b/connectivity/source/inc/java/sql/Clob.hxx @@ -47,11 +47,9 @@ namespace connectivity protected: // statische Daten fuer die Klasse static jclass theClass; - // der Destruktor um den Object-Counter zu aktualisieren - static void saveClassRef( jclass pClass ); virtual ~java_sql_Clob(); public: - static jclass getMyClass(); + virtual jclass getMyClass() const; // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: java_sql_Clob( JNIEnv * pEnv, jobject myObj ); diff --git a/connectivity/source/inc/java/sql/Connection.hxx b/connectivity/source/inc/java/sql/Connection.hxx index 6cda6e248ca4..74d76d32f35a 100644 --- a/connectivity/source/inc/java/sql/Connection.hxx +++ b/connectivity/source/inc/java/sql/Connection.hxx @@ -84,13 +84,11 @@ namespace connectivity protected: // statische Daten fuer die Klasse static jclass theClass; - // der Destruktor um den Object-Counter zu aktualisieren - static void saveClassRef( jclass pClass ); virtual ~java_sql_Connection(); public: - static jclass getMyClass(); + virtual jclass getMyClass() const; DECLARE_SERVICE_INFO(); // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: diff --git a/connectivity/source/inc/java/sql/DatabaseMetaData.hxx b/connectivity/source/inc/java/sql/DatabaseMetaData.hxx index ff487f873ee4..f45cb57e1c45 100644 --- a/connectivity/source/inc/java/sql/DatabaseMetaData.hxx +++ b/connectivity/source/inc/java/sql/DatabaseMetaData.hxx @@ -50,11 +50,9 @@ namespace connectivity // statische Daten fuer die Klasse static jclass theClass; - // der Destruktor um den Object-Counter zu aktualisieren - static void saveClassRef( jclass pClass ); public: - static jclass getMyClass(); + virtual jclass getMyClass() const; virtual ~java_sql_DatabaseMetaData(); // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: java_sql_DatabaseMetaData( JNIEnv * pEnv, jobject myObj, java_sql_Connection& _rConnection ); diff --git a/connectivity/source/inc/java/sql/DriverManager.hxx b/connectivity/source/inc/java/sql/DriverManager.hxx deleted file mode 100644 index 5304212fe1f8..000000000000 --- a/connectivity/source/inc/java/sql/DriverManager.hxx +++ /dev/null @@ -1,66 +0,0 @@ -/************************************************************************* - * - * 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: DriverManager.hxx,v $ - * $Revision: 1.3 $ - * - * 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. - * - ************************************************************************/ -#ifndef _CONNECTIVITY_JAVA_SQL_DRIVERMANAGER_HXX_ -#define _CONNECTIVITY_JAVA_SQL_DRIVERMANAGER_HXX_ - -#include "java/lang/Object.hxx" - -namespace connectivity -{ - class java_sql_Driver; - class java_sql_Connection; - // class java_util_Properties; - //************************************************************** - //************ Class: java.sql.DriverManager - //************************************************************** - class java_sql_DriverManager : public java_lang_Object - { - protected: - // statische Daten fuer die Klasse - static jclass theClass; - // der Destruktor um den Object-Counter zu aktualisieren - static void saveClassRef( jclass pClass ); - public: - static jclass getMyClass(); - virtual ~java_sql_DriverManager(); - // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: - java_sql_DriverManager( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} - - static jobject getDriver(const ::rtl::OUString &url); - - // static java_sql_Connection * getConnection( const ::rtl::OUString* _par0 ); - // static java_sql_Connection * getConnection( const String* _par0, java_util_Properties * _par1 ); - // static java_sql_Connection * getConnection( const String* _par0, const String* _par1, const String* _par2 ); - // static java_util_Enumeration * getDrivers(); - static void setLoginTimeout(sal_Int32 _par0); - }; -} -#endif // _CONNECTIVITY_JAVA_SQL_DRIVERMANAGER_HXX_ - diff --git a/connectivity/source/inc/java/sql/DriverPropertyInfo.hxx b/connectivity/source/inc/java/sql/DriverPropertyInfo.hxx index 7b37b6fcff09..333ab41388af 100644 --- a/connectivity/source/inc/java/sql/DriverPropertyInfo.hxx +++ b/connectivity/source/inc/java/sql/DriverPropertyInfo.hxx @@ -38,27 +38,25 @@ namespace connectivity { //************************************************************** -//************ Class: java.sql.DriverManager +//************ Class: java.sql.DriverPropertyInfo //************************************************************** class java_sql_DriverPropertyInfo : public java_lang_Object { protected: // statische Daten fuer die Klasse static jclass theClass; - // der Destruktor um den Object-Counter zu aktualisieren - static void saveClassRef( jclass pClass ); public: - static jclass getMyClass(); + virtual jclass getMyClass() const; virtual ~java_sql_DriverPropertyInfo(); // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: java_sql_DriverPropertyInfo( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} operator ::com::sun::star::sdbc::DriverPropertyInfo(); - ::rtl::OUString name() const; - ::rtl::OUString description() const; - ::rtl::OUString value() const; - sal_Bool required() const; - ::com::sun::star::uno::Sequence< ::rtl::OUString> choices() const; + ::rtl::OUString name(); + ::rtl::OUString description(); + ::rtl::OUString value(); + sal_Bool required(); + ::com::sun::star::uno::Sequence< ::rtl::OUString> choices(); }; } diff --git a/connectivity/source/inc/java/sql/JStatement.hxx b/connectivity/source/inc/java/sql/JStatement.hxx index 05744379d184..5b85fd9e6788 100644 --- a/connectivity/source/inc/java/sql/JStatement.hxx +++ b/connectivity/source/inc/java/sql/JStatement.hxx @@ -104,8 +104,6 @@ namespace connectivity // statische Daten fuer die Klasse static jclass theClass; - // der Destruktor um den Object-Counter zu aktualisieren - static void saveClassRef( jclass pClass ); // OPropertyArrayUsageHelper virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; @@ -133,8 +131,11 @@ namespace connectivity virtual ~java_sql_Statement_Base(); + sal_Int32 impl_getProperty(const char* _pMethodName, jmethodID& _inout_MethodID); + sal_Int32 impl_getProperty(const char* _pMethodName, jmethodID& _inout_MethodID,sal_Int32 _nDefault); + public: - static jclass getMyClass(); + virtual jclass getMyClass() const; // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: java_sql_Statement_Base( JNIEnv * pEnv, java_sql_Connection& _rCon ); @@ -197,15 +198,13 @@ namespace connectivity protected: // statische Daten fuer die Klasse static jclass theClass; - // der Destruktor um den Object-Counter zu aktualisieren - static void saveClassRef( jclass pClass ); virtual void createStatement(JNIEnv* _pEnv); virtual ~java_sql_Statement(); public: DECLARE_SERVICE_INFO(); - static jclass getMyClass(); + virtual jclass getMyClass() const; // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: java_sql_Statement( JNIEnv * pEnv, java_sql_Connection& _rCon ) : OStatement_BASE2( pEnv, _rCon){}; diff --git a/connectivity/source/inc/java/sql/PreparedStatement.hxx b/connectivity/source/inc/java/sql/PreparedStatement.hxx index 98d7b8f116fb..07635859bf55 100644 --- a/connectivity/source/inc/java/sql/PreparedStatement.hxx +++ b/connectivity/source/inc/java/sql/PreparedStatement.hxx @@ -54,14 +54,12 @@ namespace connectivity protected: // statische Daten fuer die Klasse static jclass theClass; - // der Destruktor um den Object-Counter zu aktualisieren - static void saveClassRef( jclass pClass ); virtual void createStatement(JNIEnv* _pEnv); virtual ~java_sql_PreparedStatement(); public: DECLARE_SERVICE_INFO(); - static jclass getMyClass(); + virtual jclass getMyClass() const; // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: java_sql_PreparedStatement( JNIEnv * pEnv, java_sql_Connection& _rCon,const ::rtl::OUString& sql ); diff --git a/connectivity/source/inc/java/sql/Ref.hxx b/connectivity/source/inc/java/sql/Ref.hxx index 1ee2b9a836e3..a9755e5861dc 100644 --- a/connectivity/source/inc/java/sql/Ref.hxx +++ b/connectivity/source/inc/java/sql/Ref.hxx @@ -46,11 +46,9 @@ namespace connectivity protected: // statische Daten fuer die Klasse static jclass theClass; - // der Destruktor um den Object-Counter zu aktualisieren - static void saveClassRef( jclass pClass ); virtual ~java_sql_Ref(); public: - static jclass getMyClass(); + virtual jclass getMyClass() const; // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: java_sql_Ref( JNIEnv * pEnv, jobject myObj ); diff --git a/connectivity/source/inc/java/sql/ResultSet.hxx b/connectivity/source/inc/java/sql/ResultSet.hxx index d2d3f8ca75bd..d3c9c86bb18b 100644 --- a/connectivity/source/inc/java/sql/ResultSet.hxx +++ b/connectivity/source/inc/java/sql/ResultSet.hxx @@ -87,8 +87,6 @@ namespace connectivity protected: // statische Daten fuer die Klasse static jclass theClass; - // der Destruktor um den Object-Counter zu aktualisieren - static void saveClassRef( jclass pClass ); // OPropertyArrayUsageHelper virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; @@ -113,7 +111,7 @@ namespace connectivity virtual ~java_sql_ResultSet(); public: DECLARE_SERVICE_INFO(); - static jclass getMyClass(); + virtual jclass getMyClass() const; // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: java_sql_ResultSet( JNIEnv * pEnv, jobject myObj, const java::sql::ConnectionLog& _rParentLogger,java_sql_Connection& _rConnection, java_sql_Statement_Base* pStmt = NULL ); diff --git a/connectivity/source/inc/java/sql/ResultSetMetaData.hxx b/connectivity/source/inc/java/sql/ResultSetMetaData.hxx index 43db1d1ff115..8a281cc7e0be 100644 --- a/connectivity/source/inc/java/sql/ResultSetMetaData.hxx +++ b/connectivity/source/inc/java/sql/ResultSetMetaData.hxx @@ -47,14 +47,13 @@ namespace connectivity protected: java::sql::ConnectionLog m_aLogger; java_sql_Connection* m_pConnection; + sal_Int32 m_nColumnCount; // statische Daten fuer die Klasse static jclass theClass; - // der Destruktor um den Object-Counter zu aktualisieren - static void saveClassRef( jclass pClass ); virtual ~java_sql_ResultSetMetaData(); public: - static jclass getMyClass(); + virtual jclass getMyClass() const; // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: java_sql_ResultSetMetaData( JNIEnv * pEnv, jobject myObj, const java::sql::ConnectionLog& _rResultSetLogger, java_sql_Connection& _rCon ); diff --git a/connectivity/source/inc/java/sql/SQLException.hxx b/connectivity/source/inc/java/sql/SQLException.hxx index 243034db4701..3fc66e5e6768 100644 --- a/connectivity/source/inc/java/sql/SQLException.hxx +++ b/connectivity/source/inc/java/sql/SQLException.hxx @@ -53,10 +53,8 @@ namespace connectivity protected: // statische Daten fuer die Klasse static jclass theClass; - // der Destruktor um den Object-Counter zu aktualisieren - static void saveClassRef( jclass pClass ); public: - static jclass getMyClass(); + virtual jclass getMyClass() const; virtual ~java_sql_SQLException_BASE(); // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: java_sql_SQLException_BASE( JNIEnv * pEnv, jobject myObj ); @@ -64,6 +62,8 @@ namespace connectivity ::rtl::OUString getSQLState() const; sal_Int32 getErrorCode() const; starsdbc::SQLException getNextException() const; + + static jclass st_getMyClass(); }; } diff --git a/connectivity/source/inc/java/sql/SQLWarning.hxx b/connectivity/source/inc/java/sql/SQLWarning.hxx index 967954d15d13..58477fd4a316 100644 --- a/connectivity/source/inc/java/sql/SQLWarning.hxx +++ b/connectivity/source/inc/java/sql/SQLWarning.hxx @@ -48,10 +48,8 @@ namespace connectivity protected: // statische Daten fuer die Klasse static jclass theClass; - // der Destruktor um den Object-Counter zu aktualisieren - static void saveClassRef( jclass pClass ); public: - static jclass getMyClass(); + virtual jclass getMyClass() const; virtual ~java_sql_SQLWarning_BASE(); // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: java_sql_SQLWarning_BASE( JNIEnv * pEnv, jobject myObj ) : java_sql_SQLException_BASE( pEnv, myObj ){} diff --git a/connectivity/source/inc/java/sql/Timestamp.hxx b/connectivity/source/inc/java/sql/Timestamp.hxx index 78546b4341ec..ce6de39b5bb9 100644 --- a/connectivity/source/inc/java/sql/Timestamp.hxx +++ b/connectivity/source/inc/java/sql/Timestamp.hxx @@ -46,10 +46,8 @@ namespace connectivity protected: // statische Daten fuer die Klasse static jclass theClass; - // der Destruktor um den Object-Counter zu aktualisieren - static void saveClassRef( jclass pClass ); public: - static jclass getMyClass(); + virtual jclass getMyClass() const; virtual ~java_sql_Date(); // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: java_sql_Date( JNIEnv * pEnv, jobject myObj ) : java_util_Date(pEnv,myObj){} @@ -68,10 +66,8 @@ namespace connectivity protected: // statische Daten fuer die Klasse static jclass theClass; - // der Destruktor um den Object-Counter zu aktualisieren - static void saveClassRef( jclass pClass ); public: - static jclass getMyClass(); + virtual jclass getMyClass() const; virtual ~java_sql_Time(); // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: java_sql_Time( JNIEnv * pEnv, jobject myObj ) : java_util_Date( pEnv, myObj ){} @@ -87,10 +83,8 @@ namespace connectivity protected: // statische Daten fuer die Klasse static jclass theClass; - // der Destruktor um den Object-Counter zu aktualisieren - static void saveClassRef( jclass pClass ); public: - static jclass getMyClass(); + virtual jclass getMyClass() const; virtual ~java_sql_Timestamp(); // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: java_sql_Timestamp( JNIEnv * pEnv, jobject myObj ) : java_util_Date( pEnv, myObj ){} diff --git a/connectivity/source/inc/java/util/Date.hxx b/connectivity/source/inc/java/util/Date.hxx index 2a18a5363394..05278cba0dd4 100644 --- a/connectivity/source/inc/java/util/Date.hxx +++ b/connectivity/source/inc/java/util/Date.hxx @@ -46,10 +46,8 @@ namespace connectivity protected: // statische Daten fuer die Klasse static jclass theClass; - // der Destruktor um den Object-Counter zu aktualisieren - static void saveClassRef( jclass pClass ); public: - static jclass getMyClass(); + virtual jclass getMyClass() const; virtual ~java_util_Date(); // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: java_util_Date( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} diff --git a/connectivity/source/inc/java/util/Property.hxx b/connectivity/source/inc/java/util/Property.hxx index 12afba952a18..9038d3836d2c 100644 --- a/connectivity/source/inc/java/util/Property.hxx +++ b/connectivity/source/inc/java/util/Property.hxx @@ -39,10 +39,8 @@ namespace connectivity protected: // statische Daten fuer die Klasse static jclass theClass; - // der Destruktor um den Object-Counter zu aktualisieren - static void saveClassRef( jclass pClass ); public: - static jclass getMyClass(); + virtual jclass getMyClass() const; virtual ~java_util_Properties(); // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: java_util_Properties( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} diff --git a/connectivity/source/parse/sqliterator.cxx b/connectivity/source/parse/sqliterator.cxx index 891fd41dae3f..56f63de5ce14 100644 --- a/connectivity/source/parse/sqliterator.cxx +++ b/connectivity/source/parse/sqliterator.cxx @@ -51,6 +51,7 @@ #include <connectivity/dbmetadata.hxx> #include <com/sun/star/sdb/SQLFilterOperator.hpp> #include "diagnose_ex.h" +#include <rtl/logfile.hxx> using namespace ::comphelper; using namespace ::connectivity; @@ -150,6 +151,7 @@ OSQLParseTreeIterator::OSQLParseTreeIterator(const Reference< XConnection >& _rx :m_rParser( _rParser ) ,m_pImpl( new OSQLParseTreeIteratorImpl( _rxConnection, _rxTables ) ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::OSQLParseTreeIterator" ); setParseTree(pRoot); } @@ -158,6 +160,7 @@ OSQLParseTreeIterator::OSQLParseTreeIterator( const OSQLParseTreeIterator& _rPar :m_rParser( _rParser ) ,m_pImpl( new OSQLParseTreeIteratorImpl( _rParentIterator.m_pImpl->m_xConnection, _rParentIterator.m_pImpl->m_xTableContainer ) ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::OSQLParseTreeIterator" ); m_pImpl->m_pForbiddenQueryNames = _rParentIterator.m_pImpl->m_pForbiddenQueryNames; setParseTree( pRoot ); } @@ -171,18 +174,21 @@ OSQLParseTreeIterator::~OSQLParseTreeIterator() // ----------------------------------------------------------------------------- const OSQLTables& OSQLParseTreeIterator::getTables() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::getTables" ); return *m_pImpl->m_pTables; } // ----------------------------------------------------------------------------- bool OSQLParseTreeIterator::isCaseSensitive() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::isCaseSensitive" ); return m_pImpl->m_bIsCaseSensitive; } // ----------------------------------------------------------------------------- void OSQLParseTreeIterator::dispose() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::dispose" ); m_aSelectColumns = NULL; m_aGroupColumns = NULL; m_aOrderColumns = NULL; @@ -196,6 +202,7 @@ void OSQLParseTreeIterator::dispose() //----------------------------------------------------------------------------- void OSQLParseTreeIterator::setParseTree(const OSQLParseNode * pNewParseTree) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::setParseTree" ); m_pImpl->m_pTables->clear(); m_pImpl->m_pSubTables->clear(); @@ -314,6 +321,7 @@ namespace //----------------------------------------------------------------------------- void OSQLParseTreeIterator::impl_getQueryParameterColumns( const OSQLTable& _rQuery ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::impl_getQueryParameterColumns" ); if ( ( m_pImpl->m_nIncludeMask & Parameters ) != Parameters ) // parameters not to be included in the traversal return; @@ -362,6 +370,7 @@ void OSQLParseTreeIterator::impl_getQueryParameterColumns( const OSQLTable& _rQu //----------------------------------------------------------------------------- OSQLTable OSQLParseTreeIterator::impl_locateRecordSource( const ::rtl::OUString& _rComposedName ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::impl_locateRecordSource" ); if ( !_rComposedName.getLength() ) { OSL_ENSURE( false, "OSQLParseTreeIterator::impl_locateRecordSource: no object name at all?" ); @@ -439,6 +448,7 @@ OSQLTable OSQLParseTreeIterator::impl_locateRecordSource( const ::rtl::OUString& //----------------------------------------------------------------------------- void OSQLParseTreeIterator::traverseOneTableName( OSQLTables& _rTables,const OSQLParseNode * pTableName, const ::rtl::OUString & rTableRange ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::traverseOneTableName" ); if ( ( m_pImpl->m_nIncludeMask & TableNames ) != TableNames ) // tables should not be included in the traversal return; @@ -473,6 +483,7 @@ void OSQLParseTreeIterator::traverseOneTableName( OSQLTables& _rTables,const OSQ //----------------------------------------------------------------------------- void OSQLParseTreeIterator::getQualified_join( OSQLTables& _rTables, const OSQLParseNode *pTableRef, ::rtl::OUString& aTableRange ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::getQualified_join" ); OSL_PRECOND( SQL_ISRULE( pTableRef, cross_union ) || SQL_ISRULE( pTableRef, qualified_join ) , "OSQLParseTreeIterator::getQualified_join: illegal node!" ); @@ -493,6 +504,7 @@ void OSQLParseTreeIterator::getQualified_join( OSQLTables& _rTables, const OSQLP //----------------------------------------------------------------------------- const OSQLParseNode* OSQLParseTreeIterator::getTableNode( OSQLTables& _rTables, const OSQLParseNode *pTableRef,::rtl::OUString& rTableRange ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::getTableNode" ); OSL_PRECOND( SQL_ISRULE( pTableRef, table_ref ) || SQL_ISRULE( pTableRef, joined_table ) || SQL_ISRULE( pTableRef, qualified_join ) || SQL_ISRULE( pTableRef, cross_union ), "OSQLParseTreeIterator::getTableNode: only to be called for table_ref nodes!" ); @@ -550,6 +562,7 @@ const OSQLParseNode* OSQLParseTreeIterator::getTableNode( OSQLTables& _rTables, //----------------------------------------------------------------------------- void OSQLParseTreeIterator::getSelect_statement(OSQLTables& _rTables,const OSQLParseNode* pSelect) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::getSelect_statement" ); if(SQL_ISRULE(pSelect,union_statement)) { getSelect_statement(_rTables,pSelect->getChild(0)); @@ -605,6 +618,7 @@ void OSQLParseTreeIterator::getSelect_statement(OSQLTables& _rTables,const OSQLP //----------------------------------------------------------------------------- bool OSQLParseTreeIterator::traverseTableNames(OSQLTables& _rTables) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::traverseTableNames" ); if ( m_pParseTree == NULL ) return false; @@ -640,6 +654,7 @@ bool OSQLParseTreeIterator::traverseTableNames(OSQLTables& _rTables) //----------------------------------------------------------------------------- ::rtl::OUString OSQLParseTreeIterator::getColumnAlias(const OSQLParseNode* _pDerivedColumn) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::getColumnAlias" ); OSL_ENSURE(SQL_ISRULE(_pDerivedColumn,derived_column),"No derived column!"); ::rtl::OUString sColumnAlias; if(_pDerivedColumn->getChild(1)->count() == 2) @@ -706,6 +721,7 @@ void OSQLParseTreeIterator::getColumnRange( const OSQLParseNode* _pColumnRef, ::rtl::OUString& _rColumnName, ::rtl::OUString& _rTableRange) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::getColumnRange" ); ::rtl::OUString sDummy; lcl_getColumnRange( _pColumnRef, m_pImpl->m_xConnection, _rColumnName, _rTableRange, NULL, sDummy ); } @@ -716,6 +732,7 @@ void OSQLParseTreeIterator::getColumnRange( const OSQLParseNode* _pColumnRef, ::rtl::OUString& _rTableRange, ::rtl::OUString& _out_rColumnAliasIfPresent ) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::getColumnRange" ); lcl_getColumnRange( _pColumnRef, m_pImpl->m_xConnection, _rColumnName, _rTableRange, &*m_aSelectColumns, _out_rColumnAliasIfPresent ); } @@ -723,6 +740,7 @@ void OSQLParseTreeIterator::getColumnRange( const OSQLParseNode* _pColumnRef, void OSQLParseTreeIterator::getColumnRange( const OSQLParseNode* _pColumnRef, const Reference< XConnection >& _rxConnection, ::rtl::OUString& _out_rColumnName, ::rtl::OUString& _out_rTableRange ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::getColumnRange" ); ::rtl::OUString sDummy; lcl_getColumnRange( _pColumnRef, _rxConnection, _out_rColumnName, _out_rTableRange, NULL, sDummy ); } @@ -730,6 +748,7 @@ void OSQLParseTreeIterator::getColumnRange( const OSQLParseNode* _pColumnRef, //----------------------------------------------------------------------------- sal_Bool OSQLParseTreeIterator::getColumnTableRange(const OSQLParseNode* pNode, ::rtl::OUString &rTableRange) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::getColumnTableRange" ); // Ermitteln ob alle Spalten zu einer Tabelle gehoeren if (SQL_ISRULE(pNode,column_ref)) { @@ -785,6 +804,7 @@ sal_Bool OSQLParseTreeIterator::getColumnTableRange(const OSQLParseNode* pNode, //----------------------------------------------------------------------------- void OSQLParseTreeIterator::traverseCreateColumns(const OSQLParseNode* pSelectNode) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::traverseCreateColumns" ); // aIteratorStatus.Clear(); if (!pSelectNode || m_eStatementType != SQL_STATEMENT_CREATE_TABLE || m_pImpl->m_pTables->empty()) @@ -845,6 +865,7 @@ void OSQLParseTreeIterator::traverseCreateColumns(const OSQLParseNode* pSelectNo //----------------------------------------------------------------------------- bool OSQLParseTreeIterator::traverseSelectColumnNames(const OSQLParseNode* pSelectNode) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::traverseSelectColumnNames" ); if ( ( m_pImpl->m_nIncludeMask & SelectColumns ) != SelectColumns ) return true; @@ -969,12 +990,14 @@ bool OSQLParseTreeIterator::traverseSelectColumnNames(const OSQLParseNode* pSele //----------------------------------------------------------------------------- bool OSQLParseTreeIterator::traverseOrderByColumnNames(const OSQLParseNode* pSelectNode) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::traverseOrderByColumnNames" ); traverseByColumnNames( pSelectNode, sal_True ); return !hasErrors(); } //----------------------------------------------------------------------------- void OSQLParseTreeIterator::traverseByColumnNames(const OSQLParseNode* pSelectNode,sal_Bool _bOrder) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::traverseByColumnNames" ); // aIteratorStatus.Clear(); if (pSelectNode == NULL) @@ -1063,6 +1086,7 @@ void OSQLParseTreeIterator::traverseByColumnNames(const OSQLParseNode* pSelectNo //----------------------------------------------------------------------------- bool OSQLParseTreeIterator::traverseGroupByColumnNames(const OSQLParseNode* pSelectNode) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::traverseGroupByColumnNames" ); traverseByColumnNames( pSelectNode, sal_False ); return !hasErrors(); } @@ -1089,6 +1113,7 @@ namespace // ----------------------------------------------------------------------------- void OSQLParseTreeIterator::traverseParameters(const OSQLParseNode* _pNode) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::traverseParameters" ); if ( _pNode == NULL ) return; @@ -1142,6 +1167,7 @@ void OSQLParseTreeIterator::traverseParameters(const OSQLParseNode* _pNode) //----------------------------------------------------------------------------- bool OSQLParseTreeIterator::traverseSelectionCriteria(const OSQLParseNode* pSelectNode) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::traverseSelectionCriteria" ); if ( pSelectNode == NULL ) return false; @@ -1204,6 +1230,7 @@ bool OSQLParseTreeIterator::traverseSelectionCriteria(const OSQLParseNode* pSele //----------------------------------------------------------------------------- void OSQLParseTreeIterator::traverseORCriteria(OSQLParseNode * pSearchCondition) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::traverseORCriteria" ); if ( @@ -1253,6 +1280,7 @@ void OSQLParseTreeIterator::traverseORCriteria(OSQLParseNode * pSearchCondition) //----------------------------------------------------------------------------- void OSQLParseTreeIterator::traverseANDCriteria(OSQLParseNode * pSearchCondition) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::traverseANDCriteria" ); if ( @@ -1378,6 +1406,7 @@ void OSQLParseTreeIterator::traverseParameter(const OSQLParseNode* _pParseNode ,const ::rtl::OUString& _aTableRange ,const ::rtl::OUString& _rColumnAlias) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::traverseParameter" ); if ( !SQL_ISRULE( _pParseNode, parameter ) ) return; @@ -1488,6 +1517,7 @@ void OSQLParseTreeIterator::traverseOnePredicate( ::rtl::OUString& rValue, OSQLParseNode * pParseNode) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::traverseOnePredicate" ); if ( !pParseNode ) return; @@ -1511,18 +1541,21 @@ void OSQLParseTreeIterator::traverseOnePredicate( //----------------------------------------------------------------------------- void OSQLParseTreeIterator::traverseSome( sal_uInt32 _nIncludeMask ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::traverseSome" ); impl_traverse( _nIncludeMask ); } //----------------------------------------------------------------------------- void OSQLParseTreeIterator::traverseAll() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::traverseAll" ); impl_traverse( All ); } //----------------------------------------------------------------------------- void OSQLParseTreeIterator::impl_traverse( sal_uInt32 _nIncludeMask ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::impl_traverse" ); impl_resetErrors(); m_pImpl->m_nIncludeMask = _nIncludeMask; @@ -1565,6 +1598,7 @@ void OSQLParseTreeIterator::impl_traverse( sal_uInt32 _nIncludeMask ) OSQLTable OSQLParseTreeIterator::impl_createTableObject( const ::rtl::OUString& rTableName, const ::rtl::OUString& rCatalogName, const ::rtl::OUString& rSchemaName ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::impl_createTableObject" ); OSL_PRECOND( m_eStatementType == SQL_STATEMENT_CREATE_TABLE, "OSQLParseTreeIterator::impl_createTableObject: only to be called for CREATE TABLE statements!" ); // (in all other cases, m_pTables is to contain the table objects as obtained from the tables @@ -1584,6 +1618,7 @@ OSQLTable OSQLParseTreeIterator::impl_createTableObject( const ::rtl::OUString& //----------------------------------------------------------------------------- void OSQLParseTreeIterator::appendColumns(::vos::ORef<OSQLColumns>& _rColumns,const ::rtl::OUString& _rTableAlias,const OSQLTable& _rTable) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::appendColumns" ); if (!_rTable.is()) return; @@ -1626,6 +1661,7 @@ void OSQLParseTreeIterator::appendColumns(::vos::ORef<OSQLColumns>& _rColumns,co //----------------------------------------------------------------------------- void OSQLParseTreeIterator::setSelectColumnName(::vos::ORef<OSQLColumns>& _rColumns,const ::rtl::OUString & rColumnName,const ::rtl::OUString & rColumnAlias, const ::rtl::OUString & rTableRange,sal_Bool bFkt,sal_Int32 _nType,sal_Bool bAggFkt) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::setSelectColumnName" ); if(rColumnName.toChar() == '*' && !rTableRange.getLength()) { // SELECT * ... OSL_ENSURE(_rColumns == m_aSelectColumns,"Invalid columns used here!"); @@ -1783,6 +1819,7 @@ void OSQLParseTreeIterator::setSelectColumnName(::vos::ORef<OSQLColumns>& _rColu //----------------------------------------------------------------------------- ::rtl::OUString OSQLParseTreeIterator::getUniqueColumnName(const ::rtl::OUString & rColumnName) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::getUniqueColumnName" ); ::rtl::OUString aAlias(rColumnName); OSQLColumns::Vector::const_iterator aIter = find( @@ -1807,6 +1844,7 @@ void OSQLParseTreeIterator::setSelectColumnName(::vos::ORef<OSQLColumns>& _rColu //----------------------------------------------------------------------------- void OSQLParseTreeIterator::setOrderByColumnName(const ::rtl::OUString & rColumnName, const ::rtl::OUString & rTableRange,sal_Bool bAscending) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::setOrderByColumnName" ); Reference<XPropertySet> xColumn = findColumn( rColumnName, rTableRange, false ); if ( xColumn.is() ) m_aOrderColumns->get().push_back(new OOrderColumn(xColumn,isCaseSensitive(),bAscending)); @@ -1828,6 +1866,7 @@ void OSQLParseTreeIterator::setOrderByColumnName(const ::rtl::OUString & rColumn //----------------------------------------------------------------------------- void OSQLParseTreeIterator::setGroupByColumnName(const ::rtl::OUString & rColumnName, const ::rtl::OUString & rTableRange) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::setGroupByColumnName" ); Reference<XPropertySet> xColumn = findColumn( rColumnName, rTableRange, false ); if ( xColumn.is() ) m_aGroupColumns->get().push_back(new OParseColumn(xColumn,isCaseSensitive())); @@ -1850,6 +1889,7 @@ void OSQLParseTreeIterator::setGroupByColumnName(const ::rtl::OUString & rColumn //----------------------------------------------------------------------------- const OSQLParseNode* OSQLParseTreeIterator::getWhereTree() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::getWhereTree" ); if (!m_pParseTree) @@ -1881,6 +1921,7 @@ const OSQLParseNode* OSQLParseTreeIterator::getWhereTree() const //----------------------------------------------------------------------------- const OSQLParseNode* OSQLParseTreeIterator::getOrderTree() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::getOrderTree" ); if (!m_pParseTree || getStatementType() != SQL_STATEMENT_SELECT) @@ -1904,6 +1945,7 @@ const OSQLParseNode* OSQLParseTreeIterator::getOrderTree() const //----------------------------------------------------------------------------- const OSQLParseNode* OSQLParseTreeIterator::getGroupByTree() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::getGroupByTree" ); if (!m_pParseTree || getStatementType() != SQL_STATEMENT_SELECT) return NULL; @@ -1946,6 +1988,7 @@ const OSQLParseNode* OSQLParseTreeIterator::getHavingTree() const // ----------------------------------------------------------------------------- sal_Bool OSQLParseTreeIterator::isTableNode(const OSQLParseNode* _pTableNode) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::isTableNode" ); return _pTableNode && (SQL_ISRULE(_pTableNode,catalog_name) || SQL_ISRULE(_pTableNode,schema_name) || SQL_ISRULE(_pTableNode,table_name)); @@ -1953,24 +1996,28 @@ sal_Bool OSQLParseTreeIterator::isTableNode(const OSQLParseNode* _pTableNode) co // ----------------------------------------------------------------------------- const OSQLParseNode* OSQLParseTreeIterator::getSimpleWhereTree() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::getSimpleWhereTree" ); const OSQLParseNode* pNode = getWhereTree(); return pNode ? pNode->getChild(1) : NULL; } // ----------------------------------------------------------------------------- const OSQLParseNode* OSQLParseTreeIterator::getSimpleOrderTree() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::getSimpleOrderTree" ); const OSQLParseNode* pNode = getOrderTree(); return pNode ? pNode->getChild(2) : NULL; } // ----------------------------------------------------------------------------- const OSQLParseNode* OSQLParseTreeIterator::getSimpleGroupByTree() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::getSimpleGroupByTree" ); const OSQLParseNode* pNode = getGroupByTree(); return pNode ? pNode->getChild(2) : NULL; } // ----------------------------------------------------------------------------- const OSQLParseNode* OSQLParseTreeIterator::getSimpleHavingTree() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::getSimpleHavingTree" ); const OSQLParseNode* pNode = getHavingTree(); return pNode ? pNode->getChild(1) : NULL; } @@ -1978,6 +2025,7 @@ const OSQLParseNode* OSQLParseTreeIterator::getSimpleHavingTree() const // ----------------------------------------------------------------------------- Reference< XPropertySet > OSQLParseTreeIterator::findColumn( const ::rtl::OUString & rColumnName, const ::rtl::OUString & rTableRange, bool _bLookInSubTables ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::findColumn" ); Reference< XPropertySet > xColumn = findColumn( *m_pImpl->m_pTables, rColumnName, rTableRange ); if ( !xColumn.is() && _bLookInSubTables ) xColumn = findColumn( *m_pImpl->m_pSubTables, rColumnName, rTableRange ); @@ -1987,6 +2035,7 @@ Reference< XPropertySet > OSQLParseTreeIterator::findColumn( const ::rtl::OUStri // ----------------------------------------------------------------------------- Reference< XPropertySet > OSQLParseTreeIterator::findColumn(const OSQLTables& _rTables,const ::rtl::OUString & rColumnName, const ::rtl::OUString & rTableRange) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::findColumn" ); Reference< XPropertySet > xColumn; if ( rTableRange.getLength() ) { @@ -2020,6 +2069,7 @@ Reference< XPropertySet > OSQLParseTreeIterator::findColumn(const OSQLTables& _r // ----------------------------------------------------------------------------- void OSQLParseTreeIterator::impl_appendError( IParseContext::ErrorCode _eError, const ::rtl::OUString* _pReplaceToken1, const ::rtl::OUString* _pReplaceToken2 ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::impl_appendError" ); ::rtl::OUString sErrorMessage = m_rParser.getContext().getErrorMessage( _eError ); if ( _pReplaceToken1 ) { @@ -2039,6 +2089,7 @@ void OSQLParseTreeIterator::impl_appendError( IParseContext::ErrorCode _eError, // ----------------------------------------------------------------------------- void OSQLParseTreeIterator::impl_appendError( const SQLException& _rError ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::impl_appendError" ); if ( m_aErrors.Message.getLength() ) { SQLException* pErrorChain = &m_aErrors; diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx index aa3a2ead1f40..4f8517d41703 100644 --- a/connectivity/source/parse/sqlnode.cxx +++ b/connectivity/source/parse/sqlnode.cxx @@ -75,6 +75,7 @@ #include <boost/bind.hpp> #include <algorithm> #include <functional> +#include <rtl/logfile.hxx> using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::util; @@ -198,6 +199,7 @@ SQLParseNodeParameter::~SQLParseNodeParameter() //----------------------------------------------------------------------------- ::rtl::OUString OSQLParseNode::convertDateString(const SQLParseNodeParameter& rParam, const ::rtl::OUString& rString) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::convertDateString" ); Date aDate = DBTypeConversion::toDate(rString); Reference< XNumberFormatsSupplier > xSupplier(rParam.xFormatter->getNumberFormatsSupplier()); Reference< XNumberFormatTypes > xTypes(xSupplier->getNumberFormats(), UNO_QUERY); @@ -210,6 +212,7 @@ SQLParseNodeParameter::~SQLParseNodeParameter() //----------------------------------------------------------------------------- ::rtl::OUString OSQLParseNode::convertDateTimeString(const SQLParseNodeParameter& rParam, const ::rtl::OUString& rString) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::convertDateTimeString" ); DateTime aDate = DBTypeConversion::toDateTime(rString); Reference< XNumberFormatsSupplier > xSupplier(rParam.xFormatter->getNumberFormatsSupplier()); Reference< XNumberFormatTypes > xTypes(xSupplier->getNumberFormats(), UNO_QUERY); @@ -222,6 +225,7 @@ SQLParseNodeParameter::~SQLParseNodeParameter() //----------------------------------------------------------------------------- ::rtl::OUString OSQLParseNode::convertTimeString(const SQLParseNodeParameter& rParam, const ::rtl::OUString& rString) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::convertTimeString" ); Time aTime = DBTypeConversion::toTime(rString); Reference< XNumberFormatsSupplier > xSupplier(rParam.xFormatter->getNumberFormatsSupplier()); @@ -239,6 +243,7 @@ void OSQLParseNode::parseNodeToStr(::rtl::OUString& rString, sal_Bool _bIntl, sal_Bool _bQuote) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::parseNodeToStr" ); parseNodeToStr( rString, _rxConnection, NULL, NULL, @@ -254,6 +259,7 @@ void OSQLParseNode::parseNodeToPredicateStr(::rtl::OUString& rString, sal_Char _cDec, const IParseContext* pContext ) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::parseNodeToPredicateStr" ); OSL_ENSURE(xFormatter.is(), "OSQLParseNode::parseNodeToPredicateStr:: no formatter!"); @@ -270,6 +276,7 @@ void OSQLParseNode::parseNodeToPredicateStr(::rtl::OUString& rString, sal_Char _cDec, const IParseContext* pContext ) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::parseNodeToPredicateStr" ); OSL_ENSURE(xFormatter.is(), "OSQLParseNode::parseNodeToPredicateStr:: no formatter!"); @@ -290,6 +297,7 @@ void OSQLParseNode::parseNodeToStr(::rtl::OUString& rString, bool _bPredicate, bool _bSubstitute) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::parseNodeToStr" ); OSL_ENSURE( _rxConnection.is(), "OSQLParseNode::parseNodeToStr: invalid connection!" ); @@ -317,6 +325,7 @@ void OSQLParseNode::parseNodeToStr(::rtl::OUString& rString, bool OSQLParseNode::parseNodeToExecutableStatement( ::rtl::OUString& _out_rString, const Reference< XConnection >& _rxConnection, OSQLParser& _rParser, ::com::sun::star::sdbc::SQLException* _pErrorHolder ) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::parseNodeToExecutableStatement" ); OSL_PRECOND( _rxConnection.is(), "OSQLParseNode::parseNodeToExecutableStatement: invalid connection!" ); SQLParseNodeParameter aParseParam( _rxConnection, NULL, NULL, OParseContext::getDefaultLocale(), NULL, false, true, '.', false, true ); @@ -358,6 +367,7 @@ namespace //----------------------------------------------------------------------------- void OSQLParseNode::impl_parseNodeToString_throw(::rtl::OUString& rString, const SQLParseNodeParameter& rParam) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::getTableRange" ); if ( isToken() ) { parseLeaf(rString,rParam); @@ -555,6 +565,7 @@ void OSQLParseNode::impl_parseNodeToString_throw(::rtl::OUString& rString, const //----------------------------------------------------------------------------- bool OSQLParseNode::impl_parseTableNameNodeToString_throw( ::rtl::OUString& rString, const SQLParseNodeParameter& rParam ) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::impl_parseTableNameNodeToString_throw" ); // is the table_name part of a table_ref? OSL_ENSURE( getParent(), "OSQLParseNode::impl_parseTableNameNodeToString_throw: table_name without parent?" ); if ( !getParent() || ( getParent()->getKnownRuleID() != table_ref ) ) @@ -653,6 +664,7 @@ bool OSQLParseNode::impl_parseTableNameNodeToString_throw( ::rtl::OUString& rStr //----------------------------------------------------------------------------- void OSQLParseNode::impl_parseTableRangeNodeToString_throw(::rtl::OUString& rString, const SQLParseNodeParameter& rParam) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::impl_parseTableRangeNodeToString_throw" ); OSL_PRECOND( ( count() == 2 ) || ( count() == 3 ) || ( count() == 5 ) ,"Illegal count"); // rString += ::rtl::OUString::createFromAscii(" "); @@ -663,6 +675,7 @@ void OSQLParseNode::impl_parseTableRangeNodeToString_throw(::rtl::OUString& rStr //----------------------------------------------------------------------------- void OSQLParseNode::impl_parseLikeNodeToString_throw( ::rtl::OUString& rString, const SQLParseNodeParameter& rParam ) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::impl_parseLikeNodeToString_throw" ); OSL_ENSURE(count() >= 4,"count != 5: Prepare for GPF"); const OSQLParseNode* pEscNode = NULL; @@ -727,6 +740,7 @@ sal_Bool OSQLParseNode::getTableComponents(const OSQLParseNode* _pTableNode, ::rtl::OUString &_rSchema, ::rtl::OUString &_rTable) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::getTableComponents" ); OSL_ENSURE(_pTableNode,"Wrong use of getTableComponents! _pTableNode is not allowed to be null!"); if(_pTableNode) { @@ -1447,6 +1461,7 @@ OSQLParser::~OSQLParser() // ----------------------------------------------------------------------------- void OSQLParseNode::substituteParameterNames(OSQLParseNode* _pNode) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::substituteParameterNames" ); sal_Int32 nCount = _pNode->count(); for(sal_Int32 i=0;i < nCount;++i) { @@ -1541,6 +1556,7 @@ OSQLParseNode::OSQLParseNode(const sal_Char * pNewValue, ,m_eNodeType(eNewNodeType) ,m_nNodeID(nNewNodeID) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::OSQLParseNode" ); OSL_ENSURE(m_eNodeType >= SQL_NODE_RULE && m_eNodeType <= SQL_NODE_CONCAT,"OSQLParseNode: mit unzulaessigem NodeType konstruiert"); } @@ -1553,6 +1569,7 @@ OSQLParseNode::OSQLParseNode(const ::rtl::OString &_rNewValue, ,m_eNodeType(eNewNodeType) ,m_nNodeID(nNewNodeID) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::OSQLParseNode" ); OSL_ENSURE(m_eNodeType >= SQL_NODE_RULE && m_eNodeType <= SQL_NODE_CONCAT,"OSQLParseNode: mit unzulaessigem NodeType konstruiert"); } @@ -1565,6 +1582,7 @@ OSQLParseNode::OSQLParseNode(const sal_Unicode * pNewValue, ,m_eNodeType(eNewNodeType) ,m_nNodeID(nNewNodeID) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::OSQLParseNode" ); OSL_ENSURE(m_eNodeType >= SQL_NODE_RULE && m_eNodeType <= SQL_NODE_CONCAT,"OSQLParseNode: mit unzulaessigem NodeType konstruiert"); } @@ -1577,12 +1595,14 @@ OSQLParseNode::OSQLParseNode(const ::rtl::OUString &_rNewValue, ,m_eNodeType(eNewNodeType) ,m_nNodeID(nNewNodeID) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::OSQLParseNode" ); OSL_ENSURE(m_eNodeType >= SQL_NODE_RULE && m_eNodeType <= SQL_NODE_CONCAT,"OSQLParseNode: mit unzulaessigem NodeType konstruiert"); } //----------------------------------------------------------------------------- OSQLParseNode::OSQLParseNode(const OSQLParseNode& rParseNode) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::OSQLParseNode" ); // klemm den getParent auf NULL m_pParent = NULL; @@ -1659,6 +1679,7 @@ OSQLParseNode::~OSQLParseNode() //----------------------------------------------------------------------------- void OSQLParseNode::append(OSQLParseNode* pNewNode) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::append" ); OSL_ENSURE(pNewNode != NULL, "OSQLParseNode: ungueltiger NewSubTree"); OSL_ENSURE(pNewNode->getParent() == NULL, "OSQLParseNode: Knoten ist kein Waise"); @@ -1673,6 +1694,7 @@ void OSQLParseNode::append(OSQLParseNode* pNewNode) // ----------------------------------------------------------------------------- sal_Bool OSQLParseNode::addDateValue(::rtl::OUString& rString, const SQLParseNodeParameter& rParam) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::addDateValue" ); // special display for date/time values if (SQL_ISRULE(this,set_fct_spec) && SQL_ISPUNCTUATION(m_aChilds[0],"{")) { @@ -1734,6 +1756,7 @@ sal_Bool OSQLParseNode::addDateValue(::rtl::OUString& rString, const SQLParseNod // ----------------------------------------------------------------------------- void OSQLParseNode::replaceNodeValue(const ::rtl::OUString& rTableAlias,const ::rtl::OUString& rColumnName) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::replaceNodeValue" ); for (sal_uInt32 i=0;i<count();++i) { if (SQL_ISRULE(this,column_ref) && count() == 1 && getChild(0)->getTokenValue() == rColumnName) @@ -1750,6 +1773,7 @@ void OSQLParseNode::replaceNodeValue(const ::rtl::OUString& rTableAlias,const :: //----------------------------------------------------------------------------- OSQLParseNode* OSQLParseNode::getByRule(OSQLParseNode::Rule eRule) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::getByRule" ); OSQLParseNode* pRetNode = 0; if (isRule() && OSQLParser::RuleID(eRule) == getRuleID()) pRetNode = (OSQLParseNode*)this; @@ -1782,6 +1806,7 @@ OSQLParseNode* MakeORNode(OSQLParseNode *pLeftLeaf,OSQLParseNode *pRightLeaf) //----------------------------------------------------------------------------- void OSQLParseNode::disjunctiveNormalForm(OSQLParseNode*& pSearchCondition) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::disjunctiveNormalForm" ); if(!pSearchCondition) // no where condition at entry point return; @@ -1858,6 +1883,7 @@ void OSQLParseNode::disjunctiveNormalForm(OSQLParseNode*& pSearchCondition) //----------------------------------------------------------------------------- void OSQLParseNode::negateSearchCondition(OSQLParseNode*& pSearchCondition,sal_Bool bNegate) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::negateSearchCondition" ); if(!pSearchCondition) // no where condition at entry point return; // '(' search_condition ')' @@ -1993,6 +2019,7 @@ void OSQLParseNode::negateSearchCondition(OSQLParseNode*& pSearchCondition,sal_B //----------------------------------------------------------------------------- void OSQLParseNode::eraseBraces(OSQLParseNode*& pSearchCondition) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::eraseBraces" ); if (pSearchCondition && (SQL_ISRULE(pSearchCondition,boolean_primary) || (pSearchCondition->count() == 3 && SQL_ISPUNCTUATION(pSearchCondition->getChild(0),"(") && SQL_ISPUNCTUATION(pSearchCondition->getChild(2),")")))) { @@ -2011,6 +2038,7 @@ void OSQLParseNode::eraseBraces(OSQLParseNode*& pSearchCondition) //----------------------------------------------------------------------------- void OSQLParseNode::absorptions(OSQLParseNode*& pSearchCondition) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::absorptions" ); if(!pSearchCondition) // no where condition at entry point return; @@ -2108,6 +2136,7 @@ void OSQLParseNode::absorptions(OSQLParseNode*& pSearchCondition) //----------------------------------------------------------------------------- void OSQLParseNode::compress(OSQLParseNode *&pSearchCondition) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::compress" ); if(!pSearchCondition) // no where condition at entry point return; @@ -2213,6 +2242,7 @@ void OSQLParseNode::compress(OSQLParseNode *&pSearchCondition) // ----------------------------------------------------------------------------- void OSQLParseNode::showParseTree(::rtl::OUString& rString, sal_uInt32 nLevel) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::showParseTree" ); if (!isToken()) { @@ -2300,6 +2330,7 @@ void OSQLParseNode::showParseTree(::rtl::OUString& rString, sal_uInt32 nLevel) //----------------------------------------------------------------------------- void OSQLParseNode::insert(sal_uInt32 nPos, OSQLParseNode* pNewSubTree) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::insert" ); OSL_ENSURE(pNewSubTree != NULL, "OSQLParseNode: ungueltiger NewSubTree"); OSL_ENSURE(pNewSubTree->getParent() == NULL, "OSQLParseNode: Knoten ist kein Waise"); @@ -2312,6 +2343,7 @@ void OSQLParseNode::insert(sal_uInt32 nPos, OSQLParseNode* pNewSubTree) //----------------------------------------------------------------------------- OSQLParseNode* OSQLParseNode::removeAt(sal_uInt32 nPos) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::removeAt" ); OSL_ENSURE(nPos < m_aChilds.size(),"Illegal position for removeAt"); OSQLParseNodes::iterator aPos(m_aChilds.begin() + nPos); OSQLParseNode* pNode = *aPos; @@ -2325,6 +2357,7 @@ OSQLParseNode* OSQLParseNode::removeAt(sal_uInt32 nPos) //----------------------------------------------------------------------------- OSQLParseNode* OSQLParseNode::remove(OSQLParseNode* pSubTree) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::remove" ); OSL_ENSURE(pSubTree != NULL, "OSQLParseNode: ungueltiger SubTree"); OSQLParseNodes::iterator aPos = ::std::find(m_aChilds.begin(), m_aChilds.end(), pSubTree); if (aPos != m_aChilds.end()) @@ -2342,6 +2375,7 @@ OSQLParseNode* OSQLParseNode::remove(OSQLParseNode* pSubTree) //----------------------------------------------------------------------------- OSQLParseNode* OSQLParseNode::replaceAt(sal_uInt32 nPos, OSQLParseNode* pNewSubNode) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::replaceAt" ); OSL_ENSURE(pNewSubNode != NULL, "OSQLParseNode: invalid nodes"); OSL_ENSURE(pNewSubNode->getParent() == NULL, "OSQLParseNode: node already has getParent"); OSL_ENSURE(nPos < m_aChilds.size(), "OSQLParseNode: invalid position"); @@ -2361,6 +2395,7 @@ OSQLParseNode* OSQLParseNode::replaceAt(sal_uInt32 nPos, OSQLParseNode* pNewSubN //----------------------------------------------------------------------------- OSQLParseNode* OSQLParseNode::replace (OSQLParseNode* pOldSubNode, OSQLParseNode* pNewSubNode ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::replace " ); OSL_ENSURE(pOldSubNode != NULL && pNewSubNode != NULL, "OSQLParseNode: invalid nodes"); OSL_ENSURE(pNewSubNode->getParent() == NULL, "OSQLParseNode: node already has getParent"); OSL_ENSURE(::std::find(m_aChilds.begin(), m_aChilds.end(), pOldSubNode) != m_aChilds.end(), @@ -2376,6 +2411,7 @@ OSQLParseNode* OSQLParseNode::replace (OSQLParseNode* pOldSubNode, OSQLParseNode // ----------------------------------------------------------------------------- void OSQLParseNode::parseLeaf(::rtl::OUString & rString, const SQLParseNodeParameter& rParam) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::parseLeaf" ); // ein Blatt ist gefunden // Inhalt dem Ausgabestring anfuegen switch (m_eNodeType) @@ -2568,6 +2604,7 @@ OSQLParseNode::Rule OSQLParseNode::getKnownRuleID() const // ----------------------------------------------------------------------------- ::rtl::OUString OSQLParseNode::getTableRange(const OSQLParseNode* _pTableRef) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::getTableRange" ); OSL_ENSURE(_pTableRef && _pTableRef->count() > 1 && _pTableRef->getKnownRuleID() == OSQLParseNode::table_ref,"Invalid node give, only table ref is allowed!"); const sal_uInt32 nCount = _pTableRef->count(); ::rtl::OUString sTableRange; |