You are not logged in.
Pages: 1
NULL value for published Variant properties is stored correctly in DB but when data is received then NULL value is loosing (variant is unassigned).
Very painful especially for "database-first" approach (existing infrastructure, related to very big project, where I can't resign from the NULL).
Super simple test-case:
type
TSQLtest = class(TSQLRecord)
protected
fv: Variant;
fVersion: TRecordVersion;
published
property v: Variant read fv write fv;
property Version: TRecordVersion read fVersion write fVersion;
end;
function GetModel: TSQLModel;
begin
Result := TSQLModel.Create([TSQLtest, TSQLRecordTableDeleted]);
end;
var
MasterServer, SlaveServer: TSQLRestServerDB;
Model: TSQLModel;
t: TSQLtest;
begin
Model := GetModel;
MasterServer := TSQLRestServerDB.Create(Model, ':memory:');
MasterServer.CreateMissingTables;
t := TSQLtest.Create;
t.v := NULL;
WriteLn(VarTypeAsText(VarType(t.v)));
MasterServer.Add(t, true);
t.Free;
t := TSQLtest.Create(MasterServer, 1);
WriteLn(VarTypeAsText(VarType(t.v)));
SlaveServer := TSQLRestServerDB.Create(Model,':memory:');
SlaveServer.CreateMissingTables;
SlaveServer.RecordVersionSynchronizeSlave(TSQLtest, MasterServer);
t.free;
t := TSQLtest.Create(SlaveServer, 1);
WriteLn(VarTypeAsText(VarType(t.v)));
Output:
Null
Empty
Empty
anyway patch is attached:
https://drive.google.com/file/d/0B4PZhd … sp=sharing
other patch for "typo" bug:
https://drive.google.com/file/d/0B4PZhd … sp=sharing
output with first patch:
Null
Null
Null
best regards,
Maciej Izak
best regards,
Maciej Izak
Offline
Pages: 1