List:Commits« Previous MessageNext Message »
From:bar Date:December 5 2006 12:09pm
Subject:bk commit into 5.1 tree (bar:1.2375)
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@stripped, 2006-12-05 16:09:27+04:00, bar@stripped +8 -0
  Merge mysql.com:/usr/home/bar/mysql-5.0.b22645
  into  mysql.com:/usr/home/bar/mysql-5.1.b22645
  MERGE: 1.1810.1698.188

  mysql-test/r/variables.result@stripped, 2006-12-05 16:07:18+04:00, bar@stripped +0 -0
    Auto merged
    MERGE: 1.76.1.14

  mysql-test/t/disabled.def@stripped, 2006-12-05 16:09:23+04:00, bar@stripped +1 -1
    After merge fix
    MERGE: 1.2.4.15

  mysql-test/t/variables.test@stripped, 2006-12-05 16:07:18+04:00, bar@stripped +0 -0
    Auto merged
    MERGE: 1.51.1.14

  sql/log.cc@stripped, 2006-12-05 16:07:18+04:00, bar@stripped +0 -0
    Auto merged
    MERGE: 1.158.1.40

  sql/mysql_priv.h@stripped, 2006-12-05 16:07:19+04:00, bar@stripped +0 -0
    Auto merged
    MERGE: 1.290.1.134

  sql/set_var.cc@stripped, 2006-12-05 16:07:19+04:00, bar@stripped +0 -0
    Auto merged
    MERGE: 1.125.5.30

  sql/set_var.h@stripped, 2006-12-05 16:07:19+04:00, bar@stripped +0 -0
    Auto merged
    MERGE: 1.68.2.8

  sql/sql_parse.cc@stripped, 2006-12-05 16:07:19+04:00, bar@stripped +0 -0
    Auto merged
    MERGE: 1.426.1.164

# 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.b22645/RESYNC

