IDB: Implement SQLite backing store 'get' support
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Jan 2014 03:52:30 +0000 (03:52 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Jan 2014 03:52:30 +0000 (03:52 +0000)
https://bugs.webkit.org/show_bug.cgi?id=127502

Reviewed by Tim Horton.

Source/WebCore:

Get a KeyRange from a KeyRangeData:
* Modules/indexeddb/IDBKeyRangeData.cpp:
(WebCore::IDBKeyRangeData::maybeCreateIDBKeyRange):
* Modules/indexeddb/IDBKeyRangeData.h:

Add collation function support to SQLiteDatabase:
* platform/sql/SQLiteDatabase.cpp:
(WebCore::destroyCollationFunction):
(WebCore::callCollationFunction):
(WebCore::SQLiteDatabase::setCollationFunction):
(WebCore::SQLiteDatabase::removeCollationFunction):
* platform/sql/SQLiteDatabase.h:

* WebCore.exp.in:

Source/WebKit2:

This makes get of a single IDBKey work, and lays the groundwork for getting an IDBKeyRange.

* DatabaseProcess/IndexedDB/UniqueIDBDatabase.cpp:
(WebKit::UniqueIDBDatabase::getRecordFromBackingStore):
* DatabaseProcess/IndexedDB/UniqueIDBDatabaseBackingStore.h:

* DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp:
(WebKit::UniqueIDBDatabaseBackingStoreSQLite::createAndPopulateInitialMetadata): Add custom collation
  to the Records table.
(WebKit::UniqueIDBDatabaseBackingStoreSQLite::getOrEstablishMetadata): Install the custom collator.
(WebKit::UniqueIDBDatabaseBackingStoreSQLite::getKeyRecordFromObjectStore):
(WebKit::UniqueIDBDatabaseBackingStoreSQLite::getKeyRangeRecordFromObjectStore):
(WebKit::UniqueIDBDatabaseBackingStoreSQLite::collate): Collation function to be filled in later.
* DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@162682 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/IDBKeyRangeData.cpp
Source/WebCore/Modules/indexeddb/IDBKeyRangeData.h
Source/WebCore/WebCore.exp.in
Source/WebCore/platform/sql/SQLiteDatabase.cpp
Source/WebCore/platform/sql/SQLiteDatabase.h
Source/WebKit2/ChangeLog
Source/WebKit2/DatabaseProcess/IndexedDB/UniqueIDBDatabase.cpp
Source/WebKit2/DatabaseProcess/IndexedDB/UniqueIDBDatabaseBackingStore.h
Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp
Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.h

index 67ea786..e0dd867 100644 (file)
@@ -1,3 +1,25 @@
+2014-01-23  Brady Eidson  <beidson@apple.com>
+
+        IDB: Implement SQLite backing store 'get' support
+        https://bugs.webkit.org/show_bug.cgi?id=127502
+
+        Reviewed by Tim Horton.
+
+        Get a KeyRange from a KeyRangeData:
+        * Modules/indexeddb/IDBKeyRangeData.cpp:
+        (WebCore::IDBKeyRangeData::maybeCreateIDBKeyRange):
+        * Modules/indexeddb/IDBKeyRangeData.h:
+
+        Add collation function support to SQLiteDatabase:
+        * platform/sql/SQLiteDatabase.cpp:
+        (WebCore::destroyCollationFunction):
+        (WebCore::callCollationFunction):
+        (WebCore::SQLiteDatabase::setCollationFunction):
+        (WebCore::SQLiteDatabase::removeCollationFunction):
+        * platform/sql/SQLiteDatabase.h:
+
+        * WebCore.exp.in:
+
 2014-01-23  Jon Honeycutt  <jhoneycutt@apple.com>
 
         Assertion failure in WebCore::PseudoElement::didRecalcStyle()
index 84a5d49..af1fb29 100644 (file)
@@ -43,6 +43,14 @@ IDBKeyRangeData IDBKeyRangeData::isolatedCopy() const
     return result;
 }
 
