connectivity/source/drivers/firebird/PreparedStatement.cxx | 26 ++++++++----- connectivity/source/drivers/firebird/PreparedStatement.hxx | 2 - 2 files changed, 18 insertions(+), 10 deletions(-)
New commits: commit d5cb782f9e84e1371c5e0c829f5c564fa7edee40 Author: Andrzej J.R. Hunt <andr...@ahunt.org> Date: Thu Aug 29 10:04:33 2013 +0100 Implement setTimestamp. (firebird-sdbc) Change-Id: I0c009a99061de787cd250912406a74a75fbc260a diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx b/connectivity/source/drivers/firebird/PreparedStatement.cxx index 0a753db..c38e8d3 100644 --- a/connectivity/source/drivers/firebird/PreparedStatement.cxx +++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx @@ -28,6 +28,7 @@ #include <cppuhelper/typeprovider.hxx> #include <osl/diagnose.h> #include <propertyids.hxx> +#include <time.h> #include <com/sun/star/sdbc/DataType.hpp> #include <com/sun/star/lang/DisposedException.hpp> @@ -410,15 +411,22 @@ void SAL_CALL OPreparedStatement::setTime( sal_Int32 parameterIndex, const Time& checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed); } -// ------------------------------------------------------------------------- -void SAL_CALL OPreparedStatement::setTimestamp( sal_Int32 parameterIndex, const DateTime& aVal ) throw(SQLException, RuntimeException) +void SAL_CALL OPreparedStatement::setTimestamp(sal_Int32 nIndex, const DateTime& rTimestamp) + throw(SQLException, RuntimeException) { - (void) parameterIndex; - (void) aVal; - ::osl::MutexGuard aGuard( m_pConnection->getMutex() ); - checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed); + struct tm aCTime; + aCTime.tm_sec = rTimestamp.Seconds; + aCTime.tm_min = rTimestamp.Minutes; + aCTime.tm_hour = rTimestamp.Hours; + aCTime.tm_mday = rTimestamp.Day; + aCTime.tm_mon = rTimestamp.Month; + aCTime.tm_year = rTimestamp.Year; + + ISC_TIMESTAMP aISCTimestamp; + isc_encode_timestamp(&aCTime, &aISCTimestamp); + setValue< ISC_TIMESTAMP >(nIndex, aISCTimestamp, SQL_TIMESTAMP); } // ------------------------------------------------------------------------- commit e218242ebd8bbf5dbd5a995a6881cbdd2ee106e1 Author: Andrzej J.R. Hunt <andr...@ahunt.org> Date: Thu Aug 29 09:49:37 2013 +0100 Pass by reference instead of value, fix template parameters. (firebird-sdbc) We will also want to pass structs etc. into setValue hence we should pass by reference. Change-Id: Ia8aa02ca14414003c33cd8d070510759091b5ec9 diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx b/connectivity/source/drivers/firebird/PreparedStatement.cxx index fdbb0a4..0a753db 100644 --- a/connectivity/source/drivers/firebird/PreparedStatement.cxx +++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx @@ -331,7 +331,7 @@ void SAL_CALL OPreparedStatement::setBoolean(sal_Int32 nIndex, sal_Bool x) } template <typename T> -void OPreparedStatement::setValue(sal_Int32 nIndex, T nValue, ISC_SHORT nType) +void OPreparedStatement::setValue(sal_Int32 nIndex, T& nValue, ISC_SHORT nType) throw(SQLException) { MutexGuard aGuard( m_pConnection->getMutex() ); @@ -380,13 +380,13 @@ void SAL_CALL OPreparedStatement::setLong(sal_Int32 nIndex, sal_Int64 nValue) void SAL_CALL OPreparedStatement::setFloat(sal_Int32 nIndex, float nValue) throw(SQLException, RuntimeException) { - setValue< sal_Int64 >(nIndex, nValue, SQL_FLOAT); + setValue< float >(nIndex, nValue, SQL_FLOAT); } void SAL_CALL OPreparedStatement::setDouble(sal_Int32 nIndex, double nValue) throw(SQLException, RuntimeException) { - setValue< sal_Int64 >(nIndex, nValue, SQL_DOUBLE); // TODO: SQL_D_FLOAT? + setValue< double >(nIndex, nValue, SQL_DOUBLE); // TODO: SQL_D_FLOAT? } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/firebird/PreparedStatement.hxx b/connectivity/source/drivers/firebird/PreparedStatement.hxx index 5392a93..c32be80 100644 --- a/connectivity/source/drivers/firebird/PreparedStatement.hxx +++ b/connectivity/source/drivers/firebird/PreparedStatement.hxx @@ -78,7 +78,7 @@ namespace connectivity * Set a numeric value in the input SQLDA. If the destination * parameter is not of nType then an Exception will be thrown. */ - template <typename T> void setValue(sal_Int32 nIndex, T nValue, ISC_SHORT nType) + template <typename T> void setValue(sal_Int32 nIndex, T& nValue, ISC_SHORT nType) throw(::com::sun::star::sdbc::SQLException); void setParameterNull(sal_Int32 nParameterIndex, bool bSetNull = true); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits