Skip to content
Converting IP addresses between string and numeric representation in sqlite
C Shell Makefile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
Makefile MinGW support May 23, 2017
README.md Updated the checksums Sep 4, 2017
inet.c Fixed `255.255.255.255` detected as malformed ip on windows Aug 29, 2017
testsuite.sh Additional test cases for @Animadei fixes Sep 4, 2017

README.md

sqlite-inet

This Sqlite extension provides inet_aton() and inet_ntoa() functions for converting IP adresses between their string and numeric representation.

Usage

$ make
$ sqlite3
sqlite> .load bin/inet
sqlite> select inet_ntoa(3232235777);
192.168.1.1

If you don't want to compile code yourself you can download binaries from here:

Operating System SHA256
Linux 64-bit 0fd7032dd132a26fa44b33777aba1cbd841cada2a3a91aaee9379da84d627cad
Linux 32-bit be1264f95b2d2229ed9250911022ec9f1be89d29919aebc65f72131954e9a946
Windows 64-bit 74202c3c4f13b71c85657c7ed0066eddf82055157d27678d10b27a035c4b8235
Windows 32-bit 5416b902d8c7aa66fdd6ce1619199371f4fabffbf23c047d967fe84fd5718bca

Misc

The functions behave like their MariaDB analogs, that is, they expect integers in host byte order, rather than network byte order as expected by C functions. For more info, see this bug report.

When invoked with NULL, NULL is returned.

When invoked with otherwise incorrect data, an error is raised.

You can’t perform that action at this time.