我在ionic框架中使用PRAGMA table_info获取特定表的信息,但是当我尝试编译它时,出现了table_info的意外标记错误。但是当我在DB browser(SQLite)中尝试相同的查询时,我得到了结果。
我在我的应用程序中使用了CordovaSQLite插件。
PRAGMA table_info(contacts)
我在ionic框架中使用PRAGMA table_info获取特定表的信息,但是当我尝试编译它时,出现了table_info的意外标记错误。但是当我在DB browser(SQLite)中尝试相同的查询时,我得到了结果。
我在我的应用程序中使用了CordovaSQLite插件。
PRAGMA table_info(contacts)
$cordovaSQLite.execute(self.db, 'PRAGMA table_info(category)').then(function (res) {
for (var i = 0; i < res.rows.length; i++) {
if (res.rows.item(i).name === 'is_deleted') {
hasISDeleted = true;
}
}
if (hasISDeleted === true) {
$log.log('going to update category');
var query = 'UPDATE category SET is_deleted = ? WHERE is_deleted IS NULL';
prom = $cordovaSQLite.execute(self.db, query, ['false']).then(function (res) {
console.log(res);
$log.log('category response', res);
});
$log.log('category prom', prom);
proms.push(prom);
$q.all(proms).then(function () {
defer.resolve('Sucess');
});
} else {
defer.resolve('Sucess');
}
});
希望它能够正常工作。