Get database

@param string $name
@return InfluxDB\Database $db
@throws AnalyticsException
174247
public function getDatabase($name) {
        try {
            if (!isset($name)) {
                throw InvalidArgumentException::invalidType('"db name" driver option', $name, 'string');
            }

            if (null == $this->client) {
                $this->client = new \InfluxDB\Client($this->host, $this->port, $this->username, $this->password);
            }

            if (!isset($this->dbs[$name])) {
                $this->dbs[$name] = $this->client->selectDB($name);
            }
            
            return $this->dbs[$name];
        } catch (Exception $e) {
            throw new AnalyticsException("Connecting influx db faild", 0, $e);
        }
    }
570603
protected function getFieldValue($name)
    {
        $field = $this->getField($name);

        if ($field->getSqlType()) {
            $platform = $this->getConnection()->getDatabasePlatform();

            $attributeValue = $this->getAttribute($field->getAttributeName());

            if ($name == $field->getAttributeName()) {
                return $field->convertToPHPValueSQL($attributeValue, $platform);
            }

            return $field->convertToPHPValue($attributeValue, $platform);
        }

        return $field->getValue();
    }
730210
public function createDatabase($name)
    {
        if (preg_match('@[^a-z0-9\_\$\(\)+\-]@', $name)) {
            throw new InvalidDatabasenameException(sprintf(
                'The database name %s is invalid. The database name must match the following pattern (a-z0-9_$()+-)',
                $name
            ));
        }

        if ($this->eventManager->hasListeners(Events::PRE_CREATE_DATABASE)) {
            // @codeCoverageIgnoreStart
            $this->eventManager->dispatchEvent(Events::PRE_CREATE_DATABASE, new EventArgs($this, $name));
            // @codeCoverageIgnoreEnd
        }

        $response = $this->client->request('PUT', sprintf('/%s', $name));

        if (412 === $response->getStatusCode()) {
            throw new Exception(sprintf('The database "%s" already exist', $name));
        }

        $json = (string) $response->getBody();
        $value = JSONEncoder::decode($json);

        if (isset($value['error'])) {
            throw new Exception(sprintf('[%s] Failed to create database "%s". (%s)', $value['error'], $name, $value['reason']));
        }

        $database = $this->wrapDatabase($name);

        if ($this->eventManager->hasListeners(Events::POST_CREATE_DATABASE)) {
            // @codeCoverageIgnoreStart
            $this->eventManager->dispatchEvent(Events::POST_CREATE_DATABASE, new EventArgs($database));
            // @codeCoverageIgnoreEnd
        }

        return $database;
    }
1055254
protected function doSelectDatabase($name)
    {
        $riak = $this->riakClient->selectDB($name);
        $numRetries = $this->config->getRetryQuery();
        $loggerCallable = $this->config->getLoggerCallable();

        return $loggerCallable !== null
            ? new LoggableDatabase($this, $riak, $this->eventManager, $numRetries, $loggerCallable)
            : new Database($this, $riak, $this->eventManager, $numRetries);
    }
1319326
public function get(string $name) : Type
    {
        if (! isset($this->instances[$name])) {
            throw DBALException::unknownColumnType($name);
        }

        return $this->instances[$name];
    }
438365
public function selectDatabase($name)
    {
        if ($this->eventManager->hasListeners(Events::preSelectDatabase)) {
            $this->eventManager->dispatchEvent(Events::preSelectDatabase, new EventArgs($this, $name));
        }

        $this->initialize();
        $database = $this->doSelectDatabase($name);

        if ($this->eventManager->hasListeners(Events::postSelectDatabase)) {
            $this->eventManager->dispatchEvent(Events::postSelectDatabase, new EventArgs($this, $database));
        }

        return $database;
    }
727805
public static function get($id = null)
    {
        if ($id === null && static::$activeDatabaseConnection === null) {
            throw new MissingDatabaseConnectionException('No databases defined.');
        }

        if ($id === null) {
            return static::$databaseConnections[static::$activeDatabaseConnection];
        } else {
            return static::$databaseConnections[$id];
        }
    }
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];
    }
1074373
public function getDatabase($databaseName = null) {
		if ($databaseName === null) {
			$databaseName = $this->dbname;
		}

		if (! isset($this->databases[$databaseName])) {
			$this->databases[$databaseName] = $this->getClient()->selectDB($databaseName);
		}

		return $this->databases[$databaseName];
	}
67499
public function getTable($name = '')
    {
        if (empty($name) && isset($this->options['table'])) {
            return $this->options['table'];
        }

        $name = $name ?: $this->name;

        return $this->prefix . Db::parseName($name);
    }
196262
public function getAdapter(string $name): DatabaseImportExportAdapterInterface
    {
        if (!array_key_exists($name, $this->adapters)) {
            throw new Exception\DomainException("Database import/export adapter not found by name \"$name\".");
        }

        return $this->adapters[$name];
    }
1241470
public static function getByName($name) {
		
		$db = Database::getInstance();
		$db->setQuery('SELECT * FROM `modules` WHERE name = ?');
		return $db->loadObject($name);
		
	}
297581
public function &__get($name)
    {
        if (!Arr::keyExists($this->data, $name))
        {
            $this->data[$name] = null;
        }

        return $this->data[$name];
    }
172351
private function getConfigObjectFromDatabase($name)
    {
        // Load config from DB
        $config = $this->app->db->conn()->prepare(
            'SELECT * FROM ' . $this->app->db->getPrefix() . 'config
                          WHERE `config_name` = ? LIMIT 1');
        $config->execute(array($name));
        $config = $config->fetch(\PDO::FETCH_ASSOC);

        // Load corresponding class and get config array
        return $this->createConfigObject($config['config_name'], $config['config_data'], true);
    }
1150750
public function getByName($name)
    {
        $response = $this->getPuppetDbClient()->send(new KmbPuppetDb\Request('/nodes/' . $name));
        return $this->createNodeFromData($response->getData());
    }
719983
public function getAggregation($name)
    {
        if ($this->aggregations && $this->aggregations->has($name)) {
            return $this->aggregations->get($name);
        } else {
            return null;
        }
    }
115200
public function get($name)
    {
        // 未加载数据,已登录,session中存在需要的key
        if (!$this->isLoaded() && isset($this->session['user'][$name])) {
            return $this->session['user'][$name];
        } else {
            $this->loadDbUser();

            return parent::get($name);
        }
    }