summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
authorunknown <guilhem@mysql.com>2004-06-03 23:19:01 +0200
committerunknown <guilhem@mysql.com>2004-06-03 23:19:01 +0200
commit948903fc4f47af2cf328424931a64030bec44442 (patch)
tree7167f46c01fca0ac351957979f203eb7255612be /sql/sql_parse.cc
parent0f7a9f61023d97b60286ed7b72f27a9fb343f083 (diff)
parent934bb37d39b7c18c8d80eccdd914dc08f988c646 (diff)
downloadmariadb-git-948903fc4f47af2cf328424931a64030bec44442.tar.gz
Merge gbichot@213.136.52.20:/home/bk/mysql-4.1
into mysql.com:/home/mysql_src/mysql-4.1 sql/set_var.cc: Auto merged sql/slave.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_parse.cc: Auto merged
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc42
1 files changed, 41 insertions, 1 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index a7ecda72905..e83260b5de0 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2918,14 +2918,31 @@ unsent_create_error:
}
case SQLCOM_SET_OPTION:
+ {
+ List<set_var_base> *lex_var_list= &lex->var_list;
if (tables && ((res= check_table_access(thd, SELECT_ACL, tables,0)) ||
(res= open_and_lock_tables(thd,tables))))
break;
- if (!(res= sql_set_variables(thd, &lex->var_list)))
+ if (lex->one_shot_set && not_all_support_one_shot(lex_var_list))
+ {
+ my_printf_error(0, "The SET ONE_SHOT syntax is reserved for \
+purposes internal to the MySQL server", MYF(0));
+ res= -1;
+ break;
+ }
+ if (!(res= sql_set_variables(thd, lex_var_list)))
+ {
+ /*
+ If the previous command was a SET ONE_SHOT, we don't want to forget
+ about the ONE_SHOT property of that SET. So we use a |= instead of = .
+ */
+ thd->one_shot_set|= lex->one_shot_set;
send_ok(thd);
+ }
if (thd->net.report_error)
res= -1;
break;
+ }
case SQLCOM_UNLOCK_TABLES:
unlock_locked_tables(thd);
@@ -3377,6 +3394,29 @@ unsent_create_error:
break;
}
thd->proc_info="query end"; // QQ
+ if (thd->one_shot_set)
+ {
+ /*
+ If this is a SET, do nothing. This is to allow mysqlbinlog to print
+ many SET commands (in this case we want the charset temp setting to
+ live until the real query). This is also needed so that SET
+ CHARACTER_SET_CLIENT... does not cancel itself immediately.
+ */
+ if (lex->sql_command != SQLCOM_SET_OPTION)
+ {
+ thd->variables.character_set_client=
+ global_system_variables.character_set_client;
+ thd->variables.collation_connection=
+ global_system_variables.collation_connection;
+ thd->variables.collation_database=
+ global_system_variables.collation_database;
+ thd->variables.collation_server=
+ global_system_variables.collation_server;
+ thd->update_charset();
+ /* Add timezone stuff here */
+ thd->one_shot_set= 0;
+ }
+ }
if (res < 0)
send_error(thd,thd->killed ? ER_SERVER_SHUTDOWN : 0);