List:Commits« Previous MessageNext Message »
From:konstantin Date:February 23 2006 9:00pm
Subject:bk commit into 5.0 tree (konstantin:1.2077)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of kostja. When kostja 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.2077 06/02/24 00:00:15 konstantin@stripped +8 -0
  Merge mysql.com:/opt/local/work/mysql-4.1-13134
  into  mysql.com:/opt/local/work/mysql-5.0-runtime

  sql/sql_table.cc
    1.297 06/02/24 00:00:02 konstantin@stripped +2 -2
    Manual merge.

  sql/sql_parse.cc
    1.527 06/02/24 00:00:01 konstantin@stripped +1 -2
    Manual merge.

  sql/field.h
    1.172 06/02/24 00:00:01 konstantin@stripped +3 -3
    Manual merge.

  sql/field.cc
    1.298 06/02/24 00:00:01 konstantin@stripped +1 -1
    Manual merge.

  mysql-test/t/ps.test
    1.59 06/02/24 00:00:01 konstantin@stripped +21 -22
    Manual merge.

  mysql-test/r/ps.result
    1.60 06/02/24 00:00:01 konstantin@stripped +0 -14
    Manual merge (use local)

  mysql-test/r/heap.result
    1.47 06/02/24 00:00:01 konstantin@stripped +0 -2
    Manual merge (use local)

  mysql-test/t/heap.test
    1.33 06/02/23 23:47:51 konstantin@stripped +0 -2
    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:	konstantin
# Host:	dragonfly.local
# Root:	/opt/local/work/mysql-5.0-runtime/RESYNC

--- 1.297/sql/field.cc	2006-01-30 17:02:51 +03:00
+++ 1.298/sql/field.cc	2006-02-24 00:00:01 +03:00
@@ -8213,13 +8213,11 @@
     create_field::create_length_to_internal_length()
   
   DESCRIPTION
-    Convert create_field::length from number of characters to number of bytes,
-    save original value in chars_length.
+    Convert create_field::length from number of characters to number of bytes.
 */
 
 void create_field::create_length_to_internal_length(void)
 {
-  chars_length= length;
   switch (sql_type) {
   case MYSQL_TYPE_TINY_BLOB:
   case MYSQL_TYPE_MEDIUM_BLOB:
@@ -8937,6 +8935,7 @@
   else
     interval=0;
   def=0;
+  char_length= length;
 
   if (!(flags & (NO_DEFAULT_VALUE_FLAG | BLOB_FLAG)) &&
       old_field->ptr && orig_field &&

--- 1.171/sql/field.h	2006-01-03 20:04:31 +03:00
+++ 1.172/sql/field.h	2006-02-24 00:00:01 +03:00
@@ -1386,9 +1386,10 @@
   */
   ulong length;
   /*
-    The value of 'length' before a call to create_length_to_internal_length
+    The value of `length' as set by parser: is the number of characters
+    for most of the types, or of bytes for BLOBs or numeric types.
   */
-  uint32 chars_length;
+  uint32 char_length;
   uint  decimals, flags, pack_length, key_length;
   Field::utype unireg_check;
   TYPELIB *interval;			// Which interval to use

--- 1.526/sql/sql_parse.cc	2006-02-06 19:58:10 +03:00
+++ 1.527/sql/sql_parse.cc	2006-02-24 00:00:01 +03:00
@@ -5791,6 +5791,7 @@
                       interval_list, cs, uint_geom_type))
     DBUG_RETURN(1);
 
+  new_field->char_length= new_field->length;
   lex->create_list.push_back(new_field);
   lex->last_field=new_field;
   DBUG_RETURN(0);

--- 1.296/sql/sql_table.cc	2006-02-17 09:56:47 +03:00
+++ 1.297/sql/sql_table.cc	2006-02-24 00:00:02 +03:00
@@ -688,6 +688,12 @@
   {
     CHARSET_INFO *save_cs;
 
+    /*
+      Initialize length from its original value (number of characters),
+      which was set in the parser. This is necessary if we're
+      executing a prepared statement for the second time.
+    */
+    sql_field->length= sql_field->char_length;
     if (!sql_field->charset)
       sql_field->charset= create_info->default_table_charset;
     /*
@@ -872,7 +878,7 @@
 	  sql_field->charset=		(dup_field->charset ?
 					 dup_field->charset :
 					 create_info->default_table_charset);
-	  sql_field->length=		dup_field->chars_length;
+	  sql_field->length=		dup_field->char_length;
           sql_field->pack_length=	dup_field->pack_length;
           sql_field->key_length=	dup_field->key_length;
 	  sql_field->create_length_to_internal_length();

--- 1.58/mysql-test/t/ps.test	2006-01-17 01:17:54 +03:00
+++ 1.59/mysql-test/t/ps.test	2006-02-24 00:00:01 +03:00
@@ -900,6 +900,27 @@
 deallocate prepare stmt;
 drop table t1;
 
+#
+# Bug#13134 "Length of VARCHAR() utf8 column is increasing when table is
+# recreated with PS/SP"
+#
+
+prepare stmt from 'create table t1 (a varchar(10) character set utf8)';
+execute stmt;
+--disable_warnings
+insert into t1 (a) values (repeat('a', 20));
+--enable_warnings
+select length(a) from t1;
+drop table t1;
+execute stmt;
+--disable_warnings
+insert into t1 (a) values (repeat('a', 20));
+--enable_warnings
+# Check that the data is truncated to the same length
+select length(a) from t1;
+drop table t1;
+deallocate prepare stmt;
+
 # End of 4.1 tests
 
 #
Thread
bk commit into 5.0 tree (konstantin:1.2077)konstantin23 Feb