Avoid fatal in PostgreSQL without implemented database()
https://sourceforge.net/p/adminer/discussion/1095138/thread/5e29e380/
This commit is contained in:
parent
aae2289095
commit
e680d22023
|
@ -19,11 +19,13 @@ class Adminer {
|
||||||
|
|
||||||
function database() {
|
function database() {
|
||||||
global $connection;
|
global $connection;
|
||||||
$databases = $this->databases(false);
|
if ($connection) {
|
||||||
return (!$databases
|
$databases = $this->databases(false);
|
||||||
? $connection->result("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', 1)") // username without the database list
|
return (!$databases
|
||||||
: $databases[(information_schema($databases[0]) ? 1 : 0)] // first available database
|
? $connection->result("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', 1)") // username without the database list
|
||||||
);
|
: $databases[(information_schema($databases[0]) ? 1 : 0)] // first available database
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function databases($flush = true) {
|
function databases($flush = true) {
|
||||||
|
|
Loading…
Reference in a new issue