~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/function/set_user_var.cc

  • Committer: Olaf van der Spek
  • Date: 2011-10-18 11:48:44 UTC
  • mto: This revision was merged to the branch mainline in revision 2443.
  • Revision ID: olafvdspek@gmail.com-20111018114844-yit26aam30a9h5ip
Use data_ref

Show diffs side-by-side

added added

removed removed

Lines of Context:
99
99
 
100
100
 
101
101
void
102
 
Item_func_set_user_var::update_hash(const void *ptr, uint32_t length,
 
102
Item_func_set_user_var::update_hash(data_ref data,
103
103
                                    Item_result res_type,
104
104
                                    const charset_info_st * const cs, Derivation dv,
105
105
                                    bool unsigned_arg)
110
110
  */
111
111
  if ((null_value= args[0]->null_value) && null_item)
112
112
    res_type= entry->type;                      // Don't change type of item
113
 
  entry->update_hash((null_value= args[0]->null_value), ptr, length, res_type, cs, dv, unsigned_arg);
 
113
  entry->update_hash((null_value= args[0]->null_value), data, res_type, cs, dv, unsigned_arg);
114
114
}
115
115
 
116
116
/**
193
193
  switch (cached_result_type) {
194
194
  case REAL_RESULT:
195
195
    {
196
 
      update_hash((void*) &save_result.vreal,sizeof(save_result.vreal),
197
 
                       REAL_RESULT, &my_charset_bin, DERIVATION_IMPLICIT, 0);
 
196
      update_hash(data_ref(&save_result.vreal, sizeof(save_result.vreal)), REAL_RESULT, &my_charset_bin, DERIVATION_IMPLICIT, 0);
198
197
      break;
199
198
    }
200
199
 
201
200
  case INT_RESULT:
202
201
    {
203
 
      update_hash((void*) &save_result.vint, sizeof(save_result.vint),
204
 
                       INT_RESULT, &my_charset_bin, DERIVATION_IMPLICIT,
205
 
                       unsigned_flag);
 
202
      update_hash(data_ref(&save_result.vint, sizeof(save_result.vint)), INT_RESULT, &my_charset_bin, DERIVATION_IMPLICIT, unsigned_flag);
206
203
      break;
207
204
    }
208
205
 
209
206
  case STRING_RESULT:
210
207
    {
211
208
      if (!save_result.vstr)                                      // Null value
212
 
        update_hash((void*) 0, 0, STRING_RESULT, &my_charset_bin,
213
 
                         DERIVATION_IMPLICIT, 0);
 
209
        update_hash(data_ref(), STRING_RESULT, &my_charset_bin, DERIVATION_IMPLICIT, 0);
214
210
      else
215
 
        update_hash((void*) save_result.vstr->ptr(),
216
 
                         save_result.vstr->length(), STRING_RESULT,
217
 
                         save_result.vstr->charset(),
218
 
                         DERIVATION_IMPLICIT, 0);
 
211
        update_hash(*save_result.vstr, STRING_RESULT, save_result.vstr->charset(), DERIVATION_IMPLICIT, 0);
219
212
      break;
220
213
    }
221
214
 
222
215
  case DECIMAL_RESULT:
223
216
    {
224
217
      if (!save_result.vdec)                                      // Null value
225
 
        update_hash((void*) 0, 0, DECIMAL_RESULT, &my_charset_bin,
226
 
                         DERIVATION_IMPLICIT, 0);
 
218
        update_hash(data_ref(), DECIMAL_RESULT, &my_charset_bin, DERIVATION_IMPLICIT, 0);
227
219
      else
228
 
        update_hash((void*) save_result.vdec,
229
 
                         sizeof(type::Decimal), DECIMAL_RESULT,
230
 
                         &my_charset_bin, DERIVATION_IMPLICIT, 0);
 
220
        update_hash(data_ref(save_result.vdec, sizeof(type::Decimal)), DECIMAL_RESULT, &my_charset_bin, DERIVATION_IMPLICIT, 0);
231
221
      break;
232
222
    }
233
223
 
234
224
  case ROW_RESULT:
235
225
    // This case should never be chosen
236
 
    assert(0);
 
226
    assert(false);
237
227
    break;
238
228
  }
239
229
}