00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <config.h>
00021
00022 #include <cassert>
00023
00024 #include <drizzled/function/num_op.h>
00025
00026 namespace drizzled
00027 {
00028
00034 void Item_num_op::find_num_type(void)
00035 {
00036 assert(arg_count == 2);
00037 Item_result r0= args[0]->result_type();
00038 Item_result r1= args[1]->result_type();
00039
00040 if (r0 == REAL_RESULT || r1 == REAL_RESULT ||
00041 r0 == STRING_RESULT || r1 ==STRING_RESULT)
00042 {
00043 count_real_length();
00044 max_length= float_length(decimals);
00045 hybrid_type= REAL_RESULT;
00046 }
00047 else if (r0 == DECIMAL_RESULT || r1 == DECIMAL_RESULT)
00048 {
00049 hybrid_type= DECIMAL_RESULT;
00050 result_precision();
00051 }
00052 else
00053 {
00054 assert(r0 == INT_RESULT && r1 == INT_RESULT);
00055 decimals= 0;
00056 hybrid_type=INT_RESULT;
00057 result_precision();
00058 }
00059 return;
00060 }
00061
00062 }