21 #include <drizzled/error.h>
22 #include <drizzled/internal/m_string.h>
23 #include <drizzled/plugin/function.h>
24 #include <drizzled/session.h>
34 virtual void print(
String *str);
36 const char *func_name()
const
41 void fix_length_and_dec()
57 assert(fixed ==
true);
59 char buff[MAX_FIELD_WIDTH];
60 String tmp(buff,
sizeof(buff), &my_charset_bin);
64 loop_count= (uint64_t) args[0]->val_int();
66 if (args[0]->null_value ||
67 (args[0]->unsigned_flag ==
false && (((int64_t) loop_count) < 0)))
69 if (args[0]->null_value ==
false)
71 internal::int64_t10_to_str((int64_t)loop_count, buff, -10);
72 push_warning_printf(&getSession(), DRIZZLE_ERROR::WARN_LEVEL_ERROR,
73 ER_WRONG_VALUE_FOR_TYPE, ER(ER_WRONG_VALUE_FOR_TYPE),
74 "count", buff,
"benchmark");
84 for (loop= 0 ; loop < loop_count && not getSession().getKilled(); loop++)
86 switch (args[1]->result_type())
89 (void) args[1]->val_real();
92 (void) args[1]->val_int();
95 (void) args[1]->val_str(&tmp);
98 (void) args[1]->val_decimal(&tmp_decimal);
112 str->append(STRING_WITH_LEN(
"benchmark("));
119 plugin::Create_function<BenchmarkFunction> *benchmarkudf= NULL;
123 benchmarkudf=
new plugin::Create_function<BenchmarkFunction>(
"benchmark");
124 context.add(benchmarkudf);
128 DRIZZLE_DECLARE_PLUGIN
133 "Devananda van der Veen",
134 N_(
"BENCHMARK function"),
140 DRIZZLE_DECLARE_PLUGIN_END;
TODO: Rename this file - func.h is stupid.
bool check_argument_count(int n)
virtual void print(String *str)