1
我想在移動webapp中創建一個數據庫,唯一的問題是Safari每次刷新網站時都會創建一個新的數據庫。 這裏是我的代碼:webapp中重複的SQLite數據庫
var databaseOptions = {
fileName : "todo_database",
version : "1.0",
displayName : "todoDB",
maxSize : 1024
};
var database = openDatabase(databaseOptions.fileName, databaseOptions.version,
databaseOptions.displayName, databaseOptions.maxSize);
database.transaction(function(transaction) {
alert('table created');
transaction.executeSql("CREATE TABLE IF NOT EXISTS todos (" +
"id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT," +
"todo TEXT NOT NULL,description TEXT,date DATE);");
});