Alexander Barkov
f429b5a834
MDEV-12011 sql_mode=ORACLE: cursor%ROWTYPE in variable declarations
...
Implementing cursor%ROWTYPE variables, according to the task description.
This patch includes a refactoring in how sp_instr_cpush and sp_instr_copen
work. This is needed to implement MDEV-10598 later easier, to allow variable
declarations go after cursor declarations (which is currently not allowed).
Before this patch, sp_instr_cpush worked as a Query_arena associated with
the cursor. sp_instr_copen::execute() switched to the sp_instr_cpush's
Query_arena when executing the cursor SELECT statement.
Now the Query_arena associated with the cursor is stored inside an instance
of a new class sp_lex_cursor (a LEX descendand) that contains the cursor SELECT
statement.
This simplifies the implementation, because:
- It's easier to follow the code when everything related to execution
of the cursor SELECT statement is stored inside the same sp_lex_cursor
object (rather than distributed between LEX and sp_instr_cpush).
- It's easier to link an sp_instr_cursor_copy_struct to
sp_lex_cursor rather than to sp_instr_cpush.
- Also, it allows to perform sp_instr_cursor_copy_struct::exec_core()
without having a pointer to sp_instr_cpush, using a pointer to sp_lex_cursor
instead. This will be important for MDEV-10598, because sp_instr_cpush will
happen *after* sp_instr_cursor_copy_struct.
After MDEV-10598 is done, this declaration:
DECLARE
CURSOR cur IS SELECT * FROM t1;
rec cur%ROWTYPE;
BEGIN
OPEN cur;
FETCH cur INTO rec;
CLOSE cur;
END;
will generate about this code:
+-----+--------------------------+
| Pos | Instruction |
+-----+--------------------------+
| 0 | cursor_copy_struct rec@0 | Points to sp_cursor_lex through m_lex_keeper
| 1 | set rec@0 NULL |
| 2 | cpush cur@0 | Points to sp_cursor_lex through m_lex_keeper
| 3 | copen cur@0 | Points to sp_cursor_lex through m_cursor
| 4 | cfetch cur@0 rec@0 |
| 5 | cclose cur@0 |
| 6 | cpop 1 |
+-----+--------------------------+
Notice, "cursor_copy_struct" and "set" will go before "cpush".
Instructions at positions 0, 2, 3 point to the same sp_cursor_lex instance.
2017-04-05 15:02:59 +04:00
..
2017-04-05 15:02:59 +04:00
2016-02-04 16:00:11 +02:00
2017-03-30 12:48:42 +02:00
2016-02-25 18:19:55 +01:00
2017-04-05 15:01:59 +04:00
2017-01-11 09:18:35 +02:00
2017-02-28 17:15:36 +04:00
2017-03-30 12:48:42 +02:00
2017-03-10 18:21:29 +01:00
2017-03-30 12:48:42 +02:00
2017-03-10 18:21:23 +01:00
2017-02-27 12:35:10 +01:00
2016-06-30 16:38:05 +02:00
2016-08-25 12:40:09 +02:00
2016-05-08 23:04:41 +03:00
2016-03-21 11:43:19 +01:00
2016-12-06 09:45:50 +01:00
2016-10-05 01:11:08 +03:00
2017-02-10 17:01:45 +01:00
2017-03-31 14:26:43 +04:00
2016-03-04 02:09:37 +02:00
2017-03-30 12:48:42 +02:00
2016-06-04 09:06:00 +02:00
2015-11-19 15:52:14 +01:00
2016-10-10 14:36:09 +04:00
2017-04-05 15:02:56 +04:00
2017-04-05 15:02:59 +04:00
2017-03-30 12:48:42 +02:00
2016-03-22 23:44:52 +02:00
2017-02-27 10:07:59 +04:00
2016-07-01 16:44:17 +02:00
2017-03-10 18:21:29 +01:00
2017-03-10 18:21:29 +01:00
2017-03-10 18:21:29 +01:00
2017-03-10 18:21:29 +01:00
2016-04-26 16:15:15 +04:00
2017-03-10 18:21:29 +01:00
2017-03-10 18:21:29 +01:00
2017-03-30 12:48:42 +02:00
2017-01-21 22:58:04 +03:00
2017-03-31 19:28:58 +02:00
2017-04-05 14:42:14 +04:00
2016-12-29 13:23:18 +01:00
2016-02-07 10:34:03 +02:00
2015-12-16 19:39:00 +04:00
2016-05-08 23:04:41 +03:00
2017-04-05 15:02:48 +04:00
2017-04-05 15:02:48 +04:00
2017-04-05 15:02:57 +04:00
2017-04-05 15:02:56 +04:00
2017-04-05 15:02:56 +04:00
2017-01-24 02:29:04 +04:00
2017-01-24 02:29:04 +04:00
2016-08-31 16:16:54 -07:00
2017-03-20 15:18:06 +04:00
2017-03-14 17:31:14 +04:00
2016-08-31 16:16:54 -07:00
2017-04-05 14:42:14 +04:00
2017-04-05 15:02:55 +04:00
2017-04-05 15:02:57 +04:00
2017-03-31 16:40:29 +04:00
2017-03-31 16:40:29 +04:00
2017-03-19 23:39:42 +04:00
2017-03-24 17:52:55 +04:00
2017-04-04 17:59:48 +04:00
2017-04-04 17:59:48 +04:00
2017-02-27 10:07:59 +04:00
2017-03-24 17:52:55 +04:00
2016-10-19 14:10:03 +04:00
2016-10-19 14:10:03 +04:00
2017-04-05 15:02:59 +04:00
2017-04-05 15:02:59 +04:00
2017-03-11 20:12:15 +00:00
2016-10-16 11:01:01 +00:00
2017-04-05 15:02:59 +04:00
2016-12-21 13:18:45 +04:00
2017-03-30 12:48:42 +02:00
2017-03-30 12:48:42 +02:00
2017-03-07 19:07:27 +02:00
2017-03-30 12:48:42 +02:00
2017-03-30 12:48:42 +02:00
2017-03-07 19:07:27 +02:00
2017-03-30 12:48:42 +02:00
2016-12-21 13:18:45 +04:00
2016-05-31 17:59:04 +03:00
2017-03-10 18:21:29 +01:00
2017-03-10 18:21:29 +01:00
2017-03-10 18:21:29 +01:00
2017-03-10 18:21:29 +01:00
2017-03-10 18:21:29 +01:00
2017-03-10 18:21:29 +01:00
2017-03-30 12:48:42 +02:00
2017-03-10 18:21:29 +01:00
2017-03-31 16:40:29 +04:00
2017-03-31 16:40:29 +04:00
2016-12-29 13:23:18 +01:00
2017-02-28 12:57:33 +00:00
2017-02-28 12:57:33 +00:00
2017-03-10 18:21:29 +01:00
2017-03-10 18:21:29 +01:00
2017-04-05 14:42:14 +04:00
2017-02-13 18:12:04 +01:00
2017-03-31 16:40:29 +04:00
2017-03-10 18:21:29 +01:00
2017-02-13 18:12:05 +01:00
2017-03-30 12:48:42 +02:00
2016-06-08 14:17:23 +03:00
2016-09-28 17:55:28 +02:00
2016-09-07 17:26:36 +02:00
2017-03-30 12:48:42 +02:00
2016-12-12 20:27:27 +01:00
2017-03-30 12:48:42 +02:00
2017-03-10 18:21:29 +01:00
2016-08-31 16:16:54 -07:00
2017-03-18 14:20:06 +04:00
2016-05-17 13:31:33 +02:00
2017-02-13 18:12:15 +01:00
2017-02-14 07:46:58 +02:00
2016-12-11 09:53:42 +01:00
2016-12-29 13:23:18 +01:00
2016-05-08 23:04:41 +03:00
2015-11-19 15:52:14 +01:00
2017-03-30 12:48:42 +02:00
2017-03-03 13:27:12 +02:00
2017-03-30 12:48:42 +02:00
2017-03-03 13:27:12 +02:00
2017-01-05 10:48:03 +02:00
2017-01-01 17:38:41 +05:30
2016-02-15 22:50:59 +01:00
2017-03-30 12:48:42 +02:00
2017-03-30 12:48:42 +02:00
2016-02-25 18:19:55 +01:00
2016-06-04 09:06:00 +02:00
2016-02-07 10:34:03 +02:00
2016-10-05 01:11:07 +03:00
2017-03-07 19:07:27 +02:00
2017-04-05 15:02:39 +04:00
2017-04-05 15:02:39 +04:00
2017-03-22 01:48:22 +04:00
2017-03-30 12:48:42 +02:00
2017-03-30 12:48:42 +02:00
2017-03-31 14:26:43 +04:00
2017-04-05 15:02:59 +04:00
2017-04-05 15:02:59 +04:00
2017-04-05 15:02:59 +04:00
2017-04-05 15:02:59 +04:00
2017-04-05 15:02:59 +04:00
2017-04-05 15:02:59 +04:00
2017-04-05 15:02:42 +04:00
2017-04-05 15:02:41 +04:00
2017-03-10 19:07:07 +00:00
2017-01-24 22:39:55 +04:00
2017-03-30 12:48:42 +02:00
2017-03-07 19:07:27 +02:00
2017-03-13 15:31:12 +01:00
2016-06-30 11:43:02 +02:00
2017-03-30 12:48:42 +02:00
2016-06-22 22:04:55 +03:00
2017-03-30 12:48:42 +02:00
2017-03-30 12:48:42 +02:00
2016-05-08 23:04:41 +03:00
2016-11-24 17:36:02 +03:00
2017-03-07 19:07:27 +02:00
2017-04-05 15:02:54 +04:00
2017-04-05 15:02:54 +04:00
2016-10-05 01:11:08 +03:00
2017-03-30 12:48:42 +02:00
2017-03-15 20:15:31 +05:30
2016-12-29 13:23:18 +01:00
2017-04-05 15:02:56 +04:00
2017-04-05 15:02:59 +04:00
2016-10-08 12:32:52 +04:00
2017-03-30 12:48:42 +02:00
2016-06-04 09:06:00 +02:00
2016-12-19 14:28:08 +04:00
2017-03-26 23:00:28 -07:00
2017-03-14 11:52:00 +01:00
2017-04-05 15:02:59 +04:00
2017-04-05 15:02:59 +04:00
2017-03-31 16:40:29 +04:00
2017-03-29 17:22:49 +04:00
2017-02-13 18:12:04 +01:00
2017-03-31 16:40:29 +04:00
2016-08-23 00:39:12 +03:00
2016-05-08 23:04:41 +03:00
2017-04-05 15:02:53 +04:00
2017-04-05 15:02:53 +04:00
2017-03-31 16:40:29 +04:00
2017-03-31 16:40:29 +04:00
2017-03-10 18:21:29 +01:00
2017-03-10 18:21:29 +01:00
2017-01-11 09:18:35 +02:00
2016-10-05 01:11:08 +03:00
2017-03-31 19:22:19 +02:00
2017-03-30 12:48:42 +02:00
2017-01-17 20:16:09 +01:00
2017-03-30 12:48:42 +02:00
2017-03-10 18:21:29 +01:00
2017-04-05 15:02:59 +04:00
2017-04-05 15:02:59 +04:00
2017-03-10 18:21:29 +01:00
2017-04-05 15:02:56 +04:00
2017-01-16 03:18:14 +02:00
2016-05-04 15:23:26 +02:00
2016-06-30 16:38:05 +02:00
2017-04-05 15:01:59 +04:00
2017-03-31 16:40:29 +04:00
2016-06-10 18:39:43 -04:00
2017-02-08 10:22:42 +01:00
2016-12-12 20:27:33 +01:00
2017-03-30 12:48:42 +02:00
2017-03-30 12:48:42 +02:00
2017-03-07 19:07:27 +02:00
2017-03-30 12:48:42 +02:00
2016-11-02 15:07:52 +01:00
2016-09-24 15:27:56 +03:00
2016-06-04 09:06:00 +02:00
2016-06-04 09:06:00 +02:00
2017-03-30 12:48:42 +02:00
2016-09-09 08:33:08 +02:00
2017-03-30 12:48:42 +02:00
2016-08-29 20:28:06 +03:00
2017-04-05 15:02:59 +04:00
2017-04-05 15:02:54 +04:00
2016-06-04 09:06:00 +02:00
2017-04-05 15:02:54 +04:00
2016-08-31 17:17:46 +02:00
2017-04-05 15:02:53 +04:00
2017-04-05 15:02:53 +04:00
2016-03-22 23:44:52 +02:00
2017-03-30 12:48:42 +02:00
2016-12-19 15:55:55 -05:00
2016-12-16 18:33:54 +04:00
2017-03-08 23:47:20 +04:00
2017-03-31 16:40:29 +04:00
2017-03-08 23:47:20 +04:00
2017-04-05 15:02:56 +04:00
2016-01-12 17:03:29 +04:00
2016-12-29 13:23:18 +01:00
2016-12-19 14:28:08 +04:00
2017-02-10 17:01:45 +01:00
2017-03-07 19:07:27 +02:00
2017-04-05 15:02:56 +04:00
2017-04-04 17:59:48 +04:00
2017-03-30 12:48:42 +02:00
2015-12-21 21:24:22 +01:00
2017-03-29 07:24:05 +04:00
2017-02-13 18:12:05 +01:00
2017-03-14 11:52:00 +01:00
2015-12-21 12:13:39 -08:00
2017-02-15 14:09:27 +02:00
2016-09-30 17:40:40 -07:00
2017-04-05 15:02:59 +04:00
2017-04-05 15:02:59 +04:00
2016-03-31 11:04:48 +04:00
2017-04-05 15:02:56 +04:00
2017-03-30 12:48:42 +02:00
2017-02-10 17:01:45 +01:00
2016-12-29 13:23:18 +01:00
2016-09-16 18:41:21 +04:00
2017-04-05 15:02:59 +04:00
2017-04-05 15:02:59 +04:00
2016-12-12 20:27:30 +01:00
2015-11-26 11:34:17 +04:00
2015-11-26 11:34:17 +04:00
2017-03-30 12:48:42 +02:00
2017-03-30 12:48:42 +02:00
2017-03-30 12:48:42 +02:00
2017-03-30 12:48:42 +02:00
2016-09-08 22:41:50 +02:00
2016-09-08 22:41:50 +02:00
2016-06-04 09:06:00 +02:00
2016-03-22 23:44:52 +02:00
2016-03-22 23:44:52 +02:00
2017-03-10 19:07:07 +00:00
2016-12-12 20:27:30 +01:00
2017-03-10 18:21:29 +01:00
2017-03-10 18:21:29 +01:00
2016-12-29 13:23:18 +01:00
2017-03-10 18:21:29 +01:00
2016-12-29 13:23:18 +01:00
2016-08-25 15:39:39 -04:00
2017-03-30 12:48:42 +02:00
2016-02-24 23:32:37 -05:00
2017-03-30 12:48:42 +02:00
2017-03-30 12:48:42 +02:00
2017-03-30 12:48:42 +02:00
2017-03-30 12:48:42 +02:00
2017-03-30 12:48:42 +02:00
2017-03-30 12:48:42 +02:00
2016-08-03 13:36:12 -04:00
2016-11-02 15:07:52 +01:00
2017-03-30 12:48:42 +02:00
2016-06-30 16:38:05 +02:00
2017-03-30 12:48:42 +02:00
2016-09-09 08:33:08 +02:00
2017-03-30 12:48:42 +02:00
2016-05-31 20:37:00 -04:00