If you need it as SQL function (like SOUNDEX()
), it's real easy:
sql_lex.cc
defining the function name in the
sql_functions
array.
sql_yacc.y
. On defines the preprocessor symbol
yacc can define (this should be added at the beginning of the
file). Then define the function parameters and create an 'item' with
these parameters. Check, for example, all occurrences of SOUNDEX in
sql_yacc.y
double *Item_func_newname::val()
If
you are defining a number function or String
*Item_func_newname::Str(String *str)
if you are defining a string
function.
void
Item_func_newname::fix_length_and_dec()
This should at least calcutate
max_length
based on the given arguments. max_length
is the
maximum number of chars the function may return. If the function can't
return a NULL
, one should set maybe_null = 0
.
About string functions:
String *str
argument provides a string
buffer that may be used to hold the result.
Go to the first, previous, next, last section, table of contents.