0

I am using expo and react native to build a truth or dare app. I want to store hundreds of truth or dare questions to feed to the user. I figured SQLite would be most efficient for this (and allow offline usage). I created the db using the DB Browser (SQLite) tool and created a single table named "Prompts" with several rows.

Here's the code I use for opening and performing a transation:

import database from "../assets/db/TruthOrDareDB.db"

const db = SQLite.openDatabase(database);
console.log(db);

db.transaction((tx) => {
  console.log("transaction test");
  tx.executeSql(
    `
SELECT *
FROM Prompts;`,
    [],
    (_, result) => console.log("executeSql"),
    (transaction, error) => console.log(error)
  );
});

The openDatabase call returns a webSQLDatabase obj. I recieve the "transaction" log to the console but I do not get the "executeSql" log or an error. I would expect to get at least one, why am I not?

And as far as design do you agree that SQLite is the best for my goal?

cmote
  • 79
  • 1
  • 8

0 Answers0