public function setCharset($charset = 'UTF8', \PDO $db)
    {
        try {
            if (empty($charset) || !$db) {
                throw new DatabaseException(__METHOD__ . "\ncharset:$charset\nressource:" . print_r($this->db, true), self::ERR_EXEC, self::SEVERITY_LOG, __FILE__, __LINE__);
            }

            $this->mysqli_client_encoding = (string)$charset;

            if ($this->db_detail) {
                $this->db_detail->character_set_client = (string)$charset;
            }
        } catch (DatabaseException $e) {
            throw $e;
        }

        $db->exec("set names $charset");

        return true;
    }