~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/user_var_entry.cc

  • Committer: Monty Taylor
  • Date: 2011-03-10 18:09:05 UTC
  • mfrom: (2225.2.2 refactor)
  • mto: This revision was merged to the branch mainline in revision 2228.
  • Revision ID: mordred@inaugust.com-20110310180905-ttx05t7q7ff6nl7c
Merge Olad: Refactoring

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#include "config.h"
 
20
#include <config.h>
 
21
 
21
22
#include <drizzled/session.h>
22
 
#include "drizzled/internal/m_string.h"
 
23
#include <drizzled/internal/m_string.h>
 
24
#include <drizzled/user_var_entry.h>
23
25
 
24
26
namespace drizzled
25
27
{
41
43
  case DECIMAL_RESULT:
42
44
    {
43
45
      double result;
44
 
      my_decimal2double(E_DEC_FATAL_ERROR, (my_decimal *)value, &result);
 
46
      class_decimal2double(E_DEC_FATAL_ERROR, (type::Decimal *)value, &result);
45
47
      return result;
46
48
    }
47
49
 
73
75
  case DECIMAL_RESULT:
74
76
    {
75
77
      int64_t result;
76
 
      my_decimal2int(E_DEC_FATAL_ERROR, (my_decimal *)value, 0, &result);
 
78
      ((type::Decimal *)(value))->val_int32(E_DEC_FATAL_ERROR, 0, &result);
77
79
      return result;
78
80
    }
79
81
 
113
115
    break;
114
116
 
115
117
  case DECIMAL_RESULT:
116
 
    my_decimal2string(E_DEC_FATAL_ERROR, (my_decimal *)value, 0, 0, 0, str);
 
118
    class_decimal2string((type::Decimal *)value, 0, str);
117
119
    break;
118
120
 
119
121
  case STRING_RESULT:
130
132
 
131
133
/** Get the value of a variable as a decimal. */
132
134
 
133
 
my_decimal *user_var_entry::val_decimal(bool *null_value, my_decimal *val)
 
135
type::Decimal *user_var_entry::val_decimal(bool *null_value, type::Decimal *val)
134
136
{
135
137
  if ((*null_value= (value == 0)))
136
138
    return 0;
137
139
 
138
140
  switch (type) {
139
141
  case REAL_RESULT:
140
 
    double2my_decimal(E_DEC_FATAL_ERROR, *(double*) value, val);
 
142
    double2_class_decimal(E_DEC_FATAL_ERROR, *(double*) value, val);
141
143
    break;
142
144
 
143
145
  case INT_RESULT:
144
 
    int2my_decimal(E_DEC_FATAL_ERROR, *(int64_t*) value, 0, val);
 
146
    int2_class_decimal(E_DEC_FATAL_ERROR, *(int64_t*) value, 0, val);
145
147
    break;
146
148
 
147
149
  case DECIMAL_RESULT:
148
 
    val= (my_decimal *)value;
 
150
    val= (type::Decimal *)value;
149
151
    break;
150
152
 
151
153
  case STRING_RESULT:
152
 
    str2my_decimal(E_DEC_FATAL_ERROR, value, length, collation.collation, val);
 
154
    val->store(E_DEC_FATAL_ERROR, value, length, collation.collation);
153
155
    break;
154
156
 
155
157
  case ROW_RESULT:
217
219
 
218
220
    memcpy(value, ptr, arg_length);
219
221
    if (arg_type == DECIMAL_RESULT)
220
 
      ((my_decimal*)value)->fix_buffer_pointer();
 
222
      ((type::Decimal*)value)->fix_buffer_pointer();
221
223
    length= arg_length;
222
224
    collation.set(cs, dv);
223
225
    unsigned_flag= unsigned_arg;