Commit 7c459960 authored by Sergei Golubchik's avatar Sergei Golubchik

db_low_byte_first is gone

parent 8767540a
...@@ -344,3 +344,10 @@ varchar60_datetime 2010-11-12 11:14:17 ...@@ -344,3 +344,10 @@ varchar60_datetime 2010-11-12 11:14:17
varchar70_time 11:14:17 varchar70_time 11:14:17
varchar80_timestamp 2010-11-12 11:14:17 varchar80_timestamp 2010-11-12 11:14:17
drop table t1, t2; drop table t1, t2;
create table t1 (a datetime, b datetime(6));
insert t1 values ('2010-01-02 03:04:05.678912', '2010-01-02 03:04:05.678912');
update t1 set b=a;
select * from t1;
a b
2010-01-02 03:04:05 2010-01-02 03:04:05.000000
drop table t1;
...@@ -129,3 +129,9 @@ alter table t1 ...@@ -129,3 +129,9 @@ alter table t1
drop table t1, t2; drop table t1, t2;
create table t1 (a datetime, b datetime(6));
insert t1 values ('2010-01-02 03:04:05.678912', '2010-01-02 03:04:05.678912');
update t1 set b=a;
select * from t1;
drop table t1;
This diff is collapsed.
This diff is collapsed.
...@@ -644,13 +644,11 @@ void Copy_field::set(Field *to,Field *from,bool save) ...@@ -644,13 +644,11 @@ void Copy_field::set(Field *to,Field *from,bool save)
Copy_field::Copy_func * Copy_field::Copy_func *
Copy_field::get_copy_func(Field *to,Field *from) Copy_field::get_copy_func(Field *to,Field *from)
{ {
bool compatible_db_low_byte_first= (to->table->s->db_low_byte_first ==
from->table->s->db_low_byte_first);
if (to->flags & BLOB_FLAG) if (to->flags & BLOB_FLAG)
{ {
if (!(from->flags & BLOB_FLAG) || from->charset() != to->charset()) if (!(from->flags & BLOB_FLAG) || from->charset() != to->charset())
return do_conv_blob; return do_conv_blob;
if (from_length != to_length || !compatible_db_low_byte_first) if (from_length != to_length)
{ {
// Correct pointer to point at char pointer // Correct pointer to point at char pointer
to_ptr+= to_length - to->table->s->blob_ptr_size; to_ptr+= to_length - to->table->s->blob_ptr_size;
...@@ -684,7 +682,6 @@ Copy_field::get_copy_func(Field *to,Field *from) ...@@ -684,7 +682,6 @@ Copy_field::get_copy_func(Field *to,Field *from)
if we don't allow 'all' dates. if we don't allow 'all' dates.
*/ */
if (to->real_type() != from->real_type() || if (to->real_type() != from->real_type() ||
!compatible_db_low_byte_first ||
(((to->table->in_use->variables.sql_mode & (((to->table->in_use->variables.sql_mode &
(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE | MODE_INVALID_DATES)) && (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE | MODE_INVALID_DATES)) &&
to->type() == MYSQL_TYPE_DATE) || to->type() == MYSQL_TYPE_DATE) ||
...@@ -735,8 +732,7 @@ Copy_field::get_copy_func(Field *to,Field *from) ...@@ -735,8 +732,7 @@ Copy_field::get_copy_func(Field *to,Field *from)
} }
else if (to->real_type() != from->real_type() || else if (to->real_type() != from->real_type() ||
to_length != from_length || to_length != from_length)
!compatible_db_low_byte_first)
{ {
if (to->real_type() == MYSQL_TYPE_DECIMAL || if (to->real_type() == MYSQL_TYPE_DECIMAL ||
to->result_type() == STRING_RESULT) to->result_type() == STRING_RESULT)
...@@ -747,7 +743,7 @@ Copy_field::get_copy_func(Field *to,Field *from) ...@@ -747,7 +743,7 @@ Copy_field::get_copy_func(Field *to,Field *from)
} }
else else
{ {
if (!to->eq_def(from) || !compatible_db_low_byte_first) if (!to->eq_def(from))
{ {
if (to->real_type() == MYSQL_TYPE_DECIMAL) if (to->real_type() == MYSQL_TYPE_DECIMAL)
return do_field_string; return do_field_string;
...@@ -780,14 +776,13 @@ int field_conv(Field *to,Field *from) ...@@ -780,14 +776,13 @@ int field_conv(Field *to,Field *from)
{ {
if (to->pack_length() == from->pack_length() && if (to->pack_length() == from->pack_length() &&
!(to->flags & UNSIGNED_FLAG && !(from->flags & UNSIGNED_FLAG)) && !(to->flags & UNSIGNED_FLAG && !(from->flags & UNSIGNED_FLAG)) &&
to->decimals() == from->decimals() &&
to->real_type() != MYSQL_TYPE_ENUM && to->real_type() != MYSQL_TYPE_ENUM &&
to->real_type() != MYSQL_TYPE_SET && to->real_type() != MYSQL_TYPE_SET &&
to->real_type() != MYSQL_TYPE_BIT && to->real_type() != MYSQL_TYPE_BIT &&
(to->real_type() != MYSQL_TYPE_NEWDECIMAL || (to->real_type() != MYSQL_TYPE_NEWDECIMAL ||
(to->field_length == from->field_length && to->field_length == from->field_length) &&
(((Field_num*)to)->dec == ((Field_num*)from)->dec))) &&
from->charset() == to->charset() && from->charset() == to->charset() &&
to->table->s->db_low_byte_first == from->table->s->db_low_byte_first &&
(!(to->table->in_use->variables.sql_mode & (!(to->table->in_use->variables.sql_mode &
(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE | MODE_INVALID_DATES)) || (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE | MODE_INVALID_DATES)) ||
(to->type() != MYSQL_TYPE_DATE && (to->type() != MYSQL_TYPE_DATE &&
......
...@@ -235,7 +235,6 @@ void ha_partition::init_handler_variables() ...@@ -235,7 +235,6 @@ void ha_partition::init_handler_variables()
m_extra_prepare_for_update= FALSE; m_extra_prepare_for_update= FALSE;
m_extra_cache_part_id= NO_CURRENT_PART_ID; m_extra_cache_part_id= NO_CURRENT_PART_ID;
m_handler_status= handler_not_initialized; m_handler_status= handler_not_initialized;
m_low_byte_first= 1;
m_part_field_array= NULL; m_part_field_array= NULL;
m_ordered_rec_buffer= NULL; m_ordered_rec_buffer= NULL;
m_top_entry= NO_CURRENT_PART_ID; m_top_entry= NO_CURRENT_PART_ID;
...@@ -374,18 +373,11 @@ bool ha_partition::initialize_partition(MEM_ROOT *mem_root) ...@@ -374,18 +373,11 @@ bool ha_partition::initialize_partition(MEM_ROOT *mem_root)
Verify that all partitions have the same table_flags. Verify that all partitions have the same table_flags.
*/ */
check_table_flags= m_file[0]->ha_table_flags(); check_table_flags= m_file[0]->ha_table_flags();
m_low_byte_first= m_file[0]->low_byte_first();
m_pkey_is_clustered= TRUE; m_pkey_is_clustered= TRUE;
file_array= m_file; file_array= m_file;
do do
{ {
file= *file_array; file= *file_array;
if (m_low_byte_first != file->low_byte_first())
{
// Cannot have handlers with different endian
my_error(ER_MIX_HANDLER_ERROR, MYF(0));
DBUG_RETURN(1);
}
if (!file->primary_key_is_clustered()) if (!file->primary_key_is_clustered())
m_pkey_is_clustered= FALSE; m_pkey_is_clustered= FALSE;
if (check_table_flags != file->ha_table_flags()) if (check_table_flags != file->ha_table_flags())
......
...@@ -99,7 +99,6 @@ class ha_partition :public handler ...@@ -99,7 +99,6 @@ class ha_partition :public handler
for this since the MySQL Server sometimes allocating the handler object for this since the MySQL Server sometimes allocating the handler object
without freeing them. without freeing them.
*/ */
ulong m_low_byte_first;
enum enum_handler_status enum enum_handler_status
{ {
handler_not_initialized= 0, handler_not_initialized= 0,
...@@ -884,12 +883,6 @@ class ha_partition :public handler ...@@ -884,12 +883,6 @@ class ha_partition :public handler
virtual uint max_supported_key_length() const; virtual uint max_supported_key_length() const;
virtual uint max_supported_key_part_length() const; virtual uint max_supported_key_part_length() const;
/*
All handlers in a partitioned table must have the same low_byte_first
*/
virtual bool low_byte_first() const
{ return m_low_byte_first; }
/* /*
The extra record buffer length is the maximum needed by all handlers. The extra record buffer length is the maximum needed by all handlers.
The minimum record length is the maximum of all involved handlers. The minimum record length is the maximum of all involved handlers.
......
...@@ -1623,7 +1623,6 @@ class handler :public Sql_alloc ...@@ -1623,7 +1623,6 @@ class handler :public Sql_alloc
virtual uint max_supported_key_part_length() const { return 255; } virtual uint max_supported_key_part_length() const { return 255; }
virtual uint min_record_length(uint options) const { return 1; } virtual uint min_record_length(uint options) const { return 1; }
virtual bool low_byte_first() const { return 1; }
virtual uint checksum() const { return 0; } virtual uint checksum() const { return 0; }
virtual bool is_crashed() const { return 0; } virtual bool is_crashed() const { return 0; }
virtual bool auto_repair() const { return 0; } virtual bool auto_repair() const { return 0; }
......
...@@ -103,7 +103,7 @@ pack_row(TABLE *table, MY_BITMAP const* cols, ...@@ -103,7 +103,7 @@ pack_row(TABLE *table, MY_BITMAP const* cols,
const uchar *old_pack_ptr= pack_ptr; const uchar *old_pack_ptr= pack_ptr;
#endif #endif
pack_ptr= field->pack(pack_ptr, field->ptr + offset, pack_ptr= field->pack(pack_ptr, field->ptr + offset,
field->max_data_length(), TRUE); field->max_data_length());
DBUG_PRINT("debug", ("field: %s; pack_ptr: 0x%lx;" DBUG_PRINT("debug", ("field: %s; pack_ptr: 0x%lx;"
" pack_ptr':0x%lx; bytes: %d", " pack_ptr':0x%lx; bytes: %d",
field->field_name, (ulong) old_pack_ptr, field->field_name, (ulong) old_pack_ptr,
...@@ -283,7 +283,7 @@ unpack_row(Relay_log_info const *rli, ...@@ -283,7 +283,7 @@ unpack_row(Relay_log_info const *rli,
#ifndef DBUG_OFF #ifndef DBUG_OFF
uchar const *const old_pack_ptr= pack_ptr; uchar const *const old_pack_ptr= pack_ptr;
#endif #endif
pack_ptr= f->unpack(f->ptr, pack_ptr, metadata, TRUE); pack_ptr= f->unpack(f->ptr, pack_ptr, metadata);
DBUG_PRINT("debug", ("field: %s; metadata: 0x%x;" DBUG_PRINT("debug", ("field: %s; metadata: 0x%x;"
" pack_ptr: 0x%lx; pack_ptr': 0x%lx; bytes: %d", " pack_ptr: 0x%lx; pack_ptr': 0x%lx; bytes: %d",
f->field_name, metadata, f->field_name, metadata,
......
...@@ -133,7 +133,7 @@ uint32 table_def::calc_field_size(uint col, uchar *master_data) const ...@@ -133,7 +133,7 @@ uint32 table_def::calc_field_size(uint col, uchar *master_data) const
always read the length in little-endian order. always read the length in little-endian order.
*/ */
Field_blob fb(m_field_metadata[col]); Field_blob fb(m_field_metadata[col]);
length= fb.get_packed_size(master_data, TRUE); length= fb.get_packed_size(master_data);
#else #else
/* /*
Compute the length of the data. We cannot use get_length() here Compute the length of the data. We cannot use get_length() here
......
...@@ -3542,9 +3542,6 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info, ...@@ -3542,9 +3542,6 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
tmp_table.s->db_create_options=0; tmp_table.s->db_create_options=0;
tmp_table.s->blob_ptr_size= portable_sizeof_char_ptr; tmp_table.s->blob_ptr_size= portable_sizeof_char_ptr;
tmp_table.s->db_low_byte_first=
test(create_info->db_type == myisam_hton ||
create_info->db_type == heap_hton);
tmp_table.null_row=tmp_table.maybe_null=0; tmp_table.null_row=tmp_table.maybe_null=0;
while ((item=it++)) while ((item=it++))
......
...@@ -10081,7 +10081,6 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields, ...@@ -10081,7 +10081,6 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
init_tmp_table_share(thd, share, "", 0, tmpname, tmpname); init_tmp_table_share(thd, share, "", 0, tmpname, tmpname);
share->blob_field= blob_field; share->blob_field= blob_field;
share->blob_ptr_size= portable_sizeof_char_ptr; share->blob_ptr_size= portable_sizeof_char_ptr;
share->db_low_byte_first=1; // True for HEAP and MyISAM
share->table_charset= param->table_charset; share->table_charset= param->table_charset;
share->primary_key= MAX_KEY; // Indicate no primary key share->primary_key= MAX_KEY; // Indicate no primary key
share->keys_for_keyread.init(); share->keys_for_keyread.init();
......
...@@ -757,8 +757,6 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, ...@@ -757,8 +757,6 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
share->db_record_offset= 1; share->db_record_offset= 1;
if (db_create_options & HA_OPTION_LONG_BLOB_PTR) if (db_create_options & HA_OPTION_LONG_BLOB_PTR)
share->blob_ptr_size= portable_sizeof_char_ptr; share->blob_ptr_size= portable_sizeof_char_ptr;
/* Set temporarily a good value for db_low_byte_first */
share->db_low_byte_first= test(legacy_db_type != DB_TYPE_ISAM);
error=4; error=4;
share->max_rows= uint4korr(head+18); share->max_rows= uint4korr(head+18);
share->min_rows= uint4korr(head+22); share->min_rows= uint4korr(head+22);
...@@ -1597,7 +1595,6 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, ...@@ -1597,7 +1595,6 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
(null_bit_pos + 7) / 8); (null_bit_pos + 7) / 8);
share->last_null_bit_pos= null_bit_pos; share->last_null_bit_pos= null_bit_pos;
share->db_low_byte_first= handler_file->low_byte_first();
share->column_bitmap_size= bitmap_buffer_size(share->fields); share->column_bitmap_size= bitmap_buffer_size(share->fields);
if (!(bitmaps= (my_bitmap_map*) alloc_root(&share->mem_root, if (!(bitmaps= (my_bitmap_map*) alloc_root(&share->mem_root,
......
...@@ -423,7 +423,6 @@ typedef struct st_table_share ...@@ -423,7 +423,6 @@ typedef struct st_table_share
bool null_field_first; bool null_field_first;
bool system; /* Set if system table (one record) */ bool system; /* Set if system table (one record) */
bool crypted; /* If .frm file is crypted */ bool crypted; /* If .frm file is crypted */
bool db_low_byte_first; /* Portable row format */
bool crashed; bool crashed;
bool is_view; bool is_view;
bool name_lock, replace_with_name_lock; bool name_lock, replace_with_name_lock;
......
...@@ -944,7 +944,6 @@ static bool make_empty_rec(THD *thd, File file,enum legacy_db_type table_type, ...@@ -944,7 +944,6 @@ static bool make_empty_rec(THD *thd, File file,enum legacy_db_type table_type,
} }
table.in_use= thd; table.in_use= thd;
table.s->db_low_byte_first= handler->low_byte_first();
table.s->blob_ptr_size= portable_sizeof_char_ptr; table.s->blob_ptr_size= portable_sizeof_char_ptr;
null_count=0; null_count=0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment