diff options
author | unknown <evgen@sunlight.local> | 2006-04-05 13:29:04 +0400 |
---|---|---|
committer | unknown <evgen@sunlight.local> | 2006-04-05 13:29:04 +0400 |
commit | 0f8c11758d9fe04871d87496fc32d3a0439ce249 (patch) | |
tree | 35b97ec2760fc9a23e2b0cb2a0568059917396d6 /sql/field.h | |
parent | aa3411f54b2d5e2b6069b122085926f771133437 (diff) | |
download | mariadb-git-0f8c11758d9fe04871d87496fc32d3a0439ce249.tar.gz |
Fixed bug #16281: Multi-table update broken in 5.0 on tables imported from 4.1
Mutli-table uses temporary table to store new values for fields. With the
new values the rowid of the record to be updated is stored in a Field_string
field. Table to be updated is set as source table of the rowid field.
But when the temporary table creates the tmp field for the rowid field it
converts it to a varstring field because the table to be updated was created by
the v4.1. Due to this the stored rowids were broken and no records for
update were found.
The flag can_alter_field_type is added to Field_string class. When it is set to
0 the field won't be converted to varstring. The Field_string::type() function
now always returns MYSQL_TYPE_STRING if can_alter_field_type is set to 0.
The multi_update::initialize_tables() function now sets can_alter_field_type
flag to 0 for the rowid fields denying conversion of the field to a varstring
field.
sql/field.h:
Fixed bug #16281: Multi-table update broken in 5.0 on tables imported from 4.1
The flag can_alter_field_type is added to Field_string class. When it is set to
0 the field won't be converted to varstring.
The Field_string::type() function now always returns MYSQL_TYPE_STRING if
can_alter_field_type is set to 0.
sql/sql_update.cc:
Fixed bug #16281: Multi-table update broken in 5.0 on tables imported from 4.1
The multi_update::initialize_tables() function now sets can_alter_field_type
flag to 0 for the rowid fields denying conversion of the field to a varstring
field.
Diffstat (limited to 'sql/field.h')
-rw-r--r-- | sql/field.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sql/field.h b/sql/field.h index e8dd7f05f99..35fbb2d8c54 100644 --- a/sql/field.h +++ b/sql/field.h @@ -980,20 +980,23 @@ public: class Field_string :public Field_longstr { public: + bool can_alter_field_type; Field_string(char *ptr_arg, uint32 len_arg,uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, struct st_table *table_arg, CHARSET_INFO *cs) :Field_longstr(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, table_arg, cs) {}; + unireg_check_arg, field_name_arg, table_arg, cs), + can_alter_field_type(1) {}; Field_string(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg, struct st_table *table_arg, CHARSET_INFO *cs) :Field_longstr((char*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0, 0, - NONE, field_name_arg, table_arg, cs) {}; + NONE, field_name_arg, table_arg, cs), + can_alter_field_type(1) {}; enum_field_types type() const { - return ((orig_table && + return ((can_alter_field_type && orig_table && orig_table->s->db_create_options & HA_OPTION_PACK_RECORD && field_length >= 4) && orig_table->s->frm_version < FRM_VER_TRUE_VARCHAR ? |