Javascript sqlite database error : "Error processing SQL: undefined " while inserting and selecting data from/to table
I am trying to store data from webservices using javascript, sqlite. getting some error like
db.transaction(populateDB, errorCB, successCB);
populateDB is not executing at all.
and while reading data from table(and same database )giving me error like "Error processing SQL: undefined ". applied many tricks but no solution till now.
my SELECT Code is
function queryDB(tx)
{
db.transaction(function(tx)
{
tx.executeSql('SELECT * FROM vact_geography', [], LoadGeo, errorCB);
});
}
function LoadGeo(tx, results)
{
var len = results.rows.length;
alert("Region table: " + len + " rows found.");
//arr = new Array();
for (var i=0; i<len; i++){
// alert("Row = " + i + " geo_id = " + results.rows.item(i).geo_id + " geo_name = " + results.rows.item(i).geo_name);
//arr.push(results.rows.item(i).geo_name);
//alert(results.rows.item(i).regionname);
//alert("assigned");
var src_Geo = document.getElementById("src_target") ;
var Des_Geo = document.getElementById("Des_target") ;
//alert("Row Should be printed");
src_Geo.options[src_Geo.options.length] = new Option(results.rows.item(i).geo_name, results.rows.item(i).geo_id);
Des_Geo.options[Des_Geo.options.length] = new Option(results.rows.item(i).geo_name, results.rows.item(i).geo_id);
}
}
and and code for populate data is
function startup()
{
alert("Entered in Str");
$.get("http://example.in/projects/vact1/api.php?usn=user&pwd=***&var=database",
function(Jdata)
{
alert("1st api call");
var j;
j=Jdata.timestamp;
$.get("http:/开发者_开发知识库/example.in/projects/vact1/api.php?usn=user&pwd=***&var=validity×tamp="+j+"",
function(Tdata)
{
alert("2st api call");
var i;
i=Tdata.UpdateNeeded;
alert("http://example.in/projects/vact1/api.php?usn=user&pwd=***&var=validity×tamp="+j+"");
if(i)
{
db = window.openDatabase("Database", "1.0", "PHGsample", 200000);
db.transaction(populateDB, errorCB, queryDB);
alert("Enterd");
}
else
{
queryDB();
}
});
});
}
Any suggestion ? i was implementing for [link] Waroze.com Thanks in Advance
So, how did you go on this one? I see that it's over 12 months old.
Is populateDB defined? How do you know it's not getting that far?
You know that in this case populateDB would get passed the transaction object, and you'd use that to tx.sqlExecute() the sql - right?
精彩评论