![]() |
Bitcoin Core 32.99.0
P2P Digital Currency
|
RAII class that provides access to a WalletDatabase. More...
#include <sqlite.h>
Public Member Functions | |
| SQLiteBatch (SQLiteDatabase &database) | |
| ~SQLiteBatch () override | |
| void | SetExecHandler (std::unique_ptr< SQliteExecHandler > &&handler) |
| void | Close () override |
| std::unique_ptr< DatabaseCursor > | GetNewCursor () override |
| std::unique_ptr< DatabaseCursor > | GetNewPrefixCursor (std::span< const std::byte > prefix) override |
| bool | TxnBegin () override |
| bool | TxnCommit () override |
| bool | TxnAbort () override |
| bool | HasActiveTxn () override |
Public Member Functions inherited from wallet::DatabaseBatch | |
| DatabaseBatch ()=default | |
| virtual | ~DatabaseBatch ()=default |
| DatabaseBatch (const DatabaseBatch &)=delete | |
| DatabaseBatch & | operator= (const DatabaseBatch &)=delete |
| template<typename K , typename T > | |
| bool | Read (const K &key, T &value) |
| template<typename K , typename T > | |
| bool | Write (const K &key, const T &value, bool fOverwrite=true) |
| template<typename K > | |
| bool | Erase (const K &key) |
| template<typename K > | |
| bool | Exists (const K &key) |
Protected Member Functions | |
| bool | ReadKey (DataStream &&key, DataStream &value) override |
| bool | WriteKey (DataStream &&key, DataStream &&value, bool overwrite=true) override |
| bool | EraseKey (DataStream &&key) override |
| bool | HasKey (DataStream &&key) override |
| bool | ErasePrefix (std::span< const std::byte > prefix) override |
Private Member Functions | |
| void | SetupSQLStatements () |
| bool | ExecStatement (sqlite3_stmt *stmt, std::span< const std::byte > blob) |
Private Attributes | |
| SQLiteDatabase & | m_database |
| std::unique_ptr< SQliteExecHandler > | m_exec_handler {std::make_unique<SQliteExecHandler>()} |
| sqlite3_stmt * | m_read_stmt {nullptr} |
| sqlite3_stmt * | m_insert_stmt {nullptr} |
| sqlite3_stmt * | m_overwrite_stmt {nullptr} |
| sqlite3_stmt * | m_delete_stmt {nullptr} |
| sqlite3_stmt * | m_delete_prefix_stmt {nullptr} |
| bool | m_txn {false} |
| Whether this batch has started a database transaction and whether it owns SQLiteDatabase::m_write_semaphore. | |
RAII class that provides access to a WalletDatabase.
|
explicit |
|
inlineoverride |
|
overridevirtual |
Implements wallet::DatabaseBatch.
Definition at line 418 of file sqlite.cpp.
|
overrideprotectedvirtual |
Implements wallet::DatabaseBatch.
Definition at line 553 of file sqlite.cpp.
|
overrideprotectedvirtual |
Implements wallet::DatabaseBatch.
Definition at line 558 of file sqlite.cpp.
|
private |
Definition at line 529 of file sqlite.cpp.
|
overridevirtual |
Implements wallet::DatabaseBatch.
Definition at line 607 of file sqlite.cpp.
|
overridevirtual |
Implements wallet::DatabaseBatch.
Definition at line 622 of file sqlite.cpp.
|
inlineoverridevirtual |
Implements wallet::DatabaseBatch.
|
overrideprotectedvirtual |
Implements wallet::DatabaseBatch.
Definition at line 563 of file sqlite.cpp.
|
overrideprotectedvirtual |
Implements wallet::DatabaseBatch.
Definition at line 470 of file sqlite.cpp.
|
inline |
|
private |
Definition at line 150 of file sqlite.cpp.
|
overridevirtual |
Implements wallet::DatabaseBatch.
Definition at line 693 of file sqlite.cpp.
|
overridevirtual |
Implements wallet::DatabaseBatch.
Definition at line 664 of file sqlite.cpp.
|
overridevirtual |
Implements wallet::DatabaseBatch.
Definition at line 679 of file sqlite.cpp.
|
overrideprotectedvirtual |
Implements wallet::DatabaseBatch.
Definition at line 496 of file sqlite.cpp.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Whether this batch has started a database transaction and whether it owns SQLiteDatabase::m_write_semaphore.
If the batch starts a db tx, it acquires the semaphore and sets this to true, keeping the semaphore until the transaction ends to prevent other batch objects from writing to the database.
If this batch did not start a transaction, the semaphore is acquired transiently when writing and m_txn is not set.
m_txn is different from HasActiveTxn() as it is only true when this batch has started the transaction, not just when any batch has started a transaction.