diff options
author | Sergei Golubchik <serg@mariadb.org> | 2015-09-03 12:58:41 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2015-09-03 12:58:41 +0200 |
commit | 530a6e74819ec14b5fdc42aa588b236ecb9f2fcd (patch) | |
tree | a4d45b1fd0e434c23577507364fa443226676eb5 /sql/sql_cursor.cc | |
parent | 5088cbf4ed7224698678f3eaf406361c6e7db4b8 (diff) | |
parent | 4b41e3c7f33714186c97a6cc2e6d3bb93b050c61 (diff) | |
download | mariadb-git-530a6e74819ec14b5fdc42aa588b236ecb9f2fcd.tar.gz |
Merge branch '10.0' into 10.1
referenced_by_foreign_key2(), needed for InnoDB to compile,
was taken from 10.0-galera
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 27dea480025..a8c5569ba4a 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(THD *thd_arg, select_result *result_arg): select_union(thd_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(); + } }; @@ -389,6 +403,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 ****************************************************************************/ |