mirror of
https://github.com/vrana/adminer.git
synced 2025-08-12 09:34:10 +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) . ")");
|
$result = $connection->multi_query((isset($_GET["callf"]) ? "SELECT" : "CALL") . " " . idf_escape($PROCEDURE) . "(" . implode(", ", $call) . ")");
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
echo "<p class='error'>" . h($connection->error) . "\n";
|
echo "<p class='error'>" . error() . "\n";
|
||||||
} else {
|
} else {
|
||||||
do {
|
do {
|
||||||
$result = $connection->store_result();
|
$result = $connection->store_result();
|
||||||
|
@@ -246,7 +246,7 @@ function query_redirect($query, $location, $message, $redirect = true, $execute
|
|||||||
$sql = $adminer->messageQuery($query);
|
$sql = $adminer->messageQuery($query);
|
||||||
}
|
}
|
||||||
if ($failed) {
|
if ($failed) {
|
||||||
$error = h($connection->error) . $sql;
|
$error = error() . $sql;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ($redirect) {
|
if ($redirect) {
|
||||||
|
@@ -372,6 +372,14 @@ function information_schema($db) {
|
|||||||
return ($connection->server_info >= 5 && $db == "information_schema");
|
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
|
/** Return expression for binary comparison
|
||||||
* @param string
|
* @param string
|
||||||
* @return string
|
* @return string
|
||||||
|
@@ -144,7 +144,7 @@ if (isset($rights["insert"])) {
|
|||||||
$adminer->selectLinks($table_status, $set);
|
$adminer->selectLinks($table_status, $set);
|
||||||
|
|
||||||
if (!$columns) {
|
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 {
|
} else {
|
||||||
echo "<form action='' id='form'>\n";
|
echo "<form action='' id='form'>\n";
|
||||||
echo "<div style='display: none;'>";
|
echo "<div style='display: none;'>";
|
||||||
@@ -165,7 +165,7 @@ if (!$columns) {
|
|||||||
|
|
||||||
$result = $connection->query($query);
|
$result = $connection->query($query);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
echo "<p class='error'>" . h($connection->error) . "\n";
|
echo "<p class='error'>" . error() . "\n";
|
||||||
} else {
|
} else {
|
||||||
$email_fields = array();
|
$email_fields = array();
|
||||||
echo "<form action='' method='post' enctype='multipart/form-data'>\n";
|
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
|
$start = explode(" ", microtime()); // microtime(true) is available since PHP 5
|
||||||
//! don't allow changing of character_set_results, convert encoding of displayed query
|
//! don't allow changing of character_set_results, convert encoding of displayed query
|
||||||
if (!$connection->multi_query($q)) {
|
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"]) {
|
if ($_POST["error_stops"]) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
$TABLE = $_GET["table"];
|
$TABLE = $_GET["table"];
|
||||||
$fields = fields($TABLE);
|
$fields = fields($TABLE);
|
||||||
if (!$fields) {
|
if (!$fields) {
|
||||||
$error = h($connection->error);
|
$error = error();
|
||||||
}
|
}
|
||||||
$table_status = ($fields ? table_status($TABLE) : array());
|
$table_status = ($fields ? table_status($TABLE) : array());
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user