Drizzled Public API Documentation

outer_ref.cc
1 /* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3  *
4  * Copyright (C) 2008 Sun Microsystems, Inc.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; version 2 of the License.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 #include <config.h>
21 
22 #include <drizzled/item/uint.h>
23 #include <drizzled/item/outer_ref.h>
24 
25 namespace drizzled {
26 
27 /*
28  Prepare referenced outer field then call usual Item_direct_ref::fix_fields
29 
30  SYNOPSIS
31  Item_outer_ref::fix_fields()
32  session thread handler
33  reference reference on reference where this item stored
34 
35  RETURN
36  false OK
37  true Error
38 */
39 
40 bool Item_outer_ref::fix_fields(Session *session, Item **reference)
41 {
42  /* outer_ref->check_cols() will be made in Item_direct_ref::fix_fields */
43  if ((*ref) && !(*ref)->fixed && ((*ref)->fix_fields(session, reference)))
44  return true;
45  bool err= Item_direct_ref::fix_fields(session, reference);
46  if (!outer_ref)
47  outer_ref= *ref;
48  if ((*ref)->type() == Item::FIELD_ITEM)
49  table_name= ((Item_field*)outer_ref)->table_name;
50  return err;
51 }
52 
53 void Item_outer_ref::fix_after_pullout(Select_Lex *new_parent,
54  Item **ref_item)
55 {
56  if (depended_from == new_parent)
57  {
58  *ref_item= outer_ref;
59  outer_ref->fix_after_pullout(new_parent, ref_item);
60  }
61 }
62 
63 
64 } /* namespace drizzled */