List:Commits« Previous MessageNext Message »
From:bar Date:March 31 2006 2:38pm
Subject:bk commit into 5.1 tree (bar:1.2273)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 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.2273 06/03/31 17:38:00 bar@stripped +2 -0
  Merge mysql.com:/usr/home/bar/mysql-5.0.1.2107.1.1
  into  mysql.com:/usr/home/bar/mysql-5.1-new

  sql/field.cc
    1.307 06/03/31 17:37:50 bar@stripped +0 -0
    Auto merged

  mysql-test/r/cast.result
    1.42 06/03/31 17:37:50 bar@stripped +0 -0
    Auto merged

# 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.1-new/RESYNC

--- 1.306/sql/field.cc	2006-03-31 02:34:02 +05:00
+++ 1.307/sql/field.cc	2006-03-31 17:37:50 +05:00
@@ -4237,6 +4237,7 @@ double Field_double::val_real(void)
 longlong Field_double::val_int(void)
 {
   double j;
+  longlong res;
 #ifdef WORDS_BIGENDIAN
   if (table->s->db_low_byte_first)
   {
@@ -4247,10 +4248,28 @@ longlong Field_double::val_int(void)
     doubleget(j,ptr);
   /* Check whether we fit into longlong range */
   if (j <= (double) LONGLONG_MIN)
-    return (longlong) LONGLONG_MIN;
+  {
+    res= (longlong) LONGLONG_MIN;
+    goto warn;
+  }
   if (j >= (double) (ulonglong) LONGLONG_MAX)
-    return (longlong) LONGLONG_MAX;
+  {
+    res= (longlong) LONGLONG_MAX;
+    goto warn;
+  }
   return (longlong) rint(j);
+
+warn:
+  {
+    char buf[DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE];
+    String tmp(buf, sizeof(buf), &my_charset_latin1), *str;
+    str= val_str(&tmp, 0);
+    push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+                        ER_TRUNCATED_WRONG_VALUE,
+                        ER(ER_TRUNCATED_WRONG_VALUE), "INTEGER",
+                        str->c_ptr());
+  }
+  return res;
 }
 
 

--- 1.41/mysql-test/r/cast.result	2006-03-28 18:23:36 +05:00
+++ 1.42/mysql-test/r/cast.result	2006-03-31 17:37:50 +05:00
@@ -344,6 +344,9 @@ SELECT f1 AS double_val, CAST(f1 AS SIGN
 double_val	cast_val
 -1e+30	-9223372036854775808
 1e+30	9223372036854775807
+Warnings:
+Warning	1292	Truncated incorrect INTEGER value: '-1e+30'
+Warning	1292	Truncated incorrect INTEGER value: '1e+30'
 DROP TABLE t1;
 select cast('1.2' as decimal(3,2));
 cast('1.2' as decimal(3,2))
Thread
bk commit into 5.1 tree (bar:1.2273)bar31 Mar