~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to sql/item.cc

  • Committer: Brian Aker
  • Date: 2008-07-05 17:02:05 UTC
  • Revision ID: brian@tangent.org-20080705170205-ezff9is4e7hpa3x2
Conversion of handler type.

Show diffs side-by-side

added added

removed removed

Lines of Context:
99
99
*/
100
100
void Hybrid_type_traits_decimal::div(Hybrid_type *val, ulonglong u) const
101
101
{
102
 
  int2my_decimal(E_DEC_FATAL_ERROR, u, TRUE, &val->dec_buf[2]);
 
102
  int2my_decimal(E_DEC_FATAL_ERROR, u, true, &val->dec_buf[2]);
103
103
  /* XXX: what is '4' for scale? */
104
104
  my_decimal_div(E_DEC_FATAL_ERROR,
105
105
                 &val->dec_buf[val->used_dec_buf_no ^ 1],
133
133
                                    uint8 decimals) const
134
134
{
135
135
  my_decimal_round(E_DEC_FATAL_ERROR, &val->dec_buf[val->used_dec_buf_no],
136
 
                   decimals, FALSE, &val->dec_buf[2]);
 
136
                   decimals, false, &val->dec_buf[2]);
137
137
  my_decimal2string(E_DEC_FATAL_ERROR, &val->dec_buf[2], 0, 0, 0, to);
138
138
  return to;
139
139
}
222
222
  my_decimal dec_buf, *dec= val_decimal(&dec_buf);
223
223
  if (null_value)
224
224
    return 0;
225
 
  my_decimal_round(E_DEC_FATAL_ERROR, dec, decimals, FALSE, &dec_buf);
 
225
  my_decimal_round(E_DEC_FATAL_ERROR, dec, decimals, false, &dec_buf);
226
226
  my_decimal2string(E_DEC_FATAL_ERROR, &dec_buf, 0, 0, 0, str);
227
227
  return str;
228
228
}
372
372
 
373
373
Item::Item():
374
374
  is_expensive_cache(-1), rsize(0), name(0), orig_name(0), name_length(0),
375
 
  fixed(0), is_autogenerated_name(TRUE),
 
375
  fixed(0), is_autogenerated_name(true),
376
376
  collation(&my_charset_bin, DERIVATION_COERCIBLE)
377
377
{
378
378
  marker= 0;
474
474
{
475
475
  if (fixed)
476
476
    cleanup();
477
 
  return FALSE;
 
477
  return false;
478
478
}
479
479
 
480
480
 
538
538
   orig_field_name(field_name_arg), context(context_arg),
539
539
   db_name(db_name_arg), table_name(table_name_arg),
540
540
   field_name(field_name_arg),
541
 
   alias_name_used(FALSE), cached_field_index(NO_CACHED_FIELD_INDEX),
 
541
   alias_name_used(false), cached_field_index(NO_CACHED_FIELD_INDEX),
542
542
   cached_table(0), depended_from(0)
543
543
{
544
544
  name = (char*) field_name_arg;
606
606
  @param arg  pointer to a List<Item_field>
607
607
 
608
608
  @return
609
 
    FALSE to force the evaluation of collect_item_field_processor
 
609
    false to force the evaluation of collect_item_field_processor
610
610
    for the subsequent items.
611
611
*/
612
612
 
620
620
  while ((curr_item= item_list_it++))
621
621
  {
622
622
    if (curr_item->eq(this, 1))
623
 
      DBUG_RETURN(FALSE); /* Already in the set. */
 
623
      DBUG_RETURN(false); /* Already in the set. */
624
624
  }
625
625
  item_list->push_back(this);
626
 
  DBUG_RETURN(FALSE);
 
626
  DBUG_RETURN(false);
627
627
}
628
628
 
629
629
 
638
638
  @param arg   Field being compared, arg must be of type Field
639
639
 
640
640
  @retval
641
 
    TRUE  if 'this' references the field 'arg'
 
641
    true  if 'this' references the field 'arg'
642
642
  @retval
643
 
    FALSE otherwise
 
643
    false otherwise
644
644
*/
645
645
 
646
646
bool Item_field::find_item_in_field_list_processor(uchar *arg)
652
652
  for (cur_part= first_non_group_part; cur_part != last_part; cur_part++)
653
653
  {
654
654
    if (field->eq(cur_part->field))
655
 
      return TRUE;
 
655
      return true;
656
656
  }
657
 
  return FALSE;
 
657
  return false;
658
658
}
659
659
 
