码迷,mamicode.com
首页 > 数据库 > 详细

TSQLTableJSON解析JSON

时间:2017-12-16 18:42:34      阅读:186      评论:0      收藏:0      [点我收藏+]

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

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   

原文地址:http://www.cnblogs.com/hnxxcxg/p/8047145.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!