]> git.joonet.de Git - adminer.git/commitdiff
Fix affected rows after getting warnings
authorJakub Vrana <jakub@vrana.cz>
Mon, 5 Feb 2018 08:23:07 +0000 (09:23 +0100)
committerJakub Vrana <jakub@vrana.cz>
Mon, 5 Feb 2018 08:23:07 +0000 (09:23 +0100)
adminer/call.inc.php
adminer/drivers/mysql.inc.php
adminer/sql.inc.php

index 69d963be5a03298bbafafb8a884fa6805946fbcf..89637a0c77c0b54d5255468d3da5748e4bf11c76 100644 (file)
@@ -32,6 +32,7 @@ if (!$error && $_POST) {
        $query = (isset($_GET["callf"]) ? "SELECT" : "CALL") . " " . table($PROCEDURE) . "(" . implode(", ", $call) . ")";
        $start = microtime(true);
        $result = $connection->multi_query($query);
+       $affected = $connection->affected_rows; // getting warnigns overwrites this
        echo $adminer->selectQuery($query, $start, !$result);
        
        if (!$result) {
@@ -47,7 +48,7 @@ if (!$error && $_POST) {
                        if (is_object($result)) {
                                select($result, $connection2);
                        } else {
-                               echo "<p class='message'>" . lang('Routine has been called, %d row(s) affected.', $connection->affected_rows) . "\n";
+                               echo "<p class='message'>" . lang('Routine has been called, %d row(s) affected.', $affected) . "\n";
                        }
                } while ($connection->next_result());
                
index 8244e8ad0edccb105152caf400d458897046c065..2f93e099025f6819b66c57fd50e92ca7ef73d7a3 100644 (file)
@@ -278,9 +278,7 @@ if (!defined("DRIVER")) {
                }
                
                function warnings() {
-                       $affected = $this->_conn->affected_rows;
                        $result = $this->_conn->query("SHOW WARNINGS");
-                       $this->_conn->affected_rows = $affected;
                        if ($result && $result->num_rows) {
                                ob_start();
                                select($result); // select() usually needs to print a big table progressively
index fa20702aefc5d0232998c1629c957d60f7001740..b4cb268ab857e84bdcd98d7ee9bddcea594ee93a 100644 (file)
@@ -130,6 +130,7 @@ if (!$error && $_POST) {
                                                                        $time = " <span class='time'>(" . format_time($start) . ")</span>"
                                                                                . (strlen($q) < 1000 ? " <a href='" . h(ME) . "sql=" . urlencode(trim($q)) . "'>" . lang('Edit') . "</a>" : "") // 1000 - maximum length of encoded URL in IE is 2083 characters
                                                                        ;
+                                                                       $affected = $connection->affected_rows; // getting warnigns overwrites this
                                                                        $warnings = ($_POST["only_errors"] ? "" : $driver->warnings());
                                                                        $warnings_id = "warnings-$commands";
                                                                        if ($warnings) {
@@ -165,7 +166,7 @@ if (!$error && $_POST) {
                                                                                        stop_session();
                                                                                }
                                                                                if (!$_POST["only_errors"]) {
-                                                                                       echo "<p class='message' title='" . h($connection->info) . "'>" . lang('Query executed OK, %d row(s) affected.', $connection->affected_rows) . "$time\n";
+                                                                                       echo "<p class='message' title='" . h($connection->info) . "'>" . lang('Query executed OK, %d row(s) affected.', $affected) . "$time\n";
                                                                                }
                                                                        }
                                                                        echo ($warnings ? "<div id='$warnings_id' class='hidden'>\n$warnings</div>\n" : "");