Below is the list of changes that have just been committed into a local
5.2 repository of antony. When antony does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-05-23 22:12:16-07:00, acurtis@stripped +15 -0
Post merge fixes
libmysqld/Makefile.am@stripped, 2007-05-23 22:12:10-07:00, acurtis@stripped +1 -0
fix embedded build
mysql-test/r/flush2.result@stripped, 2007-05-23 22:12:10-07:00, acurtis@stripped +0 -2
post-merge fixes
mysql-test/r/information_schema.result@stripped, 2007-05-23 22:12:11-07:00,
acurtis@stripped +1 -1
post-merge fixes
mysql-test/r/plugin_psm.result@stripped, 2007-05-23 22:12:11-07:00, acurtis@stripped +3 -1
must now declare if the external procedure is going to return result sets
mysql-test/r/rpl_stm_reset_slave.result@stripped, 2007-05-23 22:12:11-07:00,
acurtis@stripped +10 -6
post-merge fixes
mysql-test/r/system_mysql_db.result@stripped, 2007-05-23 22:12:11-07:00, acurtis@stripped
+1 -1
post-merge fixes
mysql-test/t/plugin_psm.test@stripped, 2007-05-23 22:12:11-07:00, acurtis@stripped +3 -1
must now declare if the external procedure is going to return result sets
sql/lex.h@stripped, 2007-05-23 22:12:11-07:00, acurtis@stripped +5 -0
New SQL2003 tokens
sql/mysql_priv.h@stripped, 2007-05-23 22:12:11-07:00, acurtis@stripped +1 -5
post merge fixes
sql/sp.cc@stripped, 2007-05-23 22:12:11-07:00, acurtis@stripped +10 -6
correctly reconstruct statement for external routines.
sql/sp_head.cc@stripped, 2007-05-23 22:12:11-07:00, acurtis@stripped +18 -3
build the body text for externals
sql/sp_psm.cc@stripped, 2007-05-23 22:12:11-07:00, acurtis@stripped +61 -42
fix
sql/sp_psm.h@stripped, 2007-05-23 22:12:11-07:00, acurtis@stripped +6 -2
fix
sql/sql_lex.h@stripped, 2007-05-23 22:12:11-07:00, acurtis@stripped +1 -0
fix
sql/sql_yacc.yy@stripped, 2007-05-23 22:12:11-07:00, acurtis@stripped +128 -51
fix
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: acurtis
# Host: ltamd64.xiphis.org
# Root: /home/antony/SkunkWorks/mysql-5.2-eric_antony
--- 1.176/sql/lex.h 2007-05-23 22:12:30 -07:00
+++ 1.177/sql/lex.h 2007-05-23 22:12:30 -07:00
@@ -217,6 +217,7 @@
{ "FULL", SYM(FULL)},
{ "FULLTEXT", SYM(FULLTEXT_SYM)},
{ "FUNCTION", SYM(FUNCTION_SYM)},
+ { "GENERAL", SYM(GENERAL_SYM)},
{ "GEOMETRY", SYM(GEOMETRY_SYM)},
{ "GEOMETRYCOLLECTION",SYM(GEOMETRYCOLLECTION)},
{ "GET_FORMAT", SYM(GET_FORMAT)},
@@ -378,6 +379,7 @@
{ "OUTFILE", SYM(OUTFILE)},
{ "OWNER", SYM(OWNER_SYM)},
{ "PACK_KEYS", SYM(PACK_KEYS_SYM)},
+ { "PARAMETER", SYM(PARAMETER_SYM)},
{ "PARSER", SYM(PARSER_SYM)},
{ "PARTIAL", SYM(PARTIAL)},
{ "PARTITION", SYM(PARTITION_SYM)},
@@ -433,6 +435,7 @@
{ "RESET", SYM(RESET_SYM)},
{ "RESTORE", SYM(RESTORE_SYM)},
{ "RESTRICT", SYM(RESTRICT)},
+ { "RESULT", SYM(RESULT_SYM)},
{ "RESUME", SYM(RESUME_SYM)},
{ "RETURN", SYM(RETURN_SYM)},
{ "RETURNS", SYM(RETURNS_SYM)},
@@ -461,6 +464,7 @@
{ "SESSION", SYM(SESSION_SYM)},
{ "SERVER", SYM(SERVER_SYM)},
{ "SET", SYM(SET)},
+ { "SETS", SYM(SETS_SYM)},
{ "SHARE", SYM(SHARE_SYM)},
{ "SHOW", SYM(SHOW)},
{ "SHUTDOWN", SYM(SHUTDOWN)},
@@ -504,6 +508,7 @@
{ "STORAGE", SYM(STORAGE_SYM)},
{ "STRAIGHT_JOIN", SYM(STRAIGHT_JOIN)},
{ "STRING", SYM(STRING_SYM)},
+ { "STYLE", SYM(STYLE_SYM)},
{ "SUBJECT", SYM(SUBJECT_SYM)},
{ "SUBPARTITION", SYM(SUBPARTITION_SYM)},
{ "SUBPARTITIONS", SYM(SUBPARTITIONS_SYM)},
--- 1.506/sql/mysql_priv.h 2007-05-23 22:12:30 -07:00
+++ 1.507/sql/mysql_priv.h 2007-05-23 22:12:30 -07:00
@@ -113,13 +113,9 @@
Note that the version is TWO numbers, separated with a comma
(two macro arguments, that is)
*/
-#ifdef compile_time_assert
-#error change the macro below to use compile_time_assert
-#endif
#define WARN_DEPRECATED(Thd,VerHi,VerLo,Old,New) \
do { \
- char t[MYSQL_VERSION_ID < VerHi * 10000 + VerLo * 100 ? 1 : -1] \
- __attribute__((unused)); \
+ compile_time_assert(MYSQL_VERSION_ID < VerHi * 10000 + VerLo * 100); \
if (Thd) \
push_warning_printf((Thd), MYSQL_ERROR::WARN_LEVEL_WARN, \
ER_WARN_DEPRECATED_SYNTAX, \
--- 1.276/sql/sql_lex.h 2007-05-23 22:12:30 -07:00
+++ 1.277/sql/sql_lex.h 2007-05-23 22:12:30 -07:00
@@ -858,6 +858,7 @@
enum enum_sp_suid_behaviour suid;
bool detistic;
enum enum_sp_data_access daccess;
+ uint result_sets;
};
--- 1.568/sql/sql_yacc.yy 2007-05-23 22:12:30 -07:00
+++ 1.569/sql/sql_yacc.yy 2007-05-23 22:12:30 -07:00
@@ -687,6 +687,7 @@
%token FULLTEXT_SYM
%token FUNCTION_SYM /* SQL-2003-R */
%token GE
+%token GENERAL_SYM /* SQL-2003-N */
%token GEOMETRYCOLLECTION
%token GEOMETRY_SYM
%token GET_FORMAT /* MYSQL-FUNC */
@@ -858,6 +859,7 @@
%token OWNER_SYM
%token PACK_KEYS_SYM
%token PARAM_MARKER
+%token PARAMETER_SYM /* SQL-2003-R */
%token PARSER_SYM
%token PARTIAL /* SQL-2003-N */
%token PARTITIONING_SYM
@@ -915,6 +917,7 @@
%token RESOURCES
%token RESTORE_SYM
%token RESTRICT
+%token RESULT_SYM /* SQL-2003-R */
%token RESUME_SYM
%token RETURNS_SYM /* SQL-2003-R */
%token RETURN_SYM /* SQL-2003-R */
@@ -942,6 +945,7 @@
%token SERVER_OPTIONS
%token SET /* SQL-2003-R */
%token SET_VAR
+%token SETS_SYM /* SQL-2003-N */
%token SHARE_SYM
%token SHIFT_LEFT /* OPERATOR */
%token SHIFT_RIGHT /* OPERATOR */
@@ -979,6 +983,7 @@
%token STORAGE_SYM
%token STRAIGHT_JOIN
%token STRING_SYM
+%token STYLE_SYM /* SQL-2003-N */
%token SUBDATE_SYM
%token SUBJECT_SYM
%token SUBPARTITIONS_SYM
@@ -1092,6 +1097,7 @@
UNDERSCORE_CHARSET IDENT_sys TEXT_STRING_sys TEXT_STRING_literal
NCHAR_STRING opt_component key_cache_name
sp_opt_label BIN_NUM label_ident TEXT_STRING_filesystem ident_or_empty
+ sp_c_external_name
%type <lex_str_ptr>
opt_table_alias
@@ -1996,14 +2002,25 @@
sp_chistic { }
| DETERMINISTIC_SYM { Lex->sp_chistics.detistic= TRUE; }
| not DETERMINISTIC_SYM { Lex->sp_chistics.detistic= FALSE; }
+ | LANGUAGE_SYM ident_or_text
+ {
+ if (Lex->sp_chistics.language.str)
+ {
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
+ }
+ if (!($2.length == 3 && !strcasecmp($2.str, "SQL") ||
+ plugin_is_ready(&$2, MYSQL_PSMLANGUAGE_PLUGIN)))
+ {
+ my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "PSM LANGUAGE", $2.str);
+ MYSQL_YYABORT;
+ }
+ Lex->sp_chistics.language= $2;
+ }
+ | DYNAMIC_SYM RESULT_SYM SETS_SYM NUM
+ { Lex->sp_chistics.result_sets= atoi($4.str); }
;
-opt_language_sql:
- /* empty */
- | LANGUAGE_SYM SQL_SYM
- /* Just parse it, we only have one language for now. */
- ;
-
sp_suid:
SQL_SYM SECURITY_SYM DEFINER_SYM
{
@@ -9648,6 +9665,7 @@
| FIRST_SYM {}
| FIXED_SYM {}
| FRAC_SECOND_SYM {}
+ | GENERAL_SYM {}
| GEOMETRY_SYM {}
| GEOMETRYCOLLECTION {}
| GET_FORMAT {}
@@ -9770,6 +9788,7 @@
| SERIAL_SYM {}
| SERIALIZABLE_SYM {}
| SESSION_SYM {}
+ | SETS_SYM {}
| SIMPLE_SYM {}
| SHARE_SYM {}
| SHUTDOWN {}
@@ -9783,6 +9802,7 @@
| STATUS_SYM {}
| STORAGE_SYM {}
| STRING_SYM {}
+ | STYLE_SYM {}
| SUBDATE_SYM {}
| SUBJECT_SYM {}
| SUBPARTITION_SYM {}
@@ -11287,6 +11307,12 @@
lex->sphead->m_param_end= lex->tok_start;
bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics));
}
+ sp_c_chistics
+ {
+ LEX *lex= Lex;
+ lex->sphead->m_chistics= &lex->sp_chistics;
+ lex->sphead->m_body_begin= lex->tok_start;
+ }
create_procedure_tail
{
LEX *lex= Lex;
@@ -11305,16 +11331,9 @@
;
create_procedure_tail:
- opt_language_sql
- sp_c_chistics
- {
- LEX *lex= Lex;
- lex->sphead->m_chistics= &lex->sp_chistics;
- lex->sphead->m_body_begin= lex->tok_start;
- }
opt_as
sp_proc_stmt {}
- | create_external_routine {}
+ | sp_external_body {}
;
create_function_tail:
@@ -11418,6 +11437,19 @@
bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics));
}
+ sp_c_chistics
+ {
+ LEX *lex= Lex;
+
+ if (lex->sp_chistics.result_sets)
+ {
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
+ }
+
+ lex->sphead->m_chistics= &lex->sp_chistics;
+ lex->sphead->m_body_begin= lex->tok_start;
+ }
create_function_tail2
{
THD *thd= YYTHD;
@@ -11476,55 +11508,100 @@
;
create_function_tail2:
- opt_language_sql
- sp_c_chistics
- {
- LEX *lex= Lex;
-
- lex->sphead->m_chistics= &lex->sp_chistics;
- lex->sphead->m_body_begin= lex->tok_start;
- }
- sp_proc_stmt {}
- | create_external_routine
+ sp_external_body
{ Lex->sphead->m_flags|= sp_head::HAS_RETURN; }
+ | {
+ if (Lex->sp_chistics.language.str &&
+ strcasecmp(Lex->sp_chistics.language.str, "SQL") ||
+ Lex->sp_chistics.result_sets)
+ {
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
+ }
+ } sp_proc_stmt
+ ;
+
+sp_c_external_name:
+ NAME_SYM TEXT_STRING_sys { $$= $2; }
+ | { $$= Lex->sphead->m_name; }
+ ;
+
+sp_c_parameter_style_clause:
+ /* empty */
+ | PARAMETER_SYM STYLE_SYM SQL_SYM
+ | PARAMETER_SYM STYLE_SYM GENERAL_SYM
+ ;
+
+sp_external_flags:
+ /* empty */
+ | WITH COMMIT_SYM OR_SYM ROLLBACK_SYM
+ {
+ if (Lex->sp_chistics.daccess != SP_NO_SQL)
+ {
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
+ }
+ Lex->sphead->m_flags|= sp_head::HAS_COMMIT_OR_ROLLBACK;
+ }
+ | WITH FLUSH_SYM
+ {
+ if (Lex->sp_chistics.daccess != SP_NO_SQL)
+ {
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
+ }
+ Lex->sphead->m_flags|= sp_head::HAS_SQLCOM_FLUSH;
+ }
+ | WITH RESET_SYM
+ {
+ if (Lex->sp_chistics.daccess != SP_NO_SQL)
+ {
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
+ }
+ Lex->sphead->m_flags|= sp_head::HAS_SQLCOM_RESET;
+ }
;
+
-create_external_routine:
- EXTERNAL_SYM NAME_SYM TEXT_STRING_sys
- LANGUAGE_SYM ident_or_text
+sp_external_body:
+ EXTERNAL_SYM
{
- if (!plugin_is_ready(&$5, MYSQL_PSMLANGUAGE_PLUGIN))
- {
- my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "PSM LANGUAGE", $5.str);
- MYSQL_YYABORT;
- }
- Lex->sp_chistics.language= $5;
+ if (!Lex->sphead->m_chistics->language.str ||
+ !strcasecmp(Lex->sp_chistics.language.str, "SQL"))
+ {
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
+ }
}
- sp_c_chistics
+ sp_c_external_name
+ sp_c_parameter_style_clause
+ sp_external_flags
{
LEX *lex= Lex;
sp_head *sp= lex->sphead;
- sp_instr_external *i;
- LEX_STRING name, lang;
+ sp_instr_external *i;
+ LEX_STRING name= $3, lang= sp->m_chistics->language;
- sp->m_chistics= &lex->sp_chistics;
- sp->m_body_begin= lex->tok_start;
-
- name.str= strmake_root(YYTHD->mem_root,
- $3.str, name.length= $3.length);
- lang.str= strmake_root(YYTHD->mem_root,
- $5.str, lang.length= $5.length);
+ name.str= strmake_root(YYTHD->mem_root,
+ name.str, name.length);
+ lang.str= strmake_root(YYTHD->mem_root,
+ lang.str, lang.length);
- sp->reset_lex(YYTHD);
- sp->m_tmp_query= lex->tok_start;
+ sp->reset_lex(YYTHD);
+ sp->m_tmp_query= lex->tok_start;
- i= new sp_instr_external(sp->instructions(), Lex->spcont,
- name, lang, Lex);
+ i= new sp_instr_external(sp->instructions(), Lex->spcont,
+ name, lang, sp->m_chistics->result_sets,
+ sp->m_chistics->daccess,
+ Lex);
sp->add_instr(i);
- sp->restore_lex(YYTHD);
-
- sp->m_flags|= sp_head::CONTAINS_DYNAMIC_SQL;
- sp->m_body= name;
+ sp->restore_lex(YYTHD);
+
+ if (sp->m_chistics->daccess != SP_NO_SQL)
+ sp->m_flags|= sp_head::CONTAINS_DYNAMIC_SQL;
+ if (sp->m_chistics->result_sets)
+ sp->m_flags|= sp_head::MULTI_RESULTS;
}
;
--- 1.6/mysql-test/r/flush2.result 2007-05-23 22:12:30 -07:00
+++ 1.7/mysql-test/r/flush2.result 2007-05-23 22:12:30 -07:00
@@ -4,11 +4,9 @@
Variable_name Value
log_bin OFF
log_bin_trust_function_creators ON
-log_bin_trust_routine_creators ON
flush logs;
show variables like 'log_bin%';
Variable_name Value
log_bin OFF
log_bin_trust_function_creators ON
-log_bin_trust_routine_creators ON
set global expire_logs_days = 0;
--- 1.1/mysql-test/r/plugin_psm.result 2007-05-23 22:12:30 -07:00
+++ 1.2/mysql-test/r/plugin_psm.result 2007-05-23 22:12:30 -07:00
@@ -1,5 +1,7 @@
INSTALL PLUGIN Deep_Thought SONAME 'psm_example.so';
-CREATE PROCEDURE test.UltimateAnswer() EXTERNAL NAME 'compute' LANGUAGE Deep_Thought;
+CREATE PROCEDURE test.UltimateAnswer()
+DYNAMIC RESULT SETS 1
+LANGUAGE Deep_Thought EXTERNAL NAME 'compute';
CALL test.UltimateAnswer();
Answer to Life, the Universe and Everything
Forty-Two
--- 1.1/mysql-test/t/plugin_psm.test 2007-05-23 22:12:30 -07:00
+++ 1.2/mysql-test/t/plugin_psm.test 2007-05-23 22:12:30 -07:00
@@ -2,7 +2,9 @@
INSTALL PLUGIN Deep_Thought SONAME 'psm_example.so';
-CREATE PROCEDURE test.UltimateAnswer() EXTERNAL NAME 'compute' LANGUAGE Deep_Thought;
+CREATE PROCEDURE test.UltimateAnswer()
+ DYNAMIC RESULT SETS 1
+ LANGUAGE Deep_Thought EXTERNAL NAME 'compute';
# Let's do some advanced ops with the example engine :)
CALL test.UltimateAnswer();
--- 1.1/sql/sp_psm.cc 2007-05-23 22:12:30 -07:00
+++ 1.2/sql/sp_psm.cc 2007-05-23 22:12:30 -07:00
@@ -27,6 +27,7 @@
struct st_psm_context : public st_mysql_psmcontext
{
sp_instr_external *i;
+ uint result_sets;
};
@@ -96,6 +97,8 @@
int sp_instr_external::execute(THD *thd, uint *nextp)
{
int res;
+ char *query;
+ uint32 query_length;
struct st_mysql_psmlanguage *language;
DBUG_ENTER("sp_instr_external::execute");
@@ -111,16 +114,15 @@
if ((res= language->find(&m_routine, m_name.str, m_name.length)))
my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "EXTERNAL", m_name.str);
else
+ if (!(res= alloc_query(thd, "", 1)))
{
res= m_lex_keeper.reset_lex_and_exec_core(thd, nextp, FALSE, this);
- if (res && !(thd->net.report_error == 1 || thd->killed))
- {
- my_error(ER_UNKNOWN_ERROR, MYF(0), "Something went wrong");
- }
-
language->release(m_routine);
m_routine= NULL;
+
+ thd->query= query;
+ thd->query_length= query_length;
}
plugin_unlock(NULL, m_plugin);
@@ -134,6 +136,7 @@
struct st_psm_context context;
struct st_mysql_psmlanguage *language;
int res;
+ const char *save_proc_info= thd->proc_info;
DBUG_ENTER("sp_instr_external::exec_core");
language= plugin_data(m_plugin, struct st_mysql_psmlanguage *);
@@ -143,11 +146,25 @@
context.arg_count= m_ctx->max_var_index();
context.thd= thd;
context.i= this;
+ context.result_sets= m_result_sets;
+
+ thd->proc_info= "external routine";
+
+ thd->net.no_send_error= 0;
+ mysql_reset_errors(thd, 0);
res= language->execute(m_routine, &context);
+ if (res && !(thd->net.report_error == 1 || thd->killed))
+ my_error(ER_UNKNOWN_ERROR, MYF(0), "Something went wrong");
+ else
+ if (!res)
+ send_ok(thd);
+
+ thd->proc_info= save_proc_info;
+
*nextp= m_ip+1;
- DBUG_RETURN(res);
+ DBUG_RETURN(res || thd->net.report_error);
}
@@ -194,17 +211,17 @@
else
if (idx == -1 && ctx->thd->spcont->m_return_value_fld)
field= ctx->thd->spcont->m_return_value_fld;
- if (idx == -1)
- return ctx->thd->protocol->store_null() ? -1 : 0;
else
- goto err;
+ {
+ int rc= -1;
+ if (idx == -1 && ctx->result_sets)
+ rc= ctx->thd->protocol->store_null() ? -1 : 0;
+ DBUG_RETURN(rc);
+ }
field->set_null();
DBUG_RETURN(0);
-
-err:
- DBUG_RETURN(-1);
}
int
@@ -224,18 +241,18 @@
else
if (idx == -1 && ctx->thd->spcont->m_return_value_fld)
field= ctx->thd->spcont->m_return_value_fld;
- if (idx == -1)
- return ctx->thd->protocol->store(str, length, cs) ? -1 : 0;
else
- goto err;
+ {
+ int rc= -1;
+ if (idx == -1 && ctx->result_sets)
+ rc= ctx->thd->protocol->store(str, length, cs) ? -1 : 0;
+ DBUG_RETURN(rc);
+ }
field->set_notnull();
field->store(str, length, cs);
DBUG_RETURN(0);
-
-err:
- DBUG_RETURN(-1);
}
int
@@ -251,19 +268,19 @@
else
if (idx == -1 && ctx->thd->spcont->m_return_value_fld)
field= ctx->thd->spcont->m_return_value_fld;
- if (idx == -1)
- return ctx->thd->protocol->store(value, precision,
- &ctx->i->m_str_value) ? -1 : 0;
else
- goto err;
+ {
+ int rc= -1;
+ if (idx == -1 && ctx->result_sets)
+ rc= ctx->thd->protocol->store(value, precision,
+ &ctx->i->m_str_value) ? -1 : 0;
+ DBUG_RETURN(rc);
+ }
field->set_notnull();
field->store(value);
DBUG_RETURN(0);
-
-err:
- DBUG_RETURN(-1);
}
@@ -280,19 +297,19 @@
else
if (idx == -1 && ctx->thd->spcont->m_return_value_fld)
field= ctx->thd->spcont->m_return_value_fld;
- if (idx == -1)
- return ctx->thd->protocol->store_longlong((longlong) value,
- unsigned_flag) ? -1 : 0;
else
- goto err;
+ {
+ int rc= -1;
+ if (idx == -1 && ctx->result_sets)
+ rc= ctx->thd->protocol->store_longlong((longlong) value,
+ unsigned_flag) ? -1 : 0;
+ DBUG_RETURN(rc);
+ }
field->set_notnull();
field->store((longlong) value, unsigned_flag);
DBUG_RETURN(0);
-
-err:
- DBUG_RETURN(-1);
}
int
@@ -308,18 +325,18 @@
else
if (idx == -1 && ctx->thd->spcont->m_return_value_fld)
field= ctx->thd->spcont->m_return_value_fld;
- if (idx == -1)
- return ctx->thd->protocol->store(ltime) ? -1 : 0;
else
- goto err;
+ {
+ int rc= -1;
+ if (idx == -1 && ctx->result_sets)
+ rc= ctx->thd->protocol->store(ltime) ? -1 : 0;
+ DBUG_RETURN(-1);
+ }
field->set_notnull();
field->store_time(ltime, (timestamp_type) 0);
DBUG_RETURN(0);
-
-err:
- DBUG_RETURN(-1);
}
int
@@ -420,7 +437,7 @@
Protocol *protocol= ctx->thd->protocol;
DBUG_ENTER("sp_instr_external::psm_row_prepare");
- if (ctx->thd->spcont->m_return_value_fld)
+ if (ctx->thd->spcont->m_return_value_fld || !ctx->result_sets)
goto err;
if (ctx->i->m_field_list.elements)
@@ -445,7 +462,7 @@
Protocol *protocol= ctx->thd->protocol;
DBUG_ENTER("sp_instr_external::psm_row_send");
- if (ctx->thd->spcont->m_return_value_fld)
+ if (ctx->thd->spcont->m_return_value_fld || !ctx->result_sets)
goto err;
if (protocol->write())
@@ -463,10 +480,12 @@
struct st_psm_context *ctx = (struct st_psm_context *) context;
DBUG_ENTER("sp_instr_external::psm_row_send");
- if (ctx->thd->spcont->m_return_value_fld)
+ if (ctx->thd->spcont->m_return_value_fld || !ctx->result_sets)
goto err;
send_eof(ctx->thd);
+
+ ctx->result_sets--;
DBUG_RETURN(0);
@@ -483,7 +502,7 @@
Item *item;
DBUG_ENTER("sp_instr_external::psm_row_field");
- if (ctx->thd->spcont->m_return_value_fld)
+ if (ctx->thd->spcont->m_return_value_fld || !ctx->result_sets)
goto err;
switch (field_type) {
--- 1.1/sql/sp_psm.h 2007-05-23 22:12:30 -07:00
+++ 1.2/sql/sp_psm.h 2007-05-23 22:12:30 -07:00
@@ -31,12 +31,16 @@
LEX_STRING m_name;
LEX_STRING m_language;
+ uint m_result_sets;
+ enum enum_sp_data_access m_daccess;
sp_instr_external(uint ip, sp_pcontext *ctx,
LEX_STRING &name, LEX_STRING &language,
- LEX *lex)
+ uint result_sets, enum enum_sp_data_access daccess,
+ LEX *lex)
: sp_instr(ip, ctx), m_lex_keeper(lex, TRUE),
- m_name(name), m_language(language)
+ m_name(name), m_language(language), m_result_sets(result_sets),
+ m_daccess(daccess)
{
}
--- 1.152/mysql-test/r/information_schema.result 2007-05-23 22:12:30 -07:00
+++ 1.153/mysql-test/r/information_schema.result 2007-05-23 22:12:30 -07:00
@@ -574,7 +574,7 @@
proc name char(64)
proc type enum('FUNCTION','PROCEDURE')
proc specific_name char(64)
-proc language enum('SQL')
+proc language char(64)
proc sql_data_access enum('CONTAINS_SQL','NO_SQL','READS_SQL_DATA','MODIFIES_SQL_DATA')
proc is_deterministic enum('YES','NO')
proc security_type enum('INVOKER','DEFINER')
--- 1.19/mysql-test/r/rpl_stm_reset_slave.result 2007-05-23 22:12:30 -07:00
+++ 1.20/mysql-test/r/rpl_stm_reset_slave.result 2007-05-23 22:12:30 -07:00
@@ -11,7 +11,7 @@
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
-Read_Master_Log_Pos 102
+Read_Master_Log_Pos 106
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
@@ -26,7 +26,7 @@
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 102
+Exec_Master_Log_Pos 106
Relay_Log_Space #
Until_Condition None
Until_Log_File
@@ -38,6 +38,7 @@
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
stop slave;
change master to master_user='test';
show slave status;
@@ -47,7 +48,7 @@
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
-Read_Master_Log_Pos 102
+Read_Master_Log_Pos 106
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
@@ -62,7 +63,7 @@
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 102
+Exec_Master_Log_Pos 106
Relay_Log_Space #
Until_Condition None
Until_Log_File
@@ -74,6 +75,7 @@
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
reset slave;
show slave status;
Slave_IO_State #
@@ -109,6 +111,7 @@
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
change master to master_user='root';
start slave;
show slave status;
@@ -118,7 +121,7 @@
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
-Read_Master_Log_Pos 102
+Read_Master_Log_Pos 106
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
@@ -133,7 +136,7 @@
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 102
+Exec_Master_Log_Pos 106
Relay_Log_Space #
Until_Condition None
Until_Log_File
@@ -145,6 +148,7 @@
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
stop slave;
reset slave;
start slave;
--- 1.113/libmysqld/Makefile.am 2007-05-23 22:12:30 -07:00
+++ 1.114/libmysqld/Makefile.am 2007-05-23 22:12:30 -07:00
@@ -70,6 +70,7 @@
unireg.cc uniques.cc stacktrace.c sql_union.cc hash_filo.cc \
spatial.cc gstream.cc sql_help.cc tztime.cc sql_cursor.cc \
sp_head.cc sp_pcontext.cc sp.cc sp_cache.cc sp_rcontext.cc \
+ sp_psm.cc \
parse_file.cc sql_view.cc sql_trigger.cc my_decimal.cc \
event_scheduler.cc events.cc event_data_objects.cc \
event_queue.cc event_db_repository.cc \
--- 1.149/sql/sp.cc 2007-05-23 22:12:30 -07:00
+++ 1.150/sql/sp.cc 2007-05-23 22:12:30 -07:00
@@ -1786,13 +1786,18 @@
buf->append(returns, returnslen);
}
buf->append('\n');
- if (is_external)
+ if (chistics->language.str)
{
- buf->append(STRING_WITH_LEN(" EXTERNAL NAME "));
- append_unescaped(buf, body, bodylen);
- buf->append(STRING_WITH_LEN(" LANGUAGE "));
+ buf->append(STRING_WITH_LEN(" LANGUAGE "));
append_identifier(thd, buf, chistics->language.str,
chistics->language.length);
+ buf->append('\n');
+ }
+ if (is_external && type == TYPE_ENUM_PROCEDURE &&
chistics->result_sets)
+ {
+ buf->append(STRING_WITH_LEN(" DYNAMIC RESULT SETS "));
+ buf->qs_append(chistics->result_sets);
+ buf->append('\n');
}
switch (chistics->daccess) {
case SP_NO_SQL:
@@ -1819,8 +1824,7 @@
append_unescaped(buf, chistics->comment.str, chistics->comment.length);
buf->append('\n');
}
- if (!is_external)
- buf->append(body, bodylen);
+ buf->append(body, bodylen);
return TRUE;
}
--- 1.268/sql/sp_head.cc 2007-05-23 22:12:30 -07:00
+++ 1.269/sql/sp_head.cc 2007-05-23 22:12:30 -07:00
@@ -569,10 +569,25 @@
*/
endp= skip_rear_comments(m_body_begin, endp);
- if (endp > m_body_begin)
- {
- m_body.length= endp - m_body_begin;
+ m_body.length= endp - m_body_begin;
+ if (!m_chistics->language.str ||
+ !strcasecmp(m_chistics->language.str, "SQL"))
m_body.str= strmake_root(root, m_body_begin, m_body.length);
+ else
+ {
+ char buffer[STRING_BUFFER_USUAL_SIZE];
+ String tmp(buffer, sizeof(buffer), system_charset_info);
+ tmp.length(0);
+
+ if (m_chistics->result_sets)
+ {
+ tmp.append("DYNAMIC RESULT SETS ");
+ tmp.qs_append(m_chistics->result_sets);
+ tmp.append(' ');
+ }
+ m_body.str= alloc_root(root, m_body.length + tmp.length() + 1);
+ *strnmov(strmov(m_body.str, tmp.c_ptr()), m_body_begin, m_body.length)= 0;
+ m_body.length+= tmp.length();
}
m_defstr.length= endp - lex->buf;
m_defstr.str= strmake_root(root, lex->buf, m_defstr.length);
--- 1.48/mysql-test/r/system_mysql_db.result 2007-05-23 22:12:30 -07:00
+++ 1.49/mysql-test/r/system_mysql_db.result 2007-05-23 22:12:30 -07:00
@@ -191,7 +191,7 @@
`name` char(64) NOT NULL DEFAULT '',
`type` enum('FUNCTION','PROCEDURE') NOT NULL,
`specific_name` char(64) NOT NULL DEFAULT '',
- `language` enum('SQL') NOT NULL DEFAULT 'SQL',
+ `language` char(64) NOT NULL DEFAULT 'SQL',
`sql_data_access` enum('CONTAINS_SQL','NO_SQL','READS_SQL_DATA','MODIFIES_SQL_DATA')
NOT NULL DEFAULT 'CONTAINS_SQL',
`is_deterministic` enum('YES','NO') NOT NULL DEFAULT 'NO',
`security_type` enum('INVOKER','DEFINER') NOT NULL DEFAULT 'DEFINER',
| Thread |
|---|
| • bk commit into 5.2 tree (acurtis:1.2527) | antony | 24 May |