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) {
}
return $data;
}
-
- $operators = array(
- "=",
- "!=",
- ">",
- "<",
- ">=",
- "<=",
- "regex",
- "(f)=",
- "(f)!=",
- "(f)>",
- "(f)<",
- "(f)>=",
- "(f)<=",
- "(date)=",
- "(date)!=",
- "(date)>",
- "(date)<",
- "(date)>=",
- "(date)<=",
- );
}
function table($idf) {
}
function driver_config() {
- global $operators;
return array(
'possible_drivers' => array("mongodb"),
'jush' => "mongo",
- 'operators' => $operators,
- 'functions' => array(),
- 'grouping' => array(),
);
}
}
)
);
+ 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
'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"),
);
}
}
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(
}
/** 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
);
}
}
)
);
+ 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(
'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"),
);
}
}
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
'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"),
);
}
}
)
);
+ 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]);
}
'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"),
);
}
}
* @return null
*/
function selectColumnsPrint($select, $columns) {
- global $functions, $grouping;
+ global $driver;
print_fieldset("select", lang('Select'), $select);
$i = 0;
$select[""] = array();
$val["col"],
($key !== "" ? "selectFieldChange" : "selectAddRow")
);
- echo "<div>" . ($functions || $grouping ? "<select name='columns[$i][fun]'>"
- . optionlist(array(-1 => "") + array_filter(array(lang('Functions') => $functions, lang('Aggregation') => $grouping)), $val["fun"]) . "</select>"
+ echo "<div>" . ($driver->functions || $driver->grouping ? "<select name='columns[$i][fun]'>"
+ . optionlist(array(-1 => "") + array_filter(array(lang('Functions') => $driver->functions, lang('Aggregation') => $driver->grouping)), $val["fun"]) . "</select>"
. on_help("getTarget(event).value && getTarget(event).value.replace(/ |\$/, '(') + ')'", 1)
. script("qsl('select').onchange = function () { helpClose();" . ($key !== "" ? "" : " qsl('select, input', this.parentNode).onchange();") . " };", "")
. "($column)" : $column) . "</div>\n";
* @return array [[select_expressions], [group_expressions]]
*/
function selectColumnsProcess($columns, $indexes) {
- global $functions, $grouping;
+ global $driver;
$select = array(); // select expressions, empty for *
$group = array(); // expressions without aggregation - will be used for GROUP BY if an aggregation function is used
foreach ((array) $_GET["columns"] as $key => $val) {
- if ($val["fun"] == "count" || ($val["col"] != "" && (!$val["fun"] || in_array($val["fun"], $functions) || in_array($val["fun"], $grouping)))) {
+ if ($val["fun"] == "count" || ($val["col"] != "" && (!$val["fun"] || in_array($val["fun"], $driver->functions) || in_array($val["fun"], $driver->grouping)))) {
$select[$key] = apply_sql_function($val["fun"], ($val["col"] != "" ? idf_escape($val["col"]) : "*"));
- if (!in_array($val["fun"], $grouping)) {
+ if (!in_array($val["fun"], $driver->grouping)) {
$group[] = $select[$key];
}
}
check_invalid_login();
$connection = connect();
$driver = new Driver($connection);
+ if ($adminer->operators === null) {
+ $adminer->operators = $driver->operators;
+ }
}
$login = null;
exit;
}
-global $adminer, $connection, $driver, $drivers, $enum_length, $error, $functions, $grouping, $HTTPS, $inout, $jush, $LANG, $langs, $on_actions, $permanent, $has_token, $token, $translations, $unsigned, $VERSION; // allows including Adminer inside a function
+global $adminer, $connection, $driver, $drivers, $enum_length, $error, $HTTPS, $inout, $jush, $LANG, $langs, $on_actions, $permanent, $has_token, $token, $translations, $unsigned, $VERSION; // allows including Adminer inside a function
if (!$_SERVER["REQUEST_URI"]) { // IIS 5 compatibility
$_SERVER["REQUEST_URI"] = $_SERVER["ORIG_PATH_INFO"];
$possible_drivers = $config['possible_drivers'];
$jush = $config['jush'];
$unsigned = $config['unsigned'];
-$operators = $config['operators'];
-$functions = $config['functions'];
-$grouping = $config['grouping'];
-if ($adminer->operators === null) {
- $adminer->operators = $operators;
-}
define("SERVER", $_GET[DRIVER]); // read from pgsql=localhost
define("DB", $_GET["db"]); // for the sake of speed and size
var $_conn;
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 $operators = array(); ///< @var array operators used in select
+ var $functions = array(); ///< @var array functions used in select
+ var $grouping = array(); ///< @var array grouping functions used in select
/** Create object for performing database operations
* @param Db
class Driver extends SqlDriver {
+ 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");
+
function __construct($connection) {
parent::__construct($connection);
$this->types = array( //! arrays
return array(
'jush' => "clickhouse",
'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"),
);
}
}
class Driver extends SqlDriver {
var $editFunctions = array(array("json"));
+ var $operators = array("=", "must", "should", "must_not");
function __construct($connection) {
parent::__construct($connection);
return array(
'possible_drivers' => array("json + allow_url_fopen"),
'jush' => "elastic",
- 'operators' => array("=", "must", "should", "must_not"),
- 'functions' => array(),
- 'grouping' => array(),
);
}
}
class Driver extends SqlDriver {
var $editFunctions = array(array("json"));
+ var $operators = array("=", "must", "should", "must_not");
function __construct($connection) {
parent::__construct($connection);
return array(
'possible_drivers' => array("json + allow_url_fopen"),
'jush' => "elastic",
- 'operators' => array("=", "must", "should", "must_not"),
- 'functions' => array(),
- 'grouping' => array(),
);
}
}
class Driver extends SqlDriver {
+ var $operators = array("=");
}
return array(
'possible_drivers' => array("interbase"),
'jush' => "firebird",
- 'operators' => array("="),
- 'functions' => array(),
- 'grouping' => array(),
);
}
}
class Driver extends SqlDriver {
+ var $operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "IS NOT NULL");
+ var $grouping = array("count");
+
public $primary = "itemName()";
function _chunkRequest($ids, $action, $params, $expand = array()) {
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"),
);
}
}