Re: [exim-dev] Patch to allow calling MySQL stored procedure…

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: B. Johannessen
Ημερομηνία:  
Προς: exim-dev
Αντικείμενο: Re: [exim-dev] Patch to allow calling MySQL stored procedures from Exim
Is there any interest in this patch at all or should I just resign
myself for maintaining it privately? For the record, it's been working
flawlessly for me for the last 10 days/~650.000 messages.

To illustrate the beauty of being able to call MySQL stored procedures:

mysql> CALL rcpt('bob', 'db.org');
+--------+------------------+--------+-------+------------+------------+
| status | server           | filter | sieve | quota      | home       |

+--------+------------------+--------+-------+------------+------------+
|      0 | cacofonix.db.org |      2 | keep; | 1073741824 | /home/bob/ |

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

This fetches information from 4 or 5 different tables and returns the
relevant values as a single row. Extremely easy to call from Exim, and
if you call it via a macro such as

RCPT = ${lookup mysql{CALL rcpt('${quote_mysql:$local_part}',
'${quote_mysql:$domain}')}}

you can then extract values from the result set such

${if eq {${extract{status}{RCPT}}}{1}}

With the help of the query-cache, this means then Exim will normally
only call the store procedure once per recipient per process.

If you have any interest in this at all, I would like to invite you to
try out the patch (preferably on a non-production system). If you do,
please report back with your results. If there's any interest, I'd
eventually like to this included in Exim, and I'm willing to work out
any bugs as they show up while testing...


    Bob


B. Johannessen wrote:
> B. Johannessen wrote:
>> Huh! This wasn't as simple as I'd hoped...
>
> This Easter-break thing is no good. I haven't had a real cup of coffee
> since yesterday and it shows. Attached it what is hopefully tonights
> last attempt.