javascript - Cannot query WebSQL in Android -


when use normal query (which works on browser) in android using code:

var sql = 'select dphid dph'; var sqlparam = [];  db.transaction(     function querydb(tx) {         tx.executesql(sql, sqlparam,              function querysuccess(tx, results) {                 console.log(json.stringify(results.rows));                 ... call other function ...             }         , error);     } , error);  function error(tx, err) {     console.log("error");     console.log(json.stringify(tx));     console.log(json.stringify(err)); } 

it prints success (without result data):

{"length":5} @ null:339

but prints outer error:

{"code":0,"message":"the statement callback raised exception or statement error callback did not return false"} @ null:615

what wrong?

finally solved it!

i try explain can learn:

the error happens because use results in other function call this:

results.rows[0] 

this works flawless in pc browser, not in android mobile application. need use this:

results.rows.item(0) 

to object results.

what still don't understand when print results.rows, prints {"length":5} @ null:339 made me suspected there wrong in code (which have tested in pc browser without problem).


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -