List:Commits« Previous MessageNext Message »
From:Alexander Nozdrin Date:May 14 2007 12:52pm
Subject:bk commit into 5.1 tree (anozdrin:1.2513)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of alik. When alik 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-05-14 14:52:29+04:00, anozdrin@ibm. +19 -0
  Patch for WL#3811: Deprecate GLOBAL @@collation_database,
  @@character_set_database; assignment of SESSION counterparts.

  client/mysqlimport.c@stripped, 2007-05-14 14:52:25+04:00, anozdrin@ibm. +1 -12
    Use "CHARACTER SET"-clause of "LOAD DATA INFILE" instead of
    "SET character_set_database".

  mysql-test/extra/binlog_tests/ctype_cp932_binlog.test@stripped, 2007-05-14 14:52:25+04:00,
anozdrin@ibm. +0 -1
    Update test.

  mysql-test/r/ctype_cp932_binlog_stm.result@stripped, 2007-05-14 14:52:25+04:00, anozdrin@ibm.
+6 -7
    Update result.

  mysql-test/r/ctype_eucjpms.result@stripped, 2007-05-14 14:52:25+04:00, anozdrin@ibm. +0 -1
    Update result.

  mysql-test/r/ctype_ujis.result@stripped, 2007-05-14 14:52:25+04:00, anozdrin@ibm. +0 -2
    Update result.

  mysql-test/r/mysqlbinlog.result@stripped, 2007-05-14 14:52:25+04:00, anozdrin@ibm. +1 -29
    Update result.

  mysql-test/r/rpl_loaddata_charset.result@stripped, 2007-05-14 14:52:25+04:00, anozdrin@ibm.
+0 -19
    Update result.

  mysql-test/t/ctype_cp932_binlog_stm.test@stripped, 2007-05-14 14:52:25+04:00, anozdrin@ibm.
+1 -1
    Update test.

  mysql-test/t/ctype_eucjpms.test@stripped, 2007-05-14 14:52:25+04:00, anozdrin@ibm. +0 -1
    Update test.

  mysql-test/t/ctype_ujis.test@stripped, 2007-05-14 14:52:25+04:00, anozdrin@ibm. +0 -2
    Update test.

  mysql-test/t/mysqlbinlog.test@stripped, 2007-05-14 14:52:25+04:00, anozdrin@ibm. +0 -9
    Update test.

  mysql-test/t/rpl_loaddata_charset.test@stripped, 2007-05-14 14:52:25+04:00, anozdrin@ibm. +0
-9
    Update test.

  sql/log_event.cc@stripped, 2007-05-14 14:52:25+04:00, anozdrin@ibm. +4 -41
    Eleminate charset_database_number.

  sql/log_event.h@stripped, 2007-05-14 14:52:25+04:00, anozdrin@ibm. +5 -3
    Eleminate charset_database_number.

  sql/set_var.cc@stripped, 2007-05-14 14:52:25+04:00, anozdrin@ibm. +17 -42
    Make session character_set_database and collation_database
    read-only.
    Eliminate global character_set_database and collation_database.

  sql/set_var.h@stripped, 2007-05-14 14:52:25+04:00, anozdrin@ibm. +17 -5
    Make session character_set_database and collation_database
    read-only.
    Eliminate global character_set_database and collation_database.

  sql/sql_class.cc@stripped, 2007-05-14 14:52:25+04:00, anozdrin@ibm. +0 -1
    Eliminate THD::db_charset.

  sql/sql_class.h@stripped, 2007-05-14 14:52:25+04:00, anozdrin@ibm. +0 -1
    Eliminate THD::db_charset.

  sql/sql_db.cc@stripped, 2007-05-14 14:52:25+04:00, anozdrin@ibm. +4 -5
    Eliminate THD::db_charset.

# 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:	anozdrin
# Host:	ibm.
# Root:	/home/alik/Documents/MySQL/devel/5.1-rt-cs-wl3811

