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_weekday :public Item_func
00028 {
00029 bool odbc_type;
00030 public:
00031 Item_func_weekday(Item *a,bool type_arg)
00032 :Item_func(a), odbc_type(type_arg) {}
00033 int64_t val_int();
00034 double val_real() { assert(fixed == 1); return (double) val_int(); }
00035 String *val_str(String *str)
00036 {
00037 assert(fixed == 1);
00038 str->set(val_int(), &my_charset_bin);
00039 return null_value ? 0 : str;
00040 }
00041 const char *func_name() const
00042 {
00043 return (odbc_type ? "dayofweek" : "weekday");
00044 }
00045 enum Item_result result_type () const { return INT_RESULT; }
00046 void fix_length_and_dec()
00047 {
00048 collation.set(&my_charset_bin);
00049 decimals=0;
00050 max_length=1*MY_CHARSET_BIN_MB_MAXLEN;
00051 maybe_null=1;
00052 }
00053 };
00054
00055 }
00056