From c4728c276a88ef9d80f6cc9b129dda51ba9d347a Mon Sep 17 00:00:00 2001 From: "ram@gw.mysql.r18.ru" <> Date: Tue, 3 Feb 2004 14:35:24 +0400 Subject: [PATCH] Code cleanup: we don't need opt_range.h and opt_range.cc files at all. --- libmysqld/Makefile.am | 2 +- sql/Makefile.am | 4 ++-- sql/opt_ft.cc | 36 ------------------------------------ sql/opt_ft.h | 41 ----------------------------------------- sql/opt_range.h | 11 +++++++++++ sql/sql_select.cc | 7 +++---- 6 files changed, 17 insertions(+), 84 deletions(-) delete mode 100644 sql/opt_ft.cc delete mode 100644 sql/opt_ft.h diff --git a/libmysqld/Makefile.am b/libmysqld/Makefile.am index f9e73d1e219..da58a711d22 100644 --- a/libmysqld/Makefile.am +++ b/libmysqld/Makefile.am @@ -46,7 +46,7 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \ item_func.cc item_strfunc.cc item_sum.cc item_timefunc.cc \ item_geofunc.cc item_uniq.cc item_subselect.cc item_row.cc\ key.cc lock.cc log.cc log_event.cc sql_state.c \ - protocol.cc net_serv.cc opt_ft.cc opt_range.cc \ + protocol.cc net_serv.cc opt_range.cc \ opt_sum.cc procedure.cc records.cc sql_acl.cc \ sql_load.cc sql_olap.cc \ sql_analyse.cc sql_base.cc sql_cache.cc sql_class.cc \ diff --git a/sql/Makefile.am b/sql/Makefile.am index e2ab55da6a2..4aa6aaaa1ee 100644 --- a/sql/Makefile.am +++ b/sql/Makefile.am @@ -52,7 +52,7 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \ field.h handler.h \ ha_isammrg.h ha_isam.h ha_myisammrg.h\ ha_heap.h ha_myisam.h ha_berkeley.h ha_innodb.h \ - opt_range.h opt_ft.h protocol.h \ + opt_range.h protocol.h \ sql_select.h structs.h table.h sql_udf.h hash_filo.h\ lex.h lex_symbol.h sql_acl.h sql_crypt.h \ log_event.h sql_repl.h slave.h \ @@ -75,7 +75,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc \ procedure.cc item_uniq.cc sql_test.cc \ log.cc log_event.cc init.cc derror.cc sql_acl.cc \ unireg.cc des_key_file.cc \ - time.cc opt_range.cc opt_sum.cc opt_ft.cc \ + time.cc opt_range.cc opt_sum.cc \ records.cc filesort.cc handler.cc \ ha_heap.cc ha_myisam.cc ha_myisammrg.cc \ ha_berkeley.cc ha_innodb.cc \ diff --git a/sql/opt_ft.cc b/sql/opt_ft.cc deleted file mode 100644 index 74349819937..00000000000 --- a/sql/opt_ft.cc +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -#ifdef __GNUC__ -#pragma implementation // gcc: Class implementation -#endif - -#include "mysql_priv.h" -#include "sql_select.h" -#include "opt_ft.h" - -/**************************************************************************** -** Create a FT or QUICK RANGE based on a key -****************************************************************************/ - -QUICK_SELECT *get_ft_or_quick_select_for_ref(THD *thd, TABLE *table, - JOIN_TAB *tab) -{ - if (tab->type == JT_FT) - return new FT_SELECT(thd, table, &tab->ref); - return get_quick_select_for_ref(thd, table, &tab->ref); -} - diff --git a/sql/opt_ft.h b/sql/opt_ft.h deleted file mode 100644 index 69b6b72f3fc..00000000000 --- a/sql/opt_ft.h +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - - -/* classes to use when handling where clause */ - -#ifndef _opt_ft_h -#define _opt_ft_h - -#ifdef __GNUC__ -#pragma interface /* gcc class implementation */ -#endif - -class FT_SELECT: public QUICK_SELECT { -public: - TABLE_REF *ref; - - FT_SELECT(THD *thd, TABLE *table, TABLE_REF *tref) : - QUICK_SELECT (thd, table, tref->key, 1), ref(tref) { init(); } - - int init() { return error=file->ft_init(); } - int get_next() { return error=file->ft_read(record); } -}; - -QUICK_SELECT *get_ft_or_quick_select_for_ref(THD *thd, TABLE *table, - JOIN_TAB *tab); - -#endif diff --git a/sql/opt_range.h b/sql/opt_range.h index c413b1f4021..bb1cd0f7513 100644 --- a/sql/opt_range.h +++ b/sql/opt_range.h @@ -134,6 +134,17 @@ class SQL_SELECT :public Sql_alloc { ha_rows limit, bool force_quick_range=0); }; + +class FT_SELECT: public QUICK_SELECT { +public: + FT_SELECT(THD *thd, TABLE *table, uint key): + QUICK_SELECT (thd, table, key, 1) { init(); } + + int init() { return error= file->ft_init(); } + int get_next() { return error= file->ft_read(record); } +}; + + QUICK_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table, struct st_table_ref *ref); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index ad5799f4c42..1c734a2b625 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -24,8 +24,6 @@ #include "mysql_priv.h" #include "sql_select.h" -#include "opt_ft.h" - #include #include #include @@ -7203,8 +7201,9 @@ create_sort_index(THD *thd, JOIN *join, ORDER *order, For impossible ranges (like when doing a lookup on NULL on a NOT NULL field, quick will contain an empty record set. */ - if (!(select->quick=get_ft_or_quick_select_for_ref(tab->join->thd, - table, tab))) + if (!(select->quick= tab->type == JT_FT ? + new FT_SELECT(thd, table, tab->ref.key) : + get_quick_select_for_ref(thd, table, &tab->ref))) goto err; } }