技痒之作 -__-
CREATE AGGREGATE FUNCTION oddsum returns INTEGER SONAME "udf_oddsum.so";
CREATE TABLE `v1` (
`c` int(11) DEFAULT NULL,
`id` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
insert into v1 values(1,0), (3,2), (4,4);
select sum(c),oddsum(c) from v1;
+--------+-----------+
| sum(c) | oddsum(c) |
+--------+-----------+
| 8 | 4 |
+--------+-----------+
#ifdef HAVE_STDLIB_H #include <stdlib.h> #endif #ifdef HAVE_STRING_H #include <string.h> #endif #ifdef HAVE_STRINGS_H #include <strings.h> #endif #include <ctype.h> #include <my_global.h> #include <my_sys.h> #include <mysql.h> my_bool oddsum_init(UDF_INIT *init, UDF_ARGS *args, char *message) { if (args->arg_count != 1 || args->arg_type[0] != INT_RESULT) { return 1; } init->ptr = (char *)(malloc(sizeof(longlong))); bzero((void*)init->ptr, sizeof(longlong)); return 0; } void oddsum_add(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error) { if (!args->args[0]) return; longlong new_value= *((longlong*)args->args[0]); if (new_value % 2) { longlong *current_sum= (longlong *)initid->ptr; *current_sum+= new_value; } } void oddsum_clear(UDF_INIT* initid, char* is_null __attribute__((unused)), char* message __attribute__((unused))) { bzero((void*)initid->ptr, sizeof(longlong)); } void oddsum_deinit(UDF_INIT *init) { if (init->ptr) { free(init->ptr); } } longlong oddsum(UDF_INIT* initid, UDF_ARGS* args __attribute__((unused)), char* is_null, char* error __attribute__((unused))) { return *(longlong *)initid->ptr; }
相关推荐
mysql-udf-http下载 发现很多链接都是链接到谷歌 在这里csdn传一份,方便大家国内下载 谢谢
mysql-udf-http.c编译此文件之后可使用MySQL中http_post或http_get方法,此处为原文件,需要自行编译,请谨慎下载。备注:如发现此文件编译时缺少文件可自行下载
udf mysql c语言代码,欢迎大家使用
MYSQL_UDF 5.0最新源码,内部包含40个文件,供下载使用
lib_mysqludf_sys 的win版本dll库
MYSQL的UDF开发的测试程序
mysql-udf-http
mysql_udf_redis,将数据库中的数据同步到Redis。Redis中的数据变化同步到数据库,那么这里是将Redis做为db,而真的db,数据库只作为备份
MYSQL的UDF开发的资源文件
MYSQL提权 UDF.dll MYSQL提权 UDF.dll MYSQL提权 UDF.dll MYSQL提权 UDF.dll
mysqludf库,mysql中调用系统命令的常用插件
压缩包包含win32位/64位以及linux32位/64位的mysql udf 的c语言源码,自行编译
CentOS 7.5 64位下编译好的lib_mysqludf_sys.so,源文件在https://download.csdn.net/download/shaynerain/10715798,我博客 中有介绍怎么用
mysql udf提权文件mysql udf提权文件
本人亲自测试OK
mysql-udf-http-1.0下载mysql-udf-http
Gearman 的 MySQL 插件
mysql 系统命令udf,各种平台64位包
使用mysql_udf与curl库完成http_post通信模块(mysql_udf,multi_curl,http,post) ...mysql_udf是mysql为c语言提供的一个接口,通过这个接口,用户可以自定义mysql的函数,通过调用这些mysql函数,
mysql免杀UDF 提权必不可少神器。必须配备