~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_select.h

  • Committer: Padraig O'Sullivan
  • Date: 2009-09-17 00:08:20 UTC
  • mto: (1126.9.3 captain-20090915-01)
  • mto: This revision was merged to the branch mainline in revision 1133.
  • Revision ID: osullivan.padraig@gmail.com-20090917000820-urd6p46qngi1okjp
Updated calls to some dtrace probes to cast the parameter to const char *
appropriately. Also, removed the additional variable in places that I was
using.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#include "drizzled/field/varstring.h"
26
26
#include "drizzled/item/null.h"
27
27
#include <drizzled/enum_nested_loop_state.h>
28
 
#include "drizzled/optimizer/position.h"
29
 
#include "drizzled/optimizer/sargable_param.h"
30
 
#include "drizzled/optimizer/key_use.h"
 
28
#include <drizzled/optimizer/position.h>
 
29
#include <drizzled/optimizer/sargable_param.h>
31
30
#include "drizzled/join_cache.h"
32
31
#include "drizzled/join_table.h"
33
32
 
34
33
#include <vector>
35
34
 
36
 
namespace drizzled
37
 
{
38
35
 
39
36
class select_result;
40
37
 
45
42
/* PREV_BITS only used in sql_select.cc */
46
43
#define PREV_BITS(type,A)       ((type) (((type) 1 << (A)) -1))
47
44
 
 
45
#include <plugin/myisam/myisam.h>
 
46
#include <drizzled/sql_array.h>
 
47
 
48
48
/* Values in optimize */
49
49
#define KEY_OPTIMIZE_EXISTS             1
50
50
#define KEY_OPTIMIZE_REF_OR_NULL        2
51
51
 
 
52
class KeyUse 
 
53
{
 
54
public:
 
55
  Table *table; /**< Pointer to the table this key belongs to */
 
56
  Item *val;    /**< or value if no field */
 
57
  table_map used_tables;
 
58
  uint32_t key;
 
59
  uint32_t keypart;
 
60
  uint32_t optimize; /**< 0, or KEY_OPTIMIZE_* */
 
61
  key_part_map keypart_map;
 
62
  ha_rows ref_table_rows;
 
63
  /**
 
64
    If true, the comparison this value was created from will not be
 
65
    satisfied if val has NULL 'value'.
 
66
  */
 
67
  bool null_rejecting;
 
68
  /**
 
69
    !NULL - This KeyUse was created from an equality that was wrapped into
 
70
            an Item_func_trig_cond. This means the equality (and validity of
 
71
            this KeyUse element) can be turned on and off. The on/off state
 
72
            is indicted by the pointed value:
 
73
              *cond_guard == true <=> equality condition is on
 
74
              *cond_guard == false <=> equality condition is off
 
75
 
 
76
    NULL  - Otherwise (the source equality can't be turned off)
 
77
  */
 
78
  bool *cond_guard;
 
79
};
 
80
 
52
81
class JOIN;
53
82
 
54
83
enum_nested_loop_state sub_select_cache(JOIN *join, JoinTable *join_tab, bool end_of_records);
65
94
  List<Item> *fields;
66
95
} ROLLUP;
67
96
 
68
 
} /* namespace drizzled */
69
 
 
70
 
/** @TODO why is this in the middle of the file??? */
71
 
 
72
97
#include "drizzled/join.h"
73
98
 
74
 
namespace drizzled
75
 
{
76
 
 
77
99
/*****************************************************************************
78
100
  Make som simple condition optimization:
79
101
  If there is a test 'field = const' change all refs to 'field' to 'const'
144
166
                               List<Item> &res_all_fields,
145
167
                               uint32_t elements,
146
168
                                                 List<Item> &all_fields);
 
169
void select_describe(JOIN *join, bool need_tmp_table,bool need_order, bool distinct, const char *message= NULL);
147
170
bool change_group_ref(Session *session, Item_func *expr, order_st *group_list, bool *changed);
148
171
bool check_interleaving_with_nj(JoinTable *last, JoinTable *next);
149
172
 
150
 
int join_read_const_table(JoinTable *tab, optimizer::Position *pos);
 
173
int join_read_const_table(JoinTable *tab, drizzled::optimizer::Position *pos);
151
174
int join_read_system(JoinTable *tab);
152
175
int join_read_const(JoinTable *tab);
153
176
int join_read_key(JoinTable *tab);
171
194
 
172
195
void calc_used_field_length(Session *, JoinTable *join_tab);
173
196
StoredKey *get_store_key(Session *session, 
174
 
                         optimizer::KeyUse *keyuse,
 
197
                         KeyUse *keyuse,
175
198
                         table_map used_tables,
176
199
                         KEY_PART_INFO *key_part,
177
200
                         unsigned char *key_buff,
178
201
                         uint32_t maybe_null);
179
 
int join_tab_cmp(const void* ptr1, const void* ptr2);
180
 
int join_tab_cmp_straight(const void* ptr1, const void* ptr2);
 
202
extern "C" int join_tab_cmp(const void* ptr1, const void* ptr2);
 
203
extern "C" int join_tab_cmp_straight(const void* ptr1, const void* ptr2);
181
204
void push_index_cond(JoinTable *tab, uint32_t keyno, bool other_tbls_ok);
182
205
void add_not_null_conds(JOIN *join);
183
206
uint32_t max_part_bit(key_part_map bits);
189
212
                                List<Item> &all_fields,
190
213
                                bool *all_order_by_fields_used);
191
214
bool eq_ref_table(JOIN *join, order_st *start_order, JoinTable *tab);
 
215
int join_tab_cmp(const void* ptr1, const void* ptr2);
192
216
int remove_dup_with_compare(Session *session, Table *table, Field **first_field, uint32_t offset, Item *having);
193
217
int remove_dup_with_hash_index(Session *session, 
194
218
                               Table *table,
204
228
                         COND_EQUAL *,
205
229
                         table_map normal_tables,
206
230
                         Select_Lex *select_lex,
207
 
                         std::vector<optimizer::SargableParam> &sargables);
208
 
ha_rows get_quick_record_count(Session *session, optimizer::SqlSelect *select, Table *table, const key_map *keys,ha_rows limit);
 
231
                         std::vector<drizzled::optimizer::SargableParam> &sargables);
 
232
ha_rows get_quick_record_count(Session *session, SQL_SELECT *select, Table *table, const key_map *keys,ha_rows limit);
209
233
void optimize_keyuse(JOIN *join, DYNAMIC_ARRAY *keyuse_array);
210
234
void add_group_and_distinct_keys(JOIN *join, JoinTable *join_tab);
211
235
void read_cached_record(JoinTable *tab);
212
 
bool mysql_select(Session *session, Item ***rref_pointer_array,
213
 
                  TableList *tables, uint32_t wild_num,  List<Item> &list,
214
 
                  COND *conds, uint32_t og_num, order_st *order, order_st *group,
215
 
                  Item *having, uint64_t select_type,
216
 
                  select_result *result, Select_Lex_Unit *unit,
217
 
                  Select_Lex *select_lex);
218
236
// Create list for using with tempory table
219
237
void init_tmptable_sum_functions(Item_sum **func);
220
238
void update_tmptable_sum_func(Item_sum **func,Table *tmp_table);
221
239
bool only_eq_ref_tables(JOIN *join, order_st *order, table_map tables);
222
 
bool create_ref_for_key(JOIN *join, JoinTable *j, 
223
 
                        optimizer::KeyUse *org_keyuse, 
224
 
                        table_map used_tables);
225
 
 
226
 
} /* namespace drizzled */
227
 
 
228
 
/** @TODO why is this in the middle of the file??? */
 
240
bool create_ref_for_key(JOIN *join, JoinTable *j, KeyUse *org_keyuse, table_map used_tables);
 
241
 
 
242
/* functions from opt_sum.cc */
 
243
bool simple_pred(Item_func *func_item, Item **args, bool *inv_order);
 
244
int opt_sum_query(TableList *tables, List<Item> &all_fields,COND *conds);
 
245
 
 
246
/* from sql_delete.cc, used by opt_range.cc */
 
247
extern "C" int refpos_order_cmp(void* arg, const void *a,const void *b);
229
248
 
230
249
#include "drizzled/stored_key.h"
231
250
 
232
 
namespace drizzled
233
 
{
234
 
 
235
251
bool cp_buffer_from_ref(Session *session, table_reference_st *ref);
236
252
int safe_index_read(JoinTable *tab);
237
253
COND *remove_eq_conds(Session *session, COND *cond, Item::cond_result *cond_value);
240
256
void print_join(Session *session, String *str,
241
257
                List<TableList> *tables, enum_query_type);
242
258
 
243
 
} /* namespace drizzled */
244
 
 
245
259
#endif /* DRIZZLED_SQL_SELECT_H */