HTML5 database queries

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • krishnaneeraja
    New Member
    • Mar 2008
    • 21

    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:

    Code:
    function main() {
    db.transaction( function (transaction) { transaction.executeSql(getDeptQuery, [bind1,bind2],processDepartments, errorHandler); } ); } function processDepartments(transaction, results) { for (var j=0; j
    { temp+= ""+results.rows.item(j).dept+"";
    transaction.executeSql(getEmpQuery,[bindDept],processEmployees, errorHandler);
    } document.getElementById('mydata').innerHTML +=temp; } function processEmployees(transaction, results1) { for (var j=0; j
    {
    temp+= ""+results1.rows.item(j).empname+"";
    } document.getElementById('mydata').innerHTML +=temp;
    }
    Can someone help me with the correct syntax for achieving this.

    Regards,
    Krishna Neeraja.
    Last edited by Dormilich; Jan 12 '10, 08:58 AM. Reason: Please use [code] tags when posting code
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    you are aware that JavaScript can’t access databases?

    Comment

    • xNephilimx
      Recognized Expert New Member
      • Jun 2007
      • 213

      #3
      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)

      Comment

      • xNephilimx
        Recognized Expert New Member
        • Jun 2007
        • 213

        #4
        The code krishnaneeraja provided is from palm webOS, I don't think that will work in a regular browser.

        Comment

        Working...