Weighted average. More...
#include "sqlstat.h"
Go to the source code of this file.
Classes | |
struct | avgw_storage |
Storage for weighted average. More... | |
Functions | |
my_bool | avgw_init (UDF_INIT *initid, UDF_ARGS *args, char *message) |
Called before first usage of function. More... | |
void | avgw_reset (UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error) |
Reset function and add first group member Calls clear and add. More... | |
void | avgw_clear (UDF_INIT *initid, char *is_null, char *error) |
Called at start of group. More... | |
void | avgw_add (UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error) |
Add a member of the group. More... | |
double | avgw (UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error) |
Retrieve weighted average. Called at end of group. More... | |
void | avgw_deinit (UDF_INIT *initid) |
Called after last access to function. More... | |
Weighted average.
CREATE AGGREGATE FUNCTION avgw RETURNS REAL SONAME 'libsqlstat.so'; SELECT avgw(x, w) FROM mytab; DROP FUNCTION avgw;
Definition in file avgw.c.
double avgw | ( | UDF_INIT * | initid, |
UDF_ARGS * | args, | ||
char * | is_null, | ||
char * | error | ||
) |
void avgw_add | ( | UDF_INIT * | initid, |
UDF_ARGS * | args, | ||
char * | is_null, | ||
char * | error | ||
) |
void avgw_clear | ( | UDF_INIT * | initid, |
char * | is_null, | ||
char * | error | ||
) |
Called at start of group.
void avgw_clear(UDF_INIT *initid, char *is_null, char *error) The sums are cleared.
initid | function description |
is_null | |
error | error message |
Definition at line 108 of file avgw.c.
void avgw_deinit | ( | UDF_INIT * | initid | ) |
my_bool avgw_init | ( | UDF_INIT * | initid, |
UDF_ARGS * | args, | ||
char * | message | ||
) |
void avgw_reset | ( | UDF_INIT * | initid, |
UDF_ARGS * | args, | ||
char * | is_null, | ||
char * | error | ||
) |
Reset function and add first group member Calls clear and add.
initid | function description |
args | argument values |
is_null | |
error | error message |
Definition at line 94 of file avgw.c.