00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #pragma once
00022
00023 #include <drizzled/field/num.h>
00024
00025 namespace drizzled
00026 {
00027
00028
00029 class Field_decimal :public Field_num {
00030 public:
00031
00032 using Field::store;
00033 using Field::val_int;
00034 using Field::val_str;
00035 using Field::cmp;
00036 using Field::unpack;
00037
00038
00039 uint32_t precision;
00040 uint32_t bin_size;
00041
00042
00043
00044
00045
00046
00047 Field_decimal(unsigned char *ptr_arg,
00048 uint32_t len_arg,
00049 unsigned char *null_ptr_arg,
00050 unsigned char null_bit_arg,
00051 enum utype unireg_check_arg,
00052 const char *field_name_arg,
00053 uint8_t dec_arg);
00054
00055 Field_decimal(uint32_t len_arg,
00056 bool maybe_null_arg,
00057 const char *field_name_arg,
00058 uint8_t dec_arg,
00059 bool unsigned_arg);
00060
00061 enum_field_types type() const { return DRIZZLE_TYPE_DECIMAL;}
00062 enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
00063 Item_result result_type () const { return DECIMAL_RESULT; }
00064 int reset(void);
00065 bool store_value(const type::Decimal *decimal_value);
00066 void set_value_on_overflow(type::Decimal *decimal_value, bool sign);
00067 int store(const char *to, uint32_t length, const CHARSET_INFO * const charset);
00068 int store(double nr);
00069 int store(int64_t nr, bool unsigned_val);
00070 int store_time(type::Time <ime, type::timestamp_t t_type);
00071 int store_decimal(const type::Decimal *);
00072 double val_real(void) const;
00073 int64_t val_int(void) const;
00074 type::Decimal *val_decimal(type::Decimal *) const;
00075 String *val_str(String*, String *) const;
00076 int cmp(const unsigned char *, const unsigned char *);
00077 void sort_string(unsigned char *buff, uint32_t length);
00078 bool zero_pack() const { return 0; }
00079 void sql_type(String &str) const;
00080 uint32_t max_display_length() { return field_length; }
00081 uint32_t size_of() const { return sizeof(*this); }
00082 uint32_t pack_length() const { return (uint32_t) bin_size; }
00083 uint32_t pack_length_from_metadata(uint32_t field_metadata);
00084 uint32_t is_equal(CreateField *new_field);
00085 virtual const unsigned char *unpack(unsigned char* to, const unsigned char *from,
00086 uint32_t param_data, bool low_byte_first);
00087 };
00088
00089 }
00090
00091