summaryrefslogtreecommitdiff
path: root/ext/pdo_mysql
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2005-09-14 15:34:42 +0000
committerIlia Alshanetsky <iliaa@php.net>2005-09-14 15:34:42 +0000
commitf7a4a852df7e9774ef56c2ba43e0d51c74bd080d (patch)
tree6876d5aeece6759aeadb5fbb70a726fcd357f332 /ext/pdo_mysql
parent6e3d5a9e227416d294373760cca09f17c43b12dc (diff)
downloadphp-git-f7a4a852df7e9774ef56c2ba43e0d51c74bd080d.tar.gz
Fix error detection for queries such as OPTIMIZE
Diffstat (limited to 'ext/pdo_mysql')
-rwxr-xr-xext/pdo_mysql/mysql_driver.c9
1 files changed, 7 insertions, 2 deletions
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;
+ }
}
}