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
e6b04edb
Commit
e6b04edb
authored
Nov 23, 2005
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merge
parent
db8f03eb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
13 deletions
+21
-13
sql/sp.cc
sql/sp.cc
+21
-13
No files found.
sql/sp.cc
View file @
e6b04edb
...
@@ -400,6 +400,7 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp,
...
@@ -400,6 +400,7 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp,
const
char
*
definer
,
longlong
created
,
longlong
modified
)
const
char
*
definer
,
longlong
created
,
longlong
modified
)
{
{
LEX
*
oldlex
=
thd
->
lex
,
newlex
;
LEX
*
oldlex
=
thd
->
lex
,
newlex
;
sp_rcontext
*
save_spcont
=
;
thd
->
spcont
;
String
defstr
;
String
defstr
;
char
olddb
[
128
];
char
olddb
[
128
];
bool
dbchanged
;
bool
dbchanged
;
...
@@ -430,6 +431,9 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp,
...
@@ -430,6 +431,9 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp,
lex_start
(
thd
,
(
uchar
*
)
defstr
.
c_ptr
(),
defstr
.
length
());
lex_start
(
thd
,
(
uchar
*
)
defstr
.
c_ptr
(),
defstr
.
length
());
(
*
sphp
)
->
set_definer
((
char
*
)
definer
,
(
uint
)
strlen
(
definer
));
(
*
sphp
)
->
set_info
(
created
,
modified
,
&
chistics
,
sql_mode
);
thd
->
spcont
=
0
;
if
(
yyparse
(
thd
)
||
thd
->
is_fatal_error
||
newlex
.
sphead
==
NULL
)
if
(
yyparse
(
thd
)
||
thd
->
is_fatal_error
||
newlex
.
sphead
==
NULL
)
{
{
sp_head
*
sp
=
newlex
.
sphead
;
sp_head
*
sp
=
newlex
.
sphead
;
...
@@ -442,12 +446,15 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp,
...
@@ -442,12 +446,15 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp,
else
else
{
{
if
(
dbchanged
&&
(
ret
=
mysql_change_db
(
thd
,
olddb
,
1
)))
if
(
dbchanged
&&
(
ret
=
mysql_change_db
(
thd
,
olddb
,
1
)))
goto
end
;
goto
db_
end
;
*
sphp
=
newlex
.
sphead
;
*
sphp
=
newlex
.
sphead
;
(
*
sphp
)
->
set_definer
((
char
*
)
definer
,
(
uint
)
strlen
(
definer
));
(
*
sphp
)
->
set_info
((
char
*
)
definer
,
(
uint
)
strlen
(
definer
),
(
*
sphp
)
->
set_info
((
char
*
)
definer
,
(
uint
)
strlen
(
definer
),
created
,
modified
,
&
chistics
,
sql_mode
);
created
,
modified
,
&
chistics
,
sql_mode
);
(
*
sphp
)
->
optimize
();
(
*
sphp
)
->
optimize
();
}
}
db_end:
thd
->
spcont
=
save_spcont
;
thd
->
variables
.
sql_mode
=
old_sql_mode
;
thd
->
variables
.
sql_mode
=
old_sql_mode
;
thd
->
variables
.
select_limit
=
select_limit
;
thd
->
variables
.
select_limit
=
select_limit
;
end:
end:
...
@@ -550,12 +557,13 @@ db_create_routine(THD *thd, int type, sp_head *sp)
...
@@ -550,12 +557,13 @@ db_create_routine(THD *thd, int type, sp_head *sp)
store
(
sp
->
m_chistics
->
comment
.
str
,
sp
->
m_chistics
->
comment
.
length
,
store
(
sp
->
m_chistics
->
comment
.
str
,
sp
->
m_chistics
->
comment
.
length
,
system_charset_info
);
system_charset_info
);
if
(
!
trust_routine_creators
&&
mysql_bin_log
.
is_open
())
if
((
sp
->
m_type
==
TYPE_ENUM_FUNCTION
)
&&
!
trust_function_creators
&&
mysql_bin_log
.
is_open
())
{
{
if
(
!
sp
->
m_chistics
->
detistic
)
if
(
!
sp
->
m_chistics
->
detistic
)
{
{
/*
/*
Note that
for a _function_ this test is not enough
; one could use
Note that
this test is not perfect
; one could use
a non-deterministic read-only function in an update statement.
a non-deterministic read-only function in an update statement.
*/
*/
enum
enum_sp_data_access
access
=
enum
enum_sp_data_access
access
=
...
@@ -1606,30 +1614,30 @@ create_string(THD *thd, String *buf,
...
@@ -1606,30 +1614,30 @@ create_string(THD *thd, String *buf,
chistics
->
comment
.
length
))
chistics
->
comment
.
length
))
return
FALSE
;
return
FALSE
;
buf
->
append
(
"CREATE "
,
7
);
buf
->
append
(
STRING_WITH_LEN
(
"CREATE "
)
);
if
(
type
==
TYPE_ENUM_FUNCTION
)
if
(
type
==
TYPE_ENUM_FUNCTION
)
buf
->
append
(
"FUNCTION "
,
9
);
buf
->
append
(
STRING_WITH_LEN
(
"FUNCTION "
)
);
else
else
buf
->
append
(
"PROCEDURE "
,
10
);
buf
->
append
(
STRING_WITH_LEN
(
"PROCEDURE "
)
);
append_identifier
(
thd
,
buf
,
name
->
m_name
.
str
,
name
->
m_name
.
length
);
append_identifier
(
thd
,
buf
,
name
->
m_name
.
str
,
name
->
m_name
.
length
);
buf
->
append
(
'('
);
buf
->
append
(
'('
);
buf
->
append
(
params
,
paramslen
);
buf
->
append
(
params
,
paramslen
);
buf
->
append
(
')'
);
buf
->
append
(
')'
);
if
(
type
==
TYPE_ENUM_FUNCTION
)
if
(
type
==
TYPE_ENUM_FUNCTION
)
{
{
buf
->
append
(
" RETURNS "
,
9
);
buf
->
append
(
STRING_WITH_LEN
(
" RETURNS "
)
);
buf
->
append
(
returns
,
returnslen
);
buf
->
append
(
returns
,
returnslen
);
}
}
buf
->
append
(
'\n'
);
buf
->
append
(
'\n'
);
switch
(
chistics
->
daccess
)
{
switch
(
chistics
->
daccess
)
{
case
SP_NO_SQL
:
case
SP_NO_SQL
:
buf
->
append
(
" NO SQL
\n
"
);
buf
->
append
(
STRING_WITH_LEN
(
" NO SQL
\n
"
)
);
break
;
break
;
case
SP_READS_SQL_DATA
:
case
SP_READS_SQL_DATA
:
buf
->
append
(
" READS SQL DATA
\n
"
);
buf
->
append
(
STRING_WITH_LEN
(
" READS SQL DATA
\n
"
)
);
break
;
break
;
case
SP_MODIFIES_SQL_DATA
:
case
SP_MODIFIES_SQL_DATA
:
buf
->
append
(
" MODIFIES SQL DATA
\n
"
);
buf
->
append
(
STRING_WITH_LEN
(
" MODIFIES SQL DATA
\n
"
)
);
break
;
break
;
case
SP_DEFAULT_ACCESS
:
case
SP_DEFAULT_ACCESS
:
case
SP_CONTAINS_SQL
:
case
SP_CONTAINS_SQL
:
...
@@ -1637,12 +1645,12 @@ create_string(THD *thd, String *buf,
...
@@ -1637,12 +1645,12 @@ create_string(THD *thd, String *buf,
break
;
break
;
}
}
if
(
chistics
->
detistic
)
if
(
chistics
->
detistic
)
buf
->
append
(
" DETERMINISTIC
\n
"
,
18
);
buf
->
append
(
STRING_WITH_LEN
(
" DETERMINISTIC
\n
"
)
);
if
(
chistics
->
suid
==
SP_IS_NOT_SUID
)
if
(
chistics
->
suid
==
SP_IS_NOT_SUID
)
buf
->
append
(
" SQL SECURITY INVOKER
\n
"
,
25
);
buf
->
append
(
STRING_WITH_LEN
(
" SQL SECURITY INVOKER
\n
"
)
);
if
(
chistics
->
comment
.
length
)
if
(
chistics
->
comment
.
length
)
{
{
buf
->
append
(
" COMMENT "
);
buf
->
append
(
STRING_WITH_LEN
(
" COMMENT "
)
);
append_unescaped
(
buf
,
chistics
->
comment
.
str
,
chistics
->
comment
.
length
);
append_unescaped
(
buf
,
chistics
->
comment
.
str
,
chistics
->
comment
.
length
);
buf
->
append
(
'\n'
);
buf
->
append
(
'\n'
);
}
}
...
...
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