mysqludf示例[email protected]
#ifdef STANDARD#include <string.h>
#include <stdio.h>
#else
#include <my_global.h>
#include <my_sys.h>
#endif
#include <mysql.h>
#include <m_ctype.h>
#include <m_string.h>
extern "C" {
my_bool hello_init(UDF_INIT *initid,UDF_ARGS *args,char *message);
void hello_deinit(UDF_INIT *initid);
long long hello(UDF_INIT *initid,UDF_ARGS *args,char *is_null,char *error);
}
my_bool hello_init(UDF_INIT * initid,UDF_ARGS *args,char *message){
if(args->arg_count !=1 || args->arg_type!=STRING_RESULT)
{
strcpy(message ,"You can only pass one argument,and it must be a string");
return 1;}
return 0;}
void hello_dinit(UDF_INIT * initid){}
long long hello(UDF_INIT *initid,UDF_ARGS * args,char* is_null,char *error)
{
long long i;
i=strlen(args->args);
return i;
} :?::?::?:
页:
[1]