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 * Authors: 00007 * 00008 * Jay Pipes <jay.pipes@sun.com> 00009 * 00010 * This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU General Public License 00021 * along with this program; if not, write to the Free Software 00022 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00023 */ 00024 00030 #include <config.h> 00031 #include <drizzled/sql_string.h> 00032 #include <drizzled/session.h> 00033 #include <drizzled/index_hint.h> 00034 #include <drizzled/sql_table.h> 00035 00036 namespace drizzled { 00037 00038 /* 00039 * Names of the index hints (for error messages). Keep in sync with 00040 * index_hint_type 00041 */ 00042 const char *index_hint_type_name[] = 00043 { 00044 "IGNORE INDEX" 00045 , "USE INDEX" 00046 , "FORCE INDEX" 00047 }; 00048 00057 void Index_hint::print(String& str) const 00058 { 00059 str.append(STRING_WITH_LEN(index_hint_type_name[type])); 00060 str.append(STRING_WITH_LEN(" (")); 00061 if (*key_name) 00062 { 00063 if (is_primary_key(key_name)) 00064 str.append(key_name); 00065 else 00066 str.append_identifier(str_ref(key_name)); 00067 } 00068 str.append(')'); 00069 } 00070 00071 } /* namespace drizzled */