1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-24 15:12:51 +02:00

Driver plugins: Compatibility with compiled version

This commit is contained in:
Jakub Vrana
2025-04-07 07:51:30 +02:00
parent 025d77c7c6
commit 69890ffc48
13 changed files with 148 additions and 148 deletions

View File

@@ -13,7 +13,7 @@ if (isset($_GET["mssql"])) {
define('Adminer\DRIVER', "mssql");
if (extension_loaded("sqlsrv") && $_GET["ext"] != "pdo") {
class Db extends SqlDb {
public string $extension = "sqlsrv";
public $extension = "sqlsrv";
private $link, $result;
private function get_error() {
@@ -178,7 +178,7 @@ if (isset($_GET["mssql"])) {
if (extension_loaded("pdo_sqlsrv")) {
class Db extends MssqlDb {
public string $extension = "PDO_SQLSRV";
public $extension = "PDO_SQLSRV";
function attach(?string $server, string $username, string $password): string {
return $this->dsn("sqlsrv:Server=" . str_replace(":", ",", $server), $username, $password);
@@ -187,7 +187,7 @@ if (isset($_GET["mssql"])) {
} elseif (extension_loaded("pdo_dblib")) {
class Db extends MssqlDb {
public string $extension = "PDO_DBLIB";
public $extension = "PDO_DBLIB";
function attach(?string $server, string $username, string $password): string {
return $this->dsn("dblib:charset=utf8;host=" . str_replace(":", ";unix_socket=", preg_replace('~:(\d)~', ';port=\1', $server)), $username, $password);
@@ -198,20 +198,20 @@ if (isset($_GET["mssql"])) {
class Driver extends SqlDriver {
static array $extensions = array("SQLSRV", "PDO_SQLSRV", "PDO_DBLIB");
static string $jush = "mssql";
static $extensions = array("SQLSRV", "PDO_SQLSRV", "PDO_DBLIB");
static $jush = "mssql";
public array $insertFunctions = array("date|time" => "getdate");
public array $editFunctions = array(
public $insertFunctions = array("date|time" => "getdate");
public $editFunctions = array(
"int|decimal|real|float|money|datetime" => "+/-",
"char|text" => "+",
);
public array $operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL");
public array $functions = array("len", "lower", "round", "upper");
public array $grouping = array("avg", "count", "count distinct", "max", "min", "sum");
public array $generated = array("PERSISTED", "VIRTUAL");
public string $onActions = "NO ACTION|CASCADE|SET NULL|SET DEFAULT";
public $operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL");
public $functions = array("len", "lower", "round", "upper");
public $grouping = array("avg", "count", "count distinct", "max", "min", "sum");
public $generated = array("PERSISTED", "VIRTUAL");
public $onActions = "NO ACTION|CASCADE|SET NULL|SET DEFAULT";
static function connect(?string $server, string $username, string $password) {
if ($server == "") {

View File

@@ -9,7 +9,7 @@ if (!defined('Adminer\DRIVER')) {
if (extension_loaded("mysqli") && $_GET["ext"] != "pdo") {
class Db extends \MySQLi {
/** @var Db */ static $instance;
public string $extension = "MySQLi", $flavor = '';
public $extension = "MySQLi", $flavor = '';
function __construct() {
parent::init();
@@ -113,7 +113,7 @@ if (!defined('Adminer\DRIVER')) {
}
class Result {
public int $num_rows; // number of rows in the result
public $num_rows; // number of rows in the result
/** @var resource */ private $result;
private int $offset = 0;
@@ -155,7 +155,7 @@ if (!defined('Adminer\DRIVER')) {
} elseif (extension_loaded("pdo_mysql")) {
class Db extends PdoDb {
public string $extension = "PDO_MySQL";
public $extension = "PDO_MySQL";
function attach(?string $server, string $username, string $password): string {
$options = array(\PDO::MYSQL_ATTR_LOCAL_INFILE => false);
@@ -202,13 +202,13 @@ if (!defined('Adminer\DRIVER')) {
class Driver extends SqlDriver {
/** @var list<string> */ static array $extensions = array("MySQLi", "MySQL", "PDO_MySQL");
static string $jush = "sql"; // JUSH identifier
static $extensions = array("MySQLi", "MySQL", "PDO_MySQL");
static $jush = "sql"; // JUSH identifier
/** @var list<string> */ public array $unsigned = array("unsigned", "zerofill", "unsigned zerofill");
/** @var list<string> */ public array $operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "REGEXP", "IN", "FIND_IN_SET", "IS NULL", "NOT LIKE", "NOT REGEXP", "NOT IN", "IS NOT NULL", "SQL");
/** @var list<string> */ public array $functions = array("char_length", "date", "from_unixtime", "lower", "round", "floor", "ceil", "sec_to_time", "time_to_sec", "upper");
/** @var list<string> */ public array $grouping = array("avg", "count", "count distinct", "group_concat", "max", "min", "sum");
public $unsigned = array("unsigned", "zerofill", "unsigned zerofill");
public $operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "REGEXP", "IN", "FIND_IN_SET", "IS NULL", "NOT LIKE", "NOT REGEXP", "NOT IN", "IS NOT NULL", "SQL");
public $functions = array("char_length", "date", "from_unixtime", "lower", "round", "floor", "ceil", "sec_to_time", "time_to_sec", "upper");
public $grouping = array("avg", "count", "count distinct", "group_concat", "max", "min", "sum");
static function connect(?string $server, string $username, string $password) {
$connection = parent::connect($server, $username, $password);

View File

@@ -7,7 +7,7 @@ if (isset($_GET["oracle"])) {
define('Adminer\DRIVER', "oracle");
if (extension_loaded("oci8") && $_GET["ext"] != "pdo") {
class Db extends SqlDb {
public string $extension = "oci8";
public $extension = "oci8";
public $_current_db;
private $link;
@@ -102,7 +102,7 @@ if (isset($_GET["oracle"])) {
} elseif (extension_loaded("pdo_oci")) {
class Db extends PdoDb {
public string $extension = "PDO_OCI";
public $extension = "PDO_OCI";
public $_current_db;
function attach(?string $server, string $username, string $password): string {
@@ -120,22 +120,22 @@ if (isset($_GET["oracle"])) {
class Driver extends SqlDriver {
static array $extensions = array("OCI8", "PDO_OCI");
static string $jush = "oracle";
static $extensions = array("OCI8", "PDO_OCI");
static $jush = "oracle";
public array $insertFunctions = array( //! no parentheses
public $insertFunctions = array( //! no parentheses
"date" => "current_date",
"timestamp" => "current_timestamp",
);
public array $editFunctions = array(
public $editFunctions = array(
"number|float|double" => "+/-",
"date|timestamp" => "+ interval/- interval",
"char|clob" => "||",
);
public array $operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL", "SQL");
public array $functions = array("length", "lower", "round", "upper");
public array $grouping = array("avg", "count", "count distinct", "max", "min", "sum");
public $operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL", "SQL");
public $functions = array("length", "lower", "round", "upper");
public $grouping = array("avg", "count", "count distinct", "max", "min", "sum");
function __construct(Db $connection) {
parent::__construct($connection);

View File

@@ -7,8 +7,8 @@ if (isset($_GET["pgsql"])) {
define('Adminer\DRIVER', "pgsql");
if (extension_loaded("pgsql") && $_GET["ext"] != "pdo") {
class PgsqlDb extends SqlDb {
public string $extension = "PgSQL";
public int $timeout = 0;
public $extension = "PgSQL";
public $timeout = 0;
private $link, $string, $database = true;
function _error($errno, $error) {
@@ -137,8 +137,8 @@ if (isset($_GET["pgsql"])) {
} elseif (extension_loaded("pdo_pgsql")) {
class PgsqlDb extends PdoDb {
public string $extension = "PDO_PgSQL";
public int $timeout = 0;
public $extension = "PDO_PgSQL";
public $timeout = 0;
function attach(?string $server, string $username, string $password): string {
$db = adminer()->database();
@@ -198,12 +198,12 @@ if (isset($_GET["pgsql"])) {
class Driver extends SqlDriver {
static array $extensions = array("PgSQL", "PDO_PgSQL");
static string $jush = "pgsql";
static $extensions = array("PgSQL", "PDO_PgSQL");
static $jush = "pgsql";
public array $operators = array("=", "<", ">", "<=", ">=", "!=", "~", "!~", "LIKE", "LIKE %%", "ILIKE", "ILIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL"); // no "SQL" to avoid CSRF
public array $functions = array("char_length", "lower", "round", "to_hex", "to_timestamp", "upper");
public array $grouping = array("avg", "count", "count distinct", "max", "min", "sum");
public $operators = array("=", "<", ">", "<=", ">=", "!=", "~", "!~", "LIKE", "LIKE %%", "ILIKE", "ILIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL"); // no "SQL" to avoid CSRF
public $functions = array("char_length", "lower", "round", "to_hex", "to_timestamp", "upper");
public $grouping = array("avg", "count", "count distinct", "max", "min", "sum");
static function connect(?string $server, string $username, string $password) {
$connection = parent::connect($server, $username, $password);

View File

@@ -8,7 +8,7 @@ if (isset($_GET["sqlite"])) {
if (class_exists("SQLite3") && $_GET["ext"] != "pdo") {
abstract class SqliteDb extends SqlDb {
public string $extension = "SQLite3";
public $extension = "SQLite3";
private $link;
function attach(?string $filename, string $username, string $password): string {
@@ -73,7 +73,7 @@ if (isset($_GET["sqlite"])) {
} elseif (extension_loaded("pdo_sqlite")) {
abstract class SqliteDb extends PdoDb {
public string $extension = "PDO_SQLite";
public $extension = "PDO_SQLite";
function attach(?string $filename, string $username, string $password): string {
$this->dsn(DRIVER . ":$filename", "", "");
@@ -106,21 +106,21 @@ if (isset($_GET["sqlite"])) {
class Driver extends SqlDriver {
static array $extensions = array("SQLite3", "PDO_SQLite");
static string $jush = "sqlite";
static $extensions = array("SQLite3", "PDO_SQLite");
static $jush = "sqlite";
protected array $types = array(array("integer" => 0, "real" => 0, "numeric" => 0, "text" => 0, "blob" => 0));
protected $types = array(array("integer" => 0, "real" => 0, "numeric" => 0, "text" => 0, "blob" => 0));
public array $insertFunctions = array(); // "text" => "date('now')/time('now')/datetime('now')",
public array $editFunctions = array(
public $insertFunctions = array(); // "text" => "date('now')/time('now')/datetime('now')",
public $editFunctions = array(
"integer|real|numeric" => "+/-",
// "text" => "date/time/datetime",
"text" => "||",
);
public array $operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL", "SQL"); // REGEXP can be user defined function
public array $functions = array("hex", "length", "lower", "round", "unixepoch", "upper");
public array $grouping = array("avg", "count", "count distinct", "group_concat", "max", "min", "sum");
public $operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL", "SQL"); // REGEXP can be user defined function
public $functions = array("hex", "length", "lower", "round", "unixepoch", "upper");
public $grouping = array("avg", "count", "count distinct", "group_concat", "max", "min", "sum");
static function connect(?string $server, string $username, string $password) {
if ($password != "") {