~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/nested_join.h

  • Committer: Jay Pipes
  • Date: 2008-07-17 17:54:00 UTC
  • mto: This revision was merged to the branch mainline in revision 182.
  • Revision ID: jay@mysql.com-20080717175400-xm2aazihjra8mdzq
Removal of DBUG from libdrizzle/ - Round 2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems, Inc.
5
 
 *
6
 
 *  This program is free software; you can redistribute it and/or modify
7
 
 *  it under the terms of the GNU General Public License as published by
8
 
 *  the Free Software Foundation; version 2 of the License.
9
 
 *
10
 
 *  This program is distributed in the hope that it will be useful,
11
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
 *  GNU General Public License for more details.
14
 
 *
15
 
 *  You should have received a copy of the GNU General Public License
16
 
 *  along with this program; if not, write to the Free Software
17
 
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
 
 */
19
 
 
20
 
#ifndef DRIZZLED_NESTED_JOIN_H
21
 
#define DRIZZLED_NESTED_JOIN_H
22
 
 
23
 
#include <drizzled/item.h>
24
 
#include <drizzled/lex_string.h>
25
 
#include <drizzled/sql_list.h>
26
 
 
27
 
#include <bitset>
28
 
 
29
 
namespace drizzled
30
 
{
31
 
class TableList;
32
 
class JoinTable;
33
 
 
34
 
class NestedJoin
35
 
{
36
 
public:
37
 
  /* list of elements in the nested join */
38
 
  List<TableList> join_list;
39
 
 
40
 
  /* bitmap of tables in the nested join */
41
 
  table_map used_tables;
42
 
 
43
 
  /* tables that rejects nulls           */
44
 
  table_map not_null_tables;
45
 
 
46
 
  /* the first nested table in the plan  */
47
 
  JoinTable *first_nested;
48
 
 
49
 
  /*
50
 
    Used to count tables in the nested join in 2 isolated places:
51
 
    1. In make_outerjoin_info().
52
 
    2. check_interleaving_with_nj/restore_prev_nj_state (these are called
53
 
    by the join optimizer.
54
 
    Before each use the counters are zeroed by reset_nj_counters.
55
 
  */
56
 
  uint32_t counter_;
57
 
 
58
 
  /* Bit used to identify this nested join*/
59
 
  std::bitset<64> nj_map;
60
 
 
61
 
  /*
62
 
    (Valid only for semi-join nests) Bitmap of tables outside the semi-join
63
 
    that are used within the semi-join's ON condition.
64
 
  */
65
 
  table_map sj_depends_on;
66
 
  /* Outer non-trivially correlated tables */
67
 
  table_map sj_corr_tables;
68
 
 
69
 
  List<Item> sj_outer_expr_list;
70
 
 
71
 
  /**
72
 
     True if this join nest node is completely covered by the query execution
73
 
     plan. This means two things.
74
 
 
75
 
     1. All tables on its @c join_list are covered by the plan.
76
 
 
77
 
     2. All child join nest nodes are fully covered.
78
 
   */
79
 
  bool is_fully_covered() const { return join_list.elements == counter_; }
80
 
};
81
 
 
82
 
} /* namespace drizzled */
83
 
 
84
 
#endif /* DRIZZLED_NESTED_JOIN_H */