mirror of
https://github.com/vrana/adminer.git
synced 2025-08-08 15:47:00 +02:00
CockroachDB: Display CockroachDB instead of PostgreSQL
This commit is contained in:
@@ -441,7 +441,7 @@ if (!defined('Adminer\DRIVER')) {
|
|||||||
$connection->set_charset(charset($connection));
|
$connection->set_charset(charset($connection));
|
||||||
$connection->query("SET sql_quote_show_create = 1, autocommit = 1");
|
$connection->query("SET sql_quote_show_create = 1, autocommit = 1");
|
||||||
$connection->maria = preg_match('~MariaDB~', $connection->server_info);
|
$connection->maria = preg_match('~MariaDB~', $connection->server_info);
|
||||||
$drivers["server"] = ($connection->maria ? "MariaDB" : "MySQL");
|
$drivers[DRIVER] = ($connection->maria ? "MariaDB" : "MySQL");
|
||||||
return $connection;
|
return $connection;
|
||||||
}
|
}
|
||||||
$return = $connection->error;
|
$return = $connection->error;
|
||||||
|
@@ -321,6 +321,7 @@ if (isset($_GET["pgsql"])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function connect($credentials) {
|
function connect($credentials) {
|
||||||
|
global $drivers;
|
||||||
$connection = new Db;
|
$connection = new Db;
|
||||||
if ($connection->connect($credentials[0], $credentials[1], $credentials[2])) {
|
if ($connection->connect($credentials[0], $credentials[1], $credentials[2])) {
|
||||||
if (min_version(9, 0, $connection)) {
|
if (min_version(9, 0, $connection)) {
|
||||||
@@ -328,6 +329,10 @@ if (isset($_GET["pgsql"])) {
|
|||||||
}
|
}
|
||||||
$crdb_version = $connection->result("SHOW crdb_version");
|
$crdb_version = $connection->result("SHOW crdb_version");
|
||||||
$connection->server_info .= ($crdb_version ? "-" . preg_replace('~ \(.*~', '', $crdb_version) : "");
|
$connection->server_info .= ($crdb_version ? "-" . preg_replace('~ \(.*~', '', $crdb_version) : "");
|
||||||
|
$connection->cockroach = preg_match('~CockroachDB~', $connection->server_info);
|
||||||
|
if ($connection->cockroach) { // we don't use "PostgreSQL / CockroachDB" by default because it's too long
|
||||||
|
$drivers[DRIVER] = "CockroachDB";
|
||||||
|
}
|
||||||
return $connection;
|
return $connection;
|
||||||
}
|
}
|
||||||
return $connection->error;
|
return $connection->error;
|
||||||
@@ -954,10 +959,10 @@ AND typelem = 0"
|
|||||||
|
|
||||||
function support($feature) {
|
function support($feature) {
|
||||||
global $connection;
|
global $connection;
|
||||||
return ($feature == "processlist"
|
return preg_match('~^(check|database|table|columns|sql|indexes|descidx|comment|view|' . (min_version(9.3) ? 'materializedview|' : '') . 'scheme|routine|sequence|trigger|type|variables|drop_col'
|
||||||
? !preg_match('~CockroachDB~', $connection->server_info) // https://github.com/cockroachdb/cockroach/issues/24745
|
. ($connection->cockroach ? '' : '|processlist') // https://github.com/cockroachdb/cockroach/issues/24745
|
||||||
: preg_match('~^(check|database|table|columns|sql|indexes|descidx|comment|view|' . (min_version(9.3) ? 'materializedview|' : '') . 'scheme|routine|sequence|trigger|type|variables|drop_col|kill|dump)$~', $feature)
|
. '|kill|dump)$~', $feature)
|
||||||
);
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
function kill_process($val) {
|
function kill_process($val) {
|
||||||
|
@@ -169,7 +169,7 @@ if (isset($_GET["username"]) && is_string(get_password())) {
|
|||||||
if ($adminer->operators === null) {
|
if ($adminer->operators === null) {
|
||||||
$adminer->operators = $driver->operators;
|
$adminer->operators = $driver->operators;
|
||||||
}
|
}
|
||||||
if (isset($connection->maria)) {
|
if (isset($connection->maria) || $connection->cockroach) {
|
||||||
save_settings(array("vendor-" . SERVER => $drivers[DRIVER]));
|
save_settings(array("vendor-" . SERVER => $drivers[DRIVER]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user