MDEV-8716 - Obsolete sql_calloc() in favor of THD::calloc() and thd_calloc()
This commit is contained in:
parent
0746a07708
commit
753d1f868c
@ -25,7 +25,6 @@
|
|||||||
#include "sql_priv.h" /* STRING_BUFFER_USUAL_SIZE */
|
#include "sql_priv.h" /* STRING_BUFFER_USUAL_SIZE */
|
||||||
#include "unireg.h"
|
#include "unireg.h"
|
||||||
#include "sql_const.h" /* RAND_TABLE_BIT, MAX_FIELD_NAME */
|
#include "sql_const.h" /* RAND_TABLE_BIT, MAX_FIELD_NAME */
|
||||||
#include "thr_malloc.h" /* sql_calloc */
|
|
||||||
#include "field.h" /* Derivation */
|
#include "field.h" /* Derivation */
|
||||||
#include "sql_type.h"
|
#include "sql_type.h"
|
||||||
|
|
||||||
@ -4790,11 +4789,11 @@ class Cached_item_field :public Cached_item
|
|||||||
uint length;
|
uint length;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Cached_item_field(Field *arg_field) : field(arg_field)
|
Cached_item_field(THD *thd, Field *arg_field): field(arg_field)
|
||||||
{
|
{
|
||||||
field= arg_field;
|
field= arg_field;
|
||||||
/* TODO: take the memory allocation below out of the constructor. */
|
/* TODO: take the memory allocation below out of the constructor. */
|
||||||
buff= (uchar*) sql_calloc(length=field->pack_length());
|
buff= (uchar*) thd_calloc(thd, length= field->pack_length());
|
||||||
}
|
}
|
||||||
bool cmp(void);
|
bool cmp(void);
|
||||||
};
|
};
|
||||||
|
@ -43,7 +43,7 @@ Cached_item *new_Cached_item(THD *thd, Item *item, bool pass_through_ref)
|
|||||||
{
|
{
|
||||||
Item_field *real_item= (Item_field *) item->real_item();
|
Item_field *real_item= (Item_field *) item->real_item();
|
||||||
Field *cached_field= real_item->field;
|
Field *cached_field= real_item->field;
|
||||||
return new Cached_item_field(cached_field);
|
return new (thd->mem_root) Cached_item_field(thd, cached_field);
|
||||||
}
|
}
|
||||||
switch (item->result_type()) {
|
switch (item->result_type()) {
|
||||||
case STRING_RESULT:
|
case STRING_RESULT:
|
||||||
|
@ -3452,8 +3452,9 @@ int in_vector::find(Item *item)
|
|||||||
return (int) ((*compare)(collation, base+start*size, result) == 0);
|
return (int) ((*compare)(collation, base+start*size, result) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
in_string::in_string(uint elements,qsort2_cmp cmp_func, CHARSET_INFO *cs)
|
in_string::in_string(THD *thd, uint elements, qsort2_cmp cmp_func,
|
||||||
:in_vector(elements, sizeof(String), cmp_func, cs),
|
CHARSET_INFO *cs)
|
||||||
|
:in_vector(thd, elements, sizeof(String), cmp_func, cs),
|
||||||
tmp(buff, sizeof(buff), &my_charset_bin)
|
tmp(buff, sizeof(buff), &my_charset_bin)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -3536,8 +3537,9 @@ void in_row::set(uint pos, Item *item)
|
|||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
in_longlong::in_longlong(uint elements)
|
in_longlong::in_longlong(THD *thd, uint elements)
|
||||||
:in_vector(elements,sizeof(packed_longlong),(qsort2_cmp) cmp_longlong, 0)
|
:in_vector(thd, elements, sizeof(packed_longlong),
|
||||||
|
(qsort2_cmp) cmp_longlong, 0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void in_longlong::set(uint pos,Item *item)
|
void in_longlong::set(uint pos,Item *item)
|
||||||
@ -3594,8 +3596,8 @@ Item *in_datetime::create_item(THD *thd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
in_double::in_double(uint elements)
|
in_double::in_double(THD *thd, uint elements)
|
||||||
:in_vector(elements,sizeof(double),(qsort2_cmp) cmp_double, 0)
|
:in_vector(thd, elements, sizeof(double), (qsort2_cmp) cmp_double, 0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void in_double::set(uint pos,Item *item)
|
void in_double::set(uint pos,Item *item)
|
||||||
@ -3617,8 +3619,8 @@ Item *in_double::create_item(THD *thd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
in_decimal::in_decimal(uint elements)
|
in_decimal::in_decimal(THD *thd, uint elements)
|
||||||
:in_vector(elements, sizeof(my_decimal),(qsort2_cmp) cmp_decimal, 0)
|
:in_vector(thd, elements, sizeof(my_decimal), (qsort2_cmp) cmp_decimal, 0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -4063,14 +4065,15 @@ void Item_func_in::fix_length_and_dec()
|
|||||||
}
|
}
|
||||||
switch (m_compare_type) {
|
switch (m_compare_type) {
|
||||||
case STRING_RESULT:
|
case STRING_RESULT:
|
||||||
array=new (thd->mem_root) in_string(arg_count-1,(qsort2_cmp) srtcmp_in,
|
array=new (thd->mem_root) in_string(thd, arg_count - 1,
|
||||||
|
(qsort2_cmp) srtcmp_in,
|
||||||
cmp_collation.collation);
|
cmp_collation.collation);
|
||||||
break;
|
break;
|
||||||
case INT_RESULT:
|
case INT_RESULT:
|
||||||
array= new (thd->mem_root) in_longlong(arg_count-1);
|
array= new (thd->mem_root) in_longlong(thd, arg_count - 1);
|
||||||
break;
|
break;
|
||||||
case REAL_RESULT:
|
case REAL_RESULT:
|
||||||
array= new (thd->mem_root) in_double(arg_count-1);
|
array= new (thd->mem_root) in_double(thd, arg_count - 1);
|
||||||
break;
|
break;
|
||||||
case ROW_RESULT:
|
case ROW_RESULT:
|
||||||
/*
|
/*
|
||||||
@ -4081,11 +4084,11 @@ void Item_func_in::fix_length_and_dec()
|
|||||||
((in_row*)array)->tmp.store_value(args[0]);
|
((in_row*)array)->tmp.store_value(args[0]);
|
||||||
break;
|
break;
|
||||||
case DECIMAL_RESULT:
|
case DECIMAL_RESULT:
|
||||||
array= new (thd->mem_root) in_decimal(arg_count - 1);
|
array= new (thd->mem_root) in_decimal(thd, arg_count - 1);
|
||||||
break;
|
break;
|
||||||
case TIME_RESULT:
|
case TIME_RESULT:
|
||||||
date_arg= find_date_time_item(args, arg_count, 0);
|
date_arg= find_date_time_item(args, arg_count, 0);
|
||||||
array= new (thd->mem_root) in_datetime(date_arg, arg_count - 1);
|
array= new (thd->mem_root) in_datetime(thd, date_arg, arg_count - 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (array && !(thd->is_fatal_error)) // If not EOM
|
if (array && !(thd->is_fatal_error)) // If not EOM
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
#pragma interface /* gcc class implementation */
|
#pragma interface /* gcc class implementation */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "thr_malloc.h" /* sql_calloc */
|
|
||||||
#include "item_func.h" /* Item_int_func, Item_bool_func */
|
#include "item_func.h" /* Item_int_func, Item_bool_func */
|
||||||
#define PCRE_STATIC 1 /* Important on Windows */
|
#define PCRE_STATIC 1 /* Important on Windows */
|
||||||
#include "pcre.h" /* pcre header file */
|
#include "pcre.h" /* pcre header file */
|
||||||
@ -1041,9 +1040,9 @@ public:
|
|||||||
uint count;
|
uint count;
|
||||||
uint used_count;
|
uint used_count;
|
||||||
in_vector() {}
|
in_vector() {}
|
||||||
in_vector(uint elements,uint element_length,qsort2_cmp cmp_func,
|
in_vector(THD *thd, uint elements, uint element_length, qsort2_cmp cmp_func,
|
||||||
CHARSET_INFO *cmp_coll)
|
CHARSET_INFO *cmp_coll)
|
||||||
:base((char*) sql_calloc(elements*element_length)),
|
:base((char*) thd_calloc(thd, elements * element_length)),
|
||||||
size(element_length), compare(cmp_func), collation(cmp_coll),
|
size(element_length), compare(cmp_func), collation(cmp_coll),
|
||||||
count(elements), used_count(elements) {}
|
count(elements), used_count(elements) {}
|
||||||
virtual ~in_vector() {}
|
virtual ~in_vector() {}
|
||||||
@ -1100,7 +1099,7 @@ class in_string :public in_vector
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
public:
|
public:
|
||||||
in_string(uint elements,qsort2_cmp cmp_func, CHARSET_INFO *cs);
|
in_string(THD *thd, uint elements, qsort2_cmp cmp_func, CHARSET_INFO *cs);
|
||||||
~in_string();
|
~in_string();
|
||||||
void set(uint pos,Item *item);
|
void set(uint pos,Item *item);
|
||||||
uchar *get_value(Item *item);
|
uchar *get_value(Item *item);
|
||||||
@ -1128,7 +1127,7 @@ protected:
|
|||||||
longlong unsigned_flag; // Use longlong, not bool, to preserve alignment
|
longlong unsigned_flag; // Use longlong, not bool, to preserve alignment
|
||||||
} tmp;
|
} tmp;
|
||||||
public:
|
public:
|
||||||
in_longlong(uint elements);
|
in_longlong(THD *thd, uint elements);
|
||||||
void set(uint pos,Item *item);
|
void set(uint pos,Item *item);
|
||||||
uchar *get_value(Item *item);
|
uchar *get_value(Item *item);
|
||||||
Item* create_item(THD *thd);
|
Item* create_item(THD *thd);
|
||||||
@ -1159,8 +1158,8 @@ public:
|
|||||||
/* Cache for the left item. */
|
/* Cache for the left item. */
|
||||||
Item *lval_cache;
|
Item *lval_cache;
|
||||||
|
|
||||||
in_datetime(Item *warn_item_arg, uint elements)
|
in_datetime(THD *thd, Item *warn_item_arg, uint elements)
|
||||||
:in_longlong(elements), thd(current_thd), warn_item(warn_item_arg),
|
:in_longlong(thd, elements), thd(current_thd), warn_item(warn_item_arg),
|
||||||
lval_cache(0) {};
|
lval_cache(0) {};
|
||||||
void set(uint pos,Item *item);
|
void set(uint pos,Item *item);
|
||||||
uchar *get_value(Item *item);
|
uchar *get_value(Item *item);
|
||||||
@ -1179,7 +1178,7 @@ class in_double :public in_vector
|
|||||||
{
|
{
|
||||||
double tmp;
|
double tmp;
|
||||||
public:
|
public:
|
||||||
in_double(uint elements);
|
in_double(THD *thd, uint elements);
|
||||||
void set(uint pos,Item *item);
|
void set(uint pos,Item *item);
|
||||||
uchar *get_value(Item *item);
|
uchar *get_value(Item *item);
|
||||||
Item *create_item(THD *thd);
|
Item *create_item(THD *thd);
|
||||||
@ -1195,7 +1194,7 @@ class in_decimal :public in_vector
|
|||||||
{
|
{
|
||||||
my_decimal val;
|
my_decimal val;
|
||||||
public:
|
public:
|
||||||
in_decimal(uint elements);
|
in_decimal(THD *thd, uint elements);
|
||||||
void set(uint pos, Item *item);
|
void set(uint pos, Item *item);
|
||||||
uchar *get_value(Item *item);
|
uchar *get_value(Item *item);
|
||||||
Item *create_item(THD *thd);
|
Item *create_item(THD *thd);
|
||||||
|
@ -547,11 +547,11 @@ err:
|
|||||||
|
|
||||||
#define MAX_PART_NAME_SIZE 8
|
#define MAX_PART_NAME_SIZE 8
|
||||||
|
|
||||||
char *partition_info::create_default_partition_names(uint part_no,
|
char *partition_info::create_default_partition_names(THD *thd, uint part_no,
|
||||||
uint num_parts_arg,
|
uint num_parts_arg,
|
||||||
uint start_no)
|
uint start_no)
|
||||||
{
|
{
|
||||||
char *ptr= (char*) sql_calloc(num_parts_arg*MAX_PART_NAME_SIZE);
|
char *ptr= (char*) thd->calloc(num_parts_arg * MAX_PART_NAME_SIZE);
|
||||||
char *move_ptr= ptr;
|
char *move_ptr= ptr;
|
||||||
uint i= 0;
|
uint i= 0;
|
||||||
DBUG_ENTER("create_default_partition_names");
|
DBUG_ENTER("create_default_partition_names");
|
||||||
@ -620,11 +620,11 @@ void partition_info::set_show_version_string(String *packet)
|
|||||||
0 Memory allocation error
|
0 Memory allocation error
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char *partition_info::create_default_subpartition_name(uint subpart_no,
|
char *partition_info::create_default_subpartition_name(THD *thd, uint subpart_no,
|
||||||
const char *part_name)
|
const char *part_name)
|
||||||
{
|
{
|
||||||
uint size_alloc= strlen(part_name) + MAX_PART_NAME_SIZE;
|
uint size_alloc= strlen(part_name) + MAX_PART_NAME_SIZE;
|
||||||
char *ptr= (char*) sql_calloc(size_alloc);
|
char *ptr= (char*) thd->calloc(size_alloc);
|
||||||
DBUG_ENTER("create_default_subpartition_name");
|
DBUG_ENTER("create_default_subpartition_name");
|
||||||
|
|
||||||
if (likely(ptr != NULL))
|
if (likely(ptr != NULL))
|
||||||
@ -663,7 +663,7 @@ char *partition_info::create_default_subpartition_name(uint subpart_no,
|
|||||||
The external routine needing this code is check_partition_info
|
The external routine needing this code is check_partition_info
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool partition_info::set_up_default_partitions(handler *file,
|
bool partition_info::set_up_default_partitions(THD *thd, handler *file,
|
||||||
HA_CREATE_INFO *info,
|
HA_CREATE_INFO *info,
|
||||||
uint start_no)
|
uint start_no)
|
||||||
{
|
{
|
||||||
@ -695,7 +695,8 @@ bool partition_info::set_up_default_partitions(handler *file,
|
|||||||
my_error(ER_TOO_MANY_PARTITIONS_ERROR, MYF(0));
|
my_error(ER_TOO_MANY_PARTITIONS_ERROR, MYF(0));
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
if (unlikely((!(default_name= create_default_partition_names(0, num_parts,
|
if (unlikely((!(default_name= create_default_partition_names(thd, 0,
|
||||||
|
num_parts,
|
||||||
start_no)))))
|
start_no)))))
|
||||||
goto end;
|
goto end;
|
||||||
i= 0;
|
i= 0;
|
||||||
@ -744,7 +745,7 @@ end:
|
|||||||
The external routine needing this code is check_partition_info
|
The external routine needing this code is check_partition_info
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool partition_info::set_up_default_subpartitions(handler *file,
|
bool partition_info::set_up_default_subpartitions(THD *thd, handler *file,
|
||||||
HA_CREATE_INFO *info)
|
HA_CREATE_INFO *info)
|
||||||
{
|
{
|
||||||
uint i, j;
|
uint i, j;
|
||||||
@ -771,7 +772,7 @@ bool partition_info::set_up_default_subpartitions(handler *file,
|
|||||||
if (likely(subpart_elem != 0 &&
|
if (likely(subpart_elem != 0 &&
|
||||||
(!part_elem->subpartitions.push_back(subpart_elem))))
|
(!part_elem->subpartitions.push_back(subpart_elem))))
|
||||||
{
|
{
|
||||||
char *ptr= create_default_subpartition_name(j,
|
char *ptr= create_default_subpartition_name(thd, j,
|
||||||
part_elem->partition_name);
|
part_elem->partition_name);
|
||||||
if (!ptr)
|
if (!ptr)
|
||||||
goto end;
|
goto end;
|
||||||
@ -809,7 +810,7 @@ end:
|
|||||||
this will return an error.
|
this will return an error.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool partition_info::set_up_defaults_for_partitioning(handler *file,
|
bool partition_info::set_up_defaults_for_partitioning(THD *thd, handler *file,
|
||||||
HA_CREATE_INFO *info,
|
HA_CREATE_INFO *info,
|
||||||
uint start_no)
|
uint start_no)
|
||||||
{
|
{
|
||||||
@ -819,10 +820,10 @@ bool partition_info::set_up_defaults_for_partitioning(handler *file,
|
|||||||
{
|
{
|
||||||
default_partitions_setup= TRUE;
|
default_partitions_setup= TRUE;
|
||||||
if (use_default_partitions)
|
if (use_default_partitions)
|
||||||
DBUG_RETURN(set_up_default_partitions(file, info, start_no));
|
DBUG_RETURN(set_up_default_partitions(thd, file, info, start_no));
|
||||||
if (is_sub_partitioned() &&
|
if (is_sub_partitioned() &&
|
||||||
use_default_subpartitions)
|
use_default_subpartitions)
|
||||||
DBUG_RETURN(set_up_default_subpartitions(file, info));
|
DBUG_RETURN(set_up_default_subpartitions(thd, file, info));
|
||||||
}
|
}
|
||||||
DBUG_RETURN(FALSE);
|
DBUG_RETURN(FALSE);
|
||||||
}
|
}
|
||||||
@ -1702,7 +1703,7 @@ bool partition_info::check_partition_info(THD *thd, handlerton **eng_type,
|
|||||||
my_error(ER_SUBPARTITION_ERROR, MYF(0));
|
my_error(ER_SUBPARTITION_ERROR, MYF(0));
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
if (unlikely(set_up_defaults_for_partitioning(file, info, (uint)0)))
|
if (unlikely(set_up_defaults_for_partitioning(thd, file, info, (uint)0)))
|
||||||
goto end;
|
goto end;
|
||||||
if (!(tot_partitions= get_tot_partitions()))
|
if (!(tot_partitions= get_tot_partitions()))
|
||||||
{
|
{
|
||||||
|
@ -307,7 +307,8 @@ public:
|
|||||||
return num_parts * (is_sub_partitioned() ? num_subparts : 1);
|
return num_parts * (is_sub_partitioned() ? num_subparts : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool set_up_defaults_for_partitioning(handler *file, HA_CREATE_INFO *info,
|
bool set_up_defaults_for_partitioning(THD *thd, handler *file,
|
||||||
|
HA_CREATE_INFO *info,
|
||||||
uint start_no);
|
uint start_no);
|
||||||
char *find_duplicate_field();
|
char *find_duplicate_field();
|
||||||
char *find_duplicate_name();
|
char *find_duplicate_name();
|
||||||
@ -371,12 +372,13 @@ public:
|
|||||||
bool has_same_partitioning(partition_info *new_part_info);
|
bool has_same_partitioning(partition_info *new_part_info);
|
||||||
private:
|
private:
|
||||||
static int list_part_cmp(const void* a, const void* b);
|
static int list_part_cmp(const void* a, const void* b);
|
||||||
bool set_up_default_partitions(handler *file, HA_CREATE_INFO *info,
|
bool set_up_default_partitions(THD *thd, handler *file, HA_CREATE_INFO *info,
|
||||||
uint start_no);
|
uint start_no);
|
||||||
bool set_up_default_subpartitions(handler *file, HA_CREATE_INFO *info);
|
bool set_up_default_subpartitions(THD *thd, handler *file,
|
||||||
char *create_default_partition_names(uint part_no, uint num_parts,
|
HA_CREATE_INFO *info);
|
||||||
|
char *create_default_partition_names(THD *thd, uint part_no, uint num_parts,
|
||||||
uint start_no);
|
uint start_no);
|
||||||
char *create_default_subpartition_name(uint subpart_no,
|
char *create_default_subpartition_name(THD *thd, uint subpart_no,
|
||||||
const char *part_name);
|
const char *part_name);
|
||||||
bool prune_partition_bitmaps(TABLE_LIST *table_list);
|
bool prune_partition_bitmaps(TABLE_LIST *table_list);
|
||||||
bool add_named_partition(const char *part_name, uint length);
|
bool add_named_partition(const char *part_name, uint length);
|
||||||
|
@ -255,7 +255,7 @@ static bool is_name_in_list(char *name, List<char> list_names)
|
|||||||
FALSE Success
|
FALSE Success
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool partition_default_handling(TABLE *table, partition_info *part_info,
|
bool partition_default_handling(THD *thd, TABLE *table, partition_info *part_info,
|
||||||
bool is_create_table_ind,
|
bool is_create_table_ind,
|
||||||
const char *normalized_path)
|
const char *normalized_path)
|
||||||
{
|
{
|
||||||
@ -283,7 +283,7 @@ bool partition_default_handling(TABLE *table, partition_info *part_info,
|
|||||||
part_info->num_subparts= num_parts / part_info->num_parts;
|
part_info->num_subparts= num_parts / part_info->num_parts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
part_info->set_up_defaults_for_partitioning(table->file,
|
part_info->set_up_defaults_for_partitioning(thd, table->file,
|
||||||
NULL, 0U);
|
NULL, 0U);
|
||||||
DBUG_RETURN(FALSE);
|
DBUG_RETURN(FALSE);
|
||||||
}
|
}
|
||||||
@ -455,7 +455,7 @@ int get_part_for_delete(const uchar *buf, const uchar *rec0,
|
|||||||
function.
|
function.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static bool set_up_field_array(TABLE *table,
|
static bool set_up_field_array(THD *thd, TABLE *table,
|
||||||
bool is_sub_part)
|
bool is_sub_part)
|
||||||
{
|
{
|
||||||
Field **ptr, *field, **field_array;
|
Field **ptr, *field, **field_array;
|
||||||
@ -492,7 +492,7 @@ static bool set_up_field_array(TABLE *table,
|
|||||||
DBUG_RETURN(result);
|
DBUG_RETURN(result);
|
||||||
}
|
}
|
||||||
size_field_array= (num_fields+1)*sizeof(Field*);
|
size_field_array= (num_fields+1)*sizeof(Field*);
|
||||||
field_array= (Field**)sql_calloc(size_field_array);
|
field_array= (Field**) thd->calloc(size_field_array);
|
||||||
if (unlikely(!field_array))
|
if (unlikely(!field_array))
|
||||||
{
|
{
|
||||||
mem_alloc_error(size_field_array);
|
mem_alloc_error(size_field_array);
|
||||||
@ -617,7 +617,7 @@ static bool create_full_part_field_array(THD *thd, TABLE *table,
|
|||||||
num_part_fields++;
|
num_part_fields++;
|
||||||
}
|
}
|
||||||
size_field_array= (num_part_fields+1)*sizeof(Field*);
|
size_field_array= (num_part_fields+1)*sizeof(Field*);
|
||||||
field_array= (Field**)sql_calloc(size_field_array);
|
field_array= (Field**) thd->calloc(size_field_array);
|
||||||
if (unlikely(!field_array))
|
if (unlikely(!field_array))
|
||||||
{
|
{
|
||||||
mem_alloc_error(size_field_array);
|
mem_alloc_error(size_field_array);
|
||||||
@ -804,7 +804,7 @@ static void clear_field_flag(TABLE *table)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
static bool handle_list_of_fields(List_iterator<char> it,
|
static bool handle_list_of_fields(THD *thd, List_iterator<char> it,
|
||||||
TABLE *table,
|
TABLE *table,
|
||||||
partition_info *part_info,
|
partition_info *part_info,
|
||||||
bool is_sub_part)
|
bool is_sub_part)
|
||||||
@ -865,7 +865,7 @@ static bool handle_list_of_fields(List_iterator<char> it,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result= set_up_field_array(table, is_sub_part);
|
result= set_up_field_array(thd, table, is_sub_part);
|
||||||
end:
|
end:
|
||||||
DBUG_RETURN(result);
|
DBUG_RETURN(result);
|
||||||
}
|
}
|
||||||
@ -1034,7 +1034,7 @@ static bool fix_fields_part_func(THD *thd, Item* func_expr, TABLE *table,
|
|||||||
|
|
||||||
if ((!is_sub_part) && (error= check_signed_flag(part_info)))
|
if ((!is_sub_part) && (error= check_signed_flag(part_info)))
|
||||||
goto end;
|
goto end;
|
||||||
result= set_up_field_array(table, is_sub_part);
|
result= set_up_field_array(thd, table, is_sub_part);
|
||||||
end:
|
end:
|
||||||
end_lex_with_single_table(thd, table, old_lex);
|
end_lex_with_single_table(thd, table, old_lex);
|
||||||
#if !defined(DBUG_OFF)
|
#if !defined(DBUG_OFF)
|
||||||
@ -1622,7 +1622,7 @@ bool fix_partition_func(THD *thd, TABLE *table,
|
|||||||
if (!is_create_table_ind ||
|
if (!is_create_table_ind ||
|
||||||
thd->lex->sql_command != SQLCOM_CREATE_TABLE)
|
thd->lex->sql_command != SQLCOM_CREATE_TABLE)
|
||||||
{
|
{
|
||||||
if (partition_default_handling(table, part_info,
|
if (partition_default_handling(thd, table, part_info,
|
||||||
is_create_table_ind,
|
is_create_table_ind,
|
||||||
table->s->normalized_path.str))
|
table->s->normalized_path.str))
|
||||||
{
|
{
|
||||||
@ -1641,7 +1641,7 @@ bool fix_partition_func(THD *thd, TABLE *table,
|
|||||||
if (part_info->list_of_subpart_fields)
|
if (part_info->list_of_subpart_fields)
|
||||||
{
|
{
|
||||||
List_iterator<char> it(part_info->subpart_field_list);
|
List_iterator<char> it(part_info->subpart_field_list);
|
||||||
if (unlikely(handle_list_of_fields(it, table, part_info, TRUE)))
|
if (unlikely(handle_list_of_fields(thd, it, table, part_info, TRUE)))
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1668,7 +1668,7 @@ bool fix_partition_func(THD *thd, TABLE *table,
|
|||||||
if (part_info->list_of_part_fields)
|
if (part_info->list_of_part_fields)
|
||||||
{
|
{
|
||||||
List_iterator<char> it(part_info->part_field_list);
|
List_iterator<char> it(part_info->part_field_list);
|
||||||
if (unlikely(handle_list_of_fields(it, table, part_info, FALSE)))
|
if (unlikely(handle_list_of_fields(thd, it, table, part_info, FALSE)))
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1690,7 +1690,7 @@ bool fix_partition_func(THD *thd, TABLE *table,
|
|||||||
if (part_info->column_list)
|
if (part_info->column_list)
|
||||||
{
|
{
|
||||||
List_iterator<char> it(part_info->part_field_list);
|
List_iterator<char> it(part_info->part_field_list);
|
||||||
if (unlikely(handle_list_of_fields(it, table, part_info, FALSE)))
|
if (unlikely(handle_list_of_fields(thd, it, table, part_info, FALSE)))
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -4976,7 +4976,7 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info,
|
|||||||
}
|
}
|
||||||
alt_part_info->part_type= tab_part_info->part_type;
|
alt_part_info->part_type= tab_part_info->part_type;
|
||||||
alt_part_info->subpart_type= tab_part_info->subpart_type;
|
alt_part_info->subpart_type= tab_part_info->subpart_type;
|
||||||
if (alt_part_info->set_up_defaults_for_partitioning(table->file, 0,
|
if (alt_part_info->set_up_defaults_for_partitioning(thd, table->file, 0,
|
||||||
tab_part_info->num_parts))
|
tab_part_info->num_parts))
|
||||||
{
|
{
|
||||||
goto err;
|
goto err;
|
||||||
@ -5395,7 +5395,8 @@ state of p1.
|
|||||||
DBUG_ASSERT(!alt_part_info->use_default_partitions);
|
DBUG_ASSERT(!alt_part_info->use_default_partitions);
|
||||||
/* We specified partitions explicitly so don't use defaults anymore. */
|
/* We specified partitions explicitly so don't use defaults anymore. */
|
||||||
tab_part_info->use_default_partitions= FALSE;
|
tab_part_info->use_default_partitions= FALSE;
|
||||||
if (alt_part_info->set_up_defaults_for_partitioning(table->file, 0, 0))
|
if (alt_part_info->set_up_defaults_for_partitioning(thd, table->file, 0,
|
||||||
|
0))
|
||||||
{
|
{
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
@ -1656,7 +1656,7 @@ public:
|
|||||||
|
|
||||||
bool is_single_comp_pk;
|
bool is_single_comp_pk;
|
||||||
|
|
||||||
Index_prefix_calc(TABLE *table, KEY *key_info)
|
Index_prefix_calc(THD *thd, TABLE *table, KEY *key_info)
|
||||||
: index_table(table), index_info(key_info)
|
: index_table(table), index_info(key_info)
|
||||||
{
|
{
|
||||||
uint i;
|
uint i;
|
||||||
@ -1691,7 +1691,8 @@ public:
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
if (!(state->last_prefix=
|
if (!(state->last_prefix=
|
||||||
new Cached_item_field(key_info->key_part[i].field)))
|
new (thd->mem_root) Cached_item_field(thd,
|
||||||
|
key_info->key_part[i].field)))
|
||||||
break;
|
break;
|
||||||
state->entry_count= state->prefix_count= 0;
|
state->entry_count= state->prefix_count= 0;
|
||||||
prefixes++;
|
prefixes++;
|
||||||
@ -2475,7 +2476,7 @@ int collect_statistics_for_index(THD *thd, TABLE *table, uint index)
|
|||||||
if (key_info->flags & HA_FULLTEXT)
|
if (key_info->flags & HA_FULLTEXT)
|
||||||
DBUG_RETURN(rc);
|
DBUG_RETURN(rc);
|
||||||
|
|
||||||
Index_prefix_calc index_prefix_calc(table, key_info);
|
Index_prefix_calc index_prefix_calc(thd, table, key_info);
|
||||||
|
|
||||||
DEBUG_SYNC(table->in_use, "statistics_collection_start1");
|
DEBUG_SYNC(table->in_use, "statistics_collection_start1");
|
||||||
DEBUG_SYNC(table->in_use, "statistics_collection_start2");
|
DEBUG_SYNC(table->in_use, "statistics_collection_start2");
|
||||||
|
@ -75,15 +75,6 @@ void *sql_alloc(size_t Size)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void *sql_calloc(size_t size)
|
|
||||||
{
|
|
||||||
void *ptr;
|
|
||||||
if ((ptr=sql_alloc(size)))
|
|
||||||
bzero(ptr,size);
|
|
||||||
return ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
char *sql_strmake_with_convert(const char *str, size_t arg_length,
|
char *sql_strmake_with_convert(const char *str, size_t arg_length,
|
||||||
CHARSET_INFO *from_cs,
|
CHARSET_INFO *from_cs,
|
||||||
size_t max_res_length,
|
size_t max_res_length,
|
||||||
|
@ -23,7 +23,6 @@ typedef struct st_mem_root MEM_ROOT;
|
|||||||
void init_sql_alloc(MEM_ROOT *root, uint block_size, uint pre_alloc_size,
|
void init_sql_alloc(MEM_ROOT *root, uint block_size, uint pre_alloc_size,
|
||||||
myf my_flags);
|
myf my_flags);
|
||||||
void *sql_alloc(size_t);
|
void *sql_alloc(size_t);
|
||||||
void *sql_calloc(size_t);
|
|
||||||
char *sql_strmake_with_convert(const char *str, size_t arg_length,
|
char *sql_strmake_with_convert(const char *str, size_t arg_length,
|
||||||
CHARSET_INFO *from_cs,
|
CHARSET_INFO *from_cs,
|
||||||
size_t max_res_length,
|
size_t max_res_length,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user