List:Commits« Previous MessageNext Message »
From:bar Date:January 18 2006 8:55am
Subject:bk commit into 5.1 tree (bar:1.2069)
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.2069 06/01/18 12:55:38 bar@stripped +8 -0
  loaddata.result, loaddata.test:
    Adding test case.
  sql_yacc.yy:
    Adding TEXT_STRING_filesystem, which
    converts from character_set_client to
    character_set_conversion.
    Replacing TEXT_STRING_sys to TEXT_STRING_filesystem
    in LOAD DATA and SELECT INTO OUTFILE contexts.
  sql_class.h, sql_class.cc:
    Adding character_set_filesystem variable,
    and charset_is_character_set_filesystem
    flag (to avoid conversion when it's not necessary).
  set_var.h, set_var.cc:
    Adding sys_var_character_set_filesystem
  mysqld.cc:
    Adding --character-set-filesystem startup option.

  mysql-test/r/loaddata.result
    1.22 06/01/18 12:50:10 bar@stripped +27 -0
    Adding test case.

  mysql-test/t/loaddata.test
    1.16 06/01/18 12:49:58 bar@stripped +24 -0
    Adding test case.

  sql/sql_yacc.yy
    1.439 06/01/18 12:48:30 bar@stripped +16 -4
    Adding TEXT_STRING_filesystem, which
    converts from character_set_client to
    character_set_conversion.
    Replacing TEXT_STRING_sys to TEXT_STRING_filesystem
    in LOAD DATA and SELECT INTO OUTFILE contexts.

  sql/sql_class.h
    1.283 06/01/18 12:47:54 bar@stripped +2 -0
    Adding character_set_filesystem variable,
    and charset_is_character_set_filesystem
    flag (to avoid conversion when it's not necessary).

  sql/sql_class.cc
    1.237 06/01/18 12:46:25 bar@stripped +3 -0
    Adding character_set_filesystem variable,
    and charset_is_character_set_filesystem
    flag (to avoid conversion when it's not necessary).

  sql/set_var.h
    1.78 06/01/18 12:46:19 bar@stripped +9 -0
    Adding sys_var_character_set_filesystem

  sql/set_var.cc
    1.159 06/01/18 12:45:55 bar@stripped +28 -0
    Adding sys_var_character_set_filesystem

  sql/mysqld.cc
    1.520 06/01/18 12:44:52 bar@stripped +16 -0
    Adding --character-set-filesystem startup option.

# 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.12448

--- 1.519/sql/mysqld.cc	2006-01-17 12:24:49 +04:00
+++ 1.520/sql/mysqld.cc	2006-01-18 12:44:52 +04:00
@@ -315,6 +315,7 @@
 static char *mysqld_user, *mysqld_chroot, *log_error_file_ptr;
 static char *opt_init_slave, *language_ptr, *opt_init_connect;
 static char *default_character_set_name;
+static char *character_set_filesystem_name;
 static char *my_bind_addr_str;
 static char *default_collation_name;
 static char mysql_data_home_buff[2];
@@ -562,6 +563,7 @@
 
 CHARSET_INFO *system_charset_info, *files_charset_info ;
 CHARSET_INFO *national_charset_info, *table_alias_charset;
+CHARSET_INFO *character_set_filesystem;
 
 SHOW_COMP_OPTION have_row_based_replication;
 SHOW_COMP_OPTION have_raid, have_openssl, have_symlink, have_query_cache;
@@ -2799,6 +2801,12 @@
   global_system_variables.character_set_client= default_charset_info;
   global_system_variables.collation_connection= default_charset_info;
 
+  if (!(character_set_filesystem= 
+        get_charset_by_csname(character_set_filesystem_name,
+                              MY_CS_PRIMARY, MYF(MY_WME))))
+    return 1;
+  global_system_variables.character_set_filesystem= character_set_filesystem;
+
   sys_init_connect.value_length= 0;
   if ((sys_init_connect.value= opt_init_connect))
     sys_init_connect.value_length= strlen(opt_init_connect);
@@ -4761,6 +4769,7 @@
   OPT_GROUP_CONCAT_MAX_LEN,
   OPT_DEFAULT_COLLATION,
   OPT_CHARACTER_SET_CLIENT_HANDSHAKE,
+  OPT_CHARACTER_SET_FILESYSTEM,
   OPT_INIT_CONNECT,
   OPT_INIT_SLAVE,
   OPT_SECURE_AUTH,
@@ -4914,6 +4923,11 @@
    (gptr*) &opt_character_set_client_handshake,
    (gptr*) &opt_character_set_client_handshake,
     0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
+  {"character-set-filesystem", OPT_CHARACTER_SET_FILESYSTEM,
+   "Set the filesystem character set.",
+   (gptr*) &character_set_filesystem_name,
+   (gptr*) &character_set_filesystem_name,
+   0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
   {"character-set-server", 'C', "Set the default character set.",
    (gptr*) &default_character_set_name, (gptr*) &default_character_set_name,
    0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
@@ -6924,6 +6938,7 @@
   files_charset_info= &my_charset_utf8_general_ci;
   national_charset_info= &my_charset_utf8_general_ci;
   table_alias_charset= &my_charset_bin;
+  character_set_filesystem= &my_charset_bin;
 
   opt_date_time_formats[0]= opt_date_time_formats[1]= opt_date_time_formats[2]= 0;
 
@@ -6977,6 +6992,7 @@
   default_character_set_name= (char*) MYSQL_DEFAULT_CHARSET_NAME;
   default_collation_name= (char*) MYSQL_DEFAULT_COLLATION_NAME;
   sys_charset_system.value= (char*) system_charset_info->csname;
+  character_set_filesystem_name= (char*) "binary";
 
 
   /* Set default values for some option variables */

--- 1.236/sql/sql_class.cc	2006-01-17 16:32:22 +04:00
+++ 1.237/sql/sql_class.cc	2006-01-18 12:46:25 +04:00
@@ -658,6 +658,9 @@
   charset_is_collation_connection= 
     !String::needs_conversion(0,charset(),variables.collation_connection,
                               &not_used);
+  charset_is_character_set_filesystem= 
+    !String::needs_conversion(0, charset(),
+                              variables.character_set_filesystem, &not_used);
 }
 
 

--- 1.282/sql/sql_class.h	2006-01-12 22:50:32 +04:00
+++ 1.283/sql/sql_class.h	2006-01-18 12:47:54 +04:00
@@ -258,6 +258,7 @@
   my_bool old_passwords;
 
   /* Only charset part of these variables is sensible */
+  CHARSET_INFO  *character_set_filesystem;
   CHARSET_INFO  *character_set_client;
   CHARSET_INFO  *character_set_results;
 
@@ -1126,6 +1127,7 @@
   bool       query_error, bootstrap, cleanup_done;
   bool	     tmp_table_used;
   bool	     charset_is_system_charset, charset_is_collation_connection;
+  bool       charset_is_character_set_filesystem;
   bool       enable_slow_log;   /* enable slow log for current statement */
   bool	     no_trans_update, abort_on_warning;
   bool 	     got_warning;       /* Set on call to push_warning() */

--- 1.438/sql/sql_yacc.yy	2006-01-17 11:37:29 +04:00
+++ 1.439/sql/sql_yacc.yy	2006-01-18 12:48:30 +04:00
@@ -730,7 +730,7 @@
 	LEX_HOSTNAME ULONGLONG_NUM field_ident select_alias ident ident_or_text
         UNDERSCORE_CHARSET IDENT_sys TEXT_STRING_sys TEXT_STRING_literal
 	NCHAR_STRING opt_component key_cache_name
-        sp_opt_label BIN_NUM label_ident
+        sp_opt_label BIN_NUM label_ident TEXT_STRING_filesystem
 
 %type <lex_str_ptr>
 	opt_table_alias opt_fulltext_parser
@@ -7524,7 +7524,7 @@
            ;
 
 into:
-        INTO OUTFILE TEXT_STRING_sys
+        INTO OUTFILE TEXT_STRING_filesystem
 	{
           LEX *lex= Lex;
           lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
@@ -7533,7 +7533,7 @@
             YYABORT;
 	}
 	opt_field_term opt_line_term
-	| INTO DUMPFILE TEXT_STRING_sys
+	| INTO DUMPFILE TEXT_STRING_filesystem
 	{
 	  LEX *lex=Lex;
 	  if (!lex->describe)
@@ -8596,7 +8596,7 @@
         };
 
 load_data:
-	load_data_lock opt_local INFILE TEXT_STRING_sys
+	load_data_lock opt_local INFILE TEXT_STRING_filesystem
 	{
 	  LEX *lex=Lex;
 	  lex->sql_command= SQLCOM_LOAD;
@@ -9123,6 +9123,18 @@
 	}
 	;
 
+
+TEXT_STRING_filesystem:
+	TEXT_STRING
+	{
+	  THD *thd= YYTHD;
+	  if (thd->charset_is_character_set_filesystem)
+	    $$= $1;
+	  else
+	    thd->convert_string(&$$, thd->variables.character_set_filesystem,
+				$1.str, $1.length, thd->charset());
+	}
+	;
 
 ident:
 	IDENT_sys	    { $$=$1; }

--- 1.158/sql/set_var.cc	2006-01-12 22:50:31 +04:00
+++ 1.159/sql/set_var.cc	2006-01-18 12:45:55 +04:00
@@ -193,6 +193,7 @@
 sys_var_character_set_client  sys_character_set_client("character_set_client");
 sys_var_character_set_connection  sys_character_set_connection("character_set_connection");
 sys_var_character_set_results sys_character_set_results("character_set_results");
+sys_var_character_set_filesystem  sys_character_set_filesystem("character_set_filesystem");
 sys_var_thd_ulong	sys_completion_type("completion_type",
 					 &SV::completion_type,
 					 check_completion_type,
@@ -706,6 +707,7 @@
   {sys_character_set_client.name,(char*) &sys_character_set_client, SHOW_SYS},
   {sys_character_set_connection.name,(char*) &sys_character_set_connection,SHOW_SYS},
   {sys_character_set_database.name, (char*) &sys_character_set_database,SHOW_SYS},
+  {sys_character_set_filesystem.name,(char*) &sys_character_set_filesystem, SHOW_SYS},
   {sys_character_set_results.name,(char*) &sys_character_set_results, SHOW_SYS},
   {sys_character_set_server.name, (char*) &sys_character_set_server,SHOW_SYS},
   {sys_charset_system.name,   (char*) &sys_charset_system,          SHOW_SYS},
@@ -2016,6 +2018,32 @@
  {
    thd->variables.character_set_client= (global_system_variables.
 					 character_set_client);
+   thd->update_charset();
+ }
+}
+
+
+CHARSET_INFO **
+sys_var_character_set_filesystem::ci_ptr(THD *thd, enum_var_type type)
+{
+  if (type == OPT_GLOBAL)
+    return &global_system_variables.character_set_filesystem;
+  else
+    return &thd->variables.character_set_filesystem;
+}
+
+
+extern CHARSET_INFO *character_set_filesystem;
+
+void
+sys_var_character_set_filesystem::set_default(THD *thd, enum_var_type type)
+{
+ if (type == OPT_GLOBAL)
+   global_system_variables.character_set_filesystem= character_set_filesystem;
+ else
+ {
+   thd->variables.character_set_filesystem= (global_system_variables.
+					     character_set_filesystem);
    thd->update_charset();
  }
 }

--- 1.77/sql/set_var.h	2006-01-10 22:50:17 +04:00
+++ 1.78/sql/set_var.h	2006-01-18 12:46:19 +04:00
@@ -549,6 +549,15 @@
   virtual CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type)= 0;
 };
 
+class sys_var_character_set_filesystem :public sys_var_character_set
+{
+public:
+  sys_var_character_set_filesystem(const char *name_arg) :
+    sys_var_character_set(name_arg) {}
+  void set_default(THD *thd, enum_var_type type);
+  CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
+};
+
 class sys_var_character_set_client :public sys_var_character_set
 {
 public:

--- 1.21/mysql-test/r/loaddata.result	2005-12-02 15:01:36 +04:00
+++ 1.22/mysql-test/r/loaddata.result	2006-01-18 12:50:10 +04:00
@@ -139,3 +139,30 @@
 10	NULL	Ten
 15	NULL	Fifteen
 drop table t1, t2;
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (1);
+SET NAMES latin1;
+SET character_set_filesystem=filename;
+select @@character_set_filesystem;
+@@character_set_filesystem
+filename
+SELECT * INTO OUTFILE 't-1' FROM t1;
+DELETE FROM t1;
+LOAD DATA INFILE 't-1' INTO TABLE t1;
+SELECT * FROM t1;
+a
+1
+DELETE FROM t1;
+SET character_set_filesystem=latin1;
+select @@character_set_filesystem;
+@@character_set_filesystem
+latin1
+LOAD DATA INFILE 't@002d1' INTO TABLE t1;
+SELECT * FROM t1;
+a
+1
+DROP TABLE t1;
+SET character_set_filesystem=default;
+select @@character_set_filesystem;
+@@character_set_filesystem
+binary

--- 1.15/mysql-test/t/loaddata.test	2005-10-27 02:11:06 +05:00
+++ 1.16/mysql-test/t/loaddata.test	2006-01-18 12:49:58 +04:00
@@ -114,3 +114,27 @@
 drop table t1, t2;
 
 # End of 5.0 tests
+
+
+#
+# Bug#12448 LOAD DATA / SELECT INTO OUTFILE
+# doesn't work with multibyte path name
+#
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (1);
+SET NAMES latin1;
+SET character_set_filesystem=filename;
+select @@character_set_filesystem;
+SELECT * INTO OUTFILE 't-1' FROM t1;
+DELETE FROM t1;
+LOAD DATA INFILE 't-1' INTO TABLE t1;
+SELECT * FROM t1;
+DELETE FROM t1;
+SET character_set_filesystem=latin1;
+select @@character_set_filesystem;
+LOAD DATA INFILE 't@002d1' INTO TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+--exec rm $MYSQL_TEST_DIR/var/master-data/test/t@002d1
+SET character_set_filesystem=default;
+select @@character_set_filesystem;
Thread
bk commit into 5.1 tree (bar:1.2069)bar18 Jan