~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/structs.h

  • Committer: Monty Taylor
  • Date: 2008-10-16 06:32:30 UTC
  • mto: (511.1.5 codestyle)
  • mto: This revision was merged to the branch mainline in revision 521.
  • Revision ID: monty@inaugust.com-20081016063230-4brxsra0qsmsg84q
Added -Wunused-macros.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2000-2006 MySQL AB
2
 
 
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.
6
 
 
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.
11
 
 
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 */
15
 
 
 
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
 
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
 
3
 *
 
4
 *  Copyright (C) 2008 Sun Microsystems
 
5
 *
 
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.
 
10
 *
 
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.
 
15
 *
 
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
 
19
 */
16
20
 
17
21
/* The old structures from unireg */
18
22
 
19
 
struct st_table;
 
23
#include <mysys/iocache.h>
 
24
 
 
25
class Table;
20
26
class Field;
21
27
 
22
28
typedef struct st_date_time_format {
23
 
  uchar positions[8];
 
29
  unsigned char positions[8];
24
30
  char  time_separator;                 /* Separator between hour and minute */
25
 
  uint flag;                            /* For future */
 
31
  uint32_t flag;                                /* For future */
26
32
  LEX_STRING format;
27
33
} DATE_TIME_FORMAT;
28
34
 
29
35
 
30
36
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 */
 
37
  unsigned char ref[MAX_REFLENGTH];             /* Pointer to current row */
 
38
  unsigned char dupp_ref[MAX_REFLENGTH];        /* Pointer to dupp row */
 
39
  uint32_t ref_length;                  /* Length of ref (1-8) */
 
40
  uint32_t block_size;                  /* index block size */
35
41
  File filenr;                          /* (uniq) filenr for table */
36
42
  ha_rows records;                      /* Records i datafilen */
37
43
  ha_rows deleted;                      /* Deleted records */
54
60
  uint  offset;                         /* offset in record (from 0) */
55
61
  uint  null_offset;                    /* Offset to null_bit in record */
56
62
  /* Length of key part in bytes, excluding NULL flag and length bytes */
57
 
  uint16 length;
 
63
  uint16_t length;
58
64
  /*
59
65
    Number of bytes required to store the keypart value. This may be
60
66
    different from the "length" field as it also counts
63
69
       actual value is stored from offset+1].
64
70
     - possible HA_KEY_BLOB_LENGTH bytes needed to store actual value length.
65
71
  */
66
 
  uint16 store_length;
67
 
  uint16 key_type;
68
 
  uint16 fieldnr;                       /* Fieldnum in UNIREG (1,2,3,...) */
69
 
  uint16 key_part_flag;                 /* 0 or HA_REVERSE_SORT */
70
 
  uint8 type;
71
 
  uint8 null_bit;                       /* Position to null_bit */
 
72
  uint16_t store_length;
 
73
  uint16_t key_type;
 
74
  uint16_t fieldnr;                     /* Fieldnum in UNIREG (1,2,3,...) */
 
75
  uint16_t key_part_flag;                       /* 0 or HA_REVERSE_SORT */
 
76
  uint8_t type;
 
77
  uint8_t null_bit;                     /* Position to null_bit */
72
78
} KEY_PART_INFO ;
73
79
 
74
80
 
76
82
  uint  key_length;                     /* Tot length of key */
77
83
  ulong flags;                          /* dupp key and pack flags */
78
84
  uint  key_parts;                      /* How many key_parts */
79
 
  uint  extra_length;
 
85
  uint32_t  extra_length;
80
86
  uint  usable_key_parts;               /* Should normally be = key_parts */
81
 
  uint  block_size;
 
87
  uint32_t  block_size;
82
88
  enum  ha_key_alg algorithm;
83
89
  KEY_PART_INFO *key_part;
84
90
  char  *name;                          /* Name of key */
88
94
    For temporary heap tables this member is NULL.
89
95
  */
90
96
  ulong *rec_per_key;
91
 
  struct st_table *table;
 
97
  Table *table;
92
98
  LEX_STRING comment;
93
99
} KEY;
94
100
 
110
116
struct st_join_table;
111
117
 
112
118
typedef struct st_read_record {                 /* Parameter to read_record */
113
 
  struct st_table *table;                       /* Head-form */
 
119
  Table *table;                 /* Head-form */
114
120
  handler *file;
115
 
  struct st_table **forms;                      /* head and ref forms */
 
121
  Table **forms;                        /* head and ref forms */
116
122
  int (*read_record)(struct st_read_record *);
117
123
  THD *thd;
118
124
  SQL_SELECT *select;
119
 
  uint cache_records;
120
 
  uint ref_length,struct_length,reclength,rec_cache_size,error_offset;
121
 
  uint index;
122
 
  uchar *ref_pos;                               /* pointer to form->refpos */
123
 
  uchar *record;
124
 
  uchar *rec_buf;                /* to read field values  after filesort */
125
 
  uchar *cache,*cache_pos,*cache_end,*read_positions;
 
125
  uint32_t cache_records;
 
126
  uint32_t ref_length,struct_length,reclength,rec_cache_size,error_offset;
 
127
  uint32_t index;
 
128
  unsigned char *ref_pos;                               /* pointer to form->refpos */
 
129
  unsigned char *record;
 
130
  unsigned char *rec_buf;                /* to read field values  after filesort */
 
131
  unsigned char *cache,*cache_pos,*cache_end,*read_positions;
126
132
  IO_CACHE *io_cache;
127
133
  bool print_error, ignore_not_found_rows;
128
134
  struct st_join_table *do_insideout_scan;
129
135
} READ_RECORD;
130
136
 