660
660
 
741
741
bool Item::eq(const Item *item, bool binary_cmp) const
742
742
{
743
743
  /*
744
 
    Note, that this is never TRUE if item is a Item_param:
 
744
    Note, that this is never true if item is a Item_param:
745
745
    for all basic constants we have special checks, and Item_param's
746
746
    type() can be only among basic constant types.
747
747
  */
1069
1069
      (left->derivation < right->derivation ||
1070
1070
       (left->derivation == right->derivation &&
1071
1071
        !(right->collation->state & MY_CS_UNICODE))))
1072
 
    return TRUE;
 
1072
    return true;
1073
1073
  /* Allow convert from ASCII */
1074
1074
  if (right->repertoire == MY_REPERTOIRE_ASCII &&
1075
1075
      (left->derivation < right->derivation ||
1076
1076
       (left->derivation == right->derivation &&
1077
1077
        !(left->repertoire == MY_REPERTOIRE_ASCII))))
1078
 
    return TRUE;
 
1078
    return true;
1079
1079
  /* Disallow conversion otherwise */
1080
 
  return FALSE;
 
1080
  return false;
1081
1081
}
1082
1082
 
1083
1083
/**
1260
1260
    if (c.aggregate((*arg)->collation, flags))
1261
1261
    {
1262
1262
      my_coll_agg_error(av, count, fname, item_sep);
1263
 
      return TRUE;
 
1263
      return true;
1264
1264
    }
1265
1265
  }
1266
1266
  if ((flags & MY_COLL_DISALLOW_NONE) &&
1267
1267
      c.derivation == DERIVATION_NONE)
1268
1268
  {
1269
1269
    my_coll_agg_error(av, count, fname, item_sep);
1270
 
    return TRUE;
 
1270
    return true;
1271
1271
  }
1272
 
  return FALSE;
 
1272
  return false;
1273
1273
}
1274
1274
 
1275
1275
 
1320
1320
  memset(safe_args, 0, sizeof(safe_args));
1321
1321
 
1322
1322
  if (agg_item_collations(coll, fname, args, nargs, flags, item_sep))
1323
 
    return TRUE;
 
1323
    return true;
1324
1324
 
1325
1325
  /*
1326
1326
    For better error reporting: save the first and the second argument.
1337
1337
 
1338
1338
  THD *thd= current_thd;
1339
1339
  Query_arena *arena, backup;
1340
 
  bool res= FALSE;
 
1340
  bool res= false;
1341
1341
  uint i;
1342
1342
  /*
1343
1343
    In case we're in statement prepare, create conversion item
1367
1367
        args[item_sep]= safe_args[1];
1368
1368
      }
1369
1369
      my_coll_agg_error(args, nargs, fname, item_sep);
1370
 
      res= TRUE;
 
1370
      res= true;
1371
1371
      break; // we cannot return here, we need to restore "arena".
1372
1372
    }
1373
1373
    if ((*arg)->type() == Item::FIELD_ITEM)
1680
1680
bool Item_field::val_bool_result()
1681
1681
{
1682
1682
  if ((null_value= result_field->is_null()))
1683
 
    return FALSE;
 
1683
    return false;
1684
1684
  switch (result_field->result_type()) {
1685
1685
  case INT_RESULT:
1686
1686
    return result_field->val_int() != 0;
2137
2137
  param_type(MYSQL_TYPE_VARCHAR),
2138
2138
  pos_in_query(pos_in_query_arg),
2139
2139
  set_param_func(default_set_param_func),
2140
 
  limit_clause_param(FALSE)
 
2140
  limit_clause_param(false)
2141
2141
{
2142
2142
  name= (char*) "?";
2143
2143
  /* 
2270
2270
  uint dummy_errors;
2271
2271
  if (str_value.copy(str, length, &my_charset_bin, &my_charset_bin,
2272
2272
                     &dummy_errors))
2273
 
    DBUG_RETURN(TRUE);
 
2273
    DBUG_RETURN(true);
2274
2274
  state= STRING_VALUE;
2275
2275
  max_length= length;
2276
2276
  maybe_null= 0;
2277
2277
  /* max_length and decimals are set after charset conversion */
