Looks like I missed that use of the datefield. I'll get a patch over to paul for commit later on today. Your attempt will work for the time being, but the joins need to be done a bit different for performance reasons.
-Jon Максим Подоров wrote: > Paul, during IMAP search, SQLExceptions are thrown. The proposed fix is > below. > > Best regards, > Maxim Podorov > > --- dbmail-mailbox.c.orig 2009-05-18 09:45:15.000000000 +0400 > +++ dbmail-mailbox.c 2009-05-21 13:09:28.000000000 +0400 > @@ -1353,10 +1353,12 @@ > > g_string_printf(q,"SELECT message_idnr FROM %smessages m " > "JOIN %sphysmessage p ON m.physmessage_id=p.id " > - "JOIN %sdatefield d ON d.physmessage_id=p.id " > + "JOIN %sheader h ON h.physmessage_id=p.id " > + "JOIN %sheadername n ON h.headername_id=n.id " > + "JOIN %sheadervalue v ON h.headervalue_id=v.id " > "WHERE mailbox_idnr= ? AND status IN (?,?) " > - "AND %s " > - "ORDER BY message_idnr", DBPFX, DBPFX, DBPFX, t->str); > + "AND %s AND n.headername = 'date' " > + "ORDER BY message_idnr", DBPFX, DBPFX, DBPFX, DBPFX, DBPFX, t->str); > > st = db_stmt_prepare(c,q->str); > db_stmt_set_u64(st, 1, dbmail_mailbox_get_id(self)); > @@ -1374,7 +1376,8 @@ > "JOIN %sheader h ON h.physmessage_id=p.id " > "JOIN %sheadername n ON h.headername_id=n.id " > "JOIN %sheadervalue v ON h.headervalue_id=v.id " > - "WHERE n.headername %s ? AND %s %s ? " > + "WHERE mailbox_idnr = ? AND status IN (?,?) " > + "AND n.headername %s ? AND %s %s ? " > "ORDER BY message_idnr", > DBPFX, DBPFX, DBPFX, DBPFX, DBPFX, > db_get_sql(SQL_INSENSITIVE_LIKE), > > _______________________________________________ > Dbmail-dev mailing list > [email protected] > http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail-dev > > -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. _______________________________________________ Dbmail-dev mailing list [email protected] http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail-dev
