summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <bar@bar.intranet.mysql.r18.ru>2006-12-14 16:45:48 +0400
committerunknown <bar@bar.intranet.mysql.r18.ru>2006-12-14 16:45:48 +0400
commite3ce6c4d6bb7bf155a9bf8a3ca9bb63b822ed665 (patch)
treee26fa2c6cdd24b603f02b838222acc304452eb65 /sql
parent9ef60daf784a8a1962306c997b16a2cb81a362d9 (diff)
parent76bd00a9932713aaf33de8915051c47e7af2aa61 (diff)
downloadmariadb-git-e3ce6c4d6bb7bf155a9bf8a3ca9bb63b822ed665.tar.gz
Merge mysql.com:/usr/home/bar/mysql-5.0.b22645
into mysql.com:/usr/home/bar/mysql-5.1.b22645 mysql-test/t/mysqlbinlog.test: Auto merged sql/log_event.cc: Auto merged sql/log_event.h: Auto merged mysql-test/t/disabled.def: SCCS merged
Diffstat (limited to 'sql')
-rw-r--r--sql/log_event.cc37
-rw-r--r--sql/log_event.h7
2 files changed, 40 insertions, 4 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 6b3902ba966..699fea3b357 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -1289,7 +1289,8 @@ bool Query_log_event::write(IO_CACHE* file)
1+1+FN_REFLEN+ // code of catalog and catalog length and catalog
1+4+ // code of autoinc and the 2 autoinc variables
1+6+ // code of charset and charset
- 1+1+MAX_TIME_ZONE_NAME_LENGTH // code of tz and tz length and tz name
+ 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
], *start, *start_of_status;
ulong event_length;
@@ -1401,6 +1402,13 @@ bool Query_log_event::write(IO_CACHE* file)
memcpy(start, time_zone_str, time_zone_len);
start+= time_zone_len;
}
+ if (lc_time_names_number)
+ {
+ DBUG_ASSERT(lc_time_names_number <= 0xFFFF);
+ *start++= Q_LC_TIME_NAMES_CODE;
+ int2store(start, lc_time_names_number);
+ start+= 2;
+ }
/*
Here there could be code like
if (command-line-option-which-says-"log_this_variable" && inited)
@@ -1465,7 +1473,8 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg,
flags2_inited(1), sql_mode_inited(1), charset_inited(1),
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)
+ auto_increment_offset(thd_arg->variables.auto_increment_offset),
+ lc_time_names_number(thd_arg->variables.lc_time_names->number)
{
time_t end_time;
time(&end_time);
@@ -1536,7 +1545,7 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
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)
+ time_zone_len(0), lc_time_names_number(0)
{
ulong data_len;
uint32 tmp;
@@ -1637,6 +1646,10 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
pos+= catalog_len+2; // leap over end 0
catalog_nz= 0; // catalog has end 0 in event
break;
+ case Q_LC_TIME_NAMES_CODE:
+ lc_time_names_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\
@@ -1829,6 +1842,11 @@ void Query_log_event::print_query_header(IO_CACHE* file,
memcpy(print_event_info->time_zone_str, time_zone_str, time_zone_len+1);
}
}
+ if (lc_time_names_number != print_event_info->lc_time_names_number)
+ {
+ fprintf(file, "SET @@session.lc_time_names=%d;\n", lc_time_names_number);
+ print_event_info->lc_time_names_number= lc_time_names_number;
+ }
}
@@ -1971,6 +1989,19 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli,
goto compare_errors;
}
}
+ if (lc_time_names_number)
+ {
+ if (!(thd->variables.lc_time_names=
+ my_locale_by_number(lc_time_names_number)))
+ {
+ my_printf_error(ER_UNKNOWN_ERROR,
+ "Unknown locale: '%d'", MYF(0), lc_time_names_number);
+ thd->variables.lc_time_names= &my_locale_en_US;
+ goto compare_errors;
+ }
+ }
+ else
+ thd->variables.lc_time_names= &my_locale_en_US;
/* Execute the query (note that we bypass dispatch_command()) */
mysql_parse(thd, thd->query, thd->query_length);
diff --git a/sql/log_event.h b/sql/log_event.h
index 76525bd3009..021ce938139 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -271,6 +271,8 @@ struct sql_ex_info
*/
#define Q_CATALOG_NZ_CODE 6
+#define Q_LC_TIME_NAMES_CODE 7
+
/* Intvar event post-header */
#define I_TYPE_OFFSET 0
@@ -525,9 +527,11 @@ typedef struct st_print_event_info
bool charset_inited;
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;
st_print_event_info()
:flags2_inited(0), sql_mode_inited(0),
- auto_increment_increment(1),auto_increment_offset(1), charset_inited(0)
+ auto_increment_increment(1),auto_increment_offset(1), charset_inited(0),
+ lc_time_names_number(0)
{
/*
Currently we only use static PRINT_EVENT_INFO objects, so zeroed at
@@ -829,6 +833,7 @@ public:
char charset[6];
uint time_zone_len; /* 0 means uninited */
const char *time_zone_str;
+ uint lc_time_names_number; /* 0 means en_US */
#ifndef MYSQL_CLIENT