mirror of
https://github.com/vrana/adminer.git
synced 2025-08-08 07:36:44 +02:00
Move possible drivers and JUSH to Driver
This commit is contained in:
@@ -279,6 +279,9 @@ if (isset($_GET["mongo"])) {
|
|||||||
|
|
||||||
|
|
||||||
class Driver extends SqlDriver {
|
class Driver extends SqlDriver {
|
||||||
|
static $possibleDrivers = array("mongodb");
|
||||||
|
static $jush = "mongo";
|
||||||
|
|
||||||
var $editFunctions = array(array("json"));
|
var $editFunctions = array(array("json"));
|
||||||
|
|
||||||
var $operators = array(
|
var $operators = array(
|
||||||
@@ -532,11 +535,4 @@ if (isset($_GET["mongo"])) {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function driver_config() {
|
|
||||||
return array(
|
|
||||||
'possible_drivers' => array("mongodb"),
|
|
||||||
'jush' => "mongo",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -186,6 +186,9 @@ if (isset($_GET["mssql"])) {
|
|||||||
|
|
||||||
|
|
||||||
class Driver extends SqlDriver {
|
class Driver extends SqlDriver {
|
||||||
|
static $possibleDrivers = array("SQLSRV", "PDO_SQLSRV", "PDO_DBLIB");
|
||||||
|
static $jush = "mssql";
|
||||||
|
|
||||||
var $editFunctions = array(
|
var $editFunctions = array(
|
||||||
array(
|
array(
|
||||||
"date|time" => "getdate",
|
"date|time" => "getdate",
|
||||||
@@ -704,11 +707,4 @@ WHERE sys1.xtype = 'TR' AND sys2.name = " . q($table)) as $row
|
|||||||
function support($feature) {
|
function support($feature) {
|
||||||
return preg_match('~^(check|comment|columns|database|drop_col|dump|indexes|descidx|scheme|sql|table|trigger|view|view_trigger)$~', $feature); //! routine|
|
return preg_match('~^(check|comment|columns|database|drop_col|dump|indexes|descidx|scheme|sql|table|trigger|view|view_trigger)$~', $feature); //! routine|
|
||||||
}
|
}
|
||||||
|
|
||||||
function driver_config() {
|
|
||||||
return array(
|
|
||||||
'possible_drivers' => array("SQLSRV", "PDO_SQLSRV", "PDO_DBLIB"),
|
|
||||||
'jush' => "mssql",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -281,6 +281,9 @@ if (!defined("DRIVER")) {
|
|||||||
|
|
||||||
|
|
||||||
class Driver extends SqlDriver {
|
class Driver extends SqlDriver {
|
||||||
|
static $possibleDrivers = array("MySQLi", "MySQL", "PDO_MySQL");
|
||||||
|
static $jush = "sql"; ///< @var string JUSH identifier
|
||||||
|
|
||||||
var $unsigned = array("unsigned", "zerofill", "unsigned zerofill");
|
var $unsigned = array("unsigned", "zerofill", "unsigned zerofill");
|
||||||
var $operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "REGEXP", "IN", "FIND_IN_SET", "IS NULL", "NOT LIKE", "NOT REGEXP", "NOT IN", "IS NOT NULL", "SQL");
|
var $operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "REGEXP", "IN", "FIND_IN_SET", "IS NULL", "NOT LIKE", "NOT REGEXP", "NOT IN", "IS NOT NULL", "SQL");
|
||||||
var $functions = array("char_length", "date", "from_unixtime", "lower", "round", "floor", "ceil", "sec_to_time", "time_to_sec", "upper");
|
var $functions = array("char_length", "date", "from_unixtime", "lower", "round", "floor", "ceil", "sec_to_time", "time_to_sec", "upper");
|
||||||
@@ -1196,14 +1199,4 @@ if (!defined("DRIVER")) {
|
|||||||
global $connection;
|
global $connection;
|
||||||
return $connection->result("SELECT @@max_connections");
|
return $connection->result("SELECT @@max_connections");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get driver config
|
|
||||||
* @return array ['possible_drivers' => , 'jush' => ]
|
|
||||||
*/
|
|
||||||
function driver_config() {
|
|
||||||
return array(
|
|
||||||
'possible_drivers' => array("MySQLi", "MySQL", "PDO_MySQL"),
|
|
||||||
'jush' => "sql", ///< @var string JUSH identifier
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -141,6 +141,9 @@ if (isset($_GET["oracle"])) {
|
|||||||
|
|
||||||
|
|
||||||
class Driver extends SqlDriver {
|
class Driver extends SqlDriver {
|
||||||
|
static $possibleDrivers = array("OCI8", "PDO_OCI");
|
||||||
|
static $jush = "oracle";
|
||||||
|
|
||||||
var $editFunctions = array(
|
var $editFunctions = array(
|
||||||
array( //! no parentheses
|
array( //! no parentheses
|
||||||
"date" => "current_date",
|
"date" => "current_date",
|
||||||
@@ -544,11 +547,4 @@ ORDER BY PROCESS
|
|||||||
function support($feature) {
|
function support($feature) {
|
||||||
return preg_match('~^(columns|database|drop_col|indexes|descidx|processlist|scheme|sql|status|table|variables|view)$~', $feature); //!
|
return preg_match('~^(columns|database|drop_col|indexes|descidx|processlist|scheme|sql|status|table|variables|view)$~', $feature); //!
|
||||||
}
|
}
|
||||||
|
|
||||||
function driver_config() {
|
|
||||||
return array(
|
|
||||||
'possible_drivers' => array("OCI8", "PDO_OCI"),
|
|
||||||
'jush' => "oracle",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -196,6 +196,9 @@ if (isset($_GET["pgsql"])) {
|
|||||||
|
|
||||||
|
|
||||||
class Driver extends SqlDriver {
|
class Driver extends SqlDriver {
|
||||||
|
static $possibleDrivers = array("PgSQL", "PDO_PgSQL");
|
||||||
|
static $jush = "pgsql";
|
||||||
|
|
||||||
var $operators = array("=", "<", ">", "<=", ">=", "!=", "~", "!~", "LIKE", "LIKE %%", "ILIKE", "ILIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL"); // no "SQL" to avoid CSRF
|
var $operators = array("=", "<", ">", "<=", ">=", "!=", "~", "!~", "LIKE", "LIKE %%", "ILIKE", "ILIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL"); // no "SQL" to avoid CSRF
|
||||||
var $functions = array("char_length", "lower", "round", "to_hex", "to_timestamp", "upper");
|
var $functions = array("char_length", "lower", "round", "to_hex", "to_timestamp", "upper");
|
||||||
var $grouping = array("avg", "count", "count distinct", "max", "min", "sum");
|
var $grouping = array("avg", "count", "count distinct", "max", "min", "sum");
|
||||||
@@ -935,11 +938,4 @@ AND typelem = 0"
|
|||||||
global $connection;
|
global $connection;
|
||||||
return $connection->result("SHOW max_connections");
|
return $connection->result("SHOW max_connections");
|
||||||
}
|
}
|
||||||
|
|
||||||
function driver_config() {
|
|
||||||
return array(
|
|
||||||
'possible_drivers' => array("PgSQL", "PDO_PgSQL"),
|
|
||||||
'jush' => "pgsql",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -127,6 +127,9 @@ if (isset($_GET["sqlite"])) {
|
|||||||
|
|
||||||
|
|
||||||
class Driver extends SqlDriver {
|
class Driver extends SqlDriver {
|
||||||
|
static $possibleDrivers = array("SQLite3", "PDO_SQLite");
|
||||||
|
static $jush = "sqlite";
|
||||||
|
|
||||||
protected $types = array(array("integer" => 0, "real" => 0, "numeric" => 0, "text" => 0, "blob" => 0));
|
protected $types = array(array("integer" => 0, "real" => 0, "numeric" => 0, "text" => 0, "blob" => 0));
|
||||||
|
|
||||||
var $editFunctions = array(
|
var $editFunctions = array(
|
||||||
@@ -737,11 +740,4 @@ if (isset($_GET["sqlite"])) {
|
|||||||
function support($feature) {
|
function support($feature) {
|
||||||
return preg_match('~^(check|columns|database|drop_col|dump|indexes|descidx|move_col|sql|status|table|trigger|variables|view|view_trigger)$~', $feature);
|
return preg_match('~^(check|columns|database|drop_col|dump|indexes|descidx|move_col|sql|status|table|trigger|variables|view|view_trigger)$~', $feature);
|
||||||
}
|
}
|
||||||
|
|
||||||
function driver_config() {
|
|
||||||
return array(
|
|
||||||
'possible_drivers' => array("SQLite3", "PDO_SQLite"),
|
|
||||||
'jush' => "sqlite",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -150,7 +150,7 @@ function auth_error($error) {
|
|||||||
if (isset($_GET["username"]) && !class_exists('Adminer\Db')) {
|
if (isset($_GET["username"]) && !class_exists('Adminer\Db')) {
|
||||||
unset($_SESSION["pwds"][DRIVER]);
|
unset($_SESSION["pwds"][DRIVER]);
|
||||||
unset_permanent();
|
unset_permanent();
|
||||||
page_header(lang('No extension'), lang('None of the supported PHP extensions (%s) are available.', implode(", ", $possible_drivers)), false);
|
page_header(lang('No extension'), lang('None of the supported PHP extensions (%s) are available.', implode(", ", Driver::$possibleDrivers)), false);
|
||||||
page_footer("auth");
|
page_footer("auth");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@@ -78,9 +78,7 @@ include "./include/adminer.inc.php";
|
|||||||
$adminer = (function_exists('adminer_object') ? adminer_object() : new Adminer);
|
$adminer = (function_exists('adminer_object') ? adminer_object() : new Adminer);
|
||||||
include "../adminer/drivers/mysql.inc.php"; // must be included as last driver
|
include "../adminer/drivers/mysql.inc.php"; // must be included as last driver
|
||||||
|
|
||||||
$config = driver_config();
|
$jush = Driver::$jush;
|
||||||
$possible_drivers = $config['possible_drivers'];
|
|
||||||
$jush = $config['jush'];
|
|
||||||
|
|
||||||
define("SERVER", $_GET[DRIVER]); // read from pgsql=localhost
|
define("SERVER", $_GET[DRIVER]); // read from pgsql=localhost
|
||||||
define("DB", $_GET["db"]); // for the sake of speed and size
|
define("DB", $_GET["db"]); // for the sake of speed and size
|
||||||
|
@@ -23,6 +23,9 @@ function get_driver($id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
abstract class SqlDriver {
|
abstract class SqlDriver {
|
||||||
|
static $possibleDrivers = array();
|
||||||
|
static $jush; ///< @var string JUSH identifier
|
||||||
|
|
||||||
var $_conn;
|
var $_conn;
|
||||||
protected $types = array(); ///< @var array [$description => [$type => $maximum_unsigned_length, ...], ...]
|
protected $types = array(); ///< @var array [$description => [$type => $maximum_unsigned_length, ...], ...]
|
||||||
var $editFunctions = array(); ///< @var array of ["$type|$type2" => "$function/$function2"] functions used in editing, [0] - edit and insert, [1] - edit only
|
var $editFunctions = array(); ///< @var array of ["$type|$type2" => "$function/$function2"] functions used in editing, [0] - edit and insert, [1] - edit only
|
||||||
|
@@ -131,6 +131,9 @@ if (isset($_GET["clickhouse"])) {
|
|||||||
|
|
||||||
|
|
||||||
class Driver extends SqlDriver {
|
class Driver extends SqlDriver {
|
||||||
|
static $possibleDrivers = array("allow_url_fopen");
|
||||||
|
static $jush = "clickhouse";
|
||||||
|
|
||||||
var $operators = array("=", "<", ">", "<=", ">=", "!=", "~", "!~", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL", "SQL");
|
var $operators = array("=", "<", ">", "<=", ">=", "!=", "~", "!~", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL", "SQL");
|
||||||
var $grouping = array("avg", "count", "count distinct", "max", "min", "sum");
|
var $grouping = array("avg", "count", "count distinct", "max", "min", "sum");
|
||||||
|
|
||||||
@@ -380,10 +383,4 @@ if (isset($_GET["clickhouse"])) {
|
|||||||
function support($feature) {
|
function support($feature) {
|
||||||
return preg_match("~^(columns|sql|status|table|drop_col)$~", $feature);
|
return preg_match("~^(columns|sql|status|table|drop_col)$~", $feature);
|
||||||
}
|
}
|
||||||
|
|
||||||
function driver_config() {
|
|
||||||
return array(
|
|
||||||
'jush' => "clickhouse",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -122,6 +122,9 @@ if (isset($_GET["elastic"])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class Driver extends SqlDriver {
|
class Driver extends SqlDriver {
|
||||||
|
static $possibleDrivers = array("json + allow_url_fopen");
|
||||||
|
static $jush = "elastic";
|
||||||
|
|
||||||
var $editFunctions = array(array("json"));
|
var $editFunctions = array(array("json"));
|
||||||
var $operators = array("=", "must", "should", "must_not");
|
var $operators = array("=", "must", "should", "must_not");
|
||||||
|
|
||||||
@@ -564,11 +567,4 @@ if (isset($_GET["elastic"])) {
|
|||||||
function last_id() {
|
function last_id() {
|
||||||
return connection()->last_id;
|
return connection()->last_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
function driver_config() {
|
|
||||||
return array(
|
|
||||||
'possible_drivers' => array("json + allow_url_fopen"),
|
|
||||||
'jush' => "elastic",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -113,6 +113,9 @@ if (isset($_GET["elastic5"])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class Driver extends SqlDriver {
|
class Driver extends SqlDriver {
|
||||||
|
static $possibleDrivers = array("json + allow_url_fopen");
|
||||||
|
static $jush = "elastic";
|
||||||
|
|
||||||
var $editFunctions = array(array("json"));
|
var $editFunctions = array(array("json"));
|
||||||
var $operators = array("=", "must", "should", "must_not");
|
var $operators = array("=", "must", "should", "must_not");
|
||||||
|
|
||||||
@@ -530,11 +533,4 @@ if (isset($_GET["elastic5"])) {
|
|||||||
function last_id() {
|
function last_id() {
|
||||||
return connection()->last_id;
|
return connection()->last_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
function driver_config() {
|
|
||||||
return array(
|
|
||||||
'possible_drivers' => array("json + allow_url_fopen"),
|
|
||||||
'jush' => "elastic",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -115,6 +115,9 @@ if (isset($_GET["firebird"])) {
|
|||||||
|
|
||||||
|
|
||||||
class Driver extends SqlDriver {
|
class Driver extends SqlDriver {
|
||||||
|
static $possibleDrivers = array("interbase");
|
||||||
|
static $jush = "firebird";
|
||||||
|
|
||||||
var $operators = array("=");
|
var $operators = array("=");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -301,11 +304,4 @@ ORDER BY RDB$INDEX_SEGMENTS.RDB$FIELD_POSITION';
|
|||||||
function support($feature) {
|
function support($feature) {
|
||||||
return preg_match("~^(columns|sql|status|table)$~", $feature);
|
return preg_match("~^(columns|sql|status|table)$~", $feature);
|
||||||
}
|
}
|
||||||
|
|
||||||
function driver_config() {
|
|
||||||
return array(
|
|
||||||
'possible_drivers' => array("interbase"),
|
|
||||||
'jush' => "firebird",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -118,6 +118,9 @@ if (isset($_GET["simpledb"])) {
|
|||||||
|
|
||||||
|
|
||||||
class Driver extends SqlDriver {
|
class Driver extends SqlDriver {
|
||||||
|
static $possibleDrivers = array("SimpleXML + allow_url_fopen");
|
||||||
|
static $jush = "simpledb";
|
||||||
|
|
||||||
var $operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "IS NOT NULL");
|
var $operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "IS NOT NULL");
|
||||||
var $grouping = array("count");
|
var $grouping = array("count");
|
||||||
|
|
||||||
@@ -465,11 +468,4 @@ if (isset($_GET["simpledb"])) {
|
|||||||
} while ($xml->NextToken);
|
} while ($xml->NextToken);
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function driver_config() {
|
|
||||||
return array(
|
|
||||||
'possible_drivers' => array("SimpleXML + allow_url_fopen"),
|
|
||||||
'jush' => "simpledb",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user