Otclient
14/8/2020
|
#include <database.h>
Public Member Functions | |
Database () | |
virtual | ~Database () |
virtual void | connect (const std::string &host, const std::string &user, const std::string &pass, const std::string &db, uint16 port, const std::string &unix_socket="") |
virtual bool | beginTransaction () |
virtual bool | rollback () |
virtual bool | commit () |
virtual bool | executeQuery (const std::string &query) |
virtual DBResultPtr | storeQuery (const std::string &query) |
virtual std::string | escapeString (const std::string &) |
virtual std::string | escapeBlob (const char *, uint32) |
virtual uint64 | getLastInsertedRowID () |
virtual std::string | getStringComparer () |
virtual std::string | getUpdateLimiter () |
virtual Fw::DatabaseEngine | getDatabaseEngine () |
bool | isConnected () |
Public Member Functions inherited from LuaObject | |
LuaObject () | |
virtual | ~LuaObject () |
template<typename T > | |
void | connectLuaField (const std::string &field, const std::function< T > &f, bool pushFront=false) |
template<typename... T> | |
int | luaCallLuaField (const std::string &field, const T &... args) |
template<typename R , typename... T> | |
R | callLuaField (const std::string &field, const T &... args) |
template<typename... T> | |
void | callLuaField (const std::string &field, const T &... args) |
bool | hasLuaField (const std::string &field) |
Returns true if the lua field exists. More... | |
template<typename T > | |
void | setLuaField (const std::string &key, const T &value) |
Sets a field in this lua object. More... | |
template<typename T > | |
T | getLuaField (const std::string &key) |
Gets a field from this lua object. More... | |
void | releaseLuaFieldsTable () |
Release fields table reference. More... | |
void | luaSetField (const std::string &key) |
Sets a field from this lua object, the value must be on the stack. More... | |
void | luaGetField (const std::string &key) |
Gets a field from this lua object, the result is pushed onto the stack. More... | |
void | luaGetMetatable () |
Get object's metatable. More... | |
void | luaGetFieldsTable () |
Gets the table containing all stored fields of this lua object, the result is pushed onto the stack. More... | |
int | getUseCount () |
std::string | getClassName () |
Returns the derived class name, its the same name used in Lua. More... | |
LuaObjectPtr | asLuaObject () |
void | operator= (const LuaObject &) |
Public Member Functions inherited from stdext::shared_object | |
shared_object () | |
virtual | ~shared_object () |
void | add_ref () |
void | dec_ref () |
refcount_t | ref_count () |
template<typename T > | |
stdext::shared_object_ptr< T > | static_self_cast () |
template<typename T > | |
stdext::shared_object_ptr< T > | dynamic_self_cast () |
template<typename T > | |
stdext::shared_object_ptr< T > | const_self_cast () |
Protected Member Functions | |
void | setConnected (bool connected) |
virtual bool | handleError () |
virtual bool | internalExecuteQuery (const std::string &query) |
DBResultPtr | verifyResult (DBResultPtr result) |
Protected Attributes | |
ticks_t | m_use |
bool | m_connected |
Friends | |
class | DBTransaction |
Definition at line 31 of file database.h.
|
inline |
Definition at line 36 of file database.h.
|
inlinevirtual |
Definition at line 37 of file database.h.
|
inlinevirtual |
Transaction related methods.
Methods for starting, commiting and rolling back transaction. Each of the returns boolean value.
Reimplemented in DatabaseMySQL.
Definition at line 57 of file database.h.
|
inlinevirtual |
Reimplemented in DatabaseMySQL.
Definition at line 59 of file database.h.
|
inlinevirtual |
Database connector.
Connects the database to the source host.
Reimplemented in DatabaseMySQL.
Definition at line 44 of file database.h.
|
inlinevirtual |
Escapes binary stream for query.
Prepares binary stream to fit SQL queries.
char* | binary stream |
long | stream length |
Reimplemented in DatabaseMySQL.
Definition at line 100 of file database.h.
|
inlinevirtual |
Escapes string for query.
Prepares string to fit SQL queries including quoting it.
std::string | string to be escaped |
Reimplemented in DatabaseMySQL.
Definition at line 89 of file database.h.
|
inlinevirtual |
Executes command.
Executes query which doesn't generates results (eg. INSERT, UPDATE, DELETE...).
std::string | query command |
Reimplemented in DatabaseMySQL.
Definition at line 69 of file database.h.
|
inlinevirtual |
Get database engine
Reimplemented in DatabaseMySQL.
Definition at line 122 of file database.h.
|
inlinevirtual |
Retrieve id of last inserted row
Reimplemented in DatabaseMySQL.
Definition at line 107 of file database.h.
|
inlinevirtual |
Get case insensitive string comparison operator
Definition at line 114 of file database.h.
|
inlinevirtual |
|
inlineprotectedvirtual |
Reimplemented in DatabaseMySQL.
Definition at line 141 of file database.h.
|
inlineprotectedvirtual |
Reimplemented in DatabaseMySQL.
Definition at line 142 of file database.h.
|
inline |
Database connected.
Returns whether or not the database is connected.
Definition at line 131 of file database.h.
|
inlinevirtual |
Reimplemented in DatabaseMySQL.
Definition at line 58 of file database.h.
|
inlineprotected |
Database set connected.
Sets the database to know that it is connected.
Definition at line 139 of file database.h.
|
inlinevirtual |
Queries database.
Executes query which generates results (mostly SELECT).
std::string | query |
Reimplemented in DatabaseMySQL.
Definition at line 79 of file database.h.
|
protected |
|
friend |
Definition at line 34 of file database.h.
|
protected |
Definition at line 147 of file database.h.
|
protected |
Definition at line 146 of file database.h.