W
wpy020327
Unregistered / Unconfirmed
GUEST, unregistred user!
来源:http://qburro.bbs.pepo.cn/page/bbs/default.aspx单元名为QBDBJson.pas,提供字段属性、字段属性列表、记录、记录列表、数据表等数据对象的Json化功能,实现的效果如下:1、字段属性描述类TFieldAttrJson:{ "FieldName": "CustomerID", "FieldType": "WideString", "JsonType": "String", "FieldSize": 5}2、字段属性列表描述类TFieldAttrListJson:(其中省略号为后续字段描述){ "FieldAttrCount": 11, "FieldAttrList": [ { "FieldName": "CustomerID", "FieldType": "WideString", "JsonType": "String", "FieldSize": 5 }, ...... ]}3、数据库记录内容描述类TRecordJson:{ "CustomerID": "ALFKI", "CompanyName": "Alfreds Futterkiste", "ContactName": "Maria Anders", "ContactTitle": "Sales Representative", "Address": "Obere Str. 57", "City": "Berlin", "Region": "", "PostalCode": "12209", "Country": "Germany", "Phone": "030-0074321", "Fax": "030-0076545"}4、数据库记录列表描述类TRecordListJson:(省略号为后续字段描述){ "RecordCount": 92, "RecordList": [ { "CustomerID": "ALFKI", "CompanyName": "Alfreds Futterkiste", "ContactName": "Maria Anders", "ContactTitle": "Sales Representative", "Address": "Obere Str. 57", "City": "Berlin", "Region": "", "PostalCode": "12209", "Country": "Germany", "Phone": "030-0074321", "Fax": "030-0076545" }, ...... ]}5、数据表完整描述类:TTableJson:(省略号为后续字段属性或后续记录描述){ "TableName": "Customers", "TableHead": { "FieldAttrCount": 11, "FieldAttrList": [ { "FieldName": "CustomerID", "FieldType": "WideString", "JsonType": "String", "FieldSize": 5 }, ...... ] }, "TableBody": { "RecordCount": 92, "RecordList": [ { "CustomerID": "ALFKI", "CompanyName": "Alfreds Futterkiste", "ContactName": "Maria Anders", "ContactTitle": "Sales Representative", "Address": "Obere Str. 57", "City": "Berlin", "Region": "", "PostalCode": "12209", "Country": "Germany", "Phone": "030-0074321", "Fax": "030-0076545" }, ...... ] }}