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?
Milliseconds precision, test fail
Moderators: gto, EgonHugeist, olehs
-
- Expert Boarder
- Posts: 113
- Joined: 06.10.2006, 14:41
- Location: Chapecó - Santa Catarina
- Contact:
-
- Expert Boarder
- Posts: 113
- Joined: 06.10.2006, 14:41
- Location: Chapecó - Santa Catarina
- Contact:
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.
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.