[whatwg] SQL API complex for simple cases

Ian Hickson ian at hixie.ch
Wed Oct 31 17:21:55 PDT 2007


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.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list