Get current database name

@return string
196024
protected function dbName()
    {

        $dbName = "default";
        $config = $this::$config;
        $configs = ConnectionManager::config($config);
        if ($configs) {
            $dbName = $configs['connection']['database'];
        }

        return $dbName;
    }
915793
public static function get_alternative_database_name()
    {
        // Ignore if disabled
        if (!Config::inst()->get(static::class, 'alternative_database_enabled')) {
            return false;
        }
        // Skip if CLI
        if (Director::is_cli()) {
            return false;
        }
        // Skip if there's no request object yet
        if (!Injector::inst()->has(HTTPRequest::class)) {
            return null;
        }
        /** @var HTTPRequest $request */
        $request = Injector::inst()->get(HTTPRequest::class);
        // Skip if the session hasn't been started
        if (!$request->getSession()->isStarted()) {
            return null;
        }

        $name = $request->getSession()->get(self::ALT_DB_KEY);
        if (self::valid_alternative_database_name($name)) {
            return $name;
        }

        return false;
    }
58884
public function getTableName() {
		if ($this->name === null) {
			$this->name = lcfirst($this->getIntrospectiveData()->name);
		}

		return $this->name;
	}
735775
public function getName()
    {
        $tableName = '';
        if ($this->hasSchema()) {
            $tableName = $this->guessSchemaName() . $this->database->getSchemaDelimiter();
        }

        $tableName .= $this->commonName;

        return $tableName;
    }
1054216
public function getDatabaseType()
    {
        $reflClass = new \ReflectionClass($this);
        $clazz = $reflClass->getShortName();
        $pos = strpos($clazz, 'Platform');

        return strtolower(substr($clazz, 0, $pos));
    }
1139806
protected function getDatabaseInformation()
    {
        $this->dbInfo['connection'] = env('DB_CONNECTION');
        $this->dbInfo['host'] = env('DB_HOST');
        $this->dbInfo['database'] = env('DB_DATABASE');
        $this->dbInfo['username'] = env('DB_USERNAME');
        $this->dbInfo['password'] = env('DB_PASSWORD');
        $this->dbInfo['port'] = env('DB_PORT');

        if (!check_db_connection()) {
            $this->error('Please setup your database information first!');
            die();
        }

        $this->info('Database OK...');
    }
705418
public function getDbName($id)
    {
        if (!$this->dbNames[$id]) {
            $record = wei()->appRecord()->findById($id);
            $this->dbNames[$id] = $record['name'];
        }

        return $this->dbNames[$id];
    }
111601
public function getPlatformName()
    {
        static $name = null;
        if (!$name) {
            $name = $this->connection->getDatabasePlatform()->getName();
        }
        return $name;
    }
445952
protected function fetchTableNamesDb() {
        // Get the table names.
        $tables = $this->get(
            new Identifier('sqlite_master'),
            [
                'type' => 'table',
                'name' => [Db::OP_LIKE => $this->escapeLike($this->getPx()).'%']
            ],
            [
                'columns' => ['name']
            ]
        )->fetchAll(PDO::FETCH_COLUMN);

        // Remove internal tables.
        $tables = array_filter($tables, function ($name) {
            return substr($name, 0, 7) !== 'sqlite_';
        });

        return $tables;
    }
222266
public function getDatabases()
    {
        $cursor = $this->server->executeCommand('admin', new \MongoDb\Driver\Command(['listDatabases' => 1]));

        $cursor->setTypeMap(['root' => 'array', 'document' => 'array']);
        $result = current($cursor->toArray());

        $this->queriesResultCache[ 'databaseNames' ] = [];

        if ( ! empty($result[ 'databases' ])) {
            foreach ($result[ 'databases' ] as $database) {
                if ( ! in_array($database[ 'name' ], ['admin', 'local'])) {
                    $this->queriesResultCache[ 'databaseNames' ][] = $database[ 'name' ];
                }
            }
        }

        return $this->queriesResultCache[ 'databaseNames' ];
    }
1137206
public function getConnectionString(){
        $connection_string = array();

        $type = $this->getType();
        array_push($connection_string, $type);

        if($type == self::SQLite){
        	$filename = 'db.sqlite';
        	if(isset($this->properties['filename']))
        		$filename = $this->properties['filename'];
        	array_push($connection_string, ":$filename");
        }
        else {
	        array_push($connection_string, ':host=');
	        array_push($connection_string,
	            (isset($this->properties['host']))?
	            $this->properties['host']:'localhost'
	        );
	        array_push($connection_string, ';dbname=');
	        array_push($connection_string,
	            (isset($this->properties['name']))?
	            $this->properties['name']:null
	        );
        }
        
        array_push($connection_string, ';charset=');
        array_push($connection_string, $this->getCharset());
        return implode($connection_string);
    }
894087
public function getTableName(): string
    {
        if ($this->tableName === null)
        {
            $this->tableName = (new \ReflectionClass($this))->getShortName();
        }

        return $this->tableName;
    }
1050922
public function getDbName ()
		{
			if ($this->db->getDriverName() == 'mysql')
			{
				preg_match("/dbname=([^;]*)/", $this->db->dsn, $match);
				if (isset($match[ 1 ]))
					return $match[ 1 ];
			}

			return null;
		}
855634
protected function getTableName(): string
    {
        $prefix = 'cf_';
        $configuration = GeneralUtility::makeInstance(ConfigurationService::class);
        if ($configuration->isBool('renameTablesToOtherPrefix')) {
            $prefix = 'sfc_';
        }

        return $prefix . 'staticfilecache';
    }
942986
public function getCurrentName()
    {
        switch ($this->current) {
            case self::CURRENT_OTHER:
                $currentName = Yii::t('yuncms', 'Other');
                break;
            case self::CURRENT_WORK:
                $currentName = Yii::t('yuncms', 'Work');
                break;
            case self::CURRENT_FREELANCE:
                $currentName = Yii::t('yuncms', 'Freelance');
                break;
            case self::CURRENT_START:
                $currentName = Yii::t('yuncms', 'Start');
                break;
            case self::CURRENT_OUTSOURCE:
                $currentName = Yii::t('yuncms', 'Outsource');
                break;
            case self::CURRENT_JOB:
                $currentName = Yii::t('yuncms', 'Job');
                break;
            case self::CURRENT_STUDENT:
                $currentName = Yii::t('yuncms', 'Student');
                break;
            default:
                throw new \RuntimeException('Your database is not supported!');
        }
        return $currentName;
    }
125925
public function getDatabase() : ?string 
    {
        if ( ! $this->hasDatabase()) {
            $this->setDatabase($this->getDefaultDatabase());
        }
        return $this->database;
    }
277793
public function getMainDB()
    {
        if ($this->main_database === null &&
            ($this->isOperationModeCLI() || $this->isOperationModeStandalone())
        ) {
            $this->registerMainDatabase();
        }
        return $this->main_database;
    }