mormot2ORM
<p>mormot2ORM</p><p>unit mormot.orm.core;</p>
<div class="cnblogs_code">
<pre><span style="color: rgba(128, 128, 128, 1)">///</span><span style="color: rgba(0, 128, 0, 1)"> root class for defining and mapping database records</span>
<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)"> - inherits a class from TOrm, and add published properties to describe
</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)"> the table columns (see TPropInfo for SQL and Delphi type mapping/conversion)
</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)"> - this published properties can be auto-filled from TOrmTable answer with
</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)"> FillPrepare() and FillRow(), or FillFrom() with TOrmTable or JSON data
</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)"> - these published properties can be converted back into UTF-8 encoded SQL
</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)"> source with GetSqlValues or GetSqlSet or into JSON format with GetJsonValues
</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)"> - BLOB fields are decoded to auto-freeing RawBlob properties
</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)"> - any published property defined as a T*ObjArray dynamic array storage
</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)"> of persistents (via Rtti.RegisterObjArray on Delphi 7-2009) will be freed
</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)"> - consider inherit from TOrmNoCase and TOrmNoCaseExtended if
</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)"> you expect regular NOCASE collation and smaller (but not standard JSON)
</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)"> variant fields persistence</span>
TOrm = <span style="color: rgba(0, 0, 255, 1)">class</span>(TObjectWithID)</pre>
</div>
<p>///用于定义和映射数据库记录的根类</p>
<p>//-从TOrm继承一个类,并添加已发布的属性来描述</p>
<p>//表列(请参阅TPropInfo for SQL和Delphi类型映射/转换)</p>
<p>//-可以使用</p>
<p>//FillPrepare()和FillRow(),或具有TOrmTable或JSON数据的FillFrom()</p>
<p>//-这些已发布的属性可以转换回UTF-8编码的SQL</p>
<p>//具有GetSqlValues或GetSqlSet的源代码,或具有GetJsonValues的JSON格式</p>
<p>//-BLOB字段被解码以自动释放RawBlob属性</p>
<p>//-定义为T*ObjArray动态数组存储的任何已发布属性</p>
<p>//(通过Delphi 7-2009上的Rtti.RegisterObjArray)</p>
<p>//-考虑从TOrmNoCase和TOrmNoCaseExtended继承,如果</p>
<p>//您需要常规NOCASE排序规则和更小的排序规则(但不是标准JSON)</p>
<p>//变量字段持久性</p>
<div class="cnblogs_code">
<pre> TOrmPeople = <span style="color: rgba(0, 0, 255, 1)">class</span><span style="color: rgba(0, 0, 0, 1)">(TOrm)
</span><span style="color: rgba(0, 0, 255, 1)">private</span><span style="color: rgba(0, 0, 0, 1)">
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;</span></pre>
</div>
<p> </p>
</div>
<div id="MySignature" role="contentinfo">
<p>本文来自博客园,作者:{咏南中间件},转载请注明原文链接:https://www.cnblogs.com/hnxxcxg/p/17037176.html</p><br><br>
来源:https://www.cnblogs.com/hnxxcxg/p/17037176.html
頁:
[1]