diff options
author | Andrey Hristov <andrey@php.net> | 2005-07-12 19:22:05 +0000 |
---|---|---|
committer | Andrey Hristov <andrey@php.net> | 2005-07-12 19:22:05 +0000 |
commit | 8899425e26b8d9653e122b5b4aee8a410040146a (patch) | |
tree | 97c2ba350562c0df982e824f255528b77934752b /ext/pdo_mysql/mysql_statement.c | |
parent | fa4ea0fff4873821c30f434c0c9a85ba588d59be (diff) | |
download | php-git-8899425e26b8d9653e122b5b4aee8a410040146a.tar.gz |
strictly check the result of mysql_affected_rows()
Diffstat (limited to 'ext/pdo_mysql/mysql_statement.c')
-rwxr-xr-x | ext/pdo_mysql/mysql_statement.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/ext/pdo_mysql/mysql_statement.c b/ext/pdo_mysql/mysql_statement.c index 0051313b71..6527496e75 100755 --- a/ext/pdo_mysql/mysql_statement.c +++ b/ext/pdo_mysql/mysql_statement.c @@ -155,9 +155,12 @@ static int pdo_mysql_stmt_execute(pdo_stmt_t *stmt TSRMLS_DC) } } - - stmt->row_count = mysql_stmt_affected_rows(S->stmt); - return 1; + ; + if ((row_count= mysql_stmt_affected_rows(S->stmt)) != (my_ulonglong)-1) { + stmt->row_count = row_count; + return 1; + } + return 0; } #endif /* ensure that we free any previous unfetched results */ @@ -222,7 +225,11 @@ static int pdo_mysql_stmt_next_rowset(pdo_stmt_t *stmt TSRMLS_DC) /* No more results */ return 0; } else { - row_count = mysql_affected_rows(H->server); + if ((my_ulonglong)-1 == (row_count = mysql_affected_rows(H->server))) { + pdo_mysql_error_stmt(stmt); + return 0; + } + if (!H->buffered) { S->result = mysql_use_result(H->server); } else { |