2

您好,我是 open.uwec.edu 的新 Web 开发人员。我最近不得不切换我们的网络服务器并且遇到了一些挑战。我们的旧 MySQL 服务器使用 lib_mysqludf_preg 库中的一个名为 preg_replace 的函数来进行正则表达式搜索和匹配。它已经在名为 lib_mysqludf_preg.dll 和 libpcre.dll 的“MySQL Server 5.1/lib/plugin”文件夹中编译了一些 .dll。

如果我将这些 dll 复制到“MySQL Server 5.6/lib/plugin”的新服务器并执行类似...

CREATE Function preg_replace RETURNS STRING SONAME 'lib_mysqludf_preg.dll';

我收到 MySQL 193 格式错误...

我在https://github.com/mysqludf/lib_mysqludf_preg/blob/testing/doc/INSTALL.windows查看了该库的 github 存储库上的指南,但链接没有像 pcre 这样的正确文件dll,这对我来说没有意义。是否有必要从头开始编译这个 preg 库?我使用它的函数看起来像这样。

CREATE DEFINER=`root`@`localhost` FUNCTION `slug`(dirty_string varchar(255)) RETURNS varchar(255) CHARSET latin1
    DETERMINISTIC
BEGIN
    Declare temp_string VarChar(255);
    Set temp_string = replace(dirty_string, '&', ' and ');
    Set temp_string = replace(temp_string, '''', '');
    Set temp_string = preg_replace('/[^a-z0-9-]+/i', '-', temp_string);
    Set temp_string = preg_replace('/^-+|-+$/', '', temp_string);
    Return LOWER(temp_string);
END

我们的网站使用 php codeigniter 框架。我对 MySQL 上的 UDFS 几乎没有经验,所以我希望我提供了足够的信息。谢谢你。

4

0 回答 0