Yup, ads are on Twitter alright % history meme as boring as history class?
Apr 16

Gears Future APIs: Database 2.0 API meshes with HTML5 Storage API

Gears, Tech with tags: , , Add comments

Aaron Boodman wrote a fantastic post on Gears and Standards which I am very passionate about myself.

In it he talks about the HTML5 Storage API and how we are all working together to unify the database access semantics.

You can see the Database 2 API which aims too:

  • Enable Javascript developers to easily write code that works with both Gears and browser database APIs
  • Reduce developer “mind-print” by implementing the same API that is available in browsers
  • Support the proposed HTML5 database standard with an implementation available for all browsers that Gears supports
  • Implement an asynchronous API that can be called from the UI thread without freezing the UI
  • Implement a synchronous API to simplify usage inside workers
  • Implement a thread pool abstraction that can be used in other modules for asynchronous operations (bonus)
  • build a new module from scratch using the new Dispatcher model (bonus).

It would allow you to write code such as:

var dbman = goolge.gears.factory.create('beta.databasemanager');
var db = dbman.open('pages', '',
  'Collection of crawled pages', 3000000);
function renderPageRow(row) {
  // insert page row into a table
function reportError(source, message) {
  // report an error
function renderPages() {
  db.transaction(function(tx) {
    tx.executeSql('CREATE TABLE IF NOT EXISTS Pages(title TEXT, lastUpdated INTEGER)', 
    tx.executeSql('SELECT * FROM Pages', [], function(rs) {
      for(var i = 0; i < rs.rows.length; i++) {
function insertPage(text, lastUpdated) {
  db.transaction(function(tx) {
    tx.executeSql('INSERT INTO Pages VALUES(?, ?)', [ text, lastUpdated ],
      function() {
        // no result returned, stub success callback
      function(tx, error) {
        reportError('sql', error.message);

There is a full technical design, so you can get involved and take part in the open source / open community process that we have going on in Gears land.

I will again end with my visualization of the zipper :)

4 Responses to “Gears Future APIs: Database 2.0 API meshes with HTML5 Storage API”

  1. Uriel Katz Says:

    when this will be integrated with Gears?
    also is there any synchronous API,because it is alot easier to write synchronous code and let a worker handle it in the background than writing nested function async code,also it is bad if you want to write a ORM :)

  2. EthraZa Says:

    Do you know if there is some extend to print() API in the future of Google Geras?
    From my personal point of view this wold be the killer API of GG!

  3. Vladimir Says:

    Hi Dion, what tool did you use for creating the zipper? I am guessing with PS am I write ?

  4. Vladimir Says:

    sorry right not write :)

Leave a Reply

Spam is a pain, I am sorry to have to do this to you, but can you answer the question below?

Q: Type in the word 'cricket'