~drizzle-trunk/drizzle/development

390.1.2 by Monty Taylor
Fixed copyright headers in drizzled/
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
1999.6.1 by kalebral at gmail
update Copyright strings to a more common format to help with creating the master debian copyright file
4
 *  Copyright (C) 2008 Sun Microsystems, Inc.
390.1.2 by Monty Taylor
Fixed copyright headers in drizzled/
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
2234 by Brian Aker
Mass removal of ifdef/endif in favor of pragma once.
20
#pragma once
327.2.4 by Brian Aker
Refactoring table.h
21
2154.2.4 by Brian Aker
This fixes 716459
22
#include <drizzled/item.h>
23
#include <drizzled/lex_string.h>
553.1.2 by Monty Taylor
Moved some bitmap defines into bitmap.
24
#include <drizzled/sql_list.h>
25
1100.4.2 by Padraig O'Sullivan
Removed the typedef for nested_join_map and instead just declare these
26
#include <bitset>
27
2252.1.16 by Olaf van der Spek
Common fwd
28
namespace drizzled {
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
29
2141.3.3 by vjsamuel1990 at gmail
Merge change nested_join_st to NestedJoin
30
class NestedJoin
327.2.4 by Brian Aker
Refactoring table.h
31
{
2141.3.1 by vjsamuel1990 at gmail
Merge encapsulate join_read_const_table() into JoinTable.
32
public:
2263.8.1 by kaaveeacs
Merge privatized 3 members of NestedJoin class
33
  /*
34
    This constructor serves for creation of NestedJoin instances
35
  */
2263.8.3 by kaaveeacs
Merge coding style fixes
36
  NestedJoin() 
37
  :
38
  join_list(),
39
  used_tables(),
40
  not_null_tables(),
41
  first_nested(NULL),
42
  counter_(0),
43
  nj_map(),
44
  sj_depends_on(),
45
  sj_corr_tables(),
46
  sj_outer_expr_list()      
2263.8.1 by kaaveeacs
Merge privatized 3 members of NestedJoin class
47
  { }    
48
553.1.3 by Monty Taylor
Split out nested_join.h.
49
  /* list of elements in the nested join */
50
  List<TableList> join_list;
51
52
  /* bitmap of tables in the nested join */
53
  table_map used_tables;
2263.8.1 by kaaveeacs
Merge privatized 3 members of NestedJoin class
54
  
553.1.3 by Monty Taylor
Split out nested_join.h.
55
  /* tables that rejects nulls           */
56
  table_map not_null_tables;
57
58
  /* the first nested table in the plan  */
1089.1.1 by Brian Aker
Remove of JOIN_TAB to JoinTable
59
  JoinTable *first_nested;
553.1.3 by Monty Taylor
Split out nested_join.h.
60
61
  /*
327.2.4 by Brian Aker
Refactoring table.h
62
    Used to count tables in the nested join in 2 isolated places:
553.1.3 by Monty Taylor
Split out nested_join.h.
63
    1. In make_outerjoin_info().
327.2.4 by Brian Aker
Refactoring table.h
64
    2. check_interleaving_with_nj/restore_prev_nj_state (these are called
553.1.3 by Monty Taylor
Split out nested_join.h.
65
    by the join optimizer.
327.2.4 by Brian Aker
Refactoring table.h
66
    Before each use the counters are zeroed by reset_nj_counters.
67
  */
2263.8.1 by kaaveeacs
Merge privatized 3 members of NestedJoin class
68
553.1.3 by Monty Taylor
Split out nested_join.h.
69
  uint32_t counter_;
70
71
  /* Bit used to identify this nested join*/
1100.4.2 by Padraig O'Sullivan
Removed the typedef for nested_join_map and instead just declare these
72
  std::bitset<64> nj_map;
553.1.3 by Monty Taylor
Split out nested_join.h.
73
327.2.4 by Brian Aker
Refactoring table.h
74
  /*
1637.5.9 by Prafulla Tekawade
Fix for Bug 592444
75
     True if this join nest node is completely covered by the query execution
76
     plan. This means two things.
77
78
     1. All tables on its @c join_list are covered by the plan.
2263.8.3 by kaaveeacs
Merge coding style fixes
79
1637.5.9 by Prafulla Tekawade
Fix for Bug 592444
80
     2. All child join nest nodes are fully covered.
81
   */
2263.8.1 by kaaveeacs
Merge privatized 3 members of NestedJoin class
82
2183.2.17 by Olaf van der Spek
Use List::size()
83
  bool is_fully_covered() const { return join_list.size() == counter_; }
2263.8.1 by kaaveeacs
Merge privatized 3 members of NestedJoin class
84
85
  /* To get the table_map sj_depends_on */
86
  table_map getSjDependsOn() const
87
  {
88
    return sj_depends_on;
89
  }
90
91
  /* To set the table_map sj_depends_on */
2263.8.3 by kaaveeacs
Merge coding style fixes
92
  void setSjDependsOn(const table_map &in_sj_depends_on)
2263.8.1 by kaaveeacs
Merge privatized 3 members of NestedJoin class
93
  {
94
    sj_depends_on= in_sj_depends_on;
95
  }
96
97
  /* To get the table_map sj_corr_tables */
98
  table_map getSjCorrTables() const
99
  {
100
    return sj_corr_tables;
101
  }
102
  
103
  /* To set the table_map sj_corr_tables */
2263.8.3 by kaaveeacs
Merge coding style fixes
104
  void setSjCorrTables(const table_map &in_sj_corr_tables) 
2263.8.1 by kaaveeacs
Merge privatized 3 members of NestedJoin class
105
  {
106
    sj_corr_tables= in_sj_corr_tables;
107
  }
108
109
  /* To get the List sj_outer_expr_list */
2263.8.5 by kaaveeacs
Merge coding style fixes
110
  const List<Item>& getSjOuterExprList() const
2263.8.1 by kaaveeacs
Merge privatized 3 members of NestedJoin class
111
  {
112
    return sj_outer_expr_list;
113
  }
114
  
115
  /* To set the List sj_outer_expr_list */
2263.8.3 by kaaveeacs
Merge coding style fixes
116
  void setSjOuterExprList(const List<Item> &in_sj_outer_expr_list)
2263.8.1 by kaaveeacs
Merge privatized 3 members of NestedJoin class
117
  {
118
    sj_outer_expr_list= in_sj_outer_expr_list;
119
  }
120
2263.8.3 by kaaveeacs
Merge coding style fixes
121
private:
122
  /*
123
    (Valid only for semi-join nests) Bitmap of tables outside the semi-join
124
    that are used within the semi-join's ON condition.
125
  */
126
  table_map sj_depends_on;
127
  
128
  /* Outer non-trivially correlated tables */
129
  table_map sj_corr_tables;
130
131
  List<Item> sj_outer_expr_list;
132
327.2.4 by Brian Aker
Refactoring table.h
133
};
134
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
135
} /* namespace drizzled */
136