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

[whatwg] SQL API complex for simple cases

From: Ian Hickson <ian@hixie.ch>
Date: Thu, 1 Nov 2007 00:21:55 +0000 (UTC)
Message-ID: <Pine.LNX.4.62.0711010021280.27205@hixie.dreamhostps.com>
On Wed, 31 Oct 2007, Timothy Hatcher wrote:
> 
> How is that wrong? If the first executeSql fails the error callback (if 
> any) will fire, not the normal callback.
> 
>   db.executeSql('CREATE TABLE ...', [], function(...) {
>     db.executeSql('INSERT INTO ...', []);
>   });
> 
> If the CREATE TABLE fails, the insert will never happen. If the INSERT 
> fails, you don't really want the table to be rolled out. If you did, 
> then you want a transaction. There are clearly times where you don't 
> always want a transaction, but want to chain statements.

What if another page dropped the table between the CREATE and the INSERT?

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Wednesday, 31 October 2007 17:21:55 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:37 UTC