MySQL: Display warnings in SQL command
This commit is contained in:
parent
2fb2d208c0
commit
2adc174541
|
@ -277,6 +277,10 @@ if (!defined("DRIVER")) {
|
||||||
return queries($prefix . implode(",\n", $values) . $suffix);
|
return queries($prefix . implode(",\n", $values) . $suffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function warnings() {
|
||||||
|
return $this->_conn->query("SHOW WARNINGS");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -99,12 +99,25 @@
|
||||||
return queries("BEGIN");
|
return queries("BEGIN");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Commit transaction
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
function commit() {
|
function commit() {
|
||||||
return queries("COMMIT");
|
return queries("COMMIT");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Rollback transaction
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
function rollback() {
|
function rollback() {
|
||||||
return queries("ROLLBACK");
|
return queries("ROLLBACK");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Get warnings about the last command
|
||||||
|
* @return resource or false
|
||||||
|
*/
|
||||||
|
function warnings() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -415,7 +415,7 @@ function get_key_vals($query, $connection2 = null, $timeout = 0, $set_keys = tru
|
||||||
* @param string
|
* @param string
|
||||||
* @param Min_DB
|
* @param Min_DB
|
||||||
* @param string
|
* @param string
|
||||||
* @return array associative
|
* @return array of associative arrays
|
||||||
*/
|
*/
|
||||||
function get_rows($query, $connection2 = null, $error = "<p class='error'>") {
|
function get_rows($query, $connection2 = null, $error = "<p class='error'>") {
|
||||||
global $connection;
|
global $connection;
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
<?php
|
<?php
|
||||||
$VERSION = "4.5.1-dev";
|
$VERSION = "4.6.0-dev";
|
||||||
|
|
|
@ -52,6 +52,7 @@ $translations = array(
|
||||||
'Query executed OK, %d row(s) affected.' => array('Příkaz proběhl v pořádku, byl změněn %d záznam.', 'Příkaz proběhl v pořádku, byly změněny %d záznamy.', 'Příkaz proběhl v pořádku, bylo změněno %d záznamů.'),
|
'Query executed OK, %d row(s) affected.' => array('Příkaz proběhl v pořádku, byl změněn %d záznam.', 'Příkaz proběhl v pořádku, byly změněny %d záznamy.', 'Příkaz proběhl v pořádku, bylo změněno %d záznamů.'),
|
||||||
'No commands to execute.' => 'Žádné příkazy k vykonání.',
|
'No commands to execute.' => 'Žádné příkazy k vykonání.',
|
||||||
'Error in query' => 'Chyba v dotazu',
|
'Error in query' => 'Chyba v dotazu',
|
||||||
|
'Warnings' => 'Varování',
|
||||||
'ATTACH queries are not supported.' => 'Dotazy ATTACH nejsou podporované.',
|
'ATTACH queries are not supported.' => 'Dotazy ATTACH nejsou podporované.',
|
||||||
'Execute' => 'Provést',
|
'Execute' => 'Provést',
|
||||||
'Stop on error' => 'Zastavit při chybě',
|
'Stop on error' => 'Zastavit při chybě',
|
||||||
|
|
|
@ -52,6 +52,7 @@ $translations = array(
|
||||||
'Query executed OK, %d row(s) affected.' => array('Xx, %d.', 'Xx, %d.'),
|
'Query executed OK, %d row(s) affected.' => array('Xx, %d.', 'Xx, %d.'),
|
||||||
'No commands to execute.' => 'Xx.',
|
'No commands to execute.' => 'Xx.',
|
||||||
'Error in query' => 'Xx',
|
'Error in query' => 'Xx',
|
||||||
|
'Warnings' => 'Xx',
|
||||||
'ATTACH queries are not supported.' => 'Xx.',
|
'ATTACH queries are not supported.' => 'Xx.',
|
||||||
'Execute' => 'Xx',
|
'Execute' => 'Xx',
|
||||||
'Stop on error' => 'Xx',
|
'Stop on error' => 'Xx',
|
||||||
|
|
|
@ -117,9 +117,6 @@ if (!$error && $_POST) {
|
||||||
|
|
||||||
do {
|
do {
|
||||||
$result = $connection->store_result();
|
$result = $connection->store_result();
|
||||||
$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
|
|
||||||
;
|
|
||||||
|
|
||||||
if ($connection->error) {
|
if ($connection->error) {
|
||||||
echo ($_POST["only_errors"] ? $print : "");
|
echo ($_POST["only_errors"] ? $print : "");
|
||||||
|
@ -129,7 +126,16 @@ if (!$error && $_POST) {
|
||||||
break 2;
|
break 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
} elseif (is_object($result)) {
|
} else {
|
||||||
|
$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
|
||||||
|
;
|
||||||
|
$warnings = $driver->warnings();
|
||||||
|
$warnings_id = "warnings-$commands";
|
||||||
|
if ($warnings && $warnings->num_rows) {
|
||||||
|
$time .= ", <a href='#$warnings_id'>" . lang('Warnings') . "</a>" . script("qsl('a').onclick = partial(toggle, '$warnings_id');", "");
|
||||||
|
}
|
||||||
|
if (is_object($result)) {
|
||||||
$limit = $_POST["limit"];
|
$limit = $_POST["limit"];
|
||||||
$orgtables = select($result, $connection2, array(), $limit);
|
$orgtables = select($result, $connection2, array(), $limit);
|
||||||
if (!$_POST["only_errors"]) {
|
if (!$_POST["only_errors"]) {
|
||||||
|
@ -166,6 +172,12 @@ if (!$error && $_POST) {
|
||||||
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.', $connection->affected_rows) . "$time\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($warnings && $warnings->num_rows && (!$_POST["only_errors"] || is_object($result))) {
|
||||||
|
echo "<div id='$warnings_id' class='hidden'>\n";
|
||||||
|
select($warnings);
|
||||||
|
echo "</div>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$start = microtime(true);
|
$start = microtime(true);
|
||||||
} while ($connection->next_result());
|
} while ($connection->next_result());
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
Adminer 4.5.1-dev:
|
Adminer 4.6.0-dev:
|
||||||
Fix counting selected rows after going back to select page
|
Fix counting selected rows after going back to select page
|
||||||
PHP <5.3 compatibility even with Elasticsearch enabled
|
PHP <5.3 compatibility even with Elasticsearch enabled
|
||||||
Fully support functions in default values
|
Fully support functions in default values
|
||||||
Stop redirecting links via adminer.org
|
Stop redirecting links via adminer.org
|
||||||
|
MySQL: Display warnings in SQL command
|
||||||
MariaDB: Support JSON since MariaDB 10.2
|
MariaDB: Support JSON since MariaDB 10.2
|
||||||
PostgreSQL: Support functions
|
PostgreSQL: Support functions
|
||||||
PostgreSQL: Allow editing views with uppercase letters (bug #467)
|
PostgreSQL: Allow editing views with uppercase letters (bug #467)
|
||||||
|
|
Loading…
Reference in a new issue