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
dbdf3992
Commit
dbdf3992
authored
Jan 08, 2004
by
lenz@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge lgrimmer@build.mysql.com:/home/bk/mysql-5.0
into mysql.com:/space/my/mysql-5.0
parents
f204b080
c40e51f2
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
117 additions
and
19 deletions
+117
-19
mysql-test/r/sp-error.result
mysql-test/r/sp-error.result
+19
-0
mysql-test/r/sp.result
mysql-test/r/sp.result
+15
-0
mysql-test/t/sp-error.test
mysql-test/t/sp-error.test
+32
-0
mysql-test/t/sp.test
mysql-test/t/sp.test
+19
-0
sql/sp_rcontext.cc
sql/sp_rcontext.cc
+10
-9
sql/sp_rcontext.h
sql/sp_rcontext.h
+1
-1
sql/sql_yacc.yy
sql/sql_yacc.yy
+21
-9
No files found.
mysql-test/r/sp-error.result
View file @
dbdf3992
...
...
@@ -283,4 +283,23 @@ create table t3 (column_1 int)|
call bug1653()|
drop procedure bug1653|
drop table t3|
create procedure bug2259()
begin
declare v1 int;
declare c1 cursor for select s1 from t10;
fetch c1 into v1;
end|
call bug2259()|
ERROR 24000: Cursor is not open
drop procedure bug2259|
create procedure bug2272()
begin
declare v int;
update t1 set v = 42;
end|
insert into t1 values (666, 51.3)|
call bug2272()|
ERROR 42S22: Unknown column 'v' in 'field list'
delete from t1|
drop procedure bug2272|
drop table t1|
mysql-test/r/sp.result
View file @
dbdf3992
...
...
@@ -893,6 +893,21 @@ avg 0 4.4
delete from t1|
delete from t2|
drop procedure bug1874|
create procedure bug2260()
begin
declare v1 int;
declare continue handler for not found set @x2 = 1;
declare c1 cursor for select data from t1;
open c1;
fetch c1 into v1;
set @x2 = 2;
close c1;
end|
call bug2260()|
select @x2|
@x2
2
drop procedure bug2260|
drop table if exists fac|
create table fac (n int unsigned not null primary key, f bigint unsigned)|
create procedure ifac(n int unsigned)
...
...
mysql-test/t/sp-error.test
View file @
dbdf3992
...
...
@@ -388,6 +388,38 @@ call bug1653()|
drop
procedure
bug1653
|
drop
table
t3
|
#
# BUG#2259
#
# Note: When this bug existed, it did not necessarily cause a crash
# in all builds, but valgrind did give warnings.
create
procedure
bug2259
()
begin
declare
v1
int
;
declare
c1
cursor
for
select
s1
from
t10
;
fetch
c1
into
v1
;
end
|
--
error
1310
call
bug2259
()
|
drop
procedure
bug2259
|
#
# BUG#2272
#
create
procedure
bug2272
()
begin
declare
v
int
;
update
t1
set
v
=
42
;
end
|
insert
into
t1
values
(
666
,
51.3
)
|
--
error
1054
call
bug2272
()
|
delete
from
t1
|
drop
procedure
bug2272
|
drop
table
t1
|
...
...
mysql-test/t/sp.test
View file @
dbdf3992
...
...
@@ -1036,6 +1036,25 @@ delete from t1|
delete
from
t2
|
drop
procedure
bug1874
|
#
# BUG#2260
#
create
procedure
bug2260
()
begin
declare
v1
int
;
declare
continue
handler
for
not
found
set
@
x2
=
1
;
declare
c1
cursor
for
select
data
from
t1
;
open
c1
;
fetch
c1
into
v1
;
set
@
x2
=
2
;
close
c1
;
end
|
call
bug2260
()
|
select
@
x2
|
drop
procedure
bug2260
|
#
# Some "real" examples
...
...
sql/sp_rcontext.cc
View file @
dbdf3992
...
...
@@ -72,15 +72,15 @@ sp_rcontext::find_handler(uint sql_errno)
found
=
1
;
break
;
case
sp_cond_type_t
:
:
warning
:
if
(
sqlstate
[
0
]
==
'0'
&&
sqlstate
[
0
]
==
'1'
)
if
(
sqlstate
[
0
]
==
'0'
&&
sqlstate
[
1
]
==
'1'
)
found
=
1
;
break
;
case
sp_cond_type_t
:
:
notfound
:
if
(
sqlstate
[
0
]
==
'0'
&&
sqlstate
[
0
]
==
'2'
)
if
(
sqlstate
[
0
]
==
'0'
&&
sqlstate
[
1
]
==
'2'
)
found
=
1
;
break
;
case
sp_cond_type_t
:
:
exception
:
if
(
sqlstate
[
0
]
!=
'0'
||
sqlstate
[
0
]
>
'2'
)
if
(
sqlstate
[
0
]
!=
'0'
||
sqlstate
[
1
]
>
'2'
)
found
=
1
;
break
;
}
...
...
@@ -176,10 +176,13 @@ sp_cursor::close(THD *thd)
void
sp_cursor
::
destroy
()
{
delete
m_prot
;
m_prot
=
NULL
;
free_root
(
&
m_mem_root
,
MYF
(
0
));
bzero
((
char
*
)
&
m_mem_root
,
sizeof
(
m_mem_root
));
if
(
m_prot
)
{
delete
m_prot
;
m_prot
=
NULL
;
free_root
(
&
m_mem_root
,
MYF
(
0
));
bzero
((
char
*
)
&
m_mem_root
,
sizeof
(
m_mem_root
));
}
m_isopen
=
FALSE
;
}
...
...
@@ -190,14 +193,12 @@ sp_cursor::fetch(THD *thd, List<struct sp_pvar> *vars)
sp_pvar_t
*
pv
;
MYSQL_ROW
row
;
uint
fldcount
;
MYSQL_FIELD
*
fields
=
m_prot
->
fields
;
if
(
!
m_isopen
)
{
send_error
(
thd
,
ER_SP_CURSOR_NOT_OPEN
);
return
-
1
;
}
if
(
m_current_row
==
NULL
)
{
send_error
(
thd
,
ER_SP_FETCH_NO_DATA
);
...
...
sql/sp_rcontext.h
View file @
dbdf3992
...
...
@@ -205,7 +205,7 @@ class sp_cursor : public Sql_alloc
public:
sp_cursor
(
LEX
*
lex
)
:
m_lex
(
lex
),
m_isopen
(
0
),
m_current_row
(
NULL
)
:
m_lex
(
lex
),
m_
prot
(
NULL
),
m_
isopen
(
0
),
m_current_row
(
NULL
)
{
/* Empty */
}
...
...
sql/sql_yacc.yy
View file @
dbdf3992
...
...
@@ -679,6 +679,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
param_marker singlerow_subselect singlerow_subselect_init
signed_literal NUM_literal
exists_subselect exists_subselect_init sp_opt_default
simple_ident_nospvar simple_ident_q
%type <item_list>
expr_list sp_expr_list udf_expr_list udf_expr_list2 when_list
...
...
@@ -1257,7 +1258,7 @@ sp_fdparams:
;
sp_fdparam:
ident type
sp_opt_locator
ident type
{
LEX *lex= Lex;
sp_pcontext *spc= lex->spcont;
...
...
@@ -1283,7 +1284,7 @@ sp_pdparams:
;
sp_pdparam:
sp_opt_inout ident type
sp_opt_locator
sp_opt_inout ident type
{
LEX *lex= Lex;
sp_pcontext *spc= lex->spcont;
...
...
@@ -1305,11 +1306,6 @@ sp_opt_inout:
| INOUT_SYM { $$= sp_param_inout; }
;
sp_opt_locator:
/* Empty */
| AS LOCATOR_SYM
;
sp_proc_stmts:
/* Empty */ {}
| sp_proc_stmts sp_proc_stmt ';'
...
...
@@ -4999,7 +4995,7 @@ update_list:
if (add_item_to_list(YYTHD, $3) || add_value_to_list(YYTHD, $5))
YYABORT;
}
| simple_ident equal expr_or_default
| simple_ident
_nospvar
equal expr_or_default
{
if (add_item_to_list(YYTHD, $1) || add_value_to_list(YYTHD, $3))
YYABORT;
...
...
@@ -5680,7 +5676,23 @@ simple_ident:
(Item*) new Item_ref(NullS,NullS,$1.str);
}
}
| ident '.' ident
| simple_ident_q { $$= $1; }
;
simple_ident_nospvar:
ident
{
SELECT_LEX *sel=Select;
$$= (sel->parsing_place != SELECT_LEX_NODE::IN_HAVING ||
sel->get_in_sum_expr() > 0) ?
(Item*) new Item_field(NullS,NullS,$1.str) :
(Item*) new Item_ref(NullS,NullS,$1.str);
}
| simple_ident_q { $$= $1; }
;
simple_ident_q:
ident '.' ident
{
THD *thd= YYTHD;
LEX *lex= thd->lex;
...
...
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