You mentioned that you use Phonegap . These are the steps to create and add records to sqlite database in Android
First: Add Plugin
cordova plugin add https:
Second: Open the database
document.addEventListener("deviceready", onDeviceReady, false); function onDeviceReady() { var db = window.sqlitePlugin.openDatabase({name: "my.db"}); }
Third: use it (create, update or delete)
db.transaction(function(tx) { tx.executeSql('DROP TABLE IF EXISTS test_table'); tx.executeSql('CREATE TABLE IF NOT EXISTS test_table (id integer primary key, data text, data_num integer)'); // demonstrate PRAGMA: db.executeSql("pragma table_info (test_table);", [], function(res) { console.log("PRAGMA res: " + JSON.stringify(res)); });
You can read here ...
source share