60 if (args->arg_count < 1 || args->arg_count > 2) {
61 strcpy(message,
"stddevw_coor() requires one or two arguments");
64 args->arg_type[0] = REAL_RESULT;
65 if (args->arg_count > 1) {
66 args->arg_type[1] = REAL_RESULT;
71 strcpy(message,
"Couldn't allocate memory");
74 data->
argc = args->arg_count;
76 initid->maybe_null = 1;
78 initid->max_length = 13 + initid->decimals;
79 initid->ptr = (
char *) data;
80 initid->const_item = 0;
133 if (!args->args[0]) {
137 if (data->
argc > 1) {
138 if (!args->args[1]) {
141 w = *((
double*) args->args[1]);
145 x = *((
double*) args->args[0]);
149 data->
sumXX += w * x * x;
161 double stddevw_samp(UDF_INIT *initid, UDF_ARGS *args,
char *is_null,
char *error) {
170 if (data->
count <= 2) {
Definition of functions for UDFs and plugins.
double stddevw_samp(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error)
Retrieve weighted standard deviation of sample. Called at end of group.
my_bool stddevw_samp_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
Called before first usage of function.
void stddevw_samp_clear(UDF_INIT *initid, char *is_null, char *error)
Called at start of group.
void stddevw_samp_reset(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error)
Reset function and add first group member Calls clear and add.
#define NOT_FIXED_DEC
Maximum number of digits in double As defined in mysql/sql_string.h.
Storage for weighted standard deviation of sample.
int argc
number of arguments
void stddevw_samp_add(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error)
Add a member of the group.
void stddevw_samp_deinit(UDF_INIT *initid)
Called after last access to function.