diff options
author | unknown <pem@mysql.comhem.se> | 2004-03-29 11:16:45 +0200 |
---|---|---|
committer | unknown <pem@mysql.comhem.se> | 2004-03-29 11:16:45 +0200 |
commit | 7456a3e92f94552bf22210e81d03a0708b66f721 (patch) | |
tree | b8768978c409114099e7b16e65cb887898711497 /sql/sp_head.cc | |
parent | 220494bde06fe2c0b288845c9b027764341e443f (diff) | |
download | mariadb-git-7456a3e92f94552bf22210e81d03a0708b66f721.tar.gz |
Enforce standard declaration order in SPs.
Added new test cases for this, and adjusted old tests accordingly,
and new error codes and messages.
Fixed bugs in some tests (bug2673 and use test).
Added debug printing of instructions in SPs.
include/mysqld_error.h:
New error codes for non-standard declaration order in SPs.
include/sql_state.h:
New error codes for non-standard declaration order in SPs.
mysql-test/r/sp-error.result:
Enforce standard declaration order.
Fixed syntax error in use-test.
New test cases for wrong order.
mysql-test/r/sp.result:
Enforce strict declaration order.
Fixed platform dependent bug2673 test.
mysql-test/t/sp-error.test:
Enforce standard declaration order.
Fixed syntax error in use-test.
New test cases for wrong order.
mysql-test/t/sp.test:
Enforce strict declaration order.
Fixed platform dependent bug2673 test.
sql/share/czech/errmsg.txt:
New error messages for strict (standard) declaration order in SPs.
sql/share/danish/errmsg.txt:
New error messages for strict (standard) declaration order in SPs.
sql/share/dutch/errmsg.txt:
New error messages for strict (standard) declaration order in SPs.
sql/share/english/errmsg.txt:
New error messages for strict (standard) declaration order in SPs.
sql/share/estonian/errmsg.txt:
New error messages for strict (standard) declaration order in SPs.
sql/share/french/errmsg.txt:
New error messages for strict (standard) declaration order in SPs.
sql/share/german/errmsg.txt:
New error messages for strict (standard) declaration order in SPs.
sql/share/greek/errmsg.txt:
New error messages for strict (standard) declaration order in SPs.
sql/share/hungarian/errmsg.txt:
New error messages for strict (standard) declaration order in SPs.
sql/share/italian/errmsg.txt:
New error messages for strict (standard) declaration order in SPs.
sql/share/japanese/errmsg.txt:
New error messages for strict (standard) declaration order in SPs.
sql/share/korean/errmsg.txt:
New error messages for strict (standard) declaration order in SPs.
sql/share/norwegian-ny/errmsg.txt:
New error messages for strict (standard) declaration order in SPs.
sql/share/norwegian/errmsg.txt:
New error messages for strict (standard) declaration order in SPs.
sql/share/polish/errmsg.txt:
New error messages for strict (standard) declaration order in SPs.
sql/share/portuguese/errmsg.txt:
New error messages for strict (standard) declaration order in SPs.
sql/share/romanian/errmsg.txt:
New error messages for strict (standard) declaration order in SPs.
sql/share/russian/errmsg.txt:
New error messages for strict (standard) declaration order in SPs.
sql/share/serbian/errmsg.txt:
New error messages for strict (standard) declaration order in SPs.
sql/share/slovak/errmsg.txt:
New error messages for strict (standard) declaration order in SPs.
sql/share/spanish/errmsg.txt:
New error messages for strict (standard) declaration order in SPs.
sql/share/swedish/errmsg.txt:
New error messages for strict (standard) declaration order in SPs.
sql/share/ukrainian/errmsg.txt:
New error messages for strict (standard) declaration order in SPs.
sql/sp_head.cc:
Debug printing of instructions in procedures.
New error instruction for future use.
sql/sp_head.h:
Debug printing of instructions in procedures.
New error instruction for future use.
sql/sql_string.cc:
New methods needed by debug printing of instruction in SPs.
sql/sql_string.h:
New methods needed by debug printing of instruction in SPs.
sql/sql_yacc.yy:
Check for standard order of declarations in SPs.
Diffstat (limited to 'sql/sp_head.cc')
-rw-r--r-- | sql/sp_head.cc | 173 |
1 files changed, 172 insertions, 1 deletions
diff --git a/sql/sp_head.cc b/sql/sp_head.cc index c8be113e2e1..4c883d4cd3d 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -297,6 +297,24 @@ sp_head::create(THD *thd) DBUG_PRINT("info", ("type: %d name: %s params: %s body: %s", m_type, m_name.str, m_params.str, m_body.str)); +#ifndef DBUG_OFF + String s; + sp_instr *i; + uint ip= 0; + while ((i = get_instr(ip))) + { + char buf[8]; + + sprintf(buf, "%4u: ", ip); + s.append(buf); + i->print(&s); + s.append('\n'); + ip+= 1; + } + s.append('\0'); + DBUG_PRINT("info", ("Code %s\n%s", m_qname.str, s.ptr())); +#endif + if (m_type == TYPE_ENUM_FUNCTION) ret= sp_create_function(thd, this); else @@ -622,9 +640,9 @@ sp_head::reset_lex(THD *thd) (void)m_lex.push_front(oldlex); thd->lex= sublex= new st_lex; - sublex->yylineno= oldlex->yylineno; /* Reset most stuff. The length arguments doesn't matter here. */ lex_start(thd, oldlex->buf, oldlex->end_of_query - oldlex->ptr); + sublex->yylineno= oldlex->yylineno; /* We must reset ptr and end_of_query again */ sublex->ptr= oldlex->ptr; sublex->end_of_query= oldlex->end_of_query; @@ -871,6 +889,15 @@ sp_instr_stmt::execute(THD *thd, uint *nextp) DBUG_RETURN(res); } +void +sp_instr_stmt::print(String *str) +{ + str->reserve(12); + str->append("stmt "); + str->qs_append(m_lex->sql_command); +} + + int sp_instr_stmt::exec_stmt(THD *thd, LEX *lex) { @@ -988,6 +1015,16 @@ sp_instr_set::execute(THD *thd, uint *nextp) DBUG_RETURN(0); } +void +sp_instr_set::print(String *str) +{ + str->reserve(12); + str->append("set "); + str->qs_append(m_offset); + str->append(' '); + m_value->print(str); +} + // // sp_instr_jump // @@ -1001,6 +1038,14 @@ sp_instr_jump::execute(THD *thd, uint *nextp) DBUG_RETURN(0); } +void +sp_instr_jump::print(String *str) +{ + str->reserve(12); + str->append("jump "); + str->qs_append(m_dest); +} + // // sp_instr_jump_if // @@ -1018,6 +1063,16 @@ sp_instr_jump_if::execute(THD *thd, uint *nextp) DBUG_RETURN(0); } +void +sp_instr_jump_if::print(String *str) +{ + str->reserve(12); + str->append("jump_if "); + str->qs_append(m_dest); + str->append(' '); + m_expr->print(str); +} + // // sp_instr_jump_if_not // @@ -1035,6 +1090,16 @@ sp_instr_jump_if_not::execute(THD *thd, uint *nextp) DBUG_RETURN(0); } +void +sp_instr_jump_if_not::print(String *str) +{ + str->reserve(16); + str->append("jump_if_not "); + str->qs_append(m_dest); + str->append(' '); + m_expr->print(str); +} + // // sp_instr_freturn // @@ -1047,6 +1112,16 @@ sp_instr_freturn::execute(THD *thd, uint *nextp) DBUG_RETURN(0); } +void +sp_instr_freturn::print(String *str) +{ + str->reserve(12); + str->append("freturn "); + str->qs_append(m_type); + str->append(' '); + m_value->print(str); +} + // // sp_instr_hpush_jump // @@ -1064,6 +1139,18 @@ sp_instr_hpush_jump::execute(THD *thd, uint *nextp) DBUG_RETURN(0); } +void +sp_instr_hpush_jump::print(String *str) +{ + str->reserve(32); + str->append("hpush_jump "); + str->qs_append(m_type); + str->append(' '); + str->qs_append(m_frame); + str->append(' '); + str->qs_append(m_handler); +} + // // sp_instr_hpop // @@ -1076,6 +1163,14 @@ sp_instr_hpop::execute(THD *thd, uint *nextp) DBUG_RETURN(0); } +void +sp_instr_hpop::print(String *str) +{ + str->reserve(12); + str->append("hpop "); + str->qs_append(m_count); +} + // // sp_instr_hreturn // @@ -1088,6 +1183,14 @@ sp_instr_hreturn::execute(THD *thd, uint *nextp) DBUG_RETURN(0); } +void +sp_instr_hreturn::print(String *str) +{ + str->reserve(12); + str->append("hreturn "); + str->qs_append(m_frame); +} + // // sp_instr_cpush // @@ -1106,6 +1209,12 @@ sp_instr_cpush::~sp_instr_cpush() delete m_lex; } +void +sp_instr_cpush::print(String *str) +{ + str->append("cpush"); +} + // // sp_instr_cpop // @@ -1118,6 +1227,14 @@ sp_instr_cpop::execute(THD *thd, uint *nextp) DBUG_RETURN(0); } +void +sp_instr_cpop::print(String *str) +{ + str->reserve(12); + str->append("cpop "); + str->qs_append(m_count); +} + // // sp_instr_copen // @@ -1145,6 +1262,14 @@ sp_instr_copen::execute(THD *thd, uint *nextp) DBUG_RETURN(res); } +void +sp_instr_copen::print(String *str) +{ + str->reserve(12); + str->append("copen "); + str->qs_append(m_cursor); +} + // // sp_instr_cclose // @@ -1163,6 +1288,14 @@ sp_instr_cclose::execute(THD *thd, uint *nextp) DBUG_RETURN(res); } +void +sp_instr_cclose::print(String *str) +{ + str->reserve(12); + str->append("cclose "); + str->qs_append(m_cursor); +} + // // sp_instr_cfetch // @@ -1181,6 +1314,44 @@ sp_instr_cfetch::execute(THD *thd, uint *nextp) DBUG_RETURN(res); } +void +sp_instr_cfetch::print(String *str) +{ + List_iterator_fast<struct sp_pvar> li(m_varlist); + sp_pvar_t *pv; + + str->reserve(12); + str->append("cfetch "); + str->qs_append(m_cursor); + while ((pv= li++)) + { + str->reserve(8); + str->append(' '); + str->qs_append(pv->offset); + } +} + +// +// sp_instr_error +// +int +sp_instr_error::execute(THD *thd, uint *nextp) +{ + DBUG_ENTER("sp_instr_error::execute"); + + my_error(m_errcode, MYF(0)); + *nextp= m_ip+1; + DBUG_RETURN(-1); +} + +void +sp_instr_error::print(String *str) +{ + str->reserve(12); + str->append("error "); + str->qs_append(m_errcode); +} + /* ------------------------------------------------------------------ */ |