The default bug view has changed. See this FAQ.

IndexedDB: multiEntry indexes

RESOLVED FIXED

Status

()

Core
DOM: IndexedDB
RESOLVED FIXED
6 years ago
a year ago

People

(Reporter: sicking, Assigned: sicking)

Tracking

({dev-doc-complete})

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

47.26 KB, patch
Ben Turner (not reading bugmail, use the needinfo flag!)
: review+
Details | Diff | Splinter Review
Search spec for "multientry"
Depends on: 692614
Jonas says he's going to do this.
Assignee: nobody → jonas
No longer depends on: 692614
Created attachment 578075 [details] [diff] [review]
Patch to fix
Attachment #578075 - Flags: review?(bent.mozilla)
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.
Attachment #578075 - Flags: review?(bent.mozilla) → review+
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
https://hg.mozilla.org/mozilla-central/rev/0de28e40259f
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla11
Summary: IndexedDB: multientry indexes → IndexedDB: multiEntry indexes
Keywords: dev-doc-needed
Component: DOM → DOM: IndexedDB
Target Milestone: mozilla11 → ---
Version: Trunk → unspecified
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
Keywords: dev-doc-needed → dev-doc-complete
You need to log in before you can comment on or make changes to this bug.