diff options
author | unknown <holyfoot@hf-ibm.(none)> | 2005-05-05 20:06:49 +0500 |
---|---|---|
committer | unknown <holyfoot@hf-ibm.(none)> | 2005-05-05 20:06:49 +0500 |
commit | 6de14a23f7de447e4e6c4b82e2be032b05214c9a (patch) | |
tree | 28239d480c5b5f518077513738c6718aafd3584d /sql/field.h | |
parent | c0f355762547c01192478b60659038b7751a1ced (diff) | |
download | mariadb-git-6de14a23f7de447e4e6c4b82e2be032b05214c9a.tar.gz |
A lot of fixes to Precision math
Mostly about precision/decimals of the results of the operations
include/decimal.h:
decimal interface changed a little
sql/field.cc:
a lot of precision/decimals related changes to the Field_new_decimal
sql/field.h:
Field_new_decimal interface changed
sql/ha_ndbcluster.cc:
f->precision should be used here
sql/item.cc:
precision/decimals counting related changes
sql/item.h:
precision/decimals counting related changes
sql/item_cmpfunc.cc:
precision/decimals counting related changes
sql/item_cmpfunc.h:
precision/decimals counting related changes
sql/item_func.cc:
precision/decimals counting related changes
sql/item_func.h:
precision/decimals counting related changes
sql/item_sum.cc:
precision/decimals counting related changes
sql/item_sum.h:
precision/decimals counting related changes
sql/my_decimal.cc:
precision/decimals counting related changes
sql/my_decimal.h:
precision/decimals counting related changes
sql/mysqld.cc:
precision/decimals counting related changes
sql/set_var.cc:
precision/decimals counting related changes
sql/sp_head.cc:
dbug_decimal_print was replaced with dbug_decimal_as_string
sql/sql_class.h:
div_precincrement variable added
sql/sql_parse.cc:
precision/decimals counting related changes
sql/sql_select.cc:
precision/decimals counting related changes
sql/sql_show.cc:
Field::representation_length was removed
strings/decimal.c:
decimal_actual_fraction was introduced
BitKeeper/etc/logging_ok:
Logging to logging@openlogging.org accepted
Diffstat (limited to 'sql/field.h')
-rw-r--r-- | sql/field.h | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/sql/field.h b/sql/field.h index ac9c2f351b3..853b5dd13ff 100644 --- a/sql/field.h +++ b/sql/field.h @@ -300,8 +300,6 @@ public: int warn_if_overflow(int op_result); /* maximum possible display length */ virtual uint32 max_length()= 0; - /* length of field value symbolic representation (in bytes) */ - virtual uint32 representation_length() { return field_length; } /* convert decimal to longlong with overflow check */ longlong convert_decimal2longlong(const my_decimal *val, bool unsigned_flag, int *err); @@ -438,7 +436,13 @@ public: /* New decimal/numeric field which use fixed point arithmetic */ class Field_new_decimal :public Field_num { public: + /* The maximum number of decimal digits can be stored */ + uint precision; uint bin_size; + /* Constructors take max_length of the field as a parameter - not the */ + /* precision as the number of decimal digits allowed */ + /* So for example we need to count length from precision handling */ + /* CREATE TABLE ( DECIMAL(x,y)) */ Field_new_decimal(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, @@ -446,7 +450,8 @@ public: uint8 dec_arg, bool zero_arg, bool unsigned_arg); Field_new_decimal(uint32 len_arg, bool maybe_null_arg, const char *field_name_arg, - struct st_table *table_arg, uint8 dec_arg); + struct st_table *table_arg, uint8 dec_arg, + bool unsigned_arg); enum_field_types type() const { return FIELD_TYPE_NEWDECIMAL;} enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; } Item_result result_type () const { return DECIMAL_RESULT; } @@ -465,10 +470,7 @@ public: void sort_string(char *buff, uint length); bool zero_pack() const { return 0; } void sql_type(String &str) const; - uint32 max_length() - { return field_length + 1 + (dec ? 1 : 0) + (field_length == dec ? 1 : 0); } - uint32 representation_length() - { return field_length + 1 + (dec ? 1 : 0) + (field_length == dec ? 1 : 0); }; + uint32 max_length() { return field_length; } uint size_of() const { return sizeof(*this); } uint32 pack_length() const { return (uint32) bin_size; } }; |