[whatwg] SQL API complex for simple cases

Timothy Hatcher timothy at apple.com
Wed Oct 31 17:13:27 PDT 2007


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-0001.htm>


More information about the whatwg mailing list