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"
33
typedef struct st_io_cache IO_CACHE;
35
typedef struct st_keyfile_info { /* used with ha_info() */
36
unsigned char ref[MAX_REFLENGTH]; /* Pointer to current row */
37
unsigned char dupp_ref[MAX_REFLENGTH]; /* Pointer to dupp row */
38
uint32_t ref_length; /* Length of ref (1-8) */
39
uint32_t block_size; /* index block size */
40
int filenr; /* (uniq) filenr for table */
41
ha_rows records; /* Records i datafilen */
42
ha_rows deleted; /* Deleted records */
43
uint64_t data_file_length; /* Length off data file */
44
uint64_t max_data_file_length; /* Length off data file */
45
uint64_t index_file_length;
46
uint64_t max_index_file_length;
47
uint64_t delete_length; /* Free bytes */
48
uint64_t auto_increment_value;
49
int errkey,sortkey; /* Last errorkey and sorted by */
50
time_t create_time; /* When table was created */
53
uint64_t mean_rec_length; /* physical reclength */
57
typedef struct st_key_part_info { /* Info about a key part */
59
unsigned int offset; /* offset in record (from 0) */
60
unsigned int null_offset; /* Offset to null_bit in record */
61
/* Length of key part in bytes, excluding NULL flag and length bytes */
64
Number of bytes required to store the keypart value. This may be
65
different from the "length" field as it also counts
66
- possible NULL-flag byte (see HA_KEY_NULL_LENGTH) [if null_bit != 0,
67
the first byte stored at offset is 1 if null, 0 if non-null; the
68
actual value is stored from offset+1].
69
- possible HA_KEY_BLOB_LENGTH bytes needed to store actual value length.
71
uint16_t store_length;
73
uint16_t fieldnr; /* Fieldnum in UNIREG (1,2,3,...) */
74
uint16_t key_part_flag; /* 0 or HA_REVERSE_SORT */
76
uint8_t null_bit; /* Position to null_bit */
80
typedef struct st_key {
81
unsigned int key_length; /* Tot length of key */
82
enum ha_key_alg algorithm;
83
unsigned long flags; /* dupp key and pack flags */
84
unsigned int key_parts; /* How many key_parts */
85
uint32_t extra_length;
86
unsigned int usable_key_parts; /* Should normally be = key_parts */
88
KEY_PART_INFO *key_part;
89
char *name; /* Name of key */
91
Array of AVG(#records with the same field value) for 1st ... Nth key part.
93
For temporary heap tables this member is NULL.
103
struct RegInfo { /* Extra info about reg */
104
JoinTable *join_tab; /* Used by SELECT() */
105
enum thr_lock_type lock_type; /* How database is used */
106
bool not_exists_optimize;
107
bool impossible_range;
109
: join_tab(NULL), lock_type(TL_UNLOCK),
110
not_exists_optimize(false), impossible_range(false) {}
114
lock_type= TL_UNLOCK;
115
not_exists_optimize= false;
116
impossible_range= false;
120
struct st_read_record; /* For referense later */
123
namespace drizzled { namespace optimizer { class SqlSelect; } }
125
typedef struct st_read_record { /* Parameter to read_record */
126
Table *table; /* Head-form */
128
Table **forms; /* head and ref forms */
129
int (*read_record)(struct st_read_record *);
131
drizzled::optimizer::SqlSelect *select;
132
uint32_t cache_records;
133
uint32_t ref_length,struct_length,reclength,rec_cache_size,error_offset;
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;
140
bool print_error, ignore_not_found_rows;
141
JoinTable *do_insideout_scan;
144
extern const char *show_comp_option_name[];
146
typedef int *(*update_var)(Session *, struct drizzle_show_var *);
148
/* Bits in form->status */
149
#define STATUS_NO_RECORD (1+2) /* Record isn't usably */
150
#define STATUS_GARBAGE 1
151
#define STATUS_NOT_FOUND 2 /* No record in database when needed */
152
#define STATUS_NO_PARENT 4 /* Parent record wasn't found */
153
#define STATUS_NOT_READ 8 /* Record isn't read */
154
#define STATUS_UPDATED 16 /* Record is updated by formula */
155
#define STATUS_NULL_ROW 32 /* table->null_row is set */
156
#define STATUS_DELETED 64
158
#endif /* DRIZZLED_STRUCTS_H */