~drizzle-trunk/drizzle/development

390.1.2 by Monty Taylor
Fixed copyright headers in drizzled/
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.
390.1.2 by Monty Taylor
Fixed copyright headers in drizzled/
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; either version 2 of the License, or
9
 *  (at your option) any later version.
10
 *
11
 *  This program is distributed in the hope that it will be useful,
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 *  GNU General Public License for more details.
15
 *
16
 *  You should have received a copy of the GNU General Public License
17
 *  along with this program; if not, write to the Free Software
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
 */
1 by brian
clean slate
20
2234 by Brian Aker
Mass removal of ifdef/endif in favor of pragma once.
21
#pragma once
575.1.3 by Monty Taylor
Moved some stuff out of handler.h.
22
2173.2.1 by Monty Taylor
Fixes incorrect usage of include
23
#include <drizzled/base.h>
24
#include <drizzled/definitions.h>
25
#include <drizzled/lex_string.h>
26
#include <drizzled/thr_lock.h>
481.1.16 by Monty Taylor
Merged iocache.h addition.
27
2252.1.18 by Olaf van der Spek
Common fwd
28
namespace drizzled {
1 by brian
clean slate
29
1805.1.1 by tdavies
In .../drizzled/structs.h: Changed C structs KeyPartInfo, KeyInfo, and RegInfo to C++ classes
30
class KeyPartInfo 
31
{	/* Info about a key part */
32
public:
1 by brian
clean slate
33
  Field *field;
1241.9.40 by Monty Taylor
Fixed OSX.
34
  unsigned int	offset;				/* offset in record (from 0) */
35
  unsigned int	null_offset;			/* Offset to null_bit in record */
1 by brian
clean slate
36
  /* Length of key part in bytes, excluding NULL flag and length bytes */
206 by Brian Aker
Removed final uint dead types.
37
  uint16_t length;
1 by brian
clean slate
38
  /*
39
    Number of bytes required to store the keypart value. This may be
40
    different from the "length" field as it also counts
41
     - possible NULL-flag byte (see HA_KEY_NULL_LENGTH) [if null_bit != 0,
42
       the first byte stored at offset is 1 if null, 0 if non-null; the
43
       actual value is stored from offset+1].
44
     - possible HA_KEY_BLOB_LENGTH bytes needed to store actual value length.
45
  */
206 by Brian Aker
Removed final uint dead types.
46
  uint16_t store_length;
47
  uint16_t key_type;
1575 by Brian Aker
First part, remove pack flags.
48
private:
49
public:
50
  uint16_t getKeyType() const
51
  {
52
    return key_type;
53
  }
206 by Brian Aker
Removed final uint dead types.
54
  uint16_t fieldnr;			/* Fieldnum in UNIREG (1,2,3,...) */
55
  uint16_t key_part_flag;			/* 0 or HA_REVERSE_SORT */
56
  uint8_t type;
57
  uint8_t null_bit;			/* Position to null_bit */
1534 by Brian Aker
Remove of KeyPartInfo
58
};
1 by brian
clean slate
59
60
1805.1.1 by tdavies
In .../drizzled/structs.h: Changed C structs KeyPartInfo, KeyInfo, and RegInfo to C++ classes
61
class KeyInfo 
62
{
63
public:
1241.9.40 by Monty Taylor
Fixed OSX.
64
  unsigned int	key_length;		/* Tot length of key */
1030.1.1 by Brian Aker
Straighten out structures (remove some some dead bits).
65
  enum  ha_key_alg algorithm;
1241.9.40 by Monty Taylor
Fixed OSX.
66
  unsigned long flags;			/* dupp key and pack flags */
67
  unsigned int key_parts;		/* How many key_parts */
482 by Brian Aker
Remove uint.
68
  uint32_t  extra_length;
1241.9.40 by Monty Taylor
Fixed OSX.
69
  unsigned int usable_key_parts;	/* Should normally be = key_parts */
482 by Brian Aker
Remove uint.
70
  uint32_t  block_size;
1534 by Brian Aker
Remove of KeyPartInfo
71
  KeyPartInfo *key_part;
2440.2.21 by Olaf van der Spek
Use str_ref
72
  const char* name;				/* Name of key */
1 by brian
clean slate
73
  /*
74
    Array of AVG(#records with the same field value) for 1st ... Nth key part.
75
    0 means 'not known'.
76
    For temporary heap tables this member is NULL.
77
  */
78
  ulong *rec_per_key;
327.1.1 by Brian Aker
First pass in encapsulating table (it is now an object, no longer a structure).
79
  Table *table;
2445.1.12 by Olaf van der Spek
Use str_ref
80
  str_ref comment;
1535 by Brian Aker
Rename of KEY to KeyInfo
81
};
1 by brian
clean slate
82
83
1805.1.1 by tdavies
In .../drizzled/structs.h: Changed C structs KeyPartInfo, KeyInfo, and RegInfo to C++ classes
84
class RegInfo 
85
{
86
public:		/* Extra info about reg */
1089.1.1 by Brian Aker
Remove of JOIN_TAB to JoinTable
87
  JoinTable *join_tab;	/* Used by SELECT() */
1 by brian
clean slate
88
  enum thr_lock_type lock_type;		/* How database is used */
89
  bool not_exists_optimize;
90
  bool impossible_range;
1014.2.10 by Monty Taylor
Made REGINFO into RegInfo and responsible for initializing itself.
91
  RegInfo()
92
    : join_tab(NULL), lock_type(TL_UNLOCK),
93
      not_exists_optimize(false), impossible_range(false) {}
94
  void reset()
95
  {
96
    join_tab= NULL;
97
    lock_type= TL_UNLOCK;
98
    not_exists_optimize= false;
99
    impossible_range= false;
100
  }
101
};
1 by brian
clean slate
102
1228.1.5 by Monty Taylor
Merged in some naming things.
103
typedef int *(*update_var)(Session *, struct drizzle_show_var *);
1 by brian
clean slate
104
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
105
} /* namespace drizzled */
106
1 by brian
clean slate
107
	/* Bits in form->status */
108
#define STATUS_NO_RECORD	(1+2)	/* Record isn't usably */
109
#define STATUS_GARBAGE		1
110
#define STATUS_NOT_FOUND	2	/* No record in database when needed */
111
#define STATUS_NO_PARENT	4	/* Parent record wasn't found */
112
#define STATUS_NULL_ROW		32	/* table->null_row is set */
113