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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
b3977ac2
Commit
b3977ac2
authored
Aug 04, 2017
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
An additional patch for MDEV-13415 Wrap the code in sp.cc into a class Sp_handler
parent
9b74b00c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
26 deletions
+19
-26
sql/sql_acl.cc
sql/sql_acl.cc
+13
-12
sql/sql_parse.cc
sql/sql_parse.cc
+6
-14
No files found.
sql/sql_acl.cc
View file @
b3977ac2
...
@@ -362,8 +362,8 @@ static bool show_database_privileges(THD *, const char *, const char *,
...
@@ -362,8 +362,8 @@ static bool show_database_privileges(THD *, const char *, const char *,
char
*
,
size_t
);
char
*
,
size_t
);
static
bool
show_table_and_column_privileges
(
THD
*
,
const
char
*
,
const
char
*
,
static
bool
show_table_and_column_privileges
(
THD
*
,
const
char
*
,
const
char
*
,
char
*
,
size_t
);
char
*
,
size_t
);
static
int
show_routine_grants
(
THD
*
,
const
char
*
,
const
char
*
,
HASH
*
,
static
int
show_routine_grants
(
THD
*
,
const
char
*
,
const
char
*
,
const
char
*
,
int
,
char
*
,
int
);
const
Sp_handler
*
sph
,
char
*
,
int
);
class
Grant_tables
;
class
Grant_tables
;
class
User_table
;
class
User_table
;
...
@@ -8484,12 +8484,12 @@ static bool print_grants_for_role(THD *thd, ACL_ROLE * role)
...
@@ -8484,12 +8484,12 @@ static bool print_grants_for_role(THD *thd, ACL_ROLE * role)
if
(
show_table_and_column_privileges
(
thd
,
role
->
user
.
str
,
""
,
buff
,
sizeof
(
buff
)))
if
(
show_table_and_column_privileges
(
thd
,
role
->
user
.
str
,
""
,
buff
,
sizeof
(
buff
)))
return
TRUE
;
return
TRUE
;
if
(
show_routine_grants
(
thd
,
role
->
user
.
str
,
""
,
&
proc_priv_hash
,
if
(
show_routine_grants
(
thd
,
role
->
user
.
str
,
""
,
&
sp_handler_procedure
,
STRING_WITH_LEN
(
"PROCEDURE"
),
buff
,
sizeof
(
buff
)))
buff
,
sizeof
(
buff
)))
return
TRUE
;
return
TRUE
;
if
(
show_routine_grants
(
thd
,
role
->
user
.
str
,
""
,
&
func_priv_hash
,
if
(
show_routine_grants
(
thd
,
role
->
user
.
str
,
""
,
&
sp_handler_function
,
STRING_WITH_LEN
(
"FUNCTION"
),
buff
,
sizeof
(
buff
)))
buff
,
sizeof
(
buff
)))
return
TRUE
;
return
TRUE
;
return
FALSE
;
return
FALSE
;
...
@@ -8709,12 +8709,12 @@ bool mysql_show_grants(THD *thd, LEX_USER *lex_user)
...
@@ -8709,12 +8709,12 @@ bool mysql_show_grants(THD *thd, LEX_USER *lex_user)
if
(
show_table_and_column_privileges
(
thd
,
username
,
hostname
,
buff
,
sizeof
(
buff
)))
if
(
show_table_and_column_privileges
(
thd
,
username
,
hostname
,
buff
,
sizeof
(
buff
)))
goto
end
;
goto
end
;
if
(
show_routine_grants
(
thd
,
username
,
hostname
,
&
proc_priv_hash
,
if
(
show_routine_grants
(
thd
,
username
,
hostname
,
&
sp_handler_procedure
,
STRING_WITH_LEN
(
"PROCEDURE"
),
buff
,
sizeof
(
buff
)))
buff
,
sizeof
(
buff
)))
goto
end
;
goto
end
;
if
(
show_routine_grants
(
thd
,
username
,
hostname
,
&
func_priv_hash
,
if
(
show_routine_grants
(
thd
,
username
,
hostname
,
&
sp_handler_function
,
STRING_WITH_LEN
(
"FUNCTION"
),
buff
,
sizeof
(
buff
)))
buff
,
sizeof
(
buff
)))
goto
end
;
goto
end
;
if
(
show_proxy_grants
(
thd
,
username
,
hostname
,
buff
,
sizeof
(
buff
)))
if
(
show_proxy_grants
(
thd
,
username
,
hostname
,
buff
,
sizeof
(
buff
)))
...
@@ -9094,12 +9094,13 @@ static bool show_table_and_column_privileges(THD *thd, const char *username,
...
@@ -9094,12 +9094,13 @@ static bool show_table_and_column_privileges(THD *thd, const char *username,
static
int
show_routine_grants
(
THD
*
thd
,
static
int
show_routine_grants
(
THD
*
thd
,
const
char
*
username
,
const
char
*
hostname
,
const
char
*
username
,
const
char
*
hostname
,
HASH
*
hash
,
const
char
*
type
,
int
typelen
,
const
Sp_handler
*
sph
,
char
*
buff
,
int
buffsize
)
char
*
buff
,
int
buffsize
)
{
{
uint
counter
,
index
;
uint
counter
,
index
;
int
error
=
0
;
int
error
=
0
;
Protocol
*
protocol
=
thd
->
protocol
;
Protocol
*
protocol
=
thd
->
protocol
;
HASH
*
hash
=
sph
->
get_priv_hash
();
/* Add routine access */
/* Add routine access */
for
(
index
=
0
;
index
<
hash
->
records
;
index
++
)
for
(
index
=
0
;
index
<
hash
->
records
;
index
++
)
{
{
...
@@ -9153,7 +9154,7 @@ static int show_routine_grants(THD* thd,
...
@@ -9153,7 +9154,7 @@ static int show_routine_grants(THD* thd,
}
}
}
}
global
.
append
(
STRING_WITH_LEN
(
" ON "
));
global
.
append
(
STRING_WITH_LEN
(
" ON "
));
global
.
append
(
type
,
typelen
);
global
.
append
(
sph
->
type_lex_cstring
()
);
global
.
append
(
' '
);
global
.
append
(
' '
);
append_identifier
(
thd
,
&
global
,
grant_proc
->
db
,
append_identifier
(
thd
,
&
global
,
grant_proc
->
db
,
strlen
(
grant_proc
->
db
));
strlen
(
grant_proc
->
db
));
...
...
sql/sql_parse.cc
View file @
b3977ac2
...
@@ -124,14 +124,6 @@ static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length,
...
@@ -124,14 +124,6 @@ static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length,
@{
@{
*/
*/
/* Used in error handling only */
#define SP_COM_STRING(LP) \
((LP)->sql_command == SQLCOM_CREATE_SPFUNCTION || \
(LP)->sql_command == SQLCOM_ALTER_FUNCTION || \
(LP)->sql_command == SQLCOM_SHOW_CREATE_FUNC || \
(LP)->sql_command == SQLCOM_DROP_FUNCTION ? \
"FUNCTION" : "PROCEDURE")
static
bool
execute_sqlcom_select
(
THD
*
thd
,
TABLE_LIST
*
all_tables
);
static
bool
execute_sqlcom_select
(
THD
*
thd
,
TABLE_LIST
*
all_tables
);
static
void
sql_kill
(
THD
*
thd
,
longlong
id
,
killed_state
state
,
killed_type
type
);
static
void
sql_kill
(
THD
*
thd
,
longlong
id
,
killed_state
state
,
killed_type
type
);
static
void
sql_kill_user
(
THD
*
thd
,
LEX_USER
*
user
,
killed_state
state
);
static
void
sql_kill_user
(
THD
*
thd
,
LEX_USER
*
user
,
killed_state
state
);
...
@@ -5841,11 +5833,11 @@ mysql_execute_command(THD *thd)
...
@@ -5841,11 +5833,11 @@ mysql_execute_command(THD *thd)
break
;
break
;
case
SP_KEY_NOT_FOUND
:
case
SP_KEY_NOT_FOUND
:
my_error
(
ER_SP_DOES_NOT_EXIST
,
MYF
(
0
),
my_error
(
ER_SP_DOES_NOT_EXIST
,
MYF
(
0
),
SP_COM_STRING
(
lex
),
ErrConvDQName
(
lex
->
spname
).
ptr
());
sph
->
type_str
(
),
ErrConvDQName
(
lex
->
spname
).
ptr
());
goto
error
;
goto
error
;
default:
default:
my_error
(
ER_SP_CANT_ALTER
,
MYF
(
0
),
my_error
(
ER_SP_CANT_ALTER
,
MYF
(
0
),
SP_COM_STRING
(
lex
),
ErrConvDQName
(
lex
->
spname
).
ptr
());
sph
->
type_str
(
),
ErrConvDQName
(
lex
->
spname
).
ptr
());
goto
error
;
goto
error
;
}
}
break
;
break
;
...
@@ -5950,18 +5942,18 @@ mysql_execute_command(THD *thd)
...
@@ -5950,18 +5942,18 @@ mysql_execute_command(THD *thd)
res
=
write_bin_log
(
thd
,
TRUE
,
thd
->
query
(),
thd
->
query_length
());
res
=
write_bin_log
(
thd
,
TRUE
,
thd
->
query
(),
thd
->
query_length
());
push_warning_printf
(
thd
,
Sql_condition
::
WARN_LEVEL_NOTE
,
push_warning_printf
(
thd
,
Sql_condition
::
WARN_LEVEL_NOTE
,
ER_SP_DOES_NOT_EXIST
,
ER_THD
(
thd
,
ER_SP_DOES_NOT_EXIST
),
ER_SP_DOES_NOT_EXIST
,
ER_THD
(
thd
,
ER_SP_DOES_NOT_EXIST
),
SP_COM_STRING
(
lex
),
sph
->
type_str
(
),
ErrConvDQName
(
lex
->
spname
).
ptr
());
ErrConvDQName
(
lex
->
spname
).
ptr
());
if
(
!
res
)
if
(
!
res
)
my_ok
(
thd
);
my_ok
(
thd
);
break
;
break
;
}
}
my_error
(
ER_SP_DOES_NOT_EXIST
,
MYF
(
0
),
my_error
(
ER_SP_DOES_NOT_EXIST
,
MYF
(
0
),
SP_COM_STRING
(
lex
),
ErrConvDQName
(
lex
->
spname
).
ptr
());
sph
->
type_str
(
),
ErrConvDQName
(
lex
->
spname
).
ptr
());
goto
error
;
goto
error
;
default:
default:
my_error
(
ER_SP_DROP_FAILED
,
MYF
(
0
),
my_error
(
ER_SP_DROP_FAILED
,
MYF
(
0
),
SP_COM_STRING
(
lex
),
ErrConvDQName
(
lex
->
spname
).
ptr
());
sph
->
type_str
(
),
ErrConvDQName
(
lex
->
spname
).
ptr
());
goto
error
;
goto
error
;
}
}
break
;
break
;
...
@@ -5992,7 +5984,7 @@ mysql_execute_command(THD *thd)
...
@@ -5992,7 +5984,7 @@ mysql_execute_command(THD *thd)
{
{
/* We don't distinguish between errors for now */
/* We don't distinguish between errors for now */
my_error
(
ER_SP_DOES_NOT_EXIST
,
MYF
(
0
),
my_error
(
ER_SP_DOES_NOT_EXIST
,
MYF
(
0
),
SP_COM_STRING
(
lex
),
lex
->
spname
->
m_name
.
str
);
sph
->
type_str
(
),
lex
->
spname
->
m_name
.
str
);
goto
error
;
goto
error
;
}
}
break
;
break
;
...
...
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