lundi 30 mars 2015

Cannot Truncate and Drop Tables in SQLite

I have used SQLite.swift plugin to drop tables and truncate the tables, but it does not work in device. The code can be executed by simulator, but not ios devices:



for row in db.prepare("SELECT name FROM sqlite_master WHERE type='table' and name != 'sqlite_sequence'")
{
let tableName = row[0] as String
tableName_container.append(tableName);
}
for item in tableName_container {
db.scalar("DELETE FROM '"+item+"'")
// db.scalar("DROP TABLE IF EXISTS "+item+";")
}
for item in tableName_container {
db.scalar("DROP TABLE IF EXISTS '"+item+"'")
}
// db.scalar("DROP TABLE event")
for row11 in db.prepare("SELECT name FROM sqlite_master WHERE type='table' and name != 'sqlite_sequence'")
{
let tmp_col = row11[0] as String
let count = db.scalar("Select count(*) From "+tmp_col+" ;")
println(count)
}

Aucun commentaire:

Enregistrer un commentaire