diff options
| author | Ilia Alshanetsky <iliaa@php.net> | 2005-09-14 15:34:58 +0000 |
|---|---|---|
| committer | Ilia Alshanetsky <iliaa@php.net> | 2005-09-14 15:34:58 +0000 |
| commit | 766e4b3c15a307290194d76347aec3948e5d14bb (patch) | |
| tree | 841c72965ccf33f62953191d7b0eb7621ba2d89f /ext/pdo_mysql/mysql_driver.c | |
| parent | bab59278d74a92e56c843da7009b847adb4668a6 (diff) | |
| download | php-git-766e4b3c15a307290194d76347aec3948e5d14bb.tar.gz | |
MFH: Fix error detection for queries such as OPTIMIZE
Diffstat (limited to 'ext/pdo_mysql/mysql_driver.c')
| -rwxr-xr-x | ext/pdo_mysql/mysql_driver.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/ext/pdo_mysql/mysql_driver.c b/ext/pdo_mysql/mysql_driver.c index c017e97920..f4544a3c0f 100755 --- a/ext/pdo_mysql/mysql_driver.c +++ b/ext/pdo_mysql/mysql_driver.c @@ -234,8 +234,13 @@ static long mysql_handle_doer(pdo_dbh_t *dbh, const char *sql, long sql_len TSRM pdo_mysql_error(dbh); return -1; } else { - my_ulonglong c= mysql_affected_rows(H->server); - return c != (my_ulonglong)-1 ? c:(pdo_mysql_error(dbh),-1); + my_ulonglong c = mysql_affected_rows(H->server); + if (c != (my_ulonglong) -1) { + pdo_mysql_error(dbh); + return (H->einfo.errcode ? -1 : 0); + } else { + return c; + } } } |
