~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to drizzled/key.h

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2012-06-19 10:46:49 UTC
  • mfrom: (1.2.11) (2.1.16 sid)
  • Revision ID: package-import@ubuntu.com-20120619104649-9ij634mxm4x8pp4l
Tags: 1:7.1.36-stable-1ubuntu1
* Merge from Debian unstable. (LP: #987575)
  Remaining changes:
  - Added upstart script.
* debian/drizzle.upstart: dropped logger since upstart logs job
  output now.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
#include <drizzled/sql_string.h>
31
31
#include <drizzled/handler_structs.h>
32
32
 
33
 
namespace drizzled
 
33
namespace drizzled {
 
34
 
 
35
class Key : public memory::SqlAlloc 
34
36
{
35
 
 
36
 
namespace memory { class Root; }
37
 
 
38
 
class Item;
39
 
 
40
 
class Key :public memory::SqlAlloc {
41
37
public:
42
 
  enum Keytype { PRIMARY, UNIQUE, MULTIPLE, FOREIGN_KEY};
 
38
  enum Keytype { PRIMARY, UNIQUE, MULTIPLE, FOREIGN_KEY };
43
39
  Keytype type;
44
40
  KEY_CREATE_INFO key_create_info;
45
41
  List<Key_part_spec> columns;
46
 
  LEX_STRING name;
 
42
  str_ref name;
47
43
  bool generated;
48
44
 
49
 
  Key(Keytype type_par,
50
 
      const lex_string_t &name_arg,
51
 
      KEY_CREATE_INFO *key_info_arg,
52
 
      bool generated_arg, List<Key_part_spec> &cols) :
 
45
  Key(Keytype type_par, str_ref name_arg, KEY_CREATE_INFO *key_info_arg, bool generated_arg, List<Key_part_spec> &cols) :
53
46
    type(type_par),
54
47
    key_create_info(*key_info_arg),
55
48
    columns(cols),
57
50
    generated(generated_arg)
58
51
  {}
59
52
 
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),
69
 
    generated(generated_arg)
70
 
  {
71
 
    name.str= const_cast<char *>(name_arg);
72
 
    name.length= name_len_arg;
73
 
  }
74
 
 
75
53
  virtual ~Key() {}
76
54
  /* Equality comparison of keys (ignoring name) */
77
55
  friend bool foreign_key_prefix(Key *a, Key *b);
78
56
};
79
57
 
80
58
 
81
 
int find_ref_key(KeyInfo *key, uint32_t key_count, unsigned char *record, Field *field,
82
 
                 uint32_t *key_length, uint32_t *keypart);
 
59
int find_ref_key(KeyInfo *key, uint32_t key_count, unsigned char *record, Field *field, uint32_t *key_length, uint32_t *keypart);
83
60
/**
84
61
  Copy part of a record that forms a key or key prefix to a buffer.
85
62
 
96
73
*/
97
74
 
98
75
DRIZZLED_API void key_copy(unsigned char *to_key, unsigned char *from_record, KeyInfo *key_info, uint32_t key_length);
99
 
void key_copy(std::basic_string<unsigned char> &to_key,
100
 
              unsigned char *from_record, KeyInfo *key_info, uint32_t key_length);
101
 
void key_restore(unsigned char *to_record, unsigned char *from_key, KeyInfo *key_info,
102
 
                 uint16_t key_length);
 
76
void key_copy(std::basic_string<unsigned char> &to_key, unsigned char *from_record, KeyInfo *key_info, uint32_t key_length);
 
77
void key_restore(unsigned char *to_record, unsigned char *from_key, KeyInfo *key_info, uint16_t key_length);
103
78
void key_zero_nulls(unsigned char *tuple, KeyInfo *key_info);
104
79
bool key_cmp_if_same(Table *form,const unsigned char *key,uint32_t index,uint32_t key_length);
105
80
void key_unpack(String *to, const Table *form,uint32_t index);
107
82
int key_cmp(KeyPartInfo *key_part, const unsigned char *key, uint32_t key_length);
108
83
 
109
84
} /* namespace drizzled */
110