mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
MDEV-20342 Turn Field::flags from a member to a method
This commit is contained in:
parent
fa21952e25
commit
e86010f909
59 changed files with 489 additions and 453 deletions
|
@ -903,7 +903,7 @@ dbcontext::fill_filter_buf(TABLE *table, const prep_stmt& pst,
|
|||
}
|
||||
const uint32_t fn = pst.get_filter_fields()[f->ff_offset];
|
||||
Field *const fld = table->field[fn];
|
||||
if ((fld->flags & BLOB_FLAG) != 0) {
|
||||
if ((fld->flags() & BLOB_FLAG) != 0) {
|
||||
return false;
|
||||
}
|
||||
fld->store(f->val.begin(), f->val.size(), &my_charset_bin);
|
||||
|
|
99
sql/field.cc
99
sql/field.cc
|
@ -1258,11 +1258,11 @@ int Field::store_hex_hybrid(const char *str, size_t length)
|
|||
|
||||
if (length > 8)
|
||||
{
|
||||
nr= flags & UNSIGNED_FLAG ? ULONGLONG_MAX : LONGLONG_MAX;
|
||||
nr= is_unsigned() ? ULONGLONG_MAX : LONGLONG_MAX;
|
||||
goto warn;
|
||||
}
|
||||
nr= (ulonglong) longlong_from_hex_hybrid(str, length);
|
||||
if ((length == 8) && !(flags & UNSIGNED_FLAG) && (nr > LONGLONG_MAX))
|
||||
if (length == 8 && !is_unsigned() && nr > LONGLONG_MAX)
|
||||
{
|
||||
nr= LONGLONG_MAX;
|
||||
goto warn;
|
||||
|
@ -1384,7 +1384,7 @@ error:
|
|||
|
||||
bool Field::make_empty_rec_store_default_value(THD *thd, Item *item)
|
||||
{
|
||||
DBUG_ASSERT(!(flags & BLOB_FLAG));
|
||||
DBUG_ASSERT(!(flags() & BLOB_FLAG));
|
||||
int res= item->save_in_field(this, true);
|
||||
return res != 0 && res != 3;
|
||||
}
|
||||
|
@ -1402,9 +1402,9 @@ Field_num::Field_num(uchar *ptr_arg,uint32 len_arg, uchar *null_ptr_arg,
|
|||
dec(dec_arg),zerofill(zero_arg),unsigned_flag(unsigned_arg)
|
||||
{
|
||||
if (zerofill)
|
||||
flags|=ZEROFILL_FLAG;
|
||||
add_flags(ZEROFILL_FLAG);
|
||||
if (unsigned_flag)
|
||||
flags|=UNSIGNED_FLAG;
|
||||
add_flags(UNSIGNED_FLAG);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1725,7 +1725,8 @@ String *Field::val_int_as_str(String *val_buffer, bool unsigned_val)
|
|||
Field::Field(uchar *ptr_arg,uint32 length_arg,uchar *null_ptr_arg,
|
||||
uchar null_bit_arg,
|
||||
utype unireg_check_arg, const LEX_CSTRING *field_name_arg)
|
||||
:ptr(ptr_arg), invisible(VISIBLE),
|
||||
:Column_cached_flags(null_ptr_arg ? 0 : NOT_NULL_FLAG),
|
||||
ptr(ptr_arg), invisible(VISIBLE),
|
||||
null_ptr(null_ptr_arg), table(0), orig_table(0),
|
||||
table_name(0), field_name(*field_name_arg), option_list(0),
|
||||
option_struct(0), key_start(0), part_of_key(0),
|
||||
|
@ -1735,7 +1736,6 @@ Field::Field(uchar *ptr_arg,uint32 length_arg,uchar *null_ptr_arg,
|
|||
read_stats(NULL), collected_stats(0), vcol_info(0), check_constraint(0),
|
||||
default_value(0)
|
||||
{
|
||||
flags=null_ptr ? 0: NOT_NULL_FLAG;
|
||||
comment.str= (char*) "";
|
||||
comment.length=0;
|
||||
field_index= 0;
|
||||
|
@ -1988,7 +1988,7 @@ void Field::make_send_field(Send_field *field)
|
|||
field->col_name= field_name;
|
||||
field->length=field_length;
|
||||
field->set_handler(type_handler());
|
||||
field->flags=table->maybe_null ? (flags & ~NOT_NULL_FLAG) : flags;
|
||||
field->flags= table->maybe_null ? (flags() & ~NOT_NULL_FLAG) : flags();
|
||||
field->decimals= 0;
|
||||
}
|
||||
|
||||
|
@ -2086,7 +2086,7 @@ my_decimal* Field_int::val_decimal(my_decimal *decimal_value)
|
|||
bool Field_int::get_date(MYSQL_TIME *ltime,date_mode_t fuzzydate)
|
||||
{
|
||||
DBUG_ASSERT(marked_for_read());
|
||||
Longlong_hybrid nr(val_int(), (flags & UNSIGNED_FLAG));
|
||||
Longlong_hybrid nr(val_int(), is_unsigned());
|
||||
return int_to_datetime_with_warn(get_thd(), nr, ltime,
|
||||
fuzzydate, table->s, field_name.str);
|
||||
}
|
||||
|
@ -2143,7 +2143,7 @@ Field_str::Field_str(uchar *ptr_arg,uint32 len_arg, uchar *null_ptr_arg,
|
|||
{
|
||||
m_collation= collation;
|
||||
if (collation.collation->state & MY_CS_BINSORT)
|
||||
flags|=BINARY_FLAG;
|
||||
add_flags(BINARY_FLAG);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2242,7 +2242,7 @@ uint Field::fill_cache_field(CACHE_FIELD *copy)
|
|||
copy->str= ptr;
|
||||
copy->length= pack_length_in_rec();
|
||||
copy->field= this;
|
||||
if (flags & BLOB_FLAG)
|
||||
if (flags() & BLOB_FLAG)
|
||||
{
|
||||
copy->type= CACHE_BLOB;
|
||||
copy->length-= portable_sizeof_char_ptr;
|
||||
|
@ -2311,7 +2311,7 @@ Field *Field::make_new_field(MEM_ROOT *root, TABLE *new_table,
|
|||
return 0;
|
||||
|
||||
if (tmp->table->maybe_null)
|
||||
tmp->flags&= ~NOT_NULL_FLAG;
|
||||
tmp->clear_flags(NOT_NULL_FLAG);
|
||||
tmp->table= new_table;
|
||||
tmp->key_start.init(0);
|
||||
tmp->part_of_key.init(0);
|
||||
|
@ -2321,10 +2321,10 @@ Field *Field::make_new_field(MEM_ROOT *root, TABLE *new_table,
|
|||
Try not to reset it, or explain why it needs to be reset.
|
||||
*/
|
||||
tmp->unireg_check= Field::NONE;
|
||||
tmp->flags&= (NOT_NULL_FLAG | BLOB_FLAG | UNSIGNED_FLAG |
|
||||
ZEROFILL_FLAG | BINARY_FLAG | ENUM_FLAG | SET_FLAG |
|
||||
VERS_SYS_START_FLAG | VERS_SYS_END_FLAG |
|
||||
VERS_UPDATE_UNVERSIONED_FLAG);
|
||||
tmp->mask_flags(NOT_NULL_FLAG | UNSIGNED_FLAG |
|
||||
ZEROFILL_FLAG | BINARY_FLAG |
|
||||
VERS_SYS_START_FLAG | VERS_SYS_END_FLAG |
|
||||
VERS_UPDATE_UNVERSIONED_FLAG);
|
||||
tmp->reset_fields();
|
||||
tmp->invisible= VISIBLE;
|
||||
return tmp;
|
||||
|
@ -2368,9 +2368,9 @@ Field *Field::create_tmp_field(MEM_ROOT *mem_root, TABLE *new_table,
|
|||
if ((new_field= make_new_field(mem_root, new_table, new_table == table)))
|
||||
{
|
||||
new_field->init_for_tmp_table(this, new_table);
|
||||
new_field->flags|= flags & NO_DEFAULT_VALUE_FLAG;
|
||||
new_field->add_flags(cached_flags() & NO_DEFAULT_VALUE_FLAG);
|
||||
if (maybe_null_arg)
|
||||
new_field->flags&= ~NOT_NULL_FLAG; // Because of outer join
|
||||
new_field->clear_flags(NOT_NULL_FLAG); // Because of outer join
|
||||
}
|
||||
return new_field;
|
||||
}
|
||||
|
@ -3117,7 +3117,7 @@ Field *Field_decimal::make_new_field(MEM_ROOT *root, TABLE *new_table,
|
|||
Field *field= new (root) Field_new_decimal(NULL, field_length,
|
||||
maybe_null() ? (uchar*) "" : 0, 0,
|
||||
NONE, &field_name,
|
||||
dec, flags & ZEROFILL_FLAG,
|
||||
dec, is_zerofill(),
|
||||
unsigned_flag);
|
||||
if (field)
|
||||
field->init_for_make_new_field(new_table, orig_table);
|
||||
|
@ -3493,10 +3493,9 @@ bool Field_new_decimal::compatible_field_size(uint field_metadata,
|
|||
bool Field_new_decimal::is_equal(const Column_definition &new_field) const
|
||||
{
|
||||
return ((new_field.type_handler() == type_handler()) &&
|
||||
((new_field.flags & UNSIGNED_FLAG) ==
|
||||
(uint) (flags & UNSIGNED_FLAG)) &&
|
||||
((new_field.flags & AUTO_INCREMENT_FLAG) <=
|
||||
(uint) (flags & AUTO_INCREMENT_FLAG)) &&
|
||||
(new_field.is_unsigned() == is_unsigned()) &&
|
||||
((new_field.flags() & AUTO_INCREMENT_FLAG) <=
|
||||
(uint) (flags() & AUTO_INCREMENT_FLAG)) &&
|
||||
(new_field.length == max_display_length()) &&
|
||||
(new_field.decimals == dec));
|
||||
}
|
||||
|
@ -3561,7 +3560,7 @@ Field_new_decimal::unpack(uchar* to, const uchar *from, const uchar *from_end,
|
|||
Item *Field_new_decimal::get_equal_const_item(THD *thd, const Context &ctx,
|
||||
Item *const_item)
|
||||
{
|
||||
if (flags & ZEROFILL_FLAG)
|
||||
if (is_zerofill())
|
||||
return Field_num::get_equal_zerofill_const_item(thd, ctx, const_item);
|
||||
switch (ctx.subst_constraint()) {
|
||||
case IDENTITY_SUBST:
|
||||
|
@ -4846,7 +4845,7 @@ bool Field_real::get_date(MYSQL_TIME *ltime,date_mode_t fuzzydate)
|
|||
Item *Field_real::get_equal_const_item(THD *thd, const Context &ctx,
|
||||
Item *const_item)
|
||||
{
|
||||
if (flags & ZEROFILL_FLAG)
|
||||
if (is_zerofill())
|
||||
return Field_num::get_equal_zerofill_const_item(thd, ctx, const_item);
|
||||
switch (ctx.subst_constraint()) {
|
||||
case IDENTITY_SUBST:
|
||||
|
@ -5000,16 +4999,16 @@ Field_timestamp::Field_timestamp(uchar *ptr_arg, uint32 len_arg,
|
|||
unireg_check_arg, field_name_arg)
|
||||
{
|
||||
/* For 4.0 MYD and 4.0 InnoDB compatibility */
|
||||
flags|= UNSIGNED_FLAG;
|
||||
add_flags(UNSIGNED_FLAG);
|
||||
if (unireg_check != NONE)
|
||||
{
|
||||
/*
|
||||
We mark the flag with TIMESTAMP_FLAG to indicate to the client that
|
||||
this field will be automaticly updated on insert.
|
||||
*/
|
||||
flags|= TIMESTAMP_FLAG;
|
||||
add_flags(TIMESTAMP_FLAG);
|
||||
if (unireg_check != TIMESTAMP_DN_FIELD)
|
||||
flags|= ON_UPDATE_NOW_FLAG;
|
||||
add_flags(ON_UPDATE_NOW_FLAG);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8169,7 +8168,6 @@ Field_blob::Field_blob(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
|
|||
packlength(blob_pack_length)
|
||||
{
|
||||
DBUG_ASSERT(blob_pack_length <= 4); // Only pack lengths 1-4 supported currently
|
||||
flags|= BLOB_FLAG;
|
||||
share->blob_fields++;
|
||||
/* TODO: why do not fill table->s->blob_field array here? */
|
||||
}
|
||||
|
@ -8237,7 +8235,7 @@ int Field_blob::store(const char *from,size_t length,CHARSET_INFO *cs)
|
|||
|
||||
if (table && table->blob_storage) // GROUP_CONCAT with ORDER BY | DISTINCT
|
||||
{
|
||||
DBUG_ASSERT(!f_is_hex_escape(flags));
|
||||
DBUG_ASSERT(!f_is_hex_escape(flags()));
|
||||
DBUG_ASSERT(field_charset() == cs);
|
||||
DBUG_ASSERT(length <= max_data_length());
|
||||
|
||||
|
@ -8285,7 +8283,7 @@ int Field_blob::store(const char *from,size_t length,CHARSET_INFO *cs)
|
|||
goto oom_error;
|
||||
tmp= const_cast<char*>(value.ptr());
|
||||
|
||||
if (f_is_hex_escape(flags))
|
||||
if (f_is_hex_escape(flags()))
|
||||
{
|
||||
copy_length= my_copy_with_hex_escaping(field_charset(),
|
||||
tmp, new_length,
|
||||
|
@ -8689,7 +8687,7 @@ void Field_blob::make_send_field(Send_field *field)
|
|||
|
||||
bool Field_blob::make_empty_rec_store_default_value(THD *thd, Item *item)
|
||||
{
|
||||
DBUG_ASSERT(flags & BLOB_FLAG);
|
||||
DBUG_ASSERT(flags() & BLOB_FLAG);
|
||||
int res= item->save_in_field(this, true);
|
||||
DBUG_ASSERT(res != 3); // Field_blob never returns 3
|
||||
if (res)
|
||||
|
@ -9228,8 +9226,9 @@ bool Field_num::eq_def(const Field *field) const
|
|||
|
||||
bool Field_num::is_equal(const Column_definition &new_field) const
|
||||
{
|
||||
if (((new_field.flags & UNSIGNED_FLAG) != (flags & UNSIGNED_FLAG)) ||
|
||||
((new_field.flags & AUTO_INCREMENT_FLAG) > (flags & AUTO_INCREMENT_FLAG)))
|
||||
if ((new_field.is_unsigned() != is_unsigned()) ||
|
||||
((new_field.flags() & AUTO_INCREMENT_FLAG) >
|
||||
(flags() & AUTO_INCREMENT_FLAG)))
|
||||
return false;
|
||||
|
||||
const Type_handler *th= type_handler(), *new_th = new_field.type_handler();
|
||||
|
@ -9328,7 +9327,7 @@ Field_bit::Field_bit(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
|
|||
DBUG_ENTER("Field_bit::Field_bit");
|
||||
DBUG_PRINT("enter", ("ptr_arg: %p, null_ptr_arg: %p, len_arg: %u, bit_len: %u, bytes_in_rec: %u",
|
||||
ptr_arg, null_ptr_arg, len_arg, bit_len, bytes_in_rec));
|
||||
flags|= UNSIGNED_FLAG;
|
||||
add_flags(UNSIGNED_FLAG);
|
||||
/*
|
||||
Ensure that Field::eq() can distinguish between two different bit fields.
|
||||
(two bit fields that are not null, may have same ptr and null_ptr)
|
||||
|
@ -9846,7 +9845,7 @@ Field_bit_as_char::Field_bit_as_char(uchar *ptr_arg, uint32 len_arg,
|
|||
:Field_bit(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, 0, 0,
|
||||
unireg_check_arg, field_name_arg)
|
||||
{
|
||||
flags|= UNSIGNED_FLAG;
|
||||
add_flags(UNSIGNED_FLAG);
|
||||
bit_len= 0;
|
||||
bytes_in_rec= (len_arg + 7) / 8;
|
||||
}
|
||||
|
@ -10071,7 +10070,7 @@ void Column_definition::create_length_to_internal_length_bit()
|
|||
void Column_definition::create_length_to_internal_length_newdecimal()
|
||||
{
|
||||
DBUG_ASSERT(length < UINT_MAX32);
|
||||
uint prec= get_decimal_precision((uint)length, decimals, flags & UNSIGNED_FLAG);
|
||||
uint prec= get_decimal_precision((uint)length, decimals, is_unsigned());
|
||||
key_length= pack_length= my_decimal_get_binary_size(prec, decimals);
|
||||
}
|
||||
|
||||
|
@ -10178,7 +10177,7 @@ bool Column_definition::fix_attributes_decimal()
|
|||
return true;
|
||||
}
|
||||
length= my_decimal_precision_to_length((uint) length, decimals,
|
||||
flags & UNSIGNED_FLAG);
|
||||
is_unsigned());
|
||||
pack_length= my_decimal_get_binary_size((uint) length, decimals);
|
||||
return false;
|
||||
}
|
||||
|
@ -10242,7 +10241,7 @@ bool Column_definition::check(THD *thd)
|
|||
if (def_expr->type() == Item::NULL_ITEM)
|
||||
{
|
||||
default_value= 0;
|
||||
if ((flags & (NOT_NULL_FLAG | AUTO_INCREMENT_FLAG)) == NOT_NULL_FLAG)
|
||||
if ((flags() & (NOT_NULL_FLAG | AUTO_INCREMENT_FLAG)) == NOT_NULL_FLAG)
|
||||
{
|
||||
my_error(ER_INVALID_DEFAULT, MYF(0), field_name.str);
|
||||
DBUG_RETURN(1);
|
||||
|
@ -10251,7 +10250,7 @@ bool Column_definition::check(THD *thd)
|
|||
}
|
||||
}
|
||||
|
||||
if (default_value && (flags & AUTO_INCREMENT_FLAG))
|
||||
if (default_value && (flags() & AUTO_INCREMENT_FLAG))
|
||||
{
|
||||
my_error(ER_INVALID_DEFAULT, MYF(0), field_name.str);
|
||||
DBUG_RETURN(1);
|
||||
|
@ -10285,7 +10284,7 @@ bool Column_definition::check(THD *thd)
|
|||
unireg_check= unireg_check == Field::NONE ? Field::TIMESTAMP_UN_FIELD
|
||||
: Field::TIMESTAMP_DNUN_FIELD;
|
||||
}
|
||||
else if (flags & AUTO_INCREMENT_FLAG)
|
||||
else if (flags() & AUTO_INCREMENT_FLAG)
|
||||
unireg_check= Field::NEXT_NUMBER;
|
||||
|
||||
if (type_handler()->Column_definition_fix_attributes(this))
|
||||
|
@ -10300,7 +10299,7 @@ bool Column_definition::check(THD *thd)
|
|||
We need to do this check here and in mysql_create_prepare_table() as
|
||||
sp_head::fill_field_definition() calls this function.
|
||||
*/
|
||||
if (!default_value && unireg_check == Field::NONE && (flags & NOT_NULL_FLAG))
|
||||
if (!default_value && unireg_check == Field::NONE && (flags() & NOT_NULL_FLAG))
|
||||
{
|
||||
/*
|
||||
TIMESTAMP columns get implicit DEFAULT value when
|
||||
|
@ -10309,12 +10308,12 @@ bool Column_definition::check(THD *thd)
|
|||
if ((opt_explicit_defaults_for_timestamp ||
|
||||
!is_timestamp_type()) && !vers_sys_field())
|
||||
{
|
||||
flags|= NO_DEFAULT_VALUE_FLAG;
|
||||
add_flags(NO_DEFAULT_VALUE_FLAG);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((flags & AUTO_INCREMENT_FLAG) &&
|
||||
if ((flags() & AUTO_INCREMENT_FLAG) &&
|
||||
!type_handler()->type_can_have_auto_increment_attribute())
|
||||
{
|
||||
my_error(ER_WRONG_FIELD_SPEC, MYF(0), field_name.str);
|
||||
|
@ -10418,11 +10417,11 @@ Column_definition_attributes::Column_definition_attributes(const Field *field)
|
|||
|
||||
Column_definition::Column_definition(THD *thd, Field *old_field,
|
||||
Field *orig_field)
|
||||
:Column_definition_attributes(old_field)
|
||||
:Column_cached_flags(*old_field),
|
||||
Column_definition_attributes(old_field)
|
||||
{
|
||||
on_update= NULL;
|
||||
field_name= old_field->field_name;
|
||||
flags= old_field->flags;
|
||||
pack_length=old_field->pack_length();
|
||||
key_length= old_field->key_length();
|
||||
set_handler(old_field->type_handler());
|
||||
|
@ -10470,7 +10469,7 @@ Column_definition::Column_definition(THD *thd, Field *old_field,
|
|||
|
||||
- The column didn't have a default expression
|
||||
*/
|
||||
if (!(flags & (NO_DEFAULT_VALUE_FLAG | BLOB_FLAG)) &&
|
||||
if (!(flags() & (NO_DEFAULT_VALUE_FLAG | BLOB_FLAG)) &&
|
||||
old_field->ptr != NULL && orig_field != NULL)
|
||||
{
|
||||
if (orig_field->unireg_check != Field::NEXT_NUMBER)
|
||||
|
@ -10512,7 +10511,7 @@ Column_definition::redefine_stage1_common(const Column_definition *dup_field,
|
|||
key_length= dup_field->key_length;
|
||||
decimals= dup_field->decimals;
|
||||
unireg_check= dup_field->unireg_check;
|
||||
flags= dup_field->flags;
|
||||
set_flags(dup_field->cached_flags());
|
||||
interval= dup_field->interval;
|
||||
vcol_info= dup_field->vcol_info;
|
||||
invisible= dup_field->invisible;
|
||||
|
@ -10587,7 +10586,7 @@ bool Column_definition::has_default_expression()
|
|||
{
|
||||
return (default_value &&
|
||||
(!default_value->expr->basic_const_item() ||
|
||||
(flags & BLOB_FLAG)));
|
||||
(flags() & BLOB_FLAG)));
|
||||
}
|
||||
|
||||
|
||||
|
@ -10871,7 +10870,7 @@ bool Field::save_in_field_default_value(bool view_error_processing)
|
|||
{
|
||||
THD *thd= table->in_use;
|
||||
|
||||
if (unlikely(flags & NO_DEFAULT_VALUE_FLAG &&
|
||||
if (unlikely(flags() & NO_DEFAULT_VALUE_FLAG &&
|
||||
real_type() != MYSQL_TYPE_ENUM))
|
||||
{
|
||||
if (reset())
|
||||
|
|
206
sql/field.h
206
sql/field.h
|
@ -633,7 +633,95 @@ public:
|
|||
inline void print(String*);
|
||||
};
|
||||
|
||||
class Field: public Value_source
|
||||
|
||||
|
||||
class Column_cached_flags
|
||||
{
|
||||
uint32 m_flags;
|
||||
static uint32 type_handler_implied_flags()
|
||||
{
|
||||
return ENUM_FLAG | SET_FLAG | BLOB_FLAG;
|
||||
}
|
||||
static bool is_valid(uint32 flags)
|
||||
{
|
||||
return (flags & type_handler_implied_flags()) == 0;
|
||||
}
|
||||
public:
|
||||
Column_cached_flags(uint32 flags)
|
||||
:m_flags(flags)
|
||||
{
|
||||
DBUG_ASSERT(is_valid(m_flags));
|
||||
}
|
||||
void set_flags(uint32 flags)
|
||||
{
|
||||
m_flags= flags;
|
||||
DBUG_ASSERT(is_valid(m_flags));
|
||||
}
|
||||
void add_flags(uint32 flags)
|
||||
{
|
||||
m_flags|= flags;
|
||||
DBUG_ASSERT(is_valid(m_flags));
|
||||
}
|
||||
void clear_flags(uint32 flags) { m_flags&= ~flags; }
|
||||
void mask_flags(uint32 flags) { m_flags&= flags; }
|
||||
void swap_flags(Column_cached_flags *other)
|
||||
{
|
||||
DBUG_ASSERT(is_valid(m_flags));
|
||||
DBUG_ASSERT(is_valid(other->m_flags));
|
||||
swap_variables(uint32, m_flags, other->m_flags);
|
||||
}
|
||||
|
||||
uint32 cached_flags() const { return m_flags; }
|
||||
|
||||
bool is_zerofill() const
|
||||
{
|
||||
return m_flags & ZEROFILL_FLAG;
|
||||
}
|
||||
|
||||
bool has_update_default_function() const
|
||||
{
|
||||
return m_flags & ON_UPDATE_NOW_FLAG;
|
||||
}
|
||||
|
||||
ha_storage_media field_storage_type() const
|
||||
{
|
||||
return (ha_storage_media)
|
||||
((m_flags >> FIELD_FLAGS_STORAGE_MEDIA) & 3);
|
||||
}
|
||||
|
||||
void set_storage_type(ha_storage_media storage_type_arg)
|
||||
{
|
||||
DBUG_ASSERT(field_storage_type() == HA_SM_DEFAULT);
|
||||
m_flags |= static_cast<uint32>(storage_type_arg) <<
|
||||
FIELD_FLAGS_STORAGE_MEDIA;
|
||||
}
|
||||
|
||||
column_format_type column_format() const
|
||||
{
|
||||
return (column_format_type)
|
||||
((m_flags >> FIELD_FLAGS_COLUMN_FORMAT) & 3);
|
||||
}
|
||||
|
||||
void set_column_format(column_format_type column_format_arg)
|
||||
{
|
||||
DBUG_ASSERT(column_format() == COLUMN_FORMAT_TYPE_DEFAULT);
|
||||
m_flags |= static_cast<uint32>(column_format_arg) <<
|
||||
FIELD_FLAGS_COLUMN_FORMAT;
|
||||
}
|
||||
|
||||
bool vers_sys_field() const
|
||||
{
|
||||
return m_flags & (VERS_SYS_START_FLAG | VERS_SYS_END_FLAG);
|
||||
}
|
||||
|
||||
bool vers_update_unversioned() const
|
||||
{
|
||||
return m_flags & VERS_UPDATE_UNVERSIONED_FLAG;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class Field: public Value_source, public Column_cached_flags
|
||||
{
|
||||
Field(const Item &); /* Prevent use of these */
|
||||
void operator=(Field &);
|
||||
|
@ -725,7 +813,6 @@ public:
|
|||
|
||||
utype unireg_check;
|
||||
uint32 field_length; // Length of field
|
||||
uint32 flags;
|
||||
uint16 field_index; // field number in fields array
|
||||
uchar null_bit; // Bit used to test null bit
|
||||
/**
|
||||
|
@ -790,8 +877,15 @@ public:
|
|||
return Type_std_attributes(type_numeric_attributes(), dtcollation());
|
||||
}
|
||||
|
||||
bool is_unsigned() const { return flags & UNSIGNED_FLAG; }
|
||||
uint32 flags() const
|
||||
{
|
||||
return Column_cached_flags::cached_flags() | type_handler()->flags();
|
||||
}
|
||||
|
||||
bool is_unsigned() const
|
||||
{
|
||||
return cached_flags() & UNSIGNED_FLAG;
|
||||
}
|
||||
/**
|
||||
Convenience definition of a copy function returned by
|
||||
Field::get_copy_func()
|
||||
|
@ -1010,10 +1104,6 @@ public:
|
|||
}
|
||||
virtual int set_default();
|
||||
|
||||
bool has_update_default_function() const
|
||||
{
|
||||
return flags & ON_UPDATE_NOW_FLAG;
|
||||
}
|
||||
bool has_default_now_unireg_check() const
|
||||
{
|
||||
return unireg_check == TIMESTAMP_DN_FIELD
|
||||
|
@ -1580,42 +1670,6 @@ public:
|
|||
return field_length / charset()->mbmaxlen;
|
||||
}
|
||||
|
||||
ha_storage_media field_storage_type() const
|
||||
{
|
||||
return (ha_storage_media)
|
||||
((flags >> FIELD_FLAGS_STORAGE_MEDIA) & 3);
|
||||
}
|
||||
|
||||
void set_storage_type(ha_storage_media storage_type_arg)
|
||||
{
|
||||
DBUG_ASSERT(field_storage_type() == HA_SM_DEFAULT);
|
||||
flags |= static_cast<uint32>(storage_type_arg) <<
|
||||
FIELD_FLAGS_STORAGE_MEDIA;
|
||||
}
|
||||
|
||||
column_format_type column_format() const
|
||||
{
|
||||
return (column_format_type)
|
||||
((flags >> FIELD_FLAGS_COLUMN_FORMAT) & 3);
|
||||
}
|
||||
|
||||
void set_column_format(column_format_type column_format_arg)
|
||||
{
|
||||
DBUG_ASSERT(column_format() == COLUMN_FORMAT_TYPE_DEFAULT);
|
||||
flags |= static_cast<uint32>(column_format_arg) <<
|
||||
FIELD_FLAGS_COLUMN_FORMAT;
|
||||
}
|
||||
|
||||
bool vers_sys_field() const
|
||||
{
|
||||
return flags & (VERS_SYS_START_FLAG | VERS_SYS_END_FLAG);
|
||||
}
|
||||
|
||||
bool vers_update_unversioned() const
|
||||
{
|
||||
return flags & VERS_UPDATE_UNVERSIONED_FLAG;
|
||||
}
|
||||
|
||||
/*
|
||||
Validate a non-null field value stored in the given record
|
||||
according to the current thread settings, e.g. sql_mode.
|
||||
|
@ -1832,7 +1886,7 @@ public:
|
|||
}
|
||||
Item *get_equal_const_item(THD *thd, const Context &ctx, Item *const_item)
|
||||
{
|
||||
return (flags & ZEROFILL_FLAG) ?
|
||||
return is_zerofill() ?
|
||||
get_equal_zerofill_const_item(thd, ctx, const_item) :
|
||||
const_item;
|
||||
}
|
||||
|
@ -1850,7 +1904,7 @@ public:
|
|||
}
|
||||
int save_in_field(Field *to)
|
||||
{
|
||||
return to->store(val_int(), MY_TEST(flags & UNSIGNED_FLAG));
|
||||
return to->store(val_int(), is_unsigned());
|
||||
}
|
||||
bool is_equal(const Column_definition &new_field) const;
|
||||
uint row_pack_length() const { return pack_length(); }
|
||||
|
@ -1922,7 +1976,7 @@ public:
|
|||
my_decimal *val_decimal(my_decimal *);
|
||||
bool val_bool() { return val_real() != 0e0; }
|
||||
virtual bool str_needs_quotes() { return TRUE; }
|
||||
bool eq_cmp_as_binary() { return MY_TEST(flags & BINARY_FLAG); }
|
||||
bool eq_cmp_as_binary() { return MY_TEST(flags() & BINARY_FLAG); }
|
||||
virtual uint length_size() const { return 0; }
|
||||
double pos_in_interval(Field *min, Field *max)
|
||||
{
|
||||
|
@ -2778,7 +2832,7 @@ public:
|
|||
const LEX_CSTRING *field_name_arg)
|
||||
:Field(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, unireg_check_arg,
|
||||
field_name_arg)
|
||||
{ flags|= BINARY_FLAG; }
|
||||
{ add_flags(BINARY_FLAG); }
|
||||
int store_hex_hybrid(const char *str, size_t length)
|
||||
{
|
||||
return store(str, length, &my_charset_bin);
|
||||
|
@ -3417,7 +3471,7 @@ public:
|
|||
{
|
||||
if (unireg_check == TIMESTAMP_UN_FIELD ||
|
||||
unireg_check == TIMESTAMP_DNUN_FIELD)
|
||||
flags|= ON_UPDATE_NOW_FLAG;
|
||||
add_flags(ON_UPDATE_NOW_FLAG);
|
||||
}
|
||||
const Type_handler *type_handler() const { return &type_handler_datetime; }
|
||||
enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONGLONG; }
|
||||
|
@ -3955,16 +4009,13 @@ public:
|
|||
:Field_longstr((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0, 0,
|
||||
NONE, field_name_arg, collation),
|
||||
packlength(4)
|
||||
{
|
||||
flags|= BLOB_FLAG;
|
||||
}
|
||||
{ }
|
||||
Field_blob(uint32 len_arg,bool maybe_null_arg,
|
||||
const LEX_CSTRING *field_name_arg,
|
||||
const DTCollation &collation, bool set_packlength)
|
||||
:Field_longstr((uchar*) 0,len_arg, maybe_null_arg ? (uchar*) "": 0, 0,
|
||||
NONE, field_name_arg, collation)
|
||||
{
|
||||
flags|= BLOB_FLAG;
|
||||
packlength= set_packlength ? number_storage_requirement(len_arg) : 4;
|
||||
}
|
||||
Field_blob(uint32 packlength_arg)
|
||||
|
@ -4021,7 +4072,7 @@ public:
|
|||
if (from->type() == MYSQL_TYPE_BIT)
|
||||
return do_field_int;
|
||||
*/
|
||||
if (!(from->flags & BLOB_FLAG) || from->charset() != charset() ||
|
||||
if (!(from->flags() & BLOB_FLAG) || from->charset() != charset() ||
|
||||
!from->compression_method() != !compression_method())
|
||||
return do_conv_blob;
|
||||
if (from->pack_length() != Field_blob::pack_length())
|
||||
|
@ -4260,9 +4311,7 @@ public:
|
|||
:Field_str(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
|
||||
unireg_check_arg, field_name_arg, collation),
|
||||
packlength(packlength_arg),typelib(typelib_arg)
|
||||
{
|
||||
flags|=ENUM_FLAG;
|
||||
}
|
||||
{ }
|
||||
Field *make_new_field(MEM_ROOT *root, TABLE *new_table, bool keep_type);
|
||||
const Type_handler *type_handler() const { return &type_handler_enum; }
|
||||
enum ha_base_keytype key_type() const;
|
||||
|
@ -4298,7 +4347,7 @@ public:
|
|||
bool memcpy_field_possible(const Field *from) const { return false; }
|
||||
void make_empty_rec_reset(THD *thd)
|
||||
{
|
||||
if (flags & NOT_NULL_FLAG)
|
||||
if (flags() & NOT_NULL_FLAG)
|
||||
{
|
||||
set_notnull();
|
||||
store((longlong) 1, true);
|
||||
|
@ -4369,9 +4418,7 @@ public:
|
|||
packlength_arg,
|
||||
typelib_arg, collation),
|
||||
empty_set_string("", 0, collation.collation)
|
||||
{
|
||||
flags=(flags & ~ENUM_FLAG) | SET_FLAG;
|
||||
}
|
||||
{ }
|
||||
void make_empty_rec_reset(THD *thd)
|
||||
{
|
||||
Field::make_empty_rec_reset(thd);
|
||||
|
@ -4661,6 +4708,7 @@ public:
|
|||
*/
|
||||
class Column_definition: public Sql_alloc,
|
||||
public Type_handler_hybrid_field_type,
|
||||
public Column_cached_flags,
|
||||
public Column_definition_attributes
|
||||
{
|
||||
/**
|
||||
|
@ -4722,7 +4770,8 @@ public:
|
|||
for most of the types, or of bytes for BLOBs or numeric types.
|
||||
*/
|
||||
uint32 char_length;
|
||||
uint decimals, flags, pack_length, key_length;
|
||||
uint decimals, pack_length, key_length;
|
||||
|
||||
List<String> interval_list;
|
||||
engine_option_value *option_list;
|
||||
|
||||
|
@ -4743,10 +4792,11 @@ public:
|
|||
|
||||
Column_definition()
|
||||
:Type_handler_hybrid_field_type(&type_handler_null),
|
||||
Column_cached_flags(0),
|
||||
compression_method_ptr(0),
|
||||
comment(null_clex_str),
|
||||
on_update(NULL), invisible(VISIBLE), char_length(0), decimals(0),
|
||||
flags(0), pack_length(0), key_length(0),
|
||||
pack_length(0), key_length(0),
|
||||
option_list(NULL),
|
||||
vcol_info(0), default_value(0), check_constraint(0),
|
||||
versioning(VERSIONING_NOT_SET), period(NULL)
|
||||
|
@ -4780,10 +4830,6 @@ public:
|
|||
length*= charset->mbmaxlen;
|
||||
key_length= pack_length;
|
||||
}
|
||||
bool vers_sys_field() const
|
||||
{
|
||||
return flags & (VERS_SYS_START_FLAG | VERS_SYS_END_FLAG);
|
||||
}
|
||||
void create_length_to_internal_length_bit();
|
||||
void create_length_to_internal_length_newdecimal();
|
||||
|
||||
|
@ -4847,7 +4893,15 @@ public:
|
|||
bool prepare_stage2_typelib(const char *type_name, uint field_flags,
|
||||
uint *dup_val_count);
|
||||
uint pack_flag_numeric(uint dec) const;
|
||||
uint sign_length() const { return flags & UNSIGNED_FLAG ? 0 : 1; }
|
||||
uint32 flags() const
|
||||
{
|
||||
return cached_flags() | type_handler()->flags();
|
||||
}
|
||||
bool is_unsigned() const
|
||||
{
|
||||
return cached_flags() & UNSIGNED_FLAG;
|
||||
}
|
||||
uint sign_length() const { return is_unsigned() ? 0 : 1; }
|
||||
bool check_length(uint mysql_errno, uint max_allowed_length) const;
|
||||
bool fix_attributes_real(uint default_length);
|
||||
bool fix_attributes_int(uint default_length);
|
||||
|
@ -4860,18 +4914,6 @@ public:
|
|||
|
||||
bool stored_in_db() const { return !vcol_info || vcol_info->stored_in_db; }
|
||||
|
||||
ha_storage_media field_storage_type() const
|
||||
{
|
||||
return (ha_storage_media)
|
||||
((flags >> FIELD_FLAGS_STORAGE_MEDIA) & 3);
|
||||
}
|
||||
|
||||
column_format_type column_format() const
|
||||
{
|
||||
return (column_format_type)
|
||||
((flags >> FIELD_FLAGS_COLUMN_FORMAT) & 3);
|
||||
}
|
||||
|
||||
bool has_default_function() const
|
||||
{
|
||||
return unireg_check != Field::NONE;
|
||||
|
@ -4883,7 +4925,7 @@ public:
|
|||
{
|
||||
return Column_definition_attributes::make_field(share, mem_root, addr,
|
||||
type_handler(),
|
||||
field_name_arg, flags);
|
||||
field_name_arg, flags());
|
||||
}
|
||||
Field *make_field(TABLE_SHARE *share, MEM_ROOT *mem_root,
|
||||
const LEX_CSTRING *field_name_arg) const
|
||||
|
@ -4906,7 +4948,7 @@ public:
|
|||
length= other.length;
|
||||
char_length= other.char_length;
|
||||
decimals= other.decimals;
|
||||
flags= other.flags;
|
||||
set_flags(other.cached_flags());
|
||||
pack_length= other.pack_length;
|
||||
key_length= other.key_length;
|
||||
unireg_check= other.unireg_check;
|
||||
|
@ -5168,7 +5210,7 @@ public:
|
|||
org_col_name(field->field_name),
|
||||
length(field->field_length),
|
||||
flags(field->table->maybe_null ?
|
||||
(field->flags & ~NOT_NULL_FLAG) : field->flags),
|
||||
(field->flags() & ~NOT_NULL_FLAG) : field->flags()),
|
||||
decimals(field->decimals())
|
||||
{
|
||||
normalize();
|
||||
|
|
|
@ -400,8 +400,7 @@ static void do_field_varbinary_pre50(Copy_field *copy)
|
|||
void Field::do_field_int(Copy_field *copy)
|
||||
{
|
||||
longlong value= copy->from_field->val_int();
|
||||
copy->to_field->store(value,
|
||||
MY_TEST(copy->from_field->flags & UNSIGNED_FLAG));
|
||||
copy->to_field->store(value, copy->from_field->is_unsigned());
|
||||
}
|
||||
|
||||
void Field::do_field_real(Copy_field *copy)
|
||||
|
@ -716,7 +715,7 @@ void Copy_field::set(Field *to,Field *from,bool save)
|
|||
else
|
||||
do_copy=0;
|
||||
|
||||
if ((to->flags & BLOB_FLAG) && save)
|
||||
if ((to->flags() & BLOB_FLAG) && save)
|
||||
do_copy2= do_save_blob;
|
||||
else
|
||||
do_copy2= to->get_copy_func(from);
|
||||
|
|
|
@ -2007,7 +2007,7 @@ bool filesort_use_addons(TABLE *table, uint sortlength,
|
|||
{
|
||||
if (!bitmap_is_set(table->read_set, field->field_index))
|
||||
continue;
|
||||
if (field->flags & BLOB_FLAG)
|
||||
if (field->flags() & BLOB_FLAG)
|
||||
return false;
|
||||
(*length)+= field->max_packed_col_length(field->pack_length());
|
||||
if (field->maybe_null())
|
||||
|
|
|
@ -3259,7 +3259,7 @@ int handler::update_auto_increment()
|
|||
1).
|
||||
Ignore negative values.
|
||||
*/
|
||||
if ((longlong) nr > 0 || (table->next_number_field->flags & UNSIGNED_FLAG))
|
||||
if ((longlong) nr > 0 || table->next_number_field->is_unsigned())
|
||||
adjust_next_insert_id_after_explicit_value(nr);
|
||||
insert_id_for_cur_row= 0; // didn't generate anything
|
||||
DBUG_RETURN(0);
|
||||
|
@ -7262,11 +7262,11 @@ bool Vers_parse_info::is_end(const char *name) const
|
|||
}
|
||||
bool Vers_parse_info::is_start(const Create_field &f) const
|
||||
{
|
||||
return f.flags & VERS_SYS_START_FLAG;
|
||||
return f.flags() & VERS_SYS_START_FLAG;
|
||||
}
|
||||
bool Vers_parse_info::is_end(const Create_field &f) const
|
||||
{
|
||||
return f.flags & VERS_SYS_END_FLAG;
|
||||
return f.flags() & VERS_SYS_END_FLAG;
|
||||
}
|
||||
|
||||
static Create_field *vers_init_sys_field(THD *thd, const char *field_name, int flags, bool integer)
|
||||
|
@ -7278,13 +7278,13 @@ static Create_field *vers_init_sys_field(THD *thd, const char *field_name, int f
|
|||
f->field_name.str= field_name;
|
||||
f->field_name.length= strlen(field_name);
|
||||
f->charset= system_charset_info;
|
||||
f->flags= flags | NOT_NULL_FLAG;
|
||||
f->set_flags(flags | NOT_NULL_FLAG);
|
||||
if (integer)
|
||||
{
|
||||
DBUG_ASSERT(0); // Not implemented yet
|
||||
f->set_handler(&type_handler_vers_trx_id);
|
||||
f->length= MY_INT64_NUM_DECIMAL_DIGITS - 1;
|
||||
f->flags|= UNSIGNED_FLAG;
|
||||
f->add_flags(UNSIGNED_FLAG);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -7370,7 +7370,7 @@ bool Table_scope_and_contents_source_st::vers_fix_system_fields(
|
|||
!(alter_info->flags & ALTER_ADD_SYSTEM_VERSIONING)) ||
|
||||
f->versioning == Column_definition::WITHOUT_VERSIONING)
|
||||
{
|
||||
f->flags|= VERS_UPDATE_UNVERSIONED_FLAG;
|
||||
f->add_flags(VERS_UPDATE_UNVERSIONED_FLAG);
|
||||
}
|
||||
} // while (Create_field *f= it++)
|
||||
|
||||
|
@ -7460,7 +7460,7 @@ bool Vers_parse_info::fix_alter_info(THD *thd, Alter_info *alter_info,
|
|||
List_iterator_fast<Create_field> it(alter_info->create_list);
|
||||
while (Create_field *f= it++)
|
||||
{
|
||||
if (f->change.length && f->flags & VERS_SYSTEM_FIELD)
|
||||
if (f->change.length && f->flags() & VERS_SYSTEM_FIELD)
|
||||
{
|
||||
my_error(ER_VERS_ALTER_SYSTEM_FIELD, MYF(0), f->field_name.str);
|
||||
return true;
|
||||
|
@ -7502,7 +7502,7 @@ bool Vers_parse_info::fix_alter_info(THD *thd, Alter_info *alter_info,
|
|||
while (Create_field *f= it++)
|
||||
{
|
||||
if (f->versioning == Column_definition::WITHOUT_VERSIONING)
|
||||
f->flags|= VERS_UPDATE_UNVERSIONED_FLAG;
|
||||
f->add_flags(VERS_UPDATE_UNVERSIONED_FLAG);
|
||||
|
||||
if (f->change.str && (start.streq(f->change) || end.streq(f->change)))
|
||||
{
|
||||
|
@ -7545,7 +7545,7 @@ Vers_parse_info::fix_create_like(Alter_info &alter_info, HA_CREATE_INFO &create_
|
|||
int remove= 2;
|
||||
while (remove && (f= it++))
|
||||
{
|
||||
if (f->flags & VERS_SYSTEM_FIELD)
|
||||
if (f->flags() & VERS_SYSTEM_FIELD)
|
||||
{
|
||||
it.remove();
|
||||
remove--;
|
||||
|
@ -7561,13 +7561,13 @@ Vers_parse_info::fix_create_like(Alter_info &alter_info, HA_CREATE_INFO &create_
|
|||
|
||||
while ((f= it++))
|
||||
{
|
||||
if (f->flags & VERS_SYS_START_FLAG)
|
||||
if (f->flags() & VERS_SYS_START_FLAG)
|
||||
{
|
||||
f_start= f;
|
||||
if (f_end)
|
||||
break;
|
||||
}
|
||||
else if (f->flags & VERS_SYS_END_FLAG)
|
||||
else if (f->flags() & VERS_SYS_END_FLAG)
|
||||
{
|
||||
f_end= f;
|
||||
if (f_start)
|
||||
|
@ -7643,7 +7643,7 @@ static bool is_some_bigint(const Create_field *f)
|
|||
|
||||
static bool is_versioning_bigint(const Create_field *f)
|
||||
{
|
||||
return is_some_bigint(f) && f->flags & UNSIGNED_FLAG &&
|
||||
return is_some_bigint(f) && f->is_unsigned() &&
|
||||
f->length == MY_INT64_NUM_DECIMAL_DIGITS - 1;
|
||||
}
|
||||
|
||||
|
@ -7674,9 +7674,9 @@ bool Vers_parse_info::check_sys_fields(const Lex_table_name &table_name,
|
|||
List_iterator<Create_field> it(alter_info->create_list);
|
||||
while (Create_field *f= it++)
|
||||
{
|
||||
if (!row_start && f->flags & VERS_SYS_START_FLAG)
|
||||
if (!row_start && f->flags() & VERS_SYS_START_FLAG)
|
||||
row_start= f;
|
||||
else if (!row_end && f->flags & VERS_SYS_END_FLAG)
|
||||
else if (!row_end && f->flags() & VERS_SYS_END_FLAG)
|
||||
row_end= f;
|
||||
}
|
||||
|
||||
|
@ -7725,7 +7725,7 @@ bool Table_period_info::check_field(const Create_field* f,
|
|||
my_error(ER_WRONG_FIELD_SPEC, MYF(0), f->field_name.str);
|
||||
res= true;
|
||||
}
|
||||
else if (f->vcol_info || f->flags & VERS_SYSTEM_FIELD)
|
||||
else if (f->vcol_info || f->flags() & VERS_SYSTEM_FIELD)
|
||||
{
|
||||
my_error(ER_PERIOD_FIELD_WRONG_ATTRIBUTES, MYF(0),
|
||||
f->field_name.str, "GENERATED ALWAYS AS");
|
||||
|
@ -7808,7 +7808,7 @@ Table_scope_and_contents_source_st::fix_period_fields(THD *thd,
|
|||
if (period.start.streq(f->field_name) || period.end.streq(f->field_name))
|
||||
{
|
||||
f->period= &period_info;
|
||||
f->flags|= NOT_NULL_FLAG;
|
||||
f->add_flags(NOT_NULL_FLAG);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -908,7 +908,7 @@ bool Item_field::register_field_in_write_map(void *arg)
|
|||
bool Item_field::check_field_expression_processor(void *arg)
|
||||
{
|
||||
Field *org_field= (Field*) arg;
|
||||
if (field->flags & NO_DEFAULT_VALUE_FLAG)
|
||||
if (field->flags() & NO_DEFAULT_VALUE_FLAG)
|
||||
return 0;
|
||||
if ((field->default_value && field->default_value->flags) || field->vcol_info)
|
||||
{
|
||||
|
@ -9161,7 +9161,7 @@ bool Item_default_value::fix_fields(THD *thd, Item **items)
|
|||
}
|
||||
|
||||
field_arg= (Item_field *)real_arg;
|
||||
if ((field_arg->field->flags & NO_DEFAULT_VALUE_FLAG))
|
||||
if ((field_arg->field->flags() & NO_DEFAULT_VALUE_FLAG))
|
||||
{
|
||||
my_error(ER_NO_DEFAULT_FOR_FIELD, MYF(0),
|
||||
field_arg->field->field_name.str);
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
Cached_item *new_Cached_item(THD *thd, Item *item, bool pass_through_ref)
|
||||
{
|
||||
if (pass_through_ref && item->real_item()->type() == Item::FIELD_ITEM &&
|
||||
!(((Item_field *) (item->real_item()))->field->flags & BLOB_FLAG))
|
||||
!(((Item_field *) (item->real_item()))->field->flags() & BLOB_FLAG))
|
||||
{
|
||||
Item_field *real_item= (Item_field *) item->real_item();
|
||||
Field *cached_field= real_item->field;
|
||||
|
|
|
@ -357,7 +357,7 @@ static bool convert_const_to_int(THD *thd, Item_field *field_item,
|
|||
if (0 == field_cmp)
|
||||
{
|
||||
Item *tmp= new (thd->mem_root) Item_int_with_ref(thd, field->val_int(), *item,
|
||||
MY_TEST(field->flags & UNSIGNED_FLAG));
|
||||
field->is_unsigned());
|
||||
if (tmp)
|
||||
thd->change_item_tree(item, tmp);
|
||||
result= 1; // Item was replaced
|
||||
|
|
|
@ -2563,7 +2563,7 @@ public:
|
|||
{
|
||||
Field *field=((Item_field*) args[0]->real_item())->field;
|
||||
|
||||
if ((field->flags & NOT_NULL_FLAG) &&
|
||||
if ((field->flags() & NOT_NULL_FLAG) &&
|
||||
field->type_handler()->cond_notnull_field_isnull_to_field_eq_zero())
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1303,7 +1303,7 @@ Field *Item_sum_min_max::create_tmp_field(MEM_ROOT *root,
|
|||
Field *field= ((Item_field*) args[0])->field;
|
||||
if ((field= field->create_tmp_field(root, table, true)))
|
||||
{
|
||||
DBUG_ASSERT((field->flags & NOT_NULL_FLAG) == 0);
|
||||
DBUG_ASSERT((field->flags() & NOT_NULL_FLAG) == 0);
|
||||
field->field_name= name;
|
||||
}
|
||||
DBUG_RETURN(field);
|
||||
|
|
|
@ -783,7 +783,7 @@ bool Log_to_csv_event_handler::
|
|||
A positive return value in store() means truncation.
|
||||
Still logging a message in the log in this case.
|
||||
*/
|
||||
table->field[5]->flags|= FIELDFLAG_HEX_ESCAPE;
|
||||
table->field[5]->add_flags(FIELDFLAG_HEX_ESCAPE);
|
||||
if (table->field[5]->store(sql_text, sql_text_len, client_cs) < 0)
|
||||
goto err;
|
||||
|
||||
|
|
|
@ -3083,7 +3083,7 @@ bool create_key_parts_for_pseudo_indexes(RANGE_OPT_PARAM *param,
|
|||
uint16 max_key_part_length= (uint16) table->file->max_key_part_length();
|
||||
key_part->key= keys;
|
||||
key_part->part= 0;
|
||||
if (field->flags & BLOB_FLAG)
|
||||
if (field->flags() & BLOB_FLAG)
|
||||
key_part->length= max_key_part_length;
|
||||
else
|
||||
{
|
||||
|
@ -15815,7 +15815,7 @@ static void print_key_value(String *out, const KEY_PART_INFO *key_part,
|
|||
{
|
||||
field= key_part->field;
|
||||
store_length= key_part->store_length;
|
||||
if (field->flags & BLOB_FLAG)
|
||||
if (field->flags() & BLOB_FLAG)
|
||||
{
|
||||
// Byte 0 of a nullable key is the null-byte. If set, key is NULL.
|
||||
if (field->real_maybe_null() && *key)
|
||||
|
|
|
@ -4392,7 +4392,7 @@ SJ_TMP_TABLE::create_sj_weedout_tmp_table(THD *thd)
|
|||
field->part_of_key.clear_all();
|
||||
field->part_of_sortkey.clear_all();
|
||||
field->unireg_check= Field::NONE;
|
||||
field->flags= (NOT_NULL_FLAG | BINARY_FLAG | NO_DEFAULT_VALUE_FLAG);
|
||||
field->set_flags(NOT_NULL_FLAG | BINARY_FLAG | NO_DEFAULT_VALUE_FLAG);
|
||||
field->reset_fields();
|
||||
field->init(table);
|
||||
field->orig_table= NULL;
|
||||
|
|
|
@ -904,7 +904,7 @@ static bool find_key_for_maxmin(bool max_fl, TABLE_REF *ref,
|
|||
Field* field, COND *cond,
|
||||
uint *range_fl, uint *prefix_len)
|
||||
{
|
||||
if (!(field->flags & PART_KEY_FLAG))
|
||||
if (!(field->flags() & PART_KEY_FLAG))
|
||||
return FALSE; // Not key field
|
||||
|
||||
DBUG_ENTER("find_key_for_maxmin");
|
||||
|
@ -937,7 +937,7 @@ static bool find_key_for_maxmin(bool max_fl, TABLE_REF *ref,
|
|||
|
||||
/* Check whether the index component is partial */
|
||||
Field *part_field= table->field[part->fieldnr-1];
|
||||
if ((part_field->flags & BLOB_FLAG) ||
|
||||
if ((part_field->flags() & BLOB_FLAG) ||
|
||||
part->length < part_field->key_length())
|
||||
break;
|
||||
|
||||
|
|
|
@ -902,7 +902,7 @@ bool partition_info::vers_setup_expression(THD * thd, uint32 alter_add)
|
|||
part_field_list.push_back(row_end->field_name.str, thd->mem_root);
|
||||
DBUG_ASSERT(part_field_list.elements == 1);
|
||||
// needed in handle_list_of_fields()
|
||||
row_end->flags|= GET_FIXED_FIELDS_FLAG;
|
||||
row_end->add_flags(GET_FIXED_FIELDS_FLAG);
|
||||
}
|
||||
|
||||
if (alter_add)
|
||||
|
|
|
@ -482,7 +482,7 @@ int prepare_record(TABLE *const table, const uint skip, const bool check)
|
|||
for (Field **field_ptr= table->field+skip; *field_ptr; ++field_ptr)
|
||||
{
|
||||
Field *const f= *field_ptr;
|
||||
if ((f->flags & NO_DEFAULT_VALUE_FLAG) &&
|
||||
if ((f->flags() & NO_DEFAULT_VALUE_FLAG) &&
|
||||
(f->real_type() != MYSQL_TYPE_ENUM))
|
||||
{
|
||||
THD *thd= f->table->in_use;
|
||||
|
|
|
@ -177,11 +177,11 @@ unpack_row_old(rpl_group_info *rgi,
|
|||
uint32 const mask= NOT_NULL_FLAG | NO_DEFAULT_VALUE_FLAG;
|
||||
|
||||
DBUG_PRINT("debug", ("flags = 0x%x, mask = 0x%x, flags & mask = 0x%x",
|
||||
(*field_ptr)->flags, mask,
|
||||
(*field_ptr)->flags & mask));
|
||||
(*field_ptr)->flags(), mask,
|
||||
(*field_ptr)->flags() & mask));
|
||||
|
||||
if (event_type == WRITE_ROWS_EVENT &&
|
||||
((*field_ptr)->flags & mask) == mask)
|
||||
((*field_ptr)->flags() & mask) == mask)
|
||||
{
|
||||
rgi->rli->report(ERROR_LEVEL, ER_NO_DEFAULT_FOR_FIELD, NULL,
|
||||
"Field `%s` of table `%s`.`%s` "
|
||||
|
|
|
@ -1044,7 +1044,7 @@ public:
|
|||
" maybe_null: %d, unsigned_flag: %d, pack_length: %u",
|
||||
handler->name().ptr(), target_field->field_name.str,
|
||||
tmp->field_length, tmp->decimals(), TRUE,
|
||||
tmp->flags, tmp->pack_length()));
|
||||
tmp->flags(), tmp->pack_length()));
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -256,7 +256,7 @@ bool Qualified_column_ident::resolve_type_ref(THD *thd, Column_definition *def)
|
|||
m_column.length, src)))
|
||||
{
|
||||
*def= Column_definition(thd, src, NULL/*No defaults,no constraints*/);
|
||||
def->flags&= (uint) ~NOT_NULL_FLAG;
|
||||
def->clear_flags(NOT_NULL_FLAG);
|
||||
rc= def->sp_prepare_create_field(thd, thd->mem_root);
|
||||
}
|
||||
}
|
||||
|
@ -323,7 +323,7 @@ bool Table_ident::resolve_table_rowtype_ref(THD *thd,
|
|||
(rc= !(def= new (thd->mem_root) Spvar_definition(thd, *src))))
|
||||
break;
|
||||
src[0]->field_name.str= tmp.str; // Restore field name, just in case.
|
||||
def->flags&= (uint) ~NOT_NULL_FLAG;
|
||||
def->clear_flags(NOT_NULL_FLAG);
|
||||
if ((rc= def->sp_prepare_create_field(thd, thd->mem_root)))
|
||||
break;
|
||||
defs.push_back(def, thd->mem_root);
|
||||
|
|
|
@ -5723,7 +5723,7 @@ static void update_field_dependencies(THD *thd, Field *field, TABLE *table)
|
|||
table->used_fields++;
|
||||
}
|
||||
if (table->get_fields_in_item_tree)
|
||||
field->flags|= GET_FIXED_FIELDS_FLAG;
|
||||
field->add_flags(GET_FIXED_FIELDS_FLAG);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
@ -8603,7 +8603,7 @@ static bool not_null_fields_have_null_values(TABLE *table)
|
|||
if (ff != of)
|
||||
{
|
||||
// copy after-update flags to of, copy before-update flags to ff
|
||||
swap_variables(uint32, of->flags, ff->flags);
|
||||
ff->swap_flags(of);
|
||||
if (ff->is_real_null())
|
||||
{
|
||||
ff->set_notnull(); // for next row WHERE condition in UPDATE
|
||||
|
|
|
@ -6708,7 +6708,7 @@ void THD::binlog_prepare_row_images(TABLE *table)
|
|||
{
|
||||
Field *field= (*ptr);
|
||||
if ((field->type() == MYSQL_TYPE_BLOB) &&
|
||||
!(field->flags & PRI_KEY_FLAG))
|
||||
!(field->flags() & PRI_KEY_FLAG))
|
||||
bitmap_clear_bit(&table->tmp_set, field->field_index);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -317,7 +317,8 @@ static int check_insert_fields(THD *thd, TABLE_LIST *table_list,
|
|||
|
||||
static bool has_no_default_value(THD *thd, Field *field, TABLE_LIST *table_list)
|
||||
{
|
||||
if ((field->flags & NO_DEFAULT_VALUE_FLAG) && field->real_type() != MYSQL_TYPE_ENUM)
|
||||
if ((field->flags() & NO_DEFAULT_VALUE_FLAG) &&
|
||||
field->real_type() != MYSQL_TYPE_ENUM)
|
||||
{
|
||||
bool view= false;
|
||||
if (table_list)
|
||||
|
@ -3227,7 +3228,7 @@ static void unlink_blobs(TABLE *table)
|
|||
{
|
||||
for (Field **ptr=table->field ; *ptr ; ptr++)
|
||||
{
|
||||
if ((*ptr)->flags & BLOB_FLAG)
|
||||
if ((*ptr)->flags() & BLOB_FLAG)
|
||||
((Field_blob *) (*ptr))->clear_temporary();
|
||||
}
|
||||
}
|
||||
|
@ -3238,7 +3239,7 @@ static void free_delayed_insert_blobs(TABLE *table)
|
|||
{
|
||||
for (Field **ptr=table->field ; *ptr ; ptr++)
|
||||
{
|
||||
if ((*ptr)->flags & BLOB_FLAG)
|
||||
if ((*ptr)->flags() & BLOB_FLAG)
|
||||
((Field_blob *) *ptr)->free();
|
||||
}
|
||||
}
|
||||
|
@ -3250,7 +3251,7 @@ static void set_delayed_insert_blobs(TABLE *table)
|
|||
{
|
||||
for (Field **ptr=table->field ; *ptr ; ptr++)
|
||||
{
|
||||
if ((*ptr)->flags & BLOB_FLAG)
|
||||
if ((*ptr)->flags() & BLOB_FLAG)
|
||||
{
|
||||
Field_blob *blob= ((Field_blob *) *ptr);
|
||||
uchar *data= blob->get_ptr();
|
||||
|
@ -4237,7 +4238,7 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items,
|
|||
DBUG_RETURN(NULL);
|
||||
|
||||
if (item->maybe_null)
|
||||
cr_field->flags &= ~NOT_NULL_FLAG;
|
||||
cr_field->clear_flags(NOT_NULL_FLAG);
|
||||
alter_info->create_list.push_back(cr_field, thd->mem_root);
|
||||
}
|
||||
|
||||
|
|
|
@ -8820,7 +8820,7 @@ bool LEX::last_field_generated_always_as_row_start_or_end(Lex_ident *p,
|
|||
last_field->field_name.str);
|
||||
return true;
|
||||
}
|
||||
last_field->flags|= (flag | NOT_NULL_FLAG);
|
||||
last_field->add_flags(flag | NOT_NULL_FLAG);
|
||||
DBUG_ASSERT(p);
|
||||
*p= last_field->field_name;
|
||||
return false;
|
||||
|
|
|
@ -283,7 +283,7 @@ static bool write_execute_load_query_log_event(THD *, const sql_exchange*, const
|
|||
|
||||
bool Load_data_param::add_outvar_field(THD *thd, const Field *field)
|
||||
{
|
||||
if (field->flags & BLOB_FLAG)
|
||||
if (field->flags() & BLOB_FLAG)
|
||||
{
|
||||
m_use_blobs= true;
|
||||
m_fixed_length+= 256; // Will be extended if needed
|
||||
|
|
|
@ -340,10 +340,10 @@ static bool set_up_field_array(THD *thd, TABLE *table,
|
|||
ptr= table->field;
|
||||
while ((field= *(ptr++)))
|
||||
{
|
||||
if (field->flags & GET_FIXED_FIELDS_FLAG)
|
||||
if (field->flags() & GET_FIXED_FIELDS_FLAG)
|
||||
{
|
||||
if (table->versioned(VERS_TRX_ID)
|
||||
&& unlikely(field->flags & VERS_SYSTEM_FIELD))
|
||||
&& unlikely(field->flags() & VERS_SYSTEM_FIELD))
|
||||
{
|
||||
my_error(ER_VERS_TRX_PART_HISTORIC_ROW_NOT_SUPPORTED, MYF(0));
|
||||
DBUG_RETURN(TRUE);
|
||||
|
@ -377,10 +377,10 @@ static bool set_up_field_array(THD *thd, TABLE *table,
|
|||
ptr= table->field;
|
||||
while ((field= *(ptr++)))
|
||||
{
|
||||
if (field->flags & GET_FIXED_FIELDS_FLAG)
|
||||
if (field->flags() & GET_FIXED_FIELDS_FLAG)
|
||||
{
|
||||
field->flags&= ~GET_FIXED_FIELDS_FLAG;
|
||||
field->flags|= FIELD_IN_PART_FUNC_FLAG;
|
||||
field->clear_flags(GET_FIXED_FIELDS_FLAG);
|
||||
field->add_flags(FIELD_IN_PART_FUNC_FLAG);
|
||||
if (likely(!result))
|
||||
{
|
||||
if (!is_sub_part && part_info->column_list)
|
||||
|
@ -424,7 +424,7 @@ static bool set_up_field_array(THD *thd, TABLE *table,
|
|||
performance reasons.
|
||||
*/
|
||||
|
||||
if (unlikely(field->flags & BLOB_FLAG))
|
||||
if (unlikely(field->flags() & BLOB_FLAG))
|
||||
{
|
||||
my_error(ER_BLOB_FIELD_IN_PART_FUNC_ERROR, MYF(0));
|
||||
result= TRUE;
|
||||
|
@ -489,7 +489,7 @@ static bool create_full_part_field_array(THD *thd, TABLE *table,
|
|||
ptr= table->field;
|
||||
while ((field= *(ptr++)))
|
||||
{
|
||||
if (field->flags & FIELD_IN_PART_FUNC_FLAG)
|
||||
if (field->flags() & FIELD_IN_PART_FUNC_FLAG)
|
||||
num_part_fields++;
|
||||
}
|
||||
size_field_array= (num_part_fields+1)*sizeof(Field*);
|
||||
|
@ -503,7 +503,7 @@ static bool create_full_part_field_array(THD *thd, TABLE *table,
|
|||
ptr= table->field;
|
||||
while ((field= *(ptr++)))
|
||||
{
|
||||
if (field->flags & FIELD_IN_PART_FUNC_FLAG)
|
||||
if (field->flags() & FIELD_IN_PART_FUNC_FLAG)
|
||||
field_array[num_part_fields++]= field;
|
||||
}
|
||||
field_array[num_part_fields]=0;
|
||||
|
@ -571,7 +571,7 @@ static void clear_indicator_in_key_fields(KEY *key_info)
|
|||
KEY_PART_INFO *key_part;
|
||||
uint key_parts= key_info->user_defined_key_parts, i;
|
||||
for (i= 0, key_part=key_info->key_part; i < key_parts; i++, key_part++)
|
||||
key_part->field->flags&= (~GET_FIXED_FIELDS_FLAG);
|
||||
key_part->field->clear_flags(GET_FIXED_FIELDS_FLAG);
|
||||
}
|
||||
|
||||
|
||||
|
@ -591,7 +591,7 @@ static void set_indicator_in_key_fields(KEY *key_info)
|
|||
KEY_PART_INFO *key_part;
|
||||
uint key_parts= key_info->user_defined_key_parts, i;
|
||||
for (i= 0, key_part=key_info->key_part; i < key_parts; i++, key_part++)
|
||||
key_part->field->flags|= GET_FIXED_FIELDS_FLAG;
|
||||
key_part->field->add_flags(GET_FIXED_FIELDS_FLAG);
|
||||
}
|
||||
|
||||
|
||||
|
@ -624,7 +624,7 @@ static void check_fields_in_PF(Field **ptr, bool *all_fields,
|
|||
do
|
||||
{
|
||||
/* Check if the field of the PF is part of the current key investigated */
|
||||
if ((*ptr)->flags & GET_FIXED_FIELDS_FLAG)
|
||||
if ((*ptr)->flags() & GET_FIXED_FIELDS_FLAG)
|
||||
*some_fields= TRUE;
|
||||
else
|
||||
*all_fields= FALSE;
|
||||
|
@ -651,7 +651,7 @@ static void clear_field_flag(TABLE *table)
|
|||
DBUG_ENTER("clear_field_flag");
|
||||
|
||||
for (ptr= table->field; *ptr; ptr++)
|
||||
(*ptr)->flags&= (~GET_FIXED_FIELDS_FLAG);
|
||||
(*ptr)->clear_flags(GET_FIXED_FIELDS_FLAG);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
@ -695,7 +695,7 @@ static bool handle_list_of_fields(THD *thd, List_iterator<const char> it,
|
|||
is_list_empty= FALSE;
|
||||
field= find_field_in_table_sef(table, field_name);
|
||||
if (likely(field != 0))
|
||||
field->flags|= GET_FIXED_FIELDS_FLAG;
|
||||
field->add_flags(GET_FIXED_FIELDS_FLAG);
|
||||
else
|
||||
{
|
||||
my_error(ER_FIELD_NOT_FOUND_PART_ERROR, MYF(0));
|
||||
|
@ -716,7 +716,7 @@ static bool handle_list_of_fields(THD *thd, List_iterator<const char> it,
|
|||
for (i= 0; i < num_key_parts; i++)
|
||||
{
|
||||
Field *field= table->key_info[primary_key].key_part[i].field;
|
||||
field->flags|= GET_FIXED_FIELDS_FLAG;
|
||||
field->add_flags(GET_FIXED_FIELDS_FLAG);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -3889,10 +3889,10 @@ static bool set_PF_fields_in_key(KEY *key_info, uint key_length)
|
|||
if (key_length < key_part->length)
|
||||
break;
|
||||
key_length-= key_part->length;
|
||||
if (key_part->field->flags & FIELD_IN_PART_FUNC_FLAG)
|
||||
if (key_part->field->flags() & FIELD_IN_PART_FUNC_FLAG)
|
||||
{
|
||||
found_part_field= TRUE;
|
||||
key_part->field->flags|= GET_FIXED_FIELDS_FLAG;
|
||||
key_part->field->add_flags(GET_FIXED_FIELDS_FLAG);
|
||||
}
|
||||
}
|
||||
DBUG_RETURN(found_part_field);
|
||||
|
@ -3919,7 +3919,7 @@ static bool check_part_func_bound(Field **ptr)
|
|||
|
||||
for (; *ptr; ptr++)
|
||||
{
|
||||
if (!((*ptr)->flags & GET_FIXED_FIELDS_FLAG))
|
||||
if (!((*ptr)->flags() & GET_FIXED_FIELDS_FLAG))
|
||||
{
|
||||
result= FALSE;
|
||||
break;
|
||||
|
@ -8565,7 +8565,7 @@ static uint32 get_next_partition_via_walking(PARTITION_ITERATOR *part_iter)
|
|||
while (part_iter->field_vals.cur != part_iter->field_vals.end)
|
||||
{
|
||||
longlong dummy;
|
||||
field->store(part_iter->field_vals.cur++, field->flags & UNSIGNED_FLAG);
|
||||
field->store(part_iter->field_vals.cur++, field->is_unsigned());
|
||||
if ((part_iter->part_info->is_sub_partitioned() &&
|
||||
!part_iter->part_info->get_part_partition_id(part_iter->part_info,
|
||||
&part_id, &dummy)) ||
|
||||
|
@ -8589,7 +8589,7 @@ static uint32 get_next_subpartition_via_walking(PARTITION_ITERATOR *part_iter)
|
|||
part_iter->field_vals.cur= part_iter->field_vals.start;
|
||||
return NOT_A_PARTITION_ID;
|
||||
}
|
||||
field->store(part_iter->field_vals.cur++, field->flags & UNSIGNED_FLAG);
|
||||
field->store(part_iter->field_vals.cur++, field->is_unsigned());
|
||||
if (part_iter->part_info->get_subpartition_id(part_iter->part_info,
|
||||
&res))
|
||||
return NOT_A_PARTITION_ID;
|
||||
|
|
|
@ -5791,11 +5791,11 @@ add_key_field(JOIN *join,
|
|||
!(field->table->pos_in_table_list->is_materialized_derived() &&
|
||||
field->table->is_created())) ||
|
||||
(field->table->pos_in_table_list->is_materialized_derived() &&
|
||||
!field->table->is_created() && !(field->flags & BLOB_FLAG))))
|
||||
!field->table->is_created() && !(field->flags() & BLOB_FLAG))))
|
||||
{
|
||||
optimize= KEY_OPTIMIZE_EQ;
|
||||
}
|
||||
else if (!(field->flags & PART_KEY_FLAG))
|
||||
else if (!(field->flags() & PART_KEY_FLAG))
|
||||
{
|
||||
// Don't remove column IS NULL on a LEFT JOIN table
|
||||
if (eq_func && (*value)->type() == Item::NULL_ITEM &&
|
||||
|
@ -5851,7 +5851,7 @@ add_key_field(JOIN *join,
|
|||
Field BETWEEN ...
|
||||
Field IN ...
|
||||
*/
|
||||
if (field->flags & PART_KEY_FLAG)
|
||||
if (field->flags() & PART_KEY_FLAG)
|
||||
stat[0].key_dependent|=used_tables;
|
||||
|
||||
bool is_const=1;
|
||||
|
@ -9523,7 +9523,7 @@ void JOIN_TAB::calc_used_field_length(bool max_fl)
|
|||
{
|
||||
if (bitmap_is_set(read_set, field->field_index))
|
||||
{
|
||||
uint flags=field->flags;
|
||||
uint flags= field->flags();
|
||||
fields++;
|
||||
rec_length+=field->pack_length();
|
||||
if (flags & BLOB_FLAG)
|
||||
|
@ -17257,7 +17257,7 @@ Item_func_isnull::remove_eq_conds(THD *thd, Item::cond_result *cond_value,
|
|||
{
|
||||
Field *field= ((Item_field*) real_item)->field;
|
||||
|
||||
if ((field->flags & NOT_NULL_FLAG) &&
|
||||
if ((field->flags() & NOT_NULL_FLAG) &&
|
||||
field->type_handler()->cond_notnull_field_isnull_to_field_eq_zero())
|
||||
{
|
||||
/* fix to replace 'NULL' dates with '0' (shreeve@uci.edu) */
|
||||
|
@ -17326,7 +17326,7 @@ Item_func_isnull::remove_eq_conds(THD *thd, Item::cond_result *cond_value,
|
|||
|
||||
if (top_level_arg) // "auto_increment_column IS NULL" is the only condition
|
||||
{
|
||||
if (field->flags & AUTO_INCREMENT_FLAG && !field->table->maybe_null &&
|
||||
if (field->flags() & AUTO_INCREMENT_FLAG && !field->table->maybe_null &&
|
||||
(thd->variables.option_bits & OPTION_AUTO_IS_NULL) &&
|
||||
(thd->first_successful_insert_id_in_prev_stmt > 0 &&
|
||||
thd->substitute_null_with_insert_id))
|
||||
|
@ -17886,17 +17886,17 @@ void Create_tmp_table::add_field(TABLE *table, Field *field, uint fieldnr, bool
|
|||
|
||||
if (force_not_null_cols)
|
||||
{
|
||||
field->flags|= NOT_NULL_FLAG;
|
||||
field->add_flags(NOT_NULL_FLAG);
|
||||
field->null_ptr= NULL;
|
||||
}
|
||||
|
||||
if (!(field->flags & NOT_NULL_FLAG))
|
||||
if (!(field->flags() & NOT_NULL_FLAG))
|
||||
m_null_count++;
|
||||
|
||||
table->s->reclength+= field->pack_length();
|
||||
|
||||
// Assign it here, before update_data_type_statistics() changes m_blob_count
|
||||
if (field->flags & BLOB_FLAG)
|
||||
if (field->flags() & BLOB_FLAG)
|
||||
table->s->blob_field[m_blob_count]= fieldnr;
|
||||
|
||||
table->field[fieldnr]= field;
|
||||
|
@ -18176,7 +18176,7 @@ bool Create_tmp_table::add_fields(THD *thd,
|
|||
|
||||
add_field(table, new_field, fieldnr++, param->force_not_null_cols);
|
||||
|
||||
if (!(new_field->flags & NOT_NULL_FLAG))
|
||||
if (!(new_field->flags() & NOT_NULL_FLAG))
|
||||
{
|
||||
/*
|
||||
new_field->maybe_null() is still false, it will be
|
||||
|
@ -18256,7 +18256,7 @@ bool Create_tmp_table::add_fields(THD *thd,
|
|||
if (item->marker == 4 && item->maybe_null)
|
||||
{
|
||||
m_group_null_items++;
|
||||
new_field->flags|= GROUP_FLAG;
|
||||
new_field->add_flags(GROUP_FLAG);
|
||||
}
|
||||
}
|
||||
if (!--m_hidden_field_count)
|
||||
|
@ -18412,7 +18412,7 @@ bool Create_tmp_table::finalize(THD *thd,
|
|||
uint length;
|
||||
bzero((uchar*) recinfo,sizeof(*recinfo));
|
||||
|
||||
if (!(field->flags & NOT_NULL_FLAG))
|
||||
if (!(field->flags() & NOT_NULL_FLAG))
|
||||
{
|
||||
recinfo->null_bit= (uint8)1 << (m_null_count & 7);
|
||||
recinfo->null_pos= m_null_count/8;
|
||||
|
@ -18680,7 +18680,7 @@ bool Create_tmp_table::finalize(THD *thd,
|
|||
i++, reg_field++, m_key_part_info++)
|
||||
{
|
||||
m_key_part_info->field= *reg_field;
|
||||
(*reg_field)->flags |= PART_KEY_FLAG;
|
||||
(*reg_field)->add_flags(PART_KEY_FLAG);
|
||||
if (m_key_part_info == keyinfo->key_part)
|
||||
(*reg_field)->key_start.set_bit(0);
|
||||
m_key_part_info->null_bit= (*reg_field)->null_bit;
|
||||
|
@ -18898,7 +18898,7 @@ void Virtual_tmp_table::setup_field_pointers()
|
|||
for (Field **cur_ptr= field; *cur_ptr; ++cur_ptr)
|
||||
{
|
||||
Field *cur_field= *cur_ptr;
|
||||
if ((cur_field->flags & NOT_NULL_FLAG))
|
||||
if ((cur_field->flags() & NOT_NULL_FLAG))
|
||||
cur_field->move_field(field_pos);
|
||||
else
|
||||
{
|
||||
|
@ -19138,7 +19138,7 @@ bool create_internal_tmp_table(TABLE *table, KEY *keyinfo,
|
|||
seg->language= field->charset()->number;
|
||||
seg->length= keyinfo->key_part[i].length;
|
||||
seg->start= keyinfo->key_part[i].offset;
|
||||
if (field->flags & BLOB_FLAG)
|
||||
if (field->flags() & BLOB_FLAG)
|
||||
{
|
||||
seg->type=
|
||||
((keyinfo->key_part[i].key_type & FIELDFLAG_BINARY) ?
|
||||
|
@ -19156,7 +19156,7 @@ bool create_internal_tmp_table(TABLE *table, KEY *keyinfo,
|
|||
keyinfo->key_part[i].length > 32)
|
||||
seg->flag|= HA_SPACE_PACK;
|
||||
}
|
||||
if (!(field->flags & NOT_NULL_FLAG))
|
||||
if (!(field->flags() & NOT_NULL_FLAG))
|
||||
{
|
||||
seg->null_bit= field->null_bit;
|
||||
seg->null_pos= (uint) (field->null_ptr - (uchar*) table->record[0]);
|
||||
|
@ -19333,7 +19333,7 @@ bool create_internal_tmp_table(TABLE *table, KEY *keyinfo,
|
|||
seg->language= field->charset()->number;
|
||||
seg->length= keyinfo->key_part[i].length;
|
||||
seg->start= keyinfo->key_part[i].offset;
|
||||
if (field->flags & BLOB_FLAG)
|
||||
if (field->flags() & BLOB_FLAG)
|
||||
{
|
||||
seg->type=
|
||||
((keyinfo->key_part[i].key_type & FIELDFLAG_BINARY) ?
|
||||
|
@ -19350,7 +19350,7 @@ bool create_internal_tmp_table(TABLE *table, KEY *keyinfo,
|
|||
keyinfo->key_part[i].length > 4)
|
||||
seg->flag|= HA_SPACE_PACK;
|
||||
}
|
||||
if (!(field->flags & NOT_NULL_FLAG))
|
||||
if (!(field->flags() & NOT_NULL_FLAG))
|
||||
{
|
||||
seg->null_bit= field->null_bit;
|
||||
seg->null_pos= (uint) (field->null_ptr - (uchar*) table->record[0]);
|
||||
|
@ -23529,7 +23529,7 @@ static bool copy_blobs(Field **ptr)
|
|||
{
|
||||
for (; *ptr ; ptr++)
|
||||
{
|
||||
if ((*ptr)->flags & BLOB_FLAG)
|
||||
if ((*ptr)->flags() & BLOB_FLAG)
|
||||
if (((Field_blob *) (*ptr))->copy())
|
||||
return 1; // Error
|
||||
}
|
||||
|
@ -23540,7 +23540,7 @@ static void free_blobs(Field **ptr)
|
|||
{
|
||||
for (; *ptr ; ptr++)
|
||||
{
|
||||
if ((*ptr)->flags & BLOB_FLAG)
|
||||
if ((*ptr)->flags() & BLOB_FLAG)
|
||||
((Field_blob *) (*ptr))->free();
|
||||
}
|
||||
}
|
||||
|
@ -24788,7 +24788,7 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
|
|||
item->name= ref->name;
|
||||
}
|
||||
pos= item;
|
||||
if (item->field->flags & BLOB_FLAG)
|
||||
if (item->field->flags() & BLOB_FLAG)
|
||||
{
|
||||
if (!(pos= new (thd->mem_root) Item_copy_string(thd, pos)))
|
||||
goto err;
|
||||
|
|
|
@ -2191,9 +2191,9 @@ public:
|
|||
new_field->init(this);
|
||||
field[s->fields]= new_field;
|
||||
s->reclength+= new_field->pack_length();
|
||||
if (!(new_field->flags & NOT_NULL_FLAG))
|
||||
if (!(new_field->flags() & NOT_NULL_FLAG))
|
||||
s->null_fields++;
|
||||
if (new_field->flags & BLOB_FLAG)
|
||||
if (new_field->flags() & BLOB_FLAG)
|
||||
{
|
||||
// Note, s->blob_fields was incremented in Field_blob::Field_blob
|
||||
DBUG_ASSERT(s->blob_fields);
|
||||
|
|
|
@ -209,7 +209,7 @@ bool check_sequence_fields(LEX *lex, List<Create_field> *fields)
|
|||
Field_definition *field_def= &sequence_structure[field_no];
|
||||
if (my_strcasecmp(system_charset_info, field_def->field_name,
|
||||
field->field_name.str) ||
|
||||
field->flags != field_def->flags ||
|
||||
field->flags() != field_def->flags ||
|
||||
field->type_handler() != field_def->type_handler)
|
||||
{
|
||||
reason= field->field_name.str;
|
||||
|
@ -253,7 +253,7 @@ bool prepare_sequence_fields(THD *thd, List<Create_field> *fields)
|
|||
new_field->length= field_info->length;
|
||||
new_field->char_length= field_info->length;
|
||||
new_field->comment= field_info->comment;
|
||||
new_field->flags= field_info->flags;
|
||||
new_field->set_flags(field_info->flags);
|
||||
if (unlikely(fields->push_back(new_field)))
|
||||
DBUG_RETURN(TRUE); /* purify inspected */
|
||||
}
|
||||
|
|
|
@ -1686,7 +1686,7 @@ static bool get_field_default_value(THD *thd, Field *field, String *def_value,
|
|||
enum enum_field_types field_type= field->type();
|
||||
|
||||
has_default= (field->default_value ||
|
||||
(!(field->flags & NO_DEFAULT_VALUE_FLAG) &&
|
||||
(!(field->flags() & NO_DEFAULT_VALUE_FLAG) &&
|
||||
!field->vers_sys_field() &&
|
||||
field->unireg_check != Field::NEXT_NUMBER));
|
||||
|
||||
|
@ -2107,7 +2107,7 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet,
|
|||
for (ptr=table->field ; (field= *ptr); ptr++)
|
||||
{
|
||||
|
||||
uint flags = field->flags;
|
||||
uint flags = field->flags();
|
||||
|
||||
if (field->invisible > INVISIBLE_USER)
|
||||
continue;
|
||||
|
@ -2161,11 +2161,11 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet,
|
|||
}
|
||||
else
|
||||
{
|
||||
if (field->flags & VERS_SYS_START_FLAG)
|
||||
if (field->flags() & VERS_SYS_START_FLAG)
|
||||
{
|
||||
packet->append(STRING_WITH_LEN(" GENERATED ALWAYS AS ROW START"));
|
||||
}
|
||||
else if (field->flags & VERS_SYS_END_FLAG)
|
||||
else if (field->flags() & VERS_SYS_END_FLAG)
|
||||
{
|
||||
packet->append(STRING_WITH_LEN(" GENERATED ALWAYS AS ROW END"));
|
||||
}
|
||||
|
@ -5901,13 +5901,13 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables,
|
|||
table->field[5]->store(type.ptr(), type.length(), cs);
|
||||
table->field[5]->set_notnull();
|
||||
}
|
||||
pos=(uchar*) ((field->flags & NOT_NULL_FLAG) ? "NO" : "YES");
|
||||
pos=(uchar*) ((field->flags() & NOT_NULL_FLAG) ? "NO" : "YES");
|
||||
table->field[6]->store((const char*) pos,
|
||||
strlen((const char*) pos), cs);
|
||||
store_column_type(table, field, cs, 7);
|
||||
pos=(uchar*) ((field->flags & PRI_KEY_FLAG) ? "PRI" :
|
||||
(field->flags & UNIQUE_KEY_FLAG) ? "UNI" :
|
||||
(field->flags & MULTIPLE_KEY_FLAG) ? "MUL":"");
|
||||
pos=(uchar*) ((field->flags() & PRI_KEY_FLAG) ? "PRI" :
|
||||
(field->flags() & UNIQUE_KEY_FLAG) ? "UNI" :
|
||||
(field->flags() & MULTIPLE_KEY_FLAG) ? "MUL":"");
|
||||
table->field[16]->store((const char*) pos,
|
||||
strlen((const char*) pos), cs);
|
||||
|
||||
|
@ -5930,9 +5930,9 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables,
|
|||
else
|
||||
buf.set(STRING_WITH_LEN("VIRTUAL GENERATED"), cs);
|
||||
}
|
||||
else if (field->flags & VERS_SYSTEM_FIELD)
|
||||
else if (field->flags() & VERS_SYSTEM_FIELD)
|
||||
{
|
||||
if (field->flags & VERS_SYS_START_FLAG)
|
||||
if (field->flags() & VERS_SYS_START_FLAG)
|
||||
{
|
||||
table->field[21]->store(STRING_WITH_LEN("ROW START"), cs);
|
||||
buf.set(STRING_WITH_LEN("STORED GENERATED"), cs);
|
||||
|
@ -6596,7 +6596,7 @@ static int get_schema_stat_record(THD *thd, TABLE_LIST *tables,
|
|||
key_part->field->charset()->mbmaxlen, TRUE);
|
||||
table->field[10]->set_notnull();
|
||||
}
|
||||
uint flags= key_part->field ? key_part->field->flags : 0;
|
||||
uint flags= key_part->field ? key_part->field->flags() : 0;
|
||||
const char *pos=(char*) ((flags & NOT_NULL_FLAG) ? "" : "YES");
|
||||
table->field[12]->store(pos, strlen(pos), cs);
|
||||
if (!show_table->s->keys_in_use.is_set(i))
|
||||
|
|
|
@ -2483,7 +2483,7 @@ void Column_statistics_collected::init(THD *thd, Field *table_field)
|
|||
column_total_length= 0;
|
||||
if (is_single_pk_col)
|
||||
count_distinct= NULL;
|
||||
if (table_field->flags & BLOB_FLAG)
|
||||
if (table_field->flags() & BLOB_FLAG)
|
||||
count_distinct= NULL;
|
||||
else
|
||||
{
|
||||
|
|
117
sql/sql_table.cc
117
sql/sql_table.cc
|
@ -2926,8 +2926,8 @@ bool Column_definition::prepare_stage2_typelib(const char *type_name,
|
|||
uint Column_definition::pack_flag_numeric(uint dec) const
|
||||
{
|
||||
return (FIELDFLAG_NUMBER |
|
||||
(flags & UNSIGNED_FLAG ? 0 : FIELDFLAG_DECIMAL) |
|
||||
(flags & ZEROFILL_FLAG ? FIELDFLAG_ZEROFILL : 0) |
|
||||
(is_unsigned() ? 0 : FIELDFLAG_DECIMAL) |
|
||||
(is_zerofill() ? FIELDFLAG_ZEROFILL : 0) |
|
||||
(dec << FIELDFLAG_DEC_SHIFT));
|
||||
}
|
||||
|
||||
|
@ -2965,10 +2965,10 @@ bool Column_definition::prepare_stage2(handler *file,
|
|||
if (type_handler()->Column_definition_prepare_stage2(this, file, table_flags))
|
||||
DBUG_RETURN(true);
|
||||
|
||||
if (!(flags & NOT_NULL_FLAG) ||
|
||||
if (!(flags() & NOT_NULL_FLAG) ||
|
||||
(vcol_info)) /* Make virtual columns allow NULL values */
|
||||
pack_flag|= FIELDFLAG_MAYBE_NULL;
|
||||
if (flags & NO_DEFAULT_VALUE_FLAG)
|
||||
if (flags() & NO_DEFAULT_VALUE_FLAG)
|
||||
pack_flag|= FIELDFLAG_NO_DEFAULT;
|
||||
DBUG_RETURN(false);
|
||||
}
|
||||
|
@ -3029,12 +3029,12 @@ void promote_first_timestamp_column(List<Create_field> *column_definitions)
|
|||
column_definition->unireg_check == Field::TIMESTAMP_OLD_FIELD) // Legacy
|
||||
{
|
||||
DBUG_PRINT("info", ("field-ptr:%p", column_definition->field));
|
||||
if ((column_definition->flags & NOT_NULL_FLAG) != 0 && // NOT NULL,
|
||||
if ((column_definition->flags() & NOT_NULL_FLAG) != 0 && // NOT NULL,
|
||||
column_definition->default_value == NULL && // no constant default,
|
||||
column_definition->unireg_check == Field::NONE && // no function default
|
||||
column_definition->vcol_info == NULL &&
|
||||
column_definition->period == NULL &&
|
||||
!(column_definition->flags & VERS_SYSTEM_FIELD)) // column isn't generated
|
||||
!(column_definition->flags() & VERS_SYSTEM_FIELD)) // column isn't generated
|
||||
{
|
||||
DBUG_PRINT("info", ("First TIMESTAMP column '%s' was promoted to "
|
||||
"DEFAULT CURRENT_TIMESTAMP ON UPDATE "
|
||||
|
@ -3176,7 +3176,7 @@ bool Column_definition::prepare_stage1_string(THD *thd,
|
|||
But not for blobs, as they will be stored as SQL expressions, not
|
||||
written down into the record image.
|
||||
*/
|
||||
if (!(flags & BLOB_FLAG) && default_value &&
|
||||
if (!(flags() & BLOB_FLAG) && default_value &&
|
||||
default_value->expr->basic_const_item() &&
|
||||
charset != default_value->expr->collation.collation)
|
||||
{
|
||||
|
@ -3235,7 +3235,7 @@ bool Column_definition::prepare_stage1_check_typelib_default()
|
|||
bool not_found;
|
||||
if (def == NULL) /* SQL "NULL" maps to NULL */
|
||||
{
|
||||
not_found= flags & NOT_NULL_FLAG;
|
||||
not_found= flags() & NOT_NULL_FLAG;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3332,7 +3332,7 @@ static Create_field * add_hash_field(THD * thd, List<Create_field> *create_list,
|
|||
{
|
||||
List_iterator<Create_field> it(*create_list);
|
||||
Create_field *dup_field, *cf= new (thd->mem_root) Create_field();
|
||||
cf->flags|= UNSIGNED_FLAG | LONG_UNIQUE_HASH_FIELD;
|
||||
cf->add_flags(UNSIGNED_FLAG | LONG_UNIQUE_HASH_FIELD);
|
||||
cf->decimals= 0;
|
||||
cf->length= cf->char_length= cf->pack_length= HA_HASH_FIELD_LENGTH;
|
||||
cf->invisible= INVISIBLE_FULL;
|
||||
|
@ -3418,7 +3418,7 @@ key_add_part_check_null(const handler *file, KEY *key_info,
|
|||
const Column_definition *sql_field,
|
||||
const Key_part_spec *column)
|
||||
{
|
||||
if (!(sql_field->flags & NOT_NULL_FLAG))
|
||||
if (!(sql_field->flags() & NOT_NULL_FLAG))
|
||||
{
|
||||
key_info->flags|= HA_NULL_PART_KEY;
|
||||
if (!(file->ha_table_flags() & HA_NULL_IN_KEY))
|
||||
|
@ -3541,13 +3541,13 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||
sql_field->length= sql_field->char_length;
|
||||
/* Set field charset. */
|
||||
sql_field->charset= get_sql_field_charset(sql_field, create_info);
|
||||
if ((sql_field->flags & BINCMP_FLAG) &&
|
||||
if ((sql_field->flags() & BINCMP_FLAG) &&
|
||||
!(sql_field->charset= find_bin_collation(sql_field->charset)))
|
||||
DBUG_RETURN(true);
|
||||
|
||||
/* Virtual fields are always NULL */
|
||||
if (sql_field->vcol_info)
|
||||
sql_field->flags&= ~NOT_NULL_FLAG;
|
||||
sql_field->clear_flags(NOT_NULL_FLAG);
|
||||
|
||||
if (sql_field->prepare_stage1(thd, thd->mem_root,
|
||||
file, file->ha_table_flags()))
|
||||
|
@ -3557,7 +3557,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||
file->ha_table_flags() & HA_CAN_BIT_FIELD)
|
||||
total_uneven_bit_length+= sql_field->length & 7;
|
||||
|
||||
if (!(sql_field->flags & NOT_NULL_FLAG))
|
||||
if (!(sql_field->flags() & NOT_NULL_FLAG))
|
||||
null_fields++;
|
||||
|
||||
if (check_column_name(sql_field->field_name.str))
|
||||
|
@ -3600,7 +3600,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||
dup_field->flags as flags. If we've incremented null_fields
|
||||
because of sql_field->flags, decrement it back.
|
||||
*/
|
||||
if (!(sql_field->flags & NOT_NULL_FLAG))
|
||||
if (!(sql_field->flags() & NOT_NULL_FLAG))
|
||||
null_fields--;
|
||||
|
||||
if (sql_field->redefine_stage1(dup_field, file, create_info))
|
||||
|
@ -3613,7 +3613,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||
}
|
||||
}
|
||||
/* Don't pack rows in old tables if the user has requested this */
|
||||
if ((sql_field->flags & BLOB_FLAG) ||
|
||||
if ((sql_field->flags() & BLOB_FLAG) ||
|
||||
(sql_field->real_field_type() == MYSQL_TYPE_VARCHAR &&
|
||||
create_info->row_type != ROW_TYPE_FIXED))
|
||||
(*db_options)|= HA_OPTION_PACK_RECORD;
|
||||
|
@ -3647,7 +3647,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||
*/
|
||||
if (sql_field->stored_in_db())
|
||||
record_offset+= sql_field->pack_length;
|
||||
if (sql_field->flags & VERS_SYSTEM_FIELD)
|
||||
if (sql_field->flags() & VERS_SYSTEM_FIELD)
|
||||
continue;
|
||||
}
|
||||
/* Update virtual fields' offset and give error if
|
||||
|
@ -3949,7 +3949,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
if (sql_field->invisible > INVISIBLE_USER &&
|
||||
!(sql_field->flags & VERS_SYSTEM_FIELD) &&
|
||||
!(sql_field->flags() & VERS_SYSTEM_FIELD) &&
|
||||
!key->invisible && DBUG_EVALUATE_IF("test_invisible_index", 0, 1))
|
||||
{
|
||||
my_error(ER_KEY_COLUMN_DOES_NOT_EXITS, MYF(0), column->field_name.str);
|
||||
|
@ -3991,7 +3991,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||
*sql_field) ||
|
||||
sql_field->check_vcol_for_key(thd))
|
||||
DBUG_RETURN(TRUE);
|
||||
if (!(sql_field->flags & NOT_NULL_FLAG))
|
||||
if (!(sql_field->flags() & NOT_NULL_FLAG))
|
||||
{
|
||||
my_message(ER_SPATIAL_CANT_HAVE_NULL,
|
||||
ER_THD(thd, ER_SPATIAL_CANT_HAVE_NULL), MYF(0));
|
||||
|
@ -4009,10 +4009,10 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||
*sql_field,
|
||||
file))
|
||||
DBUG_RETURN(TRUE);
|
||||
if (!(sql_field->flags & NOT_NULL_FLAG))
|
||||
if (!(sql_field->flags() & NOT_NULL_FLAG))
|
||||
{
|
||||
/* Implicitly set primary key fields to NOT NULL for ISO conf. */
|
||||
sql_field->flags|= NOT_NULL_FLAG;
|
||||
sql_field->add_flags(NOT_NULL_FLAG);
|
||||
sql_field->pack_flag&= ~FIELDFLAG_MAYBE_NULL;
|
||||
null_fields--;
|
||||
}
|
||||
|
@ -4105,7 +4105,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||
else if (!(file->ha_table_flags() & HA_NO_PREFIX_CHAR_KEYS))
|
||||
key_part_length= column->length;
|
||||
}
|
||||
else if (key_part_length == 0 && (sql_field->flags & NOT_NULL_FLAG) &&
|
||||
else if (key_part_length == 0 && (sql_field->flags() & NOT_NULL_FLAG) &&
|
||||
!is_hash_field_needed)
|
||||
{
|
||||
my_error(ER_WRONG_KEY_COLUMN, MYF(0), file->table_type(),
|
||||
|
@ -4234,7 +4234,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||
null_fields++;
|
||||
else
|
||||
{
|
||||
hash_fld->flags|= NOT_NULL_FLAG;
|
||||
hash_fld->add_flags(NOT_NULL_FLAG);
|
||||
hash_fld->pack_flag&= ~FIELDFLAG_MAYBE_NULL;
|
||||
}
|
||||
}
|
||||
|
@ -4286,12 +4286,12 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||
*/
|
||||
if (!sql_field->default_value &&
|
||||
!sql_field->has_default_function() &&
|
||||
(sql_field->flags & NOT_NULL_FLAG) &&
|
||||
(sql_field->flags() & NOT_NULL_FLAG) &&
|
||||
(!sql_field->is_timestamp_type() ||
|
||||
opt_explicit_defaults_for_timestamp)&&
|
||||
!sql_field->vers_sys_field())
|
||||
{
|
||||
sql_field->flags|= NO_DEFAULT_VALUE_FLAG;
|
||||
sql_field->add_flags(NO_DEFAULT_VALUE_FLAG);
|
||||
sql_field->pack_flag|= FIELDFLAG_NO_DEFAULT;
|
||||
}
|
||||
|
||||
|
@ -4299,7 +4299,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||
!sql_field->default_value && !sql_field->vcol_info &&
|
||||
sql_field->is_timestamp_type() &&
|
||||
!opt_explicit_defaults_for_timestamp &&
|
||||
(sql_field->flags & NOT_NULL_FLAG) &&
|
||||
(sql_field->flags() & NOT_NULL_FLAG) &&
|
||||
(type == Field::NONE || type == Field::TIMESTAMP_UN_FIELD))
|
||||
{
|
||||
/*
|
||||
|
@ -4320,8 +4320,8 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
if (sql_field->invisible == INVISIBLE_USER &&
|
||||
sql_field->flags & NOT_NULL_FLAG &&
|
||||
sql_field->flags & NO_DEFAULT_VALUE_FLAG)
|
||||
sql_field->flags() & NOT_NULL_FLAG &&
|
||||
sql_field->flags() & NO_DEFAULT_VALUE_FLAG)
|
||||
{
|
||||
my_error(ER_INVISIBLE_NOT_NULL_WITHOUT_DEFAULT, MYF(0),
|
||||
sql_field->field_name.str);
|
||||
|
@ -4479,7 +4479,7 @@ bool Column_definition::prepare_blob_field(THD *thd)
|
|||
{
|
||||
DBUG_ENTER("Column_definition::prepare_blob_field");
|
||||
|
||||
if (length > MAX_FIELD_VARCHARLENGTH && !(flags & BLOB_FLAG))
|
||||
if (length > MAX_FIELD_VARCHARLENGTH && !(flags() & BLOB_FLAG))
|
||||
{
|
||||
/* Convert long VARCHAR columns to TEXT or BLOB */
|
||||
char warn_buff[MYSQL_ERRMSG_SIZE];
|
||||
|
@ -4491,7 +4491,6 @@ bool Column_definition::prepare_blob_field(THD *thd)
|
|||
DBUG_RETURN(1);
|
||||
}
|
||||
set_handler(&type_handler_blob);
|
||||
flags|= BLOB_FLAG;
|
||||
my_snprintf(warn_buff, sizeof(warn_buff), ER_THD(thd, ER_AUTO_CONVERT),
|
||||
field_name.str,
|
||||
(charset == &my_charset_bin) ? "VARBINARY" : "VARCHAR",
|
||||
|
@ -4500,7 +4499,7 @@ bool Column_definition::prepare_blob_field(THD *thd)
|
|||
warn_buff);
|
||||
}
|
||||
|
||||
if ((flags & BLOB_FLAG) && length)
|
||||
if ((flags() & BLOB_FLAG) && length)
|
||||
{
|
||||
if (real_field_type() == FIELD_TYPE_BLOB ||
|
||||
real_field_type() == FIELD_TYPE_TINY_BLOB ||
|
||||
|
@ -6760,7 +6759,7 @@ static bool fill_alter_inplace_info(THD *thd, TABLE *table, bool varchar,
|
|||
{
|
||||
/* Clear marker for renamed or dropped field
|
||||
which we are going to set later. */
|
||||
field->flags&= ~(FIELD_IS_RENAMED | FIELD_IS_DROPPED);
|
||||
field->clear_flags(FIELD_IS_RENAMED | FIELD_IS_DROPPED);
|
||||
|
||||
/* Use transformed info to evaluate flags for storage engine. */
|
||||
uint new_field_index= 0, new_field_stored_index= 0;
|
||||
|
@ -6860,7 +6859,7 @@ static bool fill_alter_inplace_info(THD *thd, TABLE *table, bool varchar,
|
|||
}
|
||||
|
||||
if (field->vcol_info->is_in_partitioning_expr() ||
|
||||
field->flags & PART_KEY_FLAG)
|
||||
field->flags() & PART_KEY_FLAG)
|
||||
{
|
||||
if (value_changes)
|
||||
ha_alter_info->handler_flags|= ALTER_COLUMN_VCOL;
|
||||
|
@ -6876,17 +6875,17 @@ static bool fill_alter_inplace_info(THD *thd, TABLE *table, bool varchar,
|
|||
if (lex_string_cmp(system_charset_info, &field->field_name,
|
||||
&new_field->field_name))
|
||||
{
|
||||
field->flags|= FIELD_IS_RENAMED;
|
||||
field->add_flags(FIELD_IS_RENAMED);
|
||||
ha_alter_info->handler_flags|= ALTER_COLUMN_NAME;
|
||||
rename_column_in_stat_tables(thd, table, field,
|
||||
new_field->field_name.str);
|
||||
}
|
||||
|
||||
/* Check that NULL behavior is same for old and new fields */
|
||||
if ((new_field->flags & NOT_NULL_FLAG) !=
|
||||
(uint) (field->flags & NOT_NULL_FLAG))
|
||||
if ((new_field->flags() & NOT_NULL_FLAG) !=
|
||||
(uint) (field->flags() & NOT_NULL_FLAG))
|
||||
{
|
||||
if (new_field->flags & NOT_NULL_FLAG)
|
||||
if (new_field->flags() & NOT_NULL_FLAG)
|
||||
ha_alter_info->handler_flags|= ALTER_COLUMN_NOT_NULLABLE;
|
||||
else
|
||||
ha_alter_info->handler_flags|= ALTER_COLUMN_NULLABLE;
|
||||
|
@ -6930,7 +6929,7 @@ static bool fill_alter_inplace_info(THD *thd, TABLE *table, bool varchar,
|
|||
else
|
||||
{
|
||||
// Field is not present in new version of table and therefore was dropped.
|
||||
field->flags|= FIELD_IS_DROPPED;
|
||||
field->add_flags(FIELD_IS_DROPPED);
|
||||
if (field->stored_in_db())
|
||||
ha_alter_info->handler_flags|= ALTER_DROP_STORED_COLUMN;
|
||||
else
|
||||
|
@ -7182,7 +7181,7 @@ static void update_altered_table(const Alter_inplace_info &ha_alter_info,
|
|||
for fields which participate in new indexes.
|
||||
*/
|
||||
for (field_idx= 0; field_idx < altered_table->s->fields; ++field_idx)
|
||||
altered_table->field[field_idx]->flags&= ~FIELD_IN_ADD_INDEX;
|
||||
altered_table->field[field_idx]->clear_flags(FIELD_IN_ADD_INDEX);
|
||||
|
||||
/*
|
||||
Go through array of newly added indexes and mark fields
|
||||
|
@ -7196,7 +7195,7 @@ static void update_altered_table(const Alter_inplace_info &ha_alter_info,
|
|||
|
||||
end= key->key_part + key->user_defined_key_parts;
|
||||
for (key_part= key->key_part; key_part < end; key_part++)
|
||||
altered_table->field[key_part->fieldnr]->flags|= FIELD_IN_ADD_INDEX;
|
||||
altered_table->field[key_part->fieldnr]->add_flags(FIELD_IN_ADD_INDEX);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7268,8 +7267,8 @@ bool mysql_compare_tables(TABLE *table,
|
|||
Create_field *tmp_new_field= tmp_new_field_it++;
|
||||
|
||||
/* Check that NULL behavior is the same. */
|
||||
if ((tmp_new_field->flags & NOT_NULL_FLAG) !=
|
||||
(uint) (field->flags & NOT_NULL_FLAG))
|
||||
if ((tmp_new_field->flags() & NOT_NULL_FLAG) !=
|
||||
(uint) (field->flags() & NOT_NULL_FLAG))
|
||||
DBUG_RETURN(false);
|
||||
|
||||
/*
|
||||
|
@ -7281,7 +7280,7 @@ bool mysql_compare_tables(TABLE *table,
|
|||
*/
|
||||
if (create_info->row_type == ROW_TYPE_DYNAMIC ||
|
||||
create_info->row_type == ROW_TYPE_PAGE ||
|
||||
(tmp_new_field->flags & BLOB_FLAG) ||
|
||||
(tmp_new_field->flags() & BLOB_FLAG) ||
|
||||
(tmp_new_field->real_field_type() == MYSQL_TYPE_VARCHAR &&
|
||||
create_info->row_type != ROW_TYPE_FIXED))
|
||||
create_info->table_options|= HA_OPTION_PACK_RECORD;
|
||||
|
@ -8052,7 +8051,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
|||
3. unless it's a system versioning column (but see below).
|
||||
*/
|
||||
if (drop && field->invisible < INVISIBLE_SYSTEM &&
|
||||
!(field->flags & VERS_SYSTEM_FIELD &&
|
||||
!(field->flags() & VERS_SYSTEM_FIELD &&
|
||||
!(alter_info->flags & ALTER_DROP_SYSTEM_VERSIONING)))
|
||||
{
|
||||
/* Reset auto_increment value if it was dropped */
|
||||
|
@ -8064,7 +8063,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
|||
}
|
||||
if (table->s->tmp_table == NO_TMP_TABLE)
|
||||
(void) delete_statistics_for_column(thd, table, field);
|
||||
dropped_sys_vers_fields|= field->flags;
|
||||
dropped_sys_vers_fields|= field->flags();
|
||||
drop_it.remove();
|
||||
dropped_fields= &table->tmp_set;
|
||||
bitmap_set_bit(dropped_fields, field->field_index);
|
||||
|
@ -8073,7 +8072,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
|||
|
||||
/* invisible versioning column is dropped automatically on DROP SYSTEM VERSIONING */
|
||||
if (!drop && field->invisible >= INVISIBLE_SYSTEM &&
|
||||
field->flags & VERS_SYSTEM_FIELD &&
|
||||
field->flags() & VERS_SYSTEM_FIELD &&
|
||||
alter_info->flags & ALTER_DROP_SYSTEM_VERSIONING)
|
||||
{
|
||||
if (table->s->tmp_table == NO_TMP_TABLE)
|
||||
|
@ -8135,7 +8134,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
|||
}
|
||||
}
|
||||
else if (alter_info->flags & ALTER_DROP_SYSTEM_VERSIONING &&
|
||||
field->flags & VERS_SYSTEM_FIELD &&
|
||||
field->flags() & VERS_SYSTEM_FIELD &&
|
||||
field->invisible < INVISIBLE_SYSTEM)
|
||||
{
|
||||
StringBuffer<NAME_LEN*3> tmp;
|
||||
|
@ -8144,19 +8143,19 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
|||
goto err;
|
||||
}
|
||||
else if (drop && field->invisible < INVISIBLE_SYSTEM &&
|
||||
field->flags & VERS_SYSTEM_FIELD &&
|
||||
field->flags() & VERS_SYSTEM_FIELD &&
|
||||
!(alter_info->flags & ALTER_DROP_SYSTEM_VERSIONING))
|
||||
{
|
||||
/* "dropping" a versioning field only hides it from the user */
|
||||
def= new (thd->mem_root) Create_field(thd, field, field);
|
||||
def->invisible= INVISIBLE_SYSTEM;
|
||||
alter_info->flags|= ALTER_CHANGE_COLUMN;
|
||||
if (field->flags & VERS_SYS_START_FLAG)
|
||||
if (field->flags() & VERS_SYS_START_FLAG)
|
||||
create_info->vers_info.as_row.start= def->field_name= Vers_parse_info::default_start;
|
||||
else
|
||||
create_info->vers_info.as_row.end= def->field_name= Vers_parse_info::default_end;
|
||||
new_create_list.push_back(def, thd->mem_root);
|
||||
dropped_sys_vers_fields|= field->flags;
|
||||
dropped_sys_vers_fields|= field->flags();
|
||||
drop_it.remove();
|
||||
}
|
||||
else
|
||||
|
@ -8178,9 +8177,9 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
|||
if (alter)
|
||||
{
|
||||
if ((def->default_value= alter->default_value))
|
||||
def->flags&= ~NO_DEFAULT_VALUE_FLAG;
|
||||
def->clear_flags(NO_DEFAULT_VALUE_FLAG);
|
||||
else
|
||||
def->flags|= NO_DEFAULT_VALUE_FLAG;
|
||||
def->add_flags(NO_DEFAULT_VALUE_FLAG);
|
||||
alter_it.remove();
|
||||
}
|
||||
}
|
||||
|
@ -8233,13 +8232,13 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
|||
flag to allow ALTER TABLE only if the table to be altered is empty.
|
||||
*/
|
||||
if (!alter_ctx->implicit_default_value_error_field &&
|
||||
!(~def->flags & (NO_DEFAULT_VALUE_FLAG | NOT_NULL_FLAG)) &&
|
||||
!(~def->flags() & (NO_DEFAULT_VALUE_FLAG | NOT_NULL_FLAG)) &&
|
||||
def->type_handler()->validate_implicit_default_value(thd, *def))
|
||||
{
|
||||
alter_ctx->implicit_default_value_error_field= def;
|
||||
alter_ctx->error_if_not_empty= TRUE;
|
||||
}
|
||||
if (def->flags & VERS_SYSTEM_FIELD &&
|
||||
if (def->flags() & VERS_SYSTEM_FIELD &&
|
||||
!(alter_info->flags & ALTER_ADD_SYSTEM_VERSIONING))
|
||||
{
|
||||
my_error(ER_VERS_NOT_VERSIONED, MYF(0), table->s->table_name.str);
|
||||
|
@ -8306,9 +8305,9 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
|||
if (alter)
|
||||
{
|
||||
if ((def->default_value= alter->default_value)) // Use new default
|
||||
def->flags&= ~NO_DEFAULT_VALUE_FLAG;
|
||||
def->clear_flags(NO_DEFAULT_VALUE_FLAG);
|
||||
else
|
||||
def->flags|= NO_DEFAULT_VALUE_FLAG;
|
||||
def->add_flags(NO_DEFAULT_VALUE_FLAG);
|
||||
alter_it.remove();
|
||||
}
|
||||
}
|
||||
|
@ -8401,7 +8400,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
|||
if (table->s->primary_key == i)
|
||||
modified_primary_key= TRUE;
|
||||
delete_index_stat= TRUE;
|
||||
if (!(kfield->flags & VERS_SYSTEM_FIELD))
|
||||
if (!(kfield->flags() & VERS_SYSTEM_FIELD))
|
||||
dropped_key_part= key_part_name;
|
||||
continue; // Field is removed
|
||||
}
|
||||
|
@ -8797,8 +8796,8 @@ fk_check_column_changes(THD *thd, Alter_info *alter_info,
|
|||
}
|
||||
|
||||
if ((old_field->is_equal(*new_field) == IS_EQUAL_NO) ||
|
||||
((new_field->flags & NOT_NULL_FLAG) &&
|
||||
!(old_field->flags & NOT_NULL_FLAG)))
|
||||
((new_field->flags() & NOT_NULL_FLAG) &&
|
||||
!(old_field->flags() & NOT_NULL_FLAG)))
|
||||
{
|
||||
if (!(thd->variables.option_bits & OPTION_NO_FOREIGN_KEY_CHECKS))
|
||||
{
|
||||
|
@ -10812,7 +10811,7 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
|
|||
{
|
||||
const char *err_msg= ER_THD(thd, ER_DUP_ENTRY_WITH_KEY_NAME);
|
||||
if (key_nr == 0 && to->s->keys > 0 &&
|
||||
(to->key_info[0].key_part[0].field->flags &
|
||||
(to->key_info[0].key_part[0].field->flags() &
|
||||
AUTO_INCREMENT_FLAG))
|
||||
err_msg= ER_THD(thd, ER_DUP_ENTRY_AUTOINCREMENT_CASE);
|
||||
print_keydup_error(to,
|
||||
|
|
|
@ -1239,7 +1239,7 @@ bool Table_triggers_list::prepare_record_accessors(TABLE *table)
|
|||
table == (*fld)->table)))
|
||||
return 1;
|
||||
|
||||
f->flags= (*fld)->flags;
|
||||
f->set_flags((*fld)->cached_flags());
|
||||
f->invisible= (*fld)->invisible;
|
||||
f->null_ptr= null_ptr;
|
||||
f->null_bit= null_bit;
|
||||
|
|
|
@ -2533,7 +2533,6 @@ bool Type_handler_string::
|
|||
bool Type_handler_blob_common::
|
||||
Column_definition_fix_attributes(Column_definition *def) const
|
||||
{
|
||||
def->flags|= BLOB_FLAG;
|
||||
return def->check_length(ER_TOO_BIG_DISPLAYWIDTH, MAX_FIELD_BLOBLENGTH);
|
||||
}
|
||||
|
||||
|
@ -2543,7 +2542,7 @@ bool Type_handler_year::
|
|||
{
|
||||
if (!def->length || def->length != 2)
|
||||
def->length= 4; // Default length
|
||||
def->flags|= ZEROFILL_FLAG | UNSIGNED_FLAG;
|
||||
def->add_flags(ZEROFILL_FLAG | UNSIGNED_FLAG);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2563,7 +2562,7 @@ bool Type_handler_double::
|
|||
bool Type_handler_timestamp_common::
|
||||
Column_definition_fix_attributes(Column_definition *def) const
|
||||
{
|
||||
def->flags|= UNSIGNED_FLAG;
|
||||
def->add_flags(UNSIGNED_FLAG);
|
||||
return def->fix_attributes_temporal_with_time(MAX_DATETIME_WIDTH);
|
||||
}
|
||||
|
||||
|
@ -2624,7 +2623,7 @@ void Type_handler_typelib::
|
|||
Column_definition *def,
|
||||
const Field *field) const
|
||||
{
|
||||
DBUG_ASSERT(def->flags & (ENUM_FLAG | SET_FLAG));
|
||||
DBUG_ASSERT(def->flags() & (ENUM_FLAG | SET_FLAG));
|
||||
def->interval= field->get_typelib();
|
||||
}
|
||||
|
||||
|
|
|
@ -3313,6 +3313,7 @@ public:
|
|||
virtual const Name name() const= 0;
|
||||
virtual const Name version() const { return m_version_default; }
|
||||
virtual const Name &default_value() const= 0;
|
||||
virtual uint32 flags() const { return 0; }
|
||||
virtual enum_field_types field_type() const= 0;
|
||||
virtual enum_field_types real_field_type() const { return field_type(); }
|
||||
/**
|
||||
|
@ -6442,6 +6443,7 @@ class Type_handler_blob_common: public Type_handler_longstr
|
|||
{
|
||||
public:
|
||||
virtual ~Type_handler_blob_common() { }
|
||||
uint32 flags() const override { return BLOB_FLAG; }
|
||||
virtual uint length_bytes() const= 0;
|
||||
Field *make_conversion_table_field(MEM_ROOT *root,
|
||||
TABLE *table, uint metadata,
|
||||
|
@ -6648,6 +6650,7 @@ class Type_handler_enum: public Type_handler_typelib
|
|||
public:
|
||||
virtual ~Type_handler_enum() {}
|
||||
const Name name() const override { return m_name_enum; }
|
||||
uint32 flags() const override { return ENUM_FLAG; }
|
||||
enum_field_types real_field_type() const override { return MYSQL_TYPE_ENUM; }
|
||||
enum_field_types traditional_merge_field_type() const override
|
||||
{
|
||||
|
@ -6688,6 +6691,7 @@ class Type_handler_set: public Type_handler_typelib
|
|||
public:
|
||||
virtual ~Type_handler_set() {}
|
||||
const Name name() const override { return m_name_set; }
|
||||
uint32 flags() const override { return SET_FLAG; }
|
||||
enum_field_types real_field_type() const override { return MYSQL_TYPE_SET; }
|
||||
enum_field_types traditional_merge_field_type() const override
|
||||
{
|
||||
|
|
|
@ -228,7 +228,6 @@ Field *Type_handler_geometry::make_conversion_table_field(MEM_ROOT *root,
|
|||
bool Type_handler_geometry::
|
||||
Column_definition_fix_attributes(Column_definition *def) const
|
||||
{
|
||||
def->flags|= BLOB_FLAG;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ public:
|
|||
public:
|
||||
virtual ~Type_handler_geometry() {}
|
||||
const Name name() const override { return m_name_geometry; }
|
||||
uint32 flags() const override { return BLOB_FLAG; }
|
||||
enum_field_types field_type() const override { return MYSQL_TYPE_GEOMETRY; }
|
||||
bool is_param_long_data_type() const override { return true; }
|
||||
uint32 max_display_length_for_field(const Conv_source &src) const override;
|
||||
|
|
|
@ -377,7 +377,7 @@ select_unit::create_result_table(THD *thd_arg, List<Item> *column_types,
|
|||
|
||||
table->keys_in_use_for_query.clear_all();
|
||||
for (uint i=0; i < table->s->fields; i++)
|
||||
table->field[i]->flags &= ~(PART_KEY_FLAG | PART_INDIRECT_KEY_FLAG);
|
||||
table->field[i]->clear_flags(PART_KEY_FLAG | PART_INDIRECT_KEY_FLAG);
|
||||
|
||||
if (create_table)
|
||||
{
|
||||
|
@ -413,7 +413,7 @@ select_union_recursive::create_result_table(THD *thd_arg,
|
|||
|
||||
incr_table->keys_in_use_for_query.clear_all();
|
||||
for (uint i=0; i < table->s->fields; i++)
|
||||
incr_table->field[i]->flags &= ~(PART_KEY_FLAG | PART_INDIRECT_KEY_FLAG);
|
||||
incr_table->field[i]->clear_flags(PART_KEY_FLAG | PART_INDIRECT_KEY_FLAG);
|
||||
|
||||
TABLE *rec_table= 0;
|
||||
if (! (rec_table= create_tmp_table(thd_arg, &tmp_table_param, *column_types,
|
||||
|
@ -424,7 +424,7 @@ select_union_recursive::create_result_table(THD *thd_arg,
|
|||
|
||||
rec_table->keys_in_use_for_query.clear_all();
|
||||
for (uint i=0; i < table->s->fields; i++)
|
||||
rec_table->field[i]->flags &= ~(PART_KEY_FLAG | PART_INDIRECT_KEY_FLAG);
|
||||
rec_table->field[i]->clear_flags(PART_KEY_FLAG | PART_INDIRECT_KEY_FLAG);
|
||||
|
||||
if (rec_tables.push_back(rec_table))
|
||||
return true;
|
||||
|
|
|
@ -666,7 +666,7 @@ bool LEX::set_bincmp(CHARSET_INFO *cs, bool bin)
|
|||
if (!charset)
|
||||
{
|
||||
charset= cs;
|
||||
last_field->flags|= bin ? BINCMP_FLAG : 0;
|
||||
last_field->add_flags(bin ? BINCMP_FLAG : 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -6648,9 +6648,9 @@ field_spec:
|
|||
lex->alter_info.create_list.push_back($$, thd->mem_root);
|
||||
|
||||
$$->create_if_not_exists= Lex->check_exists;
|
||||
if ($$->flags & PRI_KEY_FLAG)
|
||||
if ($$->flags() & PRI_KEY_FLAG)
|
||||
lex->add_key_to_list(&$1, Key::PRIMARY, lex->check_exists);
|
||||
else if ($$->flags & UNIQUE_KEY_FLAG)
|
||||
else if ($$->flags() & UNIQUE_KEY_FLAG)
|
||||
lex->add_key_to_list(&$1, Key::UNIQUE, lex->check_exists);
|
||||
}
|
||||
;
|
||||
|
@ -6661,8 +6661,8 @@ field_type_or_serial:
|
|||
| SERIAL_SYM
|
||||
{
|
||||
Lex->last_field->set_handler(&type_handler_longlong);
|
||||
Lex->last_field->flags|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG
|
||||
| UNSIGNED_FLAG | UNIQUE_KEY_FLAG;
|
||||
Lex->last_field->add_flags(AUTO_INCREMENT_FLAG | NOT_NULL_FLAG |
|
||||
UNSIGNED_FLAG | UNIQUE_KEY_FLAG);
|
||||
}
|
||||
opt_serial_attribute
|
||||
;
|
||||
|
@ -6695,7 +6695,7 @@ field_def:
|
|||
| opt_generated_always AS virtual_column_func
|
||||
{
|
||||
Lex->last_field->vcol_info= $3;
|
||||
Lex->last_field->flags&= ~NOT_NULL_FLAG; // undo automatic NOT NULL for timestamps
|
||||
Lex->last_field->clear_flags(NOT_NULL_FLAG); // undo automatic NOT NULL for timestamps
|
||||
}
|
||||
vcol_opt_specifier vcol_opt_attribute
|
||||
| opt_generated_always AS ROW_SYM START_SYM opt_asrow_attribute
|
||||
|
@ -6748,13 +6748,13 @@ vcol_attribute:
|
|||
UNIQUE_SYM
|
||||
{
|
||||
LEX *lex=Lex;
|
||||
lex->last_field->flags|= UNIQUE_KEY_FLAG;
|
||||
lex->last_field->add_flags(UNIQUE_KEY_FLAG);
|
||||
lex->alter_info.flags|= ALTER_ADD_INDEX;
|
||||
}
|
||||
| UNIQUE_SYM KEY_SYM
|
||||
{
|
||||
LEX *lex=Lex;
|
||||
lex->last_field->flags|= UNIQUE_KEY_FLAG;
|
||||
lex->last_field->add_flags(UNIQUE_KEY_FLAG);
|
||||
lex->alter_info.flags|= ALTER_ADD_INDEX;
|
||||
}
|
||||
| COMMENT_SYM TEXT_STRING_sys { Lex->last_field->comment= $2; }
|
||||
|
@ -6976,7 +6976,7 @@ field_type_temporal:
|
|||
Unless --explicit-defaults-for-timestamp is given.
|
||||
*/
|
||||
if (!opt_explicit_defaults_for_timestamp)
|
||||
Lex->last_field->flags|= NOT_NULL_FLAG;
|
||||
Lex->last_field->add_flags(NOT_NULL_FLAG);
|
||||
$$.set(opt_mysql56_temporal_format ?
|
||||
static_cast<const Type_handler*>(&type_handler_timestamp2):
|
||||
static_cast<const Type_handler*>(&type_handler_timestamp),
|
||||
|
@ -7121,10 +7121,10 @@ precision:
|
|||
field_options:
|
||||
/* empty */ {}
|
||||
| SIGNED_SYM {}
|
||||
| UNSIGNED { Lex->last_field->flags|= UNSIGNED_FLAG;}
|
||||
| ZEROFILL { Lex->last_field->flags|= UNSIGNED_FLAG | ZEROFILL_FLAG; }
|
||||
| UNSIGNED ZEROFILL { Lex->last_field->flags|= UNSIGNED_FLAG | ZEROFILL_FLAG; }
|
||||
| ZEROFILL UNSIGNED { Lex->last_field->flags|= UNSIGNED_FLAG | ZEROFILL_FLAG; }
|
||||
| UNSIGNED { Lex->last_field->add_flags(UNSIGNED_FLAG);}
|
||||
| ZEROFILL { Lex->last_field->add_flags(UNSIGNED_FLAG | ZEROFILL_FLAG); }
|
||||
| UNSIGNED ZEROFILL { Lex->last_field->add_flags(UNSIGNED_FLAG | ZEROFILL_FLAG); }
|
||||
| ZEROFILL UNSIGNED { Lex->last_field->add_flags(UNSIGNED_FLAG | ZEROFILL_FLAG); }
|
||||
;
|
||||
|
||||
field_length:
|
||||
|
@ -7155,7 +7155,7 @@ attribute_list:
|
|||
;
|
||||
|
||||
attribute:
|
||||
NULL_SYM { Lex->last_field->flags&= ~ NOT_NULL_FLAG; }
|
||||
NULL_SYM { Lex->last_field->clear_flags(NOT_NULL_FLAG); }
|
||||
| DEFAULT column_default_expr { Lex->last_field->default_value= $2; }
|
||||
| ON UPDATE_SYM NOW_SYM opt_default_time_precision
|
||||
{
|
||||
|
@ -7164,11 +7164,11 @@ attribute:
|
|||
MYSQL_YYABORT;
|
||||
Lex->last_field->on_update= item;
|
||||
}
|
||||
| AUTO_INC { Lex->last_field->flags|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG; }
|
||||
| AUTO_INC { Lex->last_field->add_flags(AUTO_INCREMENT_FLAG | NOT_NULL_FLAG); }
|
||||
| SERIAL_SYM DEFAULT VALUE_SYM
|
||||
{
|
||||
LEX *lex=Lex;
|
||||
lex->last_field->flags|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG | UNIQUE_KEY_FLAG;
|
||||
lex->last_field->add_flags(AUTO_INCREMENT_FLAG | NOT_NULL_FLAG | UNIQUE_KEY_FLAG);
|
||||
lex->alter_info.flags|= ALTER_ADD_INDEX;
|
||||
}
|
||||
| COLLATE_SYM collation_name
|
||||
|
@ -7219,12 +7219,12 @@ compressed_deprecated_column_attribute:
|
|||
asrow_attribute:
|
||||
not NULL_SYM
|
||||
{
|
||||
Lex->last_field->flags|= NOT_NULL_FLAG;
|
||||
Lex->last_field->add_flags(NOT_NULL_FLAG);
|
||||
}
|
||||
| opt_primary KEY_SYM
|
||||
{
|
||||
LEX *lex=Lex;
|
||||
lex->last_field->flags|= PRI_KEY_FLAG | NOT_NULL_FLAG;
|
||||
lex->last_field->add_flags(PRI_KEY_FLAG | NOT_NULL_FLAG);
|
||||
lex->alter_info.flags|= ALTER_ADD_INDEX;
|
||||
}
|
||||
| vcol_attribute
|
||||
|
|
|
@ -6647,9 +6647,9 @@ field_spec:
|
|||
lex->alter_info.create_list.push_back($$, thd->mem_root);
|
||||
|
||||
$$->create_if_not_exists= Lex->check_exists;
|
||||
if ($$->flags & PRI_KEY_FLAG)
|
||||
if ($$->flags() & PRI_KEY_FLAG)
|
||||
lex->add_key_to_list(&$1, Key::PRIMARY, lex->check_exists);
|
||||
else if ($$->flags & UNIQUE_KEY_FLAG)
|
||||
else if ($$->flags() & UNIQUE_KEY_FLAG)
|
||||
lex->add_key_to_list(&$1, Key::UNIQUE, lex->check_exists);
|
||||
}
|
||||
;
|
||||
|
@ -6660,8 +6660,8 @@ field_type_or_serial:
|
|||
| SERIAL_SYM
|
||||
{
|
||||
Lex->last_field->set_handler(&type_handler_longlong);
|
||||
Lex->last_field->flags|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG
|
||||
| UNSIGNED_FLAG | UNIQUE_KEY_FLAG;
|
||||
Lex->last_field->add_flags(AUTO_INCREMENT_FLAG | NOT_NULL_FLAG |
|
||||
UNSIGNED_FLAG | UNIQUE_KEY_FLAG);
|
||||
}
|
||||
opt_serial_attribute
|
||||
;
|
||||
|
@ -6694,7 +6694,7 @@ field_def:
|
|||
| opt_generated_always AS virtual_column_func
|
||||
{
|
||||
Lex->last_field->vcol_info= $3;
|
||||
Lex->last_field->flags&= ~NOT_NULL_FLAG; // undo automatic NOT NULL for timestamps
|
||||
Lex->last_field->clear_flags(NOT_NULL_FLAG); // undo automatic NOT NULL for timestamps
|
||||
}
|
||||
vcol_opt_specifier vcol_opt_attribute
|
||||
| opt_generated_always AS ROW_SYM START_SYM opt_asrow_attribute
|
||||
|
@ -6747,13 +6747,13 @@ vcol_attribute:
|
|||
UNIQUE_SYM
|
||||
{
|
||||
LEX *lex=Lex;
|
||||
lex->last_field->flags|= UNIQUE_KEY_FLAG;
|
||||
lex->last_field->add_flags(UNIQUE_KEY_FLAG);
|
||||
lex->alter_info.flags|= ALTER_ADD_INDEX;
|
||||
}
|
||||
| UNIQUE_SYM KEY_SYM
|
||||
{
|
||||
LEX *lex=Lex;
|
||||
lex->last_field->flags|= UNIQUE_KEY_FLAG;
|
||||
lex->last_field->add_flags(UNIQUE_KEY_FLAG);
|
||||
lex->alter_info.flags|= ALTER_ADD_INDEX;
|
||||
}
|
||||
| COMMENT_SYM TEXT_STRING_sys { Lex->last_field->comment= $2; }
|
||||
|
@ -7027,7 +7027,7 @@ field_type_temporal:
|
|||
Unless --explicit-defaults-for-timestamp is given.
|
||||
*/
|
||||
if (!opt_explicit_defaults_for_timestamp)
|
||||
Lex->last_field->flags|= NOT_NULL_FLAG;
|
||||
Lex->last_field->add_flags(NOT_NULL_FLAG);
|
||||
$$.set(opt_mysql56_temporal_format ?
|
||||
static_cast<const Type_handler*>(&type_handler_timestamp2):
|
||||
static_cast<const Type_handler*>(&type_handler_timestamp),
|
||||
|
@ -7172,10 +7172,10 @@ precision:
|
|||
field_options:
|
||||
/* empty */ {}
|
||||
| SIGNED_SYM {}
|
||||
| UNSIGNED { Lex->last_field->flags|= UNSIGNED_FLAG;}
|
||||
| ZEROFILL { Lex->last_field->flags|= UNSIGNED_FLAG | ZEROFILL_FLAG; }
|
||||
| UNSIGNED ZEROFILL { Lex->last_field->flags|= UNSIGNED_FLAG | ZEROFILL_FLAG; }
|
||||
| ZEROFILL UNSIGNED { Lex->last_field->flags|= UNSIGNED_FLAG | ZEROFILL_FLAG; }
|
||||
| UNSIGNED { Lex->last_field->add_flags(UNSIGNED_FLAG);}
|
||||
| ZEROFILL { Lex->last_field->add_flags(UNSIGNED_FLAG | ZEROFILL_FLAG); }
|
||||
| UNSIGNED ZEROFILL { Lex->last_field->add_flags(UNSIGNED_FLAG | ZEROFILL_FLAG); }
|
||||
| ZEROFILL UNSIGNED { Lex->last_field->add_flags(UNSIGNED_FLAG | ZEROFILL_FLAG); }
|
||||
;
|
||||
|
||||
field_length:
|
||||
|
@ -7233,7 +7233,7 @@ attribute_list:
|
|||
;
|
||||
|
||||
attribute:
|
||||
NULL_SYM { Lex->last_field->flags&= ~ NOT_NULL_FLAG; }
|
||||
NULL_SYM { Lex->last_field->clear_flags(NOT_NULL_FLAG); }
|
||||
| DEFAULT column_default_expr { Lex->last_field->default_value= $2; }
|
||||
| ON UPDATE_SYM NOW_SYM opt_default_time_precision
|
||||
{
|
||||
|
@ -7242,11 +7242,11 @@ attribute:
|
|||
MYSQL_YYABORT;
|
||||
Lex->last_field->on_update= item;
|
||||
}
|
||||
| AUTO_INC { Lex->last_field->flags|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG; }
|
||||
| AUTO_INC { Lex->last_field->add_flags(AUTO_INCREMENT_FLAG | NOT_NULL_FLAG); }
|
||||
| SERIAL_SYM DEFAULT VALUE_SYM
|
||||
{
|
||||
LEX *lex=Lex;
|
||||
lex->last_field->flags|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG | UNIQUE_KEY_FLAG;
|
||||
lex->last_field->add_flags(AUTO_INCREMENT_FLAG | NOT_NULL_FLAG | UNIQUE_KEY_FLAG);
|
||||
lex->alter_info.flags|= ALTER_ADD_INDEX;
|
||||
}
|
||||
| COLLATE_SYM collation_name
|
||||
|
@ -7297,12 +7297,12 @@ compressed_deprecated_column_attribute:
|
|||
asrow_attribute:
|
||||
not NULL_SYM
|
||||
{
|
||||
Lex->last_field->flags|= NOT_NULL_FLAG;
|
||||
Lex->last_field->add_flags(NOT_NULL_FLAG);
|
||||
}
|
||||
| opt_primary KEY_SYM
|
||||
{
|
||||
LEX *lex=Lex;
|
||||
lex->last_field->flags|= PRI_KEY_FLAG | NOT_NULL_FLAG;
|
||||
lex->last_field->add_flags(PRI_KEY_FLAG | NOT_NULL_FLAG);
|
||||
lex->alter_info.flags|= ALTER_ADD_INDEX;
|
||||
}
|
||||
| vcol_attribute
|
||||
|
|
78
sql/table.cc
78
sql/table.cc
|
@ -1180,7 +1180,7 @@ bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table,
|
|||
for (field_ptr= table->field; *field_ptr; field_ptr++)
|
||||
{
|
||||
Field *field= *field_ptr;
|
||||
if (field->flags & LONG_UNIQUE_HASH_FIELD)
|
||||
if (field->flags() & LONG_UNIQUE_HASH_FIELD)
|
||||
{
|
||||
List<Item> *field_list= new (mem_root) List<Item>();
|
||||
Item *list_item;
|
||||
|
@ -2457,12 +2457,12 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
|
|||
reg_field->field_index= i;
|
||||
reg_field->comment=comment;
|
||||
reg_field->vcol_info= vcol_info;
|
||||
reg_field->flags|= flags;
|
||||
reg_field->add_flags(flags);
|
||||
if (extra2.field_flags.str)
|
||||
{
|
||||
uchar flags= *extra2.field_flags.str++;
|
||||
if (flags & VERS_OPTIMIZED_UPDATE)
|
||||
reg_field->flags|= VERS_UPDATE_UNVERSIONED_FLAG;
|
||||
reg_field->add_flags(VERS_UPDATE_UNVERSIONED_FLAG);
|
||||
|
||||
reg_field->invisible= f_visibility(flags);
|
||||
}
|
||||
|
@ -2480,7 +2480,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
|
|||
null_bit_pos-= 8;
|
||||
}
|
||||
}
|
||||
if (!(reg_field->flags & NOT_NULL_FLAG))
|
||||
if (!(reg_field->flags() & NOT_NULL_FLAG))
|
||||
{
|
||||
if (!(null_bit_pos= (null_bit_pos + 1) & 7))
|
||||
null_pos++;
|
||||
|
@ -2498,7 +2498,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
|
|||
}
|
||||
|
||||
if (f_no_default(attr.pack_flag))
|
||||
reg_field->flags|= NO_DEFAULT_VALUE_FLAG;
|
||||
reg_field->add_flags(NO_DEFAULT_VALUE_FLAG);
|
||||
|
||||
if (reg_field->unireg_check == Field::NEXT_NUMBER)
|
||||
share->found_next_number_field= field_ptr;
|
||||
|
@ -2555,7 +2555,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
|
|||
hash_keypart->offset= offset;
|
||||
hash_keypart->fieldnr= hash_field_used_no + 1;
|
||||
hash_field= share->field[hash_field_used_no];
|
||||
hash_field->flags|= LONG_UNIQUE_HASH_FIELD;//Used in parse_vcol_defs
|
||||
hash_field->add_flags(LONG_UNIQUE_HASH_FIELD);//Used in parse_vcol_defs
|
||||
keyinfo->flags|= HA_NOSAME;
|
||||
share->virtual_fields++;
|
||||
share->stored_fields--;
|
||||
|
@ -2773,14 +2773,14 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
|
|||
keyinfo->key_length+= key_part_length_bytes;
|
||||
|
||||
if (i == 0 && key != primary_key)
|
||||
field->flags |= (((keyinfo->flags & HA_NOSAME ||
|
||||
field->add_flags((((keyinfo->flags & HA_NOSAME ||
|
||||
keyinfo->algorithm == HA_KEY_ALG_LONG_HASH) &&
|
||||
(keyinfo->user_defined_key_parts == 1)) ?
|
||||
UNIQUE_KEY_FLAG : MULTIPLE_KEY_FLAG);
|
||||
UNIQUE_KEY_FLAG : MULTIPLE_KEY_FLAG));
|
||||
if (i == 0)
|
||||
field->key_start.set_bit(key);
|
||||
if (field->key_length() == key_part->length &&
|
||||
!(field->flags & BLOB_FLAG) &&
|
||||
!(field->flags() & BLOB_FLAG) &&
|
||||
keyinfo->algorithm != HA_KEY_ALG_LONG_HASH)
|
||||
{
|
||||
if (handler_file->index_flags(key, i, 0) & HA_KEYREAD_ONLY)
|
||||
|
@ -2796,10 +2796,10 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
|
|||
if (!(key_part->key_part_flag & HA_REVERSE_SORT) &&
|
||||
usable_parts == i)
|
||||
usable_parts++; // For FILESORT
|
||||
field->flags|= PART_KEY_FLAG;
|
||||
field->add_flags(PART_KEY_FLAG);
|
||||
if (key == primary_key)
|
||||
{
|
||||
field->flags|= PRI_KEY_FLAG;
|
||||
field->add_flags(PRI_KEY_FLAG);
|
||||
/*
|
||||
If this field is part of the primary key and all keys contains
|
||||
the primary key, then we can use any key to find this column
|
||||
|
@ -2807,7 +2807,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
|
|||
if (ha_option & HA_PRIMARY_KEY_IN_READ_INDEX)
|
||||
{
|
||||
if (field->key_length() == key_part->length &&
|
||||
!(field->flags & BLOB_FLAG))
|
||||
!(field->flags() & BLOB_FLAG))
|
||||
field->part_of_key= share->keys_in_use;
|
||||
if (field->part_of_sortkey.is_set(key))
|
||||
field->part_of_sortkey= share->keys_in_use;
|
||||
|
@ -2964,7 +2964,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
|
|||
reg_field->vcol_info= vcol_info;
|
||||
share->virtual_fields++;
|
||||
share->stored_fields--;
|
||||
if (reg_field->flags & BLOB_FLAG)
|
||||
if (reg_field->flags() & BLOB_FLAG)
|
||||
share->virtual_not_stored_blob_fields++;
|
||||
/* Correct stored_rec_length as non stored fields are last */
|
||||
recpos= (uint) (reg_field->ptr - record);
|
||||
|
@ -3017,7 +3017,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
|
|||
&share->next_number_key_offset,
|
||||
&share->next_number_keypart)) < 0)
|
||||
goto err; // Wrong field definition
|
||||
reg_field->flags |= AUTO_INCREMENT_FLAG;
|
||||
reg_field->add_flags(AUTO_INCREMENT_FLAG);
|
||||
}
|
||||
|
||||
if (share->blob_fields)
|
||||
|
@ -3032,7 +3032,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
|
|||
goto err;
|
||||
for (k=0, ptr= share->field ; *ptr ; ptr++, k++)
|
||||
{
|
||||
if ((*ptr)->flags & BLOB_FLAG)
|
||||
if ((*ptr)->flags() & BLOB_FLAG)
|
||||
(*save++)= k;
|
||||
}
|
||||
}
|
||||
|
@ -3523,15 +3523,15 @@ static bool check_vcol_forward_refs(Field *field, Virtual_column_info *vcol,
|
|||
bool check_constraint)
|
||||
{
|
||||
bool res;
|
||||
uint32 flags= field->flags;
|
||||
uint32 flags= field->cached_flags();
|
||||
if (check_constraint)
|
||||
{
|
||||
/* Check constraints can refer it itself */
|
||||
field->flags|= NO_DEFAULT_VALUE_FLAG;
|
||||
field->add_flags(NO_DEFAULT_VALUE_FLAG);
|
||||
}
|
||||
res= (vcol &&
|
||||
vcol->expr->walk(&Item::check_field_expression_processor, 0, field));
|
||||
field->flags= flags;
|
||||
field->set_flags(flags);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -3813,7 +3813,7 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share,
|
|||
{
|
||||
Field *field= key_part->field= outparam->field[key_part->fieldnr - 1];
|
||||
if (field->key_length() != key_part->length &&
|
||||
!(field->flags & BLOB_FLAG))
|
||||
!(field->flags() & BLOB_FLAG))
|
||||
{
|
||||
/*
|
||||
We are using only a prefix of the column as a key:
|
||||
|
@ -4029,8 +4029,8 @@ partititon_err:
|
|||
// copy PART_INDIRECT_KEY_FLAG that was set meanwhile by *some* thread
|
||||
for (uint i= 0 ; i < share->fields ; i++)
|
||||
{
|
||||
if (share->field[i]->flags & PART_INDIRECT_KEY_FLAG)
|
||||
outparam->field[i]->flags|= PART_INDIRECT_KEY_FLAG;
|
||||
if (share->field[i]->flags() & PART_INDIRECT_KEY_FLAG)
|
||||
outparam->field[i]->add_flags(PART_INDIRECT_KEY_FLAG);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6959,7 +6959,7 @@ void TABLE::mark_columns_needed_for_delete()
|
|||
Field **reg_field;
|
||||
for (reg_field= field ; *reg_field ; reg_field++)
|
||||
{
|
||||
if ((*reg_field)->flags & (PART_KEY_FLAG | PART_INDIRECT_KEY_FLAG))
|
||||
if ((*reg_field)->flags() & (PART_KEY_FLAG | PART_INDIRECT_KEY_FLAG))
|
||||
mark_column_with_deps(*reg_field);
|
||||
}
|
||||
need_signal= true;
|
||||
|
@ -7212,7 +7212,7 @@ void TABLE::mark_columns_per_binlog_row_image()
|
|||
If set in the AI, then the blob is really needed, there is
|
||||
nothing we can do about it.
|
||||
*/
|
||||
if ((my_field->flags & PRI_KEY_FLAG) ||
|
||||
if ((my_field->flags() & PRI_KEY_FLAG) ||
|
||||
(my_field->type() != MYSQL_TYPE_BLOB))
|
||||
{
|
||||
bitmap_set_bit(read_set, my_field->field_index);
|
||||
|
@ -7285,8 +7285,8 @@ bool TABLE::mark_virtual_columns_for_write(bool insert_fl
|
|||
if (bitmap_is_set(write_set, tmp_vfield->field_index))
|
||||
bitmap_updated|= mark_virtual_column_with_deps(tmp_vfield);
|
||||
else if (tmp_vfield->vcol_info->stored_in_db ||
|
||||
(tmp_vfield->flags & (PART_KEY_FLAG | FIELD_IN_PART_FUNC_FLAG |
|
||||
PART_INDIRECT_KEY_FLAG)))
|
||||
(tmp_vfield->flags() & (PART_KEY_FLAG | FIELD_IN_PART_FUNC_FLAG |
|
||||
PART_INDIRECT_KEY_FLAG)))
|
||||
{
|
||||
bitmap_set_bit(write_set, tmp_vfield->field_index);
|
||||
mark_virtual_column_with_deps(tmp_vfield);
|
||||
|
@ -7396,7 +7396,7 @@ void TABLE::mark_columns_used_by_virtual_fields(void)
|
|||
{
|
||||
for (vfield_ptr= vfield; *vfield_ptr; vfield_ptr++)
|
||||
{
|
||||
if ((*vfield_ptr)->flags & PART_KEY_FLAG)
|
||||
if ((*vfield_ptr)->flags() & PART_KEY_FLAG)
|
||||
(*vfield_ptr)->vcol_info->expr->walk(&Item::add_field_to_set_processor,
|
||||
1, this);
|
||||
}
|
||||
|
@ -7404,7 +7404,7 @@ void TABLE::mark_columns_used_by_virtual_fields(void)
|
|||
{
|
||||
if (bitmap_is_set(&tmp_set, i))
|
||||
{
|
||||
s->field[i]->flags|= PART_INDIRECT_KEY_FLAG;
|
||||
s->field[i]->add_flags(PART_INDIRECT_KEY_FLAG);
|
||||
v_keys= TABLE_SHARE::V_KEYS;
|
||||
}
|
||||
}
|
||||
|
@ -7723,7 +7723,7 @@ bool TABLE::add_tmp_key(uint key, uint key_parts,
|
|||
(*reg_field)->part_of_key.set_bit(key);
|
||||
create_key_part_by_field(key_part_info, *reg_field, fld_idx+1);
|
||||
keyinfo->key_length += key_part_info->store_length;
|
||||
(*reg_field)->flags|= PART_KEY_FLAG;
|
||||
(*reg_field)->add_flags(PART_KEY_FLAG);
|
||||
key_start= FALSE;
|
||||
key_part_info++;
|
||||
}
|
||||
|
@ -8274,10 +8274,10 @@ int TABLE::update_virtual_fields(handler *h, enum_vcol_update_mode update_mode)
|
|||
break;
|
||||
case VCOL_UPDATE_FOR_REPLACE:
|
||||
update= ((!vcol_info->stored_in_db &&
|
||||
(vf->flags & (PART_KEY_FLAG | PART_INDIRECT_KEY_FLAG)) &&
|
||||
(vf->flags() & (PART_KEY_FLAG | PART_INDIRECT_KEY_FLAG)) &&
|
||||
bitmap_is_set(read_set, vf->field_index)) ||
|
||||
update_all_columns);
|
||||
if (update && (vf->flags & BLOB_FLAG))
|
||||
if (update && (vf->flags() & BLOB_FLAG))
|
||||
{
|
||||
/*
|
||||
The row has been read into record[1] and Field_blob::value
|
||||
|
@ -8294,7 +8294,7 @@ int TABLE::update_virtual_fields(handler *h, enum_vcol_update_mode update_mode)
|
|||
case VCOL_UPDATE_INDEXED_FOR_UPDATE:
|
||||
/* Read indexed fields that was not updated in VCOL_UPDATE_FOR_READ */
|
||||
update= (!vcol_info->stored_in_db &&
|
||||
(vf->flags & (PART_KEY_FLAG | PART_INDIRECT_KEY_FLAG)) &&
|
||||
(vf->flags() & (PART_KEY_FLAG | PART_INDIRECT_KEY_FLAG)) &&
|
||||
!bitmap_is_set(read_set, vf->field_index));
|
||||
swap_values= 1;
|
||||
break;
|
||||
|
@ -8310,7 +8310,7 @@ int TABLE::update_virtual_fields(handler *h, enum_vcol_update_mode update_mode)
|
|||
DBUG_RESTORE_WRITE_SET(vf);
|
||||
DBUG_PRINT("info", ("field '%s' - updated error: %d",
|
||||
vf->field_name.str, field_error));
|
||||
if (swap_values && (vf->flags & BLOB_FLAG))
|
||||
if (swap_values && (vf->flags() & BLOB_FLAG))
|
||||
{
|
||||
/*
|
||||
Remember the read value to allow other update_virtual_field() calls
|
||||
|
@ -8393,7 +8393,7 @@ int TABLE::update_default_fields(bool update_command, bool ignore_errors)
|
|||
if (!update_command)
|
||||
{
|
||||
if (field->default_value &&
|
||||
(field->default_value->flags || field->flags & BLOB_FLAG))
|
||||
(field->default_value->flags || field->flags() & BLOB_FLAG))
|
||||
res|= (field->default_value->expr->save_in_field(field, 0) < 0);
|
||||
}
|
||||
else
|
||||
|
@ -8622,7 +8622,7 @@ bool TABLE::validate_default_values_of_unset_fields(THD *thd) const
|
|||
for (Field **fld= field; *fld; fld++)
|
||||
{
|
||||
if (!bitmap_is_set(write_set, (*fld)->field_index) &&
|
||||
!((*fld)->flags & NO_DEFAULT_VALUE_FLAG))
|
||||
!((*fld)->flags() & NO_DEFAULT_VALUE_FLAG))
|
||||
{
|
||||
if (!(*fld)->is_null_in_record(s->default_values) &&
|
||||
(*fld)->validate_value_in_record_with_warn(thd, s->default_values) &&
|
||||
|
@ -9096,7 +9096,7 @@ int fields_in_hash_keyinfo(KEY *keyinfo)
|
|||
void setup_keyinfo_hash(KEY *key_info)
|
||||
{
|
||||
DBUG_ASSERT(key_info->algorithm == HA_KEY_ALG_LONG_HASH);
|
||||
DBUG_ASSERT(key_info->key_part->field->flags & LONG_UNIQUE_HASH_FIELD);
|
||||
DBUG_ASSERT(key_info->key_part->field->flags() & LONG_UNIQUE_HASH_FIELD);
|
||||
uint no_of_keyparts= fields_in_hash_keyinfo(key_info);
|
||||
key_info->key_part-= no_of_keyparts;
|
||||
key_info->user_defined_key_parts= key_info->usable_key_parts=
|
||||
|
@ -9111,8 +9111,8 @@ void setup_keyinfo_hash(KEY *key_info)
|
|||
void re_setup_keyinfo_hash(KEY *key_info)
|
||||
{
|
||||
DBUG_ASSERT(key_info->algorithm == HA_KEY_ALG_LONG_HASH);
|
||||
DBUG_ASSERT(!(key_info->key_part->field->flags & LONG_UNIQUE_HASH_FIELD));
|
||||
while(!(key_info->key_part->field->flags & LONG_UNIQUE_HASH_FIELD))
|
||||
DBUG_ASSERT(!(key_info->key_part->field->flags() & LONG_UNIQUE_HASH_FIELD));
|
||||
while(!(key_info->key_part->field->flags() & LONG_UNIQUE_HASH_FIELD))
|
||||
key_info->key_part++;
|
||||
key_info->user_defined_key_parts= key_info->usable_key_parts=
|
||||
key_info->ext_key_parts= 1;
|
||||
|
@ -9468,7 +9468,7 @@ bool TR_table::check(bool error)
|
|||
}
|
||||
|
||||
if (table->field[FLD_ISO_LEVEL]->type() != MYSQL_TYPE_STRING ||
|
||||
!(table->field[FLD_ISO_LEVEL]->flags & ENUM_FLAG))
|
||||
!(table->field[FLD_ISO_LEVEL]->flags() & ENUM_FLAG))
|
||||
{
|
||||
wrong_enum:
|
||||
WARN_SCHEMA("Wrong field %d type (expected ENUM('READ-UNCOMMITTED', "
|
||||
|
@ -9615,7 +9615,7 @@ bool TABLE::export_structure(THD *thd, Row_definition_list *defs)
|
|||
Spvar_definition *def= new (thd->mem_root) Spvar_definition(thd, *src);
|
||||
if (!def)
|
||||
return true;
|
||||
def->flags&= (uint) ~NOT_NULL_FLAG;
|
||||
def->clear_flags(NOT_NULL_FLAG);
|
||||
if ((def->sp_prepare_create_field(thd, thd->mem_root)) ||
|
||||
(defs->push_back(def, thd->mem_root)))
|
||||
return true;
|
||||
|
|
|
@ -104,7 +104,7 @@ static uchar *extra2_write_field_properties(uchar *pos,
|
|||
while (Create_field *cf= it++)
|
||||
{
|
||||
uchar flags= cf->invisible;
|
||||
if (cf->flags & VERS_UPDATE_UNVERSIONED_FLAG)
|
||||
if (cf->flags() & VERS_UPDATE_UNVERSIONED_FLAG)
|
||||
flags|= VERS_OPTIMIZED_UPDATE;
|
||||
*pos++= flags;
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ bool has_extra2_field_flags(List<Create_field> &create_fields)
|
|||
{
|
||||
if (f->invisible)
|
||||
return true;
|
||||
if (f->flags & VERS_UPDATE_UNVERSIONED_FLAG)
|
||||
if (f->flags() & VERS_UPDATE_UNVERSIONED_FLAG)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -1147,7 +1147,7 @@ static bool make_empty_rec(THD *thd, uchar *buff, uint table_options,
|
|||
Field *regfield= tmp.make_field(&share, thd->mem_root, &addr,
|
||||
field->type_handler(),
|
||||
&field->field_name,
|
||||
field->flags);
|
||||
field->flags());
|
||||
if (!regfield)
|
||||
{
|
||||
error= true;
|
||||
|
@ -1157,7 +1157,7 @@ static bool make_empty_rec(THD *thd, uchar *buff, uint table_options,
|
|||
/* save_in_field() will access regfield->table->in_use */
|
||||
regfield->init(&table);
|
||||
|
||||
if (!(field->flags & NOT_NULL_FLAG))
|
||||
if (!(field->flags() & NOT_NULL_FLAG))
|
||||
{
|
||||
*regfield->null_ptr|= regfield->null_bit;
|
||||
null_count++;
|
||||
|
|
|
@ -772,7 +772,7 @@ int ha_archive::create(const char *name, TABLE *table_arg,
|
|||
{
|
||||
Field *field= key_part->field;
|
||||
|
||||
if (!(field->flags & AUTO_INCREMENT_FLAG))
|
||||
if (!(field->flags() & AUTO_INCREMENT_FLAG))
|
||||
{
|
||||
error= HA_WRONG_CREATE_OPTION;
|
||||
DBUG_PRINT("ha_archive", ("Index error in creating archive table"));
|
||||
|
|
|
@ -1613,10 +1613,10 @@ void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf)
|
|||
break;
|
||||
} // endswitch type
|
||||
|
||||
if (fp->flags & UNSIGNED_FLAG)
|
||||
if (fp->is_unsigned())
|
||||
pcf->Flags |= U_UNSIGNED;
|
||||
|
||||
if (fp->flags & ZEROFILL_FLAG)
|
||||
if (fp->is_zerofill())
|
||||
pcf->Flags |= U_ZEROFILL;
|
||||
|
||||
// This is used to skip null bit
|
||||
|
@ -6497,14 +6497,14 @@ int ha_connect::create(const char *name, TABLE *table_arg,
|
|||
if (fp->vcol_info && !fp->stored_in_db)
|
||||
continue; // This is a virtual column
|
||||
|
||||
if (fp->flags & AUTO_INCREMENT_FLAG) {
|
||||
if (fp->flags() & AUTO_INCREMENT_FLAG) {
|
||||
strcpy(g->Message, "Auto_increment is not supported yet");
|
||||
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
|
||||
rc= HA_ERR_INTERNAL_ERROR;
|
||||
DBUG_RETURN(rc);
|
||||
} // endif flags
|
||||
|
||||
if (fp->flags & (BLOB_FLAG | ENUM_FLAG | SET_FLAG)) {
|
||||
if (fp->flags() & (BLOB_FLAG | ENUM_FLAG | SET_FLAG)) {
|
||||
sprintf(g->Message, "Unsupported type for column %s",
|
||||
fp->field_name.str);
|
||||
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
|
||||
|
|
|
@ -212,9 +212,9 @@ PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db,
|
|||
crp = crp->Next; // Data_Type
|
||||
crp->Kdata->SetValue(type, i);
|
||||
|
||||
if (fp->flags & ZEROFILL_FLAG)
|
||||
if (fp->is_zerofill())
|
||||
crp->Nulls[i] = 'Z';
|
||||
else if (fp->flags & UNSIGNED_FLAG)
|
||||
else if (fp->is_unsigned())
|
||||
crp->Nulls[i] = 'U';
|
||||
else // X means TEXT field
|
||||
crp->Nulls[i] = (v == 'X') ? 'V' : v;
|
||||
|
|
|
@ -834,7 +834,7 @@ int ha_tina::find_current_row(uchar *buf)
|
|||
if (!is_enum)
|
||||
goto err;
|
||||
}
|
||||
if ((*field)->flags & BLOB_FLAG)
|
||||
if ((*field)->flags() & BLOB_FLAG)
|
||||
{
|
||||
Field_blob *blob= *(Field_blob**) field;
|
||||
uchar *src, *tgt;
|
||||
|
|
|
@ -664,7 +664,7 @@ heap_prepare_hp_create_info(TABLE *table_arg, bool internal_table,
|
|||
seg->length= (uint) key_part->length;
|
||||
seg->flag= key_part->key_part_flag;
|
||||
|
||||
if (field->flags & (ENUM_FLAG | SET_FLAG))
|
||||
if (field->flags() & (ENUM_FLAG | SET_FLAG))
|
||||
seg->charset= &my_charset_bin;
|
||||
else
|
||||
seg->charset= field->charset_for_protocol();
|
||||
|
@ -678,7 +678,7 @@ heap_prepare_hp_create_info(TABLE *table_arg, bool internal_table,
|
|||
seg->null_bit= 0;
|
||||
seg->null_pos= 0;
|
||||
}
|
||||
if (field->flags & AUTO_INCREMENT_FLAG &&
|
||||
if (field->flags() & AUTO_INCREMENT_FLAG &&
|
||||
table_arg->found_next_number_field &&
|
||||
key == share->next_number_index)
|
||||
{
|
||||
|
|
|
@ -6706,7 +6706,7 @@ get_innobase_type_from_mysql_type(
|
|||
DBUG_ASSERT((ulint)MYSQL_TYPE_FLOAT < 256);
|
||||
DBUG_ASSERT((ulint)MYSQL_TYPE_DECIMAL < 256);
|
||||
|
||||
if (field->flags & UNSIGNED_FLAG) {
|
||||
if (field->is_unsigned()) {
|
||||
|
||||
*unsigned_flag = DATA_UNSIGNED;
|
||||
} else {
|
||||
|
@ -10788,7 +10788,7 @@ create_table_info_t::create_table_def()
|
|||
vers_row = DATA_VERS_START;
|
||||
} else if (i == m_form->s->vers.end_fieldno) {
|
||||
vers_row = DATA_VERS_END;
|
||||
} else if (!(field->flags
|
||||
} else if (!(field->flags()
|
||||
& VERS_UPDATE_UNVERSIONED_FLAG)) {
|
||||
vers_row = DATA_VERSIONED;
|
||||
}
|
||||
|
|
|
@ -1431,7 +1431,7 @@ check_v_col_in_order(
|
|||
continue;
|
||||
}
|
||||
|
||||
if (field->flags & FIELD_IS_DROPPED) {
|
||||
if (field->flags() & FIELD_IS_DROPPED) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1857,7 +1857,7 @@ innobase_fts_check_doc_id_col(
|
|||
} else if (field->type() != MYSQL_TYPE_LONGLONG
|
||||
|| field->pack_length() != 8
|
||||
|| field->real_maybe_null()
|
||||
|| !(field->flags & UNSIGNED_FLAG)
|
||||
|| !field->is_unsigned()
|
||||
|| !field->stored_in_db()) {
|
||||
err = ER_INNODB_FT_WRONG_DOCID_COLUMN;
|
||||
} else {
|
||||
|
@ -2176,10 +2176,10 @@ ha_innobase::check_if_supported_inplace_alter(
|
|||
|
||||
DBUG_ASSERT((MTYP_TYPENR(key_part->field->unireg_check)
|
||||
== Field::NEXT_NUMBER)
|
||||
== !!(key_part->field->flags
|
||||
== !!(key_part->field->flags()
|
||||
& AUTO_INCREMENT_FLAG));
|
||||
|
||||
if (key_part->field->flags & AUTO_INCREMENT_FLAG) {
|
||||
if (key_part->field->flags() & AUTO_INCREMENT_FLAG) {
|
||||
/* We cannot assign AUTO_INCREMENT values
|
||||
during online or instant ALTER. */
|
||||
DBUG_ASSERT(key_part->field == altered_table
|
||||
|
@ -2244,7 +2244,7 @@ ha_innobase::check_if_supported_inplace_alter(
|
|||
renaming the FTS_DOC_ID. */
|
||||
|
||||
for (Field** fp = table->field; *fp; fp++) {
|
||||
if (!((*fp)->flags
|
||||
if (!((*fp)->flags()
|
||||
& (FIELD_IS_RENAMED | FIELD_IS_DROPPED))) {
|
||||
continue;
|
||||
}
|
||||
|
@ -4232,7 +4232,7 @@ innobase_check_foreigns(
|
|||
const Create_field* new_field;
|
||||
|
||||
ut_ad(!(*fp)->real_maybe_null()
|
||||
== !!((*fp)->flags & NOT_NULL_FLAG));
|
||||
== !!((*fp)->flags() & NOT_NULL_FLAG));
|
||||
|
||||
while ((new_field = cf_it++)) {
|
||||
if (new_field->field == *fp) {
|
||||
|
@ -4240,7 +4240,7 @@ innobase_check_foreigns(
|
|||
}
|
||||
}
|
||||
|
||||
if (!new_field || (new_field->flags & NOT_NULL_FLAG)) {
|
||||
if (!new_field || (new_field->flags() & NOT_NULL_FLAG)) {
|
||||
if (innobase_check_foreigns_low(
|
||||
user_table, drop_fk, n_drop_fk,
|
||||
(*fp)->field_name.str, !new_field)) {
|
||||
|
@ -4991,7 +4991,7 @@ prepare_inplace_drop_virtual(
|
|||
ctx->num_to_drop_vcol = 0;
|
||||
for (i = 0; table->field[i]; i++) {
|
||||
const Field* field = table->field[i];
|
||||
if (field->flags & FIELD_IS_DROPPED && !field->stored_in_db()) {
|
||||
if (field->flags() & FIELD_IS_DROPPED && !field->stored_in_db()) {
|
||||
ctx->num_to_drop_vcol++;
|
||||
}
|
||||
}
|
||||
|
@ -5005,7 +5005,7 @@ prepare_inplace_drop_virtual(
|
|||
|
||||
for (i = 0; table->field[i]; i++) {
|
||||
Field *field = table->field[i];
|
||||
if (!(field->flags & FIELD_IS_DROPPED) || field->stored_in_db()) {
|
||||
if (!(field->flags() & FIELD_IS_DROPPED) || field->stored_in_db()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -6378,7 +6378,7 @@ new_clustered_failed:
|
|||
} else if (i ==
|
||||
altered_table->s->vers.end_fieldno) {
|
||||
field_type |= DATA_VERS_END;
|
||||
} else if (!(field->flags
|
||||
} else if (!(field->flags()
|
||||
& VERS_UPDATE_UNVERSIONED_FLAG)) {
|
||||
field_type |= DATA_VERSIONED;
|
||||
}
|
||||
|
@ -7575,7 +7575,7 @@ err_exit_no_heap:
|
|||
ha_alter_info->alter_info->create_list);
|
||||
|
||||
for (Field** fp = table->field; *fp; fp++) {
|
||||
if (!((*fp)->flags & FIELD_IS_RENAMED)) {
|
||||
if (!((*fp)->flags() & FIELD_IS_RENAMED)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -8115,9 +8115,9 @@ err_exit:
|
|||
|
||||
DBUG_ASSERT((MTYP_TYPENR(field->unireg_check)
|
||||
== Field::NEXT_NUMBER)
|
||||
== !!(field->flags & AUTO_INCREMENT_FLAG));
|
||||
== !!(field->flags() & AUTO_INCREMENT_FLAG));
|
||||
|
||||
if (field->flags & AUTO_INCREMENT_FLAG) {
|
||||
if (field->flags() & AUTO_INCREMENT_FLAG) {
|
||||
if (add_autoinc_col_no != ULINT_UNDEFINED) {
|
||||
/* This should have been blocked earlier. */
|
||||
ut_ad(0);
|
||||
|
@ -9011,7 +9011,7 @@ innobase_rename_columns_try(
|
|||
|
||||
for (Field** fp = table->field; *fp; fp++, i++) {
|
||||
const bool is_virtual = !(*fp)->stored_in_db();
|
||||
if (!((*fp)->flags & FIELD_IS_RENAMED)) {
|
||||
if (!((*fp)->flags() & FIELD_IS_RENAMED)) {
|
||||
goto processed_field;
|
||||
}
|
||||
|
||||
|
@ -9061,7 +9061,7 @@ static void get_type(const Field& f, ulint& prtype, ulint& mtype, ulint& len)
|
|||
prtype |= DATA_VERS_START;
|
||||
} else if (&f == f.table->field[f.table->s->vers.end_fieldno]) {
|
||||
prtype |= DATA_VERS_END;
|
||||
} else if (!(f.flags & VERS_UPDATE_UNVERSIONED_FLAG)) {
|
||||
} else if (!(f.flags() & VERS_UPDATE_UNVERSIONED_FLAG)) {
|
||||
prtype |= DATA_VERSIONED;
|
||||
}
|
||||
}
|
||||
|
@ -9282,7 +9282,7 @@ innobase_rename_or_enlarge_columns_cache(
|
|||
col->mbmaxlen = is_string
|
||||
? (*af)->charset()->mbmaxlen : 0;
|
||||
|
||||
if ((*fp)->flags & FIELD_IS_RENAMED) {
|
||||
if ((*fp)->flags() & FIELD_IS_RENAMED) {
|
||||
dict_mem_table_col_rename(
|
||||
user_table, col_n,
|
||||
cf->field->field_name.str,
|
||||
|
|
|
@ -573,7 +573,7 @@ static int table2maria(TABLE *table_arg, data_file_type row_type,
|
|||
/* No blobs here */
|
||||
if (j == 0)
|
||||
keydef[i].flag|= HA_PACK_KEY;
|
||||
if (!(field->flags & ZEROFILL_FLAG) &&
|
||||
if (!(field->is_zerofill()) &&
|
||||
(field->type() == MYSQL_TYPE_STRING ||
|
||||
field->type() == MYSQL_TYPE_VAR_STRING ||
|
||||
((int) (pos->key_part[j].length - field->decimals())) >= 4))
|
||||
|
@ -653,20 +653,19 @@ static int table2maria(TABLE *table_arg, data_file_type row_type,
|
|||
if (!found)
|
||||
break;
|
||||
|
||||
if (found->flags & BLOB_FLAG)
|
||||
if (found->flags() & BLOB_FLAG)
|
||||
recinfo_pos->type= FIELD_BLOB;
|
||||
else if (found->type() == MYSQL_TYPE_TIMESTAMP)
|
||||
recinfo_pos->type= FIELD_NORMAL;
|
||||
else if (found->type() == MYSQL_TYPE_VARCHAR)
|
||||
recinfo_pos->type= FIELD_VARCHAR;
|
||||
else if (!(options & HA_OPTION_PACK_RECORD) ||
|
||||
(found->zero_pack() && (found->flags & PRI_KEY_FLAG)))
|
||||
(found->zero_pack() && (found->flags() & PRI_KEY_FLAG)))
|
||||
recinfo_pos->type= FIELD_NORMAL;
|
||||
else if (found->zero_pack())
|
||||
recinfo_pos->type= FIELD_SKIP_ZERO;
|
||||
else
|
||||
recinfo_pos->type= ((length <= 3 ||
|
||||
(found->flags & ZEROFILL_FLAG)) ?
|
||||
recinfo_pos->type= ((length <= 3 || found->is_zerofill()) ?
|
||||
FIELD_NORMAL :
|
||||
found->type() == MYSQL_TYPE_STRING ||
|
||||
found->type() == MYSQL_TYPE_VAR_STRING ?
|
||||
|
|
|
@ -4497,7 +4497,7 @@ void ha_mroonga::wrapper_overwrite_index_bits()
|
|||
{
|
||||
Field *field = key_part->field;
|
||||
if (field->key_length() == key_part->length &&
|
||||
!(field->flags & BLOB_FLAG))
|
||||
!(field->flags() & BLOB_FLAG))
|
||||
{
|
||||
if (index_flags(i, j, 0) & HA_KEYREAD_ONLY)
|
||||
{
|
||||
|
@ -4514,7 +4514,7 @@ void ha_mroonga::wrapper_overwrite_index_bits()
|
|||
(table_option & HA_PRIMARY_KEY_IN_READ_INDEX))
|
||||
{
|
||||
if (field->key_length() == key_part->length &&
|
||||
!(field->flags & BLOB_FLAG))
|
||||
!(field->flags() & BLOB_FLAG))
|
||||
field->part_of_key = table_share->keys_in_use;
|
||||
if (field->part_of_sortkey.is_set(i))
|
||||
field->part_of_sortkey = table_share->keys_in_use;
|
||||
|
@ -14367,7 +14367,7 @@ bool ha_mroonga::storage_check_if_incompatible_data(
|
|||
uint n = table_share->fields;
|
||||
for (uint i = 0; i < n; i++) {
|
||||
Field *field = table->field[i];
|
||||
if (field->flags & FIELD_IS_RENAMED) {
|
||||
if (field->flags() & FIELD_IS_RENAMED) {
|
||||
DBUG_RETURN(COMPATIBLE_DATA_NO);
|
||||
}
|
||||
}
|
||||
|
@ -15326,7 +15326,7 @@ bool ha_mroonga::storage_inplace_alter_table_rename_column(
|
|||
for (uint i = 0; i < n_fields; i++) {
|
||||
Field *field = table->field[i];
|
||||
|
||||
if (!(field->flags & FIELD_IS_RENAMED)) {
|
||||
if (!(field->flags() & FIELD_IS_RENAMED)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -291,7 +291,7 @@ int table2myisam(TABLE *table_arg, MI_KEYDEF **keydef_out,
|
|||
/* No blobs here */
|
||||
if (j == 0)
|
||||
keydef[i].flag|= HA_PACK_KEY;
|
||||
if (!(field->flags & ZEROFILL_FLAG) &&
|
||||
if (!field->is_zerofill() &&
|
||||
(field->type() == MYSQL_TYPE_STRING ||
|
||||
field->type() == MYSQL_TYPE_VAR_STRING ||
|
||||
((int) (pos->key_part[j].length - field->decimals())) >= 4))
|
||||
|
@ -376,7 +376,7 @@ int table2myisam(TABLE *table_arg, MI_KEYDEF **keydef_out,
|
|||
if (!found)
|
||||
break;
|
||||
|
||||
if (found->flags & BLOB_FLAG)
|
||||
if (found->flags() & BLOB_FLAG)
|
||||
recinfo_pos->type= FIELD_BLOB;
|
||||
else if (found->real_type() == MYSQL_TYPE_TIMESTAMP)
|
||||
{
|
||||
|
@ -398,8 +398,7 @@ int table2myisam(TABLE *table_arg, MI_KEYDEF **keydef_out,
|
|||
else if (found->zero_pack())
|
||||
recinfo_pos->type= FIELD_SKIP_ZERO;
|
||||
else
|
||||
recinfo_pos->type= ((length <= 3 ||
|
||||
(found->flags & ZEROFILL_FLAG)) ?
|
||||
recinfo_pos->type= ((length <= 3 || found->is_zerofill()) ?
|
||||
FIELD_NORMAL :
|
||||
found->type() == MYSQL_TYPE_STRING ||
|
||||
found->type() == MYSQL_TYPE_VAR_STRING ?
|
||||
|
@ -964,7 +963,7 @@ void ha_myisam::setup_vcols_for_repair(HA_CHECK *param)
|
|||
{
|
||||
uint vf_end= (*vf)->offset(table->record[0]) + (*vf)->pack_length_in_rec();
|
||||
set_if_bigger(new_vreclength, vf_end);
|
||||
indexed_vcols|= ((*vf)->flags & PART_KEY_FLAG) != 0;
|
||||
indexed_vcols|= ((*vf)->flags() & PART_KEY_FLAG) != 0;
|
||||
}
|
||||
}
|
||||
if (!indexed_vcols)
|
||||
|
@ -2180,7 +2179,7 @@ int ha_myisam::create(const char *name, TABLE *table_arg,
|
|||
DBUG_ENTER("ha_myisam::create");
|
||||
|
||||
for (i= 0; i < share->virtual_fields && !create_flags; i++)
|
||||
if (table_arg->vfield[i]->flags & PART_KEY_FLAG)
|
||||
if (table_arg->vfield[i]->flags() & PART_KEY_FLAG)
|
||||
create_flags|= HA_CREATE_RELIES_ON_SQL_LAYER;
|
||||
for (i= 0; i < share->keys && !create_flags; i++)
|
||||
if (table_arg->key_info[i].flags & HA_USES_PARSER)
|
||||
|
|
|
@ -335,13 +335,13 @@ int ha_oqgraph::oqgraph_check_table_structure (TABLE *table_arg)
|
|||
|
||||
if (!badColumn) if (skel[i].coltype != MYSQL_TYPE_DOUBLE && (!isLatchColumn || !isStringLatch)) {
|
||||
/* Check Is UNSIGNED */
|
||||
if ( (!((*field)->flags & UNSIGNED_FLAG ))) {
|
||||
if (!(*field)->is_unsigned()) {
|
||||
badColumn = true;
|
||||
push_warning_printf( current_thd, Sql_condition::WARN_LEVEL_WARN, HA_WRONG_CREATE_OPTION, "Column %d must be UNSIGNED.", i);
|
||||
}
|
||||
}
|
||||
/* Check THAT NOT NULL isn't set */
|
||||
if (!badColumn) if ((*field)->flags & NOT_NULL_FLAG) {
|
||||
if (!badColumn) if ((*field)->flags() & NOT_NULL_FLAG) {
|
||||
badColumn = true;
|
||||
push_warning_printf( current_thd, Sql_condition::WARN_LEVEL_WARN, HA_WRONG_CREATE_OPTION, "Column %d must be NULL.", i);
|
||||
}
|
||||
|
@ -658,7 +658,7 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked)
|
|||
if (strcmp(options->origid, (*field)->field_name.str))
|
||||
continue;
|
||||
if ((*field)->cmp_type() != INT_RESULT ||
|
||||
!((*field)->flags & NOT_NULL_FLAG))
|
||||
!((*field)->flags() & NOT_NULL_FLAG))
|
||||
{
|
||||
fprint_error("Column '%s.%s' (origid) is not a not-null integer type",
|
||||
options->table_name, options->origid);
|
||||
|
@ -683,7 +683,7 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked)
|
|||
if (strcmp(options->destid, (*field)->field_name.str))
|
||||
continue;
|
||||
if ((*field)->type() != origid->type() ||
|
||||
!((*field)->flags & NOT_NULL_FLAG))
|
||||
!((*field)->flags() & NOT_NULL_FLAG))
|
||||
{
|
||||
fprint_error("Column '%s.%s' (destid) is not a not-null integer type or is a different type to origid attribute.",
|
||||
options->table_name, options->destid);
|
||||
|
@ -715,7 +715,7 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked)
|
|||
if (strcmp(options->weight, (*field)->field_name.str))
|
||||
continue;
|
||||
if ((*field)->result_type() != REAL_RESULT ||
|
||||
!((*field)->flags & NOT_NULL_FLAG))
|
||||
!((*field)->flags() & NOT_NULL_FLAG))
|
||||
{
|
||||
fprint_error("Column '%s.%s' (weight) is not a not-null real type",
|
||||
options->table_name, options->weight);
|
||||
|
|
|
@ -10356,7 +10356,7 @@ int ha_spider::direct_update_rows_init()
|
|||
field = ((Item_field *)item)->field;
|
||||
|
||||
if (field->type() == FIELD_TYPE_TIMESTAMP &&
|
||||
field->flags & UNIQUE_KEY_FLAG)
|
||||
field->flags() & UNIQUE_KEY_FLAG)
|
||||
{
|
||||
/*
|
||||
Spider cannot perform direct update on unique timestamp fields.
|
||||
|
|
|
@ -401,7 +401,7 @@ int spider_db_mbase_row::store_to_field(
|
|||
field->reset();
|
||||
} else {
|
||||
field->set_notnull();
|
||||
if (field->flags & BLOB_FLAG)
|
||||
if (field->flags() & BLOB_FLAG)
|
||||
{
|
||||
DBUG_PRINT("info", ("spider blob field"));
|
||||
if (
|
||||
|
|
|
@ -1269,7 +1269,7 @@ bool ha_tokudb::has_auto_increment_flag(uint* index) {
|
|||
uint ai_index = 0;
|
||||
for (uint i = 0; i < table_share->fields; i++, ai_index++) {
|
||||
Field* field = table->field[i];
|
||||
if (field->flags & AUTO_INCREMENT_FLAG) {
|
||||
if (field->flags() & AUTO_INCREMENT_FLAG) {
|
||||
ai_found = true;
|
||||
*index = ai_index;
|
||||
break;
|
||||
|
@ -6933,7 +6933,7 @@ void ha_tokudb::trace_create_table_info(TABLE* form) {
|
|||
i,
|
||||
field->field_name.str,
|
||||
field->type(),
|
||||
field->flags);
|
||||
field->flags());
|
||||
}
|
||||
for (i = 0; i < form->s->keys; i++) {
|
||||
KEY *key = &form->key_info[i];
|
||||
|
@ -6953,7 +6953,7 @@ void ha_tokudb::trace_create_table_info(TABLE* form) {
|
|||
key_part->length,
|
||||
field->field_name.str,
|
||||
field->type(),
|
||||
field->flags);
|
||||
field->flags());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1257,11 +1257,6 @@ int ha_tokudb::alter_table_expand_columns(
|
|||
return error;
|
||||
}
|
||||
|
||||
// Return true if the field is an unsigned int
|
||||
static bool is_unsigned(Field *f) {
|
||||
return (f->flags & UNSIGNED_FLAG) != 0;
|
||||
}
|
||||
|
||||
// Return the starting offset in the value for a particular index (selected by
|
||||
// idx) of a particular field (selected by expand_field_num)
|
||||
// TODO: replace this?
|
||||
|
@ -1300,8 +1295,8 @@ int ha_tokudb::alter_table_expand_one_column(
|
|||
uchar pad_char;
|
||||
switch (old_field_type) {
|
||||
case toku_type_int:
|
||||
assert_always(is_unsigned(old_field) == is_unsigned(new_field));
|
||||
if (is_unsigned(old_field))
|
||||
assert_always(old_field->is_unsigned() == new_field->is_unsigned());
|
||||
if (old_field->is_unsigned())
|
||||
operation = UPDATE_OP_EXPAND_UINT;
|
||||
else
|
||||
operation = UPDATE_OP_EXPAND_INT;
|
||||
|
@ -1550,7 +1545,7 @@ static bool change_field_type_is_supported(Field* old_field,
|
|||
if (is_int_type(old_type)) {
|
||||
// int and unsigned int expansion
|
||||
if (is_int_type(new_type) &&
|
||||
is_unsigned(old_field) == is_unsigned(new_field))
|
||||
old_field->is_unsigned() == new_field->is_unsigned())
|
||||
return change_fixed_length_is_supported(old_field, new_field, ctx);
|
||||
else
|
||||
return false;
|
||||
|
|
|
@ -364,7 +364,7 @@ static bool check_decr_floor_expression(Field* lhs_field, Item* item) {
|
|||
return false;
|
||||
if (!check_x_minus_1(lhs_field->field_name.str, arguments[2]))
|
||||
return false;
|
||||
if (!(lhs_field->flags & UNSIGNED_FLAG))
|
||||
if (!lhs_field->is_unsigned())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1045,7 +1045,7 @@ static int create_toku_key_descriptor_for_key(KEY* key, uchar* buf) {
|
|||
assert_always (num_bytes_in_field < 256);
|
||||
*pos = (uchar)(num_bytes_in_field & 255);
|
||||
pos++;
|
||||
*pos = (field->flags & UNSIGNED_FLAG) ? 1 : 0;
|
||||
*pos = field->is_unsigned() ? 1 : 0;
|
||||
pos++;
|
||||
break;
|
||||
//
|
||||
|
@ -3057,8 +3057,8 @@ static bool fields_are_same_type(Field* a, Field* b) {
|
|||
case MYSQL_TYPE_LONGLONG:
|
||||
// length, unsigned, auto increment
|
||||
if (a->pack_length() != b->pack_length() ||
|
||||
(a->flags & UNSIGNED_FLAG) != (b->flags & UNSIGNED_FLAG) ||
|
||||
(a->flags & AUTO_INCREMENT_FLAG) != (b->flags & AUTO_INCREMENT_FLAG)) {
|
||||
a->is_unsigned() != b->is_unsigned() ||
|
||||
(a->flags() & AUTO_INCREMENT_FLAG) != (b->flags() & AUTO_INCREMENT_FLAG)) {
|
||||
retval = false;
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -3067,8 +3067,8 @@ static bool fields_are_same_type(Field* a, Field* b) {
|
|||
case MYSQL_TYPE_FLOAT:
|
||||
// length, unsigned, auto increment
|
||||
if (a->pack_length() != b->pack_length() ||
|
||||
(a->flags & UNSIGNED_FLAG) != (b->flags & UNSIGNED_FLAG) ||
|
||||
(a->flags & AUTO_INCREMENT_FLAG) != (b->flags & AUTO_INCREMENT_FLAG)) {
|
||||
a->is_unsigned() != b->is_unsigned() ||
|
||||
(a->flags() & AUTO_INCREMENT_FLAG) != (b->flags() & AUTO_INCREMENT_FLAG)) {
|
||||
retval = false;
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -3076,7 +3076,7 @@ static bool fields_are_same_type(Field* a, Field* b) {
|
|||
case MYSQL_TYPE_NEWDECIMAL:
|
||||
// length, unsigned
|
||||
if (a->pack_length() != b->pack_length() ||
|
||||
(a->flags & UNSIGNED_FLAG) != (b->flags & UNSIGNED_FLAG)) {
|
||||
a->is_unsigned() != b->is_unsigned()) {
|
||||
retval = false;
|
||||
goto cleanup;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue