咏南中间件JSON序列类

1)支持跨平台、跨语言

2)支持主从表数据序列、还原,支持任意数量的表

主从表数据序列为JSON字符串样式:

  1. {
  2. "rows": [
  3. {
  4. "FDBS": {
  5. "Version": 15,
  6. "Manager": {
  7. "UpdatesRegistry": true,
  8. "TableList": [
  9. {
  10. "class": "Table",
  11. "Name": "qryOpen",
  12. "SourceName": "tgoods",
  13. "SourceID": 1,
  14. "TabID": 0,
  15. "EnforceConstraints": false,
  16. "MinimumCapacity": 50,
  17. "CheckReadOnly": false,
  18. "ColumnList": [
  19. {
  20. "class": "Column",
  21. "Name": "goodsid",
  22. "SourceName": "goodsid",
  23. "SourceID": 1,
  24. "DataType": "AnsiString",
  25. "Size": 8,
  26. "Searchable": true,
  27. "Base": true,
  28. "OInUpdate": true,
  29. "OInWhere": true,
  30. "OInKey": true,
  31. "OriginColName": "goodsid",
  32. "SourcePrecision": 8,
  33. "SourceSize": 8
  34. },
  35. {
  36. "class": "Column",
  37. "Name": "barcode",
  38. "SourceName": "barcode",
  39. "SourceID": 2,
  40. "DataType": "AnsiString",
  41. "Size": 18,
  42. "Searchable": true,
  43. "AllowNull": true,
  44. "Base": true,
  45. "OAllowNull": true,
  46. "OInUpdate": true,
  47. "OInWhere": true,
  48. "OriginColName": "barcode",
  49. "SourcePrecision": 18,
  50. "SourceSize": 18
  51. },
  52. {
  53. "class": "Column",
  54. "Name": "goodsname",
  55. "SourceName": "goodsname",
  56. "SourceID": 3,
  57. "DataType": "AnsiString",
  58. "Size": 50,
  59. "Searchable": true,
  60. "Base": true,
  61. "OInUpdate": true,
  62. "OInWhere": true,
  63. "OriginColName": "goodsname",
  64. "SourcePrecision": 50,
  65. "SourceSize": 50
  66. },
  67. {
  68. "class": "Column",
  69. "Name": "pyjm",
  70. "SourceName": "pyjm",
  71. "SourceID": 4,
  72. "DataType": "AnsiString",
  73. "Size": 50,
  74. "Searchable": true,
  75. "AllowNull": true,
  76. "Base": true,
  77. "OAllowNull": true,
  78. "OInUpdate": true,
  79. "OInWhere": true,
  80. "OriginColName": "pyjm",
  81. "SourcePrecision": 50,
  82. "SourceSize": 50
  83. },
  84. {
  85. "class": "Column",
  86. "Name": "gg",
  87. "SourceName": "gg",
  88. "SourceID": 5,
  89. "DataType": "AnsiString",
  90. "Size": 30,
  91. "Searchable": true,
  92. "AllowNull": true,
  93. "Base": true,
  94. "OAllowNull": true,
  95. "OInUpdate": true,
  96. "OInWhere": true,
  97. "OriginColName": "gg",
  98. "SourcePrecision": 30,
  99. "SourceSize": 30
  100. },
  101. {
  102. "class": "Column",
  103. "Name": "kindid",
  104. "SourceName": "kindid",
  105. "SourceID": 6,
  106. "DataType": "AnsiString",
  107. "Size": 8,
  108. "Searchable": true,
  109. "AllowNull": true,
  110. "Base": true,
  111. "OAllowNull": true,
  112. "OInUpdate": true,
  113. "OInWhere": true,
  114. "OriginColName": "kindid",
  115. "SourcePrecision": 8,
  116. "SourceSize": 8
  117. },
  118. {
  119. "class": "Column",
  120. "Name": "jj",
  121. "SourceName": "jj",
  122. "SourceID": 7,
  123. "DataType": "BCD",
  124. "Precision": 18,
  125. "Scale": 4,
  126. "Searchable": true,
  127. "AllowNull": true,
  128. "Base": true,
  129. "OAllowNull": true,
  130. "OInUpdate": true,
  131. "OInWhere": true,
  132. "OriginColName": "jj",
  133. "SourcePrecision": 18,
  134. "SourceScale": 4
  135. },
  136. {
  137. "class": "Column",
  138. "Name": "lsj",
  139. "SourceName": "lsj",
  140. "SourceID": 8,
  141. "DataType": "BCD",
  142. "Precision": 18,
  143. "Scale": 4,
  144. "Searchable": true,
  145. "AllowNull": true,
  146. "Base": true,
  147. "OAllowNull": true,
  148. "OInUpdate": true,
  149. "OInWhere": true,
  150. "OriginColName": "lsj",
  151. "SourcePrecision": 18,
  152. "SourceScale": 4
  153. },
  154. {
  155. "class": "Column",
  156. "Name": "kcxx",
  157. "SourceName": "kcxx",
  158. "SourceID": 9,
  159. "DataType": "BCD",
  160. "Precision": 18,
  161. "Scale": 4,
  162. "Searchable": true,
  163. "AllowNull": true,
  164. "Base": true,
  165. "OAllowNull": true,
  166. "OInUpdate": true,
  167. "OInWhere": true,
  168. "OriginColName": "kcxx",
  169. "SourcePrecision": 18,
  170. "SourceScale": 4
  171. },
  172. {
  173. "class": "Column",
  174. "Name": "kcsx",
  175. "SourceName": "kcsx",
  176. "SourceID": 10,
  177. "DataType": "BCD",
  178. "Precision": 18,
  179. "Scale": 4,
  180. "Searchable": true,
  181. "AllowNull": true,
  182. "Base": true,
  183. "OAllowNull": true,
  184. "OInUpdate": true,
  185. "OInWhere": true,
  186. "OriginColName": "kcsx",
  187. "SourcePrecision": 18,
  188. "SourceScale": 4
  189. },
  190. {
  191. "class": "Column",
  192. "Name": "unitid",
  193. "SourceName": "unitid",
  194. "SourceID": 11,
  195. "DataType": "AnsiString",
  196. "Size": 8,
  197. "Searchable": true,
  198. "AllowNull": true,
  199. "Base": true,
  200. "OAllowNull": true,
  201. "OInUpdate": true,
  202. "OInWhere": true,
  203. "OriginColName": "unitid",
  204. "SourcePrecision": 8,
  205. "SourceSize": 8
  206. },
  207. {
  208. "class": "Column",
  209. "Name": "unitname",
  210. "SourceName": "unitname",
  211. "SourceID": 12,
  212. "DataType": "AnsiString",
  213. "Size": 10,
  214. "Searchable": true,
  215. "AllowNull": true,
  216. "Base": true,
  217. "OAllowNull": true,
  218. "OInUpdate": true,
  219. "OInWhere": true,
  220. "OriginColName": "unitname",
  221. "SourcePrecision": 10,
  222. "SourceSize": 10
  223. },
  224. {
  225. "class": "Column",
  226. "Name": "kindname",
  227. "SourceName": "kindname",
  228. "SourceID": 13,
  229. "DataType": "AnsiString",
  230. "Size": 30,
  231. "Searchable": true,
  232. "AllowNull": true,
  233. "Base": true,
  234. "OAllowNull": true,
  235. "OInUpdate": true,
  236. "OInWhere": true,
  237. "OriginColName": "kindname",
  238. "SourcePrecision": 30,
  239. "SourceSize": 30
  240. }
  241. ],
  242. "ConstraintList": [],
  243. "ViewList": [],
  244. "RowList": [
  245. {
  246. "RowID": 0,
  247. "Original": {
  248. "goodsid": "100036",
  249. "barcode": "100036",
  250. "goodsname": "秋冬四件套哦",
  251. "pyjm": "",
  252. "gg": "",
  253. "kindid": "12002",
  254. "jj": 100,
  255. "lsj": 430,
  256. "kcxx": 50,
  257. "kcsx": 5,
  258. "unitid": "15",
  259. "unitname": "箱套",
  260. "kindname": "床上用品"
  261. }
  262. },
  263. {
  264. "RowID": 1,
  265. "Original": {
  266. "goodsid": "100050",
  267. "barcode": "100050",
  268. "goodsname": "天堂伞",
  269. "pyjm": "wrth",
  270. "gg": "",
  271. "kindid": "1",
  272. "jj": 10,
  273. "lsj": 0,
  274. "kcxx": 0,
  275. "kcsx": 0,
  276. "unitid": "15",
  277. "unitname": "箱套",
  278. "kindname": "1111"
  279. }
  280. },
  281. {
  282. "RowID": 2,
  283. "Original": {
  284. "goodsid": "100054",
  285. "barcode": "100054",
  286. "goodsname": "我们的 哎",
  287. "pyjm": "WMD D7",
  288. "gg": "",
  289. "kindid": "11002",
  290. "jj": 0,
  291. "lsj": 0,
  292. "kcxx": 0,
  293. "kcsx": 0,
  294. "unitid": "18",
  295. "unitname": "公斤",
  296. "kindname": "饮料"
  297. }
  298. },
  299. {
  300. "RowID": 3,
  301. "Original": {
  302. "goodsid": "100055",
  303. "barcode": "100055",
  304. "goodsname": "娃哈哈纯净水500ML",
  305. "pyjm": "WHHCJS500ML",
  306. "kindid": "11001",
  307. "jj": 0,
  308. "lsj": 0,
  309. "kcxx": 0,
  310. "kcsx": 0,
  311. "unitid": "18",
  312. "unitname": "公斤",
  313. "kindname": "奶粉"
  314. }
  315. }
  316. ]
  317. }
  318. ],
  319. "RelationList": [],
  320. "UpdatesJournal": {
  321. "Changes": []
  322. }
  323. }
  324. }
  325. },
  326. {
  327. "FDBS": {
  328. "Version": 15,
  329. "Manager": {
  330. "UpdatesRegistry": true,
  331. "TableList": [
  332. {
  333. "class": "Table",
  334. "Name": "qryOpen",
  335. "SourceName": "tunit",
  336. "SourceID": 1,
  337. "TabID": 0,
  338. "EnforceConstraints": false,
  339. "MinimumCapacity": 50,
  340. "CheckReadOnly": false,
  341. "ColumnList": [
  342. {
  343. "class": "Column",
  344. "Name": "unitid",
  345. "SourceName": "unitid",
  346. "SourceID": 1,
  347. "DataType": "AnsiString",
  348. "Size": 4,
  349. "Searchable": true,
  350. "Base": true,
  351. "OInUpdate": true,
  352. "OInWhere": true,
  353. "OInKey": true,
  354. "OriginColName": "unitid",
  355. "SourcePrecision": 4,
  356. "SourceSize": 4
  357. },
  358. {
  359. "class": "Column",
  360. "Name": "unitname",
  361. "SourceName": "unitname",
  362. "SourceID": 2,
  363. "DataType": "AnsiString",
  364. "Size": 6,
  365. "Searchable": true,
  366. "AllowNull": true,
  367. "Base": true,
  368. "OAllowNull": true,
  369. "OInUpdate": true,
  370. "OInWhere": true,
  371. "OriginColName": "unitname",
  372. "SourcePrecision": 6,
  373. "SourceSize": 6
  374. }
  375. ],
  376. "ConstraintList": [],
  377. "ViewList": [],
  378. "RowList": [
  379. {
  380. "RowID": 0,
  381. "Original": {
  382. "unitid": "11",
  383. "unitname": "个"
  384. }
  385. },
  386. {
  387. "RowID": 1,
  388. "Original": {
  389. "unitid": "12",
  390. "unitname": "双"
  391. }
  392. }
  393. ]
  394. }
  395. ],
  396. "RelationList": [],
  397. "UpdatesJournal": {
  398. "Changes": []
  399. }
  400. }
  401. }
  402. }
  403. ]
  404. }

 主从表查询调用代码:

  1. procedure TForm1.btnQueryClick(Sender: TObject);
  2. // 主从表 查询
  3. begin
  4. var url: TynUrl := TynUrl.Create;
  5. var serial: TynJsonSerial := TynJsonSerial.Create;
  6. var send: TMemoryStream := TMemoryStream.Create;
  7. try
  8. url.url := Edit1.Text;
  9. url.command := 'query91'; // 命令
  10. url.params.Add('count=2'); // 查询几个表的数据
  11. url.params.Add('accountno=1'); // 帐套号
  12. url.params.Add('sql=select * from tgoods'); // 查询SQL
  13. url.params.Add('sql2=select * from tunit'); // 查询SQL2
  14. // Memo1.Text := IdHTTP1.Post(url.text, send);
  15. serial.Text := IdHTTP1.Post(url.text, send);
  16. serial.ReadFDMemTable(0, FDMemTable1);
  17. serial.ReadFDMemTable(1, FDMemTable2);
  18. finally
  19. serial.DisposeOf;
  20. send.DisposeOf;
  21. url.DisposeOf;
  22. end;
  23. end;

  主从表提交调用代码:

  1. procedure TForm1.btnPostClick(Sender: TObject);
  2. // 主从表 提交
  3. begin
  4. var url: TynUrl := TynUrl.Create;
  5. var serial: TynJsonSerial := TynJsonSerial.Create;
  6. var send: TMemoryStream := TMemoryStream.Create;
  7. try
  8. url.url := Edit1.Text;
  9. url.command := 'save91'; // 命令
  10. url.params.Add('count=2'); // 提交几个表的数据
  11. url.params.Add('accountno=1'); // 帐套号
  12. url.params.Add('tablename=tgoods'); // 表名
  13. url.params.Add('tablename2=tunit'); // 表名2
  14. url.params.Add('delta=' + serial.FDDeltaToJson(FDMemTable1)); // delta
  15. url.params.Add('delta2=' + serial.FDDeltaToJson(FDMemTable2)); // delta2
  16. serial.Text := IdHTTP1.Post(url.text, send);
  17. if Pos('true', serial.Text) > 0 then
  18. ShowMessage('数据提交成功')
  19. else
  20. ShowMessage('数据提交失败');
  21. finally
  22. serial.DisposeOf;
  23. send.DisposeOf;
  24. url.DisposeOf;
  25. end;
  26. end;

  

