mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 02:11:30 +00:00
fixed issue with row request on null result
This commit is contained in:
parent
12ded4b506
commit
321cf17eac
@ -1,6 +1,6 @@
|
|||||||
#include "MySQLRequestRow.h"
|
#include "MySQLRequestRow.h"
|
||||||
|
|
||||||
MySQLRequestRow::MySQLRequestRow(const MySQLRequestRow& row)
|
MySQLRequestRow::MySQLRequestRow(const MySQLRequestRow& row)
|
||||||
: m_Result(row.m_Result), m_MySQLRow(row.m_MySQLRow)
|
: m_Result(row.m_Result), m_MySQLRow(row.m_MySQLRow)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -26,13 +26,17 @@ MySQLRequestRow& MySQLRequestRow::operator=(MySQLRequestRow& moveItem)
|
|||||||
|
|
||||||
moveItem.m_Result = nullptr;
|
moveItem.m_Result = nullptr;
|
||||||
moveItem.m_MySQLRow = nullptr;
|
moveItem.m_MySQLRow = nullptr;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
MySQLRequestRow::MySQLRequestRow(MYSQL_RES *result)
|
MySQLRequestRow::MySQLRequestRow(MYSQL_RES *result)
|
||||||
: m_Result(result), m_MySQLRow(mysql_fetch_row(m_Result))
|
: m_Result(result)
|
||||||
{
|
{
|
||||||
|
if (result != nullptr)
|
||||||
|
m_MySQLRow = mysql_fetch_row(result);
|
||||||
|
else
|
||||||
|
m_MySQLRow = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
MySQLRequestRow& MySQLRequestRow::operator++()
|
MySQLRequestRow& MySQLRequestRow::operator++()
|
||||||
@ -41,19 +45,19 @@ MySQLRequestRow& MySQLRequestRow::operator++()
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
MySQLRequestRow MySQLRequestRow::operator++(int)
|
MySQLRequestRow MySQLRequestRow::operator++(int)
|
||||||
{
|
{
|
||||||
MySQLRequestRow tmp(*this);
|
MySQLRequestRow tmp(*this);
|
||||||
operator++();
|
operator++();
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MySQLRequestRow::operator==(const MySQLRequestRow& rhs)
|
bool MySQLRequestRow::operator==(const MySQLRequestRow& rhs)
|
||||||
{
|
{
|
||||||
return m_MySQLRow == rhs.m_MySQLRow;
|
return m_MySQLRow == rhs.m_MySQLRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MySQLRequestRow::operator!=(const MySQLRequestRow& rhs)
|
bool MySQLRequestRow::operator!=(const MySQLRequestRow& rhs)
|
||||||
{
|
{
|
||||||
return m_MySQLRow != rhs.m_MySQLRow;
|
return m_MySQLRow != rhs.m_MySQLRow;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -120,8 +120,10 @@ MySQLRequestResult DBcore::QueryDatabase(const char* query, uint32 querylen, boo
|
|||||||
// successful query. get results.
|
// successful query. get results.
|
||||||
MYSQL_RES* res = mysql_store_result(&mysql);
|
MYSQL_RES* res = mysql_store_result(&mysql);
|
||||||
uint32 rowCount = 0;
|
uint32 rowCount = 0;
|
||||||
|
|
||||||
if (res != nullptr)
|
if (res != nullptr)
|
||||||
rowCount = (uint32)mysql_num_rows(res);
|
rowCount = (uint32)mysql_num_rows(res);
|
||||||
|
|
||||||
MySQLRequestResult requestResult(res, (uint32)mysql_affected_rows(&mysql), rowCount, (uint32)mysql_field_count(&mysql), (uint32)mysql_insert_id(&mysql));
|
MySQLRequestResult requestResult(res, (uint32)mysql_affected_rows(&mysql), rowCount, (uint32)mysql_field_count(&mysql), (uint32)mysql_insert_id(&mysql));
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user