affected rows are returned in case of DELETE with no WHERE clause, at least since MySQL 4.0.x
This commit is contained in:
21
sql.php
21
sql.php
@@ -353,16 +353,19 @@ else {
|
|||||||
// If the query is a DELETE query with no WHERE clause, get the number of
|
// If the query is a DELETE query with no WHERE clause, get the number of
|
||||||
// rows that will be deleted (mysql_affected_rows will always return 0 in
|
// rows that will be deleted (mysql_affected_rows will always return 0 in
|
||||||
// this case)
|
// this case)
|
||||||
|
// Note: testing shows that this no longer applies since MySQL 4.0.x
|
||||||
|
|
||||||
if ($is_delete
|
if (PMA_MYSQL_INT_VERSION < 40000) {
|
||||||
&& preg_match('@^DELETE([[:space:]].+)?(FROM[[:space:]](.+))$@i', $sql_query, $parts)
|
if ($is_delete
|
||||||
&& !preg_match('@[[:space:]]WHERE[[:space:]]@i', $parts[3])) {
|
&& preg_match('@^DELETE([[:space:]].+)?(FROM[[:space:]](.+))$@i', $sql_query, $parts)
|
||||||
$cnt_all_result = @PMA_DBI_try_query('SELECT COUNT(*) as count ' . $parts[2]);
|
&& !preg_match('@[[:space:]]WHERE[[:space:]]@i', $parts[3])) {
|
||||||
if ($cnt_all_result) {
|
$cnt_all_result = @PMA_DBI_try_query('SELECT COUNT(*) as count ' . $parts[2]);
|
||||||
list($num_rows) = PMA_DBI_fetch_row($cnt_all_result);
|
if ($cnt_all_result) {
|
||||||
PMA_DBI_free_result($cnt_all_result);
|
list($num_rows) = PMA_DBI_fetch_row($cnt_all_result);
|
||||||
} else {
|
PMA_DBI_free_result($cnt_all_result);
|
||||||
$num_rows = 0;
|
} else {
|
||||||
|
$num_rows = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user