173.1.8
by Toru Maesaka
ripped out STRING and renamed new_decimal and new_date |
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 |
||
212.5.45
by Monty Taylor
Removed excess AM_CPPFLAGS from the tree. Now the only thing that should be in the include path should be -I${top_srcdir} and -I${top_builddir}w |
24 |
#include <drizzled/mysql_priv.h> |
173.1.8
by Toru Maesaka
ripped out STRING and renamed new_decimal and new_date |
25 |
|
26 |
/* New decimal/numeric field which use fixed point arithmetic */
|
|
27 |
class Field_new_decimal :public Field_num { |
|
28 |
private: |
|
29 |
int do_save_field_metadata(uchar *first_byte); |
|
30 |
public: |
|
31 |
/* The maximum number of decimal digits can be stored */
|
|
32 |
uint precision; |
|
33 |
uint bin_size; |
|
34 |
/*
|
|
35 |
Constructors take max_length of the field as a parameter - not the
|
|
36 |
precision as the number of decimal digits allowed.
|
|
37 |
So for example we need to count length from precision handling
|
|
38 |
CREATE TABLE ( DECIMAL(x,y))
|
|
39 |
*/
|
|
205
by Brian Aker
uint32 -> uin32_t |
40 |
Field_new_decimal(uchar *ptr_arg, uint32_t len_arg, uchar *null_ptr_arg, |
173.1.8
by Toru Maesaka
ripped out STRING and renamed new_decimal and new_date |
41 |
uchar null_bit_arg, |
42 |
enum utype unireg_check_arg, const char *field_name_arg, |
|
206
by Brian Aker
Removed final uint dead types. |
43 |
uint8_t dec_arg, bool zero_arg, bool unsigned_arg); |
205
by Brian Aker
uint32 -> uin32_t |
44 |
Field_new_decimal(uint32_t len_arg, bool maybe_null_arg, |
206
by Brian Aker
Removed final uint dead types. |
45 |
const char *field_name_arg, uint8_t dec_arg, |
173.1.8
by Toru Maesaka
ripped out STRING and renamed new_decimal and new_date |
46 |
bool unsigned_arg); |
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
47 |
enum_field_types type() const { return DRIZZLE_TYPE_NEWDECIMAL;} |
173.1.8
by Toru Maesaka
ripped out STRING and renamed new_decimal and new_date |
48 |
enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; } |
49 |
Item_result result_type () const { return DECIMAL_RESULT; } |
|
50 |
int reset(void); |
|
51 |
bool store_value(const my_decimal *decimal_value); |
|
52 |
void set_value_on_overflow(my_decimal *decimal_value, bool sign); |
|
53 |
int store(const char *to, uint length, CHARSET_INFO *charset); |
|
54 |
int store(double nr); |
|
55 |
int store(int64_t nr, bool unsigned_val); |
|
56 |
int store_time(MYSQL_TIME *ltime, timestamp_type t_type); |
|
57 |
int store_decimal(const my_decimal *); |
|
58 |
double val_real(void); |
|
59 |
int64_t val_int(void); |
|
60 |
my_decimal *val_decimal(my_decimal *); |
|
61 |
String *val_str(String*, String *); |
|
62 |
int cmp(const uchar *, const uchar *); |
|
63 |
void sort_string(uchar *buff, uint length); |
|
64 |
bool zero_pack() const { return 0; } |
|
65 |
void sql_type(String &str) const; |
|
205
by Brian Aker
uint32 -> uin32_t |
66 |
uint32_t max_display_length() { return field_length; } |
173.1.8
by Toru Maesaka
ripped out STRING and renamed new_decimal and new_date |
67 |
uint size_of() const { return sizeof(*this); } |
205
by Brian Aker
uint32 -> uin32_t |
68 |
uint32_t pack_length() const { return (uint32_t) bin_size; } |
173.1.8
by Toru Maesaka
ripped out STRING and renamed new_decimal and new_date |
69 |
uint pack_length_from_metadata(uint field_metadata); |
70 |
uint row_pack_length() { return pack_length(); } |
|
71 |
int compatible_field_size(uint field_metadata); |
|
72 |
uint is_equal(Create_field *new_field); |
|
73 |
virtual const uchar *unpack(uchar* to, const uchar *from, |
|
74 |
uint param_data, bool low_byte_first); |
|
75 |
};
|
|
76 |
||
77 |
#endif
|
|
78 |