List:Commits« Previous MessageNext Message »
From:ramil Date:January 18 2007 7:13am
Subject:bk commit into 5.1 tree (ramil:1.2400)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of ram. When ram 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@stripped, 2007-01-18 11:13:13+04:00, ramil@stripped +4 -0
  Merge mysql.com:/usr/home/ram/work/bug22533/my50-bug22533
  into  mysql.com:/usr/home/ram/work/bug22533/my51-bug22533
  MERGE: 1.1810.2320.21

  mysql-test/r/select.result@stripped, 2007-01-18 11:13:05+04:00, ramil@stripped +6 -6
    merging
    MERGE: 1.121.1.24

  mysql-test/t/range.test@stripped, 2007-01-18 11:04:48+04:00, ramil@stripped +0 -0
    Auto merged
    MERGE: 1.37.1.7

  mysql-test/t/select.test@stripped, 2007-01-18 11:13:05+04:00, ramil@stripped +0 -0
    merging
    MERGE: 1.102.1.15

  sql/item.cc@stripped, 2007-01-18 11:04:48+04:00, ramil@stripped +0 -0
    Auto merged
    MERGE: 1.113.54.3

# 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:	ramil
# Host:	myoffice.izhnet.ru
# Root:	/usr/home/ram/work/bug22533/my51-bug22533/RESYNC

--- 1.218/sql/item.cc	2007-01-18 11:13:24 +04:00
+++ 1.219/sql/item.cc	2007-01-18 11:13:24 +04:00
@@ -4547,18 +4547,31 @@ my_decimal *Item_hex_string::val_decimal
 
 int Item_hex_string::save_in_field(Field *field, bool no_conversions)
 {
-  int error;
   field->set_notnull();
   if (field->result_type() == STRING_RESULT)
+    return field->store(str_value.ptr(), str_value.length(), 
+                        collation.collation);
+
+  ulonglong nr;
+  uint32 length= str_value.length();
+  if (length > 8)
   {
-    error=field->store(str_value.ptr(),str_value.length(),collation.collation);
+    nr= field->flags & UNSIGNED_FLAG ? ULONGLONG_MAX : LONGLONG_MAX;
+    goto warn;
   }
-  else
+  nr= (ulonglong) val_int();
+  if ((length == 8) && !(field->flags & UNSIGNED_FLAG) && (nr > LONGLONG_MAX))
   {
-    longlong nr=val_int();
-    error=field->store(nr, TRUE);    // Assume hex numbers are unsigned
+    nr= LONGLONG_MAX;
+    goto warn;
   }
-  return error;
+  return field->store((longlong) nr, TRUE);  // Assume hex numbers are unsigned
+
+warn:
+  if (!field->store((longlong) nr, TRUE))
+    field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE,
+                       1);
+  return 1;
 }
 
 

--- 1.138/mysql-test/r/select.result	2007-01-18 11:13:24 +04:00
+++ 1.139/mysql-test/r/select.result	2007-01-18 11:13:24 +04:00
@@ -2811,6 +2811,23 @@ SELECT i='1e+01',i=1e+01, i in (1e+01,1e
 i='1e+01'	i=1e+01	i in (1e+01,1e+01)	i in ('1e+01','1e+01')
 1	1	1	1
 DROP TABLE t1;
+create table t1(a bigint unsigned, b bigint);
+insert into t1 values (0xfffffffffffffffff, 0xfffffffffffffffff), 
+(0x10000000000000000, 0x10000000000000000), 
+(0x8fffffffffffffff, 0x8fffffffffffffff);
+Warnings:
+Warning	1264	Out of range value adjusted for column 'a' at row 1
+Warning	1264	Out of range value adjusted for column 'b' 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 'b' at row 2
+Warning	1264	Out of range value adjusted for column 'b' at row 3
+select hex(a), hex(b) from t1;
+hex(a)	hex(b)
+FFFFFFFFFFFFFFFF	7FFFFFFFFFFFFFFF
+FFFFFFFFFFFFFFFF	7FFFFFFFFFFFFFFF
+8FFFFFFFFFFFFFFF	7FFFFFFFFFFFFFFF
+drop table t1;
+End of 4.1 tests
 CREATE TABLE t1 ( 
 K2C4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '', 
 K4N4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '0000', 

--- 1.43/mysql-test/t/range.test	2007-01-18 11:13:24 +04:00
+++ 1.44/mysql-test/t/range.test	2007-01-18 11:13:24 +04:00
@@ -406,8 +406,8 @@ select count(*) from t1 where x = 184467
 
 
 create table t2 (x bigint not null);
-insert into t2(x) values (cast(0xfffffffffffffff0+0 as signed));
-insert into t2(x) values (cast(0xfffffffffffffff1+0 as signed));
+insert into t2(x) values (-16);
+insert into t2(x) values (-15);
 select * from t2;
 select count(*) from t2 where x>0;
 select count(*) from t2 where x=0;

--- 1.110/mysql-test/t/select.test	2007-01-18 11:13:24 +04:00
+++ 1.111/mysql-test/t/select.test	2007-01-18 11:13:24 +04:00
@@ -2350,7 +2350,18 @@ INSERT INTO t1 VALUES (10);
 SELECT i='1e+01',i=1e+01, i in (1e+01,1e+01), i in ('1e+01','1e+01') FROM t1;
 DROP TABLE t1;
 
-# End of 4.1 tests
+#
+# Bug #22533: storing large hex strings
+#
+
+create table t1(a bigint unsigned, b bigint);
+insert into t1 values (0xfffffffffffffffff, 0xfffffffffffffffff), 
+  (0x10000000000000000, 0x10000000000000000), 
+  (0x8fffffffffffffff, 0x8fffffffffffffff);
+select hex(a), hex(b) from t1;
+drop table t1;
+
+--echo End of 4.1 tests
 
 #
 # Test for bug #6474
Thread
bk commit into 5.1 tree (ramil:1.2400)ramil18 Jan