[Libreoffice-commits] core.git: 5 commits - connectivity/Library_firebird_sdbc.mk connectivity/source
Andrzej J.R. Hunt
andrzej at ahunt.org
Tue Jul 23 10:33:12 PDT 2013
connectivity/Library_firebird_sdbc.mk | 1
connectivity/source/drivers/firebird/FConnection.hxx | 6
connectivity/source/drivers/firebird/FDatabaseMetaData.hxx | 6
connectivity/source/drivers/firebird/FDriver.hxx | 6
connectivity/source/drivers/firebird/FPreparedStatement.cxx | 78 +-
connectivity/source/drivers/firebird/FPreparedStatement.hxx | 19
connectivity/source/drivers/firebird/FResultSet.cxx | 2
connectivity/source/drivers/firebird/FResultSet.hxx | 10
connectivity/source/drivers/firebird/FResultSetMetaData.hxx | 6
connectivity/source/drivers/firebird/FStatement.cxx | 386 -----------
connectivity/source/drivers/firebird/FStatement.hxx | 166 +---
connectivity/source/drivers/firebird/FSubComponent.hxx | 6
connectivity/source/drivers/firebird/StatementCommonBase.cxx | 351 ++++++++++
connectivity/source/drivers/firebird/StatementCommonBase.hxx | 148 ++++
14 files changed, 643 insertions(+), 548 deletions(-)
New commits:
commit cacb32caabee56cb32cdb54e54dcb8229f9205d3
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date: Tue Jul 23 19:04:33 2013 +0200
Clean up naming of OStatement_Base etc. (firebird-sdbc)
Change-Id: I4cb81565ae2fa6efd434e6e789f16fab90d0ae4a
diff --git a/connectivity/source/drivers/firebird/FConnection.hxx b/connectivity/source/drivers/firebird/FConnection.hxx
index b746c74..ff8ee91f 100644
--- a/connectivity/source/drivers/firebird/FConnection.hxx
+++ b/connectivity/source/drivers/firebird/FConnection.hxx
@@ -70,7 +70,7 @@ namespace connectivity
::com::sun::star::document::XDocumentEventListener
> OConnection_BASE;
- class OStatement_Base;
+ class OStatementCommonBase;
class FirebirdDriver;
class ODatabaseMetaData;
diff --git a/connectivity/source/drivers/firebird/FPreparedStatement.cxx b/connectivity/source/drivers/firebird/FPreparedStatement.cxx
index c7a08f8..acda520 100644
--- a/connectivity/source/drivers/firebird/FPreparedStatement.cxx
+++ b/connectivity/source/drivers/firebird/FPreparedStatement.cxx
@@ -72,7 +72,7 @@ IMPLEMENT_SERVICE_INFO(OPreparedStatement,"com.sun.star.sdbcx.firebird.PreparedS
OPreparedStatement::OPreparedStatement( OConnection* _pConnection,
const TTypeInfoVector& _TypeInfo,
const OUString& sql)
- :OStatement_Base(_pConnection)
+ :OStatementCommonBase(_pConnection)
,m_aTypeInfo(_TypeInfo)
,m_sSqlStatement(sql)
,m_statementHandle(0)
@@ -87,7 +87,7 @@ void OPreparedStatement::ensurePrepared()
throw (SQLException)
{
MutexGuard aGuard(m_pConnection->getMutex());
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
if (m_statementHandle)
return;
@@ -161,34 +161,35 @@ OPreparedStatement::~OPreparedStatement()
void SAL_CALL OPreparedStatement::acquire() throw()
{
- OStatement_Base::acquire();
+ OStatementCommonBase::acquire();
}
void SAL_CALL OPreparedStatement::release() throw()
{
- OStatement_Base::release();
+ OStatementCommonBase::release();
}
Any SAL_CALL OPreparedStatement::queryInterface(const Type& rType)
throw(RuntimeException)
{
- Any aRet = OStatement_Base::queryInterface(rType);
+ Any aRet = OStatementCommonBase::queryInterface(rType);
if(!aRet.hasValue())
- aRet = OPreparedStatement_BASE::queryInterface(rType);
+ aRet = OPreparedStatement_Base::queryInterface(rType);
return aRet;
}
uno::Sequence< Type > SAL_CALL OPreparedStatement::getTypes()
throw(RuntimeException)
{
- return OPreparedStatement_BASE::getTypes();
+ return concatSequences(OPreparedStatement_Base::getTypes(),
+ OStatementCommonBase::getTypes());
}
Reference< XResultSetMetaData > SAL_CALL OPreparedStatement::getMetaData()
throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_pConnection->getMutex() );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
// TODO: implement
// if(!m_xMetaData.is())
@@ -202,21 +203,21 @@ void SAL_CALL OPreparedStatement::close() throw(SQLException, RuntimeException)
SAL_INFO("connectivity.firebird", "close()");
MutexGuard aGuard( m_pConnection->getMutex() );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
if (m_statementHandle)
{
// TODO: implement
}
- OStatement_Base::close();
+ OStatementCommonBase::close();
}
sal_Bool SAL_CALL OPreparedStatement::execute()
throw(SQLException, RuntimeException)
{
MutexGuard aGuard( m_pConnection->getMutex() );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
// TODO: implement
return sal_False;
@@ -226,7 +227,7 @@ sal_Int32 SAL_CALL OPreparedStatement::executeUpdate()
throw(SQLException, RuntimeException)
{
MutexGuard aGuard( m_pConnection->getMutex() );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
// TODO: implement
return 0;
@@ -241,7 +242,7 @@ void SAL_CALL OPreparedStatement::setString(sal_Int32 nParameterIndex,
"x: " << x);
MutexGuard aGuard( m_pConnection->getMutex() );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
ensurePrepared();
checkParameterIndex(nParameterIndex);
@@ -277,7 +278,7 @@ Reference< XConnection > SAL_CALL OPreparedStatement::getConnection()
throw(SQLException, RuntimeException)
{
MutexGuard aGuard( m_pConnection->getMutex() );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
return Reference< XConnection >(m_pConnection);
}
@@ -289,7 +290,7 @@ Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery()
"Got called with sql: " << m_sSqlStatement);
MutexGuard aGuard( m_pConnection->getMutex() );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
ensurePrepared();
ISC_STATUS aErr;
@@ -322,7 +323,7 @@ void SAL_CALL OPreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool
(void) parameterIndex;
(void) x;
::osl::MutexGuard aGuard( m_pConnection->getMutex() );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
}
// -------------------------------------------------------------------------
@@ -331,7 +332,7 @@ void SAL_CALL OPreparedStatement::setByte( sal_Int32 parameterIndex, sal_Int8 x
(void) parameterIndex;
(void) x;
::osl::MutexGuard aGuard( m_pConnection->getMutex() );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
}
@@ -342,7 +343,7 @@ void SAL_CALL OPreparedStatement::setDate( sal_Int32 parameterIndex, const Date&
(void) parameterIndex;
(void) aData;
::osl::MutexGuard aGuard( m_pConnection->getMutex() );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
}
// -------------------------------------------------------------------------
@@ -353,7 +354,7 @@ void SAL_CALL OPreparedStatement::setTime( sal_Int32 parameterIndex, const Time&
(void) parameterIndex;
(void) aVal;
::osl::MutexGuard aGuard( m_pConnection->getMutex() );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
}
// -------------------------------------------------------------------------
@@ -363,7 +364,7 @@ void SAL_CALL OPreparedStatement::setTimestamp( sal_Int32 parameterIndex, const
(void) parameterIndex;
(void) aVal;
::osl::MutexGuard aGuard( m_pConnection->getMutex() );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
}
// -------------------------------------------------------------------------
@@ -373,7 +374,7 @@ void SAL_CALL OPreparedStatement::setDouble( sal_Int32 parameterIndex, double x
(void) parameterIndex;
(void) x;
::osl::MutexGuard aGuard( m_pConnection->getMutex() );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
}
@@ -384,7 +385,7 @@ void SAL_CALL OPreparedStatement::setFloat( sal_Int32 parameterIndex, float x )
(void) parameterIndex;
(void) x;
::osl::MutexGuard aGuard( m_pConnection->getMutex() );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
}
// -------------------------------------------------------------------------
@@ -394,7 +395,7 @@ void SAL_CALL OPreparedStatement::setInt( sal_Int32 parameterIndex, sal_Int32 x
(void) parameterIndex;
(void) x;
::osl::MutexGuard aGuard( m_pConnection->getMutex() );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
}
// -------------------------------------------------------------------------
@@ -404,7 +405,7 @@ void SAL_CALL OPreparedStatement::setLong( sal_Int32 parameterIndex, sal_Int64 a
(void) parameterIndex;
(void) aVal;
::osl::MutexGuard aGuard( m_pConnection->getMutex() );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
}
// -------------------------------------------------------------------------
@@ -414,7 +415,7 @@ void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 s
(void) parameterIndex;
(void) sqlType;
::osl::MutexGuard aGuard( m_pConnection->getMutex() );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
}
// -------------------------------------------------------------------------
@@ -424,7 +425,7 @@ void SAL_CALL OPreparedStatement::setClob( sal_Int32 parameterIndex, const Refer
(void) parameterIndex;
(void) x;
::osl::MutexGuard aGuard( m_pConnection->getMutex() );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
}
// -------------------------------------------------------------------------
@@ -434,7 +435,7 @@ void SAL_CALL OPreparedStatement::setBlob( sal_Int32 parameterIndex, const Refer
(void) parameterIndex;
(void) x;
::osl::MutexGuard aGuard( m_pConnection->getMutex() );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
}
// -------------------------------------------------------------------------
@@ -444,7 +445,7 @@ void SAL_CALL OPreparedStatement::setArray( sal_Int32 parameterIndex, const Refe
(void) parameterIndex;
(void) x;
::osl::MutexGuard aGuard( m_pConnection->getMutex() );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
}
// -------------------------------------------------------------------------
@@ -454,7 +455,7 @@ void SAL_CALL OPreparedStatement::setRef( sal_Int32 parameterIndex, const Refere
(void) parameterIndex;
(void) x;
::osl::MutexGuard aGuard( m_pConnection->getMutex() );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
}
// -------------------------------------------------------------------------
@@ -465,7 +466,7 @@ void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, c
(void) x;
(void) sqlType;
(void) scale;
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
::osl::MutexGuard aGuard( m_pConnection->getMutex() );
}
@@ -477,7 +478,7 @@ void SAL_CALL OPreparedStatement::setObjectNull( sal_Int32 parameterIndex, sal_I
(void) sqlType;
(void) typeName;
::osl::MutexGuard aGuard( m_pConnection->getMutex() );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
}
// -------------------------------------------------------------------------
@@ -487,7 +488,7 @@ void SAL_CALL OPreparedStatement::setObject( sal_Int32 parameterIndex, const Any
(void) parameterIndex;
(void) x;
::osl::MutexGuard aGuard( m_pConnection->getMutex() );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
}
// -------------------------------------------------------------------------
@@ -497,7 +498,7 @@ void SAL_CALL OPreparedStatement::setShort( sal_Int32 parameterIndex, sal_Int16
(void) parameterIndex;
(void) x;
::osl::MutexGuard aGuard( m_pConnection->getMutex() );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
}
// -------------------------------------------------------------------------
@@ -507,7 +508,7 @@ void SAL_CALL OPreparedStatement::setBytes( sal_Int32 parameterIndex, const Sequ
(void) parameterIndex;
(void) x;
::osl::MutexGuard aGuard( m_pConnection->getMutex() );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
}
// -------------------------------------------------------------------------
@@ -519,7 +520,7 @@ void SAL_CALL OPreparedStatement::setCharacterStream( sal_Int32 parameterIndex,
(void) x;
(void) length;
::osl::MutexGuard aGuard( m_pConnection->getMutex() );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
}
// -------------------------------------------------------------------------
@@ -530,7 +531,7 @@ void SAL_CALL OPreparedStatement::setBinaryStream( sal_Int32 parameterIndex, con
(void) x;
(void) length;
::osl::MutexGuard aGuard( m_pConnection->getMutex() );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
}
// -------------------------------------------------------------------------
@@ -567,7 +568,7 @@ void OPreparedStatement::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,cons
case PROPERTY_ID_USEBOOKMARKS:
break;
default:
- OStatement_Base::setFastPropertyValue_NoBroadcast(nHandle,rValue);
+ OStatementCommonBase::setFastPropertyValue_NoBroadcast(nHandle,rValue);
}
}
diff --git a/connectivity/source/drivers/firebird/FPreparedStatement.hxx b/connectivity/source/drivers/firebird/FPreparedStatement.hxx
index b7f4a96..d43fbe3 100644
--- a/connectivity/source/drivers/firebird/FPreparedStatement.hxx
+++ b/connectivity/source/drivers/firebird/FPreparedStatement.hxx
@@ -58,10 +58,10 @@ namespace connectivity
::com::sun::star::sdbc::XParameters,
::com::sun::star::sdbc::XPreparedBatchExecution,
::com::sun::star::sdbc::XResultSetMetaDataSupplier,
- ::com::sun::star::lang::XServiceInfo> OPreparedStatement_BASE;
+ ::com::sun::star::lang::XServiceInfo> OPreparedStatement_Base;
- class OPreparedStatement : public OStatement_Base,
- public OPreparedStatement_BASE
+ class OPreparedStatement : public OStatementCommonBase,
+ public OPreparedStatement_Base
{
protected:
struct Parameter
diff --git a/connectivity/source/drivers/firebird/FStatement.cxx b/connectivity/source/drivers/firebird/FStatement.cxx
index 0bf7067..0469c6c 100644
--- a/connectivity/source/drivers/firebird/FStatement.cxx
+++ b/connectivity/source/drivers/firebird/FStatement.cxx
@@ -38,6 +38,7 @@
#include "FResultSet.hxx"
#include "Util.hxx"
+#include <comphelper/sequence.hxx>
#include <osl/diagnose.h>
#include <osl/thread.h>
#include <rtl/ustrbuf.hxx>
@@ -84,20 +85,12 @@ IMPLEMENT_SERVICE_INFO(OStatement,"com.sun.star.sdbcx.OStatement","com.sun.star.
void SAL_CALL OStatement::acquire() throw()
{
- OStatement_Base::acquire();
+ OStatementCommonBase::acquire();
}
void SAL_CALL OStatement::release() throw()
{
- OStatement_Base::release();
-}
-
-Any SAL_CALL OStatement::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- Any aRet = ::cppu::queryInterface(rType,static_cast< XBatchExecution*> (this));
- if(!aRet.hasValue())
- aRet = OStatement_Base::queryInterface(rType);
- return aRet;
+ OStatementCommonBase::release();
}
// ---- XStatement -----------------------------------------------------------
@@ -106,7 +99,7 @@ sal_Int32 SAL_CALL OStatement::executeUpdate(const OUString& sqlIn)
{
// TODO: close ResultSet if existing -- so so in all 3 execute methods.
MutexGuard aGuard(m_pConnection->getMutex());
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
const OUString sql = sanitizeSqlString(sqlIn);
@@ -132,7 +125,7 @@ uno::Reference< XResultSet > SAL_CALL OStatement::executeQuery(const OUString& s
throw(SQLException, RuntimeException)
{
MutexGuard aGuard(m_pConnection->getMutex());
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
const OUString sql = sanitizeSqlString(sqlIn);
@@ -179,7 +172,7 @@ sal_Bool SAL_CALL OStatement::execute(const OUString& sqlIn)
"Got called with sql: " << sqlIn);
MutexGuard aGuard(m_pConnection->getMutex());
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
XSQLDA* pOutSqlda = 0;
isc_stmt_handle aStatementHandle = 0;
@@ -216,8 +209,26 @@ uno::Reference< XConnection > SAL_CALL OStatement::getConnection()
throw(SQLException, RuntimeException)
{
MutexGuard aGuard(m_pConnection->getMutex());
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
return (uno::Reference< XConnection >)m_pConnection;
}
+
+Any SAL_CALL OStatement::queryInterface( const Type & rType ) throw(RuntimeException)
+{
+ Any aRet = OStatement_Base::queryInterface(rType);
+ if(!aRet.hasValue())
+ aRet = ::cppu::queryInterface(rType,static_cast< XBatchExecution*> (this));
+ if(!aRet.hasValue())
+ aRet = OStatementCommonBase::queryInterface(rType);
+ return aRet;
+}
+
+uno::Sequence< Type > SAL_CALL OStatement::getTypes()
+ throw(RuntimeException)
+{
+ return concatSequences(OStatement_Base::getTypes(),
+ OStatementCommonBase::getTypes());
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/firebird/FStatement.hxx b/connectivity/source/drivers/firebird/FStatement.hxx
index cecc0e1..3853298 100644
--- a/connectivity/source/drivers/firebird/FStatement.hxx
+++ b/connectivity/source/drivers/firebird/FStatement.hxx
@@ -49,10 +49,10 @@ namespace connectivity
// once the general restructuring of Statement/PreparedStatement is
// complete.
typedef ::cppu::ImplHelper1< ::com::sun::star::sdbc::XStatement >
- OStatementStatement_BASE;
+ OStatement_Base;
- class OStatement : public OStatement_Base,
- public OStatementStatement_BASE,
+ class OStatement : public OStatementCommonBase,
+ public OStatement_Base,
public ::com::sun::star::sdbc::XBatchExecution,
public ::com::sun::star::lang::XServiceInfo
{
@@ -61,12 +61,11 @@ namespace connectivity
public:
// a constructor, which is required for returning objects:
OStatement( OConnection* _pConnection)
- : OStatement_Base( _pConnection)
+ : OStatementCommonBase( _pConnection)
{}
DECLARE_SERVICE_INFO();
- 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();
@@ -87,6 +86,17 @@ namespace connectivity
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);
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL
+ queryInterface(const ::com::sun::star::uno::Type & rType)
+ throw(::com::sun::star::uno::RuntimeException);
+
+ //XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL
+ getTypes()
+ throw(::com::sun::star::uno::RuntimeException);
+
};
}
}
diff --git a/connectivity/source/drivers/firebird/StatementCommonBase.cxx b/connectivity/source/drivers/firebird/StatementCommonBase.cxx
index d599b78..4f99d5b 100644
--- a/connectivity/source/drivers/firebird/StatementCommonBase.cxx
+++ b/connectivity/source/drivers/firebird/StatementCommonBase.cxx
@@ -59,20 +59,20 @@ using namespace ::osl;
using namespace ::rtl;
using namespace ::std;
-OStatement_Base::OStatement_Base(OConnection* _pConnection)
- : OStatement_BASE(_pConnection->getMutex()),
- OPropertySetHelper(OStatement_BASE::rBHelper),
+OStatementCommonBase::OStatementCommonBase(OConnection* _pConnection)
+ : OStatementCommonBase_Base(_pConnection->getMutex()),
+ OPropertySetHelper(OStatementCommonBase_Base::rBHelper),
m_pConnection(_pConnection),
- rBHelper(OStatement_BASE::rBHelper)
+ rBHelper(OStatementCommonBase_Base::rBHelper)
{
m_pConnection->acquire();
}
-OStatement_Base::~OStatement_Base()
+OStatementCommonBase::~OStatementCommonBase()
{
}
-void OStatement_Base::disposeResultSet()
+void OStatementCommonBase::disposeResultSet()
{
//free the cursor if alive
// uno::Reference< XComponent > xComp(m_xResultSet.get(), UNO_QUERY);
@@ -82,47 +82,47 @@ void OStatement_Base::disposeResultSet()
}
//-----------------------------------------------------------------------------
-Any SAL_CALL OStatement_Base::queryInterface( const Type & rType ) throw(RuntimeException)
+Any SAL_CALL OStatementCommonBase::queryInterface( const Type & rType ) throw(RuntimeException)
{
- Any aRet = OStatement_BASE::queryInterface(rType);
+ Any aRet = OStatementCommonBase_Base::queryInterface(rType);
if(!aRet.hasValue())
aRet = OPropertySetHelper::queryInterface(rType);
return aRet;
}
// -------------------------------------------------------------------------
-Sequence< Type > SAL_CALL OStatement_Base::getTypes( ) throw(RuntimeException)
+Sequence< Type > SAL_CALL OStatementCommonBase::getTypes( ) throw(RuntimeException)
{
::cppu::OTypeCollection aTypes(
::cppu::UnoType< uno::Reference< XMultiPropertySet > >::get(),
::cppu::UnoType< uno::Reference< XFastPropertySet > >::get(),
::cppu::UnoType< uno::Reference< XPropertySet > >::get());
- return concatSequences(aTypes.getTypes(),OStatement_BASE::getTypes());
+ return concatSequences(aTypes.getTypes(),OStatementCommonBase_Base::getTypes());
}
// -------------------------------------------------------------------------
-void SAL_CALL OStatement_Base::cancel( ) throw(RuntimeException)
+void SAL_CALL OStatementCommonBase::cancel( ) throw(RuntimeException)
{
MutexGuard aGuard(m_pConnection->getMutex());
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
// cancel the current sql statement
}
// -------------------------------------------------------------------------
-void SAL_CALL OStatement_Base::close( ) throw(SQLException, RuntimeException)
+void SAL_CALL OStatementCommonBase::close( ) throw(SQLException, RuntimeException)
{
SAL_INFO("connectivity.firebird", "close().");
{
MutexGuard aGuard(m_pConnection->getMutex());
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
}
dispose();
}
-OUString OStatement_Base::sanitizeSqlString(const OUString& sqlIn)
+OUString OStatementCommonBase::sanitizeSqlString(const OUString& sqlIn)
{
// TODO: verify this is all we need.
static const sal_Unicode pattern('"');
@@ -130,7 +130,7 @@ OUString OStatement_Base::sanitizeSqlString(const OUString& sqlIn)
return sqlIn.replace(pattern, empty);
}
-int OStatement_Base::prepareAndDescribeStatement(const OUString& sqlIn,
+int OStatementCommonBase::prepareAndDescribeStatement(const OUString& sqlIn,
isc_stmt_handle& aStatementHandle,
XSQLDA*& pOutSqlda,
XSQLDA* pInSqlda)
@@ -214,25 +214,25 @@ int OStatement_Base::prepareAndDescribeStatement(const OUString& sqlIn,
}
// ---- XMultipleResults - UNSUPPORTED ----------------------------------------
-uno::Reference< XResultSet > SAL_CALL OStatement_Base::getResultSet() throw(SQLException, RuntimeException)
+uno::Reference< XResultSet > SAL_CALL OStatementCommonBase::getResultSet() throw(SQLException, RuntimeException)
{
// TODO: verify we really can't support this
return uno::Reference< XResultSet >();
// MutexGuard aGuard( m_aMutex );
-// checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+// checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
// return m_xResultSet;
}
-sal_Bool SAL_CALL OStatement_Base::getMoreResults() throw(SQLException, RuntimeException)
+sal_Bool SAL_CALL OStatementCommonBase::getMoreResults() throw(SQLException, RuntimeException)
{
// TODO: verify we really can't support this
return sal_False;
// MutexGuard aGuard( m_aMutex );
-// checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+// checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
}
-sal_Int32 SAL_CALL OStatement_Base::getUpdateCount() throw(SQLException, RuntimeException)
+sal_Int32 SAL_CALL OStatementCommonBase::getUpdateCount() throw(SQLException, RuntimeException)
{
// TODO: verify we really can't support this
return 0;
@@ -240,16 +240,16 @@ sal_Int32 SAL_CALL OStatement_Base::getUpdateCount() throw(SQLException, Runtime
// ---- XWarningsSupplier - UNSUPPORTED ----------------------------------------
-Any SAL_CALL OStatement_Base::getWarnings() throw(SQLException, RuntimeException)
+Any SAL_CALL OStatementCommonBase::getWarnings() throw(SQLException, RuntimeException)
{
return Any();
}
-void SAL_CALL OStatement_Base::clearWarnings() throw(SQLException, RuntimeException)
+void SAL_CALL OStatementCommonBase::clearWarnings() throw(SQLException, RuntimeException)
{
}
-::cppu::IPropertyArrayHelper* OStatement_Base::createArrayHelper( ) const
+::cppu::IPropertyArrayHelper* OStatementCommonBase::createArrayHelper( ) const
{
// this properties are define by the service statement
// they must in alphabetic order
@@ -271,12 +271,12 @@ void SAL_CALL OStatement_Base::clearWarnings() throw(SQLException, RuntimeExcept
}
-::cppu::IPropertyArrayHelper & OStatement_Base::getInfoHelper()
+::cppu::IPropertyArrayHelper & OStatementCommonBase::getInfoHelper()
{
- return *const_cast<OStatement_Base*>(this)->getArrayHelper();
+ return *const_cast<OStatementCommonBase*>(this)->getArrayHelper();
}
// -------------------------------------------------------------------------
-sal_Bool OStatement_Base::convertFastPropertyValue(
+sal_Bool OStatementCommonBase::convertFastPropertyValue(
Any & rConvertedValue,
Any & rOldValue,
sal_Int32 nHandle,
@@ -292,7 +292,7 @@ sal_Bool OStatement_Base::convertFastPropertyValue(
return bConverted;
}
// -------------------------------------------------------------------------
-void OStatement_Base::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) throw (Exception)
+void OStatementCommonBase::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) throw (Exception)
{
(void) rValue;
// set the value to what ever is necessary
@@ -313,7 +313,7 @@ void OStatement_Base::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const A
}
}
// -------------------------------------------------------------------------
-void OStatement_Base::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const
+void OStatementCommonBase::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const
{
(void) rValue;
switch(nHandle)
@@ -333,17 +333,17 @@ void OStatement_Base::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const
}
}
-void SAL_CALL OStatement_Base::acquire() throw()
+void SAL_CALL OStatementCommonBase::acquire() throw()
{
- OStatement_BASE::acquire();
+ OStatementCommonBase_Base::acquire();
}
-void SAL_CALL OStatement_Base::release() throw()
+void SAL_CALL OStatementCommonBase::release() throw()
{
- OStatement_BASE::release();
+ OStatementCommonBase_Base::release();
}
-uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OStatement_Base::getPropertySetInfo( ) throw(RuntimeException)
+uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OStatementCommonBase::getPropertySetInfo( ) throw(RuntimeException)
{
return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
}
diff --git a/connectivity/source/drivers/firebird/StatementCommonBase.hxx b/connectivity/source/drivers/firebird/StatementCommonBase.hxx
index 6c39853..cd8f935 100644
--- a/connectivity/source/drivers/firebird/StatementCommonBase.hxx
+++ b/connectivity/source/drivers/firebird/StatementCommonBase.hxx
@@ -61,11 +61,11 @@ namespace connectivity
typedef ::cppu::WeakComponentImplHelper4< ::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::XMultipleResults> OStatementCommonBase_Base;
- class OStatement_Base : public OStatement_BASE,
+ class OStatementCommonBase : public OStatementCommonBase_Base,
public ::cppu::OPropertySetHelper,
- public OPropertyArrayUsageHelper<OStatement_Base>
+ public OPropertyArrayUsageHelper<OStatementCommonBase>
{
protected:
@@ -98,7 +98,7 @@ namespace connectivity
virtual void SAL_CALL getFastPropertyValue(
::com::sun::star::uno::Any& rValue,
sal_Int32 nHandle) const;
- virtual ~OStatement_Base();
+ virtual ~OStatementCommonBase();
int prepareAndDescribeStatement(const OUString& sqlIn,
isc_stmt_handle& aStatementHandle,
XSQLDA*& pOutSqlda,
@@ -107,11 +107,11 @@ namespace connectivity
public:
::cppu::OBroadcastHelper& rBHelper;
- OStatement_Base(OConnection* _pConnection);
- using OStatement_BASE::operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >;
+ OStatementCommonBase(OConnection* _pConnection);
+ using OStatementCommonBase_Base::operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >;
// OComponentHelper
- virtual void SAL_CALL disposing(void){OStatement_BASE::disposing();}
+ virtual void SAL_CALL disposing(void){OStatementCommonBase_Base::disposing();}
// XInterface
virtual void SAL_CALL release() throw();
virtual void SAL_CALL acquire() throw();
commit ed9dac3baff5a75b95af6ccfdfcafc64a58200e2
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date: Tue Jul 23 17:24:12 2013 +0200
Move Statement specific methods out of common base. (firebird-sdbc)
Change-Id: If85f7f419b7c67bc84f8a74422cc8c9080a34353
diff --git a/connectivity/source/drivers/firebird/FPreparedStatement.cxx b/connectivity/source/drivers/firebird/FPreparedStatement.cxx
index 2e66504..c7a08f8 100644
--- a/connectivity/source/drivers/firebird/FPreparedStatement.cxx
+++ b/connectivity/source/drivers/firebird/FPreparedStatement.cxx
@@ -308,7 +308,7 @@ Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery()
}
uno::Reference< OResultSet > pResult(new OResultSet(m_pConnection,
- uno::Reference< XStatement >(this),
+ uno::Reference< XInterface >(*this),
m_statementHandle,
m_pOutSqlda));
m_xResultSet = pResult.get();
diff --git a/connectivity/source/drivers/firebird/FPreparedStatement.hxx b/connectivity/source/drivers/firebird/FPreparedStatement.hxx
index 75dd18f..b7f4a96 100644
--- a/connectivity/source/drivers/firebird/FPreparedStatement.hxx
+++ b/connectivity/source/drivers/firebird/FPreparedStatement.hxx
@@ -35,7 +35,11 @@
#ifndef CONNECTIVITY_FIREBIRD_PREPAREDSTATEMENT_HXX
#define CONNECTIVITY_FIREBIRD_PREPAREDSTATEMENT_HXX
+
#include "FStatement.hxx"
+
+#include <cppuhelper/implbase5.hxx>
+
#include <com/sun/star/sdbc/XPreparedStatement.hpp>
#include <com/sun/star/sdbc/XParameters.hpp>
#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
@@ -110,11 +114,8 @@ namespace connectivity
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
// XPreparedStatement
- using OStatement_Base::executeQuery;
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);
- using OStatement_Base::executeUpdate;
virtual sal_Int32 SAL_CALL executeUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- using OStatement_Base::execute;
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
diff --git a/connectivity/source/drivers/firebird/FResultSet.cxx b/connectivity/source/drivers/firebird/FResultSet.cxx
index a234057..2b05342 100644
--- a/connectivity/source/drivers/firebird/FResultSet.cxx
+++ b/connectivity/source/drivers/firebird/FResultSet.cxx
@@ -66,7 +66,7 @@ using namespace ::com::sun::star::io;
using namespace ::com::sun::star::util;
OResultSet::OResultSet(OConnection* pConnection,
- const uno::Reference< XStatement >& xStatement,
+ const uno::Reference< XInterface >& xStatement,
isc_stmt_handle& aStatementHandle,
XSQLDA* pSqlda)
: OResultSet_BASE(pConnection->getMutex())
diff --git a/connectivity/source/drivers/firebird/FResultSet.hxx b/connectivity/source/drivers/firebird/FResultSet.hxx
index 917f21d..894eaff 100644
--- a/connectivity/source/drivers/firebird/FResultSet.hxx
+++ b/connectivity/source/drivers/firebird/FResultSet.hxx
@@ -82,7 +82,7 @@ namespace connectivity
{
protected:
OConnection* m_pConnection;
- const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XStatement >& m_xStatement;
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& m_xStatement;
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData> m_xMetaData;
@@ -136,7 +136,7 @@ namespace connectivity
DECLARE_SERVICE_INFO();
OResultSet(OConnection* pConnection,
- const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XStatement >& xStatement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xStatement,
isc_stmt_handle& aStatementHandle,
XSQLDA* aSqlda);
diff --git a/connectivity/source/drivers/firebird/FStatement.cxx b/connectivity/source/drivers/firebird/FStatement.cxx
index 9c43580..0bf7067 100644
--- a/connectivity/source/drivers/firebird/FStatement.cxx
+++ b/connectivity/source/drivers/firebird/FStatement.cxx
@@ -100,4 +100,124 @@ Any SAL_CALL OStatement::queryInterface( const Type & rType ) throw(RuntimeExcep
return aRet;
}
+// ---- XStatement -----------------------------------------------------------
+sal_Int32 SAL_CALL OStatement::executeUpdate(const OUString& sqlIn)
+ throw(SQLException, RuntimeException)
+{
+ // TODO: close ResultSet if existing -- so so in all 3 execute methods.
+ MutexGuard aGuard(m_pConnection->getMutex());
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ const OUString sql = sanitizeSqlString(sqlIn);
+
+ int aErr = isc_dsql_execute_immediate(m_statusVector,
+ &m_pConnection->getDBHandle(),
+ &m_pConnection->getTransaction(),
+ 0,
+ OUStringToOString(sql, RTL_TEXTENCODING_UTF8).getStr(),
+ 1,
+ NULL);
+
+ if (aErr)
+ SAL_WARN("connectivity.firebird", "isc_dsql_execute_immediate failed" );
+
+ m_pConnection->evaluateStatusVector(m_statusVector, sql, *this);
+ // TODO: get number of changed rows with SELECT ROW_COUNT (use executeQuery)
+ // return getUpdateCount();
+ return 0;
+}
+
+
+uno::Reference< XResultSet > SAL_CALL OStatement::executeQuery(const OUString& sqlIn)
+ throw(SQLException, RuntimeException)
+{
+ MutexGuard aGuard(m_pConnection->getMutex());
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ const OUString sql = sanitizeSqlString(sqlIn);
+
+ XSQLDA* pOutSqlda = 0;
+ isc_stmt_handle aStatementHandle = 0;
+ int aErr = 0;
+
+
+ aErr = prepareAndDescribeStatement(sql,
+ aStatementHandle,
+ pOutSqlda);
+ if (aErr)
+ {
+ SAL_WARN("connectivity.firebird", "prepareAndDescribeStatement failed");
+ }
+ else
+ {
+ aErr = isc_dsql_execute(m_statusVector,
+ &m_pConnection->getTransaction(),
+ &aStatementHandle,
+ 1,
+ NULL);
+ if (aErr)
+ SAL_WARN("connectivity.firebird", "isc_dsql_execute failed" );
+ }
+
+ uno::Reference< OResultSet > pResult(new OResultSet(m_pConnection,
+ uno::Reference< XInterface >(*this),
+ aStatementHandle,
+ pOutSqlda));
+ //initializeResultSet( pResult.get() );
+ m_xResultSet = pResult.get();
+
+ // TODO: deal with cleanup
+// close();
+ m_pConnection->evaluateStatusVector(m_statusVector, sql, *this);
+ return m_xResultSet;
+}
+
+sal_Bool SAL_CALL OStatement::execute(const OUString& sqlIn)
+ throw(SQLException, RuntimeException)
+{
+ SAL_INFO("connectivity.firebird", "executeQuery(). "
+ "Got called with sql: " << sqlIn);
+
+ MutexGuard aGuard(m_pConnection->getMutex());
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ XSQLDA* pOutSqlda = 0;
+ isc_stmt_handle aStatementHandle = 0;
+ int aErr = 0;
+
+ const OUString sql = sanitizeSqlString(sqlIn);
+
+ aErr = prepareAndDescribeStatement(sql,
+ aStatementHandle,
+ pOutSqlda);
+
+ if (aErr)
+ {
+ SAL_WARN("connectivity.firebird", "prepareAndDescribeStatement failed" );
+ }
+ else
+ {
+ aErr = isc_dsql_execute(m_statusVector,
+ &m_pConnection->getTransaction(),
+ &aStatementHandle,
+ 1,
+ NULL);
+ if (aErr)
+ SAL_WARN("connectivity.firebird", "isc_dsql_execute failed" );
+ }
+
+ m_pConnection->evaluateStatusVector(m_statusVector, sql, *this);
+
+ // returns true when a resultset is available
+ return sal_False;
+}
+
+uno::Reference< XConnection > SAL_CALL OStatement::getConnection()
+ throw(SQLException, RuntimeException)
+{
+ MutexGuard aGuard(m_pConnection->getMutex());
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ return (uno::Reference< XConnection >)m_pConnection;
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/firebird/FStatement.hxx b/connectivity/source/drivers/firebird/FStatement.hxx
index 07c5afb..cecc0e1 100644
--- a/connectivity/source/drivers/firebird/FStatement.hxx
+++ b/connectivity/source/drivers/firebird/FStatement.hxx
@@ -38,12 +38,21 @@
#include "StatementCommonBase.hxx"
+#include <cppuhelper/implbase1.hxx>
+
namespace connectivity
{
namespace firebird
{
+ // The name OStatementStatement_BASE is temporary and will be changed
+ // once the general restructuring of Statement/PreparedStatement is
+ // complete.
+ typedef ::cppu::ImplHelper1< ::com::sun::star::sdbc::XStatement >
+ OStatementStatement_BASE;
+
class OStatement : public OStatement_Base,
+ public OStatementStatement_BASE,
public ::com::sun::star::sdbc::XBatchExecution,
public ::com::sun::star::lang::XServiceInfo
{
@@ -60,6 +69,20 @@ 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();
+
+ // XStatement
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL
+ executeQuery(const ::rtl::OUString& sql)
+ throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL executeUpdate(const ::rtl::OUString& sqlIn)
+ throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL
+ execute(const ::rtl::OUString& sql)
+ 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);
+
// XBatchExecution - UNSUPPORTED
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);
diff --git a/connectivity/source/drivers/firebird/StatementCommonBase.cxx b/connectivity/source/drivers/firebird/StatementCommonBase.cxx
index 4816f0f..d599b78 100644
--- a/connectivity/source/drivers/firebird/StatementCommonBase.cxx
+++ b/connectivity/source/drivers/firebird/StatementCommonBase.cxx
@@ -121,32 +121,6 @@ void SAL_CALL OStatement_Base::close( ) throw(SQLException, RuntimeException)
dispose();
}
-// ---- XStatement -----------------------------------------------------------
-sal_Int32 SAL_CALL OStatement_Base::executeUpdate(const OUString& sqlIn)
- throw(SQLException, RuntimeException)
-{
- // TODO: close ResultSet if existing -- so so in all 3 execute methods.
- MutexGuard aGuard(m_pConnection->getMutex());
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- const OUString sql = sanitizeSqlString(sqlIn);
-
- int aErr = isc_dsql_execute_immediate(m_statusVector,
- &m_pConnection->getDBHandle(),
- &m_pConnection->getTransaction(),
- 0,
- OUStringToOString(sql, RTL_TEXTENCODING_UTF8).getStr(),
- 1,
- NULL);
-
- if (aErr)
- SAL_WARN("connectivity.firebird", "isc_dsql_execute_immediate failed" );
-
- m_pConnection->evaluateStatusVector(m_statusVector, sql, *this);
- // TODO: get number of changed rows with SELECT ROW_COUNT (use executeQuery)
- // return getUpdateCount();
- return 0;
-}
OUString OStatement_Base::sanitizeSqlString(const OUString& sqlIn)
{
@@ -239,97 +213,6 @@ int OStatement_Base::prepareAndDescribeStatement(const OUString& sqlIn,
return aErr;
}
-uno::Reference< XResultSet > SAL_CALL OStatement_Base::executeQuery(const OUString& sqlIn) throw(SQLException, RuntimeException)
-{
- MutexGuard aGuard(m_pConnection->getMutex());
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- const OUString sql = sanitizeSqlString(sqlIn);
-
- XSQLDA* pOutSqlda = 0;
- isc_stmt_handle aStatementHandle = 0;
- int aErr = 0;
-
-
- aErr = prepareAndDescribeStatement(sql,
- aStatementHandle,
- pOutSqlda);
- if (aErr)
- {
- SAL_WARN("connectivity.firebird", "prepareAndDescribeStatement failed");
- }
- else
- {
- aErr = isc_dsql_execute(m_statusVector,
- &m_pConnection->getTransaction(),
- &aStatementHandle,
- 1,
- NULL);
- if (aErr)
- SAL_WARN("connectivity.firebird", "isc_dsql_execute failed" );
- }
-
- uno::Reference< OResultSet > pResult(new OResultSet(m_pConnection,
- uno::Reference< XStatement >(this),
- aStatementHandle,
- pOutSqlda));
- //initializeResultSet( pResult.get() );
- m_xResultSet = pResult.get();
-
- // TODO: deal with cleanup
-// close();
- m_pConnection->evaluateStatusVector(m_statusVector, sql, *this);
- return m_xResultSet;
-}
-
-sal_Bool SAL_CALL OStatement_Base::execute(const OUString& sqlIn) throw(SQLException, RuntimeException)
-{
- SAL_INFO("connectivity.firebird", "executeQuery(). "
- "Got called with sql: " << sqlIn);
-
- MutexGuard aGuard(m_pConnection->getMutex());
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- XSQLDA* pOutSqlda = 0;
- isc_stmt_handle aStatementHandle = 0;
- int aErr = 0;
-
- const OUString sql = sanitizeSqlString(sqlIn);
-
- aErr = prepareAndDescribeStatement(sql,
- aStatementHandle,
- pOutSqlda);
-
- if (aErr)
- {
- SAL_WARN("connectivity.firebird", "prepareAndDescribeStatement failed" );
- }
- else
- {
- aErr = isc_dsql_execute(m_statusVector,
- &m_pConnection->getTransaction(),
- &aStatementHandle,
- 1,
- NULL);
- if (aErr)
- SAL_WARN("connectivity.firebird", "isc_dsql_execute failed" );
- }
-
- m_pConnection->evaluateStatusVector(m_statusVector, sql, *this);
-
- // returns true when a resultset is available
- return sal_False;
-}
-
-uno::Reference< XConnection > SAL_CALL OStatement_Base::getConnection()
- throw(SQLException, RuntimeException)
-{
- MutexGuard aGuard(m_pConnection->getMutex());
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- return (uno::Reference< XConnection >)m_pConnection;
-}
-
// ---- XMultipleResults - UNSUPPORTED ----------------------------------------
uno::Reference< XResultSet > SAL_CALL OStatement_Base::getResultSet() throw(SQLException, RuntimeException)
{
diff --git a/connectivity/source/drivers/firebird/StatementCommonBase.hxx b/connectivity/source/drivers/firebird/StatementCommonBase.hxx
index 7ee121c..6c39853 100644
--- a/connectivity/source/drivers/firebird/StatementCommonBase.hxx
+++ b/connectivity/source/drivers/firebird/StatementCommonBase.hxx
@@ -41,7 +41,7 @@
#include <ibase.h>
#include <connectivity/OSubComponent.hxx>
-#include <cppuhelper/compbase5.hxx>
+#include <cppuhelper/compbase4.hxx>
#include <list>
#include <com/sun/star/lang/XServiceInfo.hpp>
@@ -58,8 +58,7 @@ namespace connectivity
namespace firebird
{
- typedef ::cppu::WeakComponentImplHelper5< ::com::sun::star::sdbc::XStatement,
- ::com::sun::star::sdbc::XWarningsSupplier,
+ typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::sdbc::XWarningsSupplier,
::com::sun::star::util::XCancellable,
::com::sun::star::sdbc::XCloseable,
::com::sun::star::sdbc::XMultipleResults> OStatement_BASE;
@@ -123,11 +122,6 @@ namespace connectivity
// XPropertySet
virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
- // XStatement
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ;
- virtual sal_Int32 SAL_CALL executeUpdate( const ::rtl::OUString& sqlIn ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ;
- virtual sal_Bool SAL_CALL execute( const ::rtl::OUString& sql ) 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) ;
// XWarningsSupplier - UNSUPPORTED
virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
commit 2b541c928ca6eaca9cb5dcbe7f4f43f9f0b20101
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date: Tue Jul 23 16:06:54 2013 +0200
Move Statement_Base into it's own file (firebird-sdbc).
This is in preparation of cleanly separating the code shared
by PreparedStatment and Statement from the code unique to either
of those classes.
Change-Id: I419668044e67b25d492a381acab9ee9b1acce7ce
diff --git a/connectivity/Library_firebird_sdbc.mk b/connectivity/Library_firebird_sdbc.mk
index 37486da..6030fec 100644
--- a/connectivity/Library_firebird_sdbc.mk
+++ b/connectivity/Library_firebird_sdbc.mk
@@ -46,6 +46,7 @@ $(eval $(call gb_Library_add_exception_objects,firebird_sdbc,\
connectivity/source/drivers/firebird/FResultSetMetaData \
connectivity/source/drivers/firebird/FServices \
connectivity/source/drivers/firebird/FStatement \
+ connectivity/source/drivers/firebird/StatementCommonBase \
connectivity/source/drivers/firebird/Util \
))
diff --git a/connectivity/source/drivers/firebird/FStatement.cxx b/connectivity/source/drivers/firebird/FStatement.cxx
index c58db44..9c43580 100644
--- a/connectivity/source/drivers/firebird/FStatement.cxx
+++ b/connectivity/source/drivers/firebird/FStatement.cxx
@@ -38,15 +38,9 @@
#include "FResultSet.hxx"
#include "Util.hxx"
-#include <ibase.h>
-
-#include <comphelper/sequence.hxx>
-#include <cppuhelper/typeprovider.hxx>
#include <osl/diagnose.h>
#include <osl/thread.h>
-#include <propertyids.hxx>
#include <rtl/ustrbuf.hxx>
-#include <TConnection.hxx>
#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
#include <com/sun/star/sdbc/ResultSetType.hpp>
@@ -70,316 +64,6 @@ using namespace ::osl;
using namespace ::rtl;
using namespace ::std;
-OStatement_Base::OStatement_Base(OConnection* _pConnection)
- : OStatement_BASE(_pConnection->getMutex()),
- OPropertySetHelper(OStatement_BASE::rBHelper),
- m_pConnection(_pConnection),
- rBHelper(OStatement_BASE::rBHelper)
-{
- m_pConnection->acquire();
-// // enabling the XSQLDA to accommodate up to 10 parameter items (DEFAULT)
-// m_INsqlda = (XSQLDA *)malloc(XSQLDA_LENGTH(10));
-// m_INsqlda->version = SQLDA_VERSION1;
-// m_INsqlda->sqln = 10;
-// m_INsqlda->sqld = 0;
-
-}
-
-OStatement_Base::~OStatement_Base()
-{
-}
-
-void OStatement_Base::disposeResultSet()
-{
- //free the cursor if alive
-// uno::Reference< XComponent > xComp(m_xResultSet.get(), UNO_QUERY);
-// if (xComp.is())
-// xComp->dispose();
-// m_xResultSet = uno::Reference< XResultSet>();
-}
-
-//-----------------------------------------------------------------------------
-Any SAL_CALL OStatement_Base::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- Any aRet = OStatement_BASE::queryInterface(rType);
- if(!aRet.hasValue())
- aRet = OPropertySetHelper::queryInterface(rType);
- return aRet;
-}
-// -------------------------------------------------------------------------
-Sequence< Type > SAL_CALL OStatement_Base::getTypes( ) throw(RuntimeException)
-{
- ::cppu::OTypeCollection aTypes(
- ::cppu::UnoType< uno::Reference< XMultiPropertySet > >::get(),
- ::cppu::UnoType< uno::Reference< XFastPropertySet > >::get(),
- ::cppu::UnoType< uno::Reference< XPropertySet > >::get());
-
- return concatSequences(aTypes.getTypes(),OStatement_BASE::getTypes());
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OStatement_Base::cancel( ) throw(RuntimeException)
-{
- MutexGuard aGuard(m_pConnection->getMutex());
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
- // cancel the current sql statement
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OStatement_Base::close( ) throw(SQLException, RuntimeException)
-{
- SAL_INFO("connectivity.firebird", "close().");
-
- {
- MutexGuard aGuard(m_pConnection->getMutex());
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- }
- dispose();
-}
-
-Any SAL_CALL OStatement::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- Any aRet = ::cppu::queryInterface(rType,static_cast< XBatchExecution*> (this));
- if(!aRet.hasValue())
- aRet = OStatement_Base::queryInterface(rType);
- return aRet;
-}
-
-// ---- XStatement -----------------------------------------------------------
-sal_Int32 SAL_CALL OStatement_Base::executeUpdate(const OUString& sqlIn)
- throw(SQLException, RuntimeException)
-{
- // TODO: close ResultSet if existing -- so so in all 3 execute methods.
- MutexGuard aGuard(m_pConnection->getMutex());
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- const OUString sql = sanitizeSqlString(sqlIn);
-
- int aErr = isc_dsql_execute_immediate(m_statusVector,
- &m_pConnection->getDBHandle(),
- &m_pConnection->getTransaction(),
- 0,
- OUStringToOString(sql, RTL_TEXTENCODING_UTF8).getStr(),
- 1,
- NULL);
-
- if (aErr)
- SAL_WARN("connectivity.firebird", "isc_dsql_execute_immediate failed" );
-
- m_pConnection->evaluateStatusVector(m_statusVector, sql, *this);
- // TODO: get number of changed rows with SELECT ROW_COUNT (use executeQuery)
- // return getUpdateCount();
- return 0;
-}
-
-OUString OStatement_Base::sanitizeSqlString(const OUString& sqlIn)
-{
- // TODO: verify this is all we need.
- static const sal_Unicode pattern('"');
- static const sal_Unicode empty(' ');
- return sqlIn.replace(pattern, empty);
-}
-
-int OStatement_Base::prepareAndDescribeStatement(const OUString& sqlIn,
- isc_stmt_handle& aStatementHandle,
- XSQLDA*& pOutSqlda,
- XSQLDA* pInSqlda)
-{
- MutexGuard aGuard(m_pConnection->getMutex());
-
- const OUString sql = sanitizeSqlString(sqlIn);
-
- if (!pOutSqlda)
- {
- pOutSqlda = (XSQLDA*) malloc(XSQLDA_LENGTH(10));
- pOutSqlda->version = SQLDA_VERSION1;
- pOutSqlda->sqln = 10;
- }
-
- int aErr = 0;
-
- aErr = isc_dsql_allocate_statement(m_statusVector,
- &m_pConnection->getDBHandle(),
- &aStatementHandle);
-
- if (aErr)
- {
- SAL_WARN("connectivity.firebird", "isc_dsql_allocate_statement failed");
- return aErr;
- }
- else
- {
- aErr = isc_dsql_prepare(m_statusVector,
- &m_pConnection->getTransaction(),
- &aStatementHandle,
- 0,
- OUStringToOString(sql, RTL_TEXTENCODING_UTF8).getStr(),
- 1,
- pInSqlda);
- }
-
- if (aErr)
- {
- SAL_WARN("connectivity.firebird", "isc_dsql_prepare failed");
- return aErr;
- }
- else
- {
- aErr = isc_dsql_describe(m_statusVector,
- &aStatementHandle,
- 1,
- pOutSqlda);
- }
-
- // Ensure we have enough space in pOutSqlda
- if (aErr)
- {
- SAL_WARN("connectivity.firebird", "isc_dsql_describe failed");
- return aErr;
- }
- else if (!aErr && (pOutSqlda->sqld > pOutSqlda->sqln))
- {
- int n = pOutSqlda->sqld;
- free(pOutSqlda);
- pOutSqlda = (XSQLDA*) malloc(XSQLDA_LENGTH(n));
- pOutSqlda->version = SQLDA_VERSION1;
- aErr = isc_dsql_describe(m_statusVector,
- &aStatementHandle,
- 1,
- pOutSqlda);
- }
-
- // Process each XSQLVAR parameter structure in the output XSQLDA
- if (aErr)
- {
- SAL_WARN("connectivity.firebird","isc_dsql_describe failed when resizing pOutSqlda");
- return aErr;
- }
- else
- {
- mallocSQLVAR(pOutSqlda);
- }
-
- return aErr;
-}
-
-uno::Reference< XResultSet > SAL_CALL OStatement_Base::executeQuery(const OUString& sqlIn) throw(SQLException, RuntimeException)
-{
- MutexGuard aGuard(m_pConnection->getMutex());
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- const OUString sql = sanitizeSqlString(sqlIn);
-
- XSQLDA* pOutSqlda = 0;
- isc_stmt_handle aStatementHandle = 0;
- int aErr = 0;
-
-
- aErr = prepareAndDescribeStatement(sql,
- aStatementHandle,
- pOutSqlda);
- if (aErr)
- {
- SAL_WARN("connectivity.firebird", "prepareAndDescribeStatement failed");
- }
- else
- {
- aErr = isc_dsql_execute(m_statusVector,
- &m_pConnection->getTransaction(),
- &aStatementHandle,
- 1,
- NULL);
- if (aErr)
- SAL_WARN("connectivity.firebird", "isc_dsql_execute failed" );
- }
-
- uno::Reference< OResultSet > pResult(new OResultSet(m_pConnection,
- uno::Reference< XStatement >(this),
- aStatementHandle,
- pOutSqlda));
- //initializeResultSet( pResult.get() );
- m_xResultSet = pResult.get();
-
- // TODO: deal with cleanup
-// close();
- m_pConnection->evaluateStatusVector(m_statusVector, sql, *this);
- return m_xResultSet;
-}
-
-sal_Bool SAL_CALL OStatement_Base::execute(const OUString& sqlIn) throw(SQLException, RuntimeException)
-{
- SAL_INFO("connectivity.firebird", "executeQuery(). "
- "Got called with sql: " << sqlIn);
-
- MutexGuard aGuard(m_pConnection->getMutex());
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- XSQLDA* pOutSqlda = 0;
- isc_stmt_handle aStatementHandle = 0;
- int aErr = 0;
-
- const OUString sql = sanitizeSqlString(sqlIn);
-
- aErr = prepareAndDescribeStatement(sql,
- aStatementHandle,
- pOutSqlda);
-
- if (aErr)
- {
- SAL_WARN("connectivity.firebird", "prepareAndDescribeStatement failed" );
- }
- else
- {
- aErr = isc_dsql_execute(m_statusVector,
- &m_pConnection->getTransaction(),
- &aStatementHandle,
- 1,
- NULL);
- if (aErr)
- SAL_WARN("connectivity.firebird", "isc_dsql_execute failed" );
- }
-
- m_pConnection->evaluateStatusVector(m_statusVector, sql, *this);
-
- // returns true when a resultset is available
- return sal_False;
-}
-
-uno::Reference< XConnection > SAL_CALL OStatement_Base::getConnection()
- throw(SQLException, RuntimeException)
-{
- MutexGuard aGuard(m_pConnection->getMutex());
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- return (uno::Reference< XConnection >)m_pConnection;
-}
-
-// ---- XMultipleResults - UNSUPPORTED ----------------------------------------
-uno::Reference< XResultSet > SAL_CALL OStatement_Base::getResultSet() throw(SQLException, RuntimeException)
-{
- // TODO: verify we really can't support this
- return uno::Reference< XResultSet >();
-// MutexGuard aGuard( m_aMutex );
-// checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-// return m_xResultSet;
-}
-
-sal_Bool SAL_CALL OStatement_Base::getMoreResults() throw(SQLException, RuntimeException)
-{
- // TODO: verify we really can't support this
- return sal_False;
-// MutexGuard aGuard( m_aMutex );
-// checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-}
-
-sal_Int32 SAL_CALL OStatement_Base::getUpdateCount() throw(SQLException, RuntimeException)
-{
- // TODO: verify we really can't support this
- return 0;
-}
-
// ---- XBatchExecution - UNSUPPORTED ----------------------------------------
void SAL_CALL OStatement::addBatch(const OUString& sql)
throw(SQLException, RuntimeException)
@@ -396,112 +80,8 @@ Sequence< sal_Int32 > SAL_CALL OStatement::executeBatch() throw(SQLException, Ru
return Sequence< sal_Int32 >();
}
-// ---- XWarningsSupplier - UNSUPPORTED ----------------------------------------
-Any SAL_CALL OStatement_Base::getWarnings() throw(SQLException, RuntimeException)
-{
- return Any();
-}
-
-void SAL_CALL OStatement_Base::clearWarnings() throw(SQLException, RuntimeException)
-{
-}
-
-::cppu::IPropertyArrayHelper* OStatement_Base::createArrayHelper( ) const
-{
- // this properties are define by the service statement
- // they must in alphabetic order
- Sequence< Property > aProps(10);
- Property* pProperties = aProps.getArray();
- sal_Int32 nPos = 0;
- DECL_PROP0(CURSORNAME, OUString);
- DECL_BOOL_PROP0(ESCAPEPROCESSING);
- DECL_PROP0(FETCHDIRECTION,sal_Int32);
- DECL_PROP0(FETCHSIZE, sal_Int32);
- DECL_PROP0(MAXFIELDSIZE,sal_Int32);
- DECL_PROP0(MAXROWS, sal_Int32);
- DECL_PROP0(QUERYTIMEOUT,sal_Int32);
- DECL_PROP0(RESULTSETCONCURRENCY,sal_Int32);
- DECL_PROP0(RESULTSETTYPE,sal_Int32);
- DECL_BOOL_PROP0(USEBOOKMARKS);
-
- return new ::cppu::OPropertyArrayHelper(aProps);
-}
-
-
-::cppu::IPropertyArrayHelper & OStatement_Base::getInfoHelper()
-{
- return *const_cast<OStatement_Base*>(this)->getArrayHelper();
-}
-// -------------------------------------------------------------------------
-sal_Bool OStatement_Base::convertFastPropertyValue(
- Any & rConvertedValue,
- Any & rOldValue,
- sal_Int32 nHandle,
- const Any& rValue )
- throw (IllegalArgumentException)
-{
- (void) rConvertedValue;
- (void) rOldValue;
- (void) nHandle;
- (void) rValue;
- sal_Bool bConverted = sal_False;
- // here we have to try to convert
- return bConverted;
-}
-// -------------------------------------------------------------------------
-void OStatement_Base::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) throw (Exception)
-{
- (void) rValue;
- // set the value to what ever is necessary
- switch(nHandle)
- {
- 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:
- ;
- }
-}
-// -------------------------------------------------------------------------
-void OStatement_Base::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const
-{
- (void) rValue;
- switch(nHandle)
- {
- 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:
- ;
- }
-}
-
IMPLEMENT_SERVICE_INFO(OStatement,"com.sun.star.sdbcx.OStatement","com.sun.star.sdbc.Statement");
-void SAL_CALL OStatement_Base::acquire() throw()
-{
- OStatement_BASE::acquire();
-}
-
-void SAL_CALL OStatement_Base::release() throw()
-{
- OStatement_BASE::release();
-}
-
void SAL_CALL OStatement::acquire() throw()
{
OStatement_Base::acquire();
@@ -512,8 +92,12 @@ void SAL_CALL OStatement::release() throw()
OStatement_Base::release();
}
-uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OStatement_Base::getPropertySetInfo( ) throw(RuntimeException)
+Any SAL_CALL OStatement::queryInterface( const Type & rType ) throw(RuntimeException)
{
- return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
+ Any aRet = ::cppu::queryInterface(rType,static_cast< XBatchExecution*> (this));
+ if(!aRet.hasValue())
+ aRet = OStatement_Base::queryInterface(rType);
+ return aRet;
}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/firebird/FStatement.hxx b/connectivity/source/drivers/firebird/FStatement.hxx
index 584afa9..07c5afb 100644
--- a/connectivity/source/drivers/firebird/FStatement.hxx
+++ b/connectivity/source/drivers/firebird/FStatement.hxx
@@ -36,117 +36,13 @@
#ifndef CONNECTIVITY_FIREBIRD_STATEMENT_HXX
#define CONNECTIVITY_FIREBIRD_STATEMENT_HXX
-#include <com/sun/star/sdbc/XStatement.hpp>
-#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
-#include <com/sun/star/sdbc/XMultipleResults.hpp>
-#include <com/sun/star/sdbc/XBatchExecution.hpp>
-#include <com/sun/star/sdbc/XCloseable.hpp>
-#include <com/sun/star/sdbc/SQLWarning.hpp>
-#include <com/sun/star/util/XCancellable.hpp>
-#include <cppuhelper/compbase5.hxx>
-#include "FConnection.hxx"
-#include <list>
-#include "connectivity/OSubComponent.hxx"
-#include <com/sun/star/lang/XServiceInfo.hpp>
+#include "StatementCommonBase.hxx"
namespace connectivity
{
namespace firebird
{
- typedef ::cppu::WeakComponentImplHelper5< ::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;
-
- //**************************************************************
- //************ Class: OStatement_Base
- // is a base class for the normal statement and for the prepared statement
- //**************************************************************
- class OStatement_Base : public OStatement_BASE,
- public ::cppu::OPropertySetHelper,
- public OPropertyArrayUsageHelper<OStatement_Base>
-
- {
- protected:
- ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XResultSet> m_xResultSet; // The last ResultSet created
- // for this Statement
-
- ::std::list< ::rtl::OUString> m_aBatchList;
-
- OConnection* m_pConnection;
-
- ISC_STATUS_ARRAY m_statusVector;
- protected:
-
- void disposeResultSet();
-
- // OPropertyArrayUsageHelper
- virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
- // OPropertySetHelper
- using OPropertySetHelper::getFastPropertyValue;
- virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
- virtual sal_Bool SAL_CALL convertFastPropertyValue(
- ::com::sun::star::uno::Any & rConvertedValue,
- ::com::sun::star::uno::Any & rOldValue,
- sal_Int32 nHandle,
- const ::com::sun::star::uno::Any& rValue )
- throw (::com::sun::star::lang::IllegalArgumentException);
- 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 getFastPropertyValue(
- ::com::sun::star::uno::Any& rValue,
- sal_Int32 nHandle) const;
- virtual ~OStatement_Base();
- int prepareAndDescribeStatement(const OUString& sqlIn,
- isc_stmt_handle& aStatementHandle,
- XSQLDA*& pOutSqlda,
- XSQLDA* pInSqlda=0);
- ::rtl::OUString sanitizeSqlString(const OUString& sqlIn);
- public:
-
- ::cppu::OBroadcastHelper& rBHelper;
- OStatement_Base(OConnection* _pConnection);
- using OStatement_BASE::operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >;
-
- // OComponentHelper
- virtual void SAL_CALL disposing(void){OStatement_BASE::disposing();}
- // XInterface
- virtual void SAL_CALL release() throw();
- virtual void SAL_CALL acquire() throw();
- // XInterface
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
- //XTypeProvider
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
-
- // XPropertySet
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
- // XStatement
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ;
- virtual sal_Int32 SAL_CALL executeUpdate( const ::rtl::OUString& sqlIn ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ;
- virtual sal_Bool SAL_CALL execute( const ::rtl::OUString& sql ) 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) ;
-
- // XWarningsSupplier - UNSUPPORTED
- 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);
- // XMultipleResults - UNSUPPORTED
- 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);
-
- // 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);
-
- // other methods
- OConnection* getOwnConnection() const { return m_pConnection;}
-
- };
-
class OStatement : public OStatement_Base,
public ::com::sun::star::sdbc::XBatchExecution,
public ::com::sun::star::lang::XServiceInfo
diff --git a/connectivity/source/drivers/firebird/StatementCommonBase.cxx b/connectivity/source/drivers/firebird/StatementCommonBase.cxx
new file mode 100644
index 0000000..4816f0f
--- /dev/null
+++ b/connectivity/source/drivers/firebird/StatementCommonBase.cxx
@@ -0,0 +1,468 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * the BSD license.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *************************************************************************/
+
+#include "FResultSet.hxx"
+#include "StatementCommonBase.hxx"
+#include "Util.hxx"
+
+#include <comphelper/sequence.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <propertyids.hxx>
+#include <TConnection.hxx>
+
+using namespace ::connectivity::firebird;
+
+using namespace ::com::sun::star;
+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;
+
+using namespace ::comphelper;
+using namespace ::osl;
+using namespace ::rtl;
+using namespace ::std;
+
+OStatement_Base::OStatement_Base(OConnection* _pConnection)
+ : OStatement_BASE(_pConnection->getMutex()),
+ OPropertySetHelper(OStatement_BASE::rBHelper),
+ m_pConnection(_pConnection),
+ rBHelper(OStatement_BASE::rBHelper)
+{
+ m_pConnection->acquire();
+}
+
+OStatement_Base::~OStatement_Base()
+{
+}
+
+void OStatement_Base::disposeResultSet()
+{
+ //free the cursor if alive
+// uno::Reference< XComponent > xComp(m_xResultSet.get(), UNO_QUERY);
+// if (xComp.is())
+// xComp->dispose();
+// m_xResultSet = uno::Reference< XResultSet>();
+}
+
+//-----------------------------------------------------------------------------
+Any SAL_CALL OStatement_Base::queryInterface( const Type & rType ) throw(RuntimeException)
+{
+ Any aRet = OStatement_BASE::queryInterface(rType);
+ if(!aRet.hasValue())
+ aRet = OPropertySetHelper::queryInterface(rType);
+ return aRet;
+}
+// -------------------------------------------------------------------------
+Sequence< Type > SAL_CALL OStatement_Base::getTypes( ) throw(RuntimeException)
+{
+ ::cppu::OTypeCollection aTypes(
+ ::cppu::UnoType< uno::Reference< XMultiPropertySet > >::get(),
+ ::cppu::UnoType< uno::Reference< XFastPropertySet > >::get(),
+ ::cppu::UnoType< uno::Reference< XPropertySet > >::get());
+
+ return concatSequences(aTypes.getTypes(),OStatement_BASE::getTypes());
+}
+// -------------------------------------------------------------------------
+
+void SAL_CALL OStatement_Base::cancel( ) throw(RuntimeException)
+{
+ MutexGuard aGuard(m_pConnection->getMutex());
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ // cancel the current sql statement
+}
+// -------------------------------------------------------------------------
+
+void SAL_CALL OStatement_Base::close( ) throw(SQLException, RuntimeException)
+{
+ SAL_INFO("connectivity.firebird", "close().");
+
+ {
+ MutexGuard aGuard(m_pConnection->getMutex());
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ }
+ dispose();
+}
+
+// ---- XStatement -----------------------------------------------------------
+sal_Int32 SAL_CALL OStatement_Base::executeUpdate(const OUString& sqlIn)
+ throw(SQLException, RuntimeException)
+{
+ // TODO: close ResultSet if existing -- so so in all 3 execute methods.
+ MutexGuard aGuard(m_pConnection->getMutex());
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ const OUString sql = sanitizeSqlString(sqlIn);
+
+ int aErr = isc_dsql_execute_immediate(m_statusVector,
+ &m_pConnection->getDBHandle(),
+ &m_pConnection->getTransaction(),
+ 0,
+ OUStringToOString(sql, RTL_TEXTENCODING_UTF8).getStr(),
+ 1,
+ NULL);
+
+ if (aErr)
+ SAL_WARN("connectivity.firebird", "isc_dsql_execute_immediate failed" );
+
+ m_pConnection->evaluateStatusVector(m_statusVector, sql, *this);
+ // TODO: get number of changed rows with SELECT ROW_COUNT (use executeQuery)
+ // return getUpdateCount();
+ return 0;
+}
+
+OUString OStatement_Base::sanitizeSqlString(const OUString& sqlIn)
+{
+ // TODO: verify this is all we need.
+ static const sal_Unicode pattern('"');
+ static const sal_Unicode empty(' ');
+ return sqlIn.replace(pattern, empty);
+}
+
+int OStatement_Base::prepareAndDescribeStatement(const OUString& sqlIn,
+ isc_stmt_handle& aStatementHandle,
+ XSQLDA*& pOutSqlda,
+ XSQLDA* pInSqlda)
+{
+ MutexGuard aGuard(m_pConnection->getMutex());
+
+ const OUString sql = sanitizeSqlString(sqlIn);
+
+ if (!pOutSqlda)
+ {
+ pOutSqlda = (XSQLDA*) malloc(XSQLDA_LENGTH(10));
+ pOutSqlda->version = SQLDA_VERSION1;
+ pOutSqlda->sqln = 10;
+ }
+
+ int aErr = 0;
+
+ aErr = isc_dsql_allocate_statement(m_statusVector,
+ &m_pConnection->getDBHandle(),
+ &aStatementHandle);
+
+ if (aErr)
+ {
+ SAL_WARN("connectivity.firebird", "isc_dsql_allocate_statement failed");
+ return aErr;
+ }
+ else
+ {
+ aErr = isc_dsql_prepare(m_statusVector,
+ &m_pConnection->getTransaction(),
+ &aStatementHandle,
+ 0,
+ OUStringToOString(sql, RTL_TEXTENCODING_UTF8).getStr(),
+ 1,
+ pInSqlda);
+ }
+
+ if (aErr)
+ {
+ SAL_WARN("connectivity.firebird", "isc_dsql_prepare failed");
+ return aErr;
+ }
+ else
+ {
+ aErr = isc_dsql_describe(m_statusVector,
+ &aStatementHandle,
+ 1,
+ pOutSqlda);
+ }
+
+ // Ensure we have enough space in pOutSqlda
+ if (aErr)
+ {
+ SAL_WARN("connectivity.firebird", "isc_dsql_describe failed");
+ return aErr;
+ }
+ else if (!aErr && (pOutSqlda->sqld > pOutSqlda->sqln))
+ {
+ int n = pOutSqlda->sqld;
+ free(pOutSqlda);
+ pOutSqlda = (XSQLDA*) malloc(XSQLDA_LENGTH(n));
+ pOutSqlda->version = SQLDA_VERSION1;
+ aErr = isc_dsql_describe(m_statusVector,
+ &aStatementHandle,
+ 1,
+ pOutSqlda);
+ }
+
+ // Process each XSQLVAR parameter structure in the output XSQLDA
+ if (aErr)
+ {
+ SAL_WARN("connectivity.firebird","isc_dsql_describe failed when resizing pOutSqlda");
+ return aErr;
+ }
+ else
+ {
+ mallocSQLVAR(pOutSqlda);
+ }
+
+ return aErr;
+}
+
+uno::Reference< XResultSet > SAL_CALL OStatement_Base::executeQuery(const OUString& sqlIn) throw(SQLException, RuntimeException)
+{
+ MutexGuard aGuard(m_pConnection->getMutex());
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ const OUString sql = sanitizeSqlString(sqlIn);
+
+ XSQLDA* pOutSqlda = 0;
+ isc_stmt_handle aStatementHandle = 0;
+ int aErr = 0;
+
+
+ aErr = prepareAndDescribeStatement(sql,
+ aStatementHandle,
+ pOutSqlda);
+ if (aErr)
+ {
+ SAL_WARN("connectivity.firebird", "prepareAndDescribeStatement failed");
+ }
+ else
+ {
+ aErr = isc_dsql_execute(m_statusVector,
+ &m_pConnection->getTransaction(),
+ &aStatementHandle,
+ 1,
+ NULL);
+ if (aErr)
+ SAL_WARN("connectivity.firebird", "isc_dsql_execute failed" );
+ }
+
+ uno::Reference< OResultSet > pResult(new OResultSet(m_pConnection,
+ uno::Reference< XStatement >(this),
+ aStatementHandle,
+ pOutSqlda));
+ //initializeResultSet( pResult.get() );
+ m_xResultSet = pResult.get();
+
+ // TODO: deal with cleanup
+// close();
+ m_pConnection->evaluateStatusVector(m_statusVector, sql, *this);
+ return m_xResultSet;
+}
+
+sal_Bool SAL_CALL OStatement_Base::execute(const OUString& sqlIn) throw(SQLException, RuntimeException)
+{
+ SAL_INFO("connectivity.firebird", "executeQuery(). "
+ "Got called with sql: " << sqlIn);
+
+ MutexGuard aGuard(m_pConnection->getMutex());
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ XSQLDA* pOutSqlda = 0;
+ isc_stmt_handle aStatementHandle = 0;
+ int aErr = 0;
+
+ const OUString sql = sanitizeSqlString(sqlIn);
+
+ aErr = prepareAndDescribeStatement(sql,
+ aStatementHandle,
+ pOutSqlda);
+
+ if (aErr)
+ {
+ SAL_WARN("connectivity.firebird", "prepareAndDescribeStatement failed" );
+ }
+ else
+ {
+ aErr = isc_dsql_execute(m_statusVector,
+ &m_pConnection->getTransaction(),
+ &aStatementHandle,
+ 1,
+ NULL);
+ if (aErr)
+ SAL_WARN("connectivity.firebird", "isc_dsql_execute failed" );
+ }
+
+ m_pConnection->evaluateStatusVector(m_statusVector, sql, *this);
+
+ // returns true when a resultset is available
+ return sal_False;
+}
+
+uno::Reference< XConnection > SAL_CALL OStatement_Base::getConnection()
+ throw(SQLException, RuntimeException)
+{
+ MutexGuard aGuard(m_pConnection->getMutex());
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ return (uno::Reference< XConnection >)m_pConnection;
+}
+
+// ---- XMultipleResults - UNSUPPORTED ----------------------------------------
+uno::Reference< XResultSet > SAL_CALL OStatement_Base::getResultSet() throw(SQLException, RuntimeException)
+{
+ // TODO: verify we really can't support this
+ return uno::Reference< XResultSet >();
+// MutexGuard aGuard( m_aMutex );
+// checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+// return m_xResultSet;
+}
+
+sal_Bool SAL_CALL OStatement_Base::getMoreResults() throw(SQLException, RuntimeException)
+{
+ // TODO: verify we really can't support this
+ return sal_False;
+// MutexGuard aGuard( m_aMutex );
+// checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+}
+
+sal_Int32 SAL_CALL OStatement_Base::getUpdateCount() throw(SQLException, RuntimeException)
+{
+ // TODO: verify we really can't support this
+ return 0;
+}
+
+
+// ---- XWarningsSupplier - UNSUPPORTED ----------------------------------------
+Any SAL_CALL OStatement_Base::getWarnings() throw(SQLException, RuntimeException)
+{
+ return Any();
+}
+
+void SAL_CALL OStatement_Base::clearWarnings() throw(SQLException, RuntimeException)
+{
+}
+
+::cppu::IPropertyArrayHelper* OStatement_Base::createArrayHelper( ) const
+{
+ // this properties are define by the service statement
+ // they must in alphabetic order
+ Sequence< Property > aProps(10);
+ Property* pProperties = aProps.getArray();
+ sal_Int32 nPos = 0;
+ DECL_PROP0(CURSORNAME, OUString);
+ DECL_BOOL_PROP0(ESCAPEPROCESSING);
+ DECL_PROP0(FETCHDIRECTION,sal_Int32);
+ DECL_PROP0(FETCHSIZE, sal_Int32);
+ DECL_PROP0(MAXFIELDSIZE,sal_Int32);
+ DECL_PROP0(MAXROWS, sal_Int32);
+ DECL_PROP0(QUERYTIMEOUT,sal_Int32);
+ DECL_PROP0(RESULTSETCONCURRENCY,sal_Int32);
+ DECL_PROP0(RESULTSETTYPE,sal_Int32);
+ DECL_BOOL_PROP0(USEBOOKMARKS);
+
+ return new ::cppu::OPropertyArrayHelper(aProps);
+}
+
+
+::cppu::IPropertyArrayHelper & OStatement_Base::getInfoHelper()
+{
+ return *const_cast<OStatement_Base*>(this)->getArrayHelper();
+}
+// -------------------------------------------------------------------------
+sal_Bool OStatement_Base::convertFastPropertyValue(
+ Any & rConvertedValue,
+ Any & rOldValue,
+ sal_Int32 nHandle,
+ const Any& rValue )
+ throw (IllegalArgumentException)
+{
+ (void) rConvertedValue;
+ (void) rOldValue;
+ (void) nHandle;
+ (void) rValue;
+ sal_Bool bConverted = sal_False;
+ // here we have to try to convert
+ return bConverted;
+}
+// -------------------------------------------------------------------------
+void OStatement_Base::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) throw (Exception)
+{
+ (void) rValue;
+ // set the value to what ever is necessary
+ switch(nHandle)
+ {
+ 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:
+ ;
+ }
+}
+// -------------------------------------------------------------------------
+void OStatement_Base::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const
+{
+ (void) rValue;
+ switch(nHandle)
+ {
+ 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:
+ ;
+ }
+}
+
+void SAL_CALL OStatement_Base::acquire() throw()
+{
+ OStatement_BASE::acquire();
+}
+
+void SAL_CALL OStatement_Base::release() throw()
+{
+ OStatement_BASE::release();
+}
+
+uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OStatement_Base::getPropertySetInfo( ) throw(RuntimeException)
+{
+ return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/firebird/StatementCommonBase.hxx b/connectivity/source/drivers/firebird/StatementCommonBase.hxx
new file mode 100644
index 0000000..7ee121c
--- /dev/null
+++ b/connectivity/source/drivers/firebird/StatementCommonBase.hxx
@@ -0,0 +1,154 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * the BSD license.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *************************************************************************/
+
+#ifndef CONNECTIVITY_FIREBIRD_STATEMENT_BASE_HXX
+#define CONNECTIVITY_FIREBIRD_STATEMENT_BASE_HXX
+
+#include "FConnection.hxx"
+
+#include <ibase.h>
+
+#include <connectivity/OSubComponent.hxx>
+#include <cppuhelper/compbase5.hxx>
+#include <list>
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/sdbc/SQLWarning.hpp>
+#include <com/sun/star/sdbc/XBatchExecution.hpp>
+#include <com/sun/star/sdbc/XCloseable.hpp>
+#include <com/sun/star/sdbc/XMultipleResults.hpp>
+#include <com/sun/star/sdbc/XStatement.hpp>
+#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
+#include <com/sun/star/util/XCancellable.hpp>
+
+namespace connectivity
+{
+ namespace firebird
+ {
+
+ typedef ::cppu::WeakComponentImplHelper5< ::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;
+
+ class OStatement_Base : public OStatement_BASE,
+ public ::cppu::OPropertySetHelper,
+ public OPropertyArrayUsageHelper<OStatement_Base>
+
+ {
+ protected:
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XResultSet> m_xResultSet; // The last ResultSet created
+ // for this Statement
+
+ ::std::list< ::rtl::OUString> m_aBatchList;
+
+ OConnection* m_pConnection;
+
+ ISC_STATUS_ARRAY m_statusVector;
+ protected:
+
+ void disposeResultSet();
+
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
+ // OPropertySetHelper
+ using OPropertySetHelper::getFastPropertyValue;
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+ virtual sal_Bool SAL_CALL convertFastPropertyValue(
+ ::com::sun::star::uno::Any & rConvertedValue,
+ ::com::sun::star::uno::Any & rOldValue,
+ sal_Int32 nHandle,
+ const ::com::sun::star::uno::Any& rValue )
+ throw (::com::sun::star::lang::IllegalArgumentException);
+ 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 getFastPropertyValue(
+ ::com::sun::star::uno::Any& rValue,
+ sal_Int32 nHandle) const;
+ virtual ~OStatement_Base();
+ int prepareAndDescribeStatement(const OUString& sqlIn,
+ isc_stmt_handle& aStatementHandle,
+ XSQLDA*& pOutSqlda,
+ XSQLDA* pInSqlda=0);
+ ::rtl::OUString sanitizeSqlString(const OUString& sqlIn);
+ public:
+
+ ::cppu::OBroadcastHelper& rBHelper;
+ OStatement_Base(OConnection* _pConnection);
+ using OStatement_BASE::operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >;
+
+ // OComponentHelper
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list