chunk_split for MySQL MariaDB

Need a chunk_split for MySQL? No procedures, no cursors. This hack is very specific for adding a space each octet in a 32 bit binary string. Test in your favorite SQL client: set @s32bit = ‘00000000000000001100001010100010’; select insert(insert(insert(@s32bit,9,0,‘ ‘),18,0,‘ ‘),27,0,‘ ‘); Example select string: select foo, blah, hex(bar) as ‘Hex’, insert(insert(insert(LPAD(CONV(hex(Db), 16, 2), 32, ‘0’),9,0,‘ ‘),18,0,‘ ‘),27,0,‘… Continue reading chunk_split for MySQL MariaDB

Categorized as SQL

PHP netMatch ipv6 and 4

netMatch ipv6 version 6 ip addresses A PHP based netMatch function updated to match ipv6 (version 6 and 4) ip addresses to multiple mixed networks. Supports all network representations that satisfy php’s inet_pton(), which includes ipv6 condensed ‘::1′ and alternative ”fe80:0:0:0:0:0:’ addresses. # netmatch6 cobbled 2/16, Classless inter-domain routing (CIDR) # inspired by various at, stephane at… Continue reading PHP netMatch ipv6 and 4

Categorized as PHP