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