src/includes/classes/Core/Utils/Pdo.php
public function get($shard_id_or_host = null, $uuid_or_host_db_name = null): \PDO
    {
        // Acquire DB configuration details.

        $db = $this->dbConfig($shard_id_or_host, $uuid_or_host_db_name);

        // Are we already connected to this host?

        if (($Pdo = &$this->cacheKey(__FUNCTION__, $db['©host']))) {
            if (empty($Pdo->db_name) || $Pdo->db_name !== $db['©name']) {
                $Pdo->exec('use `'.$db['©name'].'`');
                $Pdo->db_name = $db['©name'];
            }
            return $this->current = $Pdo;
        }
        // Otherwise, we need to establish a new connection.

        if (empty($this->App->Config->©mysql_db['©hosts'][$db['©host']])) {
            throw $this->c::issue(sprintf('Missing DB host: `%1$s`.', $db['©host']));
        }
        $db_host         = $this->App->Config->©mysql_db['©hosts'][$db['©host']];
        $db_host_options = [
            \PDO::ATTR_TIMEOUT => 5,

            \PDO::ATTR_AUTOCOMMIT       => true,
            \PDO::ATTR_EMULATE_PREPARES => false,

            \PDO::ATTR_CASE               => \PDO::CASE_NATURAL,
            \PDO::ATTR_ORACLE_NULLS       => \PDO::NULL_NATURAL,
            \PDO::ATTR_DEFAULT_FETCH_MODE => \PDO::FETCH_OBJ,

            \PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true,
            \PDO::ATTR_ERRMODE                  => \PDO::ERRMODE_EXCEPTION,
        ];
        if ($db_host['©charset']) { // Use a specific charset?
            $db_host_options[\PDO::MYSQL_ATTR_INIT_COMMAND] = 'SET NAMES \''.$db_host['©charset'].'\'';

            if ($db_host['©collate']) { // Also a specific collation?
                $db_host_options[\PDO::MYSQL_ATTR_INIT_COMMAND] .= ' COLLATE \''.$db_host['©collate'].'\'';
            }
        }
        if ($db_host['©ssl_enable'] && $db_host['©ssl_key'] && $db_host['©ssl_crt'] && $db_host['©ssl_ca'] && $db_host['©ssl_cipher']) {
            $db_host_options[\PDO::MYSQL_ATTR_SSL_KEY]    = $db_host['©ssl_key'];
            $db_host_options[\PDO::MYSQL_ATTR_SSL_CERT]   = $db_host['©ssl_crt'];
            $db_host_options[\PDO::MYSQL_ATTR_SSL_CA]     = $db_host['©ssl_ca'];
            $db_host_options[\PDO::MYSQL_ATTR_SSL_CIPHER] = $db_host['©ssl_cipher'];
        }
        $Pdo = new \PDO('mysql:host='.$db['©host'].';port='.$db_host['©port'], $db_host['©username'], $db_host['©password'], $db_host_options);

        $Pdo->exec('use `'.$db['©name'].'`');
        $Pdo->db_name         = $db['©name'];
        return $this->current = $Pdo;
    }
public function get($shard_id_or_host = null, $uuid_or_host_db_name = null): \PDO
    {
        // Acquire DB configuration details.

        $db = $this->dbConfig($shard_id_or_host, $uuid_or_host_db_name);

        // Are we already connected to this host?

        if (($Pdo = &$this->cacheKey(__FUNCTION__, $db['©host']))) {
            if (empty($Pdo->db_name) || $Pdo->db_name !== $db['©name']) {
                $Pdo->exec('use `'.$db['©name'].'`');
                $Pdo->db_name = $db['©name'];
            }
            return $this->current = $Pdo;
        }
        // Otherwise, we need to establish a new connection.

        if (empty($this->App->Config->©mysql_db['©hosts'][$db['©host']])) {
            throw $this->c::issue(sprintf('Missing DB host: `%1$s`.', $db['©host']));
        }
        $db_host         = $this->App->Config->©mysql_db['©hosts'][$db['©host']];
        $db_host_options = [
            \PDO::ATTR_TIMEOUT => 5,

            \PDO::ATTR_AUTOCOMMIT       => true,
            \PDO::ATTR_EMULATE_PREPARES => false,

            \PDO::ATTR_CASE               => \PDO::CASE_NATURAL,
            \PDO::ATTR_ORACLE_NULLS       => \PDO::NULL_NATURAL,
            \PDO::ATTR_DEFAULT_FETCH_MODE => \PDO::FETCH_OBJ,

            \PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true,
            \PDO::ATTR_ERRMODE                  => \PDO::ERRMODE_EXCEPTION,
        ];
        if ($db_host['©charset']) { // Use a specific charset?
            $db_host_options[\PDO::MYSQL_ATTR_INIT_COMMAND] = 'SET NAMES \''.$db_host['©charset'].'\'';

            if ($db_host['©collate']) { // Also a specific collation?
                $db_host_options[\PDO::MYSQL_ATTR_INIT_COMMAND] .= ' COLLATE \''.$db_host['©collate'].'\'';
            }
        }
        if ($db_host['©ssl_enable'] && $db_host['©ssl_key'] && $db_host['©ssl_crt'] && $db_host['©ssl_ca'] && $db_host['©ssl_cipher']) {
            $db_host_options[\PDO::MYSQL_ATTR_SSL_KEY]    = $db_host['©ssl_key'];
            $db_host_options[\PDO::MYSQL_ATTR_SSL_CERT]   = $db_host['©ssl_crt'];
            $db_host_options[\PDO::MYSQL_ATTR_SSL_CA]     = $db_host['©ssl_ca'];
            $db_host_options[\PDO::MYSQL_ATTR_SSL_CIPHER] = $db_host['©ssl_cipher'];
        }
        $Pdo = new \PDO('mysql:host='.$db['©host'].';port='.$db_host['©port'], $db_host['©username'], $db_host['©password'], $db_host_options);

        $Pdo->exec('use `'.$db['©name'].'`');
        $Pdo->db_name         = $db['©name'];
        return $this->current = $Pdo;
    }
PDO instance for a DB.

@since 150424 Initial release.
@since 17xxxx Additional arg/types.

@param int|string|null $shard_id_or_host     Shard ID or DB host.
@param int|string|null $uuid_or_host_db_name UUID64 or host DB name.

@return \PDO A PDO class instance.