+PassRefPtr<IDBKeyRange> IDBKeyRangeData::maybeCreateIDBKeyRange() const
+{
+    if (isNull)
+        return nullptr;
+
+    return IDBKeyRange::create(lowerKey.maybeCreateIDBKey(), upperKey.maybeCreateIDBKey(), lowerOpen ? IDBKeyRange::LowerBoundOpen : IDBKeyRange::LowerBoundClosed, upperOpen ? IDBKeyRange::UpperBoundOpen : IDBKeyRange::UpperBoundClosed);
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(INDEXED_DATABASE)
index 6ae8f88..d35a543 100644 (file)
@@ -57,6 +57,8 @@ struct IDBKeyRangeData {
 
     IDBKeyRangeData isolatedCopy() const;
 
+    PassRefPtr<IDBKeyRange> maybeCreateIDBKeyRange() const;
+
     bool isNull;
 
     IDBKeyData lowerKey;
index cdf4818..112ed1e 100644 (file)
@@ -84,6 +84,7 @@ __ZN7WebCore10RenderView10compositorEv
 __ZN7WebCore10RenderView7hitTestERKNS_14HitTestRequestERNS_13HitTestResultE
 __ZN7WebCore15SQLiteStatement13getColumnBlobEiRi
 __ZN7WebCore15SQLiteStatement14getColumnInt64Ei
+__ZN7WebCore15SQLiteStatement21getColumnBlobAsVectorEiRN3WTF6VectorIcLm0ENS1_15CrashOnOverflowEEE
 __ZN7WebCore10ScrollView16setParentVisibleEb
 __ZN7WebCore10ScrollView17setUseFixedLayoutEb
 __ZN7WebCore10ScrollView18setFixedLayoutSizeERKNS_7IntSizeE
@@ -374,6 +375,7 @@ __ZN7WebCore14ResourceLoader32didCancelAuthenticationChallengeERKNS_23Authentica
 __ZN7WebCore14ResourceLoader6cancelEv
 __ZN7WebCore14SQLiteDatabase11tableExistsERKN3WTF6StringE
 __ZN7WebCore14SQLiteDatabase12lastErrorMsgEv
+__ZN7WebCore14SQLiteDatabase20setCollationFunctionERKN3WTF6StringENSt3__18functionIFiiPKviS8_EEE
 __ZN7WebCore14SQLiteDatabase14executeCommandERKN3WTF6StringE
 __ZN7WebCore14SQLiteDatabase4openERKN3WTF6StringEb
 __ZN7WebCore14SQLiteDatabase5closeEv
@@ -3081,6 +3083,8 @@ __ZN7WebCore26MockMediaPlayerMediaSource19registerMediaEngineEPFvPFN3WTF10PassOw
 #if ENABLE(INDEXED_DATABASE)
 __ZNK7WebCore10IDBKeyData17maybeCreateIDBKeyEv
 __ZNK7WebCore10IDBKeyPath6encodeERNS_12KeyedEncoderE
+__ZNK7WebCore11IDBKeyRange9isOnlyKeyEv
+__ZNK7WebCore15IDBKeyRangeData22maybeCreateIDBKeyRangeEv
 __ZNK7WebCore6IDBKey6encodeERNS_12KeyedEncoderE
 __ZNK7WebCore6IDBKey7isValidEv
 __ZN7WebCore10IDBKeyDataC1EPNS_6IDBKeyE
index a9c4d93..e442ad0 100644 (file)
@@ -506,4 +506,27 @@ bool SQLiteDatabase::turnOnIncrementalAutoVacuum()
     }
 }
 
+static void destroyCollationFunction(void* arg)
+{
+    auto f = static_cast<std::function<int(int, const void*, int, const void*)>*>(arg);
+    delete f;
+}
+
+static int callCollationFunction(void* arg, int aLength, const void* a, int bLength, const void* b)
+{
+    auto f = static_cast<std::function<int(int, const void*, int, const void*)>*>(arg);
+    return (*f)(aLength, a, bLength, b);
+}
+
+void SQLiteDatabase::setCollationFunction(const String& collationName, std::function<int(int, const void*, int, const void*)> collationFunction)
+{
+    auto functionObject = new std::function<int(int, const void*, int, const void*)>(collationFunction);
+    sqlite3_create_collation_v2(m_db, collationName.utf8().data(), SQLITE_UTF8, functionObject, callCollationFunction, destroyCollationFunction);
+}
+
+void SQLiteDatabase::removeCollationFunction(const String& collationName)
+{
+    sqlite3_create_collation_v2(m_db, collationName.utf8().data(), SQLITE_UTF8, nullptr, nullptr, nullptr);
+}
+
 } // namespace WebCore
