summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <aelkin/elkin@koti.dsl.inet.fi>2007-10-04 12:27:14 +0300
committerunknown <aelkin/elkin@koti.dsl.inet.fi>2007-10-04 12:27:14 +0300
commit7258005cd40396a7803612f95eb7092574d99023 (patch)
tree517919629a45bfd069a7f37335db633689e2526b
parent345716937c6b3ba928aed448f66f34cb61bd4f33 (diff)
parentd0b076b66cef0335a884fa96c1c636bbef31a9db (diff)
downloadmariadb-git-7258005cd40396a7803612f95eb7092574d99023.tar.gz
Merge koti.dsl.inet.fi:/home/elkin/MySQL/TEAM/BARE/5.0
into koti.dsl.inet.fi:/home/elkin/MySQL/TEAM/5.1-merge client/mysql.cc: Auto merged mysql-test/r/mysql.result: Auto merged mysql-test/t/mysql.test: Auto merged sql/sql_parse.cc: Auto merged sql/sql_repl.cc: Auto merged sql/sql_class.h: conflicting hunk is for log.h
-rw-r--r--client/mysql.cc11
-rw-r--r--mysql-test/r/mysql.result2
-rw-r--r--mysql-test/t/mysql.test9
-rw-r--r--sql/sql_parse.cc11
-rw-r--r--sql/sql_repl.cc10
5 files changed, 40 insertions, 3 deletions
diff --git a/client/mysql.cc b/client/mysql.cc
index 794f252853a..c428e727255 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -1082,6 +1082,17 @@ static int read_and_execute(bool interactive)
if (!interactive)
{
line=batch_readline(status.line_buff);
+ /*
+ Skip UTF8 Byte Order Marker (BOM) 0xEFBBBF.
+ Editors like "notepad" put this marker in
+ the very beginning of a text file when
+ you save the file using "Unicode UTF-8" format.
+ */
+ if (!line_number &&
+ (uchar) line[0] == 0xEF &&
+ (uchar) line[1] == 0xBB &&
+ (uchar) line[2] == 0xBF)
+ line+= 3;
line_number++;
if (!glob_buffer.length())
status.query_start_line=line_number;
diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result
index 4e39fb28454..76018962f79 100644
--- a/mysql-test/r/mysql.result
+++ b/mysql-test/r/mysql.result
@@ -178,5 +178,7 @@ ERROR at line 1: DELIMITER cannot contain a backslash character
1
1
1
+This is a file starting with UTF8 BOM 0xEFBBBF
+This is a file starting with UTF8 BOM 0xEFBBBF
End of 5.0 tests
WARNING: --server-arg option not supported in this configuration.
diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test
index 3ee04f32640..a7c3eda92df 100644
--- a/mysql-test/t/mysql.test
+++ b/mysql-test/t/mysql.test
@@ -282,6 +282,15 @@ remove_file $MYSQLTEST_VARDIR/tmp/bug21412.sql;
#
--exec $MYSQL test -e "/*! \C latin1 */ select 1;"
+#
+# Bug#29323 mysql client only accetps ANSI encoded files
+#
+--write_file $MYSQLTEST_VARDIR/tmp/bug29323.sql
+select "This is a file starting with UTF8 BOM 0xEFBBBF";
+EOF
+--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug29323.sql 2>&1
+remove_file $MYSQLTEST_VARDIR/tmp/bug29323.sql;
+
--echo End of 5.0 tests
#
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index ae347bebb47..6d0297ac42b 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2055,7 +2055,16 @@ mysql_execute_command(THD *thd)
if (check_global_access(thd, SUPER_ACL | REPL_CLIENT_ACL))
goto error;
pthread_mutex_lock(&LOCK_active_mi);
- res = show_master_info(thd,active_mi);
+ if (active_mi != NULL)
+ {
+ res = show_master_info(thd, active_mi);
+ }
+ else
+ {
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
+ "the master info structure does not exist");
+ send_ok(thd);
+ }
pthread_mutex_unlock(&LOCK_active_mi);
break;
}
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index a6e52c05219..4ba174927a2 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -369,7 +369,6 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos,
name=0; // Find first log
linfo.index_file_offset = 0;
- thd->current_linfo = &linfo;
if (mysql_bin_log.find_log_pos(&linfo, name, 1))
{
@@ -378,6 +377,10 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos,
goto err;
}
+ pthread_mutex_lock(&LOCK_thread_count);
+ thd->current_linfo = &linfo;
+ pthread_mutex_unlock(&LOCK_thread_count);
+
if ((file=open_binlog(&log, log_file_name, &errmsg)) < 0)
{
my_errno= ER_MASTER_FATAL_ERROR_READING_BINLOG;
@@ -1359,7 +1362,6 @@ bool mysql_show_binlog_events(THD* thd)
name=0; // Find first log
linfo.index_file_offset = 0;
- thd->current_linfo = &linfo;
if (mysql_bin_log.find_log_pos(&linfo, name, 1))
{
@@ -1367,6 +1369,10 @@ bool mysql_show_binlog_events(THD* thd)
goto err;
}
+ pthread_mutex_lock(&LOCK_thread_count);
+ thd->current_linfo = &linfo;
+ pthread_mutex_unlock(&LOCK_thread_count);
+
if ((file=open_binlog(&log, linfo.log_file_name, &errmsg)) < 0)
goto err;