You are not logged in.
[Delphi 10.4/10.3.3, Win64 target, Zeos, FB 2.5.9]
Currently, I have a trouble with one of my old projects, using legacy FB DB and TIME field in a table (TDateTime in TSQLRecord). All worked fine before, but suddenly I noticed, that TSQLRecord.FillOne fills this field with value 0 - always.
I tried to find the commit, where the change has happened in mORMot and Zeos repos, but failed.
Then I tried to debug and found that TSQLPropInfoRTTIDateTime.SetValue retrieves a shortened value, like 'T08:00:0' (without last digit). Therefore it seemed to me that Iso8601ToDateTimePUTF8CharVar counts the result incorrectly (due to highly incorrect SS value).
Is there some bug, or is it something wrong with my code?
Offline
I guess 'T08:00:0' is invalid, and should not be converted.
So the problem seems not in TSQLPropInfoRTTIDateTime.SetValue / Iso8601ToDateTimePUTF8CharVar but before that, when it is retrieved from the DB.
Could you investigate a little further and check why 'T08:00:0' is returned from the DB? It should not.
Offline
well, I continued the investigation, and when I got to SynDBZeos.TSQLDBZEOSStatement.ColumnsToJSON procedure, I noticed there
{$if defined(ZEOS73UP) and defined(USE_SYNCOMMONS)}
fResultSet.ColumnsToJSON(WR,fJSONComposeOptions);
{$else}
...
And since I have USE_SYNCOMMONS definition in all mORMot+Zeos projects according to @EgonHugeist recommendation, this code is running.
I tried to rebuild the project without USE_SYNCOMMONS, and all worked as intended.
That's why I couldn't find the particular change in mORMot and Zeos repos
So, I guess, the problem is somewhere in fResultSet.ColumnsToJSON, which launches with USE_SYNCOMMONS. Does it help somehow, or I should go deeper?
Last edited by Vitaly (2020-05-29 09:43:33)
Offline
ok, probably, I've found the typo in ZDbcFirebirdInterbase.pas (latest Zeos git-master commit, line 1678, TZAbstractInterbaseFirebirdResultSet.ColumnsToJSON procedure):
JSONWriter.AddNoJSONEscape(@FTinyBuffer[0],8+(4*Ord(jcoMilliseconds in JSONComposeOptions)));
I assume there should be 9 instead of 8: THH:MM:SS.
If I change it to
JSONWriter.AddNoJSONEscape(@FTinyBuffer[0],9+(4*Ord(jcoMilliseconds in JSONComposeOptions)));
it works fine with USE_SYNCOMMONS
Offline
Hello vitaly,
i'm sorry for that regression. I just didn't count the 'T' delimiter in my mind. Other drivers had the same mistake(copy+paste issue), so i fixed them all. Plz update from SVN. Regression gone?
Michael
Offline
Hi Michael! Yes, with [r6577] almost all works fine. Thank you!
Could you only make a couple of additional tiny fixes (or it won't compile):
ZDbcMySqlResultSet.pas, line 508. Missing closing bracket. Fixed line:
JSONWriter.AddNoJSONEscape(PUTF8Char(FByteBuffer),9+(4*Ord(jcoMilliseconds in JSONComposeOptions)));
ZDbcOracleResultSet.pas, line 500. Excess closing bracket. Fixed line:
JSONWriter.AddNoJSONEscape(PUTF8Char(fByteBuffer),9);
Offline
Offline