summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--VC++Files/libmysqld/libmysqld.dsp4
-rw-r--r--VC++Files/sql/mysqld.dsp4
-rw-r--r--VC++Files/test1/mysql_thr.c4
-rw-r--r--VC++Files/thr_test/thr_test.c4
-rw-r--r--client/mysql.cc1
-rw-r--r--include/my_pthread.h11
-rw-r--r--mysql-test/r/index_merge_innodb.result57
-rw-r--r--mysql-test/r/rowid_order_innodb.result2
-rw-r--r--mysql-test/r/rpl_flush_tables.result6
-rw-r--r--mysql-test/t/index_merge_innodb.test44
-rw-r--r--mysql-test/t/outfile.test18
-rw-r--r--mysql-test/t/rpl_flush_tables.test10
-rw-r--r--mysys/my_getopt.c45
-rw-r--r--mysys/my_os2thread.c2
-rw-r--r--mysys/my_winthread.c2
-rw-r--r--scripts/make_binary_distribution.sh260
-rw-r--r--server-tools/instance-manager/guardian.cc7
-rw-r--r--server-tools/instance-manager/guardian.h6
-rw-r--r--server-tools/instance-manager/instance.cc7
-rw-r--r--server-tools/instance-manager/listener.cc8
-rw-r--r--server-tools/instance-manager/listener.h6
-rw-r--r--server-tools/instance-manager/mysql_connection.cc9
-rw-r--r--server-tools/instance-manager/mysql_connection.h7
-rw-r--r--server-tools/instance-manager/user_map.cc2
-rw-r--r--sql/ha_innodb.cc2
-rw-r--r--sql/ha_ndbcluster.cc5
-rw-r--r--sql/mysql_priv.h6
-rw-r--r--sql/mysqld.cc32
-rw-r--r--sql/protocol_cursor.cc148
-rw-r--r--sql/repl_failsafe.cc2
-rw-r--r--sql/repl_failsafe.h2
-rw-r--r--sql/slave.cc10
-rw-r--r--sql/slave.h4
-rw-r--r--sql/sql_class.h4
-rw-r--r--sql/sql_insert.cc4
-rw-r--r--sql/sql_manager.cc2
-rw-r--r--sql/sql_parse.cc8
-rw-r--r--storage/myisam/ft_nlq_search.c3
-rw-r--r--storage/myisam/myisamdef.h2
-rw-r--r--storage/myisam/sort.c2
-rw-r--r--storage/ndb/src/ndbapi/ndb_cluster_connection.cpp2
-rw-r--r--tools/mysqlmanager.c9
42 files changed, 363 insertions, 410 deletions
diff --git a/VC++Files/libmysqld/libmysqld.dsp b/VC++Files/libmysqld/libmysqld.dsp
index 242ec7b9cfe..9ee0165b01a 100644
--- a/VC++Files/libmysqld/libmysqld.dsp
+++ b/VC++Files/libmysqld/libmysqld.dsp
@@ -396,10 +396,6 @@ SOURCE=..\sql\protocol.cpp
# End Source File
# Begin Source File
-SOURCE=..\sql\protocol_cursor.cpp
-# End Source File
-# Begin Source File
-
SOURCE=..\sql\records.cpp
# End Source File
# Begin Source File
diff --git a/VC++Files/sql/mysqld.dsp b/VC++Files/sql/mysqld.dsp
index 3957f92f364..56319ac1aaf 100644
--- a/VC++Files/sql/mysqld.dsp
+++ b/VC++Files/sql/mysqld.dsp
@@ -1279,10 +1279,6 @@ SOURCE=.\protocol.cpp
# End Source File
# Begin Source File
-SOURCE=.\protocol_cursor.cpp
-# End Source File
-# Begin Source File
-
SOURCE=.\records.cpp
!IF "$(CFG)" == "mysqld - Win32 Release"
diff --git a/VC++Files/test1/mysql_thr.c b/VC++Files/test1/mysql_thr.c
index c2743cb8e4c..de1d936806e 100644
--- a/VC++Files/test1/mysql_thr.c
+++ b/VC++Files/test1/mysql_thr.c
@@ -33,7 +33,7 @@ typedef CRITICAL_SECTION pthread_mutex_t;
#define pthread_mutex_lock(A) (EnterCriticalSection(A),0)
#define pthread_mutex_unlock(A) LeaveCriticalSection(A)
#define pthread_mutex_destroy(A) DeleteCriticalSection(A)
-#define pthread_handler_decl(A,B) unsigned __cdecl A(void *B)
+#define pthread_handler_t unsigned __cdecl *
typedef unsigned (__cdecl *pthread_handler)(void *);
#define pthread_self() GetCurrentThread()
@@ -155,7 +155,7 @@ int _my_errno(void)
** The test program
*****************************************************************************/
-pthread_handler_decl(test_thread,arg)
+pthread_handler_t test_thread(void *arg)
{
MYSQL mysql;
MYSQL_RES *res;
diff --git a/VC++Files/thr_test/thr_test.c b/VC++Files/thr_test/thr_test.c
index 3427eed8441..100fcb9c45e 100644
--- a/VC++Files/thr_test/thr_test.c
+++ b/VC++Files/thr_test/thr_test.c
@@ -44,7 +44,7 @@ typedef CRITICAL_SECTION pthread_mutex_t;
#define pthread_mutex_lock(A) (EnterCriticalSection(A),0)
#define pthread_mutex_unlock(A) LeaveCriticalSection(A)
#define pthread_mutex_destroy(A) DeleteCriticalSection(A)
-#define pthread_handler_decl(A,B) unsigned __cdecl A(void *B)
+#define pthread_handler_t unsigned __cdecl *
typedef unsigned (__cdecl *pthread_handler)(void *);
#define pthread_self() GetCurrentThread()
@@ -174,7 +174,7 @@ int _my_errno(void)
** The test program
*****************************************************************************/
-pthread_handler_decl(test_thread,arg)
+pthread_handler_t test_thread(void *arg)
{
pthread_mutex_lock(&LOCK_thread_count);
thread_count--;
diff --git a/client/mysql.cc b/client/mysql.cc
index 65d520fe4b4..2dcfffdd3ac 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -1014,7 +1014,6 @@ static int read_and_execute(bool interactive)
unsigned long clen;
do
{
- line= my_cgets((char*)tmpbuf.ptr(), tmpbuf.alloced_length()-1, &clen);
buffer.append(line, clen);
/*
if we got buffer fully filled than there is a chance that
diff --git a/include/my_pthread.h b/include/my_pthread.h
index 057b71356db..1dd1ead7dfa 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -25,7 +25,10 @@
#endif
#ifdef __cplusplus
+#define EXTERN_C extern "C"
extern "C" {
+#else
+#define EXTERN_C
#endif /* __cplusplus */
#if defined(__WIN__) || defined(OS2)
@@ -77,10 +80,10 @@ struct timespec { /* For pthread_cond_timedwait() */
typedef int pthread_mutexattr_t;
#define win_pthread_self my_thread_var->pthread_self
#ifdef OS2
-#define pthread_handler_decl(A,B) void * _Optlink A(void *B)
+#define pthread_handler_t EXTERN_C void * _Optlink
typedef void * (_Optlink *pthread_handler)(void *);
#else
-#define pthread_handler_decl(A,B) void * __cdecl A(void *B)
+#define pthread_handler_t EXTERN_C void * __cdecl
typedef void * (__cdecl *pthread_handler)(void *);
#endif
@@ -184,7 +187,7 @@ typedef int pthread_attr_t; /* Needed by Unixware 7.0.0 */
#define pthread_key_create(A,B) thr_keycreate((A),(B))
#define pthread_key_delete(A) thr_keydelete(A)
-#define pthread_handler_decl(A,B) void *A(void *B)
+#define pthread_handler_t EXTERN_C void *
#define pthread_key(T,V) pthread_key_t V
void * my_pthread_getspecific_imp(pthread_key_t key);
@@ -262,7 +265,7 @@ extern int my_pthread_getprio(pthread_t thread_id);
#define my_pthread_getspecific_ptr(T,V) my_pthread_getspecific(T,(V))
#define my_pthread_setspecific_ptr(T,V) pthread_setspecific(T,(void*) (V))
#define pthread_detach_this_thread()
-#define pthread_handler_decl(A,B) void *A(void *B)
+#define pthread_handler_t EXTERN_C void *
typedef void *(* pthread_handler)(void *);
/* Test first for RTS or FSU threads */
diff --git a/mysql-test/r/index_merge_innodb.result b/mysql-test/r/index_merge_innodb.result
index 81e5fa6767d..4dac5f3b62b 100644
--- a/mysql-test/r/index_merge_innodb.result
+++ b/mysql-test/r/index_merge_innodb.result
@@ -203,3 +203,60 @@ oid fk_bbk_niederlassung fk_wochentag uhrzeit_von uhrzeit_bis geloescht version
21 7 1 08:00:00 13:00:00 0 1
drop view v1;
drop table t1;
+CREATE TABLE t1(
+t_cpac varchar(2) NOT NULL,
+t_vers varchar(4) NOT NULL,
+t_rele varchar(2) NOT NULL,
+t_cust varchar(4) NOT NULL,
+filler1 char(250) default NULL,
+filler2 char(250) default NULL,
+PRIMARY KEY (t_cpac,t_vers,t_rele,t_cust),
+UNIQUE KEY IX_4 (t_cust,t_cpac,t_vers,t_rele),
+KEY IX_5 (t_vers,t_rele,t_cust)
+) ENGINE=InnoDB;
+insert into t1 values
+('tm','2.5 ','a ',' ','',''), ('tm','2.5U','a ','stnd','',''),
+('da','3.3 ','b ',' ','',''), ('da','3.3U','b ','stnd','',''),
+('tl','7.6 ','a ',' ','',''), ('tt','7.6 ','a ',' ','',''),
+('bc','B61 ','a ',' ','',''), ('bp','B61 ','a ',' ','',''),
+('ca','B61 ','a ',' ','',''), ('ci','B61 ','a ',' ','',''),
+('cp','B61 ','a ',' ','',''), ('dm','B61 ','a ',' ','',''),
+('ec','B61 ','a ',' ','',''), ('ed','B61 ','a ',' ','',''),
+('fm','B61 ','a ',' ','',''), ('nt','B61 ','a ',' ','',''),
+('qm','B61 ','a ',' ','',''), ('tc','B61 ','a ',' ','',''),
+('td','B61 ','a ',' ','',''), ('tf','B61 ','a ',' ','',''),
+('tg','B61 ','a ',' ','',''), ('ti','B61 ','a ',' ','',''),
+('tp','B61 ','a ',' ','',''), ('ts','B61 ','a ',' ','',''),
+('wh','B61 ','a ',' ','',''), ('bc','B61U','a ','stnd','',''),
+('bp','B61U','a ','stnd','',''), ('ca','B61U','a ','stnd','',''),
+('ci','B61U','a ','stnd','',''), ('cp','B61U','a ','stnd','',''),
+('dm','B61U','a ','stnd','',''), ('ec','B61U','a ','stnd','',''),
+('fm','B61U','a ','stnd','',''), ('nt','B61U','a ','stnd','',''),
+('qm','B61U','a ','stnd','',''), ('tc','B61U','a ','stnd','',''),
+('td','B61U','a ','stnd','',''), ('tf','B61U','a ','stnd','',''),
+('tg','B61U','a ','stnd','',''), ('ti','B61U','a ','stnd','',''),
+('tp','B61U','a ','stnd','',''), ('ts','B61U','a ','stnd','',''),
+('wh','B61U','a ','stnd','','');
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `t_cpac` varchar(2) NOT NULL,
+ `t_vers` varchar(4) NOT NULL,
+ `t_rele` varchar(2) NOT NULL,
+ `t_cust` varchar(4) NOT NULL,
+ `filler1` char(250) default NULL,
+ `filler2` char(250) default NULL,
+ PRIMARY KEY (`t_cpac`,`t_vers`,`t_rele`,`t_cust`),
+ UNIQUE KEY `IX_4` (`t_cust`,`t_cpac`,`t_vers`,`t_rele`),
+ KEY `IX_5` (`t_vers`,`t_rele`,`t_cust`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+select t_vers,t_rele,t_cust,filler1 from t1 where t_vers = '7.6';
+t_vers t_rele t_cust filler1
+7.6 a
+7.6 a
+select t_vers,t_rele,t_cust,filler1 from t1 where t_vers = '7.6'
+ and t_rele='a' and t_cust = ' ';
+t_vers t_rele t_cust filler1
+7.6 a
+7.6 a
+drop table t1;
diff --git a/mysql-test/r/rowid_order_innodb.result b/mysql-test/r/rowid_order_innodb.result
index d55029f9064..f76002e9cb2 100644
--- a/mysql-test/r/rowid_order_innodb.result
+++ b/mysql-test/r/rowid_order_innodb.result
@@ -178,9 +178,9 @@ insert into t1 values ('','empt',2,2),
('dddd','d--d',2,2);
select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
pk1 pk2 key1 key2
+ empt 2 2
a a--a 2 2
bb b--b 2 2
ccc c--c 2 2
dddd d--d 2 2
- empt 2 2
drop table t1;
diff --git a/mysql-test/r/rpl_flush_tables.result b/mysql-test/r/rpl_flush_tables.result
index ca2e77cac66..667530c4071 100644
--- a/mysql-test/r/rpl_flush_tables.result
+++ b/mysql-test/r/rpl_flush_tables.result
@@ -38,3 +38,9 @@ master-bin.000001 # Query 1 # use `test`; rename table t1 to t5, t2 to t1
master-bin.000001 # Query 1 # use `test`; flush tables
select * from t3;
a
+stop slave;
+drop table t1;
+flush tables with read lock;
+start slave;
+stop slave;
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
diff --git a/mysql-test/t/index_merge_innodb.test b/mysql-test/t/index_merge_innodb.test
index 3ed7d44981b..a48626a9ec3 100644
--- a/mysql-test/t/index_merge_innodb.test
+++ b/mysql-test/t/index_merge_innodb.test
@@ -204,3 +204,47 @@ and (zeit1.geloescht = 0);
select * from v1 where oid = 21;
drop view v1;
drop table t1;
+##
+CREATE TABLE t1(
+ t_cpac varchar(2) NOT NULL,
+ t_vers varchar(4) NOT NULL,
+ t_rele varchar(2) NOT NULL,
+ t_cust varchar(4) NOT NULL,
+ filler1 char(250) default NULL,
+ filler2 char(250) default NULL,
+ PRIMARY KEY (t_cpac,t_vers,t_rele,t_cust),
+ UNIQUE KEY IX_4 (t_cust,t_cpac,t_vers,t_rele),
+ KEY IX_5 (t_vers,t_rele,t_cust)
+) ENGINE=InnoDB;
+
+insert into t1 values
+('tm','2.5 ','a ',' ','',''), ('tm','2.5U','a ','stnd','',''),
+('da','3.3 ','b ',' ','',''), ('da','3.3U','b ','stnd','',''),
+('tl','7.6 ','a ',' ','',''), ('tt','7.6 ','a ',' ','',''),
+('bc','B61 ','a ',' ','',''), ('bp','B61 ','a ',' ','',''),
+('ca','B61 ','a ',' ','',''), ('ci','B61 ','a ',' ','',''),
+('cp','B61 ','a ',' ','',''), ('dm','B61 ','a ',' ','',''),
+('ec','B61 ','a ',' ','',''), ('ed','B61 ','a ',' ','',''),
+('fm','B61 ','a ',' ','',''), ('nt','B61 ','a ',' ','',''),
+('qm','B61 ','a ',' ','',''), ('tc','B61 ','a ',' ','',''),
+('td','B61 ','a ',' ','',''), ('tf','B61 ','a ',' ','',''),
+('tg','B61 ','a ',' ','',''), ('ti','B61 ','a ',' ','',''),
+('tp','B61 ','a ',' ','',''), ('ts','B61 ','a ',' ','',''),
+('wh','B61 ','a ',' ','',''), ('bc','B61U','a ','stnd','',''),
+('bp','B61U','a ','stnd','',''), ('ca','B61U','a ','stnd','',''),
+('ci','B61U','a ','stnd','',''), ('cp','B61U','a ','stnd','',''),
+('dm','B61U','a ','stnd','',''), ('ec','B61U','a ','stnd','',''),
+('fm','B61U','a ','stnd','',''), ('nt','B61U','a ','stnd','',''),
+('qm','B61U','a ','stnd','',''), ('tc','B61U','a ','stnd','',''),
+('td','B61U','a ','stnd','',''), ('tf','B61U','a ','stnd','',''),
+('tg','B61U','a ','stnd','',''), ('ti','B61U','a ','stnd','',''),
+('tp','B61U','a ','stnd','',''), ('ts','B61U','a ','stnd','',''),
+('wh','B61U','a ','stnd','','');
+show create table t1;
+
+select t_vers,t_rele,t_cust,filler1 from t1 where t_vers = '7.6';
+select t_vers,t_rele,t_cust,filler1 from t1 where t_vers = '7.6'
+ and t_rele='a' and t_cust = ' ';
+
+drop table t1;
+
diff --git a/mysql-test/t/outfile.test b/mysql-test/t/outfile.test
index a74bebe1460..37e96d9d38d 100644
--- a/mysql-test/t/outfile.test
+++ b/mysql-test/t/outfile.test
@@ -65,3 +65,21 @@ EXPLAIN
DROP TABLE t1;
# End of 4.1 tests
+
+#
+# Bug#13202 SELECT * INTO OUTFILE ... FROM information_schema.schemata now fails
+#
+disable_query_log;
+eval SELECT * INTO OUTFILE "$MYSQL_TEST_DIR/var/tmp/outfile-test.4"
+FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
+FROM information_schema.schemata LIMIT 0, 5;
+# enable_query_log;
+--exec rm $MYSQL_TEST_DIR/var/tmp/outfile-test.4
+
+use information_schema;
+# disable_query_log;
+eval SELECT * INTO OUTFILE "$MYSQL_TEST_DIR/var/tmp/outfile-test.4"
+FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
+FROM schemata LIMIT 0, 5;
+enable_query_log;
+--exec rm $MYSQL_TEST_DIR/var/tmp/outfile-test.4
diff --git a/mysql-test/t/rpl_flush_tables.test b/mysql-test/t/rpl_flush_tables.test
index 4411d6ea1c9..92aef9c85d0 100644
--- a/mysql-test/t/rpl_flush_tables.test
+++ b/mysql-test/t/rpl_flush_tables.test
@@ -39,5 +39,15 @@ select * from t3;
# Note that all this confusion may cause warnings 'table xx is open on rename'
# in the .err files; these are not fatal and are not reported by mysql-test-run.
+stop slave;
+connection master;
+drop table t1;
+connection slave;
+flush tables with read lock;
+start slave;
+sleep 1;
+--error 1192
+stop slave;
+
# End of 4.1 tests
# Adding comment for force manual merge 5.0 -> wl1012. Delete me if needed.
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c
index e9e20fe4024..31ef21632b9 100644
--- a/mysys/my_getopt.c
+++ b/mysys/my_getopt.c
@@ -358,7 +358,8 @@ invalid value '%s'\n",
continue;
}
get_one_option(optp->id, optp,
- value ? (char*) "1" : disabled_my_option);
+ *((my_bool*) value) ?
+ (char*) "1" : disabled_my_option);
continue;
}
argument= optend;
@@ -599,16 +600,27 @@ static int setval(const struct my_option *opts, gptr *value, char *argument,
return 0;
}
-/*
- function: findopt
- Arguments: opt_pattern, length of opt_pattern, opt_struct, first found
- name (ffname)
+/*
+ Find option
- Go through all options in the my_option struct. Return number
- of options found that match the pattern and in the argument
- list the option found, if any. In case of ambiguous option, store
- the name in ffname argument
+ SYNOPSIS
+ findopt()
+ optpat Prefix of option to find (with - or _)
+ length Length of optpat
+ opt_res Options
+ ffname Place for pointer to first found name
+
+ IMPLEMENTATION
+ Go through all options in the my_option struct. Return number
+ of options found that match the pattern and in the argument
+ list the option found, if any. In case of ambiguous option, store
+ the name in ffname argument
+
+ RETURN
+ 0 No matching options
+ # Number of matching options
+ ffname points to first matching option
*/
static int findopt(char *optpat, uint length,
@@ -623,12 +635,21 @@ static int findopt(char *optpat, uint length,
if (!getopt_compare_strings(opt->name, optpat, length)) /* match found */
{
(*opt_res)= opt;
- if (!count)
- *ffname= (char *) opt->name; /* We only need to know one prev */
if (!opt->name[length]) /* Exact match */
return 1;
- if (!count || strcmp(*ffname, opt->name)) /* Don't count synonyms */
+ if (!count)
+ {
+ count= 1;
+ *ffname= (char *) opt->name; /* We only need to know one prev */
+ }
+ else if (strcmp(*ffname, opt->name))
+ {
+ /*
+ The above test is to not count same option twice
+ (see mysql.cc, option "help")
+ */
count++;
+ }
}
}
return count;
diff --git a/mysys/my_os2thread.c b/mysys/my_os2thread.c
index 0696f480a91..785ff07954d 100644
--- a/mysys/my_os2thread.c
+++ b/mysys/my_os2thread.c
@@ -51,7 +51,7 @@ void win_pthread_init(void)
** in the new thread.
*/
-static pthread_handler_decl(pthread_start,param)
+pthread_handler_t pthread_start(void *param)
{
DBUG_ENTER("pthread_start");
pthread_handler func=((struct pthread_map *) param)->func;
diff --git a/mysys/my_winthread.c b/mysys/my_winthread.c
index eebc07df180..8aaf3b1e31c 100644
--- a/mysys/my_winthread.c
+++ b/mysys/my_winthread.c
@@ -51,7 +51,7 @@ void win_pthread_init(void)
** in the new thread.
*/
-static pthread_handler_decl(pthread_start,param)
+pthread_handler_t pthread_start(void *param)
{
pthread_handler func=((struct pthread_map *) param)->func;
void *func_param=((struct pthread_map *) param)->param;
diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh
index 9c2ae9c42f2..734e3f70b13 100644
--- a/scripts/make_binary_distribution.sh
+++ b/scripts/make_binary_distribution.sh
@@ -1,56 +1,78 @@
#!/bin/sh
-# The default path should be /usr/local
-# Get some info from configure
-# chmod +x ./scripts/setsomevars
+# This is a script to create a TAR or ZIP binary distribution out of a
+# built source tree. The output file will be put at the top level of
+# the source tree, as "mysql-<vsn>....{tar.gz,zip}"
+#
+# The temporary directory path given to "--tmp=<path>" has to be
+# absolute and with no spaces.
machine=@MACHINE_TYPE@
system=@SYSTEM_TYPE@
version=@VERSION@
-export machine system version
-SOURCE=`pwd`
+SOURCE=`pwd`
CP="cp -p"
MV="mv"
STRIP=1
DEBUG=0
SILENT=0
-MACHINE=
+MACHINE=""
+PLATFORM=""
TMP=/tmp
SUFFIX=""
-NDBCLUSTER=
-
-parse_arguments() {
- for arg do
- case "$arg" in
- --debug) DEBUG=1;;
- --tmp=*) TMP=`echo "$arg" | sed -e "s;--tmp=;;"` ;;
- --suffix=*) SUFFIX=`echo "$arg" | sed -e "s;--suffix=;;"` ;;
- --no-strip) STRIP=0 ;;
- --machine=*) MACHINE=`echo "$arg" | sed -e "s;--machine=;;"` ;;
- --silent) SILENT=1 ;;
- --with-ndbcluster) NDBCLUSTER=1 ;;
- *)
- echo "Unknown argument '$arg'"
- exit 1
- ;;
- esac
- done
-}
+NDBCLUSTER=""
+
+for arg do
+ case "$arg" in
+ --debug) DEBUG=1;;
+ --tmp=*) TMP=`echo "$arg" | sed -e "s;--tmp=;;"` ;;
+ --suffix=*) SUFFIX=`echo "$arg" | sed -e "s;--suffix=;;"` ;;
+ --no-strip) STRIP=0 ;;
+ --machine=*) MACHINE=`echo "$arg" | sed -e "s;--machine=;;"` ;;
+ --platform=*) PLATFORM=`echo "$arg" | sed -e "s;--platform=;;"` ;;
+ --silent) SILENT=1 ;;
+ --with-ndbcluster) NDBCLUSTER=1 ;;
+ *)
+ echo "Unknown argument '$arg'"
+ exit 1
+ ;;
+ esac
+done
-parse_arguments "$@"
+# Remove vendor from $system
+system=`echo $system | sed -e 's/[a-z]*-\(.*\)/\1/g'`
+# Map OS names to "our" OS names (eg. darwin6.8 -> osx10.2)
+system=`echo $system | sed -e 's/darwin6.*/osx10.2/g'`
+system=`echo $system | sed -e 's/darwin7.*/osx10.3/g'`
+system=`echo $system | sed -e 's/darwin8.*/osx10.4/g'`
+system=`echo $system | sed -e 's/\(aix4.3\).*/\1/g'`
+system=`echo $system | sed -e 's/\(aix5.1\).*/\1/g'`
+system=`echo $system | sed -e 's/\(aix5.2\).*/\1/g'`
+system=`echo $system | sed -e 's/\(aix5.3\).*/\1/g'`
+system=`echo $system | sed -e 's/osf5.1b/tru64/g'`
+system=`echo $system | sed -e 's/linux-gnu/linux/g'`
+system=`echo $system | sed -e 's/solaris2.\([0-9]*\)/solaris\1/g'`
+system=`echo $system | sed -e 's/sco3.2v\(.*\)/openserver\1/g'`
+if [ x"$MACHINE" != x"" ] ; then
+ machine=$MACHINE
+fi
-#make
+if [ x"$PLATFORM" != x"" ] ; then
+ platform="$PLATFORM"
+else
+ platform="$system-$machine"
+fi
-# This should really be integrated with automake and not duplicate the
+# FIXME This should really be integrated with automake and not duplicate the
# installation list.
BASE=$TMP/my_dist$SUFFIX
if [ -d $BASE ] ; then
- rm -r -f $BASE
+ rm -rf $BASE
fi
BS=""
@@ -79,25 +101,29 @@ if [ $BASE_SYSTEM != "netware" ] ; then
chmod o-rwx $BASE/data $BASE/data/*
fi
-for i in ChangeLog \
- Docs/mysql.info
-do
- if [ -f $i ]
- then
- $CP $i $BASE/docs
- fi
-done
+# Copy files if they exists, warn for those that don't
+copyfileto()
+{
+ destdir=$1
+ shift
+ for i
+ do
+ if [ -f $i ] ; then
+ $CP $i $destdir
+ elif [ -d $i ] ; then
+ echo "Warning: Will not copy directory \"$i\""
+ else
+ echo "Warning: Listed file not found \"$i\""
+ fi
+ done
+}
+
+copyfileto $BASE/docs ChangeLog Docs/mysql.info
-for i in COPYING COPYING.LIB README Docs/INSTALL-BINARY \
+copyfileto $BASE COPYING COPYING.LIB README Docs/INSTALL-BINARY \
EXCEPTIONS-CLIENT MySQLEULA.txt LICENSE.doc README.NW
-do
- if [ -f $i ]
- then
- $CP $i $BASE
- fi
-done
-# Non platform-specific bin files:
+# Non platform-specific bin dir files:
BIN_FILES="extra/comp_err$BS extra/replace$BS extra/perror$BS \
extra/resolveip$BS extra/my_print_defaults$BS \
extra/resolve_stack_dump$BS extra/mysql_waitpid$BS \
@@ -114,7 +140,7 @@ BIN_FILES="extra/comp_err$BS extra/replace$BS extra/perror$BS \
libmysqld/examples/mysqltest_embedded$BS \
";
-# Platform-specific bin files:
+# Platform-specific bin dir files:
if [ $BASE_SYSTEM = "netware" ] ; then
BIN_FILES="$BIN_FILES \
netware/mysqld_safe$BS netware/mysql_install_db$BS \
@@ -137,33 +163,21 @@ else
";
fi
-for i in $BIN_FILES
-do
- if [ -f $i ]
- then
- $CP $i $BASE/bin
- fi
-done
+copyfileto $BASE/bin $BIN_FILES
if [ x$STRIP = x1 ] ; then
strip $BASE/bin/*
fi
# Copy not binary files
-for i in sql/mysqld.sym.gz
-do
- if [ -f $i ]
- then
- $CP $i $BASE/bin
- fi
-done
+copyfileto $BASE/bin sql/mysqld.sym.gz
if [ $BASE_SYSTEM = "netware" ] ; then
- $CP -r netware/*.pl $BASE/scripts
+ $CP netware/*.pl $BASE/scripts
$CP scripts/mysqlhotcopy $BASE/scripts/mysqlhotcopy.pl
fi
-for i in \
+copyfileto $BASE/lib \
libmysql/.libs/libmysqlclient.a libmysql/.libs/libmysqlclient.so* \
libmysql/libmysqlclient.* libmysql_r/.libs/libmysqlclient_r.a \
libmysql_r/.libs/libmysqlclient_r.so* libmysql_r/libmysqlclient_r.* \
@@ -171,12 +185,6 @@ for i in \
libmysqld/.libs/libmysqld.a libmysqld/.libs/libmysqld.so* \
libmysqld/libmysqld.a netware/libmysql.imp \
zlib/.libs/libz.a
-do
- if [ -f $i ]
- then
- $CP $i $BASE/lib
- fi
-done
# convert the .a to .lib for NetWare
if [ $BASE_SYSTEM = "netware" ] ; then
@@ -187,7 +195,8 @@ if [ $BASE_SYSTEM = "netware" ] ; then
done
fi
-$CP config.h include/* $BASE/include
+copyfileto $BASE/include config.h include/*
+
rm -f $BASE/include/Makefile* $BASE/include/*.in $BASE/include/config-win.h
if [ $BASE_SYSTEM != "netware" ] ; then
rm -f $BASE/include/config-netware.h
@@ -202,22 +211,18 @@ if [ $BASE_SYSTEM != "netware" ] ; then
fi
fi
-$CP support-files/* $BASE/support-files
-$CP scripts/*.sql $BASE/share
+copyfileto $BASE/support-files support-files/*
+
+copyfileto $BASE/share scripts/*.sql
$CP -r sql/share/* $MYSQL_SHARE
rm -f $MYSQL_SHARE/Makefile* $MYSQL_SHARE/*/*.OLD
-for i in mysql-test/mysql-test-run mysql-test/install_test_db \
+copyfileto $BASE/mysql-test \
+ mysql-test/mysql-test-run mysql-test/install_test_db \
mysql-test/mysql-test-run.pl mysql-test/README \
mysql-test/valgrind.supp \
netware/mysql_test_run.nlm netware/install_test_db.ncf
-do
- if [ -f $i ]
- then
- $CP $i $BASE/mysql-test
- fi
-done
$CP mysql-test/lib/*.pl $BASE/mysql-test/lib
$CP mysql-test/lib/*.sql $BASE/mysql-test/lib
@@ -234,19 +239,29 @@ $CP mysql-test/r/*.result mysql-test/r/*.require \
if [ $BASE_SYSTEM != "netware" ] ; then
chmod a+x $BASE/bin/*
- $CP scripts/* $BASE/bin
- $BASE/bin/replace \@localstatedir\@ ./data \@bindir\@ ./bin \@scriptdir\@ ./bin \@libexecdir\@ ./bin \@sbindir\@ ./bin \@prefix\@ . \@HOSTNAME\@ @HOSTNAME@ \@pkgdatadir\@ ./support-files < $SOURCE/scripts/mysql_install_db.sh > $BASE/scripts/mysql_install_db
- $BASE/bin/replace \@prefix\@ /usr/local/mysql \@bindir\@ ./bin \@sbindir\@ ./bin \@libexecdir\@ ./bin \@MYSQLD_USER\@ @MYSQLD_USER@ \@localstatedir\@ /usr/local/mysql/data \@HOSTNAME\@ @HOSTNAME@ < $SOURCE/support-files/mysql.server.sh > $BASE/support-files/mysql.server
+ copyfileto $BASE/bin scripts/*
+ $BASE/bin/replace \@localstatedir\@ ./data \@bindir\@ ./bin \@scriptdir\@ \
+ ./bin \@libexecdir\@ ./bin \@sbindir\@ ./bin \@prefix\@ . \@HOSTNAME\@ \
+ @HOSTNAME@ \@pkgdatadir\@ ./support-files \
+ < scripts/mysql_install_db.sh > $BASE/scripts/mysql_install_db
+ $BASE/bin/replace \@prefix\@ /usr/local/mysql \@bindir\@ ./bin \
+ \@sbindir\@ ./bin \@libexecdir\@ ./bin \
+ \@MYSQLD_USER\@ @MYSQLD_USER@ \@localstatedir\@ /usr/local/mysql/data \
+ \@HOSTNAME\@ @HOSTNAME@ \
+ < support-files/mysql.server.sh > $BASE/support-files/mysql.server
$BASE/bin/replace /my/gnu/bin/hostname /bin/hostname -- $BASE/bin/mysqld_safe
mv $BASE/support-files/binary-configure $BASE/configure
- chmod a+x $BASE/bin/* $BASE/scripts/* $BASE/support-files/mysql-* $BASE/support-files/mysql.server $BASE/configure
+ chmod a+x $BASE/bin/* $BASE/scripts/* $BASE/support-files/mysql-* \
+ $BASE/support-files/mysql.server $BASE/configure
$CP -r sql-bench/* $BASE/sql-bench
rm -f $BASE/sql-bench/*.sh $BASE/sql-bench/Makefile* $BASE/lib/*.la
rm -f $BASE/bin/*.sql
fi
-rm -f $BASE/bin/Makefile* $BASE/bin/*.in $BASE/bin/*.sh $BASE/bin/mysql_install_db $BASE/bin/make_binary_distribution $BASE/bin/setsomevars $BASE/support-files/Makefile* $BASE/support-files/*.sh
-
+rm -f $BASE/bin/Makefile* $BASE/bin/*.in $BASE/bin/*.sh \
+ $BASE/bin/mysql_install_db $BASE/bin/make_binary_distribution \
+ $BASE/bin/setsomevars $BASE/support-files/Makefile* \
+ $BASE/support-files/*.sh
#
# Copy system dependent files
@@ -280,9 +295,9 @@ if [ $BASE_SYSTEM != "netware" ] ; then
fi
# Clean up if we did this from a bk tree
-if [ -d $BASE/sql-bench/SCCS ] ; then
- find $BASE/share -name SCCS -print | xargs rm -r -f
- find $BASE/sql-bench -name SCCS -print | xargs rm -r -f
+if [ -d $BASE/sql-bench/SCCS ] ; then
+ find $BASE/share -name SCCS -print | xargs rm -rf
+ find $BASE/sql-bench -name SCCS -print | xargs rm -rf
fi
# NDB Cluster
@@ -297,52 +312,27 @@ if [ x$NDBCLUSTER = x1 ]; then
rm -rf $BASE/ndb-stage
fi
-# Remove vendor from $system
-system=`echo $system | sed -e 's/[a-z]*-\(.*\)/\1/g'`
-
-# Map OS names to "our" OS names (eg. darwin6.8 -> osx10.2)
-system=`echo $system | sed -e 's/darwin6.*/osx10.2/g'`
-system=`echo $system | sed -e 's/darwin7.*/osx10.3/g'`
-system=`echo $system | sed -e 's/darwin8.*/osx10.4/g'`
-system=`echo $system | sed -e 's/\(aix4.3\).*/\1/g'`
-system=`echo $system | sed -e 's/\(aix5.1\).*/\1/g'`
-system=`echo $system | sed -e 's/\(aix5.2\).*/\1/g'`
-system=`echo $system | sed -e 's/\(aix5.3\).*/\1/g'`
-system=`echo $system | sed -e 's/osf5.1b/tru64/g'`
-system=`echo $system | sed -e 's/linux-gnu/linux/g'`
-system=`echo $system | sed -e 's/solaris2.\([0-9]*\)/solaris\1/g'`
-system=`echo $system | sed -e 's/sco3.2v\(.*\)/openserver\1/g'`
-
-# Use the override --machine if present
-if [ -n "$MACHINE" ] ; then
- machine=$MACHINE
-fi
-
# Change the distribution to a long descriptive name
-NEW_NAME=mysql@MYSQL_SERVER_SUFFIX@-$version-$system-$machine$SUFFIX
+NEW_NAME=mysql@MYSQL_SERVER_SUFFIX@-$version-$platform$SUFFIX
# Print the platform name for build logs
-echo "PLATFORM NAME: $system-$machine"
+echo "PLATFORM NAME: $platform"
BASE2=$TMP/$NEW_NAME
-rm -r -f $BASE2
+rm -rf $BASE2
mv $BASE $BASE2
BASE=$BASE2
#
# If we are compiling with gcc, copy libgcc.a to the distribution as libmygcc.a
#
-if test "@GXX@" = "yes"
-then
- cd $BASE/lib
+if [ x"@GXX@" = x"yes" ] ; then
gcclib=`@CC@ --print-libgcc-file`
- if test $? -ne 0
- then
+ if [ $? -ne 0 ] ; then
print "Warning: Couldn't find libgcc.a!"
else
- $CP $gcclib libmygcc.a
+ $CP $gcclib $BASE/lib/libmygcc.a
fi
- cd $SOURCE
fi
#if we are debugging, do not do tar/gz
@@ -353,7 +343,9 @@ fi
# This is needed to prefere gnu tar instead of tar because tar can't
# always handle long filenames
-PATH_DIRS=`echo $PATH | sed -e 's/^:/. /' -e 's/:$/ ./' -e 's/::/ . /g' -e 's/:/ /g' `
+PATH_DIRS=`echo $PATH | \
+ sed -e 's/^:/. /' -e 's/:$/ ./' -e 's/::/ . /g' -e 's/:/ /g' `
+
which_1 ()
{
for cmd
@@ -362,8 +354,7 @@ which_1 ()
do
for file in $d/$cmd
do
- if test -x $file -a ! -d $file
- then
+ if [ -x $file -a ! -d $file ] ; then
echo $file
exit 0
fi
@@ -378,38 +369,35 @@ if [ $BASE_SYSTEM != "netware" ] ; then
#
# Create the result tar file
#
-
+
tar=`which_1 gnutar gtar`
- if test "$?" = "1" -o "$tar" = ""
- then
+ if [ "$?" = "1" -o x"$tar" = x"" ] ; then
tar=tar
fi
-
+
echo "Using $tar to create archive"
- cd $TMP
-
+
OPT=cvf
if [ x$SILENT = x1 ] ; then
OPT=cf
fi
-
- $tar $OPT $SOURCE/$NEW_NAME.tar $NEW_NAME
- cd $SOURCE
- echo "Compressing archive"
+
+ echo "Creating and compressing archive"
rm -f $NEW_NAME.tar.gz
- gzip -9 $NEW_NAME.tar
+ (cd $TMP ; $tar $OPT - $NEW_NAME) | gzip -9 > $NEW_NAME.tar.gz
echo "$NEW_NAME.tar.gz created"
+
else
#
# Create a zip file for NetWare users
#
- cd $TMP
- if test -e "$SOURCE/$NEW_NAME.zip"; then rm $SOURCE/$NEW_NAME.zip; fi
- zip -r $SOURCE/$NEW_NAME.zip $NEW_NAME
+ rm -f $NEW_NAME.zip
+ (cd $TMP; zip -r "$SOURCE/$NEW_NAME.zip" $NEW_NAME)
echo "$NEW_NAME.zip created"
fi
+
echo "Removing temporary directory"
-rm -r -f $BASE
+rm -rf $BASE
diff --git a/server-tools/instance-manager/guardian.cc b/server-tools/instance-manager/guardian.cc
index a4c0cef41b3..291b685ef1b 100644
--- a/server-tools/instance-manager/guardian.cc
+++ b/server-tools/instance-manager/guardian.cc
@@ -33,18 +33,13 @@
-C_MODE_START
-
-pthread_handler_decl(guardian, arg)
+pthread_handler_t guardian(void *arg)
{
Guardian_thread *guardian_thread= (Guardian_thread *) arg;
guardian_thread->run();
return 0;
}
-C_MODE_END
-
-
Guardian_thread::Guardian_thread(Thread_registry &thread_registry_arg,
Instance_map *instance_map_arg,
uint monitoring_interval_arg) :
diff --git a/server-tools/instance-manager/guardian.h b/server-tools/instance-manager/guardian.h
index 16180e72dc9..16b4c373c91 100644
--- a/server-tools/instance-manager/guardian.h
+++ b/server-tools/instance-manager/guardian.h
@@ -31,11 +31,7 @@ class Instance_map;
class Thread_registry;
struct GUARD_NODE;
-C_MODE_START
-
-pthread_handler_decl(guardian, arg);
-
-C_MODE_END
+pthread_handler_t guardian(void *arg);
struct Guardian_thread_args
{
diff --git a/server-tools/instance-manager/instance.cc b/server-tools/instance-manager/instance.cc
index 0c3c1aee5b4..ff3387334b6 100644
--- a/server-tools/instance-manager/instance.cc
+++ b/server-tools/instance-manager/instance.cc
@@ -43,8 +43,6 @@ typedef pid_t My_process_info;
typedef PROCESS_INFORMATION My_process_info;
#endif
-C_MODE_START
-
/*
Proxy thread is a simple way to avoid all pitfalls of the threads
implementation in the OS (e.g. LinuxThreads). With such a thread we
@@ -52,7 +50,7 @@ C_MODE_START
to do it in a portable way.
*/
-pthread_handler_decl(proxy, arg)
+pthread_handler_t proxy(void *arg)
{
Instance *instance= (Instance *) arg;
start_and_monitor_instance(&instance->options,
@@ -60,9 +58,6 @@ pthread_handler_decl(proxy, arg)
return 0;
}
-C_MODE_END
-
-
/*
Wait for an instance
diff --git a/server-tools/instance-manager/listener.cc b/server-tools/instance-manager/listener.cc
index a1c1a743c24..08c28dc9f7d 100644
--- a/server-tools/instance-manager/listener.cc
+++ b/server-tools/instance-manager/listener.cc
@@ -372,10 +372,7 @@ void Listener_thread::handle_new_mysql_connection(Vio *vio)
}
-C_MODE_START
-
-
-pthread_handler_decl(listener, arg)
+pthread_handler_t listener(void *arg)
{
Listener_thread_args *args= (Listener_thread_args *) arg;
Listener_thread listener(*args);
@@ -387,6 +384,3 @@ pthread_handler_decl(listener, arg)
return 0;
}
-
-C_MODE_END
-
diff --git a/server-tools/instance-manager/listener.h b/server-tools/instance-manager/listener.h
index 3f5a80f1f53..e0ab5b8ef2b 100644
--- a/server-tools/instance-manager/listener.h
+++ b/server-tools/instance-manager/listener.h
@@ -24,11 +24,7 @@
#include <my_pthread.h>
-C_MODE_START
-
-pthread_handler_decl(listener, arg);
-
-C_MODE_END
+pthread_handler_t listener(void *arg);
class Thread_registry;
struct Options;
diff --git a/server-tools/instance-manager/mysql_connection.cc b/server-tools/instance-manager/mysql_connection.cc
index 4a32e95450e..bf39c843f0a 100644
--- a/server-tools/instance-manager/mysql_connection.cc
+++ b/server-tools/instance-manager/mysql_connection.cc
@@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#if defined(__GNUC__) && defined(USE_PRAGMA_IMPLEMENTATION)
-#pragma interface
+#pragma implementation
#endif
#include "mysql_connection.h"
@@ -364,9 +364,7 @@ int Mysql_connection_thread::dispatch_command(enum enum_server_command command,
}
-C_MODE_START
-
-pthread_handler_decl(mysql_connection, arg)
+pthread_handler_t mysql_connection(void *arg)
{
Mysql_connection_thread_args *args= (Mysql_connection_thread_args *) arg;
Mysql_connection_thread mysql_connection_thread(*args);
@@ -381,9 +379,6 @@ pthread_handler_decl(mysql_connection, arg)
return 0;
}
-C_MODE_END
-
-
/*
vim: fdm=marker
*/
diff --git a/server-tools/instance-manager/mysql_connection.h b/server-tools/instance-manager/mysql_connection.h
index 2ff55d81e57..492937b2198 100644
--- a/server-tools/instance-manager/mysql_connection.h
+++ b/server-tools/instance-manager/mysql_connection.h
@@ -24,12 +24,7 @@
#include <my_pthread.h>
-C_MODE_START
-
-pthread_handler_decl(mysql_connection, arg);
-
-C_MODE_END
-
+pthread_handler_t mysql_connection(void *arg);
class Thread_registry;
class User_map;
diff --git a/server-tools/instance-manager/user_map.cc b/server-tools/instance-manager/user_map.cc
index d901d1ca5ec..9cb15307131 100644
--- a/server-tools/instance-manager/user_map.cc
+++ b/server-tools/instance-manager/user_map.cc
@@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#if defined(__GNUC__) && defined(USE_PRAGMA_IMPLEMENTATION)
-#pragma interface
+#pragma implementation
#endif
#include "user_map.h"
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index f238a5d2532..12f8b984971 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -7044,7 +7044,7 @@ ha_innobase::cmp_ref(
(const char*)ref1, len1,
(const char*)ref2, len2);
} else {
- result = field->cmp((const char*)ref1,
+ result = field->key_cmp((const char*)ref1,
(const char*)ref2);
}
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 490d00c55d0..50d9f5b701a 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -132,7 +132,7 @@ static int ndb_get_table_statistics(Ndb*, const char *,
static pthread_t ndb_util_thread;
pthread_mutex_t LOCK_ndb_util_thread;
pthread_cond_t COND_ndb_util_thread;
-extern "C" pthread_handler_decl(ndb_util_thread_func, arg);
+pthread_handler_t ndb_util_thread_func(void *arg);
ulong ndb_cache_check_time;
/*
@@ -6004,8 +6004,7 @@ ha_ndbcluster::update_table_comment(
// Utility thread main loop
-extern "C" pthread_handler_decl(ndb_util_thread_func,
- arg __attribute__((unused)))
+pthread_handler_t ndb_util_thread_func(void *arg __attribute__((unused)))
{
THD *thd; /* needs to be first for thread_stack */
Ndb* ndb;
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index d46d0bd1e81..0110cb70892 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -617,8 +617,8 @@ bool multi_delete_set_locks_and_link_aux_tables(LEX *lex);
void init_max_user_conn(void);
void init_update_queries(void);
void free_max_user_conn(void);
-extern "C" pthread_handler_decl(handle_one_connection,arg);
-extern "C" pthread_handler_decl(handle_bootstrap,arg);
+pthread_handler_t handle_one_connection(void *arg);
+pthread_handler_t handle_bootstrap(void *arg);
void end_thread(THD *thd,bool put_in_cache);
void flush_thread_cache();
bool mysql_execute_command(THD *thd);
@@ -1062,7 +1062,7 @@ int write_record(THD *thd, TABLE *table, COPY_INFO *info);
extern ulong volatile manager_status;
extern bool volatile manager_thread_in_use, mqh_used;
extern pthread_t manager_thread;
-extern "C" pthread_handler_decl(handle_manager, arg);
+pthread_handler_t handle_manager(void *arg);
/* sql_test.cc */
#ifndef DBUG_OFF
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index e79bce9cd9e..47184a577ee 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -593,25 +593,25 @@ struct st_VioSSLAcceptorFd *ssl_acceptor_fd;
/* Function declarations */
static void start_signal_handler(void);
-static pthread_handler_decl(signal_hand, arg);
+pthread_handler_t signal_hand(void *arg);
static void mysql_init_variables(void);
static void get_options(int argc,char **argv);
static void set_server_version(void);
static int init_thread_environment();
static char *get_relative_path(const char *path);
static void fix_paths(void);
-extern "C" pthread_handler_decl(handle_connections_sockets,arg);
-extern "C" pthread_handler_decl(kill_server_thread,arg);
+pthread_handler_t handle_connections_sockets(void *arg);
+pthread_handler_t kill_server_thread(void *arg);
static void bootstrap(FILE *file);
static void close_server_sock();
static bool read_init_file(char *file_name);
#ifdef __NT__
-extern "C" pthread_handler_decl(handle_connections_namedpipes,arg);
+pthread_handler_t handle_connections_namedpipes(void *arg);
#endif
#ifdef HAVE_SMEM
-static pthread_handler_decl(handle_connections_shared_memory,arg);
+pthread_handler_t handle_connections_shared_memory(void *arg);
#endif
-extern "C" pthread_handler_decl(handle_slave,arg);
+pthread_handler_t handle_slave(void *arg);
static ulong find_bit_type(const char *x, TYPELIB *bit_lib);
static void clean_up(bool print_message);
static void clean_up_mutexes(void);
@@ -960,7 +960,7 @@ static void __cdecl kill_server(int sig_ptr)
#if defined(USE_ONE_SIGNAL_HAND) || (defined(__NETWARE__) && defined(SIGNALS_DONT_BREAK_READ))
-extern "C" pthread_handler_decl(kill_server_thread,arg __attribute__((unused)))
+pthread_handler_t kill_server_thread(void *arg __attribute__((unused)))
{
my_thread_init(); // Initialize new thread
kill_server(0);
@@ -2170,7 +2170,7 @@ static void start_signal_handler(void)
/* This threads handles all signals and alarms */
/* ARGSUSED */
-static void *signal_hand(void *arg __attribute__((unused)))
+pthread_handler_t signal_hand(void *arg __attribute__((unused)))
{
sigset_t set;
int sig;
@@ -2391,7 +2391,7 @@ int uname(struct utsname *a)
}
-extern "C" pthread_handler_decl(handle_shutdown,arg)
+pthread_handler_t handle_shutdown(void *arg)
{
MSG msg;
my_thread_init();
@@ -2420,7 +2420,7 @@ int STDCALL handle_kill(ulong ctrl_type)
#ifdef OS2
-extern "C" pthread_handler_decl(handle_shutdown,arg)
+pthread_handler_t handle_shutdown(void *arg)
{
my_thread_init();
@@ -3742,8 +3742,7 @@ inline void kill_broken_server()
/* Handle new connections and spawn new process to handle them */
#ifndef EMBEDDED_LIBRARY
-extern "C" pthread_handler_decl(handle_connections_sockets,
- arg __attribute__((unused)))
+pthread_handler_t handle_connections_sockets(void *arg __attribute__((unused)))
{
my_socket sock,new_sock;
uint error_count=0;
@@ -3957,7 +3956,7 @@ extern "C" pthread_handler_decl(handle_connections_sockets,
#ifdef __NT__
-extern "C" pthread_handler_decl(handle_connections_namedpipes,arg)
+pthread_handler_t handle_connections_namedpipes(void *arg)
{
HANDLE hConnectedPipe;
BOOL fConnected;
@@ -4043,17 +4042,16 @@ extern "C" pthread_handler_decl(handle_connections_namedpipes,arg)
Thread of shared memory's service
SYNOPSIS
- pthread_handler_decl()
- handle_connections_shared_memory Thread handle
+ handle_connections_shared_memory()
arg Arguments of thread
*/
#ifdef HAVE_SMEM
-pthread_handler_decl(handle_connections_shared_memory,arg)
+pthread_handler_t handle_connections_shared_memory(void *arg)
{
/* file-mapping object, use for create shared memory */
HANDLE handle_connect_file_map= 0;
- char *handle_connect_map= 0; // pointer on shared memory
+ char *handle_connect_map= 0; // pointer on shared memory
HANDLE event_connect_answer= 0;
ulong smem_buffer_length= shared_memory_buffer_length + 4;
ulong connect_number= 1;
diff --git a/sql/protocol_cursor.cc b/sql/protocol_cursor.cc
deleted file mode 100644
index 093a2bf2b90..00000000000
--- a/sql/protocol_cursor.cc
+++ /dev/null
@@ -1,148 +0,0 @@
-/* Copyright (C) 2000-2003 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 */
-
-/*
- Low level functions for storing data to be send to the MySQL client
- The actual communction is handled by the net_xxx functions in net_serv.cc
-*/
-
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
-#include "mysql_priv.h"
-#include <mysql.h>
-
-bool Protocol_cursor::send_fields(List<Item> *list, uint flags)
-{
- List_iterator_fast<Item> it(*list);
- Item *item;
- MYSQL_FIELD *client_field;
- DBUG_ENTER("Protocol_cursor::send_fields");
-
- if (prepare_for_send(list))
- return FALSE;
-
- fields= (MYSQL_FIELD *)alloc_root(alloc, sizeof(MYSQL_FIELD) * field_count);
- if (!fields)
- goto err;
-
- for (client_field= fields; (item= it++) ; client_field++)
- {
- Send_field server_field;
- item->make_field(&server_field);
-
- client_field->db= strdup_root(alloc, server_field.db_name);
- client_field->table= strdup_root(alloc, server_field.table_name);
- client_field->name= strdup_root(alloc, server_field.col_name);
- client_field->org_table= strdup_root(alloc, server_field.org_table_name);
- client_field->org_name= strdup_root(alloc, server_field.org_col_name);
- client_field->catalog= strdup_root(alloc, "");
- client_field->length= server_field.length;
- client_field->type= server_field.type;
- client_field->flags= server_field.flags;
- client_field->decimals= server_field.decimals;
- client_field->db_length= strlen(client_field->db);
- client_field->table_length= strlen(client_field->table);
- client_field->name_length= strlen(client_field->name);
- client_field->org_name_length= strlen(client_field->org_name);
- client_field->org_table_length= strlen(client_field->org_table);
- client_field->catalog_length= 0;
- client_field->charsetnr= server_field.charsetnr;
-
- if (INTERNAL_NUM_FIELD(client_field))
- client_field->flags|= NUM_FLAG;
-
- if (flags & (uint) Protocol::SEND_DEFAULTS)
- {
- char buff[80];
- String tmp(buff, sizeof(buff), default_charset_info), *res;
-
- if (!(res=item->val_str(&tmp)))
- client_field->def= (char*) "";
- else
- client_field->def= strmake_root(alloc, res->ptr(), res->length());
- }
- else
- client_field->def=0;
- client_field->max_length= 0;
- }
-
- DBUG_RETURN(FALSE);
-
-err:
- my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES),
- MYF(0)); /* purecov: inspected */
- DBUG_RETURN(TRUE); /* purecov: inspected */
-}
-
-
-/* Get the length of next field. Change parameter to point at fieldstart */
-
-bool Protocol_cursor::write()
-{
- byte *cp= (byte *)packet->ptr();
- byte *end_pos= (byte *)packet->ptr() + packet->length();
- ulong len;
- MYSQL_FIELD *cur_field= fields;
- MYSQL_FIELD *fields_end= fields + field_count;
- MYSQL_ROWS *new_record;
- byte **data_tmp;
- byte *to;
-
- new_record= (MYSQL_ROWS *)alloc_root(alloc,
- sizeof(MYSQL_ROWS) + (field_count + 2)*sizeof(char *) + packet->length());
- if (!new_record)
- goto err;
- data_tmp= (byte **)(new_record + 1);
- new_record->data= (char **)data_tmp;
-
- to= (byte *)data_tmp + (field_count + 2)*sizeof(char *);
-
- for (; cur_field < fields_end; cur_field++, data_tmp++)
- {
- if ((len= net_field_length((uchar **)&cp)) == NULL_LENGTH)
- {
- *data_tmp= 0;
- }
- else
- {
- if ((long)len > (end_pos - cp))
- {
- // TODO error signal send_error(thd, CR_MALFORMED_PACKET);
- return TRUE;
- }
- *data_tmp= to;
- memcpy(to,(char*) cp,len);
- to[len]=0;
- to+=len+1;
- cp+=len;
- if (cur_field->max_length < len)
- cur_field->max_length=len;
- }
- }
- data_tmp[0]= to; // Pointer to last used byte
- data_tmp[1]= 0;
-
- *prev_record= new_record;
- prev_record= &new_record->next;
- new_record->next= NULL;
- row_count++;
- return FALSE;
- err:
- // TODO error signal send_error(thd, ER_OUT_OF_RESOURCES);
- return TRUE;
-}
diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc
index 93aafbdc0e0..35035a8b5a5 100644
--- a/sql/repl_failsafe.cc
+++ b/sql/repl_failsafe.cc
@@ -579,7 +579,7 @@ int find_recovery_captain(THD* thd, MYSQL* mysql)
}
-pthread_handler_decl(handle_failsafe_rpl,arg)
+pthread_handler_t handle_failsafe_rpl(void *arg)
{
DBUG_ENTER("handle_failsafe_rpl");
THD *thd = new THD;
diff --git a/sql/repl_failsafe.h b/sql/repl_failsafe.h
index dfaacf557e8..19849e63af9 100644
--- a/sql/repl_failsafe.h
+++ b/sql/repl_failsafe.h
@@ -31,7 +31,7 @@ extern pthread_cond_t COND_rpl_status;
extern TYPELIB rpl_role_typelib, rpl_status_typelib;
extern const char* rpl_role_type[], *rpl_status_type[];
-pthread_handler_decl(handle_failsafe_rpl,arg);
+pthread_handler_t handle_failsafe_rpl(void *arg);
void change_rpl_status(RPL_STATUS from_status, RPL_STATUS to_status);
int find_recovery_captain(THD* thd, MYSQL* mysql);
int update_slave_list(MYSQL* mysql, MASTER_INFO* mi);
diff --git a/sql/slave.cc b/sql/slave.cc
index fb7b9275d0d..279be4d9c8c 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -2949,7 +2949,7 @@ on this slave.\
/* Slave I/O Thread entry point */
-extern "C" pthread_handler_decl(handle_slave_io,arg)
+pthread_handler_t handle_slave_io(void *arg)
{
THD *thd; // needs to be first for thread_stack
MYSQL *mysql;
@@ -3258,7 +3258,7 @@ err:
#ifndef DBUG_OFF
if (abort_slave_event_count && !events_till_abort)
goto slave_begin;
-#endif
+#endif
my_thread_end();
pthread_exit(0);
DBUG_RETURN(0); // Can't return anything here
@@ -3267,11 +3267,11 @@ err:
/* Slave SQL Thread entry point */
-extern "C" pthread_handler_decl(handle_slave_sql,arg)
+pthread_handler_t handle_slave_sql(void *arg)
{
THD *thd; /* needs to be first for thread_stack */
char llbuff[22],llbuff1[22];
- RELAY_LOG_INFO* rli = &((MASTER_INFO*)arg)->rli;
+ RELAY_LOG_INFO* rli = &((MASTER_INFO*)arg)->rli;
const char *errmsg;
// needs to call my_thread_init(), otherwise we get a coredump in DBUG_ stuff
@@ -3279,7 +3279,7 @@ extern "C" pthread_handler_decl(handle_slave_sql,arg)
DBUG_ENTER("handle_slave_sql");
#ifndef DBUG_OFF
-slave_begin:
+slave_begin:
#endif
DBUG_ASSERT(rli->inited);
diff --git a/sql/slave.h b/sql/slave.h
index 486bb3055f5..d99145cbe47 100644
--- a/sql/slave.h
+++ b/sql/slave.h
@@ -547,8 +547,8 @@ void set_slave_thread_options(THD* thd);
void set_slave_thread_default_charset(THD* thd, RELAY_LOG_INFO *rli);
void rotate_relay_log(MASTER_INFO* mi);
-extern "C" pthread_handler_decl(handle_slave_io,arg);
-extern "C" pthread_handler_decl(handle_slave_sql,arg);
+pthread_handler_t handle_slave_io(void *arg);
+pthread_handler_t handle_slave_sql(void *arg);
extern bool volatile abort_loop;
extern MASTER_INFO main_mi, *active_mi; /* active_mi for multi-master */
extern LIST master_list;
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 727ed282836..9e751c37608 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -1158,8 +1158,8 @@ public:
thread is (and must remain, for now) the only responsible for freeing these
3 members. If you add members here, and you add code to set them in
replication, don't forget to free_them_and_set_them_to_0 in replication
- properly. For details see the 'err:' label of the pthread_handler_decl of
- the slave SQL thread, in sql/slave.cc.
+ properly. For details see the 'err:' label of the handle_slave_sql()
+ in sql/slave.cc.
*/
char *db, *catalog;
Security_context main_security_ctx;
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index d1122cf2ac4..beca9842e6d 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -28,7 +28,7 @@ static TABLE *delayed_get_table(THD *thd,TABLE_LIST *table_list);
static int write_delayed(THD *thd,TABLE *table, enum_duplicates dup, bool ignore,
char *query, uint query_length, bool log_on);
static void end_delayed_insert(THD *thd);
-extern "C" pthread_handler_decl(handle_delayed_insert,arg);
+pthread_handler_t handle_delayed_insert(void *arg);
static void unlink_blobs(register TABLE *table);
#endif
static bool check_view_insertability(THD *thd, TABLE_LIST *view);
@@ -1704,7 +1704,7 @@ void kill_delayed_threads(void)
* Create a new delayed insert thread
*/
-extern "C" pthread_handler_decl(handle_delayed_insert,arg)
+pthread_handler_t handle_delayed_insert(void *arg)
{
delayed_insert *di=(delayed_insert*) arg;
THD *thd= &di->thd;
diff --git a/sql/sql_manager.cc b/sql/sql_manager.cc
index 0af6a80d4c2..34334d3a01d 100644
--- a/sql/sql_manager.cc
+++ b/sql/sql_manager.cc
@@ -32,7 +32,7 @@ pthread_t manager_thread;
pthread_mutex_t LOCK_manager;
pthread_cond_t COND_manager;
-extern "C" pthread_handler_decl(handle_manager,arg __attribute__((unused)))
+pthread_handler_t handle_manager(void *arg __attribute__((unused)))
{
int error = 0;
ulong status;
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 48dc8f68707..f5391cd546d 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1048,7 +1048,7 @@ void execute_init_command(THD *thd, sys_var_str *init_command_var,
}
-pthread_handler_decl(handle_one_connection,arg)
+pthread_handler_t handle_one_connection(void *arg)
{
THD *thd=(THD*) arg;
uint launch_time =
@@ -1184,7 +1184,7 @@ end_thread:
Used when creating the initial grant tables
*/
-extern "C" pthread_handler_decl(handle_bootstrap,arg)
+pthread_handler_t handle_bootstrap(void *arg)
{
THD *thd=(THD*) arg;
FILE *file=bootstrap_file;
@@ -2946,7 +2946,7 @@ end_with_restore_list:
To prevent that, refuse SLAVE STOP if the
client thread has locked tables
*/
- if (thd->locked_tables || thd->active_transaction())
+ if (thd->locked_tables || thd->active_transaction() || thd->global_read_lock)
{
my_message(ER_LOCK_OR_ACTIVE_TRANSACTION,
ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
@@ -5004,7 +5004,7 @@ check_table_access(THD *thd, ulong want_access,TABLE_LIST *tables,
for (; tables; tables= tables->next_global)
{
if (tables->schema_table &&
- (want_access & ~(SELECT_ACL | EXTRA_ACL)))
+ (want_access & ~(SELECT_ACL | EXTRA_ACL | FILE_ACL)))
{
if (!no_errors)
my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
diff --git a/storage/myisam/ft_nlq_search.c b/storage/myisam/ft_nlq_search.c
index 7a506fd11c6..8460db61a36 100644
--- a/storage/myisam/ft_nlq_search.c
+++ b/storage/myisam/ft_nlq_search.c
@@ -266,7 +266,8 @@ FT_INFO *ft_init_nlq_search(MI_INFO *info, uint keynr, byte *query,
so if ndocs == 0, FT_INFO.doc[] must not be accessed.
*/
dlist=(FT_INFO *)my_malloc(sizeof(FT_INFO)+
- sizeof(FT_DOC)*(aio.dtree.elements_in_tree-1),
+ sizeof(FT_DOC)*
+ (int)(aio.dtree.elements_in_tree-1),
MYF(0));
if (!dlist)
goto err;
diff --git a/storage/myisam/myisamdef.h b/storage/myisam/myisamdef.h
index 87a1b757d88..36328c9d9f1 100644
--- a/storage/myisam/myisamdef.h
+++ b/storage/myisam/myisamdef.h
@@ -728,7 +728,7 @@ int flush_pending_blocks(MI_SORT_PARAM *param);
int sort_ft_buf_flush(MI_SORT_PARAM *sort_param);
int thr_write_keys(MI_SORT_PARAM *sort_param);
#ifdef THREAD
-pthread_handler_decl(thr_find_all_keys,arg);
+pthread_handler_t thr_find_all_keys(void *arg);
#endif
int flush_blocks(MI_CHECK *param, KEY_CACHE *key_cache, File file);
diff --git a/storage/myisam/sort.c b/storage/myisam/sort.c
index fabd713ef45..6c718a0d453 100644
--- a/storage/myisam/sort.c
+++ b/storage/myisam/sort.c
@@ -307,7 +307,7 @@ static ha_rows NEAR_F find_all_keys(MI_SORT_PARAM *info, uint keys,
#ifdef THREAD
/* Search after all keys and place them in a temp. file */
-pthread_handler_decl(thr_find_all_keys,arg)
+pthread_handler_t thr_find_all_keys(void *arg)
{
MI_SORT_PARAM *info= (MI_SORT_PARAM*) arg;
int error;
diff --git a/storage/ndb/src/ndbapi/ndb_cluster_connection.cpp b/storage/ndb/src/ndbapi/ndb_cluster_connection.cpp
index 68e2c1e71d8..3a69ef10afa 100644
--- a/storage/ndb/src/ndbapi/ndb_cluster_connection.cpp
+++ b/storage/ndb/src/ndbapi/ndb_cluster_connection.cpp
@@ -85,7 +85,7 @@ const char *Ndb_cluster_connection::get_connectstring(char *buf,
return 0;
}
-extern "C" pthread_handler_decl(run_ndb_cluster_connection_connect_thread, me)
+pthread_handler_t run_ndb_cluster_connection_connect_thread(void *me)
{
g_run_connect_thread= 1;
((Ndb_cluster_connection_impl*) me)->connect_thread();
diff --git a/tools/mysqlmanager.c b/tools/mysqlmanager.c
index 4a5c08be50a..4d507fc3d32 100644
--- a/tools/mysqlmanager.c
+++ b/tools/mysqlmanager.c
@@ -332,8 +332,8 @@ static int client_msg_raw(NET* net,int err_code,int pre,const char* fmt,
static int authenticate(struct manager_thd* thd);
/* returns pointer to end of line */
static char* read_line(struct manager_thd* thd);
-static pthread_handler_decl(process_connection, arg);
-static pthread_handler_decl(process_launcher_messages, arg);
+pthread_handler_t process_connection(void *arg);
+pthread_handler_t process_launcher_messages(void *arg);
static int exec_line(struct manager_thd* thd,char* buf,char* buf_end);
#ifdef DO_STACKTRACE
@@ -1089,8 +1089,7 @@ static void log_msg(const char* fmt, int msg_type, va_list args)
pthread_mutex_unlock(&lock_log);
}
-static pthread_handler_decl(process_launcher_messages,
- args __attribute__((unused)))
+pthread_handler_t process_launcher_messages(void *arg __attribute__((unused)))
{
my_thread_init();
for (;!in_shutdown;)
@@ -1146,7 +1145,7 @@ static pthread_handler_decl(process_launcher_messages,
return 0;
}
-static pthread_handler_decl(process_connection,arg)
+pthread_handler_t process_connection(void *arg)
{
struct manager_thd* thd = (struct manager_thd*)arg;
my_thread_init();