INET_ATON()

Documentation

VoltDB Home » Documentation » Using VoltDB

INET_ATON()

INET_ATON() — Converts an IPv4 internet address from a string to a numeric value

Synopsis

INET_ATON( {string} )

Description

The INET_ATON() function converts a VARCHAR value representing an IPv4 internet address in dot notation to a single BIGINT value. The VARCHAR value must consist of four integer values separated by dots, such as "104.112.152.119", or a null value. The string representations of the integer values must be between 0 and 256 and cannot contain any spaces or leading zeros. For example, string values of "0" and "12" are valid but "012" is not.

You can use the INET_NTOA() function to reverse the conversion or you can use the INET6_ATON and INET6_NTOA functions to perform similar conversions on IPv6 addresses.

Example

The following example converts a string representation of an internet address to a BIGINT value before storing it in the Address table

INSERT INTO Address (ip, owner, date) VALUES (INET_ATON(?),?,?);