mirror of
https://github.com/php/php-src.git
synced 2024-11-25 02:44:58 +08:00
strictly check the result of mysql_affected_rows()
This commit is contained in:
parent
fa4ea0fff4
commit
8899425e26
@ -225,7 +225,8 @@ static long mysql_handle_doer(pdo_dbh_t *dbh, const char *sql, long sql_len TSRM
|
||||
pdo_mysql_error(dbh);
|
||||
return -1;
|
||||
} else {
|
||||
return mysql_affected_rows(H->server);
|
||||
my_ulonglong c= mysql_affected_rows(H->server);
|
||||
return c != (my_ulonglong)-1 ? c:-1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user