~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_select.h

  • Committer: Padraig O'Sullivan
  • Date: 2010-02-11 20:01:37 UTC
  • mto: (1300.3.1 query-as-string)
  • mto: This revision was merged to the branch mainline in revision 1307.
  • Revision ID: osullivan.padraig@gmail.com-20100211200137-kx0nmgy8hke3snid
Updated the calls to dtrace probes to use the c_str() pointer from query in Session

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
#define KEY_OPTIMIZE_EXISTS             1
50
50
#define KEY_OPTIMIZE_REF_OR_NULL        2
51
51
 
52
 
class Join;
 
52
class JOIN;
53
53
 
54
 
enum_nested_loop_state sub_select_cache(Join *join, JoinTable *join_tab, bool end_of_records);
55
 
enum_nested_loop_state sub_select(Join *join,JoinTable *join_tab, bool end_of_records);
56
 
enum_nested_loop_state end_send_group(Join *join, JoinTable *join_tab, bool end_of_records);
57
 
enum_nested_loop_state end_write_group(Join *join, JoinTable *join_tab, bool end_of_records);
 
54
enum_nested_loop_state sub_select_cache(JOIN *join, JoinTable *join_tab, bool end_of_records);
 
55
enum_nested_loop_state sub_select(JOIN *join,JoinTable *join_tab, bool end_of_records);
 
56
enum_nested_loop_state end_send_group(JOIN *join, JoinTable *join_tab, bool end_of_records);
 
57
enum_nested_loop_state end_write_group(JOIN *join, JoinTable *join_tab, bool end_of_records);
58
58
 
59
59
typedef struct st_rollup
60
60
{
88
88
  COND_CMP(Item *a,Item_func *b) :and_level(a),cmp_func(b) {}
89
89
};
90
90
 
91
 
void TEST_join(Join *join);
 
91
void TEST_join(JOIN *join);
92
92
 
93
93
/* Extern functions in sql_select.cc */
94
94
bool store_val_in_field(Field *field, Item *val, enum_check_fields check_flag);
95
95
Table *create_tmp_table(Session *session,Tmp_Table_Param *param,List<Item> &fields,
96
 
                        Order *group, bool distinct, bool save_sum_fields,
 
96
                        order_st *group, bool distinct, bool save_sum_fields,
97
97
                        uint64_t select_options, ha_rows rows_limit,
98
98
                        const char* alias);
 
99
void free_tmp_table(Session *session, Table *entry);
99
100
void count_field_types(Select_Lex *select_lex, Tmp_Table_Param *param,
100
101
                       List<Item> &fields, bool reset_with_sum_func);
101
102
bool setup_copy_fields(Session *session, Tmp_Table_Param *param,
103
104
                       List<Item> &new_list1, List<Item> &new_list2,
104
105
                       uint32_t elements, List<Item> &fields);
105
106
void copy_fields(Tmp_Table_Param *param);
106
 
bool copy_funcs(Item **func_ptr, const Session *session);
 
107
void copy_funcs(Item **func_ptr);
107
108
Field* create_tmp_field_from_field(Session *session, Field* org_field,
108
109
                                   const char *name, Table *table,
109
110
                                   Item_field *item, uint32_t convert_blob_length);
110
111
bool test_if_ref(Item_field *left_item,Item *right_item);
111
 
COND *optimize_cond(Join *join, COND *conds, List<TableList> *join_list, Item::cond_result *cond_value);
 
112
COND *optimize_cond(JOIN *join, COND *conds, List<TableList> *join_list, Item::cond_result *cond_value);
112
113
COND *make_cond_for_table(COND *cond,table_map table, table_map used_table, bool exclude_expensive_cond);
113
114
COND* substitute_for_best_equal_field(COND *cond, COND_EQUAL *cond_equal, void *table_join_idx);
114
115
bool list_contains_unique_index(Table *table, bool (*find_func) (Field *, void *), void *data);
115
116
bool find_field_in_order_list (Field *field, void *data);
116
117
bool find_field_in_item_list (Field *field, void *data);
117
 
bool test_if_skip_sort_order(JoinTable *tab,Order *order,ha_rows select_limit, bool no_changes, const key_map *map);
118
 
Order *create_distinct_group(Session *session,
 
118
bool test_if_skip_sort_order(JoinTable *tab,order_st *order,ha_rows select_limit, bool no_changes, const key_map *map);
 
119
order_st *create_distinct_group(Session *session,
119
120
                                Item **ref_pointer_array,
120
 
                                Order *order_list,
 
121
                                order_st *order_list,
121
122
                                List<Item> &fields,
122
123
                                List<Item> &,
123
124
                                bool *all_order_by_fields_used);
128
129
                                                List<Item> &res_all_fields,
129
130
                                                uint32_t elements,
130
131
                              List<Item> &all_fields);
131
 
int do_select(Join *join, List<Item> *fields, Table *tmp_table);
 
132
int do_select(JOIN *join, List<Item> *fields, Table *tmp_table);
132
133
bool const_expression_in_where(COND *conds,Item *item, Item **comp_item);
133
 
int create_sort_index(Session *session, Join *join, Order *order, ha_rows filesort_limit, ha_rows select_limit, bool is_order_by);
 
134
int create_sort_index(Session *session, JOIN *join, order_st *order, ha_rows filesort_limit, ha_rows select_limit, bool is_order_by);
134
135
void save_index_subquery_explain_info(JoinTable *join_tab, Item* where);
135
136
Item *remove_additional_cond(Item* conds);
136
137
bool setup_sum_funcs(Session *session, Item_sum **func_ptr);
143
144
                               List<Item> &res_all_fields,
144
145
                               uint32_t elements,
