mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-23 18:17:46 +00:00
Database refactoring
This commit is contained in:
parent
48c92d6a7f
commit
63346359c7
2 changed files with 12 additions and 12 deletions
|
@ -161,7 +161,7 @@ boost::shared_ptr<QueryResult> Database::query( const std::string& QueryString )
|
|||
|
||||
if( sendQuery(con, QueryString.c_str(), false) )
|
||||
{
|
||||
qResult = boost::shared_ptr<QueryResult>( _StoreQueryResult( con ) );
|
||||
qResult = boost::shared_ptr<QueryResult>( storeQueryResult( con ) );
|
||||
}
|
||||
|
||||
con->lock.unlock();
|
||||
|
@ -259,14 +259,14 @@ bool Database::handleError( DatabaseConnection *con, uint32_t ErrorNumber )
|
|||
case 2055: // Lost connection to sql server - system error
|
||||
{
|
||||
// Let's instruct a reconnect to the db when we encounter these errors.
|
||||
return _Reconnect( con );
|
||||
return reconnect( con );
|
||||
}break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
QueryResult * Database::_StoreQueryResult( DatabaseConnection * con )
|
||||
QueryResult * Database::storeQueryResult( DatabaseConnection * con )
|
||||
{
|
||||
QueryResult *res;
|
||||
MYSQL_RES * pRes = mysql_store_result( con->conn );
|
||||
|
@ -289,7 +289,7 @@ QueryResult * Database::_StoreQueryResult( DatabaseConnection * con )
|
|||
return res;
|
||||
}
|
||||
|
||||
bool Database::_Reconnect( DatabaseConnection * conn )
|
||||
bool Database::reconnect( DatabaseConnection * conn )
|
||||
{
|
||||
MYSQL * temp;
|
||||
MYSQL * temp2;
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace Core {
|
|||
}
|
||||
|
||||
// return as string
|
||||
__inline std::string getString()
|
||||
__inline std::string getString() const
|
||||
{
|
||||
if( !m_pValue )
|
||||
return "";
|
||||
|
@ -38,7 +38,7 @@ namespace Core {
|
|||
}
|
||||
|
||||
// return as string
|
||||
__inline void getBinary( char* dstBuf, uint16_t size )
|
||||
__inline void getBinary( char* dstBuf, uint16_t size ) const
|
||||
{
|
||||
if( m_pValue )
|
||||
{
|
||||
|
@ -51,19 +51,19 @@ namespace Core {
|
|||
}
|
||||
|
||||
// return as float
|
||||
__inline float getFloat()
|
||||
__inline float getFloat() const
|
||||
{
|
||||
return m_pValue ? static_cast< float >( atof( m_pValue ) ) : 0;
|
||||
}
|
||||
|
||||
// return as bool
|
||||
__inline bool getBool()
|
||||
__inline bool getBool() const
|
||||
{
|
||||
return m_pValue ? atoi( m_pValue ) > 0 : false;
|
||||
}
|
||||
|
||||
template< class T >
|
||||
__inline T get()
|
||||
__inline T get() const
|
||||
{
|
||||
if( !m_pValue )
|
||||
return 0;
|
||||
|
@ -71,7 +71,7 @@ namespace Core {
|
|||
return static_cast< T >( atol( m_pValue ) );
|
||||
}
|
||||
|
||||
__inline uint32_t getLength()
|
||||
__inline uint32_t getLength() const
|
||||
{
|
||||
return m_size;
|
||||
}
|
||||
|
@ -175,9 +175,9 @@ namespace Core {
|
|||
|
||||
// actual query function
|
||||
bool sendQuery( DatabaseConnection *con, const std::string &sql, bool Self );
|
||||
QueryResult * _StoreQueryResult( DatabaseConnection * con );
|
||||
QueryResult * storeQueryResult( DatabaseConnection * con );
|
||||
bool handleError( DatabaseConnection *conn, uint32_t ErrorNumber );
|
||||
bool _Reconnect( DatabaseConnection *conn );
|
||||
bool reconnect( DatabaseConnection *conn );
|
||||
|
||||
DatabaseConnection *m_pConnections;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue