1
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
3
This program is free software; you can redistribute it and/or modify
4
it under the terms of the GNU General Public License as published by
5
the Free Software Foundation; either version 2 of the License, or
6
(at your option) any later version.
8
This program is distributed in the hope that it will be useful,
9
but WITHOUT ANY WARRANTY; without even the implied warranty of
10
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
GNU General Public License for more details.
13
You should have received a copy of the GNU General Public License
14
along with this program; if not, write to the Free Software
15
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
18
/* The old structures from unireg */
23
namespace mysql_parser
29
typedef struct st_lex_string
35
typedef struct st_lex_string_with_init :public st_lex_string
37
st_lex_string_with_init(const char *str_arg, uint length_arg)
42
} LEX_STRING_WITH_INIT;
45
typedef struct st_date_time_format {
47
char time_separator; /* Separator between hour and minute */
48
uint flag; /* For future */
53
typedef struct st_keyfile_info { /* used with ha_info() */
54
byte ref[MAX_REFLENGTH]; /* Pointer to current row */
55
byte dupp_ref[MAX_REFLENGTH]; /* Pointer to dupp row */
56
uint ref_length; /* Length of ref (1-8) */
57
uint block_size; /* index block size */
58
File filenr; /* (uniq) filenr for table */
59
ha_rows records; /* Records i datafilen */
60
ha_rows deleted; /* Deleted records */
61
ulonglong data_file_length; /* Length off data file */
62
ulonglong max_data_file_length; /* Length off data file */
63
ulonglong index_file_length;
64
ulonglong max_index_file_length;
65
ulonglong delete_length; /* Free bytes */
66
ulonglong auto_increment_value;
67
int errkey,sortkey; /* Last errorkey and sorted by */
68
time_t create_time; /* When table was created */
71
ulong mean_rec_length; /* physical reclength */
75
typedef struct st_key_part_info { /* Info about a key part */
77
uint offset; /* offset in record (from 0) */
78
uint null_offset; /* Offset to null_bit in record */
79
uint16 length; /* Length of key_part */
82
uint16 fieldnr; /* Fieldnum in UNIREG */
83
uint16 key_part_flag; /* 0 or HA_REVERSE_SORT */
85
uint8 null_bit; /* Position to null_bit */
89
typedef struct st_key {
90
uint key_length; /* Tot length of key */
91
uint flags; /* dupp key and pack flags */
92
uint key_parts; /* How many key_parts */
94
uint usable_key_parts; /* Should normally be = key_parts */
95
// enum ha_key_alg algorithm;
97
Note that parser is used when the table is opened for use, and
98
parser_name is used when the table is being created.
102
struct st_plugin_int *parser; /* Fulltext [pre]parser */
103
LEX_STRING *parser_name; /* Fulltext [pre]parser name */
105
KEY_PART_INFO *key_part;
106
char *name; /* Name of key */
108
Array of AVG(#records with the same field value) for 1st ... Nth key part.
110
For temporary heap tables this member is NULL.
114
int bdb_return_if_eq;
116
struct st_table *table;
120
struct st_join_table;
122
typedef struct st_reginfo { /* Extra info about reg */
123
struct st_join_table *join_tab; /* Used by SELECT() */
124
//enum thr_lock_type lock_type; /* How database is used */
125
bool not_exists_optimize;
126
bool impossible_range;
130
struct st_read_record; /* For referense later */
135
typedef struct st_read_record { /* Parameter to read_record */
136
struct st_table *table; /* Head-form */
138
struct st_table **forms; /* head and ref forms */
139
int (*read_record)(struct st_read_record *);
141
//SQL_SELECT *select;
143
uint ref_length,struct_length,reclength,rec_cache_size,error_offset;
145
byte *ref_pos; /* pointer to form->refpos */
147
byte *rec_buf; /* to read field values after filesort */
148
byte *cache,*cache_pos,*cache_end,*read_positions;
149
//IO_CACHE *io_cache;
150
bool print_error, ignore_not_found_rows;
155
Originally MySQL used TIME structure inside server only, but since
156
4.1 it's exported to user in the new client API. Define aliases for
157
new names to keep existing code simple.
160
typedef struct st_mysql_time TIME;
161
//typedef enum enum_mysql_timestamp_type timestamp_type;
165
ulong year,month,day,hour;
166
ulonglong minute,second,second_part;
171
typedef struct st_known_date_time_format {
172
const char *format_name;
173
const char *date_format;
174
const char *datetime_format;
175
const char *time_format;
176
} KNOWN_DATE_TIME_FORMAT;
178
enum SHOW_COMP_OPTION { SHOW_OPTION_YES, SHOW_OPTION_NO, SHOW_OPTION_DISABLED};
180
extern const char *show_comp_option_name[];
182
//typedef int *(*update_var)(THD *, struct st_mysql_show_var *);
184
typedef struct st_lex_user {
185
LEX_STRING user, host, password;
189
This structure specifies the maximum amount of resources which
190
can be consumed by each account. Zero value of a member means
193
typedef struct user_resources {
194
/* Maximum number of queries/statements per hour. */
197
Maximum number of updating statements per hour (which statements are
198
updating is defined by uc_update_queries array).
201
/* Maximum number of connections established per hour. */
203
/* Maximum number of concurrent connections. */
206
Values of this enum and specified_limits member are used by the
207
parser to store which user limits were specified in GRANT statement.
209
enum {QUERIES_PER_HOUR= 1, UPDATES_PER_HOUR= 2, CONNECTIONS_PER_HOUR= 4,
210
USER_CONNECTIONS= 8};
211
uint specified_limits;
216
This structure is used for counting resources consumed and for checking
217
them against specified user limits.
219
typedef struct user_conn {
221
Pointer to user+host key (pair separated by '\0') defining the entity
222
for which resources are counted (By default it is user account thus
223
priv_user/priv_host pair is used. If --old-style-user-limits option
224
is enabled, resources are counted for each user+host separately).
227
/* Pointer to host part of the key. */
229
/* Total length of the key. */
231
/* Current amount of concurrent connections for this account. */
234
Current number of connections per hour, number of updating statements
235
per hour and total number of statements per hour for this account.
237
uint conn_per_hour, updates, questions;
238
/* Maximum amount of resources which account is allowed to consume. */
239
USER_RESOURCES user_resources;
241
The moment of time when per hour counters were reset last time
242
(i.e. start of "hour" for conn_per_hour, updates, questions counters).
247
/* Bits in form->update */
248
#define REG_MAKE_DUPP 1 /* Make a copy of record when read */
249
#define REG_NEW_RECORD 2 /* Write a new record if not found */
250
#define REG_UPDATE 4 /* Uppdate record */
251
#define REG_DELETE 8 /* Delete found record */
252
#define REG_PROG 16 /* User is updating database */
253
#define REG_CLEAR_AFTER_WRITE 32
254
#define REG_MAY_BE_UPDATED 64
255
#define REG_AUTO_UPDATE 64 /* Used in D-forms for scroll-tables */
256
#define REG_OVERWRITE 128
257
#define REG_SKIP_DUP 256
259
/* Bits in form->status */
260
#define STATUS_NO_RECORD (1+2) /* Record isn't usably */
261
#define STATUS_GARBAGE 1
262
#define STATUS_NOT_FOUND 2 /* No record in database when needed */
263
#define STATUS_NO_PARENT 4 /* Parent record wasn't found */
264
#define STATUS_NOT_READ 8 /* Record isn't read */
265
#define STATUS_UPDATED 16 /* Record is updated by formula */
266
#define STATUS_NULL_ROW 32 /* table->null_row is set */
267
#define STATUS_DELETED 64
270
} // namespace mysql_parser
272
#endif // __STRUCTS_H__