Tag: cws_src680_kaddrbook User: ebischoff Date: 05/09/01 19:42:05 Modified: /dba/connectivity/source/drivers/kab/ KConnection.cxx, KConnection.hxx, KPreparedStatement.cxx, KPreparedStatement.hxx
Log: Simplifying File Changes: Directory: /dba/connectivity/source/drivers/kab/ ================================================ File [changed]: KConnection.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/kab/KConnection.cxx?r1=1.1.2.1&r2=1.1.2.2 Delta lines: +3 -50 -------------------- --- KConnection.cxx 29 Aug 2005 08:43:48 -0000 1.1.2.1 +++ KConnection.cxx 2 Sep 2005 02:42:02 -0000 1.1.2.2 @@ -1,8 +1,8 @@ /************************************************************************* * - * $Revision: 1.1.2.1 $ + * $Revision: 1.1.2.2 $ * - * last change: $Author: ebischoff $ $Date: 2005/08/29 08:43:48 $ + * last change: $Author: ebischoff $ $Date: 2005/09/02 02:42:02 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -151,13 +151,9 @@ ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(KabConnection_BASE::rBHelper.bDisposed); - // the pre - if (m_aTypeInfo.empty()) - buildTypeInfo(); - // create a statement // the statement can only be executed more than once - Reference< XPreparedStatement > xReturn = new KabPreparedStatement(this, m_aTypeInfo, _sSql); + Reference< XPreparedStatement > xReturn = new KabPreparedStatement(this, _sSql); m_aStatements.push_back(WeakReferenceHelper(xReturn)); return xReturn; } @@ -333,49 +329,6 @@ void SAL_CALL KabConnection::clearWarnings( ) throw(SQLException, RuntimeException) { // you should clear your collected warnings here -} -//-------------------------------------------------------------------- -void KabConnection::buildTypeInfo() throw(SQLException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - Reference< XResultSet> xRs = getMetaData()->getTypeInfo(); - Reference< XRow> xRow(xRs, UNO_QUERY); - // Information for a single SQL type - - // Loop on the result set until we reach end of file - - while (xRs->next()) - { - OTypeInfo aInfo; - aInfo.aTypeName = xRow->getString (1); - aInfo.nType = xRow->getShort (2); - aInfo.nPrecision = xRow->getInt (3); - aInfo.aLiteralPrefix = xRow->getString (4); - aInfo.aLiteralSuffix = xRow->getString (5); - aInfo.aCreateParams = xRow->getString (6); - aInfo.bNullable = xRow->getBoolean (7) == ColumnValue::NULLABLE; - aInfo.bCaseSensitive = xRow->getBoolean (8); - aInfo.nSearchType = xRow->getShort (9); - aInfo.bUnsigned = xRow->getBoolean (10); - aInfo.bCurrency = xRow->getBoolean (11); - aInfo.bAutoIncrement = xRow->getBoolean (12); - aInfo.aLocalTypeName = xRow->getString (13); - aInfo.nMinimumScale = xRow->getShort (14); - aInfo.nMaximumScale = xRow->getShort (15); - aInfo.nNumPrecRadix = (sal_Int16) xRow->getInt(18); - - // Now that we have the type info, save it - // in the Hashtable if we don't already have an - // entry for this SQL type. - - m_aTypeInfo.push_back(aInfo); - } - - // Close the result set/statement. - - Reference< XCloseable> xClose(xRs, UNO_QUERY); - xClose->close(); } //------------------------------------------------------------------------------ void KabConnection::disposing() File [changed]: KConnection.hxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/kab/KConnection.hxx?r1=1.1.2.1&r2=1.1.2.2 Delta lines: +2 -5 ------------------- --- KConnection.hxx 29 Aug 2005 08:43:48 -0000 1.1.2.1 +++ KConnection.hxx 2 Sep 2005 02:42:02 -0000 1.1.2.2 @@ -2,9 +2,9 @@ * * $RCSfile: KConnection.hxx,v $ * - * $Revision: 1.1.2.1 $ + * $Revision: 1.1.2.2 $ * - * last change: $Author: ebischoff $ $Date: 2005/08/29 08:43:48 $ + * last change: $Author: ebischoff $ $Date: 2005/09/02 02:42:02 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -146,9 +146,6 @@ sal_Bool m_bClosed; sal_Bool m_bUseCatalog; // should we use the catalog on filebased databases sal_Bool m_bUseOldDateFormat; - - - void buildTypeInfo() throw( ::com::sun::star::sdbc::SQLException); public: virtual void construct( const ::rtl::OUString& url,const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info) throw(::com::sun::star::sdbc::SQLException); File [changed]: KPreparedStatement.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/kab/KPreparedStatement.cxx?r1=1.1.2.3&r2=1.1.2.4 Delta lines: +7 -50 -------------------- --- KPreparedStatement.cxx 1 Sep 2005 17:11:30 -0000 1.1.2.3 +++ KPreparedStatement.cxx 2 Sep 2005 02:42:02 -0000 1.1.2.4 @@ -2,9 +2,9 @@ * * $RCSfile: KPreparedStatement.cxx,v $ * - * $Revision: 1.1.2.3 $ + * $Revision: 1.1.2.4 $ * - * last change: $Author: ebischoff $ $Date: 2005/09/01 17:11:30 $ + * last change: $Author: ebischoff $ $Date: 2005/09/02 02:42:02 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -80,46 +80,17 @@ IMPLEMENT_SERVICE_INFO(KabPreparedStatement,"com.sun.star.sdbcx.kab.PreparedStatement","com.sun.star.sdbc.PreparedStatement"); - KabPreparedStatement::KabPreparedStatement( KabConnection* _pConnection, - const TTypeInfoVector& _TypeInfo, const ::rtl::OUString& sql) - : KabCommonStatement(_pConnection), - m_aTypeInfo(_TypeInfo), + : KabPreparedStatement_BASE(_pConnection), m_bPrepared(sal_False), - m_sSqlStatement(sql), - m_nNumParams(0) + m_sSqlStatement(sql) { } -// ----------------------------------------------------------------------------- -KabPreparedStatement::~KabPreparedStatement() -{ -} -// ----------------------------------------------------------------------------- -void SAL_CALL KabPreparedStatement::acquire() throw() -{ - KabCommonStatement::acquire(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL KabPreparedStatement::release() throw() -{ - KabCommonStatement::release(); -} -// ----------------------------------------------------------------------------- -Any SAL_CALL KabPreparedStatement::queryInterface(const Type & rType) throw(RuntimeException) -{ - Any aRet = KabCommonStatement::queryInterface(rType); - if (!aRet.hasValue()) - aRet = KabPreparedStatement_BASE::queryInterface(rType); - return aRet; -} // ------------------------------------------------------------------------- -::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL KabPreparedStatement::getTypes() throw(::com::sun::star::uno::RuntimeException) +KabPreparedStatement::~KabPreparedStatement() { - return comphelper::concatSequences( - KabPreparedStatement_BASE::getTypes(), - KabCommonStatement::getTypes()); } // ------------------------------------------------------------------------- Reference< XResultSetMetaData > SAL_CALL KabPreparedStatement::getMetaData() throw(SQLException, RuntimeException) @@ -345,19 +316,6 @@ { } // ------------------------------------------------------------------------- -void SAL_CALL KabPreparedStatement::clearBatch() throw(SQLException, RuntimeException) -{ -} -// ------------------------------------------------------------------------- -void SAL_CALL KabPreparedStatement::addBatch() throw(SQLException, RuntimeException) -{ -} -// ------------------------------------------------------------------------- -Sequence< sal_Int32 > SAL_CALL KabPreparedStatement::executeBatch() throw(SQLException, RuntimeException) -{ - return Sequence< sal_Int32 > (); -} -// ------------------------------------------------------------------------- void KabPreparedStatement::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) throw (Exception) { switch (nHandle) @@ -377,7 +335,6 @@ // ----------------------------------------------------------------------------- void KabPreparedStatement::checkParameterIndex(sal_Int32 _parameterIndex) { - if (!_parameterIndex || _parameterIndex > m_nNumParams) + // no parameters allowed in this implementation throw SQLException(); } -// ----------------------------------------------------------------------------- File [changed]: KPreparedStatement.hxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/kab/KPreparedStatement.hxx?r1=1.1.2.3&r2=1.1.2.4 Delta lines: +19 -32 --------------------- --- KPreparedStatement.hxx 1 Sep 2005 17:11:30 -0000 1.1.2.3 +++ KPreparedStatement.hxx 2 Sep 2005 02:42:03 -0000 1.1.2.4 @@ -2,9 +2,9 @@ * * $RCSfile: KPreparedStatement.hxx,v $ * - * $Revision: 1.1.2.3 $ + * $Revision: 1.1.2.4 $ * - * last change: $Author: ebischoff $ $Date: 2005/09/01 17:11:30 $ + * last change: $Author: ebischoff $ $Date: 2005/09/02 02:42:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -72,6 +72,9 @@ #ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATASUPPLIER_HPP_ #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> #endif +#ifndef _CPPUHELPER_IMPLBASE4_HXX_ +#include <cppuhelper/implbase4.hxx> +#endif namespace connectivity { @@ -79,13 +82,13 @@ { class OBoundParam; - typedef ::cppu::ImplHelper4< ::com::sun::star::sdbc::XPreparedStatement, + typedef ::cppu::ImplInheritanceHelper4< KabCommonStatement, + ::com::sun::star::sdbc::XPreparedStatement, ::com::sun::star::sdbc::XParameters, ::com::sun::star::sdbc::XResultSetMetaDataSupplier, ::com::sun::star::lang::XServiceInfo> KabPreparedStatement_BASE; - class KabPreparedStatement : public KabCommonStatement, - public KabPreparedStatement_BASE + class KabPreparedStatement : public KabPreparedStatement_BASE { protected: struct Parameter @@ -104,13 +107,6 @@ //==================================================================== // Data attributes //==================================================================== - TTypeInfoVector m_aTypeInfo; // Hashtable containing an entry - // for each row returned by - // DatabaseMetaData.getTypeInfo. - - sal_Int32 m_nNumParams; // Number of parameter markers - // for the prepared statement - ::rtl::OUString m_sSqlStatement; ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > m_xMetaData; sal_Bool m_bPrepared; @@ -118,26 +114,21 @@ void checkParameterIndex(sal_Int32 _parameterIndex); protected: - virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, - const ::com::sun::star::uno::Any& rValue) - throw (::com::sun::star::uno::Exception); + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue) throw (::com::sun::star::uno::Exception); virtual ~KabPreparedStatement(); + public: DECLARE_SERVICE_INFO(); - KabPreparedStatement( KabConnection* _pConnection,const TTypeInfoVector& _TypeInfo,const ::rtl::OUString& sql); - - //XInterface - virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL acquire() throw(); - virtual void SAL_CALL release() throw(); - //XTypeProvider - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + KabPreparedStatement(KabConnection* _pConnection, const ::rtl::OUString& sql); // XPreparedStatement virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); virtual sal_Int32 SAL_CALL executeUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); virtual sal_Bool SAL_CALL execute( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XParameters virtual void SAL_CALL setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); @@ -162,10 +153,6 @@ 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); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