--- 1.82/client/mysqlimport.c	2007-03-19 12:19:47 +03:00
+++ 1.83/client/mysqlimport.c	2007-05-14 14:52:25 +04:00
@@ -330,6 +330,7 @@
   if (ignore)
     end= strmov(end, " IGNORE");
   end= strmov(strmov(end, " INTO TABLE "), tablename);
+  end= strmov(end, " CHARACTER SET binary");
 
   if (fields_terminated || enclosed || opt_enclosed || escaped)
       end= strmov(end, " FIELDS");
@@ -534,12 +535,6 @@
     goto error;
   }
 
-  if (mysql_query(mysql, "/*!40101 set @@character_set_database=binary */;"))
-  {
-    db_error(mysql); /* We shall countinue here, if --force was given */
-    goto error;
-  }
-
   /*
     We are not currently catching the error here.
   */
@@ -638,12 +633,6 @@
     {
       free_defaults(argv_to_free);
       return(1); /* purecov: deadcode */
-    }
-
-    if (mysql_query(mysql, "/*!40101 set @@character_set_database=binary */;"))
-    {
-      db_error(mysql); /* We shall countinue here, if --force was given */
-      return(1);
     }
 
     if (lock_tables)

--- 1.278/sql/log_event.cc	2007-05-02 22:11:19 +04:00
+++ 1.279/sql/log_event.cc	2007-05-14 14:52:25 +04:00
@@ -1293,6 +1293,7 @@
             1+1+MAX_TIME_ZONE_NAME_LENGTH+ // code of tz and tz length and tz name
             1+2+           // code of lc_time_names and lc_time_names_number
             1+2            // code of charset_database and charset_database_number
+                           // (not used anymore).
             ], *start, *start_of_status;
   ulong event_length;
 
@@ -1411,13 +1412,6 @@
     int2store(start, lc_time_names_number);
     start+= 2;
   }
-  if (charset_database_number)
-  {
-    DBUG_ASSERT(charset_database_number <= 0xFFFF);
-    *start++= Q_CHARSET_DATABASE_CODE;
-    int2store(start, charset_database_number);
-    start+= 2;
-  }
   /*
     Here there could be code like
     if (command-line-option-which-says-"log_this_variable" && inited)
@@ -1483,8 +1477,7 @@
    sql_mode(thd_arg->variables.sql_mode),
    auto_increment_increment(thd_arg->variables.auto_increment_increment),
    auto_increment_offset(thd_arg->variables.auto_increment_offset),
-   lc_time_names_number(thd_arg->variables.lc_time_names->number),
-   charset_database_number(0)
+   lc_time_names_number(thd_arg->variables.lc_time_names->number)
 {
   time_t end_time;
   time(&end_time);
@@ -1492,8 +1485,6 @@
   catalog_len = (catalog) ? (uint32) strlen(catalog) : 0;
   /* status_vars_len is set just before writing the event */
   db_len = (db) ? (uint32) strlen(db) : 0;
-  if (thd_arg->variables.collation_database != thd_arg->db_charset)
-    charset_database_number= thd_arg->variables.collation_database->number;
   
   /*
     If we don't use flags2 for anything else than options contained in
@@ -1565,7 +1556,7 @@
    db(NullS), catalog_len(0), status_vars_len(0),
    flags2_inited(0), sql_mode_inited(0), charset_inited(0),
    auto_increment_increment(1), auto_increment_offset(1),
-   time_zone_len(0), lc_time_names_number(0), charset_database_number(0)
+   time_zone_len(0), lc_time_names_number(0)
 {
   ulong data_len;
   uint32 tmp;
@@ -1670,10 +1661,6 @@
       lc_time_names_number= uint2korr(pos);
       pos+= 2;
       break;
-    case Q_CHARSET_DATABASE_CODE:
-      charset_database_number= uint2korr(pos);
-      pos+= 2;
-      break;
     default:
       /* That's why you must write status vars in growing order of code */
       DBUG_PRINT("info",("Query_log_event has unknown status vars (first has\
@@ -1872,16 +1859,6 @@
                 lc_time_names_number, print_event_info->delimiter);
     print_event_info->lc_time_names_number= lc_time_names_number;
   }
