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 #include <config.h> 00021 00022 #include <drizzled/item/uint.h> 00023 #include <drizzled/item/outer_ref.h> 00024 00025 namespace drizzled { 00026 00027 /* 00028 Prepare referenced outer field then call usual Item_direct_ref::fix_fields 00029 00030 SYNOPSIS 00031 Item_outer_ref::fix_fields() 00032 session thread handler 00033 reference reference on reference where this item stored 00034 00035 RETURN 00036 false OK 00037 true Error 00038 */ 00039 00040 bool Item_outer_ref::fix_fields(Session *session, Item **reference) 00041 { 00042 /* outer_ref->check_cols() will be made in Item_direct_ref::fix_fields */ 00043 if ((*ref) && !(*ref)->fixed && ((*ref)->fix_fields(session, reference))) 00044 return true; 00045 bool err= Item_direct_ref::fix_fields(session, reference); 00046 if (!outer_ref) 00047 outer_ref= *ref; 00048 if ((*ref)->type() == Item::FIELD_ITEM) 00049 table_name= ((Item_field*)outer_ref)->table_name; 00050 return err; 00051 } 00052 00053 void Item_outer_ref::fix_after_pullout(Select_Lex *new_parent, 00054 Item **ref_item) 00055 { 00056 if (depended_from == new_parent) 00057 { 00058 *ref_item= outer_ref; 00059 outer_ref->fix_after_pullout(new_parent, ref_item); 00060 } 00061 } 00062 00063 00064 } /* namespace drizzled */