I am not sure what if anything I am doing wrong or if this is a bug.
My IndexedDB exists and has data in it. I am currently using alasql to query the data AFTER i retrieve it from IndexedDB, however I would much rather do this in a singe step as this make joins and other queries across multiple tables much simpler.
Here is my code:
const queryDB = async (dbName, query) => {
const result = await alasql.promise([
`CREATE INDEXEDDB DATABASE IF NOT EXISTS ${dbName};`,
`ATTACH INDEXEDDB DATABASE ${dbName};`,
`USE ${dbName};`,
]);
console.log(result);
return await alasql.promise(query);
};
(also tried without semicolon...)
the first call to this function fails with 'Error: Database ... does not exist' where ... is the dbName
while the second one succeeds and returns the value from the query.
I have been trying just about everything I can everything I can think of and the only working solution is using callbacks (as in the example on the wiki) which is NOT what I want to do.