I am running this code at the beginning of my PWA opening. I have been testing the app all day
function CountTrackingRecords(){
SyncButtonValue('Checking Tracking...');
console.log('enter tracking record count');
DB = SqlOpenDatabase("pts.db3", "1.0", "PTS");
s = new Array(["SELECT COUNT(*) as c FROM tracking;", [], CountTrackingRecordsCallBack]);
Sql(DB, s);
}
function CountTrackingRecordsCallBack(transaction, results)
{
c = results.rows.item(0)['c'];
if (c >= 1)
{
SyncButtonValue("Alert - There are " + c + " records to sync.");
}
else{
SyncButtonValue("Ready - There are " + c + " records to sync.");
}
}
I am now getting this error out of the blue. (testing in Chrome)
Comparing the appstudioFunctions.js that is deployed in Chrome and the appstudioFunctions.js that is in my project “nsb”, they have different NSB._sqlerror functions.
The function in the project nsb folder:
NSB._sqlError = function (lastSQL) {
// returns an appropriate sqlError function give lastSQL
return function (tx, err) {
NSB.MsgBox('SQLite error: {errmsg} (Code {errcode}) {sql}'.supplant({
"errmsg": err.message,
"errcode": err.code,
"sql": lastSQL
}));
return false;
};
};
The function in the deployed appstudioFunctions.js in Chrome
NSB._sqlError = function (lastSQL) {
// returns an appropriate sqlError function give lastSQL
return function (tx, err) {
NSB.MsgBox("SQlite error:" + err.messages + "( Code " + error.code + ") " + lastSQL);
return false;
};
};
document.addEventListener("DOMContentLoaded", onDOMContentLoaded, False)
Function onDOMContentLoaded()
initDB();
End Function
Function initDB()
db = SqlOpenDatabase("my.db", "DatabaseName");
JavaScript
db.transaction(function(transaction) {
transaction.executeSql('CREATE TABLE IF NOT EXISTS......
End JavaScript
End Function