Case analise
index.js
var db = null;
var db2 = null;
var db3 = null;
var dbUser = null;
var dbName = "estudos.db";
var app = {
initialize: function() {
document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
},
onDeviceReady: function() {
this.receivedEvent('deviceready');
},
receivedEvent: function(id) {
var parentElement = document.getElementById(id);
_**
var receivedElement = parentElement.querySelector('.received');
listeningElement.setAttribute('style', 'display:none;');
receivedElement.setAttribute('style', 'display:block;');
dbUser = window.sqlitePlugin.openDatabase({name: 'user.db', location: 'default'});
dbUser.transaction(function(tx) {
tx.executeSql('CREATE TABLE IF NOT EXISTS Users (flg_aceite, flg_valid_bd)');
}, function(error) {
alert('Transaction ERROR: ' + error.message);
}, function() {
console.log('Database OK');
});
window.plugins.sqlDB.copy(dbName, 0, copysuccess, copyerror);
}
};
app.initialize();
function copysuccess()
{
db = window.sqlitePlugin.openDatabase({name: dbName});
dropTable();
fts_table();
}
function copyerror(e)
{
db = window.sqlitePlugin.openDatabase({name: dbName});
}
function fts_table(){
db.transaction(function(tx) {
tx.executeSql('CREATE VIRTUAL TABLE vtestudos USING FTS3(titulo, texto, id_titulo)', [], function(tx,res){
db.transaction(function(tx) {
tx.executeSql('INSERT INTO vtestudos(titulo, texto, id_titulo) SELECT titulo, texto, id_titulo FROM estudos', [], function(tx,res){
console.log('insert ok');
});
}, function(err){
alert(err.message);
});
});
}, function(err){
alert(err.message);
});
What I have tried:
I have tried to modify my database, altering my cordova.js and even my index.js replacing the index to call my otherPAGE.js