~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/function/numhybrid.cc

  • Committer: Brian Aker
  • Date: 2010-12-27 19:18:58 UTC
  • mfrom: (2035 staging)
  • mto: (2035.1.1 clean)
  • mto: This revision was merged to the branch mainline in revision 2037.
  • Revision ID: brian@tangent.org-20101227191858-h11rg8ncrkiklg3f
Manage merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
  switch (hybrid_type) {
40
40
  case DECIMAL_RESULT:
41
41
    {
42
 
      my_decimal decimal_value, *val;
 
42
      type::Decimal decimal_value, *val;
43
43
      if (!(val= decimal_op(&decimal_value)))
44
44
        return 0;                                 // null is set
45
 
      my_decimal_round(E_DEC_FATAL_ERROR, val, decimals, false, val);
46
 
      my_decimal2string(E_DEC_FATAL_ERROR, val, 0, 0, 0, str);
 
45
      class_decimal_round(E_DEC_FATAL_ERROR, val, decimals, false, val);
 
46
      class_decimal2string(E_DEC_FATAL_ERROR, val, 0, 0, 0, str);
47
47
      break;
48
48
    }
49
49
  case INT_RESULT:
77
77
  switch (hybrid_type) {
78
78
  case DECIMAL_RESULT:
79
79
    {
80
 
      my_decimal decimal_value, *val;
 
80
      type::Decimal decimal_value, *val;
81
81
      double result;
82
82
      if (!(val= decimal_op(&decimal_value)))
83
83
        return 0.0;                               // null is set
84
 
      my_decimal2double(E_DEC_FATAL_ERROR, val, &result);
 
84
      class_decimal2double(E_DEC_FATAL_ERROR, val, &result);
85
85
      return result;
86
86
    }
87
87
  case INT_RESULT:
113
113
  switch (hybrid_type) {
114
114
  case DECIMAL_RESULT:
115
115
    {
116
 
      my_decimal decimal_value, *val;
 
116
      type::Decimal decimal_value, *val;
117
117
      if (!(val= decimal_op(&decimal_value)))
118
118
        return 0;                                 // null is set
119
119
      int64_t result;
120
 
      my_decimal2int(E_DEC_FATAL_ERROR, val, unsigned_flag, &result);
 
120
      class_decimal2int(E_DEC_FATAL_ERROR, val, unsigned_flag, &result);
121
121
      return result;
122
122
    }
123
123
  case INT_RESULT:
142
142
}
143
143
 
144
144
 
145
 
my_decimal *Item_func_numhybrid::val_decimal(my_decimal *decimal_value)
 
145
type::Decimal *Item_func_numhybrid::val_decimal(type::Decimal *decimal_value)
146
146
{
147
 
  my_decimal *val= decimal_value;
 
147
  type::Decimal *val= decimal_value;
148
148
  assert(fixed == 1);
149
149
 
150
150
  switch (hybrid_type) {
154
154
  case INT_RESULT:
155
155
    {
156
156
      int64_t result= int_op();
157
 
      int2my_decimal(E_DEC_FATAL_ERROR, result, unsigned_flag, decimal_value);
 
157
      int2_class_decimal(E_DEC_FATAL_ERROR, result, unsigned_flag, decimal_value);
158
158
      break;
159
159
    }
160
160
  case REAL_RESULT:
161
161
    {
162
162
      double result= (double)real_op();
163
 
      double2my_decimal(E_DEC_FATAL_ERROR, result, decimal_value);
 
163
      double2_class_decimal(E_DEC_FATAL_ERROR, result, decimal_value);
164
164
      break;
165
165
    }
166
166
  case STRING_RESULT:
169
169
      if (!(res= str_op(&str_value)))
170
170
        return NULL;
171
171
 
172
 
      str2my_decimal(E_DEC_FATAL_ERROR, (char*) res->ptr(),
 
172
      str2_class_decimal(E_DEC_FATAL_ERROR, (char*) res->ptr(),
173
173
                     res->length(), res->charset(), decimal_value);
174
174
      break;
175
175
    }