This commit is contained in:
Philipp Holzer 2019-03-01 12:01:28 +01:00
parent 0b6d3c71f9
commit b4a6e068a9
No known key found for this signature in database
GPG key ID: 517BE60E2CE5C8A5
3 changed files with 12 additions and 7 deletions

View file

@ -113,10 +113,9 @@ class DBA
* @return string * @return string
* @throws \Exception * @throws \Exception
*/ */
public static function databaseName() { public static function databaseName()
$ret = self::p("SELECT DATABASE() AS `db`"); {
$data = self::toArray($ret); return self::$db->getDatabaseName();
return $data[0]['db'];
} }
/** /**

View file

@ -38,7 +38,7 @@ interface IDatabase
* Returns the selected database name * Returns the selected database name
* @return string * @return string
*/ */
function databaseName(); function getDatabaseName();
/** /**
* Check if data exists * Check if data exists

View file

@ -194,9 +194,15 @@ class MysqlDatabase implements IDatabase, IDatabaseLock
return $this->serverInfo; return $this->serverInfo;
} }
public function databaseName() /**
* {@inheritdoc}
* @throws \Exception
*/
public function getDatabaseName()
{ {
return DBA::databaseName(); $ret = $this->p("SELECT DATABASE() AS `db`");
$data = $this->toArray($ret);
return $data[0]['db'];
} }
public function exists($table, array $condition) public function exists($table, array $condition)