2278
2278
  /* sic: str may be not null-terminated, don't add DBUG_PRINT here */
2279
 
  DBUG_RETURN(FALSE);
 
2279
  DBUG_RETURN(false);
2280
2280
}
2281
2281
 
2282
2282
 
2294
2294
    write query to the binary log and only then perform conversion.
2295
2295
  */
2296
2296
  if (str_value.append(str, length, &my_charset_bin))
2297
 
    DBUG_RETURN(TRUE);
 
2297
    DBUG_RETURN(true);
2298
2298
  state= LONG_DATA_VALUE;
2299
2299
  maybe_null= 0;
2300
2300
 
2301
 
  DBUG_RETURN(FALSE);
 
2301
  DBUG_RETURN(false);
2302
2302
}
2303
2303
 
2304
2304
 
2676
2676
 
2677
2677
bool Item_param::convert_str_value(THD *thd)
2678
2678
{
2679
 
  bool rc= FALSE;
 
2679
  bool rc= false;
2680
2680
  if (state == STRING_VALUE || state == LONG_DATA_VALUE)
2681
2681
  {
2682
2682
    /*
2714
2714
bool Item_param::basic_const_item() const
2715
2715
{
2716
2716
  if (state == NO_VALUE || state == TIME_VALUE)
2717
 
    return FALSE;
2718
 
  return TRUE;
 
2717
    return false;
 
2718
  return true;
2719
2719
}
2720
2720
 
2721
2721
 
2751
2751
{
2752
2752
  Item *item;
2753
2753
  if (!basic_const_item() || !arg->basic_const_item() || arg->type() != type())
2754
 
    return FALSE;
 
2754
    return false;
2755
2755
  /*
2756
2756
    We need to cast off const to call val_int(). This should be OK for
2757
2757
    a basic constant.
2760
2760
 
2761
2761
  switch (state) {
2762
2762
  case NULL_VALUE:
2763
 
    return TRUE;
 
2763
    return true;
2764
2764
  case INT_VALUE:
2765
2765
    return value.integer == item->val_int() &&
2766
2766
           unsigned_flag == item->unsigned_flag;
2774
2774
  default:
2775
2775
    break;
2776
2776
  }
2777
 
  return FALSE;
 
2777
  return false;
2778
2778
}
2779
2779
 
2780
2780
/* End of Item_param related */
2839
2839
  // We do not check fields which are fixed during construction
2840
2840
  DBUG_ASSERT(fixed == 0 || basic_const_item());
2841
2841
  fixed= 1;
2842
 
  return FALSE;
 
2842
  return false;
2843
2843
}
2844
2844
 
2845
2845
double Item_ref_null_helper::val_real()
3143
3143
  Item **group_by_ref= NULL;
3144
3144
  Item **select_ref= NULL;
3145
3145
  ORDER *group_list= (ORDER*) select->group_list.first;
3146
 
  bool ambiguous_fields= FALSE;
 
3146
  bool ambiguous_fields= false;
3147
3147
  uint counter;
3148
3148
  enum_resolution_type resolution;
3149
3149
 
3156
3156
                                      &resolution)))
3157
3157
    return NULL; /* Some error occurred. */
3158
3158
  if (resolution == RESOLVED_AGAINST_ALIAS)
3159
 
    ref->alias_name_used= TRUE;
 
3159
    ref->alias_name_used= true;
3160
3160
 
3161
3161
  /* If this is a non-aggregated field inside HAVING, search in GROUP BY. */
3162
3162
  if (select->having_fix_field && !ref->with_sum_func && group_list)
3167
3167
    if (group_by_ref && (select_ref != not_found_item) &&
3168
3168
        !((*group_by_ref)->eq(*select_ref, 0)))
3169
3169
    {
3170
 
      ambiguous_fields= TRUE;
 
3170
      ambiguous_fields= true;
3171
3171
      push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_NON_UNIQ_ERROR,
3172
3172
                          ER(ER_NON_UNIQ_ERROR), ref->full_name(),
3173
3173
                          current_thd->where);
