You are not logged in.
I'm trying to get some simple ORM to work. My TSQLRecord structures look like this
TWorkstation = Class(TSQLRecord)
private
FName: String;
Published
Property Name: String Read FName Write FName;
End;
TService = Class(TSQLRecord)
private
FName: String;
FWorkstation: TWorkstation;
Published
Property Name: String Read FName Write FName;
Property Workstation: TWorkstation Read FWorkstation Write FWorkstation;
End;
Where TService has a pointer to a TWorkstation.
With the following code
Var
x: TWorkstation;
y: TService;
Begin
x := TWorkstation.Create;
x.Name := 'WS1';
FServer.Add(x,True);
y := TService.Create;
y.Name := 'Svc-1';
y.Workstation := x;
FServer.Add(y, True);
End
Ignoring the leaks, the end result is 2 sqlite tables with the correct fields defined, but the Workstation table has a huge number for the service entry. If instead, before the 2nd add I perform
y.Workstation := Pointer(x.ID);
It gets the correct value of 1 in it. Is this the wrong way to go about adds like this or do I need to perform this odd operation before any writes of tables with pointers to other tables ?
Offline