#include <database-sqlite3.h>
Public Member Functions | |
virtual | ~Database_SQLite3 () |
void | beginSave () |
void | endSave () |
bool | initialized () const |
Protected Member Functions | |
Database_SQLite3 (const std::string &savedir, const std::string &dbname) | |
void | verifyDatabase () |
void | str_to_sqlite (sqlite3_stmt *s, int iCol, std::string_view str) const |
void | int_to_sqlite (sqlite3_stmt *s, int iCol, int val) const |
void | int64_to_sqlite (sqlite3_stmt *s, int iCol, s64 val) const |
void | double_to_sqlite (sqlite3_stmt *s, int iCol, double val) const |
std::string_view | sqlite_to_string_view (sqlite3_stmt *s, int iCol) |
std::string | sqlite_to_string (sqlite3_stmt *s, int iCol) |
std::string_view | sqlite_to_blob (sqlite3_stmt *s, int iCol) |
s32 | sqlite_to_int (sqlite3_stmt *s, int iCol) |
u32 | sqlite_to_uint (sqlite3_stmt *s, int iCol) |
s64 | sqlite_to_int64 (sqlite3_stmt *s, int iCol) |
u64 | sqlite_to_uint64 (sqlite3_stmt *s, int iCol) |
float | sqlite_to_float (sqlite3_stmt *s, int iCol) |
const v3f | sqlite_to_v3f (sqlite3_stmt *s, int iCol) |
void | sqlite3_vrfy (int s, std::string_view m="", int r=SQLITE_OK) const |
void | sqlite3_vrfy (const int s, const int r, std::string_view m="") const |
virtual void | createDatabase ()=0 |
virtual void | initStatements ()=0 |
Protected Attributes | |
sqlite3 * | m_database = nullptr |
Private Member Functions | |
void | openDatabase () |
Static Private Member Functions | |
static int | busyHandler (void *data, int count) |
Private Attributes | |
bool | m_initialized = false |
std::string | m_savedir = "" |
std::string | m_dbname = "" |
sqlite3_stmt * | m_stmt_begin = nullptr |
sqlite3_stmt * | m_stmt_end = nullptr |
s64 | m_busy_handler_data [2] |
|
virtual |
References FINALIZE_STATEMENT, m_database, m_stmt_begin, m_stmt_end, and SQLOK_ERRSTREAM.
|
protected |
|
virtual |
Implements Database.
Reimplemented in MapDatabaseSQLite3, and ModStorageDatabaseSQLite3.
References m_stmt_begin, SQLRES, and verifyDatabase().
Referenced by MapDatabaseSQLite3::beginSave(), ModStorageDatabaseSQLite3::beginSave(), AuthDatabaseSQLite3::createAuth(), AuthDatabaseSQLite3::saveAuth(), and PlayerDatabaseSQLite3::savePlayer().
|
staticprivate |
References BUSY_ERROR_INTERVAL, BUSY_ERROR_TRESHOLD, BUSY_FATAL_TRESHOLD, BUSY_INFO_TRESHOLD, BUSY_WARNING_TRESHOLD, errorstream, porting::getTimeMs(), infostream, and warningstream.
Referenced by openDatabase().
|
protectedpure virtual |
Implemented in AuthDatabaseSQLite3, MapDatabaseSQLite3, ModStorageDatabaseSQLite3, and PlayerDatabaseSQLite3.
Referenced by openDatabase().
|
inlineprotected |
References sqlite3_vrfy().
Referenced by PlayerDatabaseSQLite3::savePlayer().
|
virtual |
Implements Database.
Reimplemented in MapDatabaseSQLite3, and ModStorageDatabaseSQLite3.
References m_stmt_end, SQLRES, and verifyDatabase().
Referenced by AuthDatabaseSQLite3::createAuth(), MapDatabaseSQLite3::endSave(), ModStorageDatabaseSQLite3::endSave(), AuthDatabaseSQLite3::saveAuth(), and PlayerDatabaseSQLite3::savePlayer().
|
inlinevirtual |
Reimplemented from Database.
References m_initialized.
|
protectedpure virtual |
Implemented in AuthDatabaseSQLite3, MapDatabaseSQLite3, ModStorageDatabaseSQLite3, and PlayerDatabaseSQLite3.
Referenced by verifyDatabase().
|
inlineprotected |
References sqlite3_vrfy().
Referenced by AuthDatabaseSQLite3::createAuth(), AuthDatabaseSQLite3::getAuth(), AuthDatabaseSQLite3::saveAuth(), PlayerDatabaseSQLite3::savePlayer(), and AuthDatabaseSQLite3::writePrivileges().
|
inlineprotected |
References sqlite3_vrfy().
Referenced by PlayerDatabaseSQLite3::loadPlayer(), and PlayerDatabaseSQLite3::savePlayer().
|
private |
References busyHandler(), fs::CreateAllDirs(), createDatabase(), DIR_DELIM, g_settings, Settings::getU16(), infostream, itos(), m_busy_handler_data, m_database, m_dbname, m_savedir, fs::PathExists(), and SQLOK.
Referenced by verifyDatabase().
|
inlineprotected |
|
inlineprotected |
References m_database.
Referenced by AuthDatabaseSQLite3::createAuth(), AuthDatabaseSQLite3::deleteAuth(), double_to_sqlite(), ModStorageDatabaseSQLite3::getModEntries(), ModStorageDatabaseSQLite3::getModKeys(), int64_to_sqlite(), int_to_sqlite(), ModStorageDatabaseSQLite3::removeModEntries(), ModStorageDatabaseSQLite3::removeModEntry(), PlayerDatabaseSQLite3::removePlayer(), AuthDatabaseSQLite3::saveAuth(), PlayerDatabaseSQLite3::savePlayer(), sqlite3_vrfy(), str_to_sqlite(), and AuthDatabaseSQLite3::writePrivileges().
|
inlineprotected |
Referenced by ModStorageDatabaseSQLite3::getModEntries(), ModStorageDatabaseSQLite3::getModEntry(), ModStorageDatabaseSQLite3::getModKeys(), and MapDatabaseSQLite3::loadBlock().
|
inlineprotected |
Referenced by PlayerDatabaseSQLite3::loadPlayer(), and sqlite_to_v3f().
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
References sqlite_to_string_view().
Referenced by PlayerDatabaseSQLite3::loadPlayer().
|
inlineprotected |
Referenced by AuthDatabaseSQLite3::getAuth(), AuthDatabaseSQLite3::listNames(), PlayerDatabaseSQLite3::listPlayers(), PlayerDatabaseSQLite3::loadPlayer(), and sqlite_to_string().
|
inlineprotected |
Referenced by AuthDatabaseSQLite3::createAuth(), AuthDatabaseSQLite3::getAuth(), and PlayerDatabaseSQLite3::loadPlayer().
|
inlineprotected |
|
inlineprotected |
References sqlite_to_float().
Referenced by PlayerDatabaseSQLite3::loadPlayer().
|
inlineprotected |
References sqlite3_vrfy().
Referenced by AuthDatabaseSQLite3::createAuth(), AuthDatabaseSQLite3::deleteAuth(), AuthDatabaseSQLite3::getAuth(), ModStorageDatabaseSQLite3::getModEntries(), ModStorageDatabaseSQLite3::getModEntry(), ModStorageDatabaseSQLite3::getModKeys(), ModStorageDatabaseSQLite3::hasModEntry(), PlayerDatabaseSQLite3::loadPlayer(), PlayerDatabaseSQLite3::playerDataExists(), ModStorageDatabaseSQLite3::removeModEntries(), ModStorageDatabaseSQLite3::removeModEntry(), PlayerDatabaseSQLite3::removePlayer(), AuthDatabaseSQLite3::saveAuth(), PlayerDatabaseSQLite3::savePlayer(), ModStorageDatabaseSQLite3::setModEntry(), and AuthDatabaseSQLite3::writePrivileges().
|
protected |
References initStatements(), m_initialized, openDatabase(), and PREPARE_STATEMENT.
Referenced by beginSave(), AuthDatabaseSQLite3::deleteAuth(), MapDatabaseSQLite3::deleteBlock(), endSave(), AuthDatabaseSQLite3::getAuth(), ModStorageDatabaseSQLite3::getModEntries(), ModStorageDatabaseSQLite3::getModEntry(), ModStorageDatabaseSQLite3::getModKeys(), ModStorageDatabaseSQLite3::hasModEntry(), MapDatabaseSQLite3::listAllLoadableBlocks(), ModStorageDatabaseSQLite3::listMods(), AuthDatabaseSQLite3::listNames(), PlayerDatabaseSQLite3::listPlayers(), MapDatabaseSQLite3::loadBlock(), PlayerDatabaseSQLite3::loadPlayer(), PlayerDatabaseSQLite3::playerDataExists(), ModStorageDatabaseSQLite3::removeModEntries(), ModStorageDatabaseSQLite3::removeModEntry(), MapDatabaseSQLite3::saveBlock(), and ModStorageDatabaseSQLite3::setModEntry().
|
private |
Referenced by openDatabase().
|
protected |
Referenced by ~Database_SQLite3(), AuthDatabaseSQLite3::createDatabase(), MapDatabaseSQLite3::createDatabase(), ModStorageDatabaseSQLite3::createDatabase(), PlayerDatabaseSQLite3::createDatabase(), AuthDatabaseSQLite3::deleteAuth(), MapDatabaseSQLite3::deleteBlock(), ModStorageDatabaseSQLite3::getModEntries(), ModStorageDatabaseSQLite3::getModKeys(), ModStorageDatabaseSQLite3::listMods(), openDatabase(), ModStorageDatabaseSQLite3::removeModEntries(), ModStorageDatabaseSQLite3::removeModEntry(), and sqlite3_vrfy().
|
private |
Referenced by openDatabase().
|
private |
Referenced by initialized(), and verifyDatabase().
|
private |
Referenced by openDatabase().
|
private |
Referenced by ~Database_SQLite3(), and beginSave().
|
private |
Referenced by ~Database_SQLite3(), and endSave().