~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item_func.cc

code clean move Item_func_additive_op to functions directory

Show diffs side-by-side

added added

removed removed

Lines of Context:
196
196
}
197
197
 
198
198
/**
199
 
  Set precision of results for additive operations (+ and -)
200
 
*/
201
 
void Item_func_additive_op::result_precision()
202
 
{
203
 
  decimals= cmax(args[0]->decimals, args[1]->decimals);
204
 
  int max_int_part= cmax(args[0]->decimal_precision() - args[0]->decimals,
205
 
                        args[1]->decimal_precision() - args[1]->decimals);
206
 
  int precision= cmin(max_int_part + 1 + decimals, DECIMAL_MAX_PRECISION);
207
 
 
208
 
  /* Integer operations keep unsigned_flag if one of arguments is unsigned */
209
 
  if (result_type() == INT_RESULT)
210
 
    unsigned_flag= args[0]->unsigned_flag | args[1]->unsigned_flag;
211
 
  else
212
 
    unsigned_flag= args[0]->unsigned_flag & args[1]->unsigned_flag;
213
 
  max_length= my_decimal_precision_to_length(precision, decimals,
214
 
                                             unsigned_flag);
215
 
}
216
 
 
217
 
 
218
 
/**
219
199
  The following function is here to allow the user to force
220
200
  subtraction of UNSIGNED BIGINT to return negative values.
221
201
*/