index 1cdf177..60c3a69 100644 (file)
@@ -27,6 +27,7 @@
 #ifndef SQLiteDatabase_h
 #define SQLiteDatabase_h
 
+#include <functional>
 #include <wtf/Threading.h>
 #include <wtf/text/CString.h>
 #include <wtf/text/WTFString.h>
@@ -130,6 +131,9 @@ public:
     enum AutoVacuumPragma { AutoVacuumNone = 0, AutoVacuumFull = 1, AutoVacuumIncremental = 2 };
     bool turnOnIncrementalAutoVacuum();
 
+    void setCollationFunction(const String& collationName, std::function<int(int, const void*, int, const void*)>);
+    void removeCollationFunction(const String& collationName);
+
     // Set this flag to allow access from multiple threads.  Not all multi-threaded accesses are safe!
     // See http://www.sqlite.org/cvstrac/wiki?p=MultiThreading for more info.
 #ifndef NDEBUG
index 17a5814..e5bacf3 100644 (file)
@@ -1,3 +1,25 @@
+2014-01-23  Brady Eidson  <beidson@apple.com>
+
+        IDB: Implement SQLite backing store 'get' support
+        https://bugs.webkit.org/show_bug.cgi?id=127502
+
+        Reviewed by Tim Horton.
+
+        This makes get of a single IDBKey work, and lays the groundwork for getting an IDBKeyRange.
+
+        * DatabaseProcess/IndexedDB/UniqueIDBDatabase.cpp:
+        (WebKit::UniqueIDBDatabase::getRecordFromBackingStore):
+        * DatabaseProcess/IndexedDB/UniqueIDBDatabaseBackingStore.h:
+
+        * DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp:
+        (WebKit::UniqueIDBDatabaseBackingStoreSQLite::createAndPopulateInitialMetadata): Add custom collation
+          to the Records table.
+        (WebKit::UniqueIDBDatabaseBackingStoreSQLite::getOrEstablishMetadata): Install the custom collator.
+        (WebKit::UniqueIDBDatabaseBackingStoreSQLite::getKeyRecordFromObjectStore):
+        (WebKit::UniqueIDBDatabaseBackingStoreSQLite::getKeyRangeRecordFromObjectStore):
+        (WebKit::UniqueIDBDatabaseBackingStoreSQLite::collate): Collation function to be filled in later.
+        * DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.h:
+
 2014-01-23  Jon Honeycutt  <jhoneycutt@apple.com>
 
         Assertion failure in WebCore::PseudoElement::didRecalcStyle()
index 22b8e56..7da2d6d 100644 (file)
@@ -577,11 +577,45 @@ void UniqueIDBDatabase::didPutRecordInBackingStore(uint64_t requestID, const IDB
     request->completeRequest(keyData, errorCode, errorMessage);
 }
 
