diff options
author | Andrzej J.R. Hunt <andrzej@ahunt.org> | 2013-08-29 10:04:33 +0100 |
---|---|---|
committer | Andrzej J.R. Hunt <andrzej@ahunt.org> | 2013-08-29 10:07:41 +0100 |
commit | d5cb782f9e84e1371c5e0c829f5c564fa7edee40 (patch) | |
tree | 30d10518c2b63864832c00b715c117dcfb917cbd /connectivity/source/drivers/firebird/PreparedStatement.cxx | |
parent | e218242ebd8bbf5dbd5a995a6881cbdd2ee106e1 (diff) |
Implement setTimestamp. (firebird-sdbc)
Change-Id: I0c009a99061de787cd250912406a74a75fbc260a
Diffstat (limited to 'connectivity/source/drivers/firebird/PreparedStatement.cxx')
-rw-r--r-- | connectivity/source/drivers/firebird/PreparedStatement.cxx | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx b/connectivity/source/drivers/firebird/PreparedStatement.cxx index 0a753db7e073..c38e8d3f8e2d 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); } // ------------------------------------------------------------------------- |