Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
Database_SQLite3 Class Referenceabstract

#include <database-sqlite3.h>

+ Inheritance diagram for Database_SQLite3:
+ Collaboration diagram for Database_SQLite3:

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]
 

Constructor & Destructor Documentation

◆ ~Database_SQLite3()

Database_SQLite3::~Database_SQLite3 ( )
virtual

◆ Database_SQLite3()

Database_SQLite3::Database_SQLite3 ( const std::string & savedir,
const std::string & dbname )
protected

Member Function Documentation

◆ beginSave()

void Database_SQLite3::beginSave ( )
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().

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

◆ busyHandler()

int Database_SQLite3::busyHandler ( void * data,
int count )
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().

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

◆ createDatabase()

virtual void Database_SQLite3::createDatabase ( )
protectedpure virtual

Implemented in AuthDatabaseSQLite3, MapDatabaseSQLite3, ModStorageDatabaseSQLite3, and PlayerDatabaseSQLite3.

Referenced by openDatabase().

+ Here is the caller graph for this function:

◆ double_to_sqlite()

void Database_SQLite3::double_to_sqlite ( sqlite3_stmt * s,
int iCol,
double val ) const
inlineprotected

References sqlite3_vrfy().

Referenced by PlayerDatabaseSQLite3::savePlayer().

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

◆ endSave()

void Database_SQLite3::endSave ( )
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().

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

◆ initialized()

bool Database_SQLite3::initialized ( ) const
inlinevirtual

Reimplemented from Database.

References m_initialized.

◆ initStatements()

virtual void Database_SQLite3::initStatements ( )
protectedpure virtual

Implemented in AuthDatabaseSQLite3, MapDatabaseSQLite3, ModStorageDatabaseSQLite3, and PlayerDatabaseSQLite3.

Referenced by verifyDatabase().

+ Here is the caller graph for this function:

◆ int64_to_sqlite()

void Database_SQLite3::int64_to_sqlite ( sqlite3_stmt * s,
int iCol,
s64 val ) const
inlineprotected

References sqlite3_vrfy().

Referenced by AuthDatabaseSQLite3::createAuth(), AuthDatabaseSQLite3::getAuth(), AuthDatabaseSQLite3::saveAuth(), PlayerDatabaseSQLite3::savePlayer(), and AuthDatabaseSQLite3::writePrivileges().

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

◆ int_to_sqlite()

void Database_SQLite3::int_to_sqlite ( sqlite3_stmt * s,
int iCol,
int val ) const
inlineprotected

References sqlite3_vrfy().

Referenced by PlayerDatabaseSQLite3::loadPlayer(), and PlayerDatabaseSQLite3::savePlayer().

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

◆ openDatabase()

void Database_SQLite3::openDatabase ( )
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().

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

◆ sqlite3_vrfy() [1/2]

void Database_SQLite3::sqlite3_vrfy ( const int s,
const int r,
std::string_view m = "" ) const
inlineprotected

References sqlite3_vrfy().

+ Here is the call graph for this function:

◆ sqlite3_vrfy() [2/2]

void Database_SQLite3::sqlite3_vrfy ( int s,
std::string_view m = "",
int r = SQLITE_OK ) const
inlineprotected

◆ sqlite_to_blob()

std::string_view Database_SQLite3::sqlite_to_blob ( sqlite3_stmt * s,
int iCol )
inlineprotected

Referenced by ModStorageDatabaseSQLite3::getModEntries(), ModStorageDatabaseSQLite3::getModEntry(), ModStorageDatabaseSQLite3::getModKeys(), and MapDatabaseSQLite3::loadBlock().

+ Here is the caller graph for this function:

◆ sqlite_to_float()

float Database_SQLite3::sqlite_to_float ( sqlite3_stmt * s,
int iCol )
inlineprotected

Referenced by PlayerDatabaseSQLite3::loadPlayer(), and sqlite_to_v3f().

+ Here is the caller graph for this function:

◆ sqlite_to_int()

s32 Database_SQLite3::sqlite_to_int ( sqlite3_stmt * s,
int iCol )
inlineprotected

Referenced by PlayerDatabaseSQLite3::loadPlayer().

+ Here is the caller graph for this function:

◆ sqlite_to_int64()

s64 Database_SQLite3::sqlite_to_int64 ( sqlite3_stmt * s,
int iCol )
inlineprotected

Referenced by AuthDatabaseSQLite3::getAuth().

+ Here is the caller graph for this function:

◆ sqlite_to_string()

std::string Database_SQLite3::sqlite_to_string ( sqlite3_stmt * s,
int iCol )
inlineprotected

References sqlite_to_string_view().

Referenced by PlayerDatabaseSQLite3::loadPlayer().

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

◆ sqlite_to_string_view()

std::string_view Database_SQLite3::sqlite_to_string_view ( sqlite3_stmt * s,
int iCol )
inlineprotected

Referenced by AuthDatabaseSQLite3::getAuth(), AuthDatabaseSQLite3::listNames(), PlayerDatabaseSQLite3::listPlayers(), PlayerDatabaseSQLite3::loadPlayer(), and sqlite_to_string().

+ Here is the caller graph for this function:

◆ sqlite_to_uint()

u32 Database_SQLite3::sqlite_to_uint ( sqlite3_stmt * s,
int iCol )
inlineprotected

Referenced by AuthDatabaseSQLite3::createAuth(), AuthDatabaseSQLite3::getAuth(), and PlayerDatabaseSQLite3::loadPlayer().

+ Here is the caller graph for this function:

◆ sqlite_to_uint64()

u64 Database_SQLite3::sqlite_to_uint64 ( sqlite3_stmt * s,
int iCol )
inlineprotected

◆ sqlite_to_v3f()

const v3f Database_SQLite3::sqlite_to_v3f ( sqlite3_stmt * s,
int iCol )
inlineprotected

References sqlite_to_float().

Referenced by PlayerDatabaseSQLite3::loadPlayer().

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

◆ str_to_sqlite()

void Database_SQLite3::str_to_sqlite ( sqlite3_stmt * s,
int iCol,
std::string_view str ) const
inlineprotected

◆ verifyDatabase()

Member Data Documentation

◆ m_busy_handler_data

s64 Database_SQLite3::m_busy_handler_data[2]
private

Referenced by openDatabase().

◆ m_database

◆ m_dbname

std::string Database_SQLite3::m_dbname = ""
private

Referenced by openDatabase().

◆ m_initialized

bool Database_SQLite3::m_initialized = false
private

Referenced by initialized(), and verifyDatabase().

◆ m_savedir

std::string Database_SQLite3::m_savedir = ""
private

Referenced by openDatabase().

◆ m_stmt_begin

sqlite3_stmt* Database_SQLite3::m_stmt_begin = nullptr
private

Referenced by ~Database_SQLite3(), and beginSave().

◆ m_stmt_end

sqlite3_stmt* Database_SQLite3::m_stmt_end = nullptr
private

Referenced by ~Database_SQLite3(), and endSave().


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