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

Add helper for $connection2

This commit is contained in:
Jakub Vrana
2025-03-29 22:21:18 +01:00
parent 291ae7f1ac
commit 9b6943d5af
3 changed files with 9 additions and 16 deletions

View File

@@ -451,9 +451,7 @@ ORDER BY a.attnum") as $row
}
function indexes($table, $connection2 = null) {
if (!is_object($connection2)) {
$connection2 = connection();
}
$connection2 = connection($connection2);
$return = array();
$table_oid = get_val("SELECT oid FROM pg_class WHERE relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = current_schema()) AND relname = " . q($table), 0, $connection2);
$columns = get_key_vals("SELECT attnum, attname FROM pg_attribute WHERE attrelid = $table_oid AND attnum > 0", $connection2);

View File

@@ -270,9 +270,7 @@ if (isset($_GET["sqlite"])) {
}
function indexes($table, $connection2 = null) {
if (!is_object($connection2)) {
$connection2 = connection();
}
$connection2 = connection($connection2);
$return = array();
$sql = get_val("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = " . q($table), 0, $connection2);
if (preg_match('~\bPRIMARY\s+KEY\s*\((([^)"]+|"[^"]*"|`[^`]*`)++)~i', $sql, $match)) {