Otclient  14/8/2020
MySQLResult Class Reference

#include <mysql.h>

Inheritance diagram for MySQLResult:
Collaboration diagram for MySQLResult:

Public Member Functions

 MySQLResult (MYSQL_RES *result)
 
virtual ~MySQLResult ()
 
virtual int32 getDataInt (const std::string &s)
 
virtual int64 getDataLong (const std::string &s)
 
virtual std::string getDataString (const std::string &s)
 
virtual const char * getDataStream (const std::string &s, uint64 &size)
 
virtual void free ()
 
virtual bool next ()
 
virtual int getRowCount ()
 
- Public Member Functions inherited from DBResult
 DBResult ()
 
virtual ~DBResult ()
 
- 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>
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 >
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 Types

typedef std::map< const std::string, uint32RowNames_t
 

Protected Attributes

RowNames_t m_names
 
MYSQL_RES * m_result
 
MYSQL_ROW m_row
 

Friends

class DatabaseMySQL
 

Detailed Description

Definition at line 65 of file mysql.h.

Member Typedef Documentation

◆ RowNames_t

typedef std::map<const std::string, uint32> MySQLResult::RowNames_t
protected

Definition at line 84 of file mysql.h.

Constructor & Destructor Documentation

◆ MySQLResult()

MySQLResult::MySQLResult ( MYSQL_RES *  result)

Definition at line 267 of file mysql.cpp.

◆ ~MySQLResult()

MySQLResult::~MySQLResult ( )
virtual

Definition at line 261 of file mysql.cpp.

Member Function Documentation

◆ free()

void MySQLResult::free ( )
virtual

Result freeing

Reimplemented from DBResult.

Definition at line 244 of file mysql.cpp.

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

◆ getDataInt()

int32 MySQLResult::getDataInt ( const std::string &  )
virtual

Get the Integer value of a field in database

Returns
The Integer value of the selected field and row
Parameters
sThe name of the field

Reimplemented from DBResult.

Definition at line 198 of file mysql.cpp.

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

◆ getDataLong()

int64 MySQLResult::getDataLong ( const std::string &  )
virtual

Get the Long value of a field in database

Returns
The Long value of the selected field and row
Parameters
sThe name of the field

Reimplemented from DBResult.

Definition at line 208 of file mysql.cpp.

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

◆ getDataStream()

const char * MySQLResult::getDataStream ( const std::string &  ,
uint64  
)
virtual

Get the blob of a field in database

Returns
a PropStream that is initiated with the blob data field, if not exist it returns NULL.
Parameters
sThe name of the field

Reimplemented from DBResult.

Definition at line 228 of file mysql.cpp.

Here is the call graph for this function:

◆ getDataString()

std::string MySQLResult::getDataString ( const std::string &  )
virtual

Get the String of a field in database

Returns
The String of the selected field and row
Parameters
sThe name of the field

Reimplemented from DBResult.

Definition at line 218 of file mysql.cpp.

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

◆ getRowCount()

virtual int MySQLResult::getRowCount ( )
inlinevirtual

Returned the number of rows from result

Returns
integer value of row amount, 0 if result is empty.

Reimplemented from DBResult.

Definition at line 81 of file mysql.h.

Here is the caller graph for this function:

◆ next()

bool MySQLResult::next ( )
virtual

Moves to next result in set

Returns
true if moved, false if there are no more results.

Reimplemented from DBResult.

Definition at line 255 of file mysql.cpp.

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ DatabaseMySQL

friend class DatabaseMySQL
friend

Definition at line 68 of file mysql.h.

Member Data Documentation

◆ m_names

RowNames_t MySQLResult::m_names
protected

Definition at line 85 of file mysql.h.

◆ m_result

MYSQL_RES* MySQLResult::m_result
protected

Definition at line 87 of file mysql.h.

◆ m_row

MYSQL_ROW MySQLResult::m_row
protected

Definition at line 88 of file mysql.h.


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