Follow up after work on Bug 4968
Coding style: classes start with a capital letter. Rename some classes related to parsing: create_field -> Create_field foreign_key -> Foreign_key key_part_spec -> Key_part_spec sql/field.cc: create_field -> Create_field sql/field.h: create_field -> Create_field sql/item.h: create_field -> Create_field sql/item_sum.cc: create_field -> Create_field sql/mysql_priv.h: create_field -> Create_field sql/sp_head.cc: create_field -> Create_field sql/sp_head.h: create_field -> Create_field sql/sp_pcontext.cc: create_field -> Create_field sql/sp_pcontext.h: create_field -> Create_field sql/sp_rcontext.cc: create_field -> Create_field sql/sql_class.cc: create_field -> Create_field key_part_spec -> Key_part_spec foreign_key -> Foreign_key sql/sql_class.h: create_field -> Create_field key_part_spec -> Key_part_spec foreign_key -> Foreign_key sql/sql_insert.cc: create_field -> Create_field sql/sql_lex.cc: Coding style: classes start with a capital, create_field -> Create_field sql/sql_lex.h: create_field -> Create_field key_part_spec -> Key_part_spec sql/sql_parse.cc: create_field -> Create_field key_part_spec -> Key_part_spec sql/sql_select.cc: create_field -> Create_field sql/sql_table.cc: create_field -> Create_field sql/sql_yacc.yy: create_field -> Create_field key_part_spec -> Key_part_spec foreign_key -> Foreign_key sql/unireg.cc: create_field -> Create_field
This commit is contained in:
parent
75abceb2fe
commit
97cf2694a1
36
sql/field.cc
36
sql/field.cc
@ -38,8 +38,8 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
|
#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
|
||||||
template class List<create_field>;
|
template class List<Create_field>;
|
||||||
template class List_iterator<create_field>;
|
template class List_iterator<Create_field>;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uchar Field_null::null[1]={1};
|
uchar Field_null::null[1]={1};
|
||||||
@ -2631,7 +2631,7 @@ void Field_new_decimal::sql_type(String &str) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint Field_new_decimal::is_equal(create_field *new_field)
|
uint Field_new_decimal::is_equal(Create_field *new_field)
|
||||||
{
|
{
|
||||||
return ((new_field->sql_type == real_type()) &&
|
return ((new_field->sql_type == real_type()) &&
|
||||||
((new_field->flags & UNSIGNED_FLAG) ==
|
((new_field->flags & UNSIGNED_FLAG) ==
|
||||||
@ -6100,7 +6100,7 @@ int Field_str::store(double nr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint Field::is_equal(create_field *new_field)
|
uint Field::is_equal(Create_field *new_field)
|
||||||
{
|
{
|
||||||
return (new_field->sql_type == real_type());
|
return (new_field->sql_type == real_type());
|
||||||
}
|
}
|
||||||
@ -6108,7 +6108,7 @@ uint Field::is_equal(create_field *new_field)
|
|||||||
|
|
||||||
/* If one of the fields is binary and the other one isn't return 1 else 0 */
|
/* If one of the fields is binary and the other one isn't return 1 else 0 */
|
||||||
|
|
||||||
bool Field_str::compare_str_field_flags(create_field *new_field, uint32 flags)
|
bool Field_str::compare_str_field_flags(Create_field *new_field, uint32 flags)
|
||||||
{
|
{
|
||||||
return (((new_field->flags & (BINCMP_FLAG | BINARY_FLAG)) &&
|
return (((new_field->flags & (BINCMP_FLAG | BINARY_FLAG)) &&
|
||||||
!(flags & (BINCMP_FLAG | BINARY_FLAG))) ||
|
!(flags & (BINCMP_FLAG | BINARY_FLAG))) ||
|
||||||
@ -6117,7 +6117,7 @@ bool Field_str::compare_str_field_flags(create_field *new_field, uint32 flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint Field_str::is_equal(create_field *new_field)
|
uint Field_str::is_equal(Create_field *new_field)
|
||||||
{
|
{
|
||||||
if (compare_str_field_flags(new_field, flags))
|
if (compare_str_field_flags(new_field, flags))
|
||||||
return 0;
|
return 0;
|
||||||
@ -6969,7 +6969,7 @@ Field *Field_varstring::new_key_field(MEM_ROOT *root,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint Field_varstring::is_equal(create_field *new_field)
|
uint Field_varstring::is_equal(Create_field *new_field)
|
||||||
{
|
{
|
||||||
if (new_field->sql_type == real_type() &&
|
if (new_field->sql_type == real_type() &&
|
||||||
new_field->charset == field_charset)
|
new_field->charset == field_charset)
|
||||||
@ -7651,7 +7651,7 @@ uint Field_blob::max_packed_col_length(uint max_length)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint Field_blob::is_equal(create_field *new_field)
|
uint Field_blob::is_equal(Create_field *new_field)
|
||||||
{
|
{
|
||||||
if (compare_str_field_flags(new_field, flags))
|
if (compare_str_field_flags(new_field, flags))
|
||||||
return 0;
|
return 0;
|
||||||
@ -8187,7 +8187,7 @@ bool Field_num::eq_def(Field *field)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint Field_num::is_equal(create_field *new_field)
|
uint Field_num::is_equal(Create_field *new_field)
|
||||||
{
|
{
|
||||||
return ((new_field->sql_type == real_type()) &&
|
return ((new_field->sql_type == real_type()) &&
|
||||||
((new_field->flags & UNSIGNED_FLAG) == (uint) (flags &
|
((new_field->flags & UNSIGNED_FLAG) == (uint) (flags &
|
||||||
@ -8616,20 +8616,20 @@ void Field_bit_as_char::sql_type(String &res) const
|
|||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
Handling of field and create_field
|
Handling of field and Create_field
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Convert create_field::length from number of characters to number of bytes
|
Convert Create_field::length from number of characters to number of bytes
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
create_field::create_length_to_internal_length()
|
Create_field::create_length_to_internal_length()
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
Convert create_field::length from number of characters to number of bytes.
|
Convert Create_field::length from number of characters to number of bytes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void create_field::create_length_to_internal_length(void)
|
void Create_field::create_length_to_internal_length(void)
|
||||||
{
|
{
|
||||||
switch (sql_type) {
|
switch (sql_type) {
|
||||||
case MYSQL_TYPE_TINY_BLOB:
|
case MYSQL_TYPE_TINY_BLOB:
|
||||||
@ -8676,7 +8676,7 @@ void create_field::create_length_to_internal_length(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void create_field::init_for_tmp_table(enum_field_types sql_type_arg,
|
void Create_field::init_for_tmp_table(enum_field_types sql_type_arg,
|
||||||
uint32 length_arg, uint32 decimals_arg,
|
uint32 length_arg, uint32 decimals_arg,
|
||||||
bool maybe_null, bool is_unsigned)
|
bool maybe_null, bool is_unsigned)
|
||||||
{
|
{
|
||||||
@ -8717,7 +8717,7 @@ void create_field::init_for_tmp_table(enum_field_types sql_type_arg,
|
|||||||
TRUE on error
|
TRUE on error
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool create_field::init(THD *thd, char *fld_name, enum_field_types fld_type,
|
bool Create_field::init(THD *thd, char *fld_name, enum_field_types fld_type,
|
||||||
char *fld_length, char *fld_decimals,
|
char *fld_length, char *fld_decimals,
|
||||||
uint fld_type_modifier, Item *fld_default_value,
|
uint fld_type_modifier, Item *fld_default_value,
|
||||||
Item *fld_on_update_value, LEX_STRING *fld_comment,
|
Item *fld_on_update_value, LEX_STRING *fld_comment,
|
||||||
@ -8727,7 +8727,7 @@ bool create_field::init(THD *thd, char *fld_name, enum_field_types fld_type,
|
|||||||
uint sign_len, allowed_type_modifier= 0;
|
uint sign_len, allowed_type_modifier= 0;
|
||||||
ulong max_field_charlength= MAX_FIELD_CHARLENGTH;
|
ulong max_field_charlength= MAX_FIELD_CHARLENGTH;
|
||||||
|
|
||||||
DBUG_ENTER("create_field::init()");
|
DBUG_ENTER("Create_field::init()");
|
||||||
|
|
||||||
field= 0;
|
field= 0;
|
||||||
field_name= fld_name;
|
field_name= fld_name;
|
||||||
@ -9300,7 +9300,7 @@ Field *make_field(TABLE_SHARE *share, uchar *ptr, uint32 field_length,
|
|||||||
|
|
||||||
/* Create a field suitable for create of table */
|
/* Create a field suitable for create of table */
|
||||||
|
|
||||||
create_field::create_field(Field *old_field,Field *orig_field)
|
Create_field::Create_field(Field *old_field,Field *orig_field)
|
||||||
{
|
{
|
||||||
field= old_field;
|
field= old_field;
|
||||||
field_name=change=old_field->field_name;
|
field_name=change=old_field->field_name;
|
||||||
|
30
sql/field.h
30
sql/field.h
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
class Send_field;
|
class Send_field;
|
||||||
class Protocol;
|
class Protocol;
|
||||||
class create_field;
|
class Create_field;
|
||||||
struct st_cache_field;
|
struct st_cache_field;
|
||||||
int field_conv(Field *to,Field *from);
|
int field_conv(Field *to,Field *from);
|
||||||
|
|
||||||
@ -413,7 +413,7 @@ public:
|
|||||||
/* maximum possible display length */
|
/* maximum possible display length */
|
||||||
virtual uint32 max_display_length()= 0;
|
virtual uint32 max_display_length()= 0;
|
||||||
|
|
||||||
virtual uint is_equal(create_field *new_field);
|
virtual uint is_equal(Create_field *new_field);
|
||||||
/* convert decimal to longlong with overflow check */
|
/* convert decimal to longlong with overflow check */
|
||||||
longlong convert_decimal2longlong(const my_decimal *val, bool unsigned_flag,
|
longlong convert_decimal2longlong(const my_decimal *val, bool unsigned_flag,
|
||||||
int *err);
|
int *err);
|
||||||
@ -468,14 +468,14 @@ public:
|
|||||||
Item_result result_type () const { return REAL_RESULT; }
|
Item_result result_type () const { return REAL_RESULT; }
|
||||||
void prepend_zeros(String *value);
|
void prepend_zeros(String *value);
|
||||||
void add_zerofill_and_unsigned(String &res) const;
|
void add_zerofill_and_unsigned(String &res) const;
|
||||||
friend class create_field;
|
friend class Create_field;
|
||||||
void make_field(Send_field *);
|
void make_field(Send_field *);
|
||||||
uint decimals() const { return (uint) dec; }
|
uint decimals() const { return (uint) dec; }
|
||||||
uint size_of() const { return sizeof(*this); }
|
uint size_of() const { return sizeof(*this); }
|
||||||
bool eq_def(Field *field);
|
bool eq_def(Field *field);
|
||||||
int store_decimal(const my_decimal *);
|
int store_decimal(const my_decimal *);
|
||||||
my_decimal *val_decimal(my_decimal *);
|
my_decimal *val_decimal(my_decimal *);
|
||||||
uint is_equal(create_field *new_field);
|
uint is_equal(Create_field *new_field);
|
||||||
int check_int(CHARSET_INFO *cs, const char *str, int length,
|
int check_int(CHARSET_INFO *cs, const char *str, int length,
|
||||||
const char *int_end, int error);
|
const char *int_end, int error);
|
||||||
bool get_int(CHARSET_INFO *cs, const char *from, uint len,
|
bool get_int(CHARSET_INFO *cs, const char *from, uint len,
|
||||||
@ -506,11 +506,11 @@ public:
|
|||||||
{ field_derivation= derivation_arg; }
|
{ field_derivation= derivation_arg; }
|
||||||
bool binary() const { return field_charset == &my_charset_bin; }
|
bool binary() const { return field_charset == &my_charset_bin; }
|
||||||
uint32 max_display_length() { return field_length; }
|
uint32 max_display_length() { return field_length; }
|
||||||
friend class create_field;
|
friend class Create_field;
|
||||||
my_decimal *val_decimal(my_decimal *);
|
my_decimal *val_decimal(my_decimal *);
|
||||||
virtual bool str_needs_quotes() { return TRUE; }
|
virtual bool str_needs_quotes() { return TRUE; }
|
||||||
bool compare_str_field_flags(create_field *new_field, uint32 flags);
|
bool compare_str_field_flags(Create_field *new_field, uint32 flags);
|
||||||
uint is_equal(create_field *new_field);
|
uint is_equal(Create_field *new_field);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -614,7 +614,7 @@ public:
|
|||||||
uint32 max_display_length() { return field_length; }
|
uint32 max_display_length() { return field_length; }
|
||||||
uint size_of() const { return sizeof(*this); }
|
uint size_of() const { return sizeof(*this); }
|
||||||
uint32 pack_length() const { return (uint32) bin_size; }
|
uint32 pack_length() const { return (uint32) bin_size; }
|
||||||
uint is_equal(create_field *new_field);
|
uint is_equal(Create_field *new_field);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -1246,7 +1246,7 @@ public:
|
|||||||
Field *new_key_field(MEM_ROOT *root, struct st_table *new_table,
|
Field *new_key_field(MEM_ROOT *root, struct st_table *new_table,
|
||||||
uchar *new_ptr, uchar *new_null_ptr,
|
uchar *new_ptr, uchar *new_null_ptr,
|
||||||
uint new_null_bit);
|
uint new_null_bit);
|
||||||
uint is_equal(create_field *new_field);
|
uint is_equal(Create_field *new_field);
|
||||||
void hash(ulong *nr, ulong *nr2);
|
void hash(ulong *nr, ulong *nr2);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1380,7 +1380,7 @@ public:
|
|||||||
bool has_charset(void) const
|
bool has_charset(void) const
|
||||||
{ return charset() == &my_charset_bin ? FALSE : TRUE; }
|
{ return charset() == &my_charset_bin ? FALSE : TRUE; }
|
||||||
uint32 max_display_length();
|
uint32 max_display_length();
|
||||||
uint is_equal(create_field *new_field);
|
uint is_equal(Create_field *new_field);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -1595,7 +1595,7 @@ public:
|
|||||||
Create field class for CREATE TABLE
|
Create field class for CREATE TABLE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class create_field :public Sql_alloc
|
class Create_field :public Sql_alloc
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
const char *field_name;
|
const char *field_name;
|
||||||
@ -1626,11 +1626,11 @@ public:
|
|||||||
|
|
||||||
uint8 row,col,sc_length,interval_id; // For rea_create_table
|
uint8 row,col,sc_length,interval_id; // For rea_create_table
|
||||||
uint offset,pack_flag;
|
uint offset,pack_flag;
|
||||||
create_field() :after(0) {}
|
Create_field() :after(0) {}
|
||||||
create_field(Field *field, Field *orig_field);
|
Create_field(Field *field, Field *orig_field);
|
||||||
/* Used to make a clone of this object for ALTER/CREATE TABLE */
|
/* Used to make a clone of this object for ALTER/CREATE TABLE */
|
||||||
create_field *clone(MEM_ROOT *mem_root) const
|
Create_field *clone(MEM_ROOT *mem_root) const
|
||||||
{ return new (mem_root) create_field(*this); }
|
{ return new (mem_root) Create_field(*this); }
|
||||||
void create_length_to_internal_length(void);
|
void create_length_to_internal_length(void);
|
||||||
|
|
||||||
/* Init for a tmp table field. To be extended if need be. */
|
/* Init for a tmp table field. To be extended if need be. */
|
||||||
|
@ -1756,7 +1756,7 @@ public:
|
|||||||
We have to have a different max_length than 'length' here to
|
We have to have a different max_length than 'length' here to
|
||||||
ensure that we get the right length if we do use the item
|
ensure that we get the right length if we do use the item
|
||||||
to create a new table. In this case max_length must be the maximum
|
to create a new table. In this case max_length must be the maximum
|
||||||
number of chars for a string of this type because we in create_field::
|
number of chars for a string of this type because we in Create_field::
|
||||||
divide the max_length with mbmaxlen).
|
divide the max_length with mbmaxlen).
|
||||||
*/
|
*/
|
||||||
max_length= str_value.numchars()*cs->mbmaxlen;
|
max_length= str_value.numchars()*cs->mbmaxlen;
|
||||||
|
@ -912,8 +912,8 @@ void Item_sum_distinct::fix_length_and_dec()
|
|||||||
|
|
||||||
bool Item_sum_distinct::setup(THD *thd)
|
bool Item_sum_distinct::setup(THD *thd)
|
||||||
{
|
{
|
||||||
List<create_field> field_list;
|
List<Create_field> field_list;
|
||||||
create_field field_def; /* field definition */
|
Create_field field_def; /* field definition */
|
||||||
DBUG_ENTER("Item_sum_distinct::setup");
|
DBUG_ENTER("Item_sum_distinct::setup");
|
||||||
DBUG_ASSERT(tree == 0);
|
DBUG_ASSERT(tree == 0);
|
||||||
|
|
||||||
|
@ -911,7 +911,7 @@ bool mysql_assign_to_keycache(THD* thd, TABLE_LIST* table_list,
|
|||||||
bool mysql_preload_keys(THD* thd, TABLE_LIST* table_list);
|
bool mysql_preload_keys(THD* thd, TABLE_LIST* table_list);
|
||||||
int reassign_keycache_tables(THD* thd, KEY_CACHE *src_cache,
|
int reassign_keycache_tables(THD* thd, KEY_CACHE *src_cache,
|
||||||
KEY_CACHE *dst_cache);
|
KEY_CACHE *dst_cache);
|
||||||
TABLE *create_virtual_tmp_table(THD *thd, List<create_field> &field_list);
|
TABLE *create_virtual_tmp_table(THD *thd, List<Create_field> &field_list);
|
||||||
|
|
||||||
bool mysql_xa_recover(THD *thd);
|
bool mysql_xa_recover(THD *thd);
|
||||||
|
|
||||||
@ -955,8 +955,8 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
|
|||||||
bool table_cant_handle_bit_fields,
|
bool table_cant_handle_bit_fields,
|
||||||
bool make_copy_field,
|
bool make_copy_field,
|
||||||
uint convert_blob_length);
|
uint convert_blob_length);
|
||||||
void sp_prepare_create_field(THD *thd, create_field *sql_field);
|
void sp_prepare_create_field(THD *thd, Create_field *sql_field);
|
||||||
int prepare_create_field(create_field *sql_field,
|
int prepare_create_field(Create_field *sql_field,
|
||||||
uint *blob_columns,
|
uint *blob_columns,
|
||||||
int *timestamps, int *timestamps_with_niladic,
|
int *timestamps, int *timestamps_with_niladic,
|
||||||
longlong table_flags);
|
longlong table_flags);
|
||||||
@ -1181,7 +1181,7 @@ bool add_field_to_list(THD *thd, LEX_STRING *field_name, enum enum_field_types t
|
|||||||
char *change, List<String> *interval_list,
|
char *change, List<String> *interval_list,
|
||||||
CHARSET_INFO *cs,
|
CHARSET_INFO *cs,
|
||||||
uint uint_geom_type);
|
uint uint_geom_type);
|
||||||
create_field * new_create_field(THD *thd, char *field_name, enum_field_types type,
|
Create_field * new_create_field(THD *thd, char *field_name, enum_field_types type,
|
||||||
char *length, char *decimals,
|
char *length, char *decimals,
|
||||||
uint type_modifier,
|
uint type_modifier,
|
||||||
Item *default_value, Item *on_update_value,
|
Item *default_value, Item *on_update_value,
|
||||||
@ -1808,12 +1808,12 @@ void unireg_end(void) __attribute__((noreturn));
|
|||||||
bool mysql_create_frm(THD *thd, const char *file_name,
|
bool mysql_create_frm(THD *thd, const char *file_name,
|
||||||
const char *db, const char *table,
|
const char *db, const char *table,
|
||||||
HA_CREATE_INFO *create_info,
|
HA_CREATE_INFO *create_info,
|
||||||
List<create_field> &create_field,
|
List<Create_field> &create_field,
|
||||||
uint key_count,KEY *key_info,handler *db_type);
|
uint key_count,KEY *key_info,handler *db_type);
|
||||||
int rea_create_table(THD *thd, const char *path,
|
int rea_create_table(THD *thd, const char *path,
|
||||||
const char *db, const char *table_name,
|
const char *db, const char *table_name,
|
||||||
HA_CREATE_INFO *create_info,
|
HA_CREATE_INFO *create_info,
|
||||||
List<create_field> &create_field,
|
List<Create_field> &create_field,
|
||||||
uint key_count,KEY *key_info,
|
uint key_count,KEY *key_info,
|
||||||
handler *file);
|
handler *file);
|
||||||
int format_number(uint inputflag,uint max_length,char * pos,uint length,
|
int format_number(uint inputflag,uint max_length,char * pos,uint length,
|
||||||
|
@ -581,7 +581,7 @@ sp_head::init_strings(THD *thd, LEX *lex)
|
|||||||
|
|
||||||
|
|
||||||
static TYPELIB *
|
static TYPELIB *
|
||||||
create_typelib(MEM_ROOT *mem_root, create_field *field_def, List<String> *src)
|
create_typelib(MEM_ROOT *mem_root, Create_field *field_def, List<String> *src)
|
||||||
{
|
{
|
||||||
TYPELIB *result= NULL;
|
TYPELIB *result= NULL;
|
||||||
CHARSET_INFO *cs= field_def->charset;
|
CHARSET_INFO *cs= field_def->charset;
|
||||||
@ -1905,7 +1905,7 @@ sp_head::backpatch(sp_label_t *lab)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Prepare an instance of create_field for field creation (fill all necessary
|
Prepare an instance of Create_field for field creation (fill all necessary
|
||||||
attributes).
|
attributes).
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
@ -1913,7 +1913,7 @@ sp_head::backpatch(sp_label_t *lab)
|
|||||||
thd [IN] Thread handle
|
thd [IN] Thread handle
|
||||||
lex [IN] Yacc parsing context
|
lex [IN] Yacc parsing context
|
||||||
field_type [IN] Field type
|
field_type [IN] Field type
|
||||||
field_def [OUT] An instance of create_field to be filled
|
field_def [OUT] An instance of Create_field to be filled
|
||||||
|
|
||||||
RETURN
|
RETURN
|
||||||
FALSE on success
|
FALSE on success
|
||||||
@ -1923,7 +1923,7 @@ sp_head::backpatch(sp_label_t *lab)
|
|||||||
bool
|
bool
|
||||||
sp_head::fill_field_definition(THD *thd, LEX *lex,
|
sp_head::fill_field_definition(THD *thd, LEX *lex,
|
||||||
enum enum_field_types field_type,
|
enum enum_field_types field_type,
|
||||||
create_field *field_def)
|
Create_field *field_def)
|
||||||
{
|
{
|
||||||
HA_CREATE_INFO sp_db_info;
|
HA_CREATE_INFO sp_db_info;
|
||||||
LEX_STRING cmt = { 0, 0 };
|
LEX_STRING cmt = { 0, 0 };
|
||||||
|
@ -126,7 +126,7 @@ public:
|
|||||||
int m_type;
|
int m_type;
|
||||||
uint m_flags; // Boolean attributes of a stored routine
|
uint m_flags; // Boolean attributes of a stored routine
|
||||||
|
|
||||||
create_field m_return_field_def; /* This is used for FUNCTIONs only. */
|
Create_field m_return_field_def; /* This is used for FUNCTIONs only. */
|
||||||
|
|
||||||
const char *m_tmp_query; // Temporary pointer to sub query string
|
const char *m_tmp_query; // Temporary pointer to sub query string
|
||||||
st_sp_chistics *m_chistics;
|
st_sp_chistics *m_chistics;
|
||||||
@ -290,7 +290,7 @@ public:
|
|||||||
|
|
||||||
bool fill_field_definition(THD *thd, LEX *lex,
|
bool fill_field_definition(THD *thd, LEX *lex,
|
||||||
enum enum_field_types field_type,
|
enum enum_field_types field_type,
|
||||||
create_field *field_def);
|
Create_field *field_def);
|
||||||
|
|
||||||
void set_info(longlong created, longlong modified,
|
void set_info(longlong created, longlong modified,
|
||||||
st_sp_chistics *chistics, ulong sql_mode);
|
st_sp_chistics *chistics, ulong sql_mode);
|
||||||
|
@ -422,7 +422,7 @@ sp_pcontext::find_cursor(LEX_STRING *name, uint *poff, my_bool scoped)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
sp_pcontext::retrieve_field_definitions(List<create_field> *field_def_lst)
|
sp_pcontext::retrieve_field_definitions(List<Create_field> *field_def_lst)
|
||||||
{
|
{
|
||||||
/* Put local/context fields in the result list. */
|
/* Put local/context fields in the result list. */
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ typedef struct sp_variable
|
|||||||
uint offset;
|
uint offset;
|
||||||
|
|
||||||
Item *dflt;
|
Item *dflt;
|
||||||
create_field field_def;
|
Create_field field_def;
|
||||||
} sp_variable_t;
|
} sp_variable_t;
|
||||||
|
|
||||||
|
|
||||||
@ -234,7 +234,7 @@ public:
|
|||||||
children.
|
children.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
retrieve_field_definitions(List<create_field> *field_def_lst);
|
retrieve_field_definitions(List<Create_field> *field_def_lst);
|
||||||
|
|
||||||
// Find by name
|
// Find by name
|
||||||
sp_variable_t *
|
sp_variable_t *
|
||||||
|
@ -102,7 +102,7 @@ bool sp_rcontext::init(THD *thd)
|
|||||||
bool
|
bool
|
||||||
sp_rcontext::init_var_table(THD *thd)
|
sp_rcontext::init_var_table(THD *thd)
|
||||||
{
|
{
|
||||||
List<create_field> field_def_lst;
|
List<Create_field> field_def_lst;
|
||||||
|
|
||||||
if (!m_root_parsing_ctx->max_var_index())
|
if (!m_root_parsing_ctx->max_var_index())
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -59,8 +59,8 @@ const char * const THD::DEFAULT_WHERE= "field list";
|
|||||||
/* Used templates */
|
/* Used templates */
|
||||||
template class List<Key>;
|
template class List<Key>;
|
||||||
template class List_iterator<Key>;
|
template class List_iterator<Key>;
|
||||||
template class List<key_part_spec>;
|
template class List<Key_part_spec>;
|
||||||
template class List_iterator<key_part_spec>;
|
template class List_iterator<Key_part_spec>;
|
||||||
template class List<Alter_drop>;
|
template class List<Alter_drop>;
|
||||||
template class List_iterator<Alter_drop>;
|
template class List_iterator<Alter_drop>;
|
||||||
template class List<Alter_column>;
|
template class List<Alter_column>;
|
||||||
@ -86,7 +86,7 @@ extern "C" void free_user_var(user_var_entry *entry)
|
|||||||
my_free((char*) entry,MYF(0));
|
my_free((char*) entry,MYF(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool key_part_spec::operator==(const key_part_spec& other) const
|
bool Key_part_spec::operator==(const Key_part_spec& other) const
|
||||||
{
|
{
|
||||||
return length == other.length && !strcmp(field_name, other.field_name);
|
return length == other.length && !strcmp(field_name, other.field_name);
|
||||||
}
|
}
|
||||||
@ -115,7 +115,7 @@ Key::Key(const Key &rhs, MEM_ROOT *mem_root)
|
|||||||
in THD.
|
in THD.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
foreign_key::foreign_key(const foreign_key &rhs, MEM_ROOT *mem_root)
|
Foreign_key::Foreign_key(const Foreign_key &rhs, MEM_ROOT *mem_root)
|
||||||
:Key(rhs),
|
:Key(rhs),
|
||||||
ref_table(rhs.ref_table),
|
ref_table(rhs.ref_table),
|
||||||
ref_columns(rhs.ref_columns),
|
ref_columns(rhs.ref_columns),
|
||||||
@ -160,9 +160,9 @@ bool foreign_key_prefix(Key *a, Key *b)
|
|||||||
if (a->columns.elements > b->columns.elements)
|
if (a->columns.elements > b->columns.elements)
|
||||||
return TRUE; // Can't be prefix
|
return TRUE; // Can't be prefix
|
||||||
|
|
||||||
List_iterator<key_part_spec> col_it1(a->columns);
|
List_iterator<Key_part_spec> col_it1(a->columns);
|
||||||
List_iterator<key_part_spec> col_it2(b->columns);
|
List_iterator<Key_part_spec> col_it2(b->columns);
|
||||||
const key_part_spec *col1, *col2;
|
const Key_part_spec *col1, *col2;
|
||||||
|
|
||||||
#ifdef ENABLE_WHEN_INNODB_CAN_HANDLE_SWAPED_FOREIGN_KEY_COLUMNS
|
#ifdef ENABLE_WHEN_INNODB_CAN_HANDLE_SWAPED_FOREIGN_KEY_COLUMNS
|
||||||
while ((col1= col_it1++))
|
while ((col1= col_it1++))
|
||||||
|
@ -84,14 +84,14 @@ typedef struct st_copy_info {
|
|||||||
} COPY_INFO;
|
} COPY_INFO;
|
||||||
|
|
||||||
|
|
||||||
class key_part_spec :public Sql_alloc {
|
class Key_part_spec :public Sql_alloc {
|
||||||
public:
|
public:
|
||||||
const char *field_name;
|
const char *field_name;
|
||||||
uint length;
|
uint length;
|
||||||
key_part_spec(const char *name,uint len=0) :field_name(name), length(len) {}
|
Key_part_spec(const char *name,uint len=0) :field_name(name), length(len) {}
|
||||||
bool operator==(const key_part_spec& other) const;
|
bool operator==(const Key_part_spec& other) const;
|
||||||
/**
|
/**
|
||||||
Construct a copy of this key_part_spec. field_name is copied
|
Construct a copy of this Key_part_spec. field_name is copied
|
||||||
by-pointer as it is known to never change. At the same time
|
by-pointer as it is known to never change. At the same time
|
||||||
'length' may be reset in mysql_prepare_create_table, and this
|
'length' may be reset in mysql_prepare_create_table, and this
|
||||||
is why we supply it with a copy.
|
is why we supply it with a copy.
|
||||||
@ -99,8 +99,8 @@ public:
|
|||||||
@return If out of memory, 0 is returned and an error is set in
|
@return If out of memory, 0 is returned and an error is set in
|
||||||
THD.
|
THD.
|
||||||
*/
|
*/
|
||||||
key_part_spec *clone(MEM_ROOT *mem_root) const
|
Key_part_spec *clone(MEM_ROOT *mem_root) const
|
||||||
{ return new (mem_root) key_part_spec(*this); }
|
{ return new (mem_root) Key_part_spec(*this); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ public:
|
|||||||
:name(par_name), type(par_type) {}
|
:name(par_name), type(par_type) {}
|
||||||
/**
|
/**
|
||||||
Used to make a clone of this object for ALTER/CREATE TABLE
|
Used to make a clone of this object for ALTER/CREATE TABLE
|
||||||
@sa comment for key_part_spec::clone
|
@sa comment for Key_part_spec::clone
|
||||||
*/
|
*/
|
||||||
Alter_drop *clone(MEM_ROOT *mem_root) const
|
Alter_drop *clone(MEM_ROOT *mem_root) const
|
||||||
{ return new (mem_root) Alter_drop(*this); }
|
{ return new (mem_root) Alter_drop(*this); }
|
||||||
@ -128,7 +128,7 @@ public:
|
|||||||
:name(par_name), def(literal) {}
|
:name(par_name), def(literal) {}
|
||||||
/**
|
/**
|
||||||
Used to make a clone of this object for ALTER/CREATE TABLE
|
Used to make a clone of this object for ALTER/CREATE TABLE
|
||||||
@sa comment for key_part_spec::clone
|
@sa comment for Key_part_spec::clone
|
||||||
*/
|
*/
|
||||||
Alter_column *clone(MEM_ROOT *mem_root) const
|
Alter_column *clone(MEM_ROOT *mem_root) const
|
||||||
{ return new (mem_root) Alter_column(*this); }
|
{ return new (mem_root) Alter_column(*this); }
|
||||||
@ -140,13 +140,13 @@ public:
|
|||||||
enum Keytype { PRIMARY, UNIQUE, MULTIPLE, FULLTEXT, SPATIAL, FOREIGN_KEY};
|
enum Keytype { PRIMARY, UNIQUE, MULTIPLE, FULLTEXT, SPATIAL, FOREIGN_KEY};
|
||||||
enum Keytype type;
|
enum Keytype type;
|
||||||
KEY_CREATE_INFO key_create_info;
|
KEY_CREATE_INFO key_create_info;
|
||||||
List<key_part_spec> columns;
|
List<Key_part_spec> columns;
|
||||||
const char *name;
|
const char *name;
|
||||||
bool generated;
|
bool generated;
|
||||||
|
|
||||||
Key(enum Keytype type_par, const char *name_arg,
|
Key(enum Keytype type_par, const char *name_arg,
|
||||||
KEY_CREATE_INFO *key_info_arg,
|
KEY_CREATE_INFO *key_info_arg,
|
||||||
bool generated_arg, List<key_part_spec> &cols)
|
bool generated_arg, List<Key_part_spec> &cols)
|
||||||
:type(type_par), key_create_info(*key_info_arg), columns(cols),
|
:type(type_par), key_create_info(*key_info_arg), columns(cols),
|
||||||
name(name_arg), generated(generated_arg)
|
name(name_arg), generated(generated_arg)
|
||||||
{}
|
{}
|
||||||
@ -156,7 +156,7 @@ public:
|
|||||||
friend bool foreign_key_prefix(Key *a, Key *b);
|
friend bool foreign_key_prefix(Key *a, Key *b);
|
||||||
/**
|
/**
|
||||||
Used to make a clone of this object for ALTER/CREATE TABLE
|
Used to make a clone of this object for ALTER/CREATE TABLE
|
||||||
@sa comment for key_part_spec::clone
|
@sa comment for Key_part_spec::clone
|
||||||
*/
|
*/
|
||||||
virtual Key *clone(MEM_ROOT *mem_root) const
|
virtual Key *clone(MEM_ROOT *mem_root) const
|
||||||
{ return new (mem_root) Key(*this, mem_root); }
|
{ return new (mem_root) Key(*this, mem_root); }
|
||||||
@ -164,7 +164,7 @@ public:
|
|||||||
|
|
||||||
class Table_ident;
|
class Table_ident;
|
||||||
|
|
||||||
class foreign_key: public Key {
|
class Foreign_key: public Key {
|
||||||
public:
|
public:
|
||||||
enum fk_match_opt { FK_MATCH_UNDEF, FK_MATCH_FULL,
|
enum fk_match_opt { FK_MATCH_UNDEF, FK_MATCH_FULL,
|
||||||
FK_MATCH_PARTIAL, FK_MATCH_SIMPLE};
|
FK_MATCH_PARTIAL, FK_MATCH_SIMPLE};
|
||||||
@ -172,23 +172,23 @@ public:
|
|||||||
FK_OPTION_SET_NULL, FK_OPTION_NO_ACTION, FK_OPTION_DEFAULT};
|
FK_OPTION_SET_NULL, FK_OPTION_NO_ACTION, FK_OPTION_DEFAULT};
|
||||||
|
|
||||||
Table_ident *ref_table;
|
Table_ident *ref_table;
|
||||||
List<key_part_spec> ref_columns;
|
List<Key_part_spec> ref_columns;
|
||||||
uint delete_opt, update_opt, match_opt;
|
uint delete_opt, update_opt, match_opt;
|
||||||
foreign_key(const char *name_arg, List<key_part_spec> &cols,
|
Foreign_key(const char *name_arg, List<Key_part_spec> &cols,
|
||||||
Table_ident *table, List<key_part_spec> &ref_cols,
|
Table_ident *table, List<Key_part_spec> &ref_cols,
|
||||||
uint delete_opt_arg, uint update_opt_arg, uint match_opt_arg)
|
uint delete_opt_arg, uint update_opt_arg, uint match_opt_arg)
|
||||||
:Key(FOREIGN_KEY, name_arg, &default_key_create_info, 0, cols),
|
:Key(FOREIGN_KEY, name_arg, &default_key_create_info, 0, cols),
|
||||||
ref_table(table), ref_columns(cols),
|
ref_table(table), ref_columns(cols),
|
||||||
delete_opt(delete_opt_arg), update_opt(update_opt_arg),
|
delete_opt(delete_opt_arg), update_opt(update_opt_arg),
|
||||||
match_opt(match_opt_arg)
|
match_opt(match_opt_arg)
|
||||||
{}
|
{}
|
||||||
foreign_key(const foreign_key &rhs, MEM_ROOT *mem_root);
|
Foreign_key(const Foreign_key &rhs, MEM_ROOT *mem_root);
|
||||||
/**
|
/**
|
||||||
Used to make a clone of this object for ALTER/CREATE TABLE
|
Used to make a clone of this object for ALTER/CREATE TABLE
|
||||||
@sa comment for key_part_spec::clone
|
@sa comment for Key_part_spec::clone
|
||||||
*/
|
*/
|
||||||
virtual Key *clone(MEM_ROOT *mem_root) const
|
virtual Key *clone(MEM_ROOT *mem_root) const
|
||||||
{ return new (mem_root) foreign_key(*this, mem_root); }
|
{ return new (mem_root) Foreign_key(*this, mem_root); }
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct st_mysql_lock
|
typedef struct st_mysql_lock
|
||||||
|
@ -3201,7 +3201,7 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
|
|||||||
MYSQL_LOCK **lock,
|
MYSQL_LOCK **lock,
|
||||||
TABLEOP_HOOKS *hooks)
|
TABLEOP_HOOKS *hooks)
|
||||||
{
|
{
|
||||||
TABLE tmp_table; // Used during 'create_field()'
|
TABLE tmp_table; // Used during 'Create_field()'
|
||||||
TABLE_SHARE share;
|
TABLE_SHARE share;
|
||||||
TABLE *table= 0;
|
TABLE *table= 0;
|
||||||
uint select_field_count= items->elements;
|
uint select_field_count= items->elements;
|
||||||
@ -3245,7 +3245,7 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
|
|||||||
|
|
||||||
while ((item=it++))
|
while ((item=it++))
|
||||||
{
|
{
|
||||||
create_field *cr_field;
|
Create_field *cr_field;
|
||||||
Field *field, *def_field;
|
Field *field, *def_field;
|
||||||
if (item->type() == Item::FUNC_ITEM)
|
if (item->type() == Item::FUNC_ITEM)
|
||||||
field= item->tmp_table_field(&tmp_table);
|
field= item->tmp_table_field(&tmp_table);
|
||||||
@ -3254,7 +3254,7 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
|
|||||||
(Item ***) 0, &tmp_field, &def_field, 0, 0, 0, 0,
|
(Item ***) 0, &tmp_field, &def_field, 0, 0, 0, 0,
|
||||||
0);
|
0);
|
||||||
if (!field ||
|
if (!field ||
|
||||||
!(cr_field=new create_field(field,(item->type() == Item::FIELD_ITEM ?
|
!(cr_field=new Create_field(field,(item->type() == Item::FIELD_ITEM ?
|
||||||
((Item_field *)item)->field :
|
((Item_field *)item)->field :
|
||||||
(Field*) 0))))
|
(Field*) 0))))
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
|
@ -1132,7 +1132,7 @@ Alter_info::Alter_info(const Alter_info &rhs, MEM_ROOT *mem_root)
|
|||||||
/*
|
/*
|
||||||
Make deep copies of used objects.
|
Make deep copies of used objects.
|
||||||
This is not a fully deep copy - clone() implementations
|
This is not a fully deep copy - clone() implementations
|
||||||
of Alter_drop, Alter_column, Key, foreign_key, key_part_spec
|
of Alter_drop, Alter_column, Key, foreign_key, Key_part_spec
|
||||||
do not copy string constants. At the same length the only
|
do not copy string constants. At the same length the only
|
||||||
reason we make a copy currently is that ALTER/CREATE TABLE
|
reason we make a copy currently is that ALTER/CREATE TABLE
|
||||||
code changes input Alter_info definitions, but string
|
code changes input Alter_info definitions, but string
|
||||||
|
@ -843,7 +843,7 @@ public:
|
|||||||
List<Alter_drop> drop_list;
|
List<Alter_drop> drop_list;
|
||||||
List<Alter_column> alter_list;
|
List<Alter_column> alter_list;
|
||||||
List<Key> key_list;
|
List<Key> key_list;
|
||||||
List<create_field> create_list;
|
List<Create_field> create_list;
|
||||||
uint flags;
|
uint flags;
|
||||||
enum enum_enable_or_disable keys_onoff;
|
enum enum_enable_or_disable keys_onoff;
|
||||||
enum tablespace_op_type tablespace_op;
|
enum tablespace_op_type tablespace_op;
|
||||||
@ -1132,8 +1132,8 @@ typedef struct st_lex : public Query_tables_list
|
|||||||
*/
|
*/
|
||||||
LEX_USER *definer;
|
LEX_USER *definer;
|
||||||
|
|
||||||
List<key_part_spec> col_list;
|
List<Key_part_spec> col_list;
|
||||||
List<key_part_spec> ref_list;
|
List<Key_part_spec> ref_list;
|
||||||
List<String> interval_list;
|
List<String> interval_list;
|
||||||
List<LEX_USER> users_list;
|
List<LEX_USER> users_list;
|
||||||
List<LEX_COLUMN> columns;
|
List<LEX_COLUMN> columns;
|
||||||
@ -1159,7 +1159,7 @@ typedef struct st_lex : public Query_tables_list
|
|||||||
List<LEX_STRING> db_list;
|
List<LEX_STRING> db_list;
|
||||||
|
|
||||||
SQL_LIST proc_list, auxiliary_table_list, save_list;
|
SQL_LIST proc_list, auxiliary_table_list, save_list;
|
||||||
create_field *last_field;
|
Create_field *last_field;
|
||||||
Item_sum *in_sum_func;
|
Item_sum *in_sum_func;
|
||||||
udf_func udf;
|
udf_func udf;
|
||||||
HA_CHECK_OPT check_opt; // check/repair options
|
HA_CHECK_OPT check_opt; // check/repair options
|
||||||
|
@ -5459,7 +5459,7 @@ bool add_field_to_list(THD *thd, LEX_STRING *field_name, enum_field_types type,
|
|||||||
List<String> *interval_list, CHARSET_INFO *cs,
|
List<String> *interval_list, CHARSET_INFO *cs,
|
||||||
uint uint_geom_type)
|
uint uint_geom_type)
|
||||||
{
|
{
|
||||||
register create_field *new_field;
|
register Create_field *new_field;
|
||||||
LEX *lex= thd->lex;
|
LEX *lex= thd->lex;
|
||||||
DBUG_ENTER("add_field_to_list");
|
DBUG_ENTER("add_field_to_list");
|
||||||
|
|
||||||
@ -5472,7 +5472,7 @@ bool add_field_to_list(THD *thd, LEX_STRING *field_name, enum_field_types type,
|
|||||||
if (type_modifier & PRI_KEY_FLAG)
|
if (type_modifier & PRI_KEY_FLAG)
|
||||||
{
|
{
|
||||||
Key *key;
|
Key *key;
|
||||||
lex->col_list.push_back(new key_part_spec(field_name->str, 0));
|
lex->col_list.push_back(new Key_part_spec(field_name->str, 0));
|
||||||
key= new Key(Key::PRIMARY, NullS,
|
key= new Key(Key::PRIMARY, NullS,
|
||||||
&default_key_create_info,
|
&default_key_create_info,
|
||||||
0, lex->col_list);
|
0, lex->col_list);
|
||||||
@ -5482,7 +5482,7 @@ bool add_field_to_list(THD *thd, LEX_STRING *field_name, enum_field_types type,
|
|||||||
if (type_modifier & (UNIQUE_FLAG | UNIQUE_KEY_FLAG))
|
if (type_modifier & (UNIQUE_FLAG | UNIQUE_KEY_FLAG))
|
||||||
{
|
{
|
||||||
Key *key;
|
Key *key;
|
||||||
lex->col_list.push_back(new key_part_spec(field_name->str, 0));
|
lex->col_list.push_back(new Key_part_spec(field_name->str, 0));
|
||||||
key= new Key(Key::UNIQUE, NullS,
|
key= new Key(Key::UNIQUE, NullS,
|
||||||
&default_key_create_info, 0,
|
&default_key_create_info, 0,
|
||||||
lex->col_list);
|
lex->col_list);
|
||||||
@ -5540,7 +5540,7 @@ bool add_field_to_list(THD *thd, LEX_STRING *field_name, enum_field_types type,
|
|||||||
WARN_DEPRECATED(thd, "5.2", buf, "'TIMESTAMP'");
|
WARN_DEPRECATED(thd, "5.2", buf, "'TIMESTAMP'");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(new_field= new create_field()) ||
|
if (!(new_field= new Create_field()) ||
|
||||||
new_field->init(thd, field_name->str, type, length, decimals, type_modifier,
|
new_field->init(thd, field_name->str, type, length, decimals, type_modifier,
|
||||||
default_value, on_update_value, comment, change,
|
default_value, on_update_value, comment, change,
|
||||||
interval_list, cs, uint_geom_type))
|
interval_list, cs, uint_geom_type))
|
||||||
|
@ -10024,12 +10024,12 @@ err:
|
|||||||
0 if out of memory, TABLE object in case of success
|
0 if out of memory, TABLE object in case of success
|
||||||
*/
|
*/
|
||||||
|
|
||||||
TABLE *create_virtual_tmp_table(THD *thd, List<create_field> &field_list)
|
TABLE *create_virtual_tmp_table(THD *thd, List<Create_field> &field_list)
|
||||||
{
|
{
|
||||||
uint field_count= field_list.elements;
|
uint field_count= field_list.elements;
|
||||||
uint blob_count= 0;
|
uint blob_count= 0;
|
||||||
Field **field;
|
Field **field;
|
||||||
create_field *cdef; /* column definition */
|
Create_field *cdef; /* column definition */
|
||||||
uint record_length= 0;
|
uint record_length= 0;
|
||||||
uint null_count= 0; /* number of columns which may be null */
|
uint null_count= 0; /* number of columns which may be null */
|
||||||
uint null_pack_length; /* NULL representation array length */
|
uint null_pack_length; /* NULL representation array length */
|
||||||
@ -10057,7 +10057,7 @@ TABLE *create_virtual_tmp_table(THD *thd, List<create_field> &field_list)
|
|||||||
setup_tmp_table_column_bitmaps(table, bitmaps);
|
setup_tmp_table_column_bitmaps(table, bitmaps);
|
||||||
|
|
||||||
/* Create all fields and calculate the total length of record */
|
/* Create all fields and calculate the total length of record */
|
||||||
List_iterator_fast<create_field> it(field_list);
|
List_iterator_fast<Create_field> it(field_list);
|
||||||
while ((cdef= it++))
|
while ((cdef= it++))
|
||||||
{
|
{
|
||||||
*field= make_field(share, 0, cdef->length,
|
*field= make_field(share, 0, cdef->length,
|
||||||
|
@ -34,12 +34,12 @@ const char *primary_key_name="PRIMARY";
|
|||||||
static bool check_if_keyname_exists(const char *name,KEY *start, KEY *end);
|
static bool check_if_keyname_exists(const char *name,KEY *start, KEY *end);
|
||||||
static char *make_unique_key_name(const char *field_name,KEY *start,KEY *end);
|
static char *make_unique_key_name(const char *field_name,KEY *start,KEY *end);
|
||||||
static int copy_data_between_tables(TABLE *from,TABLE *to,
|
static int copy_data_between_tables(TABLE *from,TABLE *to,
|
||||||
List<create_field> &create, bool ignore,
|
List<Create_field> &create, bool ignore,
|
||||||
uint order_num, ORDER *order,
|
uint order_num, ORDER *order,
|
||||||
ha_rows *copied,ha_rows *deleted,
|
ha_rows *copied,ha_rows *deleted,
|
||||||
enum enum_enable_or_disable keys_onoff);
|
enum enum_enable_or_disable keys_onoff);
|
||||||
|
|
||||||
static bool prepare_blob_field(THD *thd, create_field *sql_field);
|
static bool prepare_blob_field(THD *thd, Create_field *sql_field);
|
||||||
static bool check_engine(THD *, const char *, HA_CREATE_INFO *);
|
static bool check_engine(THD *, const char *, HA_CREATE_INFO *);
|
||||||
static bool
|
static bool
|
||||||
mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
||||||
@ -1920,7 +1920,7 @@ void calculate_interval_lengths(CHARSET_INFO *cs, TYPELIB *interval,
|
|||||||
table_flags table flags
|
table_flags table flags
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
This function prepares a create_field instance.
|
This function prepares a Create_field instance.
|
||||||
Fields such as pack_flag are valid after this call.
|
Fields such as pack_flag are valid after this call.
|
||||||
|
|
||||||
RETURN VALUES
|
RETURN VALUES
|
||||||
@ -1928,7 +1928,7 @@ void calculate_interval_lengths(CHARSET_INFO *cs, TYPELIB *interval,
|
|||||||
1 Error
|
1 Error
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int prepare_create_field(create_field *sql_field,
|
int prepare_create_field(Create_field *sql_field,
|
||||||
uint *blob_columns,
|
uint *blob_columns,
|
||||||
int *timestamps, int *timestamps_with_niladic,
|
int *timestamps, int *timestamps_with_niladic,
|
||||||
longlong table_flags)
|
longlong table_flags)
|
||||||
@ -2119,7 +2119,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||||||
uint *key_count, int select_field_count)
|
uint *key_count, int select_field_count)
|
||||||
{
|
{
|
||||||
const char *key_name;
|
const char *key_name;
|
||||||
create_field *sql_field,*dup_field;
|
Create_field *sql_field,*dup_field;
|
||||||
uint field,null_fields,blob_columns,max_key_length;
|
uint field,null_fields,blob_columns,max_key_length;
|
||||||
ulong record_offset= 0;
|
ulong record_offset= 0;
|
||||||
KEY *key_info;
|
KEY *key_info;
|
||||||
@ -2127,8 +2127,8 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||||||
int timestamps= 0, timestamps_with_niladic= 0;
|
int timestamps= 0, timestamps_with_niladic= 0;
|
||||||
int field_no,dup_no;
|
int field_no,dup_no;
|
||||||
int select_field_pos,auto_increment=0;
|
int select_field_pos,auto_increment=0;
|
||||||
List_iterator<create_field> it(alter_info->create_list);
|
List_iterator<Create_field> it(alter_info->create_list);
|
||||||
List_iterator<create_field> it2(alter_info->create_list);
|
List_iterator<Create_field> it2(alter_info->create_list);
|
||||||
uint total_uneven_bit_length= 0;
|
uint total_uneven_bit_length= 0;
|
||||||
DBUG_ENTER("mysql_prepare_create_table");
|
DBUG_ENTER("mysql_prepare_create_table");
|
||||||
|
|
||||||
@ -2182,7 +2182,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||||||
sql_field->sql_type == MYSQL_TYPE_ENUM))
|
sql_field->sql_type == MYSQL_TYPE_ENUM))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
Starting from 5.1 we work here with a copy of create_field
|
Starting from 5.1 we work here with a copy of Create_field
|
||||||
created by the caller, not with the instance that was
|
created by the caller, not with the instance that was
|
||||||
originally created during parsing. It's OK to create
|
originally created during parsing. It's OK to create
|
||||||
a temporary item and initialize with it a member of the
|
a temporary item and initialize with it a member of the
|
||||||
@ -2473,7 +2473,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||||||
if (key->type == Key::FOREIGN_KEY)
|
if (key->type == Key::FOREIGN_KEY)
|
||||||
{
|
{
|
||||||
fk_key_count++;
|
fk_key_count++;
|
||||||
foreign_key *fk_key= (foreign_key*) key;
|
Foreign_key *fk_key= (Foreign_key*) key;
|
||||||
if (fk_key->ref_columns.elements &&
|
if (fk_key->ref_columns.elements &&
|
||||||
fk_key->ref_columns.elements != fk_key->columns.elements)
|
fk_key->ref_columns.elements != fk_key->columns.elements)
|
||||||
{
|
{
|
||||||
@ -2557,7 +2557,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||||||
for (; (key=key_iterator++) ; key_number++)
|
for (; (key=key_iterator++) ; key_number++)
|
||||||
{
|
{
|
||||||
uint key_length=0;
|
uint key_length=0;
|
||||||
key_part_spec *column;
|
Key_part_spec *column;
|
||||||
|
|
||||||
if (key->name == ignore_key)
|
if (key->name == ignore_key)
|
||||||
{
|
{
|
||||||
@ -2666,12 +2666,12 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||||||
if (key_info->block_size)
|
if (key_info->block_size)
|
||||||
key_info->flags|= HA_USES_BLOCK_SIZE;
|
key_info->flags|= HA_USES_BLOCK_SIZE;
|
||||||
|
|
||||||
List_iterator<key_part_spec> cols(key->columns), cols2(key->columns);
|
List_iterator<Key_part_spec> cols(key->columns), cols2(key->columns);
|
||||||
CHARSET_INFO *ft_key_charset=0; // for FULLTEXT
|
CHARSET_INFO *ft_key_charset=0; // for FULLTEXT
|
||||||
for (uint column_nr=0 ; (column=cols++) ; column_nr++)
|
for (uint column_nr=0 ; (column=cols++) ; column_nr++)
|
||||||
{
|
{
|
||||||
uint length;
|
uint length;
|
||||||
key_part_spec *dup_column;
|
Key_part_spec *dup_column;
|
||||||
|
|
||||||
it.rewind();
|
it.rewind();
|
||||||
field=0;
|
field=0;
|
||||||
@ -2981,7 +2981,7 @@ static void set_table_default_charset(THD *thd,
|
|||||||
In this case the error is given
|
In this case the error is given
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static bool prepare_blob_field(THD *thd, create_field *sql_field)
|
static bool prepare_blob_field(THD *thd, Create_field *sql_field)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("prepare_blob_field");
|
DBUG_ENTER("prepare_blob_field");
|
||||||
|
|
||||||
@ -3022,7 +3022,7 @@ static bool prepare_blob_field(THD *thd, create_field *sql_field)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Preparation of create_field for SP function return values.
|
Preparation of Create_field for SP function return values.
|
||||||
Based on code used in the inner loop of mysql_prepare_create_table()
|
Based on code used in the inner loop of mysql_prepare_create_table()
|
||||||
above.
|
above.
|
||||||
|
|
||||||
@ -3036,7 +3036,7 @@ static bool prepare_blob_field(THD *thd, create_field *sql_field)
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void sp_prepare_create_field(THD *thd, create_field *sql_field)
|
void sp_prepare_create_field(THD *thd, Create_field *sql_field)
|
||||||
{
|
{
|
||||||
if (sql_field->sql_type == MYSQL_TYPE_SET ||
|
if (sql_field->sql_type == MYSQL_TYPE_SET ||
|
||||||
sql_field->sql_type == MYSQL_TYPE_ENUM)
|
sql_field->sql_type == MYSQL_TYPE_ENUM)
|
||||||
@ -4928,8 +4928,8 @@ compare_tables(TABLE *table,
|
|||||||
Field **f_ptr, *field;
|
Field **f_ptr, *field;
|
||||||
uint changes= 0, tmp;
|
uint changes= 0, tmp;
|
||||||
uint key_count;
|
uint key_count;
|
||||||
List_iterator_fast<create_field> new_field_it(alter_info->create_list);
|
List_iterator_fast<Create_field> new_field_it(alter_info->create_list);
|
||||||
create_field *new_field;
|
Create_field *new_field;
|
||||||
KEY_PART_INFO *key_part;
|
KEY_PART_INFO *key_part;
|
||||||
KEY_PART_INFO *end;
|
KEY_PART_INFO *end;
|
||||||
/*
|
/*
|
||||||
@ -5276,16 +5276,16 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
|||||||
Alter_info *alter_info)
|
Alter_info *alter_info)
|
||||||
{
|
{
|
||||||
/* New column definitions are added here */
|
/* New column definitions are added here */
|
||||||
List<create_field> new_create_list;
|
List<Create_field> new_create_list;
|
||||||
/* New key definitions are added here */
|
/* New key definitions are added here */
|
||||||
List<Key> new_key_list;
|
List<Key> new_key_list;
|
||||||
List_iterator<Alter_drop> drop_it(alter_info->drop_list);
|
List_iterator<Alter_drop> drop_it(alter_info->drop_list);
|
||||||
List_iterator<create_field> def_it(alter_info->create_list);
|
List_iterator<Create_field> def_it(alter_info->create_list);
|
||||||
List_iterator<Alter_column> alter_it(alter_info->alter_list);
|
List_iterator<Alter_column> alter_it(alter_info->alter_list);
|
||||||
List_iterator<Key> key_it(alter_info->key_list);
|
List_iterator<Key> key_it(alter_info->key_list);
|
||||||
List_iterator<create_field> find_it(new_create_list);
|
List_iterator<Create_field> find_it(new_create_list);
|
||||||
List_iterator<create_field> field_it(new_create_list);
|
List_iterator<Create_field> field_it(new_create_list);
|
||||||
List<key_part_spec> key_parts;
|
List<Key_part_spec> key_parts;
|
||||||
uint db_create_options= (table->s->db_create_options
|
uint db_create_options= (table->s->db_create_options
|
||||||
& ~(HA_OPTION_PACK_RECORD));
|
& ~(HA_OPTION_PACK_RECORD));
|
||||||
uint used_fields= create_info->used_fields;
|
uint used_fields= create_info->used_fields;
|
||||||
@ -5325,7 +5325,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
|||||||
create_info->tablespace= tablespace;
|
create_info->tablespace= tablespace;
|
||||||
}
|
}
|
||||||
restore_record(table, s->default_values); // Empty record for DEFAULT
|
restore_record(table, s->default_values); // Empty record for DEFAULT
|
||||||
create_field *def;
|
Create_field *def;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
First collect all fields from table which isn't in drop_list
|
First collect all fields from table which isn't in drop_list
|
||||||
@ -5381,7 +5381,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
|||||||
This field was not dropped and not changed, add it to the list
|
This field was not dropped and not changed, add it to the list
|
||||||
for the new table.
|
for the new table.
|
||||||
*/
|
*/
|
||||||
def= new create_field(field, field);
|
def= new Create_field(field, field);
|
||||||
new_create_list.push_back(def);
|
new_create_list.push_back(def);
|
||||||
alter_it.rewind(); // Change default if ALTER
|
alter_it.rewind(); // Change default if ALTER
|
||||||
Alter_column *alter;
|
Alter_column *alter;
|
||||||
@ -5419,7 +5419,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
|||||||
new_create_list.push_front(def);
|
new_create_list.push_front(def);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
create_field *find;
|
Create_field *find;
|
||||||
find_it.rewind();
|
find_it.rewind();
|
||||||
while ((find=find_it++)) // Add new columns
|
while ((find=find_it++)) // Add new columns
|
||||||
{
|
{
|
||||||
@ -5476,7 +5476,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
|||||||
if (!key_part->field)
|
if (!key_part->field)
|
||||||
continue; // Wrong field (from UNIREG)
|
continue; // Wrong field (from UNIREG)
|
||||||
const char *key_part_name=key_part->field->field_name;
|
const char *key_part_name=key_part->field->field_name;
|
||||||
create_field *cfield;
|
Create_field *cfield;
|
||||||
field_it.rewind();
|
field_it.rewind();
|
||||||
while ((cfield=field_it++))
|
while ((cfield=field_it++))
|
||||||
{
|
{
|
||||||
@ -5518,7 +5518,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
|||||||
key_part_length= 0; // Use whole field
|
key_part_length= 0; // Use whole field
|
||||||
}
|
}
|
||||||
key_part_length /= key_part->field->charset()->mbmaxlen;
|
key_part_length /= key_part->field->charset()->mbmaxlen;
|
||||||
key_parts.push_back(new key_part_spec(cfield->field_name,
|
key_parts.push_back(new Key_part_spec(cfield->field_name,
|
||||||
key_part_length));
|
key_part_length));
|
||||||
}
|
}
|
||||||
if (key_parts.elements)
|
if (key_parts.elements)
|
||||||
@ -6687,7 +6687,7 @@ err_with_placeholders:
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
copy_data_between_tables(TABLE *from,TABLE *to,
|
copy_data_between_tables(TABLE *from,TABLE *to,
|
||||||
List<create_field> &create,
|
List<Create_field> &create,
|
||||||
bool ignore,
|
bool ignore,
|
||||||
uint order_num, ORDER *order,
|
uint order_num, ORDER *order,
|
||||||
ha_rows *copied,
|
ha_rows *copied,
|
||||||
@ -6740,8 +6740,8 @@ copy_data_between_tables(TABLE *from,TABLE *to,
|
|||||||
|
|
||||||
save_sql_mode= thd->variables.sql_mode;
|
save_sql_mode= thd->variables.sql_mode;
|
||||||
|
|
||||||
List_iterator<create_field> it(create);
|
List_iterator<Create_field> it(create);
|
||||||
create_field *def;
|
Create_field *def;
|
||||||
copy_end=copy;
|
copy_end=copy;
|
||||||
for (Field **ptr=to->field ; *ptr ; ptr++)
|
for (Field **ptr=to->field ; *ptr ; ptr++)
|
||||||
{
|
{
|
||||||
|
@ -456,7 +456,7 @@ Item* handle_sql2003_note184_exception(THD *thd, Item* left, bool equal,
|
|||||||
List<Item> *item_list;
|
List<Item> *item_list;
|
||||||
List<String> *string_list;
|
List<String> *string_list;
|
||||||
String *string;
|
String *string;
|
||||||
key_part_spec *key_part;
|
Key_part_spec *key_part;
|
||||||
TABLE_LIST *table_list;
|
TABLE_LIST *table_list;
|
||||||
udf_func *udf;
|
udf_func *udf;
|
||||||
LEX_USER *lex_user;
|
LEX_USER *lex_user;
|
||||||
@ -4498,7 +4498,7 @@ key_def:
|
|||||||
{
|
{
|
||||||
LEX *lex=Lex;
|
LEX *lex=Lex;
|
||||||
const char *key_name= $4 ? $4 : $1;
|
const char *key_name= $4 ? $4 : $1;
|
||||||
Key *key= new foreign_key(key_name, lex->col_list,
|
Key *key= new Foreign_key(key_name, lex->col_list,
|
||||||
$8,
|
$8,
|
||||||
lex->ref_list,
|
lex->ref_list,
|
||||||
lex->fk_delete_opt,
|
lex->fk_delete_opt,
|
||||||
@ -4925,8 +4925,8 @@ opt_ref_list:
|
|||||||
| '(' ref_list ')' opt_on_delete {};
|
| '(' ref_list ')' opt_on_delete {};
|
||||||
|
|
||||||
ref_list:
|
ref_list:
|
||||||
ref_list ',' ident { Lex->ref_list.push_back(new key_part_spec($3.str)); }
|
ref_list ',' ident { Lex->ref_list.push_back(new Key_part_spec($3.str)); }
|
||||||
| ident { Lex->ref_list.push_back(new key_part_spec($1.str)); };
|
| ident { Lex->ref_list.push_back(new Key_part_spec($1.str)); };
|
||||||
|
|
||||||
|
|
||||||
opt_on_delete:
|
opt_on_delete:
|
||||||
@ -4940,16 +4940,16 @@ opt_on_delete_list:
|
|||||||
opt_on_delete_item:
|
opt_on_delete_item:
|
||||||
ON DELETE_SYM delete_option { Lex->fk_delete_opt= $3; }
|
ON DELETE_SYM delete_option { Lex->fk_delete_opt= $3; }
|
||||||
| ON UPDATE_SYM delete_option { Lex->fk_update_opt= $3; }
|
| ON UPDATE_SYM delete_option { Lex->fk_update_opt= $3; }
|
||||||
| MATCH FULL { Lex->fk_match_option= foreign_key::FK_MATCH_FULL; }
|
| MATCH FULL { Lex->fk_match_option= Foreign_key::FK_MATCH_FULL; }
|
||||||
| MATCH PARTIAL { Lex->fk_match_option= foreign_key::FK_MATCH_PARTIAL; }
|
| MATCH PARTIAL { Lex->fk_match_option= Foreign_key::FK_MATCH_PARTIAL; }
|
||||||
| MATCH SIMPLE_SYM { Lex->fk_match_option= foreign_key::FK_MATCH_SIMPLE; };
|
| MATCH SIMPLE_SYM { Lex->fk_match_option= Foreign_key::FK_MATCH_SIMPLE; };
|
||||||
|
|
||||||
delete_option:
|
delete_option:
|
||||||
RESTRICT { $$= (int) foreign_key::FK_OPTION_RESTRICT; }
|
RESTRICT { $$= (int) Foreign_key::FK_OPTION_RESTRICT; }
|
||||||
| CASCADE { $$= (int) foreign_key::FK_OPTION_CASCADE; }
|
| CASCADE { $$= (int) Foreign_key::FK_OPTION_CASCADE; }
|
||||||
| SET NULL_SYM { $$= (int) foreign_key::FK_OPTION_SET_NULL; }
|
| SET NULL_SYM { $$= (int) Foreign_key::FK_OPTION_SET_NULL; }
|
||||||
| NO_SYM ACTION { $$= (int) foreign_key::FK_OPTION_NO_ACTION; }
|
| NO_SYM ACTION { $$= (int) Foreign_key::FK_OPTION_NO_ACTION; }
|
||||||
| SET DEFAULT { $$= (int) foreign_key::FK_OPTION_DEFAULT; };
|
| SET DEFAULT { $$= (int) Foreign_key::FK_OPTION_DEFAULT; };
|
||||||
|
|
||||||
key_type:
|
key_type:
|
||||||
key_or_index { $$= Key::MULTIPLE; }
|
key_or_index { $$= Key::MULTIPLE; }
|
||||||
@ -5061,7 +5061,7 @@ key_list:
|
|||||||
| key_part order_dir { Lex->col_list.push_back($1); };
|
| key_part order_dir { Lex->col_list.push_back($1); };
|
||||||
|
|
||||||
key_part:
|
key_part:
|
||||||
ident { $$=new key_part_spec($1.str); }
|
ident { $$=new Key_part_spec($1.str); }
|
||||||
| ident '(' NUM ')'
|
| ident '(' NUM ')'
|
||||||
{
|
{
|
||||||
int key_part_len= atoi($3.str);
|
int key_part_len= atoi($3.str);
|
||||||
@ -5069,7 +5069,7 @@ key_part:
|
|||||||
{
|
{
|
||||||
my_error(ER_KEY_PART_0, MYF(0), $1.str);
|
my_error(ER_KEY_PART_0, MYF(0), $1.str);
|
||||||
}
|
}
|
||||||
$$=new key_part_spec($1.str,(uint) key_part_len);
|
$$=new Key_part_spec($1.str,(uint) key_part_len);
|
||||||
};
|
};
|
||||||
|
|
||||||
opt_ident:
|
opt_ident:
|
||||||
|
@ -29,21 +29,21 @@
|
|||||||
|
|
||||||
#define FCOMP 17 /* Bytes for a packed field */
|
#define FCOMP 17 /* Bytes for a packed field */
|
||||||
|
|
||||||
static uchar * pack_screens(List<create_field> &create_fields,
|
static uchar * pack_screens(List<Create_field> &create_fields,
|
||||||
uint *info_length, uint *screens, bool small_file);
|
uint *info_length, uint *screens, bool small_file);
|
||||||
static uint pack_keys(uchar *keybuff,uint key_count, KEY *key_info,
|
static uint pack_keys(uchar *keybuff,uint key_count, KEY *key_info,
|
||||||
ulong data_offset);
|
ulong data_offset);
|
||||||
static bool pack_header(uchar *forminfo,enum legacy_db_type table_type,
|
static bool pack_header(uchar *forminfo,enum legacy_db_type table_type,
|
||||||
List<create_field> &create_fields,
|
List<Create_field> &create_fields,
|
||||||
uint info_length, uint screens, uint table_options,
|
uint info_length, uint screens, uint table_options,
|
||||||
ulong data_offset, handler *file);
|
ulong data_offset, handler *file);
|
||||||
static uint get_interval_id(uint *int_count,List<create_field> &create_fields,
|
static uint get_interval_id(uint *int_count,List<Create_field> &create_fields,
|
||||||
create_field *last_field);
|
Create_field *last_field);
|
||||||
static bool pack_fields(File file, List<create_field> &create_fields,
|
static bool pack_fields(File file, List<Create_field> &create_fields,
|
||||||
ulong data_offset);
|
ulong data_offset);
|
||||||
static bool make_empty_rec(THD *thd, int file, enum legacy_db_type table_type,
|
static bool make_empty_rec(THD *thd, int file, enum legacy_db_type table_type,
|
||||||
uint table_options,
|
uint table_options,
|
||||||
List<create_field> &create_fields,
|
List<Create_field> &create_fields,
|
||||||
uint reclength, ulong data_offset,
|
uint reclength, ulong data_offset,
|
||||||
handler *handler);
|
handler *handler);
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ static bool make_empty_rec(THD *thd, int file, enum legacy_db_type table_type,
|
|||||||
bool mysql_create_frm(THD *thd, const char *file_name,
|
bool mysql_create_frm(THD *thd, const char *file_name,
|
||||||
const char *db, const char *table,
|
const char *db, const char *table,
|
||||||
HA_CREATE_INFO *create_info,
|
HA_CREATE_INFO *create_info,
|
||||||
List<create_field> &create_fields,
|
List<Create_field> &create_fields,
|
||||||
uint keys, KEY *key_info,
|
uint keys, KEY *key_info,
|
||||||
handler *db_file)
|
handler *db_file)
|
||||||
{
|
{
|
||||||
@ -294,8 +294,8 @@ bool mysql_create_frm(THD *thd, const char *file_name,
|
|||||||
Restore all UCS2 intervals.
|
Restore all UCS2 intervals.
|
||||||
HEX representation of them is not needed anymore.
|
HEX representation of them is not needed anymore.
|
||||||
*/
|
*/
|
||||||
List_iterator<create_field> it(create_fields);
|
List_iterator<Create_field> it(create_fields);
|
||||||
create_field *field;
|
Create_field *field;
|
||||||
while ((field=it++))
|
while ((field=it++))
|
||||||
{
|
{
|
||||||
if (field->save_interval)
|
if (field->save_interval)
|
||||||
@ -341,7 +341,7 @@ err3:
|
|||||||
int rea_create_table(THD *thd, const char *path,
|
int rea_create_table(THD *thd, const char *path,
|
||||||
const char *db, const char *table_name,
|
const char *db, const char *table_name,
|
||||||
HA_CREATE_INFO *create_info,
|
HA_CREATE_INFO *create_info,
|
||||||
List<create_field> &create_fields,
|
List<Create_field> &create_fields,
|
||||||
uint keys, KEY *key_info, handler *file)
|
uint keys, KEY *key_info, handler *file)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("rea_create_table");
|
DBUG_ENTER("rea_create_table");
|
||||||
@ -371,7 +371,7 @@ err_handler:
|
|||||||
|
|
||||||
/* Pack screens to a screen for save in a form-file */
|
/* Pack screens to a screen for save in a form-file */
|
||||||
|
|
||||||
static uchar *pack_screens(List<create_field> &create_fields,
|
static uchar *pack_screens(List<Create_field> &create_fields,
|
||||||
uint *info_length, uint *screens,
|
uint *info_length, uint *screens,
|
||||||
bool small_file)
|
bool small_file)
|
||||||
{
|
{
|
||||||
@ -380,7 +380,7 @@ static uchar *pack_screens(List<create_field> &create_fields,
|
|||||||
uint length,cols;
|
uint length,cols;
|
||||||
uchar *info,*pos,*start_screen;
|
uchar *info,*pos,*start_screen;
|
||||||
uint fields=create_fields.elements;
|
uint fields=create_fields.elements;
|
||||||
List_iterator<create_field> it(create_fields);
|
List_iterator<Create_field> it(create_fields);
|
||||||
DBUG_ENTER("pack_screens");
|
DBUG_ENTER("pack_screens");
|
||||||
|
|
||||||
start_row=4; end_row=22; cols=80; fields_on_screen=end_row+1-start_row;
|
start_row=4; end_row=22; cols=80; fields_on_screen=end_row+1-start_row;
|
||||||
@ -388,7 +388,7 @@ static uchar *pack_screens(List<create_field> &create_fields,
|
|||||||
*screens=(fields-1)/fields_on_screen+1;
|
*screens=(fields-1)/fields_on_screen+1;
|
||||||
length= (*screens) * (SC_INFO_LENGTH+ (cols>> 1)+4);
|
length= (*screens) * (SC_INFO_LENGTH+ (cols>> 1)+4);
|
||||||
|
|
||||||
create_field *field;
|
Create_field *field;
|
||||||
while ((field=it++))
|
while ((field=it++))
|
||||||
length+=(uint) strlen(field->field_name)+1+TE_INFO_LENGTH+cols/2;
|
length+=(uint) strlen(field->field_name)+1+TE_INFO_LENGTH+cols/2;
|
||||||
|
|
||||||
@ -401,7 +401,7 @@ static uchar *pack_screens(List<create_field> &create_fields,
|
|||||||
it.rewind();
|
it.rewind();
|
||||||
for (i=0 ; i < fields ; i++)
|
for (i=0 ; i < fields ; i++)
|
||||||
{
|
{
|
||||||
create_field *cfield=it++;
|
Create_field *cfield=it++;
|
||||||
if (row++ == end_row)
|
if (row++ == end_row)
|
||||||
{
|
{
|
||||||
if (i)
|
if (i)
|
||||||
@ -521,7 +521,7 @@ static uint pack_keys(uchar *keybuff, uint key_count, KEY *keyinfo,
|
|||||||
/* Make formheader */
|
/* Make formheader */
|
||||||
|
|
||||||
static bool pack_header(uchar *forminfo, enum legacy_db_type table_type,
|
static bool pack_header(uchar *forminfo, enum legacy_db_type table_type,
|
||||||
List<create_field> &create_fields,
|
List<Create_field> &create_fields,
|
||||||
uint info_length, uint screens, uint table_options,
|
uint info_length, uint screens, uint table_options,
|
||||||
ulong data_offset, handler *file)
|
ulong data_offset, handler *file)
|
||||||
{
|
{
|
||||||
@ -544,8 +544,8 @@ static bool pack_header(uchar *forminfo, enum legacy_db_type table_type,
|
|||||||
|
|
||||||
/* Check fields */
|
/* Check fields */
|
||||||
|
|
||||||
List_iterator<create_field> it(create_fields);
|
List_iterator<Create_field> it(create_fields);
|
||||||
create_field *field;
|
Create_field *field;
|
||||||
while ((field=it++))
|
while ((field=it++))
|
||||||
{
|
{
|
||||||
uint tmp_len= system_charset_info->cset->charpos(system_charset_info,
|
uint tmp_len= system_charset_info->cset->charpos(system_charset_info,
|
||||||
@ -687,11 +687,11 @@ static bool pack_header(uchar *forminfo, enum legacy_db_type table_type,
|
|||||||
|
|
||||||
/* get each unique interval each own id */
|
/* get each unique interval each own id */
|
||||||
|
|
||||||
static uint get_interval_id(uint *int_count,List<create_field> &create_fields,
|
static uint get_interval_id(uint *int_count,List<Create_field> &create_fields,
|
||||||
create_field *last_field)
|
Create_field *last_field)
|
||||||
{
|
{
|
||||||
List_iterator<create_field> it(create_fields);
|
List_iterator<Create_field> it(create_fields);
|
||||||
create_field *field;
|
Create_field *field;
|
||||||
TYPELIB *interval=last_field->interval;
|
TYPELIB *interval=last_field->interval;
|
||||||
|
|
||||||
while ((field=it++) != last_field)
|
while ((field=it++) != last_field)
|
||||||
@ -715,18 +715,18 @@ static uint get_interval_id(uint *int_count,List<create_field> &create_fields,
|
|||||||
|
|
||||||
/* Save fields, fieldnames and intervals */
|
/* Save fields, fieldnames and intervals */
|
||||||
|
|
||||||
static bool pack_fields(File file, List<create_field> &create_fields,
|
static bool pack_fields(File file, List<Create_field> &create_fields,
|
||||||
ulong data_offset)
|
ulong data_offset)
|
||||||
{
|
{
|
||||||
reg2 uint i;
|
reg2 uint i;
|
||||||
uint int_count, comment_length=0;
|
uint int_count, comment_length=0;
|
||||||
uchar buff[MAX_FIELD_WIDTH];
|
uchar buff[MAX_FIELD_WIDTH];
|
||||||
create_field *field;
|
Create_field *field;
|
||||||
DBUG_ENTER("pack_fields");
|
DBUG_ENTER("pack_fields");
|
||||||
|
|
||||||
/* Write field info */
|
/* Write field info */
|
||||||
|
|
||||||
List_iterator<create_field> it(create_fields);
|
List_iterator<Create_field> it(create_fields);
|
||||||
|
|
||||||
int_count=0;
|
int_count=0;
|
||||||
while ((field=it++))
|
while ((field=it++))
|
||||||
@ -856,7 +856,7 @@ static bool pack_fields(File file, List<create_field> &create_fields,
|
|||||||
|
|
||||||
static bool make_empty_rec(THD *thd, File file,enum legacy_db_type table_type,
|
static bool make_empty_rec(THD *thd, File file,enum legacy_db_type table_type,
|
||||||
uint table_options,
|
uint table_options,
|
||||||
List<create_field> &create_fields,
|
List<Create_field> &create_fields,
|
||||||
uint reclength,
|
uint reclength,
|
||||||
ulong data_offset,
|
ulong data_offset,
|
||||||
handler *handler)
|
handler *handler)
|
||||||
@ -867,7 +867,7 @@ static bool make_empty_rec(THD *thd, File file,enum legacy_db_type table_type,
|
|||||||
uchar *buff,*null_pos;
|
uchar *buff,*null_pos;
|
||||||
TABLE table;
|
TABLE table;
|
||||||
TABLE_SHARE share;
|
TABLE_SHARE share;
|
||||||
create_field *field;
|
Create_field *field;
|
||||||
enum_check_fields old_count_cuted_fields= thd->count_cuted_fields;
|
enum_check_fields old_count_cuted_fields= thd->count_cuted_fields;
|
||||||
DBUG_ENTER("make_empty_rec");
|
DBUG_ENTER("make_empty_rec");
|
||||||
|
|
||||||
@ -893,7 +893,7 @@ static bool make_empty_rec(THD *thd, File file,enum legacy_db_type table_type,
|
|||||||
}
|
}
|
||||||
null_pos= buff;
|
null_pos= buff;
|
||||||
|
|
||||||
List_iterator<create_field> it(create_fields);
|
List_iterator<Create_field> it(create_fields);
|
||||||
thd->count_cuted_fields= CHECK_FIELD_WARN; // To find wrong default values
|
thd->count_cuted_fields= CHECK_FIELD_WARN; // To find wrong default values
|
||||||
while ((field=it++))
|
while ((field=it++))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user