diff --git a/ChangeLog b/ChangeLog index fe1988a7a..bea577eac 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,10 @@ phpMyAdmin - Changelog $Id$ $Source$ +2004-03-13 Marc Delisle + * sql.php: bug 913630: did not detect correctly DELETE FROM table + and even if detected, was calling a non-existent PMA_DBI_result() + 2004-03-10 Marc Delisle * libraries/relation.lib.php: bug 877359, no CONSTRAINT in SHOW CREATE TABLE on older MySQL versions diff --git a/sql.php b/sql.php index 0f48a0689..d9fec500a 100644 --- a/sql.php +++ b/sql.php @@ -294,12 +294,13 @@ 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) + if ($is_delete - && preg_match('@^DELETE([[:space:]].+)?([[:space:]]FROM[[:space:]](.+))$@i', $sql_query, $parts) + && preg_match('@^DELETE([[:space:]].+)?(FROM[[:space:]](.+))$@i', $sql_query, $parts) && !preg_match('@[[:space:]]WHERE[[:space:]]@i', $parts[3])) { - $cnt_all_result = @PMA_DBI_try_query('SELECT COUNT(*) as count' . $parts[2]); + $cnt_all_result = @PMA_DBI_try_query('SELECT COUNT(*) as count ' . $parts[2]); if ($cnt_all_result) { - $num_rows = PMA_DBI_result($cnt_all_result, 0, 'count'); + list($num_rows) = PMA_DBI_fetch_row($cnt_all_result); PMA_DBI_free_result($cnt_all_result); } else { $num_rows = 0;