Bug #706 mysql_fetch_row doesn't reset errorcode

Submitted: 24 Jun 2003 3:09 Modified: 27 Aug 2003 0:39
Reporter: Georg Richter Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:all OS:Any (all)
Assigned to: Jani Tolonen CPU Architecture:Any

[24 Jun 2003 3:09] Georg Richter
Description:
I'm not sure if it's a bug or a documentation problem. Some calls like mysql_fetch_row don't set mysql->net.lasterror to 0

How to repeat:
....
// Valid call
mysql_query(mysql, "SELECT a FROM test");
res = mysql_store_result(mysql);

// invalid call
mysql_query(mysql, "THIS DOESN'T WORK!");
printf ("%d\n", mysql_errno(mysql));

row = mysql_fetch_row(res);
printf ("%d\n", mysql_errno(mysql));

Output:
1064
1064
[27 Aug 2003 0:39] Michael Widenius
This is not a bug.  The intention is that mysql_error() and mysql_errno() are only well defined if you get an error for the previous statement. (A bit like 'errno' in C).

I have updated the documentation with this and added a note that some functions does reset mysql_error() if they succeed. The most important ones regarding this is mysql_store_result() and mysql_use_result().

Regards,
Monty

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.049 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
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.