diff options
Diffstat (limited to 'sql/table.cc')
-rw-r--r-- | sql/table.cc | 38 |
1 files changed, 8 insertions, 30 deletions
diff --git a/sql/table.cc b/sql/table.cc index b9f0e7596aa..3bf85449f6c 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -50,25 +50,14 @@ #define MYSQL57_GENERATED_FIELD 128 #define MYSQL57_GCOL_HEADER_SIZE 4 -class Table_arena: public Query_arena -{ -public: - Table_arena(MEM_ROOT *mem_root, enum enum_state state_arg) : - Query_arena(mem_root, state_arg){} - virtual Type type() const - { - return TABLE_ARENA; - } -}; - bool TABLE::init_expr_arena(MEM_ROOT *mem_root) { /* We need to use CONVENTIONAL_EXECUTION here to ensure that any new items created by fix_fields() are not reverted. */ - expr_arena= new (alloc_root(mem_root, sizeof(Table_arena))) - Table_arena(mem_root, Query_arena::STMT_CONVENTIONAL_EXECUTION); + expr_arena= new (alloc_root(mem_root, sizeof(Query_arena))) + Query_arena(mem_root, Query_arena::STMT_CONVENTIONAL_EXECUTION); return expr_arena == NULL; } @@ -3659,8 +3648,7 @@ class Vcol_expr_context bool inited; THD *thd; TABLE *table; - LEX *old_lex; - LEX lex; + Query_arena backup_arena; table_map old_map; Security_context *save_security_ctx; sql_mode_t save_sql_mode; @@ -3670,7 +3658,6 @@ public: inited(false), thd(_thd), table(_table), - old_lex(thd->lex), old_map(table->map), save_security_ctx(thd->security_ctx), save_sql_mode(thd->variables.sql_mode) {} @@ -3682,18 +3669,6 @@ public: bool Vcol_expr_context::init() { - /* - As this is vcol expression we must narrow down name resolution to - single table. - */ - if (init_lex_with_single_table(thd, table, &lex)) - { - my_error(ER_OUT_OF_RESOURCES, MYF(0)); - table->map= old_map; - return true; - } - - lex.sql_command= old_lex->sql_command; thd->variables.sql_mode= 0; TABLE_LIST const *tl= table->pos_in_table_list; @@ -3702,6 +3677,8 @@ bool Vcol_expr_context::init() if (table->pos_in_table_list->security_ctx) thd->security_ctx= tl->security_ctx; + thd->set_n_backup_active_arena(table->expr_arena, &backup_arena); + inited= true; return false; } @@ -3710,9 +3687,9 @@ Vcol_expr_context::~Vcol_expr_context() { if (!inited) return; - end_lex_with_single_table(thd, table, old_lex); table->map= old_map; thd->security_ctx= save_security_ctx; + thd->restore_active_arena(table->expr_arena, &backup_arena); thd->variables.sql_mode= save_sql_mode; } @@ -4111,6 +4088,7 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share, outparam->s= share; outparam->db_stat= db_stat; outparam->write_row_record= NULL; + outparam->status= STATUS_NO_RECORD; if (share->incompatible_version && !(ha_open_flags & (HA_OPEN_FOR_ALTER | HA_OPEN_FOR_REPAIR | @@ -6960,7 +6938,7 @@ Item *Field_iterator_view::create_item(THD *thd) Item *create_view_field(THD *thd, TABLE_LIST *view, Item **field_ref, LEX_CSTRING *name) { - bool save_wrapper= thd->lex->first_select_lex()->no_wrap_view_item; + bool save_wrapper= thd->lex->current_select->no_wrap_view_item; Item *field= *field_ref; DBUG_ENTER("create_view_field"); |