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

[whatwg] Comments on updated SQL API

From: Aaron Boodman <aa@google.com>
Date: Wed, 17 Oct 2007 15:20:48 -0700
Message-ID: <278fd46c0710171520hdedb65fnfd5bf59905db11c2@mail.gmail.com>
On 10/17/07, Brady Eidson <beidson at apple.com> wrote:
> Additionally, if we replaced closeTransaction() with
> commitTransaction() and rollbackTransaction(), that would fit in with
> my idea of disallowing BEGIN/COMMIT/ROLLBACK in executeSql() as the
> developer would still have manual control over the implicit transaction.
> I'm very interested to hear everyone's thoughts on this.

Wow, this brings up something really scary that I never considered
about the current proposal:

In the current spec, the tx must stay open until callback returns,
right? That seems like the only reasonable way it could work. That's
too bad because since the callback is also overloaded as a way to get
the results of executeSql and do work, the callback might stay open
for a long time and do all sorts of other work, like starting
httprequests, starting new logical sql transactions, updating the UI,

It would be easy for developers to forget that the callback is also
used to keep the transaction alive and accidentally add all kinds of
other work to it.

commitTransaction() and rollbackTransaction() provide a way out of
this, but I would think the natural thing for developers to do would
be to be paranoid and *always* call these when done with their db

This is the first thing that makes me question the current implicit
transaction API :-(. Maybe adding a executeSqlInTransaction() would be
smarter. You can then separate the two meanings of SQLCallback:

- getting results of a sql call
- linking sql calls together into transactions

- a
Received on Wednesday, 17 October 2007 15:20:48 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:58 UTC