[whatwg] SQL API and changeVersion() with no callbacks
Aaron Boodman
aa at google.com
Wed Apr 9 10:22:48 PDT 2008
On Thu, Oct 25, 2007 at 4:43 PM, Brady Eidson <beidson at apple.com> wrote:
> > I added it for the same reason we have executeSql() with no callbacks. I
> > can remove it if desired. I expected it to be used in cases where you want
> > to change the version (e.g. from '' to '1.0') without changing the schema,
> > but where you simply don't really have any good thing to do if it goes
> > wrong. I can remove it if you don't think it'll be important, but then we
> > might as well remove the one with just the first callback, since I can
> > definitely see use cases for changing the version number without doing
> > anything else.
>
> For the sake of simplicity in the API, I see no reason why there couldn't
> be a single version of changeVersion() with the 2 strings and 2 callbacks.
> Then if a user truly wanted to call changeVersion() but wasn't interested in
> the results, they could just pass null for both of the callbacks. I suppose
> the same could be said about executeSql().
>
> But that might go against some DOM'ey or Javascript'ey convention that I'm
> not familiar with.
>
> I don't feel all too strongly about this.
Sorry I'm (really) late on this.
Anyway, I think these two callbacks should be optional. For several reasons:
1. It's basically the same API as transaction(), so I feel like it
should be consistent.
2. I feel like if an argument allows null, then it is logically
optional. It feels cleaner to me that it is actually optional as well.
That is, it seems arbitrary to me that sometimes in the database api
"optional" arguments can either be unspecified or null, but sometimes
they have to be specified and null.
3. It seems like a valid use case to me to not have an error handler.
This isn't in the spec, but I had assumed that unhandled database
errors would end up calling window.onerror, and then bubbling to the
console, if the UA has one. It's pretty common in JS to not handle
every single error, but instead allow unexpected errors to bubble to
window.onerror and log them there. This is what gmail does for
example. It would be unfortunate to have to have an error handle there
just to immediately rethrow so that you don't lose any information.
Brady, do any of these help convince you at all?
Sorry for resuming this old thread,
- a
More information about the whatwg
mailing list