~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
584.1.14 by Monty Taylor
Removed field.h from common_includes.
26
#include <drizzled/base.h>
520.6.4 by Monty Taylor
Moved thr_lock.h out of common_includes.
27
#include <mysys/definitions.h>
575.1.5 by Monty Taylor
Moved stuff to handlerton.cc
28
#include <drizzled/lex_string.h>
481.1.16 by Monty Taylor
Merged iocache.h addition.
29
327.1.1 by Brian Aker
First pass in encapsulating table (it is now an object, no longer a structure).
30
class Table;
1 by brian
clean slate
31
class Field;
584.1.14 by Monty Taylor
Removed field.h from common_includes.
32
typedef struct st_io_cache IO_CACHE;
1 by brian
clean slate
33
34
typedef struct st_keyfile_info {	/* used with ha_info() */
481 by Brian Aker
Remove all of uchar.
35
  unsigned char ref[MAX_REFLENGTH];		/* Pointer to current row */
36
  unsigned char dupp_ref[MAX_REFLENGTH];	/* Pointer to dupp row */
482 by Brian Aker
Remove uint.
37
  uint32_t ref_length;			/* Length of ref (1-8) */
38
  uint32_t block_size;			/* index block size */
1 by brian
clean slate
39
  File filenr;				/* (uniq) filenr for table */
40
  ha_rows records;			/* Records i datafilen */
41
  ha_rows deleted;			/* Deleted records */
151 by Brian Aker
Ulonglong to uint64_t
42
  uint64_t data_file_length;		/* Length off data file */
43
  uint64_t max_data_file_length;	/* Length off data file */
44
  uint64_t index_file_length;
45
  uint64_t max_index_file_length;
46
  uint64_t delete_length;		/* Free bytes */
47
  uint64_t auto_increment_value;
1 by brian
clean slate
48
  int errkey,sortkey;			/* Last errorkey and sorted by */
49
  time_t create_time;			/* When table was created */
50
  time_t check_time;
51
  time_t update_time;
520.1.16 by Brian Aker
More test updates (one ulong fix)
52
  uint64_t mean_rec_length;		/* physical reclength */
1 by brian
clean slate
53
} KEYFILE_INFO;
54
55
56
typedef struct st_key_part_info {	/* Info about a key part */
57
  Field *field;
58
  uint	offset;				/* offset in record (from 0) */
59
  uint	null_offset;			/* Offset to null_bit in record */
60
  /* Length of key part in bytes, excluding NULL flag and length bytes */
206 by Brian Aker
Removed final uint dead types.
61
  uint16_t length;
1 by brian
clean slate
62
  /*
63
    Number of bytes required to store the keypart value. This may be
64
    different from the "length" field as it also counts
65
     - possible NULL-flag byte (see HA_KEY_NULL_LENGTH) [if null_bit != 0,
66
       the first byte stored at offset is 1 if null, 0 if non-null; the
67
       actual value is stored from offset+1].
68
     - possible HA_KEY_BLOB_LENGTH bytes needed to store actual value length.
69
  */
206 by Brian Aker
Removed final uint dead types.
70
  uint16_t store_length;
71
  uint16_t key_type;
72
  uint16_t fieldnr;			/* Fieldnum in UNIREG (1,2,3,...) */
73
  uint16_t key_part_flag;			/* 0 or HA_REVERSE_SORT */
74
  uint8_t type;
75
  uint8_t null_bit;			/* Position to null_bit */
1 by brian
clean slate
76
} KEY_PART_INFO ;
77
78
79
typedef struct st_key {
80
  uint	key_length;			/* Tot length of key */
1030.1.1 by Brian Aker
Straighten out structures (remove some some dead bits).
81
  enum  ha_key_alg algorithm;
1 by brian
clean slate
82
  ulong flags;                          /* dupp key and pack flags */
83
  uint	key_parts;			/* How many key_parts */
482 by Brian Aker
Remove uint.
84
  uint32_t  extra_length;
1 by brian
clean slate
85
  uint	usable_key_parts;		/* Should normally be = key_parts */
482 by Brian Aker
Remove uint.
86
  uint32_t  block_size;
1 by brian
clean slate
87
  KEY_PART_INFO *key_part;
88
  char	*name;				/* Name of key */
89
  /*
90
    Array of AVG(#records with the same field value) for 1st ... Nth key part.
91
    0 means 'not known'.
92
    For temporary heap tables this member is NULL.
93
  */
94
  ulong *rec_per_key;
327.1.1 by Brian Aker
First pass in encapsulating table (it is now an object, no longer a structure).
95
  Table *table;
1 by brian
clean slate
96
  LEX_STRING comment;
97
} KEY;
98
99
100
struct st_join_table;
101
1014.2.10 by Monty Taylor
Made REGINFO into RegInfo and responsible for initializing itself.
102
struct RegInfo {		/* Extra info about reg */
1 by brian
clean slate
103
  struct st_join_table *join_tab;	/* Used by SELECT() */
104
  enum thr_lock_type lock_type;		/* How database is used */
105
  bool not_exists_optimize;
106
  bool impossible_range;
1014.2.10 by Monty Taylor
Made REGINFO into RegInfo and responsible for initializing itself.
107
  RegInfo()
108
    : join_tab(NULL), lock_type(TL_UNLOCK),
109
      not_exists_optimize(false), impossible_range(false) {}
110
  void reset()
111
  {
112
    join_tab= NULL;
113
    lock_type= TL_UNLOCK;
114
    not_exists_optimize= false;
115
    impossible_range= false;
116
  }
117
};
1 by brian
clean slate
118
119
struct st_read_record;				/* For referense later */
120
class SQL_SELECT;
520.1.21 by Brian Aker
THD -> Session rename
121
class Session;
1 by brian
clean slate
122
class handler;
123
struct st_join_table;
124
125
typedef struct st_read_record {			/* Parameter to read_record */
327.1.1 by Brian Aker
First pass in encapsulating table (it is now an object, no longer a structure).
126
  Table *table;			/* Head-form */
1 by brian
clean slate
127
  handler *file;
327.1.1 by Brian Aker
First pass in encapsulating table (it is now an object, no longer a structure).
128
  Table **forms;			/* head and ref forms */
1 by brian
clean slate
129
  int (*read_record)(struct st_read_record *);
520.1.22 by Brian Aker
Second pass of thd cleanup
130
  Session *session;
1 by brian
clean slate
131
  SQL_SELECT *select;
482 by Brian Aker
Remove uint.
132
  uint32_t cache_records;
133
  uint32_t ref_length,struct_length,reclength,rec_cache_size,error_offset;
134
  uint32_t index;
481 by Brian Aker
Remove all of uchar.
135
  unsigned char *ref_pos;				/* pointer to form->refpos */
136
  unsigned char *record;
137
  unsigned char *rec_buf;                /* to read field values  after filesort */
138
  unsigned char	*cache,*cache_pos,*cache_end,*read_positions;
1 by brian
clean slate
139
  IO_CACHE *io_cache;
140
  bool print_error, ignore_not_found_rows;
141
  struct st_join_table *do_insideout_scan;
142
} READ_RECORD;
143
144
145
typedef struct {
520.1.16 by Brian Aker
More test updates (one ulong fix)
146
  uint32_t year;
147
  uint32_t month;
148
  uint32_t day;
149
  uint32_t hour;
151 by Brian Aker
Ulonglong to uint64_t
150
  uint64_t minute,second,second_part;
1 by brian
clean slate
151
  bool neg;
152
} INTERVAL;
153
154
extern const char *show_comp_option_name[];
155
520.1.21 by Brian Aker
THD -> Session rename
156
typedef int *(*update_var)(Session *, struct st_mysql_show_var *);
1 by brian
clean slate
157
158
	/* Bits in form->update */
