1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-08 07:36:44 +02:00

Move types to Driver

This commit is contained in:
Jakub Vrana
2025-03-06 12:35:20 +01:00
parent d2add4dd72
commit 37a75f3759
15 changed files with 125 additions and 151 deletions

View File

@@ -131,6 +131,16 @@ if (isset($_GET["clickhouse"])) {
class Driver extends SqlDriver {
function __construct($connection) {
parent::__construct($connection);
$this->types = array( //! arrays
lang('Numbers') => array("Int8" => 3, "Int16" => 5, "Int32" => 10, "Int64" => 19, "UInt8" => 3, "UInt16" => 5, "UInt32" => 10, "UInt64" => 20, "Float32" => 7, "Float64" => 16, 'Decimal' => 38, 'Decimal32' => 9, 'Decimal64' => 18, 'Decimal128' => 38),
lang('Date and time') => array("Date" => 13, "DateTime" => 20),
lang('Strings') => array("String" => 0),
lang('Binary') => array("FixedString" => 0),
);
}
function delete($table, $queryWhere, $limit = 0) {
if ($queryWhere === '') {
$queryWhere = 'WHERE 1=1';
@@ -369,23 +379,8 @@ if (isset($_GET["clickhouse"])) {
}
function driver_config() {
$types = array();
$structured_types = array();
foreach (
array( //! arrays
lang('Numbers') => array("Int8" => 3, "Int16" => 5, "Int32" => 10, "Int64" => 19, "UInt8" => 3, "UInt16" => 5, "UInt32" => 10, "UInt64" => 20, "Float32" => 7, "Float64" => 16, 'Decimal' => 38, 'Decimal32' => 9, 'Decimal64' => 18, 'Decimal128' => 38),
lang('Date and time') => array("Date" => 13, "DateTime" => 20),
lang('Strings') => array("String" => 0),
lang('Binary') => array("FixedString" => 0),
) as $key => $val
) {
$types += $val;
$structured_types[$key] = array_keys($val);
}
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(),

View File

@@ -122,6 +122,15 @@ if (isset($_GET["elastic"])) {
}
class Driver extends SqlDriver {
function __construct($connection) {
parent::__construct($connection);
$this->types = 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),
lang('Strings') => array("string" => 65535, "text" => 65535),
lang('Binary') => array("binary" => 255),
);
}
function select($table, $select, $where, $group, $order = array(), $limit = 1, $page = 0, $print = false) {
$data = array();
@@ -554,21 +563,6 @@ if (isset($_GET["elastic"])) {
}
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),
lang('Strings') => array("string" => 65535, "text" => 65535),
lang('Binary') => array("binary" => 255),
) as $key => $val
) {
$types += $val;
$structured_types[$key] = array_keys($val);
}
return array(
'possible_drivers' => array("json + allow_url_fopen"),
'jush' => "elastic",
@@ -576,8 +570,6 @@ if (isset($_GET["elastic"])) {
'functions' => array(),
'grouping' => array(),
'edit_functions' => array(array("json")),
'types' => $types,
'structured_types' => $structured_types,
);
}
}

View File

@@ -113,6 +113,15 @@ if (isset($_GET["elastic5"])) {
}
class Driver extends SqlDriver {
function __construct($connection) {
parent::__construct($connection);
$this->types = 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),
lang('Strings') => array("string" => 65535, "text" => 65535),
lang('Binary') => array("binary" => 255),
);
}
function select($table, $select, $where, $group, $order = array(), $limit = 1, $page = 0, $print = false) {
$data = array();
@@ -520,21 +529,6 @@ if (isset($_GET["elastic5"])) {
}
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),
lang('Strings') => array("string" => 65535, "text" => 65535),
lang('Binary') => array("binary" => 255),
) as $key => $val
) {
$types += $val;
$structured_types[$key] = array_keys($val);
}
return array(
'possible_drivers' => array("json + allow_url_fopen"),
'jush' => "elastic",
@@ -542,8 +536,6 @@ if (isset($_GET["elastic5"])) {
'functions' => array(),
'grouping' => array(),
'edit_functions' => array(array("json")),
'types' => $types,
'structured_types' => $structured_types,
);
}
}