~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item/decimal.h

  • Committer: Stewart Smith
  • Date: 2009-06-16 00:46:49 UTC
  • mto: (1119.2.6 merge)
  • mto: This revision was merged to the branch mainline in revision 1124.
  • Revision ID: stewart@flamingspork.com-20090616004649-k2qt6b31sorpi6am
make type_blob test not leave tables behind

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2008 Sun Microsystems
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
22
22
 
23
23
#include <drizzled/item/num.h>
24
24
 
25
 
namespace drizzled
26
 
{
27
 
 
28
25
/* decimal (fixed point) constant */
29
26
class Item_decimal :public Item_num
30
27
{
31
28
protected:
32
 
  type::Decimal decimal_value;
 
29
  my_decimal decimal_value;
33
30
public:
34
31
  Item_decimal(const char *str_arg, uint32_t length, const CHARSET_INFO * const charset);
35
 
  Item_decimal(const char *str, const type::Decimal *val_arg,
 
32
  Item_decimal(const char *str, const my_decimal *val_arg,
36
33
               uint32_t decimal_par, uint32_t length);
37
 
  Item_decimal(type::Decimal *value_par);
 
34
  Item_decimal(my_decimal *value_par);
38
35
  Item_decimal(int64_t val, bool unsig);
39
36
  Item_decimal(double val, int precision, int scale);
40
37
  Item_decimal(const unsigned char *bin, int precision, int scale);
41
38
 
42
39
  enum Type type() const { return DECIMAL_ITEM; }
43
40
  enum Item_result result_type () const { return DECIMAL_RESULT; }
44
 
  enum_field_types field_type() const { return DRIZZLE_TYPE_DECIMAL; }
 
41
  enum_field_types field_type() const { return DRIZZLE_TYPE_NEWDECIMAL; }
45
42
  int64_t val_int();
46
43
  double val_real();
47
44
  String *val_str(String*);
48
 
  type::Decimal *val_decimal(type::Decimal *)
 
45
  my_decimal *val_decimal(my_decimal *)
49
46
  { return &decimal_value; }
50
47
  int save_in_field(Field *field, bool no_conversions);
51
48
  bool basic_const_item() const { return 1; }
56
53
  virtual void print(String *str, enum_query_type query_type);
57
54
  Item_num *neg()
58
55
  {
59
 
    class_decimal_neg(&decimal_value);
 
56
    my_decimal_neg(&decimal_value);
60
57
    unsigned_flag= !decimal_value.sign();
61
58
    return this;
62
59
  }
63
60
  uint32_t decimal_precision() const { return decimal_value.precision(); }
64
61
  bool eq(const Item *, bool binary_cmp) const;
65
 
  void set_decimal_value(type::Decimal *value_par);
 
62
  void set_decimal_value(my_decimal *value_par);
66
63
};
67
64
 
68
 
} /* namespace drizzled */
69
 
 
70
65
#endif /* DRIZZLED_ITEM_DECIMAL_H */