mirror of
https://github.com/vrana/adminer.git
synced 2025-08-06 22:56:46 +02:00
Fix types of $connection2
This commit is contained in:
@@ -538,9 +538,10 @@ if (!defined('Adminer\DRIVER')) {
|
||||
}
|
||||
|
||||
/** Get table indexes
|
||||
* @param Db|string $connection2
|
||||
* @return Index[]
|
||||
*/
|
||||
function indexes(string $table, ?Db $connection2 = null): array {
|
||||
function indexes(string $table, $connection2 = null): array {
|
||||
$return = array();
|
||||
foreach (get_rows("SHOW INDEX FROM " . table($table), $connection2) as $row) {
|
||||
$name = $row["Key_name"];
|
||||
@@ -1068,8 +1069,10 @@ if (!defined('Adminer\DRIVER')) {
|
||||
return "";
|
||||
}
|
||||
|
||||
/** Set current schema */
|
||||
function set_schema(string $schema, Db $connection2 = null): bool {
|
||||
/** Set current schema
|
||||
* @param Db|string $connection2
|
||||
*/
|
||||
function set_schema(string $schema, $connection2 = null): bool {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -5,12 +5,12 @@ namespace Adminer;
|
||||
|
||||
/** Print select result
|
||||
* @param Result $result
|
||||
* @param Db $connection2 connection to examine indexes
|
||||
* @param Db|string $connection2
|
||||
* @param string[] $orgtables
|
||||
* @param int|numeric-string $limit
|
||||
* @return string[] $orgtables
|
||||
*/
|
||||
function print_select_result($result, Db $connection2 = null, array $orgtables = array(), $limit = 0): array {
|
||||
function print_select_result($result, $connection2 = null, array $orgtables = array(), $limit = 0): array {
|
||||
$links = array(); // colno => orgtable - create links from these columns
|
||||
$indexes = array(); // orgtable => array(column => colno) - primary keys
|
||||
$columns = array(); // orgtable => array(column => ) - not selected columns in primary key
|
||||
|
@@ -6,7 +6,7 @@ namespace Adminer;
|
||||
/** Get database connection
|
||||
* @return Db|string string means error
|
||||
*/
|
||||
function connection() {
|
||||
function connection($special = null) {
|
||||
// can be used in customization, Db::$instance is minified
|
||||
return Db::$instance;
|
||||
}
|
||||
@@ -96,10 +96,10 @@ function bracket_escape(string $idf, bool $back = false): string {
|
||||
/** Check if connection has at least the given version
|
||||
* @param string|float $version required version
|
||||
* @param string|float $maria_db required MariaDB version
|
||||
* @param Db $connection2 defaults to connection()
|
||||
* @param Db|string $connection2 defaults to connection()
|
||||
*/
|
||||
function min_version($version, $maria_db = "", Db $connection2 = null): bool {
|
||||
if (!$connection2) {
|
||||
function min_version($version, $maria_db = "", $connection2 = null): bool {
|
||||
if (!is_object($connection2)) {
|
||||
$connection2 = connection();
|
||||
}
|
||||
$server_info = $connection2->server_info;
|
||||
@@ -181,9 +181,10 @@ function get_vals(string $query, $column = 0): array {
|
||||
}
|
||||
|
||||
/** Get keys from first column and values from second
|
||||
* @param Db|string $connection2
|
||||
* @return string[]
|
||||
*/
|
||||
function get_key_vals(string $query, Db $connection2 = null, bool $set_keys = true): array {
|
||||
function get_key_vals(string $query, $connection2 = null, bool $set_keys = true): array {
|
||||
if (!is_object($connection2)) {
|
||||
$connection2 = connection();
|
||||
}
|
||||
@@ -202,9 +203,10 @@ function get_key_vals(string $query, Db $connection2 = null, bool $set_keys = tr
|
||||
}
|
||||
|
||||
/** Get all rows of result
|
||||
* @param Db|string $connection2
|
||||
* @return list<string[]> of associative arrays
|
||||
*/
|
||||
function get_rows(string $query, Db $connection2 = null, string $error = "<p class='error'>"): array {
|
||||
function get_rows(string $query, $connection2 = null, string $error = "<p class='error'>"): array {
|
||||
$conn = (is_object($connection2) ? $connection2 : connection());
|
||||
$return = array();
|
||||
$result = $conn->query($query);
|
||||
|
Reference in New Issue
Block a user