Open Priya-Ahuja opened 7 years ago
I think you mean cordova-plugin-dbcopy
, cordova-plugin-sqlite-2
, and cordova-sqlite-storage
. Using both cordova-plugin-sqlite-2
(not supported here) and cordova-sqlite-storage
leads to undefined results because both plugins define the same JavaScript functions.
According to the Web SQL spec you have to specify all column values.
In case of cordova-sqlite-storage
it will only complain if you specify too many column values.
Also please be sure that you use sqlitePlugin.openDatabase
. If you use window.openDatabase
you get Web SQL and miss the benefits of the sqlite plugin.
Thanks for the help @brodybits ..I deleted the cordova-plugin-sqlite2.. My code to copy the db window.plugins.sqlDB.copy("mydb.db", 0, function () { db = $cordovaSQLite.openDB({ name: "mydb.db", location: 0 }); and still while inserting i am getting the following error :
Failed to import SQL; message=sqlite3_prepare_v2 failure: table Details has 15 columns but 12 values were supplied
Marking this as "community help" since I generally do not support Ionic or other Angular derivatives for free. I also do not support the dbcopy plugin.
I suggest you post the CREATE TABLE statement along with the actual inserting code.
Since i am using dbcopy plugin to first copy the db with blank schema in the phone , I am not making CREATE TABLE statements , i am only doing insert statements.
Understood. Here is what I suggest to get help:
Get a dump of the sqlite database file (open with the sqlite3 command tool and do .dump
).
Make a new test app based on https://github.com/brodybits/cordova-sqlite-storage-starter-app that creates the table and attempts to populate the data. Note that this app already includes cordova-sqlite-storage in config.xml so there is no need to add the sqlite plugin, just add one or more desired platforms.
Then see if you can reproduce the problem in the test app. If not, then try one thing at a time until you see what does and does not work.
Hi.. I am working on a Cordova SQLite application.Following is the list the plugins i am using for inserting data into SQLite DB