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,12 +19,14 @@ class Adminer {
|
||||||
|
|
||||||
function database() {
|
function database() {
|
||||||
global $connection;
|
global $connection;
|
||||||
|
if ($connection) {
|
||||||
$databases = $this->databases(false);
|
$databases = $this->databases(false);
|
||||||
return (!$databases
|
return (!$databases
|
||||||
? $connection->result("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', 1)") // username without the database list
|
? $connection->result("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', 1)") // username without the database list
|
||||||
: $databases[(information_schema($databases[0]) ? 1 : 0)] // first available database
|
: $databases[(information_schema($databases[0]) ? 1 : 0)] // first available database
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function databases($flush = true) {
|
function databases($flush = true) {
|
||||||
return get_databases($flush);
|
return get_databases($flush);
|
||||||
|
|
Loading…
Reference in a new issue