Datasource connection accessor
@param  strinf $name The datasource name
@return SQLConnect   The datasource connection
548966
public static function using($name){
    if (empty(self::$connections[$name])) throw new \Exception("[SQL] Unknown connection named '$name'.");
    return self::$connections[$name];
  }
1229918
public function getConnectionConfig($name = null) {
		if (is_null($name)) {
			$name = $this->defaultConfigName;
		}

		if (isset($this->connectionConfigs[$name])) {
			return $this->connectionConfigs[$name];
		}

		return null;
	}
348976
public static function get($name)
    {
        if (!isset(self::$connections[$name])) {
            throw new Exception(sprintf('Connection "%s" does not exist.', $name));
        }

        return self::$connections[$name];
    }
1196940
protected function getConnectionConfig($name)
    {
        $connections = $this->getConfig()['connections'];
        if (!isset($connections[$name])) {
            throw new InvalidArgumentException(sprintf('The pub-sub connection [%s] is not configured.', $name));
        }

        $config = $connections[$name];

        if (isset($config['subscribe_connection'])) {
            $config['subscribe_connection_config'] = $this->getConnectionConfig($config['subscribe_connection']);
        }

        return $config;
    }
47531
public function resolve($name)
	{
		if ( ! isset($this->connections[$name]))
		{
			$this->connections[$name] = $this->makeConnection($name, $this->getConfig($name));
		}

		return $this->connections[$name];
	}
567776
public function getForConnection($name = null)
    {
        $connection = $this->registry->getConnection($name);

        return $this->factory->make($connection, $name);
    }
623967
public function get($name, $autoConnect = true, $autoAuthenticate = true)
    {
        $connection = $this->connections[$name];

        if ($autoConnect && !$connection->isConnected()) {
            $connection->connect();
        }

        if ($autoAuthenticate && !$connection->isAuthenticated()) {
            $connection->authenticate($this->authentications[$name]);
        }

        return $connection;
    }
611076
protected function makeConnection(string $name)
    {
        $config = $this->getConnectionConfig($name);

        if (isset($this->extensions[$name])) {
            return $this->extensions[$name]($config);
        }

        if ($driver = array_get($config, 'driver')) {
            if (isset($this->extensions[$driver])) {
                return $this->extensions[$driver]($config);
            }
        }

        return $this->createConnection($config);
    }
122104
protected function getConnectionByName($name)
    {
        if (array_key_exists($name, $this->connectionByName)) {
            return $this->connectionByName[$name];
        }

        $event = clone $this->getManagerRegistryResourceEventPrototype();
        $event->setName(ManagerRegistryResourceEvent::RESOLVE_CONNECTION_EVENT);
        $event->setResourceName($name);
        $event->setTarget($this);


        $resultsEvent = $this->getEventManager()->trigger($event, function ($connection) {
            return is_object($connection);
        });

        $connection = $resultsEvent->last();

        if (!is_object($connection)) {
            $errMsg = sprintf('Connection %s not found', $name);
            throw new Exception\ConnectionNotFoundException($errMsg);
        }

        $this->connectionByName[$name] = $connection;

        return $this->connectionByName[$name];
    }
570699
public function dataProvider(string $name): DataProviderInterface
    {
        if (isset($this->dataProviders[$name])) {
            return $this->dataProviders[$name];
        }
        throw new \InvalidArgumentException(sprintf(
            "Requested data provider '%s' could not be found; does the content type exist, or provider not specified?",
            $name
        ));
    }
1294027
public function connection($name = null)
	{
		if (is_array($name)) return $this->multiple($name);

		return $this->resolve($name ?: $this->getDefaultConnection());
	}
324170
protected function _createConnection( $name, $adapter )
	{
		$host = $this->_config->get( 'resource/' . $name . '/host' );
		$port = $this->_config->get( 'resource/' . $name . '/port' );
		$user = $this->_config->get( 'resource/' . $name . '/username' );
		$pass = $this->_config->get( 'resource/' . $name . '/password' );
		$sock = $this->_config->get( 'resource/' . $name . '/socket' );
		$dbase = $this->_config->get( 'resource/' . $name . '/database' );

		$dsn = $adapter . ':dbname=' . $dbase;
		if( $sock == null )
		{
			$dsn .= isset( $host ) ? ';host=' . $host : '';
			$dsn .= isset( $port ) ? ';port=' . $port : '';
		}
		else
		{
			$dsn .= ';unix_socket=' . $sock;
		}

		$attr = array(
			PDO::ATTR_PERSISTENT => $this->_config->get( 'resource/' . $name . '/opt-persistent', false ),
		);

		$pdo = new PDO( $dsn, $user, $pass, $attr );
		$pdo->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
		$dbc = new MW_DB_Connection_PDO( $pdo );

		foreach( $this->_config->get( 'resource/' . $name . '/stmt', array() ) as $stmt ) {
			$dbc->create( $stmt )->execute()->finish();
		}

		return $dbc;
	}
1160939
public function getConnection(string $name = null)
    {
        if (empty($name)) {
            $name = $this->defaultConnection;
        }

        if (false === array_key_exists($name, $this->connections)) {
            return null;
        }

        return $this->connections[$name];
    }
170600
public function create($name)
    {
        $config = $this->getConfiguration($name);

        if(null === $config) {
            throw new \RuntimeException(
                "Connection with name: $name not found."
            );
        }

        return new Client($config);
    }
169002
public function connection( $name = null )
	{
		$name = $name ?: $this->getDefaultDriver();

		// If the connection has not been resolved yet we will resolve it now as all
		// of the connections are resolved when they are actually needed so we do
		// not make any unnecessary connection to the various queue end-points.
		if ( !isset( $this->connections[$name] ) )
		{
			$this->connections[$name] = $this->resolve( $name );

			$this->connections[$name]->setEncrypter( Encrypter::i() );
		}

		return $this->connections[$name];
	}
10704
public function get(string $name): ApiConnector
    {
        return $this->apiFactory->createApiConnector($name, $this->options);
    }
107687
public function getAdapter($name = null)
    {
        if (null === $name) {
            $name = $this->getDefaultDatasource();
        }
        if (!isset($this->adapters[$name])) {
            if (!isset($this->adapterClasses[$name])) {
                throw new AdapterException(sprintf('No adapter class defined for datasource "%s"', $name));
            }
            $this->adapters[$name] = AdapterFactory::create($this->adapterClasses[$name]);
        }

        return $this->adapters[$name];
    }