diff options
author | Andrzej J.R. Hunt <andrzej@ahunt.org> | 2013-08-30 11:27:30 +0100 |
---|---|---|
committer | Andrzej J.R. Hunt <andrzej@ahunt.org> | 2013-08-30 11:33:12 +0100 |
commit | 026fe9c53bc97729cd506376dd966c9e66d34a8c (patch) | |
tree | a74a16af40fa6cc64259bfddb68bf170a7e40665 /connectivity | |
parent | 437dd0369a759e32ef8788b1829bc3b355952518 (diff) |
Implement setTimeStamp. (firebird-sdbc)
Change-Id: I58907d42ec9e1b4098e2947fdb89b1ab264358a6
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/source/drivers/firebird/ResultSet.cxx | 18 |
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); } // ------------------------------------------------------------------------- |