Re: [exim] handling nulls in SQL lookups

Top Page
Delete this message
Reply to this message
Author: Ian P. Christian
Date:  
To: Jakob Hirsch, exim-users
Subject: Re: [exim] handling nulls in SQL lookups
Jakob Hirsch wrote:
> Quoting Ian P. Christian:
>
>>           set acl_m3  = ${lookup sqlite {SQLITE_DB SPAM_COUNT}{$value}}
>> However, this will obviously return nothing if the host has never mailed
>> before, and the 'Spam total' reports as NULL.

>
> set acl_m3 = ${lookup sqlite {SQLITE_DB SPAM_COUNT}{$value}{0}}
>
> Will return 0 if the lookup returns nothing.


I tried that, but unfortunately it doesn't.

2006-07-23 10:04:05 1G4Zsb-0002IR-Cx <snip> Warning: Spam total: <NULL>


>> btw - exim seems to do NO error reporting with sqlite problems
>
> uh, that's quite bad, depending on what you are doing with it.


It's damn annoying, I had to break out strace to try to figure out what
was going on with this one.

Martin's suggestion (thanks Martin) of doing it in the SQL is the way
I've been doing it until now - I was just curious as to weather there is
a better way

Regards,

--
Ian P. Christian ~ http://pookey.co.uk