diff options
author | Ocke Janssen <oj@openoffice.org> | 2001-11-26 12:52:26 +0000 |
---|---|---|
committer | Ocke Janssen <oj@openoffice.org> | 2001-11-26 12:52:26 +0000 |
commit | 543c6d10d7f6d812bfcee8c06b3ef09c089e9cda (patch) | |
tree | 50cf9a251782e82a08cbc99922fdfe5680dcecf7 /connectivity | |
parent | 49771451f2cfae6bfc0b635af5de55ba60237703 (diff) |
#94985# performance increase
Diffstat (limited to 'connectivity')
17 files changed, 278 insertions, 885 deletions
diff --git a/connectivity/source/drivers/mozab/MConnection.cxx b/connectivity/source/drivers/mozab/MConnection.cxx index 3b0d72f808a4..db55c82da7bf 100644 --- a/connectivity/source/drivers/mozab/MConnection.cxx +++ b/connectivity/source/drivers/mozab/MConnection.cxx @@ -2,9 +2,9 @@ * * $RCSfile: MConnection.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: dkenny $ $Date: 2001-11-15 10:01:12 $ + * last change: $Author: oj $ $Date: 2001-11-26 13:51:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -92,11 +92,11 @@ #include <connectivity/dbexception.hxx> #endif -#ifdef DEBUG +#ifdef _DEBUG # define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr()) -#else /* DEBUG */ +#else /* _DEBUG */ # define OUtoCStr( x ) ("dummy") -#endif /* DEBUG */ +#endif /* _DEBUG */ extern "C" void* SAL_CALL OMozabConnection_CreateInstance(void* _pDriver) { @@ -171,10 +171,7 @@ const sal_Char* OConnection::getSDBC_SCHEME_OUTLOOK_EXPRESS() OConnection::OConnection(MozabDriver* _pDriver) : OSubComponent<OConnection, OConnection_BASE>((::cppu::OWeakObject*)_pDriver, this), m_pDriver(_pDriver), - m_bClosed(sal_False), m_xMetaData(NULL), - m_bUseCatalog(sal_False), - m_bUseOldDateFormat(sal_False), m_nAnonABCount( 0 ), m_nMaxResultRecords( -1 ), m_UsesFactory(sal_False), @@ -233,8 +230,7 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV } OSL_TRACE("URI = %s\n", ((OUtoCStr(aAddrbookURI)) ? (OUtoCStr(aAddrbookURI)):("NULL")) ); - OSL_TRACE("Scheme = %s\n", ((OUtoCStr(aAddrbookScheme)) ? - (OUtoCStr(aAddrbookScheme)):("NULL")) ); + OSL_TRACE("Scheme = %s\n", ((OUtoCStr(aAddrbookScheme)) ? (OUtoCStr(aAddrbookScheme)):("NULL")) ); // // Now we have a URI convert it to a MozillaURI @@ -329,9 +325,7 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV ::rtl::OUString::createFromAscii("Invalid subschema provided"),NULL); } - OSL_TRACE("Moz URI = %s, %s\n", ((OUtoCStr(m_sMozillaURI)) ? - (OUtoCStr(m_sMozillaURI)):("NULL")), - m_UsesFactory ? "uses factory" : "no factory"); + OSL_TRACE("Moz URI = %s, %s\n", ((OUtoCStr(m_sMozillaURI)) ? (OUtoCStr(m_sMozillaURI)):("NULL")),m_UsesFactory ? "uses factory" : "no factory"); OSL_TRACE( "\tOUT OConnection::construct()\n" ); // Test connection by getting to get the Table Names @@ -519,7 +513,6 @@ void OConnection::disposing() } m_aStatements.clear(); - m_bClosed = sal_True; m_xMetaData = ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XDatabaseMetaData>(); dispose_ChildImpl(); @@ -550,4 +543,7 @@ MNameMapper* OConnection::getNameMapper () return m_aNameMapper; } +// ----------------------------------------------------------------------------- + +
\ No newline at end of file diff --git a/connectivity/source/drivers/mozab/MConnection.hxx b/connectivity/source/drivers/mozab/MConnection.hxx index a355ba276183..49a0680049a5 100644 --- a/connectivity/source/drivers/mozab/MConnection.hxx +++ b/connectivity/source/drivers/mozab/MConnection.hxx @@ -2,9 +2,9 @@ * * $RCSfile: MConnection.hxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: mmaher $ $Date: 2001-10-31 17:24:22 $ + * last change: $Author: oj $ $Date: 2001-11-26 13:51:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -79,10 +79,7 @@ #ifndef _CONNECTIVITY_OSUBCOMPONENT_HXX_ #include "OSubComponent.hxx" #endif -#ifndef INCLUDED_MAP -#include <map> -#define INCLUDED_MAP -#endif +// #include <map> #ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_ #include <com/sun/star/sdbcx/XTablesSupplier.hpp> #endif @@ -92,9 +89,6 @@ #ifndef CONNECTIVITY_CONNECTION_HXX #include "TConnection.hxx" #endif -#ifndef _CONNECTIVITY_OTYPEINFO_HXX_ -#include "OTypeInfo.hxx" -#endif #ifndef _CPPUHELPER_WEAKREF_HXX_ #include <cppuhelper/weakref.hxx> #endif @@ -111,7 +105,6 @@ namespace connectivity typedef connectivity::OMetaConnection OConnection_BASE; // implements basics and text encoding - typedef ::std::vector< ::connectivity::OTypeInfo> TTypeInfoVector; class OConnection : public OConnection_BASE, public connectivity::OSubComponent<OConnection, OConnection_BASE> @@ -134,11 +127,6 @@ namespace connectivity ::rtl::OUString m_sUser; // the user name MozabDriver* m_pDriver; // Pointer to the owning // driver object - - sal_Bool m_bClosed; - sal_Bool m_bUseCatalog; // should we use the catalog on filebased databases - sal_Bool m_bUseOldDateFormat; - // Store Catalog ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier> m_xCatalog; // Start of Additions from the land of mozilla @@ -192,10 +180,7 @@ namespace connectivity virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); // - - sal_Bool isCatalogUsed() const { return m_bUseCatalog; } ::rtl::OUString getUserName() const { return m_sUser; } - MozabDriver* getDriver() const { return m_pDriver;} // Added to enable me to use SQLInterpreter which requires an diff --git a/connectivity/source/drivers/mozab/MDatabaseMetaData.cxx b/connectivity/source/drivers/mozab/MDatabaseMetaData.cxx index 2949683f8018..6c51df8e89b5 100644 --- a/connectivity/source/drivers/mozab/MDatabaseMetaData.cxx +++ b/connectivity/source/drivers/mozab/MDatabaseMetaData.cxx @@ -2,9 +2,9 @@ * * $RCSfile: MDatabaseMetaData.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: dkenny $ $Date: 2001-11-15 10:01:12 $ + * last change: $Author: oj $ $Date: 2001-11-26 13:51:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -85,14 +85,15 @@ #ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ #include <com/sun/star/sdbc/ColumnValue.hpp> #endif +#include <com/sun/star/sdbc/ColumnSearch.hpp> #include <vector> -#ifdef DEBUG +#ifdef _DEBUG # define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr()) -#else /* DEBUG */ +#else /* _DEBUG */ # define OUtoCStr( x ) ("dummy") -#endif /* DEBUG */ +#endif /* _DEBUG */ using namespace connectivity::mozab; using namespace connectivity; diff --git a/connectivity/source/drivers/mozab/MPreparedStatement.cxx b/connectivity/source/drivers/mozab/MPreparedStatement.cxx index 7a10f4ae6607..26ffc3f102ea 100644 --- a/connectivity/source/drivers/mozab/MPreparedStatement.cxx +++ b/connectivity/source/drivers/mozab/MPreparedStatement.cxx @@ -2,9 +2,9 @@ * * $RCSfile: MPreparedStatement.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: hr $ $Date: 2001-10-17 18:24:52 $ + * last change: $Author: oj $ $Date: 2001-11-26 13:51:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -91,11 +91,11 @@ #include <com/sun/star/sdbc/ColumnValue.hpp> #endif -#ifdef DEBUG +#ifdef _DEBUG # define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr()) -#else /* DEBUG */ +#else /* _DEBUG */ # define OUtoCStr( x ) ("dummy") -#endif /* DEBUG */ +#endif /* _DEBUG */ using namespace ::comphelper; using namespace connectivity; @@ -258,11 +258,6 @@ sal_Bool SAL_CALL OPreparedStatement::execute( ) throw(SQLException, RuntimeExc sal_Int32 SAL_CALL OPreparedStatement::executeUpdate( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OStatement_BASE::rBHelper.bDisposed); - - // same as in statement with the difference that this statement also can contain parameter - OSL_TRACE("In/Out: OPreparedStatement::executeUpdate" ); return 0; } // ------------------------------------------------------------------------- @@ -300,27 +295,17 @@ Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery( ) throw(SQLE void SAL_CALL OPreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OStatement_BASE::rBHelper.bDisposed); - ::dbtools::throwInvalidIndexException(*this); } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OStatement_BASE::rBHelper.bDisposed); - ::dbtools::throwInvalidIndexException(*this); - } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::setDate( sal_Int32 parameterIndex, const Date& aData ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OStatement_BASE::rBHelper.bDisposed); - ::dbtools::throwInvalidIndexException(*this); } // ------------------------------------------------------------------------- @@ -328,27 +313,18 @@ void SAL_CALL OPreparedStatement::setDate( sal_Int32 parameterIndex, const Date& void SAL_CALL OPreparedStatement::setTime( sal_Int32 parameterIndex, const Time& aVal ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OStatement_BASE::rBHelper.bDisposed); - ::dbtools::throwInvalidIndexException(*this); } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::setTimestamp( sal_Int32 parameterIndex, const DateTime& aVal ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OStatement_BASE::rBHelper.bDisposed); - ::dbtools::throwInvalidIndexException(*this); } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::setDouble( sal_Int32 parameterIndex, double x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OStatement_BASE::rBHelper.bDisposed); - ::dbtools::throwInvalidIndexException(*this); } @@ -356,27 +332,18 @@ void SAL_CALL OPreparedStatement::setDouble( sal_Int32 parameterIndex, double x void SAL_CALL OPreparedStatement::setFloat( sal_Int32 parameterIndex, float x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OStatement_BASE::rBHelper.bDisposed); - ::dbtools::throwInvalidIndexException(*this); } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OStatement_BASE::rBHelper.bDisposed); - ::dbtools::throwInvalidIndexException(*this); } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::setLong( sal_Int32 parameterIndex, sal_Int64 aVal ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OStatement_BASE::rBHelper.bDisposed); - ::dbtools::throwInvalidIndexException(*this); } // ------------------------------------------------------------------------- @@ -394,81 +361,54 @@ void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 s void SAL_CALL OPreparedStatement::setClob( sal_Int32 parameterIndex, const Reference< XClob >& x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OStatement_BASE::rBHelper.bDisposed); - ::dbtools::throwInvalidIndexException(*this); } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::setBlob( sal_Int32 parameterIndex, const Reference< XBlob >& x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OStatement_BASE::rBHelper.bDisposed); - ::dbtools::throwInvalidIndexException(*this); } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::setArray( sal_Int32 parameterIndex, const Reference< XArray >& x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OStatement_BASE::rBHelper.bDisposed); - ::dbtools::throwInvalidIndexException(*this); } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::setRef( sal_Int32 parameterIndex, const Reference< XRef >& x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OStatement_BASE::rBHelper.bDisposed); - ::dbtools::throwInvalidIndexException(*this); } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, const Any& x, sal_Int32 sqlType, sal_Int32 scale ) throw(SQLException, RuntimeException) { - checkDisposed(OStatement_BASE::rBHelper.bDisposed); - ::osl::MutexGuard aGuard( m_aMutex ); - ::dbtools::throwInvalidIndexException(*this); } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OStatement_BASE::rBHelper.bDisposed); - - ::dbtools::throwInvalidIndexException(*this); + setNull(parameterIndex,sqlType); } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::setObject( sal_Int32 parameterIndex, const Any& x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OStatement_BASE::rBHelper.bDisposed); - - ::dbtools::throwInvalidIndexException(*this); + ::dbtools::implSetObject(this,parameterIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OStatement_BASE::rBHelper.bDisposed); - ::dbtools::throwInvalidIndexException(*this); } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::setBytes( sal_Int32 parameterIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OStatement_BASE::rBHelper.bDisposed); - ::dbtools::throwInvalidIndexException(*this); } // ------------------------------------------------------------------------- @@ -476,18 +416,12 @@ 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) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OStatement_BASE::rBHelper.bDisposed); - ::dbtools::throwInvalidIndexException(*this); } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::setBinaryStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OStatement_BASE::rBHelper.bDisposed); - ::dbtools::throwInvalidIndexException(*this); } // ------------------------------------------------------------------------- @@ -496,21 +430,6 @@ void SAL_CALL OPreparedStatement::clearParameters( ) throw(SQLException, Runtim { } // ------------------------------------------------------------------------- -void SAL_CALL OPreparedStatement::clearBatch( ) throw(SQLException, RuntimeException) -{ -} -// ------------------------------------------------------------------------- - -void SAL_CALL OPreparedStatement::addBatch( ) throw(SQLException, RuntimeException) -{ -} -// ------------------------------------------------------------------------- - -Sequence< sal_Int32 > SAL_CALL OPreparedStatement::executeBatch( ) throw(SQLException, RuntimeException) -{ - return Sequence< sal_Int32 > (); -} -// ------------------------------------------------------------------------- void OPreparedStatement::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) throw (Exception) { switch(nHandle) @@ -664,4 +583,21 @@ void OPreparedStatement::scanParameter(OSQLParseNode* pParseNode,::std::vector< for (sal_uInt32 i = 0; i < pParseNode->count(); i++) scanParameter(pParseNode->getChild(i),_rParaNodes); } +// ----------------------------------------------------------------------------- +::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL OPreparedStatement::getResultSet( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + return NULL; +} +// ----------------------------------------------------------------------------- +sal_Int32 SAL_CALL OPreparedStatement::getUpdateCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + return 0; +} +// ----------------------------------------------------------------------------- +sal_Bool SAL_CALL OPreparedStatement::getMoreResults( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + return sal_False; +} +// ----------------------------------------------------------------------------- + diff --git a/connectivity/source/drivers/mozab/MPreparedStatement.hxx b/connectivity/source/drivers/mozab/MPreparedStatement.hxx index c21482b350fb..3d70761fb0ab 100644 --- a/connectivity/source/drivers/mozab/MPreparedStatement.hxx +++ b/connectivity/source/drivers/mozab/MPreparedStatement.hxx @@ -2,9 +2,9 @@ * * $RCSfile: MPreparedStatement.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: hr $ $Date: 2001-10-17 18:38:07 $ + * last change: $Author: oj $ $Date: 2001-11-26 13:51:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -60,9 +60,13 @@ ************************************************************************/ #ifndef CONNECTIVITY_SPREPAREDSTATEMENT_HXX #define CONNECTIVITY_SPREPAREDSTATEMENT_HXX + +#ifndef CONNECTIVITY_SRESULTSET_HXX #include "MResultSet.hxx" +#endif +#ifndef CONNECTIVITY_SSTATEMENT_HXX #include "MStatement.hxx" - +#endif #ifndef _COM_SUN_STAR_SDBC_XPREPAREDSTATEMENT_HPP_ #include <com/sun/star/sdbc/XPreparedStatement.hpp> #endif @@ -72,12 +76,15 @@ #ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATASUPPLIER_HPP_ #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> #endif -#ifndef _COM_SUN_STAR_SDBC_XPREPAREDBATCHEXECUTION_HPP_ -#include <com/sun/star/sdbc/XPreparedBatchExecution.hpp> -#endif #ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_ #include <com/sun/star/io/XInputStream.hpp> #endif +#ifndef _COM_SUN_STAR_SDBC_XMULTIPLERESULTS_HPP_ +#include <com/sun/star/sdbc/XMultipleResults.hpp> +#endif +#ifndef _CPPUHELPER_COMPBASE5_HXX_ +#include <cppuhelper/compbase5.hxx> +#endif namespace connectivity { @@ -87,8 +94,8 @@ namespace connectivity class OBoundParam; typedef ::cppu::ImplHelper5< ::com::sun::star::sdbc::XPreparedStatement, ::com::sun::star::sdbc::XParameters, - ::com::sun::star::sdbc::XPreparedBatchExecution, ::com::sun::star::sdbc::XResultSetMetaDataSupplier, + ::com::sun::star::sdbc::XMultipleResults, ::com::sun::star::lang::XServiceInfo> OPreparedStatement_BASE; class OPreparedStatement : public OStatement_BASE2, @@ -190,14 +197,14 @@ namespace connectivity virtual void SAL_CALL setClob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setArray( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL clearParameters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - // XPreparedBatchExecution - virtual void SAL_CALL addBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL clearBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); // XCloseable virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); // XResultSetMetaDataSupplier virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XMultipleResults + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getResultSet( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getUpdateCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getMoreResults( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); }; } } diff --git a/connectivity/source/drivers/mozab/MResultSet.cxx b/connectivity/source/drivers/mozab/MResultSet.cxx index ac216d065889..5f06f7c8a790 100644 --- a/connectivity/source/drivers/mozab/MResultSet.cxx +++ b/connectivity/source/drivers/mozab/MResultSet.cxx @@ -2,9 +2,9 @@ * * $RCSfile: MResultSet.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: vg $ $Date: 2001-11-14 18:22:14 $ + * last change: $Author: oj $ $Date: 2001-11-26 13:51:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -65,9 +65,6 @@ #ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_ #include <com/sun/star/beans/PropertyAttribute.hpp> #endif -#ifndef _COM_SUN_STAR_SDBCX_COMPAREBOOKMARK_HPP_ -#include <com/sun/star/sdbcx/CompareBookmark.hpp> -#endif #ifndef _COMPHELPER_PROPERTY_HXX_ #include <comphelper/property.hxx> #endif @@ -101,23 +98,26 @@ #ifndef _CONNECTIVITY_TSORTINDEX_HXX_ #include <TSortIndex.hxx> #endif - +#ifndef _RTL_STRING_HXX_ #include <rtl/string.hxx> +#endif #include <vector> #include <algorithm> - +#ifndef CONNECTIVITY_SRESULTSET_HXX #include "MResultSet.hxx" +#endif +#ifndef CONNECTIVITY_SRESULSETMETADATA_HXX #include "MResultSetMetaData.hxx" - +#endif #ifndef _CONNECTIVITY_FDATABASEMETADATARESULTSET_HXX_ #include "FDatabaseMetaDataResultSet.hxx" #endif -#ifdef DEBUG +#ifdef _DEBUG # define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr()) -#else /* DEBUG */ +#else /* _DEBUG */ # define OUtoCStr( x ) ("dummy") -#endif /* DEBUG */ +#endif /* _DEBUG */ using namespace ::comphelper; using namespace connectivity; @@ -127,7 +127,6 @@ using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::beans; using namespace com::sun::star::sdbc; -using namespace com::sun::star::sdbcx; using namespace com::sun::star::container; using namespace com::sun::star::io; using namespace com::sun::star::util; @@ -141,9 +140,8 @@ using namespace com::sun::star::util; // ------------------------------------------------------------------------- Sequence< ::rtl::OUString > SAL_CALL OResultSet::getSupportedServiceNames( ) throw( RuntimeException) { - Sequence< ::rtl::OUString > aSupported(2); + Sequence< ::rtl::OUString > aSupported(1); aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.ResultSet"); - aSupported[1] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.ResultSet"); return aSupported; } // ------------------------------------------------------------------------- @@ -164,24 +162,18 @@ OResultSet::OResultSet(OStatement_Base* pStmt, connectivity::OSQLParseTreeIterat ,OPropertySetHelper(OResultSet_BASE::rBHelper) ,m_aStatement((OWeakObject*)pStmt) ,m_nRowPos(0) - ,m_bLastRecord(sal_False) - ,m_bEOF(sal_False) ,m_xMetaData(NULL) - ,m_bInserting(sal_False) - ,m_nLastColumnPos(0) ,m_nIsAlwaysFalseQuery(sal_False) ,m_nParamIndex(0) ,m_nRowCountResult(-1) - ,m_nTextEncoding(pStmt->getOwnConnection()->getTextEncoding()) ,m_aQuery(pStmt->getOwnConnection()->getColumnAlias().getAliasMap()) ,m_pKeySet(NULL) ,m_pStatement(pStmt) ,m_pParseTree(_aSQLIterator.getParseTree()) ,m_aSQLIterator(_aSQLIterator) - ,m_nIsBookmarkable(sal_False) ,m_nFetchSize(0) ,m_nResultSetType(ResultSetType::SCROLL_INSENSITIVE) - ,m_nResultSetConcurrency(ResultSetConcurrency::UPDATABLE) + ,m_nResultSetConcurrency(ResultSetConcurrency::READ_ONLY) ,m_nFetchDirection(FetchDirection::FORWARD) { m_aQuery.setMaxNrOfReturns(pStmt->getOwnConnection()->getMaxResultRecords()); @@ -250,19 +242,11 @@ sal_Int32 SAL_CALL OResultSet::findColumn( const ::rtl::OUString& columnName ) t // ------------------------------------------------------------------------- Reference< XInputStream > SAL_CALL OResultSet::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - return NULL; } // ------------------------------------------------------------------------- Reference< XInputStream > SAL_CALL OResultSet::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - return NULL; } @@ -279,84 +263,49 @@ sal_Bool SAL_CALL OResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLExcep sal_Int8 SAL_CALL OResultSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - sal_Int8 nRet = 0; - return nRet; + return 0; } // ------------------------------------------------------------------------- Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - ::osl::MutexGuard aGuard( m_aMutex ); - return Sequence< sal_Int8 >(); } // ------------------------------------------------------------------------- Date SAL_CALL OResultSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - Date nRet; - return nRet; + return Date(); } // ------------------------------------------------------------------------- double SAL_CALL OResultSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - double nRet = 0; - return nRet; + return 0.0; } // ------------------------------------------------------------------------- float SAL_CALL OResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - float nVal(0); - return nVal; + return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OResultSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - sal_Int32 nRet=0; - return nRet; + return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OResultSet::getRow( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - sal_Int32 nValue = 0; OSL_TRACE("In/Out: OResultSet::getRow" ); - return nValue; + return 0; } // ------------------------------------------------------------------------- sal_Int64 SAL_CALL OResultSet::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - return sal_Int64(); } // ------------------------------------------------------------------------- @@ -374,9 +323,6 @@ Reference< XResultSetMetaData > SAL_CALL OResultSet::getMetaData( ) throw(SQLEx // ------------------------------------------------------------------------- Reference< XArray > SAL_CALL OResultSet::getArray( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - return NULL; } @@ -384,47 +330,30 @@ Reference< XArray > SAL_CALL OResultSet::getArray( sal_Int32 columnIndex ) throw Reference< XClob > SAL_CALL OResultSet::getClob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - return NULL; } // ------------------------------------------------------------------------- Reference< XBlob > SAL_CALL OResultSet::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - return NULL; } // ------------------------------------------------------------------------- Reference< XRef > SAL_CALL OResultSet::getRef( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - return NULL; } // ------------------------------------------------------------------------- Any SAL_CALL OResultSet::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - return Any(); } // ------------------------------------------------------------------------- sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - sal_Int16 nRet=0; - return nRet; + return 0; } // ------------------------------------------------------------------------- @@ -447,14 +376,6 @@ sal_uInt32 OResultSet::currentRowCount() sal_Bool OResultSet::fetchRow(sal_uInt32 rowIndex) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - ORowSetValue value; - ::rtl::OUString sTableColumnName; - Reference<XPropertySet> xTableColumn; - Reference<XIndexAccess> xNames(m_xTableColumns,UNO_QUERY); - const ::rtl::OUString sPropertyName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME); - // Check whether we've already fetched the row... if ( !(*m_aRow)[0].isNull() && (sal_Int32)(*m_aRow)[0] == (sal_Int32)rowIndex ) return sal_True; @@ -463,27 +384,21 @@ sal_Bool OResultSet::fetchRow(sal_uInt32 rowIndex) throw(SQLException, RuntimeEx return sal_False; (*m_aRow)[0] = (sal_Int32)rowIndex; - for( sal_Int32 i = 1; i < xNames->getCount(); i++ ) { - if ( (*m_aRow)[i].isBound() ) { - OSL_TRACE("Row[%d] is Bound", i ); - xNames->getByIndex(i-1) >>= xTableColumn; - OSL_ENSURE(xTableColumn.is(), "OResultSet::fetchRow: invalid table column!"); - if (xTableColumn.is()) - xTableColumn->getPropertyValue(sPropertyName) >>= sTableColumnName; - else - sTableColumnName = ::rtl::OUString(); - - OSL_TRACE("getValue : columnName is : %s ", OUtoCStr( sTableColumnName ) ); + sal_Int32 nCount = m_aColumnNames.getLength(); + for( sal_Int32 i = 1; i < nCount; i++ ) + { + if ( (*m_aRow)[i].isBound() ) + { // // Everything in the addressbook is a string! // - m_aQuery.getRowValue( value, rowIndex, sTableColumnName, DataType::VARCHAR ); - OSL_TRACE("getValue : %s returned", OUtoCStr( value ) ); - (*m_aRow)[i] = value; + m_aQuery.getRowValue( (*m_aRow)[i], rowIndex, m_aColumnNames[i-1], DataType::VARCHAR ); } +#ifdef _DEBUG else { OSL_TRACE("Row[%d] is NOT Bound", i ); } +#endif } return sal_True; } @@ -491,10 +406,8 @@ sal_Bool OResultSet::fetchRow(sal_uInt32 rowIndex) throw(SQLException, RuntimeEx const ORowSetValue& OResultSet::getValue(sal_uInt32 rowIndex, sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - if ( fetchRow( rowIndex ) == sal_False ) { + if ( fetchRow( rowIndex ) == sal_False ) + { OSL_ASSERT("fetchRow() returned False" ); m_bWasNull = sal_True; return *ODatabaseMetaDataResultSet::getEmptyValue(); @@ -509,7 +422,6 @@ const ORowSetValue& OResultSet::getValue(sal_uInt32 rowIndex, sal_Int32 columnIn ::rtl::OUString SAL_CALL OResultSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - OSL_TRACE("In/Out: OResultSet::getString" ); OSL_ENSURE(m_xColumns.isValid(), "Need the Columns!!"); OSL_ENSURE(columnIndex <= (sal_Int32)m_xColumns->size(), "Trying to access invalid columns number"); ::osl::MutexGuard aGuard( m_aMutex ); @@ -518,8 +430,8 @@ const ORowSetValue& OResultSet::getValue(sal_uInt32 rowIndex, sal_Int32 columnIn checkIndex( columnIndex ); // If this query was sorted then we should have a valid KeySet, so use it - if ( m_pKeySet.isValid() ) { - OSL_TRACE( "%u <= %u", m_nRowPos, m_pKeySet->size()); + if ( m_pKeySet.isValid() ) + { OSL_ENSURE( m_nRowPos > 0 && m_nRowPos <= m_pKeySet->size(), "Invalid Row Position"); return getValue( (*m_pKeySet)[m_nRowPos-1], mapColumn( columnIndex ) ); } @@ -531,25 +443,14 @@ const ORowSetValue& OResultSet::getValue(sal_uInt32 rowIndex, sal_Int32 columnIn Time SAL_CALL OResultSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - ::osl::MutexGuard aGuard( m_aMutex ); - - Time nRet; - return nRet; + return Time(); } // ------------------------------------------------------------------------- DateTime SAL_CALL OResultSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - ::osl::MutexGuard aGuard( m_aMutex ); - - DateTime nRet; - return nRet; + return DateTime(); } // ------------------------------------------------------------------------- @@ -571,11 +472,7 @@ sal_Bool SAL_CALL OResultSet::isAfterLast( ) throw(SQLException, RuntimeExcepti checkDisposed(OResultSet_BASE::rBHelper.bDisposed); OSL_TRACE("In/Out: OResultSet::isAfterLast" ); - if ( m_nRowPos > currentRowCount() && m_aQuery.queryComplete()) { - return sal_True; - } - - return sal_False; + return m_nRowPos > currentRowCount() && m_aQuery.queryComplete(); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSet::isFirst( ) throw(SQLException, RuntimeException) @@ -595,10 +492,7 @@ sal_Bool SAL_CALL OResultSet::isLast( ) throw(SQLException, RuntimeException) OSL_TRACE("In/Out: OResultSet::isLast" ); - if ( m_nRowPos == currentRowCount() && m_aQuery.queryComplete()) { - return sal_True; - } - return sal_False; + return m_nRowPos == currentRowCount() && m_aQuery.queryComplete(); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::beforeFirst( ) throw(SQLException, RuntimeException) @@ -637,9 +531,6 @@ void SAL_CALL OResultSet::close( ) throw(SQLException, RuntimeException) sal_Bool SAL_CALL OResultSet::first( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - OSL_TRACE("In/Out: OResultSet::first" ); return seekRow( FIRST_POS ); } @@ -647,36 +538,24 @@ sal_Bool SAL_CALL OResultSet::first( ) throw(SQLException, RuntimeException) sal_Bool SAL_CALL OResultSet::last( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - OSL_TRACE("In/Out: OResultSet::last" ); return seekRow( LAST_POS ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - OSL_TRACE("In/Out: OResultSet::absolute" ); return seekRow( ABSOLUTE_POS, row ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - OSL_TRACE("In/Out: OResultSet::relative" ); return seekRow( RELATIVE_POS, row ); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSet::previous( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - OSL_TRACE("In/Out: OResultSet::previous" ); return seekRow( PRIOR_POS ); } @@ -694,30 +573,18 @@ Reference< XInterface > SAL_CALL OResultSet::getStatement( ) throw(SQLException sal_Bool SAL_CALL OResultSet::rowDeleted( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - OSL_TRACE("In/Out: OResultSet::rowDeleted" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSet::rowInserted( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - OSL_TRACE("In/Out: OResultSet::rowInserted" ); return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSet::rowUpdated( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - OSL_TRACE("In/Out: OResultSet::rowUpdated" ); return sal_False; } @@ -725,10 +592,6 @@ sal_Bool SAL_CALL OResultSet::rowUpdated( ) throw(SQLException, RuntimeExceptio sal_Bool SAL_CALL OResultSet::next( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - OSL_TRACE("In/Out: OResultSet::next" ); return seekRow( NEXT_POS ); } // ------------------------------------------------------------------------- @@ -738,8 +601,6 @@ sal_Bool SAL_CALL OResultSet::wasNull( ) throw(SQLException, RuntimeException) ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - OSL_TRACE("In/Out: OResultSet::wasNull" ); return m_bWasNull; } // ------------------------------------------------------------------------- @@ -763,257 +624,18 @@ Any SAL_CALL OResultSet::getWarnings( ) throw(SQLException, RuntimeException) return Any(); } // ------------------------------------------------------------------------- -void SAL_CALL OResultSet::insertRow( ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - // you only have to implement this if you want to insert new rows -} -// ------------------------------------------------------------------------- -void SAL_CALL OResultSet::updateRow( ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - // only when you allow updates -} -// ------------------------------------------------------------------------- -void SAL_CALL OResultSet::deleteRow( ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); -} -// ------------------------------------------------------------------------- - -void SAL_CALL OResultSet::cancelRowUpdates( ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); -} -// ------------------------------------------------------------------------- - -void SAL_CALL OResultSet::moveToInsertRow( ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - // only when you allow insert's -} -// ------------------------------------------------------------------------- - -void SAL_CALL OResultSet::moveToCurrentRow( ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - OSL_TRACE("In/Out: OResultSet::moveToCurrentRow" ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); -} -// ------------------------------------------------------------------------- - -void SAL_CALL OResultSet::updateNull( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); -} -// ------------------------------------------------------------------------- - -void SAL_CALL OResultSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - -} -// ------------------------------------------------------------------------- -void SAL_CALL OResultSet::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(SQLException, RuntimeException) -{ - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - ::osl::MutexGuard aGuard( m_aMutex ); - -} -// ------------------------------------------------------------------------- - -void SAL_CALL OResultSet::updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - -} -// ------------------------------------------------------------------------- -void SAL_CALL OResultSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(SQLException, RuntimeException) -{ - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - ::osl::MutexGuard aGuard( m_aMutex ); - -} -// ------------------------------------------------------------------------- -void SAL_CALL OResultSet::updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - -} -// ----------------------------------------------------------------------- -void SAL_CALL OResultSet::updateFloat( sal_Int32 columnIndex, float x ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - -} -// ------------------------------------------------------------------------- - -void SAL_CALL OResultSet::updateDouble( sal_Int32 columnIndex, double x ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - -} -// ------------------------------------------------------------------------- -void SAL_CALL OResultSet::updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - -} -// ------------------------------------------------------------------------- -void SAL_CALL OResultSet::updateBytes( sal_Int32 columnIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - -} -// ------------------------------------------------------------------------- -void SAL_CALL OResultSet::updateDate( sal_Int32 columnIndex, const Date& x ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - -} -// ------------------------------------------------------------------------- - -void SAL_CALL OResultSet::updateTime( sal_Int32 columnIndex, const Time& x ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - -} -// ------------------------------------------------------------------------- - -void SAL_CALL OResultSet::updateTimestamp( sal_Int32 columnIndex, const DateTime& x ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - -} -// ------------------------------------------------------------------------- - -void SAL_CALL OResultSet::updateBinaryStream( sal_Int32 columnIndex, const Reference< XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - -} -// ------------------------------------------------------------------------- -void SAL_CALL OResultSet::updateCharacterStream( sal_Int32 columnIndex, const Reference< XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - -} -// ------------------------------------------------------------------------- void SAL_CALL OResultSet::refreshRow( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); OSL_TRACE("In/Out: OResultSet::refreshRow" ); - -} -// ------------------------------------------------------------------------- -void SAL_CALL OResultSet::updateObject( sal_Int32 columnIndex, const Any& x ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - -} -// ------------------------------------------------------------------------- - -void SAL_CALL OResultSet::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 scale ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - -} -// ------------------------------------------------------------------------- -// XRowLocate -Any SAL_CALL OResultSet::getBookmark( ) throw( SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - // if you don't want to support bookmark you must remove the XRowLocate interface - - OSL_TRACE("In/Out: OResultSet::getBookmark" ); - return Any(); -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL OResultSet::moveToBookmark( const Any& bookmark ) throw( SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - OSL_TRACE("In/Out: OResultSet::moveToBookmark" ); - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL OResultSet::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) throw( SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - OSL_TRACE("In/Out: OResultSet::moveRelativeToBookmark" ); - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Int32 SAL_CALL OResultSet::compareBookmarks( const Any& first, const Any& second ) throw( SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - OSL_TRACE("In/Out: OResultSet::compareBookmarks" ); - return CompareBookmark::NOT_EQUAL; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL OResultSet::hasOrderedBookmarks( ) throw( SQLException, RuntimeException) -{ - OSL_TRACE("In/Out: OResultSet::hasOrderedBookmarks" ); - return sal_False; -} -// ------------------------------------------------------------------------- -sal_Int32 SAL_CALL OResultSet::hashBookmark( const Any& bookmark ) throw( SQLException, RuntimeException) -{ - throw SQLException(); -} -// ------------------------------------------------------------------------- -// XDeleteRows -Sequence< sal_Int32 > SAL_CALL OResultSet::deleteRows( const Sequence< Any >& rows ) throw( SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - return Sequence< sal_Int32 >(); } // ------------------------------------------------------------------------- IPropertyArrayHelper* OResultSet::createArrayHelper( ) const { - Sequence< Property > aProps(6); + Sequence< Property > aProps(4); Property* pProperties = aProps.getArray(); sal_Int32 nPos = 0; - DECL_PROP1IMPL(CURSORNAME, ::rtl::OUString) PropertyAttribute::READONLY); DECL_PROP0(FETCHDIRECTION, sal_Int32); DECL_PROP0(FETCHSIZE, sal_Int32); - DECL_BOOL_PROP1IMPL(ISBOOKMARKABLE) PropertyAttribute::READONLY); DECL_PROP1IMPL(RESULTSETCONCURRENCY,sal_Int32) PropertyAttribute::READONLY); DECL_PROP1IMPL(RESULTSETTYPE, sal_Int32) PropertyAttribute::READONLY); @@ -1034,8 +656,6 @@ sal_Bool OResultSet::convertFastPropertyValue( { switch(nHandle) { - case PROPERTY_ID_ISBOOKMARKABLE: - case PROPERTY_ID_CURSORNAME: case PROPERTY_ID_RESULTSETCONCURRENCY: case PROPERTY_ID_RESULTSETTYPE: throw ::com::sun::star::lang::IllegalArgumentException(); @@ -1056,8 +676,6 @@ void OResultSet::setFastPropertyValue_NoBroadcast( { switch(nHandle) { - case PROPERTY_ID_ISBOOKMARKABLE: - case PROPERTY_ID_CURSORNAME: case PROPERTY_ID_RESULTSETCONCURRENCY: case PROPERTY_ID_RESULTSETTYPE: throw Exception(); @@ -1078,13 +696,6 @@ void OResultSet::getFastPropertyValue( { switch(nHandle) { - case PROPERTY_ID_ISBOOKMARKABLE: - // rValue = bool2any(isBookmarkable()); - rValue = bool2any(m_nIsBookmarkable); - break; - case PROPERTY_ID_CURSORNAME: - // rValue <<= getCursorName(); - break; case PROPERTY_ID_RESULTSETCONCURRENCY: rValue <<= (sal_Int32)m_nResultSetConcurrency; break; @@ -1143,17 +754,20 @@ void OResultSet::parseParameter( const OSQLParseNode* pNode, rtl::OUString& rMat } // XXX - Now we know name, what's value???? m_nParamIndex ++; - OSL_TRACE("Parameter name [%d]: %s\n", m_nParamIndex, - OUtoCStr(aParameterName) ); + OSL_TRACE("Parameter name [%d]: %s\n", m_nParamIndex,OUtoCStr(aParameterName) ); if ( m_aParameterRow.isValid() ) { OSL_ENSURE( m_nParamIndex < (sal_Int32)m_aParameterRow->size() + 1, "More parameters than values found" ); rMatchString = (*m_aParameterRow)[(sal_uInt16)m_nParamIndex]; +#ifdef _DEBUG OSL_TRACE("Prop Value : %s\n", OUtoCStr( rMatchString ) ); +#endif } +#ifdef _DEBUG else { OSL_TRACE("Prop Value : Invalid ParameterRow!\n" ); } +#endif } void OResultSet::analyseWhereClause( const OSQLParseNode* parseTree, @@ -1180,11 +794,15 @@ void OResultSet::analyseWhereClause( const OSQLParseNode* parseT OSL_TRACE("Prop Column Name : %s\n", OUtoCStr( aColName ) ); if ( m_aParameterRow.isValid() ) { aParameterValue = (*m_aParameterRow)[(sal_uInt16)i]; +#ifdef _DEBUG OSL_TRACE("Prop Value : %s\n", OUtoCStr( aParameterValue ) ); +#endif } +#ifdef _DEBUG else { OSL_TRACE("Prop Value : Invalid ParameterRow!\n" ); } +#endif i++; } } @@ -1449,8 +1067,6 @@ void OResultSet::analyseWhereClause( const OSQLParseNode* parseT void OResultSet::fillRowData() throw( ::com::sun::star::sdbc::SQLException ) { - OSL_TRACE( "IN OResultSet::fillRowData()\n" ); - OSL_ENSURE( m_pStatement, "Require a statement" ); MQueryExpression queryExpression; @@ -1464,10 +1080,13 @@ void OResultSet::fillRowData() const ::rtl::OUString sProprtyName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME); ::rtl::OUString sName; m_aAttributeStrings.clear(); + m_aAttributeStrings.reserve(m_xColumns->size()); for (sal_Int32 i = 1; aIter != m_xColumns->end();++aIter, i++) { (*aIter)->getPropertyValue(sProprtyName) >>= sName; +#ifdef _DEBUG OSL_TRACE("Query Columns : (%d) %s\n", i, OUtoCStr(sName) ); +#endif m_aAttributeStrings.push_back( sName ); } @@ -1526,19 +1145,23 @@ void OResultSet::fillRowData() ::dbtools::throwGenericSQLException( ::rtl::OUString::createFromAscii("Error querying addressbook"),NULL); } - +#ifdef _DEBUG OSL_TRACE( "executeQuery returned %d\n", rv ); OSL_TRACE( "\tOUT OResultSet::fillRowData()\n" ); +#endif } // ----------------------------------------------------------------------------- -static sal_Bool matchRow( OValueRow& row1, OValueRow& row2 ) { +static sal_Bool matchRow( OValueRow& row1, OValueRow& row2 ) +{ OValueVector::iterator row1Iter = row1->begin(); OValueVector::iterator row2Iter = row2->begin(); for ( ++row1Iter,++row2Iter; // the first column is the bookmark column - row1Iter != row1->end(); ++row1Iter,++row2Iter) { - if ( row1Iter->isBound()) { + row1Iter != row1->end(); ++row1Iter,++row2Iter) + { + if ( row1Iter->isBound()) + { // Compare values, if at anytime there's a mismatch return false if ( !( (*row1Iter) == (*row2Iter) ) ) return sal_False; @@ -1598,8 +1221,7 @@ void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLExcep sal_Bool bDistinct = sal_False; sal_Bool bWasSorted = sal_False; OSQLParseNode *pDistinct = m_pParseTree->getChild(1); - if (pDistinct && pDistinct->getTokenID() == SQL_TOKEN_DISTINCT -) + if (pDistinct && pDistinct->getTokenID() == SQL_TOKEN_DISTINCT) { if(!IsSorted()) { @@ -1665,8 +1287,10 @@ void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLExcep m_pSortIndex = new OSortIndex(eKeyType,m_aOrderbyAscending); OSL_TRACE("OrderbyColumnNumber->size() = %d",m_aOrderbyColumnNumber.size()); +#ifdef _DEBUG for ( sal_uInt32 i = 0; i < m_aColMapping.size(); i++ ) OSL_TRACE("Mapped: %d -> %d", i, m_aColMapping[i] ); +#endif for ( sal_Int32 nRow = 1; nRow <= m_aQuery.getRowCount(); nRow++ ) { OKeyValue* pKeyValue = new OKeyValue(nRow); @@ -1674,10 +1298,9 @@ void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLExcep ::std::vector<sal_Int32>::iterator aIter = m_aOrderbyColumnNumber.begin(); for (;aIter != m_aOrderbyColumnNumber.end(); ++aIter) { - ORowSetValue value = getValue(nRow, *aIter); + const ORowSetValue& value = getValue(nRow, *aIter); - OSL_TRACE( "Adding Value: (%d,%d) : %s", nRow, *aIter, - OUtoCStr( value )); + OSL_TRACE( "Adding Value: (%d,%d) : %s", nRow, *aIter,OUtoCStr( value )); pKeyValue->pushKey(new ORowSetValueDecorator(value)); } @@ -1686,23 +1309,29 @@ void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLExcep } m_pKeySet = m_pSortIndex->CreateKeySet(); +#ifdef _DEBUG for( i = 0; i < m_pKeySet->size(); i++ ) OSL_TRACE("Sorted: %d -> %d", i, (*m_pKeySet)[i] ); +#endif m_pSortIndex = NULL; beforeFirst(); // Go back to start } // Handle the DISTINCT case - if ( bDistinct && m_pKeySet.isValid() ) { + if ( bDistinct && m_pKeySet.isValid() ) + { OValueRow aSearchRow = new OValueVector( m_aRow->size() ); - for( i = 0; i < m_pKeySet->size(); i++ ) { + for( i = 0; i < m_pKeySet->size(); i++ ) + { fetchRow( (*m_pKeySet)[i] ); // Fills m_aRow - if ( matchRow( m_aRow, aSearchRow ) ) { + if ( matchRow( m_aRow, aSearchRow ) ) + { (*m_pKeySet)[i] = 0; // Marker for later to be removed } - else { + else + { // They don't match, so it's not a duplicate. // Use the current Row as the next one to match against *aSearchRow = *m_aRow; @@ -1743,8 +1372,9 @@ void OResultSet::setBoundedColumns(const OValueRow& _rRow, const ::rtl::OUString sName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME); const ::rtl::OUString sRealName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_REALNAME); - const ::rtl::OUString sType = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE); + ::std::vector< ::rtl::OUString> aColumnNames; + aColumnNames.reserve(_rxColumns->size()); OValueVector::iterator aRowIter = _rRow->begin()+1; for (sal_Int32 i=0; // the first column is the bookmark column aRowIter != _rRow->end(); @@ -1763,15 +1393,22 @@ void OResultSet::setBoundedColumns(const OValueRow& _rRow, // look if we have such a select column // TODO: would like to have a O(log n) search here ... + sal_Int32 nColumnPos = 0; for ( OSQLColumns::iterator aIter = _rxColumns->begin(); aIter != _rxColumns->end(); - ++aIter + ++aIter,++nColumnPos ) { - if((*aIter)->getPropertySetInfo()->hasPropertyByName(sRealName)) - (*aIter)->getPropertyValue(sRealName) >>= sSelectColumnRealName; + if(nColumnPos < aColumnNames.size()) + sSelectColumnRealName = aColumnNames[nColumnPos]; else - (*aIter)->getPropertyValue(sName) >>= sSelectColumnRealName; + { + if((*aIter)->getPropertySetInfo()->hasPropertyByName(sRealName)) + (*aIter)->getPropertyValue(sRealName) >>= sSelectColumnRealName; + else + (*aIter)->getPropertyValue(sName) >>= sSelectColumnRealName; + aColumnNames.push_back(sSelectColumnRealName); + } if (aCase(sTableColumnName, sSelectColumnRealName)) { @@ -1782,15 +1419,14 @@ void OResultSet::setBoundedColumns(const OValueRow& _rRow, sal_Int32 nTableColumnPos = i + 1; // get first table column is the bookmark column // ... +#ifdef _DEBUG OSL_TRACE("Set Col Mapping: %d -> %d", nSelectColumnPos, nTableColumnPos ); +#endif _rColMapping[nSelectColumnPos] = nTableColumnPos; } aRowIter->setBound(sal_True); - sal_Int32 nType = DataType::OTHER; - if (xTableColumn.is()) - xTableColumn->getPropertyValue(sType) >>= nType; - aRowIter->setTypeKind(nType); + aRowIter->setTypeKind(DataType::VARCHAR); } } } @@ -1806,10 +1442,9 @@ void OResultSet::setBoundedColumns(const OValueRow& _rRow, 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) -&& + 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) ); } @@ -1823,7 +1458,9 @@ sal_Bool OResultSet::validRow( sal_uInt32 nRow ) sal_Int32 nNumberOfRecords = m_aQuery.getRealRowCount(); while ( nRow > (sal_uInt32)nNumberOfRecords && !m_aQuery.queryComplete() ) { +#ifdef _DEBUG OSL_TRACE("validRow: waiting..."); +#endif m_aQuery.checkRowAvailable( nRow ); nNumberOfRecords = m_aQuery.getRealRowCount(); } @@ -1833,13 +1470,17 @@ sal_Bool OResultSet::validRow( sal_uInt32 nRow ) OSL_TRACE("validRow(%u): return False", nRow); return sal_False; } - +#ifdef _DEBUG OSL_TRACE("validRow(%u): return True", nRow); +#endif return sal_True; } // ----------------------------------------------------------------------------- sal_Bool OResultSet::seekRow( eRowPosition pos, sal_Int32 nOffset ) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + sal_Int32 nNumberOfRecords = currentRowCount(); sal_Int32 nCurPos = m_nRowPos; @@ -1897,7 +1538,10 @@ sal_Bool OResultSet::seekRow( eRowPosition pos, sal_Int32 nOffset ) void OResultSet::setColumnMapping(const ::std::vector<sal_Int32>& _aColumnMapping) { m_aColMapping = _aColumnMapping; +#ifdef _DEBUG for ( sal_uInt32 i = 0; i < m_aColMapping.size(); i++ ) OSL_TRACE("Set Mapped: %d -> %d", i, m_aColMapping[i] ); +#endif } +// ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/mozab/MResultSet.hxx b/connectivity/source/drivers/mozab/MResultSet.hxx index 84493f10026f..2fdeb268b981 100644 --- a/connectivity/source/drivers/mozab/MResultSet.hxx +++ b/connectivity/source/drivers/mozab/MResultSet.hxx @@ -2,9 +2,9 @@ * * $RCSfile: MResultSet.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: dkenny $ $Date: 2001-11-07 10:49:56 $ + * last change: $Author: oj $ $Date: 2001-11-26 13:51:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -82,25 +82,15 @@ #ifndef _COM_SUN_STAR_SDBC_XWARNINGSSUPPLIER_HPP_ #include <com/sun/star/sdbc/XWarningsSupplier.hpp> #endif -#ifndef _COM_SUN_STAR_SDBC_XRESULTSETUPDATE_HPP_ -#include <com/sun/star/sdbc/XResultSetUpdate.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XROWUPDATE_HPP_ -#include <com/sun/star/sdbc/XRowUpdate.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XROWLOCATE_HPP_ -#include <com/sun/star/sdbcx/XRowLocate.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XDELETEROWS_HPP_ -#include <com/sun/star/sdbcx/XDeleteRows.hpp> -#endif -#ifndef _CPPUHELPER_COMPBASE12_HXX_ -#include <cppuhelper/compbase12.hxx> +#ifndef _CPPUHELPER_COMPBASE8_HXX_ +#include <cppuhelper/compbase8.hxx> #endif #ifndef _COMPHELPER_PROPERTY_ARRAY_HELPER_HXX_ #include <comphelper/proparrhlp.hxx> #endif +#ifndef CONNECTIVITY_SSTATEMENT_HXX #include "MStatement.hxx" +#endif #ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ #include "connectivity/CommonTools.hxx" #endif @@ -123,15 +113,11 @@ namespace connectivity /* ** java_sql_ResultSet */ - typedef ::cppu::WeakComponentImplHelper12< ::com::sun::star::sdbc::XResultSet, + typedef ::cppu::WeakComponentImplHelper8< ::com::sun::star::sdbc::XResultSet, ::com::sun::star::sdbc::XRow, ::com::sun::star::sdbc::XResultSetMetaDataSupplier, ::com::sun::star::util::XCancellable, ::com::sun::star::sdbc::XWarningsSupplier, - ::com::sun::star::sdbc::XResultSetUpdate, - ::com::sun::star::sdbc::XRowUpdate, - ::com::sun::star::sdbcx::XRowLocate, - ::com::sun::star::sdbcx::XDeleteRows, ::com::sun::star::sdbc::XCloseable, ::com::sun::star::sdbc::XColumnLocate, ::com::sun::star::lang::XServiceInfo> OResultSet_BASE; @@ -147,23 +133,11 @@ namespace connectivity public ::comphelper::OPropertyArrayUsageHelper<OResultSet> { protected: - TVoidVector m_aBindVector; - ::std::vector<sal_Int32> m_aLengthVector; OStatement_Base* m_pStatement; ::com::sun::star::uno::WeakReferenceHelper m_aStatement; ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData> m_xMetaData; - rtl_TextEncoding m_nTextEncoding; sal_uInt32 m_nRowPos; - sal_Int32 m_nLastColumnPos; // used for m_aRow just to know where we are sal_Bool m_bWasNull; - sal_Bool m_bBOF; // before first record - sal_Bool m_bEOF; // after last record - sal_Bool m_bLastRecord; - sal_Bool m_bFreeHandle; - sal_Bool m_bInserting; - sal_Bool m_bFetchData; // true when SQLGetaData can be called in any order or when fetching data for m_aRow - - sal_Bool m_nIsBookmarkable; sal_Int32 m_nFetchSize; sal_Int32 m_nResultSetType; sal_Int32 m_nFetchDirection; @@ -174,23 +148,6 @@ namespace connectivity connectivity::OSQLParseTreeIterator& m_aSQLIterator; const connectivity::OSQLParseNode* m_pParseTree; - // sal_Bool isBookmarkable() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - // sal_Int32 getResultSetConcurrency() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - // sal_Int32 getResultSetType() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - // sal_Int32 getFetchDirection() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - // sal_Int32 getFetchSize() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - // ::rtl::OUString getCursorName() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - - // void setFetchDirection(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - // void setFetchSize(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - - - // void fillRow(sal_Int32 _nToColumn); - // void allocBuffer(sal_Bool _bAllocRow); - // void releaseBuffer(); - - - // OPropertyArrayUsageHelper virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; // OPropertySetHelper @@ -284,44 +241,8 @@ namespace connectivity // XWarningsSupplier virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - // XResultSetUpdate - virtual void SAL_CALL insertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL deleteRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL cancelRowUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL moveToCurrentRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - // XRowUpdate - virtual void SAL_CALL updateNull( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateFloat( sal_Int32 columnIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateDouble( sal_Int32 columnIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateBytes( sal_Int32 columnIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateBinaryStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateCharacterStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateNumericObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); // XColumnLocate virtual sal_Int32 SAL_CALL findColumn( const ::rtl::OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - // XRowLocate - virtual ::com::sun::star::uno::Any SAL_CALL getBookmark( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL moveToBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL moveRelativeToBookmark( const ::com::sun::star::uno::Any& bookmark, sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL compareBookmarks( const ::com::sun::star::uno::Any& first, const ::com::sun::star::uno::Any& second ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL hasOrderedBookmarks( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL hashBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - // 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); - - protected: MQuery m_aQuery; OTable* m_pTable; @@ -332,6 +253,7 @@ protected: ::std::vector<sal_Int32> m_aColMapping; // pos 0 is unused so we don't have to decrement 1 everytime ::std::vector<sal_Int32> m_aOrderbyColumnNumber; ::std::vector<sal_Int16> m_aOrderbyAscending; + ::com::sun::star::uno::Sequence< ::rtl::OUString> m_aColumnNames; OValueRow m_aRow; OValueRow m_aParameterRow; ::std::vector< ::rtl::OUString> m_aAttributeStrings; @@ -378,9 +300,13 @@ public: ::com::sun::star::uno::RuntimeException); void setTable(OTable* _rTable) - { m_pTable = _rTable; m_pTable->acquire(); - m_xTableColumns = m_pTable->getColumns(); - } + { + m_pTable = _rTable; + m_pTable->acquire(); + m_xTableColumns = m_pTable->getColumns(); + if(m_xTableColumns.is()) + m_aColumnNames = m_xTableColumns->getElementNames(); + } void setParameterRow(const OValueRow& _rParaRow) { m_aParameterRow = _rParaRow; } diff --git a/connectivity/source/drivers/mozab/MResultSetMetaData.cxx b/connectivity/source/drivers/mozab/MResultSetMetaData.cxx index cfc823a40753..9990907396d3 100644 --- a/connectivity/source/drivers/mozab/MResultSetMetaData.cxx +++ b/connectivity/source/drivers/mozab/MResultSetMetaData.cxx @@ -2,9 +2,9 @@ * * $RCSfile: MResultSetMetaData.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $ + * last change: $Author: oj $ $Date: 2001-11-26 13:51:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -73,7 +73,12 @@ #ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ #include <cppuhelper/typeprovider.hxx> #endif +#ifndef CONNECTIVITY_SRESULSETMETADATA_HXX #include "MResultSetMetaData.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ +#include <com/sun/star/sdbc/DataType.hpp> +#endif using namespace connectivity::mozab; using namespace com::sun::star::uno; @@ -103,8 +108,7 @@ sal_Int32 SAL_CALL OResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) sal_Int32 SAL_CALL OResultSetMetaData::getColumnType( sal_Int32 column ) throw(SQLException, RuntimeException) { - checkColumnIndex(column); - return getINT32((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))); + return DataType::VARCHAR; // at the moment there exists only this type } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/mozab/MResultSetMetaData.hxx b/connectivity/source/drivers/mozab/MResultSetMetaData.hxx index 6dcbab103a10..5d909af120e9 100644 --- a/connectivity/source/drivers/mozab/MResultSetMetaData.hxx +++ b/connectivity/source/drivers/mozab/MResultSetMetaData.hxx @@ -2,9 +2,9 @@ * * $RCSfile: MResultSetMetaData.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $ + * last change: $Author: oj $ $Date: 2001-11-26 13:51:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -67,16 +67,17 @@ #ifndef _CPPUHELPER_IMPLBASE1_HXX_ #include <cppuhelper/implbase1.hxx> #endif -#ifndef INCLUDED_VECTOR #include <vector> -#define INCLUDED_VECTOR -#endif #ifndef _VOS_REF_HXX_ #include <vos/ref.hxx> #endif +#ifndef CONNECTIVITY_SCONNECTION_HXX #include "MConnection.hxx" +#endif +#ifndef _CONNECTIVITY_MOZAB_TABLE_HXX_ #include "MTable.hxx" +#endif namespace connectivity { @@ -101,7 +102,7 @@ namespace connectivity // OResultSetMetaData(OConnection* _pConnection) : m_pConnection(_pConnection){} OResultSetMetaData(const ::vos::ORef<connectivity::OSQLColumns>& _rxColumns, const ::rtl::OUString& _aTableName,OTable* _pTable) - : m_xColumns(_rxColumns), m_aTableName(_aTableName), m_pTable(_pTable) {} + : m_xColumns(_rxColumns), m_aTableName(_aTableName), m_pTable(_pTable){} /// Avoid ambigous cast error from the compiler. diff --git a/connectivity/source/drivers/mozab/MStatement.cxx b/connectivity/source/drivers/mozab/MStatement.cxx index 92fb27180a4f..1c0fb48e9afa 100644 --- a/connectivity/source/drivers/mozab/MStatement.cxx +++ b/connectivity/source/drivers/mozab/MStatement.cxx @@ -2,9 +2,9 @@ * * $RCSfile: MStatement.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: dkenny $ $Date: 2001-11-07 10:49:56 $ + * last change: $Author: oj $ $Date: 2001-11-26 13:51:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -108,16 +108,24 @@ #include <algorithm> +#ifndef CONNECTIVITY_SDRIVER_HXX #include "MDriver.hxx" +#endif +#ifndef CONNECTIVITY_SSTATEMENT_HXX #include "MStatement.hxx" +#endif +#ifndef CONNECTIVITY_SCONNECTION_HXX #include "MConnection.hxx" +#endif +#ifndef CONNECTIVITY_SRESULTSET_HXX #include "MResultSet.hxx" +#endif -#ifdef DEBUG +#ifdef _DEBUG # define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr()) -#else /* DEBUG */ +#else /* _DEBUG */ # define OUtoCStr( x ) ("dummy") -#endif /* DEBUG */ +#endif /* _DEBUG */ using namespace ::comphelper; @@ -128,7 +136,6 @@ using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::beans; using namespace com::sun::star::sdbc; -using namespace com::sun::star::sdbcx; using namespace com::sun::star::container; using namespace com::sun::star::io; using namespace com::sun::star::util; @@ -196,15 +203,6 @@ Sequence< Type > SAL_CALL OStatement_Base::getTypes( ) throw(RuntimeException) return ::comphelper::concatSequences(aTypes.getTypes(),OStatement_BASE::getTypes()); } // ------------------------------------------------------------------------- - -void SAL_CALL OStatement_Base::cancel( ) throw(RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OStatement_BASE::rBHelper.bDisposed); - // cancel the current sql statement -} -// ------------------------------------------------------------------------- - void SAL_CALL OStatement_Base::close( ) throw(SQLException, RuntimeException) { { @@ -244,13 +242,6 @@ void OStatement_Base::clearMyResultSet () throw (SQLException) m_xResultSet = Reference< XResultSet>(); } // ------------------------------------------------------------------------- - -void SAL_CALL OStatement::clearBatch( ) throw(SQLException, RuntimeException) -{ - // if you support batches clear it here -} -// ------------------------------------------------------------------------- - void OStatement_Base::parseSql( const ::rtl::OUString& sql ) throw ( SQLException, RuntimeException ) { @@ -260,7 +251,7 @@ void OStatement_Base::parseSql( const ::rtl::OUString& sql ) m_pParseTree = m_aParser.parseTree(aErr,sql); -#ifdef DEBUG +#ifdef _DEBUG { const char* str = OUtoCStr(sql); OSL_TRACE("ParseSQL: %s\n", OUtoCStr( sql ) ); @@ -276,10 +267,12 @@ void OStatement_Base::parseSql( const ::rtl::OUString& sql ) ::dbtools::throwGenericSQLException(::rtl::OUString::createFromAscii("Driver requires a single table to be specified in query"),NULL); // at this moment we support only one table per select statement +#ifdef _DEBUG OSQLTables::const_iterator citer; for( citer = xTabs.begin(); citer != xTabs.end(); ++citer ) { OSL_TRACE("SELECT Table : %s\n", OUtoCStr(citer->first) ); } +#endif OSL_ENSURE( xTabs.begin() != xTabs.end(), "Need a Table"); @@ -358,73 +351,20 @@ Reference< XConnection > SAL_CALL OStatement_Base::getConnection( ) throw(SQLEx return (Reference< XConnection >)m_pConnection; } // ----------------------------------------------------------------------------- -sal_Int32 SAL_CALL OStatement_Base::getUpdateCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -{ - return 0; -} -// ------------------------------------------------------------------------- - Any SAL_CALL OStatement::queryInterface( const Type & rType ) throw(RuntimeException) { - Any aRet = ::cppu::queryInterface(rType,static_cast< XBatchExecution*> (this)); + Any aRet = ::cppu::queryInterface(rType,static_cast< XServiceInfo*> (this)); if(!aRet.hasValue()) aRet = OStatement_Base::queryInterface(rType); return aRet; } // ------------------------------------------------------------------------- - -void SAL_CALL OStatement::addBatch( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OStatement_BASE::rBHelper.bDisposed); - - - m_aBatchList.push_back(sql); -} -// ------------------------------------------------------------------------- -Sequence< sal_Int32 > SAL_CALL OStatement::executeBatch( ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OStatement_BASE::rBHelper.bDisposed); - - return Sequence< sal_Int32 >(); -} -// ------------------------------------------------------------------------- - - sal_Int32 SAL_CALL OStatement_Base::executeUpdate( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OStatement_BASE::rBHelper.bDisposed); - - // the return values gives information about how many rows are affected by executing the sql statement return 0; } // ------------------------------------------------------------------------- - -Reference< XResultSet > SAL_CALL OStatement_Base::getResultSet( ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OStatement_BASE::rBHelper.bDisposed); - -// return our save resultset here - return m_xResultSet; -} -// ------------------------------------------------------------------------- - -sal_Bool SAL_CALL OStatement_Base::getMoreResults( ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OStatement_BASE::rBHelper.bDisposed); - - // if your driver supports more than only one resultset - // and has one more at this moment return true - return sal_False; -} -// ------------------------------------------------------------------------- - -// ------------------------------------------------------------------------- Any SAL_CALL OStatement_Base::getWarnings( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); @@ -449,7 +389,7 @@ void SAL_CALL OStatement_Base::clearWarnings( ) throw(SQLException, RuntimeExce { // this properties are define by the service resultset // they must in alphabetic order - Sequence< Property > aProps(10); + Sequence< Property > aProps(9); Property* pProperties = aProps.getArray(); sal_Int32 nPos = 0; DECL_PROP0(CURSORNAME, ::rtl::OUString); @@ -461,7 +401,6 @@ void SAL_CALL OStatement_Base::clearWarnings( ) throw(SQLException, RuntimeExce DECL_PROP0(QUERYTIMEOUT,sal_Int32); DECL_PROP0(RESULTSETCONCURRENCY,sal_Int32); DECL_PROP0(RESULTSETTYPE,sal_Int32); - DECL_BOOL_PROP0(USEBOOKMARKS); return new ::cppu::OPropertyArrayHelper(aProps); } @@ -492,13 +431,11 @@ void OStatement_Base::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const A case PROPERTY_ID_QUERYTIMEOUT: case PROPERTY_ID_MAXFIELDSIZE: case PROPERTY_ID_MAXROWS: - case PROPERTY_ID_CURSORNAME: case PROPERTY_ID_RESULTSETCONCURRENCY: case PROPERTY_ID_RESULTSETTYPE: case PROPERTY_ID_FETCHDIRECTION: case PROPERTY_ID_FETCHSIZE: case PROPERTY_ID_ESCAPEPROCESSING: - case PROPERTY_ID_USEBOOKMARKS: default: ; } @@ -511,13 +448,11 @@ void OStatement_Base::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const case PROPERTY_ID_QUERYTIMEOUT: case PROPERTY_ID_MAXFIELDSIZE: case PROPERTY_ID_MAXROWS: - case PROPERTY_ID_CURSORNAME: case PROPERTY_ID_RESULTSETCONCURRENCY: case PROPERTY_ID_RESULTSETTYPE: case PROPERTY_ID_FETCHDIRECTION: case PROPERTY_ID_FETCHSIZE: case PROPERTY_ID_ESCAPEPROCESSING: - case PROPERTY_ID_USEBOOKMARKS: default: ; } @@ -562,11 +497,15 @@ void OStatement_Base::createColumnMapping() Reference<XIndexAccess> xNames(m_xColNames,UNO_QUERY); // now check which columns are bound +#ifdef _DEBUG for ( i = 0; i < m_aColMapping.size(); i++ ) OSL_TRACE("BEFORE Mapped: %d -> %d", i, m_aColMapping[i] ); +#endif OResultSet::setBoundedColumns(m_aRow,xColumns,xNames,sal_True,m_xDBMetaData,m_aColMapping); +#ifdef _DEBUG for ( i = 0; i < m_aColMapping.size(); i++ ) OSL_TRACE("AFTER Mapped: %d -> %d", i, m_aColMapping[i] ); +#endif } // ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/mozab/MStatement.hxx b/connectivity/source/drivers/mozab/MStatement.hxx index 5894f3869f78..bb39ecebd23c 100644 --- a/connectivity/source/drivers/mozab/MStatement.hxx +++ b/connectivity/source/drivers/mozab/MStatement.hxx @@ -2,9 +2,9 @@ * * $RCSfile: MStatement.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: hr $ $Date: 2001-10-17 18:38:07 $ + * last change: $Author: oj $ $Date: 2001-11-26 13:51:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -67,9 +67,6 @@ #ifndef _COM_SUN_STAR_SDBC_XWARNINGSSUPPLIER_HPP_ #include <com/sun/star/sdbc/XWarningsSupplier.hpp> #endif -#ifndef _COM_SUN_STAR_SDBC_XMULTIPLERESULTS_HPP_ -#include <com/sun/star/sdbc/XMultipleResults.hpp> -#endif #ifndef _COM_SUN_STAR_SDBC_XBATCHEXECUTION_HPP_ #include <com/sun/star/sdbc/XBatchExecution.hpp> #endif @@ -79,14 +76,11 @@ #ifndef _COM_SUN_STAR_SDBC_SQLWARNING_HPP_ #include <com/sun/star/sdbc/SQLWarning.hpp> #endif -#ifndef _COM_SUN_STAR_UTIL_XCANCELLABLE_HPP_ -#include <com/sun/star/util/XCancellable.hpp> -#endif #ifndef _COMPHELPER_PROPERTY_ARRAY_HELPER_HXX_ #include <comphelper/proparrhlp.hxx> #endif -#ifndef _CPPUHELPER_COMPBASE5_HXX_ -#include <cppuhelper/compbase5.hxx> +#ifndef _CPPUHELPER_COMPBASE3_HXX_ +#include <cppuhelper/compbase3.hxx> #endif #ifndef _COMPHELPER_UNO3_HXX_ #include <comphelper/uno3.hxx> @@ -122,11 +116,9 @@ namespace connectivity { class OResultSet; - typedef ::cppu::WeakComponentImplHelper5< ::com::sun::star::sdbc::XStatement, + typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::sdbc::XStatement, ::com::sun::star::sdbc::XWarningsSupplier, - ::com::sun::star::util::XCancellable, - ::com::sun::star::sdbc::XCloseable, - ::com::sun::star::sdbc::XMultipleResults> OStatement_BASE; + ::com::sun::star::sdbc::XCloseable> OStatement_BASE; //************************************************************** //************ Class: OStatement_Base @@ -228,15 +220,8 @@ namespace connectivity // XWarningsSupplier virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - // XCancellable - virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException); // XCloseable virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - // XMultipleResults - virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getResultSet( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getUpdateCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL getMoreResults( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - }; class OStatement_BASE2 :public OStatement_Base @@ -254,7 +239,6 @@ namespace connectivity }; class OStatement : public OStatement_BASE2, - public ::com::sun::star::sdbc::XBatchExecution, public ::com::sun::star::lang::XServiceInfo { protected: @@ -267,10 +251,6 @@ namespace connectivity 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(); virtual void SAL_CALL release() throw(); - // XBatchExecution - virtual void SAL_CALL addBatch( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL clearBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); }; } } diff --git a/connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx b/connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx index bfac7a4276dc..840b6972451a 100644 --- a/connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx +++ b/connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx @@ -2,9 +2,9 @@ * * $RCSfile: MNSInclude.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: vg $ $Date: 2001-11-13 15:39:38 $ + * last change: $Author: oj $ $Date: 2001-11-26 13:52:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -74,13 +74,13 @@ // Turn off DEBUG Assertions -#ifdef DEBUG -# define MOZ_TMP_UDEBUG DEBUG -# undef DEBUG +#ifdef _DEBUG +# define MOZ_TMP_UDEBUG _DEBUG +# undef _DEBUG #endif #include <nsDebug.h> #ifdef MOZ_TMP_UDEBUG -# define DEBUG MOZ_TMP_UDEBUG +# define _DEBUG MOZ_TMP_UDEBUG #endif #include <xp_core.h> diff --git a/connectivity/source/drivers/mozab/mozillasrc/MNameMapper.cxx b/connectivity/source/drivers/mozab/mozillasrc/MNameMapper.cxx index 002c014787ce..02d0899b9e17 100644 --- a/connectivity/source/drivers/mozab/mozillasrc/MNameMapper.cxx +++ b/connectivity/source/drivers/mozab/mozillasrc/MNameMapper.cxx @@ -2,9 +2,9 @@ * * $RCSfile: MNameMapper.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: mmaher $ $Date: 2001-10-31 17:24:23 $ + * last change: $Author: oj $ $Date: 2001-11-26 13:52:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -62,11 +62,11 @@ #include <MNameMapper.hxx> -#ifdef DEBUG +#ifdef _DEBUG # define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr()) -#else /* DEBUG */ +#else /* _DEBUG */ # define OUtoCStr( x ) ("dummy") -#endif /* DEBUG */ +#endif /* _DEBUG */ using namespace connectivity::mozab; diff --git a/connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx b/connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx index b229dea2761e..296c903261f6 100644 --- a/connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx +++ b/connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx @@ -2,9 +2,9 @@ * * $RCSfile: MQuery.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: dkenny $ $Date: 2001-11-15 10:01:12 $ + * last change: $Author: oj $ $Date: 2001-11-26 13:52:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -73,11 +73,11 @@ #include "MTypeConverter.hxx" #endif -#ifdef DEBUG +#ifdef _DEBUG # define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr()) -#else /* DEBUG */ +#else /* _DEBUG */ # define OUtoCStr( x ) ("dummy") -#endif /* DEBUG */ +#endif /* _DEBUG */ static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); static NS_DEFINE_CID(kAbDirectoryQueryArgumentsCID, NS_ABDIRECTORYQUERYARGUMENTS_CID); @@ -200,8 +200,6 @@ void MQuery::setAddressbook(::rtl::OUString &ab) m_aAddressbook = ab; OSL_TRACE("\tOUT MQuery::setAddressbook()\n"); - - return; } // ------------------------------------------------------------------------- ::rtl::OUString MQuery::getAddressbook() const @@ -220,8 +218,6 @@ void MQuery::setMaxNrOfReturns(const sal_Int32 mnr) m_nMaxNrOfReturns = mnr; OSL_TRACE("\tOUT MQuery::setMaxNrOfReturns()\n" ); - - return; } // ------------------------------------------------------------------------- sal_Int32 MQuery::getMaxNrOfReturns() const @@ -240,8 +236,6 @@ void MQuery::setQuerySubDirs(sal_Bool &qsd) m_bQuerySubDirs = qsd; OSL_TRACE("\tOUT MQuery::setQuerySubDirs()\n"); - - return; } // ------------------------------------------------------------------------- sal_Bool MQuery::getQuerySubDirs() const @@ -288,7 +282,7 @@ static sal_Int32 generateExpression( MQuery* _aQuery, MQueryExpression* _aExpr, // Set the 'name' property of the boolString. // Check if it's an alias first... rtl::OUString attrName; - ::std::map< ::rtl::OUString, ::rtl::OUString>::iterator aIterMap; + ::std::map< ::rtl::OUString, ::rtl::OUString>::const_iterator aIterMap; aIterMap = _aQuery->getColumnAliasMap().find(evStr->getName()); if (aIterMap == _aQuery->getColumnAliasMap().end()) { // Not found. @@ -423,7 +417,7 @@ sal_Int32 MQuery::executeQuery(sal_Bool _bIsOutlookExpress, OConnection* _pCon) NS_ENSURE_SUCCESS(rv, rv); OSL_TRACE("Using the directoryQueryProxy\n"); } -#ifdef DEBUG +#ifdef _DEBUG else OSL_TRACE("Not using a Query Proxy, Query i/f supported by directory\n"); #endif /* DEBUG */ @@ -443,7 +437,9 @@ sal_Int32 MQuery::executeQuery(sal_Bool _bIsOutlookExpress, OConnection* _pCon) { ::std::string aAttrName = MTypeConverter::ouStringToStlString(*aIterAttr); returnProperties[count] = strdup( aAttrName.c_str() ); +#ifdef _DEBUG OSL_TRACE("returnProperties[%d] = %s\n", count, returnProperties[count] ); +#endif } returnProperties[count] = NULL; @@ -469,6 +465,7 @@ sal_Int32 MQuery::executeQuery(sal_Bool _bIsOutlookExpress, OConnection* _pCon) for ( sal_Int32 j = 0; returnProperties && returnProperties[j]; j++ ) { free( returnProperties[j] ); // use free for mem allocated with strdup() } + delete [] returnProperties; if (NS_FAILED(rv)) { m_aQueryDirectory->contextId = -1; @@ -476,9 +473,12 @@ sal_Int32 MQuery::executeQuery(sal_Bool _bIsOutlookExpress, OConnection* _pCon) OSL_TRACE("\tOUT MQuery::executeQuery()\n"); m_aQueryHelper->notifyQueryError() ; return(-1); - } else { + } +#ifdef _DEBUG + else { OSL_TRACE( "****** DoQuery succeeded \n"); } +#endif OSL_TRACE("\tOUT MQuery::executeQuery()\n"); @@ -545,12 +545,8 @@ MQuery::checkRowAvailable( sal_Int32 nDBRow ) // ------------------------------------------------------------------------- sal_Bool -MQuery::getRowValue( ORowSetValue& rValue, sal_Int32 nDBRow, rtl::OUString& aDBColumnName, sal_Int32 nType ) +MQuery::getRowValue( ORowSetValue& rValue, sal_Int32 nDBRow,const rtl::OUString& aDBColumnName, sal_Int32 nType ) const { - rtl::OUString sValue; - - OSL_TRACE( "IN MQuery::getRowValue()\n"); - MQueryHelperResultEntry* xResEntry = m_aQueryHelper->getByIndex( nDBRow, m_aErrorString ); OSL_ENSURE( xResEntry != NULL, "xResEntry == NULL"); @@ -560,24 +556,22 @@ MQuery::getRowValue( ORowSetValue& rValue, sal_Int32 nDBRow, rtl::OUString& aDBC rValue.setNull(); return sal_False; } - ::std::map< ::rtl::OUString, ::rtl::OUString>::const_iterator aIterMap; - switch ( nType ) { + switch ( nType ) + { case DataType::VARCHAR: - aIterMap = m_aColumnAliasMap.find(aDBColumnName); - if (aIterMap != m_aColumnAliasMap.end()) { - sValue = xResEntry->getValue(aIterMap->second); - } else { - sValue = xResEntry->getValue( aDBColumnName ); + { + ::std::map< ::rtl::OUString, ::rtl::OUString>::const_iterator aIterMap = m_aColumnAliasMap.find(aDBColumnName); + if (aIterMap != m_aColumnAliasMap.end()) + rValue = xResEntry->getValue(aIterMap->second); + else + rValue = xResEntry->getValue( aDBColumnName ); } - rValue = sValue; break; default: - OSL_TRACE("Unknown DataType : %d\n", nType ); rValue.setNull(); break; } - OSL_TRACE( "\tOUT MQuery::getRowValue()\n"); return sal_True; } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx b/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx index 1ec00c965e6c..2625220f8dc0 100644 --- a/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx +++ b/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx @@ -2,9 +2,9 @@ * * $RCSfile: MQuery.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: dkenny $ $Date: 2001-11-15 10:01:12 $ + * last change: $Author: oj $ $Date: 2001-11-26 13:52:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -239,8 +239,8 @@ namespace connectivity MQueryExpression m_aExpr; ::std::map< ::rtl::OUString, ::rtl::OUString> m_aColumnAliasMap; - ::rtl::OUString m_aErrorString; - sal_Bool m_aErrorOccurred; + mutable ::rtl::OUString m_aErrorString; + mutable sal_Bool m_aErrorOccurred; void construct(); protected: @@ -257,8 +257,8 @@ namespace connectivity void setAddressbook( ::rtl::OUString&); ::rtl::OUString getAddressbook(void) const; - ::std::map< ::rtl::OUString, - ::rtl::OUString> &getColumnAliasMap() { return m_aColumnAliasMap; } + const ::std::map< ::rtl::OUString,::rtl::OUString>& + getColumnAliasMap() const { return m_aColumnAliasMap; } void setExpression( MQueryExpression &_expr ); @@ -281,8 +281,9 @@ namespace connectivity sal_Bool checkRowAvailable( sal_Int32 nDBRow ); sal_Bool getRowValue( connectivity::ORowSetValue& rValue, - sal_Int32 nDBRow, rtl::OUString& aDBColumnName, - sal_Int32 nType ); + sal_Int32 nDBRow, + const rtl::OUString& aDBColumnName, + sal_Int32 nType ) const; public: MQuery(); diff --git a/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx b/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx index 3acdabe33b49..539d99f0e9b4 100644 --- a/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx +++ b/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx @@ -2,9 +2,9 @@ * * $RCSfile: MQueryHelper.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: dkenny $ $Date: 2001-11-15 10:01:12 $ + * last change: $Author: oj $ $Date: 2001-11-26 13:52:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -69,6 +69,7 @@ using namespace connectivity::mozab; + NS_IMPL_THREADSAFE_ISUPPORTS1(connectivity::mozab::MQueryHelper,nsIAbDirectoryQueryResultListener) // @@ -244,18 +245,24 @@ MQueryHelper::getByIndex( sal_Int32 nRow, ::rtl::OUString& _rError ) // Obtain the Mutex - don't use a guard as we want to be able to release // and acquire again... m_aMutex.acquire(); - if ( nRow > m_aResults.size() ) { - if ( m_bQueryComplete ) { + if ( nRow > m_aResults.size() ) + { + if ( m_bQueryComplete ) + { m_bAtEnd = sal_True; m_aMutex.release(); return( NULL ); - } else { + } + else + { clearResultOrComplete(); m_aMutex.release(); if ( !waitForResultOrComplete( _rError ) ) return( NULL ); } - } else { + } + else + { m_aMutex.release(); return( m_aResults[ nRow -1 ] ); } diff --git a/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.cxx b/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.cxx index 7c3384baf073..8104bb652139 100644 --- a/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.cxx +++ b/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.cxx @@ -2,9 +2,9 @@ * * $RCSfile: MTypeConverter.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: mmaher $ $Date: 2001-11-07 16:55:18 $ + * last change: $Author: oj $ $Date: 2001-11-26 13:52:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -73,8 +73,6 @@ using namespace connectivity::mozab; // ------------------------------------------------------------------------- void MTypeConverter::ouStringToNsString(::rtl::OUString const &ous, nsString &nss) { - OSL_TRACE( "IN MTypeConverter::OUStringToNsString()\n" ); - // Convert to ::rtl::OString (utf-8 encoding). ::rtl::OString os(ous,ous.getLength(), RTL_TEXTENCODING_UTF8); @@ -84,14 +82,10 @@ void MTypeConverter::ouStringToNsString(::rtl::OUString const &ous, nsString &ns NS_ConvertUTF8toUCS2 mozString(cs, csLen); //const PRUnichar* uniMozString = (const PRUnichar*) mozString; nss = mozString; // temp. - - OSL_TRACE( "\tOUT MTypeConverter::OUStringToNsString()\n" ); } // ------------------------------------------------------------------------- void MTypeConverter::nsStringToOUString(nsString const &nss, ::rtl::OUString &ous) { - OSL_TRACE( "IN MTypeConverter::nsStringToOUString()\n" ); - // Get clone of buffer. PRUnichar *uc = ToNewUnicode(nss); sal_Int32 nssLen = nss.Length(); @@ -101,72 +95,50 @@ void MTypeConverter::nsStringToOUString(nsString const &nss, ::rtl::OUString &ou ous = _ous; nsMemory::Free(uc); - - OSL_TRACE( "\tOUT MTypeConverter::nsStringToOUString()\n" ); } // ------------------------------------------------------------------------- void MTypeConverter::prUnicharToOUString(PRUnichar const *pru, ::rtl::OUString &ous) { - OSL_TRACE( "IN MTypeConverter::prUniCharToOUString()\n" ); - // TODO, specify length. ::rtl::OUString _ous(pru); ous = _ous; - - OSL_TRACE( "\tOUT MTypeConverter::prUniCharToOUString()\n" ); } // ------------------------------------------------------------------------- char *MTypeConverter::ouStringToCCharStringUtf8(::rtl::OUString const &ous) { - OSL_TRACE( "IN MTypeConverter::OUStringToCCharStringUtf8()\n" ); - // Convert to ::rtl::OString, ::rtl::OString os(ous,ous.getLength(), RTL_TEXTENCODING_UTF8); const char *cs = os.getStr(); - OSL_TRACE( "\tOUT MTypeConverter::OUStringToCCharStringUtf8()\n" ); return(strdup(cs)); } // ------------------------------------------------------------------------- char *MTypeConverter::ouStringToCCharStringAscii(::rtl::OUString const &ous) { - OSL_TRACE( "IN MTypeConverter::OUStringToCCharStringAscii()\n" ); - // Convert ::rtl::OUString to ::rtl::OString, ::rtl::OString os(ous,ous.getLength(), RTL_TEXTENCODING_ASCII_US); - OSL_TRACE( "\tOUT MTypeConverter::OUStringToCCharStringAscii()\n" ); return(strdup(os.getStr())); } // ------------------------------------------------------------------------- char *MTypeConverter::nsStringToCCharStringAscii(nsString const &nss) { - OSL_TRACE( "IN MTypeConverter::nsStringToCCharStringAscii()\n" ); - char cs[1024]; nss.ToCString(cs, 1024); - OSL_TRACE( "\tOUT MTypeConverter::nsStringToCCharStringAscii()\n" ); return(strdup(cs)); } // ------------------------------------------------------------------------- ::std::string MTypeConverter::ouStringToStlString(::rtl::OUString const &ous) { - OSL_TRACE( "IN MTypeConverter::ouStringToStlString()\n" ); - // Convert ::rtl::OUString to ::rtl::OString. ::rtl::OString os(ous,ous.getLength(),RTL_TEXTENCODING_ASCII_US); - - OSL_TRACE( "\tOUT MTypeConverter::ouStringToStlString()\n" ); return( ::std::string(os.getStr())); } // ------------------------------------------------------------------------- ::std::string MTypeConverter::nsStringToStlString(nsString const &nss) { - OSL_TRACE( "IN MTypeConverter::nsStringToStlString()\n" ); - - OSL_TRACE( "\tOUT MTypeConverter::nsStringToStlString()\n" ); return( ::std::string(nss.GetBuffer())); } // ------------------------------------------------------------------------- |