我构建了类系统
TTableSpec=class(Tobject)
private
FName : string;
FDescription : string;
FCan_add : Boolean;
FCan_edit : Boolean;
FCan_delete : Boolean;
FFields : array[1..100] of TFieldSpec;
public
property Name: String read FName;
property Description: String read FDescription;
property Can_add : Boolean read FCan_add;
property Can_edit : Boolean read FCan_edit;
property Can_delete : Boolean read FCan_delete;
property Fields : array read FFields;
end;
Run Code Online (Sandbox Code Playgroud)
因此,在TableSpec中,Fields属性应该是字段列表(我使用TFieldSpec数组).如何组织字段列表(使用或不使用数组)作为编译的结果我收到错误
[Error] Objects.pas(97): Identifier expected but 'ARRAY' found
[Error] Objects.pas(97): READ or WRITE clause expected, but identifier 'FFields' found
[Error] Objects.pas(98): …Run Code Online (Sandbox Code Playgroud) 我正在使用Synopse mORMot从Delphi 7访问SQLite数据库.我希望通过SQL直接建立连接和查询数据库,而无需使用mORMot的ORM(对象关系映射)功能.
您是否可以提供执行SQL查询而不依赖于mORMot的ORM功能的代码示例?
我试图在Delphi中构建一个类系统.的类TFieldSpec和TTableSpec通过对象属性相互引用.
type
TFieldSpec=class(Tobject)
private
FTableSpec : TTableSpec;
public
property TableSpec : TTableSpec read FTableSpec;
end;
TTableSpec=class(Tobject)
private
FFields : array[1..100] of TFieldSpec;
end;
Run Code Online (Sandbox Code Playgroud)
当我编译它时,我收到此错误:
[Error] Objects.pas(66): Undeclared identifier: 'TTableSpec'
Run Code Online (Sandbox Code Playgroud)
如何构建这些类类型?