Commit 34ee747f authored by Sergei Golubchik's avatar Sergei Golubchik

cleanup: remove MARK_COLUMNS_NONE

parent 103715d0
...@@ -6214,7 +6214,7 @@ bool Item_field::fix_fields(THD *thd, Item **reference) ...@@ -6214,7 +6214,7 @@ bool Item_field::fix_fields(THD *thd, Item **reference)
set_field(from_field); set_field(from_field);
} }
else if (thd->column_usage != MARK_COLUMNS_NONE) else if (should_mark_column(thd->column_usage))
{ {
TABLE *table= field->table; TABLE *table= field->table;
MY_BITMAP *current_bitmap, *other_bitmap; MY_BITMAP *current_bitmap, *other_bitmap;
...@@ -9248,7 +9248,7 @@ bool Item_default_value::fix_fields(THD *thd, Item **items) ...@@ -9248,7 +9248,7 @@ bool Item_default_value::fix_fields(THD *thd, Item **items)
if (!newptr) if (!newptr)
goto error; goto error;
fix_session_vcol_expr_for_read(thd, def_field, def_field->default_value); fix_session_vcol_expr_for_read(thd, def_field, def_field->default_value);
if (thd->column_usage != MARK_COLUMNS_NONE) if (should_mark_column(thd->column_usage))
def_field->default_value->expr->walk(&Item::register_field_in_read_map, 1, 0); def_field->default_value->expr->walk(&Item::register_field_in_read_map, 1, 0);
def_field->move_field(newptr+1, def_field->maybe_null() ? newptr : 0, 1); def_field->move_field(newptr+1, def_field->maybe_null() ? newptr : 0, 1);
} }
...@@ -9527,7 +9527,8 @@ void Item_trigger_field::setup_field(THD *thd, TABLE *table, ...@@ -9527,7 +9527,8 @@ void Item_trigger_field::setup_field(THD *thd, TABLE *table,
method which is called during execution of these statements. method which is called during execution of these statements.
*/ */
enum_column_usage saved_column_usage= thd->column_usage; enum_column_usage saved_column_usage= thd->column_usage;
thd->column_usage= MARK_COLUMNS_NONE; thd->column_usage= want_privilege == SELECT_ACL ? COLUMNS_READ
: COLUMNS_WRITE;
/* /*
Try to find field by its name and if it will be found Try to find field by its name and if it will be found
set field_idx properly. set field_idx properly.
......
...@@ -5352,7 +5352,7 @@ Field *view_ref_found= (Field*) 0x2; ...@@ -5352,7 +5352,7 @@ Field *view_ref_found= (Field*) 0x2;
static void update_field_dependencies(THD *thd, Field *field, TABLE *table) static void update_field_dependencies(THD *thd, Field *field, TABLE *table)
{ {
DBUG_ENTER("update_field_dependencies"); DBUG_ENTER("update_field_dependencies");
if (thd->column_usage != MARK_COLUMNS_NONE) if (should_mark_column(thd->column_usage))
{ {
MY_BITMAP *bitmap; MY_BITMAP *bitmap;
...@@ -5834,7 +5834,7 @@ find_field_in_table_ref(THD *thd, TABLE_LIST *table_list, ...@@ -5834,7 +5834,7 @@ find_field_in_table_ref(THD *thd, TABLE_LIST *table_list,
fld= WRONG_GRANT; fld= WRONG_GRANT;
else else
#endif #endif
if (thd->column_usage != MARK_COLUMNS_NONE) if (should_mark_column(thd->column_usage))
{ {
/* /*
Get rw_set correct for this field so that the handler Get rw_set correct for this field so that the handler
......
...@@ -94,7 +94,8 @@ enum enum_slave_type_conversions { SLAVE_TYPE_CONVERSIONS_ALL_LOSSY, ...@@ -94,7 +94,8 @@ enum enum_slave_type_conversions { SLAVE_TYPE_CONVERSIONS_ALL_LOSSY,
SLAVE_TYPE_CONVERSIONS_ALL_NON_LOSSY}; SLAVE_TYPE_CONVERSIONS_ALL_NON_LOSSY};
/* /*
MARK_COLUMNS_NONE: It is unknown whether the column will be read or written MARK_COLUMNS_READ: A column is goind to be read.
MARK_COLUMNS_WRITE: A column is going to be written to.
MARK_COLUMNS_READ: A column is goind to be read. MARK_COLUMNS_READ: A column is goind to be read.
A bit in read set is set to inform handler that the field A bit in read set is set to inform handler that the field
is to be read. If field list contains duplicates, then is to be read. If field list contains duplicates, then
...@@ -105,7 +106,10 @@ enum enum_slave_type_conversions { SLAVE_TYPE_CONVERSIONS_ALL_LOSSY, ...@@ -105,7 +106,10 @@ enum enum_slave_type_conversions { SLAVE_TYPE_CONVERSIONS_ALL_LOSSY,
to update this field in write_row and update_row. to update this field in write_row and update_row.
*/ */
enum enum_column_usage enum enum_column_usage
{ MARK_COLUMNS_NONE, MARK_COLUMNS_READ, MARK_COLUMNS_WRITE}; { COLUMNS_READ, COLUMNS_WRITE, MARK_COLUMNS_READ, MARK_COLUMNS_WRITE};
static inline bool should_mark_column(enum_column_usage column_usage)
{ return column_usage >= MARK_COLUMNS_READ; }
enum enum_filetype { FILETYPE_CSV, FILETYPE_XML }; enum enum_filetype { FILETYPE_CSV, FILETYPE_XML };
......
...@@ -29,7 +29,7 @@ bool mysql_do(THD *thd, List<Item> &values) ...@@ -29,7 +29,7 @@ bool mysql_do(THD *thd, List<Item> &values)
List_iterator<Item> li(values); List_iterator<Item> li(values);
Item *value; Item *value;
DBUG_ENTER("mysql_do"); DBUG_ENTER("mysql_do");
if (setup_fields(thd, Ref_ptr_array(), values, MARK_COLUMNS_NONE, 0, NULL, 0)) if (setup_fields(thd, Ref_ptr_array(), values, COLUMNS_READ, 0, NULL, 0))
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
while ((value = li++)) while ((value = li++))
(void) value->is_null(); (void) value->is_null();
......
...@@ -1315,7 +1315,7 @@ static bool check_view_insertability(THD * thd, TABLE_LIST *view) ...@@ -1315,7 +1315,7 @@ static bool check_view_insertability(THD * thd, TABLE_LIST *view)
we must not set query_id for fields as they're not we must not set query_id for fields as they're not
really used in this context really used in this context
*/ */
thd->column_usage= MARK_COLUMNS_NONE; thd->column_usage= COLUMNS_WRITE;
/* check simplicity and prepare unique test of view */ /* check simplicity and prepare unique test of view */
for (trans= trans_start; trans != trans_end; trans++) for (trans= trans_start; trans != trans_end; trans++)
{ {
......
...@@ -1590,7 +1590,7 @@ bool fix_partition_func(THD *thd, TABLE *table, ...@@ -1590,7 +1590,7 @@ bool fix_partition_func(THD *thd, TABLE *table,
{ {
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
} }
thd->column_usage= MARK_COLUMNS_NONE; thd->column_usage= COLUMNS_WRITE;
DBUG_PRINT("info", ("thd->column_usage: %d", thd->column_usage)); DBUG_PRINT("info", ("thd->column_usage: %d", thd->column_usage));
if (!is_create_table_ind || if (!is_create_table_ind ||
......
...@@ -1318,7 +1318,7 @@ static bool mysql_test_insert(Prepared_statement *stmt, ...@@ -1318,7 +1318,7 @@ static bool mysql_test_insert(Prepared_statement *stmt,
goto error; goto error;
} }
if (setup_fields(thd, Ref_ptr_array(), if (setup_fields(thd, Ref_ptr_array(),
*values, MARK_COLUMNS_NONE, 0, NULL, 0)) *values, COLUMNS_READ, 0, NULL, 0))
goto error; goto error;
} }
} }
...@@ -1424,7 +1424,7 @@ static int mysql_test_update(Prepared_statement *stmt, ...@@ -1424,7 +1424,7 @@ static int mysql_test_update(Prepared_statement *stmt,
table_list->register_want_access(SELECT_ACL); table_list->register_want_access(SELECT_ACL);
#endif #endif
if (setup_fields(thd, Ref_ptr_array(), if (setup_fields(thd, Ref_ptr_array(),
stmt->lex->value_list, MARK_COLUMNS_NONE, 0, NULL, 0) || stmt->lex->value_list, COLUMNS_READ, 0, NULL, 0) ||
check_unique_table(thd, table_list)) check_unique_table(thd, table_list))
goto error; goto error;
/* TODO: here we should send types of placeholders to the client. */ /* TODO: here we should send types of placeholders to the client. */
...@@ -1597,7 +1597,7 @@ static bool mysql_test_do_fields(Prepared_statement *stmt, ...@@ -1597,7 +1597,7 @@ static bool mysql_test_do_fields(Prepared_statement *stmt,
DT_PREPARE | DT_CREATE)) DT_PREPARE | DT_CREATE))
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
DBUG_RETURN(setup_fields(thd, Ref_ptr_array(), DBUG_RETURN(setup_fields(thd, Ref_ptr_array(),
*values, MARK_COLUMNS_NONE, 0, NULL, 0)); *values, COLUMNS_READ, 0, NULL, 0));
} }
......
...@@ -1935,7 +1935,7 @@ bool check_key_in_view(THD *thd, TABLE_LIST *view) ...@@ -1935,7 +1935,7 @@ bool check_key_in_view(THD *thd, TABLE_LIST *view)
marking as used fields which are not used marking as used fields which are not used
*/ */
enum_column_usage saved_column_usage= thd->column_usage; enum_column_usage saved_column_usage= thd->column_usage;
thd->column_usage= MARK_COLUMNS_NONE; thd->column_usage= COLUMNS_WRITE;
DBUG_PRINT("info", ("thd->column_usage: %d", thd->column_usage)); DBUG_PRINT("info", ("thd->column_usage: %d", thd->column_usage));
for (Field_translator *fld= trans; fld < end_of_trans; fld++) for (Field_translator *fld= trans; fld < end_of_trans; fld++)
{ {
......
...@@ -2859,7 +2859,7 @@ static bool fix_vcol_expr(THD *thd, Virtual_column_info *vcol) ...@@ -2859,7 +2859,7 @@ static bool fix_vcol_expr(THD *thd, Virtual_column_info *vcol)
DBUG_ENTER("fix_vcol_expr"); DBUG_ENTER("fix_vcol_expr");
const enum enum_column_usage saved_column_usage= thd->column_usage; const enum enum_column_usage saved_column_usage= thd->column_usage;
thd->column_usage= MARK_COLUMNS_NONE; thd->column_usage= COLUMNS_WRITE;
int error= vcol->expr->fix_fields(thd, &vcol->expr); int error= vcol->expr->fix_fields(thd, &vcol->expr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment