On 2008-09-28 at 14:01 +0100, Andy Smith wrote:
> I suppose its a result of the number of curly brackets used in the
> statement, but Im not sure how to write this properly. Any suggestions?
You still need the quotes for MySQL itself as the delimiters;
quote_mysql provides the escaping but not the surrounding quotes.
So:
${lookup mysql {\
SELECT remote_name FROM forwarder LEFT JOIN domain_alias \
ON domain_alias.domain_name = forwarder.domain_name \
WHERE local_part = '${quote_mysql:$local_part}' \
AND (forwarder.domain_name = '$domain' OR alias = '$domain')}}
Search spec.txt for "external_smtp_batv" (without quotes) to see one
example of this. Search for the line starting "login:" (without quotes)
to see an example of why the delimiters themselves aren't provided, in
the LDAP example where the escaped data forms only a smaller part of the
entire query string:
user="cn=${quote_ldap_dn:$auth1},ou=people,o=example.org"
-Phil