Drizzled Public API Documentation

explain_plan.h

00001 /* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
00002  *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
00003  *
00004  *  Copyright (C) 2008-2009 Sun Microsystems, Inc.
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; version 2 of the License.
00009  *
00010  *  This program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *  GNU General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with this program; if not, write to the Free Software
00017  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018  */
00019 
00020 #pragma once
00021 
00022 namespace drizzled {
00023 
00024 class Join;
00025 class Session;
00026 class Select_Lex_Unit;
00027 class select_result;
00028 
00029 namespace optimizer
00030 {
00031 
00033 enum select_type
00034 { 
00035   ST_PRIMARY,
00036   ST_SIMPLE,
00037   ST_DERIVED,
00038   ST_DEPENDENT_SUBQUERY,
00039   ST_UNCACHEABLE_SUBQUERY,
00040   ST_SUBQUERY,
00041   ST_DEPENDENT_UNION,
00042   ST_UNCACHEABLE_UNION,
00043   ST_UNION,
00044   ST_UNION_RESULT
00045 };
00046 
00047 class ExplainPlan
00048 {
00049 public:
00050 
00051   ExplainPlan()
00052     :
00053       join(NULL),
00054       need_tmp_table(false),
00055       need_order(false),
00056       distinct(false),
00057       message(NULL)
00058   {}
00059 
00060   ExplainPlan(Join *in_join,
00061               bool in_need_tmp_table,
00062               bool in_need_order,
00063               bool in_distinct,
00064               const char *in_message)
00065     :
00066       join(in_join),
00067       need_tmp_table(in_need_tmp_table),
00068       need_order(in_need_order),
00069       distinct(in_distinct),
00070       message(in_message)
00071   {}
00072 
00073   void printPlan();
00074 
00075   bool explainUnion(Session *session,
00076                     Select_Lex_Unit *unit,
00077                     select_result *result);
00078 
00079 private:
00080 
00081   Join *join;
00082 
00083   bool need_tmp_table;
00084 
00085   bool need_order;
00086 
00087   bool distinct;
00088 
00089   const char *message;
00090 };
00091 
00092 } /* namespace optimizer */
00093 
00094 } /* namespace drizzled */
00095