首页 > 其他分享 >mormot2ORM

mormot2ORM

时间:2023-01-09 15:22:13浏览次数:42  
标签:read mormot2ORM write JSON published property Delphi

mormot2ORM

unit mormot.orm.core;

  /// root class for defining and mapping database records
  // - inherits a class from TOrm, and add published properties to describe
  // the table columns (see TPropInfo for SQL and Delphi type mapping/conversion)
  // - this published properties can be auto-filled from TOrmTable answer with
  // FillPrepare() and FillRow(), or FillFrom() with TOrmTable or JSON data
  // - these published properties can be converted back into UTF-8 encoded SQL
  // source with GetSqlValues or GetSqlSet or into JSON format with GetJsonValues
  // - BLOB fields are decoded to auto-freeing RawBlob properties
  // - any published property defined as a T*ObjArray dynamic array storage
  // of persistents (via Rtti.RegisterObjArray on Delphi 7-2009) will be freed
  // - consider inherit from TOrmNoCase and TOrmNoCaseExtended if
  // you expect regular NOCASE collation and smaller (but not standard JSON)
  // variant fields persistence
  TOrm = class(TObjectWithID)

///用于定义和映射数据库记录的根类

//-从TOrm继承一个类,并添加已发布的属性来描述

//表列(请参阅TPropInfo for SQL和Delphi类型映射/转换)

//-可以使用

//FillPrepare()和FillRow(),或具有TOrmTable或JSON数据的FillFrom()

//-这些已发布的属性可以转换回UTF-8编码的SQL

//具有GetSqlValues或GetSqlSet的源代码,或具有GetJsonValues的JSON格式

//-BLOB字段被解码以自动释放RawBlob属性

//-定义为T*ObjArray动态数组存储的任何已发布属性

//(通过Delphi 7-2009上的Rtti.RegisterObjArray)

//-考虑从TOrmNoCase和TOrmNoCaseExtended继承,如果

//您需要常规NOCASE排序规则和更小的排序规则(但不是标准JSON)

//变量字段持久性

 TOrmPeople = class(TOrm)
  private
    fData: RawBlob;
    fFirstName: RawUtf8;
    fLastName: RawUtf8;
    fYearOfBirth: integer;
    fYearOfDeath: word;
  published
    property FirstName: RawUtf8 read fFirstName write fFirstName;
    property LastName: RawUtf8 read fLastName write fLastName;
    property Data: RawBlob read fData write fData;
    property YearOfBirth: integer read fYearOfBirth write fYearOfBirth;
    property YearOfDeath: word read fYearOfDeath write fYearOfDeath;

 

标签:read,mormot2ORM,write,JSON,published,property,Delphi
From: https://www.cnblogs.com/hnxxcxg/p/17037176.html

相关文章