Last Comment Bug 692630 - IndexedDB: multiEntry indexes
: IndexedDB: multiEntry indexes
Status: RESOLVED FIXED
: dev-doc-complete
Product: Core
Classification: Components
Component: DOM: IndexedDB (show other bugs)
: unspecified
: x86 Mac OS X
: -- normal (vote)
: ---
Assigned To: Jonas Sicking (:sicking) PTO Until July 5th
:
Mentors:
Depends on:
Blocks: idb
  Show dependency treegraph
 
Reported: 2011-10-06 15:44 PDT by Jonas Sicking (:sicking) PTO Until July 5th
Modified: 2015-12-01 01:33 PST (History)
8 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Patch to fix (47.26 KB, patch)
2011-11-30 13:59 PST, Jonas Sicking (:sicking) PTO Until July 5th
bent.mozilla: review+
Details | Diff | Splinter Review

Description Jonas Sicking (:sicking) PTO Until July 5th 2011-10-06 15:44:47 PDT
Search spec for "multientry"
Comment 1 Kyle Huey [:khuey] (khuey@mozilla.com) 2011-11-23 06:25:10 PST
Jonas says he's going to do this.
Comment 2 Jonas Sicking (:sicking) PTO Until July 5th 2011-11-30 13:59:33 PST
Created attachment 578075 [details] [diff] [review]
Patch to fix
Comment 3 Ben Turner (not reading bugmail, use the needinfo flag!) 2011-11-30 22:14:19 PST
Comment on attachment 578075 [details] [diff] [review]
Patch to fix

Review of attachment 578075 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/base/nsDOMClassInfo.cpp
@@ +1892,5 @@
>    SET_JSID_TO_STRING(sURL_id,             cx, "URL");
>    SET_JSID_TO_STRING(sKeyPath_id,         cx, "keyPath");
>    SET_JSID_TO_STRING(sAutoIncrement_id,   cx, "autoIncrement");
>    SET_JSID_TO_STRING(sUnique_id,          cx, "unique");
> +  SET_JSID_TO_STRING(sMultientry_id,       cx,"multientry");

Nit, indent is off

::: dom/indexedDB/DatabaseInfo.h
@@ +151,5 @@
>    ~IndexUpdateInfo();
>  #endif
>  
> +  PRInt64 index_id;
> +  bool index_unique;

Nit: underscores are for sql, lose them and go for interCaps here.

::: dom/indexedDB/IDBObjectStore.cpp
@@ +584,5 @@
>  
>    return true;
>  }
>  
> +/* static */

Nit: //

@@ +655,5 @@
> +
> +  for (PRUint32 indexesIndex = 0; indexesIndex < count; indexesIndex++) {
> +    const IndexInfo& indexInfo = aObjectStoreInfo->indexes[indexesIndex];
> +
> +    nsresult rv = AddIndexUpdateInfo(indexInfo.id,

Nit: "AppendIndexUpdateInfo"

@@ +661,5 @@
> +                                     indexInfo.unique,
> +                                     indexInfo.multientry,
> +                                     aCx,
> +                                     aObject,
> +                                     aUpdateInfoArray);

Nit: see if you can fit more than one arg on a line :)

@@ +774,5 @@
>      rv = updateInfo.value.BindToStatement(stmt, value);
>      NS_ENSURE_SUCCESS(rv, rv);
>  
>      rv = stmt->Execute();
> +    if (rv == NS_ERROR_STORAGE_CONSTRAINT && updateInfo.index_unique &&

Let's not do another db query here, just walk backwards in aUpdateInfoArray to see if it's in the list for the same index id.

@@ +2314,1 @@
>      NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);

Blegh. Just do NS_ENSURE_SUCCESS followed by |if (!hasResult)|.

@@ +2357,3 @@
>      Key key;
> +    if (!mIndex->IsAutoIncrement()) {
> +      NS_NAMED_LITERAL_CSTRING(objectDataKey, "object_data_key");

Why is this here?

@@ +2370,5 @@
> +                                       key,
> +                                       mIndex->IsAutoIncrement(),
> +                                       false,
> +                                       objectDataID,
> +                                       updateInfo);

Nit: More than one arg on a line!

::: dom/indexedDB/IDBTransaction.cpp
@@ +425,5 @@
>    );
>  }
>  
>  already_AddRefed<mozIStorageStatement>
> +IDBTransaction::UniqueDataObjectKey(bool aAutoIncrement)

I think you can get rid of this now.
Comment 4 Ed Morley [:emorley] 2011-12-03 04:23:07 PST
This landed on inbound:
https://hg.mozilla.org/integration/mozilla-inbound/rev/513428a93700

But was backed out again:
https://hg.mozilla.org/integration/mozilla-inbound/rev/8a2106940402
Comment 5 Matt Brubeck (:mbrubeck) 2011-12-05 10:12:42 PST
https://hg.mozilla.org/mozilla-central/rev/0de28e40259f
Comment 6 Chris Mills (Mozilla, MDN editor) [:cmills] 2015-12-01 01:33:29 PST
multiEntry already documented at

https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/createIndex#Parameters

Added a note to

https://developer.mozilla.org/en-US/Firefox/Releases/11#IndexedDB

Note You need to log in before you can comment on or make changes to this bug.