Matthew T. O'Connor wrote:
It appears that this block of code is the problem:

       /* delete each message */
       for (i = 0; i < *affected_rows; i++) {
               message_id = db_get_result_u64(i, 0);
               if (db_delete_message(message_id) == -1) {
trace(TRACE_ERROR, "%s,%s: error deleting message",
                             __FILE__, __func__);
                       db_free_result();
                       return DM_EQUERY;
               }
       }

The symptom is that after the first loop, db_get_result_u64 is returning 0 for a message_id, however, I'm not able to diagnose why.

After a little more digging, it appears that what is happening is that the global variable res is getting over written, it's available the first time the above loop tries to get the message_id, but then after the delete query is issued by db_delete_message, then the global res has been overwritten. Does this sound right? If there is only one global result set, how do we work around this? And why are we using globals at all?

Matt

Reply via email to