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
29e7cf01
Commit
29e7cf01
authored
Feb 22, 2017
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-12107 sql_mode=ORACLE: Inside routines the CALL keywoard is optional
parent
839e0947
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
119 additions
and
35 deletions
+119
-35
mysql-test/suite/compat/oracle/r/sp.result
mysql-test/suite/compat/oracle/r/sp.result
+37
-1
mysql-test/suite/compat/oracle/t/sp.test
mysql-test/suite/compat/oracle/t/sp.test
+32
-0
sql/sql_lex.cc
sql/sql_lex.cc
+27
-0
sql/sql_lex.h
sql/sql_lex.h
+2
-0
sql/sql_yacc.yy
sql/sql_yacc.yy
+2
-16
sql/sql_yacc_ora.yy
sql/sql_yacc_ora.yy
+19
-18
No files found.
mysql-test/suite/compat/oracle/r/sp.result
View file @
29e7cf01
...
...
@@ -777,7 +777,7 @@ LOOP
NULL
END LOOP;
RETURN total;
END' at line
2
END' at line
5
CREATE FUNCTION f1 (lower_bound INT, upper_bound INT, lim INT) RETURN INT
AS
total INT := 0;
...
...
@@ -2150,3 +2150,39 @@ END' at line 1
#
# End of MDEV-10577 sql_mode=ORACLE: %TYPE in variable declarations
#
#
# MDEV-12107 sql_mode=ORACLE: Inside routines the CALL keywoard is optional
#
CREATE OR REPLACE PROCEDURE p1(a INT) AS
BEGIN
SELECT 'This is p1' AS "comment";
END;
/
CREATE OR REPLACE PROCEDURE p2 AS
BEGIN
SELECT 'This is p2' AS "comment";
END;
/
BEGIN
p1(10);
p2;
END;
/
comment
This is p1
comment
This is p2
CREATE PROCEDURE p3 AS
BEGIN
p1(10);
p2;
END
/
CALL p3;
comment
This is p1
comment
This is p2
DROP PROCEDURE p3;
DROP PROCEDURE p2;
DROP PROCEDURE p1;
mysql-test/suite/compat/oracle/t/sp.test
View file @
29e7cf01
...
...
@@ -1966,3 +1966,35 @@ DELIMITER ;$$
--
echo
#
--
echo
# End of MDEV-10577 sql_mode=ORACLE: %TYPE in variable declarations
--
echo
#
--
echo
#
--
echo
# MDEV-12107 sql_mode=ORACLE: Inside routines the CALL keywoard is optional
--
echo
#
DELIMITER
/
;
CREATE
OR
REPLACE
PROCEDURE
p1
(
a
INT
)
AS
BEGIN
SELECT
'This is p1'
AS
"comment"
;
END
;
/
CREATE
OR
REPLACE
PROCEDURE
p2
AS
BEGIN
SELECT
'This is p2'
AS
"comment"
;
END
;
/
BEGIN
p1
(
10
);
p2
;
END
;
/
CREATE
PROCEDURE
p3
AS
BEGIN
p1
(
10
);
p2
;
END
/
DELIMITER
;
/
CALL
p3
;
DROP
PROCEDURE
p3
;
DROP
PROCEDURE
p2
;
DROP
PROCEDURE
p1
;
sql/sql_lex.cc
View file @
29e7cf01
...
...
@@ -5588,6 +5588,33 @@ bool LEX::sp_block_finalize(THD *thd, const Lex_spblock_st spblock,
}
sp_name
*
LEX
::
make_sp_name
(
THD
*
thd
,
LEX_STRING
&
name
)
{
sp_name
*
res
;
LEX_STRING
db
;
if
(
check_routine_name
(
&
name
)
||
copy_db_to
(
&
db
.
str
,
&
db
.
length
)
||
(
!
(
res
=
new
(
thd
->
mem_root
)
sp_name
(
db
,
name
,
false
))))
return
NULL
;
return
res
;
}
sp_name
*
LEX
::
make_sp_name
(
THD
*
thd
,
LEX_STRING
&
name1
,
LEX_STRING
&
name2
)
{
sp_name
*
res
;
if
(
!
name1
.
str
||
check_db_name
(
&
name1
))
{
my_error
(
ER_WRONG_DB_NAME
,
MYF
(
0
),
name1
.
str
);
return
NULL
;
}
if
(
check_routine_name
(
&
name2
)
||
(
!
(
res
=
new
(
thd
->
mem_root
)
sp_name
(
name1
,
name2
,
true
))))
return
NULL
;
return
res
;
}
sp_head
*
LEX
::
make_sp_head
(
THD
*
thd
,
sp_name
*
name
,
enum
stored_procedure_type
type
)
{
...
...
sql/sql_lex.h
View file @
29e7cf01
...
...
@@ -3099,6 +3099,8 @@ struct LEX: public Query_tables_list
bool
set_system_variable
(
struct
sys_var_with_base
*
tmp
,
enum
enum_var_type
var_type
,
Item
*
val
);
void
set_stmt_init
();
sp_name
*
make_sp_name
(
THD
*
thd
,
LEX_STRING
&
name
);
sp_name
*
make_sp_name
(
THD
*
thd
,
LEX_STRING
&
name1
,
LEX_STRING
&
name2
);
sp_head
*
make_sp_head
(
THD
*
thd
,
sp_name
*
name
,
enum
stored_procedure_type
type
);
sp_head
*
make_sp_head_no_recursive
(
THD
*
thd
,
sp_name
*
name
,
...
...
sql/sql_yacc.yy
View file @
29e7cf01
...
...
@@ -2734,26 +2734,12 @@ clear_privileges:
sp_name:
ident '.' ident
{
if (!$1.str || check_db_name(&$1))
my_yyabort_error((ER_WRONG_DB_NAME, MYF(0), $1.str));
if (check_routine_name(&$3))
MYSQL_YYABORT;
$$= new (thd->mem_root) sp_name($1, $3, true);
if ($$ == NULL)
if (!($$= Lex->make_sp_name(thd, $1, $3)))
MYSQL_YYABORT;
}
| ident
{
LEX *lex= thd->lex;
LEX_STRING db;
if (check_routine_name(&$1))
{
MYSQL_YYABORT;
}
if (lex->copy_db_to(&db.str, &db.length))
MYSQL_YYABORT;
$$= new (thd->mem_root) sp_name(db, $1, false);
if ($$ == NULL)
if (!($$= Lex->make_sp_name(thd, $1)))
MYSQL_YYABORT;
}
;
...
...
sql/sql_yacc_ora.yy
View file @
29e7cf01
...
...
@@ -2197,26 +2197,12 @@ clear_privileges:
sp_name:
ident '.' ident
{
if (!$1.str || check_db_name(&$1))
my_yyabort_error((ER_WRONG_DB_NAME, MYF(0), $1.str));
if (check_routine_name(&$3))
MYSQL_YYABORT;
$$= new (thd->mem_root) sp_name($1, $3, true);
if ($$ == NULL)
if (!($$= Lex->make_sp_name(thd, $1, $3)))
MYSQL_YYABORT;
}
| ident
{
LEX *lex= thd->lex;
LEX_STRING db;
if (check_routine_name(&$1))
{
MYSQL_YYABORT;
}
if (lex->copy_db_to(&db.str, &db.length))
MYSQL_YYABORT;
$$= new (thd->mem_root) sp_name(db, $1, false);
if ($$ == NULL)
if (!($$= Lex->make_sp_name(thd, $1)))
MYSQL_YYABORT;
}
;
...
...
@@ -3090,7 +3076,22 @@ sp_proc_stmt_if:
sp_if END IF_SYM
{ Lex->sphead->do_cont_backpatch(); }
;
sp_statement:
statement
| IDENT_sys
{
// Direct procedure call (without the CALL keyword)
LEX *lex = Lex;
if (!(lex->spname= lex->make_sp_name(thd, $1)))
MYSQL_YYABORT;
lex->sql_command= SQLCOM_CALL;
lex->value_list.empty();
sp_add_used_routine(lex, thd, lex->spname, TYPE_ENUM_PROCEDURE);
}
opt_sp_cparam_list
;
sp_proc_stmt_statement:
{
LEX *lex= thd->lex;
...
...
@@ -3099,7 +3100,7 @@ sp_proc_stmt_statement:
lex->sphead->reset_lex(thd);
lex->sphead->m_tmp_query= lip->get_tok_start();
}
statement
s
p_s
tatement
{
LEX *lex= thd->lex;
Lex_input_stream *lip= YYLIP;
...
...
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