[whatwg] Database storage API and argument type conversion

Timothy Hatcher timothy at apple.com
Thu Apr 10 09:34:27 PDT 2008


Converting an object to a string has a very defined path in  
JavaScript, toString is called. Perhaps the spec should mention  
toString.

Marking the query as bogus seems wrong, since the JavaScript language  
is very lenient about types and implicit type conversions when needed.  
Implicit conversion to strings is what any proficient JavaScript  
author would expect to happen. I don't see any reason to make the  
storage spec behave differently.

On Apr 10, 2008, at 4:32 AM, Dimitri Glazkov wrote:

> In other words, if the type of the argument is not null, string,
> double, or int, the argument is implicitly converted to to string.
>
> As an alternative, I would like to present a slightly different
> approach: if, during step 3 of the executeSql algorithm
> (http://www.whatwg.org/specs/web-apps/current-work/multipage/section-sql.html#executing 
> ),
> an argument is found to be unpalatable for the underlying database
> implementation, the statement is marked bogus.
>
> Though a bit more stringent than the implicit conversion, this
> approach explicitly prevents any subtle coercion bugs and will
> probably lead to more debuggable code.

— Timothy Hatcher


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20080410/01742837/attachment.htm>


More information about the whatwg mailing list