Bitcoin ABC 0.30.3
P2P Digital Currency
Public Member Functions | Private Member Functions | Private Attributes | List of all members
SQLiteBatch Class Reference

RAII class that provides access to a WalletDatabase. More...

#include <sqlite.h>

Inheritance diagram for SQLiteBatch:
[legend]
Collaboration diagram for SQLiteBatch:
[legend]

Public Member Functions

 SQLiteBatch (SQLiteDatabase &database)
 
 ~SQLiteBatch () override
 
void Flush () override
 No-op. More...
 
void Close () override
 
bool StartCursor () override
 
bool ReadAtCursor (CDataStream &key, CDataStream &value, bool &complete) override
 
void CloseCursor () override
 
bool TxnBegin () override
 
bool TxnCommit () override
 
bool TxnAbort () override
 
- Public Member Functions inherited from DatabaseBatch
 DatabaseBatch ()
 
virtual ~DatabaseBatch ()
 
 DatabaseBatch (const DatabaseBatch &)=delete
 
DatabaseBatchoperator= (const DatabaseBatch &)=delete
 
virtual void Flush ()=0
 
virtual void Close ()=0
 
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)
 
virtual bool StartCursor ()=0
 
virtual bool ReadAtCursor (CDataStream &ssKey, CDataStream &ssValue, bool &complete)=0
 
virtual void CloseCursor ()=0
 
virtual bool TxnBegin ()=0
 
virtual bool TxnCommit ()=0
 
virtual bool TxnAbort ()=0
 

Private Member Functions

void SetupSQLStatements ()
 
bool ReadKey (CDataStream &&key, CDataStream &value) override
 
bool WriteKey (CDataStream &&key, CDataStream &&value, bool overwrite=true) override
 
bool EraseKey (CDataStream &&key) override
 
bool HasKey (CDataStream &&key) override
 

Private Attributes

SQLiteDatabasem_database
 
bool m_cursor_init = false
 
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_cursor_stmt {nullptr}
 

Detailed Description

RAII class that provides access to a WalletDatabase.

Definition at line 16 of file sqlite.h.

Constructor & Destructor Documentation

◆ SQLiteBatch()

SQLiteBatch::SQLiteBatch ( SQLiteDatabase database)
explicit

Definition at line 333 of file sqlite.cpp.

Here is the call graph for this function:

◆ ~SQLiteBatch()

SQLiteBatch::~SQLiteBatch ( )
inlineoverride

Definition at line 38 of file sqlite.h.

Here is the call graph for this function:

Member Function Documentation

◆ Close()

void SQLiteBatch::Close ( )
overridevirtual

Implements DatabaseBatch.

Definition at line 340 of file sqlite.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CloseCursor()

void SQLiteBatch::CloseCursor ( )
overridevirtual

Implements DatabaseBatch.

Definition at line 561 of file sqlite.cpp.

◆ EraseKey()

bool SQLiteBatch::EraseKey ( CDataStream &&  key)
overrideprivatevirtual

Implements DatabaseBatch.

Definition at line 472 of file sqlite.cpp.

Here is the call graph for this function:

◆ Flush()

void SQLiteBatch::Flush ( )
inlineoverridevirtual

No-op.

See comment on SQLiteDatabase::Flush

Implements DatabaseBatch.

Definition at line 41 of file sqlite.h.

◆ HasKey()

bool SQLiteBatch::HasKey ( CDataStream &&  key)
overrideprivatevirtual

Implements DatabaseBatch.

Definition at line 500 of file sqlite.cpp.

Here is the call graph for this function:

◆ ReadAtCursor()

bool SQLiteBatch::ReadAtCursor ( CDataStream key,
CDataStream value,
bool &  complete 
)
overridevirtual

Implements DatabaseBatch.

Definition at line 531 of file sqlite.cpp.

Here is the call graph for this function:

◆ ReadKey()

bool SQLiteBatch::ReadKey ( CDataStream &&  key,
CDataStream value 
)
overrideprivatevirtual

Implements DatabaseBatch.

Definition at line 391 of file sqlite.cpp.

Here is the call graph for this function:

◆ SetupSQLStatements()

void SQLiteBatch::SetupSQLStatements ( )
private

Definition at line 69 of file sqlite.cpp.

Here is the caller graph for this function:

◆ StartCursor()

bool SQLiteBatch::StartCursor ( )
overridevirtual

Implements DatabaseBatch.

Definition at line 522 of file sqlite.cpp.

Here is the call graph for this function:

◆ TxnAbort()

bool SQLiteBatch::TxnAbort ( )
overridevirtual

Implements DatabaseBatch.

Definition at line 590 of file sqlite.cpp.

Here is the caller graph for this function:

◆ TxnBegin()

bool SQLiteBatch::TxnBegin ( )
overridevirtual

Implements DatabaseBatch.

Definition at line 566 of file sqlite.cpp.

◆ TxnCommit()

bool SQLiteBatch::TxnCommit ( )
overridevirtual

Implements DatabaseBatch.

Definition at line 578 of file sqlite.cpp.

◆ WriteKey()

bool SQLiteBatch::WriteKey ( CDataStream &&  key,
CDataStream &&  value,
bool  overwrite = true 
)
overrideprivatevirtual

Implements DatabaseBatch.

Definition at line 428 of file sqlite.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ m_cursor_init

bool SQLiteBatch::m_cursor_init = false
private

Definition at line 20 of file sqlite.h.

◆ m_cursor_stmt

sqlite3_stmt* SQLiteBatch::m_cursor_stmt {nullptr}
private

Definition at line 26 of file sqlite.h.

◆ m_database

SQLiteDatabase& SQLiteBatch::m_database
private

Definition at line 18 of file sqlite.h.

◆ m_delete_stmt

sqlite3_stmt* SQLiteBatch::m_delete_stmt {nullptr}
private

Definition at line 25 of file sqlite.h.

◆ m_insert_stmt

sqlite3_stmt* SQLiteBatch::m_insert_stmt {nullptr}
private

Definition at line 23 of file sqlite.h.

◆ m_overwrite_stmt

sqlite3_stmt* SQLiteBatch::m_overwrite_stmt {nullptr}
private

Definition at line 24 of file sqlite.h.

◆ m_read_stmt

sqlite3_stmt* SQLiteBatch::m_read_stmt {nullptr}
private

Definition at line 22 of file sqlite.h.


The documentation for this class was generated from the following files: