Bitcoin Core 31.99.0
P2P Digital Currency
Public Member Functions | List of all members
wallet::MockableSQLiteDatabase Class Reference

A WalletDatabase whose contents and return values can be modified as needed for testing. More...

#include <util.h>

Inheritance diagram for wallet::MockableSQLiteDatabase:
[legend]
Collaboration diagram for wallet::MockableSQLiteDatabase:
[legend]

Public Member Functions

 MockableSQLiteDatabase ()
 
bool Backup (const std::string &strDest) const override
 Back up the entire database to a file. More...
 
std::string Filename () override
 Return path to main database file for logs and error messages. More...
 
std::vector< fs::pathFiles () override
 Return paths to all database created files. More...
 
std::string Format () override
 
std::unique_ptr< DatabaseBatchMakeBatch () override
 Make a SQLiteBatch connected to this database. More...
 
- Public Member Functions inherited from wallet::SQLiteDatabase
 SQLiteDatabase ()=delete
 
 SQLiteDatabase (const fs::path &dir_path, const fs::path &file_path, const DatabaseOptions &options)
 Create DB handle to real database. More...
 
 ~SQLiteDatabase ()
 
bool Verify (bilingual_str &error)
 
void Open () override
 Open the database if it is not already opened. More...
 
void Close () override
 Close the database. More...
 
bool Rewrite () override
 Rewrite the entire database on disk. More...
 
bool Backup (const std::string &dest) const override
 Back up the entire database to a file. More...
 
std::string Filename () override
 Return path to main database file for logs and error messages. More...
 
std::vector< fs::pathFiles () override
 Return paths to all database created files. More...
 
std::string Format () override
 
std::unique_ptr< DatabaseBatchMakeBatch () override
 Make a SQLiteBatch connected to this database. More...
 
bool HasActiveTxn ()
 Return true if there is an on-going txn in this connection. More...
 
- Public Member Functions inherited from wallet::WalletDatabase
 WalletDatabase ()=default
 Create dummy DB handle. More...
 
virtual ~WalletDatabase ()=default
 
virtual void Open ()=0
 Open the database if it is not already opened. More...
 
virtual bool Rewrite ()=0
 Rewrite the entire database on disk. More...
 
virtual bool Backup (const std::string &strDest) const =0
 Back up the entire database to a file. More...
 
virtual void Close ()=0
 Flush to the database file and close the database. More...
 
virtual std::string Filename ()=0
 Return path to main database file for logs and error messages. More...
 
virtual std::vector< fs::pathFiles ()=0
 Return paths to all database created files. More...
 
virtual std::string Format ()=0
 
virtual std::unique_ptr< DatabaseBatchMakeBatch ()=0
 Make a DatabaseBatch connected to this database. More...
 

Additional Inherited Members

- Public Attributes inherited from wallet::SQLiteDatabase
std::binary_semaphore m_write_semaphore
 
sqlite3 * m_db {nullptr}
 
bool m_use_unsafe_sync
 
- Public Attributes inherited from wallet::WalletDatabase
std::atomic< int > m_refcount {0}
 Counts the number of active database users to be sure that the database is not closed while someone is using it. More...
 
- Protected Member Functions inherited from wallet::SQLiteDatabase
 SQLiteDatabase (const fs::path &dir_path, const fs::path &file_path, const DatabaseOptions &options, int additional_flags)
 

Detailed Description

A WalletDatabase whose contents and return values can be modified as needed for testing.

Definition at line 62 of file util.h.

Constructor & Destructor Documentation

◆ MockableSQLiteDatabase()

wallet::MockableSQLiteDatabase::MockableSQLiteDatabase ( )

Definition at line 140 of file util.cpp.

Member Function Documentation

◆ Backup()

bool wallet::MockableSQLiteDatabase::Backup ( const std::string &  dest) const
inlineoverridevirtual

Back up the entire database to a file.

Reimplemented from wallet::SQLiteDatabase.

Definition at line 67 of file util.h.

◆ Filename()

std::string wallet::MockableSQLiteDatabase::Filename ( )
inlineoverridevirtual

Return path to main database file for logs and error messages.

Reimplemented from wallet::SQLiteDatabase.

Definition at line 69 of file util.h.

◆ Files()

std::vector< fs::path > wallet::MockableSQLiteDatabase::Files ( )
inlineoverridevirtual

Return paths to all database created files.

Reimplemented from wallet::SQLiteDatabase.

Definition at line 70 of file util.h.

◆ Format()

std::string wallet::MockableSQLiteDatabase::Format ( )
inlineoverridevirtual

Reimplemented from wallet::SQLiteDatabase.

Definition at line 71 of file util.h.

◆ MakeBatch()

std::unique_ptr< DatabaseBatch > wallet::MockableSQLiteDatabase::MakeBatch ( )
inlineoverridevirtual

Make a SQLiteBatch connected to this database.

Reimplemented from wallet::SQLiteDatabase.

Definition at line 72 of file util.h.


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