Name

mysql_eof —

Synopsis

my_bool mysql_eof(MYSQL_RES *result)

Returns a nonzero value if there is no more data in the group of results being examined. If there is an error in the result set, 0 is returned. This function works only if the result set was retrieved with the mysql_use_result function (mysql_store_result retrieves the entire result set, making a call to mysql_eof unnecessary).

Tip

This function has been deprecated in the newer releases of MySQL. The mysql_errno and mysql_error functions return more information about any errors that occur, and they are more reliable.

Example

/* Read through the results until no more data comes out */
while((row = mysql_fetch_row(results))) {
       /* Do work */
}
   
if(!mysql_eof(results))
   printf("Error. End of results not reached.\n");

Get Managing & Using MySQL, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.