-void UniqueIDBDatabase::getRecordFromBackingStore(uint64_t requestID, const IDBTransactionIdentifier&, const WebCore::IDBObjectStoreMetadata&, int64_t indexID, const WebCore::IDBKeyRangeData&, WebCore::IndexedDB::CursorType)
+void UniqueIDBDatabase::getRecordFromBackingStore(uint64_t requestID, const IDBTransactionIdentifier& transaction, const WebCore::IDBObjectStoreMetadata& objectStoreMetadata, int64_t indexID, const WebCore::IDBKeyRangeData& keyRangeData, WebCore::IndexedDB::CursorType cursorType)
 {
-    // FIXME: Implement (https://bugs.webkit.org/show_bug.cgi?id=127502)
+    ASSERT(!isMainThread());
+    ASSERT(m_backingStore);
+
+    RefPtr<IDBKeyRange> keyRange = keyRangeData.maybeCreateIDBKeyRange();
+    ASSERT(keyRange);
+    if (!keyRange) {
+        postMainThreadTask(createAsyncTask(*this, &UniqueIDBDatabase::didGetRecordFromBackingStore, requestID, IDBGetResult(), IDBDatabaseException::UnknownError, ASCIILiteral("Invalid IDBKeyRange requested from backing store")));
+        return;
+    }
+
+    if (indexID == IDBIndexMetadata::InvalidId) {
+        // IDBObjectStore get record
+        RefPtr<SharedBuffer> result;
+
+        if (keyRange->isOnlyKey()) {
+            if (!m_backingStore->getKeyRecordFromObjectStore(transaction, objectStoreMetadata.id, *keyRange->lower(), result))
+                postMainThreadTask(createAsyncTask(*this, &UniqueIDBDatabase::didGetRecordFromBackingStore, requestID, IDBGetResult(), IDBDatabaseException::UnknownError, ASCIILiteral("Failed to get key record from object store in backing store")));
+            else
+                postMainThreadTask(createAsyncTask(*this, &UniqueIDBDatabase::didGetRecordFromBackingStore, requestID, IDBGetResult(result.release()), 0, String(StringImpl::empty())));
+
+            return;
+        }
+
+        RefPtr<IDBKey> resultKey;
+
+        if (!m_backingStore->getKeyRangeRecordFromObjectStore(transaction, objectStoreMetadata.id, *keyRange, result, resultKey))
+            postMainThreadTask(createAsyncTask(*this, &UniqueIDBDatabase::didGetRecordFromBackingStore, requestID, IDBGetResult(), IDBDatabaseException::UnknownError, ASCIILiteral("Failed to get key range record from object store in backing store")));
+        else
+            postMainThreadTask(createAsyncTask(*this, &UniqueIDBDatabase::didGetRecordFromBackingStore, requestID, IDBGetResult(result.release(), resultKey.release(), IDBKeyPath()), 0, String(StringImpl::empty())));
+
+        return;
+    }
+
+    // IDBIndex get record
 
-    postMainThreadTask(createAsyncTask(*this, &UniqueIDBDatabase::didGetRecordFromBackingStore, requestID, IDBGetResult(), IDBDatabaseException::UnknownError, ASCIILiteral("'get' support not yet implemented")));
+    // FIXME: Implement index gets (<rdar://problem/15779642>)
+    postMainThreadTask(createAsyncTask(*this, &UniqueIDBDatabase::didGetRecordFromBackingStore, requestID, IDBGetResult(), IDBDatabaseException::UnknownError, ASCIILiteral("'get' from indexes not supported yet")));
 }
 
 void UniqueIDBDatabase::didGetRecordFromBackingStore(uint64_t requestID, const IDBGetResult& result, uint32_t errorCode, const String& errorMessage)
index 8daed71..937978a 100644 (file)
@@ -33,6 +33,8 @@
 
 namespace WebCore {
 class IDBKey;
+class IDBKeyRange;
+class SharedBuffer;
 
 struct IDBDatabaseMetadata;
 struct IDBObjectStoreMetadata;
@@ -63,7 +65,8 @@ public:
     virtual bool putRecord(const IDBTransactionIdentifier&, int64_t objectStoreID, const WebCore::IDBKey&, const uint8_t* valueBuffer, size_t valueSize) = 0;
     virtual bool updateKeyGenerator(const IDBTransactionIdentifier&, int64_t objectStoreId, const WebCore::IDBKey&, bool checkCurrent) = 0;
 
-
+    virtual bool getKeyRecordFromObjectStore(const IDBTransactionIdentifier&, int64_t objectStoreID, const WebCore::IDBKey&, RefPtr<WebCore::SharedBuffer>& result) = 0;
+    virtual bool getKeyRangeRecordFromObjectStore(const IDBTransactionIdentifier&, int64_t objectStoreID, const WebCore::IDBKeyRange&, RefPtr<WebCore::SharedBuffer>& result, RefPtr<WebCore::IDBKey>& resultKey) = 0;
 };
 
 } // namespace WebKit
index 7a2f91a..4146d7c 100644 (file)
 #include <WebCore/FileSystem.h>
 #include <WebCore/IDBDatabaseMetadata.h>
 #include <WebCore/IDBKeyData.h>
+#include <WebCore/IDBKeyRange.h>
 #include <WebCore/SQLiteDatabase.h>
 #include <WebCore/SQLiteStatement.h>
+#include <WebCore/SharedBuffer.h>
 #include <wtf/MainThread.h>
 
 using namespace WebCore;
@@ -90,7 +92,7 @@ std::unique_ptr<WebCore::IDBDatabaseMetadata> UniqueIDBDatabaseBackingStoreSQLit
         return nullptr;
     }
 
