Merge branch 'RunQueryToDatabaseQuery_database' of https://github.com/addtheice/Server into DBQuery

This commit is contained in:
KimLS 2014-08-11 12:58:53 -07:00
commit 11abc45e3f
2 changed files with 14 additions and 8 deletions

View File

@ -31,8 +31,12 @@ MySQLRequestRow& MySQLRequestRow::operator=(MySQLRequestRow& moveItem)
}
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++()

View File

@ -120,8 +120,10 @@ MySQLRequestResult DBcore::QueryDatabase(const char* query, uint32 querylen, boo
// successful query. get results.
MYSQL_RES* res = mysql_store_result(&mysql);
uint32 rowCount = 0;
if (res != nullptr)
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));