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
4305c3ca
Commit
4305c3ca
authored
Aug 18, 2017
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-13581 ROW TYPE OF t1 and t1%ROWTYPE for routine parameters
parent
a70809c0
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
615 additions
and
50 deletions
+615
-50
mysql-test/r/sp-anchor-row-type-table.result
mysql-test/r/sp-anchor-row-type-table.result
+102
-0
mysql-test/r/sp-code.result
mysql-test/r/sp-code.result
+28
-0
mysql-test/suite/compat/oracle/r/sp-anchor-row-type-table.result
...est/suite/compat/oracle/r/sp-anchor-row-type-table.result
+103
-0
mysql-test/suite/compat/oracle/t/sp-anchor-row-type-table.test
...-test/suite/compat/oracle/t/sp-anchor-row-type-table.test
+101
-0
mysql-test/t/sp-anchor-row-type-table.test
mysql-test/t/sp-anchor-row-type-table.test
+101
-0
mysql-test/t/sp-code.test
mysql-test/t/sp-code.test
+24
-0
sql/sp_head.cc
sql/sp_head.cc
+65
-0
sql/sp_head.h
sql/sp_head.h
+27
-0
sql/sql_yacc.yy
sql/sql_yacc.yy
+20
-22
sql/sql_yacc_ora.yy
sql/sql_yacc_ora.yy
+44
-28
No files found.
mysql-test/r/sp-anchor-row-type-table.result
View file @
4305c3ca
...
@@ -679,3 +679,105 @@ rec.b
...
@@ -679,3 +679,105 @@ rec.b
b0
b0
DROP TABLE t1;
DROP TABLE t1;
DROP PROCEDURE p1;
DROP PROCEDURE p1;
#
# MDEV-13581 ROW TYPE OF t1 and t1%ROWTYPE for routine parameters
#
CREATE TABLE t1 (a INT, b TEXT, c ENUM('a','b','c'));
CREATE PROCEDURE p1 (a ROW TYPE OF t1)
BEGIN
CREATE TABLE t2 AS SELECT a.a AS a, a.b AS b, a.c AS c;
SHOW CREATE TABLE t2;
DROP TABLE t2;
END;
$$
CREATE PROCEDURE p2()
BEGIN
DECLARE a ROW TYPE OF t1;
CALL p1(a);
END;
$$
CALL p2();
Table Create Table
t2 CREATE TABLE `t2` (
`a` int(11) DEFAULT NULL,
`b` text DEFAULT NULL,
`c` varchar(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP PROCEDURE p2;
DROP PROCEDURE p1;
DROP TABLE t1;
CREATE TABLE t1 (a INT, b TEXT);
CREATE PROCEDURE p1 (OUT a ROW TYPE OF t1)
BEGIN
SET a.a=10;
SET a.b='text';
END;
$$
CREATE PROCEDURE p2()
BEGIN
DECLARE a ROW TYPE OF t1;
CALL p1(a);
SELECT a.a, a.b;
END;
$$
CREATE FUNCTION f1(a ROW TYPE OF t1) RETURNS TEXT
BEGIN
RETURN CONCAT(a.a, ' ', a.b);
END;
$$
CREATE FUNCTION f2() RETURNS TEXT
BEGIN
DECLARE a ROW TYPE OF t1;
CALL p1(a);
RETURN f1(a);
END;
$$
CALL p2();
a.a a.b
10 text
SELECT f2();
f2()
10 text
DROP PROCEDURE p2;
DROP PROCEDURE p1;
DROP FUNCTION f2;
DROP FUNCTION f1;
DROP TABLE t1;
CREATE DATABASE db1;
CREATE TABLE db1.t1 (a INT, b TEXT);
CREATE PROCEDURE p1 (OUT a ROW TYPE OF db1.t1)
BEGIN
SET a.a=10;
SET a.b='text';
END;
$$
CREATE PROCEDURE p2()
BEGIN
DECLARE a ROW TYPE OF db1.t1;
CALL p1(a);
SELECT a.a, a.b;
END;
$$
CREATE FUNCTION f1(a ROW TYPE OF db1.t1) RETURNS TEXT
BEGIN
RETURN CONCAT(a.a, ' ', a.b);
END;
$$
CREATE FUNCTION f2() RETURNS TEXT
BEGIN
DECLARE a ROW TYPE OF db1.t1;
CALL p1(a);
RETURN f1(a);
END;
$$
CALL p2();
a.a a.b
10 text
SELECT f2();
f2()
10 text
DROP PROCEDURE p2;
DROP PROCEDURE p1;
DROP FUNCTION f2;
DROP FUNCTION f1;
DROP DATABASE db1;
mysql-test/r/sp-code.result
View file @
4305c3ca
...
@@ -970,3 +970,31 @@ Pos Instruction
...
@@ -970,3 +970,31 @@ Pos Instruction
DROP PROCEDURE testp_bug11763507;
DROP PROCEDURE testp_bug11763507;
DROP FUNCTION testf_bug11763507;
DROP FUNCTION testf_bug11763507;
#END OF BUG#11763507 test.
#END OF BUG#11763507 test.
#
# MDEV-13581 ROW TYPE OF t1 and t1%ROWTYPE for routine parameters
#
CREATE TABLE t1 (a INT, b TEXT);
CREATE PROCEDURE p1(a ROW TYPE OF t1, OUT b ROW TYPE OF t1)
BEGIN
SET a.a = 100;
SET a.b = 'aaa';
SET b.a = 200;
SET b.b = 'bbb';
SET a = b;
SET b = a;
SET a.a = b.a;
SET b.a = a.a;
END;
$$
SHOW PROCEDURE CODE p1;
Pos Instruction
0 set a.a@0["a"] 100
1 set a.b@0["b"] 'aaa'
2 set b.a@1["a"] 200
3 set b.b@1["b"] 'bbb'
4 set a@0 b@1
5 set b@1 a@0
6 set a.a@0["a"] b.a@1["a"]
7 set b.a@1["a"] a.a@0["a"]
DROP PROCEDURE p1;
DROP TABLE t1;
mysql-test/suite/compat/oracle/r/sp-anchor-row-type-table.result
0 → 100644
View file @
4305c3ca
SET sql_mode=ORACLE;
#
# MDEV-13581 ROW TYPE OF t1 and t1%ROWTYPE for routine parameters
#
CREATE TABLE t1 (a INT, b TEXT, c ENUM('a','b','c'));
CREATE PROCEDURE p1 (a t1%ROWTYPE) AS
BEGIN
CREATE TABLE t2 AS SELECT a.a AS a, a.b AS b, a.c AS c;
SHOW CREATE TABLE t2;
DROP TABLE t2;
END;
$$
CREATE PROCEDURE p2 AS
a t1%ROWTYPE;
BEGIN
CALL p1(a);
END;
$$
CALL p2();
Table Create Table
t2 CREATE TABLE "t2" (
"a" int(11) DEFAULT NULL,
"b" text DEFAULT NULL,
"c" varchar(1) DEFAULT NULL
)
DROP PROCEDURE p2;
DROP PROCEDURE p1;
DROP TABLE t1;
CREATE TABLE t1 (a INT, b TEXT);
CREATE PROCEDURE p1 (a OUT t1%ROWTYPE) AS
BEGIN
SET a.a=10;
SET a.b='text';
END;
$$
CREATE PROCEDURE p2 AS
a t1%ROWTYPE;
BEGIN
CALL p1(a);
SELECT a.a, a.b;
END;
$$
CREATE FUNCTION f1(a t1%ROWTYPE) RETURN TEXT AS
BEGIN
RETURN CONCAT(a.a, ' ', a.b);
END;
$$
CREATE FUNCTION f2 RETURN TEXT AS
a t1%ROWTYPE;
BEGIN
CALL p1(a);
RETURN f1(a);
END;
$$
CALL p2();
a.a a.b
10 text
SELECT f2();
f2()
10 text
DROP PROCEDURE p2;
DROP PROCEDURE p1;
DROP FUNCTION f2;
DROP FUNCTION f1;
DROP TABLE t1;
CREATE DATABASE db1;
CREATE TABLE db1.t1 (a INT, b TEXT);
CREATE PROCEDURE p1 (a OUT db1.t1%ROWTYPE) AS
BEGIN
SET a.a=10;
SET a.b='text';
END;
$$
CREATE PROCEDURE p2 AS
a db1.t1%ROWTYPE;
BEGIN
CALL p1(a);
SELECT a.a, a.b;
END;
$$
CREATE FUNCTION f1(a db1.t1%ROWTYPE) RETURN TEXT AS
BEGIN
RETURN CONCAT(a.a, ' ', a.b);
END;
$$
CREATE FUNCTION f2() RETURN TEXT AS
a db1.t1%ROWTYPE;
BEGIN
CALL p1(a);
RETURN f1(a);
END;
$$
CALL p2();
a.a a.b
10 text
SELECT f2();
f2()
10 text
DROP PROCEDURE p2;
DROP PROCEDURE p1;
DROP FUNCTION f2;
DROP FUNCTION f1;
DROP DATABASE db1;
mysql-test/suite/compat/oracle/t/sp-anchor-row-type-table.test
0 → 100644
View file @
4305c3ca
SET
sql_mode
=
ORACLE
;
--
echo
#
--
echo
# MDEV-13581 ROW TYPE OF t1 and t1%ROWTYPE for routine parameters
--
echo
#
CREATE
TABLE
t1
(
a
INT
,
b
TEXT
,
c
ENUM
(
'a'
,
'b'
,
'c'
));
DELIMITER
$$
;
CREATE
PROCEDURE
p1
(
a
t1
%
ROWTYPE
)
AS
BEGIN
CREATE
TABLE
t2
AS
SELECT
a
.
a
AS
a
,
a
.
b
AS
b
,
a
.
c
AS
c
;
SHOW
CREATE
TABLE
t2
;
DROP
TABLE
t2
;
END
;
$$
CREATE
PROCEDURE
p2
AS
a
t1
%
ROWTYPE
;
BEGIN
CALL
p1
(
a
);
END
;
$$
DELIMITER
;
$$
CALL
p2
();
DROP
PROCEDURE
p2
;
DROP
PROCEDURE
p1
;
DROP
TABLE
t1
;
CREATE
TABLE
t1
(
a
INT
,
b
TEXT
);
DELIMITER
$$
;
CREATE
PROCEDURE
p1
(
a
OUT
t1
%
ROWTYPE
)
AS
BEGIN
SET
a
.
a
=
10
;
SET
a
.
b
=
'text'
;
END
;
$$
CREATE
PROCEDURE
p2
AS
a
t1
%
ROWTYPE
;
BEGIN
CALL
p1
(
a
);
SELECT
a
.
a
,
a
.
b
;
END
;
$$
CREATE
FUNCTION
f1
(
a
t1
%
ROWTYPE
)
RETURN
TEXT
AS
BEGIN
RETURN
CONCAT
(
a
.
a
,
' '
,
a
.
b
);
END
;
$$
CREATE
FUNCTION
f2
RETURN
TEXT
AS
a
t1
%
ROWTYPE
;
BEGIN
CALL
p1
(
a
);
RETURN
f1
(
a
);
END
;
$$
DELIMITER
;
$$
CALL
p2
();
SELECT
f2
();
DROP
PROCEDURE
p2
;
DROP
PROCEDURE
p1
;
DROP
FUNCTION
f2
;
DROP
FUNCTION
f1
;
DROP
TABLE
t1
;
CREATE
DATABASE
db1
;
CREATE
TABLE
db1
.
t1
(
a
INT
,
b
TEXT
);
DELIMITER
$$
;
CREATE
PROCEDURE
p1
(
a
OUT
db1
.
t1
%
ROWTYPE
)
AS
BEGIN
SET
a
.
a
=
10
;
SET
a
.
b
=
'text'
;
END
;
$$
CREATE
PROCEDURE
p2
AS
a
db1
.
t1
%
ROWTYPE
;
BEGIN
CALL
p1
(
a
);
SELECT
a
.
a
,
a
.
b
;
END
;
$$
CREATE
FUNCTION
f1
(
a
db1
.
t1
%
ROWTYPE
)
RETURN
TEXT
AS
BEGIN
RETURN
CONCAT
(
a
.
a
,
' '
,
a
.
b
);
END
;
$$
CREATE
FUNCTION
f2
()
RETURN
TEXT
AS
a
db1
.
t1
%
ROWTYPE
;
BEGIN
CALL
p1
(
a
);
RETURN
f1
(
a
);
END
;
$$
DELIMITER
;
$$
CALL
p2
();
SELECT
f2
();
DROP
PROCEDURE
p2
;
DROP
PROCEDURE
p1
;
DROP
FUNCTION
f2
;
DROP
FUNCTION
f1
;
DROP
DATABASE
db1
;
mysql-test/t/sp-anchor-row-type-table.test
View file @
4305c3ca
...
@@ -759,3 +759,104 @@ DELIMITER ;$$
...
@@ -759,3 +759,104 @@ DELIMITER ;$$
CALL
p1
();
CALL
p1
();
DROP
TABLE
t1
;
DROP
TABLE
t1
;
DROP
PROCEDURE
p1
;
DROP
PROCEDURE
p1
;
--
echo
#
--
echo
# MDEV-13581 ROW TYPE OF t1 and t1%ROWTYPE for routine parameters
--
echo
#
CREATE
TABLE
t1
(
a
INT
,
b
TEXT
,
c
ENUM
(
'a'
,
'b'
,
'c'
));
DELIMITER
$$
;
CREATE
PROCEDURE
p1
(
a
ROW
TYPE
OF
t1
)
BEGIN
CREATE
TABLE
t2
AS
SELECT
a
.
a
AS
a
,
a
.
b
AS
b
,
a
.
c
AS
c
;
SHOW
CREATE
TABLE
t2
;
DROP
TABLE
t2
;
END
;
$$
CREATE
PROCEDURE
p2
()
BEGIN
DECLARE
a
ROW
TYPE
OF
t1
;
CALL
p1
(
a
);
END
;
$$
DELIMITER
;
$$
CALL
p2
();
DROP
PROCEDURE
p2
;
DROP
PROCEDURE
p1
;
DROP
TABLE
t1
;
CREATE
TABLE
t1
(
a
INT
,
b
TEXT
);
DELIMITER
$$
;
CREATE
PROCEDURE
p1
(
OUT
a
ROW
TYPE
OF
t1
)
BEGIN
SET
a
.
a
=
10
;
SET
a
.
b
=
'text'
;
END
;
$$
CREATE
PROCEDURE
p2
()
BEGIN
DECLARE
a
ROW
TYPE
OF
t1
;
CALL
p1
(
a
);
SELECT
a
.
a
,
a
.
b
;
END
;
$$
CREATE
FUNCTION
f1
(
a
ROW
TYPE
OF
t1
)
RETURNS
TEXT
BEGIN
RETURN
CONCAT
(
a
.
a
,
' '
,
a
.
b
);
END
;
$$
CREATE
FUNCTION
f2
()
RETURNS
TEXT
BEGIN
DECLARE
a
ROW
TYPE
OF
t1
;
CALL
p1
(
a
);
RETURN
f1
(
a
);
END
;
$$
DELIMITER
;
$$
CALL
p2
();
SELECT
f2
();
DROP
PROCEDURE
p2
;
DROP
PROCEDURE
p1
;
DROP
FUNCTION
f2
;
DROP
FUNCTION
f1
;
DROP
TABLE
t1
;
CREATE
DATABASE
db1
;
CREATE
TABLE
db1
.
t1
(
a
INT
,
b
TEXT
);
DELIMITER
$$
;
CREATE
PROCEDURE
p1
(
OUT
a
ROW
TYPE
OF
db1
.
t1
)
BEGIN
SET
a
.
a
=
10
;
SET
a
.
b
=
'text'
;
END
;
$$
CREATE
PROCEDURE
p2
()
BEGIN
DECLARE
a
ROW
TYPE
OF
db1
.
t1
;
CALL
p1
(
a
);
SELECT
a
.
a
,
a
.
b
;
END
;
$$
CREATE
FUNCTION
f1
(
a
ROW
TYPE
OF
db1
.
t1
)
RETURNS
TEXT
BEGIN
RETURN
CONCAT
(
a
.
a
,
' '
,
a
.
b
);
END
;
$$
CREATE
FUNCTION
f2
()
RETURNS
TEXT
BEGIN
DECLARE
a
ROW
TYPE
OF
db1
.
t1
;
CALL
p1
(
a
);
RETURN
f1
(
a
);
END
;
$$
DELIMITER
;
$$
CALL
p2
();
SELECT
f2
();
DROP
PROCEDURE
p2
;
DROP
PROCEDURE
p1
;
DROP
FUNCTION
f2
;
DROP
FUNCTION
f1
;
DROP
DATABASE
db1
;
mysql-test/t/sp-code.test
View file @
4305c3ca
...
@@ -734,3 +734,27 @@ DROP PROCEDURE testp_bug11763507;
...
@@ -734,3 +734,27 @@ DROP PROCEDURE testp_bug11763507;
DROP
FUNCTION
testf_bug11763507
;
DROP
FUNCTION
testf_bug11763507
;
--
echo
#END OF BUG#11763507 test.
--
echo
#END OF BUG#11763507 test.
--
echo
#
--
echo
# MDEV-13581 ROW TYPE OF t1 and t1%ROWTYPE for routine parameters
--
echo
#
CREATE
TABLE
t1
(
a
INT
,
b
TEXT
);
DELIMITER
$$
;
CREATE
PROCEDURE
p1
(
a
ROW
TYPE
OF
t1
,
OUT
b
ROW
TYPE
OF
t1
)
BEGIN
SET
a
.
a
=
100
;
SET
a
.
b
=
'aaa'
;
SET
b
.
a
=
200
;
SET
b
.
b
=
'bbb'
;
SET
a
=
b
;
SET
b
=
a
;
SET
a
.
a
=
b
.
a
;
SET
b
.
a
=
a
.
a
;
END
;
$$
DELIMITER
;
$$
SHOW
PROCEDURE
CODE
p1
;
DROP
PROCEDURE
p1
;
DROP
TABLE
t1
;
sql/sp_head.cc
View file @
4305c3ca
...
@@ -4718,3 +4718,68 @@ sp_head::add_set_for_loop_cursor_param_variables(THD *thd,
...
@@ -4718,3 +4718,68 @@ sp_head::add_set_for_loop_cursor_param_variables(THD *thd,
}
}
return
false
;
return
false
;
}
}
bool
sp_head
::
spvar_fill_row
(
THD
*
thd
,
sp_variable
*
spvar
,
Row_definition_list
*
defs
)
{
spvar
->
field_def
.
field_name
=
spvar
->
name
;
if
(
fill_spvar_definition
(
thd
,
&
spvar
->
field_def
))
return
true
;
row_fill_field_definitions
(
thd
,
defs
);
spvar
->
field_def
.
set_row_field_definitions
(
defs
);
return
false
;
}
bool
sp_head
::
spvar_fill_type_reference
(
THD
*
thd
,
sp_variable
*
spvar
,
const
LEX_CSTRING
&
table
,
const
LEX_CSTRING
&
col
)
{
Qualified_column_ident
*
ref
;
if
(
!
(
ref
=
new
(
thd
->
mem_root
)
Qualified_column_ident
(
&
table
,
&
col
)))
return
true
;
fill_spvar_using_type_reference
(
spvar
,
ref
);
return
false
;
}
bool
sp_head
::
spvar_fill_type_reference
(
THD
*
thd
,
sp_variable
*
spvar
,
const
LEX_CSTRING
&
db
,
const
LEX_CSTRING
&
table
,
const
LEX_CSTRING
&
col
)
{
Qualified_column_ident
*
ref
;
if
(
!
(
ref
=
new
(
thd
->
mem_root
)
Qualified_column_ident
(
thd
,
&
db
,
&
table
,
&
col
)))
return
true
;
fill_spvar_using_type_reference
(
spvar
,
ref
);
return
false
;
}
bool
sp_head
::
spvar_fill_table_rowtype_reference
(
THD
*
thd
,
sp_variable
*
spvar
,
const
LEX_CSTRING
&
table
)
{
Table_ident
*
ref
;
if
(
!
(
ref
=
new
(
thd
->
mem_root
)
Table_ident
(
&
table
)))
return
true
;
fill_spvar_using_table_rowtype_reference
(
thd
,
spvar
,
ref
);
return
false
;
}
bool
sp_head
::
spvar_fill_table_rowtype_reference
(
THD
*
thd
,
sp_variable
*
spvar
,
const
LEX_CSTRING
&
db
,
const
LEX_CSTRING
&
table
)
{
Table_ident
*
ref
;
if
(
!
(
ref
=
new
(
thd
->
mem_root
)
Table_ident
(
thd
,
&
db
,
&
table
,
false
)))
return
true
;
fill_spvar_using_table_rowtype_reference
(
thd
,
spvar
,
ref
);
return
false
;
}
sql/sp_head.h
View file @
4305c3ca
...
@@ -676,6 +676,8 @@ class sp_head :private Query_arena,
...
@@ -676,6 +676,8 @@ class sp_head :private Query_arena,
def
->
field_name
=
*
name
;
def
->
field_name
=
*
name
;
return
fill_spvar_definition
(
thd
,
def
);
return
fill_spvar_definition
(
thd
,
def
);
}
}
private:
/**
/**
Set a column type reference for a parameter definition
Set a column type reference for a parameter definition
*/
*/
...
@@ -687,6 +689,31 @@ class sp_head :private Query_arena,
...
@@ -687,6 +689,31 @@ class sp_head :private Query_arena,
m_flags
|=
sp_head
::
HAS_COLUMN_TYPE_REFS
;
m_flags
|=
sp_head
::
HAS_COLUMN_TYPE_REFS
;
}
}
void
fill_spvar_using_table_rowtype_reference
(
THD
*
thd
,
sp_variable
*
spvar
,
Table_ident
*
ref
)
{
spvar
->
field_def
.
set_table_rowtype_ref
(
ref
);
spvar
->
field_def
.
field_name
=
spvar
->
name
;
fill_spvar_definition
(
thd
,
&
spvar
->
field_def
);
m_flags
|=
sp_head
::
HAS_COLUMN_TYPE_REFS
;
}
public:
bool
spvar_fill_row
(
THD
*
thd
,
sp_variable
*
spvar
,
Row_definition_list
*
def
);
bool
spvar_fill_type_reference
(
THD
*
thd
,
sp_variable
*
spvar
,
const
LEX_CSTRING
&
table
,
const
LEX_CSTRING
&
column
);
bool
spvar_fill_type_reference
(
THD
*
thd
,
sp_variable
*
spvar
,
const
LEX_CSTRING
&
db
,
const
LEX_CSTRING
&
table
,
const
LEX_CSTRING
&
column
);
bool
spvar_fill_table_rowtype_reference
(
THD
*
thd
,
sp_variable
*
spvar
,
const
LEX_CSTRING
&
table
);
bool
spvar_fill_table_rowtype_reference
(
THD
*
thd
,
sp_variable
*
spvar
,
const
LEX_CSTRING
&
db
,
const
LEX_CSTRING
&
table
);
void
set_chistics
(
const
st_sp_chistics
&
chistics
);
void
set_chistics
(
const
st_sp_chistics
&
chistics
);
void
set_info
(
longlong
created
,
longlong
modified
,
void
set_info
(
longlong
created
,
longlong
modified
,
const
st_sp_chistics
&
chistics
,
sql_mode_t
sql_mode
);
const
st_sp_chistics
&
chistics
,
sql_mode_t
sql_mode
);
...
...
sql/sql_yacc.yy
View file @
4305c3ca
...
@@ -1633,7 +1633,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
...
@@ -1633,7 +1633,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
table_ident_opt_wild create_like
table_ident_opt_wild create_like
%type <qualified_column_ident>
%type <qualified_column_ident>
qualified_column_ident
optionally_qualified_column_ident
optionally_qualified_column_ident
%type <simple_string>
%type <simple_string>
...
@@ -3093,17 +3092,30 @@ sp_param_name_and_type:
...
@@ -3093,17 +3092,30 @@ sp_param_name_and_type:
if (Lex->sp_param_fill_definition($$= $1))
if (Lex->sp_param_fill_definition($$= $1))
MYSQL_YYABORT;
MYSQL_YYABORT;
}
}
| sp_param_name TYPE_SYM OF_SYM
qualified_column_
ident
| sp_param_name TYPE_SYM OF_SYM
ident '.'
ident
{
{
Lex->sphead->fill_spvar_using_type_reference($$= $1, $4);
if (Lex->sphead->spvar_fill_type_reference(thd, $$= $1, $4, $6))
MYSQL_YYABORT;
}
| sp_param_name TYPE_SYM OF_SYM ident '.' ident '.' ident
{
if (Lex->sphead->spvar_fill_type_reference(thd, $$= $1, $4, $6, $8))
MYSQL_YYABORT;
}
| sp_param_name ROW_SYM TYPE_SYM OF_SYM ident
{
if (Lex->sphead->spvar_fill_table_rowtype_reference(thd, $$= $1, $5))
MYSQL_YYABORT;
}
| sp_param_name ROW_SYM TYPE_SYM OF_SYM ident '.' ident
{
if (Lex->sphead->spvar_fill_table_rowtype_reference(thd, $$= $1, $5, $7))
MYSQL_YYABORT;
}
}
| sp_param_name ROW_SYM row_type_body
| sp_param_name ROW_SYM row_type_body
{
{
$$= $1;
if (Lex->sphead->spvar_fill_row(thd, $$= $1, $3))
$$->field_def.field_name= $$->name;
MYSQL_YYABORT;
Lex->sphead->fill_spvar_definition(thd, &$$->field_def);
Lex->sphead->row_fill_field_definitions(thd, $3);
$$->field_def.set_row_field_definitions($3);
}
}
;
;
...
@@ -3184,20 +3196,6 @@ sp_decl:
...
@@ -3184,20 +3196,6 @@ sp_decl:
;
;
qualified_column_ident:
sp_decl_ident '.' ident
{
if (!($$= new (thd->mem_root) Qualified_column_ident(&$1, &$3)))
MYSQL_YYABORT;
}
| sp_decl_ident '.' ident '.' ident
{
if (!($$= new (thd->mem_root) Qualified_column_ident(thd,
&$1, &$3, &$5)))
MYSQL_YYABORT;
}
;
optionally_qualified_column_ident:
optionally_qualified_column_ident:
sp_decl_ident
sp_decl_ident
{
{
...
...
sql/sql_yacc_ora.yy
View file @
4305c3ca
...
@@ -1044,7 +1044,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
...
@@ -1044,7 +1044,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
table_ident_opt_wild create_like
table_ident_opt_wild create_like
%type <qualified_column_ident>
%type <qualified_column_ident>
qualified_column_ident
optionally_qualified_column_ident
optionally_qualified_column_ident
%type <simple_string>
%type <simple_string>
...
@@ -2539,17 +2538,30 @@ sp_param_name_and_type:
...
@@ -2539,17 +2538,30 @@ sp_param_name_and_type:
if (Lex->sp_param_fill_definition($$= $1))
if (Lex->sp_param_fill_definition($$= $1))
MYSQL_YYABORT;
MYSQL_YYABORT;
}
}
| sp_param_name
qualified_column_
ident '%' TYPE_SYM
| sp_param_name
sp_decl_ident '.'
ident '%' TYPE_SYM
{
{
Lex->sphead->fill_spvar_using_type_reference($$= $1, $2);
if (Lex->sphead->spvar_fill_type_reference(thd, $$= $1, $2, $4))
MYSQL_YYABORT;
}
| sp_param_name sp_decl_ident '.' ident '.' ident '%' TYPE_SYM
{
if (Lex->sphead->spvar_fill_type_reference(thd, $$= $1, $2, $4, $6))
MYSQL_YYABORT;
}
| sp_param_name sp_decl_ident '%' ROWTYPE_SYM
{
if (Lex->sphead->spvar_fill_table_rowtype_reference(thd, $$= $1, $2))
MYSQL_YYABORT;
}
| sp_param_name sp_decl_ident '.' ident '%' ROWTYPE_SYM
{
if (Lex->sphead->spvar_fill_table_rowtype_reference(thd, $$= $1, $2, $4))
MYSQL_YYABORT;
}
}
| sp_param_name ROW_SYM row_type_body
| sp_param_name ROW_SYM row_type_body
{
{
$$= $1;
if (Lex->sphead->spvar_fill_row(thd, $$= $1, $3))
$$->field_def.field_name= $$->name;
MYSQL_YYABORT;
Lex->sphead->fill_spvar_definition(thd, &$$->field_def);
Lex->sphead->row_fill_field_definitions(thd, $3);
$$->field_def.set_row_field_definitions($3);
}
}
;
;
...
@@ -2571,17 +2583,35 @@ sp_pdparam:
...
@@ -2571,17 +2583,35 @@ sp_pdparam:
if (Lex->sp_param_fill_definition($1))
if (Lex->sp_param_fill_definition($1))
MYSQL_YYABORT;
MYSQL_YYABORT;
}
}
| sp_param_name sp_opt_inout qualified_column_ident '%' TYPE_SYM
| sp_param_name sp_opt_inout sp_decl_ident '.' ident '%' TYPE_SYM
{
$1->mode= $2;
if (Lex->sphead->spvar_fill_type_reference(thd, $1, $3, $5))
MYSQL_YYABORT;
}
| sp_param_name sp_opt_inout sp_decl_ident '.' ident '.' ident '%' TYPE_SYM
{
{
Lex->sphead->fill_spvar_using_type_reference($1, $3);
$1->mode= $2;
if (Lex->sphead->spvar_fill_type_reference(thd, $1, $3, $5, $7))
MYSQL_YYABORT;
}
| sp_param_name sp_opt_inout sp_decl_ident '%' ROWTYPE_SYM
{
$1->mode= $2;
if (Lex->sphead->spvar_fill_table_rowtype_reference(thd, $1, $3))
MYSQL_YYABORT;
}
| sp_param_name sp_opt_inout sp_decl_ident '.' ident '%' ROWTYPE_SYM
{
$1->mode= $2;
if (Lex->sphead->spvar_fill_table_rowtype_reference(thd, $1, $3, $5))
MYSQL_YYABORT;
}
}
| sp_param_name sp_opt_inout ROW_SYM row_type_body
| sp_param_name sp_opt_inout ROW_SYM row_type_body
{
{
$1->mode= $2;
$1->mode= $2;
$1->field_def.field_name= $1->name;
if (Lex->sphead->spvar_fill_row(thd, $1, $4))
Lex->sphead->fill_spvar_definition(thd, &$1->field_def);
MYSQL_YYABORT;
Lex->sphead->row_fill_field_definitions(thd, $4);
$1->field_def.set_row_field_definitions($4);
}
}
;
;
...
@@ -2698,20 +2728,6 @@ opt_sp_decl_handler_list:
...
@@ -2698,20 +2728,6 @@ opt_sp_decl_handler_list:
| sp_decl_handler_list
| sp_decl_handler_list
;
;
qualified_column_ident:
sp_decl_ident '.' ident
{
if (!($$= new (thd->mem_root) Qualified_column_ident(&$1, &$3)))
MYSQL_YYABORT;
}
| sp_decl_ident '.' ident '.' ident
{
if (!($$= new (thd->mem_root) Qualified_column_ident(thd,
&$1, &$3, &$5)))
MYSQL_YYABORT;
}
;
optionally_qualified_column_ident:
optionally_qualified_column_ident:
sp_decl_ident
sp_decl_ident
{
{
...
...
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