Auteur: Bård Johannessen Datum: Aan: exim-users Onderwerp: Re: [exim] DB lookup caching and multiple columns/fields
On 27/11/12 14:20, Robert Blayzor wrote: > That said, is there a build in function in Exim that allows you to grab those multiple elements out of the string without having to create some crazy regex match to get the fields your looking for on each one?
> ie: does something like this work or make sense?
> ${lookup pgsql{select home,name from users where id='foobar'}{$value:home}}
${extract:
${extract{id}{${lookup pgsql{SELECT * FROM domains WHERE name =
'${quote_pgsql:$domain}'}}}}
Use macros to make it more readable:
DOMAIN_QUERY = ${lookup pgsql{SELECT * FROM domains WHERE name =
'${quote_pgsql:$domain}'}}
DOMAIN_ID = ${extract{id}{DOMAIN_QUERY}}
DOMAIN_NAME = ${extract{name}{DOMAIN_QUERY}}