CREATE DEFINER=`root`@`%` FUNCTION `isfiltered`(field varchar(255)) RETURNS tinyint BEGIN set @keywords = ""; set @word = ""; SELECT trim(value) into @keywords FROM guoyan.sysconfigure where fieldname = 'PresaleKeyword'; set @keywords = replace(replace(@keywords, ' ', ''), ',', ','); set @keywords = concat(@keywords, ','); while length(@keywords) > 0 do select SUBSTRING_INDEX(@keywords, ',', 1) into @word; if findbykeyword(field, @word) then return true; end if; set @keywords = replace(@keywords, concat(@word, ','), ''); end while; return false; END