3191
3191
    }
3192
3192
    if (group_by_ref)
3193
3193
      return group_by_ref;
3194
 
    DBUG_ASSERT(FALSE);
 
3194
    DBUG_ASSERT(false);
3195
3195
    return NULL; /* So there is no compiler warning. */
3196
3196
  }
3197
3197
 
3233
3233
  @retval
3234
3234
    1   column succefully resolved and fix_fields() should continue.
3235
3235
  @retval
3236
 
    0   column fully fixed and fix_fields() should return FALSE
 
3236
    0   column fully fixed and fix_fields() should return false
3237
3237
  @retval
3238
3238
    -1  error occured
3239
3239
*/
3243
3243
{
3244
3244
  enum_parsing_place place= NO_MATTER;
3245
3245
  bool field_found= (*from_field != not_found_field);
3246
 
  bool upward_lookup= FALSE;
 
3246
  bool upward_lookup= false;
3247
3247
 
3248
3248
  /*
3249
3249
    If there are outer contexts (outer selects, but current select is
3271
3271
    Item_subselect *prev_subselect_item=
3272
3272
      last_checked_context->select_lex->master_unit()->item;
3273
3273
    last_checked_context= outer_context;
3274
 
    upward_lookup= TRUE;
 
3274
    upward_lookup= true;
3275
3275
 
3276
3276
    place= prev_subselect_item->parsing_place;
3277
3277
    /*
3293
3293
                                            last_name_resolution_table,
3294
3294
                                          reference,
3295
3295
                                          IGNORE_EXCEPT_NON_UNIQUE,
3296
 
                                          TRUE, TRUE)) !=
 
3296
                                          true, true)) !=
3297
3297
        not_found_field)
3298
3298
    {
3299
3299
      if (*from_field)
3410
3410
                           context->last_name_resolution_table,
3411
3411
                           reference, REPORT_ALL_ERRORS,
3412
3412
                           !any_privileges &&
3413
 
                           TRUE, TRUE);
 
3413
                           true, true);
3414
3414
    }
3415
3415
    return -1;
3416
3416
  }
3528
3528
    view column
3529
3529
 
3530
3530
  @retval
3531
 
    TRUE  if error
 
3531
    true  if error
3532
3532
  @retval
3533
 
    FALSE on success
 
3533
    false on success
3534
3534
*/
3535
3535
 
3536
3536
bool Item_field::fix_fields(THD *thd, Item **reference)
3554
3554
                                            REPORT_ALL_ERRORS : 
3555
3555
                                            IGNORE_EXCEPT_NON_UNIQUE,
3556
3556
                                          !any_privileges,
3557
 
                                          TRUE)) ==
 
3557
                                          true)) ==
3558
3558
        not_found_field)
3559
3559
    {
3560
3560
      int ret;
3569
3569
        if (!res)
3570
3570
          return 1;
3571
3571
        if (resolution == RESOLVED_AGAINST_ALIAS)
3572
 
          alias_name_used= TRUE;
 
3572
          alias_name_used= true;
3573
3573
        if (res != (Item **)not_found_item)
3574
3574
        {
3575
3575
          if ((*res)->type() == Item::FIELD_ITEM)
3616
3616
      }
3617
3617
      if ((ret= fix_outer_field(thd, &from_field, reference)) < 0)
3618
3618
        goto error;
3619
 
      outer_fixed= TRUE;
 
3619
      outer_fixed= true;
3620
3620
      if (!ret)
3621
3621
        goto mark_non_agg_field;
3622
3622
    }
3648
3648
      Also we suppose that view can't be changed during PS/SP life.
3649
3649
    */
3650
3650
    if (from_field == view_ref_found)
3651
 
      return FALSE;
 
3651
      return false;
3652
3652
 
3653
3653
    set_field(from_field);
3654
3654
    if (thd->lex->in_sum_func &&
3685
3685
  }
3686
3686
  fixed= 1;
3687
3687
mark_non_agg_field:
3688
 
  return FALSE;
 
3688
  return false;
3689
3689
 
3690
3690
error:
3691
3691
  context->process_error(thd);
3692
 
  return TRUE;
 
3692
  return true;
3693
3693
}
3694
3694
 
3695
3695
Item *Item_field::safe_charset_converter(CHARSET_INFO *tocs)
3709
3709
    I.e. we can drop 'field'.
3710
3710
   */
3711
3711
  field= result_field= 0;
3712
 
  null_value= FALSE;
 
3712
  null_value= false;
3713
3713
  DBUG_VOID_RETURN;
3714
3714
}
3715
3715
 
3777
3777
    a comparison predicate.
3778
3778
 
3779
3779
  @retval
3780
 
    TRUE   substitution is valid
 
3780
    true   substitution is valid
3781
3781
  @retval
3782
 
    FALSE  otherwise
 
3782
    false  otherwise
3783
3783
*/
3784
3784
 
3785
3785
bool Item_field::subst_argument_checker(uchar **arg)
3879
3879
{
3880
3880
  if (field->charset() != &my_charset_bin)
3881
3881
    no_const_subst=1;
3882
 
  return FALSE;
 
3882
  return false;
3883
3883
}
3884
3884
 
3885
3885
 
3993
3993
    case MYSQL_TYPE_DATE:
3994
3994
    case MYSQL_TYPE_DATETIME:
3995
3995
    case MYSQL_TYPE_TIMESTAMP:
3996
 
      return TRUE;
 
3996
      return true;
3997
3997
    default:
3998
3998
      break;
3999
3999
  }
4000
 
  return FALSE;
 
4000
  return false;
4001
4001
}
4002
4002
 
4003
4003
 
4040
4040
  SYNOPSIS
4041
4041
    eq_by_collation()
4042
4042
    item               item to compare with
4043
 
    binary_cmp         TRUE <-> compare as binaries
 
4043
    binary_cmp         true <-> compare as binaries
4044
4044
    cs                 collation to use when comparing strings
4045
4045
 
4046
4046
  DESCRIPTION
4337
4337
      return set_field_to_null_with_conversions(field, no_conversions);
4338
4338
    }
4339
4339
 
4340
 
    /* NOTE: If null_value == FALSE, "result" must be not NULL.  */
 
4340
    /* NOTE: If null_value == false, "result" must be not NULL.  */
4341
4341
 
4342
4342
    field->set_notnull();
4343
4343
    error=field->store(result->ptr(),result->length(),cs);
4425
4425
    Item *item= (Item*) arg;
4426
4426
    return item->val_int() == value && item->unsigned_flag == unsigned_flag;
4427
4427
  }
4428
 
  return FALSE;
 
4428
  return false;
4429
4429
}
4430
4430
 
4431
4431
 
4540
4540
    Item *item= (Item*) arg;
4541
4541
    return item->val_real() == value;
4542
4542
  }
4543
 
  return FALSE;
 
4543
  return false;
4544
4544
}
4545
4545
 
4546
4546
 
4592
4592
  // following assert is redundant, because fixed=1 assigned in constructor
4593
4593
  DBUG_ASSERT(fixed == 1);
4594
4594
  ulonglong value= (ulonglong)val_int();
4595
 
  int2my_decimal(E_DEC_FATAL_ERROR, value, TRUE, decimal_value);
 
4595
  int2my_decimal(E_DEC_FATAL_ERROR, value, true, decimal_value);
4596
4596
  return (decimal_value);
4597
4597
}
4598
4598
 
4617
4617
    nr= LONGLONG_MAX;
4618
4618
    goto warn;
4619
4619
  }
4620
 
  return field->store((longlong) nr, TRUE);  // Assume hex numbers are unsigned
 
4620
  return field->store((longlong) nr, true);  // Assume hex numbers are unsigned
4621
4621
 
4622
4622
warn:
4623
 
  if (!field->store((longlong) nr, TRUE))
 
4623
  if (!field->store((longlong) nr, true))
4624
4624
    field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE,
4625
4625
                       1);
4626
4626
  return 1;
4648
4648
      return !stringcmp(&str_value, &arg->str_value);
4649
4649
    return !sortcmp(&str_value, &arg->str_value, collation.collation);
4650
4650
  }
4651
 
  return FALSE;
 
4651
  return false;
4652
4652
}
4653
4653
 
4654
4654
 
