Re: [exim] handling nulls in SQL lookups

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Ian P. Christian
Fecha:  
A: exim-users
Asunto: Re: [exim] handling nulls in SQL lookups
Jakob Hirsch wrote:
>> It's damn annoying, I had to break out strace to try to figure out what
>> was going on with this one.
>
> What was the problem you got from that?


Actually, it didn't even help - it was like working with a black box
this one. I'll have a look at the source later and see if I can see why
there's no error handling.

> The easiest SQL way is "SELECT IFNULL(SUM(something),0) ...". That's
> probably better than using Exim magic...


Yeah, I decided just to do it in SQL again like I was in MySQL:

SPAM_COUNT    = SELECT COALESCE(SUM(spam_score),0) FROM spam WHERE host
= '${quote_sqlite:$sender_host_address}' AND created_at > (${tod_epoch}
- 300);


Thanks all,

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