[whatwg] executeSql API is synchronous

On Sep 20, 2007 1:14 PM, Timothy Hatcher <timothy at apple.com> wrote:

>  The pain of asynchronous access can be alleviated or even solved with an
> API for transactions, or a group of SQL queries that need be executed in
> order. Commonly, if a transaction fails in the middle, the database
> is rolled-back to the state before the transaction started.
>

It sounds like what you're talking about is something like:

var tx = new Transaction();
tx.addStatement("insert into accounts values (?, ?)", ["foo", "bar"]);
tx.addStatement("update persons set name = ?, age = ?", ["bob", 42]);
tx.executeAsync(callback, errback);

This only works so long as you can construct all the sql calls ahead of
time. If any calls depend on the results of previous ones, you need
something like a worker.

But I agree that the api needs support for transactions, I wanted to start
another thread about that.

- a


> There can then be a callback when the transaction finished or fails, with
> details on what query failed.
>
> On Sep 20, 2007, at 10:13 AM, Aaron Boodman wrote:
>
> That said, it will be even more common with databases to have multiple
> asynchronous operations in a row than it is today with XHR. Doing this all
> asynchronously will be incredibly painful.
>
>
>  ? Timothy Hatcher
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20070920/913f3ee0/attachment.htm>

Received on Thursday, 20 September 2007 13:49:44 UTC