summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2017-08-18 18:29:33 +0400
committerAlexander Barkov <bar@mariadb.org>2017-08-18 18:29:33 +0400
commit4305c3ca5797ba4157384c363579be8e934e2fb1 (patch)
treeaa48de35235e7d087d385f3c28edeacdf11e9d89
parenta70809c0fcd5eca38c5f6bafa92270f1704a0597 (diff)
downloadmariadb-git-4305c3ca5797ba4157384c363579be8e934e2fb1.tar.gz
MDEV-13581 ROW TYPE OF t1 and t1%ROWTYPE for routine parameters
-rw-r--r--mysql-test/r/sp-anchor-row-type-table.result102
-rw-r--r--mysql-test/r/sp-code.result28
-rw-r--r--mysql-test/suite/compat/oracle/r/sp-anchor-row-type-table.result103
-rw-r--r--mysql-test/suite/compat/oracle/t/sp-anchor-row-type-table.test101
-rw-r--r--mysql-test/t/sp-anchor-row-type-table.test101
-rw-r--r--mysql-test/t/sp-code.test24
-rw-r--r--sql/sp_head.cc65
-rw-r--r--sql/sp_head.h27
-rw-r--r--sql/sql_yacc.yy42
-rw-r--r--sql/sql_yacc_ora.yy72
10 files changed, 615 insertions, 50 deletions
diff --git a/mysql-test/r/sp-anchor-row-type-table.result b/mysql-test/r/sp-anchor-row-type-table.result
index 80fc763c4fa..e3ad1aa831e 100644
--- a/mysql-test/r/sp-anchor-row-type-table.result
+++ b/mysql-test/r/sp-anchor-row-type-table.result
@@ -679,3 +679,105 @@ rec.b
b0
DROP TABLE t1;
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;
diff --git a/mysql-test/r/sp-code.result b/mysql-test/r/sp-code.result
index 972c7ff5b16..ddb2901b8a4 100644
--- a/mysql-test/r/sp-code.result
+++ b/mysql-test/r/sp-code.result
@@ -970,3 +970,31 @@ Pos Instruction
DROP PROCEDURE testp_bug11763507;
DROP FUNCTION testf_bug11763507;
#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;
diff --git a/mysql-test/suite/compat/oracle/r/sp-anchor-row-type-table.result b/mysql-test/suite/compat/oracle/r/sp-anchor-row-type-table.result
new file mode 100644
index 00000000000..f2c8429a54d
--- /dev/null
+++ b/mysql-test/suite/compat/oracle/r/sp-anchor-row-type-table.result
@@ -0,0 +1,103 @@
+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;
diff --git a/mysql-test/suite/compat/oracle/t/sp-anchor-row-type-table.test b/mysql-test/suite/compat/oracle/t/sp-anchor-row-type-table.test
new file mode 100644
index 00000000000..b904cc39139
--- /dev/null
+++ b/mysql-test/suite/compat/oracle/t/sp-anchor-row-type-table.test
@@ -0,0 +1,101 @@
+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;
diff --git a/mysql-test/t/sp-anchor-row-type-table.test b/mysql-test/t/sp-anchor-row-type-table.test
index 97e0a1d5805..1171ae2d7b7 100644
--- a/mysql-test/t/sp-anchor-row-type-table.test
+++ b/mysql-test/t/sp-anchor-row-type-table.test
@@ -759,3 +759,104 @@ DELIMITER ;$$
CALL p1();
DROP TABLE t1;
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;
diff --git a/mysql-test/t/sp-code.test b/mysql-test/t/sp-code.test
index d4b63a73920..29b6764ebc6 100644
--- a/mysql-test/t/sp-code.test
+++ b/mysql-test/t/sp-code.test
@@ -734,3 +734,27 @@ DROP PROCEDURE testp_bug11763507;
DROP FUNCTION testf_bug11763507;
--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;
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index bb6fe6613bf..2ea40e37754 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -4718,3 +4718,68 @@ sp_head::add_set_for_loop_cursor_param_variables(THD *thd,
}
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;
+}
diff --git a/sql/sp_head.h b/sql/sp_head.h
index 730b2c11b43..c3dab609823 100644
--- a/sql/sp_head.h
+++ b/sql/sp_head.h
@@ -676,6 +676,8 @@ public:
def->field_name= *name;
return fill_spvar_definition(thd, def);
}
+
+private:
/**
Set a column type reference for a parameter definition
*/
@@ -687,6 +689,31 @@ public:
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_info(longlong created, longlong modified,
const st_sp_chistics &chistics, sql_mode_t sql_mode);
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 647ed1a3a60..b4aa1b63213 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -1633,7 +1633,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
table_ident_opt_wild create_like
%type <qualified_column_ident>
- qualified_column_ident
optionally_qualified_column_ident
%type <simple_string>
@@ -3093,17 +3092,30 @@ sp_param_name_and_type:
if (Lex->sp_param_fill_definition($$= $1))
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
{
- $$= $1;
- $$->field_def.field_name= $$->name;
- Lex->sphead->fill_spvar_definition(thd, &$$->field_def);
- Lex->sphead->row_fill_field_definitions(thd, $3);
- $$->field_def.set_row_field_definitions($3);
+ if (Lex->sphead->spvar_fill_row(thd, $$= $1, $3))
+ MYSQL_YYABORT;
}
;
@@ -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:
sp_decl_ident
{
diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy
index f0f365d0116..746d43fdc0f 100644
--- a/sql/sql_yacc_ora.yy
+++ b/sql/sql_yacc_ora.yy
@@ -1044,7 +1044,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
table_ident_opt_wild create_like
%type <qualified_column_ident>
- qualified_column_ident
optionally_qualified_column_ident
%type <simple_string>
@@ -2539,17 +2538,30 @@ sp_param_name_and_type:
if (Lex->sp_param_fill_definition($$= $1))
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
{
- $$= $1;
- $$->field_def.field_name= $$->name;
- Lex->sphead->fill_spvar_definition(thd, &$$->field_def);
- Lex->sphead->row_fill_field_definitions(thd, $3);
- $$->field_def.set_row_field_definitions($3);
+ if (Lex->sphead->spvar_fill_row(thd, $$= $1, $3))
+ MYSQL_YYABORT;
}
;
@@ -2571,17 +2583,35 @@ sp_pdparam:
if (Lex->sp_param_fill_definition($1))
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
{
$1->mode= $2;
- $1->field_def.field_name= $1->name;
- Lex->sphead->fill_spvar_definition(thd, &$1->field_def);
- Lex->sphead->row_fill_field_definitions(thd, $4);
- $1->field_def.set_row_field_definitions($4);
+ if (Lex->sphead->spvar_fill_row(thd, $1, $4))
+ MYSQL_YYABORT;
}
;
@@ -2698,20 +2728,6 @@ opt_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:
sp_decl_ident
{