Changeset 70093 in webkit
- Timestamp:
- Oct 19, 2010 3:10:16 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r70087 r70093 1 2010-10-19 Jeremy Orlow <jorlow@chromium.org> 2 3 Reviewed by Nate Chapin. 4 5 Fix multiple index support in IndexedDB 6 https://bugs.webkit.org/show_bug.cgi?id=47919 7 8 Modify an existing test to verify behavior and add another test for 9 something I thought might have been related (but wasn't, but it still 10 seems like a good test). 11 12 * storage/indexeddb/index-basics-expected.txt: 13 * storage/indexeddb/index-basics.html: 14 * storage/indexeddb/queued-commands-expected.txt: Added. 15 * storage/indexeddb/queued-commands.html: Added. 16 1 17 2010-10-19 James Robinson <jamesr@chromium.org> 2 18 -
trunk/LayoutTests/storage/indexeddb/index-basics-expected.txt
r69540 r70093 45 45 db.createObjectStore('storeName', null) 46 46 store.createIndex('indexName', 'x') 47 store.createIndex('indexName2', 'y', false) 47 48 PASS 'name' in indexObject is true 48 49 PASS indexObject.name is "indexName" … … 109 110 110 111 PASS event.result is "key" 112 indexObject2.getKey('zzz') 113 PASS 'onsuccess' in result is true 114 PASS 'onerror' in result is true 115 PASS 'readyState' in result is true 116 An event should fire shortly... 117 118 Success event fired: 119 PASS 'result' in event is true 120 PASS 'code' in event is false 121 PASS 'message' in event is false 122 PASS 'source' in event is true 123 PASS event.source != null is true 124 PASS 'onsuccess' in event.target is true 125 PASS 'onerror' in event.target is true 126 PASS 'readyState' in event.target is true 127 PASS event.target.readyState is event.target.DONE 128 129 PASS event.result is "key" 111 130 indexObject.get('value') 112 131 PASS 'onsuccess' in result is true -
trunk/LayoutTests/storage/indexeddb/index-basics.html
r69540 r70093 49 49 window.store = evalAndLog("db.createObjectStore('storeName', null)"); 50 50 window.indexObject = evalAndLog("store.createIndex('indexName', 'x')"); 51 window.indexObject2 = evalAndLog("store.createIndex('indexName2', 'y', false)"); 51 52 addData(); 52 53 } … … 98 99 shouldBeEqualToString("event.result", "key"); 99 100 101 result = evalAndLog("indexObject2.getKey('zzz')"); 102 verifyResult(result); 103 result.onsuccess = getObjectData2; 104 result.onerror = unexpectedErrorCallback; 105 } 106 107 function getObjectData2() 108 { 109 verifySuccessEvent(event); 110 shouldBeEqualToString("event.result", "key"); 111 100 112 result = evalAndLog("indexObject.get('value')"); 101 113 verifyResult(result); -
trunk/WebCore/ChangeLog
r70089 r70093 1 2010-10-19 Jeremy Orlow <jorlow@chromium.org> 2 3 Reviewed by Nate Chapin. 4 5 Fix multiple index support in IndexedDB 6 https://bugs.webkit.org/show_bug.cgi?id=47919 7 8 Fix 2 bugs that caused the IndexData of all but the last index to be 9 properly updated: 10 * The objectStoreDataId is NOT unique if there are multiple indexes. So 11 remove the constraint. 12 * Do not delete all existing entries with that objectStoreDataId before 13 adding an entry for each index. Only do it once at the beginning. 14 15 Test: storage/indexeddb/queued-commands.html 16 + index-basics.html modified 17 18 * storage/IDBFactoryBackendImpl.cpp: 19 (WebCore::createTables): 20 * storage/IDBObjectStoreBackendImpl.cpp: 21 (WebCore::deleteIndexData): 22 (WebCore::putIndexData): 23 (WebCore::IDBObjectStoreBackendImpl::putInternal): 24 1 25 2010-10-19 Martin Robinson <mrobinson@igalia.com> 2 26 -
trunk/WebCore/storage/IDBFactoryBackendImpl.cpp
r69421 r70093 100 100 101 101 "DROP TABLE IF EXISTS IndexData", 102 "CREATE TABLE IF NOT EXISTS IndexData (id INTEGER PRIMARY KEY, indexId INTEGER NOT NULL REFERENCES Indexes(id), keyString TEXT, keyDate INTEGER, keyNumber INTEGER, objectStoreDataId INTEGER NOT NULL UNIQUEREFERENCES ObjectStoreData(id))",102 "CREATE TABLE IF NOT EXISTS IndexData (id INTEGER PRIMARY KEY, indexId INTEGER NOT NULL REFERENCES Indexes(id), keyString TEXT, keyDate INTEGER, keyNumber INTEGER, objectStoreDataId INTEGER NOT NULL REFERENCES ObjectStoreData(id))", 103 103 "DROP INDEX IF EXISTS IndexData_composit", 104 104 "CREATE INDEX IF NOT EXISTS IndexData_composit ON IndexData(keyString, keyDate, keyNumber, indexId)", -
trunk/WebCore/storage/IDBObjectStoreBackendImpl.cpp
r69721 r70093 155 155 } 156 156 157 static int putIndexData(SQLiteDatabase& db, IDBKey* key, int64_t indexId, int64_t objectStoreDataId)157 static bool deleteIndexData(SQLiteDatabase& db, int64_t objectStoreDataId) 158 158 { 159 159 SQLiteStatement deleteQuery(db, "DELETE FROM IndexData WHERE objectStoreDataId = ?"); … … 161 161 return false; 162 162 deleteQuery.bindInt64(1, objectStoreDataId); 163 if (deleteQuery.step() != SQLResultDone) 164 return false; 165 163 164 return deleteQuery.step() == SQLResultDone; 165 } 166 167 static bool putIndexData(SQLiteDatabase& db, IDBKey* key, int64_t indexId, int64_t objectStoreDataId) 168 { 166 169 SQLiteStatement putQuery(db, "INSERT INTO IndexData (keyString, keyDate, keyNumber, indexId, objectStoreDataId) VALUES (?, ?, ?, ?, ?)"); 167 170 if (putQuery.prepare() != SQLResultOk) … … 191 194 RefPtr<SerializedScriptValue> value = prpValue; 192 195 RefPtr<IDBKey> key = prpKey; 196 197 // FIXME: Support auto-increment. 193 198 194 199 if (!objectStore->m_keyPath.isNull()) { … … 242 247 } 243 248 249 if (!deleteIndexData(objectStore->sqliteDatabase(), dataRowId)) { 250 // FIXME: The Indexed Database specification does not have an error code dedicated to I/O errors. 251 callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "Error writing data to stable storage.")); 252 transaction->abort(); 253 return; 254 } 255 244 256 int i = 0; 245 257 for (IndexMap::iterator it = objectStore->m_indexes.begin(); it != objectStore->m_indexes.end(); ++it, ++i) {
Note: See TracChangeset
for help on using the changeset viewer.