Display error code in SQL query
This commit is contained in:
parent
588cb7c0c3
commit
a9262d8752
|
@ -12,11 +12,12 @@ if (isset($_GET["mssql"])) {
|
|||
define("DRIVER", "mssql");
|
||||
if (extension_loaded("sqlsrv")) {
|
||||
class Min_DB {
|
||||
var $extension = "sqlsrv", $_link, $_result, $server_info, $affected_rows, $error;
|
||||
var $extension = "sqlsrv", $_link, $_result, $server_info, $affected_rows, $errno, $error;
|
||||
|
||||
function _get_error() {
|
||||
$this->error = "";
|
||||
foreach (sqlsrv_errors() as $error) {
|
||||
$this->errno = $error["code"];
|
||||
$this->error .= "$error[message]\n";
|
||||
}
|
||||
$this->error = rtrim($this->error);
|
||||
|
|
|
@ -54,6 +54,7 @@ if (!defined("DRIVER")) {
|
|||
$extension = "MySQL", ///< @var string extension name
|
||||
$server_info, ///< @var string server version
|
||||
$affected_rows, ///< @var int number of affected rows
|
||||
$errno, ///< @var int last error code
|
||||
$error, ///< @var string last error message
|
||||
$_link, $_result ///< @access private
|
||||
;
|
||||
|
@ -110,6 +111,7 @@ if (!defined("DRIVER")) {
|
|||
$result = @($unbuffered ? mysql_unbuffered_query($query, $this->_link) : mysql_query($query, $this->_link)); // @ - mute mysql.trace_mode
|
||||
$this->error = "";
|
||||
if (!$result) {
|
||||
$this->errrno = mysql_errno($this->_link);
|
||||
$this->error = mysql_error($this->_link);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ if (isset($_GET["oracle"])) {
|
|||
define("DRIVER", "oracle");
|
||||
if (extension_loaded("oci8")) {
|
||||
class Min_DB {
|
||||
var $extension = "oci8", $_link, $_result, $server_info, $affected_rows, $error;
|
||||
var $extension = "oci8", $_link, $_result, $server_info, $affected_rows, $errno, $error;
|
||||
|
||||
function _error($errno, $error) {
|
||||
if (ini_bool("html_errors")) {
|
||||
|
@ -40,6 +40,7 @@ if (isset($_GET["oracle"])) {
|
|||
$this->error = "";
|
||||
if (!$result) {
|
||||
$error = oci_error($this->_link);
|
||||
$this->errno = $error["code"];
|
||||
$this->error = $error["message"];
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
|
|||
if (isset($_GET["sqlite"])) {
|
||||
|
||||
class Min_SQLite {
|
||||
var $extension = "SQLite3", $server_info, $affected_rows, $error, $_link;
|
||||
var $extension = "SQLite3", $server_info, $affected_rows, $errno, $error, $_link;
|
||||
|
||||
function Min_SQLite($filename) {
|
||||
$this->_link = new SQLite3($filename);
|
||||
|
@ -21,6 +21,7 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
|
|||
$result = @$this->_link->query($query);
|
||||
$this->error = "";
|
||||
if (!$result) {
|
||||
$this->errno = $this->_link->lastErrorCode();
|
||||
$this->error = $this->_link->lastErrorMsg();
|
||||
return false;
|
||||
} elseif ($result->numColumns()) {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// PDO can be used in several database drivers
|
||||
if (extension_loaded('pdo')) {
|
||||
/*abstract*/ class Min_PDO extends PDO {
|
||||
var $_result, $server_info, $affected_rows, $error;
|
||||
var $_result, $server_info, $affected_rows, $errno, $error;
|
||||
|
||||
function __construct() {
|
||||
global $adminer;
|
||||
|
@ -26,8 +26,7 @@ if (extension_loaded('pdo')) {
|
|||
$result = parent::query($query);
|
||||
$this->error = "";
|
||||
if (!$result) {
|
||||
$errorInfo = $this->errorInfo();
|
||||
$this->error = $errorInfo[2];
|
||||
list(, $this->errno, $this->error) = $this->errorInfo();
|
||||
return false;
|
||||
}
|
||||
$this->store_result($result);
|
||||
|
|
|
@ -104,7 +104,7 @@ if (!$error && $_POST) {
|
|||
$time = format_time($start, $end) . (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) {
|
||||
echo ($_POST["only_errors"] ? $print : "");
|
||||
echo "<p class='error'>" . lang('Error in query') . ": " . error() . "\n";
|
||||
echo "<p class='error'>" . lang('Error in query') . ($connection->errno ? " ($connection->errno)" : "") . ": " . error() . "\n";
|
||||
$errors[] = " <a href='#sql-$commands'>$commands</a>";
|
||||
if ($_POST["error_stops"]) {
|
||||
break 2;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
Adminer 3.6.3-dev:
|
||||
Display error code in SQL query
|
||||
Treat Meta key same as Ctrl
|
||||
Don't use type="number" for decimal numbers
|
||||
|
||||
|
|
Loading…
Reference in a new issue