Return registered database under given name

@param string $connectionName

@return \OrientDB
191123
public function getDatabase($connectionName = 'default')
    {
        if ($this->databases->containsKey($connectionName)) {
            return $this->databases->get($connectionName);
        }

        $configuration = $this->getConfiguration($connectionName);
        $database = $this->getConnection($connectionName);

        $database->DBOpen(
            $configuration->getDatabase(),
            $configuration->getUser(),
            $configuration->getPassword()
        );

        $this->databases->set($connectionName, $database);

        return $this->databases->get($connectionName);
    }
19733
public function synchronize($connectionName)
    {
        $configuration = $this->getConfiguration($connectionName);
        $database = $this->getDatabase($connectionName);

        foreach ($configuration->getVertexes() as $vertex) {
            try {
                $database->query(sprintf('CREATE CLASS %s EXTENDS V',
                    $vertex->getName()
                ));
                $database->query(sprintf('DISPLAY RECORD 0',
                    $vertex->getName()
                ));
                dump($res); die;
            } catch (\Exception $e) {
                if (preg_match(sprintf('/Class %s already exists in current database$/', $vertex->getName()), $e->getMessage())) {
                    continue;
                }

                throw $e;
            }
        }
    }
86627
public function getTables($dbName='') {
        $sql    = !empty($dbName)?'SHOW TABLES FROM '.$dbName:'SHOW TABLES ';
        $result = $this->query($sql);
        $info   =   array();
        foreach ($result as $key => $val) {
            $info[$key] = current($val);
        }
        return $info;
    }
981940
public function getTables($dbName = '')
    {
        $pdo    = $this->linkID->query("select table_name from all_tables");
        $result = $pdo->fetchAll(PDO::FETCH_ASSOC);
        $info   = [];
        foreach ($result as $key => $val) {
            $info[$key] = current($val);
        }
        return $info;
    }
1193426
public function getCollections($databaseName = null) {
		$database = $this->getDatabase($databaseName);

		if ($this->_profilerEnabled) {
			$event = $this->getProfiler()->startRead('Collections list');
		}

		$collections = $database->getCollectionNames();

		if ($this->_profilerEnabled) {
			$event->stopSuccess();
		}

		return $collections;
	}
946835
public static function getConnectionData($connectName)
    {
        //如果设置连接数据,直接返回
        if (isset(self::$connectionDataInstance[$connectName])) {
            return  self::$connectionDataInstance[$connectName];
        }

        //根据连接名获取配置信息
        $config         = Config::get($connectName , 'db.php');
        $driver         = $config['driver'];
        //根据驱动获取数据库连接信息
        $driver_class   = "\\Zwei\\BriefDB\\Database\\Driver\\{$driver}\\Connection";
        /* @var $connection \Doctrine\DBAL\Connection */
        $connection     = $driver_class::getInstance($connectName);
        $connectionData = new ConnectionData();
        $connectionData->setData($connectName, $driver, $connection);
        return self::$connectionDataInstance[$connectName] = $connectionData;
    }
300602
public function findConnection(string $connectionName)
  {
    if ( empty($connectionName) ) {
      # Take first available connection
      $connection = reset($this->connections);
      if ($connection === false)
        return null;
    } else {
      # Attempt to find the connection from the pool
      $connection = ( $this->connections[strtolower($connectionName)] ?? null);
    }

    return $connection;
  }
293854
public function getTables($dbName = '')
    {
        $sql    = !empty($dbName) ? 'SHOW TABLES FROM ' . $dbName : 'SHOW TABLES ';
        $pdo    = $this->query($sql, [], false, true);
        $result = $pdo->fetchAll(PDO::FETCH_ASSOC);
        $info   = [];

        foreach ($result as $key => $val) {
            $info[$key] = current($val);
        }

        return $info;
    }
481367
public function makeInsert(string $connectionName = ''): InsertQueryBuilder
    {
        $connection = $this->provideConnection($connectionName);
        $statementBuilder = new InsertStatementBuilder;
        return new InsertQueryBuilder($connection, $statementBuilder);
    }
974459
public static function database($name = 'default')
    {
        if (!isset(static::$databases[$name])) {

            $cache = Config::get('cache');

            if (!isset($cache['storage']) || $cache['storage'] != 'redis') {
                throw new \RuntimeException("Redis database [$name] is not defined.");
            }

            static::$databases[$name] = new static(
                new Adapter\Socket($cache['server']['host'], $cache['server']['port']),
                $cache['server']['database']
            );
        }

        return static::$databases[$name];
    }
27087
public function database(string $database = null): MongoDatabase
    {
        if (empty($database)) {
            $database = $this->config->defaultDatabase();
        }

        //Spiral support ability to link multiple virtual databases together using aliases
        $database = $this->config->resolveAlias($database);

        if (isset($this->databases[$database])) {
            return $this->databases[$database];
        }

        if (!$this->config->hasDatabase($database)) {
            throw new ODMException(
                "Unable to initiate MongoDatabase, no presets for '{$database}' found"
            );
        }

        $options = $this->config->databaseOptions($database);

        //Initiating database instance
        return $this->createDatabase(
            $database,
            $options['server'],
            $options['database'],
            $options['driverOptions'] ?? [],
            $options['options'] ?? []
        );
    }
88940
public function getNamedNativeQuery($queryName)
    {
        if ( ! isset($this->namedNativeQueries[$queryName])) {
            throw MappingException::queryNotFound($this->name, $queryName);
        }

        return $this->namedNativeQueries[$queryName];
    }
199119
public function makeDelete(string $connectionName = ''): DeleteQueryBuilder
    {
        $connection = $this->provideConnection($connectionName);
        $statementBuilder = new DeleteStatementBuilder;
        return new DeleteQueryBuilder($connection, $statementBuilder);
    }
166989
public function getRepository($entityName, $db = null)
    {
        return \erdiko\doctrine\EntityManager::getEntityManager()->getRepository($entityName);
    }
185555
public function setDbCollection(string $dbName, string $collectionName): \MongoCollection
    {
        return $this->mongoClient->selectDB($dbName)->selectCollection($collectionName);
    }
485980
public static function get($config = null) {
		if (!isset($config['driver'])) {
			throw new ConnectionException("Unknown driver");
		}
		if (!isset($config['host']) || !isset($config['port'])) {
			throw new ConnectionException("Host and Port is required");
		}
		$type = $config['driver'];
		$hash = md5($type . ':' . $config['host'] . ':' . $config['port']);
		if (!isset(self::$created_driver[$hash])) {
			if (isset(self::$driver[$type])) {
				$className = self::$driver[$type];
			} else {
				$className = __NAMESPACE__ . '\\Driver\\' . ucfirst($type);
			}
			self::$created_driver[$hash] = new $className($config);
		}
		return self::$created_driver[$hash];
	}
802432
public function getConnection($serviceName)
    {
        if (empty($this->connectionPool[$serviceName])) {
            $this->initConnection($serviceName);
        }

        return $this->connectionPool[$serviceName];
    }