[whatwg] Gigantoredesignorrific changes to the Database API

Dimitri Glazkov dimitri.glazkov at gmail.com
Thu Oct 25 19:26:38 PDT 2007

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?


More information about the whatwg mailing list