You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it possible to wait until the query is finished? I have something like:
functionquery(fields,table){db.on('open',()=>{returndb.prepare(`SELECT ${fields} FROM ${table}`).all()})}letrows=query('*','user')console.log(rows)// is returning undefined. I need this to wait until all() is finished.
thanks!
The text was updated successfully, but these errors were encountered:
Version 2 has been released! If you update better-sqlite3 to version 2, you'll be able to do this synchronously:
var Database = require('better-sqlite3')
var db = new Database('foobar.db', options)
function query(fields, table) {
return db.prepare(`SELECT ${fields} FROM ${table}`).all()
}
let rows = query('*', 'user')
console.log(rows)
Is it possible to wait until the query is finished? I have something like:
thanks!
The text was updated successfully, but these errors were encountered: