Hi. I'm using the plugin in Ionic v4 application.
const sqlQuery = 'SELECT user, consignment FROM users WHERE consignment = ?;';
const result = await this.db.transaction(tx => {
tx.executeSql(sqlQuery, ['some_value'], (trx, res) => this.logger.debug('[sqlite-tx-update]', res, trx));
});
The result output that I get is
{
"rows": {
"length" : 1
},
"rowsAffected": 0
}
Here's my transaction config
{
"db": {
"openargs": {
"name": "activity",
"location": "default",
"androidDatabaseProvider": "system",
"androidLockWorkaround": 1,
"dbLocation": "nosync",
"androidOldDatabaseImplementation": 1,
"androidBugWorkaround": 1,
},
"dbname": "activity"
},
"txlock": true,
"readOnly": false,
"executes": [],
"finalized": true
}
I'm using the plugin version 3.2 on Android 9.0 device
Your use of the transaction API does not look right, specifically there is something wrong with the way you are using the res object. How to get the rows data from the res object is already documented, please double-check.
I'm sorry my bad, was considering item to be an array instead of a function. Please make an explicit note of that in the documentation.
I have used the transaction API as documented but using async await and it works fine.
was considering item to be an array instead of a function
No worries, I just marked this with doc-todo label. Yes this is a pitfall and documentation really needs cleanup now.
I have used the transaction API as documented but using async await and it works fine.
Interesting, I have never tried it myself.
P.S. While the demo code is for the Ionic wrapper API, which is not directly supported by this project, it demonstrates how callback API calls can be embedded in async (asynchronous) JavaScript functions.