You are not logged in.
Pages: 1
I have a class derived from TSQLRecord, with several string fields.
I want to save the list/array of instances in one json file. Should I use array or TObjectList, and how to save and load? Eventually, convert that list into a dataset (with JSONToDataSet?).
Offline
Both works well.
For loading, you need to supply the TSQLRecord class type you are using, or the TSQLRecordDynArray for an array.
Of course the classical/regular Delphi way is to use a collection.
Usually, I prefer dynamic arrays.
No need to specify the type when you retrieve an item.
And you have plenty of ObjArray*() functions to manage them.
Do not forget to call ObjArrayClear() in a finally ObjArrayClear(arr); end; clause to actually release the TSQLRecord instances.
If you which to mORMot 2, you would have mORMot collections, which are even easier to use.
Offline
Pages: 1