private function build_message($sql_arr)
    {
        $message = $this->db->decode($sql_arr['data'], true);

        if ($message) {
            $message->flags = array();
            foreach ($this->flags as $idx => $flag) {
                if (($sql_arr['flags'] & $idx) == $idx) {
                    $message->flags[$flag] = true;
                }
           }
        }

        return $message;
    }