affected rows are returned in case of DELETE with no WHERE clause, at least since MySQL 4.0.x

This commit is contained in:
Marc Delisle
2006-01-25 14:49:40 +00:00
parent ee90fc123c
commit c7d4963897

View File

@@ -353,7 +353,9 @@ else {
// 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
// this case)
// Note: testing shows that this no longer applies since MySQL 4.0.x
if (PMA_MYSQL_INT_VERSION < 40000) {
if ($is_delete
&& preg_match('@^DELETE([[:space:]].+)?(FROM[[:space:]](.+))$@i', $sql_query, $parts)
&& !preg_match('@[[:space:]]WHERE[[:space:]]@i', $parts[3])) {
@@ -365,6 +367,7 @@ else {
$num_rows = 0;
}
}
}
// E x e c u t e t h e q u e r y