-  if (charset_database_number != print_event_info->charset_database_number)
-  {
-    if (charset_database_number)
-      my_b_printf(file, "SET @@session.collation_database=%d%s\n",
-                  charset_database_number, print_event_info->delimiter);
-    else
-      my_b_printf(file, "SET @@session.collation_database=DEFAULT%s\n",
-                  print_event_info->delimiter);
-    print_event_info->charset_database_number= charset_database_number;
-  }
 }
 
 
@@ -2037,21 +2014,7 @@
       }
       else
         thd->variables.lc_time_names= &my_locale_en_US;
-      if (charset_database_number)
-      {
-        CHARSET_INFO *cs;
-        if (!(cs= get_charset(charset_database_number, MYF(0))))
-        {
-          char buf[20];
-          int10_to_str((int) charset_database_number, buf, -10);
-          my_error(ER_UNKNOWN_COLLATION, MYF(0), buf);
-          goto compare_errors;
-        }
-        thd->variables.collation_database= cs;
-      }
-      else
-        thd->variables.collation_database= thd->db_charset;
-      
+
       /* Execute the query (note that we bypass dispatch_command()) */
       const char* found_semicolon= NULL;
       mysql_parse(thd, thd->query, thd->query_length, &found_semicolon);

--- 1.149/sql/log_event.h	2007-04-13 21:19:07 +04:00
+++ 1.150/sql/log_event.h	2007-05-14 14:52:25 +04:00
@@ -273,7 +273,11 @@
 
 #define Q_LC_TIME_NAMES_CODE    7
 
+/*
+  not used anymore.
 #define Q_CHARSET_DATABASE_CODE 8
+*/
+
 /* Intvar event post-header */
 
 #define I_TYPE_OFFSET        0
@@ -554,11 +558,10 @@
   char charset[6]; // 3 variables, each of them storable in 2 bytes
   char time_zone_str[MAX_TIME_ZONE_NAME_LENGTH];
   uint lc_time_names_number;
-  uint charset_database_number;
   st_print_event_info()
     :flags2_inited(0), sql_mode_inited(0),
      auto_increment_increment(1),auto_increment_offset(1), charset_inited(0),
