Get the current database name.

@return mixed
487226
private function getDbName() {
        if (!isset($this->dbname)) {
            $this->dbname = $this->getPDO()->query('select database()')->fetchColumn();
        }
        return $this->dbname;
    }
462978
public function getDBO()
	{
		$db = \App::get('db');

		// Test the connection
		if (!$db->connected())
		{
			$this->log('PDO connection failed', 'error');
			return false;
		}

		// Check for the existance of the migrations table
		$tables = $db->getTableList();
		$prefix = $db->getPrefix();
		$tableset = false;

		if (in_array('migrations', $tables))
		{
			$this->setTableName('migrations');
			$tableset = true;
		}

		if (in_array($prefix . 'migrations', $tables))
		{
			if ($tableset)
			{
				$this->log('Tables `migrations` and `' . $prefix . 'migrations` both exist', 'error');
				return false;
			}

			$this->setTableName('#__migrations');
			$tableset = true;
		}

		if (!$tableset)
		{
			if ($this->createMigrationsTable($db) === false)
			{
				return false;
			}
		}

		// Add a callback so that a migration can update $this in real time if necessary
		$this->registerCallback('migration', $this);

		return $db;
	}
474331
public function get_server_info() {
        static $info;

        if (!$info) {
            $server_info = sqlsrv_server_info($this->sqlsrv);

            if ($server_info) {
                $info['description'] = $server_info['SQLServerName'];
                $info['version'] = $server_info['SQLServerVersion'];
                $info['database'] = $server_info['CurrentDatabase'];
            }
        }
        return $info;
    }
871026
public static function currentServerName()
    {
        if (! empty(env('SERVER_NAME'))) {
            $BASE_URL = env('SERVER_NAME');
        } elseif (! empty($_SERVER['SERVER_NAME'])) {
            $BASE_URL = $_SERVER['SERVER_NAME'];
        } elseif (! empty($_SERVER['HTTP_HOST'])) {
            $BASE_URL = $_SERVER['HTTP_HOST'];
        } else {
            $BASE_URL = 'empty';
        }
        return $BASE_URL;
    }
768795
public function getDatabase()
    {
        if(!isset($this->_database))
        {
            $query = $this->getObject('lib:database.query.select')
                ->columns('DATABASE()');

            $this->_database = $this->select($query, KDatabase::FETCH_FIELD);
        }
        return $this->_database;
    }
74504
public function getDatabase($name = null)
    {
        if (empty($name)) {
            $name = $this->getCurrentDatabaseName();
        }

        if (!isset($this->databasePool[$name])) {
            // init db
            $database = new Database($this, $name);
            if (isset($this->mapping[$name])) {
                $database->map($this->mapping[$name]);
            }

            // configure db
            $this->databasePool[$name] = $database;
        }
        
        return $this->databasePool[$name];
    }
60568
private function _getCurrentData()
    {
        $cls = $this->_cls;
        if (!$this->_data) {
            $this->_data = $cls::executePrepared($this->_builder, $this->_vals);
        }
        return $this->_data->fetch(\PDO::FETCH_ASSOC);
    }
361944
public static function current()
    {
        if (static::$_current === null) {
            if ($token = AuthToken::current()) {
                //
                // TODO: (known bug)
                // When accessing $token->auth inside an observer other than `auth`,
                // the table name of the query is being equals to the observer itself.
                //
                $token->auth(); // this resets the target querying table name
                static::$_current = $token->auth;
            }
        }

        return static::$_current;
    }
393986
public function getDatabase()
    {
        if (!isset($this->_database)) {
            $this->_database = $this->select("SELECT DATABASE()", AnDatabase::FETCH_FIELD);
        }

        return $this->_database;
    }
1098690
public function getDb()
    {
        if ($this->_db === NULL and $this->getConfig('main/db/engine')) {
            $this->_db = new Db();
        }

        return $this->_db;
    }
1203054
public function getCurrentSchema()
    {
        try {
            $schema = $this->capsule->getConnection()->getDatabaseName();
        } catch (\Exception $e) {
            throw new Exception\RuntimeException('Cannot retrieve current schema:' . $e->getMessage());
        }

        return $schema;
    }
483518
public function getDatabases(): array
    {
        $names = array_unique(array_merge(array_keys($this->databases), array_keys($this->config->getDatabases())));

        $result = [];
        foreach ($names as $name) {
            $result[] = $this->database($name);
        }

        return $result;
    }
619093
public static function getDefaultDB()
    {
        if (self::$defaultDBName === null) {
            // Determine default database name.
            self::$defaultDBName = isset(self::$configuration['datasources']['default']) && is_scalar(self::$configuration['datasources']['default']) ? self::$configuration['datasources']['default'] : self::DEFAULT_NAME;
        }

        return self::$defaultDBName;
    }
554229
protected function getDatabaseFileName() : string
    {
        // Get database to use, saved in the link file (as symlinks are not available or only
        // with admin permissions on Windows).
        $linkFile = $this->getDataDirectory() . DIRECTORY_SEPARATOR . Parser::LINK_FILENAME;
        if ($this->isFileReadable($linkFile)) {
            return (string)file_get_contents($linkFile);
        } elseif (!file_exists($linkFile)) {
            throw new ParserRuntimeException(
                "Database link file '$linkFile' not found. Parser data need to be generated.",
                1458898368
            );
        } else {
            throw new ParserRuntimeException("Database link file '$linkFile' is not readable.", 1458898369);
        }
    }
336124
public function getTableName()
    {
        if (is_null($this->_tableName)) {
            $this->_tableName = $this->getDescriptor()->getEntity()
                ->getTableName();
        }
        return $this->_tableName;
    }
886742
public function getTableName()
    {
        if (null == $this->tableName) {
            $this->tableName = $this->determineTableName();
        }
        return $this->tableName;
    }
189731
public function getTablesNames()
    {
        return $this->database->tableNames()->filter(function ($name) {
            return !in_array($name, $this->exclude);
        });
    }