| 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: | |
| Category: | MySQL Server | Severity: | S3 (Non-critical) |
| Version: | all | OS: | Any (all) |
| Assigned to: | Jani Tolonen | CPU Architecture: | Any |
[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

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