Get the name of the database driver.

@param  string  $connection
@return string
324834
protected function getDriverName($connection)
    {
        try {
            return DB::connection($connection)->getDriverName();
        } catch (Exception $e) {
            $this->eye->logger()->debug('Unable to find DB driver', $connection);
        }

        return 'unknown';
    }
183243
public static function GetConnectionName () {
		$class_name = static::class;
		if (!isset(static::$_connectionNameList[$class_name])) {
			if (defined($class_name.'::CONNECTION_NAME')) {
				$connection_name = $class_name::CONNECTION_NAME;
			} else {
				$connection_name = basename(dirname(str_replace("\\", '/', $class_name)));
			}
			static::$_connectionNameList[$class_name] = $connection_name;
		}
		return static::$_connectionNameList[$class_name];
	}
525488
private function getCorConnectClassName(array $collector, string $driver): string
    {
        if (!isset($collector[$driver][DriverType::COR])) {
            throw new DbException('The coroutine driver of ' . $driver . ' is not exist!');
        }

        return $collector[$driver][DriverType::COR];
    }
1262000
private function getSyncConnectClassName(array $collector, string $driver): string
    {
        if (!isset($collector[$driver][DriverType::SYNC])) {
            throw new DbException('The synchronous driver of ' . $driver . ' is not exist!');
        }

        return $collector[$driver][DriverType::SYNC];
    }
327397
protected function getQueue($connection)
	{
		if (is_null($connection))
		{
			$connection = $this->flyphp['config']['queue.default'];
		}

		$queue = $this->flyphp['config']->get("queue.connections.{$connection}.queue", 'default');

		return $this->input->getOption('queue') ?: $queue;
	}
