List:Commits« Previous MessageNext Message »
From:Mikael Ronstrom Date:October 30 2009 9:11pm
Subject:bzr commit into mysql-6.0-codebase branch (mikael:3654)
View as plain text  
#At file:///home/mikael/mysql_clones/mysql-6.0-codebase-wl3352/

 3654 Mikael Ronstrom	2009-10-30 [merge]
      Merge
      modified:
        mysql-test/r/partition_column.result
        sql/sql_partition.cc

=== modified file 'mysql-test/r/partition_column.result'
--- a/mysql-test/r/partition_column.result	2009-10-29 17:04:23 +0000
+++ b/mysql-test/r/partition_column.result	2009-10-30 16:34:11 +0000
@@ -34,8 +34,8 @@ t1	CREATE TABLE `t1` (
   `a` varchar(2) CHARACTER SET ucs2 DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 /*!50100 PARTITION BY LIST  COLUMNS(a)
-(PARTITION p0 VALUES IN (_ucs2'  ') ENGINE = MyISAM,
- PARTITION p1 VALUES IN (_ucs2'') ENGINE = MyISAM) */
+(PARTITION p0 VALUES IN (_ucs2 0x2020) ENGINE = MyISAM,
+ PARTITION p1 VALUES IN (_ucs2 '') ENGINE = MyISAM) */
 insert into t1 values ('');
 insert into t1 values (_ucs2 0x2020);
 drop table t1;
@@ -77,9 +77,9 @@ t1	CREATE TABLE `t1` (
 /*!50100 PARTITION BY RANGE  COLUMNS(a,b,c,d)
 SUBPARTITION BY HASH (to_seconds(d))
 SUBPARTITIONS 4
-(PARTITION p0 VALUES LESS THAN (1,_latin1'0',MAXVALUE,'1900-01-01') ENGINE = MyISAM,
- PARTITION p1 VALUES LESS THAN (1,_latin1'a',MAXVALUE,'1999-01-01') ENGINE = MyISAM,
- PARTITION p2 VALUES LESS THAN (1,_latin1'a',MAXVALUE,MAXVALUE) ENGINE = MyISAM,
+(PARTITION p0 VALUES LESS THAN (1,_latin1 0x30,MAXVALUE,'1900-01-01') ENGINE = MyISAM,
+ PARTITION p1 VALUES LESS THAN (1,_latin1 0x61,MAXVALUE,'1999-01-01') ENGINE = MyISAM,
+ PARTITION p2 VALUES LESS THAN (1,_latin1 0x61,MAXVALUE,MAXVALUE) ENGINE = MyISAM,
  PARTITION p3 VALUES LESS THAN (1,MAXVALUE,MAXVALUE,MAXVALUE) ENGINE = MyISAM) */
 drop table t1;
 create table t1 (a int, b int)
@@ -298,10 +298,10 @@ t1	CREATE TABLE `t1` (
 /*!50100 PARTITION BY RANGE  COLUMNS(a,b,c)
 SUBPARTITION BY KEY (c,d)
 SUBPARTITIONS 3
-(PARTITION p0 VALUES LESS THAN (1,_latin1'abc',_latin1'abc') ENGINE = MyISAM,
- PARTITION p1 VALUES LESS THAN (2,_latin1'abc',_latin1'abc') ENGINE = MyISAM,
- PARTITION p2 VALUES LESS THAN (3,_latin1'abc',_latin1'abc') ENGINE = MyISAM,
- PARTITION p3 VALUES LESS THAN (4,_latin1'abc',_latin1'abc') ENGINE = MyISAM) */
+(PARTITION p0 VALUES LESS THAN (1,_latin1 0x616263,_latin1 0x616263) ENGINE = MyISAM,
+ PARTITION p1 VALUES LESS THAN (2,_latin1 0x616263,_latin1 0x616263) ENGINE = MyISAM,
+ PARTITION p2 VALUES LESS THAN (3,_latin1 0x616263,_latin1 0x616263) ENGINE = MyISAM,
+ PARTITION p3 VALUES LESS THAN (4,_latin1 0x616263,_latin1 0x616263) ENGINE = MyISAM) */
 insert into t1 values (1,'a','b',1),(2,'a','b',2),(3,'a','b',3);
 insert into t1 values (1,'b','c',1),(2,'b','c',2),(3,'b','c',3);
 insert into t1 values (1,'c','d',1),(2,'c','d',2),(3,'c','d',3);
@@ -329,8 +329,8 @@ t1	CREATE TABLE `t1` (
   `c` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 /*!50100 PARTITION BY RANGE  COLUMNS(a,b,c)
-(PARTITION p0 VALUES LESS THAN (1,_latin1'A',1) ENGINE = MyISAM,
- PARTITION p1 VALUES LESS THAN (1,_latin1'B',1) ENGINE = MyISAM) */
+(PARTITION p0 VALUES LESS THAN (1,_latin1 0x41,1) ENGINE = MyISAM,
+ PARTITION p1 VALUES LESS THAN (1,_latin1 0x42,1) ENGINE = MyISAM) */
 insert into t1 values (1, 'A', 1);
 explain partitions select * from t1 where a = 1 AND b <= 'A' and c = 1;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra

=== modified file 'sql/sql_partition.cc'
--- a/sql/sql_partition.cc	2009-10-30 16:34:50 +0000
+++ b/sql/sql_partition.cc	2009-10-30 20:11:25 +0000
@@ -1861,6 +1861,46 @@ static int add_write(File fptr, const ch
     return 1;
 }
 
+static int add_string(File fptr, const char *string);
+
+static int write_hex_char(File fptr, uint number)
+{
+  char buf[2];
+  char c= '0';
+  /* Write number between 0 and 15 as 0-9,A-F */
+  if (number < 10)
+    c+= number;
+  else
+  {
+    c= 'A';
+    c+= (number - 10);
+  }
+  buf[0]= c;
+  buf[1]= 0;
+  return add_string(fptr, (const char*)buf);
+}
+
+static int add_hex_string_object(File fptr, String *string)
+{
+  uint len= string->length();
+  uint i;
+  const char *ptr= string->ptr();
+  char c;
+  int err;
+  uint low, high;
+  err= add_string(fptr, "0x");
+  for (i= 0; i < len; i++)
+  {
+    c= *ptr;
+    ptr++;
+    high= c >> 4;
+    low= c & 15;
+    err+= write_hex_char(fptr, high);
+    err+= write_hex_char(fptr, low);
+  }
+  return err;
+}
+
 static int add_string_object(File fptr, String *string)
 {
   return add_write(fptr, string->ptr(), string->length());
@@ -2252,10 +2292,24 @@ static int add_column_list_values(File f
           {
             err+= add_string(fptr,"_");
             err+= add_string(fptr, field_cs->csname);
+            err+= add_space(fptr);
+            if (res->length())
+            {
+              err+= add_hex_string_object(fptr, res);
+            }
+            else
+            {
+              err+= add_string(fptr,"'");
+              err+= add_string(fptr,"'");
+            }
+
+          }
+          else
+          {
+            err+= add_string(fptr,"'");
+            err+= add_string_object(fptr, res);
+            err+= add_string(fptr,"'");
           }
-          err+= add_string(fptr,"'");
-          err+= add_string_object(fptr, res);
-          err+= add_string(fptr,"'");
         }
       }
     }

Thread
bzr commit into mysql-6.0-codebase branch (mikael:3654) Mikael Ronstrom30 Oct