[Bug 9793] New: Allow dates and floating point numbers in keys

http://www.w3.org/Bugs/Public/show_bug.cgi?id=9793

           Summary: Allow dates and floating point numbers in keys
           Product: WebAppsWG
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Indexed Database API
        AssignedTo: nikunj.mehta@oracle.com
        ReportedBy: pablo.castro@microsoft.com
         QAContact: member-webapi-cvs@w3.org
                CC: mike@w3.org, public-webapps@w3.org


Currently the spec requires the values referenced by the key path to be
integers or strings. I strongly believe that we should also allow dates and
floating point numbers (am I missing any other important types?). While dates
and floating point numbers alone are not good for a primary key, they are
important for non-unique indexes and as part of a composite key, allowing for
things such as scanning in temporal order.

This is the change I'd like to propose:

Section "3.1.1 Keys" of the currently published draft reads:

-------------------------------------
In order to efficiently retrieve records stored in an indexed database, a user
agent needs to organize each record by its key. Conforming user agents must
support the use of values of IDL data types [WEBIDL] DOMString and long as well
as the value null as keys.

For purposes of comparison, a DOMString key is always evaluated higher than any
long key. Moreover, null always evaluates lower than any DOMString or long key.
-------------------------------------

New proposed text:

-------------------------------------
In order to efficiently retrieve records stored in an indexed database, a user
agent needs to organize each record by its key. Conforming user agents must
support the use of values of IDL data types [WEBIDL] DOMString, long, float,
and the Date JavaScript object, as well as the value null as keys.

For purposes of comparison, all DOMString values are evaluated as greater than
long, float, and Date values; Date values are evaluated as greater than long
and float values; and long and float values are evaluated by their numeric
value with no need to separate them by type. Moreover, null always evaluates
less than any other key value that is a non-null value. For the particular case
of floating point numbers, the value NaN is not allowed.
-------------------------------------

I realize that it's weird to have Date as a JavaScript object and the rest as
Web IDL types, but there doesn't seem to be any reference to Date() in Web IDL,
and I don't want to leave it out just because it's not there.

Last time we discussed this topic Nikunj wasn't sure if this was the right
time, but there was support [1] [2] and no pushback. Assuming we're still
there, then Eliot (who'll start helping Nikunj with editing) can incorporate it
into the spec.

[1] http://lists.w3.org/Archives/Public/public-webapps/2010JanMar/0353.html
[2] http://lists.w3.org/Archives/Public/public-webapps/2010JanMar/0664.html

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

Received on Friday, 21 May 2010 22:42:48 UTC