1
/* Copyright (C) 2000-2006 MySQL 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; version 2 of the License.
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
GNU General Public License for more details.
12
You should have received a copy of the GNU General Public License
13
along with this program; if not, write to the Free Software
14
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
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
17
21
/* The old structures from unireg */
23
#ifndef DRIZZLED_STRUCTS_H
24
#define DRIZZLED_STRUCTS_H
26
#include <drizzled/base.h>
27
#include <mysys/definitions.h>
28
#include <drizzled/lex_string.h>
32
typedef struct st_io_cache IO_CACHE;
22
34
typedef struct st_date_time_format {
35
unsigned char positions[8];
24
36
char time_separator; /* Separator between hour and minute */
25
uint flag; /* For future */
37
uint32_t flag; /* For future */
27
39
} DATE_TIME_FORMAT;
30
42
typedef struct st_keyfile_info { /* used with ha_info() */
31
uchar ref[MAX_REFLENGTH]; /* Pointer to current row */
32
uchar dupp_ref[MAX_REFLENGTH]; /* Pointer to dupp row */
33
uint ref_length; /* Length of ref (1-8) */
34
uint block_size; /* index block size */
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 */
35
47
File filenr; /* (uniq) filenr for table */
36
48
ha_rows records; /* Records i datafilen */
37
49
ha_rows deleted; /* Deleted records */
106
118
struct st_read_record; /* For referense later */
107
119
class SQL_SELECT;
110
122
struct st_join_table;
112
124
typedef struct st_read_record { /* Parameter to read_record */
113
struct st_table *table; /* Head-form */
125
Table *table; /* Head-form */
115
struct st_table **forms; /* head and ref forms */
127
Table **forms; /* head and ref forms */
116
128
int (*read_record)(struct st_read_record *);
118
130
SQL_SELECT *select;
120
uint ref_length,struct_length,reclength,rec_cache_size,error_offset;
122
uchar *ref_pos; /* pointer to form->refpos */
124
uchar *rec_buf; /* to read field values after filesort */
125
uchar *cache,*cache_pos,*cache_end,*read_positions;
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;
126
138
IO_CACHE *io_cache;
127
139
bool print_error, ignore_not_found_rows;
128
140
struct st_join_table *do_insideout_scan;
133
Originally MySQL used DRIZZLE_TIME structure inside server only, but since
134
4.1 it's exported to user in the new client API. Define aliases for
135
new names to keep existing code simple.
138
typedef enum enum_drizzle_timestamp_type timestamp_type;
142
ulong year,month,day,hour;
143
149
uint64_t minute,second,second_part;
152
158
const char *time_format;
153
159
} KNOWN_DATE_TIME_FORMAT;
155
enum SHOW_COMP_OPTION { SHOW_OPTION_YES, SHOW_OPTION_NO, SHOW_OPTION_DISABLED};
157
162
extern const char *show_comp_option_name[];
159
typedef int *(*update_var)(THD *, struct st_mysql_show_var *);
164
typedef int *(*update_var)(Session *, struct st_mysql_show_var *);
161
166
typedef struct st_lex_user {
162
167
LEX_STRING user, host, password;
166
This structure specifies the maximum amount of resources which
167
can be consumed by each account. Zero value of a member means
170
typedef struct user_resources {
171
/* Maximum number of queries/statements per hour. */
174
Maximum number of updating statements per hour (which statements are
175
updating is defined by sql_command_flags array).
178
/* Maximum number of connections established per hour. */
180
/* Maximum number of concurrent connections. */
183
Values of this enum and specified_limits member are used by the
184
parser to store which user limits were specified in GRANT statement.
186
enum {QUERIES_PER_HOUR= 1, UPDATES_PER_HOUR= 2, CONNECTIONS_PER_HOUR= 4,
187
USER_CONNECTIONS= 8};
188
uint specified_limits;
193
171
This structure is used for counting resources consumed and for checking
194
172
them against specified user limits.
210
188
uint64_t reset_utime;
211
189
/* Total length of the key. */
213
191
/* Current amount of concurrent connections for this account. */
192
uint32_t connections;
216
194
Current number of connections per hour, number of updating statements
217
195
per hour and total number of statements per hour for this account.
219
uint conn_per_hour, updates, questions;
220
/* Maximum amount of resources which account is allowed to consume. */
221
USER_RESOURCES user_resources;
197
uint32_t conn_per_hour, updates, questions;
224
200
/* Bits in form->update */
248
224
{ auto_inc_interval_min + k * increment,
249
225
0 <= k <= (auto_inc_interval_values-1) }
250
226
Where "increment" is maintained separately by the user of this class (and is
251
currently only thd->variables.auto_increment_increment).
227
currently only session->variables.auto_increment_increment).
252
228
It mustn't derive from Sql_alloc, because SET INSERT_ID needs to
253
229
allocate memory which must stay allocated for use by the next statement.
266
242
interval_max= (val == UINT64_MAX) ? val : start + val * incr;
268
244
Discrete_interval(uint64_t start, uint64_t val, uint64_t incr) :
269
next(NULL) { replace(start, val, incr); };
270
Discrete_interval() : next(NULL) { replace(0, 0, 0); };
245
interval_min(start), interval_values(val),
246
interval_max((val == UINT64_MAX) ? val : start + val * incr),
249
Discrete_interval() :
250
interval_min(0), interval_values(0),
251
interval_max(0), next(NULL)
271
253
uint64_t minimum() const { return interval_min; };
272
254
uint64_t values() const { return interval_values; };
273
255
uint64_t maximum() const { return interval_max; };
322
Discrete_intervals_list() : head(NULL), current(NULL), elements(0) {};
323
Discrete_intervals_list(const Discrete_intervals_list& from)
304
Discrete_intervals_list() :
305
head(NULL), tail(NULL),
306
current(NULL), elements(0) {};
307
Discrete_intervals_list(const Discrete_intervals_list& from) :
308
head(NULL), tail(NULL),
309
current(NULL), elements(0)
327
void operator=(const Discrete_intervals_list& from)
313
Discrete_intervals_list& operator=(const Discrete_intervals_list& from)
332
319
void empty_no_free()