List:Commits« Previous MessageNext Message »
From:bar Date:June 5 2006 2:08pm
Subject:bk commit into 5.0 tree (bar:1.2168) BUG#6147
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of bar. When bar does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2168 06/06/05 17:08:32 bar@stripped +30 -0
  Bug#6147: Traditional: Assigning a string to a numeric column has unexpected results
  The problem was that when converting a string to an exact number,
  rounding didn't work, because conversion didn't understand
  approximate numbers notation.
  Fix: a new function for string-to-number conversion was implemented,
  which is aware of approxinate number notation (with decimal point
  and exponent, e.g. -19.55e-1)

  mysql-test/t/round.test
    1.1 06/06/05 17:08:24 bar@stripped +143 -0
    New test for rounding

  mysql-test/t/round.test
    1.0 06/06/05 17:08:24 bar@stripped +0 -0
    BitKeeper file /usr/home/bar/mysql-5.0.b6147/mysql-test/t/round.test

  mysql-test/r/round.result
    1.1 06/06/05 17:08:23 bar@stripped +272 -0
    New test for rounding

  strings/ctype-utf8.c
    1.99 06/06/05 17:08:23 bar@stripped +1 -0
    Adding new function into the MY_CHARSET_HANDLER structure

  strings/ctype-ujis.c
    1.71 06/06/05 17:08:23 bar@stripped +1 -0
    Adding new function into the MY_CHARSET_HANDLER structure

  strings/ctype-ucs2.c
    1.62 06/06/05 17:08:23 bar@stripped +30 -0
    UCS2 wrapper for 8bit function
    Adding new function into the MY_CHARSET_HANDLER structure

  strings/ctype-tis620.c
    1.93 06/06/05 17:08:23 bar@stripped +1 -0
    Adding new function into the MY_CHARSET_HANDLER structure

  strings/ctype-sjis.c
    1.90 06/06/05 17:08:23 bar@stripped +1 -0
    Adding new function into the MY_CHARSET_HANDLER structure

  strings/ctype-simple.c
    1.77 06/06/05 17:08:23 bar@stripped +311 -0
    Implementation of my_strntoull10rnd_8bit
    Adding new function into the MY_CHARSET_HANDLER structure

  strings/ctype-latin1.c
    1.50 06/06/05 17:08:23 bar@stripped +1 -0
    Adding new function into the MY_CHARSET_HANDLER structure

  strings/ctype-gbk.c
    1.80 06/06/05 17:08:23 bar@stripped +1 -0
    Adding new function into the MY_CHARSET_HANDLER structure

  strings/ctype-gb2312.c
    1.65 06/06/05 17:08:23 bar@stripped +1 -0
    Adding new function into the MY_CHARSET_HANDLER structure

  mysql-test/r/round.result
    1.0 06/06/05 17:08:23 bar@stripped +0 -0
    BitKeeper file /usr/home/bar/mysql-5.0.b6147/mysql-test/r/round.result

  strings/ctype-eucjpms.c
    1.14 06/06/05 17:08:22 bar@stripped +1 -0
    Adding new function into the MY_CHARSET_HANDLER structure

  strings/ctype-euc_kr.c
    1.68 06/06/05 17:08:22 bar@stripped +1 -0
    Adding new function into the MY_CHARSET_HANDLER structure

  strings/ctype-cp932.c
    1.13 06/06/05 17:08:22 bar@stripped +1 -0
    Adding new function into the MY_CHARSET_HANDLER structure

  strings/ctype-bin.c
    1.70 06/06/05 17:08:22 bar@stripped +1 -0
    Adding new function into the MY_CHARSET_HANDLER structure

  strings/ctype-big5.c
    1.90 06/06/05 17:08:22 bar@stripped +1 -0
    Adding new function into the MY_CHARSET_HANDLER structure

  sql/field.cc
    1.308 06/06/05 17:08:22 bar@stripped +83 -110
    Using new function

  mysql-test/t/strict.test
    1.21 06/06/05 17:08:22 bar@stripped +4 -4
    Fixing results

  mysql-test/r/warnings.result
    1.36 06/06/05 17:08:22 bar@stripped +30 -30
    Fixing results

  mysql-test/r/view.result
    1.162 06/06/05 17:08:22 bar@stripped +2 -2
    Fixing results

  mysql-test/r/strict.result
    1.27 06/06/05 17:08:22 bar@stripped +4 -4
    Fixing results

  mysql-test/r/sp-vars.result
    1.3 06/06/05 17:08:21 bar@stripped +1 -1
    Fixing results

  mysql-test/r/rpl_rewrite_db.result
    1.6 06/06/05 17:08:21 bar@stripped +4 -3
    Fixing results

  mysql-test/r/ps_6bdb.result
    1.43 06/06/05 17:08:21 bar@stripped +24 -24
    Fixing results

  mysql-test/r/ps_5merge.result
    1.41 06/06/05 17:08:21 bar@stripped +48 -48
    Fixing results

  mysql-test/r/ps_4heap.result
    1.40 06/06/05 17:08:21 bar@stripped +24 -24
    Fixing results

  mysql-test/r/ps_3innodb.result
    1.44 06/06/05 17:08:21 bar@stripped +24 -24
    Fixing results

  mysql-test/r/ps_2myisam.result
    1.41 06/06/05 17:08:21 bar@stripped +24 -24
    Fixing results

  mysql-test/r/loaddata.result
    1.24 06/06/05 17:08:21 bar@stripped +4 -3
    Fixing results

  include/m_ctype.h
    1.120 06/06/05 17:08:21 bar@stripped +10 -0
    Adding new function into MY_CHARSET_HANDLER
    Adding prototypes for 8bit and ucs2 functions.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	bar
# Host:	bar.intranet.mysql.r18.ru
# Root:	/usr/home/bar/mysql-5.0.b6147

--- 1.119/include/m_ctype.h	2006-03-23 20:32:02 +04:00
+++ 1.120/include/m_ctype.h	2006-06-05 17:08:21 +05:00
@@ -205,6 +205,9 @@ typedef struct my_charset_handler_st
 			 int *err);
   longlong    (*strtoll10)(struct charset_info_st *cs,
                            const char *nptr, char **endptr, int *error);
+  ulonglong   (*strntoull10rnd)(struct charset_info_st *cs,
+                                const char *str, uint length, int unsigned_fl,
+                                char **endptr, int *error);
   ulong        (*scan)(struct charset_info_st *, const char *b, const char *e,
 		       int sq);
 } MY_CHARSET_HANDLER;
@@ -340,6 +343,13 @@ longlong my_strtoll10_8bit(CHARSET_INFO 
                            const char *nptr, char **endptr, int *error);
 longlong my_strtoll10_ucs2(CHARSET_INFO *cs, 
                            const char *nptr, char **endptr, int *error);
+
+ulonglong my_strntoull10rnd_8bit(CHARSET_INFO *cs,
+                                 const char *str, uint length, int unsigned_fl,
+                                 char **endptr, int *error);
+ulonglong my_strntoull10rnd_ucs2(CHARSET_INFO *cs, 
+                                 const char *str, uint length, int unsigned_fl,
+                                 char **endptr, int *error);
 
 void my_fill_8bit(CHARSET_INFO *cs, char* to, uint l, int fill);
 

--- 1.307/sql/field.cc	2006-05-24 13:56:55 +05:00
+++ 1.308/sql/field.cc	2006-06-05 17:08:22 +05:00
@@ -2579,30 +2579,27 @@ void Field_new_decimal::sql_type(String 
 
 int Field_tiny::store(const char *from,uint len,CHARSET_INFO *cs)
 {
-  int not_used;				// We can ignore result from str2int
   char *end;
-  long tmp= my_strntol(cs, from, len, 10, &end, &not_used);
-  int error= 0;
+  int error;
 
   if (unsigned_flag)
   {
-    if (tmp < 0)
-    {
-      tmp=0; /* purecov: inspected */
-      set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
-      error= 1;
-    }
-    else if (tmp > 255)
+    ulonglong tmp= cs->cset->strntoull10rnd(cs, from, len, 1, &end,
&error);
+    if (error == MY_ERRNO_ERANGE || tmp > 255)
     {
-      tmp= 255;
+      set_if_smaller(tmp, 255);
       set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
       error= 1;
     }
     else if (table->in_use->count_cuted_fields &&
check_int(from,len,end,cs))
       error= 1;
+    else
+      error= 0;
+    ptr[0]= (char) tmp;
   }
   else
   {
+    longlong tmp= cs->cset->strntoull10rnd(cs, from, len, 0, &end, &error);
     if (tmp < -128)
     {
       tmp= -128;
@@ -2617,8 +2614,10 @@ int Field_tiny::store(const char *from,u
     }
     else if (table->in_use->count_cuted_fields &&
check_int(from,len,end,cs))
       error= 1;
+    else
+      error= 0;
+    ptr[0]= (char) tmp;
   }
-  ptr[0]= (char) tmp;
   return error;
 }
 
@@ -2783,30 +2782,34 @@ void Field_tiny::sql_type(String &res) c
 
 int Field_short::store(const char *from,uint len,CHARSET_INFO *cs)
 {
-  int not_used;				// We can ignore result from str2int
   char *end;
-  long tmp= my_strntol(cs, from, len, 10, &end, &not_used);
-  int error= 0;
+  int error;
 
   if (unsigned_flag)
   {
-    if (tmp < 0)
+    ulonglong tmp= cs->cset->strntoull10rnd(cs, from, len, 1, &end,
&error);
+    if (error == MY_ERRNO_ERANGE || tmp > UINT_MAX16)
     {
-      tmp=0;
-      set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
-      error= 1;
-    }
-    else if (tmp > UINT_MAX16)
-    {
-      tmp=UINT_MAX16;
+      set_if_smaller(tmp, UINT_MAX16);
       set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
       error= 1;
     }
     else if (table->in_use->count_cuted_fields &&
check_int(from,len,end,cs))
       error= 1;
+    else
+      error= 0;
+#ifdef WORDS_BIGENDIAN
+    if (table->s->db_low_byte_first)
+    {
+      int2store(ptr,tmp);
+    }
+    else
+#endif
+      shortstore(ptr,(short) tmp);
   }
   else
   {
+    longlong tmp= cs->cset->strntoull10rnd(cs, from, len, 0, &end, &error);
     if (tmp < INT_MIN16)
     {
       tmp= INT_MIN16;
@@ -2821,15 +2824,17 @@ int Field_short::store(const char *from,
     }
     else if (table->in_use->count_cuted_fields &&
check_int(from,len,end,cs))
       error= 1;
-  }
+    else
+      error= 0;
 #ifdef WORDS_BIGENDIAN
-  if (table->s->db_low_byte_first)
-  {
-    int2store(ptr,tmp);
-  }
-  else
+    if (table->s->db_low_byte_first)
+    {
+      int2store(ptr,tmp);
+    }
+    else
 #endif
-    shortstore(ptr,(short) tmp);
+      shortstore(ptr,(short) tmp);
+  }
   return error;
 }
 
@@ -3057,30 +3062,27 @@ void Field_short::sql_type(String &res) 
 
 int Field_medium::store(const char *from,uint len,CHARSET_INFO *cs)
 {
-  int not_used;				// We can ignore result from str2int
   char *end;
-  long tmp= my_strntol(cs, from, len, 10, &end, &not_used);
-  int error= 0;
+  int error;
 
   if (unsigned_flag)
   {
-    if (tmp < 0)
+    ulonglong tmp= cs->cset->strntoull10rnd(cs, from, len, 1, &end,
&error);
+    if (error == MY_ERRNO_ERANGE || tmp > UINT_MAX24)
     {
-      tmp=0;
-      set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
-      error= 1;
-    }
-    else if (tmp >= (long) (1L << 24))
-    {
-      tmp=(long) (1L << 24)-1L;
+      set_if_smaller(tmp, UINT_MAX24);
       set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
       error= 1;
     }
     else if (table->in_use->count_cuted_fields &&
check_int(from,len,end,cs))
       error= 1;
+    else
+      error= 0;
+    int3store(ptr,tmp);
   }
   else
   {
+    longlong tmp= cs->cset->strntoull10rnd(cs, from, len, 0, &end, &error);
     if (tmp < INT_MIN24)
     {
       tmp= INT_MIN24;
@@ -3095,9 +3097,10 @@ int Field_medium::store(const char *from
     }
     else if (table->in_use->count_cuted_fields &&
check_int(from,len,end,cs))
       error= 1;
+    else
+      error= 0;
+    int3store(ptr,tmp);
   }
-
-  int3store(ptr,tmp);
   return error;
 }
 
@@ -3293,64 +3296,47 @@ static bool test_if_minus(CHARSET_INFO *
 
 int Field_long::store(const char *from,uint len,CHARSET_INFO *cs)
 {
-  ulong tmp_scan;
-  longlong tmp;
   long store_tmp;
   int error;
   char *end;
 
-  tmp_scan= cs->cset->scan(cs, from, from+len, MY_SEQ_SPACES);
-  len-= tmp_scan;
-  from+= tmp_scan;
-
-  end= (char*) from+len;
-  tmp= cs->cset->strtoll10(cs, from, &end, &error);
-
-  if (error != MY_ERRNO_EDOM)
+  if (unsigned_flag)
   {
-    if (unsigned_flag)
+    ulonglong tmp= cs->cset->strntoull10rnd(cs, from, len, 1, &end,
&error);
+    if (error == MY_ERRNO_ERANGE || tmp > (ulonglong) UINT_MAX32)
     {
-      if (error < 0)
-      {
-        error= 1;
-        tmp= 0;
-      }
-      else if ((ulonglong) tmp > (ulonglong) UINT_MAX32)
-      {
-        tmp= UINT_MAX32;
-        error= 1;
-      }
-      else
-        error= 0;
+      set_if_smaller(tmp, (ulonglong) UINT_MAX32);
+      set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+      error= 1;
     }
+    else if (table->in_use->count_cuted_fields &&
check_int(from,len,end,cs))
+      error= 1;
     else
-    {
-      if (error < 0)
-      {
-        error= 0;
-        if (tmp < INT_MIN32)
-        {
-          tmp= INT_MIN32;
-          error= 1;
-        }
-      }
-      else if (tmp > INT_MAX32)
-      {
-        tmp= INT_MAX32;
-        error= 1;
-      }
-    }
+      error= 0;
+    store_tmp= (long) tmp;
   }
-  if (error)
+  else
   {
-    error= error != MY_ERRNO_EDOM ? 1 : 2;
-    set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+    longlong tmp= cs->cset->strntoull10rnd(cs, from, len, 0, &end, &error);
+    if (tmp < INT_MIN32)
+    {
+      tmp= INT_MIN32;
+      set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+      error= 1;
+    }
+    else if (tmp > INT_MAX32)
+    {
+      tmp=INT_MAX32;
+      set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+      error= 1;
+    }
+    else if (table->in_use->count_cuted_fields &&
check_int(from,len,end,cs))
+      error= 1;
+    else
+      error= 0;
+    store_tmp= (long) tmp;
   }
-  else if (from+len != end && table->in_use->count_cuted_fields &&
-           check_int(from,len,end,cs))
-    error= 2;
     
-  store_tmp= (long) tmp;
 #ifdef WORDS_BIGENDIAN
   if (table->s->db_low_byte_first)
   {
@@ -3586,33 +3572,20 @@ void Field_long::sql_type(String &res) c
 
 int Field_longlong::store(const char *from,uint len,CHARSET_INFO *cs)
 {
-  longlong tmp;
-  int error= 0;
+  int error;
   char *end;
+  ulonglong tmp;
 
-  tmp= cs->cset->scan(cs, from, from+len, MY_SEQ_SPACES);
-  len-= (uint)tmp;
-  from+= tmp;
-  if (unsigned_flag)
-  {
-    if (!len || test_if_minus(cs, from, from + len))
-    {
-      tmp=0;					// Set negative to 0
-      error= 1;
-    }
-    else
-      tmp=(longlong) my_strntoull(cs,from,len,10,&end,&error);
-  }
-  else
-    tmp=my_strntoll(cs,from,len,10,&end,&error);
-  if (error)
+  tmp= cs->cset->strntoull10rnd(cs,from,len,unsigned_flag,&end,&error);
+  if (error == MY_ERRNO_ERANGE)
   {
     set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
     error= 1;
   }
-  else if (from+len != end && table->in_use->count_cuted_fields &&
-           check_int(from,len,end,cs))
-    error= 2;
+  else if (table->in_use->count_cuted_fields && check_int(from,len,end,cs))
+    error= 1;
+  else
+    error= 0;
 #ifdef WORDS_BIGENDIAN
   if (table->s->db_low_byte_first)
   {

--- 1.89/strings/ctype-big5.c	2006-03-23 12:37:49 +04:00
+++ 1.90/strings/ctype-big5.c	2006-06-05 17:08:22 +05:00
@@ -6370,6 +6370,7 @@ static MY_CHARSET_HANDLER my_charset_big
   my_strntoull_8bit,
   my_strntod_8bit,
   my_strtoll10_8bit,
+  my_strntoull10rnd_8bit,
   my_scan_8bit
 };
 

--- 1.67/strings/ctype-euc_kr.c	2006-03-23 20:32:03 +04:00
+++ 1.68/strings/ctype-euc_kr.c	2006-06-05 17:08:22 +05:00
@@ -8711,6 +8711,7 @@ static MY_CHARSET_HANDLER my_charset_han
   my_strntoull_8bit,
   my_strntod_8bit,
   my_strtoll10_8bit,
+  my_strntoull10rnd_8bit,
   my_scan_8bit
 };
 

--- 1.64/strings/ctype-gb2312.c	2006-03-23 20:32:04 +04:00
+++ 1.65/strings/ctype-gb2312.c	2006-06-05 17:08:23 +05:00
@@ -5762,6 +5762,7 @@ static MY_CHARSET_HANDLER my_charset_han
   my_strntoull_8bit,
   my_strntod_8bit,
   my_strtoll10_8bit,
+  my_strntoull10rnd_8bit,
   my_scan_8bit
 };
 

--- 1.79/strings/ctype-gbk.c	2006-03-23 12:37:50 +04:00
+++ 1.80/strings/ctype-gbk.c	2006-06-05 17:08:23 +05:00
@@ -10015,6 +10015,7 @@ static MY_CHARSET_HANDLER my_charset_han
   my_strntoull_8bit,
   my_strntod_8bit,
   my_strtoll10_8bit,
+  my_strntoull10rnd_8bit,
   my_scan_8bit
 };
 

--- 1.89/strings/ctype-sjis.c	2006-03-23 12:37:50 +04:00
+++ 1.90/strings/ctype-sjis.c	2006-06-05 17:08:23 +05:00
@@ -4663,6 +4663,7 @@ static MY_CHARSET_HANDLER my_charset_han
   my_strntoull_8bit,
   my_strntod_8bit,
   my_strtoll10_8bit,
+  my_strntoull10rnd_8bit,
   my_scan_8bit
 };
 

--- 1.92/strings/ctype-tis620.c	2006-03-23 12:37:50 +04:00
+++ 1.93/strings/ctype-tis620.c	2006-06-05 17:08:23 +05:00
@@ -891,6 +891,7 @@ static MY_CHARSET_HANDLER my_charset_han
     my_strntoull_8bit,
     my_strntod_8bit,
     my_strtoll10_8bit,
+    my_strntoull10rnd_8bit,
     my_scan_8bit
 };
 

--- 1.70/strings/ctype-ujis.c	2006-03-23 12:37:51 +04:00
+++ 1.71/strings/ctype-ujis.c	2006-06-05 17:08:23 +05:00
@@ -8545,6 +8545,7 @@ static MY_CHARSET_HANDLER my_charset_han
     my_strntoull_8bit,
     my_strntod_8bit,
     my_strtoll10_8bit,
+    my_strntoull10rnd_8bit,
     my_scan_8bit
 };
 

--- 1.2/mysql-test/r/sp-vars.result	2006-05-12 21:58:48 +05:00
+++ 1.3/mysql-test/r/sp-vars.result	2006-06-05 17:08:21 +05:00
@@ -896,7 +896,7 @@ sp_var
 @user_var
 0
 Warnings:
-Warning	1264	Out of range value adjusted for column 'sp_var' at row 1
+Warning	1366	Incorrect integer value: 'Hello, world!' for column 'sp_var' at row 1
 DROP PROCEDURE p1;
 DROP TABLE t1;
 

--- 1.69/strings/ctype-bin.c	2006-03-23 20:32:03 +04:00
+++ 1.70/strings/ctype-bin.c	2006-06-05 17:08:22 +05:00
@@ -517,6 +517,7 @@ static MY_CHARSET_HANDLER my_charset_han
     my_strntoull_8bit,
     my_strntod_8bit,
     my_strtoll10_8bit,
+    my_strntoull10rnd_8bit,
     my_scan_8bit
 };
 

