1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008 Sun Microsystems, Inc.
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 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.
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
20
#ifndef DRIZZLED_ITEM_FLOAT_H
21
#define DRIZZLED_ITEM_FLOAT_H
23
#include <drizzled/item/num.h>
28
class Item_float :public Item_num
33
// Item_real() :value(0) {}
34
Item_float(const char *str_arg, uint32_t length);
35
Item_float(const char *str,double val_arg,uint32_t decimal_par,uint32_t length)
38
presentation= name=(char*) str;
39
decimals=(uint8_t) decimal_par;
43
Item_float(double value_par, uint32_t decimal_par) :presentation(0), value(value_par)
45
decimals= (uint8_t) decimal_par;
48
int save_in_field(Field *field, bool no_conversions);
49
enum Type type() const { return REAL_ITEM; }
50
enum_field_types field_type() const { return DRIZZLE_TYPE_DOUBLE; }
51
double val_real() { assert(fixed == 1); return value; }
53
String *val_str(String*);
54
type::Decimal *val_decimal(type::Decimal *);
55
bool basic_const_item() const { return 1; }
57
{ return new Item_float(name, value, decimals, max_length); }
58
Item_num *neg() { value= -value; return this; }
59
virtual void print(String *str, enum_query_type query_type);
60
bool eq(const Item *, bool binary_cmp) const;
63
class Item_static_float_func :public Item_float
65
const char *func_name;
67
Item_static_float_func(const char *str, double val_arg, uint32_t decimal_par,
69
:Item_float(NULL, val_arg, decimal_par, length), func_name(str)
72
virtual inline void print(String *str, enum_query_type)
74
str->append(func_name);
77
Item *safe_charset_converter(const CHARSET_INFO * const tocs);
80
} /* namespace drizzled */
82
#endif /* DRIZZLED_ITEM_FLOAT_H */