我在高速缓存中进行设计,它看起来像它不允许多个插入,即SQL插入不起作用
insert into Ruler (...) values (...), values()....
或
insert into Ruler (...) values (...), (....)
所以我决定创建方法执行插入。问题 - 这是行不通的。每个插入都很好。删除也起作用,但不能插入。没有错误,只是空表。
Method Fill() As %Integer
{
&sql(insert into Ruler (nameRuler, biography, idRuler)
values ('Peter the Great','Born in Moscow, Russia on June 9, 1672, Peter the Great was a Russian czar in the late 17th century who is best known for his extensive reforms in an attempt to establish Russia as a great nation. He created a strong navy, reorganized his army according to Western standards, secularized schools, administered greater control over the reactionary Orthodox Church, and introduced new administrative and territorial divisions of the country.', 1)
)
&sql(insert into Ruler (nameRuler, biography, idRuler) values ('Boris Godunov','was de facto regent of Russia from c. 1585 to 1598 and then the first non-Rurikid tsar from 1598 to 1605. The end of his reign saw Russia descend into the Time of Troubles.', 2))
//&sql(delete from Ruler)
&sql(SELECT COUNT(*) INTO :count
FROM Ruler)
Quit "Total: "_count
}
任何想法?
“每个插入都很好,删除也可以,但不能插入”?你的意思是单独的插入语句工作正常,但[表值构造函数](http://technet.microsoft.com/en-us/library/dd776382.aspx)方法不起作用? –
嗯,是的。单独的插入工作正常,如果通过门户执行(这是phpmyadmin模拟)。两个和更多的插入不能在这个门户网站(因为语法是错误的,所以我认为这不支持)。如果从Object Method中调用,则不插入任何工作。没有错误。 我不知道表值构造函数,但不认为它是它。我不创建新的表格,我使用现有的表格。 现在我试图做ClassMethod,非对象..可能会工作。 (PS如果你知道如何在Cache中调用ClassMethod,请告诉他们的文档是非常有用的。 – Tigran
write ## class(Ruler).Fill() - 这是ClassMethod调用的方法,结果为0(不再插入) – Tigran