~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item_func.cc

  • Committer: Monty Taylor
  • Date: 2008-08-10 06:11:44 UTC
  • mto: (312.1.3 translations)
  • mto: This revision was merged to the branch mainline in revision 295.
  • Revision ID: monty@inaugust.com-20080810061144-llnyqeju5zckd6pw
Oy. Replaced max and min macros with std::max and std::min so that we get
strong typing. And, then, cast things in the right direction...

Show diffs side-by-side

added added

removed removed

Lines of Context:
1237
1237
    unsigned_flag= args[0]->unsigned_flag & args[1]->unsigned_flag;
1238
1238
  decimals= min(args[0]->decimals + args[1]->decimals, DECIMAL_MAX_SCALE);
1239
1239
  int precision= min(args[0]->decimal_precision() + args[1]->decimal_precision(),
1240
 
                     DECIMAL_MAX_PRECISION);
 
1240
                     (unsigned int)DECIMAL_MAX_PRECISION);
1241
1241
  max_length= my_decimal_precision_to_length(precision, decimals,unsigned_flag);
1242
1242
}
1243
1243
 
1285
1285
void Item_func_div::result_precision()
1286
1286
{
1287
1287
  uint precision=min(args[0]->decimal_precision() + prec_increment,
1288
 
                     DECIMAL_MAX_PRECISION);
 
1288
                     (unsigned int)DECIMAL_MAX_PRECISION);
1289
1289
  /* Integer operations keep unsigned_flag if one of arguments is unsigned */
1290
1290
  if (result_type() == INT_RESULT)
1291
1291
    unsigned_flag= args[0]->unsigned_flag | args[1]->unsigned_flag;
1292
1292
  else
1293
1293
    unsigned_flag= args[0]->unsigned_flag & args[1]->unsigned_flag;
1294
 
  decimals= min(args[0]->decimals + prec_increment, DECIMAL_MAX_SCALE);
 
1294
  decimals= min(args[0]->decimals + prec_increment, (unsigned int)DECIMAL_MAX_SCALE);
1295
1295
  max_length= my_decimal_precision_to_length(precision, decimals,
1296
1296
                                             unsigned_flag);
1297
1297
}
2067
2067
  my_decimal val, *value= args[0]->val_decimal(&val);
2068
2068
  int64_t dec= args[1]->val_int();
2069
2069
  if (dec >= 0 || args[1]->unsigned_flag)
2070
 
    dec= min((uint64_t) dec, decimals);
 
2070
    dec= min(dec, (int64_t) decimals);
2071
2071
  else if (dec < INT_MIN)
2072
2072
    dec= INT_MIN;
2073
2073
    
2908
2908
               u_d->name.str, init_msg_buff);
2909
2909
      return(true);
2910
2910
    }
2911
 
    func->max_length=min(initid.max_length,MAX_BLOB_WIDTH);
 
2911
    func->max_length=min(initid.max_length,(unsigned long)MAX_BLOB_WIDTH);
2912
2912
    func->maybe_null=initid.maybe_null;
2913
2913
    const_item_cache=initid.const_item;
2914
2914
    /* 
2917
2917
    */  
2918
2918
    if (!const_item_cache && !used_tables_cache)
2919
2919
      used_tables_cache= RAND_TABLE_BIT;
2920
 
    func->decimals=min(initid.decimals,NOT_FIXED_DEC);
 
2920
    func->decimals=min(initid.decimals,(unsigned int)NOT_FIXED_DEC);
2921
2921
  }
2922
2922
  initialized=1;
2923
2923
  if (error)