Result by selecting datatype BIT wrong

hei-ta's profile image hei-ta posted 1 month ago in General Permalink

The result by select of datatype BIT is shown wrong in the GUI. I tried the option "show binary data as text". Buthese takes no effect. Or is there anything to do on my side?

CREATE TABLE `test_bitfield16` (`Maske` BIT(16) NOT NULL)
COLLATE='utf8mb4_unicode_ci'
ENGINE=InnoDB;

TRUNCATE TABLE test_bitfield16;

INSERT INTO test_bitfield16 (Maske) VALUES (0x000F);
INSERT INTO test_bitfield16 (Maske) VALUES (0x00F0);
INSERT INTO test_bitfield16 (Maske) VALUES (0x0F00);
INSERT INTO test_bitfield16 (Maske) VALUES (0xF000);
INSERT INTO test_bitfield16 (Maske) VALUES (0x003F);
INSERT INTO test_bitfield16 (Maske) VALUES (0x03F0);
INSERT INTO test_bitfield16 (Maske) VALUES (0x3F00);

SELECT 
 Maske, 
 LPAD(HEX(Maske), 4, '0') AS HEX_Maske, 
 LPAD(BIN(Maske), 16, '0') AS BIN_Maske
FROM test_bitfield16;

grafik.png

Please login to leave a reply, or register at first.