Re: [Exim] Basic Exim+SQL

Pàgina inicial
Delete this message
Reply to this message
Autor: Nico Erfurth
Data:  
A: Steve Sherwood
CC: exim-users@exim.org
Assumpte: Re: [Exim] Basic Exim+SQL
On 24 Oct 2002, Steve Sherwood wrote:

> Just getting into Exim+SQL. I've scanned the web + mailing lists and
> what I seem to be doing is correct.
>
> hide mysql_servers = localhost/db/user/pass
> domainlist local_domains = @:localhost:mydomain.com:mydomain2.com
>
> The config file works perfectly with this... (xyz@???) is
> delivered locally.
>
> If I swap it to say
>
> domainlist local_domains = @:localhost:${lookup mysql{SELECT domain FROM
> local_domains}}


When this is expanded, it will result in this
domainlist local_domains = @:localhost:mydomain.com\nmydomain2.com

What you want is something like this
domainlist local_domains @:localhost:mysql;select 1 from local_domains \
where domain='${quote_mysql:$domain}'

This just queries the database for "Do we know about this domain?"

> Anyone has any ideas why this doesn't work?


The lookup yields the results line per line, but exim wants them seperated
by a :
It's better to use the lookup; style, because it acts like a command,
expansions will be done BEFORE the list is checked, and IIRC they make the
list uncacheable. The lookup;-parts will be matched ONLY when reached in
the list (And the list stays cacheable IIRC).

Btw, you should extract such data that's used very often to some very fast
datastore (local dbm/cdb-file) because this is needed very often.

ciao