On Thu, 23 Aug 2001, Johansson Jan wrote:
> condition = ${lookup mysql{select if(count(*), "yes", "no") from passwd
> where id='$local_part@$domain'}{$value}{no}}
>
> That works. for some reason 1 / 0 didnt work as expected? Anyway, thankyou
> for your help, your statement was right, aslong as the responses were
> replaced.
>
> According to p. 103 in the book "0" "no" "false" should all generate a fail
> in the dition", can anyone shed som ligt on why it didnt in this case? (Exim
> 3.33)
What your message said you used was this line:
select if(count(*), "1", "0) from passwd where id='$local_part@$domain'
Is that actually correct? If so, the problem is a missing " after "0
> (I would really have liked a tad more examples in the aye aye book :)
1. It got long enough as it is!
2. I am not an SQL user, and know very little about it. Consequently,
such examples as there are are very simple. Indeed, from this thread I
have now learned that you can do things like
select if(count(*), "1", "0") from passwd where id='$local_part@$domain'
which I presume means 'yield "1" if a record is found, and "0" if no
record is found'. I rather suspected the query language could do fancy
stuff like that, which makes the use of "condition" a lot tidier. People
have been using messier constructions like
${lookup mysql {select id from passwd where id='$local_part@$domain'}{1}{0}}
--
Philip Hazel University of Cambridge Computing Service,
ph10@??? Cambridge, England. Phone: +44 1223 334714.