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
40f21c8a
Commit
40f21c8a
authored
Jan 14, 2004
by
pem@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/usr/local/bk/mysql-5.0
into mysql.com:/home/pem/work/mysql-5.0
parents
370a43a3
a1ff4d65
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
126 additions
and
13 deletions
+126
-13
mysql-test/r/sp.result
mysql-test/r/sp.result
+46
-0
mysql-test/t/sp.test
mysql-test/t/sp.test
+35
-0
sql/sp.cc
sql/sp.cc
+38
-12
sql/sql_yacc.yy
sql/sql_yacc.yy
+7
-1
No files found.
mysql-test/r/sp.result
View file @
40f21c8a
...
...
@@ -922,6 +922,52 @@ select @x2|
@x2
2
drop procedure bug2260|
create procedure bug2267_1()
begin
show procedure status;
end|
create procedure bug2267_2()
begin
show function status;
end|
create procedure bug2267_3()
begin
show create procedure bug2267_1;
end|
create procedure bug2267_4()
begin
show create function fac;
end|
call bug2267_1()|
Name Type Definer Modified Created Security_type Comment
bug2267_1 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
bug2267_2 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
bug2267_3 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
bug2267_4 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
call bug2267_2()|
Name Type Definer Modified Created Security_type Comment
fac FUNCTION root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
call bug2267_3()|
Procedure Create Procedure
bug2267_1 CREATE PROCEDURE `bug2267_1`()
begin
show procedure status;
end
call bug2267_4()|
Function Create Function
fac CREATE FUNCTION `fac`(n int unsigned) RETURNS bigint unsigned
begin
declare f bigint unsigned default 1;
while n > 1 do
set f = f * n;
set n = n - 1;
end while;
return f;
end
drop procedure bug2267_1|
drop procedure bug2267_2|
drop procedure bug2267_3|
drop procedure bug2267_4|
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.test
View file @
40f21c8a
...
...
@@ -1072,6 +1072,41 @@ call bug2260()|
select
@
x2
|
drop
procedure
bug2260
|
#
# BUG#2267
#
create
procedure
bug2267_1
()
begin
show
procedure
status
;
end
|
create
procedure
bug2267_2
()
begin
show
function
status
;
end
|
create
procedure
bug2267_3
()
begin
show
create
procedure
bug2267_1
;
end
|
create
procedure
bug2267_4
()
begin
show
create
function
fac
;
end
|
--
replace_column
4
'0000-00-00 00:00:00'
5
'0000-00-00 00:00:00'
call
bug2267_1
()
|
--
replace_column
4
'0000-00-00 00:00:00'
5
'0000-00-00 00:00:00'
call
bug2267_2
()
|
call
bug2267_3
()
|
call
bug2267_4
()
|
drop
procedure
bug2267_1
|
drop
procedure
bug2267_2
|
drop
procedure
bug2267_3
|
drop
procedure
bug2267_4
|
#
# Some "real" examples
...
...
sql/sp.cc
View file @
40f21c8a
...
...
@@ -570,20 +570,25 @@ sp_find_procedure(THD *thd, LEX_STRING *name)
int
sp_create_procedure
(
THD
*
thd
,
sp_head
*
sp
)
{
int
ret
;
DBUG_ENTER
(
"sp_create_procedure"
);
DBUG_PRINT
(
"enter"
,
(
"name: %*s"
,
sp
->
m_name
.
length
,
sp
->
m_name
.
str
));
DBUG_RETURN
(
db_create_routine
(
thd
,
TYPE_ENUM_PROCEDURE
,
sp
));
ret
=
db_create_routine
(
thd
,
TYPE_ENUM_PROCEDURE
,
sp
);
DBUG_RETURN
(
ret
);
}
int
sp_drop_procedure
(
THD
*
thd
,
char
*
name
,
uint
namelen
)
{
int
ret
;
DBUG_ENTER
(
"sp_drop_procedure"
);
DBUG_PRINT
(
"enter"
,
(
"name: %*s"
,
namelen
,
name
));
sp_cache_remove
(
&
thd
->
sp_proc_cache
,
name
,
namelen
);
DBUG_RETURN
(
db_drop_routine
(
thd
,
TYPE_ENUM_PROCEDURE
,
name
,
namelen
));
ret
=
db_drop_routine
(
thd
,
TYPE_ENUM_PROCEDURE
,
name
,
namelen
);
DBUG_RETURN
(
ret
);
}
...
...
@@ -592,12 +597,14 @@ sp_update_procedure(THD *thd, char *name, uint namelen,
char
*
newname
,
uint
newnamelen
,
st_sp_chistics
*
chistics
)
{
int
ret
;
DBUG_ENTER
(
"sp_update_procedure"
);
DBUG_PRINT
(
"enter"
,
(
"name: %*s"
,
namelen
,
name
));
sp_cache_remove
(
&
thd
->
sp_proc_cache
,
name
,
namelen
);
DBUG_RETURN
(
db_update_routine
(
thd
,
TYPE_ENUM_PROCEDURE
,
name
,
namelen
,
newname
,
newnamelen
,
chistics
));
ret
=
db_update_routine
(
thd
,
TYPE_ENUM_PROCEDURE
,
name
,
namelen
,
newname
,
newnamelen
,
chistics
);
DBUG_RETURN
(
ret
);
}
...
...
@@ -609,7 +616,11 @@ sp_show_create_procedure(THD *thd, LEX_STRING *name)
DBUG_PRINT
(
"enter"
,
(
"name: %*s"
,
name
->
length
,
name
->
str
));
if
((
sp
=
sp_find_procedure
(
thd
,
name
)))
DBUG_RETURN
(
sp
->
show_create_procedure
(
thd
));
{
int
ret
=
sp
->
show_create_procedure
(
thd
);
DBUG_RETURN
(
ret
);
}
DBUG_RETURN
(
SP_KEY_NOT_FOUND
);
}
...
...
@@ -618,8 +629,11 @@ sp_show_create_procedure(THD *thd, LEX_STRING *name)
int
sp_show_status_procedure
(
THD
*
thd
,
const
char
*
wild
)
{
int
ret
;
DBUG_ENTER
(
"sp_show_status_procedure"
);
DBUG_RETURN
(
db_show_routine_status
(
thd
,
TYPE_ENUM_PROCEDURE
,
wild
));
ret
=
db_show_routine_status
(
thd
,
TYPE_ENUM_PROCEDURE
,
wild
);
DBUG_RETURN
(
ret
);
}
...
...
@@ -649,21 +663,25 @@ sp_find_function(THD *thd, LEX_STRING *name)
int
sp_create_function
(
THD
*
thd
,
sp_head
*
sp
)
{
int
ret
;
DBUG_ENTER
(
"sp_create_function"
);
DBUG_PRINT
(
"enter"
,
(
"name: %*s"
,
sp
->
m_name
.
length
,
sp
->
m_name
.
str
));
DBUG_RETURN
(
db_create_routine
(
thd
,
TYPE_ENUM_FUNCTION
,
sp
));
ret
=
db_create_routine
(
thd
,
TYPE_ENUM_FUNCTION
,
sp
);
DBUG_RETURN
(
ret
);
}
int
sp_drop_function
(
THD
*
thd
,
char
*
name
,
uint
namelen
)
{
int
ret
;
DBUG_ENTER
(
"sp_drop_function"
);
DBUG_PRINT
(
"enter"
,
(
"name: %*s"
,
namelen
,
name
));
sp_cache_remove
(
&
thd
->
sp_func_cache
,
name
,
namelen
);
DBUG_RETURN
(
db_drop_routine
(
thd
,
TYPE_ENUM_FUNCTION
,
name
,
namelen
));
ret
=
db_drop_routine
(
thd
,
TYPE_ENUM_FUNCTION
,
name
,
namelen
);
DBUG_RETURN
(
ret
);
}
...
...
@@ -672,12 +690,14 @@ sp_update_function(THD *thd, char *name, uint namelen,
char
*
newname
,
uint
newnamelen
,
st_sp_chistics
*
chistics
)
{
int
ret
;
DBUG_ENTER
(
"sp_update_procedure"
);
DBUG_PRINT
(
"enter"
,
(
"name: %*s"
,
namelen
,
name
));
sp_cache_remove
(
&
thd
->
sp_func_cache
,
name
,
namelen
);
DBUG_RETURN
(
db_update_routine
(
thd
,
TYPE_ENUM_FUNCTION
,
name
,
namelen
,
newname
,
newnamelen
,
chistics
));
ret
=
db_update_routine
(
thd
,
TYPE_ENUM_FUNCTION
,
name
,
namelen
,
newname
,
newnamelen
,
chistics
);
DBUG_RETURN
(
ret
);
}
...
...
@@ -689,7 +709,11 @@ sp_show_create_function(THD *thd, LEX_STRING *name)
DBUG_PRINT
(
"enter"
,
(
"name: %*s"
,
name
->
length
,
name
->
str
));
if
((
sp
=
sp_find_function
(
thd
,
name
)))
DBUG_RETURN
(
sp
->
show_create_function
(
thd
));
{
int
ret
=
sp
->
show_create_function
(
thd
);
DBUG_RETURN
(
ret
);
}
DBUG_RETURN
(
SP_KEY_NOT_FOUND
);
}
...
...
@@ -697,8 +721,10 @@ sp_show_create_function(THD *thd, LEX_STRING *name)
int
sp_show_status_function
(
THD
*
thd
,
const
char
*
wild
)
{
int
ret
;
DBUG_ENTER
(
"sp_show_status_function"
);
DBUG_RETURN
(
db_show_routine_status
(
thd
,
TYPE_ENUM_FUNCTION
,
wild
));
ret
=
db_show_routine_status
(
thd
,
TYPE_ENUM_FUNCTION
,
wild
);
DBUG_RETURN
(
ret
);
}
...
...
sql/sql_yacc.yy
View file @
40f21c8a
...
...
@@ -1572,7 +1572,13 @@ sp_proc_stmt:
{
LEX *lex= Lex;
if (lex->sql_command == SQLCOM_SELECT && !lex->result)
/* QQ What else? This doesn't seem to be a practical way,
but at the moment we can't think of anything better... */
if ((lex->sql_command == SQLCOM_SELECT && !lex->result) ||
lex->sql_command == SQLCOM_SHOW_CREATE_PROC ||
lex->sql_command == SQLCOM_SHOW_CREATE_FUNC ||
lex->sql_command == SQLCOM_SHOW_STATUS_PROC ||
lex->sql_command == SQLCOM_SHOW_STATUS_FUNC)
{
/* We maybe have one or more SELECT without INTO */
lex->sphead->m_multi_results= TRUE;
...
...
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