From a2443670f8671abcc9c09c7c34f699da384b35fd Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Fri, 29 Oct 2010 15:24:06 +0200 Subject: [PATCH] Always display all drivers (bug #3097666) --- adminer/drivers/mssql.inc.php | 7 +- adminer/drivers/mysql.inc.php | 8 +- adminer/drivers/oracle.inc.php | 7 +- adminer/drivers/pgsql.inc.php | 7 +- adminer/drivers/sqlite.inc.php | 158 ++++++++++++++++----------------- adminer/include/auth.inc.php | 13 ++- adminer/include/pdo.inc.php | 1 - changes.txt | 1 + 8 files changed, 91 insertions(+), 111 deletions(-) diff --git a/adminer/drivers/mssql.inc.php b/adminer/drivers/mssql.inc.php index 11f15b54..a604fcfa 100644 --- a/adminer/drivers/mssql.inc.php +++ b/adminer/drivers/mssql.inc.php @@ -5,13 +5,10 @@ * @author Jakub Vrana */ -$possible_drivers[] = "SQLSRV"; -$possible_drivers[] = "MSSQL"; -if (extension_loaded("sqlsrv") || extension_loaded("mssql")) { - $drivers["mssql"] = "MS SQL"; -} +$drivers["mssql"] = "MS SQL"; if (isset($_GET["mssql"])) { + $possible_drivers = array("SQLSRV", "MSSQL"); define("DRIVER", "mssql"); if (extension_loaded("sqlsrv")) { class Min_DB { diff --git a/adminer/drivers/mysql.inc.php b/adminer/drivers/mysql.inc.php index cc0fd66e..5720cabc 100644 --- a/adminer/drivers/mysql.inc.php +++ b/adminer/drivers/mysql.inc.php @@ -1,12 +1,8 @@ "MySQL") + $drivers; -} +$drivers = array("server" => "MySQL") + $drivers; if (!defined("DRIVER")) { + $possible_drivers = array("MySQLi", "MySQL", "PDO_MySQL"); define("DRIVER", "server"); // server - backwards compatibility // MySQLi supports everything, MySQL doesn't support multiple result sets, PDO_MySQL doesn't support orgtable if (extension_loaded("mysqli")) { diff --git a/adminer/drivers/oracle.inc.php b/adminer/drivers/oracle.inc.php index cbdb61d5..5d2488b0 100644 --- a/adminer/drivers/oracle.inc.php +++ b/adminer/drivers/oracle.inc.php @@ -1,11 +1,8 @@ _link = new SQLite3($filename); + $version = $this->_link->version(); + $this->server_info = $version["versionString"]; + } + + function query($query) { + $result = @$this->_link->query($query); + if (!$result) { + $this->error = $this->_link->lastErrorMsg(); + return false; + } elseif ($result->numColumns()) { + return new Min_Result($result); + } + $this->affected_rows = $this->_link->changes(); + return true; + } + + function quote($string) { + return "'" . $this->_link->escapeString($string) . "'"; + } + + function store_result() { + return $this->_result; + } + + function result($query, $field = 0) { + $result = $this->query($query); + if (!is_object($result)) { + return false; + } + $row = $result->_result->fetchArray(); + return $row[$field]; + } + } + + class Min_Result { + var $_result, $_offset = 0, $num_rows; + + function Min_Result($result) { + $this->_result = $result; + } + + function fetch_assoc() { + return $this->_result->fetchArray(SQLITE3_ASSOC); + } + + function fetch_row() { + return $this->_result->fetchArray(SQLITE3_NUM); + } + + function fetch_field() { + $column = $this->_offset++; + $type = $this->_result->columnType($column); + return (object) array( + "name" => $this->_result->columnName($column), + "type" => $type, + "charsetnr" => ($type == SQLITE3_BLOB ? 63 : 0), // 63 - binary + ); + } + + function __desctruct() { + return $this->_result->finalize(); + } + } + + } else { class Min_SQLite { var $extension = "SQLite", $server_info, $affected_rows, $error, $_link; @@ -95,77 +160,6 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) { } - } else { - - class Min_SQLite { - var $extension = "SQLite3", $server_info, $affected_rows, $error, $_link; - - function Min_SQLite($filename) { - $this->_link = new SQLite3($filename); - $version = $this->_link->version(); - $this->server_info = $version["versionString"]; - } - - function query($query) { - $result = @$this->_link->query($query); - if (!$result) { - $this->error = $this->_link->lastErrorMsg(); - return false; - } elseif ($result->numColumns()) { - return new Min_Result($result); - } - $this->affected_rows = $this->_link->changes(); - return true; - } - - function quote($string) { - return "'" . $this->_link->escapeString($string) . "'"; - } - - function store_result() { - return $this->_result; - } - - function result($query, $field = 0) { - $result = $this->query($query); - if (!is_object($result)) { - return false; - } - $row = $result->_result->fetchArray(); - return $row[$field]; - } - } - - class Min_Result { - var $_result, $_offset = 0, $num_rows; - - function Min_Result($result) { - $this->_result = $result; - } - - function fetch_assoc() { - return $this->_result->fetchArray(SQLITE3_ASSOC); - } - - function fetch_row() { - return $this->_result->fetchArray(SQLITE3_NUM); - } - - function fetch_field() { - $column = $this->_offset++; - $type = $this->_result->columnType($column); - return (object) array( - "name" => $this->_result->columnName($column), - "type" => $type, - "charsetnr" => ($type == SQLITE3_BLOB ? 63 : 0), // 63 - binary - ); - } - - function __desctruct() { - return $this->_result->finalize(); - } - } - } } elseif (extension_loaded("pdo_sqlite")) { diff --git a/adminer/include/auth.inc.php b/adminer/include/auth.inc.php index 156593bc..09c09da0 100644 --- a/adminer/include/auth.inc.php +++ b/adminer/include/auth.inc.php @@ -1,12 +1,6 @@ login($_GET["username"], get_session("pwds"))) { diff --git a/adminer/include/pdo.inc.php b/adminer/include/pdo.inc.php index 2e7be171..9c342e04 100644 --- a/adminer/include/pdo.inc.php +++ b/adminer/include/pdo.inc.php @@ -79,5 +79,4 @@ if (extension_loaded('pdo')) { } } -$possible_drivers = array(); $drivers = array(); diff --git a/changes.txt b/changes.txt index 7b3dad97..77c478f7 100644 --- a/changes.txt +++ b/changes.txt @@ -7,6 +7,7 @@ Link to bookmark SQL command Support for virtual foreign keys Immunity against zend.ze1_compatibility_mode Fix last page with empty result set +Always display all drivers Adminer 3.0.1 (released 2010-10-18): Send the form by Ctrl+Enter in all textareas