mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Merge mysql.com:/opt/local/work/mysql-4.1-root
into mysql.com:/opt/local/work/mysql-5.0-root regex/regerror.c: Auto merged sql/sql_lex.cc: Auto merged mysql-test/r/ps.result: Manual merge mysql-test/t/ps.test: Manual merge sql/sql_yacc.yy: Manual merge
This commit is contained in:
@ -801,3 +801,25 @@ execute stmt using @param1;
|
|||||||
select utext from t1 where utext like '%%';
|
select utext from t1 where utext like '%%';
|
||||||
drop table t1;
|
drop table t1;
|
||||||
deallocate prepare stmt;
|
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;
|
||||||
|
@ -556,6 +556,15 @@ int yylex(void *arg, void *yythd)
|
|||||||
lex->next_state= MY_LEX_START; // Allow signed numbers
|
lex->next_state= MY_LEX_START; // Allow signed numbers
|
||||||
if (c == ',')
|
if (c == ',')
|
||||||
lex->tok_start=lex->ptr; // Let tok_start point at next item
|
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);
|
return((int) c);
|
||||||
|
|
||||||
case MY_LEX_IDENT_OR_NCHAR:
|
case MY_LEX_IDENT_OR_NCHAR:
|
||||||
|
@ -465,6 +465,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
|
|||||||
%token PACK_KEYS_SYM
|
%token PACK_KEYS_SYM
|
||||||
%token PARTIAL
|
%token PARTIAL
|
||||||
%token PASSWORD
|
%token PASSWORD
|
||||||
|
%token PARAM_MARKER
|
||||||
%token PHASE_SYM
|
%token PHASE_SYM
|
||||||
%token POINTFROMTEXT
|
%token POINTFROMTEXT
|
||||||
%token POINT_SYM
|
%token POINT_SYM
|
||||||
@ -6933,23 +6934,15 @@ text_string:
|
|||||||
;
|
;
|
||||||
|
|
||||||
param_marker:
|
param_marker:
|
||||||
'?'
|
PARAM_MARKER
|
||||||
{
|
{
|
||||||
THD *thd=YYTHD;
|
THD *thd=YYTHD;
|
||||||
LEX *lex= thd->lex;
|
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))
|
||||||
{
|
{
|
||||||
Item_param *item= new Item_param((uint) (lex->tok_start -
|
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
|
||||||
(uchar *) thd->query));
|
|
||||||
if (!($$= item) || lex->param_list.push_back(item))
|
|
||||||
{
|
|
||||||
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
|
|
||||||
YYABORT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
yyerror(ER(ER_SYNTAX_ERROR));
|
|
||||||
YYABORT;
|
YYABORT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user