fields due to limitation in isc_decode_date function.
I propose to change the code in GetTimestamp from
Code: Select all
function TZResultSQLDA.GetTimestamp(const Index: Integer): TDateTime;
........
SQL_TIMESTAMP : begin
FPlainDriver.isc_decode_date(PISC_QUAD(sqldata), @TempDate);
Result := SysUtils.EncodeDate(TempDate.tm_year + 1900,
TempDate.tm_mon + 1, TempDate.tm_mday) + EncodeTime(TempDate.tm_hour,
TempDate.tm_min, TempDate.tm_sec, 0);
end;
SQL_TYPE_DATE : begin
FPlainDriver.isc_decode_sql_date(PISC_DATE(sqldata), @TempDate);
Result := SysUtils.EncodeDate(Word(TempDate.tm_year + 1900),
Word(TempDate.tm_mon + 1), Word(TempDate.tm_mday));
end;
SQL_TYPE_TIME : begin
FPlainDriver.isc_decode_sql_time(PISC_TIME(sqldata), @TempDate);
Result := SysUtils.EncodeTime(Word(TempDate.tm_hour), Word(TempDate.tm_min),
Word(TempDate.tm_sec), 0);
end;
Code: Select all
const ISC_TIME_SECONDS_PRECISION=10000;
TimeDivisor=24*60*60*ISC_TIME_SECONDS_PRECISION;
DateDelta=15018;// days between 17.11.1858 and 31.12.1899
........
function TZResultSQLDA.GetTimestamp(const Index: Integer): TDateTime;
........
SQL_TIMESTAMP : begin
With PISC_QUAD(sqldata)^ do
Result:=gds_quad_low/TimeDivisor+gds_quad_high-DateDelta;
end;
SQL_TYPE_DATE : begin
Result:=PISC_DATE(sqldata)^-DateDelta;
end;
SQL_TYPE_TIME : begin
Result:=PISC_TIME(sqldata)^/TimeDivisor;
end;
Thanks