zbalt 发表于 2004-2-24 17:48:43

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;
}

Dragonfly 发表于 2004-3-1 23:38:53

:?::?::?:
页: [1]
查看完整版本: mysqludf示例[email protected]