zoukankan      html  css  js  c++  java
  • firedac数据集数据序列为JSON

    firedac数据集数据序列为JSON

    FIREDAC数据库引擎充分地考虑了跨平台和跨语言的支持。

    因此,FIREDAC数据集可以序列为BINXMLJSON,三种格式。

    firedac数据集数据序列为JSON字符串:

    procedure TForm1.Button1Click(Sender: TObject);
    begin
      var ss: TStringStream := TStringStream.Create('', TEncoding.UTF8);
      FDQuery1.SaveToStream(ss, sfJSON);
      Memo1.Text := ss.DataString;
      ss.Free;
    end;
    

      

    数据集序列后的JSON字符串:

    {
        "FDBS":
    	{"Version":15,
    	    "Manager":
    		{"UpdatesRegistry":true,
    		    "TableList":
    			[
    				{"class":"Table","Name":"FDQuery1","SourceName":"tunit","SourceID":1,"TabID":0,"EnforceConstraints":false,"MinimumCapacity":50,
    				"ColumnList":
    				[
    					{"class":"Column","Name":"unitid","SourceName":"unitid","SourceID":1,"DataType":"AnsiString","Size":4,"Searchable":true,"Base":true,"OInUpdate":true,"OInWhere":true,"OInKey":true,"OriginColName":"unitid","SourcePrecision":4,"SourceSize":4
    					},
    					{"class":"Column","Name":"unitname","SourceName":"unitname","SourceID":2,"DataType":"AnsiString","Size":6,"Searchable":true,"AllowNull":true,"Base":true,"OAllowNull":true,"OInUpdate":true,"OInWhere":true,"OriginColName":"unitname","SourcePrecision":6,"SourceSize":6
    					}
    				],"ConstraintList":[],"ViewList":[],
    				    "RowList":
    					[{"RowID":0,"Original":{"unitid":"11","unitname":"个"}},{"RowID":1,"Original":{"unitid":"12","unitname":"双"}}
    					]
    				}
    			],"RelationList":[],"UpdatesJournal":{"Changes":[]}
            }
        }
    }
    

      

      如上的JSON数据,其他开发语言当然是能解析并还原出数据的。

  • 相关阅读:
    Visual Studio Code 配置C/C++环境
    二叉链的基本操作
    回文自动机
    吊打线段树的超级树状数组
    Treap平衡树
    uni-app nvue页面动态修改导航栏按钮
    uni-app map组件关于marker标记点动态设置的问题
    uni-app 提示 v-for 暂不支持循环数据
    uni-app APP端隐藏导航栏自定义按钮
    uni-app路径规划(打开第三方地图实现)
  • 原文地址:https://www.cnblogs.com/hnxxcxg/p/10630610.html
Copyright © 2011-2022 走看看