diff options
Diffstat (limited to 'connectivity/source')
24 files changed, 762 insertions, 214 deletions
diff --git a/connectivity/source/cpool/ZConnectionPool.cxx b/connectivity/source/cpool/ZConnectionPool.cxx index d4521f78391e..243d72ab8122 100644 --- a/connectivity/source/cpool/ZConnectionPool.cxx +++ b/connectivity/source/cpool/ZConnectionPool.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ZConnectionPool.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: oj $ $Date: 2001-04-26 10:33:42 $ + * last change: $Author: oj $ $Date: 2001-05-17 09:13:25 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -197,14 +197,13 @@ Reference< XConnection > SAL_CALL OConnectionPool::getConnectionWithInfo( const //-------------------------------------------------------------------------- sal_Bool SAL_CALL OConnectionPool::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException) { - MutexGuard aGuard(m_aMutex); Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); const ::rtl::OUString* pSupported = aSupported.getConstArray(); - for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported) - if (pSupported->equals(_rServiceName)) - return sal_True; + const ::rtl::OUString* pEnd = pSupported + aSupported.getLength(); + for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported) + ; - return sal_False; + return pSupported != pEnd; } //-------------------------------------------------------------------------- diff --git a/connectivity/source/cpool/ZConnectionWrapper.cxx b/connectivity/source/cpool/ZConnectionWrapper.cxx index eb1114da1a09..d959786332b2 100644 --- a/connectivity/source/cpool/ZConnectionWrapper.cxx +++ b/connectivity/source/cpool/ZConnectionWrapper.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ZConnectionWrapper.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: oj $ $Date: 2001-04-27 10:08:06 $ + * last change: $Author: oj $ $Date: 2001-05-17 09:13:25 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -102,8 +102,8 @@ IMPLEMENT_SERVICE_INFO(OConnectionWrapper, "com.sun.star.sdbc.drivers.OConnectio Reference< XStatement > SAL_CALL OConnectionWrapper::createStatement( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OConnection_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + return m_xConnection->createStatement(); } @@ -111,8 +111,8 @@ Reference< XStatement > SAL_CALL OConnectionWrapper::createStatement( ) throw(S Reference< XPreparedStatement > SAL_CALL OConnectionWrapper::prepareStatement( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OConnection_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + return m_xConnection->prepareStatement(sql); } @@ -120,8 +120,8 @@ Reference< XPreparedStatement > SAL_CALL OConnectionWrapper::prepareStatement( c Reference< XPreparedStatement > SAL_CALL OConnectionWrapper::prepareCall( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OConnection_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + return m_xConnection->prepareCall(sql); } @@ -129,8 +129,8 @@ Reference< XPreparedStatement > SAL_CALL OConnectionWrapper::prepareCall( const ::rtl::OUString SAL_CALL OConnectionWrapper::nativeSQL( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OConnection_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + return m_xConnection->nativeSQL(sql); } @@ -138,16 +138,16 @@ Reference< XPreparedStatement > SAL_CALL OConnectionWrapper::prepareCall( const void SAL_CALL OConnectionWrapper::setAutoCommit( sal_Bool autoCommit ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OConnection_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + m_xConnection->setAutoCommit(autoCommit); } // -------------------------------------------------------------------------------- sal_Bool SAL_CALL OConnectionWrapper::getAutoCommit( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OConnection_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + return m_xConnection->getAutoCommit(); } @@ -155,8 +155,8 @@ sal_Bool SAL_CALL OConnectionWrapper::getAutoCommit( ) throw(SQLException, Runt void SAL_CALL OConnectionWrapper::commit( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OConnection_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + m_xConnection->commit(); } @@ -164,8 +164,8 @@ void SAL_CALL OConnectionWrapper::commit( ) throw(SQLException, RuntimeExceptio void SAL_CALL OConnectionWrapper::rollback( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OConnection_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + m_xConnection->rollback(); } @@ -180,8 +180,8 @@ sal_Bool SAL_CALL OConnectionWrapper::isClosed( ) throw(SQLException, RuntimeEx Reference< XDatabaseMetaData > SAL_CALL OConnectionWrapper::getMetaData( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OConnection_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + return m_xConnection->getMetaData(); } @@ -189,8 +189,8 @@ Reference< XDatabaseMetaData > SAL_CALL OConnectionWrapper::getMetaData( ) thro void SAL_CALL OConnectionWrapper::setReadOnly( sal_Bool readOnly ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OConnection_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + m_xConnection->setReadOnly(readOnly); } @@ -198,8 +198,8 @@ void SAL_CALL OConnectionWrapper::setReadOnly( sal_Bool readOnly ) throw(SQLExce sal_Bool SAL_CALL OConnectionWrapper::isReadOnly( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OConnection_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + return m_xConnection->isReadOnly(); } @@ -207,8 +207,8 @@ sal_Bool SAL_CALL OConnectionWrapper::isReadOnly( ) throw(SQLException, Runtime void SAL_CALL OConnectionWrapper::setCatalog( const ::rtl::OUString& catalog ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OConnection_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + m_xConnection->setCatalog(catalog); } @@ -216,8 +216,8 @@ void SAL_CALL OConnectionWrapper::setCatalog( const ::rtl::OUString& catalog ) t ::rtl::OUString SAL_CALL OConnectionWrapper::getCatalog( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OConnection_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + return m_xConnection->getCatalog(); } @@ -225,8 +225,8 @@ void SAL_CALL OConnectionWrapper::setCatalog( const ::rtl::OUString& catalog ) t void SAL_CALL OConnectionWrapper::setTransactionIsolation( sal_Int32 level ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OConnection_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + m_xConnection->setTransactionIsolation(level); } @@ -234,8 +234,8 @@ void SAL_CALL OConnectionWrapper::setTransactionIsolation( sal_Int32 level ) thr sal_Int32 SAL_CALL OConnectionWrapper::getTransactionIsolation( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OConnection_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + return m_xConnection->getTransactionIsolation(); } @@ -243,8 +243,8 @@ sal_Int32 SAL_CALL OConnectionWrapper::getTransactionIsolation( ) throw(SQLExce Reference< ::com::sun::star::container::XNameAccess > SAL_CALL OConnectionWrapper::getTypeMap( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OConnection_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + return m_xConnection->getTypeMap(); } @@ -252,8 +252,8 @@ Reference< ::com::sun::star::container::XNameAccess > SAL_CALL OConnectionWrappe void SAL_CALL OConnectionWrapper::setTypeMap( const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OConnection_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + m_xConnection->setTypeMap(typeMap); } @@ -263,8 +263,8 @@ void SAL_CALL OConnectionWrapper::close( ) throw(SQLException, RuntimeException { { ::osl::MutexGuard aGuard( m_aMutex ); - if (OConnection_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + } dispose(); } @@ -273,8 +273,8 @@ void SAL_CALL OConnectionWrapper::close( ) throw(SQLException, RuntimeException Any SAL_CALL OConnectionWrapper::getWarnings( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OConnection_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + Reference<XWarningsSupplier> xWarning(m_xConnection,UNO_QUERY); return xWarning.is() ? xWarning->getWarnings() : Any(); @@ -283,8 +283,8 @@ Any SAL_CALL OConnectionWrapper::getWarnings( ) throw(SQLException, RuntimeExce void SAL_CALL OConnectionWrapper::clearWarnings( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OConnection_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + Reference<XWarningsSupplier> xWarning(m_xConnection,UNO_QUERY); if(xWarning.is()) diff --git a/connectivity/source/cpool/makefile.mk b/connectivity/source/cpool/makefile.mk index 3e3692731aec..7c99fb548372 100644 --- a/connectivity/source/cpool/makefile.mk +++ b/connectivity/source/cpool/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.1 $ +# $Revision: 1.2 $ # -# last change: $Author: oj $ $Date: 2001-04-26 09:12:05 $ +# last change: $Author: oj $ $Date: 2001-05-17 09:13:25 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -99,6 +99,7 @@ SHL1STDLIBS=\ $(VOSLIB) \ $(OSLLIB) \ $(COMPHELPERLIB) \ + $(DBTOOLSLIB) \ $(SALLIB) SHL1DEPN= diff --git a/connectivity/source/drivers/adabas/BDriver.cxx b/connectivity/source/drivers/adabas/BDriver.cxx index d8bb62b47952..b9f894f799f6 100644 --- a/connectivity/source/drivers/adabas/BDriver.cxx +++ b/connectivity/source/drivers/adabas/BDriver.cxx @@ -2,9 +2,9 @@ * * $RCSfile: BDriver.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: oj $ $Date: 2001-05-15 08:18:12 $ + * last change: $Author: oj $ $Date: 2001-05-17 09:13:24 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -189,11 +189,11 @@ sal_Bool SAL_CALL ODriver::supportsService( const ::rtl::OUString& _rServiceName { Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); const ::rtl::OUString* pSupported = aSupported.getConstArray(); - for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported) - if (pSupported->equals(_rServiceName)) - return sal_True; + const ::rtl::OUString* pEnd = pSupported + aSupported.getLength(); + for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported) + ; - return sal_False; + return pSupported != pEnd; } //------------------------------------------------------------------ Sequence< ::rtl::OUString > SAL_CALL ODriver::getSupportedServiceNames( ) throw(RuntimeException) diff --git a/connectivity/source/drivers/ado/AConnection.cxx b/connectivity/source/drivers/ado/AConnection.cxx index 9f7493c6423c..5832269f041b 100644 --- a/connectivity/source/drivers/ado/AConnection.cxx +++ b/connectivity/source/drivers/ado/AConnection.cxx @@ -2,9 +2,9 @@ * * $RCSfile: AConnection.cxx,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: oj $ $Date: 2001-05-17 07:26:59 $ + * last change: $Author: oj $ $Date: 2001-05-17 09:13:23 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -99,6 +99,9 @@ #ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ #include <cppuhelper/typeprovider.hxx> #endif +#ifndef _DBHELPER_DBEXCEPTION_HXX_ +#include "connectivity/dbexception.hxx" +#endif using namespace dbtools; using namespace connectivity::ado; @@ -194,7 +197,7 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV else ADOS::ThrowException(*m_pAdoConnection,*this); if(m_pAdoConnection->get_State() != adStateOpen) - throw SQLException(); + ::dbtools::throwFunctionSequenceException(*this); ADOProperties* pProps=m_pAdoConnection->get_Properties(); if(pProps) @@ -214,7 +217,7 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV //bErg = TRUE; } else - throw SQLException(); + ::dbtools::throwFunctionSequenceException(*this); osl_decrementInterlockedCount( &m_refCount ); } diff --git a/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx index 6e0b89270ea0..5682feae54da 100644 --- a/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx +++ b/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ADatabaseMetaDataResultSet.cxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: oj $ $Date: 2001-05-17 07:30:42 $ + * last change: $Author: oj $ $Date: 2001-05-17 09:13:23 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -108,7 +108,7 @@ #include <oledb.h> - +using namespace dbtools; using namespace connectivity::ado; using namespace cppu; using namespace ::comphelper; @@ -188,7 +188,12 @@ sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::findColumn( const ::rtl::OUString sal_Int32 nLen = xMeta->getColumnCount(); sal_Int32 i = 1; for(;i<=nLen;++i) - if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) : columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i))) + if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) : +#if SUPD > 630 + columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i))) +#else + columnName.equalsIgnoreCase(xMeta->getColumnName(i))) +#endif break; return i; } @@ -200,7 +205,7 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL ODatabaseMetaDataResult checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); if(!m_pRecordSet) - throw SQLException(); + throwFunctionSequenceException(*this); columnIndex = mapColumn(columnIndex); ADO_GETFIELD(columnIndex); @@ -243,7 +248,7 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL ODatabaseMetaDataResult checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); if(!m_pRecordSet) - throw SQLException(); + throwFunctionSequenceException(*this); columnIndex = mapColumn(columnIndex); return NULL; @@ -256,7 +261,7 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::getBoolean( sal_Int32 columnIndex checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); if(!m_pRecordSet) - throw SQLException(); + throwFunctionSequenceException(*this); columnIndex = mapColumn(columnIndex); ADO_GETFIELD(columnIndex); @@ -273,7 +278,7 @@ sal_Int8 SAL_CALL ODatabaseMetaDataResultSet::getByte( sal_Int32 columnIndex ) t checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); if(!m_pRecordSet) - throw SQLException(); + throwFunctionSequenceException(*this); columnIndex = mapColumn(columnIndex); ADO_GETFIELD(columnIndex); @@ -295,7 +300,7 @@ Sequence< sal_Int8 > SAL_CALL ODatabaseMetaDataResultSet::getBytes( sal_Int32 co checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); if(!m_pRecordSet) - throw SQLException(); + throwFunctionSequenceException(*this); columnIndex = mapColumn(columnIndex); ADO_GETFIELD(columnIndex); @@ -312,7 +317,7 @@ Sequence< sal_Int8 > SAL_CALL ODatabaseMetaDataResultSet::getBytes( sal_Int32 co checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); if(!m_pRecordSet) - throw SQLException(); + throwFunctionSequenceException(*this); columnIndex = mapColumn(columnIndex); ADO_GETFIELD(columnIndex); @@ -329,7 +334,7 @@ double SAL_CALL ODatabaseMetaDataResultSet::getDouble( sal_Int32 columnIndex ) t checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); if(!m_pRecordSet) - throw SQLException(); + throwFunctionSequenceException(*this); columnIndex = mapColumn(columnIndex); ADO_GETFIELD(columnIndex); @@ -346,7 +351,7 @@ float SAL_CALL ODatabaseMetaDataResultSet::getFloat( sal_Int32 columnIndex ) thr checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); if(!m_pRecordSet) - throw SQLException(); + throwFunctionSequenceException(*this); columnIndex = mapColumn(columnIndex); ADO_GETFIELD(columnIndex); @@ -363,7 +368,7 @@ sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::getInt( sal_Int32 columnIndex ) t checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); if(!m_pRecordSet) - throw SQLException(); + throwFunctionSequenceException(*this); columnIndex = mapColumn(columnIndex); ADO_GETFIELD(columnIndex); @@ -386,7 +391,7 @@ sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::getRow( ) throw(SQLException, Ru checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); if(!m_pRecordSet) - throw SQLException(); + throwFunctionSequenceException(*this); return 0; } @@ -398,7 +403,7 @@ sal_Int64 SAL_CALL ODatabaseMetaDataResultSet::getLong( sal_Int32 columnIndex ) checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); if(!m_pRecordSet) - throw SQLException(); + throwFunctionSequenceException(*this); columnIndex = mapColumn(columnIndex); ADO_GETFIELD(columnIndex); @@ -412,7 +417,7 @@ Reference< XResultSetMetaData > SAL_CALL ODatabaseMetaDataResultSet::getMetaData checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); if(!m_pRecordSet) - throw SQLException(); + throwFunctionSequenceException(*this); if(!m_xMetaData.is()) m_xMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this); @@ -426,7 +431,7 @@ Reference< XArray > SAL_CALL ODatabaseMetaDataResultSet::getArray( sal_Int32 col checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); if(!m_pRecordSet) - throw SQLException(); + throwFunctionSequenceException(*this); columnIndex = mapColumn(columnIndex); return NULL; @@ -440,7 +445,7 @@ Reference< XClob > SAL_CALL ODatabaseMetaDataResultSet::getClob( sal_Int32 colum checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); if(!m_pRecordSet) - throw SQLException(); + throwFunctionSequenceException(*this); columnIndex = mapColumn(columnIndex); return NULL; @@ -452,7 +457,7 @@ Reference< XBlob > SAL_CALL ODatabaseMetaDataResultSet::getBlob( sal_Int32 colum checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); if(!m_pRecordSet) - throw SQLException(); + throwFunctionSequenceException(*this); columnIndex = mapColumn(columnIndex); return NULL; @@ -465,7 +470,7 @@ Reference< XRef > SAL_CALL ODatabaseMetaDataResultSet::getRef( sal_Int32 columnI checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); if(!m_pRecordSet) - throw SQLException(); + throwFunctionSequenceException(*this); columnIndex = mapColumn(columnIndex); return NULL; @@ -478,7 +483,7 @@ Any SAL_CALL ODatabaseMetaDataResultSet::getObject( sal_Int32 columnIndex, const checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); if(!m_pRecordSet) - throw SQLException(); + throwFunctionSequenceException(*this); columnIndex = mapColumn(columnIndex); return Any(); @@ -491,7 +496,7 @@ sal_Int16 SAL_CALL ODatabaseMetaDataResultSet::getShort( sal_Int32 columnIndex ) checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); if(!m_pRecordSet) - throw SQLException(); + throwFunctionSequenceException(*this); columnIndex = mapColumn(columnIndex); ADO_GETFIELD(columnIndex); @@ -514,7 +519,7 @@ sal_Int16 SAL_CALL ODatabaseMetaDataResultSet::getShort( sal_Int32 columnIndex ) checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); if(!m_pRecordSet) - throw SQLException(); + throwFunctionSequenceException(*this); columnIndex = mapColumn(columnIndex); ADO_GETFIELD(columnIndex); @@ -536,7 +541,7 @@ sal_Int16 SAL_CALL ODatabaseMetaDataResultSet::getShort( sal_Int32 columnIndex ) checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); if(!m_pRecordSet) - throw SQLException(); + throwFunctionSequenceException(*this); columnIndex = mapColumn(columnIndex); ADO_GETFIELD(columnIndex); @@ -554,7 +559,7 @@ sal_Int16 SAL_CALL ODatabaseMetaDataResultSet::getShort( sal_Int32 columnIndex ) checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); if(!m_pRecordSet) - throw SQLException(); + throwFunctionSequenceException(*this); columnIndex = mapColumn(columnIndex); ADO_GETFIELD(columnIndex); @@ -571,7 +576,7 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isAfterLast( ) throw(SQLException checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); if(!m_pRecordSet) - throw SQLException(); + throwFunctionSequenceException(*this); VARIANT_BOOL bIsAtEOF; m_pRecordSet->get_EOF(&bIsAtEOF); @@ -584,7 +589,7 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isFirst( ) throw(SQLException, Ru checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); if(!m_pRecordSet) - throw SQLException(); + throwFunctionSequenceException(*this); return m_nRowPos == 1; } @@ -595,7 +600,7 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isLast( ) throw(SQLException, Run checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); if(!m_pRecordSet) - throw SQLException(); + throwFunctionSequenceException(*this); return sal_True; } @@ -606,7 +611,7 @@ void SAL_CALL ODatabaseMetaDataResultSet::beforeFirst( ) throw(SQLException, Ru checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); if(!m_pRecordSet) - throw SQLException(); + throwFunctionSequenceException(*this); if(first()) previous(); @@ -618,7 +623,7 @@ void SAL_CALL ODatabaseMetaDataResultSet::afterLast( ) throw(SQLException, Runt checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); if(!m_pRecordSet) - throw SQLException(); + throwFunctionSequenceException(*this); if(last()) next(); @@ -724,7 +729,7 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::rowDeleted( ) throw(SQLException, checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); if(!m_pRecordSet) - throw SQLException(); + throwFunctionSequenceException(*this); RecordStatusEnum eRec; m_pRecordSet->get_Status((sal_Int32*)&eRec); @@ -736,7 +741,7 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::rowInserted( ) throw(SQLException checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); if(!m_pRecordSet) - throw SQLException(); + throwFunctionSequenceException(*this); RecordStatusEnum eRec; m_pRecordSet->get_Status((sal_Int32*)&eRec); @@ -749,7 +754,7 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::rowUpdated( ) throw(SQLException, checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); if(!m_pRecordSet) - throw SQLException(); + throwFunctionSequenceException(*this); RecordStatusEnum eRec; m_pRecordSet->get_Status((sal_Int32*)&eRec); @@ -797,7 +802,7 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::wasNull( ) throw(SQLException, Ru checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); if(!m_pRecordSet) - throw SQLException(); + throwFunctionSequenceException(*this); return m_aValue.isNull(); } @@ -808,7 +813,7 @@ void SAL_CALL ODatabaseMetaDataResultSet::refreshRow( ) throw(SQLException, Run checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); if(!m_pRecordSet) - throw SQLException(); + throwFunctionSequenceException(*this); m_pRecordSet->Resync(adAffectCurrent,adResyncAllValues); } @@ -820,7 +825,7 @@ void SAL_CALL ODatabaseMetaDataResultSet::cancel( ) throw(RuntimeException) checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); if(!m_pRecordSet) - throw SQLException(); + throwFunctionSequenceException(*this); m_pRecordSet->Cancel(); } diff --git a/connectivity/source/drivers/ado/ADriver.cxx b/connectivity/source/drivers/ado/ADriver.cxx index 6502f8447b22..88942374e731 100644 --- a/connectivity/source/drivers/ado/ADriver.cxx +++ b/connectivity/source/drivers/ado/ADriver.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ADriver.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2001-04-27 10:08:08 $ + * last change: $Author: oj $ $Date: 2001-05-17 09:13:23 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -148,11 +148,11 @@ sal_Bool SAL_CALL ODriver::supportsService( const ::rtl::OUString& _rServiceName { Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); const ::rtl::OUString* pSupported = aSupported.getConstArray(); - for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported) - if (pSupported->equals(_rServiceName)) - return sal_True; + const ::rtl::OUString* pEnd = pSupported + aSupported.getLength(); + for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported) + ; - return sal_False; + return pSupported != pEnd; } // -------------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/ado/AResultSet.cxx b/connectivity/source/drivers/ado/AResultSet.cxx index ef4501c261ef..40665d39c37c 100644 --- a/connectivity/source/drivers/ado/AResultSet.cxx +++ b/connectivity/source/drivers/ado/AResultSet.cxx @@ -2,9 +2,9 @@ * * $RCSfile: AResultSet.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: oj $ $Date: 2001-05-17 07:30:42 $ + * last change: $Author: oj $ $Date: 2001-05-17 09:13:23 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -136,13 +136,13 @@ using namespace com::sun::star::sdbc; // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSet::supportsService( const ::rtl::OUString& _rServiceName ) throw(::com::sun::star::uno::RuntimeException) { - ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); + Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); const ::rtl::OUString* pSupported = aSupported.getConstArray(); - for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported) - if (pSupported->equals(_rServiceName)) - return sal_True; + const ::rtl::OUString* pEnd = pSupported + aSupported.getLength(); + for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported) + ; - return sal_False; + return pSupported != pEnd; } // ------------------------------------------------------------------------- OResultSet::OResultSet(ADORecordset* _pRecordSet,OStatement_Base* pStmt) : OResultSet_BASE(m_aMutex) @@ -157,7 +157,7 @@ OResultSet::OResultSet(ADORecordset* _pRecordSet,OStatement_Base* pStmt) : ORes osl_incrementInterlockedCount( &m_refCount ); OSL_ENSURE(_pRecordSet,"No RecordSet !"); if(!_pRecordSet) - throw SQLException(); + ::dbtools::throwFunctionSequenceException(*this); m_pRecordSet->AddRef(); VARIANT_BOOL bIsAtBOF; CHECK_RETURN(m_pRecordSet->get_BOF(&bIsAtBOF)) @@ -175,7 +175,7 @@ OResultSet::OResultSet(ADORecordset* _pRecordSet) : OResultSet_BASE(m_aMutex) osl_incrementInterlockedCount( &m_refCount ); OSL_ENSURE(_pRecordSet,"No RecordSet !"); if(!_pRecordSet) - throw SQLException(); + ::dbtools::throwFunctionSequenceException(*this); m_pRecordSet->AddRef(); VARIANT_BOOL bIsAtBOF; CHECK_RETURN(m_pRecordSet->get_BOF(&bIsAtBOF)) @@ -231,7 +231,12 @@ sal_Int32 SAL_CALL OResultSet::findColumn( const ::rtl::OUString& columnName ) t sal_Int32 nLen = xMeta->getColumnCount(); sal_Int32 i = 1; for(;i<=nLen;++i) - if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) : columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i))) + if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) : +#if SUPD > 630 + columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i))) +#else + columnName.equalsIgnoreCase(xMeta->getColumnName(i))) +#endif break; return i; } @@ -608,7 +613,7 @@ sal_Bool SAL_CALL OResultSet::absolute( sal_Int32 row ) throw(SQLException, Runt if(!row) // absolute with zero not allowed - throw SQLException(); + ::dbtools::throwFunctionSequenceException(*this); sal_Bool bCheck = sal_True; if(row < 0) @@ -1035,7 +1040,7 @@ sal_Bool SAL_CALL OResultSet::moveToBookmark( const Any& bookmark ) throw(SQLExc bookmark >>= nPos; OSL_ENSURE(nPos >= 0 && nPos < (sal_Int32)m_aBookmarks.size(),"Invalid Index for vector"); if(nPos < 0 || nPos >= (sal_Int32)m_aBookmarks.size()) - throw SQLException(); + ::dbtools::throwFunctionSequenceException(*this); return SUCCEEDED(m_pRecordSet->Move(0,m_aBookmarks[nPos])); } @@ -1051,7 +1056,7 @@ sal_Bool SAL_CALL OResultSet::moveRelativeToBookmark( const Any& bookmark, sal_I nPos += rows; OSL_ENSURE(nPos >= 0 && nPos < (sal_Int32)m_aBookmarks.size(),"Invalid Index for vector"); if(nPos < 0 || nPos >= (sal_Int32)m_aBookmarks.size()) - throw SQLException(); + ::dbtools::throwFunctionSequenceException(*this); return SUCCEEDED(m_pRecordSet->Move(rows,m_aBookmarks[nPos])); } //------------------------------------------------------------------------------ diff --git a/connectivity/source/drivers/ado/AStatement.cxx b/connectivity/source/drivers/ado/AStatement.cxx index 2a4a812bf7d7..ac9b93bcc540 100644 --- a/connectivity/source/drivers/ado/AStatement.cxx +++ b/connectivity/source/drivers/ado/AStatement.cxx @@ -2,9 +2,9 @@ * * $RCSfile: AStatement.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: oj $ $Date: 2001-05-17 07:26:59 $ + * last change: $Author: oj $ $Date: 2001-05-17 09:13:23 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -91,8 +91,8 @@ #ifndef _COM_SUN_STAR_SDBC_FETCHDIRECTION_HPP_ #include <com/sun/star/sdbc/FetchDirection.hpp> #endif -#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ -#include <com/sun/star/lang/DisposedException.hpp> +#ifndef _DBHELPER_DBEXCEPTION_HXX_ +#include "connectivity/dbexception.hxx" #endif #define CHECK_RETURN(x) \ @@ -548,7 +548,7 @@ sal_Int32 OStatement_Base::getMaxRows() const throw(SQLException, RuntimeExcepti { sal_Int32 nRet=-1; if(!m_RecordSet.IsValid() && m_RecordSet.get_MaxRecords(nRet)) - throw SQLException(); + ::dbtools::throwFunctionSequenceException(NULL); return nRet; } //------------------------------------------------------------------------------ diff --git a/connectivity/source/drivers/ado/Aolevariant.cxx b/connectivity/source/drivers/ado/Aolevariant.cxx new file mode 100644 index 000000000000..86f935b75e98 --- /dev/null +++ b/connectivity/source/drivers/ado/Aolevariant.cxx @@ -0,0 +1,527 @@ +/************************************************************************* + * + * $RCSfile: Aolevariant.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: oj $ $Date: 2001-05-17 09:15:34 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the License); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an AS IS basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ADO_AOLEVARIANT_HXX_ +#include "ado/Aolevariant.hxx" +#endif + + +using namespace connectivity::ado; +OLEString::OLEString() + :m_sStr(NULL) +{ +} +OLEString::OLEString(const BSTR& _sBStr) + :m_sStr(_sBStr) +{ +} +OLEString::OLEString(const ::rtl::OUString& _sBStr) +{ + m_sStr = ::SysAllocString(_sBStr); +} +OLEString::~OLEString() +{ + if(m_sStr) + ::SysFreeString(m_sStr); +} +OLEString& OLEString::operator=(const ::rtl::OUString& _rSrc) +{ + if(m_sStr) + ::SysFreeString(m_sStr); + m_sStr = ::SysAllocString(_rSrc); + return *this; +} +OLEString& OLEString::operator=(const BSTR& _rSrc) +{ + if(m_sStr) + ::SysFreeString(m_sStr); + m_sStr = _rSrc; + return *this; +} +OLEString::operator ::rtl::OUString() const +{ + return (m_sStr != NULL) ? ::rtl::OUString(m_sStr,::SysStringLen(m_sStr)) : ::rtl::OUString(); +} +OLEString::operator BSTR() const +{ + return m_sStr; +} +BSTR* OLEString::operator &() +{ + return &m_sStr; +} +sal_Int32 OLEString::length() const +{ + return (m_sStr != NULL) ? ::SysStringLen(m_sStr) : 0; +} + +OLEVariant::OLEVariant() +{ + VariantInit(this); +} +OLEVariant::OLEVariant(const VARIANT& varSrc) +{ + ::VariantInit(this); + ::VariantCopy(this, const_cast<VARIANT*>(&varSrc)); +} +OLEVariant::OLEVariant(const OLEVariant& varSrc) +{ + ::VariantInit(this); + ::VariantCopy(this, const_cast<VARIANT*>(static_cast<const VARIANT*>(&varSrc))); +} + +OLEVariant::OLEVariant(sal_Bool x) { VariantInit(this); vt = VT_BOOL; boolVal = (x ? VARIANT_TRUE : VARIANT_FALSE);} +OLEVariant::OLEVariant(sal_Int8 n) { VariantInit(this); vt = VT_I1; bVal = n;} +OLEVariant::OLEVariant(sal_Int16 n) { VariantInit(this); vt = VT_I2; intVal = n;} +OLEVariant::OLEVariant(sal_Int32 n) { VariantInit(this); vt = VT_I4; lVal = n;} +OLEVariant::OLEVariant(sal_Int64 x) { VariantInit(this); vt = VT_I4; lVal = x;} + +OLEVariant::OLEVariant(const rtl::OUString& us) +{ + ::VariantInit(this); + vt = VT_BSTR; + bstrVal = SysAllocString(us); +} +OLEVariant::~OLEVariant() +{ + ::VariantClear(this); +} // clears all the memory that was allocated before + +OLEVariant::OLEVariant(const ::com::sun::star::util::Date& x ) +{ + VariantInit(this); + vt = VT_R8; + dblVal = ::dbtools::DBTypeConversion::toDouble(x); +} +OLEVariant::OLEVariant(const ::com::sun::star::util::Time& x ) +{ + VariantInit(this); + vt = VT_R8; + dblVal = ::dbtools::DBTypeConversion::toDouble(x); +} +OLEVariant::OLEVariant(const ::com::sun::star::util::DateTime& x ) +{ + VariantInit(this); + vt = VT_R8; + dblVal = ::dbtools::DBTypeConversion::toDouble(x); +} +OLEVariant::OLEVariant(const float &x) +{ + VariantInit(this); + vt = VT_R4; + fltVal = x; +} +OLEVariant::OLEVariant(const double &x) +{ + VariantInit(this); + vt = VT_R8; + dblVal = x; +} + + +OLEVariant::OLEVariant(IDispatch* pDispInterface) +{ + VariantInit(this); + vt = VT_DISPATCH; + pdispVal = pDispInterface; +} + +OLEVariant::OLEVariant(const ::com::sun::star::uno::Sequence< sal_Int8 >& x) +{ + VariantInit(this); + vt = VT_ARRAY|VT_UI1; + parray = SafeArrayCreateVector(VT_UI1, 0, x.getLength()); + const sal_Int8* pBegin = x.getConstArray(); + const sal_Int8* pEnd = pBegin + x.getLength(); + for(sal_Int32 i=0;pBegin != pEnd;++i,++pBegin) + SafeArrayPutElement(parray,&i,&pBegin); +} + +OLEVariant& OLEVariant::operator=(const OLEVariant& varSrc) +{ + VariantCopy(this, const_cast<VARIANT*>(static_cast<const VARIANT*>(&varSrc))); + return *this; +} +// Assign a const VARIANT& (::VariantCopy handles everything) +// +OLEVariant& OLEVariant::operator=(const tagVARIANT& varSrc) +{ + ::VariantCopy(this, const_cast<VARIANT*>(&varSrc)); + + return *this; +} + +// Assign a const VARIANT* (::VariantCopy handles everything) +// +OLEVariant& OLEVariant::operator=(const VARIANT* pSrc) +{ + ::VariantCopy(this, const_cast<VARIANT*>(pSrc)); + + return *this; +} + +void OLEVariant::setByte(sal_uInt8 n) { VariantClear(this); vt = VT_UI1; bVal = n;} +void OLEVariant::setInt16(sal_Int16 n) { VariantClear(this); vt = VT_I2; iVal = n;} +void OLEVariant::setInt32(sal_Int32 n) { VariantClear(this); vt = VT_I4; lVal = n;} +void OLEVariant::setFloat(float f) { VariantClear(this); vt = VT_R4; fltVal = f;} +void OLEVariant::setDouble(double d) { VariantClear(this); vt = VT_R8; dblVal = d;} +void OLEVariant::setDate(DATE d) { VariantClear(this); vt = VT_DATE; date = d;} +void OLEVariant::setChar(unsigned char a) { VariantClear(this); vt = VT_UI1; bVal = a;} +void OLEVariant::setCurrency(double aCur) { VariantClear(this); vt = VT_CY; set(aCur*10000);} +void OLEVariant::setBool(sal_Bool b) { VariantClear(this); vt = VT_BOOL; boolVal = b ? VARIANT_TRUE : VARIANT_FALSE;} +void OLEVariant::setString(const rtl::OUString& us){ VariantClear(this); vt = VT_BSTR; bstrVal = ::SysAllocString(us);} +void OLEVariant::setNoArg() { VariantClear(this); vt = VT_ERROR; scode = DISP_E_PARAMNOTFOUND;} + +void OLEVariant::setIDispatch(IDispatch* pDispInterface) + { VariantClear(this); vt = VT_DISPATCH; pdispVal = pDispInterface;} + +void OLEVariant::setNull() { VariantClear(this); vt = VT_NULL;} +void OLEVariant::setEmpty() { VariantClear(this); vt = VT_EMPTY;} + +void OLEVariant::setUI1SAFEARRAYPtr(SAFEARRAY* pSafeAr) + { VariantClear(this); vt = VT_ARRAY|VT_UI1; parray = pSafeAr; } + +void OLEVariant::setArray(SAFEARRAY* pSafeArray, VARTYPE vtType) + { VariantClear(this); vt = VT_ARRAY|vtType; parray = pSafeArray; } + +sal_Bool OLEVariant::isNull() const { return (vt == VT_NULL); } +sal_Bool OLEVariant::isEmpty() const { return (vt == VT_EMPTY); } + +VARTYPE OLEVariant::getType() const { return vt; } + +OLEVariant::operator ::com::sun::star::util::Date() const +{ + return connectivity::DateConversion::toDate(date,::com::sun::star::util::Date(30,12,1899)); +} +OLEVariant::operator ::com::sun::star::util::Time() const +{ + return connectivity::DateConversion::toTime(date); +} +OLEVariant::operator ::com::sun::star::util::DateTime()const +{ + return connectivity::DateConversion::toDateTime(date,::com::sun::star::util::Date(30,12,1899)); +} + +VARIANT_BOOL OLEVariant::VariantBool(sal_Bool bEinBoolean) +{ + return (bEinBoolean ? VARIANT_TRUE : VARIANT_FALSE); +} + +void OLEVariant::CHS() +{ + cyVal.Lo ^= (sal_uInt32)-1; + cyVal.Hi ^= -1; + cyVal.Lo++; + if( !cyVal.Lo ) + cyVal.Hi++; +} + +void OLEVariant::set(double n) +{ + if( n >= 0 ) + { + cyVal.Hi = (sal_Int32)(n / (double)4294967296.0); + cyVal.Lo = (sal_uInt32)(n - ((double)cyVal.Hi * (double)4294967296.0)); + } + else { + cyVal.Hi = (sal_Int32)(-n / (double)4294967296.0); + cyVal.Lo = (sal_uInt32)(-n - ((double)cyVal.Hi * (double)4294967296.0)); + CHS(); + } +} + +OLEVariant::operator rtl::OUString() const +{ + if (V_VT(this) == VT_BSTR) + return V_BSTR(this); + + + OLEVariant varDest; + + varDest.ChangeType(VT_BSTR, this); + + return V_BSTR(&varDest); +} +// ----------------------------------------------------------------------------- +OLEVariant::operator ::com::sun::star::uno::Sequence< sal_Int8 >() const +{ + ::com::sun::star::uno::Sequence< sal_Int8 > aRet; + if(V_VT(this) == VT_BSTR) + { + OLEString sStr(V_BSTR(this)); + aRet = ::com::sun::star::uno::Sequence<sal_Int8>(reinterpret_cast<const sal_Int8*>((const wchar_t*)sStr),sizeof(sal_Unicode)*sStr.length()); + } + else + { + SAFEARRAY* pArray = getUI1SAFEARRAYPtr(); + + if(pArray) + { + HRESULT hresult1,hresult2; + long lBound,uBound; + // Verify that the SafeArray is the proper shape. + hresult1 = ::SafeArrayGetLBound(pArray, 1, &lBound); + hresult2 = ::SafeArrayGetUBound(pArray, 1, &uBound); + if(SUCCEEDED(hresult1) && SUCCEEDED(hresult2)) + { + long nIndex = 0; + long nCount = uBound-lBound+1; + aRet.realloc(nCount); + for(long i=0;i<nCount;++i) + { + ::SafeArrayGetElement(pArray,&nIndex,(void*)aRet.getArray()[i]); + } + } + } + } + + return aRet; +} +// ----------------------------------------------------------------------------- +::rtl::OUString OLEVariant::getString() const +{ + return (rtl::OUString)*this; +} +// ----------------------------------------------------------------------------- +sal_Bool OLEVariant::getBool() const +{ + if (V_VT(this) == VT_BOOL) + return V_BOOL(this) == VARIANT_TRUE ? sal_True : sal_False; + + OLEVariant varDest; + + varDest.ChangeType(VT_BOOL, this); + + return V_BOOL(&varDest) == VARIANT_TRUE ? sal_True : sal_False; +} +// ----------------------------------------------------------------------------- +IUnknown* OLEVariant::getIUnknown() const +{ + if (V_VT(this) == VT_UNKNOWN) + { + V_UNKNOWN(this)->AddRef(); + return V_UNKNOWN(this); + } + + OLEVariant varDest; + + varDest.ChangeType(VT_UNKNOWN, this); + + V_UNKNOWN(&varDest)->AddRef(); + return V_UNKNOWN(&varDest); +} +// ----------------------------------------------------------------------------- +IDispatch* OLEVariant::getIDispatch() const +{ + if (V_VT(this) == VT_DISPATCH) + { + V_DISPATCH(this)->AddRef(); + return V_DISPATCH(this); + } + + OLEVariant varDest; + + varDest.ChangeType(VT_DISPATCH, this); + + V_DISPATCH(&varDest)->AddRef(); + return V_DISPATCH(&varDest); +} +// ----------------------------------------------------------------------------- +sal_uInt8 OLEVariant::getByte() const +{ + if (V_VT(this) == VT_UI1) + return V_UI1(this); + + OLEVariant varDest; + + varDest.ChangeType(VT_UI1, this); + + return V_UI1(&varDest); +} +// ----------------------------------------------------------------------------- +sal_Int16 OLEVariant::getInt16() const +{ + if (V_VT(this) == VT_I2) + return V_I2(this); + + OLEVariant varDest; + + varDest.ChangeType(VT_I2, this); + + return V_I2(&varDest); +} +// ----------------------------------------------------------------------------- +sal_Int8 OLEVariant::getInt8() const +{ + if (V_VT(this) == VT_I1) + return V_I1(this); + + OLEVariant varDest; + + varDest.ChangeType(VT_I1, this); + + return V_I1(&varDest); +} +// ----------------------------------------------------------------------------- +sal_Int32 OLEVariant::getInt32() const +{ + if (V_VT(this) == VT_I4) + return V_I4(this); + + OLEVariant varDest; + + varDest.ChangeType(VT_I4, this); + + return V_I4(&varDest); +} +// ----------------------------------------------------------------------------- +sal_uInt32 OLEVariant::getUInt32() const +{ + if (V_VT(this) == VT_UI4) + return V_UI4(this); + + OLEVariant varDest; + + varDest.ChangeType(VT_UI4, this); + + return V_UI4(&varDest); +} +// ----------------------------------------------------------------------------- +float OLEVariant::getFloat() const +{ + if (V_VT(this) == VT_R4) + return V_R4(this); + + OLEVariant varDest; + + varDest.ChangeType(VT_R4, this); + + return V_R4(&varDest); +} +// ----------------------------------------------------------------------------- +double OLEVariant::getDouble() const +{ + if (V_VT(this) == VT_R8) + return V_R8(this); + + OLEVariant varDest; + + varDest.ChangeType(VT_R8, this); + + return V_R8(&varDest); +} +// ----------------------------------------------------------------------------- +double OLEVariant::getDate() const +{ + if (V_VT(this) == VT_DATE) + return V_DATE(this); + + OLEVariant varDest; + + varDest.ChangeType(VT_DATE, this); + + return V_DATE(&varDest); +} +// ----------------------------------------------------------------------------- +CY OLEVariant::getCurrency() const +{ + if (V_VT(this) == VT_CY) + return V_CY(this); + + OLEVariant varDest; + + varDest.ChangeType(VT_CY, this); + + return V_CY(&varDest); +} +// ----------------------------------------------------------------------------- +SAFEARRAY* OLEVariant::getUI1SAFEARRAYPtr() const +{ + if (V_VT(this) == (VT_ARRAY|VT_UI1)) + return V_ARRAY(this); + + OLEVariant varDest; + + varDest.ChangeType((VT_ARRAY|VT_UI1), this); + + return V_ARRAY(&varDest); +} +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +void OLEVariant::ChangeType(VARTYPE vartype, const OLEVariant* pSrc) +{ + // + // If pDest is NULL, convert type in place + // + if (pSrc == NULL) + pSrc = this; + + if ((this != pSrc) || (vartype != V_VT(this))) + { + if(FAILED(::VariantChangeType(static_cast<VARIANT*>(this), + const_cast<VARIANT*>(static_cast<const VARIANT*>(pSrc)), + 0, vartype))) + throw ::com::sun::star::sdbc::SQLException(::rtl::OUString::createFromAscii("Could convert type!"),NULL,::rtl::OUString(),1000,::com::sun::star::uno::Any()); + } +} + diff --git a/connectivity/source/drivers/ado/makefile.mk b/connectivity/source/drivers/ado/makefile.mk index 2fd2f0a41efd..145653fa4817 100644 --- a/connectivity/source/drivers/ado/makefile.mk +++ b/connectivity/source/drivers/ado/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.6 $ +# $Revision: 1.7 $ # -# last change: $Author: oj $ $Date: 2001-05-14 11:40:04 $ +# last change: $Author: oj $ $Date: 2001-05-17 09:13:23 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -80,6 +80,7 @@ ENVCFLAGS+=/FR$(SLO)$/ # --- Files ------------------------------------- SLOFILES=\ + $(SLO)$/Aolevariant.obj \ $(SLO)$/Awrapado.obj \ $(SLO)$/ADatabaseMetaData.obj \ $(SLO)$/AColumn.obj \ diff --git a/connectivity/source/drivers/calc/CResultSet.cxx b/connectivity/source/drivers/calc/CResultSet.cxx index 59df5048689e..c6f196abff2d 100644 --- a/connectivity/source/drivers/calc/CResultSet.cxx +++ b/connectivity/source/drivers/calc/CResultSet.cxx @@ -2,9 +2,9 @@ * * $RCSfile: CResultSet.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: oj $ $Date: 2001-05-17 06:46:55 $ + * last change: $Author: oj $ $Date: 2001-05-17 09:13:23 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -104,13 +104,13 @@ Sequence< ::rtl::OUString > SAL_CALL OCalcResultSet::getSupportedServiceNames( // ------------------------------------------------------------------------- sal_Bool SAL_CALL OCalcResultSet::supportsService( const ::rtl::OUString& _rServiceName ) throw( RuntimeException) { - Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); + Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); const ::rtl::OUString* pSupported = aSupported.getConstArray(); - for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported) - if (pSupported->equals(_rServiceName)) - return sal_True; + const ::rtl::OUString* pEnd = pSupported + aSupported.getLength(); + for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported) + ; - return sal_False; + return pSupported != pEnd; } // ------------------------------------------------------------------------- Any SAL_CALL OCalcResultSet::queryInterface( const Type & rType ) throw(RuntimeException) diff --git a/connectivity/source/drivers/dbase/DResultSet.cxx b/connectivity/source/drivers/dbase/DResultSet.cxx index bee3b954b678..9b7b4e3daaec 100644 --- a/connectivity/source/drivers/dbase/DResultSet.cxx +++ b/connectivity/source/drivers/dbase/DResultSet.cxx @@ -2,9 +2,9 @@ * * $RCSfile: DResultSet.cxx,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: oj $ $Date: 2001-05-17 06:46:55 $ + * last change: $Author: oj $ $Date: 2001-05-17 09:13:21 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -113,13 +113,13 @@ Sequence< ::rtl::OUString > SAL_CALL ODbaseResultSet::getSupportedServiceNames( // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODbaseResultSet::supportsService( const ::rtl::OUString& _rServiceName ) throw( RuntimeException) { - Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); + Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); const ::rtl::OUString* pSupported = aSupported.getConstArray(); - for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported) - if (pSupported->equals(_rServiceName)) - return sal_True; + const ::rtl::OUString* pEnd = pSupported + aSupported.getLength(); + for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported) + ; - return sal_False; + return pSupported != pEnd; } // ------------------------------------------------------------------------- Any SAL_CALL ODbaseResultSet::queryInterface( const Type & rType ) throw(RuntimeException) diff --git a/connectivity/source/drivers/file/FDriver.cxx b/connectivity/source/drivers/file/FDriver.cxx index ff571c25565c..5f7688603102 100644 --- a/connectivity/source/drivers/file/FDriver.cxx +++ b/connectivity/source/drivers/file/FDriver.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FDriver.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2001-04-30 10:11:27 $ + * last change: $Author: oj $ $Date: 2001-05-17 09:13:20 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -123,13 +123,13 @@ Sequence< ::rtl::OUString > OFileDriver::getSupportedServiceNames_Static( ) thr //------------------------------------------------------------------ sal_Bool SAL_CALL OFileDriver::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException) { - Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); + Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); const ::rtl::OUString* pSupported = aSupported.getConstArray(); - for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported) - if (pSupported->equals(_rServiceName)) - return sal_True; + const ::rtl::OUString* pEnd = pSupported + aSupported.getLength(); + for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported) + ; - return sal_False; + return pSupported != pEnd; } //------------------------------------------------------------------ diff --git a/connectivity/source/drivers/flat/EResultSet.cxx b/connectivity/source/drivers/flat/EResultSet.cxx index 14e77d710e2d..936e278b51ae 100644 --- a/connectivity/source/drivers/flat/EResultSet.cxx +++ b/connectivity/source/drivers/flat/EResultSet.cxx @@ -2,9 +2,9 @@ * * $RCSfile: EResultSet.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: oj $ $Date: 2001-05-17 06:46:52 $ + * last change: $Author: oj $ $Date: 2001-05-17 09:13:18 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -108,13 +108,13 @@ Sequence< ::rtl::OUString > SAL_CALL OFlatResultSet::getSupportedServiceNames( // ------------------------------------------------------------------------- sal_Bool SAL_CALL OFlatResultSet::supportsService( const ::rtl::OUString& _rServiceName ) throw( RuntimeException) { - Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); + Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); const ::rtl::OUString* pSupported = aSupported.getConstArray(); - for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported) - if (pSupported->equals(_rServiceName)) - return sal_True; + const ::rtl::OUString* pEnd = pSupported + aSupported.getLength(); + for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported) + ; - return sal_False; + return pSupported != pEnd; } // ------------------------------------------------------------------------- Any SAL_CALL OFlatResultSet::queryInterface( const Type & rType ) throw(RuntimeException) diff --git a/connectivity/source/drivers/jdbc/JDriver.cxx b/connectivity/source/drivers/jdbc/JDriver.cxx index 36bf22da34e5..bb348caa902f 100644 --- a/connectivity/source/drivers/jdbc/JDriver.cxx +++ b/connectivity/source/drivers/jdbc/JDriver.cxx @@ -2,9 +2,9 @@ * * $RCSfile: JDriver.cxx,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: oj $ $Date: 2001-05-17 07:26:57 $ + * last change: $Author: oj $ $Date: 2001-05-17 09:13:17 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -154,12 +154,14 @@ jclass java_sql_Driver::getMyClass() if( !theClass ) { SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelscht worden!"); - if( !t.pEnv ) return (jclass)0; - jclass tempClass = t.pEnv->FindClass("java/sql/Driver"); - OSL_ENSURE(tempClass,"Java : FindClass nicht erfolgreich!"); - jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); - t.pEnv->DeleteLocalRef( tempClass ); - saveClassRef( globClass ); + if( t.pEnv ) + { + jclass tempClass = t.pEnv->FindClass("java/sql/Driver"); + OSL_ENSURE(tempClass,"Java : FindClass nicht erfolgreich!"); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } } return theClass; } diff --git a/connectivity/source/drivers/jdbc/PreparedStatement.cxx b/connectivity/source/drivers/jdbc/PreparedStatement.cxx index 5c4f760fcec6..5827fe217707 100644 --- a/connectivity/source/drivers/jdbc/PreparedStatement.cxx +++ b/connectivity/source/drivers/jdbc/PreparedStatement.cxx @@ -2,9 +2,9 @@ * * $RCSfile: PreparedStatement.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: oj $ $Date: 2001-04-30 10:13:38 $ + * last change: $Author: oj $ $Date: 2001-05-17 09:13:17 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -103,13 +103,16 @@ java_sql_PreparedStatement::~java_sql_PreparedStatement() jclass java_sql_PreparedStatement::getMyClass() { // die Klasse muss nur einmal geholt werden, daher statisch - if( !theClass ){ + if( !theClass ) + { SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelscht worden!"); - if( !t.pEnv ) return (jclass)0; - 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 ); + 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 ); + } } return theClass; } diff --git a/connectivity/source/drivers/jdbc/ResultSet.cxx b/connectivity/source/drivers/jdbc/ResultSet.cxx index d1a36dbb4136..e5593acbbacd 100644 --- a/connectivity/source/drivers/jdbc/ResultSet.cxx +++ b/connectivity/source/drivers/jdbc/ResultSet.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ResultSet.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: oj $ $Date: 2001-05-14 11:37:35 $ + * last change: $Author: oj $ $Date: 2001-05-17 09:13:16 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1771,6 +1771,7 @@ sal_Bool java_sql_ResultSet::convertFastPropertyValue( const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::lang::IllegalArgumentException) { + sal_Bool bRet = sal_False; switch(nHandle) { case PROPERTY_ID_CURSORNAME: @@ -1779,13 +1780,14 @@ sal_Bool java_sql_ResultSet::convertFastPropertyValue( throw ::com::sun::star::lang::IllegalArgumentException(); break; case PROPERTY_ID_FETCHDIRECTION: - return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchDirection()); + bRet = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchDirection()); + break; case PROPERTY_ID_FETCHSIZE: - return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchSize()); + bRet = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchSize()); default: ; } - return sal_False; + return bRet; } // ------------------------------------------------------------------------- void java_sql_ResultSet::setFastPropertyValue_NoBroadcast( diff --git a/connectivity/source/sdbcx/VColumn.cxx b/connectivity/source/sdbcx/VColumn.cxx index e6af610ef556..5f97635ec7fe 100644 --- a/connectivity/source/sdbcx/VColumn.cxx +++ b/connectivity/source/sdbcx/VColumn.cxx @@ -2,9 +2,9 @@ * * $RCSfile: VColumn.cxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: oj $ $Date: 2001-05-14 11:34:03 $ + * last change: $Author: oj $ $Date: 2001-05-17 09:13:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -102,13 +102,13 @@ using namespace ::com::sun::star::lang; // ----------------------------------------------------------------------------- sal_Bool SAL_CALL OColumn::supportsService( const ::rtl::OUString& _rServiceName ) throw(::com::sun::star::uno::RuntimeException) { - ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); + Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); const ::rtl::OUString* pSupported = aSupported.getConstArray(); - for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported) - if (pSupported->equals(_rServiceName)) - return sal_True; + const ::rtl::OUString* pEnd = pSupported + aSupported.getLength(); + for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported) + ; - return sal_False; + return pSupported != pEnd; } // ------------------------------------------------------------------------- OColumn::OColumn(sal_Bool _bCase) : OColumnDescriptor_BASE(m_aMutex) diff --git a/connectivity/source/sdbcx/VIndex.cxx b/connectivity/source/sdbcx/VIndex.cxx index a9e64fd60730..3d913cb451ff 100644 --- a/connectivity/source/sdbcx/VIndex.cxx +++ b/connectivity/source/sdbcx/VIndex.cxx @@ -2,9 +2,9 @@ * * $RCSfile: VIndex.cxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: oj $ $Date: 2001-05-14 11:34:03 $ + * last change: $Author: oj $ $Date: 2001-05-17 09:13:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -110,13 +110,13 @@ using namespace ::com::sun::star::lang; // ----------------------------------------------------------------------------- sal_Bool SAL_CALL OIndex::supportsService( const ::rtl::OUString& _rServiceName ) throw(::com::sun::star::uno::RuntimeException) { - ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); + Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); const ::rtl::OUString* pSupported = aSupported.getConstArray(); - for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported) - if (pSupported->equals(_rServiceName)) - return sal_True; + const ::rtl::OUString* pEnd = pSupported + aSupported.getLength(); + for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported) + ; - return sal_False; + return pSupported != pEnd; } // ------------------------------------------------------------------------- OIndex::OIndex(sal_Bool _bCase) : ODescriptor_BASE(m_aMutex) diff --git a/connectivity/source/sdbcx/VIndexColumn.cxx b/connectivity/source/sdbcx/VIndexColumn.cxx index 8dd43e82297a..7475be7895ad 100644 --- a/connectivity/source/sdbcx/VIndexColumn.cxx +++ b/connectivity/source/sdbcx/VIndexColumn.cxx @@ -2,9 +2,9 @@ * * $RCSfile: VIndexColumn.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: oj $ $Date: 2001-05-14 11:34:03 $ + * last change: $Author: oj $ $Date: 2001-05-17 09:13:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -90,13 +90,13 @@ using namespace ::com::sun::star::uno; // ----------------------------------------------------------------------------- sal_Bool SAL_CALL OIndexColumn::supportsService( const ::rtl::OUString& _rServiceName ) throw(::com::sun::star::uno::RuntimeException) { - ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); + Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); const ::rtl::OUString* pSupported = aSupported.getConstArray(); - for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported) - if (pSupported->equals(_rServiceName)) - return sal_True; + const ::rtl::OUString* pEnd = pSupported + aSupported.getLength(); + for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported) + ; - return sal_False; + return pSupported != pEnd; } // ----------------------------------------------------------------------------- OIndexColumn::OIndexColumn(sal_Bool _bCase) : OColumn(_bCase), m_IsAscending(sal_True) diff --git a/connectivity/source/sdbcx/VKey.cxx b/connectivity/source/sdbcx/VKey.cxx index e846a00a1613..b364b80da72c 100644 --- a/connectivity/source/sdbcx/VKey.cxx +++ b/connectivity/source/sdbcx/VKey.cxx @@ -2,9 +2,9 @@ * * $RCSfile: VKey.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: oj $ $Date: 2001-05-14 11:34:03 $ + * last change: $Author: oj $ $Date: 2001-05-17 09:13:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -112,13 +112,13 @@ using namespace ::com::sun::star::lang; // ----------------------------------------------------------------------------- sal_Bool SAL_CALL OKey::supportsService( const ::rtl::OUString& _rServiceName ) throw(::com::sun::star::uno::RuntimeException) { - ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); + Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); const ::rtl::OUString* pSupported = aSupported.getConstArray(); - for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported) - if (pSupported->equals(_rServiceName)) - return sal_True; + const ::rtl::OUString* pEnd = pSupported + aSupported.getLength(); + for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported) + ; - return sal_False; + return pSupported != pEnd; } // ------------------------------------------------------------------------- OKey::OKey(sal_Bool _bCase) : ODescriptor_BASE(m_aMutex) diff --git a/connectivity/source/sdbcx/VKeyColumn.cxx b/connectivity/source/sdbcx/VKeyColumn.cxx index ace1e097a977..a95568585b22 100644 --- a/connectivity/source/sdbcx/VKeyColumn.cxx +++ b/connectivity/source/sdbcx/VKeyColumn.cxx @@ -2,9 +2,9 @@ * * $RCSfile: VKeyColumn.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: oj $ $Date: 2001-05-14 11:34:03 $ + * last change: $Author: oj $ $Date: 2001-05-17 09:13:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -92,13 +92,13 @@ using namespace cppu; // ----------------------------------------------------------------------------- sal_Bool SAL_CALL OKeyColumn::supportsService( const ::rtl::OUString& _rServiceName ) throw(::com::sun::star::uno::RuntimeException) { - ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); + Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); const ::rtl::OUString* pSupported = aSupported.getConstArray(); - for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported) - if (pSupported->equals(_rServiceName)) - return sal_True; + const ::rtl::OUString* pEnd = pSupported + aSupported.getLength(); + for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported) + ; - return sal_False; + return pSupported != pEnd; } // ------------------------------------------------------------------------- OKeyColumn::OKeyColumn(sal_Bool _bCase) : OColumn(_bCase) diff --git a/connectivity/source/sdbcx/VTable.cxx b/connectivity/source/sdbcx/VTable.cxx index 41a20d0089f6..7c6bc0b93fdc 100644 --- a/connectivity/source/sdbcx/VTable.cxx +++ b/connectivity/source/sdbcx/VTable.cxx @@ -2,9 +2,9 @@ * * $RCSfile: VTable.cxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: oj $ $Date: 2001-05-14 11:34:03 $ + * last change: $Author: oj $ $Date: 2001-05-17 09:13:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -117,13 +117,13 @@ using namespace ::com::sun::star::lang; // ----------------------------------------------------------------------------- sal_Bool SAL_CALL OTable::supportsService( const ::rtl::OUString& _rServiceName ) throw(::com::sun::star::uno::RuntimeException) { - ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); + Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); const ::rtl::OUString* pSupported = aSupported.getConstArray(); - for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported) - if (pSupported->equals(_rServiceName)) - return sal_True; + const ::rtl::OUString* pEnd = pSupported + aSupported.getLength(); + for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported) + ; - return sal_False; + return pSupported != pEnd; } // ------------------------------------------------------------------------- OTable::OTable(sal_Bool _bCase) : OTableDescriptor_BASE(m_aMutex) |