Changeset 73697 in webkit
- Timestamp:
- Dec 10, 2010 2:12:55 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r73695 r73697 1 2010-12-10 Hans Wennborg <hans@chromium.org> 2 3 Reviewed by Jeremy Orlow. 4 5 IndexedDB: Numeric keys are floats. 6 https://bugs.webkit.org/show_bug.cgi?id=50674 7 8 Update layout tests to use floating-point values for keys. 9 10 * storage/indexeddb/keyrange-expected.txt: 11 * storage/indexeddb/keyrange.html: 12 Make sure creating the keys works. 13 * storage/indexeddb/objectstore-cursor-expected.txt: 14 * storage/indexeddb/objectstore-cursor.html: 15 Make sure retrieving the keys from the DB objectstore works. 16 1 17 2010-12-10 Martin Robinson <mrobinson@igalia.com> 2 18 -
trunk/LayoutTests/storage/indexeddb/index-basics-expected.txt
r73633 r73697 46 46 store.createIndex('indexName', 'x') 47 47 store.createIndex('indexName2', 'y', false) 48 store.createIndex('zIndex', 'z', true) 48 49 PASS 'name' in indexObject is true 49 50 PASS indexObject.name is "indexName" … … 58 59 PASS 'getKey' in indexObject is true 59 60 PASS 'get' in indexObject is true 60 store.add({x: 'value', y: 'zzz' }, 'key')61 PASS 'onsuccess' in result is true 62 PASS 'onerror' in result is true 63 PASS 'readyState' in result is true 64 An event should fire shortly... 65 66 Success event fired: 67 PASS 'result' in event is true 68 PASS 'code' in event is false 69 PASS 'message' in event is false 70 PASS 'source' in event is true 71 PASS event.source != null is true 72 PASS 'onsuccess' in event.target is true 73 PASS 'onerror' in event.target is true 74 PASS 'readyState' in event.target is true 75 PASS event.target.readyState is event.target.DONE 76 77 event.source.add({x: 'value2', y: 'zzz2' }, 'key2')61 store.add({x: 'value', y: 'zzz', z: 2.72}, 'key') 62 PASS 'onsuccess' in result is true 63 PASS 'onerror' in result is true 64 PASS 'readyState' in result is true 65 An event should fire shortly... 66 67 Success event fired: 68 PASS 'result' in event is true 69 PASS 'code' in event is false 70 PASS 'message' in event is false 71 PASS 'source' in event is true 72 PASS event.source != null is true 73 PASS 'onsuccess' in event.target is true 74 PASS 'onerror' in event.target is true 75 PASS 'readyState' in event.target is true 76 PASS event.target.readyState is event.target.DONE 77 78 event.source.add({x: 'value2', y: 'zzz2', z: 2.71}, 'key2') 78 79 PASS 'onsuccess' in result is true 79 80 PASS 'onerror' in result is true … … 128 129 129 130 PASS event.result is "key" 131 indexObject3.get(2.71) 132 PASS 'onsuccess' in result is true 133 PASS 'onerror' in result is true 134 PASS 'readyState' in result is true 135 An event should fire shortly... 136 137 Success event fired: 138 PASS 'result' in event is true 139 PASS 'code' in event is false 140 PASS 'message' in event is false 141 PASS 'source' in event is true 142 PASS event.source != null is true 143 PASS 'onsuccess' in event.target is true 144 PASS 'onerror' in event.target is true 145 PASS 'readyState' in event.target is true 146 PASS event.target.readyState is event.target.DONE 147 148 PASS event.result.x is "value2" 130 149 indexObject.get('value') 131 150 PASS 'onsuccess' in result is true -
trunk/LayoutTests/storage/indexeddb/index-basics.html
r73633 r73697 50 50 window.indexObject = evalAndLog("store.createIndex('indexName', 'x')"); 51 51 window.indexObject2 = evalAndLog("store.createIndex('indexName2', 'y', false)"); 52 window.indexObject3 = evalAndLog("store.createIndex('zIndex', 'z', true)"); 52 53 addData(); 53 54 } … … 68 69 shouldBeTrue("'get' in indexObject"); 69 70 70 result = evalAndLog("store.add({x: 'value', y: 'zzz' }, 'key')");71 result = evalAndLog("store.add({x: 'value', y: 'zzz', z: 2.72}, 'key')"); 71 72 verifyResult(result); 72 73 result.onsuccess = addMore; … … 78 79 verifySuccessEvent(event); 79 80 80 result = evalAndLog("event.source.add({x: 'value2', y: 'zzz2' }, 'key2')");81 result = evalAndLog("event.source.add({x: 'value2', y: 'zzz2', z: 2.71}, 'key2')"); 81 82 verifyResult(result); 82 83 result.onsuccess = getData; … … 109 110 verifySuccessEvent(event); 110 111 shouldBeEqualToString("event.result", "key"); 112 113 result = evalAndLog("indexObject3.get(2.71)"); 114 verifyResult(result); 115 result.onsuccess = getObjectData3; 116 result.onerror = unexpectedErrorCallback; 117 } 118 119 function getObjectData3() 120 { 121 verifySuccessEvent(event); 122 shouldBeEqualToString("event.result.x", "value2"); 111 123 112 124 result = evalAndLog("indexObject.get('value')"); -
trunk/LayoutTests/storage/indexeddb/index-cursor.html
r73633 r73697 19 19 1, 20 20 1, 21 2,22 2,21 3.14159, 22 3.14159, 23 23 10, 24 24 // FIXME: Dates. -
trunk/LayoutTests/storage/indexeddb/keyrange-expected.txt
r73633 r73697 28 28 PASS keyRange.lowerOpen is false 29 29 PASS keyRange.upperOpen is false 30 webkitIDBKeyRange.only(3.14) 31 PASS keyRange.lower is 3.14 32 PASS keyRange.upper is 3.14 33 PASS keyRange.lowerOpen is false 34 PASS keyRange.upperOpen is false 30 35 webkitIDBKeyRange.only('a') 31 36 PASS keyRange.lower is 'a' … … 48 53 PASS keyRange.upper is null 49 54 PASS keyRange.upperOpen is false 55 webkitIDBKeyRange.lowerBound(10.1,true) 56 PASS keyRange.lower is 10.1 57 PASS keyRange.lowerOpen is true 58 PASS keyRange.upper is null 59 PASS keyRange.upperOpen is false 60 webkitIDBKeyRange.lowerBound(11.2,false) 61 PASS keyRange.lower is 11.2 62 PASS keyRange.lowerOpen is false 63 PASS keyRange.upper is null 64 PASS keyRange.upperOpen is false 65 webkitIDBKeyRange.lowerBound(12.3,undefined) 66 PASS keyRange.lower is 12.3 67 PASS keyRange.lowerOpen is false 68 PASS keyRange.upper is null 69 PASS keyRange.upperOpen is false 50 70 webkitIDBKeyRange.lowerBound('aa',true) 51 71 PASS keyRange.lower is 'aa' … … 75 95 webkitIDBKeyRange.upperBound(22,undefined) 76 96 PASS keyRange.upper is 22 97 PASS keyRange.upperOpen is false 98 PASS keyRange.lower is null 99 PASS keyRange.lowerOpen is false 100 webkitIDBKeyRange.upperBound(20.2,true) 101 PASS keyRange.upper is 20.2 102 PASS keyRange.upperOpen is true 103 PASS keyRange.lower is null 104 PASS keyRange.lowerOpen is false 105 webkitIDBKeyRange.upperBound(21.3,false) 106 PASS keyRange.upper is 21.3 107 PASS keyRange.upperOpen is false 108 PASS keyRange.lower is null 109 PASS keyRange.lowerOpen is false 110 webkitIDBKeyRange.upperBound(22.4,undefined) 111 PASS keyRange.upper is 22.4 77 112 PASS keyRange.upperOpen is false 78 113 PASS keyRange.lower is null … … 118 153 PASS keyRange.lowerOpen is true 119 154 PASS keyRange.upperOpen is true 155 webkitIDBKeyRange.bound(30.1,40.2, {lowerOpen: undefined, upperOpen:undefined}) 156 PASS keyRange.lower is 30.1 157 PASS keyRange.upper is 40.2 158 PASS keyRange.lowerOpen is false 159 PASS keyRange.upperOpen is false 160 webkitIDBKeyRange.bound(31.3,41.4, {lowerOpen: false, upperOpen:false}) 161 PASS keyRange.lower is 31.3 162 PASS keyRange.upper is 41.4 163 PASS keyRange.lowerOpen is false 164 PASS keyRange.upperOpen is false 165 webkitIDBKeyRange.bound(32.5,42.6, {lowerOpen: false, upperOpen:true}) 166 PASS keyRange.lower is 32.5 167 PASS keyRange.upper is 42.6 168 PASS keyRange.lowerOpen is false 169 PASS keyRange.upperOpen is true 170 webkitIDBKeyRange.bound(33.7,43.8, {lowerOpen: true, upperOpen:false}) 171 PASS keyRange.lower is 33.7 172 PASS keyRange.upper is 43.8 173 PASS keyRange.lowerOpen is true 174 PASS keyRange.upperOpen is false 175 webkitIDBKeyRange.bound(34.9,44, {lowerOpen: true, upperOpen:true}) 176 PASS keyRange.lower is 34.9 177 PASS keyRange.upper is 44 178 PASS keyRange.lowerOpen is true 179 PASS keyRange.upperOpen is true 120 180 webkitIDBKeyRange.bound('aaa','aba', {lowerOpen: false, upperOpen:false}) 121 181 PASS keyRange.lower is 'aaa' -
trunk/LayoutTests/storage/indexeddb/keyrange.html
r73633 r73697 85 85 86 86 checkSingleKeyRange(1); 87 checkSingleKeyRange(3.14); 87 88 checkSingleKeyRange("'a'"); 88 89 … … 90 91 checkLowerBoundKeyRange(11, false); 91 92 checkLowerBoundKeyRange(12); 93 checkLowerBoundKeyRange(10.1, true); 94 checkLowerBoundKeyRange(11.2, false); 95 checkLowerBoundKeyRange(12.3); 92 96 checkLowerBoundKeyRange("'aa'", true); 93 97 checkLowerBoundKeyRange("'ab'", false); … … 97 101 checkUpperBoundKeyRange(21, false); 98 102 checkUpperBoundKeyRange(22); 103 checkUpperBoundKeyRange(20.2, true); 104 checkUpperBoundKeyRange(21.3, false); 105 checkUpperBoundKeyRange(22.4); 99 106 checkUpperBoundKeyRange("'ba'", true); 100 107 checkUpperBoundKeyRange("'bb'", false); … … 106 113 checkBoundKeyRange(33, 43, true, false); 107 114 checkBoundKeyRange(34, 44, true, true); 115 116 checkBoundKeyRange(30.1, 40.2); 117 checkBoundKeyRange(31.3, 41.4, false, false); 118 checkBoundKeyRange(32.5, 42.6, false, true); 119 checkBoundKeyRange(33.7, 43.8, true, false); 120 checkBoundKeyRange(34.9, 44.0, true, true); 108 121 109 122 checkBoundKeyRange("'aaa'", "'aba'", false, false); -
trunk/LayoutTests/storage/indexeddb/objectstore-cursor.html
r73633 r73697 17 17 // In order of how it should be sorted by IndexedDB. 18 18 window.testData = [ 19 1, 20 2, 19 2.718281828459, 21 20 3, 21 3.14159265, 22 22 10, 23 23 // FIXME: Dates. -
trunk/WebCore/ChangeLog
r73695 r73697 1 2010-12-10 Hans Wennborg <hans@chromium.org> 2 3 Reviewed by Jeremy Orlow. 4 5 IndexedDB: Numeric keys are floats. 6 https://bugs.webkit.org/show_bug.cgi?id=50674 7 8 Use floating point to represent numeric keys, 9 add version meta data to the SQLite db, 10 and migrate object stores that use integers. 11 12 * bindings/v8/IDBBindingUtilities.cpp: 13 (WebCore::createIDBKeyFromValue): 14 * bindings/v8/custom/V8IDBKeyCustom.cpp: 15 (WebCore::toV8): 16 * storage/IDBFactoryBackendImpl.cpp: 17 (WebCore::createTables): 18 (WebCore::migrateDatabase): 19 (WebCore::IDBFactoryBackendImpl::open): 20 * storage/IDBKey.cpp: 21 (WebCore::IDBKey::IDBKey): 22 (WebCore::IDBKey::fromQuery): 23 (WebCore::IDBKey::bind): 24 (WebCore::IDBKey::bindWithNulls): 25 * storage/IDBKey.h: 26 (WebCore::IDBKey::create): 27 (WebCore::IDBKey::number): 28 1 29 2010-12-10 Martin Robinson <mrobinson@igalia.com> 2 30 … … 827 855 * svg/SVGUseElement.cpp: 828 856 (WebCore::ShadowTreeUpdateBlocker::while): Ditto. 829 830 2010-12-09 Hans Wennborg <hans@chromium.org>831 832 Reviewed by Jeremy Orlow.833 834 IndexedDB: Numeric keys are floats.835 https://bugs.webkit.org/show_bug.cgi?id=50674836 837 Use floating point to represent numeric keys,838 add version meta data to the SQLite db,839 and migrate object stores that use integers.840 841 * bindings/v8/IDBBindingUtilities.cpp:842 (WebCore::createIDBKeyFromValue):843 * bindings/v8/custom/V8IDBKeyCustom.cpp:844 (WebCore::toV8):845 * storage/IDBFactoryBackendImpl.cpp:846 (WebCore::createTables):847 (WebCore::migrateDatabase):848 (WebCore::IDBFactoryBackendImpl::open):849 * storage/IDBKey.cpp:850 (WebCore::IDBKey::IDBKey):851 (WebCore::IDBKey::fromQuery):852 (WebCore::IDBKey::bind):853 (WebCore::IDBKey::bindWithNulls):854 * storage/IDBKey.h:855 (WebCore::IDBKey::create):856 (WebCore::IDBKey::number):857 857 858 858 2010-12-09 Brady Eidson <beidson@apple.com> -
trunk/WebCore/bindings/v8/IDBBindingUtilities.cpp
r73633 r73697 42 42 if (value->IsNull()) 43 43 return IDBKey::create(); 44 if (value->Is Int32())45 return IDBKey::create(value-> Int32Value());44 if (value->IsNumber()) 45 return IDBKey::create(value->NumberValue()); 46 46 if (value->IsString()) 47 47 return IDBKey::create(v8ValueToWebCoreString(value)); -
trunk/WebCore/bindings/v8/custom/V8IDBKeyCustom.cpp
r73633 r73697 46 46 return v8::Null(); 47 47 case IDBKey::NumberType: 48 return v8:: Integer::New(key->number());48 return v8::Number::New(key->number()); 49 49 case IDBKey::StringType: 50 50 return v8String(key->string()); -
trunk/WebCore/storage/IDBFactoryBackendImpl.cpp
r73633 r73697 36 36 #include "IDBSQLiteDatabase.h" 37 37 #include "IDBTransactionCoordinator.h" 38 #include "SQLiteStatement.h" 39 #include "SQLiteTransaction.h" 38 40 #include "SecurityOrigin.h" 39 41 #include <wtf/Threading.h> … … 94 96 static bool createTables(SQLiteDatabase& sqliteDatabase) 95 97 { 98 if (sqliteDatabase.tableExists("Databases")) 99 return true; 100 96 101 static const char* commands[] = { 97 "CREATE TABLE IF NOT EXISTSDatabases (id INTEGER PRIMARY KEY, name TEXT NOT NULL, description TEXT NOT NULL, version TEXT NOT NULL)",98 "CREATE UNIQUE INDEX IF NOT EXISTSDatabases_name ON Databases(name)",99 100 "CREATE TABLE IF NOT EXISTSObjectStores (id INTEGER PRIMARY KEY, name TEXT NOT NULL, keyPath TEXT, doAutoIncrement INTEGER NOT NULL, databaseId INTEGER NOT NULL REFERENCES Databases(id))",101 "CREATE UNIQUE INDEX IF NOT EXISTSObjectStores_composit ON ObjectStores(databaseId, name)",102 103 "CREATE TABLE I F NOT EXISTS Indexes (id INTEGER PRIMARY KEY, objectStoreId INTEGER NOT NULL REFERENCES ObjectStore(id), name TEXT NOT NULL, keyPath TEXT, isUnique INTEGER NOT NULL)",104 "CREATE UNIQUE INDEX I F NOT EXISTS Indexes_composit ON Indexes(objectStoreId, name)",105 106 "CREATE TABLE IF NOT EXISTSObjectStoreData (id INTEGER PRIMARY KEY, objectStoreId INTEGER NOT NULL REFERENCES ObjectStore(id), keyString TEXT, keyDate INTEGER, keyNumber INTEGER, value TEXT NOT NULL)",107 "CREATE UNIQUE INDEX IF NOT EXISTSObjectStoreData_composit ON ObjectStoreData(keyString, keyDate, keyNumber, objectStoreId)",108 109 "CREATE TABLE I F 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))",110 "CREATE INDEX I F NOT EXISTS IndexData_composit ON IndexData(keyString, keyDate, keyNumber, indexId)",111 "CREATE INDEX I F NOT EXISTS IndexData_objectStoreDataId ON IndexData(objectStoreDataId)",112 "CREATE INDEX I F NOT EXISTS IndexData_indexId ON IndexData(indexId)"102 "CREATE TABLE Databases (id INTEGER PRIMARY KEY, name TEXT NOT NULL, description TEXT NOT NULL, version TEXT NOT NULL)", 103 "CREATE UNIQUE INDEX Databases_name ON Databases(name)", 104 105 "CREATE TABLE ObjectStores (id INTEGER PRIMARY KEY, name TEXT NOT NULL, keyPath TEXT, doAutoIncrement INTEGER NOT NULL, databaseId INTEGER NOT NULL REFERENCES Databases(id))", 106 "CREATE UNIQUE INDEX ObjectStores_composit ON ObjectStores(databaseId, name)", 107 108 "CREATE TABLE Indexes (id INTEGER PRIMARY KEY, objectStoreId INTEGER NOT NULL REFERENCES ObjectStore(id), name TEXT NOT NULL, keyPath TEXT, isUnique INTEGER NOT NULL)", 109 "CREATE UNIQUE INDEX Indexes_composit ON Indexes(objectStoreId, name)", 110 111 "CREATE TABLE ObjectStoreData (id INTEGER PRIMARY KEY, objectStoreId INTEGER NOT NULL REFERENCES ObjectStore(id), keyString TEXT, keyDate INTEGER, keyNumber INTEGER, value TEXT NOT NULL)", 112 "CREATE UNIQUE INDEX ObjectStoreData_composit ON ObjectStoreData(keyString, keyDate, keyNumber, objectStoreId)", 113 114 "CREATE TABLE 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))", 115 "CREATE INDEX IndexData_composit ON IndexData(keyString, keyDate, keyNumber, indexId)", 116 "CREATE INDEX IndexData_objectStoreDataId ON IndexData(objectStoreDataId)", 117 "CREATE INDEX IndexData_indexId ON IndexData(indexId)", 113 118 }; 114 119 120 SQLiteTransaction transaction(sqliteDatabase, false); 121 transaction.begin(); 115 122 for (size_t i = 0; i < arraysize(commands); ++i) { 116 123 if (!sqliteDatabase.executeCommand(commands[i])) { … … 120 127 } 121 128 } 129 transaction.commit(); 130 return true; 131 } 132 133 static bool createMetaDataTable(SQLiteDatabase& sqliteDatabase) 134 { 135 static const char* commands[] = { 136 "CREATE TABLE MetaData (name TEXT PRIMARY KEY, value NONE)", 137 "INSERT INTO MetaData VALUES ('version', 1)", 138 }; 139 140 SQLiteTransaction transaction(sqliteDatabase, false); 141 transaction.begin(); 142 for (size_t i = 0; i < arraysize(commands); ++i) { 143 if (!sqliteDatabase.executeCommand(commands[i])) 144 return false; 145 } 146 transaction.commit(); 147 return true; 148 } 149 150 static bool getDatabaseVersion(SQLiteDatabase& sqliteDatabase, int* databaseVersion) 151 { 152 SQLiteStatement query(sqliteDatabase, "SELECT value FROM MetaData WHERE name = 'version'"); 153 if (query.prepare() != SQLResultOk || query.step() != SQLResultRow) 154 return false; 155 156 *databaseVersion = query.getColumnInt(0); 157 return query.finalize() == SQLResultOk; 158 } 159 160 static bool migrateDatabase(SQLiteDatabase& sqliteDatabase) 161 { 162 if (!sqliteDatabase.tableExists("MetaData")) { 163 if (!createMetaDataTable(sqliteDatabase)) 164 return false; 165 } 166 167 int databaseVersion; 168 if (!getDatabaseVersion(sqliteDatabase, &databaseVersion)) 169 return false; 170 171 if (databaseVersion == 1) { 172 static const char* commands[] = { 173 "DROP TABLE IF EXISTS ObjectStoreData2", 174 "CREATE TABLE ObjectStoreData2 (id INTEGER PRIMARY KEY, objectStoreId INTEGER NOT NULL REFERENCES ObjectStore(id), keyString TEXT, keyDate REAL, keyNumber REAL, value TEXT NOT NULL)", 175 "INSERT INTO ObjectStoreData2 SELECT * FROM ObjectStoreData", 176 "DROP TABLE ObjectStoreData", // This depends on SQLite not enforcing referential consistency. 177 "ALTER TABLE ObjectStoreData2 RENAME TO ObjectStoreData", 178 "CREATE UNIQUE INDEX ObjectStoreData_composit ON ObjectStoreData(keyString, keyDate, keyNumber, objectStoreId)", 179 "DROP TABLE IF EXISTS IndexData2", // This depends on SQLite not enforcing referential consistency. 180 "CREATE TABLE IndexData2 (id INTEGER PRIMARY KEY, indexId INTEGER NOT NULL REFERENCES Indexes(id), keyString TEXT, keyDate REAL, keyNumber REAL, objectStoreDataId INTEGER NOT NULL REFERENCES ObjectStoreData(id))", 181 "INSERT INTO IndexData2 SELECT * FROM IndexData", 182 "DROP TABLE IndexData", 183 "ALTER TABLE IndexData2 RENAME TO IndexData", 184 "CREATE INDEX IndexData_composit ON IndexData(keyString, keyDate, keyNumber, indexId)", 185 "CREATE INDEX IndexData_objectStoreDataId ON IndexData(objectStoreDataId)", 186 "CREATE INDEX IndexData_indexId ON IndexData(indexId)", 187 "UPDATE MetaData SET value = 2 WHERE name = 'version'", 188 }; 189 190 SQLiteTransaction transaction(sqliteDatabase, false); 191 transaction.begin(); 192 for (size_t i = 0; i < arraysize(commands); ++i) { 193 if (!sqliteDatabase.executeCommand(commands[i])) { 194 LOG_ERROR("Failed to run the following command for IndexedDB: %s", commands[i]); 195 return false; 196 } 197 } 198 transaction.commit(); 199 200 databaseVersion = 2; 201 } 202 122 203 return true; 123 204 } … … 142 223 sqliteDatabase = openSQLiteDatabase(securityOrigin.get(), dataDir, maximumSize, fileIdentifier, this); 143 224 144 if (!sqliteDatabase || !createTables(sqliteDatabase->db()) ) {225 if (!sqliteDatabase || !createTables(sqliteDatabase->db()) || !migrateDatabase(sqliteDatabase->db())) { 145 226 callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "Internal error.")); 227 m_sqliteDatabaseMap.set(fileIdentifier, 0); 146 228 return; 147 229 } … … 157 239 158 240 #endif // ENABLE(INDEXED_DATABASE) 159 -
trunk/WebCore/storage/IDBKey.cpp
r73633 r73697 39 39 } 40 40 41 IDBKey::IDBKey( int32_tnumber)41 IDBKey::IDBKey(double number) 42 42 : m_type(NumberType) 43 43 , m_number(number) … … 66 66 67 67 if (!query.isColumnNull(baseColumn + 2)) 68 return IDBKey::create(query.getColumn Int(baseColumn + 2));68 return IDBKey::create(query.getColumnDouble(baseColumn + 2)); 69 69 70 70 return IDBKey::create(); // Null. … … 148 148 return 1; 149 149 case IDBKey::NumberType: 150 query.bind Int(column, m_number);150 query.bindDouble(column, m_number); 151 151 return 1; 152 152 case IDBKey::NullType: … … 169 169 query.bindNull(baseColumn + 0); 170 170 query.bindNull(baseColumn + 1); 171 query.bind Int(baseColumn + 2, m_number);171 query.bindDouble(baseColumn + 2, m_number); 172 172 break; 173 173 case IDBKey::NullType: -
trunk/WebCore/storage/IDBKey.h
r73633 r73697 44 44 return adoptRef(new IDBKey()); 45 45 } 46 static PassRefPtr<IDBKey> create( int32_tnumber)46 static PassRefPtr<IDBKey> create(double number) 47 47 { 48 48 return adoptRef(new IDBKey(number)); … … 69 69 } 70 70 71 int32_tnumber() const71 double number() const 72 72 { 73 73 ASSERT(m_type == NumberType); … … 89 89 private: 90 90 IDBKey(); 91 explicit IDBKey( int32_t);91 explicit IDBKey(double); 92 92 explicit IDBKey(const String&); 93 93 94 94 Type m_type; 95 95 String m_string; 96 int32_tm_number;96 double m_number; 97 97 }; 98 98 -
trunk/WebKit/chromium/ChangeLog
r73633 r73697 1 2010-12-10 Hans Wennborg <hans@chromium.org> 2 3 Reviewed by Jeremy Orlow. 4 5 IndexedDB: Numeric keys are floats. 6 https://bugs.webkit.org/show_bug.cgi?id=50674 7 8 Represent numeric keys as floating point values. 9 10 * public/WebIDBKey.h: 11 (WebKit::WebIDBKey::WebIDBKey): 12 * src/WebIDBKey.cpp: 13 (WebKit::WebIDBKey::assign): 14 (WebKit::WebIDBKey::number): 15 1 16 2010-12-09 Sheriff Bot <webkit.review.bot@gmail.com> 2 17 -
trunk/WebKit/chromium/public/WebIDBKey.h
r73633 r73697 49 49 50 50 WebIDBKey(const WebString& string) { assign(string); } 51 WebIDBKey( int32_tnumber) { assign(number); }51 WebIDBKey(double number) { assign(number); } 52 52 WebIDBKey(const WebIDBKey& e) { assign(e); } 53 53 WebIDBKey& operator=(const WebIDBKey& e) … … 60 60 WEBKIT_API void assignNull(); 61 61 WEBKIT_API void assign(const WebString&); 62 WEBKIT_API void assign( int32_t);62 WEBKIT_API void assign(double); 63 63 WEBKIT_API void assignInvalid(); 64 64 WEBKIT_API void reset(); … … 74 74 WEBKIT_API Type type() const; 75 75 WEBKIT_API WebString string() const; // Only valid for StringType. 76 WEBKIT_API int32_tnumber() const; // Only valid for numberType.76 WEBKIT_API double number() const; // Only valid for numberType. 77 77 78 78 #if WEBKIT_IMPLEMENTATION -
trunk/WebKit/chromium/src/WebIDBKey.cpp
r73633 r73697 78 78 } 79 79 80 void WebIDBKey::assign( int32_tnumber)80 void WebIDBKey::assign(double number) 81 81 { 82 82 m_private = IDBKey::create(number); … … 105 105 } 106 106 107 int32_tWebIDBKey::number() const107 double WebIDBKey::number() const 108 108 { 109 109 return m_private->number();
Note: See TracChangeset
for help on using the changeset viewer.