react-native-sqlite-storage icon indicating copy to clipboard operation
react-native-sqlite-storage copied to clipboard

await db.transaction

Open fjqingyou opened this issue 5 years ago • 2 comments

            //db: SQLite.SQLiteDatabase
            let tx = await db.transaction((tx2 : Transaction)=>{
                console.info("tx2=",tx2);
            });
            console.info("tx=",tx);

Expected Behavior

tx !== null && tx2 == tx

Current Behavior

tx == null && tx2 != null && tx2 != tx

and console print

18:47:10.364 tx2= SQLitePluginTransaction {db: SQLitePlugin, txlock: true, fn: ƒ, error: ƒ, success: ƒ, …} 18:47:19.259 tx= []

Possible Solution

Steps to Reproduce (for bugs)

Context

Your Environment

  • React Native SQLite Storage Version used: "react-native-sqlite-storage": "^5.0.0",

  • React Native version used: "react-native": "0.63.0",

  • Operating System and version (simulator or device): MAC OS: Darwin x64 19.4.0

  • IDE used: VSCode Version: 1.47.2 commit: 17299e413d5590b14ab0340ea477cdd86ff13daf Date: 2020-07-15T18:18:50.054Z Electron: 7.3.2 Chrome: 78.0.3904.130 Node.js: 12.8.1 V8: 7.8.279.23-electron.0 OS: Darwin x64 19.4.0

  • Link to your project:

Debug logs

fjqingyou avatar Jul 22 '20 10:07 fjqingyou

#441 I need using await, so i can't usin callback mode

fjqingyou avatar Jul 22 '20 15:07 fjqingyou

@fjqingyou did you turn on Promise mode?

andpor avatar Jan 25 '21 17:01 andpor