~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/user_var_entry.cc

  • Committer: Olaf van der Spek
  • Date: 2011-10-18 13:52:19 UTC
  • mto: This revision was merged to the branch mainline in revision 2443.
  • Revision ID: olafvdspek@gmail.com-20111018135219-vn5xhy8pvumotthk
Refactor

Show diffs side-by-side

added added

removed removed

Lines of Context:
184
184
    true    failure
185
185
*/
186
186
 
187
 
void user_var_entry::update_hash(bool set_null, void *ptr, uint32_t arg_length,
188
 
                                 Item_result arg_type, const charset_info_st * const cs, Derivation dv,
189
 
                                 bool unsigned_arg)
 
187
void user_var_entry::update_hash(bool set_null, data_ref data, Item_result arg_type, const charset_info_st* cs, Derivation dv, bool unsigned_arg)
190
188
{
191
189
  if (set_null)
192
190
  {
201
199
  }
202
200
  else
203
201
  {
204
 
    size_t needed_size= arg_length + ((arg_type == STRING_RESULT) ? 1 : 0);
 
202
    size_t needed_size= data.size() + ((arg_type == STRING_RESULT) ? 1 : 0);
205
203
 
206
204
    if (needed_size > size)
207
205
    {
210
208
    }
211
209
 
212
210
    if (arg_type == STRING_RESULT)
213
 
      value[arg_length]= 0;                     // Store end \0
 
211
      value[data.size()]= 0;                    // Store end \0
214
212
 
215
 
    memcpy(value, ptr, arg_length);
 
213
    memcpy(value, data.data(), data.size());
216
214
    if (arg_type == DECIMAL_RESULT)
217
215
      ((type::Decimal*)value)->fix_buffer_pointer();
218
 
    length= arg_length;
 
216
    length= data.size();
219
217
    collation.set(cs, dv);
220
218
    unsigned_flag= unsigned_arg;
221
219
  }