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,‘ ‘) ‘Binary’ from demo_tbl LIMIT 5;
Output:
00000000 00000000 11000010 10100010
A more readable binary string due to the added spaces to separate (chunk) the bytes.