-1

I'm creating a database and a table for my node webkit app, using this :

var db = openDatabase('vizDb', '1.0', 'Visualiation database', 2 * 1024 * 1024);

db.transaction(function (tx) {
        query = 'CREATE TABLE IF NOT EXISTS dataworking  (id, ACV, sales, Date)';
        tx.executeSql(query);

        $.each(records, function(i,thisRecord){

            records[i] = thisRecord.split(',');

            query = 'INSERT INTO  dataworking (id, ACV, sales, Date) VALUES (' + thisRecord + ')';
            //console.log(query); //query is correct here
            tx.executeSql(query);
        });
});    

But when I do the following, I don't get the records in the console.

db.transaction(function (tx) {
        query = 'SELECT * FROM dataworking';
        tx.executeSql(query , [], function (tx, results) {
            var len = results.rows.length ;
            for (i = 0; i < len; i++) {
               console.log(results.rows.item(i));
            }
        });
    });

I want to check if my records are entered currently. For this, I go to the location

..AppData\Local\Package-name\databases and I see a file Databases.db and a folder file__0 with a file named '1'. I run the SQLite prompt from the location ../file__0/ and list the tables

sqlite>.open 1
sqlite>.tables
sqlite> __WebKitDatabseInfoTable__

But there is no table named dataworking.

How do I open the database vizDb and check if the table 'dataworking' is made?

vivekanon
  • 1,813
  • 3
  • 22
  • 44

1 Answers1

0

The Databases.db file contains a list of the actual databases.

Your database is in the file 1.

CL.
  • 173,858
  • 17
  • 217
  • 259
  • Okay..so once I've created a table, how do I view it in the prompt. I tried [.open 1] and then [.tables] but I don't get the table listed. – vivekanon Jul 06 '14 at 08:38
  • When you use the wrong directory, SQLite will happily create an empty database there. – CL. Jul 06 '14 at 08:44
  • Umm.. the directory I used was file__0. That's where the file 1 is. Am I supposed to use some other dir? – vivekanon Jul 06 '14 at 09:24