~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 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:
184
184
    true    failure
185
185
*/
186
186
 
187
 
void user_var_entry::update_hash(bool set_null, const void *ptr, uint32_t arg_length, Item_result arg_type, const charset_info_st* cs, Derivation dv, 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)
188
188
{
189
189
  if (set_null)
190
190
  {
199
199
  }
200
200
  else
201
201
  {
202
 
    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);
203
203
 
204
204
    if (needed_size > size)
205
205
    {
208
208
    }
209
209
 
210
210
    if (arg_type == STRING_RESULT)
211
 
      value[arg_length]= 0;                     // Store end \0
 
211
      value[data.size()]= 0;                    // Store end \0
212
212
 
213
 
    memcpy(value, ptr, arg_length);
 
213
    memcpy(value, data.data(), data.size());
214
214
    if (arg_type == DECIMAL_RESULT)
215
215
      ((type::Decimal*)value)->fix_buffer_pointer();
216
 
    length= arg_length;
 
216
    length= data.size();
217
217
    collation.set(cs, dv);
218
218
    unsigned_flag= unsigned_arg;
219
219
  }