Slide 254
Slide 254 text
ফ͑ͨࢀরઌͷςʔϒϧ໊JEςφϯτJEΛ͢ͱ
66*%Λฦͯ͘͠ΕΔϋογϡؔ
ϦϨʔγϣϯઌͷϨίʔυ͕ͳ͍
DELIMITER //
CREATE FUNCTION sys.GHOSTUUID(table_name TEXT, id BIGINT, tenant_id TEXT)
RETURNS TEXT CHARSET utf8mb4 DETERMINISTIC
BEGIN
SET @sha2 = SHA2(CONCAT('table_name:',table_name,'::id:',id,'::tenant_id:',tenant_id), 512);
SET @uuid = CONCAT(
SUBSTR(@sha2 from 10 for 8),
'-',
SUBSTR(@sha2 from 18 for 4),
'-4',
SUBSTR(@sha2 from 22 for 3),
'-',
LOWER(CONV(CONV(SUBSTR(@sha2 from 26 for 1), 16, 10) & 3 | 8, 10, 16)),
SUBSTR(@sha2 from 27 for 3),
'-',
SUBSTR(@sha2 from 40 for 12)
);
RETURN @uuid;
END;
//
DELIMITER ;