Merge lp:~stewart/drizzle/misc-cleanups into lp:drizzle
- misc-cleanups
- Merge into 7.2
Proposed by
Stewart Smith
Status: | Merged |
---|---|
Merged at revision: | 2631 |
Proposed branch: | lp:~stewart/drizzle/misc-cleanups |
Merge into: | lp:drizzle |
Diff against target: |
938 lines (+169/-139) 43 files modified
drizzled/base.h (+0/-8) drizzled/cursor.cc (+1/-0) drizzled/cursor.h (+2/-2) drizzled/field.h (+1/-1) drizzled/ha_commands.cc (+0/-5) drizzled/handler_structs.h (+4/-3) drizzled/include.am (+2/-1) drizzled/item/field.cc (+1/-0) drizzled/item/subselect.cc (+1/-0) drizzled/join.cc (+1/-0) drizzled/key.cc (+1/-0) drizzled/key.h (+2/-0) drizzled/key_info.h (+5/-63) drizzled/key_part_info.h (+61/-0) drizzled/optimizer/key_field.cc (+1/-0) drizzled/optimizer/quick_group_min_max_select.cc (+1/-0) drizzled/optimizer/quick_group_min_max_select.h (+2/-0) drizzled/optimizer/quick_range_select.h (+3/-0) drizzled/optimizer/range.cc (+4/-2) drizzled/optimizer/sum.cc (+1/-0) drizzled/optimizer/table_read_plan.h (+3/-0) drizzled/plugin/storage_engine.h (+1/-1) drizzled/sql_select.cc (+1/-0) drizzled/sql_select.h (+2/-0) drizzled/sql_table.cc (+1/-0) drizzled/sql_yacc.yy (+3/-3) drizzled/statement/alter_table.cc (+1/-0) drizzled/table.cc (+3/-2) drizzled/table.h (+29/-2) drizzled/table/instance/base.cc (+3/-18) drizzled/table/instance/base.h (+1/-0) drizzled/table/singular.cc (+1/-0) drizzled/table_proto.cc (+6/-16) plugin/innobase/handler/ha_innodb.cc (+2/-1) plugin/innobase/handler/handler0alter.cc (+1/-0) plugin/memory/ha_heap.cc (+2/-1) plugin/myisam/ha_myisam.cc (+4/-3) plugin/myisam/mi_range.cc (+2/-1) plugin/myisam/mi_rkey.cc (+2/-1) plugin/myisam/mi_rnext.cc (+3/-2) plugin/myisam/mi_rnext_same.cc (+2/-1) plugin/storage_engine_api_tester/storage_engine_api_tester.cc (+1/-1) plugin/tableprototester/tableprototester.cc (+1/-1) |
To merge this branch: | bzr merge lp:~stewart/drizzle/misc-cleanups |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Stewart Smith (community) | Approve | ||
Drizzle Trunk | Pending | ||
Review via email: mp+151404@code.launchpad.net |
Commit message
Description of the change
a bunch of misc cleanups, even getting rid of the legacy structs.h
To post a comment you must log in.
- 2637. By Stewart Smith
-
fix a condition in ha_myisam::doOpen() that was relying on message:
:Table: :STANDARD being 0 and non-standard tables being non-zero. At least let's not rely on message: :Table: :STANDARD being 0.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'drizzled/base.h' |
2 | --- drizzled/base.h 2011-03-17 06:15:56 +0000 |
3 | +++ drizzled/base.h 2013-03-07 01:36:23 +0000 |
4 | @@ -78,14 +78,6 @@ |
5 | HA_READ_MBR_EQUAL |
6 | }; |
7 | |
8 | - /* Key algorithm types */ |
9 | - |
10 | -enum ha_key_alg { |
11 | - HA_KEY_ALG_UNDEF= 0, /* Not specified (old file) */ |
12 | - HA_KEY_ALG_BTREE= 1, /* B-tree, default one */ |
13 | - HA_KEY_ALG_HASH= 3 /* HASH keys (HEAP tables) */ |
14 | -}; |
15 | - |
16 | /* The following is parameter to ha_extra() */ |
17 | |
18 | enum ha_extra_function { |
19 | |
20 | === modified file 'drizzled/cursor.cc' |
21 | --- drizzled/cursor.cc 2013-02-21 22:31:46 +0000 |
22 | +++ drizzled/cursor.cc 2013-03-07 01:36:23 +0000 |
23 | @@ -48,6 +48,7 @@ |
24 | #include <drizzled/statistics_variables.h> |
25 | #include <drizzled/system_variables.h> |
26 | #include "drizzled/probes.h" |
27 | +#include <drizzled/key_part_info.h> |
28 | |
29 | using namespace std; |
30 | |
31 | |
32 | === modified file 'drizzled/cursor.h' |
33 | --- drizzled/cursor.h 2011-08-08 12:51:19 +0000 |
34 | +++ drizzled/cursor.h 2013-03-07 01:36:23 +0000 |
35 | @@ -38,6 +38,8 @@ |
36 | |
37 | namespace drizzled { |
38 | |
39 | +class KeyPartInfo; |
40 | + |
41 | #define HA_MAX_ALTER_FLAGS 40 |
42 | |
43 | typedef std::bitset<HA_MAX_ALTER_FLAGS> HA_ALTER_FLAGS; |
44 | @@ -603,8 +605,6 @@ |
45 | virtual void drop_table(); |
46 | }; |
47 | |
48 | -extern const char *ha_row_type[]; |
49 | - |
50 | /* basic stuff */ |
51 | void ha_init_errors(void); |
52 | |
53 | |
54 | === modified file 'drizzled/field.h' |
55 | --- drizzled/field.h 2011-10-24 15:58:22 +0000 |
56 | +++ drizzled/field.h 2013-03-07 01:36:23 +0000 |
57 | @@ -31,9 +31,9 @@ |
58 | #include <drizzled/type/decimal.h> |
59 | #include <drizzled/key_map.h> |
60 | #include <drizzled/sql_list.h> |
61 | -#include <drizzled/structs.h> |
62 | #include <drizzled/charset.h> |
63 | #include <drizzled/item_result.h> |
64 | +#include <drizzled/base.h> |
65 | |
66 | #include <string> |
67 | #include <vector> |
68 | |
69 | === modified file 'drizzled/ha_commands.cc' |
70 | --- drizzled/ha_commands.cc 2012-02-12 06:45:37 +0000 |
71 | +++ drizzled/ha_commands.cc 2013-03-07 01:36:23 +0000 |
72 | @@ -44,11 +44,6 @@ |
73 | |
74 | KEY_CREATE_INFO default_key_create_info; |
75 | |
76 | -const char *ha_row_type[] = |
77 | -{ |
78 | - "", "FIXED", "DYNAMIC", "COMPRESSED", "REDUNDANT", "COMPACT", "PAGE", "?","?","?" |
79 | -}; |
80 | - |
81 | /** |
82 | Register Cursor error messages for use with my_error(). |
83 | */ |
84 | |
85 | === modified file 'drizzled/handler_structs.h' |
86 | --- drizzled/handler_structs.h 2011-10-10 09:27:50 +0000 |
87 | +++ drizzled/handler_structs.h 2013-03-07 01:36:23 +0000 |
88 | @@ -30,10 +30,11 @@ |
89 | # endif |
90 | #endif |
91 | |
92 | +#include <drizzled/common_fwd.h> |
93 | #include <drizzled/base.h> |
94 | #include <drizzled/definitions.h> |
95 | -#include <drizzled/structs.h> |
96 | #include <drizzled/util/data_ref.h> |
97 | +#include <drizzled/message/table.h> |
98 | |
99 | namespace drizzled { |
100 | |
101 | @@ -85,12 +86,12 @@ |
102 | struct KEY_CREATE_INFO |
103 | { |
104 | KEY_CREATE_INFO() : |
105 | - algorithm(HA_KEY_ALG_UNDEF), |
106 | + algorithm(drizzled::message::Table::Index::UNKNOWN_INDEX), |
107 | block_size(0) |
108 | { |
109 | } |
110 | |
111 | - ha_key_alg algorithm; |
112 | + drizzled::message::Table::Index::IndexType algorithm; |
113 | uint32_t block_size; |
114 | str_ref comment; |
115 | }; |
116 | |
117 | === modified file 'drizzled/include.am' |
118 | --- drizzled/include.am 2013-02-27 03:47:10 +0000 |
119 | +++ drizzled/include.am 2013-03-07 01:36:23 +0000 |
120 | @@ -288,7 +288,9 @@ |
121 | drizzled/join_cache.h \ |
122 | drizzled/join_table.h \ |
123 | drizzled/key.h \ |
124 | + drizzled/key_info.h \ |
125 | drizzled/key_map.h \ |
126 | + drizzled/key_part_info.h \ |
127 | drizzled/key_part_spec.h \ |
128 | drizzled/kill.h \ |
129 | drizzled/korr.h \ |
130 | @@ -476,7 +478,6 @@ |
131 | drizzled/statistics_variables.h \ |
132 | drizzled/status_helper.h \ |
133 | drizzled/stored_key.h \ |
134 | - drizzled/structs.h \ |
135 | drizzled/symbol_hash.h \ |
136 | drizzled/sys_var.h \ |
137 | drizzled/system_variables.h \ |
138 | |
139 | === modified file 'drizzled/item/field.cc' |
140 | --- drizzled/item/field.cc 2013-01-08 12:08:04 +0000 |
141 | +++ drizzled/item/field.cc 2013-03-07 01:36:23 +0000 |
142 | @@ -31,6 +31,7 @@ |
143 | #include <drizzled/plugin/client.h> |
144 | #include <drizzled/item/subselect.h> |
145 | #include <drizzled/sql_lex.h> |
146 | +#include <drizzled/key_part_info.h> |
147 | |
148 | #include <boost/dynamic_bitset.hpp> |
149 | |
150 | |
151 | === modified file 'drizzled/item/subselect.cc' |
152 | --- drizzled/item/subselect.cc 2012-03-05 06:00:54 +0000 |
153 | +++ drizzled/item/subselect.cc 2013-03-07 01:36:23 +0000 |
154 | @@ -47,6 +47,7 @@ |
155 | #include <drizzled/select_union.h> |
156 | #include <drizzled/sql_lex.h> |
157 | #include <drizzled/system_variables.h> |
158 | +#include <drizzled/key_part_info.h> |
159 | |
160 | namespace drizzled { |
161 | |
162 | |
163 | === modified file 'drizzled/join.cc' |
164 | --- drizzled/join.cc 2013-01-08 12:08:04 +0000 |
165 | +++ drizzled/join.cc 2013-03-07 01:36:23 +0000 |
166 | @@ -69,6 +69,7 @@ |
167 | #include <drizzled/statistics_variables.h> |
168 | #include <drizzled/system_variables.h> |
169 | #include <algorithm> |
170 | +#include <drizzled/key_part_info.h> |
171 | |
172 | using namespace std; |
173 | |
174 | |
175 | === modified file 'drizzled/key.cc' |
176 | --- drizzled/key.cc 2011-07-04 18:16:24 +0000 |
177 | +++ drizzled/key.cc 2013-03-07 01:36:23 +0000 |
178 | @@ -22,6 +22,7 @@ |
179 | #include <drizzled/field/blob.h> |
180 | #include <drizzled/util/test.h> |
181 | #include <drizzled/plugin/storage_engine.h> |
182 | +#include <drizzled/key_part_info.h> |
183 | |
184 | #include <boost/dynamic_bitset.hpp> |
185 | |
186 | |
187 | === modified file 'drizzled/key.h' |
188 | --- drizzled/key.h 2011-10-24 21:23:54 +0000 |
189 | +++ drizzled/key.h 2013-03-07 01:36:23 +0000 |
190 | @@ -32,6 +32,8 @@ |
191 | |
192 | namespace drizzled { |
193 | |
194 | +class KeyPartInfo; |
195 | + |
196 | class Key : public memory::SqlAlloc |
197 | { |
198 | public: |
199 | |
200 | === renamed file 'drizzled/structs.h' => 'drizzled/key_info.h' |
201 | --- drizzled/structs.h 2011-10-26 09:37:58 +0000 |
202 | +++ drizzled/key_info.h 2013-03-07 01:36:23 +0000 |
203 | @@ -24,45 +24,17 @@ |
204 | #include <drizzled/definitions.h> |
205 | #include <drizzled/lex_string.h> |
206 | #include <drizzled/thr_lock.h> |
207 | +#include <drizzled/message/table.pb.h> |
208 | |
209 | namespace drizzled { |
210 | |
211 | -class KeyPartInfo |
212 | -{ /* Info about a key part */ |
213 | -public: |
214 | - Field *field; |
215 | - unsigned int offset; /* offset in record (from 0) */ |
216 | - unsigned int null_offset; /* Offset to null_bit in record */ |
217 | - /* Length of key part in bytes, excluding NULL flag and length bytes */ |
218 | - uint16_t length; |
219 | - /* |
220 | - Number of bytes required to store the keypart value. This may be |
221 | - different from the "length" field as it also counts |
222 | - - possible NULL-flag byte (see HA_KEY_NULL_LENGTH) [if null_bit != 0, |
223 | - the first byte stored at offset is 1 if null, 0 if non-null; the |
224 | - actual value is stored from offset+1]. |
225 | - - possible HA_KEY_BLOB_LENGTH bytes needed to store actual value length. |
226 | - */ |
227 | - uint16_t store_length; |
228 | - uint16_t key_type; |
229 | -private: |
230 | -public: |
231 | - uint16_t getKeyType() const |
232 | - { |
233 | - return key_type; |
234 | - } |
235 | - uint16_t fieldnr; /* Fieldnum in UNIREG (1,2,3,...) */ |
236 | - uint16_t key_part_flag; /* 0 or HA_REVERSE_SORT */ |
237 | - uint8_t type; |
238 | - uint8_t null_bit; /* Position to null_bit */ |
239 | -}; |
240 | - |
241 | - |
242 | -class KeyInfo |
243 | +class KeyPartInfo; |
244 | + |
245 | +class KeyInfo |
246 | { |
247 | public: |
248 | unsigned int key_length; /* Tot length of key */ |
249 | - enum ha_key_alg algorithm; |
250 | + drizzled::message::Table::Index::IndexType algorithm; |
251 | unsigned long flags; /* dupp key and pack flags */ |
252 | unsigned int key_parts; /* How many key_parts */ |
253 | uint32_t extra_length; |
254 | @@ -80,34 +52,4 @@ |
255 | str_ref comment; |
256 | }; |
257 | |
258 | - |
259 | -class RegInfo |
260 | -{ |
261 | -public: /* Extra info about reg */ |
262 | - JoinTable *join_tab; /* Used by SELECT() */ |
263 | - enum thr_lock_type lock_type; /* How database is used */ |
264 | - bool not_exists_optimize; |
265 | - bool impossible_range; |
266 | - RegInfo() |
267 | - : join_tab(NULL), lock_type(TL_UNLOCK), |
268 | - not_exists_optimize(false), impossible_range(false) {} |
269 | - void reset() |
270 | - { |
271 | - join_tab= NULL; |
272 | - lock_type= TL_UNLOCK; |
273 | - not_exists_optimize= false; |
274 | - impossible_range= false; |
275 | - } |
276 | -}; |
277 | - |
278 | -typedef int *(*update_var)(Session *, struct drizzle_show_var *); |
279 | - |
280 | } /* namespace drizzled */ |
281 | - |
282 | - /* Bits in form->status */ |
283 | -#define STATUS_NO_RECORD (1+2) /* Record isn't usably */ |
284 | -#define STATUS_GARBAGE 1 |
285 | -#define STATUS_NOT_FOUND 2 /* No record in database when needed */ |
286 | -#define STATUS_NO_PARENT 4 /* Parent record wasn't found */ |
287 | -#define STATUS_NULL_ROW 32 /* table->null_row is set */ |
288 | - |
289 | |
290 | === added file 'drizzled/key_part_info.h' |
291 | --- drizzled/key_part_info.h 1970-01-01 00:00:00 +0000 |
292 | +++ drizzled/key_part_info.h 2013-03-07 01:36:23 +0000 |
293 | @@ -0,0 +1,61 @@ |
294 | +/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*- |
295 | + * vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
296 | + * |
297 | + * Copyright (C) 2008 Sun Microsystems, Inc. |
298 | + * Copyright (C) 2013 Stewart Smith |
299 | + * |
300 | + * This program is free software; you can redistribute it and/or modify |
301 | + * it under the terms of the GNU General Public License as published by |
302 | + * the Free Software Foundation; either version 2 of the License, or |
303 | + * (at your option) any later version. |
304 | + * |
305 | + * This program is distributed in the hope that it will be useful, |
306 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
307 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
308 | + * GNU General Public License for more details. |
309 | + * |
310 | + * You should have received a copy of the GNU General Public License |
311 | + * along with this program; if not, write to the Free Software |
312 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
313 | + */ |
314 | + |
315 | +#pragma once |
316 | + |
317 | +#include <drizzled/message/table.pb.h> |
318 | + |
319 | +namespace drizzled { |
320 | + |
321 | +/* This structure describes a key part. |
322 | + There is one key part per field in a key. |
323 | + */ |
324 | +class KeyPartInfo |
325 | +{ |
326 | +public: |
327 | + Field *field; |
328 | + unsigned int offset; /* offset in record (from 0) */ |
329 | + unsigned int null_offset; /* Offset to null_bit in record */ |
330 | + /* Length of key part in bytes, excluding NULL flag and length bytes */ |
331 | + uint16_t length; |
332 | + /* |
333 | + Number of bytes required to store the keypart value. This may be |
334 | + different from the "length" field as it also counts |
335 | + - possible NULL-flag byte (see HA_KEY_NULL_LENGTH) [if null_bit != 0, |
336 | + the first byte stored at offset is 1 if null, 0 if non-null; the |
337 | + actual value is stored from offset+1]. |
338 | + - possible HA_KEY_BLOB_LENGTH bytes needed to store actual value length. |
339 | + */ |
340 | + uint16_t store_length; |
341 | + uint16_t key_type; |
342 | +private: |
343 | +public: |
344 | + uint16_t getKeyType() const |
345 | + { |
346 | + return key_type; |
347 | + } |
348 | + uint16_t fieldnr; /* Fieldnum in UNIREG (1,2,3,...) */ |
349 | + uint16_t key_part_flag; /* 0 or HA_REVERSE_SORT */ |
350 | + uint8_t type; |
351 | + uint8_t null_bit; /* Position to null_bit */ |
352 | +}; |
353 | + |
354 | +} /* namespace drizzled */ |
355 | |
356 | === modified file 'drizzled/optimizer/key_field.cc' |
357 | --- drizzled/optimizer/key_field.cc 2011-03-01 18:51:28 +0000 |
358 | +++ drizzled/optimizer/key_field.cc 2013-03-07 01:36:23 +0000 |
359 | @@ -28,6 +28,7 @@ |
360 | #include <drizzled/optimizer/key_use.h> |
361 | #include <drizzled/sql_lex.h> |
362 | #include <drizzled/item/subselect.h> |
363 | +#include <drizzled/key_part_info.h> |
364 | |
365 | #include <vector> |
366 | |
367 | |
368 | === modified file 'drizzled/optimizer/quick_group_min_max_select.cc' |
369 | --- drizzled/optimizer/quick_group_min_max_select.cc 2011-06-22 19:56:58 +0000 |
370 | +++ drizzled/optimizer/quick_group_min_max_select.cc 2013-03-07 01:36:23 +0000 |
371 | @@ -31,6 +31,7 @@ |
372 | #include <drizzled/key.h> |
373 | #include <drizzled/table.h> |
374 | #include <drizzled/system_variables.h> |
375 | +#include <drizzled/key_part_info.h> |
376 | |
377 | #include <vector> |
378 | |
379 | |
380 | === modified file 'drizzled/optimizer/quick_group_min_max_select.h' |
381 | --- drizzled/optimizer/quick_group_min_max_select.h 2011-03-14 05:40:28 +0000 |
382 | +++ drizzled/optimizer/quick_group_min_max_select.h 2013-03-07 01:36:23 +0000 |
383 | @@ -26,6 +26,8 @@ |
384 | namespace drizzled |
385 | { |
386 | |
387 | +class KeyPartInfo; |
388 | + |
389 | namespace optimizer |
390 | { |
391 | |
392 | |
393 | === modified file 'drizzled/optimizer/quick_range_select.h' |
394 | --- drizzled/optimizer/quick_range_select.h 2012-02-12 10:29:09 +0000 |
395 | +++ drizzled/optimizer/quick_range_select.h 2013-03-07 01:36:23 +0000 |
396 | @@ -26,6 +26,9 @@ |
397 | #include <vector> |
398 | |
399 | namespace drizzled { |
400 | + |
401 | +class KeyPartInfo; |
402 | + |
403 | namespace optimizer { |
404 | |
405 | /** |
406 | |
407 | === modified file 'drizzled/optimizer/range.cc' |
408 | --- drizzled/optimizer/range.cc 2013-01-08 12:08:04 +0000 |
409 | +++ drizzled/optimizer/range.cc 2013-03-07 01:36:23 +0000 |
410 | @@ -142,6 +142,7 @@ |
411 | #include <drizzled/temporal.h> /* Needed in get_mm_leaf() for timestamp -> datetime comparisons */ |
412 | #include <drizzled/sql_lex.h> |
413 | #include <drizzled/system_variables.h> |
414 | +#include <drizzled/key_part_info.h> |
415 | |
416 | using namespace std; |
417 | |
418 | @@ -3802,8 +3803,9 @@ |
419 | } |
420 | } |
421 | /* Figure out if the key scan is ROR (returns rows in ROWID order) or not */ |
422 | - enum ha_key_alg key_alg= param->table->key_info[seq.real_keyno].algorithm; |
423 | - if ((key_alg != HA_KEY_ALG_BTREE) && (key_alg!= HA_KEY_ALG_UNDEF)) |
424 | + message::Table::Index::IndexType key_alg= param->table->key_info[seq.real_keyno].algorithm; |
425 | + if ((key_alg != message::Table::Index::BTREE) |
426 | + && (key_alg!= message::Table::Index::UNKNOWN_INDEX)) |
427 | { |
428 | /* |
429 | All scans are non-ROR scans for those index types. |
430 | |
431 | === modified file 'drizzled/optimizer/sum.cc' |
432 | --- drizzled/optimizer/sum.cc 2011-07-05 12:32:41 +0000 |
433 | +++ drizzled/optimizer/sum.cc 2013-03-07 01:36:23 +0000 |
434 | @@ -61,6 +61,7 @@ |
435 | #include <drizzled/table_list.h> |
436 | #include <drizzled/key.h> |
437 | #include <drizzled/error.h> |
438 | +#include <drizzled/key_part_info.h> |
439 | |
440 | namespace drizzled |
441 | { |
442 | |
443 | === modified file 'drizzled/optimizer/table_read_plan.h' |
444 | --- drizzled/optimizer/table_read_plan.h 2011-06-27 22:54:15 +0000 |
445 | +++ drizzled/optimizer/table_read_plan.h 2013-03-07 01:36:23 +0000 |
446 | @@ -24,6 +24,9 @@ |
447 | #include <algorithm> |
448 | |
449 | namespace drizzled { |
450 | + |
451 | +class KeyPartInfo; |
452 | + |
453 | namespace optimizer { |
454 | |
455 | /* |
456 | |
457 | === modified file 'drizzled/plugin/storage_engine.h' |
458 | --- drizzled/plugin/storage_engine.h 2013-02-21 22:31:46 +0000 |
459 | +++ drizzled/plugin/storage_engine.h 2013-03-07 01:36:23 +0000 |
460 | @@ -229,7 +229,7 @@ |
461 | } |
462 | |
463 | // @todo match check_flag interface |
464 | - virtual uint32_t index_flags(enum ha_key_alg) const { return 0; } |
465 | + virtual uint32_t index_flags(drizzled::message::Table::Index::IndexType) const { return 0; } |
466 | virtual void startStatement(Session *session) |
467 | { |
468 | doStartStatement(session); |
469 | |
470 | === modified file 'drizzled/sql_select.cc' |
471 | --- drizzled/sql_select.cc 2012-03-05 06:00:54 +0000 |
472 | +++ drizzled/sql_select.cc 2013-03-07 01:36:23 +0000 |
473 | @@ -68,6 +68,7 @@ |
474 | #include <drizzled/select_result.h> |
475 | #include <drizzled/key.h> |
476 | #include <drizzled/my_hash.h> |
477 | +#include <drizzled/key_part_info.h> |
478 | |
479 | using namespace std; |
480 | |
481 | |
482 | === modified file 'drizzled/sql_select.h' |
483 | --- drizzled/sql_select.h 2011-06-14 20:59:28 +0000 |
484 | +++ drizzled/sql_select.h 2013-03-07 01:36:23 +0000 |
485 | @@ -219,6 +219,8 @@ |
486 | int join_read_always_key_or_null(JoinTable *tab); |
487 | int join_read_next_same_or_null(ReadRecord *info); |
488 | |
489 | +class KeyPartInfo; |
490 | + |
491 | void calc_used_field_length(Session *, JoinTable *join_tab); |
492 | StoredKey *get_store_key(Session *session, |
493 | optimizer::KeyUse *keyuse, |
494 | |
495 | === modified file 'drizzled/sql_table.cc' |
496 | --- drizzled/sql_table.cc 2012-07-11 14:06:00 +0000 |
497 | +++ drizzled/sql_table.cc 2013-03-07 01:36:23 +0000 |
498 | @@ -46,6 +46,7 @@ |
499 | #include <drizzled/open_tables_state.h> |
500 | #include <drizzled/table/cache.h> |
501 | #include <drizzled/create_field.h> |
502 | +#include <drizzled/key_part_info.h> |
503 | |
504 | #include <algorithm> |
505 | #include <sstream> |
506 | |
507 | === modified file 'drizzled/sql_yacc.yy' |
508 | --- drizzled/sql_yacc.yy 2013-02-26 21:21:52 +0000 |
509 | +++ drizzled/sql_yacc.yy 2013-03-07 01:36:23 +0000 |
510 | @@ -148,7 +148,7 @@ |
511 | drizzled::sys_var_with_base variable; |
512 | drizzled::sql_var_t var_type; |
513 | drizzled::Key::Keytype key_type; |
514 | - drizzled::ha_key_alg key_alg; |
515 | + drizzled::message::Table::Index::IndexType key_alg; |
516 | drizzled::ha_rkey_function ha_rkey_mode; |
517 | drizzled::enum_tx_isolation tx_isolation; |
518 | drizzled::Cast_target cast_type; |
519 | @@ -1780,8 +1780,8 @@ |
520 | ; |
521 | |
522 | btree_or_rtree: |
523 | - BTREE_SYM { $$= HA_KEY_ALG_BTREE; } |
524 | - | HASH_SYM { $$= HA_KEY_ALG_HASH; } |
525 | + BTREE_SYM { $$= drizzled::message::Table::Index::BTREE; } |
526 | + | HASH_SYM { $$= drizzled::message::Table::Index::HASH; } |
527 | ; |
528 | |
529 | key_list: |
530 | |
531 | === modified file 'drizzled/statement/alter_table.cc' |
532 | --- drizzled/statement/alter_table.cc 2012-07-11 14:06:00 +0000 |
533 | +++ drizzled/statement/alter_table.cc 2013-03-07 01:36:23 +0000 |
534 | @@ -52,6 +52,7 @@ |
535 | #include <drizzled/table/cache.h> |
536 | #include <drizzled/create_field.h> |
537 | #include <drizzled/catalog/instance.h> |
538 | +#include <drizzled/key_part_info.h> |
539 | |
540 | using namespace std; |
541 | |
542 | |
543 | === modified file 'drizzled/table.cc' |
544 | --- drizzled/table.cc 2011-10-24 09:51:02 +0000 |
545 | +++ drizzled/table.cc 2013-03-07 01:36:23 +0000 |
546 | @@ -59,6 +59,7 @@ |
547 | #include <drizzled/statistics_variables.h> |
548 | #include <drizzled/system_variables.h> |
549 | #include <drizzled/open_tables_state.h> |
550 | +#include <drizzled/key_part_info.h> |
551 | |
552 | using namespace std; |
553 | |
554 | @@ -1162,7 +1163,7 @@ |
555 | keyinfo->usable_key_parts=keyinfo->key_parts= param->group_parts; |
556 | keyinfo->key_length= 0; |
557 | keyinfo->rec_per_key= 0; |
558 | - keyinfo->algorithm= HA_KEY_ALG_UNDEF; |
559 | + keyinfo->algorithm= message::Table::Index::UNKNOWN_INDEX; |
560 | keyinfo->name= (char*) "group_key"; |
561 | Order *cur_group= group; |
562 | for (; cur_group ; cur_group= cur_group->next, key_part_info++) |
563 | @@ -1240,7 +1241,7 @@ |
564 | keyinfo->flags=HA_NOSAME | HA_NULL_ARE_EQUAL; |
565 | keyinfo->key_length=(uint16_t) reclength; |
566 | keyinfo->name= (char*) "distinct_key"; |
567 | - keyinfo->algorithm= HA_KEY_ALG_UNDEF; |
568 | + keyinfo->algorithm= message::Table::Index::UNKNOWN_INDEX; |
569 | keyinfo->rec_per_key= 0; |
570 | |
571 | /* |
572 | |
573 | === modified file 'drizzled/table.h' |
574 | --- drizzled/table.h 2011-10-22 13:10:53 +0000 |
575 | +++ drizzled/table.h 2013-03-07 01:36:23 +0000 |
576 | @@ -36,11 +36,38 @@ |
577 | |
578 | namespace drizzled { |
579 | |
580 | + /* Bits in form->status */ |
581 | +#define STATUS_NO_RECORD (1+2) /* Record isn't usably */ |
582 | +#define STATUS_GARBAGE 1 |
583 | +#define STATUS_NOT_FOUND 2 /* No record in database when needed */ |
584 | +#define STATUS_NO_PARENT 4 /* Parent record wasn't found */ |
585 | +#define STATUS_NULL_ROW 32 /* table->null_row is set */ |
586 | + |
587 | + |
588 | +class RegInfo |
589 | +{ |
590 | +public: /* Extra info about reg */ |
591 | + JoinTable *join_tab; /* Used by SELECT() */ |
592 | + enum thr_lock_type lock_type; /* How database is used */ |
593 | + bool not_exists_optimize; |
594 | + bool impossible_range; |
595 | + RegInfo() |
596 | + : join_tab(NULL), lock_type(TL_UNLOCK), |
597 | + not_exists_optimize(false), impossible_range(false) {} |
598 | + void reset() |
599 | + { |
600 | + join_tab= NULL; |
601 | + lock_type= TL_UNLOCK; |
602 | + not_exists_optimize= false; |
603 | + impossible_range= false; |
604 | + } |
605 | +}; |
606 | + |
607 | /** |
608 | - * Class representing a set of records, either in a temporary, |
609 | + * Class representing a set of records, either in a temporary, |
610 | * normal, or derived table. |
611 | */ |
612 | -class DRIZZLED_API Table |
613 | +class DRIZZLED_API Table |
614 | { |
615 | Field **field; /**< Pointer to fields collection */ |
616 | |
617 | |
618 | === modified file 'drizzled/table/instance/base.cc' |
619 | --- drizzled/table/instance/base.cc 2012-07-11 14:06:00 +0000 |
620 | +++ drizzled/table/instance/base.cc 2013-03-07 01:36:23 +0000 |
621 | @@ -87,6 +87,7 @@ |
622 | #include <drizzled/key.h> |
623 | #include <drizzled/open_tables_state.h> |
624 | #include <drizzled/catalog/local.h> |
625 | +#include <drizzled/key_part_info.h> |
626 | |
627 | using namespace std; |
628 | |
629 | @@ -625,23 +626,7 @@ |
630 | } |
631 | } |
632 | |
633 | - switch (indx.type()) |
634 | - { |
635 | - case message::Table::Index::UNKNOWN_INDEX: |
636 | - keyinfo->algorithm= HA_KEY_ALG_UNDEF; |
637 | - break; |
638 | - case message::Table::Index::BTREE: |
639 | - keyinfo->algorithm= HA_KEY_ALG_BTREE; |
640 | - break; |
641 | - case message::Table::Index::HASH: |
642 | - keyinfo->algorithm= HA_KEY_ALG_HASH; |
643 | - break; |
644 | - |
645 | - default: |
646 | - /* TODO: suitable warning ? */ |
647 | - keyinfo->algorithm= HA_KEY_ALG_UNDEF; |
648 | - break; |
649 | - } |
650 | + keyinfo->algorithm= indx.type(); |
651 | |
652 | keyinfo->key_length= indx.key_length(); |
653 | |
654 | @@ -1315,7 +1300,7 @@ |
655 | if (local_field->key_length() == key_part->length && |
656 | !(local_field->flags & BLOB_FLAG)) |
657 | { |
658 | - enum ha_key_alg algo= key_info[key].algorithm; |
659 | + message::Table::Index::IndexType algo= key_info[key].algorithm; |
660 | if (db_type()->index_flags(algo) & HA_KEYREAD_ONLY) |
661 | { |
662 | keys_for_keyread.set(key); |
663 | |
664 | === modified file 'drizzled/table/instance/base.h' |
665 | --- drizzled/table/instance/base.h 2012-07-11 14:06:00 +0000 |
666 | +++ drizzled/table/instance/base.h 2013-03-07 01:36:23 +0000 |
667 | @@ -39,6 +39,7 @@ |
668 | #include <drizzled/key_map.h> |
669 | #include <drizzled/field.h> |
670 | #include <drizzled/util/find_ptr.h> |
671 | +#include <drizzled/key_info.h> |
672 | |
673 | namespace drizzled { |
674 | |
675 | |
676 | === modified file 'drizzled/table/singular.cc' |
677 | --- drizzled/table/singular.cc 2012-07-11 14:06:00 +0000 |
678 | +++ drizzled/table/singular.cc 2013-03-07 01:36:23 +0000 |
679 | @@ -30,6 +30,7 @@ |
680 | #include <drizzled/statistics_variables.h> |
681 | #include <drizzled/table.h> |
682 | #include <drizzled/create_field.h> |
683 | +#include <drizzled/key_part_info.h> |
684 | |
685 | namespace drizzled { |
686 | namespace table { |
687 | |
688 | === modified file 'drizzled/table_proto.cc' |
689 | --- drizzled/table_proto.cc 2011-10-06 18:18:31 +0000 |
690 | +++ drizzled/table_proto.cc 2013-03-07 01:36:23 +0000 |
691 | @@ -24,6 +24,8 @@ |
692 | #include <drizzled/internal/my_sys.h> |
693 | #include <drizzled/typelib.h> |
694 | #include <drizzled/util/test.h> |
695 | +#include <drizzled/key_part_info.h> |
696 | +#include <drizzled/key_info.h> |
697 | |
698 | /* For proto */ |
699 | #include <string> |
700 | @@ -410,22 +412,10 @@ |
701 | idx->set_key_length(key_info[i].key_length); |
702 | idx->set_is_primary(is_primary_key(key_info[i].name)); |
703 | |
704 | - switch(key_info[i].algorithm) |
705 | - { |
706 | - case HA_KEY_ALG_HASH: |
707 | - idx->set_type(message::Table::Index::HASH); |
708 | - break; |
709 | - |
710 | - case HA_KEY_ALG_BTREE: |
711 | - idx->set_type(message::Table::Index::BTREE); |
712 | - break; |
713 | - |
714 | - case HA_KEY_ALG_UNDEF: |
715 | - { |
716 | - idx->set_type(create_info->db_type->default_index_type()); |
717 | - break; |
718 | - } |
719 | - } |
720 | + if (key_info[i].algorithm == message::Table::Index::UNKNOWN_INDEX) |
721 | + idx->set_type(create_info->db_type->default_index_type()); |
722 | + else |
723 | + idx->set_type(key_info[i].algorithm); |
724 | |
725 | if (key_info[i].flags & HA_NOSAME) |
726 | idx->set_is_unique(true); |
727 | |
728 | === modified file 'plugin/innobase/handler/ha_innodb.cc' |
729 | --- plugin/innobase/handler/ha_innodb.cc 2013-02-27 02:30:19 +0000 |
730 | +++ plugin/innobase/handler/ha_innodb.cc 2013-03-07 01:36:23 +0000 |
731 | @@ -74,6 +74,7 @@ |
732 | #include <drizzled/session/times.h> |
733 | #include <drizzled/session/transactions.h> |
734 | #include <drizzled/typelib.h> |
735 | +#include <drizzled/key_part_info.h> |
736 | |
737 | #include <boost/algorithm/string.hpp> |
738 | #include <boost/program_options.hpp> |
739 | @@ -553,7 +554,7 @@ |
740 | UNIV_INTERN uint32_t max_supported_key_part_length() const; |
741 | |
742 | |
743 | - UNIV_INTERN uint32_t index_flags(enum ha_key_alg) const |
744 | + UNIV_INTERN uint32_t index_flags(drizzled::message::Table::Index::IndexType) const |
745 | { |
746 | return (HA_READ_NEXT | |
747 | HA_READ_PREV | |
748 | |
749 | === modified file 'plugin/innobase/handler/handler0alter.cc' |
750 | --- plugin/innobase/handler/handler0alter.cc 2012-05-23 02:06:56 +0000 |
751 | +++ plugin/innobase/handler/handler0alter.cc 2013-03-07 01:36:23 +0000 |
752 | @@ -28,6 +28,7 @@ |
753 | #include <drizzled/table.h> |
754 | #include <drizzled/field/varstring.h> |
755 | #include <drizzled/internal/my_sys.h> |
756 | +#include <drizzled/key_part_info.h> |
757 | |
758 | #include "log0log.h" |
759 | #include "row0merge.h" |
760 | |
761 | === modified file 'plugin/memory/ha_heap.cc' |
762 | --- plugin/memory/ha_heap.cc 2012-07-11 14:06:00 +0000 |
763 | +++ plugin/memory/ha_heap.cc 2013-03-07 01:36:23 +0000 |
764 | @@ -24,6 +24,7 @@ |
765 | #include <drizzled/session/table_messages.h> |
766 | #include <drizzled/statistics_variables.h> |
767 | #include <drizzled/system_variables.h> |
768 | +#include <drizzled/key_part_info.h> |
769 | |
770 | #include <boost/thread/mutex.hpp> |
771 | |
772 | @@ -105,7 +106,7 @@ |
773 | uint32_t max_supported_keys() const { return MAX_KEY; } |
774 | uint32_t max_supported_key_part_length() const { return MAX_KEY_LENGTH; } |
775 | |
776 | - uint32_t index_flags(enum ha_key_alg ) const |
777 | + uint32_t index_flags(drizzled::message::Table::Index::IndexType) const |
778 | { |
779 | return ( HA_ONLY_WHOLE_INDEX | HA_KEY_SCAN_NOT_ROR); |
780 | } |
781 | |
782 | === modified file 'plugin/myisam/ha_myisam.cc' |
783 | --- plugin/myisam/ha_myisam.cc 2013-02-12 01:26:17 +0000 |
784 | +++ plugin/myisam/ha_myisam.cc 2013-03-07 01:36:23 +0000 |
785 | @@ -38,6 +38,7 @@ |
786 | #include <drizzled/key.h> |
787 | #include <drizzled/statistics_variables.h> |
788 | #include <drizzled/system_variables.h> |
789 | +#include <drizzled/key_part_info.h> |
790 | |
791 | #include <boost/algorithm/string.hpp> |
792 | #include <boost/scoped_ptr.hpp> |
793 | @@ -121,7 +122,7 @@ |
794 | uint32_t max_supported_key_length() const { return MI_MAX_KEY_LENGTH; } |
795 | uint32_t max_supported_key_part_length() const { return MI_MAX_KEY_LENGTH; } |
796 | |
797 | - uint32_t index_flags(enum ha_key_alg) const |
798 | + uint32_t index_flags(drizzled::message::Table::Index::IndexType) const |
799 | { |
800 | return (HA_READ_NEXT | |
801 | HA_READ_PREV | |
802 | @@ -223,7 +224,7 @@ |
803 | { |
804 | KeyInfo *pos= &table_arg->key_info[i]; |
805 | keydef[i].flag= ((uint16_t) pos->flags & (HA_NOSAME)); |
806 | - keydef[i].key_alg= HA_KEY_ALG_BTREE; |
807 | + keydef[i].key_alg= message::Table::Index::BTREE; |
808 | keydef[i].block_length= pos->block_size; |
809 | keydef[i].seg= keyseg; |
810 | keydef[i].keysegs= pos->key_parts; |
811 | @@ -589,7 +590,7 @@ |
812 | if (!(file= mi_open(identifier, mode, test_if_locked))) |
813 | return (errno ? errno : -1); |
814 | |
815 | - if (!getTable()->getShare()->getType()) /* No need to perform a check for tmp table */ |
816 | + if (getTable()->getShare()->getType() == message::Table::STANDARD) |
817 | { |
818 | if ((errno= table2myisam(getTable(), &keyinfo, &recinfo, &recs))) |
819 | { |
820 | |
821 | === modified file 'plugin/myisam/mi_range.cc' |
822 | --- plugin/myisam/mi_range.cc 2010-10-02 21:15:42 +0000 |
823 | +++ plugin/myisam/mi_range.cc 2013-03-07 01:36:23 +0000 |
824 | @@ -19,6 +19,7 @@ |
825 | */ |
826 | |
827 | #include "myisam_priv.h" |
828 | +#include <drizzled/message/table.h> |
829 | |
830 | using namespace drizzled; |
831 | |
832 | @@ -58,7 +59,7 @@ |
833 | info->update&= (HA_STATE_CHANGED+HA_STATE_ROW_CHANGED); |
834 | |
835 | switch(info->s->keyinfo[inx].key_alg){ |
836 | - case HA_KEY_ALG_BTREE: |
837 | + case message::Table::Index::BTREE: |
838 | default: |
839 | start_pos= (min_key ? _mi_record_pos(info, min_key->key, |
840 | min_key->keypart_map, min_key->flag) |
841 | |
842 | === modified file 'plugin/myisam/mi_rkey.cc' |
843 | --- plugin/myisam/mi_rkey.cc 2010-10-02 21:15:42 +0000 |
844 | +++ plugin/myisam/mi_rkey.cc 2013-03-07 01:36:23 +0000 |
845 | @@ -16,6 +16,7 @@ |
846 | /* Read record based on a key */ |
847 | |
848 | #include "myisam_priv.h" |
849 | +#include <drizzled/message/table.h> |
850 | |
851 | using namespace drizzled; |
852 | |
853 | @@ -74,7 +75,7 @@ |
854 | use_key_length=USE_WHOLE_KEY; |
855 | |
856 | switch (info->s->keyinfo[inx].key_alg) { |
857 | - case HA_KEY_ALG_BTREE: |
858 | + case message::Table::Index::BTREE: |
859 | default: |
860 | myisam_search_flag= myisam_read_vec[search_flag]; |
861 | if (!_mi_search(info, keyinfo, key_buff, use_key_length, |
862 | |
863 | === modified file 'plugin/myisam/mi_rnext.cc' |
864 | --- plugin/myisam/mi_rnext.cc 2011-08-22 12:09:32 +0000 |
865 | +++ plugin/myisam/mi_rnext.cc 2013-03-07 01:36:23 +0000 |
866 | @@ -14,6 +14,7 @@ |
867 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ |
868 | |
869 | #include "myisam_priv.h" |
870 | +#include <drizzled/message/table.h> |
871 | |
872 | using namespace drizzled; |
873 | |
874 | @@ -41,7 +42,7 @@ |
875 | if (!flag) |
876 | { |
877 | switch(info->s->keyinfo[inx].key_alg){ |
878 | - case HA_KEY_ALG_BTREE: |
879 | + case message::Table::Index::BTREE: |
880 | default: |
881 | error=_mi_search_first(info,info->s->keyinfo+inx, |
882 | info->s->state.key_root[inx]); |
883 | @@ -51,7 +52,7 @@ |
884 | else |
885 | { |
886 | switch (info->s->keyinfo[inx].key_alg) { |
887 | - case HA_KEY_ALG_BTREE: |
888 | + case message::Table::Index::BTREE: |
889 | default: |
890 | if (!changed) |
891 | error= _mi_search_next(info,info->s->keyinfo+inx,info->lastkey, |
892 | |
893 | === modified file 'plugin/myisam/mi_rnext_same.cc' |
894 | --- plugin/myisam/mi_rnext_same.cc 2010-10-02 21:15:42 +0000 |
895 | +++ plugin/myisam/mi_rnext_same.cc 2013-03-07 01:36:23 +0000 |
896 | @@ -14,6 +14,7 @@ |
897 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ |
898 | |
899 | #include "myisam_priv.h" |
900 | +#include <drizzled/message/table.h> |
901 | |
902 | using namespace drizzled; |
903 | |
904 | @@ -39,7 +40,7 @@ |
905 | |
906 | switch (keyinfo->key_alg) |
907 | { |
908 | - case HA_KEY_ALG_BTREE: |
909 | + case message::Table::Index::BTREE: |
910 | default: |
911 | if (!(info->update & HA_STATE_RNEXT_SAME)) |
912 | { |
913 | |
914 | === modified file 'plugin/storage_engine_api_tester/storage_engine_api_tester.cc' |
915 | --- plugin/storage_engine_api_tester/storage_engine_api_tester.cc 2013-02-21 22:31:46 +0000 |
916 | +++ plugin/storage_engine_api_tester/storage_engine_api_tester.cc 2013-03-07 01:36:23 +0000 |
917 | @@ -590,7 +590,7 @@ |
918 | } |
919 | |
920 | /* just copied from innobase... */ |
921 | - uint32_t index_flags(enum ha_key_alg) const |
922 | + uint32_t index_flags(drizzled::message::Table::Index::IndexType) const |
923 | { |
924 | return (HA_READ_NEXT | |
925 | HA_READ_PREV | |
926 | |
927 | === modified file 'plugin/tableprototester/tableprototester.cc' |
928 | --- plugin/tableprototester/tableprototester.cc 2012-04-20 18:29:45 +0000 |
929 | +++ plugin/tableprototester/tableprototester.cc 2013-03-07 01:36:23 +0000 |
930 | @@ -83,7 +83,7 @@ |
931 | uint32_t max_supported_key_length() const { return 1000; } |
932 | uint32_t max_supported_key_part_length() const { return 1000; } |
933 | |
934 | - uint32_t index_flags(enum ha_key_alg) const |
935 | + uint32_t index_flags(drizzled::message::Table::Index::IndexType) const |
936 | { |
937 | return (HA_READ_NEXT | |
938 | HA_READ_PREV | |
Approved by Brian over mail.