ApacheMySQL 2019-04-04
代码如下:
delimiter || DROP FUNCTION IF EXISTS IS_MOBILE|| CREATE FUNCTION IS_MOBILE( x VARCHAR(255)) RETURNS TINYINT(1) BEGIN DECLARE result TINYINT(1) DEFAULT 0; SET x = LCASE(x); IF RIGHT(x,4) = '.mp4' THEN SET result = 1; ELSEIF LEFT(x,9) = '[ctvideo]' THEN SET result = 1; END IF; RETURN result; END; delimiter ;