-    if (!m_sqliteDB->executeCommand("CREATE TABLE Records (objectStoreID INTEGER NOT NULL ON CONFLICT FAIL, key BLOB NOT NULL ON CONFLICT FAIL UNIQUE ON CONFLICT REPLACE, value BLOB NOT NULL ON CONFLICT FAIL);")) {
+    if (!m_sqliteDB->executeCommand("CREATE TABLE Records (objectStoreID INTEGER NOT NULL ON CONFLICT FAIL, key BLOB COLLATE IDBKEY NOT NULL ON CONFLICT FAIL UNIQUE ON CONFLICT REPLACE, value BLOB NOT NULL ON CONFLICT FAIL);")) {
         LOG_ERROR("Could not create Records table in database (%i) - %s", m_sqliteDB->lastError(), m_sqliteDB->lastErrorMsg());
         m_sqliteDB = nullptr;
         return nullptr;
@@ -247,6 +249,11 @@ std::unique_ptr<IDBDatabaseMetadata> UniqueIDBDatabaseBackingStoreSQLite::getOrE
     if (!m_sqliteDB)
         return nullptr;
 
+    RefPtr<UniqueIDBDatabaseBackingStoreSQLite> protector(this);
+    m_sqliteDB->setCollationFunction("IDBKEY", [this](int aLength, const void* a, int bLength, const void* b) {
+        return collate(aLength, a, bLength, b);
+    });
+
     std::unique_ptr<IDBDatabaseMetadata> metadata = extractExistingMetadata();
     if (!metadata)
         metadata = createAndPopulateInitialMetadata();
@@ -476,6 +483,111 @@ bool UniqueIDBDatabaseBackingStoreSQLite::updateKeyGenerator(const IDBTransactio
     return false;
 }
 
+bool UniqueIDBDatabaseBackingStoreSQLite::getKeyRecordFromObjectStore(const IDBTransactionIdentifier& identifier, int64_t objectStoreID, const WebCore::IDBKey& key, RefPtr<WebCore::SharedBuffer>& result)
+{
+    ASSERT(!isMainThread());
+    ASSERT(m_sqliteDB);
+    ASSERT(m_sqliteDB->isOpen());
+
+    SQLiteIDBTransaction* transaction = m_transactions.get(identifier);
+    if (!transaction || !transaction->inProgress()) {
+        LOG_ERROR("Attempt to put a record into database without an established, in-progress transaction");
+        return false;
+    }
+
+    RefPtr<SharedBuffer> keyBuffer = serializeIDBKey(key);
+    if (!keyBuffer) {
+        LOG_ERROR("Unable to serialize IDBKey to be stored in the database");
+        return false;
+    }
+
+    {
+        SQLiteStatement sql(*m_sqliteDB, ASCIILiteral("SELECT value FROM Records WHERE objectStoreID = ? AND key = ?;"));
+        if (sql.prepare() != SQLResultOk
+            || sql.bindInt64(1, objectStoreID) != SQLResultOk
+            || sql.bindBlob(2, keyBuffer->data(), keyBuffer->size()) != SQLResultOk) {
+            LOG_ERROR("Could not get record from object store %lli from Records table (%i) - %s", objectStoreID, m_sqliteDB->lastError(), m_sqliteDB->lastErrorMsg());
+            return false;
+        }
+
+        int sqlResult = sql.step();
+        if (sqlResult == SQLResultOk || sqlResult == SQLResultDone) {
+            // There was no record for the key in the database.
+            return true;
+        }
+        if (sqlResult != SQLResultRow) {
+            // There was an error fetching the record from the database.
+            LOG_ERROR("Could not get record from object store %lli from Records table (%i) - %s", objectStoreID, m_sqliteDB->lastError(), m_sqliteDB->lastErrorMsg());
+            return false;
+        }
+
+        Vector<char> buffer;
+        sql.getColumnBlobAsVector(0, buffer);
+        result = SharedBuffer::create(static_cast<const char*>(buffer.data()), buffer.size());
+    }
+
+    return true;
+}
+
+bool UniqueIDBDatabaseBackingStoreSQLite::getKeyRangeRecordFromObjectStore(const IDBTransactionIdentifier& identifier, int64_t objectStoreID, const WebCore::IDBKeyRange& keyRange, RefPtr<WebCore::SharedBuffer>& result, RefPtr<WebCore::IDBKey>& resultKey)
+{
+    ASSERT(!isMainThread());
+    ASSERT(m_sqliteDB);
+    ASSERT(m_sqliteDB->isOpen());
+
+    SQLiteIDBTransaction* transaction = m_transactions.get(identifier);
+    if (!transaction || !transaction->inProgress()) {
+        LOG_ERROR("Attempt to put a record into database without an established, in-progress transaction");
+        return false;
+    }
+
+    RefPtr<SharedBuffer> lowerBuffer = serializeIDBKey(*keyRange.lower());
+    if (!lowerBuffer) {
+        LOG_ERROR("Unable to serialize IDBKey to be stored in the database");
+        return false;
+    }
+
+    RefPtr<SharedBuffer> upperBuffer = serializeIDBKey(*keyRange.upper());
+    if (!upperBuffer) {
+        LOG_ERROR("Unable to serialize IDBKey to be stored in the database");
+        return false;
+    }
+
+    {
+        SQLiteStatement sql(*m_sqliteDB, ASCIILiteral("SELECT value FROM Records WHERE objectStoreID = ? AND key >= ? AND key <= ? ORDER BY key;"));
+        if (sql.prepare() != SQLResultOk
+            || sql.bindInt64(1, objectStoreID) != SQLResultOk
+            || sql.bindBlob(2, lowerBuffer->data(), lowerBuffer->size()) != SQLResultOk
+            || sql.bindBlob(3, upperBuffer->data(), upperBuffer->size()) != SQLResultOk) {
+            LOG_ERROR("Could not get key range record from object store %lli from Records table (%i) - %s", objectStoreID, m_sqliteDB->lastError(), m_sqliteDB->lastErrorMsg());
+            return false;
+        }
+
+        int sqlResult = sql.step();
+
+        if (sqlResult == SQLResultOk || sqlResult == SQLResultDone) {
+            // There was no record for the key in the database.
+            return true;
+        }
+        if (sqlResult != SQLResultRow) {
+            // There was an error fetching the record from the database.
+            LOG_ERROR("Could not get record from object store %lli from Records table (%i) - %s", objectStoreID, m_sqliteDB->lastError(), m_sqliteDB->lastErrorMsg());
+            return false;
+        }
+
+        Vector<char> buffer;
+        sql.getColumnBlobAsVector(0, buffer);
+        result = SharedBuffer::create(static_cast<const char*>(buffer.data()), buffer.size());
+    }
+
+    return true;
+}
+
+int UniqueIDBDatabaseBackingStoreSQLite::collate(int aLength, const void* a, int bLength, const void* b)
+{
+    // FIXME: Implement
+    return 0;
+}
 
 } // namespace WebKit
 
index 64503b5..c969796 100644 (file)
@@ -69,6 +69,9 @@ public:
     virtual bool putRecord(const IDBTransactionIdentifier&, int64_t objectStoreID, const WebCore::IDBKey&, const uint8_t* valueBuffer, size_t valueSize) override;
     virtual bool updateKeyGenerator(const IDBTransactionIdentifier&, int64_t objectStoreId, const WebCore::IDBKey&, bool checkCurrent) override;
 
+    virtual bool getKeyRecordFromObjectStore(const IDBTransactionIdentifier&, int64_t objectStoreID, const WebCore::IDBKey&, RefPtr<WebCore::SharedBuffer>& result) override;
+    virtual bool getKeyRangeRecordFromObjectStore(const IDBTransactionIdentifier&, int64_t objectStoreID, const WebCore::IDBKeyRange&, RefPtr<WebCore::SharedBuffer>& result, RefPtr<WebCore::IDBKey>& resultKey) override;
+
 private:
     UniqueIDBDatabaseBackingStoreSQLite(const UniqueIDBDatabaseIdentifier&, const String& databaseDirectory);
 
@@ -76,6 +79,8 @@ private:
     std::unique_ptr<WebCore::IDBDatabaseMetadata> extractExistingMetadata();
     std::unique_ptr<WebCore::IDBDatabaseMetadata> createAndPopulateInitialMetadata();
 
+    int collate(int aLength, const void* a, int bLength, const void* b);
+
     UniqueIDBDatabaseIdentifier m_identifier;
     String m_absoluteDatabaseDirectory;