当前位置:Gxlcms > 数据库问题 > TSQLTableJSON解析JSON

TSQLTableJSON解析JSON

时间:2021-07-01 10:21:17 帮助过:21人阅读

TSQLTableJSON解析JSON

uses mormot

rocedure TTestTableContent.SynopseTableVariant;
var json: RawUTF8;
people: variant;
list: TSQLTableJSON;
begin
json := StringFromFile(fFileName);
Owner.TestTimer.Start;
list := TSQLTableJSON.Create(‘‘,pointer(json),length(json));
while list.Step(false,@people) do begin
Check(people.FirstName<>‘‘);
Check(people.LastName<>‘‘);
Check(people.YearOfBirth<10000);
Check((people.YearOfDeath>1400)and(people.YearOfDeath<2000));
Check((people.ID>11011) or (people.Data<>‘‘));
end;
fRunConsoleOccurenceNumber := list.RowCount;
fRunConsoleMemoryUsed := MemoryUsed-fMemoryAtStart;
list.Free;
end;

procedure TTestTableContent.SynopseTableIndex;
var json: RawUTF8;
list: TSQLTableJSON;
i: Integer;
begin
json := StringFromFile(fFileName);
Owner.TestTimer.Start;
list := TSQLTableJSON.Create(‘‘,pointer(json),length(json));
for i := 1 to list.RowCount do begin
Check(list.Get(i,‘FirstName‘)<>nil);
Check(list.Get(i,‘LastName‘)<>nil);
Check(list.GetAsInteger(i,‘YearOfBirth‘)<10000);
Check((list.GetAsInteger(i,‘YearOfDeath‘)>1400)and(list.GetAsInteger(i,‘YearOfDeath‘)<2000));
Check((list.GetAsInteger(i,‘RowID‘)>11011) or (list.Get(i,‘Data‘)<>nil));
end;
fRunConsoleOccurenceNumber := list.RowCount;
fRunConsoleMemoryUsed := MemoryUsed-fMemoryAtStart;
list.Free;
end;

 

TSQLTableJSON解析JSON

标签:ring   gpo   index   解析json   step   set   rowid   while   begin   

人气教程排行