00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #pragma once
00021
00022 #include <drizzled/function/func.h>
00023
00024 namespace drizzled
00025 {
00026
00027 class Item_func_month :public Item_func
00028 {
00029 public:
00030 Item_func_month(Item *a) :Item_func(a) {}
00031 int64_t val_int();
00032 double val_real()
00033 { assert(fixed == 1); return (double) Item_func_month::val_int(); }
00034 String *val_str(String *str)
00035 {
00036 str->set(val_int(), &my_charset_bin);
00037 return null_value ? 0 : str;
00038 }
00039 const char *func_name() const { return "month"; }
00040 enum Item_result result_type () const { return INT_RESULT; }
00041 void fix_length_and_dec()
00042 {
00043 collation.set(&my_charset_bin);
00044 decimals=0;
00045 max_length=2*MY_CHARSET_BIN_MB_MAXLEN;
00046 maybe_null=1;
00047 }
00048 };
00049
00050 class Item_func_monthname :public Item_func_month
00051 {
00052 public:
00053 Item_func_monthname(Item *a) :Item_func_month(a) {}
00054 const char *func_name() const { return "monthname"; }
00055 String *val_str(String *str);
00056 enum Item_result result_type () const { return STRING_RESULT; }
00057 void fix_length_and_dec()
00058 {
00059 collation.set(&my_charset_bin);
00060 decimals=0;
00061 max_length=10*my_charset_bin.mbmaxlen;
00062 maybe_null=1;
00063 }
00064 };
00065
00066 }
00067