Expo.Sqlite errors

#1

Hello. I just created simple expo.sqlite wrapper based on promises. But i cannot execute insert and select command it causes errors. Here is a fragment of my code

    this.db = SQLite.openDatabase({ name: DB.name })
    await this.query(`
      DROP TABLE IF EXISTS users;
      CREATE TABLE users (
        id INT(6) AUTO_INCREMENT PRIMARY KEY,
        name VARCHAR(20) NOT NULL
      )
    `)

    await this.query(`
      INSERT INTO users VALUES (null, 'jack');
    `) // Fails here

    await this.query(`
      SELECT * FROM users;
    `)

here is the code of query function:

  query (sql, opts = []) {
    let success = this.logQuerySuccess
    let fail = this.logQueryFail
    let resultLog = this.logQueryResult
    let error = this.errorCallback

    let db = this.db

    console.log(sql) //eslint-disable-line

    return new Promise((resolve, reject) => {
      db.transaction((tx) => {
        tx.executeSql(sql, opts, (tx, result) => {
          success()
          resultLog(result)
          resolve(result)
        }, (err) => {
          fail(err)
          reject(err)
        })
      }, error)
    })
  }

It fails with:

Possible Unhandled Promise Rejection (id: 0):
WebSQLTransaction {
  "_complete": true,
  "_error": null,
  "_running": false,
  "_runningTimeout": false,
  "_sqlQueue": Queue {
    "first": undefined,
    "last": undefined,
    "length": 0,
  },
  "_websqlDatabase": WebSQLDatabase {
    "_currentTask": null,
    "_db": SQLiteDatabase {
      "_name": "test.db",
    },
    "_running": false,
    "_txnQueue": Queue {
      "first": undefined,
      "last": undefined,
      "length": 0,
    },
    "version": "1.0",
  },
  "column": 29,
  "line": 21966,
  "sourceURL": "http://192.168.0.103:19001/./node_modules/react-native-scripts/build/bin/crna-entry.bundle?platform=android&dev=true&hot=true&minify=false",
}
#2

Not actual. Fixed sql errors