summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorAndrzej J.R. Hunt <andrzej@ahunt.org>2013-08-29 10:49:01 +0100
committerAndrzej J.R. Hunt <andrzej@ahunt.org>2013-08-30 11:33:11 +0100
commit84fe40e3699adea7b7ef6476d324d63aada9c5ad (patch)
tree7a79c258c512dfc20d769dbab14c91ceb37ad183 /connectivity
parent93e9f05c26e23cf99f80ebd55dc7c22335cad979 (diff)
Implement set[Date|Time]. (firebird-sdbc)
Change-Id: Ia519b2ec9c6be94f6f21bbd2951a295da8079479
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/firebird/PreparedStatement.cxx34
1 files changed, 20 insertions, 14 deletions
diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx b/connectivity/source/drivers/firebird/PreparedStatement.cxx
index c38e8d3f8e2d..0069d7129a12 100644
--- a/connectivity/source/drivers/firebird/PreparedStatement.cxx
+++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx
@@ -390,26 +390,32 @@ void SAL_CALL OPreparedStatement::setDouble(sal_Int32 nIndex, double nValue)
setValue< double >(nIndex, nValue, SQL_DOUBLE); // TODO: SQL_D_FLOAT?
}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setDate( sal_Int32 parameterIndex, const Date& aData ) throw(SQLException, RuntimeException)
+void SAL_CALL OPreparedStatement::setDate(sal_Int32 nIndex, const Date& rDate)
+ throw(SQLException, RuntimeException)
{
- (void) parameterIndex;
- (void) aData;
- ::osl::MutexGuard aGuard( m_pConnection->getMutex() );
- checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
+ struct tm aCTime;
+ aCTime.tm_mday = rDate.Day;
+ aCTime.tm_mon = rDate.Month;
+ aCTime.tm_year = rDate.Year;
-}
-// -------------------------------------------------------------------------
+ ISC_DATE aISCDate;
+ isc_encode_sql_date(&aCTime, &aISCDate);
+ setValue< ISC_DATE >(nIndex, aISCDate, SQL_TYPE_DATE);
+}
-void SAL_CALL OPreparedStatement::setTime( sal_Int32 parameterIndex, const Time& aVal ) throw(SQLException, RuntimeException)
+void SAL_CALL OPreparedStatement::setTime( sal_Int32 nIndex, const Time& rTime)
+ throw(SQLException, RuntimeException)
{
- (void) parameterIndex;
- (void) aVal;
- ::osl::MutexGuard aGuard( m_pConnection->getMutex() );
- checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
+ struct tm aCTime;
+ aCTime.tm_sec = rTime.Seconds;
+ aCTime.tm_min = rTime.Minutes;
+ aCTime.tm_hour = rTime.Hours;
+
+ ISC_TIME aISCTime;
+ isc_encode_sql_time(&aCTime, &aISCTime);
+ setValue< ISC_TIME >(nIndex, aISCTime, SQL_TYPE_TIME);
}
void SAL_CALL OPreparedStatement::setTimestamp(sal_Int32 nIndex, const DateTime& rTimestamp)