~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/user_var_entry.cc

  • Committer: Stewart Smith
  • Date: 2011-01-14 05:09:04 UTC
  • mto: (2086.1.3 build)
  • mto: This revision was merged to the branch mainline in revision 2087.
  • Revision ID: stewart@flamingspork.com-20110114050904-a98kswwpqnpl413s
add a bit of a note on how variables docs should be expanded

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems
 
4
 *  Copyright (C) 2008 Sun Microsystems, Inc.
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
41
41
  case DECIMAL_RESULT:
42
42
    {
43
43
      double result;
44
 
      my_decimal2double(E_DEC_FATAL_ERROR, (my_decimal *)value, &result);
 
44
      class_decimal2double(E_DEC_FATAL_ERROR, (type::Decimal *)value, &result);
45
45
      return result;
46
46
    }
47
47
 
73
73
  case DECIMAL_RESULT:
74
74
    {
75
75
      int64_t result;
76
 
      my_decimal2int(E_DEC_FATAL_ERROR, (my_decimal *)value, 0, &result);
 
76
      ((type::Decimal *)(value))->val_int32(E_DEC_FATAL_ERROR, 0, &result);
77
77
      return result;
78
78
    }
79
79
 
113
113
    break;
114
114
 
115
115
  case DECIMAL_RESULT:
116
 
    my_decimal2string(E_DEC_FATAL_ERROR, (my_decimal *)value, 0, 0, 0, str);
 
116
    class_decimal2string(E_DEC_FATAL_ERROR, (type::Decimal *)value, 0, 0, 0, str);
117
117
    break;
118
118
 
119
119
  case STRING_RESULT:
130
130
 
131
131
/** Get the value of a variable as a decimal. */
132
132
 
133
 
my_decimal *user_var_entry::val_decimal(bool *null_value, my_decimal *val)
 
133
type::Decimal *user_var_entry::val_decimal(bool *null_value, type::Decimal *val)
134
134
{
135
135
  if ((*null_value= (value == 0)))
136
136
    return 0;
137
137
 
138
138
  switch (type) {
139
139
  case REAL_RESULT:
140
 
    double2my_decimal(E_DEC_FATAL_ERROR, *(double*) value, val);
 
140
    double2_class_decimal(E_DEC_FATAL_ERROR, *(double*) value, val);
141
141
    break;
142
142
 
143
143
  case INT_RESULT:
144
 
    int2my_decimal(E_DEC_FATAL_ERROR, *(int64_t*) value, 0, val);
 
144
    int2_class_decimal(E_DEC_FATAL_ERROR, *(int64_t*) value, 0, val);
145
145
    break;
146
146
 
147
147
  case DECIMAL_RESULT:
148
 
    val= (my_decimal *)value;
 
148
    val= (type::Decimal *)value;
149
149
    break;
150
150
 
151
151
  case STRING_RESULT:
152
 
    str2my_decimal(E_DEC_FATAL_ERROR, value, length, collation.collation, val);
 
152
    val->store(E_DEC_FATAL_ERROR, value, length, collation.collation);
153
153
    break;
154
154
 
155
155
  case ROW_RESULT:
217
217
 
218
218
    memcpy(value, ptr, arg_length);
219
219
    if (arg_type == DECIMAL_RESULT)
220
 
      ((my_decimal*)value)->fix_buffer_pointer();
 
220
      ((type::Decimal*)value)->fix_buffer_pointer();
221
221
    length= arg_length;
222
222
    collation.set(cs, dv);
223
223
    unsigned_flag= unsigned_arg;