~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/key.cc

  • Committer: Stewart Smith
  • Date: 2011-03-29 01:30:47 UTC
  • mto: (2257.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 2258.
  • Revision ID: stewart@flamingspork.com-20110329013047-5ujzfx6pahmwuko2
have CachedDirectory print out a warning if we can't stat() something in a directory. We should always have access to at least stat() things in directories Drizzle is running in (otherwise there is likely a problem)

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
/* Functions to handle keys and fields in forms */
18
18
 
19
 
#include "config.h"
20
 
#include "drizzled/table.h"
21
 
#include "drizzled/key.h"
22
 
#include "drizzled/field/blob.h"
23
 
#include "drizzled/util/test.h"
 
19
#include <config.h>
 
20
#include <drizzled/table.h>
 
21
#include <drizzled/key.h>
 
22
#include <drizzled/field/blob.h>
 
23
#include <drizzled/util/test.h>
 
24
#include <drizzled/plugin/storage_engine.h>
24
25
 
25
26
#include <boost/dynamic_bitset.hpp>
26
27
 
63
64
int find_ref_key(KeyInfo *key, uint32_t key_count, unsigned char *record, Field *field,
64
65
                 uint32_t *key_length, uint32_t *keypart)
65
66
{
66
 
  register int i;
67
 
  register KeyInfo *key_info;
 
67
  int i;
 
68
  KeyInfo *key_info;
68
69
  uint32_t fieldpos;
69
70
 
70
71
  fieldpos= field->offset(record);
133
134
    {
134
135
      length= min((uint16_t)key_length, key_part->length);
135
136
      Field *field= key_part->field;
136
 
      const CHARSET_INFO * const cs= field->charset();
 
137
      const charset_info_st * const cs= field->charset();
137
138
      uint32_t bytes= field->get_key_image(to_key, length);
138
139
      if (bytes < length)
139
140
        cs->cset->fill(cs, (char*) to_key + bytes, length - bytes, ' ');
295
296
    length= min((uint32_t) (key_end-key), store_length);
296
297
    if (key_part->field->type() == DRIZZLE_TYPE_VARCHAR)
297
298
    {
298
 
      const CHARSET_INFO * const cs= key_part->field->charset();
 
299
      const charset_info_st * const cs= key_part->field->charset();
299
300
      uint32_t char_length= key_part->length / cs->mbmaxlen;
300
301
      const unsigned char *pos= table->getInsertRecord() + key_part->offset;
301
302
      if (length > char_length)
329
330
     idx        Key number
330
331
*/
331
332
 
332
 
void key_unpack(String *to, Table *table, uint32_t idx)
 
333
void key_unpack(String *to, const Table *table, uint32_t idx)
333
334
{
334
335
  KeyPartInfo *key_part,*key_part_end;
335
336
  Field *field;
353
354
    }
354
355
    if ((field= key_part->field))
355
356
    {
356
 
      const CHARSET_INFO * const cs= field->charset();
 
357
      const charset_info_st * const cs= field->charset();
357
358
      field->setReadSet();
358
359
      field->val_str_internal(&tmp);
359
360
      if (cs->mbmaxlen > 1 &&
449
450
    if (key_part->null_bit)
450
451
    {
451
452
      /* This key part allows null values; NULL is lower than everything */
452
 
      register bool field_is_null= key_part->field->is_null();
 
453
      bool field_is_null= key_part->field->is_null();
453
454
      if (*key)                                 // If range key is null
454
455
      {
455
456
        /* the range is expecting a null value */