131
137
 
132
 
/*
133
 
  Originally MySQL used MYSQL_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.
136
 
*/
137
 
 
138
 
typedef enum enum_mysql_timestamp_type timestamp_type;
139
 
 
140
 
 
141
138
typedef struct {
142
139
  ulong year,month,day,hour;
143
140
  uint64_t minute,second,second_part;
169
166
*/
170
167
typedef struct user_resources {
171
168
  /* Maximum number of queries/statements per hour. */
172
 
  uint questions;
 
169
  uint32_t questions;
173
170
  /*
174
171
     Maximum number of updating statements per hour (which statements are
175
172
     updating is defined by sql_command_flags array).
176
173
  */
177
 
  uint updates;
 
174
  uint32_t updates;
178
175
  /* Maximum number of connections established per hour. */
179
 
  uint conn_per_hour;
 
176
  uint32_t conn_per_hour;
180
177
  /* Maximum number of concurrent connections. */
181
 
  uint user_conn;
 
178
  uint32_t user_conn;
182
179
  /*
183
180
     Values of this enum and specified_limits member are used by the
184
181
     parser to store which user limits were specified in GRANT statement.
185
182
  */
186
183
  enum {QUERIES_PER_HOUR= 1, UPDATES_PER_HOUR= 2, CONNECTIONS_PER_HOUR= 4,
187
184
        USER_CONNECTIONS= 8};
188
 
  uint specified_limits;
 
185
  uint32_t specified_limits;
189
186
} USER_RESOURCES;
190
187
 
191
188
 
209
206
  */
210
207
  uint64_t reset_utime;
211
208
  /* Total length of the key. */
212
 
  uint len;
 
209
  uint32_t len;
213
210
  /* Current amount of concurrent connections for this account. */
214
 
  uint connections;
 
211
  uint32_t connections;
215
212
  /*
216
213
     Current number of connections per hour, number of updating statements
217
214
     per hour and total number of statements per hour for this account.
218
215
  */
219
 
  uint conn_per_hour, updates, questions;
 
216
  uint32_t conn_per_hour, updates, questions;
220
217
  /* Maximum amount of resources which account is allowed to consume. */
221
218
  USER_RESOURCES user_resources;
222
219
} USER_CONN;
266
263
    interval_max=    (val == UINT64_MAX) ? val : start + val * incr;
267
264
  }
268
265
  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); };
 
266
    interval_min(start), interval_values(val),
 
267
    interval_max((val == UINT64_MAX) ? val : start + val * incr),
 
268
    next(NULL)
 
269
  {};
 
270
  Discrete_interval() :
 
271
    interval_min(0), interval_values(0),
 
272
    interval_max(0), next(NULL)
 
273
  {};
271
274
  uint64_t minimum() const { return interval_min;    };
272
275
  uint64_t values()  const { return interval_values; };
273
276
  uint64_t maximum() const { return interval_max;    };
307
310
    "head" to "tail" then to NULL).
308
311
  */
309
312
  Discrete_interval        *current;
310
 
  uint                  elements; // number of elements
 
313
  uint32_t                  elements; // number of elements
311
314
 
312
315
  /* helper function for copy construct and assignment operator */
313
316
  void copy_(const Discrete_intervals_list& from)
319
322
    }
320
323
  }
321
324
public:
322
 
  Discrete_intervals_list() : head(NULL), current(NULL), elements(0) {};
323
 
  Discrete_intervals_list(const Discrete_intervals_list& from)
 
325
  Discrete_intervals_list() :
 
326
    head(NULL), tail(NULL),
 
327
    current(NULL), elements(0) {};
 
328
  Discrete_intervals_list(const Discrete_intervals_list& from) :
 
329
    head(NULL), tail(NULL),
 
330
    current(NULL), elements(0)
324
331
  {
325
332
    copy_(from);
326
333
  }
327
 
  void operator=(const Discrete_intervals_list& from)
 
334
  Discrete_intervals_list& operator=(const Discrete_intervals_list& from)
328
335
  {
329
336
    empty();
330
337
    copy_(from);
 
338
    return *this;
331
339
  }
332
340
  void empty_no_free()
333
341
  {
357
365
  bool append(Discrete_interval *interval);
358
366
  uint64_t minimum()     const { return (head ? head->minimum() : 0); };
359
367
  uint64_t maximum()     const { return (head ? tail->maximum() : 0); };
360
 
  uint      nb_elements() const { return elements; }
 
368
  uint32_t      nb_elements() const { return elements; }
361
369
};