1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008 Sun Microsystems
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.
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.
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
21
/* The old structures from unireg */
23
#ifndef DRIZZLED_STRUCTS_H
24
#define DRIZZLED_STRUCTS_H
26
#include "drizzled/base.h"
27
#include "drizzled/definitions.h"
28
#include "drizzled/lex_string.h"
29
#include "drizzled/thr_lock.h"
36
typedef struct st_io_cache IO_CACHE;
42
typedef struct st_keyfile_info { /* used with ha_info() */
43
unsigned char ref[MAX_REFLENGTH]; /* Pointer to current row */
44
unsigned char dupp_ref[MAX_REFLENGTH]; /* Pointer to dupp row */
45
uint32_t ref_length; /* Length of ref (1-8) */
46
uint32_t block_size; /* index block size */
47
int filenr; /* (uniq) filenr for table */
48
ha_rows records; /* Records i datafilen */
49
ha_rows deleted; /* Deleted records */
50
uint64_t data_file_length; /* Length off data file */
51
uint64_t max_data_file_length; /* Length off data file */
52
uint64_t index_file_length;
53
uint64_t max_index_file_length;
54
uint64_t delete_length; /* Free bytes */
55
uint64_t auto_increment_value;
56
int errkey,sortkey; /* Last errorkey and sorted by */
57
time_t create_time; /* When table was created */
60
uint64_t mean_rec_length; /* physical reclength */
64
typedef struct st_key_part_info { /* Info about a key part */
66
unsigned int offset; /* offset in record (from 0) */
67
unsigned int null_offset; /* Offset to null_bit in record */
68
/* Length of key part in bytes, excluding NULL flag and length bytes */
71
Number of bytes required to store the keypart value. This may be
72
different from the "length" field as it also counts
73
- possible NULL-flag byte (see HA_KEY_NULL_LENGTH) [if null_bit != 0,
74
the first byte stored at offset is 1 if null, 0 if non-null; the
75
actual value is stored from offset+1].
76
- possible HA_KEY_BLOB_LENGTH bytes needed to store actual value length.
78
uint16_t store_length;
80
uint16_t fieldnr; /* Fieldnum in UNIREG (1,2,3,...) */
81
uint16_t key_part_flag; /* 0 or HA_REVERSE_SORT */
83
uint8_t null_bit; /* Position to null_bit */
87
typedef struct st_key {
88
unsigned int key_length; /* Tot length of key */
89
enum ha_key_alg algorithm;
90
unsigned long flags; /* dupp key and pack flags */
91
unsigned int key_parts; /* How many key_parts */
92
uint32_t extra_length;
93
unsigned int usable_key_parts; /* Should normally be = key_parts */
95
KEY_PART_INFO *key_part;
96
char *name; /* Name of key */
98
Array of AVG(#records with the same field value) for 1st ... Nth key part.
100
For temporary heap tables this member is NULL.
110
struct RegInfo { /* Extra info about reg */
111
JoinTable *join_tab; /* Used by SELECT() */
112
enum thr_lock_type lock_type; /* How database is used */
113
bool not_exists_optimize;
114
bool impossible_range;
116
: join_tab(NULL), lock_type(TL_UNLOCK),
117
not_exists_optimize(false), impossible_range(false) {}
121
lock_type= TL_UNLOCK;
122
not_exists_optimize= false;
123
impossible_range= false;
127
struct st_read_record; /* For referense later */
130
namespace optimizer { class SqlSelect; }
132
typedef struct st_read_record { /* Parameter to read_record */
133
Table *table; /* Head-form */
135
Table **forms; /* head and ref forms */
136
int (*read_record)(struct st_read_record *);
138
optimizer::SqlSelect *select;
139
uint32_t cache_records;
140
uint32_t ref_length,struct_length,reclength,rec_cache_size,error_offset;
142
unsigned char *ref_pos; /* pointer to form->refpos */
143
unsigned char *record;
144
unsigned char *rec_buf; /* to read field values after filesort */
145
unsigned char *cache,*cache_pos,*cache_end,*read_positions;
146
internal::IO_CACHE *io_cache;
147
bool print_error, ignore_not_found_rows;
148
JoinTable *do_insideout_scan;
151
typedef int *(*update_var)(Session *, struct drizzle_show_var *);
153
} /* namespace drizzled */
155
/* Bits in form->status */
156
#define STATUS_NO_RECORD (1+2) /* Record isn't usably */
157
#define STATUS_GARBAGE 1
158
#define STATUS_NOT_FOUND 2 /* No record in database when needed */
159
#define STATUS_NO_PARENT 4 /* Parent record wasn't found */
160
#define STATUS_NOT_READ 8 /* Record isn't read */
161
#define STATUS_UPDATED 16 /* Record is updated by formula */
162
#define STATUS_NULL_ROW 32 /* table->null_row is set */
163
#define STATUS_DELETED 64
165
#endif /* DRIZZLED_STRUCTS_H */