Windows上的MySQL UDF开发
时间:2008-04-21 来源:sdccf
作者:admin |
<IFRAME height=60 marginHeight=0 src="http://www.newway999.com/adfile/ad7.htm" frameBorder=0 width=468 marginWidth=0 scrolling=no></IFRAME>
曾以为Windows版本的MySQL存在不能使用UDF的BUG诸提交了一个bug报告。不过
Sorry this isn't a bug.
Ok. Assuming you have VC++ and the source distribution and a server
Note: the sample is ugly, but the purpose here is to show you how
- Open the mysqld.dsw workspace.
#include <stdlib.h>
extern "C" {
char *my_name(UDF_INIT *initid, UDF_ARGS *args, char *is_null,
return me;
- Type Ctrl+N for to create a new file.
- Right Click the my_udf project and select Settings
- Copy the my_udf.dll to the environment path directory: - Start the mysql client and issue:
C:\mysql-udf\bin>mysql -uroot -p Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> CREATE FUNCTION my_name RETURNS STRING SONAME "my_udf.dll"; mysql> select my_name();
mysql> drop function my_name; 画蛇添足的作下简要中文说明。
抱歉,这并不是一个bug。下面我粘贴一个以前为某个客户做的简例,假设你有了
我将创建一个UDF它将一个名字:
- 打开 mysqld.dsw 工作区。
extern "C" {
char *my_name(UDF_INIT *initid, UDF_ARGS *args, char *is_null,
return me;
- 右击my_udf项目并选择Settings
- 复制 my_udf.dll 到环境变量path定义过的目录 - 打开mysql客户端
C:\mysql-udf\bin>mysql -uroot -p Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> CREATE FUNCTION my_name RETURNS STRING SONAME "my_udf.dll"; mysql> select my_name();
mysql> drop function my_name;
|