~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
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
33
namespace drizzled
34
{
35
36
namespace memory { class Root; }
37
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.
38
class Item;
39
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
40
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.
41
public:
42
  enum Keytype { PRIMARY, UNIQUE, MULTIPLE, FOREIGN_KEY};
2096.1.5 by Brian Aker
Fix key init, stop using memset.
43
  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.
44
  KEY_CREATE_INFO key_create_info;
45
  List<Key_part_spec> columns;
46
  LEX_STRING name;
47
  bool generated;
48
2096.1.5 by Brian Aker
Fix key init, stop using memset.
49
  Key(Keytype type_par,
50
      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.
51
      KEY_CREATE_INFO *key_info_arg,
2096.1.5 by Brian Aker
Fix key init, stop using memset.
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)
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.
58
  {}
2096.1.5 by Brian Aker
Fix key init, stop using memset.
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),
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.
69
    generated(generated_arg)
70
  {
1238.1.4 by Brian Aker
ICC cleanup
71
    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.
72
    name.length= name_len_arg;
73
  }
934.2.21 by Jay Pipes
Move Key stuff into key.cc and out of session.cc
74
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.
75
  virtual ~Key() {}
76
  /* Equality comparison of keys (ignoring name) */
77
  friend bool foreign_key_prefix(Key *a, Key *b);
78
};
79
656.1.1 by Monty Taylor
OOOh doggie. Got rid of my_alloca.
80
1535 by Brian Aker
Rename of KEY to KeyInfo
81
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.
82
                 uint32_t *key_length, uint32_t *keypart);
83
/**
84
  Copy part of a record that forms a key or key prefix to a buffer.
85
86
    The function takes a complete table record (as e.g. retrieved by
87
    handler::index_read()), and a description of an index on the same table,
88
    and extracts the first key_length bytes of the record which are part of a
89
    key into to_key. If length == 0 then copy all bytes from the record that
90
    form a key.
91
92
  @param to_key      buffer that will be used as a key
93
  @param from_record full record to be copied from
94
  @param key_info    descriptor of the index
95
  @param key_length  specifies length of all keyparts that will be copied
96
*/
97
2119.4.1 by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by
98
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.
99
void key_copy(std::basic_string<unsigned char> &to_key,
1535 by Brian Aker
Rename of KEY to KeyInfo
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,
656.1.1 by Monty Taylor
OOOh doggie. Got rid of my_alloca.
102
                 uint16_t key_length);
1535 by Brian Aker
Rename of KEY to KeyInfo
103
void key_zero_nulls(unsigned char *tuple, KeyInfo *key_info);
656.1.1 by Monty Taylor
OOOh doggie. Got rid of my_alloca.
104
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.
105
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.
106
bool is_key_used(Table *table, uint32_t idx, const boost::dynamic_bitset<>& fields);
1534 by Brian Aker
Remove of KeyPartInfo
107
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.
108
109
} /* namespace drizzled */
110