W3C home > Mailing lists > Public > whatwg@whatwg.org > October 2007

[whatwg] Gigantoredesignorrific changes to the Database API

From: Dimitri Glazkov <dimitri.glazkov@gmail.com>
Date: Thu, 25 Oct 2007 21:26:38 -0500
Message-ID: <fb15ac210710251926m63697f7qddb7fcb9f8b63a65@mail.gmail.com>
I like the operation structure, imposed by the new spec: (database
(transaction (statement (handler)))), and error callbacks are nice. A
couple of things stood out:

1) The transactions are now required and this seems like an
unreasonable performance hit. What if the API would assume transaction
mode, but would allow authors to explicitly state that the operation
is not a transaction:

db.operation(function(op) {
   // implicitly a transaction
});
db.operation(function(op) {
   // explicitly not a transaction, just a set of statements in one context.
}, null, false /* states that this is not a transaction */);

.. or something along these lines.

2) Fully asynchronous is scary. Are we sure this is going to be
well-digested? I can just see people doing this:

db.operation(function(tx) {
   var count;
   tx.executeSql("SELECT COUNT(*) AS C FROM BLAH;", function(r) {
       count = r.item(0).c;
   });
   if (count > 0) {
        // do happy things.
   }
});

3) I think I misunderstand step 11, help me out. If the commit has
failed once, why try to re-commit, even if the error callback
instructs you to?

:DG<
Received on Thursday, 25 October 2007 19:26:38 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:37 UTC