summaryrefslogtreecommitdiff
path: root/sql/sql_lex.cc
diff options
context:
space:
mode:
authorkonstantin@mysql.com <>2005-07-15 00:01:49 +0400
committerkonstantin@mysql.com <>2005-07-15 00:01:49 +0400
commita2b11ff2664cf00fea3aa10bd98c6fbb14ff6fc7 (patch)
treef58984f3d67be4ee2ca5f3bc83e521b155dca05a /sql/sql_lex.cc
parenta1270b65db4e017ca512fab9554e0d4961062c05 (diff)
downloadmariadb-git-a2b11ff2664cf00fea3aa10bd98c6fbb14ff6fc7.tar.gz
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.
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r--sql/sql_lex.cc9
1 files changed, 9 insertions, 0 deletions
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: