From 541cb675c87ae1efa1e1769abaed03e9535eaf27 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 8 Feb 2004 20:14:13 +0200 Subject: fixed subquery with PS (BUG#2462) fixed UNION preparation sql/item.cc: debug output added sql/item.h: debug output added sql/item_cmpfunc.cc: correct cleunup() for Item_in_optimizer sql/item_cmpfunc.h: correct cleunup() for Item_in_optimizer debug output added sql/item_func.h: debug output added sql/item_subselect.cc: support of prepared statemnts added - mostly memorry allocation manegement, only one trabsformatio & correct cleupup() sql/item_subselect.h: support of prepared statemnts added - mostly memorry allocation manegement, only one trabsformatio & correct cleupup() sql/item_sum.cc: debug output added sql/item_sum.h: debug output added sql/sql_class.cc: function to switch allocation arena for Items sql/sql_class.h: function to switch allocation arena for Items pointer on current prepared statement added sql/sql_lex.cc: comment fixed sql/sql_lex.h: item cleanup support sql/sql_prepare.cc: - fixed preparation of PS to avoid storing junk in its memory + correct work with union - fixed tables cleanup for UNION & subqueries sql/sql_select.cc: removed condition which is always true for now fixed layout sql/sql_union.cc: support of UNION subquery cleanup tests/client_test.c: test of repeatable subqueries test of correct UNION initialisation --- sql/sql_class.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'sql/sql_class.h') diff --git a/sql/sql_class.h b/sql/sql_class.h index 7971137d848..fbe42c9876e 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -427,7 +427,7 @@ class Statement public: /* FIXME: must be private */ LEX main_lex; -public: + /* Uniquely identifies each statement object in thread scope; change during statement lifetime. FIXME: must be const @@ -476,7 +476,7 @@ public: char *query; uint32 query_length; // current query length /* - List of items created in the parser for this query. Every item puts + List of items created in the parser for this query. Every item puts itself to the list on creation (see Item::Item() for details)) */ Item *free_list; @@ -503,6 +503,15 @@ public: void set_statement(Statement *stmt); /* return class type */ virtual Type type() const; + + void set_n_backup_item_arena(Statement *set, Statement *backup); + inline void restore_backup_item_arena(Statement *backup) + { + set_item_arena(backup); + // reset backup mem_root to avoid its freeing + init_alloc_root(&backup->mem_root, 0, 0); + } + void set_item_arena(Statement *set); }; @@ -688,6 +697,10 @@ public: #ifdef SIGNAL_WITH_VIO_CLOSE Vio* active_vio; #endif + /* + Current prepared Statement if there one, or 0 + */ + Statement *current_statement; /* next_insert_id is set on SET INSERT_ID= #. This is used as the next generated auto_increment value in handler.cc -- cgit v1.2.1