Sqlite executeSql 不返回结果集

Sqlite executeSql is not returning ResultSet

我正在尝试使用 react-native-sqlite-storage 插件对 React-Native 中的 Sqlite 执行简单查询。根据文档,我应该在成功回调中加入两个参数 1) SQLite.Transaction 和 2) SQLlite.ResultSet 但在我的示例中我只得到 SQLite.Transaction

let sql = "SELECT * FROM table_a;"
let params = [];

db.executeSql(sql, params,
  (trans, results) => {
    console.log("execute success results: " + JSON.stringify(results))
    console.log("execute success transaction: " + JSON.stringify(trans))
    //resolve(results);
    resolve(trans);
  },
  (error) => {
    console.log("execute error: " + error);
    reject(error);
});  

控制台输出

execute success results: undefined
execute success transaction: {"rows":{"length":1},"rowsAffected":0}  

我忘记将 executeSql 包裹在 transaction 中。这按预期工作:

db.transaction((txn) => {
    txn.executeSql(sql, params, (trans, results) => {
        console.log("execute success results: " + JSON.stringify(results))
        console.log("execute success transaction: " + JSON.stringify(trans))
        //resolve(results);
        resolve(trans);
    },
        (error) => {
        console.log("execute error: " + JSON.stringify(error))
        reject(error);
    });
});