Code: Select all
CREATE TABLE `tmp` (
`wid` bigint unsigned NOT NULL,
`simhash` binary(255) NOT NULL,
PRIMARY KEY (`wid`),
UNIQUE KEY `u_simhash` (`simhash`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
TRUNCATE `tmp`;
insert into tmp set wid=4, simhash=b'10';
SELECT wid,bin(simhash+0) FROM tmp;
Aber es schlägt fehl. Das Ergebnis von bin(simhash+0) ist 0 und nicht 10, wie ich erwartet hatte.
Was ist also das Problem? Ich möchte nur eine Binärzeichenfolge (wie „1000110101101....“) in das Binärfeld einfügen.
- Env: MySQL 8.0.40
- Client: MySQL Workbench 8.0.40
