Hi.

On Tue, Mar 20, 2001 at 02:09:48PM -0800, [EMAIL PROTECTED] wrote:
> ok... this is stumping me.... perhaps I'm doing something wring, but It
> doesn't appear that I am....
> 
> Am I doing, or not doing something that makes the INET_ATON function
> default to 127.255.255.255 ?

No, as you should yourself below, INET_ATON("192.168.50.5") returns
the correct result (3232248325), while inserting the result into the
table does not (2147483647). So this has nothing to with INET_ATON().

You can verify this by doing:

INSERT INTO sequoia VALUES (3232248325, 'Test', 'Test', 'Test');

which will also yield to a wrong value stored in the table.

> why does it work for 24.18.10.5, but not
> 192.168.50.5 when inserting into a table?

The explanation is very probably that you have defined sequoia.ip to
be of type INT, which has a MAX value of 2147483647.

If you insert a too large value (for example 3232248325) into a
column, MySQL will insert the MAX value of that column instead (here:
2147483647).

Simply change the table type to INT UNSIGNED and your problem should
be gone.

Bye,

        Benjamin.


> mysql> SELECT INET_ATON("24.18.10.5");
> +-------------------------+
> | INET_ATON("24.18.10.5") |
> +-------------------------+
> |               403835397 |
> +-------------------------+
> 1 row in set (0.01 sec)
> 
> mysql> SELECT INET_ATON("192.168.50.5");
> +---------------------------+
> | INET_ATON("192.168.50.5") |
> +---------------------------+
> |                3232248325 |
> +---------------------------+
> 1 row in set (0.01 sec)
> 
> mysql> insert into sequoia VALUES ( INET_ATON("24.18.10.5"), 'TestHost',
> 'This is a test', 'Test' );
> Query OK, 1 row affected (0.03 sec)
> 
> mysql> insert into sequoia VALUES ( INET_ATON("192.168.50.5"),
> 'TestHost2', 'This is a test', 'Test' );
> Query OK, 1 row affected (0.01 sec)
> 
> mysql> select * from sequoia;
> +------------+-----------+----------------+----------+
> | ip         | hostname  | comment        | customer |
> +------------+-----------+----------------+----------+
> |  403835397 | TestHost  | This is a test | Test     |
> | 2147483647 | TestHost2 | This is a test | Test     |
> +------------+-----------+----------------+----------+
> 2 rows in set (0.01 sec)
> 
> mysql> select INET_NTOA(ip),hostname from sequoia;
> +-----------------+-----------+
> | INET_NTOA(ip)   | hostname  |
> +-----------------+-----------+
> | 24.18.10.5      | TestHost  |
> | 127.255.255.255 | TestHost2 |
> +-----------------+-----------+
> 2 rows in set (0.01 sec)

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to