You are not logged in.
Let's suppose we have the following types:
type ENum01 = (val_01, val_02, val_03);
ENum02 = (val_04, val_05, val_06);
TOrmOneClass = class(TOrm)
private
Ffield_01 : Integer;
Ffield_02 : TDateTime;
Ffield_03 : TDateTime;
Ffield_04 : RawUtf8;
Ffield_05 : TEnum01;
Ffield_06 : TEnum02;
published
property field_01 : Integer read Ffield_01 write Ffield_01;
...
end; So, after mORMot creates all SQLite fields, I can see, using 'SQLiteStudio' the 'OrmOneClass' table with the following types:
ID : INTEGER;
field_01 : INTEGER;
field_02 : TEXT;
field_03 : TEXT;
field_04 : TEXT;
field_05 : INTEGER;
field_06 : INTEGER;
In some part of my system I need to obtain the field types using the following code:
var ADataSet : TOrmTableDataSet;
JsonData : RawUtf8;
count : Integer;
ADataSet := TOrmTableDataSet.CreateFromJson(nil, JSonData); If I check the type of each field of 'ADataSet' with 'ADataSet.Fields[count].DataType', I have the following results:
ID : ftLargeInt;
field_01 : ftWideString;
field_02 : ftWideString;
field_03 : ftWideString;
field_04 : ftWideString;
field_05 : ftWideString;
field_06 : ftWideString;'ID' is as expected, but:
1) Why do ALL other fields become 'ftWideString'?
2) What is the proper way to obtain the correct field types of a 'TOrmTableDataSet' created from JSON?
Last edited by Prometeus (2025-11-21 16:48:42)
Offline
BTW which version of Delphi are you using?
Delphi 13
Last edited by Prometeus (2025-11-22 13:31:40)
Offline