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/item.h> 00023 00024 namespace drizzled 00025 { 00026 00027 class TableList; 00028 class SecurityContext; 00029 class Session; 00030 class Select_Lex; 00031 00049 class Name_resolution_context: public memory::SqlAlloc 00050 { 00051 public: 00056 Name_resolution_context *outer_context; 00057 00066 TableList *table_list; 00074 TableList *first_name_resolution_table; 00079 TableList *last_name_resolution_table; 00080 00086 Select_Lex *select_lex; 00087 00093 void (*error_processor)(Session *, void *); 00094 void *error_processor_data; 00095 00101 bool resolve_in_select_list; 00102 00107 SecurityContext *security_ctx; 00108 00109 Name_resolution_context() 00110 : 00111 outer_context(0), 00112 table_list(0), 00113 select_lex(0), 00114 error_processor_data(0), 00115 security_ctx(0) 00116 {} 00117 00118 inline void init() 00119 { 00120 resolve_in_select_list= false; 00121 error_processor= &dummy_error_processor; 00122 first_name_resolution_table= NULL; 00123 last_name_resolution_table= NULL; 00124 } 00125 00126 inline void resolve_in_table_list_only(TableList *tables) 00127 { 00128 table_list= first_name_resolution_table= tables; 00129 resolve_in_select_list= false; 00130 } 00131 00132 inline void process_error(Session *session) 00133 { 00134 (*error_processor)(session, error_processor_data); 00135 } 00136 }; 00137 00138 } /* namespace drizzled */ 00139