I have used the SQLlite plugin with Cordova to perform database operations on SQLlite database. I am using Cordova SQLlite storage plugin with Cordova version 6.0 and X-Code 7.2. The iOS device hangs when and consumes more memory when executing below code.
The below code snippet opens a database connection:
db = window.sqlitePlugin.openDatabase({name: 'sample.db', location: 2}, function(database){
console.log('DB opened successfully in database.js');
db = database;
if(dbSuccessCallback != null){
dbSuccessCallback(db);
}
}, function(error){
console.log('DB opening error in database.js');
if(dbErrorCallback != null){
dbErrorCallback(error);
}
});
return db;
The below code snippet is used to insert the data in database
db.sqlBatch(['create table if not exists app_settings(id integer primary key autoincrement,key_name text,value text)', 'create table if not exists department(id integer primary key autoincrement,department_name text,department_head text,no_of_employees integer)'],function(tx, result){
console.log('Tables Created successfully');
}
Can someone tell me what mistake I am doing in above code or is their any other SQLlite plugin or any other way of inserting records in sqllite database in iOS with Cordova?
Aucun commentaire:
Enregistrer un commentaire