Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
Database_PostgreSQL Class Referenceabstract

#include <database-postgresql.h>

+ Inheritance diagram for Database_PostgreSQL:
+ Collaboration diagram for Database_PostgreSQL:

Public Member Functions

 Database_PostgreSQL (const std::string &connect_string, const char *type)
 
 ~Database_PostgreSQL ()
 
void beginSave ()
 
void endSave ()
 
void rollback ()
 
bool initialized () const
 

Protected Member Functions

int pg_to_int (PGresult *res, int row, int col)
 
u32 pg_to_uint (PGresult *res, int row, int col)
 
float pg_to_float (PGresult *res, int row, int col)
 
v3s16 pg_to_v3s16 (PGresult *res, int row, int col)
 
std::string pg_to_string (PGresult *res, int row, int col)
 
PGresult * execPrepared (const char *stmtName, const int paramsNumber, const void **params, const int *paramsLengths=NULL, const int *paramsFormats=NULL, bool clear=true, bool nobinary=true)
 
PGresult * execPrepared (const char *stmtName, const int paramsNumber, const char **params, bool clear=true, bool nobinary=true)
 
void createTableIfNotExists (const std::string &table_name, const std::string &definition)
 
void verifyDatabase ()
 
void connectToDatabase ()
 
virtual void createDatabase ()=0
 
virtual void initStatements ()=0
 
void prepareStatement (const std::string &name, const std::string &sql)
 
int getPGVersion () const
 

Private Member Functions

void ping ()
 
PGresult * checkResults (PGresult *res, bool clear=true)
 

Private Attributes

std::string m_connect_string
 
PGconn * m_conn = nullptr
 
int m_pgversion = 0
 

Constructor & Destructor Documentation

◆ Database_PostgreSQL()

Database_PostgreSQL::Database_PostgreSQL ( const std::string & connect_string,
const char * type )

◆ ~Database_PostgreSQL()

Database_PostgreSQL::~Database_PostgreSQL ( )

Member Function Documentation

◆ beginSave()

void Database_PostgreSQL::beginSave ( )
virtual

Implements Database.

Reimplemented in MapDatabasePostgreSQL, and ModStorageDatabasePostgreSQL.

Referenced by MapDatabasePostgreSQL::beginSave(), and ModStorageDatabasePostgreSQL::beginSave().

+ Here is the caller graph for this function:

◆ checkResults()

PGresult * Database_PostgreSQL::checkResults ( PGresult * res,
bool clear = true )
private

Referenced by execPrepared(), and prepareStatement().

+ Here is the caller graph for this function:

◆ connectToDatabase()

void Database_PostgreSQL::connectToDatabase ( )
protected

◆ createDatabase()

virtual void Database_PostgreSQL::createDatabase ( )
protectedpure virtual

◆ createTableIfNotExists()

void Database_PostgreSQL::createTableIfNotExists ( const std::string & table_name,
const std::string & definition )
protected

◆ endSave()

void Database_PostgreSQL::endSave ( )
virtual

Implements Database.

Reimplemented in MapDatabasePostgreSQL, and ModStorageDatabasePostgreSQL.

Referenced by MapDatabasePostgreSQL::endSave(), and ModStorageDatabasePostgreSQL::endSave().

+ Here is the caller graph for this function:

◆ execPrepared() [1/2]

PGresult * Database_PostgreSQL::execPrepared ( const char * stmtName,
const int paramsNumber,
const char ** params,
bool clear = true,
bool nobinary = true )
inlineprotected

References execPrepared().

+ Here is the call graph for this function:

◆ execPrepared() [2/2]

PGresult * Database_PostgreSQL::execPrepared ( const char * stmtName,
const int paramsNumber,
const void ** params,
const int * paramsLengths = NULL,
const int * paramsFormats = NULL,
bool clear = true,
bool nobinary = true )
inlineprotected

References checkResults(), and m_conn.

Referenced by execPrepared().

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

◆ getPGVersion()

int Database_PostgreSQL::getPGVersion ( ) const
inlineprotected

References m_pgversion.

◆ initialized()

bool Database_PostgreSQL::initialized ( ) const
virtual

Reimplemented from Database.

◆ initStatements()

virtual void Database_PostgreSQL::initStatements ( )
protectedpure virtual

◆ pg_to_float()

float Database_PostgreSQL::pg_to_float ( PGresult * res,
int row,
int col )
inlineprotected

◆ pg_to_int()

int Database_PostgreSQL::pg_to_int ( PGresult * res,
int row,
int col )
inlineprotected

Referenced by pg_to_v3s16().

+ Here is the caller graph for this function:

◆ pg_to_string()

std::string Database_PostgreSQL::pg_to_string ( PGresult * res,
int row,
int col )
inlineprotected

◆ pg_to_uint()

u32 Database_PostgreSQL::pg_to_uint ( PGresult * res,
int row,
int col )
inlineprotected

◆ pg_to_v3s16()

v3s16 Database_PostgreSQL::pg_to_v3s16 ( PGresult * res,
int row,
int col )
inlineprotected

References pg_to_int().

+ Here is the call graph for this function:

◆ ping()

void Database_PostgreSQL::ping ( )
private

◆ prepareStatement()

void Database_PostgreSQL::prepareStatement ( const std::string & name,
const std::string & sql )
inlineprotected

References checkResults(), and m_conn.

+ Here is the call graph for this function:

◆ rollback()

void Database_PostgreSQL::rollback ( )

◆ verifyDatabase()

void Database_PostgreSQL::verifyDatabase ( )
protected

Referenced by AuthDatabasePostgreSQL::verifyDatabase().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_conn

PGconn* Database_PostgreSQL::m_conn = nullptr
private

Referenced by execPrepared(), and prepareStatement().

◆ m_connect_string

std::string Database_PostgreSQL::m_connect_string
private

◆ m_pgversion

int Database_PostgreSQL::m_pgversion = 0
private

Referenced by getPGVersion().


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