不工作在SQLite的針對iOS(3.7.7)我正在運行這些查詢:ON DELETE CASCADE SQLite中
PRAGMA foreign_keys = ON;
create table venue(id integer primary key not null, name text not null);
create table event(id integer primary key not null, name text not null,
venue_id integer references venue(id) on delete cascade);
但是當我刪除的場所,孩子的事件不會被刪除。有任何想法嗎?
我無法在3.7.4中重現該行爲。你確定'PRAGMA foreign_keys = ON'是否在刪除場地之前設置? (這是連接設置,不是數據庫設置。) –
這很奇怪。我確實犯了一個錯誤,就是沒有在每個連接上設置它,但是當我修復它時並沒有幫助。你在iPhone模擬器中嘗試過嗎?因爲我得到這個工作在SQLite的navicat,但不是在模擬器。 –
好吧,我只是在模擬器中用最簡單的代碼嘗試過它,它的工作,所以錯誤必須在其他地方。謝謝。 –