You are not logged in.
@ab,
If you run this small test console project you'll get an EAccessViolation error
https://gist.github.com/edwinyzh/ea75bd … 3d59ee095f
The case is that a freeing a TSQLRecord-derived class which has a published property of type TRawUTF8List, created by CreateCopy, will cause the 'Access Violation' error.
Am I doing something wrong, is it by design, or is it a bug?
I'm using the latest mORMot rev:
https://github.com/synopse/mORMot/commi … 8b1605bf92
And the error also happens with previous versions.
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
After some debugging I wonder it might has something to do with TSQLPropInfoRTTIObject.CopySameClassProp?
Last edited by edwinsn (2020-05-13 11:24:20)
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
But when being stored in the db, a field of type TRawUTF8DynArray is not in JSON format? Persisting in JSON format is required in my use case.
Last edited by edwinsn (2020-05-14 07:55:24)
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
@ab,
I'm afraid it's still a bug?
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
But when stored in the db, a field of type TRawUTF8DynArray is not in JSON format? Persisting in JSON format is required in my use case.
About a week ago expected the same JSON format of TRawUTF8DynArray field value, but unfortunately didn't get such a result Therefore I had to make a quick workaround with the calculated field.
Offline
@Vitaly,
Alternatively you can use TStrings/TStringList as the published property type, you'll get JSON format in the db, and it doesn't have the 'CreateCopy' issue described here.
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
a bit embarrassing but I have to tell that I was avoiding TDocVariant almost always. Just rarely used it for fast getting some value from some JSON.
And now I tried it with several different structures and I must admit that it is useful and rather simple! Of course, so far I'm not sure that I'm using it the best way, but I will get it after some more experience.
I will use it in many places of my projects, thank you for your hints, guys! and sorry, @edwinsn, for a kind of offtopic
Offline