From a2b11ff2664cf00fea3aa10bd98c6fbb14ff6fc7 Mon Sep 17 00:00:00 2001 From: "konstantin@mysql.com" <> Date: Fri, 15 Jul 2005 00:01:49 +0400 Subject: A fix and a test case for Bug#11299 "prepared statement makes wrong SQL syntax in binlog which stops replication": disallow the use of parameter markers which can lead to generation of malformed binlog queries. --- sql/sql_lex.cc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'sql/sql_lex.cc') diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 904b4675c74..42e3b678c09 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -554,6 +554,15 @@ int yylex(void *arg, void *yythd) lex->next_state= MY_LEX_START; // Allow signed numbers if (c == ',') lex->tok_start=lex->ptr; // Let tok_start point at next item + /* + Check for a placeholder: it should not precede a possible identifier + because of binlogging: when a placeholder is replaced with + its value in a query for the binlog, the query must stay + grammatically correct. + */ + else if (c == '?' && ((THD*) yythd)->command == COM_PREPARE && + !ident_map[cs, yyPeek()]) + return(PARAM_MARKER); return((int) c); case MY_LEX_IDENT_OR_NCHAR: -- cgit v1.2.1