summaryrefslogtreecommitdiff
path: root/connectivity/source/drivers/firebird/ResultSet.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'connectivity/source/drivers/firebird/ResultSet.cxx')
-rw-r--r--connectivity/source/drivers/firebird/ResultSet.cxx18
1 files changed, 13 insertions, 5 deletions
diff --git a/connectivity/source/drivers/firebird/ResultSet.cxx b/connectivity/source/drivers/firebird/ResultSet.cxx
index 7b106c3f7d87..aec90bfa4a1f 100644
--- a/connectivity/source/drivers/firebird/ResultSet.cxx
+++ b/connectivity/source/drivers/firebird/ResultSet.cxx
@@ -363,7 +363,7 @@ T OResultSet::retrieveValue(sal_Int32 columnIndex)
{
// TODO: check we have the right type.
if ((m_bWasNull = isNull(columnIndex)))
- return 0;
+ return T();
return *((T*) m_pSqlda->sqlvar[columnIndex-1].sqldata);
}
@@ -401,6 +401,7 @@ OUString OResultSet::retrieveValue(sal_Int32 columnIndex)
template <>
ISC_QUAD* OResultSet::retrieveValue(sal_Int32 columnIndex)
{
+ // TODO: this is probably wrong
if ((m_bWasNull = isNull(columnIndex)))
return 0;
return (ISC_QUAD*) m_pSqlda->sqlvar[columnIndex-1].sqldata;
@@ -505,11 +506,18 @@ Time SAL_CALL OResultSet::getTime(sal_Int32 nIndex)
return Time(0, aCTime.tm_sec, aCTime.tm_min, aCTime.tm_hour, false);
}
-DateTime SAL_CALL OResultSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
+DateTime SAL_CALL OResultSet::getTimestamp(sal_Int32 nIndex)
+ throw(SQLException, RuntimeException)
{
- (void) columnIndex;
- return DateTime(); // TODO: implement
-// return safelyRetrieveValue(columnIndex);
+ ISC_TIMESTAMP aISCTimestamp = safelyRetrieveValue< ISC_TIMESTAMP >(nIndex);
+
+ struct tm aCTime;
+ isc_decode_timestamp(&aISCTimestamp, &aCTime);
+
+ // first field is nanoseconds -- not supported in firebird or struct tm.
+ // last field denotes UTC (true) or unknown (false)
+ return DateTime(0, aCTime.tm_sec, aCTime.tm_min, aCTime.tm_hour, aCTime.tm_mday,
+ aCTime.tm_mon, aCTime.tm_year, false);
}
// -------------------------------------------------------------------------