angularjs - 在 ionicframework 中为 sqlite 获取 table_info 的意外标记

标签 angularjs ionic-framework sqlite

我已经使用 PRAGMA table_info 来获取 ionic 框架中特定表的信息但是当我尝试编译它时我收到错误作为 table_info 的意外标记。但是当我在数据库浏览器中尝试相同的查询时(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');
    }
  });

希望它能奏效。

关于angularjs - 在 ionicframework 中为 sqlite 获取 table_info 的意外标记,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45834285/

相关文章:

angular - Ionic 3 组件与页面

c# - System.Data.SQLite 有多稳定

ruby-on-rails - Rails 4 SQLite3::SQLException 错误

javascript - 在 Angularjs 中的对象数组中分配动态索引

javascript - Datepicker 在 angular-ui 版本 0.11.0 中没有打开两次

angularjs - Angular Javascript 动画适用于 ng-if 但不适用于 ng-show

ios - 从 TableView 到标签的数组数据

angularjs - Angular-material - 在 md-select 多个选项中更改分隔符

javascript - Cordova 白名单插件手动检测阻止的导航(事件)

android - ionic 推送通知自定义声音不在 Android 中播放