~drizzle-trunk/drizzle/development

466 by Monty Taylor
Fixed modelines... these files are c++.
1
/* - mode: c++ c-basic-offset: 2; indent-tabs-mode: nil; -*-
173.1.8 by Toru Maesaka
ripped out STRING and renamed new_decimal and new_date
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
4
 *  Copyright (C) 2008 MySQL
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; either version 2 of the License, or
9
 *  (at your option) any later version.
10
 *
11
 *  This program is distributed in the hope that it will be useful,
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 *  GNU General Public License for more details.
15
 *
16
 *  You should have received a copy of the GNU General Public License
17
 *  along with this program; if not, write to the Free Software
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
 */
20
2234 by Brian Aker
Mass removal of ifdef/endif in favor of pragma once.
21
#pragma once
173.1.8 by Toru Maesaka
ripped out STRING and renamed new_decimal and new_date
22
584.5.1 by Monty Taylor
Removed field includes from field.h.
23
#include <drizzled/field/num.h>
24
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
25
namespace drizzled
26
{
27
173.1.8 by Toru Maesaka
ripped out STRING and renamed new_decimal and new_date
28
/* New decimal/numeric field which use fixed point arithmetic */
1211.1.1 by Brian Aker
Updating with my change to to DECIMAL from NEWDECIMAL and Stewart's update
29
class Field_decimal :public Field_num {
173.1.8 by Toru Maesaka
ripped out STRING and renamed new_decimal and new_date
30
public:
892.1.2 by Monty Taylor
Fixed solaris warnings.
31
32
  using Field::store;
33
  using Field::val_int;
34
  using Field::val_str;
35
  using Field::cmp;
36
  using Field::unpack;
37
173.1.8 by Toru Maesaka
ripped out STRING and renamed new_decimal and new_date
38
  /* The maximum number of decimal digits can be stored */
482 by Brian Aker
Remove uint.
39
  uint32_t precision;
40
  uint32_t bin_size;
173.1.8 by Toru Maesaka
ripped out STRING and renamed new_decimal and new_date
41
  /*
42
    Constructors take max_length of the field as a parameter - not the
43
    precision as the number of decimal digits allowed.
44
    So for example we need to count length from precision handling
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
45
    CREATE TABLE ( DECIMAL(x,y))
173.1.8 by Toru Maesaka
ripped out STRING and renamed new_decimal and new_date
46
  */
1211.1.1 by Brian Aker
Updating with my change to to DECIMAL from NEWDECIMAL and Stewart's update
47
  Field_decimal(unsigned char *ptr_arg,
48
                uint32_t len_arg,
49
                unsigned char *null_ptr_arg,
50
                unsigned char null_bit_arg,
51
                enum utype unireg_check_arg,
52
                const char *field_name_arg,
2137.1.3 by Brian Aker
Move decimal_zero, and a light fix on the decimal_t type (ditch the
53
                uint8_t dec_arg);
54
1211.1.1 by Brian Aker
Updating with my change to to DECIMAL from NEWDECIMAL and Stewart's update
55
  Field_decimal(uint32_t len_arg,
56
                bool maybe_null_arg,
57
                const char *field_name_arg,
58
                uint8_t dec_arg,
59
                bool unsigned_arg);
2137.1.3 by Brian Aker
Move decimal_zero, and a light fix on the decimal_t type (ditch the
60
1211.1.1 by Brian Aker
Updating with my change to to DECIMAL from NEWDECIMAL and Stewart's update
61
  enum_field_types type() const { return DRIZZLE_TYPE_DECIMAL;}
173.1.8 by Toru Maesaka
ripped out STRING and renamed new_decimal and new_date
62
  enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
63
  Item_result result_type () const { return DECIMAL_RESULT; }
64
  int  reset(void);
2030.1.4 by Brian Aker
Change my_decimal to Decimal
65
  bool store_value(const type::Decimal *decimal_value);
66
  void set_value_on_overflow(type::Decimal *decimal_value, bool sign);
2254 by Brian Aker
Shift CHARSET_INFO to charset_info_st
67
  int  store(const char *to, uint32_t length, const charset_info_st * const charset);
173.1.8 by Toru Maesaka
ripped out STRING and renamed new_decimal and new_date
68
  int  store(double nr);
69
  int  store(int64_t nr, bool unsigned_val);
2104.2.7 by Brian Aker
Fix store_time to take reference.
70
  int store_time(type::Time &ltime, type::timestamp_t t_type);
2030.1.4 by Brian Aker
Change my_decimal to Decimal
71
  int  store_decimal(const type::Decimal *);
2181.2.1 by Brian Aker
Protect all of the val_* methods from modification.
72
  double val_real(void) const;
73
  int64_t val_int(void) const;
74
  type::Decimal *val_decimal(type::Decimal *) const;
75
  String *val_str(String*, String *) const;
481 by Brian Aker
Remove all of uchar.
76
  int cmp(const unsigned char *, const unsigned char *);
482 by Brian Aker
Remove uint.
77
  void sort_string(unsigned char *buff, uint32_t length);
173.1.8 by Toru Maesaka
ripped out STRING and renamed new_decimal and new_date
78
  bool zero_pack() const { return 0; }
205 by Brian Aker
uint32 -> uin32_t
79
  uint32_t max_display_length() { return field_length; }
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
80
  uint32_t size_of() const { return sizeof(*this); }
205 by Brian Aker
uint32 -> uin32_t
81
  uint32_t pack_length() const { return (uint32_t) bin_size; }
482 by Brian Aker
Remove uint.
82
  uint32_t pack_length_from_metadata(uint32_t field_metadata);
1052.2.3 by Nathan Williams
No actual code changes. Changed Create_field to CreateField to be consistent with coding standards.
83
  uint32_t is_equal(CreateField *new_field);
481 by Brian Aker
Remove all of uchar.
84
  virtual const unsigned char *unpack(unsigned char* to, const unsigned char *from,
1211.1.1 by Brian Aker
Updating with my change to to DECIMAL from NEWDECIMAL and Stewart's update
85
                                      uint32_t param_data, bool low_byte_first);
173.1.8 by Toru Maesaka
ripped out STRING and renamed new_decimal and new_date
86
};
87
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
88
} /* namespace drizzled */
89
173.1.8 by Toru Maesaka
ripped out STRING and renamed new_decimal and new_date
90