diff --git a/include/mysql_com.h b/include/mysql_com.h index c608a2e7724..2293476c76c 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -48,8 +48,8 @@ enum enum_server_command COM_PROCESS_INFO, COM_CONNECT, COM_PROCESS_KILL, COM_DEBUG, COM_PING, COM_TIME, COM_DELAYED_INSERT, COM_CHANGE_USER, COM_BINLOG_DUMP, COM_TABLE_DUMP, COM_CONNECT_OUT, COM_REGISTER_SLAVE, - COM_PREPARE, COM_EXECUTE, COM_LONG_DATA, COM_CLOSE_STMT, - COM_RESET_STMT, COM_SET_OPTION, COM_FETCH, + COM_STMT_PREPARE, COM_STMT_EXECUTE, COM_STMT_SEND_LONG_DATA, COM_STMT_CLOSE, + COM_STMT_RESET, COM_SET_OPTION, COM_STMT_FETCH, /* don't forget to update const char *command_name[] in sql_parse.cc */ /* Must be last */ diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 753657951ee..8ee11519615 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -1736,7 +1736,7 @@ myodbc_remove_escape(MYSQL *mysql,char *name) /******************* Declarations ***********************************/ -/* Default number of rows fetched per one COM_FETCH command. */ +/* Default number of rows fetched per one COM_STMT_FETCH command. */ #define DEFAULT_PREFETCH_ROWS (ulong) 1 @@ -1887,7 +1887,7 @@ void set_stmt_errmsg(MYSQL_STMT * stmt, const char *err, int errcode, } /* - Read and unpack server reply to COM_PREPARE command (sent from + Read and unpack server reply to COM_STMT_PREPARE command (sent from mysql_stmt_prepare). SYNOPSIS @@ -2082,7 +2082,7 @@ mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, ulong length) mysql_use_result it won't be freed in mysql_stmt_free_result and we should get 'Commands out of sync' here. */ - if (simple_command(mysql, COM_CLOSE_STMT, buff, 4, 1)) + if (simple_command(mysql, COM_STMT_CLOSE, buff, 4, 1)) { set_stmt_errmsg(stmt, mysql->net.last_error, mysql->net.last_errno, mysql->net.sqlstate); @@ -2091,7 +2091,7 @@ mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, ulong length) stmt->state= MYSQL_STMT_INIT_DONE; } - if (simple_command(mysql, COM_PREPARE, query, length, 1)) + if (simple_command(mysql, COM_STMT_PREPARE, query, length, 1)) { set_stmt_errmsg(stmt, mysql->net.last_error, mysql->net.last_errno, mysql->net.sqlstate); @@ -2175,7 +2175,7 @@ static unsigned int alloc_stmt_fields(MYSQL_STMT *stmt) /* Update result set columns metadata if it was sent again in - reply to COM_EXECUTE. + reply to COM_STMT_EXECUTE. */ static void update_stmt_fields(MYSQL_STMT *stmt) @@ -2490,7 +2490,7 @@ static my_bool store_param(MYSQL_STMT *stmt, MYSQL_BIND *param) /* - Auxilary function to send COM_EXECUTE packet to server and read reply. + Auxilary function to send COM_STMT_EXECUTE packet to server and read reply. Used from cli_stmt_execute, which is in turn used by mysql_stmt_execute. */ @@ -2507,7 +2507,7 @@ static my_bool execute(MYSQL_STMT *stmt, char *packet, ulong length) int4store(buff, stmt->stmt_id); /* Send stmt id to server */ buff[4]= (char) stmt->flags; int4store(buff+5, 1); /* iteration count */ - if (cli_advanced_command(mysql, COM_EXECUTE, buff, sizeof(buff), + if (cli_advanced_command(mysql, COM_STMT_EXECUTE, buff, sizeof(buff), packet, length, 1) || (*mysql->methods->read_query_result)(mysql)) { @@ -2720,7 +2720,7 @@ stmt_read_row_from_cursor(MYSQL_STMT *stmt, unsigned char **row) /* Send row request to the server */ int4store(buff, stmt->stmt_id); int4store(buff + 4, stmt->prefetch_rows); /* number of rows to fetch */ - if (cli_advanced_command(mysql, COM_FETCH, buff, sizeof(buff), + if (cli_advanced_command(mysql, COM_STMT_FETCH, buff, sizeof(buff), NullS, 0, 1)) { set_stmt_errmsg(stmt, net->last_error, net->last_errno, net->sqlstate); @@ -2910,7 +2910,7 @@ int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt) - if data dictionary changed between prepare and execute, for example a table used in the query was altered. Note, that now (4.1.3) we always send metadata in reply to - COM_EXECUTE (even if it is not necessary), so either this or + COM_STMT_EXECUTE (even if it is not necessary), so either this or previous branch always works. TODO: send metadata only when it's really necessary and add a warning 'Metadata changed' when it's sent twice. @@ -3380,8 +3380,9 @@ mysql_stmt_send_long_data(MYSQL_STMT *stmt, uint param_number, Note that we don't get any ok packet from the server in this case This is intentional to save bandwidth. */ - if ((*mysql->methods->advanced_command)(mysql, COM_LONG_DATA, buff, - sizeof(buff), data, length, 1)) + if ((*mysql->methods->advanced_command)(mysql, COM_STMT_SEND_LONG_DATA, + buff, sizeof(buff), data, + length, 1)) { set_stmt_errmsg(stmt, mysql->net.last_error, mysql->net.last_errno, mysql->net.sqlstate); @@ -4930,7 +4931,7 @@ static my_bool reset_stmt_handle(MYSQL_STMT *stmt, uint flags) */ char buff[MYSQL_STMT_HEADER]; /* packet header: 4 bytes for stmt id */ int4store(buff, stmt->stmt_id); - if ((*mysql->methods->advanced_command)(mysql, COM_RESET_STMT, buff, + if ((*mysql->methods->advanced_command)(mysql, COM_STMT_RESET, buff, sizeof(buff), 0, 0, 0)) { set_stmt_errmsg(stmt, mysql->net.last_error, mysql->net.last_errno, @@ -5004,7 +5005,7 @@ my_bool STDCALL mysql_stmt_close(MYSQL_STMT *stmt) mysql->status= MYSQL_STATUS_READY; } int4store(buff, stmt->stmt_id); - if ((rc= simple_command(mysql, COM_CLOSE_STMT, buff, 4, 1))) + if ((rc= simple_command(mysql, COM_STMT_CLOSE, buff, 4, 1))) { set_stmt_errmsg(stmt, mysql->net.last_error, mysql->net.last_errno, mysql->net.sqlstate); diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index 74a1c8c7922..dd4ba939ebe 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -220,7 +220,7 @@ static int emb_stmt_execute(MYSQL_STMT *stmt) THD *thd= (THD*)stmt->mysql->thd; thd->client_param_count= stmt->param_count; thd->client_params= stmt->params; - if (emb_advanced_command(stmt->mysql, COM_EXECUTE,0,0, + if (emb_advanced_command(stmt->mysql, COM_STMT_EXECUTE,0,0, header, sizeof(header), 1) || emb_mysql_read_query_result(stmt->mysql)) { diff --git a/sql/item.h b/sql/item.h index 820624afd2b..5ff2c726afd 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1481,7 +1481,7 @@ public: str_value.length(), &end_not_used, &err_not_used)); } longlong val_int() - { + { int err; return null_value ? LL(0) : my_strntoll(str_value.charset(),str_value.ptr(),str_value.length(),10, (char**) 0,&err); } @@ -1496,62 +1496,62 @@ public: }; -class Item_buff :public Sql_alloc +class Cached_item :public Sql_alloc { public: my_bool null_value; - Item_buff() :null_value(0) {} + Cached_item() :null_value(0) {} virtual bool cmp(void)=0; - virtual ~Item_buff(); /*line -e1509 */ + virtual ~Cached_item(); /*line -e1509 */ }; -class Item_str_buff :public Item_buff +class Cached_item_str :public Cached_item { Item *item; String value,tmp_value; public: - Item_str_buff(THD *thd, Item *arg); + Cached_item_str(THD *thd, Item *arg); bool cmp(void); - ~Item_str_buff(); // Deallocate String:s + ~Cached_item_str(); // Deallocate String:s }; -class Item_real_buff :public Item_buff +class Cached_item_real :public Cached_item { Item *item; double value; public: - Item_real_buff(Item *item_par) :item(item_par),value(0.0) {} + Cached_item_real(Item *item_par) :item(item_par),value(0.0) {} bool cmp(void); }; -class Item_int_buff :public Item_buff +class Cached_item_int :public Cached_item { Item *item; longlong value; public: - Item_int_buff(Item *item_par) :item(item_par),value(0) {} + Cached_item_int(Item *item_par) :item(item_par),value(0) {} bool cmp(void); }; -class Item_decimal_buff :public Item_buff +class Cached_item_decimal :public Cached_item { Item *item; my_decimal value; public: - Item_decimal_buff(Item *item_par); + Cached_item_decimal(Item *item_par); bool cmp(void); }; -class Item_field_buff :public Item_buff +class Cached_item_field :public Cached_item { char *buff; Field *field; uint length; public: - Item_field_buff(Item_field *item) + Cached_item_field(Item_field *item) { field=item->field; buff= (char*) sql_calloc(length=field->pack_length()); @@ -1573,7 +1573,7 @@ public: void print(String *str); int save_in_field(Field *field_arg, bool no_conversions); table_map used_tables() const { return (table_map)0L; } - + bool walk(Item_processor processor, byte *args) { return arg->walk(processor, args) || @@ -1879,7 +1879,7 @@ void mark_select_range_as_dependent(THD *thd, Field *found_field, Item *found_item, Item_ident *resolved_item); -extern Item_buff *new_Item_buff(THD *thd, Item *item); +extern Cached_item *new_Cached_item(THD *thd, Item *item); extern Item_result item_cmp_type(Item_result a,Item_result b); extern void resolve_const_item(THD *thd, Item **ref, Item *cmp_item); extern bool field_is_equal_to_item(Field *field,Item *item); diff --git a/sql/item_buff.cc b/sql/item_buff.cc index 688e4cca846..a4c42071bb0 100644 --- a/sql/item_buff.cc +++ b/sql/item_buff.cc @@ -20,23 +20,23 @@ #include "mysql_priv.h" /* -** Create right type of item_buffer for an item +** Create right type of Cached_item for an item */ -Item_buff *new_Item_buff(THD *thd, Item *item) +Cached_item *new_Cached_item(THD *thd, Item *item) { if (item->type() == Item::FIELD_ITEM && !(((Item_field *) item)->field->flags & BLOB_FLAG)) - return new Item_field_buff((Item_field *) item); + return new Cached_item_field((Item_field *) item); switch (item->result_type()) { case STRING_RESULT: - return new Item_str_buff(thd, (Item_field *) item); + return new Cached_item_str(thd, (Item_field *) item); case INT_RESULT: - return new Item_int_buff((Item_field *) item); + return new Cached_item_int((Item_field *) item); case REAL_RESULT: - return new Item_real_buff(item); + return new Cached_item_real(item); case DECIMAL_RESULT: - return new Item_decimal_buff(item); + return new Cached_item_decimal(item); case ROW_RESULT: default: DBUG_ASSERT(0); @@ -44,18 +44,18 @@ Item_buff *new_Item_buff(THD *thd, Item *item) } } -Item_buff::~Item_buff() {} +Cached_item::~Cached_item() {} /* ** Compare with old value and replace value with new value ** Return true if values have changed */ -Item_str_buff::Item_str_buff(THD *thd, Item *arg) +Cached_item_str::Cached_item_str(THD *thd, Item *arg) :item(arg), value(min(arg->max_length, thd->variables.max_sort_length)) {} -bool Item_str_buff::cmp(void) +bool Cached_item_str::cmp(void) { String *res; bool tmp; @@ -77,12 +77,12 @@ bool Item_str_buff::cmp(void) return tmp; } -Item_str_buff::~Item_str_buff() +Cached_item_str::~Cached_item_str() { item=0; // Safety } -bool Item_real_buff::cmp(void) +bool Cached_item_real::cmp(void) { double nr= item->val_real(); if (null_value != item->null_value || nr != value) @@ -94,7 +94,7 @@ bool Item_real_buff::cmp(void) return FALSE; } -bool Item_int_buff::cmp(void) +bool Cached_item_int::cmp(void) { longlong nr=item->val_int(); if (null_value != item->null_value || nr != value) @@ -107,7 +107,7 @@ bool Item_int_buff::cmp(void) } -bool Item_field_buff::cmp(void) +bool Cached_item_field::cmp(void) { bool tmp= field->cmp(buff) != 0; // This is not a blob! if (tmp) @@ -121,14 +121,14 @@ bool Item_field_buff::cmp(void) } -Item_decimal_buff::Item_decimal_buff(Item *it) +Cached_item_decimal::Cached_item_decimal(Item *it) :item(it) { my_decimal_set_zero(&value); } -bool Item_decimal_buff::cmp() +bool Cached_item_decimal::cmp() { my_decimal tmp; my_decimal *ptmp= item->val_decimal(&tmp); @@ -147,6 +147,6 @@ bool Item_decimal_buff::cmp() *****************************************************************************/ #ifdef __GNUC__ -template class List; -template class List_iterator; +template class List; +template class List_iterator; #endif diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index eabc89bc429..5a2e14eef2e 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -649,7 +649,7 @@ bool Item_in_optimizer::fix_left(THD *thd, If it is preparation PS only then we do not know values of parameters => cant't get there values and do not need that values. */ - if (!thd->only_prepare()) + if (!thd->current_arena->is_stmt_prepare()) cache->store(args[0]); if (cache->cols() == 1) { diff --git a/sql/item_func.cc b/sql/item_func.cc index 4dc7e55f195..71620a68c34 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -161,7 +161,7 @@ bool Item_func::agg_arg_charsets(DTCollation &coll, } THD *thd= current_thd; - Item_arena *arena, backup; + Query_arena *arena, backup; bool res= FALSE; /* In case we're in statement prepare, create conversion item diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 7a72b78b6f4..393cb87c113 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -340,7 +340,7 @@ Item_singlerow_subselect::select_transformer(JOIN *join) return RES_OK; SELECT_LEX *select_lex= join->select_lex; - Item_arena *arena= thd->current_arena; + Query_arena *arena= thd->current_arena; if (!select_lex->master_unit()->first_select()->next_select() && !select_lex->table_list.elements && @@ -1164,7 +1164,7 @@ Item_in_subselect::select_transformer(JOIN *join) Item_subselect::trans_res Item_in_subselect::select_in_like_transformer(JOIN *join, Comp_creator *func) { - Item_arena *arena, backup; + Query_arena *arena, backup; SELECT_LEX *current= thd->lex->current_select, *up; const char *save_where= thd->where; Item_subselect::trans_res res= RES_ERROR; diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 946b6166458..eff286289f3 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -559,8 +559,6 @@ struct Query_cache_query_flags #define query_cache_invalidate_by_MyISAM_filename_ref NULL #endif /*HAVE_QUERY_CACHE*/ -#define prepare_execute(A) ((A)->command == COM_EXECUTE) - bool mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create, bool silent); bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create); bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent); @@ -842,7 +840,7 @@ bool mysql_stmt_prepare(THD *thd, char *packet, uint packet_length, void mysql_stmt_execute(THD *thd, char *packet, uint packet_length); void mysql_sql_stmt_execute(THD *thd, LEX_STRING *stmt_name); void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length); -void mysql_stmt_free(THD *thd, char *packet); +void mysql_stmt_close(THD *thd, char *packet); void mysql_stmt_reset(THD *thd, char *packet); void mysql_stmt_get_longdata(THD *thd, char *pos, ulong packet_length); void reinit_stmt_before_use(THD *thd, LEX *lex); diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 29898437cfb..ee824085df6 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -310,12 +310,12 @@ sp_head::operator delete(void *ptr, size_t size) sp_head::sp_head() - :Item_arena((bool)FALSE), m_returns_cs(NULL), m_has_return(FALSE), + :Query_arena((bool)FALSE), m_returns_cs(NULL), m_has_return(FALSE), m_simple_case(FALSE), m_multi_results(FALSE), m_in_handler(FALSE) { extern byte * sp_table_key(const byte *ptr, uint *plen, my_bool first); - extern byte + extern byte *sp_lex_sp_key(const byte *ptr, uint *plen, my_bool first); DBUG_ENTER("sp_head::sp_head"); @@ -574,7 +574,7 @@ sp_head::execute(THD *thd) sp_rcontext *ctx; int ret= 0; uint ip= 0; - Item_arena *old_arena; + Query_arena *old_arena; query_id_t old_query_id; TABLE *old_derived_tables; LEX *old_lex; @@ -2312,7 +2312,7 @@ sp_head::add_used_tables_to_table_list(THD *thd, TABLE_LIST ***query_tables_last_ptr) { uint i; - Item_arena *arena, backup; + Query_arena *arena, backup; bool result= FALSE; DBUG_ENTER("sp_head::add_used_tables_to_table_list"); diff --git a/sql/sp_head.h b/sql/sp_head.h index 617d6622037..d22515672f9 100644 --- a/sql/sp_head.h +++ b/sql/sp_head.h @@ -74,7 +74,7 @@ sp_name * sp_name_current_db_new(THD *thd, LEX_STRING name); -class sp_head :private Item_arena +class sp_head :private Query_arena { sp_head(const sp_head &); /* Prevent use of these */ void operator=(sp_head &); diff --git a/sql/sql_base.cc b/sql/sql_base.cc index b466606f845..7fa14557e57 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -3022,7 +3022,7 @@ int setup_wild(THD *thd, TABLE_LIST *tables, List &fields, Item *item; List_iterator it(fields); - Item_arena *arena, backup; + Query_arena *arena, backup; DBUG_ENTER("setup_wild"); /* @@ -3306,7 +3306,7 @@ bool get_key_map_from_key_list(key_map *map, TABLE *table, any_privileges 0 If we should ensure that we have SELECT privileges for all columns 1 If any privilege is ok - allocate_view_names if true view names will be copied to current Item_arena + allocate_view_names if true view names will be copied to current Query_arena memory (made for SP/PS) RETURN 0 ok @@ -3566,7 +3566,7 @@ err: int setup_conds(THD *thd, TABLE_LIST *tables, TABLE_LIST *leaves, COND **conds) { SELECT_LEX *select_lex= thd->lex->current_select; - Item_arena *arena= thd->current_arena, backup; + Query_arena *arena= thd->current_arena, backup; bool save_wrapper= thd->lex->current_select->no_wrap_view_item; TABLE_LIST *table= NULL; // For HP compilers DBUG_ENTER("setup_conds"); diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 165ce61d5d1..299011d8821 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1478,14 +1478,14 @@ void select_dumpvar::cleanup() Create arena for already constructed THD. SYNOPSYS - Item_arena() + Query_arena() thd - thread for which arena is created DESCRIPTION Create arena for already existing THD using its variables as parameters for memory root initialization. */ -Item_arena::Item_arena(THD* thd) +Query_arena::Query_arena(THD* thd) :free_list(0), mem_root(&main_mem_root), state(INITIALIZED) { @@ -1499,7 +1499,7 @@ Item_arena::Item_arena(THD* thd) Create arena and optionally initialize memory root. SYNOPSYS - Item_arena() + Query_arena() init_mem_root - whenever we need to initialize memory root DESCRIPTION @@ -1511,7 +1511,7 @@ Item_arena::Item_arena(THD* thd) its memory root in THD::init_for_queries() before execution of real statements. */ -Item_arena::Item_arena(bool init_mem_root) +Query_arena::Query_arena(bool init_mem_root) :free_list(0), mem_root(&main_mem_root), state(CONVENTIONAL_EXECUTION) { @@ -1520,7 +1520,7 @@ Item_arena::Item_arena(bool init_mem_root) } -Item_arena::Type Item_arena::type() const +Query_arena::Type Query_arena::type() const { DBUG_ASSERT(0); /* Should never be called */ return STATEMENT; @@ -1532,7 +1532,7 @@ Item_arena::Type Item_arena::type() const */ Statement::Statement(THD *thd) - :Item_arena(thd), + :Query_arena(thd), id(++thd->statement_id_counter), set_query_id(1), allow_sum_func(0), @@ -1551,7 +1551,7 @@ Statement::Statement(THD *thd) */ Statement::Statement() - :Item_arena((bool)TRUE), + :Query_arena((bool)TRUE), id(0), set_query_id(1), allow_sum_func(0), /* initialized later */ @@ -1563,7 +1563,7 @@ Statement::Statement() } -Item_arena::Type Statement::type() const +Query_arena::Type Statement::type() const { return STATEMENT; } @@ -1611,9 +1611,9 @@ void THD::end_statement() } -void Item_arena::set_n_backup_item_arena(Item_arena *set, Item_arena *backup) +void Query_arena::set_n_backup_item_arena(Query_arena *set, Query_arena *backup) { - DBUG_ENTER("Item_arena::set_n_backup_item_arena"); + DBUG_ENTER("Query_arena::set_n_backup_item_arena"); DBUG_ASSERT(backup_arena == 0); backup->set_item_arena(this); set_item_arena(set); @@ -1624,9 +1624,9 @@ void Item_arena::set_n_backup_item_arena(Item_arena *set, Item_arena *backup) } -void Item_arena::restore_backup_item_arena(Item_arena *set, Item_arena *backup) +void Query_arena::restore_backup_item_arena(Query_arena *set, Query_arena *backup) { - DBUG_ENTER("Item_arena::restore_backup_item_arena"); + DBUG_ENTER("Query_arena::restore_backup_item_arena"); set->set_item_arena(this); set_item_arena(backup); #ifndef DBUG_OFF @@ -1635,7 +1635,7 @@ void Item_arena::restore_backup_item_arena(Item_arena *set, Item_arena *backup) #ifdef NOT_NEEDED_NOW /* Reset backup mem_root to avoid its freeing. - Since Item_arena's mem_root is freed only when it is part of Statement + Since Query_arena's mem_root is freed only when it is part of Statement we need this only if we use some Statement's arena as backup storage. But we do this only with THD::stmt_backup and this Statement is specially handled in this respect. So this code is not really needed now. @@ -1645,7 +1645,7 @@ void Item_arena::restore_backup_item_arena(Item_arena *set, Item_arena *backup) DBUG_VOID_RETURN; } -void Item_arena::set_item_arena(Item_arena *set) +void Query_arena::set_item_arena(Query_arena *set) { mem_root= set->mem_root; free_list= set->free_list; diff --git a/sql/sql_class.h b/sql/sql_class.h index af799ce403f..bcd482c728e 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -654,7 +654,7 @@ typedef struct system_status_var void free_tmp_table(THD *thd, TABLE *entry); -class Item_arena +class Query_arena { public: /* @@ -667,12 +667,12 @@ public: #ifndef DBUG_OFF bool backup_arena; #endif - enum enum_state + enum enum_state { INITIALIZED= 0, INITIALIZED_FOR_SP= 1, PREPARED= 2, CONVENTIONAL_EXECUTION= 3, EXECUTED= 4, ERROR= -1 }; - + enum_state state; /* We build without RTTI, so dynamic_cast can't be used. */ @@ -682,22 +682,22 @@ public: }; /* - This constructor is used only when Item_arena is created as - backup storage for another instance of Item_arena. + This constructor is used only when Query_arena is created as + backup storage for another instance of Query_arena. */ - Item_arena() {}; + Query_arena() {}; /* Create arena for already constructed THD using its variables as parameters for memory root initialization. */ - Item_arena(THD *thd); + Query_arena(THD *thd); /* Create arena and optionally init memory root with minimal values. - Particularly used if Item_arena is part of Statement. + Particularly used if Query_arena is part of Statement. */ - Item_arena(bool init_mem_root); + Query_arena(bool init_mem_root); virtual Type type() const; - virtual ~Item_arena() {}; + virtual ~Query_arena() {}; inline bool is_stmt_prepare() const { return state == INITIALIZED; } inline bool is_stmt_prepare_or_first_sp_execute() const @@ -729,9 +729,9 @@ public: return ptr; } - void set_n_backup_item_arena(Item_arena *set, Item_arena *backup); - void restore_backup_item_arena(Item_arena *set, Item_arena *backup); - void set_item_arena(Item_arena *set); + void set_n_backup_item_arena(Query_arena *set, Query_arena *backup); + void restore_backup_item_arena(Query_arena *set, Query_arena *backup); + void set_item_arena(Query_arena *set); }; @@ -751,7 +751,7 @@ class Cursor; be used explicitly. */ -class Statement: public Item_arena +class Statement: public Query_arena { Statement(const Statement &rhs); /* not implemented: */ Statement &operator=(const Statement &rhs); /* non-copyable */ @@ -1054,7 +1054,7 @@ public: #endif struct st_my_thread_var *mysys_var; /* - Type of current query: COM_PREPARE, COM_QUERY, etc. Set from + Type of current query: COM_STMT_PREPARE, COM_QUERY, etc. Set from first byte of the packet in do_command() */ enum enum_server_command command; @@ -1122,9 +1122,9 @@ public: Item_change_list change_list; /* - Current prepared Item_arena if there one, or 0 + Current prepared Query_arena if there one, or 0 */ - Item_arena *current_arena; + Query_arena *current_arena; /* next_insert_id is set on SET INSERT_ID= #. This is used as the next generated auto_increment value in handler.cc @@ -1346,13 +1346,9 @@ public: return 0; #endif } - inline bool only_prepare() - { - return command == COM_PREPARE; - } inline bool fill_derived_tables() { - return !only_prepare() && !lex->only_view_structure(); + return !current_arena->is_stmt_prepare() && !lex->only_view_structure(); } inline gptr trans_alloc(unsigned int size) { @@ -1385,13 +1381,13 @@ public: inline void fatal_error() { is_fatal_error= 1; - net.report_error= 1; + net.report_error= 1; DBUG_PRINT("error",("Fatal error set")); } inline CHARSET_INFO *charset() { return variables.character_set_client; } void update_charset(); - inline Item_arena *change_arena_if_needed(Item_arena *backup) + inline Query_arena *change_arena_if_needed(Query_arena *backup) { /* use new arena if we are in a prepared statements and we have not diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 1270aab18ae..08f0c3badf7 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -967,7 +967,7 @@ int yylex(void *arg, void *yythd) { THD* thd= (THD*)yythd; if ((thd->client_capabilities & CLIENT_MULTI_STATEMENTS) && - (thd->command != COM_PREPARE)) + (thd->command != COM_STMT_PREPARE)) { lex->safe_to_cache_query= 0; lex->found_semicolon=(char*) lex->ptr; @@ -1484,8 +1484,8 @@ bool st_select_lex::setup_ref_array(THD *thd, uint order_group_num) We have to create array in prepared statement memory if it is prepared statement */ - Item_arena *arena= thd->current_arena; - return (ref_pointer_array= + Query_arena *arena= thd->current_arena; + return (ref_pointer_array= (Item **)arena->alloc(sizeof(Item*) * (item_list.elements + select_n_having_items + diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 96d111d6329..788d12cb898 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1638,32 +1638,32 @@ bool dispatch_command(enum enum_server_command command, THD *thd, } break; } - case COM_EXECUTE: + case COM_STMT_EXECUTE: { mysql_stmt_execute(thd, packet, packet_length); break; } - case COM_FETCH: + case COM_STMT_FETCH: { mysql_stmt_fetch(thd, packet, packet_length); break; } - case COM_LONG_DATA: + case COM_STMT_SEND_LONG_DATA: { mysql_stmt_get_longdata(thd, packet, packet_length); break; } - case COM_PREPARE: + case COM_STMT_PREPARE: { mysql_stmt_prepare(thd, packet, packet_length, 0); break; } - case COM_CLOSE_STMT: + case COM_STMT_CLOSE: { - mysql_stmt_free(thd, packet); + mysql_stmt_close(thd, packet); break; } - case COM_RESET_STMT: + case COM_STMT_RESET: { mysql_stmt_reset(thd, packet); break; @@ -2203,7 +2203,7 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident, /* Read query from packet and store in thd->query - Used in COM_QUERY and COM_PREPARE + Used in COM_QUERY and COM_STMT_PREPARE DESCRIPTION Sets the following THD variables: @@ -2505,7 +2505,7 @@ mysql_execute_command(THD *thd) lex->prepared_stmt_name.str, query_len, query_str)); } - thd->command= COM_PREPARE; + thd->command= COM_STMT_PREPARE; if (!(res= mysql_stmt_prepare(thd, query_str, query_len + 1, &lex->prepared_stmt_name))) send_ok(thd, 0L, 0L, "Statement prepared"); diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 7af881790eb..57deec91e8a 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -19,9 +19,9 @@ This file contains the implementation of prepare and executes. Prepare: - - Server gets the query from client with command 'COM_PREPARE'; + - Server gets the query from client with command 'COM_STMT_PREPARE'; in the following format: - [COM_PREPARE:1] [query] + [COM_STMT_PREPARE:1] [query] - Parse the query and recognize any parameter markers '?' and store its information list in lex->param_list - Allocate a new statement for this prepare; and keep this in @@ -37,10 +37,10 @@ Prepare: Prepare-execute: - - Server gets the command 'COM_EXECUTE' to execute the + - Server gets the command 'COM_STMT_EXECUTE' to execute the previously prepared query. If there is any param markers; then client will send the data in the following format: - [COM_EXECUTE:1] + [COM_STMT_EXECUTE:1] [STMT_ID:4] [NULL_BITS:(param_count+7)/8)] [TYPES_SUPPLIED_BY_CLIENT(0/1):1] @@ -55,9 +55,10 @@ Prepare-execute: Long data handling: - - Server gets the long data in pieces with command type 'COM_LONG_DATA'. + - Server gets the long data in pieces with command type + 'COM_STMT_SEND_LONG_DATA'. - The packet recieved will have the format as: - [COM_LONG_DATA:1][STMT_ID:4][parameter_number:2][data] + [COM_STMT_SEND_LONG_DATA:1][STMT_ID:4][parameter_number:2][data] - data from the packet is appended to long data value buffer for this placeholder. - It's up to the client to check for read data ended. The server doesn't @@ -104,7 +105,7 @@ public: Prepared_statement(THD *thd_arg); virtual ~Prepared_statement(); void setup_set_params(); - virtual Item_arena::Type type() const; + virtual Query_arena::Type type() const; }; static void execute_stmt(THD *thd, Prepared_statement *stmt, @@ -132,7 +133,7 @@ find_prepared_statement(THD *thd, ulong id, const char *where) { Statement *stmt= thd->stmt_map.find(id); - if (stmt == 0 || stmt->type() != Item_arena::PREPARED_STATEMENT) + if (stmt == 0 || stmt->type() != Query_arena::PREPARED_STATEMENT) { char llbuf[22]; my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), sizeof(llbuf), llstr(id, llbuf), @@ -1798,7 +1799,7 @@ bool mysql_stmt_prepare(THD *thd, char *packet, uint packet_length, { stmt->setup_set_params(); init_stmt_after_parse(thd, stmt->lex); - stmt->state= Item_arena::PREPARED; + stmt->state= Query_arena::PREPARED; } DBUG_RETURN(!stmt); } @@ -1969,7 +1970,7 @@ void mysql_stmt_execute(THD *thd, char *packet, uint packet_length) DBUG_PRINT("exec_query:", ("%s", stmt->query)); /* Check if we got an error when sending long data */ - if (stmt->state == Item_arena::ERROR) + if (stmt->state == Query_arena::ERROR) { my_message(stmt->last_errno, stmt->last_error, MYF(0)); DBUG_VOID_RETURN; @@ -2117,7 +2118,7 @@ void mysql_sql_stmt_execute(THD *thd, LEX_STRING *stmt_name) { my_error(ER_WRONG_ARGUMENTS, MYF(0), "EXECUTE"); } - thd->command= COM_EXECUTE; /* For nice messages in general log */ + thd->command= COM_STMT_EXECUTE; /* For nice messages in general log */ execute_stmt(thd, stmt, &expanded_query); DBUG_VOID_RETURN; } @@ -2178,14 +2179,14 @@ static void execute_stmt(THD *thd, Prepared_statement *stmt, thd->set_statement(&thd->stmt_backup); thd->current_arena= thd; - if (stmt->state == Item_arena::PREPARED) - stmt->state= Item_arena::EXECUTED; + if (stmt->state == Query_arena::PREPARED) + stmt->state= Query_arena::EXECUTED; DBUG_VOID_RETURN; } /* - COM_FETCH handler: fetches requested amount of rows from cursor + COM_STMT_FETCH handler: fetches requested amount of rows from cursor SYNOPSIS mysql_stmt_fetch() @@ -2270,7 +2271,7 @@ void mysql_stmt_reset(THD *thd, char *packet) if (stmt->cursor && stmt->cursor->is_open()) stmt->cursor->close(); - stmt->state= Item_arena::PREPARED; + stmt->state= Query_arena::PREPARED; /* Clear parameters from data which could be set by @@ -2290,13 +2291,13 @@ void mysql_stmt_reset(THD *thd, char *packet) Note: we don't send any reply to that command. */ -void mysql_stmt_free(THD *thd, char *packet) +void mysql_stmt_close(THD *thd, char *packet) { /* There is always space for 4 bytes in packet buffer */ ulong stmt_id= uint4korr(packet); Prepared_statement *stmt; - DBUG_ENTER("mysql_stmt_free"); + DBUG_ENTER("mysql_stmt_close"); statistic_increment(thd->status_var.com_stmt_close, &LOCK_status); if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_close"))) @@ -2360,7 +2361,7 @@ void mysql_stmt_get_longdata(THD *thd, char *packet, ulong packet_length) if (param_number >= stmt->param_count) { /* Error will be sent in execute call */ - stmt->state= Item_arena::ERROR; + stmt->state= Query_arena::ERROR; stmt->last_errno= ER_WRONG_ARGUMENTS; sprintf(stmt->last_error, ER(ER_WRONG_ARGUMENTS), "mysql_stmt_send_long_data"); @@ -2376,7 +2377,7 @@ void mysql_stmt_get_longdata(THD *thd, char *packet, ulong packet_length) if (param->set_longdata(thd->extra_data, thd->extra_length)) #endif { - stmt->state= Item_arena::ERROR; + stmt->state= Query_arena::ERROR; stmt->last_errno= ER_OUTOFMEMORY; sprintf(stmt->last_error, ER(ER_OUTOFMEMORY), 0); } @@ -2429,7 +2430,7 @@ Prepared_statement::~Prepared_statement() } -Item_arena::Type Prepared_statement::type() const +Query_arena::Type Prepared_statement::type() const { return PREPARED_STATEMENT; } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 8c5e96241ac..775db828c51 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -138,7 +138,7 @@ end_unique_update(JOIN *join, JOIN_TAB *join_tab, bool end_of_records); static enum_nested_loop_state end_write_group(JOIN *join, JOIN_TAB *join_tab, bool end_of_records); -static int test_if_group_changed(List &list); +static int test_if_group_changed(List &list); static int join_read_const_table(JOIN_TAB *tab, POSITION *pos); static int join_read_system(JOIN_TAB *tab); static int join_read_const(JOIN_TAB *tab); @@ -582,7 +582,7 @@ JOIN::optimize() MEMROOT for prepared statements and stored procedures. */ - Item_arena *arena= thd->current_arena, backup; + Query_arena *arena= thd->current_arena, backup; if (arena->is_conventional()) arena= 0; // For easier test else @@ -12312,7 +12312,7 @@ alloc_group_fields(JOIN *join,ORDER *group) { for (; group ; group=group->next) { - Item_buff *tmp=new_Item_buff(join->thd, *group->item); + Cached_item *tmp=new_Cached_item(join->thd, *group->item); if (!tmp || join->group_fields.push_front(tmp)) return TRUE; } @@ -12323,12 +12323,12 @@ alloc_group_fields(JOIN *join,ORDER *group) static int -test_if_group_changed(List &list) +test_if_group_changed(List &list) { DBUG_ENTER("test_if_group_changed"); - List_iterator li(list); + List_iterator li(list); int idx= -1,i; - Item_buff *buff; + Cached_item *buff; for (i=(int) list.elements-1 ; (buff=li++) ; i--) { diff --git a/sql/sql_select.h b/sql/sql_select.h index 5351bbb13d3..5bec06fa36c 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -178,7 +178,7 @@ class JOIN :public Sql_alloc table_map const_table_map,found_const_table_map,outer_join; ha_rows send_records,found_records,examined_rows,row_limit, select_limit; /* - Used to fetch no more than given amount of rows per one + Used to fetch no more than given amount of rows per one fetch operation of server side cursor. The value is checked in end_send and end_send_group in fashion, similar to offset_limit_cnt: @@ -190,7 +190,7 @@ class JOIN :public Sql_alloc POSITION positions[MAX_TABLES+1],best_positions[MAX_TABLES+1]; double best_read; List *fields; - List group_fields, group_fields_cache; + List group_fields, group_fields_cache; TABLE *tmp_table; // used to store 2 possible tmp table of SELECT TABLE *exec_tmp_table1, *exec_tmp_table2; @@ -370,7 +370,7 @@ class JOIN :public Sql_alloc statement for many cursors. */ -class Cursor: public Sql_alloc, public Item_arena +class Cursor: public Sql_alloc, public Query_arena { JOIN *join; SELECT_LEX_UNIT *unit; @@ -396,7 +396,7 @@ public: void close(); void set_unit(SELECT_LEX_UNIT *unit_arg) { unit= unit_arg; } - Cursor() :Item_arena(TRUE), join(0), unit(0) {} + Cursor() :Query_arena(TRUE), join(0), unit(0) {} ~Cursor(); }; diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 912636b6cf3..f59d7fffe85 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -274,7 +274,7 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result, all collations together for UNION. */ List_iterator_fast tp(types); - Item_arena *arena= thd->current_arena; + Query_arena *arena= thd->current_arena; Item *type; while ((type= tp++)) @@ -308,7 +308,7 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result, if (!item_list.elements) { Field **field; - Item_arena *tmp_arena,backup; + Query_arena *tmp_arena,backup; tmp_arena= thd->change_arena_if_needed(&backup); for (field= table->field; *field; field++) diff --git a/sql/sql_view.cc b/sql/sql_view.cc index 9f0c3260d8f..5152619fd85 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -579,7 +579,7 @@ mysql_make_view(File_parser *parser, TABLE_LIST *table) For now we assume that tables will not be changed during PS life (it will be TRUE as far as we make new table cache). */ - Item_arena *arena= thd->current_arena, backup; + Query_arena *arena= thd->current_arena, backup; if (arena->is_conventional()) arena= 0; else diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 62ba61961a8..6a33ba6ae48 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -52,7 +52,7 @@ const LEX_STRING null_lex_str={0,0}; ER_WARN_DEPRECATED_SYNTAX, \ ER(ER_WARN_DEPRECATED_SYNTAX), (A), (B)); -#define TEST_ASSERT(A) \ +#define YYERROR_UNLESS(A) \ if (!(A)) \ { \ yyerror(ER(ER_SYNTAX_ERROR)); \ @@ -914,7 +914,7 @@ deallocate: { THD *thd=YYTHD; LEX *lex= thd->lex; - if (thd->command == COM_PREPARE) + if (thd->command == COM_STMT_PREPARE) { yyerror(ER(ER_SYNTAX_ERROR)); YYABORT; @@ -939,7 +939,7 @@ prepare: { THD *thd=YYTHD; LEX *lex= thd->lex; - if (thd->command == COM_PREPARE) + if (thd->command == COM_STMT_PREPARE) { yyerror(ER(ER_SYNTAX_ERROR)); YYABORT; @@ -974,7 +974,7 @@ execute: { THD *thd=YYTHD; LEX *lex= thd->lex; - if (thd->command == COM_PREPARE) + if (thd->command == COM_STMT_PREPARE) { yyerror(ER(ER_SYNTAX_ERROR)); YYABORT; @@ -5094,7 +5094,7 @@ table_ref: ; join_table_list: - derived_table_list { TEST_ASSERT($$=$1); } + derived_table_list { YYERROR_UNLESS($$=$1); } ; /* Warning - may return NULL in case of incomplete SELECT */ @@ -5102,41 +5102,41 @@ derived_table_list: table_ref { $$=$1; } | derived_table_list ',' table_ref { - TEST_ASSERT($1 && ($$=$3)); + YYERROR_UNLESS($1 && ($$=$3)); } ; join_table: - table_ref normal_join table_ref { TEST_ASSERT($1 && ($$=$3)); } + table_ref normal_join table_ref { YYERROR_UNLESS($1 && ($$=$3)); } | table_ref STRAIGHT_JOIN table_factor - { TEST_ASSERT($1 && ($$=$3)); $3->straight=1; } + { YYERROR_UNLESS($1 && ($$=$3)); $3->straight=1; } | table_ref normal_join table_ref ON expr - { TEST_ASSERT($1 && ($$=$3)); add_join_on($3,$5); } + { YYERROR_UNLESS($1 && ($$=$3)); add_join_on($3,$5); } | table_ref STRAIGHT_JOIN table_factor ON expr - { TEST_ASSERT($1 && ($$=$3)); $3->straight=1; add_join_on($3,$5); } + { YYERROR_UNLESS($1 && ($$=$3)); $3->straight=1; add_join_on($3,$5); } | table_ref normal_join table_ref USING { SELECT_LEX *sel= Select; - TEST_ASSERT($1 && $3); + YYERROR_UNLESS($1 && $3); sel->save_names_for_using_list($1, $3); } '(' using_list ')' { add_join_on($3,$7); $$=$3; } | table_ref LEFT opt_outer JOIN_SYM table_ref ON expr - { TEST_ASSERT($1 && $5); add_join_on($5,$7); $5->outer_join|=JOIN_TYPE_LEFT; $$=$5; } + { YYERROR_UNLESS($1 && $5); add_join_on($5,$7); $5->outer_join|=JOIN_TYPE_LEFT; $$=$5; } | table_ref LEFT opt_outer JOIN_SYM table_factor { SELECT_LEX *sel= Select; - TEST_ASSERT($1 && $5); + YYERROR_UNLESS($1 && $5); sel->save_names_for_using_list($1, $5); } USING '(' using_list ')' { add_join_on($5,$9); $5->outer_join|=JOIN_TYPE_LEFT; $$=$5; } | table_ref NATURAL LEFT opt_outer JOIN_SYM table_factor { - TEST_ASSERT($1 && $6); + YYERROR_UNLESS($1 && $6); add_join_natural($1,$6); $6->outer_join|=JOIN_TYPE_LEFT; $$=$6; @@ -5144,7 +5144,7 @@ join_table: | table_ref RIGHT opt_outer JOIN_SYM table_ref ON expr { LEX *lex= Lex; - TEST_ASSERT($1 && $5); + YYERROR_UNLESS($1 && $5); if (!($$= lex->current_select->convert_right_join())) YYABORT; add_join_on($$, $7); @@ -5152,7 +5152,7 @@ join_table: | table_ref RIGHT opt_outer JOIN_SYM table_factor { SELECT_LEX *sel= Select; - TEST_ASSERT($1 && $5); + YYERROR_UNLESS($1 && $5); sel->save_names_for_using_list($1, $5); } USING '(' using_list ')' @@ -5164,14 +5164,14 @@ join_table: } | table_ref NATURAL RIGHT opt_outer JOIN_SYM table_factor { - TEST_ASSERT($1 && $6); + YYERROR_UNLESS($1 && $6); add_join_natural($6,$1); LEX *lex= Lex; if (!($$= lex->current_select->convert_right_join())) YYABORT; } | table_ref NATURAL JOIN_SYM table_factor - { TEST_ASSERT($1 && ($$=$4)); add_join_natural($1,$4); }; + { YYERROR_UNLESS($1 && ($$=$4)); add_join_natural($1,$4); }; normal_join: @@ -5200,7 +5200,7 @@ table_factor: sel->add_joined_table($$); } | '{' ident table_ref LEFT OUTER JOIN_SYM table_ref ON expr '}' - { TEST_ASSERT($3 && $7); add_join_on($7,$9); $7->outer_join|=JOIN_TYPE_LEFT; $$=$7; } + { YYERROR_UNLESS($3 && $7); add_join_on($7,$9); $7->outer_join|=JOIN_TYPE_LEFT; $$=$7; } | select_derived_init get_select_lex select_derived2 { LEX *lex= Lex; @@ -6902,7 +6902,7 @@ param_marker: { THD *thd=YYTHD; LEX *lex= thd->lex; - if (thd->command == COM_PREPARE) + if (thd->command == COM_STMT_PREPARE) { Item_param *item= new Item_param((uint) (lex->tok_start - (uchar *) thd->query)); @@ -8731,21 +8731,21 @@ xa: XA_SYM begin_or_start xid opt_join_or_resume xid: text_string { - TEST_ASSERT($1->length() <= MAXGTRIDSIZE); + YYERROR_UNLESS($1->length() <= MAXGTRIDSIZE); if (!(Lex->xid=(XID *)YYTHD->alloc(sizeof(XID)))) YYABORT; Lex->xid->set(1L, $1->ptr(), $1->length(), 0, 0); } | text_string ',' text_string { - TEST_ASSERT($1->length() <= MAXGTRIDSIZE && $3->length() <= MAXBQUALSIZE); + YYERROR_UNLESS($1->length() <= MAXGTRIDSIZE && $3->length() <= MAXBQUALSIZE); if (!(Lex->xid=(XID *)YYTHD->alloc(sizeof(XID)))) YYABORT; Lex->xid->set(1L, $1->ptr(), $1->length(), $3->ptr(), $3->length()); } | text_string ',' text_string ',' ulong_num { - TEST_ASSERT($1->length() <= MAXGTRIDSIZE && $3->length() <= MAXBQUALSIZE); + YYERROR_UNLESS($1->length() <= MAXGTRIDSIZE && $3->length() <= MAXBQUALSIZE); if (!(Lex->xid=(XID *)YYTHD->alloc(sizeof(XID)))) YYABORT; Lex->xid->set($5, $1->ptr(), $1->length(), $3->ptr(), $3->length()); diff --git a/sql/table.cc b/sql/table.cc index 234fdbf5ef3..c065538f9ca 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1929,7 +1929,7 @@ bool st_table_list::setup_ancestor(THD *thd, Item **conds, (check_opt_type == VIEW_CHECK_CASCADED && ancestor->check_option)) { - Item_arena *arena= thd->current_arena, backup; + Query_arena *arena= thd->current_arena, backup; TABLE_LIST *tbl= this; if (arena->is_conventional()) arena= 0; // For easier test @@ -2019,7 +2019,7 @@ bool st_table_list::setup_ancestor(THD *thd, Item **conds, /* full text function moving to current select */ if (view->select_lex.ftfunc_list->elements) { - Item_arena *arena= thd->current_arena, backup; + Query_arena *arena= thd->current_arena, backup; if (arena->is_conventional()) arena= 0; // For easier test else diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 7a683659df6..1cde3a1e978 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -13040,7 +13040,7 @@ static void test_bug9478() int4store(buff, stmt->stmt_id); buff[4]= 0; /* Flag */ int4store(buff+5, 1); /* Return 1 row */ - rc= ((*mysql->methods->advanced_command)(mysql, COM_EXECUTE, buff, + rc= ((*mysql->methods->advanced_command)(mysql, COM_STMT_EXECUTE, buff, sizeof(buff), 0,0,1) || (*mysql->methods->read_query_result)(mysql)); DIE_UNLESS(rc);