~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item.cc

  • Committer: Brian Aker
  • Date: 2008-08-10 17:18:41 UTC
  • mfrom: (287.3.13 codestyle)
  • Revision ID: brian@tangent.org-20080810171841-pkvi2ky94wbd0nt5
Merge from Monty

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
{
69
69
  item->decimals= arg->decimals;
70
70
  item->max_length= min(arg->max_length + DECIMAL_LONGLONG_DIGITS,
71
 
                        DECIMAL_MAX_STR_LENGTH);
 
71
                        (unsigned int)DECIMAL_MAX_STR_LENGTH);
72
72
}
73
73
 
74
74
 
435
435
 
436
436
  if ((restype == DECIMAL_RESULT) || (restype == INT_RESULT))
437
437
    return min(my_decimal_length_to_precision(max_length, decimals, unsigned_flag),
438
 
               DECIMAL_MAX_PRECISION);
439
 
  return min(max_length, DECIMAL_MAX_PRECISION);
 
438
               (unsigned int)DECIMAL_MAX_PRECISION);
 
439
  return min(max_length, (uint32_t)DECIMAL_MAX_PRECISION);
440
440
}
441
441
 
442
442
 
722
722
                                   &res_length);
723
723
  }
724
724
  else
725
 
    name= sql_strmake(str, (name_length= min(length,MAX_ALIAS_NAME)));
 
725
    name= sql_strmake(str, (name_length= min(length,(unsigned int)MAX_ALIAS_NAME)));
726
726
}
727
727
 
728
728
 
2207
2207
    internal decimal value.
2208
2208
*/
2209
2209
 
2210
 
void Item_param::set_decimal(const char *str, ulong length)
 
2210
void Item_param::set_decimal(char *str, ulong length)
2211
2211
{
2212
2212
  char *end;
2213
2213
 
2214
 
  end= (char*) str+length;
2215
 
  str2my_decimal(E_DEC_FATAL_ERROR, str, &decimal_value, &end);
 
2214
  end= str+length;
 
2215
  str2my_decimal((uint)E_DEC_FATAL_ERROR, str, &decimal_value, &end);
2216
2216
  state= DECIMAL_VALUE;
2217
2217
  decimals= decimal_value.frac;
2218
2218
  max_length= my_decimal_precision_to_length(decimal_value.precision(),
4512
4512
  // following assert is redundant, because fixed=1 assigned in constructor
4513
4513
  assert(fixed == 1);
4514
4514
  char *end=(char*) str_value.ptr()+str_value.length(),
4515
 
       *ptr=end-min(str_value.length(),sizeof(int64_t));
 
4515
       *ptr=end-min(str_value.length(),(uint32_t)sizeof(int64_t));
4516
4516
 
4517
4517
  uint64_t value=0;
4518
4518
  for (; ptr != end ; ptr++)
4566
4566
                            enum_query_type query_type __attribute__((unused)))
4567
4567
{
4568
4568
  char *end= (char*) str_value.ptr() + str_value.length(),
4569
 
       *ptr= end - min(str_value.length(), sizeof(int64_t));
 
4569
       *ptr= end - min(str_value.length(), (uint32_t)sizeof(int64_t));
4570
4570
  str->append("0x");
4571
4571
  for (; ptr != end ; ptr++)
4572
4572
  {
6268
6268
    /* fix variable decimals which always is NOT_FIXED_DEC */
6269
6269
    if (Field::result_merge_type(fld_type) == INT_RESULT)
6270
6270
      item_decimals= 0;
6271
 
    decimals= max(decimals, item_decimals);
 
6271
    decimals= max((int)decimals, item_decimals);
6272
6272
  }
6273
6273
  if (Field::result_merge_type(fld_type) == DECIMAL_RESULT)
6274
6274
  {
6275
 
    decimals= min(max(decimals, item->decimals), DECIMAL_MAX_SCALE);
 
6275
    decimals= min((int)max(decimals, item->decimals), DECIMAL_MAX_SCALE);
6276
6276
    int precision= min(max(prev_decimal_int_part, item->decimal_int_part())
6277
6277
                       + decimals, DECIMAL_MAX_PRECISION);
6278
6278
    unsigned_flag&= item->unsigned_flag;