Drizzled Public API Documentation

key_use.h
00001 /* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
00002  *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
00003  *
00004  *  Copyright (C) 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 namespace optimizer
00025 {
00026 
00027 class KeyUse 
00028 {
00029 public:
00030 
00031   KeyUse()
00032     :
00033       table(NULL),
00034       val(NULL),
00035       used_tables(0),
00036       key(0),
00037       keypart(0),
00038       optimize(0),
00039       keypart_map(0),
00040       ref_table_rows(0),
00041       null_rejecting(false),
00042       cond_guard(NULL)
00043   {}
00044 
00045   KeyUse(Table *in_table,
00046          Item *in_val,
00047          table_map in_used_tables,
00048          uint32_t in_key,
00049          uint32_t in_keypart,
00050          uint32_t in_optimize,
00051          key_part_map in_keypart_map,
00052          ha_rows in_ref_table_rows,
00053          bool in_null_rejecting,
00054          bool *in_cond_guard)
00055     :
00056       table(in_table),
00057       val(in_val),
00058       used_tables(in_used_tables),
00059       key(in_key),
00060       keypart(in_keypart),
00061       optimize(in_optimize),
00062       keypart_map(in_keypart_map),
00063       ref_table_rows(in_ref_table_rows),
00064       null_rejecting(in_null_rejecting),
00065       cond_guard(in_cond_guard)
00066   {}
00067 
00068   Table *getTable()
00069   {
00070     return table;
00071   }
00072 
00073   Item *getVal()
00074   {
00075     return val;
00076   }
00077 
00078   table_map getUsedTables()
00079   {
00080     return used_tables;
00081   }
00082 
00083   uint32_t getKey() const
00084   {
00085     return key;
00086   }
00087 
00088   uint32_t getKeypart() const
00089   {
00090     return keypart;
00091   }
00092 
00093   uint32_t getOptimizeFlags() const
00094   {
00095     return optimize;
00096   }
00097 
00098   key_part_map getKeypartMap()
00099   {
00100     return keypart_map;
00101   }
00102 
00103   ha_rows getTableRows() const
00104   {
00105     return ref_table_rows;
00106   }
00107 
00108   void setTableRows(ha_rows input)
00109   {
00110     ref_table_rows= input;
00111   }
00112 
00113   bool isNullRejected() const
00114   {
00115     return null_rejecting;
00116   }
00117 
00118   bool *getConditionalGuard()
00119   {
00120     return cond_guard;
00121   }
00122 
00123 private:
00124 
00125   Table *table; 
00127   Item *val;  
00129   table_map used_tables;
00130 
00131   uint32_t key;
00132 
00133   uint32_t keypart;
00134 
00135   uint32_t optimize; 
00137   key_part_map keypart_map;
00138 
00139   ha_rows ref_table_rows;
00140 
00145   bool null_rejecting;
00146 
00157   bool *cond_guard;
00158 };
00159 
00160 } /* end namespace optimizer */
00161 
00162 } /* end namespace drizzled */
00163