Kaydet (Commit) f98a193a authored tarafından Andrzej J.R. Hunt's avatar Andrzej J.R. Hunt

Implement the first parts of FPreparedStatement.

Change-Id: Iad9561fa6b200ce5efcacc4c0b7b822aaaf9adb0
üst 291b8796
...@@ -73,21 +73,22 @@ namespace connectivity ...@@ -73,21 +73,22 @@ namespace connectivity
}; };
::std::vector< Parameter> m_aParameters; ::std::vector< Parameter> m_aParameters;
//====================================================================
// Data attributes
//====================================================================
TTypeInfoVector m_aTypeInfo; // Hashtable containing an entry TTypeInfoVector m_aTypeInfo; // Hashtable containing an entry
// for each row returned by // for each row returned by
// DatabaseMetaData.getTypeInfo. // DatabaseMetaData.getTypeInfo.
sal_Int32 m_nNumParams; // Number of parameter markers
// for the prepared statement
::rtl::OUString m_sSqlStatement; ::rtl::OUString m_sSqlStatement;
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > m_xMetaData; ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > m_xMetaData;
sal_Bool m_bPrepared;
void checkParameterIndex(sal_Int32 _parameterIndex); isc_stmt_handle m_statementHandle;
XSQLDA* m_pOutSqlda;
XSQLDA* m_pInSqlda;
void checkParameterIndex(sal_Int32 nParameterIndex)
throw(::com::sun::star::sdbc::SQLException);
void ensurePrepared()
throw(::com::sun::star::sdbc::SQLException);
protected: protected:
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,
...@@ -117,7 +118,7 @@ namespace connectivity ...@@ -117,7 +118,7 @@ namespace connectivity
virtual sal_Bool SAL_CALL execute( ) 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); 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 // 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 setNull( sal_Int32 nParameterIndex, 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); 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);
virtual void SAL_CALL setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
......
...@@ -210,7 +210,7 @@ OUString OStatement_Base::sanitizeSqlString(const OUString& sqlIn) ...@@ -210,7 +210,7 @@ OUString OStatement_Base::sanitizeSqlString(const OUString& sqlIn)
{ {
// TODO: verify this is all we need. // TODO: verify this is all we need.
static const sal_Unicode pattern('"'); static const sal_Unicode pattern('"');
static const sal_Unicode empty('\''); static const sal_Unicode empty(' ');
return sqlIn.replace(pattern, empty); return sqlIn.replace(pattern, empty);
} }
...@@ -297,11 +297,13 @@ int OStatement_Base::prepareAndDescribeStatement(const OUString& sqlIn, ...@@ -297,11 +297,13 @@ int OStatement_Base::prepareAndDescribeStatement(const OUString& sqlIn,
return aErr; return aErr;
} }
uno::Reference< XResultSet > SAL_CALL OStatement_Base::executeQuery(const OUString& sql) throw(SQLException, RuntimeException) uno::Reference< XResultSet > SAL_CALL OStatement_Base::executeQuery(const OUString& sqlIn) throw(SQLException, RuntimeException)
{ {
MutexGuard aGuard(m_pConnection->getMutex()); MutexGuard aGuard(m_pConnection->getMutex());
checkDisposed(OStatement_BASE::rBHelper.bDisposed); checkDisposed(OStatement_BASE::rBHelper.bDisposed);
const OUString sql = sanitizeSqlString(sqlIn);
XSQLDA* pOutSqlda = 0; XSQLDA* pOutSqlda = 0;
isc_stmt_handle aStatementHandle = 0; isc_stmt_handle aStatementHandle = 0;
int aErr = 0; int aErr = 0;
......
...@@ -77,7 +77,6 @@ namespace connectivity ...@@ -77,7 +77,6 @@ namespace connectivity
OConnection* m_pConnection; OConnection* m_pConnection;
XSQLDA * m_INsqlda;
ISC_STATUS_ARRAY m_statusVector; ISC_STATUS_ARRAY m_statusVector;
protected: protected:
...@@ -146,7 +145,6 @@ namespace connectivity ...@@ -146,7 +145,6 @@ namespace connectivity
// other methods // other methods
OConnection* getOwnConnection() const { return m_pConnection;} OConnection* getOwnConnection() const { return m_pConnection;}
inline XSQLDA * getINsqlda() const { return m_INsqlda; }
}; };
class OStatement_BASE2 :public OStatement_Base class OStatement_BASE2 :public OStatement_Base
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment