summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authormonty@hundin.mysql.fi <>2001-11-22 17:55:18 +0200
committermonty@hundin.mysql.fi <>2001-11-22 17:55:18 +0200
commita66ddaf8ba4b7e5478c376ce65b57d6fdf25607b (patch)
tree5c88c46555c8f2f0d49c779e6347d2d6139a84e0 /sql
parent9265a4df45ea24b029ce024df7c9f34b7248a0d0 (diff)
downloadmariadb-git-a66ddaf8ba4b7e5478c376ce65b57d6fdf25607b.tar.gz
Fixed fulltext after merge from 3.23.45
First (incomplete) version of transaction and as3ap tests.
Diffstat (limited to 'sql')
-rw-r--r--sql/item_func.cc5
-rw-r--r--sql/mysqld.cc88
-rw-r--r--sql/sql_base.cc6
-rw-r--r--sql/sql_delete.cc14
-rw-r--r--sql/sql_parse.cc2
-rw-r--r--sql/sql_select.cc38
-rw-r--r--sql/sql_union.cc8
7 files changed, 80 insertions, 81 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 91ec8826f73..86cc3283955 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -2164,10 +2164,7 @@ bool Item_func_match::eq(const Item *item) const
double Item_func_match::val()
{
if (ft_handler==NULL)
- init_search(1);
-
- if ((null_value= (ft_handler==NULL)))
- return 0.0;
+ return -1.0;
if (join_key)
{
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index d903651e81f..2774e2a4050 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -47,7 +47,6 @@ char pstack_file_name[80];
#if defined(HAVE_DEC_3_2_THREADS) || defined(SIGNALS_DONT_BREAK_READ)
#define HAVE_CLOSE_SERVER_SOCK 1
-void close_server_sock();
#endif
extern "C" { // Because of SCO 3.2V4.2
@@ -207,7 +206,7 @@ SHOW_COMP_OPTION have_openssl=SHOW_OPTION_NO;
SHOW_COMP_OPTION have_symlink=SHOW_OPTION_YES;
-static bool opt_skip_slave_start = 0; // if set, slave is not autostarted
+static bool opt_skip_slave_start = 0; // If set, slave is not autostarted
static bool opt_do_pstack = 0;
static ulong opt_specialflag=SPECIAL_ENGLISH;
static ulong back_log,connect_timeout,concurrency;
@@ -229,8 +228,10 @@ int segfaulted = 0; // ensure we do not enter SIGSEGV handler twice
extern MASTER_INFO glob_mi;
extern int init_master_info(MASTER_INFO* mi);
-// if sql_bin_update is true, SQL_LOG_UPDATE and SQL_LOG_BIN are kept in sync,
-// and are treated as aliases for each other
+/*
+ If sql_bin_update is true, SQL_LOG_UPDATE and SQL_LOG_BIN are kept in sync,
+ and are treated as aliases for each other
+*/
static bool kill_in_progress=FALSE;
static struct rand_struct sql_rand;
@@ -385,6 +386,7 @@ static char *get_relative_path(const char *path);
static void fix_paths(void);
static pthread_handler_decl(handle_connections_sockets,arg);
static int bootstrap(FILE *file);
+static void close_server_sock();
static bool read_init_file(char *file_name);
#ifdef __NT__
static pthread_handler_decl(handle_connections_namedpipes,arg);
@@ -454,9 +456,7 @@ static void close_connections(void)
if (error != 0 && !count++)
sql_print_error("Got error %d from pthread_cond_timedwait",error);
#endif
-#if defined(HAVE_DEC_3_2_THREADS) || defined(SIGNALS_DONT_BREAK_READ)
close_server_sock();
-#endif
}
(void) pthread_mutex_unlock(&LOCK_thread_count);
#endif /* __WIN__ */
@@ -570,28 +570,31 @@ static void close_connections(void)
DBUG_VOID_RETURN;
}
-#ifdef HAVE_CLOSE_SERVER_SOCK
-void close_server_sock()
+static void close_server_sock()
{
+#ifdef HAVE_CLOSE_SERVER_SOCK
DBUG_ENTER("close_server_sock");
- if (ip_sock != INVALID_SOCKET)
+ my_socket tmp_sock;
+ tmp_sock=ip_sock;
+ if (tmp_sock != INVALID_SOCKET)
{
- DBUG_PRINT("info",("closing TCP/IP socket"));
- VOID(shutdown(ip_sock,2));
- VOID(closesocket(ip_sock));
ip_sock=INVALID_SOCKET;
+ DBUG_PRINT("info",("closing TCP/IP socket"));
+ VOID(shutdown(tmp_sock,2));
+ VOID(closesocket(tmp_sock));
}
- if (unix_sock != INVALID_SOCKET)
+ tmp_sock=unix_sock;
+ if (tmp_sock != INVALID_SOCKET)
{
+ unix_sock=INVALID_SOCKET;
DBUG_PRINT("info",("closing Unix socket"));
- VOID(shutdown(unix_sock,2));
- VOID(closesocket(unix_sock));
+ VOID(shutdown(tmp_sock,2));
+ VOID(closesocket(tmp_sock));
VOID(unlink(mysql_unix_port));
- unix_sock=INVALID_SOCKET;
}
DBUG_VOID_RETURN;
-}
#endif
+}
void kill_mysql(void)
{
@@ -607,10 +610,12 @@ void kill_mysql(void)
{
DBUG_PRINT("error",("Got error: %ld from SetEvent",GetLastError()));
}
- // or:
- // HANDLE hEvent=OpenEvent(0, FALSE, "MySqlShutdown");
- // SetEvent(hEventShutdown);
- // CloseHandle(hEvent);
+ /*
+ or:
+ HANDLE hEvent=OpenEvent(0, FALSE, "MySqlShutdown");
+ SetEvent(hEventShutdown);
+ CloseHandle(hEvent);
+ */
}
#elif defined(OS2)
pthread_cond_signal( &eventShutdown); // post semaphore
@@ -647,8 +652,7 @@ static void __cdecl kill_server(int sig_ptr)
int sig=(int) (long) sig_ptr; // This is passed a int
DBUG_ENTER("kill_server");
- // if there is a signal during the kill in progress, we do not need
- // another one
+ // if there is a signal during the kill in progress, ignore the other
if (kill_in_progress) // Safety
RETURN_FROM_KILL_SERVER;
kill_in_progress=TRUE;
@@ -1207,10 +1211,12 @@ static void start_signal_handler(void)
static sig_handler handle_segfault(int sig)
{
THD *thd=current_thd;
- // strictly speaking, one needs a mutex here
- // but since we have got SIGSEGV already, things are a mess
- // so not having the mutex is not as bad as possibly using a buggy
- // mutex - so we keep things simple
+ /*
+ Strictly speaking, one needs a mutex here
+ but since we have got SIGSEGV already, things are a mess
+ so not having the mutex is not as bad as possibly using a buggy
+ mutex - so we keep things simple
+ */
if (segfaulted)
{
fprintf(stderr, "Fatal signal %d while backtracing\n", sig);
@@ -1559,8 +1565,10 @@ pthread_handler_decl(handle_shutdown,arg)
// close semaphore and kill server
pthread_cond_destroy( &eventShutdown);
- // exit main loop on main thread, so kill will be done from
- // main thread (this is thread 2)
+ /*
+ Exit main loop on main thread, so kill will be done from
+ main thread (this is thread 2)
+ */
abort_loop = 1;
// unblock select()
@@ -1584,8 +1592,9 @@ static void open_log(MYSQL_LOG *log, const char *hostname,
char tmp[FN_REFLEN];
if (!opt_name || !opt_name[0])
{
- /* TODO: The following should be using fn_format(); We just need to
- first change fn_format() to cut the file name if it's too long.
+ /*
+ TODO: The following should be using fn_format(); We just need to
+ first change fn_format() to cut the file name if it's too long.
*/
strmake(tmp,hostname,FN_REFLEN-5);
strmov(strcend(tmp,'.'),extension);
@@ -2136,9 +2145,11 @@ int main(int argc, char **argv)
}
}
- // This is a WIN95 machine or a start of mysqld as a standalone program
- // we have to pass the arguments, in case of NT-service this will be done
- // by ServiceMain()
+ /*
+ This is a WIN95 machine or a start of mysqld as a standalone program
+ we have to pass the arguments, in case of NT-service this will be done
+ by ServiceMain()
+ */
Service.my_argc=argc;
Service.my_argv=argv;
@@ -2726,8 +2737,10 @@ static struct option long_options[] = {
{"master-ssl-cert", optional_argument, 0, (int) OPT_MASTER_SSL_CERT},
{"myisam-recover", optional_argument, 0, (int) OPT_MYISAM_RECOVER},
{"memlock", no_argument, 0, (int) OPT_MEMLOCK},
- // needs to be available for the test case to pass in non-debugging mode
- // is a no-op
+ /*
+ Option needs to be available for the test case to pass in non-debugging
+ mode. is a no-op.
+ */
{"disconnect-slave-event-count", required_argument, 0,
(int) OPT_DISCONNECT_SLAVE_EVENT_COUNT},
{"abort-slave-event-count", required_argument, 0,
@@ -2762,8 +2775,7 @@ static struct option long_options[] = {
(int) OPT_REPLICATE_WILD_IGNORE_TABLE},
{"replicate-rewrite-db", required_argument, 0,
(int) OPT_REPLICATE_REWRITE_DB},
- // In replication, we may need to tell the other servers how to connect
- // to us
+ // In replication, we may need to tell the other servers how to connect
{"report-host", required_argument, 0, (int) OPT_REPORT_HOST},
{"report-user", required_argument, 0, (int) OPT_REPORT_USER},
{"report-password", required_argument, 0, (int) OPT_REPORT_PASSWORD},
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 7c5b56aa8b6..32318180081 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -2174,8 +2174,8 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table_name,
int setup_ftfuncs(THD *thd)
{
- List_iterator<Item_func_match> li(thd->lex.ftfunc_list),
- lj(thd->lex.ftfunc_list);
+ List_iterator<Item_func_match> li(thd->lex.select_lex.ftfunc_list),
+ lj(thd->lex.select_lex.ftfunc_list);
Item_func_match *ftf, *ftf2;
while ((ftf=li++))
@@ -2195,7 +2195,7 @@ int setup_ftfuncs(THD *thd)
int init_ftfuncs(THD *thd, bool no_order)
{
- List_iterator<Item_func_match> li(thd->lex.ftfunc_list);
+ List_iterator<Item_func_match> li(thd->lex.select_lex.ftfunc_list);
Item_func_match *ifm;
DBUG_PRINT("info",("Performing FULLTEXT search"));
thd->proc_info="FULLTEXT initialization";
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 464216d56ba..63e003178c2 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -1,24 +1,28 @@
/* Copyright (C) 2000 MySQL 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 */
+
/*
Delete of records and truncate of tables.
+
Multi-table deletes were introduced by Monty and Sinisa
*/
+
+
#include "mysql_priv.h"
#include "ha_innobase.h"
#include "sql_select.h"
@@ -75,7 +79,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
if (error)
DBUG_RETURN(-1);
if ((select && select->check_quick(test(thd->options & SQL_SAFE_UPDATES),
- limit)) ||
+ limit)) ||
!limit)
{
delete select;
@@ -125,8 +129,8 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
}
init_read_record(&info,thd,table,select,1,1);
- init_ftfuncs(thd,1);
deleted=0L;
+ init_ftfuncs(thd,1);
thd->proc_info="updating";
while (!(error=info.read_record(&info)) && !thd->killed)
{
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 20a645e52af..0eabd971027 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1718,7 +1718,7 @@ mysql_execute_command(void)
table_count)) && ! thd->fatal_error)
{
res=mysql_select(thd,tables,select_lex->item_list,
- select_lex->where,select_lex->ftfunc_list,
+ select_lex->where,
(ORDER *)NULL,(ORDER *)NULL,(Item *)NULL,
(ORDER *)NULL,
select_lex->options | thd->options |
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index acb29743356..abb1d891166 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -35,11 +35,10 @@ const char *join_type_str[]={ "UNKNOWN","system","const","eq_ref","ref",
"MAYBE_REF","ALL","range","index","fulltext" };
static bool make_join_statistics(JOIN *join,TABLE_LIST *tables,COND *conds,
- DYNAMIC_ARRAY *keyuse,List<Item_func_match> &ftfuncs);
+ DYNAMIC_ARRAY *keyuse);
static bool update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,
JOIN_TAB *join_tab,
- uint tables,COND *conds,table_map table_map,
- List<Item_func_match> &ftfuncs);
+ uint tables,COND *conds,table_map table_map);
static int sort_keyuse(KEYUSE *a,KEYUSE *b);
static void set_position(JOIN *join,uint index,JOIN_TAB *table,KEYUSE *key);
static void find_best_combination(JOIN *join,table_map rest_tables);
@@ -156,7 +155,6 @@ int handle_select(THD *thd, LEX *lex, select_result *result)
res=mysql_select(thd,(TABLE_LIST*) select_lex->table_list.first,
select_lex->item_list,
select_lex->where,
- select_lex->ftfunc_list,
(ORDER*) select_lex->order_list.first,
(ORDER*) select_lex->group_list.first,
select_lex->having,
@@ -177,7 +175,6 @@ int handle_select(THD *thd, LEX *lex, select_result *result)
int
mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
- List<Item_func_match> &ftfuncs,
ORDER *order, ORDER *group,Item *having,ORDER *proc_param,
ulong select_options,select_result *result)
{
@@ -220,7 +217,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
if (having->with_sum_func)
having->split_sum_func(all_fields);
}
- if (setup_ftfuncs(thd,tables,ftfuncs)) /* should be after having->fix_fields */
+ if (setup_ftfuncs(thd)) /* should be after having->fix_fields */
DBUG_RETURN(-1);
/*
Check if one one uses a not constant column with group functions
@@ -408,8 +405,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
/* Calculate how to do the join */
thd->proc_info="statistics";
- if (make_join_statistics(&join,tables,conds,&keyuse,ftfuncs) ||
- thd->fatal_error)
+ if (make_join_statistics(&join,tables,conds,&keyuse) || thd->fatal_error)
goto err;
thd->proc_info="preparing";
result->initialize_tables(&join);
@@ -532,7 +528,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
make_join_readinfo(&join,
(select_options & (SELECT_DESCRIBE |
SELECT_NO_JOIN_CACHE)) |
- (ftfuncs.elements ? SELECT_NO_JOIN_CACHE : 0));
+ (thd->lex.select_lex.ftfunc_list.elements ? SELECT_NO_JOIN_CACHE : 0));
/* Need to tell Innobase that to play it safe, it should fetch all
columns of the tables: this is because MySQL
@@ -599,18 +595,8 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
}
/* Perform FULLTEXT search before all regular searches */
- if (ftfuncs.elements)
- {
- List_iterator_fast<Item_func_match> li(ftfuncs);
- Item_func_match *ifm;
- DBUG_PRINT("info",("Performing FULLTEXT search"));
- thd->proc_info="FULLTEXT search init";
+ init_ftfuncs(thd,test(order));
- while ((ifm=li++))
- {
- ifm->init_search(test(order));
- }
- }
/* Create a tmp table if distinct or if the sort is too complicated */
if (need_tmp)
{
@@ -902,8 +888,7 @@ static ha_rows get_quick_record_count(SQL_SELECT *select,TABLE *table,
static bool
make_join_statistics(JOIN *join,TABLE_LIST *tables,COND *conds,
- DYNAMIC_ARRAY *keyuse_array,
- List<Item_func_match> &ftfuncs)
+ DYNAMIC_ARRAY *keyuse_array)
{
int error;
uint i,table_count,const_count,found_ref,refs,key,const_ref,eq_part;
@@ -1015,7 +1000,7 @@ make_join_statistics(JOIN *join,TABLE_LIST *tables,COND *conds,
if (conds || outer_join)
if (update_ref_and_keys(join->thd,keyuse_array,stat,join->tables,
- conds,~outer_join,ftfuncs))
+ conds,~outer_join))
DBUG_RETURN(1);
/* loop until no more const tables are found */
@@ -1524,8 +1509,7 @@ sort_keyuse(KEYUSE *a,KEYUSE *b)
static bool
update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
- uint tables, COND *cond, table_map normal_tables,
- List<Item_func_match> &ftfuncs)
+ uint tables, COND *cond, table_map normal_tables)
{
uint and_level,i,found_eq_constant;
@@ -1553,7 +1537,7 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
add_key_part(keyuse,field);
}
- if (ftfuncs.elements)
+ if (thd->lex.select_lex.ftfunc_list.elements)
{
add_ft_keys(keyuse,join_tab,cond,normal_tables);
}
@@ -1561,7 +1545,7 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
/*
** remove ref if there is a keypart which is a ref and a const.
** remove keyparts without previous keyparts.
- ** Special treatment for ft-keys. SerG.
+ ** Special treatment for ft-keys.
*/
if (keyuse->elements)
{
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index a6ea88d9adc..b2ffb97fa81 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -68,7 +68,6 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
res=mysql_select(thd, (TABLE_LIST*) sl->table_list.first,
sl->item_list,
sl->where,
- sl->ftfunc_list,
(sl->braces) ? (ORDER *) sl->order_list.first : (ORDER *) 0,
(ORDER*) sl->group_list.first,
sl->having,
@@ -127,7 +126,6 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
res=mysql_select(thd, (TABLE_LIST*) sl->table_list.first,
sl->item_list,
sl->where,
- sl->ftfunc_list,
(sl->braces) ? (ORDER *)sl->order_list.first : (ORDER *) 0,
(ORDER*) sl->group_list.first,
sl->having,
@@ -150,8 +148,12 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
/* Create a list of fields in the temporary table */
List_iterator<Item> it(item_list);
Field **field;
+#if 0
List<Item_func_match> ftfunc_list;
ftfunc_list.empty();
+#else
+ thd->lex.select_lex.ftfunc_list.empty();
+#endif
for (field=table->field ; *field ; field++)
{
@@ -170,7 +172,7 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
thd->options&= ~OPTION_FOUND_ROWS;
}
res=mysql_select(thd,&result_table_list,
- item_list, NULL, ftfunc_list, order,
+ item_list, NULL, /*ftfunc_list,*/ order,
(ORDER*) NULL, NULL, (ORDER*) NULL,
thd->options, result);
}