bug 913630 deleted rows 0

This commit is contained in:
Marc Delisle
2004-03-13 13:38:40 +00:00
parent ff79c198b8
commit f81459a5d2
2 changed files with 8 additions and 3 deletions

View File

@@ -5,6 +5,10 @@ phpMyAdmin - Changelog
$Id$
$Source$
2004-03-13 Marc Delisle <lem9@users.sourceforge.net>
* 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 <lem9@users.sourceforge.net>
* libraries/relation.lib.php: bug 877359, no CONSTRAINT in
SHOW CREATE TABLE on older MySQL versions

View File

@@ -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;