~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/blob.cc

  • Committer: Monty Taylor
  • Date: 2008-12-06 07:22:02 UTC
  • mto: (656.1.7 devel) (660.1.5 codestyle)
  • mto: This revision was merged to the branch mainline in revision 665.
  • Revision ID: monty@inaugust.com-20081206072202-2g25o9doqr1l8euu
OOOh doggie. Got rid of my_alloca.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include <drizzled/table.h>
25
25
#include <drizzled/session.h>
26
26
 
 
27
#include <string>
 
28
 
 
29
using namespace std;
27
30
 
28
31
uint32_t
29
32
blob_pack_length_to_max_length(uint32_t arg)
374
377
/* The following is used only when comparing a key */
375
378
 
376
379
uint32_t Field_blob::get_key_image(unsigned char *buff,
377
 
                               uint32_t length,
378
 
                               imagetype type_arg __attribute__((unused)))
 
380
                                   uint32_t length,
 
381
                                   imagetype)
379
382
{
380
383
  uint32_t blob_length= get_length(ptr);
381
384
  unsigned char *blob;
401
404
}
402
405
 
403
406
 
 
407
uint32_t Field_blob::get_key_image(basic_string<unsigned char> &buff,
 
408
                                   uint32_t length,
 
409
                                   imagetype)
 
410
{
 
411
  uint32_t blob_length= get_length(ptr);
 
412
  unsigned char *blob;
 
413
 
 
414
  get_ptr(&blob);
 
415
  uint32_t local_char_length= length / field_charset->mbmaxlen;
 
416
  local_char_length= my_charpos(field_charset, blob, blob + blob_length,
 
417
                                local_char_length);
 
418
  set_if_smaller(blob_length, local_char_length);
 
419
 
 
420
  unsigned char len_buff[HA_KEY_BLOB_LENGTH];
 
421
  int2store(len_buff,length);
 
422
  buff.append(len_buff);
 
423
  buff.append(blob, blob_length);
 
424
 
 
425
  if (length > blob_length)
 
426
  {
 
427
    /*
 
428
      Must clear this as we do a memcmp in opt_range.cc to detect
 
429
      identical keys
 
430
    */
 
431
 
 
432
    buff.append(length-blob_length, '0');
 
433
  }
 
434
  return HA_KEY_BLOB_LENGTH+length;
 
435
}
 
436
 
 
437
 
404
438
void Field_blob::set_key_image(const unsigned char *buff,uint32_t length)
405
439
{
406
440
  length= uint2korr(buff);