on 10-28-2015 7:36 AM
Hi All,
I'm creating database in sapui5 application for registration screen. Database is created once the button is clicked. But i want to check the details once the app open if already the customer register means i moves to login screen. So i want to call the database creation function in init function i tried but it does not populate. I share my code snippet here please correct it. Thanks in advance.
CODE:
testp:function(){
// Populate the database
function populateDB(tx) {
alert("Registration_Key : "+registration_Key);
tx.executeSql('DROP TABLE IF EXISTS DEMO');
tx.executeSql('CREATE TABLE IF NOT EXISTS DEMO (id unique, data)');
tx.executeSql('INSERT INTO DEMO (id, data) VALUES (1, 2)');
}
function queryDB(tx) {
tx.executeSql('SELECT * FROM DEMO', [], querySuccess, errorCB);
}
// Query the success callback
function querySuccess(tx, results) {
alert("querySuccess: "+querySuccess);
var len = results.rows.length;
console.log("DEMO table: " + len + " rows found.");
for (var i=0; i<len; i++){
console.log("Row = " + i + " ID = " + results.rows.item(i).id + " Data = " + results.rows.item(i).data);
}
}
// Transaction error callback
function errorCB(err) {
console.log("Error processing SQL: "+err.code);
alert("Error processing SQL: "+err.code);
}
// Transaction success callback
function successCB() {
var db = window.openDatabase("Database", "1.0", "PhoneGap Demo", 200000);
db.transaction(queryDB, errorCB);
}
alert("First Key : "+registration_Key);
registration_Key = "Registered";
db.transaction(populateDB, errorCB, successCB);
},
onInit: function() {
sap.ui.getCore().byId("registrationform.Login.view.js").getController().querySuccess();
},
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.