码迷,mamicode.com
首页 > Web开发 > 详细

TJSONTableObject跨平台解析JSON

时间:2017-12-16 19:49:58      阅读:204      评论:0      收藏:0      [点我收藏+]

标签:integer   begin   word   table   persist   test   sso   epo   timer   

TJSONTableObject跨平台解析JSON

USES SynCrossPlatformJSON

TSQLRecordPeoplePersistent = class(TPersistent)
private
fRowID: integer;
fData: TByteDynArray;
fFirstName: string;
fLastName: string;
fYearOfBirth: integer;
fYearOfDeath: word;
published
property RowID: integer read fRowID write fRowID;
property FirstName: string read fFirstName write fFirstName;
property LastName: string read fLastName write fLastName;
property Data: TByteDynArray read fData write fData;
property YearOfBirth: integer read fYearOfBirth write fYearOfBirth;
property YearOfDeath: word read fYearOfDeath write fYearOfDeath;
end;

procedure TTestTableContent.SynopseCrossORM; // by cxg
var json: string;
table: TJSONTableObject;
people: TSQLRecordPeoplePersistent;
begin
json := AnyTextFileToString(fFileName,true);
people := TSQLRecordPeoplePersistent.Create;
Owner.TestTimer.Start;
table := TJSONTableObject.Create(json);
fRunConsoleOccurenceNumber := 0;
while table.StepObject(people) do begin
Check(people.FirstName<>‘‘);
Check(people.LastName<>‘‘);
Check(people.YearOfBirth<10000);
Check((people.YearOfDeath>1400)and(people.YearOfDeath<2000));
Check((people.RowID>11011) or (people.Data<>nil));
inc(fRunConsoleOccurenceNumber);
end;
fRunConsoleMemoryUsed := MemoryUsed-fMemoryAtStart;
table.Free;
people.Free;
end;

TJSONTableObject跨平台解析JSON

标签:integer   begin   word   table   persist   test   sso   epo   timer   

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

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