~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/fdecimal.h

Removed dead variable, sorted authors file.

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 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
 
 
21
 
#ifndef DRIZZLE_SERVER_FIELD_NEW_DECIMAL
22
 
#define DRIZZLE_SERVER_FIELD_NEW_DECIMAL
23
 
 
24
 
/* New decimal/numeric field which use fixed point arithmetic */
25
 
class Field_new_decimal :public Field_num {
26
 
private:
27
 
  int do_save_field_metadata(unsigned char *first_byte);
28
 
public:
29
 
  /* The maximum number of decimal digits can be stored */
30
 
  uint32_t precision;
31
 
  uint32_t bin_size;
32
 
  /*
33
 
    Constructors take max_length of the field as a parameter - not the
34
 
    precision as the number of decimal digits allowed.
35
 
    So for example we need to count length from precision handling
36
 
    CREATE TABLE ( DECIMAL(x,y)) 
37
 
  */
38
 
  Field_new_decimal(unsigned char *ptr_arg, uint32_t len_arg, unsigned char *null_ptr_arg,
39
 
                    unsigned char null_bit_arg,
40
 
                    enum utype unireg_check_arg, const char *field_name_arg,
41
 
                    uint8_t dec_arg, bool zero_arg, bool unsigned_arg);
42
 
  Field_new_decimal(uint32_t len_arg, bool maybe_null_arg,
43
 
                    const char *field_name_arg, uint8_t dec_arg,
44
 
                    bool unsigned_arg);
45
 
  enum_field_types type() const { return DRIZZLE_TYPE_NEWDECIMAL;}
46
 
  enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
47
 
  Item_result result_type () const { return DECIMAL_RESULT; }
48
 
  int  reset(void);
49
 
  bool store_value(const my_decimal *decimal_value);
50
 
  void set_value_on_overflow(my_decimal *decimal_value, bool sign);
51
 
  int  store(const char *to, uint32_t length, const CHARSET_INFO * const charset);
52
 
  int  store(double nr);
53
 
  int  store(int64_t nr, bool unsigned_val);
54
 
  int store_time(DRIZZLE_TIME *ltime, enum enum_drizzle_timestamp_type t_type);
55
 
  int  store_decimal(const my_decimal *);
56
 
  double val_real(void);
57
 
  int64_t val_int(void);
58
 
  my_decimal *val_decimal(my_decimal *);
59
 
  String *val_str(String*, String *);
60
 
  int cmp(const unsigned char *, const unsigned char *);
61
 
  void sort_string(unsigned char *buff, uint32_t length);
62
 
  bool zero_pack() const { return 0; }
63
 
  void sql_type(String &str) const;
64
 
  uint32_t max_display_length() { return field_length; }
65
 
  uint32_t size_of() const { return sizeof(*this); } 
66
 
  uint32_t pack_length() const { return (uint32_t) bin_size; }
67
 
  uint32_t pack_length_from_metadata(uint32_t field_metadata);
68
 
  uint32_t row_pack_length() { return pack_length(); }
69
 
  int compatible_field_size(uint32_t field_metadata);
70
 
  uint32_t is_equal(Create_field *new_field);
71
 
  virtual const unsigned char *unpack(unsigned char* to, const unsigned char *from,
72
 
                              uint32_t param_data, bool low_byte_first);
73
 
};
74
 
 
75
 
#endif
76