~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/function/set_user_var.cc

  • Committer: Brian Aker
  • Date: 2010-12-18 02:06:13 UTC
  • Revision ID: brian@tangent.org-20101218020613-8lxhcvsy812bu960
Formatting + remove default from switch/case.

Show diffs side-by-side

added added

removed removed

Lines of Context:
140
140
 
141
141
  switch (cached_result_type) {
142
142
  case REAL_RESULT:
143
 
  {
144
 
    save_result.vreal= use_result_field ? result_field->val_real() :
145
 
                        args[0]->val_real();
146
 
    break;
147
 
  }
 
143
    {
 
144
      save_result.vreal= use_result_field ? result_field->val_real() :
 
145
        args[0]->val_real();
 
146
      break;
 
147
    }
148
148
  case INT_RESULT:
149
 
  {
150
 
    save_result.vint= use_result_field ? result_field->val_int() :
151
 
                       args[0]->val_int();
152
 
    unsigned_flag= use_result_field ? ((Field_num*)result_field)->unsigned_flag:
153
 
                    args[0]->unsigned_flag;
154
 
    break;
155
 
  }
 
149
    {
 
150
      save_result.vint= use_result_field ? result_field->val_int() :
 
151
        args[0]->val_int();
 
152
      unsigned_flag= use_result_field ? ((Field_num*)result_field)->unsigned_flag:
 
153
        args[0]->unsigned_flag;
 
154
      break;
 
155
    }
156
156
  case STRING_RESULT:
157
 
  {
158
 
    save_result.vstr= use_result_field ? result_field->val_str_internal(&value) :
159
 
      args[0]->val_str(&value);
160
 
    break;
161
 
  }
 
157
    {
 
158
      save_result.vstr= use_result_field ? result_field->val_str_internal(&value) :
 
159
        args[0]->val_str(&value);
 
160
      break;
 
161
    }
162
162
  case DECIMAL_RESULT:
163
 
  {
164
 
    save_result.vdec= use_result_field ?
165
 
                       result_field->val_decimal(&decimal_buff) :
166
 
                       args[0]->val_decimal(&decimal_buff);
167
 
    break;
168
 
  }
 
163
    {
 
164
      save_result.vdec= use_result_field ?
 
165
        result_field->val_decimal(&decimal_buff) :
 
166
        args[0]->val_decimal(&decimal_buff);
 
167
      break;
 
168
    }
169
169
  case ROW_RESULT:
170
 
  default:
171
170
    // This case should never be chosen
172
171
    assert(0);
173
172
    break;
174
173
  }
175
 
  return(false);
 
174
 
 
175
  return false;
176
176
}
177
177
 
178
178
/**
197
197
 
198
198
  switch (cached_result_type) {
199
199
  case REAL_RESULT:
200
 
  {
201
 
    res= update_hash((void*) &save_result.vreal,sizeof(save_result.vreal),
202
 
                     REAL_RESULT, &my_charset_bin, DERIVATION_IMPLICIT, 0);
203
 
    break;
204
 
  }
 
200
    {
 
201
      res= update_hash((void*) &save_result.vreal,sizeof(save_result.vreal),
 
202
                       REAL_RESULT, &my_charset_bin, DERIVATION_IMPLICIT, 0);
 
203
      break;
 
204
    }
 
205
 
205
206
  case INT_RESULT:
206
 
  {
207
 
    res= update_hash((void*) &save_result.vint, sizeof(save_result.vint),
208
 
                     INT_RESULT, &my_charset_bin, DERIVATION_IMPLICIT,
209
 
                     unsigned_flag);
210
 
    break;
211
 
  }
 
207
    {
 
208
      res= update_hash((void*) &save_result.vint, sizeof(save_result.vint),
 
209
                       INT_RESULT, &my_charset_bin, DERIVATION_IMPLICIT,
 
210
                       unsigned_flag);
 
211
      break;
 
212
    }
 
213
 
212
214
  case STRING_RESULT:
213
 
  {
214
 
    if (!save_result.vstr)                                      // Null value
215
 
      res= update_hash((void*) 0, 0, STRING_RESULT, &my_charset_bin,
216
 
                       DERIVATION_IMPLICIT, 0);
217
 
    else
218
 
      res= update_hash((void*) save_result.vstr->ptr(),
219
 
                       save_result.vstr->length(), STRING_RESULT,
220
 
                       save_result.vstr->charset(),
221
 
                       DERIVATION_IMPLICIT, 0);
222
 
    break;
223
 
  }
 
215
    {
 
216
      if (!save_result.vstr)                                      // Null value
 
217
        res= update_hash((void*) 0, 0, STRING_RESULT, &my_charset_bin,
 
218
                         DERIVATION_IMPLICIT, 0);
 
219
      else
 
220
        res= update_hash((void*) save_result.vstr->ptr(),
 
221
                         save_result.vstr->length(), STRING_RESULT,
 
222
                         save_result.vstr->charset(),
 
223
                         DERIVATION_IMPLICIT, 0);
 
224
      break;
 
225
    }
 
226
 
224
227
  case DECIMAL_RESULT:
225
 
  {
226
 
    if (!save_result.vdec)                                      // Null value
227
 
      res= update_hash((void*) 0, 0, DECIMAL_RESULT, &my_charset_bin,
228
 
                       DERIVATION_IMPLICIT, 0);
229
 
    else
230
 
      res= update_hash((void*) save_result.vdec,
231
 
                       sizeof(my_decimal), DECIMAL_RESULT,
232
 
                       &my_charset_bin, DERIVATION_IMPLICIT, 0);
233
 
    break;
234
 
  }
 
228
    {
 
229
      if (!save_result.vdec)                                      // Null value
 
230
        res= update_hash((void*) 0, 0, DECIMAL_RESULT, &my_charset_bin,
 
231
                         DERIVATION_IMPLICIT, 0);
 
232
      else
 
233
        res= update_hash((void*) save_result.vdec,
 
234
                         sizeof(my_decimal), DECIMAL_RESULT,
 
235
                         &my_charset_bin, DERIVATION_IMPLICIT, 0);
 
236
      break;
 
237
    }
 
238
 
235
239
  case ROW_RESULT:
236
 
  default:
237
240
    // This case should never be chosen
238
241
    assert(0);
239
242
    break;
240
243
  }
 
244
 
241
245
  return(res);
242
246
}
243
247