4978
4978
    ER_BAD_FIELD_ERROR which we produce now.
4979
4979
 
4980
4980
  @retval
4981
 
    TRUE  if error
 
4981
    true  if error
4982
4982
  @retval
4983
 
    FALSE on success
 
4983
    false on success
4984
4984
*/
4985
4985
 
4986
4986
bool Item_ref::fix_fields(THD *thd, Item **reference)
5075
5075
                                             last_name_resolution_table,
5076
5076
                                           reference,
5077
5077
                                           IGNORE_EXCEPT_NON_UNIQUE,
5078
 
                                           TRUE, TRUE);
 
5078
                                           true, true);
5079
5079
          if (! from_field)
5080
5080
            goto error;
5081
5081
          if (from_field == view_ref_found)
5096
5096
              view reference found, we substituted it instead of this
5097
5097
              Item, so can quit
5098
5098
            */
5099
 
            return FALSE;
 
5099
            return false;
5100
5100
          }
5101
5101
          if (from_field != not_found_field)
5102
5102
          {
5152
5152
            last_checked_context->select_lex->nest_level)
5153
5153
          set_if_bigger(thd->lex->in_sum_func->max_arg_level,
5154
5154
                        last_checked_context->select_lex->nest_level);
5155
 
        return FALSE;
 
5155
        return false;
5156
5156
      }
5157
5157
      if (ref == 0)
5158
5158
      {
5203
5203
 
5204
5204
  if ((*ref)->check_cols(1))
5205
5205
    goto error;
5206
 
  return FALSE;
 
5206
  return false;
5207
5207
 
5208
5208
error:
5209
5209
  context->process_error(thd);
5210
 
  return TRUE;
 
5210
  return true;
5211
5211
}
5212
5212
 
5213
5213
 
5229
5229
  if ((*ref)->type() == FIELD_ITEM)
5230
5230
    alias_name_used= ((Item_ident *) (*ref))->alias_name_used;
5231
5231
  else
5232
 
    alias_name_used= TRUE; // it is not field, so it is was resolved by alias
 
5232
    alias_name_used= true; // it is not field, so it is was resolved by alias
5233
5233
}
5234
5234
 
5235
5235
 
5516
5516
  @param reference   reference on reference where this item stored
5517
5517
 
5518
5518
  @retval
5519
 
    FALSE   OK
 
5519
    false   OK
5520
5520
  @retval
5521
 
    TRUE    Error
 
5521
    true    Error
5522
5522
*/
5523
5523
 
5524
5524
bool Item_direct_view_ref::fix_fields(THD *thd, Item **reference)
5528
5528
  /* (*ref)->check_cols() will be made in Item_direct_ref::fix_fields */
5529
5529
  if (!(*ref)->fixed &&
5530
5530
      ((*ref)->fix_fields(thd, ref)))
5531
 
    return TRUE;
 
5531
    return true;
5532
5532
  return Item_direct_ref::fix_fields(thd, reference);
5533
5533
}
5534
5534
 
5541
5541
    reference   reference on reference where this item stored
5542
5542
 
5543
5543
  RETURN
5544
 
    FALSE   OK
5545
 
    TRUE    Error
 
5544
    false   OK
 
5545
    true    Error
5546
5546
*/
5547
5547
 
5548
5548
bool Item_outer_ref::fix_fields(THD *thd, Item **reference)
5550
5550
  bool err;
5551
5551
  /* outer_ref->check_cols() will be made in Item_direct_ref::fix_fields */
5552
5552
  if ((*ref) && !(*ref)->fixed && ((*ref)->fix_fields(thd, reference)))
5553
 
    return TRUE;
 
5553
    return true;
5554
5554
  err= Item_direct_ref::fix_fields(thd, reference);
5555
5555
  if (!outer_ref)
5556
5556
    outer_ref= *ref;
5589
5589
  @param binary_cmp  make binary comparison
5590
5590
 
5591
5591
  @retval
5592
 
    TRUE    Referenced item is equal to given item
 
5592
    true    Referenced item is equal to given item
5593
5593
  @retval
5594
 
    FALSE   otherwise
 
5594
    false   otherwise
5595
5595
*/
5596
5596
 
