@@ -413,7 +413,8 @@ Item::Item(THD *thd):
413
413
name(null_clex_str), orig_name(0 ), is_expensive_cache(-1 )
414
414
{
415
415
DBUG_ASSERT (thd);
416
- flags= ITEM_FLAG_FIXED | ITEM_FLAG_IS_AUTOGENERATED_NAME;
416
+ base_flags= item_base_t ::FIXED | item_base_t ::IS_AUTOGENERATED_NAME;
417
+ with_flags= item_with_t ::NONE;
417
418
null_value= 0 ;
418
419
marker= 0 ;
419
420
@@ -445,7 +446,8 @@ Item::Item():
445
446
name(null_clex_str), orig_name(0 ), is_expensive_cache(-1 )
446
447
{
447
448
DBUG_ASSERT (my_progname == NULL ); // before main()
448
- flags= ITEM_FLAG_FIXED | ITEM_FLAG_IS_AUTOGENERATED_NAME;
449
+ base_flags= item_base_t ::FIXED | item_base_t ::IS_AUTOGENERATED_NAME;
450
+ with_flags= item_with_t ::NONE;
449
451
null_value= 0 ;
450
452
marker= 0 ;
451
453
join_tab_idx= MAX_TABLES;
@@ -473,13 +475,13 @@ Item::Item(THD *thd, Item *item):
473
475
str_value(item->str_value),
474
476
name(item->name),
475
477
orig_name(item->orig_name),
478
+ base_flags(item->base_flags & ~item_base_t ::FIXED),
479
+ with_flags(item->with_flags),
476
480
marker(item->marker),
477
481
null_value(item->null_value),
478
482
is_expensive_cache(-1 ),
479
483
join_tab_idx(item->join_tab_idx)
480
484
{
481
- flags= item->flags & (item_flags_t ) ~ITEM_FLAG_FIXED;
482
-
483
485
next= thd->free_list ; // Put in free list
484
486
thd->free_list = this ;
485
487
}
@@ -1599,9 +1601,10 @@ bool Item_sp_variable::fix_fields_from_item(THD *thd, Item **, const Item *it)
1599
1601
max_length= it->max_length ;
1600
1602
decimals= it->decimals ;
1601
1603
unsigned_flag= it->unsigned_flag ;
1602
- flags|= ITEM_FLAG_WITH_PARAM | ITEM_FLAG_FIXED;
1604
+ base_flags|= item_base_t ::FIXED;
1605
+ with_flags|= item_with_t ::SP_VAR;
1603
1606
if (thd->lex ->current_select && thd->lex ->current_select ->master_unit ()->item )
1604
- thd->lex ->current_select ->master_unit ()->item ->flags |= ITEM_FLAG_WITH_PARAM ;
1607
+ thd->lex ->current_select ->master_unit ()->item ->with_flags |= item_with_t ::SP_VAR ;
1605
1608
collation.set (it->collation .collation , it->collation .derivation );
1606
1609
1607
1610
return FALSE ;
@@ -1723,7 +1726,7 @@ Item_splocal::Item_splocal(THD *thd,
1723
1726
m_var_idx(sp_var_idx),
1724
1727
m_type(handler == &type_handler_row ? ROW_ITEM : CONST_ITEM)
1725
1728
{
1726
- flags|= ITEM_FLAG_MAYBE_NULL ;
1729
+ set_maybe_null () ;
1727
1730
}
1728
1731
1729
1732
@@ -2086,7 +2089,7 @@ Item_name_const::Item_name_const(THD *thd, Item *name_arg, Item *val):
2086
2089
StringBuffer<128 > name_buffer;
2087
2090
String *name_str;
2088
2091
2089
- flags|= ITEM_FLAG_MAYBE_NULL ;
2092
+ set_maybe_null () ;
2090
2093
if (name_item->basic_const_item () &&
2091
2094
(name_str= name_item->val_str (&name_buffer))) // Can't have a NULL name
2092
2095
set_name (thd, name_str);
@@ -2140,7 +2143,7 @@ bool Item_name_const::fix_fields(THD *thd, Item **ref)
2140
2143
max_length= value_item->max_length ;
2141
2144
decimals= value_item->decimals ;
2142
2145
unsigned_flag= value_item->unsigned_flag ;
2143
- flags |= ITEM_FLAG_FIXED ;
2146
+ base_flags |= item_base_t ::FIXED ;
2144
2147
return FALSE ;
2145
2148
}
2146
2149
@@ -2959,7 +2962,7 @@ Item_field::Item_field(THD *thd, Field *f)
2959
2962
*/
2960
2963
orig_table_name= table_name;
2961
2964
orig_field_name= field_name;
2962
- flags |= ITEM_FLAG_WITH_FIELD ;
2965
+ with_flags |= item_with_t ::FIELD ;
2963
2966
}
2964
2967
2965
2968
@@ -3009,7 +3012,7 @@ Item_field::Item_field(THD *thd, Name_resolution_context *context_arg,
3009
3012
name= orig_field_name;
3010
3013
}
3011
3014
set_field (f);
3012
- flags |= ITEM_FLAG_WITH_FIELD ;
3015
+ with_flags |= item_with_t ::FIELD ;
3013
3016
}
3014
3017
3015
3018
@@ -3025,7 +3028,7 @@ Item_field::Item_field(THD *thd, Name_resolution_context *context_arg,
3025
3028
collation.set (DERIVATION_IMPLICIT);
3026
3029
if (select && select->parsing_place != IN_HAVING)
3027
3030
select->select_n_where_fields ++;
3028
- flags |= ITEM_FLAG_WITH_FIELD ;
3031
+ with_flags |= item_with_t ::FIELD ;
3029
3032
}
3030
3033
3031
3034
/* *
@@ -3040,7 +3043,7 @@ Item_field::Item_field(THD *thd, Item_field *item)
3040
3043
any_privileges(item->any_privileges)
3041
3044
{
3042
3045
collation.set (DERIVATION_IMPLICIT);
3043
- flags |= ITEM_FLAG_WITH_FIELD ;
3046
+ with_flags |= item_with_t ::FIELD ;
3044
3047
}
3045
3048
3046
3049
@@ -3065,7 +3068,7 @@ void Item_field::set_field(Field *field_par)
3065
3068
db_name= field_par->table ->s ->db ;
3066
3069
alias_name_used= field_par->table ->alias_name_used ;
3067
3070
3068
- flags |= ITEM_FLAG_FIXED ;
3071
+ base_flags |= item_base_t ::FIXED ;
3069
3072
if (field->table ->s ->tmp_table == SYSTEM_TMP_TABLE)
3070
3073
any_privileges= 0 ;
3071
3074
}
@@ -3959,7 +3962,7 @@ Item_param::Item_param(THD *thd, const LEX_CSTRING *name_arg,
3959
3962
before mysql_stmt_execute(), so we assuming that it can be NULL until
3960
3963
value is set.
3961
3964
*/
3962
- flags|= ITEM_FLAG_MAYBE_NULL ;
3965
+ set_maybe_null () ;
3963
3966
}
3964
3967
3965
3968
@@ -3991,7 +3994,7 @@ void Item_param::sync_clones()
3991
3994
{
3992
3995
Item_param *c= *c_ptr;
3993
3996
/* Scalar-type members: */
3994
- c->copy_flags (this , ITEM_FLAG_MAYBE_NULL );
3997
+ c->copy_flags (this , item_base_t ::MAYBE_NULL );
3995
3998
c->null_value = null_value;
3996
3999
c->Type_std_attributes ::operator =(*this );
3997
4000
c->Type_handler_hybrid_field_type ::operator =(*this );
@@ -4043,7 +4046,7 @@ void Item_param::set_int(longlong i, uint32 max_length_arg)
4043
4046
collation= DTCollation_numeric ();
4044
4047
max_length= max_length_arg;
4045
4048
decimals= 0 ;
4046
- flags &= ( item_flags_t ) ~ITEM_FLAG_MAYBE_NULL ;
4049
+ base_flags &= ~ item_base_t ::MAYBE_NULL ;
4047
4050
null_value= 0 ;
4048
4051
DBUG_VOID_RETURN;
4049
4052
}
@@ -4057,7 +4060,7 @@ void Item_param::set_double(double d)
4057
4060
collation= DTCollation_numeric ();
4058
4061
max_length= DBL_DIG + 8 ;
4059
4062
decimals= NOT_FIXED_DEC;
4060
- flags &= ( item_flags_t ) ~ITEM_FLAG_MAYBE_NULL ;
4063
+ base_flags &= ~ item_base_t ::MAYBE_NULL ;
4061
4064
null_value= 0 ;
4062
4065
DBUG_VOID_RETURN;
4063
4066
}
@@ -4089,7 +4092,7 @@ void Item_param::set_decimal(const char *str, ulong length)
4089
4092
max_length=
4090
4093
my_decimal_precision_to_length_no_truncation (value.m_decimal .precision (),
4091
4094
decimals, unsigned_flag);
4092
- flags &= ( item_flags_t ) ~ITEM_FLAG_MAYBE_NULL ;
4095
+ base_flags &= ~ item_base_t ::MAYBE_NULL ;
4093
4096
null_value= 0 ;
4094
4097
DBUG_VOID_RETURN;
4095
4098
}
@@ -4106,7 +4109,7 @@ void Item_param::set_decimal(const my_decimal *dv, bool unsigned_arg)
4106
4109
unsigned_flag= unsigned_arg;
4107
4110
max_length= my_decimal_precision_to_length (value.m_decimal .intg + decimals,
4108
4111
decimals, unsigned_flag);
4109
- flags &= ( item_flags_t ) ~ITEM_FLAG_MAYBE_NULL ;
4112
+ base_flags &= ~ item_base_t ::MAYBE_NULL ;
4110
4113
null_value= 0 ;
4111
4114
}
4112
4115
@@ -4117,7 +4120,7 @@ void Item_param::fix_temporal(uint32 max_length_arg, uint decimals_arg)
4117
4120
collation= DTCollation_numeric ();
4118
4121
max_length= max_length_arg;
4119
4122
decimals= decimals_arg;
4120
- flags &= ( item_flags_t ) ~ITEM_FLAG_MAYBE_NULL ;
4123
+ base_flags &= ~ item_base_t ::MAYBE_NULL ;
4121
4124
null_value= 0 ;
4122
4125
}
4123
4126
@@ -4127,7 +4130,7 @@ void Item_param::set_time(const MYSQL_TIME *tm,
4127
4130
{
4128
4131
DBUG_ASSERT (value.type_handler ()->cmp_type () == TIME_RESULT);
4129
4132
value.time = *tm;
4130
- flags &= ( item_flags_t ) ~ITEM_FLAG_MAYBE_NULL ;
4133
+ base_flags &= ~ item_base_t ::MAYBE_NULL ;
4131
4134
null_value= 0 ;
4132
4135
fix_temporal (max_length_arg, decimals_arg);
4133
4136
}
@@ -4162,7 +4165,7 @@ void Item_param::set_time(MYSQL_TIME *tm, timestamp_type time_type,
4162
4165
&str, time_type, NULL , NULL , NULL );
4163
4166
set_zero_time (&value.time , time_type);
4164
4167
}
4165
- flags &= ( item_flags_t ) ~ITEM_FLAG_MAYBE_NULL ;
4168
+ base_flags &= ~ item_base_t ::MAYBE_NULL ;
4166
4169
null_value= 0 ;
4167
4170
fix_temporal (max_length_arg,
4168
4171
tm->second_part > 0 ? TIME_SECOND_PART_DIGITS : 0 );
@@ -4199,7 +4202,7 @@ bool Item_param::set_str(const char *str, ulong length,
4199
4202
state= SHORT_DATA_VALUE;
4200
4203
collation.set (tocs, DERIVATION_COERCIBLE);
4201
4204
max_length= length;
4202
- flags &= ( item_flags_t ) ~ITEM_FLAG_MAYBE_NULL ;
4205
+ base_flags &= ~ item_base_t ::MAYBE_NULL ;
4203
4206
null_value= 0 ;
4204
4207
/* max_length and decimals are set after charset conversion */
4205
4208
/* sic: str may be not null-terminated, don't add DBUG_PRINT here */
@@ -4234,7 +4237,7 @@ bool Item_param::set_longdata(const char *str, ulong length)
4234
4237
if (value.m_string .append (str, length, &my_charset_bin))
4235
4238
DBUG_RETURN (TRUE );
4236
4239
state= LONG_DATA_VALUE;
4237
- flags &= ( item_flags_t ) ~ITEM_FLAG_MAYBE_NULL ;
4240
+ base_flags &= ~ item_base_t ::MAYBE_NULL ;
4238
4241
null_value= 0 ;
4239
4242
4240
4243
DBUG_RETURN (FALSE );
@@ -4335,7 +4338,7 @@ void Item_param::reset()
4335
4338
value.m_string .set_charset (&my_charset_bin);
4336
4339
collation.set (&my_charset_bin, DERIVATION_COERCIBLE);
4337
4340
state= NO_VALUE;
4338
- flags|= ITEM_FLAG_MAYBE_NULL ;
4341
+ set_maybe_null () ;
4339
4342
null_value= 0 ;
4340
4343
DBUG_VOID_RETURN;
4341
4344
}
@@ -4794,7 +4797,7 @@ Item_param::set_param_type_and_swap_value(Item_param *src)
4794
4797
Type_std_attributes::set (src);
4795
4798
set_handler (src->type_handler ());
4796
4799
4797
- copy_flags (src, ITEM_FLAG_MAYBE_NULL );
4800
+ copy_flags (src, item_base_t ::MAYBE_NULL );
4798
4801
null_value= src->null_value ;
4799
4802
state= src->state ;
4800
4803
@@ -5629,7 +5632,7 @@ Item_field::fix_outer_field(THD *thd, Field **from_field, Item **reference)
5629
5632
set_if_bigger (thd->lex ->in_sum_func ->max_arg_level ,
5630
5633
select->nest_level );
5631
5634
set_field (*from_field);
5632
- flags |= ITEM_FLAG_FIXED ;
5635
+ base_flags |= item_base_t ::FIXED ;
5633
5636
mark_as_dependent (thd, last_checked_context->select_lex ,
5634
5637
context->select_lex , this ,
5635
5638
((ref_type == REF_ITEM ||
@@ -6049,7 +6052,7 @@ bool Item_field::fix_fields(THD *thd, Item **reference)
6049
6052
}
6050
6053
}
6051
6054
#endif
6052
- flags |= ITEM_FLAG_FIXED ;
6055
+ base_flags |= item_base_t ::FIXED ;
6053
6056
if (field->vcol_info )
6054
6057
fix_session_vcol_expr_for_read (thd, field, field->vcol_info );
6055
6058
if (thd->variables .sql_mode & MODE_ONLY_FULL_GROUP_BY &&
@@ -8072,20 +8075,10 @@ void Item_ref::set_properties()
8072
8075
We have to remember if we refer to a sum function, to ensure that
8073
8076
split_sum_func() doesn't try to change the reference.
8074
8077
*/
8075
- /* Reset flags if called from update_ref() */
8076
- flags&= ~ (ITEM_FLAG_WITH_SUM_FUNC |
8077
- ITEM_FLAG_WITH_PARAM |
8078
- ITEM_FLAG_WITH_WINDOW_FUNC |
8079
- ITEM_FLAG_WITH_SUBQUERY |
8080
- ITEM_FLAG_WITH_FIELD);
8081
-
8082
- flags|= (ITEM_FLAG_FIXED |
8083
- ((*ref)->flags & (ITEM_FLAG_MAYBE_NULL |
8084
- ITEM_FLAG_WITH_SUM_FUNC |
8085
- ITEM_FLAG_WITH_PARAM |
8086
- ITEM_FLAG_WITH_WINDOW_FUNC |
8087
- ITEM_FLAG_WITH_SUBQUERY |
8088
- ITEM_FLAG_WITH_FIELD)));
8078
+ with_flags= (*ref)->with_flags ;
8079
+ base_flags|= (item_base_t ::FIXED |
8080
+ ((*ref)->base_flags & item_base_t ::MAYBE_NULL));
8081
+
8089
8082
if (alias_name_used)
8090
8083
return ;
8091
8084
if ((*ref)->type () == FIELD_ITEM)
@@ -8563,14 +8556,10 @@ Item_cache_wrapper::Item_cache_wrapper(THD *thd, Item *item_arg):
8563
8556
DBUG_ASSERT (orig_item->fixed ());
8564
8557
Type_std_attributes::set (orig_item);
8565
8558
8566
- flags|= ITEM_FLAG_FIXED |
8567
- (orig_item->flags &
8568
- (ITEM_FLAG_MAYBE_NULL |
8569
- ITEM_FLAG_WITH_SUM_FUNC |
8570
- ITEM_FLAG_WITH_SUBQUERY |
8571
- ITEM_FLAG_WITH_PARAM |
8572
- ITEM_FLAG_WITH_FIELD));
8573
-
8559
+ base_flags|= (item_base_t ::FIXED |
8560
+ (orig_item->base_flags & item_base_t ::MAYBE_NULL));
8561
+ with_flags|= orig_item->with_flags ;
8562
+
8574
8563
name= item_arg->name ;
8575
8564
8576
8565
if ((expr_value= orig_item->get_cache (thd)))
@@ -9029,7 +9018,7 @@ bool Item_direct_view_ref::fix_fields(THD *thd, Item **reference)
9029
9018
if (Item_direct_ref::fix_fields (thd, reference))
9030
9019
return TRUE ;
9031
9020
if (view->table && view->table ->maybe_null )
9032
- flags|= ITEM_FLAG_MAYBE_NULL ;
9021
+ set_maybe_null () ;
9033
9022
set_null_ref_table ();
9034
9023
return FALSE ;
9035
9024
}
@@ -9789,7 +9778,7 @@ bool Item_trigger_field::fix_fields(THD *thd, Item **items)
9789
9778
field= (row_version == OLD_ROW) ? triggers->old_field [field_idx] :
9790
9779
triggers->new_field [field_idx];
9791
9780
set_field (field);
9792
- flags |= ITEM_FLAG_FIXED ;
9781
+ base_flags |= item_base_t ::FIXED ;
9793
9782
return FALSE ;
9794
9783
}
9795
9784
0 commit comments