159
#define REG_MAKE_DUPP		1	/* Make a copy of record when read */
160
#define REG_NEW_RECORD		2	/* Write a new record if not found */
161
#define REG_UPDATE		4	/* Uppdate record */
162
#define REG_DELETE		8	/* Delete found record */
163
#define REG_PROG		16	/* User is updating database */
164
#define REG_CLEAR_AFTER_WRITE	32
165
#define REG_MAY_BE_UPDATED	64
166
#define REG_AUTO_UPDATE		64	/* Used in D-forms for scroll-tables */
167
#define REG_OVERWRITE		128
168
#define REG_SKIP_DUP		256
169
170
	/* Bits in form->status */
171
#define STATUS_NO_RECORD	(1+2)	/* Record isn't usably */
172
#define STATUS_GARBAGE		1
173
#define STATUS_NOT_FOUND	2	/* No record in database when needed */
174
#define STATUS_NO_PARENT	4	/* Parent record wasn't found */
175
#define STATUS_NOT_READ		8	/* Record isn't read */
176
#define STATUS_UPDATED		16	/* Record is updated by formula */
177
#define STATUS_NULL_ROW		32	/* table->null_row is set */
178
#define STATUS_DELETED		64
179
575.1.3 by Monty Taylor
Moved some stuff out of handler.h.
180
#endif /* DRIZZLED_STRUCTS_H */