diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2008-07-01 15:23:19 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2008-07-01 15:23:19 +0000 |
commit | 99df690cdcd23dc216aafff80e1e65f7d0b1b809 (patch) | |
tree | c0273a86ee66e4e19e9dc3018b97f0aa5fc81137 /sc/source/core/data/dpcachetable.cxx | |
parent | 1f7c0200f46309f7851b4c7738e2e83cca7e2cfd (diff) |
INTEGRATION: CWS dr62 (1.2.12); FILE MERGED
2008/06/03 18:21:47 nn 1.2.12.1: #i50344# allow TIME, TIMESTAMP in DataPilot from database
Diffstat (limited to 'sc/source/core/data/dpcachetable.cxx')
-rw-r--r-- | sc/source/core/data/dpcachetable.cxx | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/sc/source/core/data/dpcachetable.cxx b/sc/source/core/data/dpcachetable.cxx index e736307de..422b8f121 100644 --- a/sc/source/core/data/dpcachetable.cxx +++ b/sc/source/core/data/dpcachetable.cxx @@ -8,7 +8,7 @@ * * $RCSfile: dpcachetable.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * * This file is part of OpenOffice.org. * @@ -68,6 +68,8 @@ using ::com::sun::star::uno::UNO_QUERY; using ::com::sun::star::uno::UNO_QUERY_THROW; using ::com::sun::star::sheet::DataPilotFieldFilter; +const double D_TIMEFACTOR = 86400.0; + static BOOL lcl_HasQueryEntry( const ScQueryParam& rParam ) { return rParam.GetEntryCount() > 0 && @@ -422,8 +424,32 @@ void lcl_GetCellValue(const Reference<sdbc::XRow>& xRow, sal_Int32 nType, long n } break; - //! case sdbc::DataType::TIME: - //! case sdbc::DataType::TIMESTAMP: + case sdbc::DataType::TIME: + { + nNumType = NUMBERFORMAT_TIME; + + util::Time aTime = xRow->getTime(nCol); + rCell.mfValue = ( aTime.Hours * 3600 + aTime.Minutes * 60 + + aTime.Seconds + aTime.HundredthSeconds / 100.0 ) / D_TIMEFACTOR; + bEmptyFlag = xRow->wasNull(); + rCell.mbNumeric = true; + rCell.mnType = SC_VALTYPE_VALUE; + } + break; + + case sdbc::DataType::TIMESTAMP: + { + nNumType = NUMBERFORMAT_DATETIME; + + util::DateTime aStamp = xRow->getTimestamp(nCol); + rCell.mfValue = ( Date( aStamp.Day, aStamp.Month, aStamp.Year ) - rNullDate ) + + ( aStamp.Hours * 3600 + aStamp.Minutes * 60 + + aStamp.Seconds + aStamp.HundredthSeconds / 100.0 ) / D_TIMEFACTOR; + bEmptyFlag = xRow->wasNull(); + rCell.mbNumeric = true; + rCell.mnType = SC_VALTYPE_VALUE; + } + break; case sdbc::DataType::SQLNULL: case sdbc::DataType::BINARY: |