00001 /* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*- 00002 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 00003 * 00004 * Copyright (C) 2008 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 #include <drizzled/memory/sql_alloc.h> 00023 00024 namespace drizzled 00025 { 00026 00027 class Field; 00028 class TableList; 00029 class Item; 00030 00031 /* 00032 Column reference of a NATURAL/USING join. Since column references in 00033 joins can be both from views and stored tables, may point to either a 00034 Field (for tables). 00035 */ 00036 00037 class Natural_join_column: public memory::SqlAlloc 00038 { 00039 public: 00040 Field *table_field; /* Column reference of table or temp view. */ 00041 TableList *table_ref; /* Original base table/view reference. */ 00042 /* 00043 True if a common join column of two NATURAL/USING join operands. Notice 00044 that when we have a hierarchy of nested NATURAL/USING joins, a column can 00045 be common at some level of nesting but it may not be common at higher 00046 levels of nesting. Thus this flag may change depending on at which level 00047 we are looking at some column. 00048 */ 00049 bool is_common; 00050 public: 00051 Natural_join_column(Field *field_param, TableList *tab); 00052 const char *name(); 00053 Item *create_item(Session *session); 00054 Field *field(); 00055 const char *table_name(); 00056 const char *db_name(); 00057 }; 00058 00059 } /* namespace drizzled */ 00060