Minetest 5.9.0-dev
 
Loading...
Searching...
No Matches
ModStorageDatabaseSQLite3 Class Reference

#include <database-sqlite3.h>

+ Inheritance diagram for ModStorageDatabaseSQLite3:
+ Collaboration diagram for ModStorageDatabaseSQLite3:

Public Member Functions

 ModStorageDatabaseSQLite3 (const std::string &savedir)
 
virtual ~ModStorageDatabaseSQLite3 ()
 
virtual void getModEntries (const std::string &modname, StringMap *storage)
 
virtual void getModKeys (const std::string &modname, std::vector< std::string > *storage)
 
virtual bool getModEntry (const std::string &modname, const std::string &key, std::string *value)
 
virtual bool hasModEntry (const std::string &modname, const std::string &key)
 
virtual bool setModEntry (const std::string &modname, const std::string &key, std::string_view value)
 
virtual bool removeModEntry (const std::string &modname, const std::string &key)
 
virtual bool removeModEntries (const std::string &modname)
 
virtual void listMods (std::vector< std::string > *res)
 
virtual void beginSave ()
 
virtual void endSave ()
 
- Public Member Functions inherited from ModStorageDatabase
virtual ~ModStorageDatabase ()=default
 
virtual void getModEntries (const std::string &modname, StringMap *storage)=0
 
virtual void getModKeys (const std::string &modname, std::vector< std::string > *storage)=0
 
virtual bool hasModEntry (const std::string &modname, const std::string &key)=0
 
virtual bool getModEntry (const std::string &modname, const std::string &key, std::string *value)=0
 
virtual bool setModEntry (const std::string &modname, const std::string &key, std::string_view value)=0
 
virtual bool removeModEntry (const std::string &modname, const std::string &key)=0
 
virtual bool removeModEntries (const std::string &modname)=0
 
virtual void listMods (std::vector< std::string > *res)=0
 
virtual void beginSave ()=0
 
virtual void endSave ()=0
 
virtual bool initialized () const
 

Protected Member Functions

virtual void createDatabase ()
 
virtual void initStatements ()
 

Private Attributes

sqlite3_stmt * m_stmt_get_all = nullptr
 
sqlite3_stmt * m_stmt_get_keys = nullptr
 
sqlite3_stmt * m_stmt_get = nullptr
 
sqlite3_stmt * m_stmt_has = nullptr
 
sqlite3_stmt * m_stmt_set = nullptr
 
sqlite3_stmt * m_stmt_remove = nullptr
 
sqlite3_stmt * m_stmt_remove_all = nullptr
 
- Private Attributes inherited from Database_SQLite3
sqlite3 * m_database = nullptr
 

Additional Inherited Members

- Private Member Functions inherited from Database_SQLite3
virtual ~Database_SQLite3 ()
 
void beginSave ()
 
void endSave ()
 
bool initialized () const
 
 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
 
virtual void beginSave ()=0
 
virtual void endSave ()=0
 
virtual bool initialized () const
 

Constructor & Destructor Documentation

◆ ModStorageDatabaseSQLite3()

ModStorageDatabaseSQLite3::ModStorageDatabaseSQLite3 ( const std::string &  savedir)

◆ ~ModStorageDatabaseSQLite3()

ModStorageDatabaseSQLite3::~ModStorageDatabaseSQLite3 ( )
virtual

Member Function Documentation

◆ beginSave()

virtual void ModStorageDatabaseSQLite3::beginSave ( )
inlinevirtual

Reimplemented from Database_SQLite3.

References Database_SQLite3::beginSave().

+ Here is the call graph for this function:

◆ createDatabase()

void ModStorageDatabaseSQLite3::createDatabase ( )
protectedvirtual

Implements Database_SQLite3.

References Database_SQLite3::m_database, and SQLOK.

◆ endSave()

virtual void ModStorageDatabaseSQLite3::endSave ( )
inlinevirtual

Reimplemented from Database_SQLite3.

References Database_SQLite3::endSave().

+ Here is the call graph for this function:

◆ getModEntries()

void ModStorageDatabaseSQLite3::getModEntries ( const std::string &  modname,
StringMap storage 
)
virtual

Implements ModStorageDatabase.

