summaryrefslogtreecommitdiff
path: root/sql/sp_head.cc
diff options
context:
space:
mode:
authorMikael Ronstrom <mikael@mysql.com>2009-06-11 12:07:59 +0200
committerMikael Ronstrom <mikael@mysql.com>2009-06-11 12:07:59 +0200
commita22c8c5be5ceadd23eed707ae2f1308ced2de977 (patch)
tree796cc97d1d103e18e0672d9b57dee4c54857073c /sql/sp_head.cc
parent510835a0727fc1ebe98e2808cae91c8ab014d27e (diff)
parent585cf08fe6a8d6e237732daa94a969f93e5c84ec (diff)
downloadmariadb-git-a22c8c5be5ceadd23eed707ae2f1308ced2de977.tar.gz
Merge MySQL 5.1.35 into MySQL 5.4
Diffstat (limited to 'sql/sp_head.cc')
-rw-r--r--sql/sp_head.cc33
1 files changed, 20 insertions, 13 deletions
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 34b6c483637..d6984bf5ad0 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -208,6 +208,7 @@ sp_get_flags_for_command(LEX *lex)
case SQLCOM_SHOW_STATUS_PROC:
case SQLCOM_SHOW_STORAGE_ENGINES:
case SQLCOM_SHOW_TABLES:
+ case SQLCOM_SHOW_TABLE_STATUS:
case SQLCOM_SHOW_VARIABLES:
case SQLCOM_SHOW_WARNS:
case SQLCOM_REPAIR:
@@ -957,6 +958,8 @@ subst_spvars(THD *thd, sp_instr *instr, LEX_STRING *query_str)
qbuf.length(0);
cur= query_str->str;
prev_pos= res= 0;
+ thd->query_name_consts= 0;
+
for (Item_splocal **splocal= sp_vars_uses.front();
splocal < sp_vars_uses.back(); splocal++)
{
@@ -990,6 +993,8 @@ subst_spvars(THD *thd, sp_instr *instr, LEX_STRING *query_str)
res|= qbuf.append(')');
if (res)
break;
+
+ thd->query_name_consts++;
}
res|= qbuf.append(cur + prev_pos, query_str->length - prev_pos);
if (res)
@@ -2129,17 +2134,16 @@ sp_head::restore_lex(THD *thd)
/**
Put the instruction on the backpatch list, associated with the label.
*/
-void
+int
sp_head::push_backpatch(sp_instr *i, sp_label_t *lab)
{
bp_t *bp= (bp_t *)sql_alloc(sizeof(bp_t));
- if (bp)
- {
- bp->lab= lab;
- bp->instr= i;
- (void)m_backpatch.push_front(bp);
- }
+ if (!bp)
+ return 1;
+ bp->lab= lab;
+ bp->instr= i;
+ return m_backpatch.push_front(bp);
}
/**
@@ -2214,7 +2218,7 @@ sp_head::fill_field_definition(THD *thd, LEX *lex,
}
-void
+int
sp_head::new_cont_backpatch(sp_instr_opt_meta *i)
{
m_cont_level+= 1;
@@ -2222,15 +2226,17 @@ sp_head::new_cont_backpatch(sp_instr_opt_meta *i)
{
/* Use the cont. destination slot to store the level */
i->m_cont_dest= m_cont_level;
- (void)m_cont_backpatch.push_front(i);
+ if (m_cont_backpatch.push_front(i))
+ return 1;
}
+ return 0;
}
-void
+int
sp_head::add_cont_backpatch(sp_instr_opt_meta *i)
{
i->m_cont_dest= m_cont_level;
- (void)m_cont_backpatch.push_front(i);
+ return m_cont_backpatch.push_front(i);
}
void
@@ -2466,7 +2472,7 @@ sp_head::show_create_routine(THD *thd, int type)
@param instr Instruction
*/
-void sp_head::add_instr(sp_instr *instr)
+int sp_head::add_instr(sp_instr *instr)
{
instr->free_list= m_thd->free_list;
m_thd->free_list= 0;
@@ -2477,7 +2483,7 @@ void sp_head::add_instr(sp_instr *instr)
entire stored procedure, as their life span is equal.
*/
instr->mem_root= &main_mem_root;
- insert_dynamic(&m_instr, (uchar*)&instr);
+ return insert_dynamic(&m_instr, (uchar*)&instr);
}
@@ -2854,6 +2860,7 @@ sp_instr_stmt::execute(THD *thd, uint *nextp)
*nextp= m_ip+1;
thd->query= query;
thd->query_length= query_length;
+ thd->query_name_consts= 0;
if (!thd->is_error())
thd->main_da.reset_diagnostics_area();