[英]Do I have to drop the table before creating it in Sqlite?
When I initialize my Sqlite Database I make it as follows: 当我初始化我的Sqlite数据库时,它如下所示:
var db = window.openDatabase("Database", "1.0", "Cordova Demo", 20000);
db.transaction(populateDB, errorCB, successCB);
function populateDB(tx) {
tx.executeSql('DROP TABLE IF EXISTS TimeTable');
tx.executeSql('CREATE TABLE IF NOT EXISTS TimeTable (id INTEGER PRIMARY KEY AUTOINCREMENT, Day, Subject, StartingTime, EndingTime)');}
Now, I don't want the table to be dropped every time I call this function. 现在,我不希望每次调用此函数都删除该表。 But when I remove this line:
但是,当我删除此行时:
tx.executeSql('DROP TABLE IF EXISTS TimeTable');
An error shows: 错误显示:
[INFO] Error processing SQL: 1
Is there a solution for this ? 有解决方案吗?
you can try the solution posted there: 您可以尝试在那里发布的解决方案:
phoneGap Android - Populate database once "Error processing SQL:1" phoneGap Android-一次填充数据库“错误处理SQL:1”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.