diff options
Diffstat (limited to 'sql')
-rw-r--r-- | sql/field.cc | 25 | ||||
-rw-r--r-- | sql/ha_innodb.cc | 3 |
2 files changed, 26 insertions, 2 deletions
diff --git a/sql/field.cc b/sql/field.cc index 2a0d0160d00..32679f549ba 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -1713,6 +1713,11 @@ void Field_float::store(double nr) float j; if (dec < NOT_FIXED_DEC) nr=floor(nr*log_10[dec]+0.5)/log_10[dec]; // To fixed point + if (unsigned_flag && nr < 0) + { + current_thd->cuted_fields++; + nr=0; + } if (nr < -FLT_MAX) { j= -FLT_MAX; @@ -1739,6 +1744,11 @@ void Field_float::store(double nr) void Field_float::store(longlong nr) { float j= (float) nr; + if (unsigned_flag && j < 0) + { + current_thd->cuted_fields++; + j=0; + } #ifdef WORDS_BIGENDIAN if (table->db_low_byte_first) { @@ -1945,6 +1955,11 @@ void Field_double::store(const char *from,uint len) double j= atof(tmp_str.c_ptr()); if (errno || current_thd->count_cuted_fields && !test_if_real(from,len)) current_thd->cuted_fields++; + if (unsigned_flag && j < 0) + { + current_thd->cuted_fields++; + j=0; + } #ifdef WORDS_BIGENDIAN if (table->db_low_byte_first) { @@ -1960,6 +1975,11 @@ void Field_double::store(double nr) { if (dec < NOT_FIXED_DEC) nr=floor(nr*log_10[dec]+0.5)/log_10[dec]; // To fixed point + if (unsigned_flag && nr < 0) + { + current_thd->cuted_fields++; + nr=0; + } #ifdef WORDS_BIGENDIAN if (table->db_low_byte_first) { @@ -1974,6 +1994,11 @@ void Field_double::store(double nr) void Field_double::store(longlong nr) { double j= (double) nr; + if (unsigned_flag && j < 0) + { + current_thd->cuted_fields++; + j=0; + } #ifdef WORDS_BIGENDIAN if (table->db_low_byte_first) { diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 4cf06dfb731..287b644b5d3 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -2408,7 +2408,7 @@ ha_innobase::rnd_pos( int error; uint keynr = active_index; DBUG_ENTER("rnd_pos"); - DBUG_DUMP("key", pos, ref_stored_len); + DBUG_DUMP("key", (char*) pos, ref_stored_len); statistic_increment(ha_read_rnd_count, &LOCK_status); @@ -2633,7 +2633,6 @@ ha_innobase::create( dict_table_t* innobase_table; trx_t* trx; int primary_key_no; - KEY* key; uint i; char name2[FN_REFLEN]; char norm_name[FN_REFLEN]; |