Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
3cd1861a
Commit
3cd1861a
authored
Jul 12, 2013
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merge bugfuxes for sp-error.test
parent
f0502cf8
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
1890 additions
and
5 deletions
+1890
-5
mysql-test/r/signal.result
mysql-test/r/signal.result
+10
-4
mysql-test/r/sp-error.result
mysql-test/r/sp-error.result
+875
-0
mysql-test/t/signal.test
mysql-test/t/signal.test
+10
-1
mysql-test/t/sp-error.test
mysql-test/t/sp-error.test
+970
-0
sql/sp_head.cc
sql/sp_head.cc
+8
-0
sql/sp_rcontext.cc
sql/sp_rcontext.cc
+17
-0
No files found.
mysql-test/r/signal.result
View file @
3cd1861a
...
...
@@ -1315,19 +1315,25 @@ drop procedure test_signal $$
#
# Test where SIGNAL can be used
#
# RETURN statement clears Diagnostics Area, thus
# the warnings raised in a stored function are not
# visible outsidef the stored function. So, we're using
# @@warning_count variable to check that SIGNAL succeeded.
create function test_signal_func() returns integer
begin
DECLARE v INT;
DECLARE warn CONDITION FOR SQLSTATE "01XXX";
SIGNAL warn SET
MESSAGE_TEXT = "This function SIGNAL a warning",
MYSQL_ERRNO = 1012;
return 5;
SELECT @@warning_count INTO v;
return v;
end $$
select test_signal_func() $$
test_signal_func()
5
Warnings:
Warning 1012 This function SIGNAL a warning
1
drop function test_signal_func $$
create function test_signal_func() returns integer
begin
...
...
mysql-test/r/sp-error.result
View file @
3cd1861a
This diff is collapsed.
Click to expand it.
mysql-test/t/signal.test
View file @
3cd1861a
...
...
@@ -1551,15 +1551,24 @@ drop procedure test_signal $$
--
echo
# Test where SIGNAL can be used
--
echo
#
--
echo
--
echo
# RETURN statement clears Diagnostics Area, thus
--
echo
# the warnings raised in a stored function are not
--
echo
# visible outsidef the stored function. So, we're using
--
echo
# @@warning_count variable to check that SIGNAL succeeded.
--
echo
create
function
test_signal_func
()
returns
integer
begin
DECLARE
v
INT
;
DECLARE
warn
CONDITION
FOR
SQLSTATE
"01XXX"
;
SIGNAL
warn
SET
MESSAGE_TEXT
=
"This function SIGNAL a warning"
,
MYSQL_ERRNO
=
1012
;
return
5
;
SELECT
@@
warning_count
INTO
v
;
return
v
;
end
$$
select
test_signal_func
()
$$
...
...
mysql-test/t/sp-error.test
View file @
3cd1861a
This diff is collapsed.
Click to expand it.
sql/sp_head.cc
View file @
3cd1861a
...
...
@@ -3390,6 +3390,14 @@ sp_instr_freturn::execute(THD *thd, uint *nextp)
int
sp_instr_freturn
::
exec_core
(
THD
*
thd
,
uint
*
nextp
)
{
/*
RETURN is a "procedure statement" (in terms of the SQL standard).
That means, Diagnostics Area should be clean before its execution.
*/
Diagnostics_area
*
da
=
thd
->
get_stmt_da
();
da
->
clear_warning_info
(
da
->
warning_info_id
());
/*
Change <next instruction pointer>, so that this will be the last
instruction in the stored function.
...
...
sql/sp_rcontext.cc
View file @
3cd1861a
...
...
@@ -233,6 +233,23 @@ bool sp_rcontext::handle_sql_condition(THD *thd,
if
(
found_handler
)
found_condition
=
da
->
get_error_condition
();
/*
Found condition can be NULL if the diagnostics area was full
when the error was raised. It can also be NULL if
Diagnostics_area::set_error_status(uint sql_error) was used.
In these cases, make a temporary Sql_condition here so the
error can be handled.
*/
if
(
!
found_condition
)
{
Sql_condition
*
condition
=
new
(
callers_arena
->
mem_root
)
Sql_condition
(
callers_arena
->
mem_root
);
condition
->
set
(
da
->
sql_errno
(),
da
->
get_sqlstate
(),
Sql_condition
::
WARN_LEVEL_ERROR
,
da
->
message
());
found_condition
=
condition
;
}
}
else
if
(
da
->
current_statement_warn_count
())
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment