Re: [exim] mysql expansion

Page principale
Supprimer ce message
Répondre à ce message
Auteur: #Ronan McGlue
Date:  
À: exim-users
Sujet: Re: [exim] mysql expansion
Mike Cardwell wrote:
> * on the Mon, Feb 26, 2007 at 03:37:09PM +0000, #Ronan McGlue wrote:
>
>> My redirect router looks like
>>
>>
>>    data = ${lookup mysql{select mailbox,host from routing where alias = 
>> '${quote_mysql:$local_part}'}}

>>
>> according to the spec this will return
>>
>> mailbox=testuser host=testhost.qub.ac.uk
>>
>> how do i change this to be mailbox@host ?
>
> Do it in the query it's self:
>
> data = ${lookup mysql{select concat(mailbox,'@',host) from routing where alias = '${quote_mysql:$local_part}'}}
>
> That will return "testuser@???" rather than
> "mailbox=testuser host=testhost.qub.ac.uk" as the result is a single
> value, rather than a list.
>
> Mike
>

Thanks Mike, that seems to do it. however...

bash3.1 #exim -bt r.mcglue@???
r.mcglue@??? cannot be resolved at this time: failed to expand
"${lookup mysql{select concat(mailbox,'@',host) from routing where alias
= '${quote_mysql:$local_part}'}}": lookup of "select
concat(mailbox,'@',host) from routing where alias = 'r.mcglue'" gave
DEFER: incomplete MySQL server data: sXT
[root@rhexim ~]#

whereas


mysql> select concat(mailbox,'@',host) from routing where alias =
'r.mcglue';
+-----------------------------+
| concat(mailbox,'@',host)    |

+-----------------------------+
| rmcglue@???       |

+-----------------------------+
1 row in set (0.00 sec)


whats this?

R
--
Regards

Ronan McGlue

===================
Analyst / Programmer
Queens University Belfast