5597
5597
bool Item_direct_view_ref::eq(const Item *item, bool binary_cmp) const
5605
5605
      return ((*ref)->real_item() == item_ref_ref->real_item());
5606
5606
    }
5607
5607
  }
5608
 
  return FALSE;
 
5608
  return false;
5609
5609
}
5610
5610
 
5611
5611
bool Item_default_value::eq(const Item *item, bool binary_cmp) const
5625
5625
  if (!arg)
5626
5626
  {
5627
5627
    fixed= 1;
5628
 
    return FALSE;
 
5628
    return false;
5629
5629
  }
5630
5630
  if (!arg->fixed && arg->fix_fields(thd, &arg))
5631
5631
    goto error;
5651
5651
                               (def_field->table->s->default_values -
5652
5652
                                def_field->table->record[0]));
5653
5653
  set_field(def_field);
5654
 
  return FALSE;
 
5654
  return false;
5655
5655
 
5656
5656
error:
5657
5657
  context->process_error(thd);
5658
 
  return TRUE;
 
5658
  return true;
5659
5659
}
5660
5660
 
5661
5661
 
5743
5743
    res= arg->fix_fields(thd, &arg);
5744
5744
    context->last_name_resolution_table= orig_next_table;
5745
5745
    if (res)
5746
 
      return TRUE;
 
5746
      return true;
5747
5747
  }
5748
5748
 
5749
5749
  if (arg->type() == REF_ITEM)
5752
5752
    if (ref->ref[0]->type() != FIELD_ITEM)
5753
5753
    {
5754
5754
      my_error(ER_BAD_FIELD_ERROR, MYF(0), "", "VALUES() function");
5755
 
      return TRUE;
 
5755
      return true;
5756
5756
    }
5757
5757
    arg= ref->ref[0];
5758
5758
  }
5768
5768
  {
5769
5769
    Field *def_field= (Field*) sql_alloc(field_arg->field->size_of());
5770
5770
    if (!def_field)
5771
 
      return TRUE;
 
5771
      return true;
5772
5772
    memcpy(def_field, field_arg->field, field_arg->field->size_of());
5773
5773
    def_field->move_field_offset((my_ptrdiff_t)
5774
5774
                                 (def_field->table->insert_values -
5787
5787
      set_field(tmp_field);
5788
5788
    }
5789
5789
  }
5790
 
  return FALSE;
 
5790
  return false;
5791
5791
}
5792
5792
 
5793
5793
void Item_insert_value::print(String *str, enum_query_type query_type)
6068
6068
String* Item_cache_decimal::val_str(String *str)
6069
6069
{
6070
6070
  DBUG_ASSERT(fixed);
6071
 
  my_decimal_round(E_DEC_FATAL_ERROR, &decimal_value, decimals, FALSE,
 
6071
  my_decimal_round(E_DEC_FATAL_ERROR, &decimal_value, decimals, false,
6072
6072
                   &decimal_value);
6073
6073
  my_decimal2string(E_DEC_FATAL_ERROR, &decimal_value, 0, 0, 0, str);
6074
6074
  return str;
6334
6334
  @param item    given item to join its parameters with this item ones
6335
6335
 
6336
6336
  @retval
6337
 
    TRUE   error - types are incompatible
 
6337
    true   error - types are incompatible
6338
6338
  @retval
6339
 
    FALSE  OK
 
6339
    false  OK
6340
6340
*/
6341
6341
 
6342
6342
bool Item_type_holder::join_types(THD *thd, Item *item)
6383
6383
               item->collation.collation->name,
6384
6384
               item->collation.derivation_name(),
6385
6385
               "UNION");
6386
 
      DBUG_RETURN(TRUE);
 
6386
      DBUG_RETURN(true);
6387
6387
    }
6388
6388
    /*
6389
6389
      To figure out max_length, we have to take into account possible
6433
6433
  prev_decimal_int_part= decimal_int_part();
6434
6434
  DBUG_PRINT("info", ("become type: %d  len: %u  dec: %u",
6435
6435
                      (int) fld_type, max_length, (uint) decimals));
6436
 
  DBUG_RETURN(FALSE);
 
6436
  DBUG_RETURN(false);
6437
6437
}
6438
6438
 
6439
6439
/**