Mailing List Archive

dbmail 2 patches
I have made patches to address 2 issues with the current cvs version of
dbmail:
1) in db.c, db_list_mailboxes_by_regex, if there are mailboxes, but none
match the pattern, no check is made and a realloc occurs asking for 0 bytes
memory, resulting in a NULL pointer returned. The patch corrects this
behavior by returning a 0 if the number of matching mailboxes is 0.

2) In MySQL, there is a great performance penalty when calling
mysql_data_seek. The normal MySQL behavior would be to call mysql_fetch_row
repeatedly for each subsequent row. The patch changes the calls to
mysql_data_seek to use mysql_fetch_row, or the last row fetched whenever
possible, and otherwise use the seek. I'm handling mailboxes with 1000's of
rows, and this make a huge difference.


Alex Wheeler

Sr. Systems Engineer
Royall & Company
1920 East Parham Road
RIchmond, VA 23228

http://www.royall.com <http://www.royall.com>
mailto:awheeler@royall.com <mailto:awheeler@royall.com>
(804)741-8965 (Office)
(804)741-8969 (Fax)
Re: dbmail 2 patches [ In reply to ]
Hi,
On Nov 21, 2003, at 12:10 AM, Wheeler, Alex wrote:

> I have made patches to address 2 issues with the currentcvs version of
> dbmail:
>
> 1) in db.c,db_list_mailboxes_by_regex, if there are mailboxes, but
> none match the pattern, no check is made and areallococcurs asking for
> 0 bytes memory, resulting in a NULL pointer returned. The patch
> corrects this behavior by returning a 0 if the number of matching
> mailboxes is 0.
Good one. I've applied your patch and added more of those checks in
shared_mailbox.c and in db_findmailbox_by_regex()
>
> 2) InMySQL, there is a great performance penalty when
> callingmysql_data_seek.  The normalMySQLbehavior would be to
> callmysql_fetch_rowrepeatedly for each subsequent row.  The patch
> changes the calls tomysql_data_seekto usemysql_fetch_row, or the last
> row fetched whenever possible, and otherwise use the seek.  I'm
> handling mailboxes with 1000's of rows, and this make a huge
> difference.
Ok. Didn't know that. Applied your patch

Thanks for your small (easy to check and apply) and very clear patches!

cheers, have a nice weekend,
Ilja
--
IC&S
Stadhouderslaan 57
3583 JD Utrecht
telnr. 030-6355730
faxnr. 030-6355731

PGP-key:
http://www.ic-s.nl/keys/ilja.txt