SQlite query response

I posted this on SO but it seems like there’s not much traction for Expo. So posting here:
According to Expo documentation with SQLite I would make a query like so:

`tx.executeSql(sqlStatement, arguments, success, error)`

I execute it like this:

db.transaction(tx => {
  tx.executeSql('SELECT * FROM dr_report_properties WHERE orderId = (?)', [this.state.orderId]);
  error => {
  (tx, results) => {

My question is how do I get the response? The above returns as undefined. I then try (not expecting it to work but just for kicks)


This does give a console.log

(tx, results) => {
        console.log('I got data');

According to the documentation:

ResultSet objects are returned through second parameter of the success callback for the tx.executeSql() method on a Transaction (see above). They have the following form:
  rows: {

I would expect result would be this object. Any ideas at what I’m doing wrong?

1 Like

Hey @impactcolor!

Took me a little bit to figure it out, but the success and error callbacks are part of the executeSql method, so it should be written like this (for example)

      tx => {
        tx.executeSql('select * from my_table', [], (trans, result) => {
          console.log(trans, result)

I tested in this snack and it works!

1 Like

This did it @charliecruzan, thank you!

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.