Bitcoin ABC 0.26.3
P2P Digital Currency
|
An instance of this class represents one SQLite3 database. More...
#include <sqlite.h>
Public Member Functions | |
SQLiteDatabase ()=delete | |
SQLiteDatabase (const fs::path &dir_path, const fs::path &file_path, bool mock=false) | |
Create DB handle to real database. | |
~SQLiteDatabase () | |
bool | Verify (bilingual_str &error) |
void | Open () override |
Open the database if it is not already opened. | |
void | Close () override |
Close the database. | |
void | AddRef () override |
Indicate the a new database user has began using the database. | |
void | RemoveRef () override |
Indicate that database user has stopped using the database and that it could be flushed or closed. | |
bool | Rewrite (const char *skip=nullptr) override |
Rewrite the entire database on disk. | |
bool | Backup (const std::string &dest) const override |
Back up the entire database to a file. | |
void | Flush () override |
No-ops. | |
bool | PeriodicFlush () override |
void | ReloadDbEnv () override |
void | IncrementUpdateCounter () override |
std::string | Filename () override |
Return path to main database file for logs and error messages. | |
std::unique_ptr< DatabaseBatch > | MakeBatch (bool flush_on_close=true) override |
Make a SQLiteBatch connected to this database. | |
Public Member Functions inherited from WalletDatabase | |
WalletDatabase () | |
Create dummy DB handle. | |
virtual | ~WalletDatabase () |
Public Attributes | |
sqlite3 * | m_db {nullptr} |
Public Attributes inherited from 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. | |
std::atomic< unsigned int > | nUpdateCounter |
unsigned int | nLastSeen |
unsigned int | nLastFlushed |
int64_t | nLastWalletUpdate |
Private Member Functions | |
void | Cleanup () noexcept |
Private Attributes | |
const bool | m_mock {false} |
const std::string | m_dir_path |
const std::string | m_file_path |
|
delete |
SQLiteDatabase::SQLiteDatabase | ( | const fs::path & | dir_path, |
const fs::path & | file_path, | ||
bool | mock = false |
||
) |
Create DB handle to real database.
Definition at line 32 of file sqlite.cpp.
SQLiteDatabase::~SQLiteDatabase | ( | ) |
|
inlineoverridevirtual |
Indicate the a new database user has began using the database.
Increments m_refcount
Implements WalletDatabase.
Definition at line 83 of file sqlite.h.
|
overridevirtual |
Back up the entire database to a file.
Implements WalletDatabase.
Definition at line 291 of file sqlite.cpp.
|
privatenoexcept |
Definition at line 122 of file sqlite.cpp.
|
overridevirtual |
Close the database.
Implements WalletDatabase.
Definition at line 318 of file sqlite.cpp.
|
inlineoverridevirtual |
Return path to main database file for logs and error messages.
Implements WalletDatabase.
|
inlineoverridevirtual |
No-ops.
SQLite always flushes everything to the database file after each transaction (each Read/Write/Erase that we do is its own transaction unless we called TxnBegin) so there is no need to have Flush or Periodic Flush.
There is no DB env to reload, so ReloadDbEnv has nothing to do
Implements WalletDatabase.
|
inlineoverridevirtual |
Implements WalletDatabase.
|
overridevirtual |
Make a SQLiteBatch connected to this database.
Implements WalletDatabase.
Definition at line 328 of file sqlite.cpp.
|
overridevirtual |
Open the database if it is not already opened.
Implements WalletDatabase.
Definition at line 179 of file sqlite.cpp.
|
inlineoverridevirtual |
Implements WalletDatabase.
|
inlineoverridevirtual |
Implements WalletDatabase.
|
inlineoverridevirtual |
Indicate that database user has stopped using the database and that it could be flushed or closed.
Decrement m_refcount
Implements WalletDatabase.
Definition at line 84 of file sqlite.h.
Rewrite the entire database on disk.
Implements WalletDatabase.
Definition at line 284 of file sqlite.cpp.
bool SQLiteDatabase::Verify | ( | bilingual_str & | error | ) |