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

#include <database-sqlite3.h>

+ Inheritance diagram for AuthDatabaseSQLite3:
+ Collaboration diagram for AuthDatabaseSQLite3:

Public Member Functions

 AuthDatabaseSQLite3 (const std::string &savedir)
 
virtual ~AuthDatabaseSQLite3 ()
 
virtual bool getAuth (const std::string &name, AuthEntry &res)
 
virtual bool saveAuth (const AuthEntry &authEntry)
 
virtual bool createAuth (AuthEntry &authEntry)
 
virtual bool deleteAuth (const std::string &name)
 
virtual void listNames (std::vector< std::string > &res)
 
virtual void reload ()
 
- Public Member Functions inherited from AuthDatabase
virtual ~AuthDatabase ()=default
 

Protected Member Functions

virtual void createDatabase ()
 
virtual void initStatements ()
 

Private Member Functions

virtual void writePrivileges (const AuthEntry &authEntry)
 
- 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_read = nullptr
 
sqlite3_stmt * m_stmt_write = nullptr
 
sqlite3_stmt * m_stmt_create = nullptr
 
sqlite3_stmt * m_stmt_delete = nullptr
 
sqlite3_stmt * m_stmt_list_names = nullptr
 
sqlite3_stmt * m_stmt_read_privs = nullptr
 
sqlite3_stmt * m_stmt_write_privs = nullptr
 
sqlite3_stmt * m_stmt_delete_privs = nullptr
 
sqlite3_stmt * m_stmt_last_insert_rowid = nullptr
 
- Private Attributes inherited from Database_SQLite3
sqlite3 * m_database = nullptr
 

Constructor & Destructor Documentation

◆ AuthDatabaseSQLite3()

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

◆ ~AuthDatabaseSQLite3()

Member Function Documentation

◆ createAuth()

bool AuthDatabaseSQLite3::createAuth ( AuthEntry & authEntry)
virtual

◆ createDatabase()

void AuthDatabaseSQLite3::createDatabase ( )
protectedvirtual

Implements Database_SQLite3.

References Database_SQLite3::m_database, and SQLOK.

◆ deleteAuth()

bool AuthDatabaseSQLite3::deleteAuth ( const std::string & name)
virtual

Implements AuthDatabase.

References Database_SQLite3::m_database, m_stmt_delete, Database_SQLite3::sqlite3_vrfy(), Database_SQLite3::str_to_sqlite(), and Database_SQLite3::verifyDatabase().

+ Here is the call graph for this function:

◆ getAuth()

bool AuthDatabaseSQLite3::getAuth ( const std::string & name,
AuthEntry & res )
virtual

◆ initStatements()

void AuthDatabaseSQLite3::initStatements ( )
protectedvirtual

Implements Database_SQLite3.

References PREPARE_STATEMENT.

◆ listNames()

void AuthDatabaseSQLite3::listNames ( std::vector< std::string > & res)
virtual

Implements AuthDatabase.

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

+ Here is the call graph for this function:

◆ reload()

void AuthDatabaseSQLite3::reload ( )
virtual

Implements AuthDatabase.

◆ saveAuth()

bool AuthDatabaseSQLite3::saveAuth ( const AuthEntry & authEntry)
virtual

Implements AuthDatabase.

References Database_SQLite3::beginSave(), Database_SQLite3::endSave(), AuthEntry::id, Database_SQLite3::int64_to_sqlite(), AuthEntry::last_login, m_stmt_write, AuthEntry::name, AuthEntry::password, Database_SQLite3::sqlite3_vrfy(), Database_SQLite3::str_to_sqlite(), and writePrivileges().

+ Here is the call graph for this function:

◆ writePrivileges()

void AuthDatabaseSQLite3::writePrivileges ( const AuthEntry & authEntry)
privatevirtual

References AuthEntry::id, Database_SQLite3::int64_to_sqlite(), m_stmt_delete_privs, m_stmt_write_privs, AuthEntry::privileges, Database_SQLite3::sqlite3_vrfy(), and Database_SQLite3::str_to_sqlite().

Referenced by createAuth(), and saveAuth().

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

Member Data Documentation

◆ m_stmt_create

sqlite3_stmt* AuthDatabaseSQLite3::m_stmt_create = nullptr
private

Referenced by ~AuthDatabaseSQLite3(), and createAuth().

◆ m_stmt_delete

sqlite3_stmt* AuthDatabaseSQLite3::m_stmt_delete = nullptr
private

Referenced by ~AuthDatabaseSQLite3(), and deleteAuth().

◆ m_stmt_delete_privs

sqlite3_stmt* AuthDatabaseSQLite3::m_stmt_delete_privs = nullptr
private

◆ m_stmt_last_insert_rowid

sqlite3_stmt* AuthDatabaseSQLite3::m_stmt_last_insert_rowid = nullptr
private

Referenced by ~AuthDatabaseSQLite3(), and createAuth().

◆ m_stmt_list_names

sqlite3_stmt* AuthDatabaseSQLite3::m_stmt_list_names = nullptr
private

Referenced by ~AuthDatabaseSQLite3(), and listNames().

◆ m_stmt_read

sqlite3_stmt* AuthDatabaseSQLite3::m_stmt_read = nullptr
private

Referenced by ~AuthDatabaseSQLite3(), and getAuth().

◆ m_stmt_read_privs

sqlite3_stmt* AuthDatabaseSQLite3::m_stmt_read_privs = nullptr
private

Referenced by ~AuthDatabaseSQLite3(), and getAuth().

◆ m_stmt_write

sqlite3_stmt* AuthDatabaseSQLite3::m_stmt_write = nullptr
private

Referenced by ~AuthDatabaseSQLite3(), and saveAuth().

◆ m_stmt_write_privs

sqlite3_stmt* AuthDatabaseSQLite3::m_stmt_write_privs = nullptr
private

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