Re: [Exim] Opinions sought: Exim and MYSQL

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Philip Hazel
Datum:  
To: pkelly
CC: exim-users
Betreff: Re: [Exim] Opinions sought: Exim and MYSQL
I now have a MYSQL lookup implemented which works as follows:

. mysql_servers must be set to a list of host/database/user/password
tuples. They are tried in order until a connection succeeds. No
database need be supplied - it must then be given in the queries.

. connections to the database are cached, based on mysql_servers
strings.

. The format of the query is an SQL statement, so an example might be

${lookup mysql{select mailbox from users where id='ph10'}{$value}fail}

. If the result of the query contains more than one field, the data for
each field in the row is returned, preceded by its name, so the result
of a lookup such as

    ${lookup mysql{select home,name from users where id='ph10'}{$value}fail} 


might be

    home=/home/ph10 name="Philip Hazel" 


Values containing spaces and empty values are double quoted, with
embedded quotes escaped by \.

. If the result of the query contains just one field, the value is
passed back verbatim, without a field name, e.g.

    Philip Hazel 


. If the result of the query yields more than one row, it is all
concatenated, with a newline between the data for each row.

Comments?

-- 
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.