存储/保存 UDF [英] storing/saving a UDF

查看:43
本文介绍了存储/保存 UDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一位乐于助人的用户能够帮助我创建用于自定义排序的 MySQL UDF.存储此 UDF 以使其始终可用的建议方法是什么?我读过如果服务器重新启动,UDF 就会丢失.重启可能会很频繁,因为这是在具有各种角色和管理员的本地 Windows 网络服务器上进行的.

A helpful user was able to help me create a MySQL UDF for custom sorting. What's the suggested approach for storing this UDF so that it's always available? I've read that if the server restarts, the UDF is lost. Restarts are likely to be frequent, as this is on a local Windows network server that has a variety of roles and admins.

现在我将在客户端登录时删除并重新创建它.登录不会非常频繁 - 它由大约 11 名员工使用.我认为这不是最有效的方法.

Right now I'm just going to drop and recreate it on client-side login. Logins won't be terribly frequent - it's used by a staff of about 11. I assume this is not the most efficient approach.

我想我读到可以用 C 编写它并将其存储在 .dll 中,但这可能超出了我的技能水平.

I think I read it's possible to write it in C and store it in a .dll, but this is probably beyond my skill level.

推荐答案

看起来您正在使用 存储的例程,而不是 用户定义函数.在 MySQL 中,UDF总是是编译扩展,而存储的例程总是只是 SQL.

It looks like you're working with a stored routine, not a user-defined function. In MySQL, UDFs are always compiled extensions, while stored routines are always just SQL.

手册页表明两者都不会消失.查询存储例程的信息有多种方式,包括获取创建日期、创建者,甚至定义的函数体.您可以轻松检查它是否丢失,并在需要时添加它.您也应该记录此事件,因为它根本不应该发生.

The manual pages suggest that neither will ever simply disappear. There are a variety of ways to query information about stored routines, including getting the creation date, who created it, and even the function body as defined. You could easily check if it's missing, and add it if needed. You should also probably log this event, as it simply should not be happening.

这篇关于存储/保存 UDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