List:Commits« Previous MessageNext Message »
From:Sergey Vojtovich Date:April 24 2006 2:53pm
Subject:bk commit into 5.1 tree (svoj:1.2359)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of svoj. When svoj 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.2359 06/04/24 19:53:38 svoj@april.(none) +7 -0
  Merge april.(none):/home/svoj/devel/mysql/merge/mysql-5.0
  into  april.(none):/home/svoj/devel/mysql/merge/mysql-5.1-new

  storage/myisam/mi_packrec.c
    1.36 06/04/24 19:53:34 svoj@april.(none) +1 -11
    Manual merge: use local, since this fix should be moved into mi_dynmap_file().

  storage/myisam/mi_packrec.c
    1.30.3.2 06/04/24 19:51:16 svoj@april.(none) +0 -0
    Merge rename: myisam/mi_packrec.c -> storage/myisam/mi_packrec.c

  sql/mysqld.cc
    1.548 06/04/24 19:51:16 svoj@april.(none) +0 -0
    Auto merged

  sql/item_timefunc.h
    1.69 06/04/24 19:51:16 svoj@april.(none) +0 -0
    Auto merged

  sql/item_timefunc.cc
    1.113 06/04/24 19:51:16 svoj@april.(none) +0 -0
    Auto merged

  mysql-test/t/rpl_view-slave.opt
    1.3 06/04/24 19:51:16 svoj@april.(none) +0 -0
    Auto merged

  mysql-test/t/ctype_ucs.test
    1.41 06/04/24 19:51:16 svoj@april.(none) +0 -0
    Auto merged

  mysql-test/r/ctype_ucs.result
    1.45 06/04/24 19:51:16 svoj@april.(none) +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:	svoj
# Host:	april.(none)
# Root:	/home/svoj/devel/mysql/merge/mysql-5.1-new/RESYNC

--- 1.30.3.1/myisam/mi_packrec.c	2006-04-15 16:07:59 +05:00
+++ 1.36/storage/myisam/mi_packrec.c	2006-04-24 19:53:34 +05:00
@@ -1176,56 +1176,34 @@
 static int _mi_read_mempack_record(MI_INFO *info,my_off_t filepos,byte *buf);
 static int _mi_read_rnd_mempack_record(MI_INFO*, byte *,my_off_t, my_bool);
 
-#ifndef MAP_NORESERVE
-#define MAP_NORESERVE 0		/* For irix */
-#endif
-#ifndef MAP_FAILED
-#define MAP_FAILED -1
-#endif
-
 my_bool _mi_memmap_file(MI_INFO *info)
 {
   byte *file_map;
   MYISAM_SHARE *share=info->s;
   DBUG_ENTER("mi_memmap_file");
 
-  if (!share->file_map)
+  if (!info->s->file_map)
   {
-    my_off_t data_file_length= share->state.state.data_file_length;
-    if (data_file_length > (my_off_t) (~((size_t) 0)) - MEMMAP_EXTRA_MARGIN)
-    {
-      DBUG_PRINT("warning", ("File is too large for mmap"));
-      DBUG_RETURN(0);
-    }
     if (my_seek(info->dfile,0L,MY_SEEK_END,MYF(0)) <
-        data_file_length + MEMMAP_EXTRA_MARGIN)
+        share->state.state.data_file_length+MEMMAP_EXTRA_MARGIN)
     {
       DBUG_PRINT("warning",("File isn't extended for memmap"));
       DBUG_RETURN(0);
     }
-    file_map=(byte*)
-      my_mmap(0, (size_t) (data_file_length + MEMMAP_EXTRA_MARGIN), PROT_READ,
-              MAP_SHARED | MAP_NORESERVE, info->dfile, 0L);
-    if (file_map == (byte*) MAP_FAILED)
-    {
-      DBUG_PRINT("warning",("mmap failed: errno: %d",errno));
-      my_errno=errno;
+    if (mi_dynmap_file(info, share->state.state.data_file_length))
       DBUG_RETURN(0);
-    }
-    share->file_map= file_map;
   }
   info->opt_flag|= MEMMAP_USED;
-  info->read_record=share->read_record=_mi_read_mempack_record;
-  share->read_rnd=_mi_read_rnd_mempack_record;
+  info->read_record= share->read_record= _mi_read_mempack_record;
+  share->read_rnd= _mi_read_rnd_mempack_record;
   DBUG_RETURN(1);
 }
 
 
 void _mi_unmap_file(MI_INFO *info)
 {
-  VOID(my_munmap(info->s->file_map,
-	      (size_t) info->s->state.state.data_file_length+
-	      MEMMAP_EXTRA_MARGIN));
+  VOID(my_munmap(info->s->file_map, 
+                 (size_t) info->s->mmaped_length + MEMMAP_EXTRA_MARGIN));
 }
 
 