--- 1.457/sql/mysql_priv.h	2006-12-05 16:09:39 +04:00
+++ 1.458/sql/mysql_priv.h	2006-12-05 16:09:39 +04:00
@@ -118,6 +118,7 @@ enum Derivation
 
 typedef struct my_locale_st
 {
+  uint  number;
   const char *name;
   const char *description;
   const bool is_ascii;
@@ -126,9 +127,11 @@ typedef struct my_locale_st
   TYPELIB *day_names;
   TYPELIB *ab_day_names;
 #ifdef __cplusplus 
-  my_locale_st(const char *name_par, const char *descr_par, bool is_ascii_par,
+  my_locale_st(uint number_par,
+               const char *name_par, const char *descr_par, bool is_ascii_par,
                TYPELIB *month_names_par, TYPELIB *ab_month_names_par,
                TYPELIB *day_names_par, TYPELIB *ab_day_names_par) : 
+    number(number_par),
     name(name_par), description(descr_par), is_ascii(is_ascii_par),
     month_names(month_names_par), ab_month_names(ab_month_names_par),
     day_names(day_names_par), ab_day_names(ab_day_names_par)
@@ -140,6 +143,7 @@ extern MY_LOCALE my_locale_en_US;
 extern MY_LOCALE *my_locales[];
 
 MY_LOCALE *my_locale_by_name(const char *name);
+MY_LOCALE *my_locale_by_number(uint number);
 
 /***************************************************************************
   Configuration parameters

--- 1.595/sql/sql_parse.cc	2006-12-05 16:09:39 +04:00
+++ 1.596/sql/sql_parse.cc	2006-12-05 16:09:39 +04:00
@@ -2441,6 +2441,7 @@ static void reset_one_shot_variables(THD
   thd->update_charset();
   thd->variables.time_zone=
     global_system_variables.time_zone;
+  thd->variables.lc_time_names= &my_locale_en_US;
   thd->one_shot_set= 0;
 }
 

--- 1.212/mysql-test/t/disabled.def	2006-12-05 16:09:39 +04:00
+++ 1.213/mysql-test/t/disabled.def	2006-12-05 16:09:39 +04:00
@@ -18,6 +18,7 @@ ndb_autodiscover2        : BUG#18952 200
 ndb_load                 : BUG#17233 2006-05-04 tomas failed load data from infile causes mysqld dbug_assert, binlog not flushed
 partition_03ndb          : BUG#16385 2006-03-24 mikael Partitions: crash when updating a range partitioned NDB table
 ps_7ndb                  : BUG#18950 2006-02-16 jmiller create table like does not obtain LOCK_open
+rpl_locale               : Bug#22645 2006-12-05 bar
 rpl_ndb_2innodb          : BUG#19227 2006-04-20 pekka pk delete apparently not replicated
 rpl_ndb_2myisam          : BUG#19227 Seems to pass currently
 rpl_ndb_dd_partitions    : BUG#19259 2006-04-21 rpl_ndb_dd_partitions fails on s/AMD

--- 1.93/mysql-test/r/variables.result	2006-12-05 16:09:39 +04:00
+++ 1.94/mysql-test/r/variables.result	2006-12-05 16:09:39 +04:00
@@ -697,6 +697,63 @@ set names latin1;
 select @@have_innodb;
 @@have_innodb
 #
+*** Various tests with LC_TIME_NAMES
+*** LC_TIME_NAMES: testing case insensitivity
+set @@lc_time_names='ru_ru';
+select @@lc_time_names;
+@@lc_time_names
+ru_RU
+*** LC_TIME_NAMES: testing with a user variable
+set @lc='JA_JP';
+set @@lc_time_names=@lc;
+select @@lc_time_names;
+@@lc_time_names
+ja_JP
+*** LC_TIME_NAMES: testing with string expressions
+set lc_time_names=concat('de','_','DE');
+select @@lc_time_names;
+@@lc_time_names
+de_DE
+set lc_time_names=concat('de','+','DE');
+ERROR HY000: Unknown locale: 'de+DE'
+select @@lc_time_names;
+@@lc_time_names
+de_DE
+LC_TIME_NAMES: testing with numeric expressions
+set @@lc_time_names=1+2;
+select @@lc_time_names;
+@@lc_time_names
+sv_SE
+set @@lc_time_names=1/0;
+ERROR 42000: Incorrect argument type to variable 'lc_time_names'
+select @@lc_time_names;
+@@lc_time_names
+sv_SE
+set lc_time_names=en_US;
+LC_TIME_NAMES: testing NULL and a negative number:
+set lc_time_names=NULL;
+ERROR 42000: Variable 'lc_time_names' can't be set to the value of 'NULL'
+set lc_time_names=-1;
+ERROR HY000: Unknown locale: '-1'
+select @@lc_time_names;
+@@lc_time_names
+en_US
+LC_TIME_NAMES: testing locale with the last ID:
+set lc_time_names=108;
+select @@lc_time_names;
+@@lc_time_names
+zh_HK
+LC_TIME_NAMES: testing a number beyond the valid ID range:
+set lc_time_names=109;
+ERROR HY000: Unknown locale: '109'
+select @@lc_time_names;
+@@lc_time_names
+zh_HK
+LC_TIME_NAMES: testing that 0 is en_US:
+set lc_time_names=0;
+select @@lc_time_names;
+@@lc_time_names
+en_US
 set @test = @@query_prealloc_size;
 set @@query_prealloc_size = @test;
 select @@query_prealloc_size = @test;

--- 1.65/mysql-test/t/variables.test	2006-12-05 16:09:39 +04:00
+++ 1.66/mysql-test/t/variables.test	2006-12-05 16:09:39 +04:00
@@ -497,6 +497,50 @@ set names latin1;
 select @@have_innodb;
 
 #
+# Tests for lc_time_names
+# Note, when adding new locales, please fix ID accordingly:
+# - to test the last ID (currently 108)
+# - and the next after the last (currently 109)
+#
+--echo *** Various tests with LC_TIME_NAMES
+--echo *** LC_TIME_NAMES: testing case insensitivity
+set @@lc_time_names='ru_ru';
+select @@lc_time_names;
+--echo *** LC_TIME_NAMES: testing with a user variable
+set @lc='JA_JP';
+set @@lc_time_names=@lc;
+select @@lc_time_names;
+--echo *** LC_TIME_NAMES: testing with string expressions
+set lc_time_names=concat('de','_','DE');
+select @@lc_time_names;
+--error 1105
+set lc_time_names=concat('de','+','DE');
+select @@lc_time_names;
+--echo LC_TIME_NAMES: testing with numeric expressions
+set @@lc_time_names=1+2;
+select @@lc_time_names;
+--error 1232
+set @@lc_time_names=1/0;
+select @@lc_time_names;
+set lc_time_names=en_US;
+--echo LC_TIME_NAMES: testing NULL and a negative number:
+--error 1231
+set lc_time_names=NULL;
+--error 1105
+set lc_time_names=-1;
+select @@lc_time_names;
+--echo LC_TIME_NAMES: testing locale with the last ID:
+set lc_time_names=108;
+select @@lc_time_names;
+--echo LC_TIME_NAMES: testing a number beyond the valid ID range:
+--error 1105
+set lc_time_names=109;
+select @@lc_time_names;
+--echo LC_TIME_NAMES: testing that 0 is en_US:
+set lc_time_names=0;
+select @@lc_time_names;
+
+#
 # Bug #13334: query_prealloc_size default less than minimum
 #
 set @test = @@query_prealloc_size;

--- 1.200/sql/set_var.cc	2006-12-05 16:09:39 +04:00
+++ 1.201/sql/set_var.cc	2006-12-05 16:09:39 +04:00
@@ -3003,17 +3003,39 @@ byte *sys_var_max_user_conn::value_ptr(T
   return (byte*) &(max_user_connections);
 }
 
+
 bool sys_var_thd_lc_time_names::check(THD *thd, set_var *var)
 {
-  char *locale_str =var->value->str_value.c_ptr();
-  MY_LOCALE *locale_match=  my_locale_by_name(locale_str);
+  MY_LOCALE *locale_match;
 
-  if (locale_match == NULL)
+  if (var->value->result_type() == INT_RESULT)
+  {
+    if (!(locale_match= my_locale_by_number((uint) var->value->val_int())))
+    {
+      char buf[20];
+      int10_to_str((int) var->value->val_int(), buf, -10);
+      my_printf_error(ER_UNKNOWN_ERROR, "Unknown locale: '%s'", MYF(0), buf);
+      return 1;
+    }
+  }
+  else // STRING_RESULT
   {
-    my_printf_error(ER_UNKNOWN_ERROR,
-                    "Unknown locale: '%s'", MYF(0), locale_str);
-    return 1;
+    char buff[6]; 
+    String str(buff, sizeof(buff), &my_charset_latin1), *res;
+    if (!(res=var->value->val_str(&str)))
+    {
+      my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, "NULL");
+      return 1;
+    }
+    const char *locale_str= res->c_ptr();
+    if (!(locale_match= my_locale_by_name(locale_str)))
+    {
+      my_printf_error(ER_UNKNOWN_ERROR,
+                      "Unknown locale: '%s'", MYF(0), locale_str);
+      return 1;
+    }
   }
+
   var->save_result.locale_value= locale_match;
   return 0;
 }

--- 1.93/sql/set_var.h	2006-12-05 16:09:39 +04:00
+++ 1.94/sql/set_var.h	2006-12-05 16:09:39 +04:00
@@ -909,13 +909,17 @@ class sys_var_thd_lc_time_names :public 
 {
 public:
   sys_var_thd_lc_time_names(const char *name_arg):
-    sys_var_thd(name_arg)
-  {}
+    sys_var_thd(name_arg) 
+  {
+#if MYSQL_VERSION_ID < 50000
+    no_support_one_shot= 0;
+#endif
+  }
   bool check(THD *thd, set_var *var);
   SHOW_TYPE type() { return SHOW_CHAR; }
   bool check_update_type(Item_result type)
   {
-    return type != STRING_RESULT;		/* Only accept strings */
+    return ((type != STRING_RESULT) && (type != INT_RESULT));
   }
   bool check_default(enum_var_type type) { return 0; }
   bool update(THD *thd, set_var *var);
Thread
bk commit into 5.1 tree (bar:1.2375)bar5 Dec