145
146
                                                 List<Item> &all_fields);
146
 
bool change_group_ref(Session *session, Item_func *expr, Order *group_list, bool *changed);
147
 
bool check_interleaving_with_nj(JoinTable *next);
 
147
bool change_group_ref(Session *session, Item_func *expr, order_st *group_list, bool *changed);
 
148
bool check_interleaving_with_nj(JoinTable *last, JoinTable *next);
148
149
 
149
150
int join_read_const_table(JoinTable *tab, optimizer::Position *pos);
150
151
int join_read_system(JoinTable *tab);
152
153
int join_read_key(JoinTable *tab);
153
154
int join_read_always_key(JoinTable *tab);
154
155
int join_read_last_key(JoinTable *tab);
155
 
int join_no_more_records(ReadRecord *info);
156
 
int join_read_next(ReadRecord *info);
157
 
int join_read_next_different(ReadRecord *info);
 
156
int join_no_more_records(READ_RECORD *info);
 
157
int join_read_next(READ_RECORD *info);
 
158
int join_read_next_different(READ_RECORD *info);
158
159
int join_init_quick_read_record(JoinTable *tab);
159
160
int init_read_record_seq(JoinTable *tab);
160
161
int test_if_quick_select(JoinTable *tab);
161
162
int join_init_read_record(JoinTable *tab);
162
163
int join_read_first(JoinTable *tab);
163
 
int join_read_next_same(ReadRecord *info);
164
 
int join_read_next_same_diff(ReadRecord *info);
 
164
int join_read_next_same(READ_RECORD *info);
 
165
int join_read_next_same_diff(READ_RECORD *info);
165
166
int join_read_last(JoinTable *tab);
166
 
int join_read_prev_same(ReadRecord *info);
167
 
int join_read_prev(ReadRecord *info);
 
167
int join_read_prev_same(READ_RECORD *info);
 
168
int join_read_prev(READ_RECORD *info);
168
169
int join_read_always_key_or_null(JoinTable *tab);
169
 
int join_read_next_same_or_null(ReadRecord *info);
 
170
int join_read_next_same_or_null(READ_RECORD *info);
170
171
 
171
172
void calc_used_field_length(Session *, JoinTable *join_tab);
172
173
StoredKey *get_store_key(Session *session, 
173
174
                         optimizer::KeyUse *keyuse,
174
175
                         table_map used_tables,
175
 
                         KeyPartInfo *key_part,
 
176
                         KEY_PART_INFO *key_part,
176
177
                         unsigned char *key_buff,
177
178
                         uint32_t maybe_null);
178
179
int join_tab_cmp(const void* ptr1, const void* ptr2);
179
180
int join_tab_cmp_straight(const void* ptr1, const void* ptr2);
180
181
void push_index_cond(JoinTable *tab, uint32_t keyno, bool other_tbls_ok);
181
 
void add_not_null_conds(Join *join);
 
182
void add_not_null_conds(JOIN *join);
182
183
uint32_t max_part_bit(key_part_map bits);
183
184
COND *add_found_match_trig_cond(JoinTable *tab, COND *cond, JoinTable *root_tab);
184
 
Order *create_distinct_group(Session *session,
 
185
order_st *create_distinct_group(Session *session,
185
186
                                Item **ref_pointer_array,
186
 
                                Order *order,
 
187
                                order_st *order,
187
188
                                List<Item> &fields,
188
189
                                List<Item> &all_fields,
189
190
                                bool *all_order_by_fields_used);
190
 
bool eq_ref_table(Join *join, Order *start_order, JoinTable *tab);
 
191
bool eq_ref_table(JOIN *join, order_st *start_order, JoinTable *tab);
191
192
int remove_dup_with_compare(Session *session, Table *table, Field **first_field, uint32_t offset, Item *having);
192
193
int remove_dup_with_hash_index(Session *session, 
193
194
                               Table *table,
205
206
                         Select_Lex *select_lex,
206
207
                         std::vector<optimizer::SargableParam> &sargables);
207
208
ha_rows get_quick_record_count(Session *session, optimizer::SqlSelect *select, Table *table, const key_map *keys,ha_rows limit);
208
 
void optimize_keyuse(Join *join, DYNAMIC_ARRAY *keyuse_array);
209
 
void add_group_and_distinct_keys(Join *join, JoinTable *join_tab);
 
209
void optimize_keyuse(JOIN *join, DYNAMIC_ARRAY *keyuse_array);
 
210
void add_group_and_distinct_keys(JOIN *join, JoinTable *join_tab);
210
211
void read_cached_record(JoinTable *tab);
211
212
bool mysql_select(Session *session, Item ***rref_pointer_array,
212
213
                  TableList *tables, uint32_t wild_num,  List<Item> &list,
213
 
                  COND *conds, uint32_t og_num, Order *order, Order *group,
 
214
                  COND *conds, uint32_t og_num, order_st *order, order_st *group,
214
215
                  Item *having, uint64_t select_type,
215
216
                  select_result *result, Select_Lex_Unit *unit,
216
217
                  Select_Lex *select_lex);
217
218
// Create list for using with tempory table
218
219
void init_tmptable_sum_functions(Item_sum **func);
219
220
void update_tmptable_sum_func(Item_sum **func,Table *tmp_table);
220
 
bool only_eq_ref_tables(Join *join, Order *order, table_map tables);
221
 
bool create_ref_for_key(Join *join, JoinTable *j, 
 
221
bool only_eq_ref_tables(JOIN *join, order_st *order, table_map tables);
 
222
bool create_ref_for_key(JOIN *join, JoinTable *j, 
222
223
                        optimizer::KeyUse *org_keyuse, 
223
224
                        table_map used_tables);
224
225