[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: IMAP and MySQL?



On Fri, May 03, 2002 at 03:22:39PM -0500, Dan Hinds wrote:
> I see that there is a patch for the Courier IMAP system to use a pgsql database, but is there a patch that will allow it to use a MySQL database with the table structure used by Qmail-SQL?

It's possible to create a database-view, which reformats the qmail-sql
table to a imap-table. Both qmail-sql and imap will be happy that way. The
difference between both tables consists in the way the 'login'-field is
handled. I refuse to consider login@domain as an atomic field. In
my opinion the login-part is separated from the domain-part: the '@' is just
a choosen separator. So login and domain-part should each go into a different
column.
Anyway: with postgresql the view is created with:
CREATE VIEW imap AS ( 
                      SELECT passwd.uid, 
                             passwd.gid, 
                             passwd.home, 
                             passwd.password, 
                             passwd.hardquota, 
                             (passwd.login || '@' || passwd.virtual_host) AS id
                       FROM passwd
                     );

MySQL doesn't provide VIEWS yet, but it should be available around version 4.1.
If you cannot wait that long, i'd suggest using PostgreSQL ...

Kind regards,
Michael.