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_keyfile_info { /* used with ha_info() */
35
unsigned char ref[MAX_REFLENGTH]; /* Pointer to current row */
36
unsigned char dupp_ref[MAX_REFLENGTH]; /* Pointer to dupp row */
37
uint32_t ref_length; /* Length of ref (1-8) */
38
uint32_t block_size; /* index block size */
39
File filenr; /* (uniq) filenr for table */
40
ha_rows records; /* Records i datafilen */
41
ha_rows deleted; /* Deleted records */
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;
48
int errkey,sortkey; /* Last errorkey and sorted by */
49
time_t create_time; /* When table was created */
52
uint64_t mean_rec_length; /* physical reclength */
56
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 */
58
uint offset; /* offset in record (from 0) */
59
uint null_offset; /* Offset to null_bit in record */
48
60
/* Length of key part in bytes, excluding NULL flag and length bytes */
58
70
uint16_t store_length;
62
uint16_t getKeyType() const
66
72
uint16_t fieldnr; /* Fieldnum in UNIREG (1,2,3,...) */
67
73
uint16_t key_part_flag; /* 0 or HA_REVERSE_SORT */
69
75
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 */
79
typedef struct st_key {
80
uint key_length; /* Tot length of key */
81
ulong flags; /* dupp key and pack flags */
82
uint key_parts; /* How many key_parts */
80
83
uint32_t extra_length;
81
unsigned int usable_key_parts; /* Should normally be = key_parts */
84
uint usable_key_parts; /* Should normally be = key_parts */
82
85
uint32_t block_size;
83
KeyPartInfo *key_part;
86
enum ha_key_alg algorithm;
87
KEY_PART_INFO *key_part;
84
88
char *name; /* Name of key */
86
90
Array of AVG(#records with the same field value) for 1st ... Nth key part.
90
94
ulong *rec_per_key;
92
96
LEX_STRING comment;
100
public: /* Extra info about reg */
101
JoinTable *join_tab; /* Used by SELECT() */
100
struct st_join_table;
102
typedef struct st_reginfo { /* Extra info about reg */
103
struct st_join_table *join_tab; /* Used by SELECT() */
102
104
enum thr_lock_type lock_type; /* How database is used */
103
105
bool not_exists_optimize;
104
106
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;
110
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 */
114
struct st_join_table;
116
typedef struct st_read_record { /* Parameter to read_record */
117
Table *table; /* Head-form */
119
Table **forms; /* head and ref forms */
120
int (*read_record)(struct st_read_record *);
123
uint32_t cache_records;
124
uint32_t ref_length,struct_length,reclength,rec_cache_size,error_offset;
126
unsigned char *ref_pos; /* pointer to form->refpos */
127
unsigned char *record;
128
unsigned char *rec_buf; /* to read field values after filesort */
129
unsigned char *cache,*cache_pos,*cache_end,*read_positions;
131
bool print_error, ignore_not_found_rows;
132
struct st_join_table *do_insideout_scan;
141
uint64_t minute,second,second_part;
145
extern const char *show_comp_option_name[];
147
typedef int *(*update_var)(Session *, struct st_mysql_show_var *);
149
typedef struct st_lex_user {
150
LEX_STRING user, host, password;
154
This structure is used for counting resources consumed and for checking
155
them against specified user limits.
157
typedef struct user_conn {
159
Pointer to user+host key (pair separated by '\0') defining the entity
160
for which resources are counted (By default it is user account thus
161
priv_user/priv_host pair is used. If --old-style-user-limits option
162
is enabled, resources are counted for each user+host separately).
165
/* Pointer to host part of the key. */
168
The moment of time when per hour counters were reset last time
169
(i.e. start of "hour" for conn_per_hour, updates, questions counters).
171
uint64_t reset_utime;
172
/* Total length of the key. */
174
/* Current amount of concurrent connections for this account. */
175
uint32_t connections;
177
Current number of connections per hour, number of updating statements
178
per hour and total number of statements per hour for this account.
180
uint32_t conn_per_hour, updates, questions;
183
/* Bits in form->update */
184
#define REG_MAKE_DUPP 1 /* Make a copy of record when read */
185
#define REG_NEW_RECORD 2 /* Write a new record if not found */
186
#define REG_UPDATE 4 /* Uppdate record */
187
#define REG_DELETE 8 /* Delete found record */
188
#define REG_PROG 16 /* User is updating database */
189
#define REG_CLEAR_AFTER_WRITE 32
190
#define REG_MAY_BE_UPDATED 64
191
#define REG_AUTO_UPDATE 64 /* Used in D-forms for scroll-tables */
192
#define REG_OVERWRITE 128
193
#define REG_SKIP_DUP 256
125
195
/* Bits in form->status */
126
196
#define STATUS_NO_RECORD (1+2) /* Record isn't usably */