You are not logged in.
Pages: 1
I have the TNullableDateTime field in a TSQLRecord, which is mapped to the TIMESTAMP FB field.
After retrieving a record from DB (FillPrepare and FillOne) I see ISO8601 datetime value from the debugger.
Direct assigning
LLastUpdate := LSQLParty.LastUpdate;
causes runtime conversion error, and
LLastUpdate := NullableDateTimeToValue(LSQLParty.LastUpdate);
also doesn't work, because VType = 256.
Therefore I have to handle it like this
if not NullableDateTimeIsEmptyOrNull(LSQLParty.LastUpdate) then
LLastUpdate := Iso8601ToDateTime(LSQLParty.LastUpdate);
Is this done so by design, or I have misunderstood smth?
[Delphi 10.4, Win64, Zeos r6580, FB 2.5.9]
Offline
ok, will it slow down significantly (or brake smth), if in SynCommons.GetVariantFromJSON procedure instead of
with TVarData(Value) do begin
// found no numerical value -> return a string in the expected format
VType := varString;
VString := nil; // avoid GPF below when assigning a string variable to VAny
FastSetString(RawUTF8(VString),JSON,StrLen(JSON));
end;
will be smth like
with TVarData(Value) do
if IsIso8601(JSON, StrLen(JSON)) then begin
VType := varDate;
VDate := Iso8601ToDateTimePUTF8Char(JSON, StrLen(JSON));
end else begin
// found no numerical value -> return a string in the expected format
VType := varString;
VString := nil; // avoid GPF below when assigning a string variable to VAny
FastSetString(RawUTF8(VString),JSON,StrLen(JSON));
end;
NullableDateTimeToValue works good then, even with null value.
Maybe my suggestion is not optimized or/and wrongly formatted, but I at least tried...
Offline
Now I get your problem.
I guess the bug should rather be fixed in TSQLPropInfoRTTIVariant.
Please check https://synopse.info/fossil/info/64eda8fc9d
Offline
Pages: 1