Prepare for moving drivers to plugins
This commit is contained in:
parent
4f8ecd3c11
commit
50ed4f7ce7
|
@ -372,7 +372,7 @@ if (isset($_GET["clickhouse"])) {
|
|||
return preg_match("~^(columns|sql|status|table|drop_col)$~", $feature);
|
||||
}
|
||||
|
||||
$jush = "clickhouse";
|
||||
function driver_config() {
|
||||
$types = array();
|
||||
$structured_types = array();
|
||||
foreach (array( //! arrays
|
||||
|
@ -384,9 +384,15 @@ if (isset($_GET["clickhouse"])) {
|
|||
$types += $val;
|
||||
$structured_types[$key] = array_keys($val);
|
||||
}
|
||||
$unsigned = array();
|
||||
$operators = array("=", "<", ">", "<=", ">=", "!=", "~", "!~", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL", "SQL");
|
||||
$functions = array();
|
||||
$grouping = array("avg", "count", "count distinct", "max", "min", "sum");
|
||||
$edit_functions = array();
|
||||
return array(
|
||||
'jush' => "clickhouse",
|
||||
'types' => $types,
|
||||
'structured_types' => $structured_types,
|
||||
'unsigned' => array(),
|
||||
'operators' => array("=", "<", ">", "<=", ">=", "!=", "~", "!~", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL", "SQL"),
|
||||
'functions' => array(),
|
||||
'grouping' => array("avg", "count", "count distinct", "max", "min", "sum"),
|
||||
'edit_functions' => array(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
$drivers["elastic"] = "Elasticsearch (beta)";
|
||||
|
||||
if (isset($_GET["elastic"])) {
|
||||
$possible_drivers = array("json + allow_url_fopen");
|
||||
define("DRIVER", "elastic");
|
||||
|
||||
if (function_exists('json_decode') && ini_bool('allow_url_fopen')) {
|
||||
|
@ -461,13 +460,9 @@ if (isset($_GET["elastic"])) {
|
|||
return $connection->last_id;
|
||||
}
|
||||
|
||||
$jush = "elastic";
|
||||
$operators = array("=", "query");
|
||||
$functions = array();
|
||||
$grouping = array();
|
||||
$edit_functions = array(array("json"));
|
||||
$types = array(); ///< @var array ($type => $maximum_unsigned_length, ...)
|
||||
$structured_types = array(); ///< @var array ($description => array($type, ...), ...)
|
||||
function driver_config() {
|
||||
$types = array();
|
||||
$structured_types = array();
|
||||
foreach (array(
|
||||
lang('Numbers') => array("long" => 3, "integer" => 5, "short" => 8, "byte" => 10, "double" => 20, "float" => 66, "half_float" => 12, "scaled_float" => 21),
|
||||
lang('Date and time') => array("date" => 10),
|
||||
|
@ -477,4 +472,15 @@ if (isset($_GET["elastic"])) {
|
|||
$types += $val;
|
||||
$structured_types[$key] = array_keys($val);
|
||||
}
|
||||
return array(
|
||||
'possible_drivers' => array("json + allow_url_fopen"),
|
||||
'jush' => "elastic",
|
||||
'operators' => array("=", "query"),
|
||||
'functions' => array(),
|
||||
'grouping' => array(),
|
||||
'edit_functions' => array(array("json")),
|
||||
'types' => $types,
|
||||
'structured_types' => $structured_types,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
$drivers['firebird'] = 'Firebird (alpha)';
|
||||
|
||||
if (isset($_GET["firebird"])) {
|
||||
$possible_drivers = array("interbase");
|
||||
define("DRIVER", "firebird");
|
||||
|
||||
if (extension_loaded("interbase") ) {
|
||||
|
@ -312,9 +311,14 @@ ORDER BY RDB$INDEX_SEGMENTS.RDB$FIELD_POSITION';
|
|||
return preg_match("~^(columns|sql|status|table)$~", $feature);
|
||||
}
|
||||
|
||||
$jush = "firebird";
|
||||
$operators = array("=");
|
||||
$functions = array();
|
||||
$grouping = array();
|
||||
$edit_functions = array();
|
||||
function driver_config() {
|
||||
return array(
|
||||
'possible_drivers' => array("interbase"),
|
||||
'jush' => "firebird",
|
||||
'operators' => array("="),
|
||||
'functions' => array(),
|
||||
'grouping' => array(),
|
||||
'edit_functions' => array(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
$drivers["mongo"] = "MongoDB";
|
||||
|
||||
if (isset($_GET["mongo"])) {
|
||||
$possible_drivers = array("mongo", "mongodb");
|
||||
define("DRIVER", "mongo");
|
||||
|
||||
if (class_exists('MongoDB\Driver\Manager')) {
|
||||
|
@ -731,8 +730,13 @@ if (isset($_GET["mongo"])) {
|
|||
return true;
|
||||
}
|
||||
|
||||
$jush = "mongo";
|
||||
$functions = array();
|
||||
$grouping = array();
|
||||
$edit_functions = array(array("json"));
|
||||
function driver_config() {
|
||||
return array(
|
||||
'possible_drivers' => array("mongo", "mongodb"),
|
||||
'jush' => "mongo",
|
||||
'functions' => array(),
|
||||
'grouping' => array(),
|
||||
'edit_functions' => array(array("json")),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
$drivers["mssql"] = "MS SQL (beta)";
|
||||
|
||||
if (isset($_GET["mssql"])) {
|
||||
$possible_drivers = array("SQLSRV", "MSSQL", "PDO_DBLIB");
|
||||
define("DRIVER", "mssql");
|
||||
if (extension_loaded("sqlsrv")) {
|
||||
class Min_DB {
|
||||
|
@ -646,7 +645,7 @@ WHERE sys1.xtype = 'TR' AND sys2.name = " . q($table)
|
|||
return preg_match('~^(comment|columns|database|drop_col|indexes|descidx|scheme|sql|table|trigger|view|view_trigger)$~', $feature); //! routine|
|
||||
}
|
||||
|
||||
$jush = "mssql";
|
||||
function driver_config() {
|
||||
$types = array();
|
||||
$structured_types = array();
|
||||
foreach (array( //! use sys.types
|
||||
|
@ -658,16 +657,23 @@ WHERE sys1.xtype = 'TR' AND sys2.name = " . q($table)
|
|||
$types += $val;
|
||||
$structured_types[$key] = array_keys($val);
|
||||
}
|
||||
$unsigned = array();
|
||||
$operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL");
|
||||
$functions = array("len", "lower", "round", "upper");
|
||||
$grouping = array("avg", "count", "count distinct", "max", "min", "sum");
|
||||
$edit_functions = array(
|
||||
return array(
|
||||
'possible_drivers' => array("SQLSRV", "MSSQL", "PDO_DBLIB"),
|
||||
'jush' => "mssql",
|
||||
'types' => $types,
|
||||
'structured_types' => $structured_types,
|
||||
'unsigned' => array(),
|
||||
'operators' => array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL"),
|
||||
'functions' => array("len", "lower", "round", "upper"),
|
||||
'grouping' => array("avg", "count", "count distinct", "max", "min", "sum"),
|
||||
'edit_functions' => array(
|
||||
array(
|
||||
"date|time" => "getdate",
|
||||
), array(
|
||||
"int|decimal|real|float|money|datetime" => "+/-",
|
||||
"char|text" => "+",
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
$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")) {
|
||||
|
@ -1111,7 +1110,10 @@ if (!defined("DRIVER")) {
|
|||
return $connection->result("SELECT @@max_connections");
|
||||
}
|
||||
|
||||
$jush = "sql"; ///< @var string JUSH identifier
|
||||
/** Get driver config
|
||||
* @return array array('possible_drivers' => , 'jush' => , 'types' => , 'structured_types' => , 'unsigned' => , 'operators' => , 'functions' => , 'grouping' => , 'edit_functions' => )
|
||||
*/
|
||||
function driver_config() {
|
||||
$types = array(); ///< @var array ($type => $maximum_unsigned_length, ...)
|
||||
$structured_types = array(); ///< @var array ($description => array($type, ...), ...)
|
||||
foreach (array(
|
||||
|
@ -1125,11 +1127,16 @@ if (!defined("DRIVER")) {
|
|||
$types += $val;
|
||||
$structured_types[$key] = array_keys($val);
|
||||
}
|
||||
$unsigned = array("unsigned", "zerofill", "unsigned zerofill"); ///< @var array number variants
|
||||
$operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "REGEXP", "IN", "FIND_IN_SET", "IS NULL", "NOT LIKE", "NOT REGEXP", "NOT IN", "IS NOT NULL", "SQL"); ///< @var array operators used in select
|
||||
$functions = array("char_length", "date", "from_unixtime", "lower", "round", "floor", "ceil", "sec_to_time", "time_to_sec", "upper"); ///< @var array functions used in select
|
||||
$grouping = array("avg", "count", "count distinct", "group_concat", "max", "min", "sum"); ///< @var array grouping functions used in select
|
||||
$edit_functions = array( ///< @var array of array("$type|$type2" => "$function/$function2") functions used in editing, [0] - edit and insert, [1] - edit only
|
||||
return array(
|
||||
'possible_drivers' => array("MySQLi", "MySQL", "PDO_MySQL"),
|
||||
'jush' => "sql", ///< @var string JUSH identifier
|
||||
'types' => $types,
|
||||
'structured_types' => $structured_types,
|
||||
'unsigned' => array("unsigned", "zerofill", "unsigned zerofill"), ///< @var array number variants
|
||||
'operators' => array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "REGEXP", "IN", "FIND_IN_SET", "IS NULL", "NOT LIKE", "NOT REGEXP", "NOT IN", "IS NOT NULL", "SQL"), ///< @var array operators used in select
|
||||
'functions' => array("char_length", "date", "from_unixtime", "lower", "round", "floor", "ceil", "sec_to_time", "time_to_sec", "upper"), ///< @var array functions used in select
|
||||
'grouping' => array("avg", "count", "count distinct", "group_concat", "max", "min", "sum"), ///< @var array grouping functions used in select
|
||||
'edit_functions' => array( ///< @var array of array("$type|$type2" => "$function/$function2") functions used in editing, [0] - edit and insert, [1] - edit only
|
||||
array(
|
||||
"char" => "md5/sha1/password/encrypt/uuid",
|
||||
"binary" => "md5/sha1",
|
||||
|
@ -1140,5 +1147,7 @@ if (!defined("DRIVER")) {
|
|||
"time" => "addtime/subtime",
|
||||
"char|text" => "concat",
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
$drivers["oracle"] = "Oracle (beta)";
|
||||
|
||||
if (isset($_GET["oracle"])) {
|
||||
$possible_drivers = array("OCI8", "PDO_OCI");
|
||||
define("DRIVER", "oracle");
|
||||
if (extension_loaded("oci8")) {
|
||||
class Min_DB {
|
||||
|
@ -404,7 +403,7 @@ ORDER BY PROCESS
|
|||
return preg_match('~^(columns|database|drop_col|indexes|descidx|processlist|scheme|sql|status|table|variables|view|view_trigger)$~', $feature); //!
|
||||
}
|
||||
|
||||
$jush = "oracle";
|
||||
function driver_config() {
|
||||
$types = array();
|
||||
$structured_types = array();
|
||||
foreach (array(
|
||||
|
@ -416,11 +415,16 @@ ORDER BY PROCESS
|
|||
$types += $val;
|
||||
$structured_types[$key] = array_keys($val);
|
||||
}
|
||||
$unsigned = array();
|
||||
$operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT REGEXP", "NOT IN", "IS NOT NULL", "SQL");
|
||||
$functions = array("length", "lower", "round", "upper");
|
||||
$grouping = array("avg", "count", "count distinct", "max", "min", "sum");
|
||||
$edit_functions = array(
|
||||
return array(
|
||||
'possible_drivers' => array("OCI8", "PDO_OCI"),
|
||||
'jush' => "oracle",
|
||||
'types' => $types,
|
||||
'structured_types' => $structured_types,
|
||||
'unsigned' => array(),
|
||||
'operators' => array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT REGEXP", "NOT IN", "IS NOT NULL", "SQL"),
|
||||
'functions' => array("length", "lower", "round", "upper"),
|
||||
'grouping' => array("avg", "count", "count distinct", "max", "min", "sum"),
|
||||
'edit_functions' => array(
|
||||
array( //! no parentheses
|
||||
"date" => "current_date",
|
||||
"timestamp" => "current_timestamp",
|
||||
|
@ -429,5 +433,7 @@ ORDER BY PROCESS
|
|||
"date|timestamp" => "+ interval/- interval",
|
||||
"char|clob" => "||",
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
$drivers["pgsql"] = "PostgreSQL";
|
||||
|
||||
if (isset($_GET["pgsql"])) {
|
||||
$possible_drivers = array("PgSQL", "PDO_PgSQL");
|
||||
define("DRIVER", "pgsql");
|
||||
if (extension_loaded("pgsql")) {
|
||||
class Min_DB {
|
||||
|
@ -879,7 +878,7 @@ AND typelem = 0"
|
|||
return $connection->result("SHOW max_connections");
|
||||
}
|
||||
|
||||
$jush = "pgsql";
|
||||
function driver_config() {
|
||||
$types = array();
|
||||
$structured_types = array();
|
||||
foreach (array( //! arrays
|
||||
|
@ -893,11 +892,16 @@ AND typelem = 0"
|
|||
$types += $val;
|
||||
$structured_types[$key] = array_keys($val);
|
||||
}
|
||||
$unsigned = array();
|
||||
$operators = array("=", "<", ">", "<=", ">=", "!=", "~", "!~", "LIKE", "LIKE %%", "ILIKE", "ILIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL"); // no "SQL" to avoid CSRF
|
||||
$functions = array("char_length", "lower", "round", "to_hex", "to_timestamp", "upper");
|
||||
$grouping = array("avg", "count", "count distinct", "max", "min", "sum");
|
||||
$edit_functions = array(
|
||||
return array(
|
||||
'possible_drivers' => array("PgSQL", "PDO_PgSQL"),
|
||||
'jush' => "pgsql",
|
||||
'types' => $types,
|
||||
'structured_types' => $structured_types,
|
||||
'unsigned' => array(),
|
||||
'operators' => array("=", "<", ">", "<=", ">=", "!=", "~", "!~", "LIKE", "LIKE %%", "ILIKE", "ILIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL"), // no "SQL" to avoid CSRF
|
||||
'functions' => array("char_length", "lower", "round", "to_hex", "to_timestamp", "upper"),
|
||||
'grouping' => array("avg", "count", "count distinct", "max", "min", "sum"),
|
||||
'edit_functions' => array(
|
||||
array(
|
||||
"char" => "md5",
|
||||
"date|time" => "now",
|
||||
|
@ -906,5 +910,7 @@ AND typelem = 0"
|
|||
"date|time" => "+ interval/- interval", //! escape
|
||||
"char|text" => "||",
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
$drivers["simpledb"] = "SimpleDB";
|
||||
|
||||
if (isset($_GET["simpledb"])) {
|
||||
$possible_drivers = array("SimpleXML + allow_url_fopen");
|
||||
define("DRIVER", "simpledb");
|
||||
|
||||
if (class_exists('SimpleXMLElement') && ini_bool('allow_url_fopen')) {
|
||||
|
@ -476,9 +475,14 @@ if (isset($_GET["simpledb"])) {
|
|||
return $return;
|
||||
}
|
||||
|
||||
$jush = "simpledb";
|
||||
$operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "IS NOT NULL");
|
||||
$functions = array();
|
||||
$grouping = array("count");
|
||||
$edit_functions = array(array("json"));
|
||||
function driver_config() {
|
||||
return array(
|
||||
'possible_drivers' => array("SimpleXML + allow_url_fopen"),
|
||||
'jush' => "simpledb",
|
||||
'operators' => array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "IS NOT NULL"),
|
||||
'functions' => array(),
|
||||
'grouping' => array("count"),
|
||||
'edit_functions' => array(array("json")),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ $drivers["sqlite"] = "SQLite 3";
|
|||
$drivers["sqlite2"] = "SQLite 2";
|
||||
|
||||
if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
|
||||
$possible_drivers = array((isset($_GET["sqlite"]) ? "SQLite3" : "SQLite"), "PDO_SQLite");
|
||||
define("DRIVER", (isset($_GET["sqlite"]) ? "sqlite" : "sqlite2"));
|
||||
if (class_exists(isset($_GET["sqlite"]) ? "SQLite3" : "SQLiteDatabase")) {
|
||||
if (isset($_GET["sqlite"])) {
|
||||
|
@ -785,14 +784,17 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
|
|||
return preg_match('~^(columns|database|drop_col|dump|indexes|descidx|move_col|sql|status|table|trigger|variables|view|view_trigger)$~', $feature);
|
||||
}
|
||||
|
||||
$jush = "sqlite";
|
||||
$types = array("integer" => 0, "real" => 0, "numeric" => 0, "text" => 0, "blob" => 0);
|
||||
$structured_types = array_keys($types);
|
||||
$unsigned = array();
|
||||
$operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL", "SQL"); // REGEXP can be user defined function
|
||||
$functions = array("hex", "length", "lower", "round", "unixepoch", "upper");
|
||||
$grouping = array("avg", "count", "count distinct", "group_concat", "max", "min", "sum");
|
||||
$edit_functions = array(
|
||||
function driver_config() {
|
||||
return array(
|
||||
'possible_drivers' => array((isset($_GET["sqlite"]) ? "SQLite3" : "SQLite"), "PDO_SQLite"),
|
||||
'jush' => "sqlite",
|
||||
'types' => array("integer" => 0, "real" => 0, "numeric" => 0, "text" => 0, "blob" => 0),
|
||||
'structured_types' => array_keys($types),
|
||||
'unsigned' => array(),
|
||||
'operators' => array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL", "SQL"), // REGEXP can be user defined function
|
||||
'functions' => array("hex", "length", "lower", "round", "unixepoch", "upper"),
|
||||
'grouping' => array("avg", "count", "count distinct", "group_concat", "max", "min", "sum"),
|
||||
'edit_functions' => array(
|
||||
array(
|
||||
// "text" => "date('now')/time('now')/datetime('now')",
|
||||
), array(
|
||||
|
@ -800,5 +802,7 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
|
|||
// "text" => "date/time/datetime",
|
||||
"text" => "||",
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,6 +87,17 @@ include "../adminer/drivers/elastic.inc.php";
|
|||
include "../adminer/drivers/clickhouse.inc.php";
|
||||
include "../adminer/drivers/mysql.inc.php"; // must be included as last driver
|
||||
|
||||
$config = driver_config();
|
||||
$possible_drivers = $config['possible_drivers'];
|
||||
$jush = $config['jush'];
|
||||
$types = $config['types'];
|
||||
$structured_types = $config['structured_types'];
|
||||
$unsigned = $config['unsigned'];
|
||||
$operators = $config['operators'];
|
||||
$functions = $config['functions'];
|
||||
$grouping = $config['grouping'];
|
||||
$edit_functions = $config['edit_functions'];
|
||||
|
||||
define("SERVER", $_GET[DRIVER]); // read from pgsql=localhost
|
||||
define("DB", $_GET["db"]); // for the sake of speed and size
|
||||
define("ME", preg_replace('~\?.*~', '', relative_uri()) . '?'
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
<?php
|
||||
$VERSION = "4.7.10-dev";
|
||||
$VERSION = "4.8.0-dev";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Adminer 4.7.10-dev:
|
||||
Adminer 4.8.0-dev:
|
||||
Support function default values in insert (bug #713)
|
||||
Allow SQL pseudo-function in insert
|
||||
Skip date columns for non-date values in search anywhere
|
||||
|
|
Loading…
Reference in a new issue