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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
2fad8ac2
Commit
2fad8ac2
authored
Mar 14, 2007
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Manual merge from 5.0-runtime to 5.1-runtime
parent
34a0de58
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
364 additions
and
6 deletions
+364
-6
include/my_global.h
include/my_global.h
+6
-0
mysql-test/r/sp-error.result
mysql-test/r/sp-error.result
+52
-0
mysql-test/r/sp.result
mysql-test/r/sp.result
+165
-0
mysql-test/t/sp.test
mysql-test/t/sp.test
+135
-0
sql/field.cc
sql/field.cc
+3
-3
sql/sql_select.cc
sql/sql_select.cc
+3
-3
No files found.
include/my_global.h
View file @
2fad8ac2
...
@@ -1486,4 +1486,10 @@ do { doubleget_union _tmp; \
...
@@ -1486,4 +1486,10 @@ do { doubleget_union _tmp; \
#include <new>
#include <new>
#endif
#endif
/* Length of decimal number represented by INT32. */
#define MY_INT32_NUM_DECIMAL_DIGITS 11
/* Length of decimal number represented by INT64. */
#define MY_INT64_NUM_DECIMAL_DIGITS 21
#endif
/* my_global_h */
#endif
/* my_global_h */
mysql-test/r/sp-error.result
View file @
2fad8ac2
...
@@ -1414,3 +1414,55 @@ ERROR 42000: This version of MySQL doesn't yet support 'return value collation'
...
@@ -1414,3 +1414,55 @@ ERROR 42000: This version of MySQL doesn't yet support 'return value collation'
create function bug20701() returns varchar(25) return "test";
create function bug20701() returns varchar(25) return "test";
drop function bug20701;
drop function bug20701;
End of 5.1 tests
End of 5.1 tests
create procedure proc_26503_error_1()
begin
retry:
repeat
begin
declare continue handler for sqlexception
begin
iterate retry;
end
select "do something";
end
until true end repeat retry;
end//
ERROR 42000: ITERATE with no matching label: retry
create procedure proc_26503_error_2()
begin
retry:
repeat
begin
declare continue handler for sqlexception
iterate retry;
select "do something";
end
until true end repeat retry;
end//
ERROR 42000: ITERATE with no matching label: retry
create procedure proc_26503_error_3()
begin
retry:
repeat
begin
declare continue handler for sqlexception
begin
leave retry;
end
select "do something";
end
until true end repeat retry;
end//
ERROR 42000: LEAVE with no matching label: retry
create procedure proc_26503_error_4()
begin
retry:
repeat
begin
declare continue handler for sqlexception
leave retry;
select "do something";
end
until true end repeat retry;
end//
ERROR 42000: LEAVE with no matching label: retry
mysql-test/r/sp.result
View file @
2fad8ac2
...
@@ -5896,4 +5896,169 @@ func_8407_b()
...
@@ -5896,4 +5896,169 @@ func_8407_b()
1500
1500
drop function func_8407_a|
drop function func_8407_a|
drop function func_8407_b|
drop function func_8407_b|
drop table if exists table_26503|
drop procedure if exists proc_26503_ok_1|
drop procedure if exists proc_26503_ok_2|
drop procedure if exists proc_26503_ok_3|
drop procedure if exists proc_26503_ok_4|
create table table_26503(a int unique)|
create procedure proc_26503_ok_1(v int)
begin
declare i int default 5;
declare continue handler for sqlexception
begin
select 'caught something';
retry:
while i > 0 do
begin
set i = i - 1;
select 'looping', i;
iterate retry;
select 'dead code';
end;
end while retry;
select 'leaving handler';
end;
select 'do something';
insert into table_26503 values (v);
select 'do something again';
insert into table_26503 values (v);
end|
create procedure proc_26503_ok_2(v int)
begin
declare i int default 5;
declare continue handler for sqlexception
begin
select 'caught something';
retry:
while i > 0 do
begin
set i = i - 1;
select 'looping', i;
leave retry;
select 'dead code';
end;
end while;
select 'leaving handler';
end;
select 'do something';
insert into table_26503 values (v);
select 'do something again';
insert into table_26503 values (v);
end|
create procedure proc_26503_ok_3(v int)
begin
declare i int default 5;
retry:
begin
declare continue handler for sqlexception
begin
select 'caught something';
retry:
while i > 0 do
begin
set i = i - 1;
select 'looping', i;
iterate retry;
select 'dead code';
end;
end while retry;
select 'leaving handler';
end;
select 'do something';
insert into table_26503 values (v);
select 'do something again';
insert into table_26503 values (v);
end;
end|
create procedure proc_26503_ok_4(v int)
begin
declare i int default 5;
retry:
begin
declare continue handler for sqlexception
begin
select 'caught something';
retry:
while i > 0 do
begin
set i = i - 1;
select 'looping', i;
leave retry;
select 'dead code';
end;
end while;
select 'leaving handler';
end;
select 'do something';
insert into table_26503 values (v);
select 'do something again';
insert into table_26503 values (v);
end;
end|
call proc_26503_ok_1(1)|
do something
do something
do something again
do something again
caught something
caught something
looping i
looping 4
looping i
looping 3
looping i
looping 2
looping i
looping 1
looping i
looping 0
leaving handler
leaving handler
call proc_26503_ok_2(2)|
do something
do something
do something again
do something again
caught something
caught something
looping i
looping 4
leaving handler
leaving handler
call proc_26503_ok_3(3)|
do something
do something
do something again
do something again
caught something
caught something
looping i
looping 4
looping i
looping 3
looping i
looping 2
looping i
looping 1
looping i
looping 0
leaving handler
leaving handler
call proc_26503_ok_4(4)|
do something
do something
do something again
do something again
caught something
caught something
looping i
looping 4
leaving handler
leaving handler
drop table table_26503|
drop procedure proc_26503_ok_1|
drop procedure proc_26503_ok_2|
drop procedure proc_26503_ok_3|
drop procedure proc_26503_ok_4|
drop table t1,t2;
drop table t1,t2;
mysql-test/t/sp.test
View file @
2fad8ac2
...
@@ -6887,6 +6887,141 @@ select func_8407_b()|
...
@@ -6887,6 +6887,141 @@ select func_8407_b()|
drop function func_8407_a|
drop function func_8407_a|
drop function func_8407_b|
drop function func_8407_b|
#
# Bug#26503 (Illegal SQL exception handler code causes the server to crash)
#
--disable_warnings
drop table if exists table_26503|
drop procedure if exists proc_26503_ok_1|
drop procedure if exists proc_26503_ok_2|
drop procedure if exists proc_26503_ok_3|
drop procedure if exists proc_26503_ok_4|
--enable_warnings
create table table_26503(a int unique)|
create procedure proc_26503_ok_1(v int)
begin
declare i int default 5;
declare continue handler for sqlexception
begin
select 'caught something';
retry:
while i > 0 do
begin
set i = i - 1;
select 'looping', i;
iterate retry;
select 'dead code';
end;
end while retry;
select 'leaving handler';
end;
select 'do something';
insert into table_26503 values (v);
select 'do something again';
insert into table_26503 values (v);
end|
create procedure proc_26503_ok_2(v int)
begin
declare i int default 5;
declare continue handler for sqlexception
begin
select 'caught something';
retry:
while i > 0 do
begin
set i = i - 1;
select 'looping', i;
leave retry;
select 'dead code';
end;
end while;
select 'leaving handler';
end;
select 'do something';
insert into table_26503 values (v);
select 'do something again';
insert into table_26503 values (v);
end|
## The outer retry label should not prevent using the inner label.
create procedure proc_26503_ok_3(v int)
begin
declare i int default 5;
retry:
begin
declare continue handler for sqlexception
begin
select 'caught something';
retry:
while i > 0 do
begin
set i = i - 1;
select 'looping', i;
iterate retry;
select 'dead code';
end;
end while retry;
select 'leaving handler';
end;
select 'do something';
insert into table_26503 values (v);
select 'do something again';
insert into table_26503 values (v);
end;
end|
## The outer retry label should not prevent using the inner label.
create procedure proc_26503_ok_4(v int)
begin
declare i int default 5;
retry:
begin
declare continue handler for sqlexception
begin
select 'caught something';
retry:
while i > 0 do
begin
set i = i - 1;
select 'looping', i;
leave retry;
select 'dead code';
end;
end while;
select 'leaving handler';
end;
select 'do something';
insert into table_26503 values (v);
select 'do something again';
insert into table_26503 values (v);
end;
end|
call proc_26503_ok_1(1)|
call proc_26503_ok_2(2)|
call proc_26503_ok_3(3)|
call proc_26503_ok_4(4)|
drop table table_26503|
drop procedure proc_26503_ok_1|
drop procedure proc_26503_ok_2|
drop procedure proc_26503_ok_3|
drop procedure proc_26503_ok_4|
#
#
# NOTE: The delimiter is `
|
`, and not `
;
`. It is changed to `
;
`
# NOTE: The delimiter is `
|
`, and not `
;
`. It is changed to `
;
`
# at the end of the file!
# at the end of the file!
...
...
sql/field.cc
View file @
2fad8ac2
...
@@ -1207,13 +1207,13 @@ String *Field::val_int_as_str(String *val_buffer, my_bool unsigned_val)
...
@@ -1207,13 +1207,13 @@ String *Field::val_int_as_str(String *val_buffer, my_bool unsigned_val)
{
{
ASSERT_COLUMN_MARKED_FOR_READ
;
ASSERT_COLUMN_MARKED_FOR_READ
;
CHARSET_INFO
*
cs
=
&
my_charset_bin
;
CHARSET_INFO
*
cs
=
&
my_charset_bin
;
uint
length
=
21
;
uint
length
;
longlong
value
=
val_int
();
longlong
value
=
val_int
();
if
(
val_buffer
->
alloc
(
length
))
if
(
val_buffer
->
alloc
(
MY_INT64_NUM_DECIMAL_DIGITS
))
return
0
;
return
0
;
length
=
(
uint
)
(
*
cs
->
cset
->
longlong10_to_str
)(
cs
,
(
char
*
)
val_buffer
->
ptr
(),
length
=
(
uint
)
(
*
cs
->
cset
->
longlong10_to_str
)(
cs
,
(
char
*
)
val_buffer
->
ptr
(),
length
,
MY_INT64_NUM_DECIMAL_DIGITS
,
unsigned_val
?
10
:
-
10
,
unsigned_val
?
10
:
-
10
,
value
);
value
);
val_buffer
->
length
(
length
);
val_buffer
->
length
(
length
);
...
...
sql/sql_select.cc
View file @
2fad8ac2
...
@@ -8675,7 +8675,7 @@ remove_eq_conds(THD *thd, COND *cond, Item::cond_result *cond_value)
...
@@ -8675,7 +8675,7 @@ remove_eq_conds(THD *thd, COND *cond, Item::cond_result *cond_value)
if
((
new_cond
=
new
Item_func_eq
(
args
[
0
],
if
((
new_cond
=
new
Item_func_eq
(
args
[
0
],
new
Item_int
(
"last_insert_id()"
,
new
Item_int
(
"last_insert_id()"
,
thd
->
read_first_successful_insert_id_in_prev_stmt
(),
thd
->
read_first_successful_insert_id_in_prev_stmt
(),
21
))))
MY_INT64_NUM_DECIMAL_DIGITS
))))
{
{
cond
=
new_cond
;
cond
=
new_cond
;
/*
/*
...
@@ -8940,7 +8940,7 @@ static Field *create_tmp_field_from_item(THD *thd, Item *item, TABLE *table,
...
@@ -8940,7 +8940,7 @@ static Field *create_tmp_field_from_item(THD *thd, Item *item, TABLE *table,
break
;
break
;
case
INT_RESULT
:
case
INT_RESULT
:
/* Select an integer type with the minimal fit precision */
/* Select an integer type with the minimal fit precision */
if
(
item
->
max_length
>
11
)
if
(
item
->
max_length
>
MY_INT32_NUM_DECIMAL_DIGITS
)
new_field
=
new
Field_longlong
(
item
->
max_length
,
maybe_null
,
new_field
=
new
Field_longlong
(
item
->
max_length
,
maybe_null
,
item
->
name
,
item
->
unsigned_flag
);
item
->
name
,
item
->
unsigned_flag
);
else
else
...
@@ -15255,7 +15255,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
...
@@ -15255,7 +15255,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
examined_rows
=
(
ha_rows
)
join
->
best_positions
[
i
].
records_read
;
examined_rows
=
(
ha_rows
)
join
->
best_positions
[
i
].
records_read
;
item_list
.
push_back
(
new
Item_int
((
longlong
)
(
ulonglong
)
examined_rows
,
item_list
.
push_back
(
new
Item_int
((
longlong
)
(
ulonglong
)
examined_rows
,
21
));
MY_INT64_NUM_DECIMAL_DIGITS
));
/* Add "filtered" field to item_list. */
/* Add "filtered" field to item_list. */
if
(
join
->
thd
->
lex
->
describe
&
DESCRIBE_EXTENDED
)
if
(
join
->
thd
->
lex
->
describe
&
DESCRIBE_EXTENDED
)
...
...
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