以下对象脚本将创建以下SQL表:
Objectscript类
Class MyApp.Parent Extends %Persistent
{
Property Children As array Of MyApp.Child;
}Parent_Children表和列:
Parent int NOT NULL,
ID varchar(254) NOT NULL,
Children int NULL,
element_key varchar(50) NOT NULL当父文件通过%Save()命令保存在objectscript中,并且父属性的子属性具有一个元素时,将自动在此联接表中创建一行。ID列的值类似于"15||1",,Parent列有Parent行的主键,Children列有子行的主键。
在SQL中,如何为此表创建insert语句?我不知道如何为ID列创建值。
发布于 2013-08-01 18:42:51
如果您有ID为1的父级和ID为2的子级,则可以使用:
Insert into MyApp.Parent_Children values (1,null,2,'fzj')它将ID为2的子元素添加到ID为1的父级的子数组中,并且在"fzj“数组中有一个键值。
https://stackoverflow.com/questions/18001072
复制相似问题