--- 1.49/strings/ctype-latin1.c	2006-03-23 12:37:50 +04:00
+++ 1.50/strings/ctype-latin1.c	2006-06-05 17:08:23 +05:00
@@ -411,6 +411,7 @@ static MY_CHARSET_HANDLER my_charset_han
     my_strntoull_8bit,
     my_strntod_8bit,
     my_strtoll10_8bit,
+    my_strntoull10rnd_8bit,
     my_scan_8bit
 };
 

--- 1.61/strings/ctype-ucs2.c	2006-03-30 18:14:51 +05:00
+++ 1.62/strings/ctype-ucs2.c	2006-06-05 17:08:23 +05:00
@@ -974,6 +974,35 @@ double my_strntod_ucs2(CHARSET_INFO *cs 
 }
 
 
+ulonglong my_strntoull10rnd_ucs2(CHARSET_INFO *cs __attribute__((unused)),
+                                 const char *nptr, uint length, int unsign_fl,
+                                 char **endptr, int *err)
+{
+  char     buf[256], *b= buf;
+  ulonglong res;
+  const uchar *end, *s= (const uchar*) nptr;
+  my_wc_t  wc;
+  int      cnv;
+
+  /* Cut too long strings */
+  if (length >= sizeof(buf))
+    length= sizeof(buf)-1;
+  end= s + length;
+
+  while ((cnv= cs->cset->mb_wc(cs,&wc,s,end)) > 0)
+  {
+    s+= cnv;
+    if (wc > (int) (uchar) 'e' || !wc)
+      break;                            /* Can't be a number part */
+    *b++= (char) wc;
+  }
+
+  res= my_strntoull10rnd_8bit(cs, buf, b - buf, unsign_fl, endptr, err);
+  *endptr= (char*) nptr + 2 * (uint) (*endptr- buf);
+  return res;
+}
+
+
 /*
   This is a fast version optimized for the case of radix 10 / -10
 */
@@ -1629,6 +1658,7 @@ MY_CHARSET_HANDLER my_charset_ucs2_handl
     my_strntoull_ucs2,
     my_strntod_ucs2,
     my_strtoll10_ucs2,
+    my_strntoull10rnd_ucs2,
     my_scan_ucs2
 };
 

--- 1.76/strings/ctype-simple.c	2006-03-23 12:37:50 +04:00
+++ 1.77/strings/ctype-simple.c	2006-06-05 17:08:23 +05:00
@@ -17,6 +17,7 @@
 #include <my_global.h>
 #include "m_string.h"
 #include "m_ctype.h"
+#include "my_sys.h"  /* Needed for MY_ERRNO_ERANGE */
 #include <errno.h>
 
 #include "stdarg.h"
@@ -1354,6 +1355,315 @@ longlong my_strtoll10_8bit(CHARSET_INFO 
 }
 
 
