#include <database-sqlite3.h>
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 |
PlayerDatabaseSQLite3::PlayerDatabaseSQLite3 | ( | const std::string & | savedir | ) |
|
virtual |
References FINALIZE_STATEMENT, m_stmt_player_add, m_stmt_player_add_inventory, m_stmt_player_add_inventory_items, m_stmt_player_list, m_stmt_player_load, m_stmt_player_load_inventory, m_stmt_player_load_inventory_items, m_stmt_player_metadata_add, m_stmt_player_metadata_load, m_stmt_player_metadata_remove, m_stmt_player_remove, m_stmt_player_remove_inventory, m_stmt_player_remove_inventory_items, and m_stmt_player_update.
|
protectedvirtual |
Implements Database_SQLite3.
References Database_SQLite3::m_database, and SQLOK.
|
protectedvirtual |
Implements Database_SQLite3.
References PREPARE_STATEMENT, and verbosestream.
|
virtual |
Implements PlayerDatabase.
References m_stmt_player_list, Database_SQLite3::sqlite_to_string_view(), and Database_SQLite3::verifyDatabase().
|
virtual |
Implements PlayerDatabase.
References Inventory::addList(), InventoryList::changeItem(), ItemStack::deSerialize(), PlayerSAO::getMeta(), Player::getName(), PlayerSAO::getPlayer(), Database_SQLite3::int_to_sqlite(), Player::inventory, m_stmt_player_load, m_stmt_player_load_inventory, m_stmt_player_load_inventory_items, m_stmt_player_metadata_load, MYMIN, PlayerSAO::setBasePosition(), PlayerSAO::setBreath(), PlayerSAO::setHPRaw(), PlayerSAO::setLookPitch(), SimpleMetadata::setModified(), PlayerSAO::setPlayerYaw(), SimpleMetadata::setString(), InventoryList::setWidth(), Database_SQLite3::sqlite_to_float(), Database_SQLite3::sqlite_to_int(), Database_SQLite3::sqlite_to_string(), Database_SQLite3::sqlite_to_string_view(), Database_SQLite3::sqlite_to_uint(), Database_SQLite3::sqlite_to_v3f(), Database_SQLite3::str_to_sqlite(), U16_MAX, and Database_SQLite3::verifyDatabase().
|
private |
References m_stmt_player_load, Database_SQLite3::str_to_sqlite(), and Database_SQLite3::verifyDatabase().
Referenced by removePlayer(), and savePlayer().
|
virtual |
Implements PlayerDatabase.
References m_stmt_player_remove, playerDataExists(), Database_SQLite3::sqlite3_vrfy(), and Database_SQLite3::str_to_sqlite().
|
virtual |
Implements PlayerDatabase.
References Database_SQLite3::beginSave(), Database_SQLite3::double_to_sqlite(), Database_SQLite3::endSave(), ServerActiveObject::getBasePosition(), PlayerSAO::getBreath(), UnitSAO::getHP(), PlayerSAO::getInventory(), InventoryList::getItem(), Inventory::getLists(), PlayerSAO::getLookPitch(), PlayerSAO::getMeta(), InventoryList::getName(), Player::getName(), RemotePlayer::getPlayerSAO(), UnitSAO::getRotation(), InventoryList::getSize(), SimpleMetadata::getStrings(), InventoryList::getWidth(), Database_SQLite3::int64_to_sqlite(), Database_SQLite3::int_to_sqlite(), m_stmt_player_add, m_stmt_player_add_inventory, m_stmt_player_add_inventory_items, m_stmt_player_metadata_add, m_stmt_player_metadata_remove, m_stmt_player_remove_inventory, m_stmt_player_remove_inventory_items, m_stmt_player_update, RemotePlayer::onSuccessfulSave(), playerDataExists(), sanity_check, ItemStack::serialize(), Database_SQLite3::sqlite3_vrfy(), and Database_SQLite3::str_to_sqlite().
|
private |
Referenced by ~PlayerDatabaseSQLite3(), and savePlayer().
|
private |
Referenced by ~PlayerDatabaseSQLite3(), and savePlayer().
|
private |
Referenced by ~PlayerDatabaseSQLite3(), and savePlayer().
|
private |
Referenced by ~PlayerDatabaseSQLite3(), and listPlayers().
|
private |
Referenced by ~PlayerDatabaseSQLite3(), loadPlayer(), and playerDataExists().
|
private |
Referenced by ~PlayerDatabaseSQLite3(), and loadPlayer().
|
private |
Referenced by ~PlayerDatabaseSQLite3(), and loadPlayer().
|
private |
Referenced by ~PlayerDatabaseSQLite3(), and savePlayer().
|
private |
Referenced by ~PlayerDatabaseSQLite3(), and loadPlayer().
|
private |
Referenced by ~PlayerDatabaseSQLite3(), and savePlayer().
|
private |
Referenced by ~PlayerDatabaseSQLite3(), and removePlayer().
|
private |
Referenced by ~PlayerDatabaseSQLite3(), and savePlayer().
|
private |
Referenced by ~PlayerDatabaseSQLite3(), and savePlayer().
|
private |
Referenced by ~PlayerDatabaseSQLite3(), and savePlayer().