How to disable a millisecond?

How to disable a millisecond?

Postby 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?
Vdovin_Sergei
 
Posts: 1
Joined: Mon 27 May 2013 21:47

Re: How to disable a millisecond?

Postby 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/Libraries/XE2/en/Data.SqlTimSt.TSQLTimeStamp
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;
AndreyZ
 


Return to dbExpress driver for InterBase & Firebird