[whatwg] SQL API and Transactions
Scott Hess
shess at google.com
Thu Nov 1 09:51:33 PDT 2007
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
More information about the whatwg
mailing list