mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 10:31:54 +01:00
Merge mysql.com:/usr/local/bk/mysql-5.0
into mysql.com:/usr/home/pem/mysql-5.0
This commit is contained in:
commit
d825ed1a6b
7 changed files with 125 additions and 5 deletions
|
@ -786,3 +786,50 @@ END|
|
||||||
ERROR 0A000: HANDLER is not allowed in stored procedures
|
ERROR 0A000: HANDLER is not allowed in stored procedures
|
||||||
SELECT bug12995()|
|
SELECT bug12995()|
|
||||||
ERROR 42000: FUNCTION test.bug12995 does not exist
|
ERROR 42000: FUNCTION test.bug12995 does not exist
|
||||||
|
drop procedure if exists bug12712;
|
||||||
|
drop function if exists bug12712;
|
||||||
|
create procedure bug12712()
|
||||||
|
set session autocommit = 0;
|
||||||
|
select @@autocommit;
|
||||||
|
@@autocommit
|
||||||
|
1
|
||||||
|
set @au = @@autocommit;
|
||||||
|
call bug12712();
|
||||||
|
select @@autocommit;
|
||||||
|
@@autocommit
|
||||||
|
0
|
||||||
|
set session autocommit = @au;
|
||||||
|
create function bug12712()
|
||||||
|
returns int
|
||||||
|
begin
|
||||||
|
call bug12712();
|
||||||
|
return 0;
|
||||||
|
end|
|
||||||
|
set @x = bug12712()|
|
||||||
|
ERROR HY000: Not allowed to set autocommit from a stored function or trigger
|
||||||
|
drop procedure bug12712|
|
||||||
|
drop function bug12712|
|
||||||
|
create function bug12712()
|
||||||
|
returns int
|
||||||
|
begin
|
||||||
|
set session autocommit = 0;
|
||||||
|
return 0;
|
||||||
|
end|
|
||||||
|
ERROR HY000: Not allowed to set autocommit from a stored function or trigger
|
||||||
|
create function bug12712()
|
||||||
|
returns int
|
||||||
|
begin
|
||||||
|
set @@autocommit = 0;
|
||||||
|
return 0;
|
||||||
|
end|
|
||||||
|
ERROR HY000: Not allowed to set autocommit from a stored function or trigger
|
||||||
|
create function bug12712()
|
||||||
|
returns int
|
||||||
|
begin
|
||||||
|
set local autocommit = 0;
|
||||||
|
return 0;
|
||||||
|
end|
|
||||||
|
ERROR HY000: Not allowed to set autocommit from a stored function or trigger
|
||||||
|
create trigger bug12712
|
||||||
|
before insert on t1 for each row set session autocommit = 0;
|
||||||
|
ERROR HY000: Not allowed to set autocommit from a stored function or trigger
|
||||||
|
|
|
@ -1130,6 +1130,64 @@ END|
|
||||||
SELECT bug12995()|
|
SELECT bug12995()|
|
||||||
delimiter ;|
|
delimiter ;|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# BUG#12712: SET AUTOCOMMIT should fail within SP/functions/triggers
|
||||||
|
#
|
||||||
|
--disable_warnings
|
||||||
|
drop procedure if exists bug12712;
|
||||||
|
drop function if exists bug12712;
|
||||||
|
--enable_warnings
|
||||||
|
# Can...
|
||||||
|
create procedure bug12712()
|
||||||
|
set session autocommit = 0;
|
||||||
|
|
||||||
|
select @@autocommit;
|
||||||
|
set @au = @@autocommit;
|
||||||
|
call bug12712();
|
||||||
|
select @@autocommit;
|
||||||
|
set session autocommit = @au;
|
||||||
|
|
||||||
|
delimiter |;
|
||||||
|
create function bug12712()
|
||||||
|
returns int
|
||||||
|
begin
|
||||||
|
call bug12712();
|
||||||
|
return 0;
|
||||||
|
end|
|
||||||
|
|
||||||
|
# Can't...
|
||||||
|
--error ER_SP_CANT_SET_AUTOCOMMIT
|
||||||
|
set @x = bug12712()|
|
||||||
|
drop procedure bug12712|
|
||||||
|
drop function bug12712|
|
||||||
|
--error ER_SP_CANT_SET_AUTOCOMMIT
|
||||||
|
create function bug12712()
|
||||||
|
returns int
|
||||||
|
begin
|
||||||
|
set session autocommit = 0;
|
||||||
|
return 0;
|
||||||
|
end|
|
||||||
|
--error ER_SP_CANT_SET_AUTOCOMMIT
|
||||||
|
create function bug12712()
|
||||||
|
returns int
|
||||||
|
begin
|
||||||
|
set @@autocommit = 0;
|
||||||
|
return 0;
|
||||||
|
end|
|
||||||
|
--error ER_SP_CANT_SET_AUTOCOMMIT
|
||||||
|
create function bug12712()
|
||||||
|
returns int
|
||||||
|
begin
|
||||||
|
set local autocommit = 0;
|
||||||
|
return 0;
|
||||||
|
end|
|
||||||
|
delimiter ;|
|
||||||
|
--error ER_SP_CANT_SET_AUTOCOMMIT
|
||||||
|
create trigger bug12712
|
||||||
|
before insert on t1 for each row set session autocommit = 0;
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# BUG#NNNN: New bug synopsis
|
# BUG#NNNN: New bug synopsis
|
||||||
#
|
#
|
||||||
|
|
|
@ -447,10 +447,10 @@ sys_var_thd_date_time_format sys_datetime_format("datetime_format",
|
||||||
|
|
||||||
/* Variables that are bits in THD */
|
/* Variables that are bits in THD */
|
||||||
|
|
||||||
static sys_var_thd_bit sys_autocommit("autocommit", 0,
|
sys_var_thd_bit sys_autocommit("autocommit", 0,
|
||||||
set_option_autocommit,
|
set_option_autocommit,
|
||||||
OPTION_NOT_AUTOCOMMIT,
|
OPTION_NOT_AUTOCOMMIT,
|
||||||
1);
|
1);
|
||||||
static sys_var_thd_bit sys_big_tables("big_tables", 0,
|
static sys_var_thd_bit sys_big_tables("big_tables", 0,
|
||||||
set_option_bit,
|
set_option_bit,
|
||||||
OPTION_BIG_TABLES);
|
OPTION_BIG_TABLES);
|
||||||
|
|
|
@ -905,6 +905,7 @@ extern sys_var_const_str sys_charset_system;
|
||||||
extern sys_var_str sys_init_connect;
|
extern sys_var_str sys_init_connect;
|
||||||
extern sys_var_str sys_init_slave;
|
extern sys_var_str sys_init_slave;
|
||||||
extern sys_var_thd_time_zone sys_time_zone;
|
extern sys_var_thd_time_zone sys_time_zone;
|
||||||
|
extern sys_var_thd_bit sys_autocommit;
|
||||||
CHARSET_INFO *get_old_charset_by_name(const char *old_name);
|
CHARSET_INFO *get_old_charset_by_name(const char *old_name);
|
||||||
gptr find_named(I_List<NAMED_LIST> *list, const char *name, uint length,
|
gptr find_named(I_List<NAMED_LIST> *list, const char *name, uint length,
|
||||||
NAMED_LIST **found);
|
NAMED_LIST **found);
|
||||||
|
|
|
@ -5403,3 +5403,5 @@ ER_VIEW_PREVENT_UPDATE
|
||||||
eng "The definition of table '%-.64s' prevents operation %s on table '%-.64s'."
|
eng "The definition of table '%-.64s' prevents operation %s on table '%-.64s'."
|
||||||
ER_PS_NO_RECURSION
|
ER_PS_NO_RECURSION
|
||||||
eng "The prepared statement contains a stored routine call that refers to that same statement. It's not allowed to execute a prepared statement in such a recursive manner"
|
eng "The prepared statement contains a stored routine call that refers to that same statement. It's not allowed to execute a prepared statement in such a recursive manner"
|
||||||
|
ER_SP_CANT_SET_AUTOCOMMIT
|
||||||
|
eng "Not allowed to set autocommit from a stored function or trigger"
|
||||||
|
|
|
@ -114,7 +114,8 @@ public:
|
||||||
IN_HANDLER= 4, // Is set if the parser is in a handler body
|
IN_HANDLER= 4, // Is set if the parser is in a handler body
|
||||||
MULTI_RESULTS= 8, // Is set if a procedure with SELECT(s)
|
MULTI_RESULTS= 8, // Is set if a procedure with SELECT(s)
|
||||||
CONTAINS_DYNAMIC_SQL= 16, // Is set if a procedure with PREPARE/EXECUTE
|
CONTAINS_DYNAMIC_SQL= 16, // Is set if a procedure with PREPARE/EXECUTE
|
||||||
IS_INVOKED= 32 // Is set if this sp_head is being used.
|
IS_INVOKED= 32, // Is set if this sp_head is being used
|
||||||
|
HAS_SET_AUTOCOMMIT_STMT = 64 // Is set if a procedure with 'set autocommit'
|
||||||
};
|
};
|
||||||
|
|
||||||
int m_type; // TYPE_ENUM_FUNCTION or TYPE_ENUM_PROCEDURE
|
int m_type; // TYPE_ENUM_FUNCTION or TYPE_ENUM_PROCEDURE
|
||||||
|
@ -282,6 +283,8 @@ public:
|
||||||
my_error(ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0), "Dynamic SQL");
|
my_error(ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0), "Dynamic SQL");
|
||||||
else if (m_flags & MULTI_RESULTS)
|
else if (m_flags & MULTI_RESULTS)
|
||||||
my_error(ER_SP_NO_RETSET, MYF(0), where);
|
my_error(ER_SP_NO_RETSET, MYF(0), where);
|
||||||
|
else if (m_flags & HAS_SET_AUTOCOMMIT_STMT)
|
||||||
|
my_error(ER_SP_CANT_SET_AUTOCOMMIT, MYF(0));
|
||||||
return test(m_flags & (CONTAINS_DYNAMIC_SQL|MULTI_RESULTS));
|
return test(m_flags & (CONTAINS_DYNAMIC_SQL|MULTI_RESULTS));
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -8005,6 +8005,15 @@ internal_variable_name:
|
||||||
if (tmp == &sys_time_zone &&
|
if (tmp == &sys_time_zone &&
|
||||||
lex->add_time_zone_tables_to_query_tables(YYTHD))
|
lex->add_time_zone_tables_to_query_tables(YYTHD))
|
||||||
YYABORT;
|
YYABORT;
|
||||||
|
else
|
||||||
|
if (spc && tmp == &sys_autocommit)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
We don't allow setting AUTOCOMMIT from a stored function
|
||||||
|
or trigger.
|
||||||
|
*/
|
||||||
|
lex->sphead->m_flags|= sp_head::HAS_SET_AUTOCOMMIT_STMT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue