drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
weekday.h
1/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3 *
4 * Copyright (C) 2008 Sun Microsystems, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#pragma once
21
22#include <drizzled/function/func.h>
23
24namespace drizzled
25{
26
27class Item_func_weekday :public Item_func
28{
29 bool odbc_type;
30public:
31 Item_func_weekday(Item *a,bool type_arg)
32 :Item_func(a), odbc_type(type_arg) {}
33 int64_t val_int();
34 double val_real() { assert(fixed == 1); return (double) val_int(); }
36 {
37 assert(fixed == 1);
38 str->set(val_int(), &my_charset_bin);
39 return null_value ? 0 : str;
40 }
41 const char *func_name() const
42 {
43 return (odbc_type ? "dayofweek" : "weekday");
44 }
45 enum Item_result result_type () const { return INT_RESULT; }
46 void fix_length_and_dec()
47 {
48 collation.set(&my_charset_bin);
49 decimals=0;
50 max_length=1*MY_CHARSET_BIN_MB_MAXLEN;
51 maybe_null=1;
52 }
53};
54
55} /* namespace drizzled */
56
String * val_str(String *str)
Definition weekday.h:35
bool fixed
Definition item.h:122
bool null_value
Definition item.h:124
bool maybe_null
Definition item.h:123
TODO: Rename this file - func.h is stupid.