~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-07 09:12:12 UTC
  • mto: This revision was merged to the branch mainline in revision 1985.
  • Revision ID: brian@tangent.org-20101207091212-1m0w20tck6z7632m
This is a fix for bug lp:686197

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
  switch (type) {
35
35
  case REAL_RESULT:
36
36
    return *(double*) value;
37
 
 
38
37
  case INT_RESULT:
39
38
    return (double) *(int64_t*) value;
40
 
 
41
39
  case DECIMAL_RESULT:
42
 
    {
43
 
      double result;
44
 
      my_decimal2double(E_DEC_FATAL_ERROR, (my_decimal *)value, &result);
45
 
      return result;
46
 
    }
47
 
 
 
40
  {
 
41
    double result;
 
42
    my_decimal2double(E_DEC_FATAL_ERROR, (my_decimal *)value, &result);
 
43
    return result;
 
44
  }
48
45
  case STRING_RESULT:
49
46
    return internal::my_atof(value);                      // This is null terminated
50
 
 
51
47
  case ROW_RESULT:
52
48
    assert(1);                          // Impossible
53
49
    break;
66
62
  switch (type) {
67
63
  case REAL_RESULT:
68
64
    return (int64_t) *(double*) value;
69
 
 
70
65
  case INT_RESULT:
71
66
    return *(int64_t*) value;
72
 
 
73
67
  case DECIMAL_RESULT:
74
 
    {
75
 
      int64_t result;
76
 
      my_decimal2int(E_DEC_FATAL_ERROR, (my_decimal *)value, 0, &result);
77
 
      return result;
78
 
    }
79
 
 
 
68
  {
 
69
    int64_t result;
 
70
    my_decimal2int(E_DEC_FATAL_ERROR, (my_decimal *)value, 0, &result);
 
71
    return result;
 
72
  }
80
73
  case STRING_RESULT:
81
 
    {
82
 
      int error;
83
 
      return internal::my_strtoll10(value, (char**) 0, &error);// String is null terminated
84
 
    }
85
 
 
 
74
  {
 
75
    int error;
 
76
    return internal::my_strtoll10(value, (char**) 0, &error);// String is null terminated
 
77
  }
86
78
  case ROW_RESULT:
87
79
    assert(1);                          // Impossible
88
80
    break;
89
81
  }
90
 
 
91
82
  return 0L;                                    // Impossible
92
83
}
93
84
 
104
95
  case REAL_RESULT:
105
96
    str->set_real(*(double*) value, decimals, &my_charset_bin);
106
97
    break;
107
 
 
108
98
  case INT_RESULT:
109
99
    if (!unsigned_flag)
110
100
      str->set(*(int64_t*) value, &my_charset_bin);
111
101
    else
112
102
      str->set(*(uint64_t*) value, &my_charset_bin);
113
103
    break;
114
 
 
115
104
  case DECIMAL_RESULT:
116
105
    my_decimal2string(E_DEC_FATAL_ERROR, (my_decimal *)value, 0, 0, 0, str);
117
106
    break;
118
 
 
119
107
  case STRING_RESULT:
120
108
    if (str->copy(value, length, collation.collation))
121
109
      str= 0;                                   // EOM error
122
 
 
123
110
  case ROW_RESULT:
124
111
    assert(1);                          // Impossible
125
112
    break;
126
113
  }
127
 
 
128
114
  return(str);
129
115
}
130
116
 
139
125
  case REAL_RESULT:
140
126
    double2my_decimal(E_DEC_FATAL_ERROR, *(double*) value, val);
141
127
    break;
142
 
 
143
128
  case INT_RESULT:
144
129
    int2my_decimal(E_DEC_FATAL_ERROR, *(int64_t*) value, 0, val);
145
130
    break;
146
 
 
147
131
  case DECIMAL_RESULT:
148
132
    val= (my_decimal *)value;
149
133
    break;
150
 
 
151
134
  case STRING_RESULT:
152
135
    str2my_decimal(E_DEC_FATAL_ERROR, value, length, collation.collation, val);
153
136
    break;
154
 
 
155
137
  case ROW_RESULT:
156
138
    assert(1);                          // Impossible
157
139
    break;
158
140
  }
159
 
 
160
141
  return(val);
161
142
}
162
143