You are not logged in.
Pages: 1
I've two classes
ClassA = class(tSqlRecord)
protected
fdesA : rawutf8;
published
property desA : rawutf8 read fDes write fDes;
end;
ClassB = class(tSqlRecord)
protected
fdesB : rawutf8;
fA : ClassA;
published
property desB : rawutf8 read fDesB write fDesB;
property A : ClassA read fA write fA;
end;
In class a there is an instance with ID = maxint + 1 (2147483648).
procedure test;
var a : classa;
b : classb;
aID : tID;
begin
a := classa.create;
a.desa := 'A';
a.idvalue := 2147483648;
server.add(A, true, true);
b := classb.create;
b.desb := 'B';
b.A := A.Astsqlrecord;
aID := server.add(b, true);
b.free;
b := classb.create(server, aID);
aID := b.A.ID; // here an access violation error is returned.
b.free;
a.free;
end;
Debugging i've seen that in mormot.pas the assigment of value to property b.A is done using TSQLPropInfoRTTIInt32 class instead of TSQLPropInfoRTTIInt64.
Offline
By definition: ClassA = TObject = pointer = 32 bits = stored as Int32.
If you want 64 bit IDs, use TID or you own TID sub-type.
All is explained at http://synopse.info/files/html/Synopse% … l#TITLE_54
A little search in the doc would always help, right?
Offline
I may agree about little search but... i haven't done any search , thinking that record properties should permits to store any record.
Sorry.
Offline
ok ab,
as we know , the documentation of this big framework is BIG.
What about raise an axception on b.A=A.AstSqlRecord if A.ID is greater than maxint? It could avoid any misunderstanding (now , in the db field, is stored 2147483648!).
Offline
Good idea.
Offline
Pages: 1