Skip to content

Latest commit

 

History

History
39 lines (29 loc) · 786 Bytes

README.md

File metadata and controls

39 lines (29 loc) · 786 Bytes

react-native-sqlite-helper

Promisify andpor/react-native-sqlite-storage

MyDBHelper.js

import SQLiteOpenHelper from 'react-native-sqlite-helper'

class MyDbHelper extends SQLiteOpenHelper {
  constructor() {
    super('db_name', 201);
  }

  onCreate(db) {
    console.log("create");
  }

  onUpgrade(db, oldVersion, newVersion) {
    console.log("upgrade");
  }

  onDowngrade(db, oldVersion, newVersion) {
    console.log("downgrade");
  }
}

export default MyDbHelper
import MyDBHelper from './MyDBHelper'

let dbHelper = new MyDBHelper();
let db = await this.dbHelper.getDatabase();
db.executeSql('SELECT * FROM some_table;').then((results) => {
  this.list = results.rows.raw();
});