summaryrefslogtreecommitdiffstats
path: root/connectivity
diff options
context:
space:
mode:
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/firebird/PreparedStatement.cxx9
-rw-r--r--connectivity/source/drivers/firebird/ResultSet.cxx12
2 files changed, 16 insertions, 5 deletions
diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx b/connectivity/source/drivers/firebird/PreparedStatement.cxx
index afe1fa3229a6..f97895ec530e 100644
--- a/connectivity/source/drivers/firebird/PreparedStatement.cxx
+++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -463,6 +463,10 @@ void SAL_CALL OPreparedStatement::setTime( sal_Int32 nIndex, const css::util::Ti
ISC_TIME aISCTime;
isc_encode_sql_time(&aCTime, &aISCTime);
+ // Here we "know" that ISC_TIME is simply in units of seconds/ISC_TIME_SECONDS_PRECISION with no
+ // other funkiness, so we can simply add the fraction of a second.
+ aISCTime += rTime.NanoSeconds / (1000000000 / ISC_TIME_SECONDS_PRECISION);
+
setValue< ISC_TIME >(nIndex, aISCTime, SQL_TYPE_TIME);
}
@@ -479,6 +483,9 @@ void SAL_CALL OPreparedStatement::setTimestamp(sal_Int32 nIndex, const DateTime&
ISC_TIMESTAMP aISCTimestamp;
isc_encode_timestamp(&aCTime, &aISCTimestamp);
+ // As in previous function
+ aISCTimestamp.timestamp_time += rTimestamp.NanoSeconds / (1000000000 / ISC_TIME_SECONDS_PRECISION);
+
setValue< ISC_TIMESTAMP >(nIndex, aISCTimestamp, SQL_TIMESTAMP);
}
diff --git a/connectivity/source/drivers/firebird/ResultSet.cxx b/connectivity/source/drivers/firebird/ResultSet.cxx
index 9e8387d39a3d..20fe2a4dab1e 100644
--- a/connectivity/source/drivers/firebird/ResultSet.cxx
+++ b/connectivity/source/drivers/firebird/ResultSet.cxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -526,9 +526,12 @@ Time OResultSet::retrieveValue(const sal_Int32 nColumnIndex, const ISC_SHORT /*n
struct tm aCTime;
isc_decode_sql_time(&aISCTime, &aCTime);
- // first field is nanoseconds -- not supported in firebird or struct tm.
+ // First field is nanoseconds.
// last field denotes UTC (true) or unknown (false)
- return Time(0, aCTime.tm_sec, aCTime.tm_min, aCTime.tm_hour, false);
+ // Here we "know" that ISC_TIME is simply in units of seconds/ISC_TIME_SECONDS_PRECISION
+ // with no other funkiness, so we can get the fractional seconds easily.
+ return Time((aISCTime % ISC_TIME_SECONDS_PRECISION) * (1000000000 / ISC_TIME_SECONDS_PRECISION),
+ aCTime.tm_sec, aCTime.tm_min, aCTime.tm_hour, false);
}
else
{
@@ -546,7 +549,8 @@ DateTime OResultSet::retrieveValue(const sal_Int32 nColumnIndex, const ISC_SHORT
struct tm aCTime;
isc_decode_timestamp(&aISCTimestamp, &aCTime);
- return DateTime(0, //nanoseconds, not supported
+ // Ditto here, see comment in previous function about ISC_TIME and ISC_TIME_SECONDS_PRECISION.
+ return DateTime((aISCTimestamp.timestamp_time % ISC_TIME_SECONDS_PRECISION) * (1000000000 / ISC_TIME_SECONDS_PRECISION), //nanoseconds
aCTime.tm_sec,
aCTime.tm_min,
aCTime.tm_hour,