(expo-sqlite) How do I iterate through an SQLResultSet?

Please provide the following:

  1. SDK Version: 4.13.0
  2. Platforms(Android/iOS/web/all): Android & iOS
  3. Add the appropriate “Tag” based on what Expo library you have a question on.

I use this code snippet to create a Promise whenever I try to run an SQL statement:

async function executeSql(sql:string,params:Array<any>): Promise<SQLResultSet> {

    return new Promise((resolve,reject) =>

        database.transaction(tx => {

            tx.executeSql(

                sql,

                params,

                (transaction,resultSet) => resolve(resultSet),(transaction,error)=>{

                    reject(error);

                    return true;

                })

        }))

}

And then I use code like this to do anything with executeSql:

async function doSomething()
{
    const resultSet = await executeSql("sql",[]);
}

But resultSet is an SQLResultSet, NOT a regular ResultSet, contrary to what the documentation indicates: " ResultSet objects are returned through second parameter of the success callback for the tx.executeSql() method on a SQLTransaction (see above)"

I need to iterate through the results in resultSet. How do I do this?

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