Results 1 to 5 of 5
  1.    #1  
    In the data example provided by Palm, a query is done similar to this...

    Code:
        this.db.transaction( 
            (function (transaction) { 
                transaction.executeSql(mytext, [], this.queryDataHandler.bind(this), this.errorHandler.bind(this)); 
            }).bind(this) 
        );
    And the queryDataHandler function processes data that is returned...

    Code:
    QueryAssistant.prototype.queryDataHandler = function(transaction, results) {
      // A LOT OF CODE IN BETWEEN HERE...
    }
    If the query doesn't return any rows, what will be the value of the results variable that is passed into the queryDataHandler function? Will it be null, an error, or something else???
    Last edited by Laxidasical; 10/10/2009 at 01:44 AM. Reason: Typo
    MoBill - Use your Authorize.net account to bill your customers with your webOS device!!
    MoJack - Track your lost or stolen webOS device from anywhere!
    Time to get VIRAL
  2. #2  
    To check for 0 rows, you'd have this code:

    if (results.rows.length == 0) {
    // 0 rows
    }
  3.    #3  
    After some searching online I found that I could also do this...

    Code:
    if (results.rows == '')
    {
        // CODE...
    }
    If anyone is looking for the latest W3C draft for HTML5 API for database storage...
    Web Database

    Palm should really have this stuff documented somewhere instead of having to search all over the web for it.
    Last edited by Laxidasical; 10/10/2009 at 08:51 AM. Reason: Typo
    MoBill - Use your Authorize.net account to bill your customers with your webOS device!!
    MoJack - Track your lost or stolen webOS device from anywhere!
    Time to get VIRAL
  4. #4  
    I don't think this should necessarily be documented in the SDK since it's more related to javascript semantics (i.e. checking the "length" element of the "rows" array to determine if the array has 0 elements).

    In general though, if you need example code for portions of the SDK, you can look in the "share/samplecode" sub-directory within the SDK installation directory on your computer.

    One of the projects in there is called "Data" which shows how to work with cookies, depots, and sqlite databases. In the sqlite code, you'll see "results.rows.length" referenced in a FOR loop that loops through each element in the results.rows array.
  5.    #5  
    You know, I must have looked at that for over 3 hours and missed it!!! I really need to get some sleep!
    MoBill - Use your Authorize.net account to bill your customers with your webOS device!!
    MoJack - Track your lost or stolen webOS device from anywhere!
    Time to get VIRAL

Posting Permissions