~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/structs.h

  • Committer: Brian Aker
  • Date: 2009-02-05 10:38:55 UTC
  • Revision ID: brian@tangent.org-20090205103855-wajzccrbu7zbvmh4
Reworked some classes out of session.h
Also updated ignore file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
/* The old structures from unireg */
22
22
 
 
23
#ifndef DRIZZLED_STRUCTS_H
 
24
#define DRIZZLED_STRUCTS_H
 
25
 
 
26
#include <drizzled/base.h>
 
27
#include <mysys/definitions.h>
 
28
#include <drizzled/lex_string.h>
 
29
 
23
30
class Table;
24
31
class Field;
 
32
typedef struct st_io_cache IO_CACHE;
25
33
 
26
34
typedef struct st_date_time_format {
27
35
  unsigned char positions[8];
49
57
  time_t create_time;                   /* When table was created */
50
58
  time_t check_time;
51
59
  time_t update_time;
52
 
  ulong mean_rec_length;                /* physical reclength */
 
60
  uint64_t mean_rec_length;             /* physical reclength */
53
61
} KEYFILE_INFO;
54
62
 
55
63
 
109
117
 
110
118
struct st_read_record;                          /* For referense later */
111
119
class SQL_SELECT;
112
 
class THD;
 
120
class Session;
113
121
class handler;
114
122
struct st_join_table;
115
123
 
118
126
  handler *file;
119
127
  Table **forms;                        /* head and ref forms */
120
128
  int (*read_record)(struct st_read_record *);
121
 
  THD *thd;
 
129
  Session *session;
122
130
  SQL_SELECT *select;
123
131
  uint32_t cache_records;
124
132
  uint32_t ref_length,struct_length,reclength,rec_cache_size,error_offset;
134
142
 
135
143
 
136
144
typedef struct {
137
 
  ulong year,month,day,hour;
 
145
  uint32_t year;
 
146
  uint32_t month;
 
147
  uint32_t day;
 
148
  uint32_t hour;
138
149
  uint64_t minute,second,second_part;
139
150
  bool neg;
140
151
} INTERVAL;
147
158
  const char *time_format;
148
159
} KNOWN_DATE_TIME_FORMAT;
149
160
 
150
 
enum SHOW_COMP_OPTION { SHOW_OPTION_YES, SHOW_OPTION_NO, SHOW_OPTION_DISABLED};
151
161
 
152
162
extern const char *show_comp_option_name[];
153
163
 
154
 
typedef int *(*update_var)(THD *, struct st_mysql_show_var *);
 
164
typedef int *(*update_var)(Session *, struct st_mysql_show_var *);
155
165
 
156
166
typedef struct  st_lex_user {
157
167
  LEX_STRING user, host, password;
158
168
} LEX_USER;
159
169
 
160
170
/*
161
 
  This structure specifies the maximum amount of resources which
162
 
  can be consumed by each account. Zero value of a member means
163
 
  there is no limit.
164
 
*/
165
 
typedef struct user_resources {
166
 
  /* Maximum number of queries/statements per hour. */
167
 
  uint32_t questions;
168
 
  /*
169
 
     Maximum number of updating statements per hour (which statements are
170
 
     updating is defined by sql_command_flags array).
171
 
  */
172
 
  uint32_t updates;
173
 
  /* Maximum number of connections established per hour. */
174
 
  uint32_t conn_per_hour;
175
 
  /* Maximum number of concurrent connections. */
176
 
  uint32_t user_conn;
177
 
  /*
178
 
     Values of this enum and specified_limits member are used by the
179
 
     parser to store which user limits were specified in GRANT statement.
180
 
  */
181
 
  enum {QUERIES_PER_HOUR= 1, UPDATES_PER_HOUR= 2, CONNECTIONS_PER_HOUR= 4,
182
 
        USER_CONNECTIONS= 8};
183
 
  uint32_t specified_limits;
184
 
} USER_RESOURCES;
185
 
 
186
 
 
187
 
/*
188
171
  This structure is used for counting resources consumed and for checking
189
172
  them against specified user limits.
190
173
*/
212
195
     per hour and total number of statements per hour for this account.
213
196
  */
214
197
  uint32_t conn_per_hour, updates, questions;
215
 
  /* Maximum amount of resources which account is allowed to consume. */
216
 
  USER_RESOURCES user_resources;
217
198
} USER_CONN;
218
199
 
219
200
        /* Bits in form->update */
243
224
  { auto_inc_interval_min + k * increment,
244
225
    0 <= k <= (auto_inc_interval_values-1) }
245
226
  Where "increment" is maintained separately by the user of this class (and is
246
 
  currently only thd->variables.auto_increment_increment).
 
227
  currently only session->variables.auto_increment_increment).
247
228
  It mustn't derive from Sql_alloc, because SET INSERT_ID needs to
248
229
  allocate memory which must stay allocated for use by the next statement.
249
230
*/
261
242
    interval_max=    (val == UINT64_MAX) ? val : start + val * incr;
262
243
  }
263
244
  Discrete_interval(uint64_t start, uint64_t val, uint64_t incr) :
264
 
    next(NULL) { replace(start, val, incr); };
265
 
  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),
 
247
    next(NULL)
 
248
  {};
 
249
  Discrete_interval() :
 
250
    interval_min(0), interval_values(0),
 
251
    interval_max(0), next(NULL)
 
252
  {};
266
253
  uint64_t minimum() const { return interval_min;    };
267
254
  uint64_t values()  const { return interval_values; };
268
255
  uint64_t maximum() const { return interval_max;    };
314
301
    }
315
302
  }
316
303
public:
317
 
  Discrete_intervals_list() : head(NULL), current(NULL), elements(0) {};
318
 
  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)
319
310
  {
320
311
    copy_(from);
321
312
  }
322
 
  void operator=(const Discrete_intervals_list& from)
 
313
  Discrete_intervals_list& operator=(const Discrete_intervals_list& from)
323
314
  {
324
315
    empty();
325
316
    copy_(from);
 
317
    return *this;
326
318
  }
327
319
  void empty_no_free()
328
320
  {
354
346
  uint64_t maximum()     const { return (head ? tail->maximum() : 0); };
355
347
  uint32_t      nb_elements() const { return elements; }
356
348
};
 
349
 
 
350
#endif /* DRIZZLED_STRUCTS_H */