我遇到了一个MySQL函数的问题,我从另一个数据库中提取。我做了并分别导入了数据和功能和程序。Mysql调用不存在的函数
我现在有一个makehash
函数,可以调用preg_replace
。尽管如此,我无法看到这个功能或程序。
如果我运行show function status
或show procedure status
与preg_replace
没有任何关系,只显示了之前存在的自定义过程和函数。
有没有什么我缺少安装在我复制的数据库我已经忽略复制到新的?
这里是makehash
功能:
CREATE DEFINER=`root`@`localhost` FUNCTION `makehash`(description text, raw_location text, title text) RETURNS varchar(32) CHARSET utf8
NO SQL
DETERMINISTIC
begin
declare data longtext;
declare hash varchar(32);
set data = ifnull(description, '');
set hash = null;
if length(data) > 64 then
set data = lower(concat(data, ifnull(raw_location, ''), ifnull(title, '')));
set hash = md5(preg_replace('/[^a-z]/', '', data));
end if;
return hash;
preg_replace是一个php函数 - 不是mysql。另见:http://stackoverflow.com/questions/1815865/is-there-a-mysql-equivalent-of-phps-preg-replace – ethrbunny
@ethrbunny我知道,但我想知道如果我没有看到其他的东西D b。理想情况下,我只是想从那里复制它。这个函数适用于其他分贝,所以我认为它必须在某处。除了函数和过程还有其他东西存储在MySQL数据库? –