Ömür Ölmez
2008-07-04 10:30:14 UTC
Hello,
I have a timestamp column in a table.
/*create table table1(
ts timestamp
);*/
I insert records into table as below :
IBQuery.SQL.Text :=Format(
'insert into table1(ts) values(''%s'')',
[FornatDateTime('d.m.yyyy h:n:s:z', dtValue)]);
And I can see exact time value if I query by using console (Ex. 4.7.08
13:20:14.217).
But,
* In TDBGrid components, I always see tree zero as millisecond part of field
value even I set Field's DisplayFormat as 'dd.mm.yyyy hh:nn:ss:zzz'
properly.
* In programmatically accesing value as below, I always see tree zero again
:
var
dt :TDateTime;
begin
dt :=IBQuery1.FieldByName('ts').AsDateTime;
ShowMessage(FormatDateTime('dd.mm.yyyy hh:nn:ss:zzz', dt));
* If I try, FieldByName('ts').AsSQLTimestamp, it raises exception because of
it is not implemented (Delphi 6 EE).
* If I try getting data, by using GetFieldData method, the 8 bytes raw data
which comes from TField is differ from the 8 bytes raw data view of
TDateTime which I prepared by using EncodeDate and EncodeTime.
So, I guess, ib server has enough precision, but ibx truncates it some how.
Is it true ?
I do not need exact values in visuals (in TDBGrid etc.) I need excat values
when I access programmaticaly.
Is there any solution ?
Regards
Ömür Ölmez
I have a timestamp column in a table.
/*create table table1(
ts timestamp
);*/
I insert records into table as below :
IBQuery.SQL.Text :=Format(
'insert into table1(ts) values(''%s'')',
[FornatDateTime('d.m.yyyy h:n:s:z', dtValue)]);
And I can see exact time value if I query by using console (Ex. 4.7.08
13:20:14.217).
But,
* In TDBGrid components, I always see tree zero as millisecond part of field
value even I set Field's DisplayFormat as 'dd.mm.yyyy hh:nn:ss:zzz'
properly.
* In programmatically accesing value as below, I always see tree zero again
:
var
dt :TDateTime;
begin
dt :=IBQuery1.FieldByName('ts').AsDateTime;
ShowMessage(FormatDateTime('dd.mm.yyyy hh:nn:ss:zzz', dt));
* If I try, FieldByName('ts').AsSQLTimestamp, it raises exception because of
it is not implemented (Delphi 6 EE).
* If I try getting data, by using GetFieldData method, the 8 bytes raw data
which comes from TField is differ from the 8 bytes raw data view of
TDateTime which I prepared by using EncodeDate and EncodeTime.
So, I guess, ib server has enough precision, but ibx truncates it some how.
Is it true ?
I do not need exact values in visuals (in TDBGrid etc.) I need excat values
when I access programmaticaly.
Is there any solution ?
Regards
Ömür Ölmez