Minetest  5.4.0
MapDatabaseSQLite3 Class Reference

#include <database-sqlite3.h>

+ Inheritance diagram for MapDatabaseSQLite3:
+ Collaboration diagram for MapDatabaseSQLite3:

Public Member Functions

 MapDatabaseSQLite3 (const std::string &savedir)
 
virtual ~MapDatabaseSQLite3 ()
 
bool saveBlock (const v3s16 &pos, const std::string &data)
 
void loadBlock (const v3s16 &pos, std::string *block)
 
bool deleteBlock (const v3s16 &pos)
 
void listAllLoadableBlocks (std::vector< v3s16 > &dst)
 
void beginSave ()
 
void endSave ()
 
- Public Member Functions inherited from MapDatabase
virtual ~MapDatabase ()=default
 

Protected Member Functions

virtual void createDatabase ()
 
virtual void initStatements ()
 

Private Member Functions

void bindPos (sqlite3_stmt *stmt, const v3s16 &pos, int index=1)
 
- Private Member Functions inherited from Database_SQLite3
virtual ~Database_SQLite3 ()
 
bool initialized () const
 
 Database_SQLite3 (const std::string &savedir, const std::string &dbname)
 
void verifyDatabase ()
 
void str_to_sqlite (sqlite3_stmt *s, int iCol, const std::string &str) const
 
void str_to_sqlite (sqlite3_stmt *s, int iCol, const char *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 sqlite_to_string (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, const std::string &m="", int r=SQLITE_OK) const
 
void sqlite3_vrfy (const int s, const int r, const std::string &m="") const
 

Private Attributes

sqlite3_stmt * m_stmt_read = nullptr
 
sqlite3_stmt * m_stmt_write = nullptr
 
sqlite3_stmt * m_stmt_list = nullptr
 
sqlite3_stmt * m_stmt_delete = nullptr
 
- Private Attributes inherited from Database_SQLite3
sqlite3 * m_database = nullptr
 

Additional Inherited Members

- Static Public Member Functions inherited from MapDatabase
static s64 getBlockAsInteger (const v3s16 &pos)
 
static v3s16 getIntegerAsBlock (s64 i)
 

Constructor & Destructor Documentation

◆ MapDatabaseSQLite3()

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

◆ ~MapDatabaseSQLite3()

MapDatabaseSQLite3::~MapDatabaseSQLite3 ( )
virtual

Member Function Documentation

◆ beginSave()

void MapDatabaseSQLite3::beginSave ( )
inlinevirtual

Reimplemented from Database_SQLite3.

References Database_SQLite3::beginSave().

+ Here is the call graph for this function:

◆ bindPos()

void MapDatabaseSQLite3::bindPos ( sqlite3_stmt *  stmt,
const v3s16 pos,
int  index = 1 
)
inlineprivate

References MapDatabase::getBlockAsInteger(), SQLOK, and TOSTRING.

Referenced by deleteBlock(), loadBlock(), and saveBlock().

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

◆ createDatabase()

void MapDatabaseSQLite3::createDatabase ( )
protectedvirtual

Implements Database_SQLite3.

References Database_SQLite3::m_database, and SQLOK.

◆ deleteBlock()

bool MapDatabaseSQLite3::deleteBlock ( const v3s16 pos)
virtual

Implements MapDatabase.

References bindPos(), Database_SQLite3::m_database, m_stmt_delete, PP, Database_SQLite3::verifyDatabase(), and warningstream.

Referenced by saveBlock().

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

◆ endSave()

void MapDatabaseSQLite3::endSave ( )
inlinevirtual

Reimplemented from Database_SQLite3.

References Database_SQLite3::endSave().

+ Here is the call graph for this function:

◆ initStatements()

void MapDatabaseSQLite3::initStatements ( )
protectedvirtual

Implements Database_SQLite3.

References PREPARE_STATEMENT, and verbosestream.

◆ listAllLoadableBlocks()

void MapDatabaseSQLite3::listAllLoadableBlocks ( std::vector< v3s16 > &  dst)
virtual

Implements MapDatabase.

References MapDatabase::getIntegerAsBlock(), m_stmt_list, and Database_SQLite3::verifyDatabase().

+ Here is the call graph for this function:

◆ loadBlock()

void MapDatabaseSQLite3::loadBlock ( const v3s16 pos,
std::string *  block 
)
virtual

Implements MapDatabase.

References bindPos(), m_stmt_read, and Database_SQLite3::verifyDatabase().

+ Here is the call graph for this function:

◆ saveBlock()

bool MapDatabaseSQLite3::saveBlock ( const v3s16 pos,
const std::string &  data 
)
virtual

Implements MapDatabase.

References bindPos(), deleteBlock(), m_stmt_read, m_stmt_write, SQLOK, SQLRES, TOSTRING, and Database_SQLite3::verifyDatabase().

+ Here is the call graph for this function:

Member Data Documentation

◆ m_stmt_delete

sqlite3_stmt* MapDatabaseSQLite3::m_stmt_delete = nullptr
private

Referenced by ~MapDatabaseSQLite3(), and deleteBlock().

◆ m_stmt_list

sqlite3_stmt* MapDatabaseSQLite3::m_stmt_list = nullptr
private

◆ m_stmt_read

sqlite3_stmt* MapDatabaseSQLite3::m_stmt_read = nullptr
private

◆ m_stmt_write

sqlite3_stmt* MapDatabaseSQLite3::m_stmt_write = nullptr
private

Referenced by ~MapDatabaseSQLite3(), and saveBlock().


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