Ideas:

$('#mydiv').html(
    $.gears(db, 'select * from Demo order by Timestamp desc').toTable()
);

jQuery shouldn't be made to really change the gears API, but a good plugin
should allow the natural result of using the gears API to be easily used
to play with the DOM.  So, a toTable() method would return a jQuery object
containing an HTML table representation of the resultset.  Perhaps a
blending of ideas is in order to merge gears with something like taconite,
making a very easy to render online/offline page?  Just brainstorming.

- Brian


>> Although, this sounds like a great opportunity to write a plugin
>> around Google Gears.
>
> This was my first thought too, but after working with the API a little
> bit, I don't really see what functionality a jQuery plugin would
> add... Maybe in dealing with result sets:
>
> Before:
> // Get the 3 most recent entries. Delete any others.
> var rs = db.execute('select * from Demo order by Timestamp desc');
> var index = 0;
> while (rs.isValidRow()) {
>   if (index < 3) {
>     recentPhrases[index] = rs.field(0);
>   } else {
>     db.execute('delete from Demo where Timestamp=?', [rs.field(1)]);
>   }
>   ++index;
>   rs.next();
> }
> rs.close();
>
> After:
> // Get the 3 most recent entries. Delete any others.
> $(db.execute('select * from Demo order by Timestamp
> desc')).each(function(index) {
>   if (index < 3) {
>     recentPhrases[index] = this.field(0);
>   } else {
>     db.execute('delete from Demo where Timestamp=?', [this.field(1)]);
>   }
> });
>
> The API is already so simple and straightforward, where else would a
> jQuery plugin be helpful?
>
> --Erik

Reply via email to