-     lc_time_names_number(0), charset_database_number(0)
+     lc_time_names_number(0)
     {
       /*
         Currently we only use static PRINT_EVENT_INFO objects, so zeroed at
@@ -1018,7 +1021,6 @@
   uint time_zone_len; /* 0 means uninited */
   const char *time_zone_str;
   uint lc_time_names_number; /* 0 means en_US */
-  uint charset_database_number;
 
 #ifndef MYSQL_CLIENT
 

--- 1.333/sql/sql_class.cc	2007-04-26 01:39:25 +04:00
+++ 1.334/sql/sql_class.cc	2007-05-14 14:52:25 +04:00
@@ -252,7 +252,6 @@
   file_id = 0;
   query_id= 0;
   warn_id= 0;
-  db_charset= global_system_variables.collation_database;
   bzero(ha_data, sizeof(ha_data));
   mysys_var=0;
   binlog_evt_union.do_union= FALSE;

--- 1.358/sql/sql_class.h	2007-05-10 18:28:16 +04:00
+++ 1.359/sql/sql_class.h	2007-05-14 14:52:25 +04:00
@@ -1305,7 +1305,6 @@
   */
   table_map  used_tables;
   USER_CONN *user_connect;
-  CHARSET_INFO *db_charset;
   /*
     FIXME: this, and some other variables like 'count_cuted_fields'
     maybe should be statement/cursor local, that is, moved to Statement

--- 1.151/sql/sql_db.cc	2007-04-13 11:25:27 +04:00
+++ 1.152/sql/sql_db.cc	2007-05-14 14:52:25 +04:00
@@ -760,10 +760,10 @@
   */
   if (thd->db && !strcmp(thd->db,db))
   {
-    thd->db_charset= create_info->default_table_charset ?
-		     create_info->default_table_charset :
-		     thd->variables.collation_server;
-    thd->variables.collation_database= thd->db_charset;
+    thd->variables.collation_database=
+      create_info->default_table_charset ?
+      create_info->default_table_charset :
+      thd->variables.collation_server;
   }
 
   ha_binlog_log_query(thd, 0, LOGCOM_ALTER_DB,
@@ -1315,7 +1315,6 @@
 
   /* 3. Update db-charset environment variables. */
 
-  thd->db_charset= new_db_charset;
   thd->variables.collation_database= new_db_charset;
 }
 

--- 1.2/mysql-test/r/rpl_loaddata_charset.result	2007-03-01 10:50:27 +03:00
+++ 1.3/mysql-test/r/rpl_loaddata_charset.result	2007-05-14 14:52:25 +04:00
@@ -6,32 +6,13 @@
 start slave;
 create table t1 (a varchar(10) character set utf8);
 load data infile '../std_data_ln/loaddata6.dat' into table t1;
-set @@character_set_database=koi8r;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
-set @@character_set_database=DEFAULT;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
-set @@character_set_database=koi8r;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
-set @@character_set_database=DEFAULT;
 load data infile '../std_data_ln/loaddata6.dat' into table t1 character set koi8r;
 select hex(a) from t1;
 hex(a)
 C3BF
 D0AA
-C3BF
-C3BF
-C3BF
-D0AA
-D0AA
 select hex(a) from t1;
 hex(a)
 C3BF
-D0AA
-C3BF
-C3BF
-C3BF
-D0AA
 D0AA
 drop table t1;

--- 1.2/mysql-test/t/rpl_loaddata_charset.test	2007-03-01 10:50:13 +03:00
+++ 1.3/mysql-test/t/rpl_loaddata_charset.test	2007-05-14 14:52:25 +04:00
@@ -10,15 +10,6 @@
 connection master;
 create table t1 (a varchar(10) character set utf8);
 load data infile '../std_data_ln/loaddata6.dat' into table t1;
-set @@character_set_database=koi8r;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
-set @@character_set_database=DEFAULT;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
-set @@character_set_database=koi8r;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
-set @@character_set_database=DEFAULT;
 load data infile '../std_data_ln/loaddata6.dat' into table t1 character set koi8r;
 
 select hex(a) from t1;

--- 1.35/mysql-test/r/mysqlbinlog.result	2007-04-10 14:51:42 +04:00
+++ 1.36/mysql-test/r/mysqlbinlog.result	2007-05-14 14:52:25 +04:00
@@ -258,25 +258,11 @@
 flush logs;
 create table t1 (a varchar(64) character set utf8);
 load data infile '../std_data_ln/loaddata6.dat' into table t1;
-set character_set_database=koi8r;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
-set character_set_database=latin1;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
-set character_set_database=koi8r;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
-set character_set_database=latin1;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
 load data infile '../std_data_ln/loaddata6.dat' into table t1 character set koi8r;
 select hex(a) from t1;
 hex(a)
 C3BF
 D0AA
-C3BF
-C3BF
-D0AA
-C3BF
-D0AA
 drop table t1;
 flush logs;
 /*!40019 SET @@session.max_insert_delayed_threads=0*/;
@@ -292,21 +278,7 @@
 SET TIMESTAMP=1000000000/*!*/;
 load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-6-0' INTO table t1/*!*/;
 SET TIMESTAMP=1000000000/*!*/;
-SET @@session.collation_database=7/*!*/;
-load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-7-0' INTO table t1/*!*/;
-SET TIMESTAMP=1000000000/*!*/;
-SET @@session.collation_database=DEFAULT/*!*/;
-load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-8-0' INTO table t1/*!*/;
-SET TIMESTAMP=1000000000/*!*/;
-load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-9-0' INTO table t1/*!*/;
-SET TIMESTAMP=1000000000/*!*/;
-SET @@session.collation_database=7/*!*/;
-load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-a-0' INTO table t1/*!*/;
-SET TIMESTAMP=1000000000/*!*/;
-SET @@session.collation_database=DEFAULT/*!*/;
-load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-b-0' INTO table t1/*!*/;
-SET TIMESTAMP=1000000000/*!*/;
-load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-c-0' INTO table t1 character set
koi8r/*!*/;
+load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-7-0' INTO table t1 character set
koi8r/*!*/;
 SET TIMESTAMP=1000000000/*!*/;
 drop table t1/*!*/;
 DELIMITER ;

--- 1.46/mysql-test/t/mysqlbinlog.test	2007-04-10 14:51:42 +04:00
+++ 1.47/mysql-test/t/mysqlbinlog.test	2007-05-14 14:52:25 +04:00
@@ -191,15 +191,6 @@
 flush logs;
 create table t1 (a varchar(64) character set utf8);
 load data infile '../std_data_ln/loaddata6.dat' into table t1;
-set character_set_database=koi8r;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
-set character_set_database=latin1;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
-set character_set_database=koi8r;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
-set character_set_database=latin1;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
 load data infile '../std_data_ln/loaddata6.dat' into table t1 character set koi8r;
 select hex(a) from t1;
 drop table t1;

--- 1.9/mysql-test/extra/binlog_tests/ctype_cp932_binlog.test	2007-03-29 23:37:58 +04:00
+++ 1.10/mysql-test/extra/binlog_tests/ctype_cp932_binlog.test	2007-05-14 14:52:25 +04:00
@@ -7,7 +7,6 @@
 --enable_warnings
 
 set names cp932;
-set character_set_database = cp932;
 
 # Test prepared statement with 0x8300 sequence in parameter while
 # running with cp932 client character set.

--- 1.7/mysql-test/r/ctype_cp932_binlog_stm.result	2007-03-30 06:44:43 +04:00
+++ 1.8/mysql-test/r/ctype_cp932_binlog_stm.result	2007-05-14 14:52:25 +04:00
@@ -1,6 +1,5 @@
 drop table if exists t1;
 set names cp932;
-set character_set_database = cp932;
 RESET MASTER;
 CREATE TABLE t1(f1 blob);
 PREPARE stmt1 FROM 'INSERT INTO t1 VALUES(?)';
@@ -30,17 +29,17 @@
 466F6F2773206120426172	ED40ED41ED42	47.93
 DROP PROCEDURE bug18293|
 DROP TABLE t4|
-SHOW BINLOG EVENTS FROM 410|
+SHOW BINLOG EVENTS FROM 401|
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	410	Query	1	576	use `test`; CREATE TABLE t4 (s1 CHAR(50) CHARACTER SET
latin1,
+master-bin.000001	401	Query	1	564	use `test`; CREATE TABLE t4 (s1 CHAR(50) CHARACTER SET
latin1,
 s2 CHAR(50) CHARACTER SET cp932,
 d DECIMAL(10,2))
-master-bin.000001	576	Query	1	824	use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE
bug18293 (IN ins1 CHAR(50),
+master-bin.000001	564	Query	1	809	use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE
bug18293 (IN ins1 CHAR(50),
 IN ins2 CHAR(50) CHARACTER SET cp932,
 IN ind DECIMAL(10,2))
 BEGIN
 INSERT INTO t4 VALUES (ins1, ins2, ind);
 END
-master-bin.000001	824	Query	1	1043	use `test`; INSERT INTO t4 VALUES (
NAME_CONST('ins1',_latin1 0x466F6F2773206120426172),  NAME_CONST('ins2',_cp932
0xED40ED41ED42),  NAME_CONST('ind',47.93))
-master-bin.000001	1043	Query	1	1132	use `test`; DROP PROCEDURE bug18293
-master-bin.000001	1132	Query	1	1211	use `test`; DROP TABLE t4
+master-bin.000001	809	Query	1	1025	use `test`; INSERT INTO t4 VALUES (
NAME_CONST('ins1',_latin1 0x466F6F2773206120426172),  NAME_CONST('ins2',_cp932
0xED40ED41ED42),  NAME_CONST('ind',47.93))
+master-bin.000001	1025	Query	1	1111	use `test`; DROP PROCEDURE bug18293
+master-bin.000001	1111	Query	1	1187	use `test`; DROP TABLE t4

--- 1.6/mysql-test/t/ctype_cp932_binlog_stm.test	2007-03-29 23:37:58 +04:00
+++ 1.7/mysql-test/t/ctype_cp932_binlog_stm.test	2007-05-14 14:52:25 +04:00
@@ -22,7 +22,7 @@
 SELECT HEX(s1),HEX(s2),d FROM t4|
 DROP PROCEDURE bug18293|
 DROP TABLE t4|
-SHOW BINLOG EVENTS FROM 410|
+SHOW BINLOG EVENTS FROM 401|
 delimiter ;|
 
 # End of 5.0 tests

--- 1.19/mysql-test/r/ctype_ujis.result	2006-03-23 13:07:36 +03:00
+++ 1.20/mysql-test/r/ctype_ujis.result	2007-05-14 14:52:25 +04:00
@@ -2316,7 +2316,6 @@
 DROP TABLE IF EXISTS t1, t2;
 DROP PROCEDURE IF EXISTS sp1;
 set names ujis;
-set character_set_database = ujis;
 set character_set_server = ujis;
 CREATE TABLE t1(c1 char(2)) default charset = ujis;
 CREATE TABLE t2(c2 char(2)) default charset = ujis;
@@ -2341,5 +2340,4 @@
 DROP TABLE t1;
 DROP TABLE t2;
 set names default;
-set character_set_database=default;
 set character_set_server=default;

--- 1.19/mysql-test/t/ctype_ujis.test	2006-03-23 13:07:36 +03:00
+++ 1.20/mysql-test/t/ctype_ujis.test	2007-05-14 14:52:25 +04:00
@@ -1174,7 +1174,6 @@
 --enable_warnings
 
 set names ujis;
-set character_set_database = ujis;
 set character_set_server = ujis;
 
 CREATE TABLE t1(c1 char(2)) default charset = ujis;
@@ -1208,5 +1207,4 @@
 DROP TABLE t2;
 
 set names default;
-set character_set_database=default;
 set character_set_server=default;

--- 1.230/sql/set_var.cc	2007-05-08 13:28:27 +04:00
+++ 1.231/sql/set_var.cc	2007-05-14 14:52:25 +04:00
@@ -2254,25 +2254,24 @@
  }
 }
 
-CHARSET_INFO ** sys_var_character_set_database::ci_ptr(THD *thd,
-						       enum_var_type type)
+byte *sys_var_character_set_database::value_ptr(THD *thd,
+						enum_var_type type,
+                                                LEX_STRING *base)
 {
   if (type == OPT_GLOBAL)
-    return &global_system_variables.collation_database;
-  else
-    return &thd->variables.collation_database;
+    return NULL;
+
+  return sys_var_character_set::value_ptr(thd, type, base);
 }
 
 
-void sys_var_character_set_database::set_default(THD *thd, enum_var_type type)
+CHARSET_INFO **sys_var_character_set_database::ci_ptr(THD *thd,
+                                                      enum_var_type type)
 {
- if (type == OPT_GLOBAL)
-    global_system_variables.collation_database= default_charset_info;
-  else
-  {
-    thd->variables.collation_database= thd->db_charset;
-    thd->update_charset();
-  }
+  DBUG_ASSERT(type != OPT_GLOBAL);
+  DBUG_ASSERT(thd->variables.collation_database);
+
+  return &thd->variables.collation_database;
 }
 
 
@@ -2311,39 +2310,15 @@
  }
 }
 
