mirror of
https://github.com/vrana/adminer.git
synced 2025-08-12 01:24:17 +02:00
Simplify SQL syntax errors everywhere
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1276 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
@@ -30,7 +30,7 @@ if (!$error && $_POST) {
|
||||
}
|
||||
$result = $connection->multi_query((isset($_GET["callf"]) ? "SELECT" : "CALL") . " " . idf_escape($PROCEDURE) . "(" . implode(", ", $call) . ")");
|
||||
if (!$result) {
|
||||
echo "<p class='error'>" . h($connection->error) . "\n";
|
||||
echo "<p class='error'>" . error() . "\n";
|
||||
} else {
|
||||
do {
|
||||
$result = $connection->store_result();
|
||||
|
@@ -246,7 +246,7 @@ function query_redirect($query, $location, $message, $redirect = true, $execute
|
||||
$sql = $adminer->messageQuery($query);
|
||||
}
|
||||
if ($failed) {
|
||||
$error = h($connection->error) . $sql;
|
||||
$error = error() . $sql;
|
||||
return false;
|
||||
}
|
||||
if ($redirect) {
|
||||
|
@@ -372,6 +372,14 @@ function information_schema($db) {
|
||||
return ($connection->server_info >= 5 && $db == "information_schema");
|
||||
}
|
||||
|
||||
/** Get escaped error message
|
||||
* @return string
|
||||
*/
|
||||
function error() {
|
||||
global $connection;
|
||||
return h(preg_replace('~^You have an error.*syntax to use~U', "Syntax error", $connection->error));
|
||||
}
|
||||
|
||||
/** Return expression for binary comparison
|
||||
* @param string
|
||||
* @return string
|
||||
|
@@ -144,7 +144,7 @@ if (isset($rights["insert"])) {
|
||||
$adminer->selectLinks($table_status, $set);
|
||||
|
||||
if (!$columns) {
|
||||
echo "<p class='error'>" . lang('Unable to select the table') . ($fields ? "" : ": " . h($connection->error)) . ".\n";
|
||||
echo "<p class='error'>" . lang('Unable to select the table') . ($fields ? "" : ": " . error()) . ".\n";
|
||||
} else {
|
||||
echo "<form action='' id='form'>\n";
|
||||
echo "<div style='display: none;'>";
|
||||
@@ -165,7 +165,7 @@ if (!$columns) {
|
||||
|
||||
$result = $connection->query($query);
|
||||
if (!$result) {
|
||||
echo "<p class='error'>" . h($connection->error) . "\n";
|
||||
echo "<p class='error'>" . error() . "\n";
|
||||
} else {
|
||||
$email_fields = array();
|
||||
echo "<form action='' method='post' enctype='multipart/form-data'>\n";
|
||||
|
@@ -63,7 +63,7 @@ if (!$error && $_POST) {
|
||||
$start = explode(" ", microtime()); // microtime(true) is available since PHP 5
|
||||
//! don't allow changing of character_set_results, convert encoding of displayed query
|
||||
if (!$connection->multi_query($q)) {
|
||||
echo "<p class='error'>" . lang('Error in query') . ": " . h(preg_replace('~^You have an error.*syntax to use~U', "Syntax error", $connection->error)) . "\n";
|
||||
echo "<p class='error'>" . lang('Error in query') . ": " . error() . "\n";
|
||||
if ($_POST["error_stops"]) {
|
||||
break;
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
$TABLE = $_GET["table"];
|
||||
$fields = fields($TABLE);
|
||||
if (!$fields) {
|
||||
$error = h($connection->error);
|
||||
$error = error();
|
||||
}
|
||||
$table_status = ($fields ? table_status($TABLE) : array());
|
||||
|
||||
|
Reference in New Issue
Block a user