1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-11 09:04:02 +02:00

Rename Min_ classes

This commit is contained in:
Jakub Vrana
2025-03-05 14:12:42 +01:00
parent 45ac930e06
commit 3da09dd31a
18 changed files with 89 additions and 90 deletions

View File

@@ -7,7 +7,7 @@ if (isset($_GET["mongo"])) {
define("DRIVER", "mongo");
if (class_exists('MongoDB\Driver\Manager')) {
class Min_DB {
class Db {
var $extension = "MongoDB", $server_info = MONGODB_VERSION, $affected_rows, $error, $last_id;
/** @var MongoDB\Driver\Manager */
var $_link;
@@ -54,7 +54,7 @@ if (isset($_GET["mongo"])) {
}
}
class Min_Result {
class Result {
var $num_rows, $_rows = array(), $_offset = 0, $_charset = array();
function __construct($result) {
@@ -116,7 +116,7 @@ if (isset($_GET["mongo"])) {
}
class Min_Driver extends Min_SQL {
class Driver extends SqlDriver {
public $primary = "_id";
function select($table, $select, $where, $group, $order = array(), $limit = 1, $page = 0, $print = false) {
@@ -141,7 +141,7 @@ if (isset($_GET["mongo"])) {
$skip = $page * $limit;
$class = 'MongoDB\Driver\Query';
try {
return new Min_Result($connection->_link->executeQuery("$connection->_db_name.$table", new $class($where, array('projection' => $select, 'limit' => $limit, 'skip' => $skip, 'sort' => $sort))));
return new Result($connection->_link->executeQuery("$connection->_db_name.$table", new $class($where, array('projection' => $select, 'limit' => $limit, 'skip' => $skip, 'sort' => $sort))));
} catch (Exception $e) {
$connection->error = $e->getMessage();
return false;
@@ -425,7 +425,7 @@ if (isset($_GET["mongo"])) {
function connect() {
global $adminer;
$connection = new Min_DB;
$connection = new Db;
list($server, $username, $password) = $adminer->credentials();
if ($server == "") {

View File

@@ -12,7 +12,7 @@ $drivers["mssql"] = "MS SQL";
if (isset($_GET["mssql"])) {
define("DRIVER", "mssql");
if (extension_loaded("sqlsrv")) {
class Min_DB {
class Db {
var $extension = "sqlsrv", $_link, $_result, $server_info, $affected_rows, $errno, $error;
function _get_error() {
@@ -85,7 +85,7 @@ if (isset($_GET["mssql"])) {
return false;
}
if (sqlsrv_field_metadata($result)) {
return new Min_Result($result);
return new Result($result);
}
$this->affected_rows = sqlsrv_rows_affected($result);
return true;
@@ -105,7 +105,7 @@ if (isset($_GET["mssql"])) {
}
}
class Min_Result {
class Result {
var $_result, $_offset = 0, $_fields, $num_rows;
function __construct($result) {
@@ -155,7 +155,7 @@ if (isset($_GET["mssql"])) {
}
} elseif (extension_loaded("pdo_sqlsrv")) {
class Min_DB extends Min_PDO {
class Db extends PdoDb {
var $extension = "PDO_SQLSRV";
function connect($server, $username, $password) {
@@ -170,7 +170,7 @@ if (isset($_GET["mssql"])) {
}
} elseif (extension_loaded("pdo_dblib")) {
class Min_DB extends Min_PDO {
class Db extends PdoDb {
var $extension = "PDO_DBLIB";
function connect($server, $username, $password) {
@@ -185,7 +185,7 @@ if (isset($_GET["mssql"])) {
}
class Min_Driver extends Min_SQL {
class Driver extends SqlDriver {
function insertUpdate($table, $rows, $primary) {
$fields = fields($table);
@@ -255,7 +255,7 @@ if (isset($_GET["mssql"])) {
function connect() {
global $adminer;
$connection = new Min_DB;
$connection = new Db;
$credentials = $adminer->credentials();
if ($credentials[0] == "") {

View File

@@ -7,7 +7,7 @@ if (!defined("DRIVER")) {
define("DRIVER", "server"); // server - backwards compatibility
// MySQLi supports everything, MySQL doesn't support multiple result sets, PDO_MySQL doesn't support orgtable
if (extension_loaded("mysqli")) {
class Min_DB extends \MySQLi {
class Db extends \MySQLi {
var $extension = "MySQLi";
function __construct() {
@@ -59,7 +59,7 @@ if (!defined("DRIVER")) {
}
} elseif (extension_loaded("mysql") && !((ini_bool("sql.safe_mode") || ini_bool("mysql.allow_local_infile")) && extension_loaded("pdo_mysql"))) {
class Min_DB {
class Db {
var
$extension = "MySQL", ///< @var string extension name
$server_info, ///< @var string server version
@@ -129,7 +129,7 @@ if (!defined("DRIVER")) {
/** Send query
* @param string
* @param bool
* @return mixed bool or Min_Result
* @return mixed bool or Result
*/
function query($query, $unbuffered = false) {
$result = @($unbuffered ? mysql_unbuffered_query($query, $this->_link) : mysql_query($query, $this->_link)); // @ - mute mysql.trace_mode
@@ -144,7 +144,7 @@ if (!defined("DRIVER")) {
$this->info = mysql_info($this->_link);
return true;
}
return new Min_Result($result);
return new Result($result);
}
/** Send query with more resultsets
@@ -156,7 +156,7 @@ if (!defined("DRIVER")) {
}
/** Get current resultset
* @return Min_Result
* @return Result
*/
function store_result() {
return $this->_result;
@@ -184,7 +184,7 @@ if (!defined("DRIVER")) {
}
}
class Min_Result {
class Result {
var
$num_rows, ///< @var int number of rows in the result
$_result, $_offset = 0 ///< @access private
@@ -231,7 +231,7 @@ if (!defined("DRIVER")) {
}
} elseif (extension_loaded("pdo_mysql")) {
class Min_DB extends Min_PDO {
class Db extends PdoDb {
var $extension = "PDO_MySQL";
function connect($server, $username, $password) {
@@ -280,7 +280,7 @@ if (!defined("DRIVER")) {
class Min_Driver extends Min_SQL {
class Driver extends SqlDriver {
function insert($table, $set) {
return ($set ? parent::insert($table, $set) : queries("INSERT INTO " . table($table) . " ()\nVALUES ()"));
@@ -377,11 +377,11 @@ if (!defined("DRIVER")) {
}
/** Connect to the database
* @return mixed Min_DB or string for error
* @return mixed Db or string for error
*/
function connect() {
global $adminer, $types, $structured_types, $edit_functions;
$connection = new Min_DB;
$connection = new Db;
$credentials = $adminer->credentials();
if ($connection->connect($credentials[0], $credentials[1], $credentials[2])) {
$connection->set_charset(charset($connection)); // available in MySQLi since PHP 5.0.5
@@ -589,7 +589,7 @@ if (!defined("DRIVER")) {
/** Get table indexes
* @param string
* @param string Min_DB to use
* @param string Db to use
* @return array [$key_name => ["type" => , "columns" => [], "lengths" => [], "descs" => []]]
*/
function indexes($table, $connection2 = null) {
@@ -984,9 +984,9 @@ if (!defined("DRIVER")) {
}
/** Explain select
* @param Min_DB
* @param Db
* @param string
* @return Min_Result
* @return Result
*/
function explain($connection, $query) {
return $connection->query("EXPLAIN " . (min_version(5.1) && !min_version(5.7) ? "PARTITIONS " : "") . $query);
@@ -1029,7 +1029,7 @@ if (!defined("DRIVER")) {
/** Set current schema
* @param string
* @param Min_DB
* @param Db
* @return bool
function set_schema($schema, $connection2 = null) {
return true;

View File

@@ -6,7 +6,7 @@ $drivers["oracle"] = "Oracle (beta)";
if (isset($_GET["oracle"])) {
define("DRIVER", "oracle");
if (extension_loaded("oci8")) {
class Min_DB {
class Db {
var $extension = "oci8", $_link, $_result, $server_info, $affected_rows, $errno, $error;
var $_current_db;
@@ -52,7 +52,7 @@ if (isset($_GET["oracle"])) {
restore_error_handler();
if ($return) {
if (oci_num_fields($result)) {
return new Min_Result($result);
return new Result($result);
}
$this->affected_rows = oci_num_rows($result);
oci_free_statement($result);
@@ -81,7 +81,7 @@ if (isset($_GET["oracle"])) {
}
}
class Min_Result {
class Result {
var $_result, $_offset = 1, $num_rows;
function __construct($result) {
@@ -121,7 +121,7 @@ if (isset($_GET["oracle"])) {
}
} elseif (extension_loaded("pdo_oci")) {
class Min_DB extends Min_PDO {
class Db extends PdoDb {
var $extension = "PDO_OCI";
var $_current_db;
@@ -140,7 +140,7 @@ if (isset($_GET["oracle"])) {
class Min_Driver extends Min_SQL {
class Driver extends SqlDriver {
//! support empty $set in insert()
@@ -186,7 +186,7 @@ if (isset($_GET["oracle"])) {
function connect() {
global $adminer;
$connection = new Min_DB;
$connection = new Db;
$credentials = $adminer->credentials();
if ($connection->connect($credentials[0], $credentials[1], $credentials[2])) {
return $connection;

View File

@@ -6,7 +6,7 @@ $drivers["pgsql"] = "PostgreSQL";
if (isset($_GET["pgsql"])) {
define("DRIVER", "pgsql");
if (extension_loaded("pgsql")) {
class Min_DB {
class Db {
var $extension = "PgSQL", $_link, $_result, $_string, $_database = true, $server_info, $affected_rows, $error, $timeout;
function _error($errno, $error) {
@@ -79,7 +79,7 @@ if (isset($_GET["pgsql"])) {
$this->affected_rows = pg_affected_rows($result);
$return = true;
} else {
$return = new Min_Result($result);
$return = new Result($result);
}
if ($this->timeout) {
$this->timeout = 0;
@@ -114,7 +114,7 @@ if (isset($_GET["pgsql"])) {
}
}
class Min_Result {
class Result {
var $_result, $_offset = 0, $num_rows;
function __construct($result) {
@@ -149,7 +149,7 @@ if (isset($_GET["pgsql"])) {
}
} elseif (extension_loaded("pdo_pgsql")) {
class Min_DB extends Min_PDO {
class Db extends PdoDb {
var $extension = "PDO_PgSQL", $timeout;
function connect($server, $username, $password) {
@@ -195,7 +195,7 @@ if (isset($_GET["pgsql"])) {
class Min_Driver extends Min_SQL {
class Driver extends SqlDriver {
function insertUpdate($table, $rows, $primary) {
global $connection;
@@ -273,7 +273,7 @@ if (isset($_GET["pgsql"])) {
function connect() {
global $adminer, $types, $structured_types;
$connection = new Min_DB;
$connection = new Db;
$credentials = $adminer->credentials();
if ($connection->connect($credentials[0], $credentials[1], $credentials[2])) {
if (min_version(9, 0, $connection)) {

View File

@@ -7,7 +7,7 @@ if (isset($_GET["sqlite"])) {
define("DRIVER", "sqlite");
if (class_exists("SQLite3")) {
class Min_SQLite {
class SqliteDb {
var $extension = "SQLite3", $server_info, $affected_rows, $errno, $error, $_link;
function __construct($filename) {
@@ -24,7 +24,7 @@ if (isset($_GET["sqlite"])) {
$this->error = $this->_link->lastErrorMsg();
return false;
} elseif ($result->numColumns()) {
return new Min_Result($result);
return new Result($result);
}
$this->affected_rows = $this->_link->changes();
return true;
@@ -51,7 +51,7 @@ if (isset($_GET["sqlite"])) {
}
}
class Min_Result {
class Result {
var $_result, $_offset = 0, $num_rows;
function __construct($result) {
@@ -82,7 +82,7 @@ if (isset($_GET["sqlite"])) {
}
} elseif (extension_loaded("pdo_sqlite")) {
class Min_SQLite extends Min_PDO {
class SqliteDb extends PdoDb {
var $extension = "PDO_SQLite";
function __construct($filename) {
@@ -92,8 +92,8 @@ if (isset($_GET["sqlite"])) {
}
if (class_exists('Adminer\Min_SQLite')) {
class Min_DB extends Min_SQLite {
if (class_exists('Adminer\SqliteDb')) {
class Db extends SqliteDb {
function __construct() {
parent::__construct(":memory:");
@@ -122,7 +122,7 @@ if (isset($_GET["sqlite"])) {
class Min_Driver extends Min_SQL {
class Driver extends SqlDriver {
function insertUpdate($table, $rows, $primary) {
$values = array();
@@ -164,7 +164,7 @@ if (isset($_GET["sqlite"])) {
if ($password != "") {
return lang('Database does not support password.');
}
return new Min_DB;
return new Db;
}
function get_databases() {
@@ -362,7 +362,7 @@ if (isset($_GET["sqlite"])) {
return false;
}
try {
$link = new Min_SQLite($db);
$link = new SqliteDb($db);
} catch (Exception $ex) {
$connection->error = $ex->getMessage();
return false;