~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
2440.2.8 by Olaf van der Spek
Refactor
35
class Key : public memory::SqlAlloc 
36
{
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.
37
public:
2440.2.8 by Olaf van der Spek
Refactor
38
  enum Keytype { PRIMARY, UNIQUE, MULTIPLE, FOREIGN_KEY };
2096.1.5 by Brian Aker
Fix key init, stop using memset.
39
  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.
40
  KEY_CREATE_INFO key_create_info;
41
  List<Key_part_spec> columns;
2445.1.9 by Olaf van der Spek
Use str_ref
42
  str_ref name;
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.
43
  bool generated;
44
2445.1.10 by Olaf van der Spek
Use str_ref
45
  Key(Keytype type_par, str_ref name_arg, KEY_CREATE_INFO *key_info_arg, bool generated_arg, List<Key_part_spec> &cols) :
2096.1.5 by Brian Aker
Fix key init, stop using memset.
46
    type(type_par),
47
    key_create_info(*key_info_arg),
48
    columns(cols),
49
    name(name_arg),
50
    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.
51
  {}
2096.1.5 by Brian Aker
Fix key init, stop using memset.
52
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
  virtual ~Key() {}
54
  /* Equality comparison of keys (ignoring name) */
55
  friend bool foreign_key_prefix(Key *a, Key *b);
56
};
57
656.1.1 by Monty Taylor
OOOh doggie. Got rid of my_alloca.
58
2440.2.8 by Olaf van der Spek
Refactor
59
int find_ref_key(KeyInfo *key, uint32_t key_count, unsigned char *record, Field *field, uint32_t *key_length, uint32_t *keypart);
656.1.1 by Monty Taylor
OOOh doggie. Got rid of my_alloca.
60
/**
61
  Copy part of a record that forms a key or key prefix to a buffer.
62
63
    The function takes a complete table record (as e.g. retrieved by
64
    handler::index_read()), and a description of an index on the same table,
65
    and extracts the first key_length bytes of the record which are part of a
66
    key into to_key. If length == 0 then copy all bytes from the record that
67
    form a key.
68
69
  @param to_key      buffer that will be used as a key
70
  @param from_record full record to be copied from
71
  @param key_info    descriptor of the index
72
  @param key_length  specifies length of all keyparts that will be copied
73
*/
74
2119.4.1 by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by
75
DRIZZLED_API void key_copy(unsigned char *to_key, unsigned char *from_record, KeyInfo *key_info, uint32_t key_length);
2440.2.8 by Olaf van der Spek
Refactor
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);
1535 by Brian Aker
Rename of KEY to KeyInfo
78
void key_zero_nulls(unsigned char *tuple, KeyInfo *key_info);
656.1.1 by Monty Taylor
OOOh doggie. Got rid of my_alloca.
79
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.
80
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.
81
bool is_key_used(Table *table, uint32_t idx, const boost::dynamic_bitset<>& fields);
1534 by Brian Aker
Remove of KeyPartInfo
82
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.
83
84
} /* namespace drizzled */