+#undef  ULONGLONG_MAX
+/*
+  Needed under MetroWerks Compiler, since MetroWerks compiler does not
+  properly handle a constant expression containing a mod operator
+*/
+#if defined(__NETWARE__) && defined(__MWERKS__)
+static ulonglong ulonglong_max= ~(ulonglong) 0;
+#define ULONGLONG_MAX ulonglong_max
+#else
+#define ULONGLONG_MAX           (~(ulonglong) 0)
+#endif /* __NETWARE__ && __MWERKS__ */
+
+    
+#define CUTOFF  (ULONGLONG_MAX / 10)
+#define CUTLIM  (ULONGLONG_MAX % 10)
+#define DIGITS_IN_ULONGLONG 20
+
+static ulonglong d10[DIGITS_IN_ULONGLONG]=
+{
+  1,
+  10,
+  100,
+  1000,
+  10000,
+  100000,
+  1000000,
+  10000000,
+  100000000,
+  1000000000,
+  10000000000ULL,
+  100000000000ULL,
+  1000000000000ULL,
+  10000000000000ULL,
+  100000000000000ULL,
+  1000000000000000ULL,
+  10000000000000000ULL,
+  100000000000000000ULL,
+  1000000000000000000ULL,
+  10000000000000000000ULL
+};
+
+
+/*
+
+  Convert a string to an to unsigned long long integer value
+  with rounding.
+  
+  SYNOPSYS
+    my_strntoull10_8bit()
+      cs              in      pointer to character set
+      str             in      pointer to the string to be converted
+      length          in      string length
+      unsigned_flag   in      whether the number is unsigned
+      endptr          out     pointer to the stop character
+      error           out     returned error code
+
+  DESCRIPTION
+    This function takes the decimal representation of integer number
+    from string str and converts it to an signed or unsigned
+    long long integer value.
+    Space characters and tab are ignored.
+    A sign character might precede the digit characters.
+    The number may have any number of pre-zero digits.
+    The number may have decimal point and exponent.
+    Rounding is always done in "away from zero" style:
+      0.5  ->   1
+     -0.5  ->  -1
+
+    The function stops reading the string str after "length" bytes
+    or at the first character that is not a part of correct number syntax:
+
+    <signed numeric literal> ::=
+      [ <sign> ] <exact numeric literal> [ E [ <sign> ] <unsigned
integer> ]
+
+    <exact numeric literal> ::=
+                        <unsigned integer> [ <period> [ <unsigned
integer> ] ]
+                      | <period> <unsigned integer>
+    <unsigned integer>   ::= <digit>...
+     
+  RETURN VALUES
+    Value of string as a signed/unsigned longlong integer
+
+    endptr cannot be NULL. The function will store the end pointer
+    to the stop character here.
+
+    The error parameter contains information how things went:
+    0	     ok
+    ERANGE   If the the value of the converted number is out of range
+    In this case the return value is:
+    - ULONGLONG_MAX if unsigned_flag and the number was too big
+    - 0 if unsigned_flag and the number was negative
+    - LONGLONG_MAX if no unsigned_flag and the number is too big
+    - LONGLONG_MIN if no unsigned_flag and the number it too big negative
+    
+    EDOM If the string didn't contain any digits.
+    In this case the return value is 0.
+*/
+
+ulonglong
+my_strntoull10rnd_8bit(CHARSET_INFO *cs __attribute__((unused)),
+                       const char *str, uint length, int unsigned_flag,
+                       char **endptr, int *error)
+{
+  const char *dot, *end9, *beg, *end= str + length;
+  ulonglong ull;
+  ulong ul;
+  unsigned char ch;
+  int shift= 0, digits= 0, negative, addon;
+
+  /* Skip leading spaces and tabs */
+  for ( ; str < end && (*str == ' ' || *str == '\t') ; str++);
+
+  if (str >= end)
+    goto ret_edom;
+
+  if ((negative= (*str == '-')) || *str=='+') /* optional sign */
+  {
+    if (++str == end)
+      goto ret_edom;
+  }
+
+  beg= str;
+  end9= (str + 9) > end ? end : (str + 9);
+  /* Accumulate small number into ulong, for performance purposes */
+  for (ul= 0 ; str < end9 && (ch= ((unsigned char)*str - '0')) < 10; str++)
+  {
+    ul= ul * 10 + ch;
+  }
+  digits= str - beg;
+
+  /* Continue to accumulate into ulonglong */
+  for (dot= NULL, ull= ul; str < end; str++)
+  {
+    if ((ch= ((unsigned char)*str - '0')) < 10)
+    {
+      if (ull < CUTOFF || (ull == CUTOFF && ch <= CUTLIM))
+      {
+        ull= ull * 10 + ch;
+        digits++;
+        continue;
+      }
+      /*
+        Adding the next digit would overflow.
+        Remember the next digit in "addon", for rounding.
+        Scan all digits with an optional single dot.
+      */
+      if (ull == CUTOFF)
+      {
+        ull= ULONGLONG_MAX;
+        addon= 1;
+        str++;
+      }
+      else
+        addon= (*str >= '5');
+      for ( ; str < end && (ch= ((unsigned char)*str - '0')) < 10; str++)
+      {
+        if (!dot)
+          shift++;
+      }
+      if (str < end && *str == '.' && !dot)
+      {
+        str++;
+        for ( ; str < end && (ch= ((unsigned char)*str - '0')) < 10;
str++);
+      }
+      goto exp;
+    }
+    
+    if (*str == '.')
+    {
+      if (dot)
+      {
+        /* The second dot character */
+        addon= 0;
+        goto exp;
+      }
+      else
+      {
+        dot= str + 1;
+      }
+      continue;
+    }
+    
+    /* Unknown character, exit the loop */
+    break; 
+  }
+  shift= dot ? dot - str : 0; /* Right shift */
+  addon= 0;
+
+exp:    /* [ E [ <sign> ] <unsigned integer> ] */
+
+  if (!digits)
+  {
+    str= beg;
+    goto ret_edom;
+  }
+  
+  if (str < end && (*str == 'e' || *str == 'E'))
+  {
+    str++;
+    if (str < end)
+    {
+      int negative_exp, exp;
+      if ((negative_exp= (*str == '-')) || *str=='+')
+      {
+        if (++str == end)
+          goto ret_sign;
+      }
+      for (exp= 0 ; str < end && (ch= ((unsigned char)*str - '0')) < 10;
str++)
+      {
+        exp= exp * 10 + ch;
+      }
+      shift+= negative_exp ? -exp : exp;
+    }
+  }
+  
+  if (shift == 0) /* No shift, check addon digit */
+  {
+    if (addon)
+    {
+      if (ull == ULONGLONG_MAX)
+        goto ret_too_big;
+      ull++;
+    }
+    goto ret_sign;
+  }
+
+  if (shift < 0) /* Right shift */
+  {
+    ulonglong d, r;
+    
+    if (-shift >= DIGITS_IN_ULONGLONG)
+      goto ret_zero; /* Exponent is a big negative number, return 0 */
+    
+    d= d10[-shift];
+    r= (ull % d) * 2;
+    ull /= d;
+    if (r >= d)
+      ull++;
+    goto ret_sign;
+  }
+
+  if (shift > DIGITS_IN_ULONGLONG) /* Huge left shift */
+  {
+    if (!ull)
+      goto ret_sign;
+    goto ret_too_big;
+  }
+
+  for ( ; shift > 0; shift--, ull*= 10) /* Left shift */
+  {
+    if (ull > CUTOFF)
+      goto ret_too_big; /* Overflow, number too big */
+  }
+
+ret_sign:
+  *endptr= (char*) str;
+
+  if (!unsigned_flag)
+  {
+    if (negative)
+    {
+      if (ull > (ulonglong) LONGLONG_MIN)
+      {
+        *error= MY_ERRNO_ERANGE;
+        return (ulonglong) LONGLONG_MIN;
+      }
+      *error= 0;
+      return -ull;
+    }
+    else
+    {
+      if (ull > (ulonglong) LONGLONG_MAX)
+      {
+        *error= MY_ERRNO_ERANGE;
+        return (ulonglong) LONGLONG_MAX;
+      }
+      *error= 0;
+      return ull;
+    }
+  }
+
+  /* Unsigned number */
+  if (negative && ull)
+  {
+    *error= MY_ERRNO_ERANGE;
+    return 0;
+  }
+  *error= 0;
+  return ull;
+
+ret_zero:
+  *endptr= (char*) str;
+  *error= 0;
+  return 0;
+
+ret_edom:
+  *endptr= (char*) str;
+  *error= MY_ERRNO_EDOM;
+  return 0;
+  
+ret_too_big:
+  *endptr= (char*) str;
+  *error= MY_ERRNO_ERANGE;
+  return unsigned_flag ?
+         ULONGLONG_MAX :
+         negative ? (ulonglong) LONGLONG_MIN : (ulonglong) LONGLONG_MAX;
+}
+
+
 /*
   Check if a constant can be propagated
 
@@ -1434,6 +1744,7 @@ MY_CHARSET_HANDLER my_charset_8bit_handl
     my_strntoull_8bit,
     my_strntod_8bit,
     my_strtoll10_8bit,
+    my_strntoull10rnd_8bit,
     my_scan_8bit
 };
 

--- 1.98/strings/ctype-utf8.c	2006-03-23 12:37:51 +04:00
+++ 1.99/strings/ctype-utf8.c	2006-06-05 17:08:23 +05:00
@@ -2548,6 +2548,7 @@ MY_CHARSET_HANDLER my_charset_utf8_handl
     my_strntoull_8bit,
     my_strntod_8bit,
     my_strtoll10_8bit,
+    my_strntoull10rnd_8bit,
     my_scan_8bit
 };
 
--- New file ---
+++ mysql-test/r/round.result	06/06/05 17:08:23
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (sint8 tinyint not null);
INSERT INTO t1 VALUES ('0.1');
INSERT INTO t1 VALUES ('0.5');
INSERT INTO t1 VALUES ('127.4');
INSERT INTO t1 VALUES ('127.5');
Warnings:
Warning	1264	Out of range value adjusted for column 'sint8' at row 1
INSERT INTO t1 VALUES ('-0.1');
INSERT INTO t1 VALUES ('-0.5');
INSERT INTO t1 VALUES ('-127.4');
INSERT INTO t1 VALUES ('-127.5');
INSERT INTO t1 VALUES ('-128.4');
INSERT INTO t1 VALUES ('-128.5');
Warnings:
Warning	1264	Out of range value adjusted for column 'sint8' at row 1
SELECT * FROM t1;
sint8
0
1
127
127
0
-1
-127
-128
-128
-128
DROP TABLE t1;
CREATE TABLE t1 (uint8 tinyint unsigned not null);
INSERT INTO t1 VALUES ('0.1');
INSERT INTO t1 VALUES ('0.5');
INSERT INTO t1 VALUES ('127.4');
INSERT INTO t1 VALUES ('127.5');
INSERT INTO t1 VALUES ('-0.1');
INSERT INTO t1 VALUES ('-0.5');
Warnings:
Warning	1264	Out of range value adjusted for column 'uint8' at row 1
INSERT INTO t1 VALUES ('255.4');
INSERT INTO t1 VALUES ('255.5');
Warnings:
Warning	1264	Out of range value adjusted for column 'uint8' at row 1
SELECT * FROM t1;
uint8
0
1
127
128
0
0
255
255
DROP TABLE t1;
CREATE TABLE t1 (sint16 smallint not null);
INSERT INTO t1 VALUES ('0.1');
INSERT INTO t1 VALUES ('0.5');
INSERT INTO t1 VALUES ('32767.4');
INSERT INTO t1 VALUES ('32767.5');
Warnings:
Warning	1264	Out of range value adjusted for column 'sint16' at row 1
INSERT INTO t1 VALUES ('-0.1');
INSERT INTO t1 VALUES ('-0.5');
INSERT INTO t1 VALUES ('-32767.4');
INSERT INTO t1 VALUES ('-32767.5');
INSERT INTO t1 VALUES ('-32768.4');
INSERT INTO t1 VALUES ('-32768.5');
Warnings:
Warning	1264	Out of range value adjusted for column 'sint16' at row 1
SELECT * FROM t1;
sint16
0
1
32767
32767
0
-1
-32767
-32768
-32768
-32768
DROP TABLE t1;
CREATE TABLE t1 (uint16 smallint unsigned not null);
INSERT INTO t1 VALUES ('0.1');
INSERT INTO t1 VALUES ('0.5');
INSERT INTO t1 VALUES ('32767.4');
INSERT INTO t1 VALUES ('32767.5');
INSERT INTO t1 VALUES ('-0.1');
INSERT INTO t1 VALUES ('-0.5');
Warnings:
Warning	1264	Out of range value adjusted for column 'uint16' at row 1
INSERT INTO t1 VALUES ('65535.4');
INSERT INTO t1 VALUES ('65535.5');
Warnings:
Warning	1264	Out of range value adjusted for column 'uint16' at row 1
SELECT * FROM t1;
uint16
0
1
32767
32768
0
0
65535
65535
DROP TABLE t1;
CREATE TABLE t1 (sint24 mediumint not null);
INSERT INTO t1 VALUES ('0.1');
INSERT INTO t1 VALUES ('0.5');
INSERT INTO t1 VALUES ('8388607.4');
INSERT INTO t1 VALUES ('8388607.5');
Warnings:
Warning	1264	Out of range value adjusted for column 'sint24' at row 1
INSERT INTO t1 VALUES ('-0.1');
INSERT INTO t1 VALUES ('-0.5');
INSERT INTO t1 VALUES ('-8388607.4');
INSERT INTO t1 VALUES ('-8388607.5');
INSERT INTO t1 VALUES ('-8388608.4');
INSERT INTO t1 VALUES ('-8388608.5');
Warnings:
Warning	1264	Out of range value adjusted for column 'sint24' at row 1
SELECT * FROM t1;
sint24
0
1
8388607
8388607
0
-1
-8388607
-8388608
-8388608
-8388608
DROP TABLE t1;
CREATE TABLE t1 (uint24 mediumint unsigned not null);
INSERT INTO t1 VALUES ('0.1');
INSERT INTO t1 VALUES ('0.5');
INSERT INTO t1 VALUES ('8388607.4');
INSERT INTO t1 VALUES ('8388607.5');
INSERT INTO t1 VALUES ('-0.1');
INSERT INTO t1 VALUES ('-0.5');
Warnings:
Warning	1264	Out of range value adjusted for column 'uint24' at row 1
INSERT INTO t1 VALUES ('16777215.4');
INSERT INTO t1 VALUES ('16777215.5');
Warnings:
Warning	1264	Out of range value adjusted for column 'uint24' at row 1
SELECT * FROM t1;
uint24
0
1
8388607
8388608
0
0
16777215
16777215
DROP TABLE t1;
CREATE TABLE t1 (sint64 bigint not null);
INSERT INTO t1 VALUES ('0.1');
INSERT INTO t1 VALUES ('0.5');
INSERT INTO t1 VALUES ('9223372036854775807.4');
INSERT INTO t1 VALUES ('9223372036854775807.5');
Warnings:
Warning	1264	Out of range value adjusted for column 'sint64' at row 1
INSERT INTO t1 VALUES ('-0.1');
INSERT INTO t1 VALUES ('-0.5');
INSERT INTO t1 VALUES ('-9223372036854775807.4');
INSERT INTO t1 VALUES ('-9223372036854775807.5');
INSERT INTO t1 VALUES ('-9223372036854775808.4');
INSERT INTO t1 VALUES ('-9223372036854775808.5');
Warnings:
Warning	1264	Out of range value adjusted for column 'sint64' at row 1
SELECT * FROM t1;
sint64
0
1
9223372036854775807
9223372036854775807
0
-1
-9223372036854775807
-9223372036854775808
-9223372036854775808
-9223372036854775808
DROP TABLE t1;
CREATE TABLE t1 (uint64 bigint unsigned not null);
INSERT INTO t1 VALUES ('0.1');
INSERT INTO t1 VALUES ('0.5');
INSERT INTO t1 VALUES ('9223372036854775807.4');
INSERT INTO t1 VALUES ('9223372036854775807.5');
INSERT INTO t1 VALUES ('-0.1');
INSERT INTO t1 VALUES ('-0.5');
Warnings:
Warning	1264	Out of range value adjusted for column 'uint64' at row 1
INSERT INTO t1 VALUES ('18446744073709551615.4');
INSERT INTO t1 VALUES ('18446744073709551615.5');
Warnings:
Warning	1264	Out of range value adjusted for column 'uint64' at row 1
INSERT INTO t1 VALUES ('1844674407370955161.0');
INSERT INTO t1 VALUES ('1844674407370955161.1');
INSERT INTO t1 VALUES ('1844674407370955161.2');
INSERT INTO t1 VALUES ('1844674407370955161.3');
INSERT INTO t1 VALUES ('1844674407370955161.4');
INSERT INTO t1 VALUES ('1844674407370955161.5');
INSERT INTO t1 VALUES ('1844674407370955161.0e1');
INSERT INTO t1 VALUES ('1844674407370955161.1e1');
INSERT INTO t1 VALUES ('1844674407370955161.2e1');
INSERT INTO t1 VALUES ('1844674407370955161.3e1');
INSERT INTO t1 VALUES ('1844674407370955161.4e1');
INSERT INTO t1 VALUES ('1844674407370955161.5e1');
INSERT INTO t1 VALUES ('18446744073709551610e-1');
INSERT INTO t1 VALUES ('18446744073709551611e-1');
INSERT INTO t1 VALUES ('18446744073709551612e-1');
INSERT INTO t1 VALUES ('18446744073709551613e-1');
INSERT INTO t1 VALUES ('18446744073709551614e-1');
INSERT INTO t1 VALUES ('18446744073709551615e-1');
SELECT * FROM t1;
uint64
0
1
9223372036854775807
9223372036854775808
0
0
18446744073709551615
18446744073709551615
1844674407370955161
1844674407370955161
1844674407370955161
1844674407370955161
1844674407370955161
1844674407370955162
18446744073709551610
18446744073709551611
18446744073709551612
18446744073709551613
18446744073709551614
18446744073709551615
1844674407370955161
1844674407370955161
1844674407370955161
1844674407370955161
1844674407370955161
1844674407370955162
DROP TABLE t1;
CREATE TABLE t1 (str varchar(128), sint64 bigint not null default 0);
INSERT INTO t1 (str) VALUES ('1.5');
INSERT INTO t1 (str) VALUES ('1.00005e4');
INSERT INTO t1 (str) VALUES ('1.0005e3');
INSERT INTO t1 (str) VALUES ('1.005e2');
INSERT INTO t1 (str) VALUES ('1.05e1');
INSERT INTO t1 (str) VALUES ('1.5e0');
INSERT INTO t1 (str) VALUES ('100005e-1');
INSERT INTO t1 (str) VALUES ('100050e-2');
INSERT INTO t1 (str) VALUES ('100500e-3');
INSERT INTO t1 (str) VALUES ('105000e-4');
INSERT INTO t1 (str) VALUES ('150000e-5');
UPDATE t1 SET sint64=str;
SELECT * FROM t1;
str	sint64
1.5	2
1.00005e4	10001
1.0005e3	1001
1.005e2	101
1.05e1	11
1.5e0	2
100005e-1	10001
100050e-2	1001
100500e-3	101
105000e-4	11
150000e-5	2
DROP TABLE t1;

--- New file ---
+++ mysql-test/t/round.test	06/06/05 17:08:24
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings

CREATE TABLE t1 (sint8 tinyint not null);
INSERT INTO t1 VALUES ('0.1');
INSERT INTO t1 VALUES ('0.5');
INSERT INTO t1 VALUES ('127.4');
INSERT INTO t1 VALUES ('127.5');
INSERT INTO t1 VALUES ('-0.1');
INSERT INTO t1 VALUES ('-0.5');
INSERT INTO t1 VALUES ('-127.4');
INSERT INTO t1 VALUES ('-127.5');
INSERT INTO t1 VALUES ('-128.4');
INSERT INTO t1 VALUES ('-128.5');
SELECT * FROM t1;
DROP TABLE t1;

CREATE TABLE t1 (uint8 tinyint unsigned not null);
INSERT INTO t1 VALUES ('0.1');
INSERT INTO t1 VALUES ('0.5');
INSERT INTO t1 VALUES ('127.4');
INSERT INTO t1 VALUES ('127.5');
INSERT INTO t1 VALUES ('-0.1');
INSERT INTO t1 VALUES ('-0.5');
INSERT INTO t1 VALUES ('255.4');
INSERT INTO t1 VALUES ('255.5');
SELECT * FROM t1;
DROP TABLE t1;


CREATE TABLE t1 (sint16 smallint not null);
INSERT INTO t1 VALUES ('0.1');
INSERT INTO t1 VALUES ('0.5');
INSERT INTO t1 VALUES ('32767.4');
INSERT INTO t1 VALUES ('32767.5');
INSERT INTO t1 VALUES ('-0.1');
INSERT INTO t1 VALUES ('-0.5');
INSERT INTO t1 VALUES ('-32767.4');
INSERT INTO t1 VALUES ('-32767.5');
INSERT INTO t1 VALUES ('-32768.4');
INSERT INTO t1 VALUES ('-32768.5');
SELECT * FROM t1;
DROP TABLE t1;


CREATE TABLE t1 (uint16 smallint unsigned not null);
INSERT INTO t1 VALUES ('0.1');
INSERT INTO t1 VALUES ('0.5');
INSERT INTO t1 VALUES ('32767.4');
INSERT INTO t1 VALUES ('32767.5');
INSERT INTO t1 VALUES ('-0.1');
INSERT INTO t1 VALUES ('-0.5');
INSERT INTO t1 VALUES ('65535.4');
INSERT INTO t1 VALUES ('65535.5');
SELECT * FROM t1;
DROP TABLE t1;

CREATE TABLE t1 (sint24 mediumint not null);
INSERT INTO t1 VALUES ('0.1');
INSERT INTO t1 VALUES ('0.5');
INSERT INTO t1 VALUES ('8388607.4');
INSERT INTO t1 VALUES ('8388607.5');
INSERT INTO t1 VALUES ('-0.1');
INSERT INTO t1 VALUES ('-0.5');
INSERT INTO t1 VALUES ('-8388607.4');
INSERT INTO t1 VALUES ('-8388607.5');
INSERT INTO t1 VALUES ('-8388608.4');
INSERT INTO t1 VALUES ('-8388608.5');
SELECT * FROM t1;
DROP TABLE t1;

CREATE TABLE t1 (uint24 mediumint unsigned not null);
INSERT INTO t1 VALUES ('0.1');
INSERT INTO t1 VALUES ('0.5');
INSERT INTO t1 VALUES ('8388607.4');
INSERT INTO t1 VALUES ('8388607.5');
INSERT INTO t1 VALUES ('-0.1');
INSERT INTO t1 VALUES ('-0.5');
INSERT INTO t1 VALUES ('16777215.4');
INSERT INTO t1 VALUES ('16777215.5');
SELECT * FROM t1;
DROP TABLE t1;

CREATE TABLE t1 (sint64 bigint not null);
INSERT INTO t1 VALUES ('0.1');
INSERT INTO t1 VALUES ('0.5');
INSERT INTO t1 VALUES ('9223372036854775807.4');
INSERT INTO t1 VALUES ('9223372036854775807.5');
INSERT INTO t1 VALUES ('-0.1');
INSERT INTO t1 VALUES ('-0.5');
INSERT INTO t1 VALUES ('-9223372036854775807.4');
INSERT INTO t1 VALUES ('-9223372036854775807.5');
INSERT INTO t1 VALUES ('-9223372036854775808.4');
INSERT INTO t1 VALUES ('-9223372036854775808.5');
SELECT * FROM t1;
DROP TABLE t1;

CREATE TABLE t1 (uint64 bigint unsigned not null);
INSERT INTO t1 VALUES ('0.1');
INSERT INTO t1 VALUES ('0.5');
INSERT INTO t1 VALUES ('9223372036854775807.4');
INSERT INTO t1 VALUES ('9223372036854775807.5');
INSERT INTO t1 VALUES ('-0.1');
INSERT INTO t1 VALUES ('-0.5');
INSERT INTO t1 VALUES ('18446744073709551615.4');
INSERT INTO t1 VALUES ('18446744073709551615.5');
INSERT INTO t1 VALUES ('1844674407370955161.0');
INSERT INTO t1 VALUES ('1844674407370955161.1');
INSERT INTO t1 VALUES ('1844674407370955161.2');
INSERT INTO t1 VALUES ('1844674407370955161.3');
INSERT INTO t1 VALUES ('1844674407370955161.4');
INSERT INTO t1 VALUES ('1844674407370955161.5');
INSERT INTO t1 VALUES ('1844674407370955161.0e1');
INSERT INTO t1 VALUES ('1844674407370955161.1e1');
INSERT INTO t1 VALUES ('1844674407370955161.2e1');
INSERT INTO t1 VALUES ('1844674407370955161.3e1');
INSERT INTO t1 VALUES ('1844674407370955161.4e1');
INSERT INTO t1 VALUES ('1844674407370955161.5e1');
INSERT INTO t1 VALUES ('18446744073709551610e-1');
INSERT INTO t1 VALUES ('18446744073709551611e-1');
INSERT INTO t1 VALUES ('18446744073709551612e-1');
INSERT INTO t1 VALUES ('18446744073709551613e-1');
INSERT INTO t1 VALUES ('18446744073709551614e-1');
INSERT INTO t1 VALUES ('18446744073709551615e-1');
SELECT * FROM t1;
DROP TABLE t1;

CREATE TABLE t1 (str varchar(128), sint64 bigint not null default 0);
INSERT INTO t1 (str) VALUES ('1.5');
INSERT INTO t1 (str) VALUES ('1.00005e4');
INSERT INTO t1 (str) VALUES ('1.0005e3');
INSERT INTO t1 (str) VALUES ('1.005e2');
INSERT INTO t1 (str) VALUES ('1.05e1');
INSERT INTO t1 (str) VALUES ('1.5e0');
INSERT INTO t1 (str) VALUES ('100005e-1');
INSERT INTO t1 (str) VALUES ('100050e-2');
INSERT INTO t1 (str) VALUES ('100500e-3');
INSERT INTO t1 (str) VALUES ('105000e-4');
INSERT INTO t1 (str) VALUES ('150000e-5');
UPDATE t1 SET sint64=str;
SELECT * FROM t1;
DROP TABLE t1;


--- 1.161/mysql-test/r/view.result	2006-06-01 10:55:39 +05:00
+++ 1.162/mysql-test/r/view.result	2006-06-05 17:08:22 +05:00
@@ -1306,9 +1306,9 @@ a	b
 delete from t1;
 load data infile '../std_data_ln/loaddata3.dat' ignore into table v1 fields terminated by
'' enclosed by '' ignore 1 lines;
 Warnings:
-Warning	1264	Out of range value adjusted for column 'a' at row 3
+Warning	1366	Incorrect integer value: 'error      ' for column 'a' at row 3
 Error	1369	CHECK OPTION failed 'test.v1'
-Warning	1264	Out of range value adjusted for column 'a' at row 4
+Warning	1366	Incorrect integer value: 'wrong end  ' for column 'a' at row 4
 Error	1369	CHECK OPTION failed 'test.v1'
 select * from t1;
 a	b

--- 1.40/mysql-test/r/ps_2myisam.result	2006-05-13 13:11:36 +05:00
+++ 1.41/mysql-test/r/ps_2myisam.result	2006-06-05 17:08:21 +05:00
@@ -2689,21 +2689,21 @@ set @arg00= '1.11111111111111111111e+50'
 execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
 @arg00, @arg00, @arg00, @arg00, @arg00 ;
 Warnings:
-Warning	1265	Data truncated for column 'c1' at row 1
-Warning	1265	Data truncated for column 'c2' at row 1
-Warning	1265	Data truncated for column 'c3' at row 1
-Warning	1265	Data truncated for column 'c4' at row 1
-Warning	1265	Data truncated for column 'c5' at row 1
-Warning	1265	Data truncated for column 'c6' at row 1
+Warning	1264	Out of range value adjusted for column 'c1' at row 1
+Warning	1264	Out of range value adjusted for column 'c2' at row 1
+Warning	1264	Out of range value adjusted for column 'c3' at row 1
+Warning	1264	Out of range value adjusted for column 'c4' at row 1
+Warning	1264	Out of range value adjusted for column 'c5' at row 1
+Warning	1264	Out of range value adjusted for column 'c6' at row 1
 Warning	1264	Out of range value adjusted for column 'c7' at row 1
 Warning	1264	Out of range value adjusted for column 'c12' at row 1
 execute my_select ;
-c1	1
-c2	1
-c3	1
-c4	1
-c5	1
-c6	1
+c1	127
+c2	32767
+c3	8388607
+c4	2147483647
+c5	2147483647
+c6	9223372036854775807
 c7	3.40282e+38
 c8	1.11111111111111e+50
 c9	1.11111111111111e+50
@@ -2739,21 +2739,21 @@ set @arg00= '-1.11111111111111111111e+50
 execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
 @arg00, @arg00, @arg00, @arg00, @arg00 ;
 Warnings:
-Warning	1265	Data truncated for column 'c1' at row 1
-Warning	1265	Data truncated for column 'c2' at row 1
-Warning	1265	Data truncated for column 'c3' at row 1
-Warning	1265	Data truncated for column 'c4' at row 1
-Warning	1265	Data truncated for column 'c5' at row 1
-Warning	1265	Data truncated for column 'c6' at row 1
+Warning	1264	Out of range value adjusted for column 'c1' at row 1
+Warning	1264	Out of range value adjusted for column 'c2' at row 1
+Warning	1264	Out of range value adjusted for column 'c3' at row 1
+Warning	1264	Out of range value adjusted for column 'c4' at row 1
+Warning	1264	Out of range value adjusted for column 'c5' at row 1
+Warning	1264	Out of range value adjusted for column 'c6' at row 1
 Warning	1264	Out of range value adjusted for column 'c7' at row 1
 Warning	1264	Out of range value adjusted for column 'c12' at row 1
 execute my_select ;
-c1	-1
-c2	-1
-c3	-1
-c4	-1
-c5	-1
-c6	-1
+c1	-128
+c2	-32768
+c3	-8388608
+c4	-2147483648
+c5	-2147483648
+c6	-9223372036854775808
 c7	-3.40282e+38
 c8	-1.11111111111111e+50
 c9	-1.11111111111111e+50

--- 1.43/mysql-test/r/ps_3innodb.result	2006-05-13 13:11:36 +05:00
+++ 1.44/mysql-test/r/ps_3innodb.result	2006-06-05 17:08:21 +05:00
@@ -2672,21 +2672,21 @@ set @arg00= '1.11111111111111111111e+50'
 execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
 @arg00, @arg00, @arg00, @arg00, @arg00 ;
 Warnings:
-Warning	1265	Data truncated for column 'c1' at row 1
-Warning	1265	Data truncated for column 'c2' at row 1
-Warning	1265	Data truncated for column 'c3' at row 1
-Warning	1265	Data truncated for column 'c4' at row 1
-Warning	1265	Data truncated for column 'c5' at row 1
-Warning	1265	Data truncated for column 'c6' at row 1
+Warning	1264	Out of range value adjusted for column 'c1' at row 1
+Warning	1264	Out of range value adjusted for column 'c2' at row 1
+Warning	1264	Out of range value adjusted for column 'c3' at row 1
+Warning	1264	Out of range value adjusted for column 'c4' at row 1
+Warning	1264	Out of range value adjusted for column 'c5' at row 1
+Warning	1264	Out of range value adjusted for column 'c6' at row 1
 Warning	1264	Out of range value adjusted for column 'c7' at row 1
 Warning	1264	Out of range value adjusted for column 'c12' at row 1
 execute my_select ;
-c1	1
-c2	1
-c3	1
-c4	1
-c5	1
-c6	1
+c1	127
+c2	32767
+c3	8388607
+c4	2147483647
+c5	2147483647
+c6	9223372036854775807
 c7	3.40282e+38
 c8	1.11111111111111e+50
 c9	1.11111111111111e+50
@@ -2722,21 +2722,21 @@ set @arg00= '-1.11111111111111111111e+50
 execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
 @arg00, @arg00, @arg00, @arg00, @arg00 ;
 Warnings:
-Warning	1265	Data truncated for column 'c1' at row 1
-Warning	1265	Data truncated for column 'c2' at row 1
-Warning	1265	Data truncated for column 'c3' at row 1
-Warning	1265	Data truncated for column 'c4' at row 1
-Warning	1265	Data truncated for column 'c5' at row 1
-Warning	1265	Data truncated for column 'c6' at row 1
+Warning	1264	Out of range value adjusted for column 'c1' at row 1
+Warning	1264	Out of range value adjusted for column 'c2' at row 1
+Warning	1264	Out of range value adjusted for column 'c3' at row 1
+Warning	1264	Out of range value adjusted for column 'c4' at row 1
+Warning	1264	Out of range value adjusted for column 'c5' at row 1
+Warning	1264	Out of range value adjusted for column 'c6' at row 1
 Warning	1264	Out of range value adjusted for column 'c7' at row 1
 Warning	1264	Out of range value adjusted for column 'c12' at row 1
 execute my_select ;
-c1	-1
-c2	-1
-c3	-1
-c4	-1
-c5	-1
-c6	-1
+c1	-128
+c2	-32768
+c3	-8388608
+c4	-2147483648
+c5	-2147483648
+c6	-9223372036854775808
 c7	-3.40282e+38
 c8	-1.11111111111111e+50
 c9	-1.11111111111111e+50

--- 1.39/mysql-test/r/ps_4heap.result	2006-05-13 13:11:36 +05:00
+++ 1.40/mysql-test/r/ps_4heap.result	2006-06-05 17:08:21 +05:00
@@ -2673,21 +2673,21 @@ set @arg00= '1.11111111111111111111e+50'
 execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
 @arg00, @arg00, @arg00, @arg00, @arg00 ;
 Warnings:
-Warning	1265	Data truncated for column 'c1' at row 1
-Warning	1265	Data truncated for column 'c2' at row 1
-Warning	1265	Data truncated for column 'c3' at row 1
-Warning	1265	Data truncated for column 'c4' at row 1
-Warning	1265	Data truncated for column 'c5' at row 1
-Warning	1265	Data truncated for column 'c6' at row 1
+Warning	1264	Out of range value adjusted for column 'c1' at row 1
+Warning	1264	Out of range value adjusted for column 'c2' at row 1
+Warning	1264	Out of range value adjusted for column 'c3' at row 1
+Warning	1264	Out of range value adjusted for column 'c4' at row 1
+Warning	1264	Out of range value adjusted for column 'c5' at row 1
+Warning	1264	Out of range value adjusted for column 'c6' at row 1
 Warning	1264	Out of range value adjusted for column 'c7' at row 1
 Warning	1264	Out of range value adjusted for column 'c12' at row 1
 execute my_select ;
-c1	1
-c2	1
-c3	1
-c4	1
-c5	1
-c6	1
+c1	127
+c2	32767
+c3	8388607
+c4	2147483647
+c5	2147483647
+c6	9223372036854775807
 c7	3.40282e+38
 c8	1.11111111111111e+50
 c9	1.11111111111111e+50
@@ -2723,21 +2723,21 @@ set @arg00= '-1.11111111111111111111e+50
 execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
 @arg00, @arg00, @arg00, @arg00, @arg00 ;
 Warnings:
-Warning	1265	Data truncated for column 'c1' at row 1
-Warning	1265	Data truncated for column 'c2' at row 1
-Warning	1265	Data truncated for column 'c3' at row 1
-Warning	1265	Data truncated for column 'c4' at row 1
-Warning	1265	Data truncated for column 'c5' at row 1
-Warning	1265	Data truncated for column 'c6' at row 1
+Warning	1264	Out of range value adjusted for column 'c1' at row 1
+Warning	1264	Out of range value adjusted for column 'c2' at row 1
+Warning	1264	Out of range value adjusted for column 'c3' at row 1
+Warning	1264	Out of range value adjusted for column 'c4' at row 1
+Warning	1264	Out of range value adjusted for column 'c5' at row 1
+Warning	1264	Out of range value adjusted for column 'c6' at row 1
 Warning	1264	Out of range value adjusted for column 'c7' at row 1
 Warning	1264	Out of range value adjusted for column 'c12' at row 1
 execute my_select ;
-c1	-1
-c2	-1
-c3	-1
-c4	-1
-c5	-1
-c6	-1
+c1	-128
+c2	-32768
+c3	-8388608
+c4	-2147483648
+c5	-2147483648
+c6	-9223372036854775808
 c7	-3.40282e+38
 c8	-1.11111111111111e+50
 c9	-1.11111111111111e+50

--- 1.40/mysql-test/r/ps_5merge.result	2006-05-13 13:11:36 +05:00
+++ 1.41/mysql-test/r/ps_5merge.result	2006-06-05 17:08:21 +05:00
@@ -2609,21 +2609,21 @@ set @arg00= '1.11111111111111111111e+50'
 execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
 @arg00, @arg00, @arg00, @arg00, @arg00 ;
 Warnings:
-Warning	1265	Data truncated for column 'c1' at row 1
-Warning	1265	Data truncated for column 'c2' at row 1
-Warning	1265	Data truncated for column 'c3' at row 1
-Warning	1265	Data truncated for column 'c4' at row 1
-Warning	1265	Data truncated for column 'c5' at row 1
-Warning	1265	Data truncated for column 'c6' at row 1
+Warning	1264	Out of range value adjusted for column 'c1' at row 1
+Warning	1264	Out of range value adjusted for column 'c2' at row 1
+Warning	1264	Out of range value adjusted for column 'c3' at row 1
+Warning	1264	Out of range value adjusted for column 'c4' at row 1
+Warning	1264	Out of range value adjusted for column 'c5' at row 1
+Warning	1264	Out of range value adjusted for column 'c6' at row 1
 Warning	1264	Out of range value adjusted for column 'c7' at row 1
 Warning	1264	Out of range value adjusted for column 'c12' at row 1
 execute my_select ;
-c1	1
-c2	1
-c3	1
-c4	1
-c5	1
-c6	1
+c1	127
+c2	32767
+c3	8388607
+c4	2147483647
+c5	2147483647
+c6	9223372036854775807
 c7	3.40282e+38
 c8	1.11111111111111e+50
 c9	1.11111111111111e+50
@@ -2659,21 +2659,21 @@ set @arg00= '-1.11111111111111111111e+50
 execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
 @arg00, @arg00, @arg00, @arg00, @arg00 ;
 Warnings:
-Warning	1265	Data truncated for column 'c1' at row 1
-Warning	1265	Data truncated for column 'c2' at row 1
-Warning	1265	Data truncated for column 'c3' at row 1
-Warning	1265	Data truncated for column 'c4' at row 1
-Warning	1265	Data truncated for column 'c5' at row 1
-Warning	1265	Data truncated for column 'c6' at row 1
+Warning	1264	Out of range value adjusted for column 'c1' at row 1
+Warning	1264	Out of range value adjusted for column 'c2' at row 1
+Warning	1264	Out of range value adjusted for column 'c3' at row 1
+Warning	1264	Out of range value adjusted for column 'c4' at row 1
+Warning	1264	Out of range value adjusted for column 'c5' at row 1
+Warning	1264	Out of range value adjusted for column 'c6' at row 1
 Warning	1264	Out of range value adjusted for column 'c7' at row 1
 Warning	1264	Out of range value adjusted for column 'c12' at row 1
 execute my_select ;
-c1	-1
-c2	-1
-c3	-1
-c4	-1
-c5	-1
-c6	-1
+c1	-128
+c2	-32768
+c3	-8388608
+c4	-2147483648
+c5	-2147483648
+c6	-9223372036854775808
 c7	-3.40282e+38
 c8	-1.11111111111111e+50
 c9	-1.11111111111111e+50
@@ -5623,21 +5623,21 @@ set @arg00= '1.11111111111111111111e+50'
 execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
 @arg00, @arg00, @arg00, @arg00, @arg00 ;
 Warnings:
-Warning	1265	Data truncated for column 'c1' at row 1
-Warning	1265	Data truncated for column 'c2' at row 1
-Warning	1265	Data truncated for column 'c3' at row 1
-Warning	1265	Data truncated for column 'c4' at row 1
-Warning	1265	Data truncated for column 'c5' at row 1
-Warning	1265	Data truncated for column 'c6' at row 1
+Warning	1264	Out of range value adjusted for column 'c1' at row 1
+Warning	1264	Out of range value adjusted for column 'c2' at row 1
+Warning	1264	Out of range value adjusted for column 'c3' at row 1
+Warning	1264	Out of range value adjusted for column 'c4' at row 1
+Warning	1264	Out of range value adjusted for column 'c5' at row 1
+Warning	1264	Out of range value adjusted for column 'c6' at row 1
 Warning	1264	Out of range value adjusted for column 'c7' at row 1
 Warning	1264	Out of range value adjusted for column 'c12' at row 1
 execute my_select ;
-c1	1
-c2	1
-c3	1
-c4	1
-c5	1
-c6	1
+c1	127
+c2	32767
+c3	8388607
+c4	2147483647
+c5	2147483647
+c6	9223372036854775807
 c7	3.40282e+38
 c8	1.11111111111111e+50
 c9	1.11111111111111e+50
@@ -5673,21 +5673,21 @@ set @arg00= '-1.11111111111111111111e+50
 execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
 @arg00, @arg00, @arg00, @arg00, @arg00 ;
 Warnings:
-Warning	1265	Data truncated for column 'c1' at row 1
-Warning	1265	Data truncated for column 'c2' at row 1
-Warning	1265	Data truncated for column 'c3' at row 1
-Warning	1265	Data truncated for column 'c4' at row 1
-Warning	1265	Data truncated for column 'c5' at row 1
-Warning	1265	Data truncated for column 'c6' at row 1
+Warning	1264	Out of range value adjusted for column 'c1' at row 1
+Warning	1264	Out of range value adjusted for column 'c2' at row 1
+Warning	1264	Out of range value adjusted for column 'c3' at row 1
+Warning	1264	Out of range value adjusted for column 'c4' at row 1
+Warning	1264	Out of range value adjusted for column 'c5' at row 1
+Warning	1264	Out of range value adjusted for column 'c6' at row 1
 Warning	1264	Out of range value adjusted for column 'c7' at row 1
 Warning	1264	Out of range value adjusted for column 'c12' at row 1
 execute my_select ;
-c1	-1
-c2	-1
-c3	-1
-c4	-1
-c5	-1
-c6	-1
+c1	-128
+c2	-32768
+c3	-8388608
+c4	-2147483648
+c5	-2147483648
+c6	-9223372036854775808
 c7	-3.40282e+38
 c8	-1.11111111111111e+50
 c9	-1.11111111111111e+50

--- 1.42/mysql-test/r/ps_6bdb.result	2006-05-13 13:11:37 +05:00
+++ 1.43/mysql-test/r/ps_6bdb.result	2006-06-05 17:08:21 +05:00
@@ -2672,21 +2672,21 @@ set @arg00= '1.11111111111111111111e+50'
 execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
 @arg00, @arg00, @arg00, @arg00, @arg00 ;
 Warnings:
-Warning	1265	Data truncated for column 'c1' at row 1
-Warning	1265	Data truncated for column 'c2' at row 1
-Warning	1265	Data truncated for column 'c3' at row 1
-Warning	1265	Data truncated for column 'c4' at row 1
-Warning	1265	Data truncated for column 'c5' at row 1
-Warning	1265	Data truncated for column 'c6' at row 1
+Warning	1264	Out of range value adjusted for column 'c1' at row 1
+Warning	1264	Out of range value adjusted for column 'c2' at row 1
+Warning	1264	Out of range value adjusted for column 'c3' at row 1
+Warning	1264	Out of range value adjusted for column 'c4' at row 1
+Warning	1264	Out of range value adjusted for column 'c5' at row 1
+Warning	1264	Out of range value adjusted for column 'c6' at row 1
 Warning	1264	Out of range value adjusted for column 'c7' at row 1
 Warning	1264	Out of range value adjusted for column 'c12' at row 1
 execute my_select ;
-c1	1
-c2	1
-c3	1
-c4	1
-c5	1
-c6	1
+c1	127
+c2	32767
+c3	8388607
+c4	2147483647
+c5	2147483647
+c6	9223372036854775807
 c7	3.40282e+38
 c8	1.11111111111111e+50
 c9	1.11111111111111e+50
@@ -2722,21 +2722,21 @@ set @arg00= '-1.11111111111111111111e+50
 execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
 @arg00, @arg00, @arg00, @arg00, @arg00 ;
 Warnings:
-Warning	1265	Data truncated for column 'c1' at row 1
-Warning	1265	Data truncated for column 'c2' at row 1
-Warning	1265	Data truncated for column 'c3' at row 1
-Warning	1265	Data truncated for column 'c4' at row 1
-Warning	1265	Data truncated for column 'c5' at row 1
-Warning	1265	Data truncated for column 'c6' at row 1
+Warning	1264	Out of range value adjusted for column 'c1' at row 1
+Warning	1264	Out of range value adjusted for column 'c2' at row 1
+Warning	1264	Out of range value adjusted for column 'c3' at row 1
+Warning	1264	Out of range value adjusted for column 'c4' at row 1
+Warning	1264	Out of range value adjusted for column 'c5' at row 1
+Warning	1264	Out of range value adjusted for column 'c6' at row 1
 Warning	1264	Out of range value adjusted for column 'c7' at row 1
 Warning	1264	Out of range value adjusted for column 'c12' at row 1
 execute my_select ;
-c1	-1
-c2	-1
-c3	-1
-c4	-1
-c5	-1
-c6	-1
+c1	-128
+c2	-32768
+c3	-8388608
+c4	-2147483648
+c5	-2147483648
+c6	-9223372036854775808
 c7	-3.40282e+38
 c8	-1.11111111111111e+50
 c9	-1.11111111111111e+50

--- 1.5/mysql-test/r/rpl_rewrite_db.result	2006-01-24 11:30:47 +04:00
+++ 1.6/mysql-test/r/rpl_rewrite_db.result	2006-06-05 17:08:21 +05:00
@@ -67,9 +67,9 @@ drop table t1;
 create table t1 (a int, b char(10));
 load data infile '../std_data_ln/loaddata3.dat' into table t1 fields terminated by ''
enclosed by '' ignore 1 lines;
 Warnings:
-Warning	1264	Out of range value adjusted for column 'a' at row 3
+Warning	1366	Incorrect integer value: 'error      ' for column 'a' at row 3
 Warning	1262	Row 3 was truncated; it contained more data than there were input columns
-Warning	1264	Out of range value adjusted for column 'a' at row 5
+Warning	1366	Incorrect integer value: 'wrong end  ' for column 'a' at row 5
 Warning	1262	Row 5 was truncated; it contained more data than there were input columns
 select * from rewrite.t1;
 a	b
@@ -81,7 +81,8 @@ a	b
 truncate table t1;
 load data infile '../std_data_ln/loaddata4.dat' into table t1 fields terminated by ''
enclosed by '' lines terminated by '' ignore 1 lines;
 Warnings:
-Warning	1264	Out of range value adjusted for column 'a' at row 4
+Warning	1366	Incorrect integer value: '
+' for column 'a' at row 4
 Warning	1261	Row 4 doesn't contain data for all columns
 select * from rewrite.t1;
 a	b

--- 1.26/mysql-test/r/strict.result	2006-05-23 13:27:39 +05:00
+++ 1.27/mysql-test/r/strict.result	2006-06-05 17:08:22 +05:00
@@ -611,9 +611,9 @@ ERROR 22012: Division by 0
 UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0;
 ERROR 22012: Division by 0
 INSERT INTO t1 (col1) VALUES ('');
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR HY000: Incorrect integer value: '' for column 'col1' at row 1
 INSERT INTO t1 (col1) VALUES ('a59b');
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR HY000: Incorrect integer value: 'a59b' for column 'col1' at row 1
 INSERT INTO t1 (col1) VALUES ('1a');
 ERROR 01000: Data truncated for column 'col1' at row 1
 INSERT IGNORE INTO t1 (col1) VALUES ('2a');
@@ -693,9 +693,9 @@ ERROR 22012: Division by 0
 UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0;
 ERROR 22012: Division by 0
 INSERT INTO t1 (col1) VALUES ('');
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR HY000: Incorrect integer value: '' for column 'col1' at row 1
 INSERT INTO t1 (col1) VALUES ('a59b');
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR HY000: Incorrect integer value: 'a59b' for column 'col1' at row 1
 INSERT INTO t1 (col1) VALUES ('1a');
 ERROR 01000: Data truncated for column 'col1' at row 1
 INSERT IGNORE INTO t1 (col1) VALUES ('2a');

--- 1.20/mysql-test/t/strict.test	2006-05-23 13:27:39 +05:00
+++ 1.21/mysql-test/t/strict.test	2006-06-05 17:08:22 +05:00
@@ -635,9 +635,9 @@ UPDATE t1 SET col2 =col2 + 50 WHERE col2
 UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0;
 --error 1365
 UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0;
---error 1264
+--error 1366
 INSERT INTO t1 (col1) VALUES ('');
---error 1264
+--error 1366
 INSERT INTO t1 (col1) VALUES ('a59b');
 --error 1265
 INSERT INTO t1 (col1) VALUES ('1a');
@@ -696,9 +696,9 @@ INSERT INTO t1 (col2) VALUES(18446744073
 UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0;
 --error 1365
 UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0;
---error 1264
+--error 1366
 INSERT INTO t1 (col1) VALUES ('');
---error 1264
+--error 1366
 INSERT INTO t1 (col1) VALUES ('a59b');
 --error 1265
 INSERT INTO t1 (col1) VALUES ('1a');

--- 1.23/mysql-test/r/loaddata.result	2006-03-29 20:56:07 +05:00
+++ 1.24/mysql-test/r/loaddata.result	2006-06-05 17:08:21 +05:00
@@ -43,9 +43,9 @@ drop table t1;
 create table t1 (a int, b char(10));
 load data infile '../std_data_ln/loaddata3.dat' into table t1 fields terminated by ''
enclosed by '' ignore 1 lines;
 Warnings:
-Warning	1264	Out of range value adjusted for column 'a' at row 3
+Warning	1366	Incorrect integer value: 'error      ' for column 'a' at row 3
 Warning	1262	Row 3 was truncated; it contained more data than there were input columns
-Warning	1264	Out of range value adjusted for column 'a' at row 5
+Warning	1366	Incorrect integer value: 'wrong end  ' for column 'a' at row 5
 Warning	1262	Row 5 was truncated; it contained more data than there were input columns
 select * from t1;
 a	b
@@ -57,7 +57,8 @@ a	b
 truncate table t1;
 load data infile '../std_data_ln/loaddata4.dat' into table t1 fields terminated by ''
enclosed by '' lines terminated by '' ignore 1 lines;
 Warnings:
-Warning	1264	Out of range value adjusted for column 'a' at row 4
+Warning	1366	Incorrect integer value: '
+' for column 'a' at row 4
 Warning	1261	Row 4 doesn't contain data for all columns
 select * from t1;
 a	b

--- 1.35/mysql-test/r/warnings.result	2006-01-24 11:30:47 +04:00
+++ 1.36/mysql-test/r/warnings.result	2006-06-05 17:08:22 +05:00
@@ -31,19 +31,19 @@ Error	1064	You have an error in your SQL
 insert into t1 values (1);
 insert into t1 values ("hej");
 Warnings:
-Warning	1264	Out of range value adjusted for column 'a' at row 1
+Warning	1366	Incorrect integer value: 'hej' for column 'a' at row 1
 insert into t1 values ("hej"),("då");
 Warnings:
-Warning	1264	Out of range value adjusted for column 'a' at row 1
-Warning	1264	Out of range value adjusted for column 'a' at row 2
+Warning	1366	Incorrect integer value: 'hej' for column 'a' at row 1
+Warning	1366	Incorrect integer value: 'd?' for column 'a' at row 2
 set SQL_WARNINGS=1;
 insert into t1 values ("hej");
 Warnings:
-Warning	1264	Out of range value adjusted for column 'a' at row 1
+Warning	1366	Incorrect integer value: 'hej' for column 'a' at row 1
 insert into t1 values ("hej"),("då");
 Warnings:
-Warning	1264	Out of range value adjusted for column 'a' at row 1
-Warning	1264	Out of range value adjusted for column 'a' at row 2
+Warning	1366	Incorrect integer value: 'hej' for column 'a' at row 1
+Warning	1366	Incorrect integer value: 'd?' for column 'a' at row 2
 drop table t1;
 set SQL_WARNINGS=0;
 drop temporary table if exists not_exists;
@@ -187,44 +187,44 @@ create table t1 (a int);
 insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
 update t1 set a='abc';
 Warnings:
-Warning	1264	Out of range value adjusted for column 'a' at row 1
-Warning	1264	Out of range value adjusted for column 'a' at row 2
-Warning	1264	Out of range value adjusted for column 'a' at row 3
-Warning	1264	Out of range value adjusted for column 'a' at row 4
-Warning	1264	Out of range value adjusted for column 'a' at row 5
-Warning	1264	Out of range value adjusted for column 'a' at row 6
-Warning	1264	Out of range value adjusted for column 'a' at row 7
-Warning	1264	Out of range value adjusted for column 'a' at row 8
-Warning	1264	Out of range value adjusted for column 'a' at row 9
-Warning	1264	Out of range value adjusted for column 'a' at row 10
+Warning	1366	Incorrect integer value: 'abc' for column 'a' at row 1
+Warning	1366	Incorrect integer value: 'abc' for column 'a' at row 2
+Warning	1366	Incorrect integer value: 'abc' for column 'a' at row 3
+Warning	1366	Incorrect integer value: 'abc' for column 'a' at row 4
+Warning	1366	Incorrect integer value: 'abc' for column 'a' at row 5
+Warning	1366	Incorrect integer value: 'abc' for column 'a' at row 6
+Warning	1366	Incorrect integer value: 'abc' for column 'a' at row 7
+Warning	1366	Incorrect integer value: 'abc' for column 'a' at row 8
+Warning	1366	Incorrect integer value: 'abc' for column 'a' at row 9
+Warning	1366	Incorrect integer value: 'abc' for column 'a' at row 10
 show warnings limit 2, 1;
 Level	Code	Message
-Warning	1264	Out of range value adjusted for column 'a' at row 3
+Warning	1366	Incorrect integer value: 'abc' for column 'a' at row 3
 show warnings limit 0, 10;
 Level	Code	Message
-Warning	1264	Out of range value adjusted for column 'a' at row 1
-Warning	1264	Out of range value adjusted for column 'a' at row 2
-Warning	1264	Out of range value adjusted for column 'a' at row 3
-Warning	1264	Out of range value adjusted for column 'a' at row 4
-Warning	1264	Out of range value adjusted for column 'a' at row 5
-Warning	1264	Out of range value adjusted for column 'a' at row 6
-Warning	1264	Out of range value adjusted for column 'a' at row 7
-Warning	1264	Out of range value adjusted for column 'a' at row 8
-Warning	1264	Out of range value adjusted for column 'a' at row 9
-Warning	1264	Out of range value adjusted for column 'a' at row 10
+Warning	1366	Incorrect integer value: 'abc' for column 'a' at row 1
+Warning	1366	Incorrect integer value: 'abc' for column 'a' at row 2
+Warning	1366	Incorrect integer value: 'abc' for column 'a' at row 3
+Warning	1366	Incorrect integer value: 'abc' for column 'a' at row 4
+Warning	1366	Incorrect integer value: 'abc' for column 'a' at row 5
+Warning	1366	Incorrect integer value: 'abc' for column 'a' at row 6
+Warning	1366	Incorrect integer value: 'abc' for column 'a' at row 7
+Warning	1366	Incorrect integer value: 'abc' for column 'a' at row 8
+Warning	1366	Incorrect integer value: 'abc' for column 'a' at row 9
+Warning	1366	Incorrect integer value: 'abc' for column 'a' at row 10
 show warnings limit 9, 1;
 Level	Code	Message
-Warning	1264	Out of range value adjusted for column 'a' at row 10
+Warning	1366	Incorrect integer value: 'abc' for column 'a' at row 10
 show warnings limit 10, 1;
 Level	Code	Message
 show warnings limit 9, 2;
 Level	Code	Message
-Warning	1264	Out of range value adjusted for column 'a' at row 10
+Warning	1366	Incorrect integer value: 'abc' for column 'a' at row 10
 show warnings limit 0, 0;
 Level	Code	Message
 show warnings limit 1;
 Level	Code	Message
-Warning	1264	Out of range value adjusted for column 'a' at row 1
+Warning	1366	Incorrect integer value: 'abc' for column 'a' at row 1
 show warnings limit 0;
 Level	Code	Message
 show warnings limit 1, 0;

--- 1.12/strings/ctype-cp932.c	2006-03-23 14:03:32 +04:00
+++ 1.13/strings/ctype-cp932.c	2006-06-05 17:08:22 +05:00
@@ -5492,6 +5492,7 @@ static MY_CHARSET_HANDLER my_charset_han
   my_strntoull_8bit,
   my_strntod_8bit,
   my_strtoll10_8bit,
+  my_strntoull10rnd_8bit,
   my_scan_8bit
 };
 

--- 1.13/strings/ctype-eucjpms.c	2006-03-23 14:03:32 +04:00
+++ 1.14/strings/ctype-eucjpms.c	2006-06-05 17:08:22 +05:00
@@ -8677,6 +8677,7 @@ static MY_CHARSET_HANDLER my_charset_han
     my_strntoull_8bit,
     my_strntod_8bit,
     my_strtoll10_8bit,
+    my_strntoull10rnd_8bit,
     my_scan_8bit
 };
 
Thread
bk commit into 5.0 tree (bar:1.2168) BUG#6147bar5 Jun