" WHERE " + (DebugConfig.enableMailboxGroup ? "mailbox_id = ? AND " : "") + "folder_id = ? AND type IN " + IMAP_TYPES);
" WHERE " + IN_THIS_MAILBOX_AND + "folder_id = ? AND type IN " + IMAP_TYPES);
    public static List<ImapMessage> loadImapFolder(Folder folder) throws ServiceException {        Mailbox mbox = folder.getMailbox();        List<ImapMessage> result = new ArrayList<ImapMessage>();        Connection conn = mbox.getOperationConnection();        PreparedStatement stmt = null;        ResultSet rs = null;        try {            stmt = conn.prepareStatement("SELECT " + IMAP_FIELDS +                    " FROM " + getMailItemTableName(folder.getMailboxId(), " mi") +                    " WHERE " +                    (DebugConfig.enableMailboxGroup ? "mailbox_id = ? AND " : "") +                    "folder_id = ? AND type IN " + IMAP_TYPES);            int pos = 1;            if (DebugConfig.enableMailboxGroup)                stmt.setInt(pos++, mbox.getId());            stmt.setInt(pos++, folder.getId());            rs = stmt.executeQuery();            while (rs.next()) {                int flags = rs.getBoolean(4) ? Flag.BITMASK_UNREAD | rs.getInt(5) : rs.getInt(5);                result.add(new ImapMessage(rs.getInt(1), rs.getByte(2), rs.getInt(3), flags, rs.getLong(6)));            }            return result;        } catch (SQLException e) {            throw ServiceException.FAILURE("loading IMAP folder data: " + folder.getPath(), e);        } finally {            DbPool.closeResults(rs);            DbPool.closeStatement(stmt);        }    }