diff --git a/adminer/drivers/mongo.inc.php b/adminer/drivers/mongo.inc.php index d1e0b1e3..65faee34 100644 --- a/adminer/drivers/mongo.inc.php +++ b/adminer/drivers/mongo.inc.php @@ -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(), ); } } diff --git a/adminer/drivers/mssql.inc.php b/adminer/drivers/mssql.inc.php index d993094d..472e7912 100644 --- a/adminer/drivers/mssql.inc.php +++ b/adminer/drivers/mssql.inc.php @@ -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"), ); } } diff --git a/adminer/drivers/mysql.inc.php b/adminer/drivers/mysql.inc.php index c3399ab9..d5492825 100644 --- a/adminer/drivers/mysql.inc.php +++ b/adminer/drivers/mysql.inc.php @@ -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 ); } } diff --git a/adminer/drivers/oracle.inc.php b/adminer/drivers/oracle.inc.php index af33c6c6..0e11e878 100644 --- a/adminer/drivers/oracle.inc.php +++ b/adminer/drivers/oracle.inc.php @@ -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"), ); } } diff --git a/adminer/drivers/pgsql.inc.php b/adminer/drivers/pgsql.inc.php index 180c6baf..c08bce14 100644 --- a/adminer/drivers/pgsql.inc.php +++ b/adminer/drivers/pgsql.inc.php @@ -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"), ); } } diff --git a/adminer/drivers/sqlite.inc.php b/adminer/drivers/sqlite.inc.php index 0a01b6b4..d428fbd3 100644 --- a/adminer/drivers/sqlite.inc.php +++ b/adminer/drivers/sqlite.inc.php @@ -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"), ); } } diff --git a/adminer/include/adminer.inc.php b/adminer/include/adminer.inc.php index c90c8a3c..f7de73a3 100644 --- a/adminer/include/adminer.inc.php +++ b/adminer/include/adminer.inc.php @@ -361,7 +361,7 @@ class Adminer { * @return null */ function selectColumnsPrint($select, $columns) { - global $functions, $grouping; + global $driver; print_fieldset("select", lang('Select'), $select); $i = 0; $select[""] = array(); @@ -373,8 +373,8 @@ class Adminer { $val["col"], ($key !== "" ? "selectFieldChange" : "selectAddRow") ); - echo "