Cordova, Ionic framework SQLite database

cordova plugin add https://github.com/brodysoft/Cordova-SQLitePlugin.git window.sqlitePlugin.openDatabase({name: "my.db"}) .transaction( function (tx) { tx.executeSql("CREATE TABLE IF NOT EXISTS test( id INTEGET PRIMARY KEY, data TEXT )"); tx.executeSql( "INSERT INTO test(id, data) VALUES(?,?)", [1,'test'], function (tx, res) { // Success callback console.log("ID: " + res.insertId); console.log("rowsAffected: " + res.rowsAffected + " -- deberia ser 1"); }, function (error){ // Error callback console.log("Error : " + JSON.stringify(error)); } ); } );

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.