咏南中间件JSON序列类的更多相关文章

  1. 咏南中间件D7客户端演示

    咏南中间件D7客户端演示 咏南中间件MORMOT(http.sys)支持D6.D7等老版本开发客户端.客户端使用TClientDataSet内存表控件,数据序列使用TynSerial类.

  2. 咏南中间件+开发框架支持最新的DELPHI XE10.1(BERLIN) UPDATE1

    咏南中间件+开发框架支持最新的DELPHI XE10.1(BERLIN) UPDATE1 购买提供:中间件源码,价格十分优惠!有意者请向本人索取演示程序! 附带福利(赠送): CS开发框架源码BS开发 ...

  3. delphi 10.1 berlin最新的开发框架:咏南中间件+咏南开发框架,购买后提供全部的源码

    咏南中间件+咏南开发框架支持最新的delphi 10.1(berlin),老用户提供免费升级. 购买提供:中间件源码 附带福利(赠送): CS开发框架源码BS开发框架源码移动APP源码中间件集群源码二 ...

  4. 专门为ADO二层升三层的咏南中间件(特种用途)

    专门为ADO二层升三层的咏南中间件(特种用途) 演示下载:链接: https://pan.baidu.com/s/1bulGBIZ6A1nkeErxIrGsGA 密码: 22dk 解压后运行ynmai ...

  5. 咏南中间件支持JWT TOKEN

    咏南中间件支持JWT TOKEN

  6. 咏南中间件新增MORMOT移动端演示

    咏南中间件新增MORMOT移动端演示 基于FMX,支持安卓.IOS移动端. 1)使用INDY 的HTTP控件进行查询: procedure TForm1.查询1Click(Sender: TObjec ...

  7. 咏南中间件支持DELPHI6及以上版本开发的客户端

    咏南中间件支持DELPHI6及以上版本开发的客户端 下面是测试用DELPHI7开发的客户端,调用DELPHI10.3.1开发的中间件,完全兼容. 这样,有利于维护原来用D7开发的老程序. 如上所述,只 ...

  8. 咏南中间件开始支持redis client接口调用

    咏南中间件开始支持redis client接口调用 咏南中间件封装了redis client接口,可以支持REDIS了. 如下图,将数据集写入REDIS缓存,和从REDIS缓存获取数据: proced ...

  9. 咏南中间件支持TMS WEB CORE客户端

    咏南中间件支持TMS WEB CORE客户端 TMS WEB CORE是优秀的JS前端,搭配咏南中间件后端,可以进行快速的企业应用开发.

随机推荐

  1. Ex 6_3 修建酒店所获得的利润..._第五次作业

    假设profit[i]为在前i个位置修建酒店所获得的最大利润,当i=0时,profit[0]=0.当i>0时,若j为上一个满足m[i]-m[j]k的位置.若profit[i-1]>prof ...

  2. 判断Javascript变量是否为空 undefined 或者null(附样例)

    1.变量申明未赋值 var type; //type 变量未赋值 1. type==undefined //true 2. type===undefined //true 3. typeof(type ...

  3. [学习笔记]Javascript采用二进制浮点数和四舍五入的错误

    1.样例 var a = .3 - .2 //0.09999999999999998 var b = .2 - .1 //0.1 a == b //false 出现这样的原因在于 1.Javascri ...

  4. PYTHON-文件处理-练习

    ## 一.实现用户注册功能# 思路:# 用户输入用户名.密码# 将用户输入的内容按照固定的格式,比如:egon:123,存入文件# 可以往一个文件中重复注册新的用户名和密码# 附加:# 1.对输入的用 ...

  5. C++ Primer读书笔记(1)

    指针和引用 引用本身不是一个对象,因此不能定义引用的指针:而指针是一个对象,因此可以定义指针的引用. 此外,要理解一个复合类型的变量到底是什么类型,最简单的办法是从右向左阅读其定义,离变量名最近的符号 ...

  6. python接口自动化测试一:http协议

    1. http简介:http(超文本传输协议)是一个基于请求与响应模式的.无状态的.应用层的协议 2. url详解:百度搜索的一个url地址:https://www.baidu.com/s?wd=%E ...

  7. icomet研究

    官方文档https://github.com/ideawu/icomet/wiki 如何实现的长连接:noop: 心跳消息+HTTP endless chunk 以班级ID为主键,进行班级通道的创建: ...

  8. hdu 1385 Floyd 输出路径

    Floyd 输出路径 Sample Input50 3 22 -1 43 0 5 -1 -122 5 0 9 20-1 -1 9 0 44 -1 20 4 05 17 8 3 1 //收费1 3 // ...

  9. 删除input上传的文件路径

    上传文件时,选择了文件后想清空文件路径,搜索了一下,用两种方法解决 <input type="file" id="fileupload" name=&qu ...

  10. Python安装scrapy过程中出现“Failed building wheel for xxx”

    https://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml Python安装scrapy库过程中出现“ Failed building wheel for xxx ...