mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
cleanup: remove Field->stored_in_db, Create_field->stored_in_db
and don't set Create_field->sql_type to MYSQL_TYPE_VIRTUAL temporarily only to change it again few lines later.
This commit is contained in:
43
sql/field.cc
43
sql/field.cc
@@ -1648,9 +1648,7 @@ Field::Field(uchar *ptr_arg,uint32 length_arg,uchar *null_ptr_arg,
|
||||
part_of_key_not_clustered(0), part_of_sortkey(0),
|
||||
unireg_check(unireg_check_arg), field_length(length_arg),
|
||||
null_bit(null_bit_arg), is_created_from_null_item(FALSE),
|
||||
read_stats(NULL), collected_stats(0),
|
||||
vcol_info(0),
|
||||
stored_in_db(TRUE)
|
||||
read_stats(NULL), collected_stats(0), vcol_info(0)
|
||||
{
|
||||
flags=null_ptr ? 0: NOT_NULL_FLAG;
|
||||
comment.str= (char*) "";
|
||||
@@ -9759,7 +9757,6 @@ void Create_field::init_for_tmp_table(enum_field_types sql_type_arg,
|
||||
f_packtype(pack_flag)));
|
||||
vcol_info= 0;
|
||||
create_if_not_exists= FALSE;
|
||||
stored_in_db= TRUE;
|
||||
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
@@ -9778,10 +9775,21 @@ bool Create_field::check(THD *thd)
|
||||
ulong max_field_charlength= MAX_FIELD_CHARLENGTH;
|
||||
DBUG_ENTER("Create_field::check");
|
||||
|
||||
/* Initialize data for a computed field */
|
||||
if (vcol_info)
|
||||
{
|
||||
DBUG_ASSERT(vcol_info->expr_item);
|
||||
|
||||
vcol_info->set_field_type(sql_type);
|
||||
sql_type= (enum enum_field_types)MYSQL_TYPE_VIRTUAL;
|
||||
/*
|
||||
Walk through the Item tree checking if all items are valid
|
||||
to be part of the virtual column
|
||||
*/
|
||||
if (vcol_info->expr_item->walk(&Item::check_vcol_func_processor, 0, NULL))
|
||||
{
|
||||
my_error(ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED, MYF(0), field_name);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
if (length > MAX_FIELD_BLOBLENGTH)
|
||||
@@ -9857,30 +9865,6 @@ bool Create_field::check(THD *thd)
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
/* Initialize data for a computed field */
|
||||
if (sql_type == MYSQL_TYPE_VIRTUAL)
|
||||
{
|
||||
DBUG_ASSERT(vcol_info && vcol_info->expr_item);
|
||||
stored_in_db= vcol_info->is_stored();
|
||||
/*
|
||||
Walk through the Item tree checking if all items are valid
|
||||
to be part of the virtual column
|
||||
*/
|
||||
if (vcol_info->expr_item->walk(&Item::check_vcol_func_processor, 0, NULL))
|
||||
{
|
||||
my_error(ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED, MYF(0), field_name);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
Make a field created for the real type.
|
||||
Note that regular and computed fields differ from each other only by
|
||||
Field::vcol_info. It is is always NULL for a column that is not
|
||||
computed.
|
||||
*/
|
||||
sql_type= vcol_info->get_real_type();
|
||||
}
|
||||
|
||||
sign_len= flags & UNSIGNED_FLAG ? 0 : 1;
|
||||
|
||||
switch (sql_type) {
|
||||
@@ -10456,7 +10440,6 @@ Create_field::Create_field(THD *thd, Field *old_field, Field *orig_field)
|
||||
decimals= old_field->decimals();
|
||||
vcol_info= old_field->vcol_info;
|
||||
create_if_not_exists= FALSE;
|
||||
stored_in_db= old_field->stored_in_db;
|
||||
option_list= old_field->option_list;
|
||||
option_struct= old_field->option_struct;
|
||||
|
||||
|
25
sql/field.h
25
sql/field.h
@@ -555,12 +555,12 @@ private:
|
||||
when a Create_field object is created/initialized.
|
||||
*/
|
||||
enum_field_types field_type; /* Real field type*/
|
||||
/* Flag indicating that the field is physically stored in the database */
|
||||
bool stored_in_db;
|
||||
/* Flag indicating that the field used in a partitioning expression */
|
||||
bool in_partitioning_expr;
|
||||
|
||||
public:
|
||||
/* Flag indicating that the field is physically stored in the database */
|
||||
bool stored_in_db;
|
||||
/* The expression to compute the value of the virtual column */
|
||||
Item *expr_item;
|
||||
/* Text representation of the defining expression */
|
||||
@@ -568,7 +568,7 @@ public:
|
||||
|
||||
Virtual_column_info()
|
||||
: field_type((enum enum_field_types)MYSQL_TYPE_VIRTUAL),
|
||||
stored_in_db(FALSE), in_partitioning_expr(FALSE),
|
||||
in_partitioning_expr(FALSE), stored_in_db(FALSE),
|
||||
expr_item(NULL)
|
||||
{
|
||||
expr_str.str= NULL;
|
||||
@@ -713,12 +713,6 @@ public:
|
||||
can be computed from other fields.
|
||||
*/
|
||||
Virtual_column_info *vcol_info;
|
||||
/*
|
||||
Flag indicating that the field is physically stored in tables
|
||||
rather than just computed from other fields.
|
||||
As of now, FALSE can be set only for computed virtual columns.
|
||||
*/
|
||||
bool stored_in_db;
|
||||
|
||||
Field(uchar *ptr_arg,uint32 length_arg,uchar *null_ptr_arg,
|
||||
uchar null_bit_arg, utype unireg_check_arg,
|
||||
@@ -1048,6 +1042,8 @@ public:
|
||||
null_bit= p_null_bit;
|
||||
}
|
||||
|
||||
bool stored_in_db() const { return !vcol_info || vcol_info->stored_in_db; }
|
||||
|
||||
inline THD *get_thd() const
|
||||
{ return likely(table) ? table->in_use : current_thd; }
|
||||
|
||||
@@ -3467,20 +3463,13 @@ public:
|
||||
can be computed from other fields.
|
||||
*/
|
||||
Virtual_column_info *vcol_info;
|
||||
/*
|
||||
Flag indicating that the field is physically stored in tables
|
||||
rather than just computed from other fields.
|
||||
As of now, FALSE can be set only for computed virtual columns.
|
||||
*/
|
||||
bool stored_in_db;
|
||||
|
||||
Create_field() :change(0), after(0), comment(null_lex_str),
|
||||
def(0), on_update(0), sql_type(MYSQL_TYPE_NULL),
|
||||
flags(0), pack_length(0), key_length(0), interval(0),
|
||||
srid(0), geom_type(Field::GEOM_GEOMETRY),
|
||||
field(0), option_list(NULL), option_struct(NULL),
|
||||
create_if_not_exists(false), vcol_info(0),
|
||||
stored_in_db(true)
|
||||
create_if_not_exists(false), vcol_info(0)
|
||||
{
|
||||
interval_list.empty();
|
||||
}
|
||||
@@ -3498,6 +3487,8 @@ public:
|
||||
|
||||
bool check(THD *thd);
|
||||
|
||||
bool stored_in_db() const { return !vcol_info || vcol_info->stored_in_db; }
|
||||
|
||||
ha_storage_media field_storage_type() const
|
||||
{
|
||||
return (ha_storage_media)
|
||||
|
@@ -886,7 +886,6 @@ sp_head::create_result_field(uint field_max_length, const char *field_name,
|
||||
field_name ? field_name : (const char *) m_name.str);
|
||||
|
||||
field->vcol_info= m_return_field_def.vcol_info;
|
||||
field->stored_in_db= m_return_field_def.stored_in_db;
|
||||
if (field)
|
||||
field->init(table);
|
||||
|
||||
|
@@ -8789,7 +8789,7 @@ fill_record(THD *thd, TABLE *table_arg, List<Item> &fields, List<Item> &values,
|
||||
ER_THD(thd, ER_WARNING_NON_DEFAULT_VALUE_FOR_VIRTUAL_COLUMN),
|
||||
rfield->field_name, table->s->table_name.str);
|
||||
}
|
||||
if ((!rfield->vcol_info || rfield->stored_in_db) &&
|
||||
if (rfield->stored_in_db() &&
|
||||
(value->save_in_field(rfield, 0)) < 0 && !ignore_errors)
|
||||
{
|
||||
my_message(ER_UNKNOWN_ERROR, ER_THD(thd, ER_UNKNOWN_ERROR), MYF(0));
|
||||
|
@@ -1501,7 +1501,7 @@ bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list,
|
||||
{
|
||||
for (Field **vfield_ptr= table->vfield; *vfield_ptr; vfield_ptr++)
|
||||
{
|
||||
if ((*vfield_ptr)->stored_in_db)
|
||||
if ((*vfield_ptr)->vcol_info->stored_in_db)
|
||||
{
|
||||
thd->lex->unit.insert_table_with_stored_vcol= table;
|
||||
break;
|
||||
|
@@ -303,7 +303,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
||||
{
|
||||
for (Field **vfield_ptr= table->vfield; *vfield_ptr; vfield_ptr++)
|
||||
{
|
||||
if ((*vfield_ptr)->stored_in_db)
|
||||
if ((*vfield_ptr)->vcol_info->stored_in_db)
|
||||
{
|
||||
thd->lex->unit.insert_table_with_stored_vcol= table;
|
||||
break;
|
||||
|
@@ -15678,7 +15678,6 @@ Field *create_tmp_field_from_field(THD *thd, Field *org_field,
|
||||
else if (org_field->type() == FIELD_TYPE_DOUBLE)
|
||||
((Field_double *) new_field)->not_fixed= TRUE;
|
||||
new_field->vcol_info= 0;
|
||||
new_field->stored_in_db= TRUE;
|
||||
new_field->cond_selectivity= 1.0;
|
||||
new_field->next_equal_field= NULL;
|
||||
new_field->option_list= NULL;
|
||||
|
@@ -1844,7 +1844,7 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet,
|
||||
field->vcol_info->expr_str.length,
|
||||
system_charset_info);
|
||||
packet->append(STRING_WITH_LEN(")"));
|
||||
if (field->stored_in_db)
|
||||
if (field->vcol_info->stored_in_db)
|
||||
packet->append(STRING_WITH_LEN(" PERSISTENT"));
|
||||
else
|
||||
packet->append(STRING_WITH_LEN(" VIRTUAL"));
|
||||
@@ -5344,7 +5344,7 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables,
|
||||
table->field[17]->store(type.ptr(), type.length(), cs);
|
||||
if (field->vcol_info)
|
||||
{
|
||||
if (field->stored_in_db)
|
||||
if (field->vcol_info->stored_in_db)
|
||||
table->field[17]->store(STRING_WITH_LEN("PERSISTENT"), cs);
|
||||
else
|
||||
table->field[17]->store(STRING_WITH_LEN("VIRTUAL"), cs);
|
||||
|
@@ -3466,7 +3466,6 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
||||
sql_field->flags= dup_field->flags;
|
||||
sql_field->interval= dup_field->interval;
|
||||
sql_field->vcol_info= dup_field->vcol_info;
|
||||
sql_field->stored_in_db= dup_field->stored_in_db;
|
||||
it2.remove(); // Remove first (create) definition
|
||||
select_field_pos--;
|
||||
break;
|
||||
@@ -3508,14 +3507,14 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
||||
(virtual fields) and update their offset later
|
||||
(see the next loop).
|
||||
*/
|
||||
if (sql_field->stored_in_db)
|
||||
if (sql_field->stored_in_db())
|
||||
record_offset+= sql_field->pack_length;
|
||||
}
|
||||
/* Update virtual fields' offset*/
|
||||
it.rewind();
|
||||
while ((sql_field=it++))
|
||||
{
|
||||
if (!sql_field->stored_in_db)
|
||||
if (!sql_field->stored_in_db())
|
||||
{
|
||||
sql_field->offset= record_offset;
|
||||
record_offset+= sql_field->pack_length;
|
||||
@@ -3868,7 +3867,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (!sql_field->stored_in_db)
|
||||
if (!sql_field->stored_in_db())
|
||||
{
|
||||
/* Key fields must always be physically stored. */
|
||||
my_error(ER_KEY_BASED_ON_GENERATED_VIRTUAL_COLUMN, MYF(0));
|
||||
@@ -6240,18 +6239,6 @@ static bool fill_alter_inplace_info(THD *thd,
|
||||
ha_alter_info->handler_flags|= Alter_inplace_info::ALTER_COLUMN_TYPE;
|
||||
}
|
||||
|
||||
/*
|
||||
Check if the altered column is computed and either
|
||||
is stored or is used in the partitioning expression.
|
||||
TODO: Mark such a column with an alter flag only if
|
||||
the defining expression has changed.
|
||||
*/
|
||||
if (field->vcol_info &&
|
||||
(field->stored_in_db || field->vcol_info->is_in_partitioning_expr()))
|
||||
{
|
||||
ha_alter_info->handler_flags|= Alter_inplace_info::ALTER_COLUMN_VCOL;
|
||||
}
|
||||
|
||||
/* Check if field was renamed */
|
||||
if (my_strcasecmp(system_charset_info, field->field_name,
|
||||
new_field->field_name))
|
||||
@@ -6318,20 +6305,29 @@ static bool fill_alter_inplace_info(THD *thd,
|
||||
new_field_it.init(alter_info->create_list);
|
||||
while ((new_field= new_field_it++))
|
||||
{
|
||||
if (! new_field->field)
|
||||
Virtual_column_info *vcol_info;
|
||||
if (new_field->field)
|
||||
vcol_info= new_field->field->vcol_info;
|
||||
else
|
||||
{
|
||||
vcol_info= new_field->vcol_info;
|
||||
/*
|
||||
Field is not present in old version of table and therefore was added.
|
||||
Again corresponding storage engine flag should be already set.
|
||||
*/
|
||||
DBUG_ASSERT(ha_alter_info->handler_flags & Alter_inplace_info::ADD_COLUMN);
|
||||
}
|
||||
|
||||
if (new_field->vcol_info &&
|
||||
(new_field->stored_in_db || new_field->vcol_info->is_in_partitioning_expr()))
|
||||
{
|
||||
ha_alter_info->handler_flags|= Alter_inplace_info::ALTER_COLUMN_VCOL;
|
||||
}
|
||||
break;
|
||||
/*
|
||||
Check if the altered column is computed and either
|
||||
is stored or is used in the partitioning expression.
|
||||
TODO: Mark such a column with an alter flag only if
|
||||
the defining expression has changed.
|
||||
*/
|
||||
if (vcol_info &&
|
||||
(vcol_info->stored_in_db || vcol_info->is_in_partitioning_expr()))
|
||||
{
|
||||
ha_alter_info->handler_flags|= Alter_inplace_info::ALTER_COLUMN_VCOL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7394,7 +7390,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
||||
of the list for now. Their positions will be corrected later.
|
||||
*/
|
||||
new_create_list.push_back(def, thd->mem_root);
|
||||
if (field->stored_in_db != def->stored_in_db)
|
||||
if (field->stored_in_db() != def->stored_in_db())
|
||||
{
|
||||
my_error(ER_UNSUPPORTED_ACTION_ON_VIRTUAL_COLUMN, MYF(0));
|
||||
goto err;
|
||||
|
21
sql/table.cc
21
sql/table.cc
@@ -1675,7 +1675,10 @@ 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->stored_in_db= fld_stored_in_db;
|
||||
if (vcol_info)
|
||||
reg_field->vcol_info->stored_in_db= fld_stored_in_db;
|
||||
else
|
||||
DBUG_ASSERT(fld_stored_in_db == true);
|
||||
if (field_type == MYSQL_TYPE_BIT && !f_bit_as_char(pack_flag))
|
||||
{
|
||||
null_bits_are_used= 1;
|
||||
@@ -1698,7 +1701,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
|
||||
|
||||
if (use_hash && my_hash_insert(&share->name_hash, (uchar*) field_ptr))
|
||||
goto err;
|
||||
if (!reg_field->stored_in_db)
|
||||
if (!reg_field->stored_in_db())
|
||||
{
|
||||
share->stored_fields--;
|
||||
if (share->stored_rec_length>=recpos)
|
||||
@@ -2526,6 +2529,10 @@ bool unpack_vcol_info_from_frm(THD *thd,
|
||||
/* From now on use vcol_info generated by the parser. */
|
||||
field->vcol_info= vcol_storage.vcol_info;
|
||||
|
||||
/* copy the stored_in_db property, the parser doesn't generate it */
|
||||
field->vcol_info->stored_in_db=
|
||||
table->s->field[field->field_index]->vcol_info->stored_in_db;
|
||||
|
||||
/* Validate the Item tree. */
|
||||
if (fix_vcol_expr(thd, table, field))
|
||||
{
|
||||
@@ -6169,7 +6176,7 @@ void TABLE::mark_virtual_columns_for_write(bool insert_fl)
|
||||
tmp_vfield= *vfield_ptr;
|
||||
if (bitmap_is_set(write_set, tmp_vfield->field_index))
|
||||
bitmap_updated= mark_virtual_col(tmp_vfield);
|
||||
else if (tmp_vfield->stored_in_db)
|
||||
else if (tmp_vfield->vcol_info->stored_in_db)
|
||||
{
|
||||
bool mark_fl= insert_fl;
|
||||
if (!mark_fl)
|
||||
@@ -6903,13 +6910,15 @@ int update_virtual_fields(THD *thd, TABLE *table,
|
||||
for (vfield_ptr= table->vfield; *vfield_ptr; vfield_ptr++)
|
||||
{
|
||||
vfield= (*vfield_ptr);
|
||||
DBUG_ASSERT(vfield->vcol_info && vfield->vcol_info->expr_item);
|
||||
Virtual_column_info *vcol_info= vfield->vcol_info;
|
||||
DBUG_ASSERT(vcol_info);
|
||||
DBUG_ASSERT(vcol_info->expr_item);
|
||||
if ((bitmap_is_set(table->vcol_set, vfield->field_index) &&
|
||||
(vcol_update_mode == VCOL_UPDATE_FOR_WRITE || !vfield->stored_in_db)) ||
|
||||
(vcol_update_mode == VCOL_UPDATE_FOR_WRITE || !vcol_info->stored_in_db)) ||
|
||||
vcol_update_mode == VCOL_UPDATE_ALL)
|
||||
{
|
||||
/* Compute the actual value of the virtual fields */
|
||||
error= vfield->vcol_info->expr_item->save_in_field(vfield, 0);
|
||||
error= vcol_info->expr_item->save_in_field(vfield, 0);
|
||||
DBUG_PRINT("info", ("field '%s' - updated", vfield->field_name));
|
||||
}
|
||||
else
|
||||
|
@@ -874,7 +874,7 @@ static bool pack_fields(uchar *buff, List<Create_field> &create_fields,
|
||||
{
|
||||
*buff++= (uchar) (1 + MY_TEST(field->interval));
|
||||
*buff++= (uchar) field->sql_type;
|
||||
*buff++= (uchar) field->stored_in_db;
|
||||
*buff++= (uchar) field->vcol_info->stored_in_db;
|
||||
if (field->interval)
|
||||
*buff++= (uchar) field->interval_id;
|
||||
memcpy(buff, field->vcol_info->expr_str.str, field->vcol_info->expr_str.length);
|
||||
|
@@ -1448,7 +1448,7 @@ void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf)
|
||||
pcf->Flags |= U_NULLS;
|
||||
|
||||
// Mark virtual columns as such
|
||||
if (fp->vcol_info && !fp->stored_in_db)
|
||||
if (!fp->stored_in_db())
|
||||
pcf->Flags |= U_VIRTUAL;
|
||||
|
||||
pcf->Key= 0; // Not used when called from MySQL
|
||||
@@ -1946,7 +1946,7 @@ int ha_connect::MakeRecord(char *buf)
|
||||
for (field= table->field; *field && !rc; field++) {
|
||||
fp= *field;
|
||||
|
||||
if (fp->vcol_info && !fp->stored_in_db)
|
||||
if (!fp->stored_in_db())
|
||||
continue; // This is a virtual column
|
||||
|
||||
if (bitmap_is_set(map, fp->field_index) || alter) {
|
||||
@@ -2067,8 +2067,7 @@ int ha_connect::ScanRecord(PGLOBAL g, uchar *)
|
||||
for (Field **field=table->field ; *field ; field++) {
|
||||
fp= *field;
|
||||
|
||||
if ((fp->vcol_info && !fp->stored_in_db) ||
|
||||
fp->option_struct->special)
|
||||
if (!fp->stored_in_db() || fp->option_struct->special)
|
||||
continue; // Is a virtual column possible here ???
|
||||
|
||||
if ((xmod == MODE_INSERT && tdbp->GetAmType() != TYPE_AM_MYSQL
|
||||
@@ -5980,7 +5979,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
|
||||
for (field= table_arg->field; *field; field++) {
|
||||
fp= *field;
|
||||
|
||||
if (fp->vcol_info && !fp->stored_in_db)
|
||||
if (!fp->stored_in_db())
|
||||
continue; // This is a virtual column
|
||||
|
||||
if (fp->flags & AUTO_INCREMENT_FLAG) {
|
||||
|
@@ -7416,7 +7416,7 @@ ha_innobase::build_template(
|
||||
/* Push down an index condition or an end_range check. */
|
||||
for (i = 0, sql_idx = 0; i < n_stored_fields; i++, sql_idx++) {
|
||||
|
||||
while (!table->field[sql_idx]->stored_in_db) {
|
||||
while (!table->field[sql_idx]->stored_in_db()) {
|
||||
sql_idx++;
|
||||
}
|
||||
|
||||
@@ -7535,7 +7535,7 @@ ha_innobase::build_template(
|
||||
pushdown. */
|
||||
for (i = 0, sql_idx = 0; i < n_stored_fields; i++, sql_idx++) {
|
||||
|
||||
while (!table->field[sql_idx]->stored_in_db) {
|
||||
while (!table->field[sql_idx]->stored_in_db()) {
|
||||
sql_idx++;
|
||||
}
|
||||
|
||||
@@ -7575,7 +7575,7 @@ ha_innobase::build_template(
|
||||
for (i = 0, sql_idx = 0; i < n_stored_fields; i++, sql_idx++) {
|
||||
const Field* field;
|
||||
|
||||
while (!table->field[sql_idx]->stored_in_db) {
|
||||
while (!table->field[sql_idx]->stored_in_db()) {
|
||||
sql_idx++;
|
||||
}
|
||||
|
||||
@@ -8156,7 +8156,7 @@ calc_row_difference(
|
||||
|
||||
for (sql_idx = 0; sql_idx < n_fields; sql_idx++) {
|
||||
field = table->field[sql_idx];
|
||||
if (!field->stored_in_db)
|
||||
if (!field->stored_in_db())
|
||||
continue;
|
||||
|
||||
o_ptr = (const byte*) old_row + get_field_offset(table, field);
|
||||
@@ -8295,7 +8295,7 @@ calc_row_difference(
|
||||
}
|
||||
}
|
||||
}
|
||||
if (field->stored_in_db)
|
||||
if (field->stored_in_db())
|
||||
innodb_idx++;
|
||||
}
|
||||
|
||||
@@ -10510,7 +10510,7 @@ create_table_def(
|
||||
|
||||
for (i = 0; i < n_cols; i++) {
|
||||
Field* field = form->field[i];
|
||||
if (!field->stored_in_db)
|
||||
if (!field->stored_in_db())
|
||||
continue;
|
||||
|
||||
col_type = get_innobase_type_from_mysql_type(&unsigned_type,
|
||||
|
@@ -382,7 +382,7 @@ ha_innobase::check_if_supported_inplace_alter(
|
||||
const Field* field = table->field[i];
|
||||
const dict_col_t* col = dict_table_get_nth_col(prebuilt->table, icol);
|
||||
ulint unsigned_flag;
|
||||
if (!field->stored_in_db)
|
||||
if (!field->stored_in_db())
|
||||
continue;
|
||||
icol++;
|
||||
|
||||
@@ -1230,7 +1230,7 @@ innobase_rec_to_mysql(
|
||||
ulint ilen;
|
||||
const uchar* ifield;
|
||||
|
||||
while (!((field= table->field[sql_idx])->stored_in_db))
|
||||
while (!((field= table->field[sql_idx])->stored_in_db()))
|
||||
sql_idx++;
|
||||
|
||||
field->reset();
|
||||
@@ -1283,7 +1283,7 @@ innobase_fields_to_mysql(
|
||||
Field* field;
|
||||
ulint ipos;
|
||||
|
||||
while (!((field= table->field[sql_idx])->stored_in_db))
|
||||
while (!((field= table->field[sql_idx])->stored_in_db()))
|
||||
sql_idx++;
|
||||
|
||||
field->reset();
|
||||
@@ -1332,7 +1332,7 @@ innobase_row_to_mysql(
|
||||
Field* field;
|
||||
const dfield_t* df = dtuple_get_nth_field(row, i);
|
||||
|
||||
while (!((field= table->field[sql_idx])->stored_in_db))
|
||||
while (!((field= table->field[sql_idx])->stored_in_db()))
|
||||
sql_idx++;
|
||||
|
||||
field->reset();
|
||||
@@ -1638,7 +1638,7 @@ innobase_fts_check_doc_id_col(
|
||||
for (i = 0; i < n_cols; i++, sql_idx++) {
|
||||
const Field* field;
|
||||
while (!((field= altered_table->field[sql_idx])->
|
||||
stored_in_db))
|
||||
stored_in_db()))
|
||||
sql_idx++;
|
||||
if (my_strcasecmp(system_charset_info,
|
||||
field->field_name, FTS_DOC_ID_COL_NAME)) {
|
||||
@@ -2504,7 +2504,7 @@ innobase_build_col_map(
|
||||
}
|
||||
|
||||
while (const Create_field* new_field = cf_it++) {
|
||||
if (!new_field->stored_in_db)
|
||||
if (!new_field->stored_in_db())
|
||||
{
|
||||
sql_idx++;
|
||||
continue;
|
||||
@@ -2513,7 +2513,7 @@ innobase_build_col_map(
|
||||
table->field[old_i];
|
||||
old_i++) {
|
||||
const Field* field = table->field[old_i];
|
||||
if (!table->field[old_i]->stored_in_db)
|
||||
if (!table->field[old_i]->stored_in_db())
|
||||
continue;
|
||||
if (new_field->field == field) {
|
||||
col_map[old_innobase_i] = i;
|
||||
@@ -2886,7 +2886,7 @@ prepare_inplace_alter_table_dict(
|
||||
for (uint i = 0; i < altered_table->s->stored_fields; i++, sql_idx++) {
|
||||
const Field* field;
|
||||
while (!((field= altered_table->field[sql_idx])->
|
||||
stored_in_db))
|
||||
stored_in_db()))
|
||||
sql_idx++;
|
||||
ulint is_unsigned;
|
||||
ulint field_type
|
||||
@@ -3980,7 +3980,7 @@ func_exit:
|
||||
ha_alter_info->alter_info->create_list);
|
||||
while (const Create_field* new_field = cf_it++) {
|
||||
const Field* field;
|
||||
if (!new_field->stored_in_db) {
|
||||
if (!new_field->stored_in_db()) {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
@@ -3989,7 +3989,7 @@ func_exit:
|
||||
DBUG_ASSERT(innodb_idx < altered_table->s->stored_fields);
|
||||
|
||||
for (uint old_i = 0; table->field[old_i]; old_i++) {
|
||||
if (!table->field[old_i]->stored_in_db)
|
||||
if (!table->field[old_i]->stored_in_db())
|
||||
continue;
|
||||
if (new_field->field == table->field[old_i]) {
|
||||
goto found_col;
|
||||
@@ -4688,7 +4688,7 @@ innobase_rename_columns_try(
|
||||
& Alter_inplace_info::ALTER_COLUMN_NAME);
|
||||
|
||||
for (Field** fp = table->field; *fp; fp++, i++) {
|
||||
if (!((*fp)->flags & FIELD_IS_RENAMED) || !((*fp)->stored_in_db)) {
|
||||
if (!((*fp)->flags & FIELD_IS_RENAMED) || !((*fp)->stored_in_db())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@@ -7914,7 +7914,7 @@ ha_innobase::build_template(
|
||||
/* Push down an index condition or an end_range check. */
|
||||
for (i = 0, sql_idx = 0; i < n_stored_fields; i++, sql_idx++) {
|
||||
|
||||
while (!table->field[sql_idx]->stored_in_db) {
|
||||
while (!table->field[sql_idx]->stored_in_db()) {
|
||||
sql_idx++;
|
||||
}
|
||||
|
||||
@@ -8033,7 +8033,7 @@ ha_innobase::build_template(
|
||||
pushdown. */
|
||||
for (i = 0, sql_idx = 0; i < n_stored_fields; i++, sql_idx++) {
|
||||
|
||||
while (!table->field[sql_idx]->stored_in_db) {
|
||||
while (!table->field[sql_idx]->stored_in_db()) {
|
||||
sql_idx++;
|
||||
}
|
||||
|
||||
@@ -8073,7 +8073,7 @@ ha_innobase::build_template(
|
||||
for (i = 0, sql_idx = 0; i < n_stored_fields; i++, sql_idx++) {
|
||||
const Field* field;
|
||||
|
||||
while (!table->field[sql_idx]->stored_in_db) {
|
||||
while (!table->field[sql_idx]->stored_in_db()) {
|
||||
sql_idx++;
|
||||
}
|
||||
|
||||
@@ -8671,7 +8671,7 @@ calc_row_difference(
|
||||
|
||||
for (sql_idx = 0; sql_idx < n_fields; sql_idx++) {
|
||||
field = table->field[sql_idx];
|
||||
if (!field->stored_in_db)
|
||||
if (!field->stored_in_db())
|
||||
continue;
|
||||
|
||||
o_ptr = (const byte*) old_row + get_field_offset(table, field);
|
||||
@@ -8809,7 +8809,7 @@ calc_row_difference(
|
||||
}
|
||||
}
|
||||
}
|
||||
if (field->stored_in_db)
|
||||
if (field->stored_in_db())
|
||||
innodb_idx++;
|
||||
}
|
||||
|
||||
@@ -11072,7 +11072,7 @@ create_table_def(
|
||||
|
||||
for (i = 0; i < n_cols; i++) {
|
||||
Field* field = form->field[i];
|
||||
if (!field->stored_in_db)
|
||||
if (!field->stored_in_db())
|
||||
continue;
|
||||
|
||||
col_type = get_innobase_type_from_mysql_type(&unsigned_type,
|
||||
|
@@ -386,7 +386,7 @@ ha_innobase::check_if_supported_inplace_alter(
|
||||
const Field* field = table->field[i];
|
||||
const dict_col_t* col = dict_table_get_nth_col(prebuilt->table, icol);
|
||||
ulint unsigned_flag;
|
||||
if (!field->stored_in_db)
|
||||
if (!field->stored_in_db())
|
||||
continue;
|
||||
icol++;
|
||||
|
||||
@@ -1233,7 +1233,7 @@ innobase_rec_to_mysql(
|
||||
ulint ilen;
|
||||
const uchar* ifield;
|
||||
|
||||
while (!((field= table->field[sql_idx])->stored_in_db))
|
||||
while (!((field= table->field[sql_idx])->stored_in_db()))
|
||||
sql_idx++;
|
||||
|
||||
field->reset();
|
||||
@@ -1286,7 +1286,7 @@ innobase_fields_to_mysql(
|
||||
Field* field;
|
||||
ulint ipos;
|
||||
|
||||
while (!((field= table->field[sql_idx])->stored_in_db))
|
||||
while (!((field= table->field[sql_idx])->stored_in_db()))
|
||||
sql_idx++;
|
||||
|
||||
field->reset();
|
||||
@@ -1335,7 +1335,7 @@ innobase_row_to_mysql(
|
||||
Field* field;
|
||||
const dfield_t* df = dtuple_get_nth_field(row, i);
|
||||
|
||||
while (!((field= table->field[sql_idx])->stored_in_db))
|
||||
while (!((field= table->field[sql_idx])->stored_in_db()))
|
||||
sql_idx++;
|
||||
|
||||
field->reset();
|
||||
@@ -1642,7 +1642,7 @@ innobase_fts_check_doc_id_col(
|
||||
for (i = 0; i < n_cols; i++, sql_idx++) {
|
||||
const Field* field;
|
||||
while (!((field= altered_table->field[sql_idx])->
|
||||
stored_in_db))
|
||||
stored_in_db()))
|
||||
sql_idx++;
|
||||
if (my_strcasecmp(system_charset_info,
|
||||
field->field_name, FTS_DOC_ID_COL_NAME)) {
|
||||
@@ -2508,7 +2508,7 @@ innobase_build_col_map(
|
||||
}
|
||||
|
||||
while (const Create_field* new_field = cf_it++) {
|
||||
if (!new_field->stored_in_db)
|
||||
if (!new_field->stored_in_db())
|
||||
{
|
||||
sql_idx++;
|
||||
continue;
|
||||
@@ -2517,7 +2517,7 @@ innobase_build_col_map(
|
||||
table->field[old_i];
|
||||
old_i++) {
|
||||
const Field* field = table->field[old_i];
|
||||
if (!table->field[old_i]->stored_in_db)
|
||||
if (!table->field[old_i]->stored_in_db())
|
||||
continue;
|
||||
if (new_field->field == field) {
|
||||
col_map[old_innobase_i] = i;
|
||||
@@ -2896,7 +2896,7 @@ prepare_inplace_alter_table_dict(
|
||||
for (uint i = 0; i < altered_table->s->stored_fields; i++, sql_idx++) {
|
||||
const Field* field;
|
||||
while (!((field= altered_table->field[sql_idx])->
|
||||
stored_in_db))
|
||||
stored_in_db()))
|
||||
sql_idx++;
|
||||
ulint is_unsigned;
|
||||
ulint field_type
|
||||
@@ -3999,7 +3999,7 @@ func_exit:
|
||||
ha_alter_info->alter_info->create_list);
|
||||
while (const Create_field* new_field = cf_it++) {
|
||||
const Field* field;
|
||||
if (!new_field->stored_in_db) {
|
||||
if (!new_field->stored_in_db()) {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
@@ -4008,7 +4008,7 @@ func_exit:
|
||||
DBUG_ASSERT(innodb_idx < altered_table->s->stored_fields);
|
||||
|
||||
for (uint old_i = 0; table->field[old_i]; old_i++) {
|
||||
if (!table->field[old_i]->stored_in_db)
|
||||
if (!table->field[old_i]->stored_in_db())
|
||||
continue;
|
||||
if (new_field->field == table->field[old_i]) {
|
||||
goto found_col;
|
||||
@@ -4707,7 +4707,7 @@ innobase_rename_columns_try(
|
||||
& Alter_inplace_info::ALTER_COLUMN_NAME);
|
||||
|
||||
for (Field** fp = table->field; *fp; fp++, i++) {
|
||||
if (!((*fp)->flags & FIELD_IS_RENAMED) || !((*fp)->stored_in_db)) {
|
||||
if (!((*fp)->flags & FIELD_IS_RENAMED) || !((*fp)->stored_in_db())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user