我在高速緩存中進行設計,它看起來像它不允許多個插入,即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