References Database_SQLite3::m_database, m_stmt_get_all, Database_SQLite3::sqlite3_vrfy(), Database_SQLite3::sqlite_to_blob(), Database_SQLite3::str_to_sqlite(), and Database_SQLite3::verifyDatabase().

+ Here is the call graph for this function:

◆ getModEntry()

bool ModStorageDatabaseSQLite3::getModEntry ( const std::string &  modname,
const std::string &  key,
std::string *  value 
)
virtual

Implements ModStorageDatabase.

References m_stmt_get, Database_SQLite3::sqlite_to_blob(), SQLOK, Database_SQLite3::str_to_sqlite(), TOSTRING, and Database_SQLite3::verifyDatabase().

+ Here is the call graph for this function:

◆ getModKeys()

void ModStorageDatabaseSQLite3::getModKeys ( const std::string &  modname,
std::vector< std::string > *  storage 
)
virtual

Implements ModStorageDatabase.

References Database_SQLite3::m_database, m_stmt_get_keys, Database_SQLite3::sqlite3_vrfy(), Database_SQLite3::sqlite_to_blob(), Database_SQLite3::str_to_sqlite(), and Database_SQLite3::verifyDatabase().

+ Here is the call graph for this function:

◆ hasModEntry()

bool ModStorageDatabaseSQLite3::hasModEntry ( const std::string &  modname,
const std::string &  key 
)
virtual

Implements ModStorageDatabase.

References m_stmt_has, SQLOK, Database_SQLite3::str_to_sqlite(), TOSTRING, and Database_SQLite3::verifyDatabase().

+ Here is the call graph for this function:

◆ initStatements()

void ModStorageDatabaseSQLite3::initStatements ( )
protectedvirtual

Implements Database_SQLite3.

References PREPARE_STATEMENT, and remove().

+ Here is the call graph for this function:

◆ listMods()

void ModStorageDatabaseSQLite3::listMods ( std::vector< std::string > *  res)
virtual

Implements ModStorageDatabase.

References Database_SQLite3::m_database, and Database_SQLite3::verifyDatabase().

+ Here is the call graph for this function:

◆ removeModEntries()

bool ModStorageDatabaseSQLite3::removeModEntries ( const std::string &  modname)
virtual

Implements ModStorageDatabase.

References Database_SQLite3::m_database, m_stmt_remove_all, Database_SQLite3::sqlite3_vrfy(), Database_SQLite3::str_to_sqlite(), and Database_SQLite3::verifyDatabase().

+ Here is the call graph for this function:

◆ removeModEntry()

bool ModStorageDatabaseSQLite3::removeModEntry ( const std::string &  modname,
const std::string &  key 
)
virtual

Implements ModStorageDatabase.

References Database_SQLite3::m_database, m_stmt_remove, Database_SQLite3::sqlite3_vrfy(), SQLOK, Database_SQLite3::str_to_sqlite(), TOSTRING, and Database_SQLite3::verifyDatabase().

+ Here is the call graph for this function:

◆ setModEntry()

bool ModStorageDatabaseSQLite3::setModEntry ( const std::string &  modname,
const std::string &  key,
std::string_view  value 
)
virtual

Implements ModStorageDatabase.

References m_stmt_set, SQLOK, SQLRES, Database_SQLite3::str_to_sqlite(), TOSTRING, and Database_SQLite3::verifyDatabase().

+ Here is the call graph for this function:

Member Data Documentation

◆ m_stmt_get

sqlite3_stmt* ModStorageDatabaseSQLite3::m_stmt_get = nullptr
private

◆ m_stmt_get_all

sqlite3_stmt* ModStorageDatabaseSQLite3::m_stmt_get_all = nullptr
private

◆ m_stmt_get_keys

sqlite3_stmt* ModStorageDatabaseSQLite3::m_stmt_get_keys = nullptr
private

◆ m_stmt_has

sqlite3_stmt* ModStorageDatabaseSQLite3::m_stmt_has = nullptr
private

◆ m_stmt_remove

sqlite3_stmt* ModStorageDatabaseSQLite3::m_stmt_remove = nullptr
private

◆ m_stmt_remove_all

sqlite3_stmt* ModStorageDatabaseSQLite3::m_stmt_remove_all = nullptr
private

◆ m_stmt_set

sqlite3_stmt* ModStorageDatabaseSQLite3::m_stmt_set = nullptr
private

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