Luanti 5.16.0-dev
Loading...
Searching...
No Matches
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, std::string_view data)
void loadBlock (const v3s16 &pos, std::string *block)
bool deleteBlock (const v3s16 &pos)
void listAllLoadableBlocks (std::vector< v3s16 > &dst)
Public Member Functions inherited from MapDatabase
virtual ~MapDatabase ()=default

Protected Member Functions

virtual void createDatabase ()
virtual void initStatements ()

Private Member Functions

int bindPos (sqlite3_stmt *stmt, v3s16 pos, int index=1)
 Bind block position into statement at column index.
Private Member Functions inherited from Database_SQLite3
virtual ~Database_SQLite3 ()
void beginSave () override
void endSave () override
bool initialized () const override
void verifyDatabase () override
 Database_SQLite3 (const std::string &savedir, const std::string &dbname)
bool checkTable (const char *table)
bool checkColumn (const char *table, const char *column)
void str_to_sqlite (sqlite3_stmt *s, int iCol, std::string_view str) const
void blob_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

bool m_new_format = false
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)

References Database_SQLite3::Database_SQLite3().

Here is the call graph for this function:

◆ ~MapDatabaseSQLite3()

MapDatabaseSQLite3::~MapDatabaseSQLite3 ( )
virtual

References FINALIZE_STATEMENT.

Member Function Documentation

◆ bindPos()

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

Bind block position into statement at column index.

Returns
index of next column after position

References MapDatabase::getBlockAsInteger(), Database_SQLite3::int64_to_sqlite(), Database_SQLite3::int_to_sqlite(), and m_new_format.

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, Database_SQLite3::verifyDatabase(), and warningstream.

Here is the call graph for this function:

◆ initStatements()

void MapDatabaseSQLite3::initStatements ( )
protectedvirtual

Implements Database_SQLite3.

References Database_SQLite3::checkColumn(), Database_SQLite3::checkTable(), infostream, m_new_format, and PREPARE_STATEMENT.

Here is the call graph for this function:

◆ listAllLoadableBlocks()

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

Implements MapDatabase.

References MapDatabase::getIntegerAsBlock(), m_new_format, m_stmt_list, p(), Database_SQLite3::sqlite_to_int(), Database_SQLite3::sqlite_to_int64(), 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, Database_SQLite3::sqlite_to_blob(), and Database_SQLite3::verifyDatabase().

Here is the call graph for this function:

◆ saveBlock()

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

Implements MapDatabase.

References bindPos(), Database_SQLite3::blob_to_sqlite(), m_stmt_write, SQLRES, and Database_SQLite3::verifyDatabase().

Here is the call graph for this function:

Member Data Documentation

◆ m_new_format

bool MapDatabaseSQLite3::m_new_format = false
private

◆ m_stmt_delete

sqlite3_stmt* MapDatabaseSQLite3::m_stmt_delete = nullptr
private

Referenced by deleteBlock().

◆ m_stmt_list

sqlite3_stmt* MapDatabaseSQLite3::m_stmt_list = nullptr
private

Referenced by listAllLoadableBlocks().

◆ m_stmt_read

sqlite3_stmt* MapDatabaseSQLite3::m_stmt_read = nullptr
private

Referenced by loadBlock().

◆ m_stmt_write

sqlite3_stmt* MapDatabaseSQLite3::m_stmt_write = nullptr
private

Referenced by saveBlock().


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