~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/key.h

  • Committer: patrick crews
  • Date: 2011-02-23 17:17:25 UTC
  • mto: (2195.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 2196.
  • Revision ID: gleebix@gmail.com-20110223171725-4tgewemxhsw1m7q8
Integrated randgen with dbqp.  We now have mode=randgen and a set of randgen test suites (very basic now).  Output = same as dtr : )  We also have mode=cleanup to kill any servers we have started.  Docs updates too.  Gendata utility allows us to populate test servers 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems
 
4
 *  Copyright (C) 2008 Sun Microsystems, Inc.
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
24
24
#include <string>
25
25
#include <boost/dynamic_bitset.hpp>
26
26
 
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"
 
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>
33
33
 
34
34
namespace drizzled
35
35
{
41
41
class Key :public memory::SqlAlloc {
42
42
public:
43
43
  enum Keytype { PRIMARY, UNIQUE, MULTIPLE, FOREIGN_KEY};
44
 
  enum Keytype type;
 
44
  Keytype type;
45
45
  KEY_CREATE_INFO key_create_info;
46
46
  List<Key_part_spec> columns;
47
47
  LEX_STRING name;
48
48
  bool generated;
49
49
 
50
 
  Key(enum Keytype type_par, const LEX_STRING &name_arg,
 
50
  Key(Keytype type_par,
 
51
      const lex_string_t &name_arg,
51
52
      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)
 
53
      bool generated_arg, List<Key_part_spec> &cols) :
 
54
    type(type_par),
 
55
    key_create_info(*key_info_arg),
 
56
    columns(cols),
 
57
    name(name_arg),
 
58
    generated(generated_arg)
55
59
  {}
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),
 
60
 
 
61
  Key(Keytype type_par,
 
62
      const char *name_arg,
 
63
      size_t name_len_arg,
 
64
      KEY_CREATE_INFO *key_info_arg,
 
65
      bool generated_arg,
 
66
      List<Key_part_spec> &cols) :
 
67
    type(type_par),
 
68
    key_create_info(*key_info_arg),
 
69
    columns(cols),
60
70
    generated(generated_arg)
61
71
  {
62
72
    name.str= const_cast<char *>(name_arg);
86
96
  @param key_length  specifies length of all keyparts that will be copied
87
97
*/
88
98
 
89
 
void key_copy(unsigned char *to_key, unsigned char *from_record, KeyInfo *key_info, uint32_t key_length);
 
99
DRIZZLED_API void key_copy(unsigned char *to_key, unsigned char *from_record, KeyInfo *key_info, uint32_t key_length);
90
100
void key_copy(std::basic_string<unsigned char> &to_key,
91
101
              unsigned char *from_record, KeyInfo *key_info, uint32_t key_length);
92
102
void key_restore(unsigned char *to_record, unsigned char *from_key, KeyInfo *key_info,
93
103
                 uint16_t key_length);
94
104
void key_zero_nulls(unsigned char *tuple, KeyInfo *key_info);
95
105
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);
 
106
void key_unpack(String *to, const Table *form,uint32_t index);
97
107
bool is_key_used(Table *table, uint32_t idx, const boost::dynamic_bitset<>& fields);
98
108
int key_cmp(KeyPartInfo *key_part, const unsigned char *key, uint32_t key_length);
99
109