Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
PlayerDatabaseSQLite3 Class Reference

#include <database-sqlite3.h>

+ Inheritance diagram for PlayerDatabaseSQLite3:
+ Collaboration diagram for PlayerDatabaseSQLite3:

Public Member Functions

 PlayerDatabaseSQLite3 (const std::string &savedir)
 
virtual ~PlayerDatabaseSQLite3 ()
 
void savePlayer (RemotePlayer *player)
 
bool loadPlayer (RemotePlayer *player, PlayerSAO *sao)
 
bool removePlayer (const std::string &name)
 
void listPlayers (std::vector< std::string > &res)
 
- Public Member Functions inherited from PlayerDatabase
virtual ~PlayerDatabase ()=default
 

Protected Member Functions

virtual void createDatabase ()
 
virtual void initStatements ()
 

Private Member Functions

bool playerDataExists (const std::string &name)
 
- 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
 

Private Attributes

sqlite3_stmt * m_stmt_player_load = nullptr
 
sqlite3_stmt * m_stmt_player_add = nullptr
 
sqlite3_stmt * m_stmt_player_update = nullptr
 
sqlite3_stmt * m_stmt_player_remove = nullptr
 
sqlite3_stmt * m_stmt_player_list = nullptr
 
sqlite3_stmt * m_stmt_player_load_inventory = nullptr
 
sqlite3_stmt * m_stmt_player_load_inventory_items = nullptr
 
sqlite3_stmt * m_stmt_player_add_inventory = nullptr
 
sqlite3_stmt * m_stmt_player_add_inventory_items = nullptr
 
sqlite3_stmt * m_stmt_player_remove_inventory = nullptr
 
sqlite3_stmt * m_stmt_player_remove_inventory_items = nullptr
 
sqlite3_stmt * m_stmt_player_metadata_load = nullptr
 
sqlite3_stmt * m_stmt_player_metadata_remove = nullptr
 
sqlite3_stmt * m_stmt_player_metadata_add = nullptr
 
- Private Attributes inherited from Database_SQLite3
sqlite3 * m_database = nullptr
 

Constructor & Destructor Documentation

◆ PlayerDatabaseSQLite3()

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

◆ ~PlayerDatabaseSQLite3()

Member Function Documentation

◆ createDatabase()

void PlayerDatabaseSQLite3::createDatabase ( )
protectedvirtual

Implements Database_SQLite3.

References Database_SQLite3::m_database, and SQLOK.

◆ initStatements()

void PlayerDatabaseSQLite3::initStatements ( )
protectedvirtual

Implements Database_SQLite3.

References PREPARE_STATEMENT, and verbosestream.

◆ listPlayers()

void PlayerDatabaseSQLite3::listPlayers ( std::vector< std::string > & res)
virtual

Implements PlayerDatabase.

References m_stmt_player_list, Database_SQLite3::sqlite_to_string_view(), and Database_SQLite3::verifyDatabase().

+ Here is the call graph for this function:

◆ loadPlayer()

◆ playerDataExists()

bool PlayerDatabaseSQLite3::playerDataExists ( const std::string & name)
private

References m_stmt_player_load, Database_SQLite3::str_to_sqlite(), and Database_SQLite3::verifyDatabase().

Referenced by removePlayer(), and savePlayer().

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

◆ removePlayer()

bool PlayerDatabaseSQLite3::removePlayer ( const std::string & name)
virtual

Implements PlayerDatabase.

References m_stmt_player_remove, playerDataExists(), Database_SQLite3::sqlite3_vrfy(), and Database_SQLite3::str_to_sqlite().

+ Here is the call graph for this function:

◆ savePlayer()

Member Data Documentation

◆ m_stmt_player_add

sqlite3_stmt* PlayerDatabaseSQLite3::m_stmt_player_add = nullptr
private

◆ m_stmt_player_add_inventory

sqlite3_stmt* PlayerDatabaseSQLite3::m_stmt_player_add_inventory = nullptr
private

◆ m_stmt_player_add_inventory_items

sqlite3_stmt* PlayerDatabaseSQLite3::m_stmt_player_add_inventory_items = nullptr
private

◆ m_stmt_player_list

sqlite3_stmt* PlayerDatabaseSQLite3::m_stmt_player_list = nullptr
private

◆ m_stmt_player_load

sqlite3_stmt* PlayerDatabaseSQLite3::m_stmt_player_load = nullptr
private

◆ m_stmt_player_load_inventory

sqlite3_stmt* PlayerDatabaseSQLite3::m_stmt_player_load_inventory = nullptr
private

◆ m_stmt_player_load_inventory_items

sqlite3_stmt* PlayerDatabaseSQLite3::m_stmt_player_load_inventory_items = nullptr
private

◆ m_stmt_player_metadata_add

sqlite3_stmt* PlayerDatabaseSQLite3::m_stmt_player_metadata_add = nullptr
private

◆ m_stmt_player_metadata_load

sqlite3_stmt* PlayerDatabaseSQLite3::m_stmt_player_metadata_load = nullptr
private

◆ m_stmt_player_metadata_remove

sqlite3_stmt* PlayerDatabaseSQLite3::m_stmt_player_metadata_remove = nullptr
private

◆ m_stmt_player_remove

sqlite3_stmt* PlayerDatabaseSQLite3::m_stmt_player_remove = nullptr
private

◆ m_stmt_player_remove_inventory

sqlite3_stmt* PlayerDatabaseSQLite3::m_stmt_player_remove_inventory = nullptr
private

◆ m_stmt_player_remove_inventory_items

sqlite3_stmt* PlayerDatabaseSQLite3::m_stmt_player_remove_inventory_items = nullptr
private

◆ m_stmt_player_update

sqlite3_stmt* PlayerDatabaseSQLite3::m_stmt_player_update = nullptr
private

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