430824
protected function getSequenceName(Connection $connection, $tableName)
    {
        $PkColumns = $connection->query("SELECT a.attname, format_type(a.atttypid, a.atttypmod) AS data_type
            FROM   pg_index i
            JOIN   pg_attribute a ON a.attrelid = i.indrelid
                                 AND a.attnum = ANY(i.indkey)
            WHERE  i.indrelid = :table_name::regclass
            AND    i.indisprimary;", [':table_name' => $tableName])->fetchAll(\PDO::FETCH_ASSOC);
        $PkColumnsCount = count($PkColumns);
        if ($PkColumnsCount != 1) {
            return null;
        }

        return $connection->query('select pg_get_serial_sequence(:table_name, :column_name)', [':table_name' => $tableName, ':column_name' => $PkColumns[0]['attname']])->fetchScalar();
    }
102610
public function getConnectionRoles($connection = null, $server = null)
    {
        $credentials = $this->credentials->getServerCredentials($connection, $server);

        return Arr::get($credentials, 'roles', []);
    }
369559
public function getAll(Connection $connection): array
    {
        foreach ($this->registry as $types) {
            foreach (array_keys($types) as $type) {
                $this->get($connection, $type);
            }
        }

        return $this->instances[$connection->driver()];
    }
484791
protected static function getSchemaBuilder(Connection $connection)
    {
        $schemaBuilder = $connection->getSchemaBuilder();
        $schemaBuilder->blueprintResolver(function ($table, $callback) {
            return new Blueprint($table, $callback);
        });

        return $schemaBuilder;
    }
582033
public function driver_name()
	{
		// Make sure the database is connected
		$this->_connection or $this->connect();

		// Getting driver name
		return $this->_connection->getAttribute(\PDO::ATTR_DRIVER_NAME);
	}
1238258
public static function table( $table, $connection = null )
	{
		return self::getInstance()->getConnection($connection)->table($table);
	}
1339400
public function connection($connection)
	{
		$connections = Config::get('database.connections');

		$default = Config::get('database.default');

		$connection = $connections[$default];

		$connectionString = "{$connection['driver']}:host={$connection['host']};dbname={$connection['database']}";

		try 
		{
			$pdo = new PDO($connectionString, $connection['username'], $connection['password']);
		}
		catch (PDOException $e)
		{
			print "Error!: " . $e->getMessage() . "<br/>";
			die();
		}

		$db = new Qlake\Database\Query(new Qlake\Database\Connection($pdo), new Qlake\Database\Grammar);

		return $db;
	}
629327
protected function getConnection($connection = null)
    {
        $database = $this->app->make('db');

        $connection = $connection ?: $database->getDefaultConnection();

        return $database->connection($connection);
    }
1072711
public static function getConnections($connection, $table)
    {
        $connections = DB::connection($connection)->table($table)->get();

        if(!empty($connections)) {
            /**
             * Create an empty array which will get populated with the data from
             * $connections in the correct format within the foreach statement
             * below file generation.
             */
            $config = array();
            /**
             * Generate a random string for the filename as it is temporary
             * and more secure.
             */
            $random_string = ConnectionLoader::random_string(35);
            /**
             * Append the .php extension to the file name and store here
             * storage_path/app/$tempFile with some starting content.
             */
            $tempFileName = $random_string . '.php';
            $tempFile = Storage::disk('local')->put($tempFileName, '<?php return ');

            if ($tempFile === true) {
                /**
                 * Loops through the connections checking the driver and pushes
                 * correctly formatted array into the $config array.
                 */
                foreach ($connections as $connection) {
                    $name = $connection->name;
                    $driver = $connection->driver;

                    if ($driver == 'sqlite') {

                        $connection_config = array(
                            'driver' => $driver,
                            'database' => database_path($connection->database),
                            'prefix' => $connection->prefix,
                        );

                        $config[$name] = $connection_config;

                    } elseif ($driver == 'mysql') {

                        $strict = $connection->strict;
                        if ($strict == 1) {
                            $strict = true;
                        } else {
                            $strict = false;
                        }
                        $password = $connection->password;

                        if(empty($password)) {
                            $connection_config = array(
                                'driver' => $driver,
                                'host' => $connection->host,
                                'database' => $connection->database,
                                'username' => $connection->username,
                                'password' => $password,
                                'charset' => $connection->charset,
                                'collation' => $connection->collation,
                                'prefix' => $connection->prefix,
                                'strict' => $strict,
                            );
                        }
                        else {
                            $connection_config = array(
                                'driver' => $driver,
                                'host' => $connection->host,
                                'database' => $connection->database,
                                'username' => $connection->username,
                                'password' => Crypt::decrypt($password),
                                'charset' => $connection->charset,
                                'collation' => $connection->collation,
                                'prefix' => $connection->prefix,
                                'strict' => $strict,
                            );
                        }

                        $config[$name] = $connection_config;

                    } elseif ($driver == 'pgsql') {

                        $password = $connection->password;

                        if(empty($password)) {
                            $connection_config = array(
                                'driver' => $driver,
                                'host' => $connection->host,
                                'port' => $connection->port,
                                'database' => $connection->database,
                                'username' => $connection->username,
                                'password' => $password,
                                'charset' => $connection->charset,
                                'prefix' => $connection->prefix,
                                'schema' => $connection->schema,
                            );
                        }
                        else {
                            $connection_config = array(
                                'driver' => $driver,
                                'host' => $connection->host,
                                'port' => $connection->port,
                                'database' => $connection->database,
                                'username' => $connection->username,
                                'password' => Crypt::decrypt($password),
                                'charset' => $connection->charset,
                                'prefix' => $connection->prefix,
                                'schema' => $connection->schema,
                            );
                        }

                        $config[$name] = $connection_config;
                    }
                }

                /**
                 * Append a var_export of $config to the temporary file and
                 * append the semicolon.
                 *
                 * Returns the temporary filename.
                 */
                $endFile = ';';
                Storage::append($tempFileName, var_export($config, true));
                Storage::append($tempFileName, $endFile);

                return $tempFileName;

            } else {
                \error_log('Unable to create temporary file');
            }
        } else {
            \error_log('Configuration File Connection Invalid.');
            return null;
        }
    }
694395
protected function getConnection($context)
    {
        $connectionName = null;

        if (!empty($context['options']['db_connection_name'])) {
            $connectionName = $context['options']['db_connection_name'];
        }

        return $this->doctrine->getConnection($connectionName);
    }
98116
public static function selectOne(Connection $connection)
    {
        $selector = new EntitySelector(AbstractSelector::fromConnection($connection, static::$table, static::$types), get_called_class());

        return $selector->one();
    }
476036
public function getServerMetadata(
        Connection $connection
    ) {
        // Attempt to list databases, ignoring internal databases
        try {
            $statement = $connection->query('SHOW DATABASES WHERE `Database` NOT IN ("information_schema", "performance_schema", "sys", "mysql");');
        } catch (\Throwable $e) {
            throw new \RuntimeException('Failed to list databases: ' . $e->getMessage());
        }

        $databaseMetadataList = [];
        /** @var string $databaseName */
        while ($databaseName = $statement->fetchColumn(0)) {
            $databaseMetadataList[] = $this->getDatabaseMetadata($connection, $databaseName);
        }

        return new ServerMetadata($connection->getHost(), $databaseMetadataList);
    }