At 11:38 09/08/2002 +0100, Philip Hazel wrote:
>On Fri, 9 Aug 2002, Tom Bell wrote:
> > I under stand that, my problem is that I dont want SQL to do the
> > matching. To quote the exim manual at exim.org
> >
> > Partial matching is implemented by doing a series of separate lookups
> > using keys constructed by modifying the original subject key. This means
> > that it can be used with any of the single-key lookup types, provided
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> > Well it seems that this is not working with partial-mysql.
>
>No, it won't. You've overlooked one vital statement in the manual. The
>title of that section is:
>
>9.5 Partial matching in single-key lookups
> ^^^^^^^^^^^^^^^^^^^^^
> > So my question is probably more like is partial-mysql meant to work ?
>
>No. Partial matching works only in single-key lookups, where Exim has a
>simple key string to look up. I will put a more prominent warning into
>the next edition of the manual.
Ah. <fx: wonders> So how about...
${lookup {<key>} partial-mysql {<query>} {<success>} {<fail>}}
where <query> involves a reference to something like
$exim_permutable_lookup_key (actually, preferably just $lookup_key),
thereby making a single-key style lookup of the query-style lookup (in that
Exim can permute the value of $lookup_key and perform multiple attempts as
per single-key partial lookups currently)?
It might be that this would be a more elegant solution than contriving more
complex queries which attempted to score the result and limit their output
to one entry, and perhaps faster if your database is much better optimised
for single-key queries than it is for multiple-key or ranged queries (like
MySQL). While MySQL and PostgreSQL support doing regexes, they're miserably
slow against large tables, especially when the variable bit's at the
beginning (how do you do any kind of indexed search on ".*\.fict\.example"?
By building the index from the right hand end of the text. I don't think
that's a normal feature; instead they fall back to using a sequential scan.)
</fx>
Just a suggestion, and probably not even worth 2p.
Incidentally, reading about the query-style lookup, the thing that confused
me most was not being told how to refer to the value to look up when
constructing the query! Then I twigged that you just use whatever exim
variables you want.
Cheers,
John.
--
John Robinson Tel +44 7771 784058
Though my soul may set in darkness / It will rise in perfect light;
I have loved the stars too fondly / To be fearful of the night.