Show results of REPLACE as affected as it contains both deleted and inserted rows count (bug #1475765).
This commit is contained in:
@@ -9,6 +9,8 @@ $Source$
|
|||||||
* Documentation.html, libraries/config.default.php,
|
* Documentation.html, libraries/config.default.php,
|
||||||
libraries/auth/cookie.auth.lib.php: Logout from all servers by default
|
libraries/auth/cookie.auth.lib.php: Logout from all servers by default
|
||||||
(RFE #1370874).
|
(RFE #1370874).
|
||||||
|
* sql.php: Show results of REPLACE as affected as it contains both deleted
|
||||||
|
and inserted rows count (bug #1475765).
|
||||||
|
|
||||||
2006-04-26 Michal Čihař <michal@cihar.com>
|
2006-04-26 Michal Čihař <michal@cihar.com>
|
||||||
* libraries/plugin_interface.lib.php:
|
* libraries/plugin_interface.lib.php:
|
||||||
|
12
sql.php
12
sql.php
@@ -315,7 +315,7 @@ else {
|
|||||||
// TODO: detect all this with the parser, to avoid problems finding
|
// TODO: detect all this with the parser, to avoid problems finding
|
||||||
// those strings in comments or backquoted identifiers
|
// those strings in comments or backquoted identifiers
|
||||||
|
|
||||||
$is_explain = $is_count = $is_export = $is_delete = $is_insert = $is_affected = $is_show = $is_maint = $is_analyse = $is_group = $is_func = false;
|
$is_explain = $is_count = $is_export = $is_delete = $is_insert = $is_affected = $is_show = $is_maint = $is_analyse = $is_group = $is_func = $is_replace = false;
|
||||||
if ($is_select) { // see line 141
|
if ($is_select) { // see line 141
|
||||||
$is_group = preg_match('@(GROUP[[:space:]]+BY|HAVING|SELECT[[:space:]]+DISTINCT)[[:space:]]+@i', $sql_query);
|
$is_group = preg_match('@(GROUP[[:space:]]+BY|HAVING|SELECT[[:space:]]+DISTINCT)[[:space:]]+@i', $sql_query);
|
||||||
$is_func = !$is_group && (preg_match('@[[:space:]]+(SUM|AVG|STD|STDDEV|MIN|MAX|BIT_OR|BIT_AND)\s*\(@i', $sql_query));
|
$is_func = !$is_group && (preg_match('@[[:space:]]+(SUM|AVG|STD|STDDEV|MIN|MAX|BIT_OR|BIT_AND)\s*\(@i', $sql_query));
|
||||||
@@ -330,6 +330,9 @@ else {
|
|||||||
} elseif (preg_match('@^(INSERT|LOAD[[:space:]]+DATA|REPLACE)[[:space:]]+@i', $sql_query)) {
|
} elseif (preg_match('@^(INSERT|LOAD[[:space:]]+DATA|REPLACE)[[:space:]]+@i', $sql_query)) {
|
||||||
$is_insert = true;
|
$is_insert = true;
|
||||||
$is_affected = true;
|
$is_affected = true;
|
||||||
|
if (preg_match('@^(REPLACE)[[:space:]]+@i', $sql_query)) {
|
||||||
|
$is_replace = true;
|
||||||
|
}
|
||||||
} elseif (preg_match('@^UPDATE[[:space:]]+@i', $sql_query)) {
|
} elseif (preg_match('@^UPDATE[[:space:]]+@i', $sql_query)) {
|
||||||
$is_affected = true;
|
$is_affected = true;
|
||||||
} elseif (preg_match('@^SHOW[[:space:]]+@i', $sql_query)) {
|
} elseif (preg_match('@^SHOW[[:space:]]+@i', $sql_query)) {
|
||||||
@@ -620,7 +623,12 @@ else {
|
|||||||
if ($is_delete) {
|
if ($is_delete) {
|
||||||
$message = $strDeletedRows . ' ' . $num_rows;
|
$message = $strDeletedRows . ' ' . $num_rows;
|
||||||
} elseif ($is_insert) {
|
} elseif ($is_insert) {
|
||||||
$message = $strInsertedRows . ' ' . $num_rows;
|
if ($is_replace) {
|
||||||
|
/* For replace we get DELETED + INSERTED row count, so we have to call it affected */
|
||||||
|
$message = $strAffectedRows . ' ' . $num_rows;
|
||||||
|
} else {
|
||||||
|
$message = $strInsertedRows . ' ' . $num_rows;
|
||||||
|
}
|
||||||
$insert_id = PMA_DBI_insert_id();
|
$insert_id = PMA_DBI_insert_id();
|
||||||
if ($insert_id != 0) {
|
if ($insert_id != 0) {
|
||||||
// insert_id is id of FIRST record inserted in one insert, so if we inserted multiple rows, we had to increment this
|
// insert_id is id of FIRST record inserted in one insert, so if we inserted multiple rows, we had to increment this
|
||||||
|
Reference in New Issue
Block a user