Fix trying to fetch more MySQL rows than are available.

MySQL returns -1 on error in an unsigned field which was breaking
this.
This commit is contained in:
Sadie Powell 2024-08-04 11:29:49 +01:00
parent 3ad07f7082
commit 6e2f3cef2e

View File

@ -170,7 +170,8 @@ public:
MySQLresult(MYSQL_RES* res, unsigned long affected_rows)
: err(SQL::SUCCESS)
{
if (affected_rows >= 1)
// mysql returns -1 on error even though the return type is unsigned
if (affected_rows >= 1 && affected_rows != (unsigned long)-1)
{
rows = int(affected_rows);
fieldlists.resize(rows);