mirror of
https://github.com/vrana/adminer.git
synced 2025-08-16 19:44:00 +02:00
Move operators, functions and grouping to Driver
This commit is contained in:
@@ -115,6 +115,29 @@ if (isset($_GET["mongo"])) {
|
||||
|
||||
class Driver extends SqlDriver {
|
||||
var $editFunctions = array(array("json"));
|
||||
|
||||
var $operators = array(
|
||||
"=",
|
||||
"!=",
|
||||
">",
|
||||
"<",
|
||||
">=",
|
||||
"<=",
|
||||
"regex",
|
||||
"(f)=",
|
||||
"(f)!=",
|
||||
"(f)>",
|
||||
"(f)<",
|
||||
"(f)>=",
|
||||
"(f)<=",
|
||||
"(date)=",
|
||||
"(date)!=",
|
||||
"(date)>",
|
||||
"(date)<",
|
||||
"(date)>=",
|
||||
"(date)<=",
|
||||
);
|
||||
|
||||
public $primary = "_id";
|
||||
|
||||
function select($table, $select, $where, $group, $order = array(), $limit = 1, $page = 0, $print = false) {
|
||||
@@ -349,28 +372,6 @@ if (isset($_GET["mongo"])) {
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
$operators = array(
|
||||
"=",
|
||||
"!=",
|
||||
">",
|
||||
"<",
|
||||
">=",
|
||||
"<=",
|
||||
"regex",
|
||||
"(f)=",
|
||||
"(f)!=",
|
||||
"(f)>",
|
||||
"(f)<",
|
||||
"(f)>=",
|
||||
"(f)<=",
|
||||
"(date)=",
|
||||
"(date)!=",
|
||||
"(date)>",
|
||||
"(date)<",
|
||||
"(date)>=",
|
||||
"(date)<=",
|
||||
);
|
||||
}
|
||||
|
||||
function table($idf) {
|
||||
@@ -532,13 +533,9 @@ if (isset($_GET["mongo"])) {
|
||||
}
|
||||
|
||||
function driver_config() {
|
||||
global $operators;
|
||||
return array(
|
||||
'possible_drivers' => array("mongodb"),
|
||||
'jush' => "mongo",
|
||||
'operators' => $operators,
|
||||
'functions' => array(),
|
||||
'grouping' => array(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -195,6 +195,10 @@ if (isset($_GET["mssql"])) {
|
||||
)
|
||||
);
|
||||
|
||||
var $operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL");
|
||||
var $functions = array("len", "lower", "round", "upper");
|
||||
var $grouping = array("avg", "count", "count distinct", "max", "min", "sum");
|
||||
|
||||
function __construct($connection) {
|
||||
parent::__construct($connection);
|
||||
$this->types = array( //! use sys.types
|
||||
@@ -707,9 +711,6 @@ WHERE sys1.xtype = 'TR' AND sys2.name = " . q($table)) as $row
|
||||
'possible_drivers' => array("SQLSRV", "PDO_SQLSRV", "PDO_DBLIB"),
|
||||
'jush' => "mssql",
|
||||
'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"),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -281,6 +281,10 @@ if (!defined("DRIVER")) {
|
||||
|
||||
|
||||
class Driver extends SqlDriver {
|
||||
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 $grouping = array("avg", "count", "count distinct", "group_concat", "max", "min", "sum");
|
||||
|
||||
function __construct($connection) {
|
||||
parent::__construct($connection);
|
||||
$this->types = array(
|
||||
@@ -1193,16 +1197,13 @@ if (!defined("DRIVER")) {
|
||||
}
|
||||
|
||||
/** Get driver config
|
||||
* @return array ['possible_drivers' => , 'jush' => , 'unsigned' => , 'operators' => , 'functions' => , 'grouping' => ]
|
||||
* @return array ['possible_drivers' => , 'jush' => , 'unsigned' => ]
|
||||
*/
|
||||
function driver_config() {
|
||||
return array(
|
||||
'possible_drivers' => array("MySQLi", "MySQL", "PDO_MySQL"),
|
||||
'jush' => "sql", ///< @var string JUSH identifier
|
||||
'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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -152,6 +152,10 @@ if (isset($_GET["oracle"])) {
|
||||
)
|
||||
);
|
||||
|
||||
var $operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL", "SQL");
|
||||
var $functions = array("length", "lower", "round", "upper");
|
||||
var $grouping = array("avg", "count", "count distinct", "max", "min", "sum");
|
||||
|
||||
function __construct($connection) {
|
||||
parent::__construct($connection);
|
||||
$this->types = array(
|
||||
@@ -546,9 +550,6 @@ ORDER BY PROCESS
|
||||
'possible_drivers' => array("OCI8", "PDO_OCI"),
|
||||
'jush' => "oracle",
|
||||
'unsigned' => array(),
|
||||
'operators' => array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL", "SQL"),
|
||||
'functions' => array("length", "lower", "round", "upper"),
|
||||
'grouping' => array("avg", "count", "count distinct", "max", "min", "sum"),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -196,6 +196,10 @@ if (isset($_GET["pgsql"])) {
|
||||
|
||||
|
||||
class Driver extends SqlDriver {
|
||||
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 $grouping = array("avg", "count", "count distinct", "max", "min", "sum");
|
||||
|
||||
function __construct($connection) {
|
||||
parent::__construct($connection);
|
||||
$this->types = array( //! arrays
|
||||
@@ -937,9 +941,6 @@ AND typelem = 0"
|
||||
'possible_drivers' => array("PgSQL", "PDO_PgSQL"),
|
||||
'jush' => "pgsql",
|
||||
'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"),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -139,6 +139,10 @@ if (isset($_GET["sqlite"])) {
|
||||
)
|
||||
);
|
||||
|
||||
var $operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL", "SQL"); // REGEXP can be user defined function
|
||||
var $functions = array("hex", "length", "lower", "round", "unixepoch", "upper");
|
||||
var $grouping = array("avg", "count", "count distinct", "group_concat", "max", "min", "sum");
|
||||
|
||||
function structuredTypes() {
|
||||
return array_keys($this->types[0]);
|
||||
}
|
||||
@@ -739,9 +743,6 @@ if (isset($_GET["sqlite"])) {
|
||||
'possible_drivers' => array("SQLite3", "PDO_SQLite"),
|
||||
'jush' => "sqlite",
|
||||
'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"),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user