diff options
author | unknown <monty@hundin.mysql.fi> | 2002-06-28 09:18:23 +0300 |
---|---|---|
committer | unknown <monty@hundin.mysql.fi> | 2002-06-28 09:18:23 +0300 |
commit | d7a84c7af0e1eb166c48ce7a7c3e3dca83f43baf (patch) | |
tree | cc96a38fba045126d5ddd2d125e830e1c2786a7e /sql/field.cc | |
parent | 5e5d70399c249607352c1321c59e3f8eb38e43ab (diff) | |
download | mariadb-git-d7a84c7af0e1eb166c48ce7a7c3e3dca83f43baf.tar.gz |
Indentation cleanup & new comments
BitKeeper/deleted/.del-getvar.c~2a29ff383970fd31:
Delete: mysys/getvar.c
zlib/zlib.dsp:
Turn on EOLN_NATIVE flag
libmysql/Makefile.shared:
Remove getvar.c
myisam/mi_cache.c:
Indentation cleanup
myisam/mi_check.c:
Indentation cleanup
Changed name of a variable
myisam/sort.c:
Indentation cleanup
Added initialization of a variable
myisammrg/myrg_delete.c:
Indentation cleanup
myisammrg/myrg_rsame.c:
Indentation cleanup
myisammrg/myrg_update.c:
Indentation cleanup
myisammrg/myrg_write.c:
Indentation cleanup
mysys/Makefile.am:
removed getvar.c
sql/field.cc:
Added warning counter to overflow() (and removed this from other places)
Diffstat (limited to 'sql/field.cc')
-rw-r--r-- | sql/field.cc | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/sql/field.cc b/sql/field.cc index 21b967e60a9..a23f41e1fa0 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -312,8 +312,8 @@ bool Field::optimize_range(uint idx) } /**************************************************************************** -** Functions for the Field_decimal class -** This is an unpacked number. + Functions for the Field_decimal class + This is an number stored as a pre-space (or pre-zero) string ****************************************************************************/ void @@ -326,6 +326,8 @@ void Field_decimal::overflow(bool negative) { uint len=field_length; char *to=ptr, filler= '9'; + + current_thd->cuted_fields++; if (negative) { if (!unsigned_flag) @@ -419,7 +421,7 @@ void Field_decimal::store(const char *from,uint len) if ((tmp_dec=dec)) tmp_dec++; - for (; from!=end && isspace(*from); from++) ; // Read spaces + for (; from !=end && isspace(*from); from++) ; // Read spaces if (from == end) { current_thd->cuted_fields++; @@ -428,23 +430,22 @@ void Field_decimal::store(const char *from,uint len) else if (*from == '+' || *from == '-') // Found some sign ? { sign_char= *from++; - /* - Unsigned can't have any flag. So we'll just drop "+" - and will overflow on "-" + /* + Unsigned can't have any flag. So we'll just drop "+" + and will overflow on "-" */ if (unsigned_flag) { if (sign_char=='-') { - current_thd->cuted_fields++; Field_decimal::overflow(1); return; } else sign_char=0; } - } + pre_zeros_from= from; for (; from!=end && *from == '0'; from++) ; // Read prezeros pre_zeros_end=int_digits_from=from; @@ -484,7 +485,7 @@ void Field_decimal::store(const char *from,uint len) if (current_thd->count_cuted_fields) { - for (;from!=end && isspace(*from); from++) ; // Read end spaces + for (;from != end && isspace(*from); from++) ; // Read end spaces if (from != end) // If still something left, warn { current_thd->cuted_fields++; @@ -563,7 +564,6 @@ void Field_decimal::store(const char *from,uint len) if (field_length < tmp_uint + (int) (sign_char == '-')) { - current_thd->cuted_fields++; // too big number, change to max or min number Field_decimal::overflow(sign_char == '-'); return; @@ -606,7 +606,7 @@ void Field_decimal::store(const char *from,uint len) } else { - left_wall=to+(sign_char!=0)-1; + left_wall=to+(sign_char != 0)-1; if (!expo_sign_char) // If exponent was specified, ignore prezeros { for (;pos != left_wall && pre_zeros_from !=pre_zeros_end; @@ -659,7 +659,7 @@ void Field_decimal::store(const char *from,uint len) { if (tmp_char != '0') // Losing a non zero digit ? { - if (current_thd->count_cuted_fields && !is_cuted_fields_incr) + if (!is_cuted_fields_incr) current_thd->cuted_fields++; return; } @@ -696,14 +696,12 @@ void Field_decimal::store(double nr) if (unsigned_flag && nr < 0) { overflow(1); - current_thd->cuted_fields++; return; } if (isinf(nr)) // Handle infinity as special case { overflow(nr < 0.0); - current_thd->cuted_fields++; return; } @@ -721,10 +719,7 @@ void Field_decimal::store(double nr) length=(uint) strlen(buff); if (length > field_length) - { overflow(nr < 0.0); - current_thd->cuted_fields++; - } else { to=ptr; @@ -740,7 +735,6 @@ void Field_decimal::store(longlong nr) if (unsigned_flag && nr < 0) { overflow(1); - current_thd->cuted_fields++; return; } char buff[22]; @@ -748,10 +742,7 @@ void Field_decimal::store(longlong nr) uint int_part=field_length- (dec ? dec+1 : 0); if (length > int_part) - { overflow(test(nr < 0L)); /* purecov: inspected */ - current_thd->cuted_fields++; /* purecov: inspected */ - } else { char fyllchar = zerofill ? (char) '0' : (char) ' '; |