23 #include <drizzled/plugin/function.h>
24 #include <drizzled/function/str/strfunc.h>
25 #include <drizzled/charset.h>
35 void fix_length_and_dec();
36 const char *func_name()
const {
return "reverse"; }
47 String *res = args[0]->val_str(str);
48 char *ptr, *end, *tmp;
50 if ((null_value=args[0]->null_value))
54 return &my_empty_string;
55 if (tmp_value.alloced_length() < res->length())
56 tmp_value.realloc(res->length());
57 tmp_value.length(res->length());
58 tmp_value.set_charset(res->charset());
59 ptr= (
char *) res->ptr();
60 end= ptr + res->length();
61 tmp= (
char *) tmp_value.ptr() + tmp_value.length();
62 if (use_mb(res->charset()))
67 if ((l= my_ismbchar(res->charset(),ptr,end)))
85 void ReverseFunction::fix_length_and_dec()
87 collation.set(args[0]->collation);
88 max_length = args[0]->max_length;
91 plugin::Create_function<ReverseFunction> *reverse_function= NULL;
95 reverse_function=
new plugin::Create_function<ReverseFunction>(
"reverse");
96 context.add(reverse_function);
100 DRIZZLE_DECLARE_PLUGIN
106 N_(
"REVERSE function"),
112 DRIZZLE_DECLARE_PLUGIN_END;
TODO: Rename this file - func.h is stupid.
String * val_str(String *)
bool check_argument_count(int n)