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

[whatwg] SQL API and Transactions

From: Scott Hess <shess@google.com>
Date: Thu, 1 Nov 2007 09:51:33 -0700
Message-ID: <696e4b7c0711010951y2421bb4cra403cf3c89c3db73@mail.gmail.com>
On Oct 31, 2007 5:20 PM, Ian Hickson <ian at hixie.ch> wrote:
> On Wed, 31 Oct 2007, Scott Hess wrote:
> > I think one could work around this within the current spec something
> > like:
> >
> > var success = true;
> >
> > db.transaction(function (t) {
> >   t.executeSql('insert into x values (?)', [y]);
> >   db.transaction(function (t) {
> >     if (success) {
> >       // This should be called after the outer transaction has completed.
> >     }
> >   }
> > }, function (e) {
> >   success = false;
> > });
> >
> > That's awful cumbersome, but if the need is seldom enough, it might be
> > reasonable.
>
> Actually that wouldn't work because nested transactions are completely
> independent of the initial one, so unless the transaction blocked the
> entire database, the nested one above would finish immediately.

Hmm.  Is this because we're allowing for what SQLite calls BEGIN
DEFERRED, rather than requiring BEGIN IMMEDIATE?  [I'm basing this on
error code 5.]  In that case, yes, the above won't work.  I'd like to
argue that BEGIN IMMEDIATE should be required, but I don't think
that's at all portable.

-scott
Received on Thursday, 1 November 2007 09:51:33 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:47:42 GMT