mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Merge zippy.(none):/home/cmiller/work/mysql/merge/mysql-5.1
into zippy.(none):/home/cmiller/work/mysql/merge/mysql-5.1-new-maint
This commit is contained in:
28
sql/field.cc
28
sql/field.cc
@@ -1536,7 +1536,8 @@ bool Field::optimize_range(uint idx, uint part)
|
||||
}
|
||||
|
||||
|
||||
Field *Field::new_field(MEM_ROOT *root, struct st_table *new_table)
|
||||
Field *Field::new_field(MEM_ROOT *root, struct st_table *new_table,
|
||||
bool keep_type __attribute__((unused)))
|
||||
{
|
||||
Field *tmp;
|
||||
if (!(tmp= (Field*) memdup_root(root,(char*) this,size_of())))
|
||||
@@ -1561,7 +1562,7 @@ Field *Field::new_key_field(MEM_ROOT *root, struct st_table *new_table,
|
||||
uint new_null_bit)
|
||||
{
|
||||
Field *tmp;
|
||||
if ((tmp= new_field(root, new_table)))
|
||||
if ((tmp= new_field(root, new_table, table == new_table)))
|
||||
{
|
||||
tmp->ptr= new_ptr;
|
||||
tmp->null_ptr= new_null_ptr;
|
||||
@@ -6383,11 +6384,12 @@ uint Field_string::max_packed_col_length(uint max_length)
|
||||
}
|
||||
|
||||
|
||||
Field *Field_string::new_field(MEM_ROOT *root, struct st_table *new_table)
|
||||
Field *Field_string::new_field(MEM_ROOT *root, struct st_table *new_table,
|
||||
bool keep_type)
|
||||
{
|
||||
Field *field;
|
||||
if (type() != MYSQL_TYPE_VAR_STRING || table == new_table)
|
||||
return Field::new_field(root, new_table);
|
||||
if (type() != MYSQL_TYPE_VAR_STRING || keep_type)
|
||||
return Field::new_field(root, new_table, keep_type);
|
||||
|
||||
/*
|
||||
Old VARCHAR field which should be modified to a VARCHAR on copy
|
||||
@@ -6396,17 +6398,7 @@ Field *Field_string::new_field(MEM_ROOT *root, struct st_table *new_table)
|
||||
*/
|
||||
if ((field= new Field_varstring(field_length, maybe_null(), field_name,
|
||||
new_table->s, charset())))
|
||||
{
|
||||
field->init(new_table);
|
||||
/*
|
||||
delayed_insert::get_local_table() needs a ptr copied from old table.
|
||||
This is what other new_field() methods do too. The above method of
|
||||
Field_varstring sets ptr to NULL.
|
||||
*/
|
||||
field->ptr= ptr;
|
||||
field->null_ptr= null_ptr;
|
||||
field->null_bit= null_bit;
|
||||
}
|
||||
return field;
|
||||
}
|
||||
|
||||
@@ -6908,9 +6900,11 @@ int Field_varstring::cmp_binary(const char *a_ptr, const char *b_ptr,
|
||||
}
|
||||
|
||||
|
||||
Field *Field_varstring::new_field(MEM_ROOT *root, struct st_table *new_table)
|
||||
Field *Field_varstring::new_field(MEM_ROOT *root, struct st_table *new_table,
|
||||
bool keep_type)
|
||||
{
|
||||
Field_varstring *res= (Field_varstring*) Field::new_field(root, new_table);
|
||||
Field_varstring *res= (Field_varstring*) Field::new_field(root, new_table,
|
||||
keep_type);
|
||||
if (res)
|
||||
res->length_bytes= length_bytes;
|
||||
return res;
|
||||
|
||||
Reference in New Issue
Block a user