User: obo Date: 2006/07/13 08:13:05 Modified: dba/connectivity/source/commontools/dbconversion.cxx
Log: INTEGRATION: CWS dba204a (1.24.32); FILE MERGED 2006/07/06 12:15:36 oj 1.24.32.3: #i65063# convert only timestamp 2006/07/05 07:59:00 oj 1.24.32.2: RESYNC: (1.24-1.25); FILE MERGED 2006/05/05 09:25:10 oj 1.24.32.1: #i65063# use nanos as well File Changes: Directory: /dba/connectivity/source/commontools/ ================================================ File [changed]: dbconversion.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/commontools/dbconversion.cxx?r1=1.25&r2=1.26 Delta lines: +15 -6 -------------------- --- dbconversion.cxx 20 Jun 2006 01:05:37 -0000 1.25 +++ dbconversion.cxx 13 Jul 2006 15:13:03 -0000 1.26 @@ -118,6 +118,8 @@ aTemp += ::rtl::OUString::createFromAscii(" "); Time aTime(0,_rDateTime.Seconds,_rDateTime.Minutes,_rDateTime.Hours); aTemp += toTimeString(aTime); + aTemp += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".")); + aTemp += ::rtl::OUString::valueOf(static_cast<sal_Int32>(_rDateTime.HundredthSeconds)); return aTemp; } //------------------------------------------------------------------------------ @@ -456,9 +458,9 @@ //----------------------------------------------------------------------------- DateTime DBTypeConversion::toDateTime(const ::rtl::OUString& _sSQLString) { - // This is very suspicious. Is there any documentation about the format of the string? - // Our assumption is that it's "YYYY-MM-DD HH:MM:SS", which makes sense, but how do we know? - // #i14997# - 2003-06-05 - [EMAIL PROTECTED] + //@see http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Timestamp.html#valueOf(java.lang.String) + //@see http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Date.html#valueOf(java.lang.String) + //@see http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Time.html#valueOf(java.lang.String) // the date part Date aDate = toDate(_sSQLString); @@ -467,7 +469,7 @@ if ( -1 != nSeparation ) aTime = toTime( _sSQLString.copy( nSeparation ) ); - return DateTime(0,aTime.Seconds,aTime.Minutes,aTime.Hours,aDate.Day,aDate.Month,aDate.Year); + return DateTime(aTime.HundredthSeconds,aTime.Seconds,aTime.Minutes,aTime.Hours,aDate.Day,aDate.Month,aDate.Year); } //----------------------------------------------------------------------------- @@ -478,15 +480,22 @@ sal_Int32 nIndex = 0; sal_uInt16 nHour = 0, nMinute = 0, - nSecond = 0; + nSecond = 0, + nNano = 0; nHour = (sal_uInt16)_sSQLString.getToken(0,sTimeSep,nIndex).toInt32(); if(nIndex != -1) { nMinute = (sal_uInt16)_sSQLString.getToken(0,sTimeSep,nIndex).toInt32(); if(nIndex != -1) + { nSecond = (sal_uInt16)_sSQLString.getToken(0,sTimeSep,nIndex).toInt32(); + nIndex = 0; + ::rtl::OUString sNano(_sSQLString.getToken(1,'.',nIndex)); + if ( sNano.getLength() ) + nNano = (sal_uInt16)sNano.toInt32(); + } } - return Time(0,nSecond,nMinute,nHour); + return Time(nNano,nSecond,nMinute,nHour); } //......................................................................... --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
