SQLite understanding returns

Hi!
I am struggling to understand how I can debug return values from my SQLite queries.

var res = ''
db.transaction(function(tx){
        res = tx.executeSql("some querry");
    });
    console.log(res)

This returns object. If is use JSON.stringify(res) I receive {"rowsAffected":0,"insertId":"","rows":{}} even if the querry is correct and has returned values that I can access via res.rows.item(0).name

What is the proper way to debug returns?

I am looking into this to check if my CREATE TABLE IF NOT EXIST was executed or not. If it was I would like to set the PRAGMA user_version = 1

I usually have an init that either initializes or returns a reference to the _db. Thereafter, I just use naive:

if(result.rows.length === 1)

tests. In this case, I would just set the PRAGMA, assuming it’s in the schema, and check the length of the return. What’s the schema of the table?

The console.log should be in the function, i think.

if that transaction works asynchronosly res is not set at time of printing it.

if not, this doesnt matter :wink: