drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
item/decimal.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/item/num.h>
23
24namespace drizzled {
25
26/* decimal (fixed point) constant */
27class Item_decimal : public Item_num
28{
29protected:
30 type::Decimal decimal_value;
31public:
32 Item_decimal(const char *str_arg, uint32_t length, const charset_info_st*);
33 Item_decimal(const char *str, const type::Decimal *val_arg, uint32_t decimal_par, uint32_t length);
34 Item_decimal(type::Decimal *value_par);
35 Item_decimal(int64_t val, bool unsig);
36 Item_decimal(double val, int precision, int scale);
37 Item_decimal(const unsigned char *bin, int precision, int scale);
38
39 enum Type type() const { return DECIMAL_ITEM; }
40 enum Item_result result_type () const { return DECIMAL_RESULT; }
41 enum_field_types field_type() const { return DRIZZLE_TYPE_DECIMAL; }
42 int64_t val_int();
43 double val_real();
46 { return &decimal_value; }
47 int save_in_field(Field *field, bool no_conversions);
48 bool basic_const_item() const { return true; }
49 Item *clone_item()
50 {
51 return new Item_decimal(name, &decimal_value, decimals, max_length);
52 }
53 virtual void print(String *str);
54 Item_num *neg()
55 {
56 class_decimal_neg(&decimal_value);
57 unsigned_flag= !decimal_value.sign();
58 return this;
59 }
60 uint32_t decimal_precision() const { return decimal_value.precision(); }
61 bool eq(const Item *, bool binary_cmp) const;
62 void set_decimal_value(type::Decimal *value_par);
63};
64
65} /* namespace drizzled */
66
bool basic_const_item() const
String * val_str(String *)
bool eq(const Item *, bool binary_cmp) const
virtual void print(String *str)
type::Decimal * val_decimal(type::Decimal *)
const char * name
Definition item.h:112
TODO: Rename this file - func.h is stupid.