Urlencode/urldecode As MySQL Stored Functions
Join the DZone community and get the full member experience.
Join For Freeโ
โ
DELIMITER ;
โ
DROP FUNCTION IF EXISTS multiurldecode;
โ
DELIMITER |
โ
CREATE FUNCTION multiurldecode (s VARCHAR(4096)) RETURNS VARCHAR(4096)
DETERMINISTIC
CONTAINS SQL
BEGIN
DECLARE pr VARCHAR(4096) DEFAULT '';
IF ISNULL(s) THEN
RETURN NULL;
END IF;
REPEAT
SET pr = s;
SELECT urldecode(s) INTO s;
UNTIL pr = s END REPEAT;
RETURN s;
END;
โ
|
โ
DELIMITER ;
Opinions expressed by DZone contributors are their own.
Comments