I've got a SQLlite resultset - and I think it's actually returning data, whereas I thought originally it was coming off as an error.
This is what I get when I log the resultset (console.log(results)):
SQLResultSet {rowsAffected: 0, rows: SQLResultSetRowList}insertId: [Exception: DOMException: Failed to read the 'insertId' property from 'SQLResultSet': The query didn't result in any rows being added.]rows: SQLResultSetRowListlength: 1__proto__: SQLResultSetRowListconstructor: function SQLResultSetRowList() { [native code] }item: function item() { [native code] }arguments: nullcaller: nulllength: 1name: "item"__proto__: function Empty() {}<function scope>...
Now, when I do this - console.log(results.rows.item), I get:
function item() { [native code] }
How am I supposed to get any data from this?
All I want to do is get the id from my query.
This is my query for reference:
db.transaction(function(tx) {
tx.executeSql('SELECT id FROM calculator ORDER by id DESC LIMIT 1;', [],
function(tx, results) {
So how do I get the value?
Aucun commentaire:
Enregistrer un commentaire