~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_select.cc

  • Committer: Brian Aker
  • Date: 2010-05-19 00:35:41 UTC
  • mto: This revision was merged to the branch mainline in revision 1542.
  • Revision ID: brian@gaz-20100519003541-7ecxcuwv9klvzi8l
JOIN -> Join rename

Show diffs side-by-side

added added

removed removed

Lines of Context:
364
364
  bool free_join= 1;
365
365
 
366
366
  select_lex->context.resolve_in_select_list= true;
367
 
  JOIN *join;
 
367
  Join *join;
368
368
  if (select_lex->join != 0)
369
369
  {
370
370
    join= select_lex->join;
397
397
  }
398
398
  else
399
399
  {
400
 
    if (!(join= new JOIN(session, fields, select_options, result)))
 
400
    if (!(join= new Join(session, fields, select_options, result)))
401
401
      return(true);
402
402
    session->set_proc_info("init");
403
403
    session->used_tables=0;                         // Updated by setup_fields
693
693
/**
694
694
  Update some values in keyuse for faster choose_plan() loop.
695
695
*/
696
 
void optimize_keyuse(JOIN *join, DYNAMIC_ARRAY *keyuse_array)
 
696
void optimize_keyuse(Join *join, DYNAMIC_ARRAY *keyuse_array)
697
697
{
698
698
  optimizer::KeyUse *end,*keyuse= dynamic_element(keyuse_array, 
699
699
                                                  0, 
748
748
  @return
749
749
    None
750
750
*/
751
 
void add_group_and_distinct_keys(JOIN *join, JoinTable *join_tab)
 
751
void add_group_and_distinct_keys(Join *join, JoinTable *join_tab)
752
752
{
753
753
  List<Item_field> indexed_fields;
754
754
  List_iterator<Item_field> indexed_fields_it(indexed_fields);
960
960
    *e1= e2;
961
961
}
962
962
 
963
 
bool create_ref_for_key(JOIN *join, 
 
963
bool create_ref_for_key(Join *join, 
964
964
                        JoinTable *j, 
965
965
                        optimizer::KeyUse *org_keyuse,
966
966
                        table_map used_tables)
1138
1138
      3. add_not_null_conds adds "x IS NOT NULL" to join_tab->select_cond of
1139
1139
         appropiate JoinTable members.
1140
1140
*/
1141
 
void add_not_null_conds(JOIN *join)
 
1141
void add_not_null_conds(Join *join)
1142
1142
{
1143
1143
  for (uint32_t i= join->const_tables; i < join->tables; i++)
1144
1144
  {
1478
1478
  read_record.end_read_record();
1479
1479
}
1480
1480
 
1481
 
bool only_eq_ref_tables(JOIN *join,order_st *order,table_map tables)
 
1481
bool only_eq_ref_tables(Join *join,order_st *order,table_map tables)
1482
1482
{
1483
1483
  for (JoinTable **tab=join->map2table ; tables ; tab++, tables>>=1)
1484
1484
  {
1507
1507
  SELECT * FROM t1,t2 WHERE t1.a=t2.a ORDER BY t2.b,t1.a
1508
1508
  @endcode
1509
1509
*/
1510
 
bool eq_ref_table(JOIN *join, order_st *start_order, JoinTable *tab)
 
1510
bool eq_ref_table(Join *join, order_st *start_order, JoinTable *tab)
1511
1511
{
1512
1512
  if (tab->cached_eq_ref_table)                 // If cached
1513
1513
    return tab->eq_ref_table;
2859
2859
bool check_interleaving_with_nj(JoinTable *last_tab, JoinTable *next_tab)
2860
2860
{
2861
2861
  TableList *next_emb= next_tab->table->pos_in_table_list->embedding;
2862
 
  JOIN *join= last_tab->join;
 
2862
  Join *join= last_tab->join;
2863
2863
 
2864
2864
  if ((join->cur_embedding_map & ~next_tab->embedding_map).any())
2865
2865
  {
2900
2900
  return false;
2901
2901
}
2902
2902
 
2903
 
COND *optimize_cond(JOIN *join, COND *conds, List<TableList> *join_list, Item::cond_result *cond_value)
 
2903
COND *optimize_cond(Join *join, COND *conds, List<TableList> *join_list, Item::cond_result *cond_value)
2904
2904
{
2905
2905
  Session *session= join->session;
2906
2906
 
3209
3209
  @return
3210
3210
    end_select function to use. This function can't fail.
3211
3211
*/
3212
 
Next_select_func setup_end_select_func(JOIN *join)
 
3212
Next_select_func setup_end_select_func(Join *join)
3213
3213
{
3214
3214
  Table *table= join->tmp_table;
3215
3215
  Tmp_Table_Param *tmp_tbl= &join->tmp_table_param;
3274
3274
  @retval
3275
3275
    -1  if error should be sent
3276
3276
*/
3277
 
int do_select(JOIN *join, List<Item> *fields, Table *table)
 
3277
int do_select(Join *join, List<Item> *fields, Table *table)
3278
3278
{
3279
3279
  int rc= 0;
3280
3280
  enum_nested_loop_state error= NESTED_LOOP_OK;
3375
3375
  return(join->session->is_error() ? -1 : rc);
3376
3376
}
3377
3377
 
3378
 
enum_nested_loop_state sub_select_cache(JOIN *join, JoinTable *join_tab, bool end_of_records)
 
3378
enum_nested_loop_state sub_select_cache(Join *join, JoinTable *join_tab, bool end_of_records)
3379
3379
{
3380
3380
  enum_nested_loop_state rc;
3381
3381
 
3522
3522
  @return
3523
3523
    return one of enum_nested_loop_state, except NESTED_LOOP_NO_MORE_ROWS.
3524
3524
*/
3525
 
enum_nested_loop_state sub_select(JOIN *join, JoinTable *join_tab, bool end_of_records)
 
3525
enum_nested_loop_state sub_select(Join *join, JoinTable *join_tab, bool end_of_records)
3526
3526
{
3527
3527
  join_tab->table->null_row=0;
3528
3528
  if (end_of_records)
3651
3651
    table->maybe_null=0;
3652
3652
 
3653
3653
  /* Check appearance of new constant items in Item_equal objects */
3654
 
  JOIN *join= tab->join;
 
3654
  Join *join= tab->join;
3655
3655
  if (join->conds)
3656
3656
    update_const_equal_items(join->conds, tab);
3657
3657
  TableList *tbl;
4103
4103
  return safe_index_read(tab);                  // then read null keys
4104
4104
}
4105
4105
 
4106
 
enum_nested_loop_state end_send_group(JOIN *join, JoinTable *, bool end_of_records)
 
4106
enum_nested_loop_state end_send_group(Join *join, JoinTable *, bool end_of_records)
4107
4107
{
4108
4108
  int idx= -1;
4109
4109
  enum_nested_loop_state ok_code= NESTED_LOOP_OK;
4192
4192
  return(NESTED_LOOP_OK);
4193
4193
}
4194
4194
 
4195
 
enum_nested_loop_state end_write_group(JOIN *join, JoinTable *, bool end_of_records)
 
4195
enum_nested_loop_state end_write_group(Join *join, JoinTable *, bool end_of_records)
4196
4196
{
4197
4197
  Table *table=join->tmp_table;
4198
4198
  int     idx= -1;
4921
4921
    int best_key= -1;
4922
4922
    bool is_best_covering= false;
4923
4923
    double fanout= 1;
4924
 
    JOIN *join= tab->join;
 
4924
    Join *join= tab->join;
4925
4925
    uint32_t tablenr= tab - join->join_tab;
4926
4926
    ha_rows table_records= table->cursor->stats.records;
4927
4927
    bool group= join->group && order == join->group_list;
5218
5218
    -1          Some fatal error
5219
5219
    1           No records
5220
5220
*/
5221
 
int create_sort_index(Session *session, JOIN *join, order_st *order, ha_rows filesort_limit, ha_rows select_limit, bool is_order_by)
 
5221
int create_sort_index(Session *session, Join *join, order_st *order, ha_rows filesort_limit, ha_rows select_limit, bool is_order_by)
5222
5222
{
5223
5223
  uint32_t length= 0;
5224
5224
  ha_rows examined_rows;