From: Ilia Alshanetsky Date: Wed, 14 Sep 2005 15:34:42 +0000 (+0000) Subject: Fix error detection for queries such as OPTIMIZE X-Git-Tag: RELEASE_0_9_0~218 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f7a4a852df7e9774ef56c2ba43e0d51c74bd080d;p=php Fix error detection for queries such as OPTIMIZE --- diff --git a/ext/pdo_mysql/mysql_driver.c b/ext/pdo_mysql/mysql_driver.c index 75c7fc2cac..d97e350298 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; + } } }