~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/key.h

  • Committer: Olaf van der Spek
  • Date: 2011-10-17 23:59:40 UTC
  • mto: This revision was merged to the branch mainline in revision 2443.
  • Revision ID: olafvdspek@gmail.com-20111017235940-tzf58zfcyx4vuoal
Refactor

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
 
33
33
namespace drizzled {
34
34
 
35
 
class Key :public memory::SqlAlloc {
 
35
class Key : public memory::SqlAlloc 
 
36
{
36
37
public:
37
 
  enum Keytype { PRIMARY, UNIQUE, MULTIPLE, FOREIGN_KEY};
 
38
  enum Keytype { PRIMARY, UNIQUE, MULTIPLE, FOREIGN_KEY };
38
39
  Keytype type;
39
40
  KEY_CREATE_INFO key_create_info;
40
41
  List<Key_part_spec> columns;
41
42
  lex_string_t name;
42
43
  bool generated;
43
44
 
44
 
  Key(Keytype type_par,
45
 
      const lex_string_t &name_arg,
46
 
      KEY_CREATE_INFO *key_info_arg,
47
 
      bool generated_arg, List<Key_part_spec> &cols) :
 
45
  Key(Keytype type_par, lex_string_t name_arg, KEY_CREATE_INFO *key_info_arg, bool generated_arg, List<Key_part_spec> &cols) :
48
46
    type(type_par),
49
47
    key_create_info(*key_info_arg),
50
48
    columns(cols),
52
50
    generated(generated_arg)
53
51
  {}
54
52
 
55
 
  Key(Keytype type_par,
56
 
      const char *name_arg,
57
 
      size_t name_len_arg,
58
 
      KEY_CREATE_INFO *key_info_arg,
59
 
      bool generated_arg,
60
 
      List<Key_part_spec> &cols) :
 
53
  Key(Keytype type_par, const char *name_arg, size_t name_len_arg, KEY_CREATE_INFO *key_info_arg, bool generated_arg, List<Key_part_spec> &cols) :
61
54
    type(type_par),
62
55
    key_create_info(*key_info_arg),
63
56
    columns(cols),
72
65
};
73
66
 
74
67
 
75
 
int find_ref_key(KeyInfo *key, uint32_t key_count, unsigned char *record, Field *field,
76
 
                 uint32_t *key_length, uint32_t *keypart);
 
68
int find_ref_key(KeyInfo *key, uint32_t key_count, unsigned char *record, Field *field, uint32_t *key_length, uint32_t *keypart);
77
69
/**
78
70
  Copy part of a record that forms a key or key prefix to a buffer.
79
71
 
90
82
*/
91
83
 
92
84
DRIZZLED_API void key_copy(unsigned char *to_key, unsigned char *from_record, KeyInfo *key_info, uint32_t key_length);
93
 
void key_copy(std::basic_string<unsigned char> &to_key,
94
 
              unsigned char *from_record, KeyInfo *key_info, uint32_t key_length);
95
 
void key_restore(unsigned char *to_record, unsigned char *from_key, KeyInfo *key_info,
96
 
                 uint16_t key_length);
 
85
void key_copy(std::basic_string<unsigned char> &to_key, unsigned char *from_record, KeyInfo *key_info, uint32_t key_length);
 
86
void key_restore(unsigned char *to_record, unsigned char *from_key, KeyInfo *key_info, uint16_t key_length);
97
87
void key_zero_nulls(unsigned char *tuple, KeyInfo *key_info);
98
88
bool key_cmp_if_same(Table *form,const unsigned char *key,uint32_t index,uint32_t key_length);
99
89
void key_unpack(String *to, const Table *form,uint32_t index);
101
91
int key_cmp(KeyPartInfo *key_part, const unsigned char *key, uint32_t key_length);
102
92
 
103
93
} /* namespace drizzled */
104