Milliseconds precision, test fail

The alpha/beta tester's forum for ZeosLib 7.0.x series

Report problems concerning our Delphi 2009+ version and new Zeoslib 7.0 features here.

This is a forum that will be removed once the 7.X version goes into stable!!

Moderators: gto, EgonHugeist, olehs

Locked
papelhigienico
Expert Boarder
Expert Boarder
Posts: 113
Joined: 06.10.2006, 14:41
Location: Chapecó - Santa Catarina
Contact:

Milliseconds precision, test fail

Post by papelhigienico »

I did a change to support the milliseconds precision with certain databases like postgres and sqlite. But after this, running the tests, I got:

TIME() failed, expected: <1899-12-30 12:17:34> but was: <1899-12-30 12:17:34.465>

on

TZTestExpressionCase -> TestFunctionsDateTime

Now, I don't know if my change is wrong or if the test is wrong... Ideas?
seawolf
Zeos Dev Team *
Zeos Dev Team *
Posts: 385
Joined: 04.06.2008, 19:50
Contact:

Post by seawolf »

I think you changed the interface, so you need to change also the test.

I mean correctly that test fail because in one case millisecond are filtered, while in the other not.
papelhigienico
Expert Boarder
Expert Boarder
Posts: 113
Joined: 06.10.2006, 14:41
Location: Chapecó - Santa Catarina
Contact:

Post by papelhigienico »

Test fails at line 186 of ZTestExpression.pas

Expression := 'TIME()';
CheckEquals(FormatDateTime('yyyy-mm-dd hh":"nn":"ss',Time), SoftVarManager.GetAsString(Evaluate),Expression+' failed, ');


I changed two functions at ZSysUtils.pas

function AnsiSQLDateToDateTime(const Value: string): TDateTime; (values from DB to application)

and

function DateTimeToAnsiSQLDate(Value: TDateTime): string; (values from application to database)

So, I undid the changes in DateTimeToAnsiSQLDate and everything are ok on test. But, if a date/time value (with milliseconds) is inserted via a TZTable, the milliseconds are lost.

So, I thought that the best way to insert a date time value with milliseconds is doing your own Insert query. Maybe I'm wrong. Ideas?

I searched and the SQL-92 standard says nothing about milliseconds.
Locked