Pre-populated database with SQLite plugin

0

I have the following problem: I am using SQLite Plugin: link in my hybrid App with cordova version: 6.1.1

I have a pre-populated bd located in the www folder of my project and the connection to my bd is like this:

var _db = window.sqlitePlugin.openDatabase({
        name: 'db_skulapp.db',
        location: 1,
        createFromLocation: 1
    },
    _function,
    function(_error){
        console.log('Error abriendo bd: '+JSON.stringify(_error));
    });

The connection opened and does not report any errors, but when I make a query about the bd, I get the following error:

  

no such table: profile (code 1):, while compiling: INSERT INTO profile   VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)

I decided to print the value of tx (the object that is created in the context of _db.transaction ()) and this is its value:

{"openargs":{"name":"db_skulapp.db","location":1,"createFromLocation":1,"dblocation":"libs","createFromResource":"1"},"dbname":"db_skulapp.db"}

Question:

  • How do I correct it (obviously)?
  • How can I verify the location and structure of the bd on my device (ie the path where it is stored)?
  • Thanks to whoever can help me!

        
    asked by Cristian Rivas Buitrago 10.05.2016 в 18:30
    source

    1 answer

    0

    I do not know very well why, but the author of the plugin "split" it in different versions and the one that supports pre-populated databases is cordova-sqlite-ext , try that.

        
    answered by 16.09.2016 в 12:17