~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/key.h

  • Committer: Padraig O'Sullivan
  • Date: 2009-09-17 00:08:20 UTC
  • mto: (1126.9.3 captain-20090915-01)
  • mto: This revision was merged to the branch mainline in revision 1133.
  • Revision ID: osullivan.padraig@gmail.com-20090917000820-urd6p46qngi1okjp
Updated calls to some dtrace probes to cast the parameter to const char *
appropriately. Also, removed the additional variable in places that I was
using.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#ifndef DRIZZLED_KEY_H
22
22
#define DRIZZLED_KEY_H
23
23
 
24
 
#include <string>
25
 
 
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"
32
 
 
33
 
namespace drizzled
34
 
{
35
 
 
36
 
namespace memory { class Root; }
 
24
 
 
25
#include <drizzled/sql_alloc.h>
 
26
#include <drizzled/key_part_spec.h>
 
27
#include <drizzled/sql_list.h>
 
28
#include <drizzled/lex_string.h>
 
29
#include <drizzled/handler_structs.h>
37
30
 
38
31
class Item;
39
 
class MyBitmap;
 
32
typedef struct st_mem_root MEM_ROOT;
40
33
 
41
 
class Key :public memory::SqlAlloc {
 
34
class Key :public Sql_alloc {
42
35
public:
43
36
  enum Keytype { PRIMARY, UNIQUE, MULTIPLE, FOREIGN_KEY};
44
37
  enum Keytype type;
59
52
    :type(type_par), key_create_info(*key_info_arg), columns(cols),
60
53
    generated(generated_arg)
61
54
  {
62
 
    name.str= const_cast<char *>(name_arg);
 
55
    name.str= (char *)name_arg;
63
56
    name.length= name_len_arg;
64
57
  }
65
58
 
 
59
  /**
 
60
   * Construct an (almost) deep copy of this key. Only those
 
61
   * elements that are known to never change are not copied.
 
62
   * If out of memory, a partial copy is returned and an error is set
 
63
   * in Session.
 
64
   */
 
65
  Key(const Key &rhs, MEM_ROOT *mem_root);
66
66
  virtual ~Key() {}
67
67
  /* Equality comparison of keys (ignoring name) */
68
68
  friend bool foreign_key_prefix(Key *a, Key *b);
 
69
  /**
 
70
    Used to make a clone of this object for ALTER/CREATE TABLE
 
71
    @sa comment for Key_part_spec::clone
 
72
  */
 
73
  virtual Key *clone(MEM_ROOT *mem_root) const
 
74
    { return new (mem_root) Key(*this, mem_root); }
69
75
};
70
76
 
71
77
 
97
103
bool is_key_used(Table *table, uint32_t idx, const MyBitmap *fields);
98
104
int key_cmp(KEY_PART_INFO *key_part, const unsigned char *key, uint32_t key_length);
99
105
extern "C" int key_rec_cmp(void *key_info, unsigned char *a, unsigned char *b);
100
 
 
101
 
} /* namespace drizzled */
102
 
 
103
106
#endif /* DRIZZLED_KEY_H */