Re: [exim-dev] sqlite lookup support.

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Philip Hazel
Datum:  
To: David Woodhouse
CC: exim-dev
Betreff: Re: [exim-dev] sqlite lookup support.
On Mon, 4 Jul 2005, David Woodhouse wrote:

> I really shouldn't be using lsearch and ${run sh -c "echo blah >> dbfile"}
> for my greylisting. Here's sqlite3 support.


That's all good stuff, but I'm going to change the way you do it because
otherwise sqlite queries cannot be used in domain lists, host lists,
etc.

Instead of making it a rather odd "single-key" type lookup, I will make
it into a true "query-style" lookup, with this syntax:

${lookup sqlite{/file/name <sql query>}}

This means you can then do things like

domains = sqlite;/my/db select ... where domain='$domain' : ....

which your code does not support, because the single-key lookups assume
that the key is the domain name.

Also, you didn't supply a quoting function. Is is correct that the only
character that needs to be quoted (by doubling) is the single quote?

Oh, and I found a bug (in case you are using this for real). You forgot
to add the terminating zero byte to the result data. (The
string_append() function doesn't.) And I'll put the results through the
lf_quote() function so that empty fields etc. get quoted.

Philip

-- 
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.