3

I am new to react native so please forgive me If I ask anything wrong. I am integrating sqlite (https://github.com/andpor/react-native-sqlite-storage) to store data locally on my device and I am able to create table with insert record and fetch but not able to find out where all the queries are stored mean where it create database file in our app.

Below is the code:

let SQLite = require('react-native-sqlite-storage')
let db = SQLite.openDatabase({name: 'user_consultant.db', location:'Library'}, this.openCB, this.errorCB);
db.transaction((tx) => {
    tx.executeSql('CREATE TABLE IF NOT EXISTS category  (ID Integer PRIMARY KEY AUTOINCREMENT,NAME varchar(25))', [], (tx, results) => {
        // Get rows with Web SQL Database spec compliance.
        alert(JSON.stringify(results));
        },(err) => {
        alert('error '+JSON.stringify(err));
    });
});

I want to store this table in database and also want to see query in database file with location. Please help me out to find-out the solution. Thanks in advance.

MLavoie
  • 9,671
  • 41
  • 36
  • 56
Vinit Mehta
  • 449
  • 4
  • 13
  • Format the code please – Andrey Moiseev Nov 10 '16 at 12:42
  • please check on http://pastebin.com/ftQKiqFR – Vinit Mehta Nov 10 '16 at 13:20
  • 2
    Edit the post and indent code with code button – Andrey Moiseev Nov 10 '16 at 13:29
  • Like all android applications, the database probably exists in the apps private data and you can only access it by adb – OneCricketeer Nov 10 '16 at 13:31
  • 1
    @cricket_007 how can I access created DB with adb? – Vinit Mehta Nov 10 '16 at 13:33
  • I don't think this is what you need... You seem to want to use a pre-populated database like that github page explains, not create your entire schema within the app. And sqlite doesn't keep a history of the commands ran into a database file, it only stores the data in the format you give – OneCricketeer Nov 10 '16 at 13:36
  • And I don't know what `location: 'Library'` means, but that looks like it was copied from the ios example – OneCricketeer Nov 10 '16 at 13:37
  • In other words, read the documentation... *The 'location' parameter you provide to openDatabase call indicated where you would like the file to be created. This parameter is neglected on Android.*... But anyways, this is what I was referring to http://stackoverflow.com/questions/11598152/how-do-i-pull-the-sqlite-database-from-the-android-device – OneCricketeer Nov 10 '16 at 13:40
  • But How I check where my data is stored , it is actually stored in any sql file or just store in temporary memory? – Vinit Mehta Nov 10 '16 at 13:43
  • @VinitMehta did you find any solution? – bittu Mar 05 '18 at 09:06

0 Answers0