[whatwg] executeSql API is synchronous

Ian Hickson ian at hixie.ch
Mon Sep 24 21:22:20 PDT 2007


On Sun, 23 Sep 2007, Aaron Boodman wrote:
> 
> db.executeSQL("select * from person where id = ?", [42], function(result) {
>   // result is an array of objects
> });
> 
> Another issue that this design addresses is that it avoid blocking the
> UI for IO while iterating the results (all the results can be iterated
> on a different thread).

This is basically what the spec does now. There is some debate about 
whether the results should actually be an Array or not though, to allow 
for a lazy caching implementation if desired.


> The downside is that for some difficult types of queries that involve 
> application-level filtering, this can be wasteful. That is why you might 
> want a lower-level iteration API as well. One way that you could get 
> this while at the same time avoiding blocking the UI thread while 
> stepping through the results is to have a callback for every row like 
> David suggested.

This might be something to look at for a v2, certainly. I'd rather we keep 
the API as simple as possible at first, though.

-- 
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