--- 1.112/sql/item_timefunc.cc	2006-04-18 04:40:08 +05:00
+++ 1.113/sql/item_timefunc.cc	2006-04-24 19:51:16 +05:00
@@ -2255,8 +2255,8 @@
     // Convert character set if differ
     uint dummy_errors;
     if (!(res= args[0]->val_str(&tmp_value)) ||
-	str->copy(res->ptr(), res->length(), res->charset(),
-                  cast_cs, &dummy_errors))
+        str->copy(res->ptr(), res->length(), from_cs,
+        cast_cs, &dummy_errors))
     {
       null_value= 1;
       return 0;
@@ -2311,21 +2311,40 @@
 void Item_char_typecast::fix_length_and_dec()
 {
   uint32 char_length;
-  /*
-    We always force character set conversion if cast_cs is a
-    multi-byte character set. It garantees that the result of CAST is
-    a well-formed string.  For single-byte character sets we allow
-    just to copy from the argument. A single-byte character sets
-    string is always well-formed.
+  /* 
+     We always force character set conversion if cast_cs
+     is a multi-byte character set. It garantees that the
+     result of CAST is a well-formed string.
+     For single-byte character sets we allow just to copy
+     from the argument. A single-byte character sets string
+     is always well-formed. 
+     
+     There is a special trick to convert form a number to ucs2.
+     As numbers have my_charset_bin as their character set,
+     it wouldn't do conversion to ucs2 without an additional action.
+     To force conversion, we should pretend to be non-binary.
+     Let's choose from_cs this way:
+     - If the argument in a number and cast_cs is ucs2 (i.e. mbminlen > 1),
+       then from_cs is set to latin1, to perform latin1 -> ucs2 conversion.
+     - If the argument is a number and cast_cs is ASCII-compatible
+       (i.e. mbminlen == 1), then from_cs is set to cast_cs,
+       which allows just to take over the args[0]->val_str() result
+       and thus avoid unnecessary character set conversion.
+     - If the argument is not a number, then from_cs is set to
+       the argument's charset.
   */
-  charset_conversion= ((cast_cs->mbmaxlen > 1) ||
-                       !my_charset_same(args[0]->collation.collation,
-                                        cast_cs) &&
-                       args[0]->collation.collation != &my_charset_bin &&
-                       cast_cs != &my_charset_bin);
+  from_cs= (args[0]->result_type() == INT_RESULT || 
+            args[0]->result_type() == DECIMAL_RESULT ||
+            args[0]->result_type() == REAL_RESULT) ?
+           (cast_cs->mbminlen == 1 ? cast_cs : &my_charset_latin1) :
+           args[0]->collation.collation;
+  charset_conversion= (cast_cs->mbmaxlen > 1) ||
+                      !my_charset_same(from_cs, cast_cs) &&
+                      from_cs != &my_charset_bin &&
+                      cast_cs != &my_charset_bin;
   collation.set(cast_cs, DERIVATION_IMPLICIT);
   char_length= (cast_length >= 0) ? cast_length : 
-	       args[0]->max_length/args[0]->collation.collation->mbmaxlen;
+	       args[0]->max_length/from_cs->mbmaxlen;
   max_length= char_length * cast_cs->mbmaxlen;
 }
 

--- 1.68/sql/item_timefunc.h	2006-04-18 04:40:08 +05:00
+++ 1.69/sql/item_timefunc.h	2006-04-24 19:51:16 +05:00
@@ -708,7 +708,7 @@
 class Item_char_typecast :public Item_typecast
 {
   int cast_length;
-  CHARSET_INFO *cast_cs;
+  CHARSET_INFO *cast_cs, *from_cs;
   bool charset_conversion;
   String tmp_value;
 public:

--- 1.547/sql/mysqld.cc	2006-04-23 05:09:47 +05:00
+++ 1.548/sql/mysqld.cc	2006-04-24 19:51:16 +05:00
@@ -5931,7 +5931,7 @@
     (gptr*) &max_system_variables.max_length_for_sort_data, 0, GET_ULONG,
     REQUIRED_ARG, 1024, 4, 8192*1024L, 0, 1, 0},
   {"max_prepared_stmt_count", OPT_MAX_PREPARED_STMT_COUNT,
-   "Maximum numbrer of prepared statements in the server.",
+   "Maximum number of prepared statements in the server.",
    (gptr*) &max_prepared_stmt_count, (gptr*) &max_prepared_stmt_count,
    0, GET_ULONG, REQUIRED_ARG, 16382, 0, 1*1024*1024, 0, 1, 0},
   {"max_relay_log_size", OPT_MAX_RELAY_LOG_SIZE,

--- 1.44/mysql-test/r/ctype_ucs.result	2006-04-07 14:23:48 +05:00
+++ 1.45/mysql-test/r/ctype_ucs.result	2006-04-24 19:51:16 +05:00
@@ -674,6 +674,18 @@
 Warning	1264	Out of range value for column 'Field1' at row 1
 DROP TABLE t1;
 SET NAMES latin1;
+SELECT CONVERT(103, CHAR(50) UNICODE);
+CONVERT(103, CHAR(50) UNICODE)
+103
+SELECT CONVERT(103.0, CHAR(50) UNICODE);
+CONVERT(103.0, CHAR(50) UNICODE)
+103.0
+SELECT CONVERT(-103, CHAR(50) UNICODE);
+CONVERT(-103, CHAR(50) UNICODE)
+-103
+SELECT CONVERT(-103.0, CHAR(50) UNICODE);
+CONVERT(-103.0, CHAR(50) UNICODE)
+-103.0
 CREATE TABLE t1 (
 a varchar(255) NOT NULL default '',
 KEY a (a)

--- 1.40/mysql-test/t/ctype_ucs.test	2006-04-07 14:23:48 +05:00
+++ 1.41/mysql-test/t/ctype_ucs.test	2006-04-24 19:51:16 +05:00
@@ -410,6 +410,14 @@
 SET NAMES latin1;
 
 #
+# Bug#18691 Converting number to UNICODE string returns invalid result
+#
+SELECT CONVERT(103, CHAR(50) UNICODE);
+SELECT CONVERT(103.0, CHAR(50) UNICODE);
+SELECT CONVERT(-103, CHAR(50) UNICODE);
+SELECT CONVERT(-103.0, CHAR(50) UNICODE);
+
+#
 # Bug#9557 MyISAM utf8 table crash
 #
 CREATE TABLE t1 (
Thread
bk commit into 5.1 tree (svoj:1.2359)Sergey Vojtovich24 Apr