How to disable a millisecond?

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for InterBase & Firebird in Delphi and C++Builder
Post Reply
Vdovin_Sergei
Posts: 1
Joined: Mon 27 May 2013 21:47

How to disable a millisecond?

Post by Vdovin_Sergei » Mon 27 May 2013 22:14

Environment: dbExpress driver 4.2.3, Delphi XE 15.0.3953.35171, FireBird 1.5.6.

We are testing trial version of the driver and found that it inserts into the database TSQLTimeStamp with millisecond precision. However, the driver in DelphiXE (dbxfb.dll) are accurate to within seconds. We would like to have backward compatibility during the transition to your driver. So we are interested in whether it is possible to disable this accuracy?

AndreyZ

Re: How to disable a millisecond?

Post by AndreyZ » Tue 28 May 2013 06:56

The TSQLTimeStamp Delphi type holds the information about year, month, day, hour, minute, second, and fractions (that is, milliseconds). You can more information about this at http://docwiki.embarcadero.com/Librarie ... LTimeStamp
Our dbExpress driver for InterBase & Firebird correctly handles all this information. The fact that the standard driver for Firebird truncates milliseconds is a bug. You can write about this problem to the Embarcadero support.
If you want to remove milliseconds from TSQLTimeStamp, you should do it manually. Here is an example:

Code: Select all

var
  ts: TSQLTimeStamp;
begin
  // code
  ts := DateTimeToSQLTimeStamp(Now);
  ts.Fractions := 0;
  ClientDataSet.Append;
  ClientDataSet.FieldByName('timestampfield').AsSQLTimeStamp := ts;
  // code
end;

Post Reply