Re: [exim] Decimal IP Calculation

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Mike Cardwell
Date:  
À: exim-users
Sujet: 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