" WHERE " + (DebugConfig.enableMailboxGroup ? "mailbox_id = ? AND " : "") + "parent_id = ? AND folder_id != ?");
" WHERE " + IN_THIS_MAILBOX_AND + "parent_id = ? AND folder_id != ?");
    public static void setFolder(MailItem item, Folder folder) throws ServiceException {        Mailbox mbox = item.getMailbox();        if (mbox != folder.getMailbox())            throw MailServiceException.WRONG_MAILBOX();        Connection conn = mbox.getOperationConnection();        PreparedStatement stmt = null;        try {            String imapRenumber = mbox.isTrackingImap() ? ", imap_id = IF(imap_id IS NULL, NULL, 0)" : "";            int attr = 1;            if (item instanceof Folder) {                stmt = conn.prepareStatement("UPDATE " + getMailItemTableName(item) +                        " SET parent_id = ?, folder_id = ?, mod_metadata = ?, change_date = ?" +                        " WHERE " +                        (DebugConfig.enableMailboxGroup ? "mailbox_id = ? AND " : "") +                        "id = ? AND folder_id != ?");                stmt.setInt(attr++, folder.getId());            } else if (item instanceof Conversation && !(item instanceof VirtualConversation)) {                stmt = conn.prepareStatement("UPDATE " + getMailItemTableName(item) +                        " SET folder_id = ?, mod_metadata = ?, change_date = ?" + imapRenumber +                        " WHERE " +                        (DebugConfig.enableMailboxGroup ? "mailbox_id = ? AND " : "") +                        "parent_id = ? AND folder_id != ?");            } else {                stmt = conn.prepareStatement("UPDATE " + getMailItemTableName(item) +                        " SET folder_id = ?, mod_metadata = ?, change_date = ? " + imapRenumber +                        " WHERE " +                        (DebugConfig.enableMailboxGroup ? "mailbox_id = ? AND " : "") +                        "id = ? AND folder_id != ?");            }            stmt.setInt(attr++, folder.getId());            stmt.setInt(attr++, mbox.getOperationChangeID());            stmt.setInt(attr++, mbox.getOperationTimestamp());            if (DebugConfig.enableMailboxGroup)                stmt.setInt(attr++, mbox.getId());            stmt.setInt(attr++, item instanceof VirtualConversation ? ((VirtualConversation) item).getMessageId() : item.getId());            stmt.setInt(attr++, folder.getId());            stmt.executeUpdate();        } catch (SQLException e) {            throw ServiceException.FAILURE("writing new folder data for item " + item.getId(), e);        } finally {            DbPool.closeStatement(stmt);        }    }