国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數據庫 > MySQL > 正文

mysql的udf編程之非阻塞超時重傳

2024-07-24 12:47:37
字體:
來源:轉載
供稿:網友

MySQL的UDF(User Defined Function)類似于一種API, 用戶根據一定的規范用C/C++(或采用C調用規范的語言)編寫一組函數(UDF),然后編譯成動態鏈接庫,通過DROP FUNCTION語句來加載和卸載UDF。UDF被加載后可以像調用MySQL的內置函數一樣來調用它,并且服務器在啟動時會自動加載原來存在的UDF。

復制代碼 代碼如下:

#ifdef STANDARD/* STANDARD is defined, don't use any mysql functions */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifdef __WIN__
typedef unsigned __int64 ulonglong;    /* Microsofts 64 bit types */
typedef __int64 longlong;
#else
typedef unsigned long long ulonglong;
typedef long long longlong;
#endif /*__WIN__*/
#else
#include <my_global.h>
#include <my_sys.h>
#if defined(MYSQL_SERVER)
#include <m_string.h>        /* To get strmov() */
#else
/* when compiled as standalone */
#include <string.h>
#endif
#endif
#include <mysql.h>
#include <m_ctype.h>
#include <m_string.h>
#include <stdlib.h>
#include <errno.h>
#include <netdb.h>
#include <unistd.h>
#include<fcntl.h>
#include<sys time.h="">
#include<sys ioctl.h="">
#include <sys types.h="">
#include <netinet in.h="">
#include <sys socket.h="">
#include <sys wait.h="">
#include<arpa inet.h="">
#include<unistd.h>
#include <mysql.h>
#include <ctype.h>
#ifdef HAVE_DLOPEN

my_bool http_post_init(UDF_INIT *initid, UDF_ARGS *args, char *message);
void http_post_deinit(UDF_INIT *initid);
longlong http_post(UDF_INIT *initid, UDF_ARGS *args, char *is_null,char *error);
/*************************************************************************
** Example of init function
** Arguments:
** initid                        Points to a structure that the init function should fill.
**            char *ptr;            A pointer that the function can use.
** message                        Error message
**RETURN                        This function should return 1 if something goes wrong. In this case
**************************************************************************/
my_bool http_post_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
{
if (args->arg_count < 3 )
{
    strcpy(message,"Wrong arguments to http_post; ");
    return 1;
}

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 昭苏县| 达州市| 惠东县| 鹿邑县| 仙居县| 辉南县| 遵义市| 陈巴尔虎旗| 彩票| 南康市| 章丘市| 湘西| 越西县| 岳阳市| 九江县| 武义县| 惠安县| 宁夏| 武川县| 青铜峡市| 杭州市| 黔西县| 土默特左旗| 石家庄市| 吴旗县| 灵丘县| 左权县| 阳原县| 阳曲县| 柞水县| 江华| 屏东市| 望谟县| 吉林省| 定兴县| 来安县| 金塔县| 绥化市| 汝阳县| 大方县| 城固县|