1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2011 Matthew Rheaume
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.
10
* This program is distributed in the hopethat 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.
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
22
#include <drizzled/function/func.h>
23
#include <drizzled/temporal.h>
27
class Item_time :public Item_func
30
using Item_func::tmp_table_field;
32
Item_time() :Item_func() {}
33
Item_time(Item *a) :Item_func(a) {}
34
enum Item_result result_type() const { return STRING_RESULT; }
35
enum_field_types field_type() const { return DRIZZLE_TYPE_TIME; }
36
String *val_str(String *str);
38
double val_real() { return val_real_from_decimal(); }
39
const char *func_name() const { return "time"; }
40
void fix_length_and_dec()
42
collation.set(&my_charset_bin);
44
max_length=Time::MAX_STRING_LENGTH*MY_CHARSET_BIN_MB_MAXLEN;
47
virtual bool get_temporal(Time &temporal)=0;
48
Field *tmp_table_field(Table *table)
50
return tmp_table_field_from_field_type(table, 0);
52
bool result_as_int64_t() { return true; }
53
type::Decimal *val_decimal(type::Decimal *decimal_value)
56
return val_decimal_from_time(decimal_value);
58
int save_in_field(Field *field,
61
return save_time_in_field(field);
65
} /* namespace drizzled */