468,305 Members | 1,472 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,305 developers. It's quick & easy.

HTML5 database queries

Hi,
I am developing a HTML5 based application. I need to process two queries concurrently, one inside another. Pseudo code attached below:

Expand|Select|Wrap|Line Numbers
  1. function main() {
  2. db.transaction( function (transaction) { transaction.executeSql(getDeptQuery, [bind1,bind2],processDepartments, errorHandler); } ); } function processDepartments(transaction, results) { for (var j=0; j
  3. { temp+= ""+results.rows.item(j).dept+"";
  4. transaction.executeSql(getEmpQuery,[bindDept],processEmployees, errorHandler);
  5. } document.getElementById('mydata').innerHTML +=temp; } function processEmployees(transaction, results1) { for (var j=0; j
  6. {
  7. temp+= ""+results1.rows.item(j).empname+"";
  8. } document.getElementById('mydata').innerHTML +=temp;
  9. }
Can someone help me with the correct syntax for achieving this.

Regards,
Krishna Neeraja.
Jan 12 '10 #1
3 2740
Dormilich
8,651 Expert Mod 8TB
you are aware that JavaScript canít access databases?
Jan 12 '10 #2
xNephilimx
213 Expert 100+
In HTML5 it can, but I don't know if browsers had implemented this API yet, I haven't tried it either. Anyways, from what I've read, the dbs are stored on the client side only, what seems logical, since a client side connection to a remote db is terribly insecure.
If you want to store data locally on the client's browser but want to use something better, with more granular lever of control, and more persistent than cookies, you can use DOM Storage (https://developer.mozilla.org/en/DOM/Storage)
Jan 12 '10 #3
xNephilimx
213 Expert 100+
The code krishnaneeraja provided is from palm webOS, I don't think that will work in a regular browser.
Jan 12 '10 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by arabub | last post: by
3 posts views Thread by Jules | last post: by
1 post views Thread by cover | last post: by
6 posts views Thread by DNB | last post: by
3 posts views Thread by DNB | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.