~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/user_var_entry.cc

  • Committer: Brian Aker
  • Date: 2010-12-24 03:44:02 UTC
  • mfrom: (2015.1.3 timestamp)
  • mto: This revision was merged to the branch mainline in revision 2028.
  • Revision ID: brian@tangent.org-20101224034402-n1hpg1yxwjz59hpw
Finish up issues with unsigned/int by fixing cast().

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