-bool sys_var_collation_database::update(THD *thd, set_var *var)
-{
-  if (var->type == OPT_GLOBAL)
-    global_system_variables.collation_database= var->save_result.charset;
-  else
-  {
-    thd->variables.collation_database= var->save_result.charset;
-    thd->update_charset();
-  }
-  return 0;
-}
-
-
 byte *sys_var_collation_database::value_ptr(THD *thd, enum_var_type type,
-					      LEX_STRING *base)
+					    LEX_STRING *base)
 {
-  CHARSET_INFO *cs= ((type == OPT_GLOBAL) ?
-		  global_system_variables.collation_database :
-		  thd->variables.collation_database);
-  return cs ? (byte*) cs->name : (byte*) "NULL";
-}
+  if (type == OPT_GLOBAL)
+    return NULL;
 
+  DBUG_ASSERT(thd->variables.collation_database);
 
-void sys_var_collation_database::set_default(THD *thd, enum_var_type type)
-{
- if (type == OPT_GLOBAL)
-   global_system_variables.collation_database= default_charset_info;
- else
- {
-   thd->variables.collation_database= (global_system_variables.
-					 collation_database);
-   thd->update_charset();
- }
+  return (byte *) thd->variables.collation_database->name;
 }
 
 

--- 1.104/sql/set_var.h	2007-04-05 15:36:50 +04:00
+++ 1.105/sql/set_var.h	2007-05-14 14:52:25 +04:00
@@ -683,8 +683,15 @@
 public:
   sys_var_character_set_database(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);
