You are not logged in.
Pages: 1
CopyObject don't work correctly with object with published property of variant type. Something is wrong with TPropInfo.CopyValue in mORMot for Variants. If destination field has different offset than source field then CopyObject don't work correctly (! probably memory corruption).
type
TA = class(TSQLRecord)
protected
ftemp: TNullableUTF8Text;
ffoo: TNullableUTF8Text;
published
property foo: TNullableUTF8Text index 60 read ffoo write ffoo;
end;
TB = class(TSQLRecord)
protected
ffoo: TNullableUTF8Text;
published
property foo: TNullableUTF8Text index 60 read ffoo write ffoo;
end;
var
a: TA;
b: TB;
begin
a := TA.Create;
a.foo := NullableUTF8Text('mORMot');
WriteLn(NullableUTF8TextToValue(a.foo));
b := TB.Create;
CopyObject(a, b);
WriteLn(NullableUTF8TextToValue(b.foo)); // will print nothing (expected mORMot)
best regards,
Maciej Izak
Offline
There was indeed problems with TPropInfo.CopyValue method and CopyObject() function for variants and UnicodeString/WideString properties.
Should be fixed by http://synopse.info/fossil/info/9f35a52d4e
Online
Thanks , the patch now looks so obviously!
best regards,
Maciej Izak
Offline
Pages: 1