~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item/float.h

pandora-build v0.72 - Moved remaining hard-coded tests into pandora-build
macros.
Add PANDORA_DRIZZLE_BUILD to run the extra checks that drizzle needs that 
plugins would also need to run so we can just use that macro in generated
external plugin builds.
Added support to register_plugins for external plugin building.
Renamed register_plugins.py to pandora-plugin.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
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
#ifndef DRIZZLED_ITEM_FLOAT_H
 
21
#define DRIZZLED_ITEM_FLOAT_H
 
22
 
 
23
#include <drizzled/item/num.h>
 
24
 
 
25
class Item_float :public Item_num
 
26
{
 
27
  char *presentation;
 
28
public:
 
29
  double value;
 
30
  // Item_real() :value(0) {}
 
31
  Item_float(const char *str_arg, uint32_t length);
 
32
  Item_float(const char *str,double val_arg,uint32_t decimal_par,uint32_t length)
 
33
    :value(val_arg)
 
34
  {
 
35
    presentation= name=(char*) str;
 
36
    decimals=(uint8_t) decimal_par;
 
37
    max_length=length;
 
38
    fixed= 1;
 
39
  }
 
40
  Item_float(double value_par, uint32_t decimal_par) :presentation(0), value(value_par)
 
41
  {
 
42
    decimals= (uint8_t) decimal_par;
 
43
    fixed= 1;
 
44
  }
 
45
  int save_in_field(Field *field, bool no_conversions);
 
46
  enum Type type() const { return REAL_ITEM; }
 
47
  enum_field_types field_type() const { return DRIZZLE_TYPE_DOUBLE; }
 
48
  double val_real() { assert(fixed == 1); return value; }
 
49
  int64_t val_int();
 
50
  String *val_str(String*);
 
51
  my_decimal *val_decimal(my_decimal *);
 
52
  bool basic_const_item() const { return 1; }
 
53
  Item *clone_item()
 
54
  { return new Item_float(name, value, decimals, max_length); }
 
55
  Item_num *neg() { value= -value; return this; }
 
56
  virtual void print(String *str, enum_query_type query_type);
 
57
  bool eq(const Item *, bool binary_cmp) const;
 
58
};
 
59
 
 
60
class Item_static_float_func :public Item_float
 
61
{
 
62
  const char *func_name;
 
63
public:
 
64
  Item_static_float_func(const char *str, double val_arg, uint32_t decimal_par,
 
65
                        uint32_t length)
 
66
    :Item_float(NULL, val_arg, decimal_par, length), func_name(str)
 
67
  {}
 
68
 
 
69
  virtual inline void print(String *str, enum_query_type)
 
70
  {
 
71
    str->append(func_name);
 
72
  }
 
73
 
 
74
  Item *safe_charset_converter(const CHARSET_INFO * const tocs);
 
75
};
 
76
 
 
77
#endif /* DRIZZLED_ITEM_FLOAT_H */
 
78