diff options
author | Mats Kindahl <mats@sun.com> | 2010-04-21 08:15:10 +0200 |
---|---|---|
committer | Mats Kindahl <mats@sun.com> | 2010-04-21 08:15:10 +0200 |
commit | b5c45fb624c3d7d97dc394986a6b77165ebc1aeb (patch) | |
tree | 3f93fdd5f8cf3205b3c23f1a1ae8987e2e4d3a46 /sql/sql_yacc.yy | |
parent | c0817bacafacfd3199551a64acae8c6cb60dc238 (diff) | |
parent | 20f5c421e7a70fa4338da34ab123002cf9b00ad3 (diff) | |
download | mariadb-git-b5c45fb624c3d7d97dc394986a6b77165ebc1aeb.tar.gz |
Merging with mysql-trunk-bugfixing
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r-- | sql/sql_yacc.yy | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 207e72404ef..a0d64e6a378 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -9830,7 +9830,40 @@ limit_options: ; limit_option: - param_marker + ident + { + Item_splocal *splocal; + THD *thd= YYTHD; + LEX *lex= thd->lex; + Lex_input_stream *lip= & thd->m_parser_state->m_lip; + sp_variable_t *spv; + sp_pcontext *spc = lex->spcont; + if (spc && (spv = spc->find_variable(&$1))) + { + splocal= new (thd->mem_root) + Item_splocal($1, spv->offset, spv->type, + lip->get_tok_start() - lex->sphead->m_tmp_query, + lip->get_ptr() - lip->get_tok_start()); + if (splocal == NULL) + MYSQL_YYABORT; +#ifndef DBUG_OFF + splocal->m_sp= lex->sphead; +#endif + lex->safe_to_cache_query=0; + } + else + { + my_error(ER_SP_UNDECLARED_VAR, MYF(0), $1.str); + MYSQL_YYABORT; + } + if (splocal->type() != Item::INT_ITEM) + { + my_error(ER_WRONG_SPVAR_TYPE_IN_LIMIT, MYF(0)); + MYSQL_YYABORT; + } + splocal->limit_clause_param= TRUE; + $$= splocal; + } | param_marker { ((Item_param *) $1)->limit_clause_param= TRUE; } |