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
26aae2ab
Commit
26aae2ab
authored
Dec 21, 2003
by
monty@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed memory leaks in SP
Some code cleanup
parent
9f78dc52
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
144 additions
and
159 deletions
+144
-159
mysql-test/r/sp.result
mysql-test/r/sp.result
+4
-4
sql/sp.cc
sql/sp.cc
+86
-103
sql/sql_parse.cc
sql/sql_parse.cc
+54
-52
No files found.
mysql-test/r/sp.result
View file @
26aae2ab
...
@@ -732,7 +732,7 @@ delete from t1|
...
@@ -732,7 +732,7 @@ delete from t1|
alter procedure chistics sql security invoker name chistics2|
alter procedure chistics sql security invoker name chistics2|
show create procedure chistics2|
show create procedure chistics2|
Procedure Create Procedure
Procedure Create Procedure
chistics2 CREATE PROCEDURE
chistics2
()
chistics2 CREATE PROCEDURE
`chistics2`
()
SQL SECURITY INVOKER
SQL SECURITY INVOKER
COMMENT 'Characteristics procedure test'
COMMENT 'Characteristics procedure test'
insert into t1 values ("chistics", 1)
insert into t1 values ("chistics", 1)
...
@@ -749,7 +749,7 @@ chistics()
...
@@ -749,7 +749,7 @@ chistics()
alter function chistics name chistics2 comment 'Characteristics function test'|
alter function chistics name chistics2 comment 'Characteristics function test'|
show create function chistics2|
show create function chistics2|
Function Create Function
Function Create Function
chistics2 CREATE FUNCTION
chistics2
() RETURNS int
chistics2 CREATE FUNCTION
`chistics2`
() RETURNS int
DETERMINISTIC
DETERMINISTIC
SQL SECURITY INVOKER
SQL SECURITY INVOKER
COMMENT 'Characteristics function test'
COMMENT 'Characteristics function test'
...
@@ -999,7 +999,7 @@ end while;
...
@@ -999,7 +999,7 @@ end while;
end|
end|
show create procedure opp|
show create procedure opp|
Procedure Create Procedure
Procedure Create Procedure
opp CREATE PROCEDURE
opp
(n bigint unsigned, out pp bool)
opp CREATE PROCEDURE
`opp`
(n bigint unsigned, out pp bool)
begin
begin
declare r double;
declare r double;
declare b, s bigint unsigned default 0;
declare b, s bigint unsigned default 0;
...
@@ -1096,7 +1096,7 @@ alter procedure bar2 name bar comment "3333333333"|
...
@@ -1096,7 +1096,7 @@ alter procedure bar2 name bar comment "3333333333"|
alter procedure bar|
alter procedure bar|
show create procedure bar|
show create procedure bar|
Procedure Create Procedure
Procedure Create Procedure
bar CREATE PROCEDURE
bar
(x char(16), y int)
bar CREATE PROCEDURE
`bar`
(x char(16), y int)
COMMENT '3333333333'
COMMENT '3333333333'
insert into test.t1 values (x, y)
insert into test.t1 values (x, y)
show procedure status like 'bar'|
show procedure status like 'bar'|
...
...
sql/sp.cc
View file @
26aae2ab
This diff is collapsed.
Click to expand it.
sql/sql_parse.cc
View file @
26aae2ab
...
@@ -3085,11 +3085,11 @@ mysql_execute_command(THD *thd)
...
@@ -3085,11 +3085,11 @@ mysql_execute_command(THD *thd)
}
}
case
SQLCOM_CREATE_FUNCTION
:
// UDF function
case
SQLCOM_CREATE_FUNCTION
:
// UDF function
{
{
sp_head
*
sph
;
if
(
check_access
(
thd
,
INSERT_ACL
,
"mysql"
,
0
,
1
,
0
))
if
(
check_access
(
thd
,
INSERT_ACL
,
"mysql"
,
0
,
1
,
0
))
break
;
break
;
#ifdef HAVE_DLOPEN
#ifdef HAVE_DLOPEN
sp_head
*
sph
=
sp_find_function
(
thd
,
&
lex
->
udf
.
name
);
if
(
!
(
sph
=
sp_find_function
(
thd
,
&
lex
->
udf
.
name
)))
if
(
sph
)
{
{
net_printf
(
thd
,
ER_UDF_EXISTS
,
lex
->
udf
.
name
.
str
);
net_printf
(
thd
,
ER_UDF_EXISTS
,
lex
->
udf
.
name
.
str
);
goto
error
;
goto
error
;
...
@@ -3374,13 +3374,12 @@ mysql_execute_command(THD *thd)
...
@@ -3374,13 +3374,12 @@ mysql_execute_command(THD *thd)
break
;
break
;
case
SQLCOM_CREATE_PROCEDURE
:
case
SQLCOM_CREATE_PROCEDURE
:
case
SQLCOM_CREATE_SPFUNCTION
:
case
SQLCOM_CREATE_SPFUNCTION
:
{
if
(
!
lex
->
sphead
)
if
(
!
lex
->
sphead
)
{
{
res
=
-
1
;
// Shouldn't happen
res
=
-
1
;
// Shouldn't happen
break
;
break
;
}
}
else
{
uint
namelen
;
uint
namelen
;
char
*
name
=
lex
->
sphead
->
name
(
&
namelen
);
char
*
name
=
lex
->
sphead
->
name
(
&
namelen
);
#ifdef HAVE_DLOPEN
#ifdef HAVE_DLOPEN
...
@@ -3391,6 +3390,8 @@ mysql_execute_command(THD *thd)
...
@@ -3391,6 +3390,8 @@ mysql_execute_command(THD *thd)
if
(
udf
)
if
(
udf
)
{
{
net_printf
(
thd
,
ER_UDF_EXISTS
,
name
);
net_printf
(
thd
,
ER_UDF_EXISTS
,
name
);
delete
lex
->
sphead
;
lex
->
sphead
=
0
;
goto
error
;
goto
error
;
}
}
}
}
...
@@ -3399,13 +3400,13 @@ mysql_execute_command(THD *thd)
...
@@ -3399,13 +3400,13 @@ mysql_execute_command(THD *thd)
!
lex
->
sphead
->
m_has_return
)
!
lex
->
sphead
->
m_has_return
)
{
{
net_printf
(
thd
,
ER_SP_NORETURN
,
name
);
net_printf
(
thd
,
ER_SP_NORETURN
,
name
);
delete
lex
->
sphead
;
lex
->
sphead
=
0
;
goto
error
;
goto
error
;
}
}
res
=
lex
->
sphead
->
create
(
thd
);
res
=
lex
->
sphead
->
create
(
thd
);
switch
(
res
)
{
switch
(
res
)
{
case
SP_OK
:
case
SP_OK
:
send_ok
(
thd
);
send_ok
(
thd
);
delete
lex
->
sphead
;
delete
lex
->
sphead
;
...
@@ -3428,8 +3429,7 @@ mysql_execute_command(THD *thd)
...
@@ -3428,8 +3429,7 @@ mysql_execute_command(THD *thd)
{
{
sp_head
*
sp
;
sp_head
*
sp
;
sp
=
sp_find_procedure
(
thd
,
&
lex
->
udf
.
name
);
if
(
!
(
sp
=
sp_find_procedure
(
thd
,
&
lex
->
udf
.
name
)))
if
(
!
sp
)
{
{
net_printf
(
thd
,
ER_SP_DOES_NOT_EXIST
,
"PROCEDURE"
,
lex
->
udf
.
name
);
net_printf
(
thd
,
ER_SP_DOES_NOT_EXIST
,
"PROCEDURE"
,
lex
->
udf
.
name
);
goto
error
;
goto
error
;
...
@@ -3611,6 +3611,7 @@ mysql_execute_command(THD *thd)
...
@@ -3611,6 +3611,7 @@ mysql_execute_command(THD *thd)
res
=
0
;
res
=
0
;
goto
error
;
goto
error
;
}
}
res
=
0
;
break
;
break
;
}
}
case
SQLCOM_SHOW_STATUS_PROC
:
case
SQLCOM_SHOW_STATUS_PROC
:
...
@@ -4157,6 +4158,7 @@ mysql_parse(THD *thd, char *inBuf, uint length)
...
@@ -4157,6 +4158,7 @@ mysql_parse(THD *thd, char *inBuf, uint length)
query_cache_abort
(
&
thd
->
net
);
query_cache_abort
(
&
thd
->
net
);
if
(
thd
->
lex
->
sphead
)
if
(
thd
->
lex
->
sphead
)
{
{
/* Clean up after failed stored procedure/function */
if
(
lex
!=
thd
->
lex
)
if
(
lex
!=
thd
->
lex
)
thd
->
lex
->
sphead
->
restore_lex
(
thd
);
thd
->
lex
->
sphead
->
restore_lex
(
thd
);
delete
thd
->
lex
->
sphead
;
delete
thd
->
lex
->
sphead
;
...
...
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