53 my_bool
median_init(UDF_INIT *initid, UDF_ARGS *args,
char *message) {
56 if (args->arg_count != 1) {
57 strcpy(message,
"median() requires one argument");
60 args->arg_type[0] = REAL_RESULT;
64 strcpy(message,
"Couldn't allocate memory");
68 initid->maybe_null = 1;
70 initid->max_length = 13 + initid->decimals;
71 initid->ptr = (
char *) data;
72 initid->const_item = 0;
88 void median_reset(UDF_INIT *initid, UDF_ARGS *args,
char *is_null,
char *error) {
119 void median_add(UDF_INIT *initid, UDF_ARGS *args,
char *is_null,
char *error) {
123 if (!args->args[0]) {
127 x = *((
double*) args->args[0]);
131 }
catch (std::bad_alloc e) {
145 double median(UDF_INIT *initid, UDF_ARGS *args,
char *is_null,
char *error) {
147 DoubleSet::iterator pos;
164 for (
size_t i = 0; i < n2; i++) {
Definition of functions for UDFs and plugins.
#define NOT_FIXED_DEC
Maximum number of digits in double As defined in mysql/sql_string.h.
ItemSet data
collected data