~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/join.h

  • Committer: Stewart Smith
  • Date: 2009-10-08 12:39:27 UTC
  • mto: This revision was merged to the branch mainline in revision 1179.
  • Revision ID: stewart@flamingspork.com-20091008123927-qpf9hog04w4xc5aj
make directory_file_name() static to mysys/my_lib.cc

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
#define DRIZZLED_JOIN_H
29
29
 
30
30
#include <drizzled/optimizer/position.h>
31
 
#include "drizzled/sql_select.h"
32
31
#include <bitset>
33
32
 
34
 
namespace drizzled
35
 
{
36
 
 
37
 
class JOIN :public memory::SqlAlloc
 
33
class JOIN :public Sql_alloc
38
34
{
39
35
  JOIN(const JOIN &rhs);                        /**< not implemented */
40
36
  JOIN& operator=(const JOIN &rhs);             /**< not implemented */
43
39
   * Contains a partial query execution plan which is extended during
44
40
   * cost-based optimization.
45
41
   */
46
 
  optimizer::Position positions[MAX_TABLES+1];
 
42
  drizzled::optimizer::Position positions[MAX_TABLES+1];
47
43
 
48
44
  /**
49
45
   * Contains the optimal query execution plan after cost-based optimization
50
46
   * has taken place. 
51
47
   */
52
 
  optimizer::Position best_positions[MAX_TABLES+1];
 
48
  drizzled::optimizer::Position best_positions[MAX_TABLES+1];
53
49
 
54
50
public:
55
51
  JoinTable *join_tab;
109
105
  bool simple_group;
110
106
  /**
111
107
    Is set only in case if we have a GROUP BY clause
112
 
    and no ORDER BY after constant elimination of 'order'.
 
108
    and no order_st BY after constant elimination of 'order'.
113
109
  */
114
110
  bool no_order;
115
 
  /** Is set if we have a GROUP BY and we have ORDER BY on a constant. */
 
111
  /** Is set if we have a GROUP BY and we have order_st BY on a constant. */
116
112
  bool skip_sort_order;
117
113
  bool union_part; /**< this subselect is part of union */
118
114
  bool optimized; /**< flag to avoid double optimization in EXPLAIN */
147
143
  Select_Lex_Unit *unit;
148
144
  /** select that processed */
149
145
  Select_Lex *select_lex;
150
 
  optimizer::SqlSelect *select; /**< created in optimization phase */
 
146
  SQL_SELECT *select; /**< created in optimisation phase */
 
147
  Array<Item_in_subselect> sj_subselects;
151
148
 
152
149
  /**
153
150
    Bitmap of nested joins embedding the position at the end of the current
274
271
      unit(NULL),
275
272
      select_lex(NULL),
276
273
      select(NULL),
 
274
      sj_subselects(session_arg->mem_root, 4),
277
275
      exec_tmp_table1(NULL),
278
276
      exec_tmp_table2(NULL),
279
277
      sum_funcs(NULL),
471
469
  void copyPartialPlanIntoOptimalPlan(uint32_t size)
472
470
  {
473
471
    memcpy(best_positions, positions, 
474
 
           sizeof(optimizer::Position) * size);
 
472
           sizeof(drizzled::optimizer::Position) * size);
475
473
  }
476
474
 
477
 
  void cache_const_exprs();
478
 
 
479
475
  /**
480
476
   * @param[in] index the index of the position to retrieve
481
477
   * @return a reference to the specified position in the optimal
482
478
   *         query plan
483
479
   */
484
 
  optimizer::Position &getPosFromOptimalPlan(uint32_t index)
 
480
  drizzled::optimizer::Position &getPosFromOptimalPlan(uint32_t index)
485
481
  {
486
482
    return best_positions[index];
487
483
  }
491
487
   * @return a reference to the specified position in the partial
492
488
   *         query plan
493
489
   */
494
 
  optimizer::Position &getPosFromPartialPlan(uint32_t index)
 
490
  drizzled::optimizer::Position &getPosFromPartialPlan(uint32_t index)
495
491
  {
496
492
    return positions[index];
497
493
  }
500
496
   * @param[in] index the index of the position to set
501
497
   * @param[in] in_pos the value to set the position to
502
498
   */
503
 
  void setPosInPartialPlan(uint32_t index, optimizer::Position &in_pos)
 
499
  void setPosInPartialPlan(uint32_t index, drizzled::optimizer::Position &in_pos)
504
500
  {
505
501
    positions[index]= in_pos;
506
502
  }
508
504
  /**
509
505
   * @return a pointer to the first position in the partial query plan
510
506
   */
511
 
  optimizer::Position *getFirstPosInPartialPlan()
 
507
  drizzled::optimizer::Position *getFirstPosInPartialPlan()
512
508
  {
513
509
    return positions;
514
510
  }
518
514
   *                  query plan
519
515
   * @return a pointer to the position in the partial query plan
520
516
   */
521
 
  optimizer::Position *getSpecificPosInPartialPlan(int32_t index)
 
517
  drizzled::optimizer::Position *getSpecificPosInPartialPlan(int32_t index)
522
518
  {
523
519
    return positions + index;
524
520
  }
533
529
enum_nested_loop_state end_update(JOIN *join, JoinTable *join_tab, bool end_of_records);
534
530
enum_nested_loop_state end_unique_update(JOIN *join, JoinTable *join_tab, bool end_of_records);
535
531
 
536
 
} /* namespace drizzled */
537
 
 
538
532
#endif /* DRIZZLED_JOIN_H */