23
23
#ifndef DRIZZLED_STRUCTS_H
24
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;
26
#include <drizzled/base.h>
27
#include <mysys/definitions.h>
28
#include <drizzled/lex_string.h>
43
{ /* Info about a key part */
32
typedef struct st_io_cache IO_CACHE;
34
typedef struct st_date_time_format {
35
unsigned char positions[8];
36
char time_separator; /* Separator between hour and minute */
37
uint32_t flag; /* For future */
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
File 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 */
46
unsigned int offset; /* offset in record (from 0) */
47
unsigned int null_offset; /* Offset to null_bit in record */
66
uint offset; /* offset in record (from 0) */
67
uint null_offset; /* Offset to null_bit in record */
48
68
/* Length of key part in bytes, excluding NULL flag and length bytes */
58
78
uint16_t store_length;
62
uint16_t getKeyType() const
66
80
uint16_t fieldnr; /* Fieldnum in UNIREG (1,2,3,...) */
67
81
uint16_t key_part_flag; /* 0 or HA_REVERSE_SORT */
69
83
uint8_t null_bit; /* Position to null_bit */
76
unsigned int key_length; /* Tot length of key */
77
enum ha_key_alg algorithm;
78
unsigned long flags; /* dupp key and pack flags */
79
unsigned int key_parts; /* How many key_parts */
87
typedef struct st_key {
88
uint key_length; /* Tot length of key */
89
ulong flags; /* dupp key and pack flags */
90
uint key_parts; /* How many key_parts */
80
91
uint32_t extra_length;
81
unsigned int usable_key_parts; /* Should normally be = key_parts */
92
uint usable_key_parts; /* Should normally be = key_parts */
82
93
uint32_t block_size;
83
KeyPartInfo *key_part;
94
enum ha_key_alg algorithm;
95
KEY_PART_INFO *key_part;
84
96
char *name; /* Name of key */
86
98
Array of AVG(#records with the same field value) for 1st ... Nth key part.
90
102
ulong *rec_per_key;
92
104
LEX_STRING comment;
100
public: /* Extra info about reg */
101
JoinTable *join_tab; /* Used by SELECT() */
108
struct st_join_table;
110
typedef struct st_reginfo { /* Extra info about reg */
111
struct st_join_table *join_tab; /* Used by SELECT() */
102
112
enum thr_lock_type lock_type; /* How database is used */
103
113
bool not_exists_optimize;
104
114
bool impossible_range;
106
: join_tab(NULL), lock_type(TL_UNLOCK),
107
not_exists_optimize(false), impossible_range(false) {}
111
lock_type= TL_UNLOCK;
112
not_exists_optimize= false;
113
impossible_range= false;
118
struct st_read_record; /* For referense later */
119
namespace optimizer { class SqlSelect; }
121
typedef int *(*update_var)(Session *, struct drizzle_show_var *);
123
} /* namespace drizzled */
122
struct st_join_table;
124
typedef struct st_read_record { /* Parameter to read_record */
125
Table *table; /* Head-form */
127
Table **forms; /* head and ref forms */
128
int (*read_record)(struct st_read_record *);
131
uint32_t cache_records;
132
uint32_t ref_length,struct_length,reclength,rec_cache_size,error_offset;
134
unsigned char *ref_pos; /* pointer to form->refpos */
135
unsigned char *record;
136
unsigned char *rec_buf; /* to read field values after filesort */
137
unsigned char *cache,*cache_pos,*cache_end,*read_positions;
139
bool print_error, ignore_not_found_rows;
140
struct st_join_table *do_insideout_scan;
149
uint64_t minute,second,second_part;
154
typedef struct st_known_date_time_format {
155
const char *format_name;
156
const char *date_format;
157
const char *datetime_format;
158
const char *time_format;
159
} KNOWN_DATE_TIME_FORMAT;
162
extern const char *show_comp_option_name[];
164
typedef int *(*update_var)(Session *, struct st_mysql_show_var *);
166
typedef struct st_lex_user {
167
LEX_STRING user, host, password;
171
This structure is used for counting resources consumed and for checking
172
them against specified user limits.
174
typedef struct user_conn {
176
Pointer to user+host key (pair separated by '\0') defining the entity
177
for which resources are counted (By default it is user account thus
178
priv_user/priv_host pair is used. If --old-style-user-limits option
179
is enabled, resources are counted for each user+host separately).
182
/* Pointer to host part of the key. */
185
The moment of time when per hour counters were reset last time
186
(i.e. start of "hour" for conn_per_hour, updates, questions counters).
188
uint64_t reset_utime;
189
/* Total length of the key. */
191
/* Current amount of concurrent connections for this account. */
192
uint32_t connections;
194
Current number of connections per hour, number of updating statements
195
per hour and total number of statements per hour for this account.
197
uint32_t conn_per_hour, updates, questions;
200
/* Bits in form->update */
201
#define REG_MAKE_DUPP 1 /* Make a copy of record when read */
202
#define REG_NEW_RECORD 2 /* Write a new record if not found */
203
#define REG_UPDATE 4 /* Uppdate record */
204
#define REG_DELETE 8 /* Delete found record */
205
#define REG_PROG 16 /* User is updating database */
206
#define REG_CLEAR_AFTER_WRITE 32
207
#define REG_MAY_BE_UPDATED 64
208
#define REG_AUTO_UPDATE 64 /* Used in D-forms for scroll-tables */
209
#define REG_OVERWRITE 128
210
#define REG_SKIP_DUP 256
125
212
/* Bits in form->status */
126
213
#define STATUS_NO_RECORD (1+2) /* Record isn't usably */