RE: [Exim] Syntax for a MySQL select true/false statement

Top Page
Delete this message
Reply to this message
Author: Troy Settle
Date:  
To: eli
CC: exim-users
Subject: RE: [Exim] Syntax for a MySQL select true/false statement
Here's what I use:

SELECT if(count(*), "1", "0") FROM table WHERE ...

Which will return a 1 or 0, which exim treats as TRUE or FALSE.


--
Troy Settle
Pulaski Networks
http://www.psknet.com
540.994.4254 - 866.477.5638


> -----Original Message-----
> From: exim-users-admin@???
> [mailto:exim-users-admin@exim.org] On Behalf Of Eli
> Sent: Wednesday, June 18, 2003 4:21 PM
> To: 'William Thompson'
> Cc: exim-users@???
> Subject: RE: [Exim] Syntax for a MySQL select true/false statement
>
>
> Thanks - that's the syntax I was looking for. I didn't know
> it was that
> easy!
>
> Eli.
>
> -----Original Message-----
> From: exim-users-admin@???
> [mailto:exim-users-admin@exim.org] On Behalf
> Of William Thompson
> Sent: Wednesday, June 18, 2003 3:00 PM
> To: Eli
> Cc: exim-users@???
> Subject: Re: [Exim] Syntax for a MySQL select true/false statement
>
>
> > I want to do a MySQL select to test something, but I don't
> really have any
> > useful data to return. It's a test to see if a user account has
> forwarding
> > enabled (or is an alias), or is a real account to receive
> actual delivery
> of
> > email. Right now I have:
> >
> > virtual_user:
> >         driver                  = accept
> >         domains                 = +virtual_domains
> >         transport               = virtual_delivery

> >
> > virtual_forward:
> >         driver                  = redirect
> >         no_expn
> >         no_verify
> >         check_ancestor
> >         domains                 = +virtual_domains
> >         data                    = ${lookup mysql{SELECT fwd
> FROM users
> WHERE
> > host = '${quote_mysql:$domain}' AND user =
> '${quote_mysql:$local_part}'
> AND
> > fwd IS NOT NULL}}

> >
> >
> > But when I send an email to an address that is supposed to
> forward email
> > (not receive delivery), it attempts to receive delivery
> anyways because it
> > just matched the virtual_user router settings first.
> >
> > I want to add something like:
> >
> >     condition            = ${lookup mysql{SELECT fwd FROM
> > users WHERE host = '${quote_mysql:$domain}' AND user =
> > '${quote_mysql:$local_part}'}}

>
> How about: ${lookup mysql{SELECT fwd FROM users WHERE host =
> '${quote_mysql:$domain}' AND user =
> '${quote_mysql:$local_part}'} {yes}
> {no}}
> ?
>
> --
>
> ## List details at
> http://www.exim.org/mailman/listinfo/exim-> users Exim
> details
> at http://www.exim.org/ ##
>
> ---
> [This
> E-mail scanned for viruses]
>
>
> ---
> [This E-mail scanned for viruses]
>
>
> --
>
> ## List details at
> http://www.exim.org/mailman/listinfo/exim-> users Exim details
> at http://www.exim.org/ ##
>
>