Re: [exim] macros in macros

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Tony Finch
Ημερομηνία:  
Προς: Arkadiusz Miskiewicz
Υ/ο: exim-users
Αντικείμενο: Re: [exim] macros in macros
On Wed, 24 Aug 2005, Arkadiusz Miskiewicz wrote:

> I'm afraid that it doesn't change anything. I'm still getting empty results:


I'm not entirely sure how your queries are supposed to work, but if you
want the ${extract to work on the result of the QUOTA_STANDARD query
you'll have to do the QUOTA_STANDARD lookup separately. At the moment
you're interleaving SQL and Exim expansions in a very dodgy manner. Try
something like

QUOTA_STANDARD = SELECT ...

# in the following, $value refers to the result of the above query

QUOTA_EXTRA = SELECT ... \
              WHERE account_id=${extract {$user_id}{$value} } \
              ...


# the outer lookup here sets $value

quota = ${lookup mysql {QUOTA_STANDARD} \
            {${eval: ${extract {quota_max}{$value} } \
                   + ${lookup mysql {QUOTA_EXTRA} } \
            }} }


Though to be honest you should probably re-arrange your tables so that the
whole quota calculation can be done with one SQL query.

Tony.
--
<fanf@???> <dot@???> http://dotat.at/ ${sg{\N${sg{\
N\}{([^N]*)(.)(.)(.*)}{\$1\$3\$2\$1\$3\n\$2\$3\$4\$3\n\$3\$2\$4}}\
\N}{([^N]*)(.)(.)(.*)}{\$1\$3\$2\$1\$3\n\$2\$3\$4\$3\n\$3\$2\$4}}