mysql_use_result returns NULL but no error set?
Posted by: Daniel Chiaramello
Date: October 15, 2012 08:56AM

Hello.

I have a problem at one of our customers, who runs MySQL 5.5.8.

I have something like the following code:

MYSQL_RES *res;
MYSQL_ROW row;
MYSQL* mysql = XXX();
uint32 ret;
char* sqlQuery = "SELECT MAX(id) FROM mytable";

ret = mysql_real_query(mysql, sqlQuery, (unsigned int)strlen(sqlQuery));
if (ret != 0)
{
  printf("### Error mysql_real_query: '%s'", mysql_error(mysql));
  return;
}

res = mysql_use_result(mysql);
if (res == NULL)
{
  printf("### Error mysql_use_result: '%s'", mysql_error(mysql));
  return;
}
...

But I have the following result:
### Error mysql_use_result: ''

I don't understand why mysql_use_result would return NULL and mysql_error is not set. By the way, there is also no reason why mysql_use_result returns NULL (the table is present and the request is returning value when run manually), but that's another story...

Did you already have this problem, of having a function returning an error but the error is not set??? Where could I look to find more investigation elements?

Thanks for your attention,
Daniel

Options: ReplyQuote


Subject
Views
Written By
Posted
mysql_use_result returns NULL but no error set?
2254
October 15, 2012 08:56AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.