+
+public:
+  virtual bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
+  virtual byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
+  virtual CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
+
+  virtual void set_default(THD *thd, enum_var_type type) { }
+  virtual bool update(THD *thd, set_var *var) { return TRUE; }
+  virtual bool is_readonly() const { return TRUE; }
 };
 
 class sys_var_character_set_connection :public sys_var_character_set
@@ -718,9 +725,14 @@
 {
 public:
   sys_var_collation_database(const char *name_arg) :sys_var_collation(name_arg) {}
-  bool update(THD *thd, set_var *var);
-  void set_default(THD *thd, enum_var_type type);
-  byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
+
+public:
+  virtual bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
+  virtual byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
+
+  virtual void set_default(THD *thd, enum_var_type type) { }
+  virtual bool update(THD *thd, set_var *var) { return TRUE; }
+  virtual bool is_readonly() const { return TRUE; }
 };
 
 

--- 1.6/mysql-test/r/ctype_eucjpms.result	2006-03-23 13:03:31 +03:00
+++ 1.7/mysql-test/r/ctype_eucjpms.result	2007-05-14 14:52:25 +04:00
@@ -3,7 +3,6 @@
 drop table if exists t3;
 drop table if exists t4;
 set names eucjpms;
-set character_set_database = eucjpms;
 CREATE TABLE t1(c1 CHAR(1)) DEFAULT CHARACTER SET = eucjpms;
 INSERT INTO t1 VALUES
 (0x5C),(0x7E),(0xA1B1),(0xA1BD),(0xA1C0),(0xA1C1),(0xA1C2),(0xA1DD),(0xA1F1),(0xA1F2),(0xA1EF),(0xA2CC),(0x8FA2B7),(0x8FA2C3);

--- 1.9/mysql-test/t/ctype_eucjpms.test	2006-03-23 13:03:31 +03:00
+++ 1.10/mysql-test/t/ctype_eucjpms.test	2007-05-14 14:52:25 +04:00
@@ -9,7 +9,6 @@
 --enable_warnings
 
 set names eucjpms;
-set character_set_database = eucjpms;
  
 CREATE TABLE t1(c1 CHAR(1)) DEFAULT CHARACTER SET = eucjpms;
 
Thread
bk commit into 5.1 tree (anozdrin:1.2513)Alexander Nozdrin14 May