Commit 8a442c4e authored by bell@sanja.is.com.ua's avatar bell@sanja.is.com.ua

after review fix

parent 47fb235e
......@@ -419,7 +419,7 @@ class Item_int :public Item
int save_in_field(Field *field, bool no_conversions);
bool basic_const_item() const { return 1; }
Item *new_item() { return new Item_int(name,value,max_length); }
void cleanup() { fixed= 1; } // to privent drop fixed flag
void cleanup() { fixed= 1; } // to prevent drop fixed flag
void print(String *str);
};
......@@ -908,7 +908,7 @@ class Item_cache: public Item
static Item_cache* get_cache(Item_result type);
table_map used_tables() const { return used_table_map; }
virtual void keep_array() {}
void cleanup() { fixed= 1; } // to privent drop fixed flag
void cleanup() { fixed= 1; } // to prevent drop fixed flag
void print(String *str);
};
......
......@@ -1009,7 +1009,10 @@ class Item_func_match :public Item_real_func
table->fulltext_searched=0;
}
if (concat)
{
delete concat;
concat= 0;
}
DBUG_VOID_RETURN;
}
enum Functype functype() const { return FT_FUNC; }
......
......@@ -57,8 +57,7 @@ void Item_subselect::init(st_select_lex *select_lex,
unit= select_lex->master_unit();
if (select_lex->next_select())
engine= new subselect_union_engine(unit, result,
this);
engine= new subselect_union_engine(unit, result, this);
else
engine= new subselect_single_select_engine(select_lex, result, this);
DBUG_VOID_RETURN;
......
......@@ -1631,14 +1631,6 @@ int open_and_lock_tables(THD *thd, TABLE_LIST *tables)
if (open_tables(thd, tables, &counter) || lock_tables(thd, tables, counter))
DBUG_RETURN(-1); /* purecov: inspected */
fix_tables_pointers(thd->lex->all_selects_list);
/*
open temporary memory pool, which will be closed in
mysql_test_select_fields, mysql_test_upd_fields or
mysql_test_insert_fields
*/
if (thd->current_statement)
thd->ps_setup_prepare_memory();
DBUG_RETURN(mysql_handle_derived(thd->lex));
}
......@@ -2089,6 +2081,11 @@ int setup_wild(THD *thd, TABLE_LIST *tables, List<Item> &fields,
if (!wild_num)
return 0;
Statement *stmt= thd->current_statement, backup;
/*
If we are in preparing prepared statement phase then we have change
temporary mem_root to statement mem root to save changes of SELECT list
*/
if (stmt)
thd->set_n_backup_item_arena(stmt, &backup);
reg2 Item *item;
......
......@@ -621,9 +621,14 @@ static bool mysql_test_insert_fields(Prepared_statement *stmt,
(grant_option && check_grant(thd,privilege,table_list,0,0)))
DBUG_RETURN(1);
#endif
/*
open temporary memory pool for temporary data allocated by derived
tables & preparation procedure
*/
thd->ps_setup_prepare_memory();
if (open_and_lock_tables(thd, table_list))
{
// this memory pool was opened in open_and_lock_tables
thd->ps_setup_free_memory();
DBUG_RETURN(1);
}
......@@ -692,6 +697,12 @@ static bool mysql_test_upd_fields(Prepared_statement *stmt,
(grant_option && check_grant(thd,UPDATE_ACL,table_list,0,0)))
DBUG_RETURN(1);
#endif
/*
open temporary memory pool for temporary data allocated by derived
tables & preparation procedure
*/
thd->ps_setup_prepare_memory();
if (open_and_lock_tables(thd, table_list))
{
// this memory pool was opened in open_and_lock_tables
......@@ -761,13 +772,14 @@ static bool mysql_test_select_fields(Prepared_statement *stmt,
if ((&lex->select_lex != lex->all_selects_list &&
lex->unit.create_total_list(thd, lex, &tables)))
DBUG_RETURN(1);
/*
open temporary memory pool for temporary data allocated by derived
tables & preparation procedure
*/
thd->ps_setup_prepare_memory();
if (open_and_lock_tables(thd, tables))
{
// this memory pool was opened in open_and_lock_tables
thd->ps_setup_free_memory();
DBUG_RETURN(1);
}
goto err;
if (lex->describe)
{
......@@ -985,6 +997,10 @@ bool mysql_stmt_prepare(THD *thd, char *packet, uint packet_length)
thd->current_statement= 0;
DBUG_RETURN(1);
insert_stmt_err:
stmt->set_statement(thd);
thd->set_statement(&thd->stmt_backup);
/* Statement map deletes statement on erase */
thd->stmt_map.erase(stmt);
thd->current_statement= 0;
delete stmt;
DBUG_RETURN(1);
......@@ -1068,7 +1084,7 @@ void mysql_stmt_execute(THD *thd, char *packet)
SELECT_LEX_UNIT *unit= sl->master_unit();
unit->unclean();
unit->types.empty();
// for derived tables & PS (which can't be reset bu Item_subquery)
// for derived tables & PS (which can't be reset by Item_subquery)
unit->reinit_exec_mechanism();
}
}
......
......@@ -8538,7 +8538,7 @@ int main(int argc, char **argv)
test_stmt_close(); /* mysql_stmt_close() test -- hangs */
test_prepare_field_result(); /* prepare meta info */
test_multi_stmt(); /* multi stmt test */
/* test_multi_statements(); *//* test multi statement execution */
test_multi_statements();/* test multi statement execution */
test_store_result(); /* test the store_result */
test_store_result1(); /* test store result without buffers */
test_store_result2(); /* test store result for misc case */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment