查看: 69|回复: 0

mormot2ORM

[复制链接]

3

主题

0

回帖

0

积分

热心网友

金币
0
阅读权限
220
精华
0
威望
0
贡献
0
在线时间
0 小时
注册时间
2010-9-26
发表于 2023-1-9 15:18:00 | 显示全部楼层 |阅读模式

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;

 

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

相关侵权、举报、投诉及建议等,请发 E-mail:qiongdian@foxmail.com

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部