~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/key.h

  • Committer: Olaf van der Spek
  • Date: 2011-03-23 10:31:37 UTC
  • mto: (2247.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 2248.
  • Revision ID: olafvdspek@gmail.com-20110323103137-lwevis2tfchgu18u
Propogate return void

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 */
19
19
 
20
20
 
21
 
#ifndef DRIZZLED_KEY_H
22
 
#define DRIZZLED_KEY_H
 
21
#pragma once
23
22
 
24
23
#include <string>
25
24
#include <boost/dynamic_bitset.hpp>
26
25
 
27
 
#include "drizzled/memory/sql_alloc.h"
28
 
#include "drizzled/key_part_spec.h"
29
 
#include "drizzled/sql_list.h"
30
 
#include "drizzled/lex_string.h"
31
 
#include "drizzled/sql_string.h"
32
 
#include "drizzled/handler_structs.h"
 
26
#include <drizzled/memory/sql_alloc.h>
 
27
#include <drizzled/key_part_spec.h>
 
28
#include <drizzled/sql_list.h>
 
29
#include <drizzled/lex_string.h>
 
30
#include <drizzled/sql_string.h>
 
31
#include <drizzled/handler_structs.h>
33
32
 
34
33
namespace drizzled
35
34
{
41
40
class Key :public memory::SqlAlloc {
42
41
public:
43
42
  enum Keytype { PRIMARY, UNIQUE, MULTIPLE, FOREIGN_KEY};
44
 
  enum Keytype type;
 
43
  Keytype type;
45
44
  KEY_CREATE_INFO key_create_info;
46
45
  List<Key_part_spec> columns;
47
46
  LEX_STRING name;
48
47
  bool generated;
49
48
 
50
 
  Key(enum Keytype type_par, const LEX_STRING &name_arg,
 
49
  Key(Keytype type_par,
 
50
      const lex_string_t &name_arg,
51
51
      KEY_CREATE_INFO *key_info_arg,
52
 
      bool generated_arg, List<Key_part_spec> &cols)
53
 
    :type(type_par), key_create_info(*key_info_arg), columns(cols),
54
 
    name(name_arg), generated(generated_arg)
 
52
      bool generated_arg, List<Key_part_spec> &cols) :
 
53
    type(type_par),
 
54
    key_create_info(*key_info_arg),
 
55
    columns(cols),
 
56
    name(name_arg),
 
57
    generated(generated_arg)
55
58
  {}
56
 
  Key(enum Keytype type_par, const char *name_arg, size_t name_len_arg,
57
 
      KEY_CREATE_INFO *key_info_arg, bool generated_arg,
58
 
      List<Key_part_spec> &cols)
59
 
    :type(type_par), key_create_info(*key_info_arg), columns(cols),
 
59
 
 
60
  Key(Keytype type_par,
 
61
      const char *name_arg,
 
62
      size_t name_len_arg,
 
63
      KEY_CREATE_INFO *key_info_arg,
 
64
      bool generated_arg,
 
65
      List<Key_part_spec> &cols) :
 
66
    type(type_par),
 
67
    key_create_info(*key_info_arg),
 
68
    columns(cols),
60
69
    generated(generated_arg)
61
70
  {
62
71
    name.str= const_cast<char *>(name_arg);
86
95
  @param key_length  specifies length of all keyparts that will be copied
87
96
*/
88
97
 
89
 
void key_copy(unsigned char *to_key, unsigned char *from_record, KeyInfo *key_info, uint32_t key_length);
 
98
DRIZZLED_API void key_copy(unsigned char *to_key, unsigned char *from_record, KeyInfo *key_info, uint32_t key_length);
90
99
void key_copy(std::basic_string<unsigned char> &to_key,
91
100
              unsigned char *from_record, KeyInfo *key_info, uint32_t key_length);
92
101
void key_restore(unsigned char *to_record, unsigned char *from_key, KeyInfo *key_info,
93
102
                 uint16_t key_length);
94
103
void key_zero_nulls(unsigned char *tuple, KeyInfo *key_info);
95
104
bool key_cmp_if_same(Table *form,const unsigned char *key,uint32_t index,uint32_t key_length);
96
 
void key_unpack(String *to,Table *form,uint32_t index);
 
105
void key_unpack(String *to, const Table *form,uint32_t index);
97
106
bool is_key_used(Table *table, uint32_t idx, const boost::dynamic_bitset<>& fields);
98
107
int key_cmp(KeyPartInfo *key_part, const unsigned char *key, uint32_t key_length);
99
108
 
100
109
} /* namespace drizzled */
101
110
 
102
 
#endif /* DRIZZLED_KEY_H */