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 ;
MySQL
Opinions expressed by DZone contributors are their own.
Comments