~drizzle-trunk/drizzle/development

584.1.15 by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes.
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
1999.6.1 by kalebral at gmail
update Copyright strings to a more common format to help with creating the master debian copyright file
4
 *  Copyright (C) 2008 Sun Microsystems, Inc.
584.1.15 by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes.
5
 *
6
 *  This program is free software; you can redistribute it and/or modify
7
 *  it under the terms of the GNU General Public License as published by
8
 *  the Free Software Foundation; version 2 of the License.
9
 *
10
 *  This program is distributed in the hope that it will be useful,
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 *  GNU General Public License for more details.
14
 *
15
 *  You should have received a copy of the GNU General Public License
16
 *  along with this program; if not, write to the Free Software
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
 */
19
20
2234 by Brian Aker
Mass removal of ifdef/endif in favor of pragma once.
21
#pragma once
584.1.15 by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes.
22
1241.9.1 by Monty Taylor
Removed global.h. Fixed all the headers.
23
#include <string>
1802.16.5 by Padraig O'Sullivan
Adding help method for dynamic bitset functions. Temporary until MyBitmap is removed. Got rid of another MyBitmap usage in the range optimizer.
24
#include <boost/dynamic_bitset.hpp>
584.1.15 by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes.
25
2173.2.1 by Monty Taylor
Fixes incorrect usage of include
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>
584.1.15 by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes.
32
2252.1.15 by Olaf van der Spek
Common fwd
33
namespace drizzled {
584.1.15 by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes.
34
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
35
class Key :public memory::SqlAlloc {
584.1.15 by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes.
36
public:
37
  enum Keytype { PRIMARY, UNIQUE, MULTIPLE, FOREIGN_KEY};
2096.1.5 by Brian Aker
Fix key init, stop using memset.
38
  Keytype type;
584.1.15 by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes.
39
  KEY_CREATE_INFO key_create_info;
40
  List<Key_part_spec> columns;
41
  LEX_STRING name;
42
  bool generated;
43
2096.1.5 by Brian Aker
Fix key init, stop using memset.
44
  Key(Keytype type_par,
45
      const lex_string_t &name_arg,
584.1.15 by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes.
46
      KEY_CREATE_INFO *key_info_arg,
2096.1.5 by Brian Aker
Fix key init, stop using memset.
47
      bool generated_arg, List<Key_part_spec> &cols) :
48
    type(type_par),
49
    key_create_info(*key_info_arg),
50
    columns(cols),
51
    name(name_arg),
52
    generated(generated_arg)
584.1.15 by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes.
53
  {}
2096.1.5 by Brian Aker
Fix key init, stop using memset.
54
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) :
61
    type(type_par),
62
    key_create_info(*key_info_arg),
63
    columns(cols),
584.1.15 by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes.
64
    generated(generated_arg)
65
  {
1238.1.4 by Brian Aker
ICC cleanup
66
    name.str= const_cast<char *>(name_arg);
584.1.15 by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes.
67
    name.length= name_len_arg;
68
  }
934.2.21 by Jay Pipes
Move Key stuff into key.cc and out of session.cc
69
584.1.15 by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes.
70
  virtual ~Key() {}
71
  /* Equality comparison of keys (ignoring name) */
72
  friend bool foreign_key_prefix(Key *a, Key *b);
73
};
74
656.1.1 by Monty Taylor
OOOh doggie. Got rid of my_alloca.
75
1535 by Brian Aker
Rename of KEY to KeyInfo
76
int find_ref_key(KeyInfo *key, uint32_t key_count, unsigned char *record, Field *field,
656.1.1 by Monty Taylor
OOOh doggie. Got rid of my_alloca.
77
                 uint32_t *key_length, uint32_t *keypart);
78
/**
79
  Copy part of a record that forms a key or key prefix to a buffer.
80
81
    The function takes a complete table record (as e.g. retrieved by
82
    handler::index_read()), and a description of an index on the same table,
83
    and extracts the first key_length bytes of the record which are part of a
84
    key into to_key. If length == 0 then copy all bytes from the record that
85
    form a key.
86
87
  @param to_key      buffer that will be used as a key
88
  @param from_record full record to be copied from
89
  @param key_info    descriptor of the index
90
  @param key_length  specifies length of all keyparts that will be copied
91
*/
92
2119.4.1 by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by
93
DRIZZLED_API void key_copy(unsigned char *to_key, unsigned char *from_record, KeyInfo *key_info, uint32_t key_length);
656.1.1 by Monty Taylor
OOOh doggie. Got rid of my_alloca.
94
void key_copy(std::basic_string<unsigned char> &to_key,
1535 by Brian Aker
Rename of KEY to KeyInfo
95
              unsigned char *from_record, KeyInfo *key_info, uint32_t key_length);
96
void key_restore(unsigned char *to_record, unsigned char *from_key, KeyInfo *key_info,
656.1.1 by Monty Taylor
OOOh doggie. Got rid of my_alloca.
97
                 uint16_t key_length);
1535 by Brian Aker
Rename of KEY to KeyInfo
98
void key_zero_nulls(unsigned char *tuple, KeyInfo *key_info);
656.1.1 by Monty Taylor
OOOh doggie. Got rid of my_alloca.
99
bool key_cmp_if_same(Table *form,const unsigned char *key,uint32_t index,uint32_t key_length);
2148.7.12 by Brian Aker
Merge in header fixes.
100
void key_unpack(String *to, const Table *form,uint32_t index);
1802.16.5 by Padraig O'Sullivan
Adding help method for dynamic bitset functions. Temporary until MyBitmap is removed. Got rid of another MyBitmap usage in the range optimizer.
101
bool is_key_used(Table *table, uint32_t idx, const boost::dynamic_bitset<>& fields);
1534 by Brian Aker
Remove of KeyPartInfo
102
int key_cmp(KeyPartInfo *key_part, const unsigned char *key, uint32_t key_length);
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
103
104
} /* namespace drizzled */
105