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

[whatwg] SQL API complex for simple cases

From: Timothy Hatcher <timothy@apple.com>
Date: Wed, 31 Oct 2007 17:13:27 -0700
Message-ID: <4AAF16DD-3EAB-407A-81FD-FD5F8581779C@apple.com>
On Oct 31, 2007, at 4:56 PM, Ian Hickson wrote:

> The fear is that people would do:
>
>   db.executeSql('...', [], function(...) {
>     db.executeSql('...', []); // depends on the first call
>   });
>
> ...without a transaction.


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.

? Timothy Hatcher


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20071031/bc860409/attachment.htm>
Received on Wednesday, 31 October 2007 17:13:27 UTC

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