Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
3274b050
Commit
3274b050
authored
Jul 15, 2005
by
konstantin@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/opt/local/work/mysql-4.1-root
into mysql.com:/opt/local/work/mysql-5.0-root
parents
4ede9735
76468501
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
13 deletions
+37
-13
mysql-test/t/ps.test
mysql-test/t/ps.test
+22
-0
sql/sql_lex.cc
sql/sql_lex.cc
+9
-0
sql/sql_yacc.yy
sql/sql_yacc.yy
+6
-13
No files found.
mysql-test/t/ps.test
View file @
3274b050
...
...
@@ -801,3 +801,25 @@ execute stmt using @param1;
select
utext
from
t1
where
utext
like
'%%'
;
drop
table
t1
;
deallocate
prepare
stmt
;
#
# Bug#11299 "prepared statement makes wrong SQL syntax in binlog which stops
# replication": check that errouneous queries with placeholders are not
# allowed
#
create
table
t1
(
a
int
);
--
error
1064
prepare
stmt
from
"select ??"
;
--
error
1064
prepare
stmt
from
"select ?FROM t1"
;
--
error
1064
prepare
stmt
from
"select FROM t1 WHERE?=1"
;
--
error
1064
prepare
stmt
from
"update t1 set a=a+?WHERE 1"
;
--
error
1064
select
?
;
--
error
1064
select
??
;
--
error
1064
select
?
from
t1
;
drop
table
t1
;
deallocate
prepare
stmt
;
sql/sql_lex.cc
View file @
3274b050
...
...
@@ -556,6 +556,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
:
...
...
sql/sql_yacc.yy
View file @
3274b050
...
...
@@ -465,6 +465,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token PACK_KEYS_SYM
%token PARTIAL
%token PASSWORD
%token PARAM_MARKER
%token PHASE_SYM
%token POINTFROMTEXT
%token POINT_SYM
...
...
@@ -6933,12 +6934,10 @@ text_string:
;
param_marker:
'?'
PARAM_MARKER
{
THD *thd=YYTHD;
LEX *lex= thd->lex;
if (thd->command == COM_STMT_PREPARE)
{
Item_param *item= new Item_param((uint) (lex->tok_start -
(uchar *) thd->query));
if (!($$= item) || lex->param_list.push_back(item))
...
...
@@ -6947,12 +6946,6 @@ param_marker:
YYABORT;
}
}
else
{
yyerror(ER(ER_SYNTAX_ERROR));
YYABORT;
}
}
;
signed_literal:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment