You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
795 B

  1. import * as SQLite from "expo-sqlite";
  2. function openDatabase() {
  3. const db = SQLite.openDatabase("db.testDb");
  4. // return undefined
  5. return db;
  6. }
  7. export default openDatabase;
  8. // Snippet from docs:
  9. // https://docs.expo.io/versions/latest/sdk/sqlite/#importing-an-existing-database
  10. // async function openDatabase() {
  11. // if (
  12. // !(await FileSystem.getInfoAsync(
  13. // FileSystem.documentDirectory + "SQLite"
  14. // ).then(exists))
  15. // // .exists
  16. // ) {
  17. // await FileSystem.makeDirectoryAsync(
  18. // FileSystem.documentDirectory + "SQLite"
  19. // );
  20. // }
  21. // await FileSystem.downloadAsync(
  22. // Asset.fromModule(require("../assets/ddl.sqlite3.db")).uri,
  23. // FileSystem.documentDirectory + "SQLite/wp6.db"
  24. // );
  25. // return SQLite.openDatabase("wp6.db");
  26. // }