Re: [exim] Decimal IP Calculation

Top Page
Delete this message
Reply to this message
Author: Mike Cardwell
Date:  
To: exim-users
Subject: Re: [exim] Decimal IP Calculation
* on the Sun, Dec 09, 2007 at 01:56:57PM +0000, Phil White wrote:

> warn
>   message       = X-Info: Return = \
>                      ${lookup mysql { SELECT value FROM system WHERE \
>                               ip_addr=$acl_c5 } \ {$value}{0} \
>                       }

>
> Database that I am trying to access stores as decimal IP, and it is
> going to be a pain to change


Use the MySQL function INET_ATON() in your query

Eg:

SELECT value FROM system WHERE ip_addr = INET_ATON("127.0.0.1");

mysql> SELECT INET_ATON("127.0.0.1");
+------------------------+
| INET_ATON("127.0.0.1") |

+------------------------+
|             2130706433 | 

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

Mike