public function selectDb($dbname, \PDO $db)
    {
        if (empty($db) || empty($dbname)) return false;
        try {
            if (!$db->query("USE `$dbname`")) {
                $this->error   = (string)$db->errorInfo();
                $this->errorno = (int)$db->errorCode();
                throw new DatabaseException(__METHOD__ . "\nsql_error: $this->error\nsql_errorno:$this->errorno", self::ERR_EXEC, self::SEVERITY_LOG, __FILE__, __LINE__);
            }
        } catch (DatabaseException $e) {
            throw $e;
        }

        return true;
    }