0
我在這裏有一個更新數據庫的工作函數,但我想把一個陷阱,它不會接受重複的名稱。我已經閱讀過有關使用NOT EXISTS語句的內容,但它不會返回它是真的還是不真的。SQLite數據庫更新之前檢查重複
這裏是我的代碼:
function editDB(eName) {
var clubDetect = $('#clubDisplay').text();
if (-- condition that checks if the Name exists in the database goes here --)
db.transaction(function (tx) { tx.executeSql('UPDATE SoccerPlayer SET Name = ? WHERE Club=?',[ eName, clubDetect ]); });
else
alert("existing name");
}
我堅持這個問題,任何幫助將欣然接受。提前致謝。
由於它可以防止現在複製,但它不會觸發回調都沒有。 –