~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
 *
4
 *  Copyright (C) 2008 Sun Microsystems
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
21
/* The old structures from unireg */
22
575.1.3 by Monty Taylor
Moved some stuff out of handler.h.
23
#ifndef DRIZZLED_STRUCTS_H
24
#define DRIZZLED_STRUCTS_H
25
1237.9.2 by Padraig O'Sullivan
Moved opt_range.[cc,h] into the optimizer directory and namespace and renamed the files to
26
#include "drizzled/base.h"
1241.9.51 by Monty Taylor
More mysys stuff out of headers.
27
#include "drizzled/definitions.h"
1237.9.2 by Padraig O'Sullivan
Moved opt_range.[cc,h] into the optimizer directory and namespace and renamed the files to
28
#include "drizzled/lex_string.h"
1241.9.43 by Monty Taylor
Merged trunk. Also renamed thr_lock. Doh. I hate it when I do both.
29
#include "drizzled/thr_lock.h"
481.1.16 by Monty Taylor
Merged iocache.h addition.
30
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
31
namespace drizzled
32
{
33
34
namespace internal
35
{
36
typedef struct st_io_cache IO_CACHE;
37
}
38
327.1.1 by Brian Aker
First pass in encapsulating table (it is now an object, no longer a structure).
39
class Table;
1 by brian
clean slate
40
class Field;
41
1534 by Brian Aker
Remove of KeyPartInfo
42
struct KeyPartInfo {	/* Info about a key part */
1 by brian
clean slate
43
  Field *field;
1241.9.40 by Monty Taylor
Fixed OSX.
44
  unsigned int	offset;				/* offset in record (from 0) */
45
  unsigned int	null_offset;			/* Offset to null_bit in record */
1 by brian
clean slate
46
  /* Length of key part in bytes, excluding NULL flag and length bytes */
206 by Brian Aker
Removed final uint dead types.
47
  uint16_t length;
1 by brian
clean slate
48
  /*
49
    Number of bytes required to store the keypart value. This may be
50
    different from the "length" field as it also counts
51
     - possible NULL-flag byte (see HA_KEY_NULL_LENGTH) [if null_bit != 0,
52
       the first byte stored at offset is 1 if null, 0 if non-null; the
53
       actual value is stored from offset+1].
54
     - possible HA_KEY_BLOB_LENGTH bytes needed to store actual value length.
55
  */
206 by Brian Aker
Removed final uint dead types.
56
  uint16_t store_length;
57
  uint16_t key_type;
1575 by Brian Aker
First part, remove pack flags.
58
private:
59
public:
60
  uint16_t getKeyType() const
61
  {
62
    return key_type;
63
  }
206 by Brian Aker
Removed final uint dead types.
64
  uint16_t fieldnr;			/* Fieldnum in UNIREG (1,2,3,...) */
65
  uint16_t key_part_flag;			/* 0 or HA_REVERSE_SORT */
66
  uint8_t type;
67
  uint8_t null_bit;			/* Position to null_bit */
1534 by Brian Aker
Remove of KeyPartInfo
68
};
1 by brian
clean slate
69
70
1535 by Brian Aker
Rename of KEY to KeyInfo
71
struct KeyInfo {
1241.9.40 by Monty Taylor
Fixed OSX.
72
  unsigned int	key_length;		/* Tot length of key */
1030.1.1 by Brian Aker
Straighten out structures (remove some some dead bits).
73
  enum  ha_key_alg algorithm;
1241.9.40 by Monty Taylor
Fixed OSX.
74
  unsigned long flags;			/* dupp key and pack flags */
75
  unsigned int key_parts;		/* How many key_parts */
482 by Brian Aker
Remove uint.
76
  uint32_t  extra_length;
1241.9.40 by Monty Taylor
Fixed OSX.
77
  unsigned int usable_key_parts;	/* Should normally be = key_parts */
482 by Brian Aker
Remove uint.
78
  uint32_t  block_size;
1534 by Brian Aker
Remove of KeyPartInfo
79
  KeyPartInfo *key_part;
1 by brian
clean slate
80
  char	*name;				/* Name of key */
81
  /*
82
    Array of AVG(#records with the same field value) for 1st ... Nth key part.
83
    0 means 'not known'.
84
    For temporary heap tables this member is NULL.
85
  */
86
  ulong *rec_per_key;
327.1.1 by Brian Aker
First pass in encapsulating table (it is now an object, no longer a structure).
87
  Table *table;
1 by brian
clean slate
88
  LEX_STRING comment;
1535 by Brian Aker
Rename of KEY to KeyInfo
89
};
1 by brian
clean slate
90
91
1089.1.1 by Brian Aker
Remove of JOIN_TAB to JoinTable
92
class JoinTable;
1 by brian
clean slate
93
1014.2.10 by Monty Taylor
Made REGINFO into RegInfo and responsible for initializing itself.
94
struct RegInfo {		/* Extra info about reg */
1089.1.1 by Brian Aker
Remove of JOIN_TAB to JoinTable
95
  JoinTable *join_tab;	/* Used by SELECT() */
1 by brian
clean slate
96
  enum thr_lock_type lock_type;		/* How database is used */
97
  bool not_exists_optimize;
98
  bool impossible_range;
1014.2.10 by Monty Taylor
Made REGINFO into RegInfo and responsible for initializing itself.
99
  RegInfo()
100
    : join_tab(NULL), lock_type(TL_UNLOCK),
101
      not_exists_optimize(false), impossible_range(false) {}
102
  void reset()
103
  {
104
    join_tab= NULL;
105
    lock_type= TL_UNLOCK;
106
    not_exists_optimize= false;
107
    impossible_range= false;
108
  }
109
};
1 by brian
clean slate
110
520.1.21 by Brian Aker
THD -> Session rename
111
class Session;
1183.1.2 by Brian Aker
Rename of handler to Cursor. You would not believe how long I have wanted
112
class Cursor;
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
113
namespace optimizer { class SqlSelect; }
1 by brian
clean slate
114
1228.1.5 by Monty Taylor
Merged in some naming things.
115
typedef int *(*update_var)(Session *, struct drizzle_show_var *);
1 by brian
clean slate
116
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
117
} /* namespace drizzled */
118
1 by brian
clean slate
119
	/* Bits in form->status */
120
#define STATUS_NO_RECORD	(1+2)	/* Record isn't usably */
121
#define STATUS_GARBAGE		1
122
#define STATUS_NOT_FOUND	2	/* No record in database when needed */
123
#define STATUS_NO_PARENT	4	/* Parent record wasn't found */
124
#define STATUS_NOT_READ		8	/* Record isn't read */
125
#define STATUS_UPDATED		16	/* Record is updated by formula */
126
#define STATUS_NULL_ROW		32	/* table->null_row is set */
127
#define STATUS_DELETED		64
128
575.1.3 by Monty Taylor
Moved some stuff out of handler.h.
129
#endif /* DRIZZLED_STRUCTS_H */