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 : IDisposableRemarks
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
| Name | Description |
|---|---|
| IndexedDBBackendTransaction() |
IndexedDBBackendTransaction()
protected IndexedDBBackendTransaction()No documentation is available.
Methods
| Name | Description |
|---|---|
| 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)
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)CountRecords(long, IndexedDBKeyRange)
Returns the number of records of an object store in a key range.
public abstract long CountRecords(long objectStoreId, IndexedDBKeyRange 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.
public abstract void CreateIndex(long objectStoreId, IndexedDBIndexSchema index)Parameters
objectStoreIdlongindexIndexedDBIndexSchema
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
objectStoreIndexedDBObjectStoreSchema
DeleteIndex(long)
DeleteObjectStore(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
objectStoreIdlongrangeIndexedDBKeyRange
Dispose overloads
Dispose()
IndexedDBBackend.csPerforms application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()Dispose(bool)
IndexedDBBackend.csGetIndexRecords(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)Parameters
indexIdlongrangeIndexedDBKeyRangereverseboolstartIndexedDBIndexPosition?limitint
Returns
GetKeyGeneratorCurrentNumber(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)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
indexIdlongrecordsIReadOnlyList<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
objectStoreIdlongkeybyte[]valuebyte[]indexKeysIReadOnlyList<IndexedDBIndexKey>