By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,466 Members | 1,132 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,466 IT Pros & Developers. It's quick & easy.

HTML5 database queries

P: 21
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
Share this Question
Share on Google+
3 Replies


Dormilich
Expert Mod 5K+
P: 8,639
you are aware that JavaScript canít access databases?
Jan 12 '10 #2

xNephilimx
Expert 100+
P: 213
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
Expert 100+
P: 213
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.