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

Move engines() to Driver

This commit is contained in:
Jakub Vrana
2025-03-18 13:41:24 +01:00
parent b2f904c64f
commit a3d1ab34bb
12 changed files with 18 additions and 50 deletions

View File

@@ -168,7 +168,7 @@ if (!$_POST) {
}
$collations = collations();
$engines = engines();
$engines = $driver->engines();
// case of engine may differ
foreach ($engines as $engine) {
if (!strcasecmp($engine, $row["Engine"])) {

View File

@@ -309,10 +309,6 @@ if (isset($_GET["mssql"])) {
return get_val("SELECT collation_name FROM sys.databases WHERE name = " . q($db));
}
function engines() {
return array();
}
function logged_user() {
return get_val("SELECT SUSER_NAME()");
}

View File

@@ -410,6 +410,16 @@ if (!defined('Adminer\DRIVER')) {
}
return $c_style;
}
function engines() {
$return = array();
foreach (get_rows("SHOW ENGINES") as $row) {
if (preg_match("~YES|DEFAULT~", $row["Support"])) {
$return[] = $row["Engine"];
}
}
return $return;
}
}
@@ -508,19 +518,6 @@ if (!defined('Adminer\DRIVER')) {
return $return;
}
/** Get supported engines
* @return array
*/
function engines() {
$return = array();
foreach (get_rows("SHOW ENGINES") as $row) {
if (preg_match("~YES|DEFAULT~", $row["Support"])) {
$return[] = $row["Engine"];
}
}
return $return;
}
/** Get logged user
* @return string
*/

View File

@@ -247,10 +247,6 @@ ORDER BY 1"
return get_val("SELECT value FROM nls_database_parameters WHERE parameter = 'NLS_CHARACTERSET'"); //! respect $db
}
function engines() {
return array();
}
function logged_user() {
return get_val("SELECT USER FROM DUAL");
}

View File

@@ -366,10 +366,6 @@ ORDER BY datname");
return get_val("SELECT datcollate FROM pg_database WHERE datname = " . q($db));
}
function engines() {
return array();
}
function logged_user() {
return get_val("SELECT user");
}

View File

@@ -219,10 +219,6 @@ if (isset($_GET["sqlite"])) {
return get_val("PRAGMA encoding"); // there is no database list so $db == DB
}
function engines() {
return array();
}
function logged_user() {
return get_current_user(); // should return effective user
}

View File

@@ -253,6 +253,13 @@ abstract class SqlDriver {
return false;
}
/** Get supported engines
* @return array
*/
function engines() {
return array();
}
/** Check whether table supports indexes
* @param array result of table_status()
* @return bool

View File

@@ -348,10 +348,6 @@ if (isset($_GET["elastic"])) {
//
}
function engines() {
return array();
}
function count_tables($databases) {
$return = connection()->rootQuery('_aliases');
return array("elastic" => ($return ? count($return) : 0));

View File

@@ -159,10 +159,6 @@ if (isset($_GET["firebird"])) {
function db_collation($db, $collations) {
}
function engines() {
return array();
}
function logged_user() {
$adminer = adminer();
$credentials = $adminer->credentials();

View File

@@ -252,10 +252,6 @@ if (isset($_GET["imap"])) {
function fk_support($table_status) {
}
function engines() {
return array();
}
function alter_table($table, $name, $fields, $foreign, $comment, $engine, $collation, $auto_increment, $partitioning) {
return connection()->create($name);
}

View File

@@ -500,10 +500,6 @@ if (isset($_GET["mongo"])) {
function fk_support($table_status) {
}
function engines() {
return array();
}
function alter_table($table, $name, $fields, $foreign, $comment, $engine, $collation, $auto_increment, $partitioning) {
if ($table == "") {
connection()->_db->createCollection($name);

View File

@@ -368,10 +368,6 @@ if (isset($_GET["simpledb"])) {
function fk_support($table_status) {
}
function engines() {
return array();
}
function alter_table($table, $name, $fields, $foreign, $comment, $engine, $collation, $auto_increment, $partitioning) {
return ($table == "" && sdb_request('CreateDomain', array('DomainName' => $name)));
}