Re: [Exim] mysql localdomains?

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Philip Hazel
Dátum:  
Címzett: Chris Knipe
CC: exim-users
Tárgy: Re: [Exim] mysql localdomains?
On Sat, 3 Feb 2001, Chris Knipe wrote:

> Any reason why
>
> local_domains=localhost:mysql;SELECT domain FROM domains WHERE active='1';
>
> or
>
> local_domains="localhost:mysql;SELECT domain FROM domains WHERE
> active='1';"
>
> Wont work?


Yes. You have misunderstood domain lists. Read section 7.12. Hmm. On
checking that section, I see that it isn't at all well explained. Sorry
about that. I'll improve it in the next edition.

You have assumed that the lookup returns a list of domains. It does not.
[If it worked like that, the syntax would be an expansion string.]

A lookup in a domain list is a "probe" with the current domain as a
"key". The data that is looked up is not used. If the lookup succeeds,
the domain is in the list. This is easier to understand with single-key
lookups. Consider a file containing

domain1
domain2
domain3
...

Then if you have

  local_domains = lsearch;/that/file    


the lookup is done by reading through the file, looking to see if any
line matches the current domain. EXACTLY the same process happens if you
use a query such as mysql. What you have to have is a table containing
an entry for each domain, and a lookup such as

local_domains = mysql;SELECT domain FROM domains WHERE domain='$key';

It doesn't matter what field you SELECT because that data is not used.
But you have to mention $key somewhere.

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