diff options
author | Sergei Golubchik <serg@mariadb.org> | 2015-08-05 09:45:36 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2015-08-05 09:45:36 +0200 |
commit | 50ef00663322aeb36b18048193f0d47c9d388ae3 (patch) | |
tree | 5194ab20feb3d18a61b4394484752ed3048270cd /sql/sql_cursor.cc | |
parent | 928edb5a9139502abf6e1c1b1552234b39d38a78 (diff) | |
parent | d6d54584ee813c6592cecb01eab3d896ed1475a8 (diff) | |
download | mariadb-git-50ef00663322aeb36b18048193f0d47c9d388ae3.tar.gz |
Merge branch '10.0' into bb-10.0-serg
Diffstat (limited to 'sql/sql_cursor.cc')
-rw-r--r-- | sql/sql_cursor.cc | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/sql/sql_cursor.cc b/sql/sql_cursor.cc index c09f3269d7a..d8684086e68 100644 --- a/sql/sql_cursor.cc +++ b/sql/sql_cursor.cc @@ -54,6 +54,8 @@ public: virtual void fetch(ulong num_rows); virtual void close(); virtual ~Materialized_cursor(); + + void on_table_fill_finished(); }; @@ -74,6 +76,18 @@ public: Select_materialize(select_result *result_arg) :result(result_arg), materialized_cursor(0) {} virtual bool send_result_set_metadata(List<Item> &list, uint flags); + bool send_eof() + { + if (materialized_cursor) + materialized_cursor->on_table_fill_finished(); + return false; + } + + void abort_result_set() + { + if (materialized_cursor) + materialized_cursor->on_table_fill_finished(); + } }; @@ -388,6 +402,29 @@ Materialized_cursor::~Materialized_cursor() } +/* + @brief + Perform actions that are to be done when cursor materialization has + finished. + + @detail + This function is called when "OPEN $cursor" has finished filling the + temporary table with rows that the cursor will return. + + Temporary table has table->field->orig_table pointing at the tables + that are used in the cursor definition query. Pointers to these tables + will not be valid after the query finishes. So, we do what is done for + regular tables: have orig_table point at the table that the fields belong + to. +*/ + +void Materialized_cursor::on_table_fill_finished() +{ + uint fields= table->s->fields; + for (uint i= 0; i < fields; i++) + table->field[i]->orig_table= table->field[i]->table; +} + /*************************************************************************** Select_materialize ****************************************************************************/ |