IndexedDBBackendTransaction Class

A transaction of an IndexedDBBackend: the reads see the writes of the transaction, the writes are applied by IndexedDBBackendTransaction.Commit, and IndexedDBBackendTransaction.Abort reverts all the changes (including the changes of the schema, the version and the key generators). The library calls exactly one of them, then IDisposable.Dispose.

public abstract class IndexedDBBackendTransaction : IDisposable

Remarks

The key ranges and the order are the byte order of the encoded keys. The schema methods are only called in a IdbTransactionMode.VersionChange transaction, and the write methods in a IdbTransactionMode.ReadWrite or IdbTransactionMode.VersionChange transaction.

The library computes the keys of the indexes (including the multiEntry indexes) and checks the uniqueness constraints: an index record is a key of the index and the primary key of a record of its object store, and the index records are ordered by key, then by primary key. The records of an index are removed with the record of the object store.

Implements

Constructors

NameDescription
IndexedDBBackendTransaction()

IndexedDBBackendTransaction()

protected IndexedDBBackendTransaction()

No documentation is available.

Methods

NameDescription
Abort()Reverts the changes of the transaction.
ClearObjectStore(long)Deletes all the records of an object store, and their index records.
Commit()Applies the changes of the transaction. An exception aborts the transaction (the changes must then be reverted).
CountIndexRecords(long, IndexedDBKeyRange)Returns the number of records of an index whose key is in a key range.
CountRecords(long, IndexedDBKeyRange)Returns the number of records of an object store in a key range.
CreateIndex(long, IndexedDBIndexSchema)Creates an empty index of an object store (a version change transaction). The library then adds its records with IndexedDBBackendTransaction.PutIndexRecords.
CreateObjectStore(IndexedDBObjectStoreSchema)Creates an object store (a version change transaction). Its key generator's current number is 1.
DeleteIndex(long)Deletes an index and its records (a version change transaction).
DeleteObjectStore(long)Deletes an object store, its records and its indexes (a version change transaction).
DeleteRecords(long, IndexedDBKeyRange)Deletes the records of an object store in a key range, and their index records.
Dispose()Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Dispose(bool)Releases the resources of the transaction.
GetIndexRecords(long, IndexedDBKeyRange, bool, IndexedDBIndexPosition?, int)Returns the records of an index whose key is in a key range, ordered by key then by primary key (or the reverse order), at most limit records. When start is given, only the records at or after this position in this order are returned: the records whose key is greater (in the reverse order, lower), or equal with a greater (lower) primary key, or equal with the same primary key when the position is inclusive.
GetKeyGeneratorCurrentNumber(long)Returns the current number of the key generator of an object store (https://w3c.github.io/IndexedDB/#key-generator-current-number).
GetRecords(long, IndexedDBKeyRange, bool, int)Returns the records of an object store in a key range, in the order of the keys (or the reverse order), at most limit records.
PutIndexRecords(long, IReadOnlyList<IndexedDBIndexRecord>)Adds records to an index (the records of a new index, computed from the existing records of its object store).
PutRecord(long, byte[], byte[], IReadOnlyList<IndexedDBIndexKey>)Stores a record in an object store: it replaces the record with the same key, if any, and its index records. The index records of the new record are indexKeys (with the key of the record as primary key).
RenameIndex(long, string)Renames an index (a version change transaction).
RenameObjectStore(long, string)Renames an object store (a version change transaction).
SetKeyGeneratorCurrentNumber(long, long)Sets the current number of the key generator of an object store.
SetVersion(long)Sets the version of the database (a version change transaction).

Abort()

Reverts the changes of the transaction.

public abstract void Abort()

ClearObjectStore(long)

Deletes all the records of an object store, and their index records.

public abstract void ClearObjectStore(long objectStoreId)

Parameters

objectStoreId long

Commit()

Applies the changes of the transaction. An exception aborts the transaction (the changes must then be reverted).

public abstract void Commit()

CountIndexRecords(long, IndexedDBKeyRange)

Returns the number of records of an index whose key is in a key range.

public abstract long CountIndexRecords(long indexId, IndexedDBKeyRange range)

Parameters

indexId long
range IndexedDBKeyRange

Returns

long

CountRecords(long, IndexedDBKeyRange)

Returns the number of records of an object store in a key range.

public abstract long CountRecords(long objectStoreId, IndexedDBKeyRange range)

Parameters

objectStoreId long
range IndexedDBKeyRange

Returns

long

CreateIndex(long, IndexedDBIndexSchema)

Creates an empty index of an object store (a version change transaction). The library then adds its records with IndexedDBBackendTransaction.PutIndexRecords.

public abstract void CreateIndex(long objectStoreId, IndexedDBIndexSchema index)

Parameters

objectStoreId long
index IndexedDBIndexSchema

CreateObjectStore(IndexedDBObjectStoreSchema)

Creates an object store (a version change transaction). Its key generator's current number is 1.

public abstract void CreateObjectStore(IndexedDBObjectStoreSchema objectStore)

Parameters

objectStore IndexedDBObjectStoreSchema

DeleteIndex(long)

Deletes an index and its records (a version change transaction).

public abstract void DeleteIndex(long indexId)

Parameters

indexId long

DeleteObjectStore(long)

Deletes an object store, its records and its indexes (a version change transaction).

public abstract void DeleteObjectStore(long objectStoreId)

Parameters

objectStoreId long

DeleteRecords(long, IndexedDBKeyRange)

Deletes the records of an object store in a key range, and their index records.

public abstract void DeleteRecords(long objectStoreId, IndexedDBKeyRange range)

Parameters

objectStoreId long
range IndexedDBKeyRange

Dispose overloads

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

Dispose(bool)

IndexedDBBackend.cs

Releases the resources of the transaction.

protected virtual void Dispose(bool disposing)
Parameters
disposing bool

GetIndexRecords(long, IndexedDBKeyRange, bool, IndexedDBIndexPosition?, int)

Returns the records of an index whose key is in a key range, ordered by key then by primary key (or the reverse order), at most limit records. When start is given, only the records at or after this position in this order are returned: the records whose key is greater (in the reverse order, lower), or equal with a greater (lower) primary key, or equal with the same primary key when the position is inclusive.

public abstract IReadOnlyList<IndexedDBIndexRecord> GetIndexRecords(long indexId, IndexedDBKeyRange range, bool reverse, IndexedDBIndexPosition? start, int limit)

GetKeyGeneratorCurrentNumber(long)

Returns the current number of the key generator of an object store (https://w3c.github.io/IndexedDB/#key-generator-current-number).

public abstract long GetKeyGeneratorCurrentNumber(long objectStoreId)

Parameters

objectStoreId long

Returns

long

GetRecords(long, IndexedDBKeyRange, bool, int)

Returns the records of an object store in a key range, in the order of the keys (or the reverse order), at most limit records.

public abstract IReadOnlyList<IndexedDBRecord> GetRecords(long objectStoreId, IndexedDBKeyRange range, bool reverse, int limit)

Parameters

objectStoreId long
range IndexedDBKeyRange
reverse bool
limit int

Returns

IReadOnlyList<IndexedDBRecord>

PutIndexRecords(long, IReadOnlyList<IndexedDBIndexRecord>)

Adds records to an index (the records of a new index, computed from the existing records of its object store).

public abstract void PutIndexRecords(long indexId, IReadOnlyList<IndexedDBIndexRecord> records)

Parameters

indexId long
records IReadOnlyList<IndexedDBIndexRecord>

PutRecord(long, byte[], byte[], IReadOnlyList<IndexedDBIndexKey>)

Stores a record in an object store: it replaces the record with the same key, if any, and its index records. The index records of the new record are indexKeys (with the key of the record as primary key).

public abstract void PutRecord(long objectStoreId, byte[] key, byte[] value, IReadOnlyList<IndexedDBIndexKey> indexKeys)

Parameters

objectStoreId long
key byte[]
value byte[]
indexKeys IReadOnlyList<IndexedDBIndexKey>

RenameIndex(long, string)

Renames an index (a version change transaction).

public abstract void RenameIndex(long indexId, string name)

Parameters

indexId long
name string

RenameObjectStore(long, string)

Renames an object store (a version change transaction).

public abstract void RenameObjectStore(long objectStoreId, string name)

Parameters

objectStoreId long
name string

SetKeyGeneratorCurrentNumber(long, long)

Sets the current number of the key generator of an object store.

public abstract void SetKeyGeneratorCurrentNumber(long objectStoreId, long value)

Parameters

objectStoreId long
value long

SetVersion(long)

Sets the version of the database (a version change transaction).

public abstract void SetVersion(long version)

Parameters

version long