diff options
author | Sergei Golubchik <sergii@pisem.net> | 2014-09-23 23:55:29 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2014-09-23 23:55:29 +0200 |
commit | 06d65521923841999c6a9522af924b08476ef2e9 (patch) | |
tree | f26966e0d3aedc3a535ecf69390809b428824e33 /sql | |
parent | a3bd38d66dd144ec42d842fb2655e94238d50496 (diff) | |
parent | 53a44915c53a16f4c52c98227b71f44ae421025c (diff) | |
download | mariadb-git-06d65521923841999c6a9522af924b08476ef2e9.tar.gz |
5.5 merge
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_sum.cc | 26 | ||||
-rw-r--r-- | sql/slave.h | 10 |
2 files changed, 20 insertions, 16 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 62db351150b..087c1235b76 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -3197,19 +3197,13 @@ Item_func_group_concat(Name_resolution_context *context_arg, /* We need to allocate: args - arg_count_field+arg_count_order - (for possible order items in temporare tables) + (for possible order items in temporary tables) order - arg_count_order */ - if (!(args= (Item**) sql_alloc(sizeof(Item*) * arg_count + + if (!(args= (Item**) sql_alloc(sizeof(Item*) * arg_count * 2 + sizeof(ORDER*)*arg_count_order))) return; - if (!(orig_args= (Item **) sql_alloc(sizeof(Item *) * arg_count))) - { - args= NULL; - return; - } - order= (ORDER**)(args + arg_count); /* fill args items of show and sort */ @@ -3230,6 +3224,9 @@ Item_func_group_concat(Name_resolution_context *context_arg, order_item->item= arg_ptr++; } } + + /* orig_args is only used for print() */ + orig_args= (Item**) (order + arg_count_order); memcpy(orig_args, args, sizeof(Item*) * arg_count); } @@ -3313,6 +3310,19 @@ void Item_func_group_concat::cleanup() } DBUG_ASSERT(tree == 0); } + + /* + For prepared statements we have to restore pointers for ORDER BY as + they may point to areas that are freed at cleanup(). + */ + if (!current_thd->stmt_arena->is_conventional() && arg_count_order) + { + memcpy(args + arg_count_field, orig_args + arg_count_field, + sizeof(Item*) * arg_count_order); + + for (uint i= 0 ; i < arg_count_order ; i++) + order[i]->item = args + arg_count_field + i; + } DBUG_VOID_RETURN; } diff --git a/sql/slave.h b/sql/slave.h index 4b5bc1686fb..e65b4a589a1 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -240,25 +240,19 @@ pthread_handler_t handle_slave_sql(void *arg); bool net_request_file(NET* net, const char* fname); extern bool volatile abort_loop; -extern Master_info main_mi, *active_mi; /* active_mi for multi-master */ +extern Master_info *active_mi; /* active_mi for multi-master */ extern Master_info *default_master_info; /* To replace active_mi */ extern Master_info_index *master_info_index; extern LEX_STRING default_master_connection_name; -extern LIST master_list; extern my_bool replicate_same_server_id; extern int disconnect_slave_event_count, abort_slave_event_count ; /* the master variables are defaults read from my.cnf or command line */ -extern uint master_port, master_connect_retry, report_port; -extern char * master_user, *master_password, *master_host; +extern uint report_port; extern char *master_info_file, *report_user; extern char *report_host, *report_password; -extern my_bool master_ssl; -extern char *master_ssl_ca, *master_ssl_capath, *master_ssl_cert; -extern char *master_ssl_cipher, *master_ssl_key; - extern I_List<THD> threads; #else |