Example #1
0
IDBError MemoryIDBBackingStore::getCount(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const IDBKeyRangeData& range, uint64_t& outCount)
{
    LOG(IndexedDB, "MemoryIDBBackingStore::getCount");

    ASSERT(objectStoreIdentifier);

    if (!m_transactions.contains(transactionIdentifier))
        return { IDBDatabaseException::UnknownError, ASCIILiteral("No backing store transaction found to get count") };

    MemoryObjectStore* objectStore = m_objectStoresByIdentifier.get(objectStoreIdentifier);
    if (!objectStore)
        return { IDBDatabaseException::UnknownError, ASCIILiteral("No backing store object store found") };

    outCount = objectStore->countForKeyRange(indexIdentifier, range);

    return { };
}