Função para fazer URL decode em Mysql
DELIMITER $$
DROP FUNCTION IF EXISTS `_functions`.`url_decode`$$
CREATE DEFINER=`root`@`%` FUNCTION `_functions`.`url_decode`(original_text text) RETURNS text CHARSET latin1
BEGIN
declare new_text text default null;
declare pointer int default 1;
set new_text = replace(original_text,’+',’ ‘);
while (LOCATE(”%”,new_text,pointer) <> 0 )&& (pointer < length(new_text)) do
set pointer = LOCATE(”%”,new_text,pointer);
set new_text = concat(left(new_text,pointer-1), char(conv(mid(new_text,pointer+1,2),16,10)), right(new_text,length(new_text)-(pointer+2)));
set pointer = pointer + 1;
end while;
return new_text;
END;
$$
DELIMITER ;
Repare que ele utiliza um outro banco para guardar as funções.
Por Garret Hill
August 13th, 2008 at 11:26 am
I found your site on technorati and read a few of your other posts. Keep up the good work. I just added your RSS feed to my Google News Reader. Looking forward to reading more from you down the road!
August 14th, 2008 at 10:06 am
Your blog is interesting!
Keep up the good work!