SQLite

Contents

Access SQLite databases on the device.

https://github.com/litehelpers/Cordova-sqlite-storage

Ionic 数据库 SQLite插件的安装(Installation)

ionic cordova plugin add cordova-sqlite-storage npm install @ionic-native/sqlite

Ionic 数据库 SQLite插件支持的平台(Supported Platforms)

  • Android
  • iOS
  • macOS
  • Windows

Ionic 数据库 SQLite插件的用法(Usage)

import { SQLite, SQLiteObject } from '@ionic-native/sqlite';

constructor(private sqlite: SQLite) { }

...

this.sqlite.create({
  name: 'data.db',
  location: 'default'
})
  .then((db: SQLiteObject) => {


    db.executeSql('create table danceMoves(name VARCHAR(32))', [])
      .then(() => console.log('Executed SQL'))
      .catch(e => console.log(e));


  })
  .catch(e => console.log(e));