im having some issues trying to use expo sqlite. Check the code bellow
let getRomaneiosLocal = async () => {
let {reduxDb} = props
let selCMD = sqliteUtils.createSelectCMD('ROMANEIOS')
selCMD += ' GROUP BY ROMANEIO, FILIAL'
//selCMD = SELECT * FROM ROMANEIOS GROUP BY ROMANEIO, FILIAL
let dbResp
await reduxDb.transaction(async tx => {
await tx.executeSql(selCMD, [],
(tx, {rows}) => dbResp = rows), //Sucess cb
(tx, errorObj) => { //Error cb
alert('Error getRomaneiosLocal')
console.log(errorObj)
}
}
)
return dbResp
}
I would like to return dbResp, but it is returning undefined instead of the rows value .
Inside the sucess cb the dbResp value is the rows, but it is returning undefined .
My first try was putting async await (didnt work), i search on expo forum, still didnt found a answer for this problem
Expo Sqlite documentation: SQLite - Expo Documentation
Maybe this is a scope problem?
Should I use functions instead of arrow functions?