1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge mysql.com:/windows/Linux_space/MySQL/mysql-5.1

into  mysql.com:/windows/Linux_space/MySQL/mysql-5.1-new-ndb


configure.in:
  Auto merged
client/mysqldump.c:
  Auto merged
include/my_sys.h:
  Auto merged
mysql-test/r/ndb_update.result:
  Auto merged
mysql-test/t/ndb_index_ordered.test:
  Auto merged
sql/ha_ndbcluster.cc:
  Auto merged
sql/ha_ndbcluster_binlog.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
storage/ndb/include/util/OutputStream.hpp:
  Auto merged
storage/ndb/src/common/debugger/EventLogger.cpp:
  Auto merged
storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp:
  Auto merged
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
  Auto merged
storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp:
  Auto merged
storage/ndb/src/mgmapi/mgmapi.cpp:
  Auto merged
storage/ndb/src/mgmclient/CommandInterpreter.cpp:
  Auto merged
storage/ndb/src/ndbapi/ClusterMgr.cpp:
  Auto merged
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp:
  Auto merged
storage/ndb/src/ndbapi/NdbTransaction.cpp:
  Auto merged
storage/ndb/src/ndbapi/Ndbinit.cpp:
  Auto merged
storage/ndb/src/ndbapi/ndb_cluster_connection.cpp:
  Auto merged
sql/sql_cache.cc:
  Merge
This commit is contained in:
unknown
2006-11-30 15:31:20 +01:00
596 changed files with 18709 additions and 7193 deletions

View File

@ -1252,6 +1252,7 @@ mysql-test/r/*.err
mysql-test/r/*.log
mysql-test/r/*.out
mysql-test/r/*.reject
mysql-test/r/*.warnings
mysql-test/r/alter_table.err
mysql-test/r/archive.err
mysql-test/r/backup.log

View File

@ -5,7 +5,7 @@ configure="./configure $base_configs $extra_configs"
commands="\
$make -k distclean || true
/bin/rm -rf */.deps/*.P config.cache storage/innobase/config.cache autom4te.cache innobase/autom4te.cache;
/bin/rm -rf */.deps/*.P configure config.cache storage/*/configure storage/*/config.cache autom4te.cache storage/*/autom4te.cache;
path=`dirname $0`
. \"$path/autorun.sh\""

View File

@ -183,7 +183,7 @@ fi
# (http://samba.org/ccache) is installed, use it.
# We use 'grep' and hope 'grep' will work as expected
# (returns 0 if finds lines)
if ccache -V > /dev/null 2>&1
if ccache -V > /dev/null 2>&1 && test "$CCACHE_GCOV_VERSION_ENABLED" == "1"
then
echo "$CC" | grep "ccache" > /dev/null || CC="ccache $CC"
echo "$CXX" | grep "ccache" > /dev/null || CXX="ccache $CXX"

View File

@ -1,12 +1,21 @@
#! /bin/sh
# Need to disable ccache, or we loose the gcov-needed compiler output files.
CCACHE_GCOV_VERSION_ENABLED=0
if ccache -V > /dev/null 2>&1
then
CCACHE_VER=`ccache -V | head -1 | sed s/"ccache version "//`
if test "$CCACHE_VER" == "2.4-gcov"
then
CCACHE_GCOV_VERSION_ENABLED=1
fi
fi
export CCACHE_GCOV_VERSION_ENABLED
path=`dirname $0`
. "$path/SETUP.sh"
# Need to disable ccache, or we loose the gcov-needed compiler output files.
CCACHE_DISABLE=1
export CCACHE_DISABLE
# GCC4 needs -fprofile-arcs -ftest-coverage on the linker command line (as well
# as on the compiler command line), and this requires setting LDFLAGS for BDB.
export LDFLAGS="-fprofile-arcs -ftest-coverage"
@ -14,7 +23,7 @@ export LDFLAGS="-fprofile-arcs -ftest-coverage"
# The -fprofile-arcs and -ftest-coverage options cause GCC to instrument the
# code with profiling information used by gcov.
# the -DDISABLE_TAO_ASM is needed to avoid build failures in Yassl.
extra_flags="$pentium_cflags -fprofile-arcs -ftest-coverage -DDISABLE_TAO_ASM -DHAVE_MUTEX_THREAD_ONLY"
extra_flags="$pentium_cflags -fprofile-arcs -ftest-coverage -DDISABLE_TAO_ASM -DHAVE_MUTEX_THREAD_ONLY $debug_extra_flags"
extra_configs="$pentium_configs $debug_configs --disable-shared $static_link"
extra_configs="$extra_configs $max_configs"

View File

@ -17,3 +17,6 @@
452a92d0-31-8wSzSfZi165fcGcXPA
454a7ef8gdvE_ddMlJyghvOAkKPNOQ
454f8960jsVT_kMKJtZ9OCgXoba0xQ
4561b2ecZbhuAc0TTDdCdultxUYaMw
4561bde4qWhz1I8tkItXKex5uniipA
4562ba016dYH0JzszOqZ8p6psbKfnQ

View File

@ -35,9 +35,17 @@ fi
CHANGESET=`bk -R prs -r+ -h -d':P:::I:' ChangeSet`
CSETKEY=`bk -R prs -r+ -h -d':KEY:' ChangeSet`
BUG=`bk -R prs -r+ -h -d':C:' ChangeSet | sed -ne 's/^.*[Bb][Uu][Gg] *# *\([0-9][0-9]*\).*$/\1/p'`
WL=`bk -R prs -r+ -h -d':C:' ChangeSet | sed -ne 's/^.*[Ww][Ll] *# *\([0-9][0-9]*\).*$/ WL#\1/p'`
#
# composing subject lines of commit mails.
# if a fix targets to a WL and there is a bug referred
# then X-Bug mail header will contain the first found bug's number
#
BUG=`bk -R prs -r+ -h -d':C:' ChangeSet | \
sed -ne 's/[Bb][Uu][Gg] *# *\([0-9][0-9]*\).*$/BUG#\1/
s/.*BUG#\([0-9][0-9]*\)/\1/p'`
WL=`bk -R prs -r+ -h -d':C:' ChangeSet | \
sed -ne 's/[Ww][Ll] *# *\([0-9][0-9]*\).*$/WL#\1/
s/.*\(WL#[0-9][0-9]*\)/ \1/p'`
if [ "$BUG" = "" ]
then
TO=dev-public@mysql.com

View File

@ -26,7 +26,7 @@ all-local: $(TXT_FILES)
# make sure that "make install" installs the info page, too
# automake only seems to take care of this automatically,
# if we're building the info page from texi directly.
install-data-hook: mysql.info
install-data-hook: $(srcdir)/mysql.info
$(mkinstalldirs) $(DESTDIR)$(infodir)
$(INSTALL_DATA) $(srcdir)/mysql.info $(DESTDIR)$(infodir)
@ -44,23 +44,23 @@ CLEAN_FILES: $(TXT_FILES)
GT = $(srcdir)/generate-text-files.pl
../INSTALL-SOURCE: mysql.info $(GT)
perl -w $(GT) mysql.info "installing-source" "windows-source-build" > $@
../INSTALL-SOURCE: $(srcdir)/mysql.info $(GT)
perl -w $(GT) $(srcdir)/mysql.info "installing-source" "windows-source-build" > $@
../INSTALL-WIN-SOURCE: mysql.info $(GT)
perl -w $(GT) mysql.info "windows-source-build" "post-installation" > $@
../INSTALL-WIN-SOURCE: $(srcdir)/mysql.info $(GT)
perl -w $(GT) $(srcdir)/mysql.info "windows-source-build" "post-installation" > $@
# We put the description for the binary installation here so that
# people who download source wont have to see it. It is moved up to
# the toplevel by the script that makes the binary tar files.
INSTALL-BINARY: mysql.info $(GT)
perl -w $(GT) mysql.info "installing-binary" "installing-source" > $@
INSTALL-BINARY: $(srcdir)/mysql.info $(GT)
perl -w $(GT) $(srcdir)/mysql.info "installing-binary" "installing-source" > $@
../EXCEPTIONS-CLIENT: mysql.info $(GT)
perl -w $(GT) mysql.info "mysql-floss-license-exception" "function-index" > $@
../EXCEPTIONS-CLIENT: $(srcdir)/mysql.info $(GT)
perl -w $(GT) $(srcdir)/mysql.info "mysql-floss-license-exception" "function-index" > $@
../support-files/MacOSX/ReadMe.txt: mysql.info $(GT)
perl -w $(GT) mysql.info "mac-os-x-installation" "netware-installation" > $@
../support-files/MacOSX/ReadMe.txt: $(srcdir)/mysql.info $(GT)
perl -w $(GT) $(srcdir)/mysql.info "mac-os-x-installation" "netware-installation" > $@
# Include the Windows manual.chm in source .tar.gz only if available.
# It is not in BitKeeper, but is downloaded from intranet by Bootstrap.

View File

@ -142,10 +142,15 @@ test-force:
test-force-full:
$(MAKE) force=--force test-full
#used by autopush.pl to run memory based tests
test-force-mem:
$(MAKE) 'force=--force --mem' test
# Keep these for a while
test-pl: test
test-full-pl: test-full
test-force-pl: test-force
test-force-pl-mem: test-force-mem
test-force-full-pl: test-force-full
# Don't update the files from bitkeeper

View File

@ -58,5 +58,6 @@ enum options_client
OPT_IGNORE_TABLE,OPT_INSERT_IGNORE,OPT_SHOW_WARNINGS,OPT_DROP_DATABASE,
OPT_TZ_UTC, OPT_AUTO_CLOSE, OPT_CREATE_SLAP_SCHEMA,
OPT_MYSQL_REPLACE_INTO, OPT_BASE64_OUTPUT, OPT_SERVER_ID,
OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES, OPT_SSL_VERIFY_SERVER_CERT
OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES, OPT_SSL_VERIFY_SERVER_CERT,
OPT_DEBUG_INFO, OPT_COLUMN_TYPES
};

View File

@ -44,7 +44,7 @@
#include <locale.h>
#endif
const char *VER= "14.12";
const char *VER= "14.13";
/* Don't try to make a nice table if the data is too big */
#define MAX_COLUMN_LENGTH 1024
@ -140,6 +140,7 @@ static my_bool info_flag=0,ignore_errors=0,wait_flag=0,quick=0,
default_charset_used= 0, opt_secure_auth= 0,
default_pager_set= 0, opt_sigint_ignore= 0,
show_warnings= 0, executing_query= 0, interrupted_query= 0;
static my_bool column_types_flag;
static ulong opt_max_allowed_packet, opt_net_buffer_length;
static uint verbose=0,opt_silent=0,opt_mysql_port=0, opt_local_infile=0;
static my_string opt_mysql_unix_port=0;
@ -545,7 +546,7 @@ sig_handler mysql_end(int sig)
my_free(current_prompt,MYF(MY_ALLOW_ZERO_PTR));
mysql_server_end();
free_defaults(defaults_argv);
my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
my_end(info_flag ? MY_CHECK_ERROR : 0);
exit(status.exit_status);
}
@ -600,12 +601,13 @@ static struct my_option my_long_options[] =
{"character-sets-dir", OPT_CHARSETS_DIR,
"Directory where character sets are.", (gptr*) &charsets_dir,
(gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default-character-set", OPT_DEFAULT_CHARSET,
"Set the default character set.", (gptr*) &default_charset,
(gptr*) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"column-type-info", OPT_COLUMN_TYPES, "Display column type information.",
(gptr*) &column_types_flag, (gptr*) &column_types_flag,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"compress", 'C', "Use compression in server/client protocol.",
(gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
#ifdef DBUG_OFF
{"debug", '#', "This is a non-debug version. Catch this and exit",
0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
@ -613,8 +615,13 @@ static struct my_option my_long_options[] =
{"debug", '#', "Output debug log", (gptr*) &default_dbug_option,
(gptr*) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"debug-info", 'T', "Print some debug info at exit.", (gptr*) &info_flag,
(gptr*) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"database", 'D', "Database to use.", (gptr*) &current_db,
(gptr*) &current_db, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default-character-set", OPT_DEFAULT_CHARSET,
"Set the default character set.", (gptr*) &default_charset,
(gptr*) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"delimiter", OPT_DELIMITER, "Delimiter to be used.", (gptr*) &delimiter_str,
(gptr*) &delimiter_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"execute", 'e', "Execute command and quit. (Disables --force and history file)", 0,
@ -711,8 +718,6 @@ static struct my_option my_long_options[] =
#include "sslopt-longopts.h"
{"table", 't', "Output in table format.", (gptr*) &output_tables,
(gptr*) &output_tables, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"debug-info", 'T', "Print some debug info at exit.", (gptr*) &info_flag,
(gptr*) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"tee", OPT_TEE,
"Append everything into outfile. See interactive help (\\h) also. Does not work in batch mode. Disable with --disable-tee. This option is disabled by default.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@ -2085,7 +2090,7 @@ com_go(String *buffer,char *line __attribute__((unused)))
time_buff[0]=0;
if (result)
{
if (!mysql_num_rows(result) && ! quick && !info_flag)
if (!mysql_num_rows(result) && ! quick && !column_types_flag)
{
strmov(buff, "Empty set");
}
@ -2324,7 +2329,7 @@ print_table_data(MYSQL_RES *result)
bool *num_flag;
num_flag=(bool*) my_alloca(sizeof(bool)*mysql_num_fields(result));
if (info_flag)
if (column_types_flag)
{
print_field_types(result);
if (!mysql_num_rows(result))

View File

@ -16,21 +16,42 @@
#include "client_priv.h"
#include <my_dir.h>
#include <my_list.h>
#include <sslopt-vars.h>
#define UPGRADE_DEFAULTS_NAME "mysql_upgrade_defaults"
#define MYSQL_UPGRADE_INFO_NAME "mysql_upgrade_info"
#define MYSQL_FIX_PRIV_TABLES_NAME "mysql_fix_privilege_tables.sql"
#define MY_PARENT (1 << 0)
#define MY_ISDIR (1 << 1)
#define MY_SEARCH_SELF (1 << 2)
#ifdef __WIN__
const char *mysqlcheck_name= "mysqlcheck.exe";
const char *mysql_name= "mysql.exe";
const char *mysqld_name= "mysqld.exe";
#else
const char *mysqlcheck_name= "mysqlcheck";
const char *mysql_name= "mysql";
const char *mysqld_name= "mysqld";
#endif /*__WIN__*/
static my_bool opt_force= 0, opt_verbose= 0, tty_password= 0;
extern TYPELIB sql_protocol_typelib;
static my_bool opt_force= 0, opt_verbose= 0, opt_compress= 0;
static char *user= (char*) "root", *basedir= 0, *datadir= 0, *opt_password= 0;
static my_bool upgrade_defaults_created= 0;
static my_string opt_mysql_port, opt_mysql_unix_port= 0;
static char *default_dbug_option= (char*) "d:t:O,/tmp/comp_err.trace";
static my_bool info_flag= 0;
static char *current_host= 0;
static char *opt_default_charset= 0, *opt_charsets_dir= 0;
#ifdef HAVE_SMEM
static char *shared_memory_base_name= 0;
#endif
static char *opt_protocol= 0;
static my_string opt_mysql_port= 0, opt_mysql_unix_port= 0;
#ifndef DBUG_OFF
static char *default_dbug_option= (char*) "d:t:O,/tmp/mysql_upgrade.trace";
#endif
static my_bool info_flag= 0, tty_password= 0;
static struct my_option my_long_options[]=
{
@ -50,27 +71,51 @@ static struct my_option my_long_options[]=
#endif
{"debug-info", 'T', "Print some debug info at exit.", (gptr *) & info_flag,
(gptr *) & info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"force", 'f', "Continue even if we get an sql-error.",
{"default-character-set", OPT_DEFAULT_CHARSET,
"Set the default character set.", (gptr*) &opt_default_charset,
(gptr*) &opt_default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"force", 'f', "Force execution of mysqlcheck even if mysql_upgrade "
"has already been executed for the current version of MySQL.",
(gptr*) &opt_force, (gptr*) &opt_force, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR,
"Directory where character sets are.", (gptr*) &opt_charsets_dir,
(gptr*) &opt_charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"compress", OPT_COMPRESS, "Use compression in server/client protocol.",
(gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"host",'h', "Connect to host.", (gptr*) &current_host,
(gptr*) &current_host, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"password", 'p',
"Password to use when connecting to server. If password is not given it's solicited on the tty.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
"Password to use when connecting to server. If password is not given"
" it's solicited on the tty.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#ifdef __WIN__
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"port", 'P', "Port number to use for connection.", (gptr*) &opt_mysql_port,
(gptr*) &opt_mysql_port, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0,
0},
(gptr*) &opt_mysql_port, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"protocol", OPT_MYSQL_PROTOCOL,
"The protocol of connection (tcp,socket,pipe,memory).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_SMEM
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
"Base name of shared memory.", (gptr*) &shared_memory_base_name,
(gptr*) &shared_memory_base_name, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"socket", 'S', "Socket file to use for connection.",
(gptr*) &opt_mysql_unix_port, (gptr*) &opt_mysql_unix_port, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
(gptr*) &opt_mysql_unix_port, (gptr*) &opt_mysql_unix_port, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"user", 'u', "User for login if not current user.", (gptr*) &user,
(gptr*) &user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"verbose", 'v', "Display more output about the process", (gptr*) &opt_verbose,
(gptr *) &opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#include <sslopt-longopts.h>
{"verbose", 'v', "Display more output about the process",
(gptr*) &opt_verbose, (gptr*) &opt_verbose, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
static const char *load_default_groups[]=
{
"mysql_upgrade", 0
@ -78,6 +123,81 @@ static const char *load_default_groups[]=
#include <help_end.h>
static LIST *extra_defaults= NULL;
typedef struct _extra_default
{
int id;
const char *name;
int n_len;
const char *value;
int v_len;
} extra_default_t;
static inline
void set_extra_default(int id, const struct my_option *opt)
{
switch (id) {
case 'b': case 'd': /* these are ours */
case 'f': /* --force is ours */
case 'u': /* --user passed on cmdline */
case 'T': /* --debug-info is not accepted by mysqlcheck */
/* so, do nothing */
break;
default:
{
LIST *l;
extra_default_t *d;
/*
Remove any earlier duplicates: they can
refer to invalid memory addresses (stale pointers)
*/
l= extra_defaults;
while (l)
{
LIST *n= l->next;
d= l->data;
if (d->id == id)
{
extra_defaults= list_delete(extra_defaults, l);
my_free((gptr)l, MYF(0));
my_free((gptr)d, MYF(0));
}
l= n;
}
d= (extra_default_t *)my_malloc(sizeof(extra_default_t),
MYF(MY_FAE|MY_ZEROFILL));
d->id= id;
d->name= opt->name;
d->n_len= strlen(opt->name);
if (opt->arg_type != NO_ARG)
switch (opt->var_type & GET_TYPE_MASK) {
case GET_BOOL:
if (*((int *)opt->value))
{
d->value= "true";
d->v_len= 4;
}
break;
case GET_STR:
case GET_STR_ALLOC:
d->value= *opt->value;
d->v_len= strlen(d->value);
break;
default:
my_printf_error(0, "Error: internal error at %s:%d", MYF(0),
__FILE__, __LINE__);
exit(1);
}
list_push(extra_defaults, d);
}
}
}
static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__ ((unused)),
char *argument)
@ -85,16 +205,13 @@ get_one_option(int optid, const struct my_option *opt __attribute__ ((unused)),
switch (optid) {
case '?':
puts
("MySQL utility script to upgrade database to the current server version");
("MySQL utility to upgrade database to the current server version");
puts("");
my_print_help(my_long_options);
exit(0);
case '#':
DBUG_PUSH(argument ? argument : default_dbug_option);
break;
case 'f':
opt_force= TRUE;
break;
case 'p':
tty_password= 1;
if (argument)
@ -109,315 +226,412 @@ get_one_option(int optid, const struct my_option *opt __attribute__ ((unused)),
tty_password= 0;
}
break;
#ifdef __WIN__
case 'W':
my_free(opt_protocol, MYF(MY_ALLOW_ZERO_PTR));
opt_protocol= my_strdup("pipe", MYF(MY_FAE));
break;
#endif
case OPT_MYSQL_PROTOCOL:
if (find_type(argument, &sql_protocol_typelib, 0) > 0)
{
my_free(opt_protocol, MYF(MY_ALLOW_ZERO_PTR));
opt_protocol= my_strdup(argument, MYF(MY_FAE));
}
else
{
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
exit(1);
}
break;
#include <sslopt-case.h>
default:;
};
}
set_extra_default(opt->id, opt);
return 0;
}
/* buffer should be not smaller than FN_REFLEN */
static my_bool test_file_exists_res(const char *dir, const char *fname,
char *buffer, char **buf_end)
{
MY_STAT stat_info;
*buf_end= strxnmov(buffer, FN_REFLEN-1, dir, "/", fname, NullS);
unpack_filename(buffer, buffer);
return my_stat(buffer, &stat_info, MYF(0)) != 0;
}
static my_bool test_file_exists(const char *dir, const char *fname)
{
char path[FN_REFLEN];
char *path_end;
return test_file_exists_res(dir, fname, path, &path_end);
}
static int create_check_file(const char *path)
{
File check_file= my_open(path, O_CREAT | O_WRONLY, MYF(MY_FAE | MY_WME));
int error;
int ret;
File fd;
if (check_file < 0)
return 1;
error= my_write(check_file,
MYSQL_SERVER_VERSION, strlen(MYSQL_SERVER_VERSION),
fd= my_open(path, O_CREAT | O_WRONLY, MYF(MY_FAE | MY_WME));
if (fd < 0) {
ret= 1;
goto error;
}
ret= my_write(fd, MYSQL_SERVER_VERSION,
sizeof(MYSQL_SERVER_VERSION) - 1,
MYF(MY_WME | MY_FNABP));
error= my_close(check_file, MYF(MY_FAE | MY_WME)) || error;
return error;
ret|= my_close(fd, MYF(MY_FAE | MY_WME));
error:
return ret;
}
static int create_defaults_file(const char *path, const char *our_defaults_path)
static int create_defaults_file(const char *path, const char *forced_path)
{
uint b_read;
File our_defaults_file, defaults_file;
char buffer[512];
char *buffer_end;
int failed_to_open_count= 0;
int error;
int ret;
uint cnt;
File forced_file, defaults_file;
/* check if the defaults file is needed at all */
if (!opt_password)
return 0;
DYNAMIC_STRING buf;
extra_default_t *d;
my_delete(path, MYF(0));
retry_open:
defaults_file= my_open(path, O_BINARY | O_CREAT | O_WRONLY | O_EXCL,
MYF(MY_FAE | MY_WME));
if (defaults_file < 0)
{
if (failed_to_open_count == 0)
{
remove(path);
failed_to_open_count+= 1;
goto retry_open;
}
else
return 1;
ret= 1;
goto out;
}
upgrade_defaults_created= 1;
if (our_defaults_path)
if (init_dynamic_string(&buf, NULL, my_getpagesize(), FN_REFLEN))
{
our_defaults_file= my_open(our_defaults_path, O_RDONLY,
MYF(MY_FAE | MY_WME));
if (our_defaults_file < 0)
return 1;
ret= 1;
goto error;
}
if (forced_path)
{
forced_file= my_open(forced_path, O_RDONLY, MYF(MY_FAE | MY_WME));
if (forced_file < 0)
{
ret= 1;
goto error;
}
do
{
if (((b_read= my_read(our_defaults_file, buffer,
sizeof(buffer), MYF(MY_WME))) == MY_FILE_ERROR) ||
my_write(defaults_file, buffer, b_read, MYF(MY_FNABP | MY_WME)))
cnt= my_read(forced_file, buf.str, buf.max_length, MYF(MY_WME));
if ((cnt == MY_FILE_ERROR)
|| my_write(defaults_file, buf.str, cnt, MYF(MY_FNABP | MY_WME)))
{
error= 1;
goto close_return;
ret= 1;
my_close(forced_file, MYF(0));
goto error;
}
} while (b_read == sizeof(buffer));
} while (cnt == buf.max_length);
my_close(forced_file, MYF(0));
}
buffer_end= strnmov(buffer, "\n[client]", sizeof(buffer));
if (opt_password)
buffer_end= strxnmov(buffer_end, sizeof(buffer),
"\npassword=", opt_password, NullS);
error= my_write(defaults_file, buffer, (int) (buffer_end - buffer),
MYF(MY_WME | MY_FNABP));
close_return:
return my_close(defaults_file, MYF(MY_WME)) || error;
dynstr_set(&buf, "\n[client]");
while (extra_defaults)
{
int len;
d= extra_defaults->data;
len= d->n_len + d->v_len + 1;
if (buf.length + len >= buf.max_length) /* to avoid realloc() */
{
if (my_write(defaults_file, buf.str, buf.length, MYF(MY_FNABP | MY_WME)))
{
ret= 1;
goto error;
}
dynstr_set(&buf, NULL);
}
if (dynstr_append_mem(&buf, "\n", 1)
|| dynstr_append_mem(&buf, d->name, d->n_len)
|| (d->v_len && (dynstr_append_mem(&buf, "=", 1)
|| dynstr_append_mem(&buf, d->value, d->v_len))))
{
ret= 1;
goto error;
}
my_delete((gptr)d, MYF(0));
list_pop(extra_defaults); /* pop off the head */
}
if (my_write(defaults_file, buf.str, buf.length, MYF(MY_FNABP | MY_WME)))
{
ret= 1;
goto error;
}
/* everything's all right */
ret= 0;
error:
dynstr_free(&buf);
if (defaults_file >= 0)
ret|= my_close(defaults_file, MYF(MY_WME));
if (ret)
my_delete(path, MYF(0));
out:
return ret;
}
/* Compare filenames */
static int comp_names(struct fileinfo *a, struct fileinfo *b)
{
return (strcmp(a->name,b->name));
}
static int find_file(const char *name, const char *root,
uint flags, char *result, size_t len, ...)
{
int ret= 1;
va_list va;
const char *subdir;
char *cp;
FILEINFO key;
/* Init key with name of the file to look for */
key.name= (char*)name;
DBUG_ASSERT(root != NULL);
cp= strmake(result, root, len);
if (cp[-1] != FN_LIBCHAR)
*cp++= FN_LIBCHAR;
va_start(va, len);
subdir= (!(flags & MY_SEARCH_SELF)) ? va_arg(va, char *) : "";
while (subdir)
{
MY_DIR *dir;
FILEINFO *match;
char *cp1;
cp1= strnmov(cp, subdir, len - (cp - result) - 1);
dir= my_dir(result, (flags & MY_ISDIR) ? MY_WANT_STAT : MYF(0));
if (dir)
{
match= bsearch(&key, dir->dir_entry, dir->number_off_files,
sizeof(FILEINFO), (qsort_cmp)comp_names);
if (match)
{
ret= (flags & MY_ISDIR) ? !MY_S_ISDIR(match->mystat->st_mode) : 0;
if (!ret)
{
if (cp1[-1] != FN_LIBCHAR)
*cp1++= FN_LIBCHAR;
if (!(flags & MY_PARENT))
strnmov(cp1, name, len - (cp1 - result));
else
*cp1= '\0';
my_dirend(dir);
break;
}
}
my_dirend(dir);
}
subdir= va_arg(va, char *);
}
va_end(va);
return ret;
}
int main(int argc, char **argv)
{
char bindir[FN_REFLEN];
char *bindir_end, *buf_end;
char datadir_buf[FN_REFLEN];
char mysqlcheck_line[FN_REFLEN], *mysqlcheck_end;
char check_file_name[FN_REFLEN];
int check_file;
char fix_priv_tables_cmd[FN_REFLEN], *fix_cmd_end;
char script_line[FN_REFLEN];
int error;
int ret;
char *forced_defaults_file;
char *forced_extra_defaults;
char *defaults_group_suffix;
char upgrade_defaults_path[FN_REFLEN], *defaults_to_use= 0;
char port_socket[100], *port_socket_end;
const char *script_line;
char *upgrade_defaults_path;
char *defaults_to_use= NULL;
int upgrade_defaults_created= 0;
char path[FN_REFLEN];
DYNAMIC_STRING cmdline;
MY_INIT(argv[0]);
#ifdef __NETWARE__
setscreenmode(SCR_AUTOCLOSE_ON_EXIT);
#endif
load_defaults("my", load_default_groups, &argc, &argv);
if ((error= handle_options(&argc, &argv, my_long_options, get_one_option)))
exit(error);
if (tty_password)
opt_password= get_tty_password(NullS);
/* Check if we want to force the use a specific default file */
/* Check if we are forced to use specific defaults */
get_defaults_options(argc, argv,
&forced_defaults_file, &forced_extra_defaults,
&defaults_group_suffix);
port_socket_end= port_socket;
if (opt_mysql_port)
port_socket_end= strxnmov(port_socket, sizeof(port_socket) - 1, " --port=",
opt_mysql_port, NullS);
if (opt_mysql_unix_port)
port_socket_end= strxnmov(port_socket_end,
sizeof(port_socket) -
(int)(port_socket_end - port_socket) - 1,
" --socket=", opt_mysql_unix_port, NullS);
*port_socket_end= 0;
load_defaults("my", load_default_groups, &argc, &argv);
if (basedir)
if (handle_options(&argc, &argv, my_long_options, get_one_option))
{
bindir_end= strmake(bindir, basedir, sizeof(bindir)-1);
ret= 1;
goto error;
}
else
if (tty_password)
opt_password= get_tty_password(NullS);
if (init_dynamic_string(&cmdline, NULL, 2 * FN_REFLEN + 128, FN_REFLEN))
{
if (test_file_exists("./share/mysql/english", "errmsg.sys")
&& (test_file_exists("./bin", "mysqld") ||
test_file_exists("./libexec", "mysqld")))
{
my_getwd(bindir, sizeof(bindir), MYF(0));
bindir_end= bindir + strlen(bindir);
ret= 1;
goto error;
}
else
if (!basedir)
{
bindir_end= strmake(bindir, DEFAULT_MYSQL_HOME, sizeof(bindir)-1);
my_getwd(path, sizeof(path), MYF(0));
basedir= my_strdup(path, MYF(0));
if (find_file("errmsg.sys", basedir, MYF(0), path, sizeof(path),
"share/mysql/english", NullS)
|| find_file(mysqld_name, basedir, MYF(0), path, sizeof(path),
"bin", "libexec", NullS))
{
my_free((gptr)basedir, MYF(0));
basedir= (char *)DEFAULT_MYSQL_HOME;
}
}
if (!datadir)
{
datadir= datadir_buf;
if (test_file_exists(bindir, "data/mysql"))
{
*strxnmov(datadir_buf, sizeof(datadir_buf)-1, bindir, "/data", NullS)= 0;
}
else if (test_file_exists(bindir, "var/mysql"))
{
*strxnmov(datadir_buf, sizeof(datadir_buf)-1, bindir, "/var", NullS)= 0;
}
if (!find_file("mysql", basedir, MYF(MY_ISDIR|MY_PARENT),
path, sizeof(path),
"data", "var", NullS))
datadir= my_strdup(path, MYF(0));
else
datadir= (char *)DATADIR;
}
strmake(bindir_end, "/bin", sizeof(bindir) - (int) (bindir_end - bindir)-1);
if (!test_file_exists_res
(bindir, mysqlcheck_name, mysqlcheck_line, &mysqlcheck_end))
if (find_file("user.frm", datadir, MYF(0), path, sizeof(path),
"mysql", NullS))
{
printf("Can't find program '%s'\n", mysqlcheck_line);
puts("Please restart with --basedir=mysql-install-directory");
exit(1);
ret= 1;
puts("Can't find data directory. Please restart with"
" --datadir=path-to-writable-data-dir");
goto error;
}
if (!test_file_exists(datadir, "mysql/user.frm"))
/*
Create the modified defaults file to be used by mysqlcheck
and mysql tools
*/
fn_format(path, UPGRADE_DEFAULTS_NAME, datadir, "", MYF(0));
upgrade_defaults_path= my_strdup(path, MYF(0));
if (extra_defaults)
{
puts
("Can't find data directory. Please restart with --datadir=path-to-data-dir");
exit(1);
ret= create_defaults_file(upgrade_defaults_path, forced_extra_defaults);
if (ret)
goto error;
defaults_to_use= upgrade_defaults_path;
upgrade_defaults_created= 1;
}
else
defaults_to_use= forced_extra_defaults;
/* create the modified defaults file to be used by mysqlcheck */
/* and mysql tools */
*strxnmov(upgrade_defaults_path, sizeof(upgrade_defaults_path)-1,
datadir, "/upgrade_defaults", NullS)= 0;
unpack_filename(upgrade_defaults_path, upgrade_defaults_path);
if ((error=
create_defaults_file(upgrade_defaults_path, forced_extra_defaults)))
goto err_exit;
defaults_to_use= upgrade_defaults_created ?
upgrade_defaults_path : forced_extra_defaults;
if (test_file_exists_res(datadir, "mysql_upgrade_info", check_file_name,
&buf_end) && !opt_force)
if (!find_file(MYSQL_UPGRADE_INFO_NAME, datadir, MY_SEARCH_SELF,
path, sizeof(path), NULL, NullS)
&& !opt_force)
{
char chf_buffer[50];
int b_read;
check_file= my_open(check_file_name, O_RDONLY, MYF(0));
b_read= my_read(check_file, chf_buffer, sizeof(chf_buffer)-1, MYF(0));
chf_buffer[b_read]= 0;
my_close(check_file, MYF(0));
if (!strcmp(chf_buffer, MYSQL_SERVER_VERSION))
char buf[sizeof(MYSQL_SERVER_VERSION)];
int fd, cnt;
fd= my_open(path, O_RDONLY, MYF(0));
cnt= my_read(fd, buf, sizeof(buf) - 1, MYF(0));
my_close(fd, MYF(0));
buf[cnt]= 0;
if (!strcmp(buf, MYSQL_SERVER_VERSION))
{
if (opt_verbose)
puts("mysql_upgrade already done for this version");
puts("mysql_upgrade has already been done for this version");
goto fix_priv_tables;
}
}
if (find_file(mysqlcheck_name, basedir, MYF(0), path, sizeof(path),
"bin", NullS))
{
ret= 1;
printf("Can't find program '%s'\n", mysqlcheck_name);
puts("Please restart with --basedir=mysql-install-directory");
goto error;
}
else
dynstr_set(&cmdline, path);
if (defaults_to_use)
{
mysqlcheck_end= strxnmov(mysqlcheck_end,
sizeof(mysqlcheck_line) - (int) (mysqlcheck_end -
mysqlcheck_line),
" --defaults-extra-file=", defaults_to_use,NullS);
dynstr_append(&cmdline, " --defaults-extra-file=");
dynstr_append(&cmdline, defaults_to_use);
}
mysqlcheck_end= strxnmov(mysqlcheck_end,
sizeof(mysqlcheck_line) -
(int) (mysqlcheck_end - mysqlcheck_line - 1),
" --check-upgrade --all-databases --auto-repair --user=",
user, port_socket, NullS);
*mysqlcheck_end= 0;
dynstr_append(&cmdline, " --check-upgrade --all-databases"
" --auto-repair --user=");
dynstr_append(&cmdline, user);
if (opt_verbose)
printf("Running %s\n", mysqlcheck_line);
if ((error= system(mysqlcheck_line)))
printf("Running %s\n", cmdline.str);
ret= system(cmdline.str);
if (ret)
{
printf("Error executing '%s'\n", mysqlcheck_line);
goto err_exit;
printf("Error executing '%s'\n", cmdline.str);
goto error;
}
if ((error= create_check_file(check_file_name)))
goto err_exit;
fn_format(path, MYSQL_UPGRADE_INFO_NAME, datadir, "", MYF(0));
ret= create_check_file(path);
if (ret)
goto error;
fix_priv_tables:
if (!test_file_exists_res(bindir, mysql_name,
fix_priv_tables_cmd, &fix_cmd_end))
if (find_file(mysql_name, basedir, MYF(0), path, sizeof(path),
"bin", NullS))
{
puts("Could not find MySQL command-line client (mysql).");
puts
("Please use --basedir to specify the directory where MySQL is installed.");
error= 1;
goto err_exit;
ret= 1;
puts("Could not find MySQL command-line client (mysql).\n"
"Please use --basedir to specify the directory"
" where MySQL is installed.");
goto error;
}
else
dynstr_set(&cmdline, path);
if (!test_file_exists_res(basedir,
"support_files/mysql_fix_privilege_tables.sql",
script_line, &buf_end)
&& !test_file_exists_res(basedir, "share/mysql_fix_privilege_tables.sql",
script_line, &buf_end)
&& !test_file_exists_res(basedir,
"share/mysql/mysql_fix_privilege_tables.sql",
script_line, &buf_end)
&& !test_file_exists_res(basedir,
"scripts/mysql_fix_privilege_tables.sql",
script_line, &buf_end)
&& !test_file_exists_res("/usr/local/mysql/share/mysql",
"mysql_fix_privilege_tables.sql", script_line,
&buf_end))
if (find_file(MYSQL_FIX_PRIV_TABLES_NAME, basedir, MYF(0),
path, sizeof(path),
"support_files", "share/mysql", "scripts",
NullS)
&& find_file(MYSQL_FIX_PRIV_TABLES_NAME, "/usr/local/mysql", MYF(0),
path, sizeof(path),
"share/mysql", NullS))
{
puts("Could not find file mysql_fix_privilege_tables.sql");
puts
("Please use --basedir to specify the directory where MySQL is installed");
error= 1;
goto err_exit;
ret= 1;
puts("Could not find file " MYSQL_FIX_PRIV_TABLES_NAME "\n"
"Please use --basedir to specify the directory"
" where MySQL is installed");
goto error;
}
else
script_line= my_strdup(path, MYF(0));
if (defaults_to_use)
{
fix_cmd_end= strxnmov(fix_cmd_end,
sizeof(fix_priv_tables_cmd) -
(int) (fix_cmd_end - fix_priv_tables_cmd - 1),
" --defaults-extra-file=", defaults_to_use, NullS);
dynstr_append(&cmdline, " --defaults-extra-file=");
dynstr_append(&cmdline, defaults_to_use);
}
fix_cmd_end= strxnmov(fix_cmd_end,
sizeof(fix_priv_tables_cmd) - (int) (fix_cmd_end -
fix_priv_tables_cmd),
" --user=", user, port_socket, " mysql < ", script_line, NullS);
*fix_cmd_end= 0;
dynstr_append(&cmdline, " --force --no-auto-rehash --batch --user=");
dynstr_append(&cmdline, user);
dynstr_append(&cmdline, " mysql < ");
dynstr_append(&cmdline, script_line);
if ((error= system(fix_priv_tables_cmd)))
{
/* Problem is that the 'Duplicate column' error */
/* which is not a bug for the script makes 'mysql' return */
/* an error */
/* printf("Error executing '%s'\n", fix_priv_tables_cmd); */
}
if (opt_verbose)
printf("Running %s\n", cmdline.str);
ret= system(cmdline.str);
if (ret)
printf("Error executing '%s'\n", cmdline.str);
error:
dynstr_free(&cmdline);
err_exit:
if (upgrade_defaults_created)
my_delete(upgrade_defaults_path, MYF(0));
my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
return error;
} /* main */
my_end(info_flag ? MY_CHECK_ERROR : 0);
return ret;
}

View File

@ -28,7 +28,7 @@
#include "../ndb/src/mgmclient/ndb_mgmclient.h"
#endif
#define ADMIN_VERSION "8.41"
#define ADMIN_VERSION "8.42"
#define MAX_MYSQL_VAR 256
#define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */
#define MAX_TRUNC_LENGTH 3
@ -41,7 +41,7 @@ ulonglong last_values[MAX_MYSQL_VAR];
static int interval=0;
static my_bool option_force=0,interrupted=0,new_line=0,
opt_compress=0, opt_relative=0, opt_verbose=0, opt_vertical=0,
tty_password=0;
tty_password= 0, info_flag= 0;
static uint tcp_port = 0, option_wait = 0, option_silent=0, nr_iterations,
opt_count_iterations= 0;
static ulong opt_connect_timeout, opt_shutdown_timeout;
@ -136,6 +136,8 @@ static struct my_option my_long_options[] =
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (gptr*) &info_flag,
(gptr*) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"force", 'f',
"Don't ask for confirmation on drop database; with multiple commands, continue even if an error occurs.",
(gptr*) &option_force, (gptr*) &option_force, 0, GET_BOOL, NO_ARG, 0, 0,
@ -412,7 +414,7 @@ int main(int argc,char *argv[])
my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
#endif
free_defaults(save_argv);
my_end(0);
my_end(info_flag ? MY_CHECK_ERROR : 0);
exit(error ? 1 : 0);
return 0;
}

View File

@ -66,7 +66,7 @@ static bool one_database=0, to_last_remote_log= 0, disable_log_bin= 0;
static bool opt_hexdump= 0;
static bool opt_base64_output= 0;
static const char* database= 0;
static my_bool force_opt= 0, short_form= 0, remote_opt= 0;
static my_bool force_opt= 0, short_form= 0, remote_opt= 0, info_flag;
static ulonglong offset = 0;
static const char* host = 0;
static int port= 0;
@ -716,6 +716,8 @@ static struct my_option my_long_options[] =
{"debug", '#', "Output debug log.", (gptr*) &default_dbug_option,
(gptr*) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (gptr*) &info_flag,
(gptr*) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"disable-log-bin", 'D', "Disable binary log. This is useful, if you "
"enabled --to-last-log and are sending the output to the same MySQL server. "
"This way you could avoid an endless loop. You would also like to use it "
@ -844,7 +846,7 @@ static void die(const char* fmt, ...)
va_end(args);
cleanup();
/* We cannot free DBUG, it is used in global destructors after exit(). */
my_end(MY_DONT_FREE_DBUG);
my_end((info_flag ? MY_CHECK_ERROR : 0) | MY_DONT_FREE_DBUG);
exit(1);
}
@ -852,7 +854,7 @@ static void die(const char* fmt, ...)
static void print_version()
{
printf("%s Ver 3.1 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
printf("%s Ver 3.2 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
NETWARE_SET_SCREEN_MODE(1);
}
@ -1138,7 +1140,7 @@ could be out of memory");
}
if (len < 8 && net->read_pos[0] == 254)
break; // end of data
DBUG_PRINT("info",( "len= %u, net->read_pos[5] = %d\n",
DBUG_PRINT("info",( "len: %lu, net->read_pos[5]: %d\n",
len, net->read_pos[5]));
if (!(ev= Log_event::read_log_event((const char*) net->read_pos + 1 ,
len - 1, &error_msg,
@ -1360,6 +1362,21 @@ static int dump_local_log_entries(const char* logname)
}
else // reading from stdin;
{
/*
Windows opens stdin in text mode by default. Certain characters
such as CTRL-Z are interpeted as events and the read() method
will stop. CTRL-Z is the EOF marker in Windows. to get past this
you have to open stdin in binary mode. Setmode() is used to set
stdin in binary mode. Errors on setting this mode result in
halting the function and printing an error message to stderr.
*/
#if defined (__WIN__) || (_WIN64)
if (_setmode(fileno(stdin), O_BINARY) == -1)
{
fprintf(stderr, "Could not set binary mode on stdin.\n");
return 1;
}
#endif
if (init_io_cache(file, fileno(stdin), 0, READ_CACHE, (my_off_t) 0,
0, MYF(MY_WME | MY_NABP | MY_DONT_CHECK_FILESIZE)))
return 1;
@ -1530,7 +1547,7 @@ int main(int argc, char** argv)
free_defaults(defaults_argv);
my_free_open_file_info();
/* We cannot free DBUG, it is used in global destructors after exit(). */
my_end(MY_DONT_FREE_DBUG);
my_end((info_flag ? MY_CHECK_ERROR : 0) | MY_DONT_FREE_DBUG);
exit(exit_value);
DBUG_RETURN(exit_value); // Keep compilers happy
}

View File

@ -16,7 +16,7 @@
/* By Jani Tolonen, 2001-04-20, MySQL Development Team */
#define CHECK_VERSION "2.4.4"
#define CHECK_VERSION "2.4.5"
#include "client_priv.h"
#include <m_ctype.h>
@ -34,7 +34,7 @@ static my_bool opt_alldbs = 0, opt_check_only_changed = 0, opt_extended = 0,
opt_compress = 0, opt_databases = 0, opt_fast = 0,
opt_medium_check = 0, opt_quick = 0, opt_all_in_1 = 0,
opt_silent = 0, opt_auto_repair = 0, ignore_errors = 0,
tty_password = 0, opt_frm = 0,
tty_password= 0, opt_frm= 0, info_flag= 0,
opt_fix_table_names= 0, opt_fix_db_names= 0, opt_upgrade= 0;
static uint verbose = 0, opt_mysql_port=0;
static my_string opt_mysql_unix_port = 0;
@ -96,6 +96,8 @@ static struct my_option my_long_options[] =
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (gptr*) &info_flag,
(gptr*) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"default-character-set", OPT_DEFAULT_CHARSET,
"Set the default character set.", (gptr*) &default_charset,
(gptr*) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@ -761,7 +763,7 @@ int main(int argc, char **argv)
*/
if (get_options(&argc, &argv))
{
my_end(0);
my_end(info_flag ? MY_CHECK_ERROR : 0);
exit(EX_USAGE);
}
if (dbConnect(current_host, current_user, opt_password))
@ -803,6 +805,6 @@ int main(int argc, char **argv)
#ifdef HAVE_SMEM
my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
#endif
my_end(0);
my_end(info_flag ? MY_CHECK_ERROR : 0);
return(first_error!=0);
} /* main */

View File

@ -37,7 +37,7 @@
** 10 Jun 2003: SET NAMES and --no-set-names by Alexander Barkov
*/
#define DUMP_VERSION "10.10"
#define DUMP_VERSION "10.12"
#include <my_global.h>
#include <my_sys.h>
@ -103,7 +103,7 @@ static my_bool verbose= 0, opt_no_create_info= 0, opt_no_data= 0,
opt_alltspcs=0, opt_notspcs= 0;
static ulong opt_max_allowed_packet, opt_net_buffer_length;
static MYSQL mysql_connection,*mysql=0;
static my_bool insert_pat_inited=0;
static my_bool insert_pat_inited= 0, info_flag;
static DYNAMIC_STRING insert_pat;
static char *opt_password=0,*current_user=0,
*current_host=0,*path=0,*fields_terminated=0,
@ -111,6 +111,7 @@ static char *opt_password=0,*current_user=0,
*where=0, *order_by=0,
*opt_compatible_mode_str= 0,
*err_ptr= 0;
static char **defaults_argv= 0;
static char compatible_mode_normal_str[255];
static ulong opt_compatible_mode= 0;
#define MYSQL_OPT_MASTER_DATA_EFFECTIVE_SQL 1
@ -120,7 +121,7 @@ static my_string opt_mysql_unix_port=0;
static int first_error=0;
static DYNAMIC_STRING extended_row;
#include <sslopt-vars.h>
FILE *md_result_file;
FILE *md_result_file= 0;
#ifdef HAVE_SMEM
static char *shared_memory_base_name=0;
#endif
@ -226,6 +227,8 @@ static struct my_option my_long_options[] =
{"debug", '#', "Output debug log", (gptr*) &default_dbug_option,
(gptr*) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (gptr*) &info_flag,
(gptr*) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"default-character-set", OPT_DEFAULT_CHARSET,
"Set the default character set.", (gptr*) &default_charset,
(gptr*) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@ -545,8 +548,10 @@ static void write_header(FILE *sql_file, char *db_name)
if (opt_xml)
{
fputs("<?xml version=\"1.0\"?>\n", sql_file);
/* Schema reference. Allows use of xsi:nil for NULL values and
xsi:type to define an element's data type. */
/*
Schema reference. Allows use of xsi:nil for NULL values and
xsi:type to define an element's data type.
*/
fputs("<mysqldump ", sql_file);
fputs("xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"",
sql_file);
@ -649,14 +654,6 @@ byte* get_table_key(const char *entry, uint *length,
}
void init_table_rule_hash(HASH* h)
{
if (hash_init(h, charset_info, 16, 0, 0,
(hash_get_key) get_table_key,
(hash_free_key) free_table_ent, 0))
exit(EX_EOM);
}
static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
@ -699,6 +696,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break;
case '#':
DBUG_PUSH(argument ? argument : default_dbug_option);
info_flag= 1;
break;
#include <sslopt-case.h>
case 'V': print_version(); exit(0);
@ -739,9 +737,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
fprintf(stderr, "Illegal use of option --ignore-table=<database>.<table>\n");
exit(1);
}
if (!hash_inited(&ignore_table))
init_table_rule_hash(&ignore_table);
if (my_hash_insert(&ignore_table, (byte*)my_strdup(argument, MYF(0))))
exit(EX_EOM);
break;
@ -817,9 +812,21 @@ static int get_options(int *argc, char ***argv)
md_result_file= stdout;
load_defaults("my",load_default_groups,argc,argv);
defaults_argv= *argv;
if (hash_init(&ignore_table, charset_info, 16, 0, 0,
(hash_get_key) get_table_key,
(hash_free_key) free_table_ent, 0))
return(EX_EOM);
/* Don't copy cluster internal log tables */
if (my_hash_insert(&ignore_table,
(byte*) my_strdup("mysql.apply_status", MYF(MY_WME))) ||
my_hash_insert(&ignore_table,
(byte*) my_strdup("mysql.schema", MYF(MY_WME))))
return(EX_EOM);
if ((ho_error= handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error);
return(ho_error);
*mysql_params->p_max_allowed_packet= opt_max_allowed_packet;
*mysql_params->p_net_buffer_length= opt_net_buffer_length;
@ -831,7 +838,7 @@ static int get_options(int *argc, char ***argv)
{
fprintf(stderr,
"%s: You must use option --tab with --fields-...\n", my_progname);
return(1);
return(EX_USAGE);
}
/* Ensure consistency of the set of binlog & locking options */
@ -841,7 +848,7 @@ static int get_options(int *argc, char ***argv)
{
fprintf(stderr, "%s: You can't use --single-transaction and "
"--lock-all-tables at the same time.\n", my_progname);
return(1);
return(EX_USAGE);
}
if (opt_master_data)
opt_lock_all_tables= !opt_single_transaction;
@ -850,14 +857,14 @@ static int get_options(int *argc, char ***argv)
if (enclosed && opt_enclosed)
{
fprintf(stderr, "%s: You can't use ..enclosed.. and ..optionally-enclosed.. at the same time.\n", my_progname);
return(1);
return(EX_USAGE);
}
if ((opt_databases || opt_alldbs) && path)
{
fprintf(stderr,
"%s: --databases or --all-databases can't be used with --tab.\n",
my_progname);
return(1);
return(EX_USAGE);
}
if (strcmp(default_charset, charset_info->csname) &&
!(charset_info= get_charset_by_csname(default_charset,
@ -866,7 +873,7 @@ static int get_options(int *argc, char ***argv)
if ((*argc < 1 && !opt_alldbs) || (*argc > 0 && opt_alldbs))
{
short_usage();
return 1;
return EX_USAGE;
}
if (tty_password)
opt_password=get_tty_password(NullS);
@ -941,6 +948,23 @@ static FILE* open_sql_file_for_table(const char* table)
}
static void free_resources()
{
if (md_result_file && md_result_file != stdout)
my_fclose(md_result_file, MYF(0));
my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR));
if (hash_inited(&ignore_table))
hash_free(&ignore_table);
if (extended_insert)
dynstr_free(&extended_row);
if (insert_pat_inited)
dynstr_free(&insert_pat);
if (defaults_argv)
free_defaults(defaults_argv);
my_end(info_flag ? MY_CHECK_ERROR : 0);
}
static void safe_exit(int error)
{
if (!first_error)
@ -949,18 +973,19 @@ static void safe_exit(int error)
return;
if (mysql)
mysql_close(mysql);
free_resources();
exit(error);
}
/* safe_exit */
/*
** dbConnect -- connects to the host and selects DB.
db_connect -- connects to the host and selects DB.
*/
static int dbConnect(char *host, char *user,char *passwd)
static int connect_to_db(char *host, char *user,char *passwd)
{
char buff[20+FN_REFLEN];
DBUG_ENTER("dbConnect");
DBUG_ENTER("connect_to_db");
verbose_msg("-- Connecting to %s...\n", host ? host : "localhost");
mysql_init(&mysql_connection);
@ -985,7 +1010,7 @@ static int dbConnect(char *host, char *user,char *passwd)
0)))
{
DB_error(&mysql_connection, "when trying to connect");
return 1;
DBUG_RETURN(1);
}
/*
Don't dump SET NAMES with a pre-4.1 server (bug#7997).
@ -1002,7 +1027,7 @@ static int dbConnect(char *host, char *user,char *passwd)
if (mysql_query_with_error_report(mysql, 0, buff))
{
safe_exit(EX_MYSQLERR);
return 1;
DBUG_RETURN(1);
}
/*
set time_zone to UTC to allow dumping date types between servers with
@ -1014,11 +1039,11 @@ static int dbConnect(char *host, char *user,char *passwd)
if (mysql_query_with_error_report(mysql, 0, buff))
{
safe_exit(EX_MYSQLERR);
return 1;
DBUG_RETURN(1);
}
}
return 0;
} /* dbConnect */
DBUG_RETURN(0);
} /* connect_to_db */
/*
@ -1543,8 +1568,8 @@ static uint dump_routines_for_db(char *db)
if the user has EXECUTE privilege he see routine names, but NOT the
routine body of other routines that are not the creator of!
*/
DBUG_PRINT("info",("length of body for %s row[2] '%s' is %d",
routine_name, row[2], strlen(row[2])));
DBUG_PRINT("info",("length of body for %s row[2] '%s' is %ld",
routine_name, row[2], (long) strlen(row[2])));
if (strlen(row[2]))
{
char *query_str= NULL;
@ -1667,7 +1692,11 @@ static uint get_table_structure(char *table, char *db, char *table_type,
{
complete_insert= opt_complete_insert;
if (!insert_pat_inited)
insert_pat_inited= init_dynamic_string(&insert_pat, "", 1024, 1024);
{
insert_pat_inited= 1;
if (init_dynamic_string(&insert_pat, "", 1024, 1024))
safe_exit(EX_MYSQLERR);
}
else
dynstr_set(&insert_pat, "");
}
@ -2330,7 +2359,7 @@ static void dump_table(char *table, char *db)
The "table" could be a view. If so, we don't do anything here.
*/
if (strcmp (table_type, "VIEW") == 0)
return;
DBUG_VOID_RETURN;
/* Check --no-data flag */
if (opt_no_data)
@ -3097,6 +3126,8 @@ static int dump_databases(char **db_names)
{
int result=0;
char **db;
DBUG_ENTER("dump_databases");
for (db= db_names ; *db ; db++)
{
if (dump_all_tables_in_db(*db))
@ -3110,7 +3141,7 @@ static int dump_databases(char **db_names)
result=1;
}
}
return result;
DBUG_RETURN(result);
} /* dump_databases */
@ -3125,7 +3156,7 @@ RETURN VALUES
0 Success.
1 Failure.
*/
int init_dumping_views(char *qdatabase)
int init_dumping_views(char *qdatabase __attribute__((unused)))
{
return 0;
} /* init_dumping_views */
@ -3222,12 +3253,11 @@ static int init_dumping(char *database, int init_func(char*))
} /* init_dumping */
/* Return 1 if we should copy the table */
my_bool include_table(byte* hash_key, uint len)
{
if (hash_search(&ignore_table, (byte*) hash_key, len))
return FALSE;
return TRUE;
return !hash_search(&ignore_table, (byte*) hash_key, len);
}
@ -3236,18 +3266,16 @@ static int dump_all_tables_in_db(char *database)
char *table;
uint numrows;
char table_buff[NAME_LEN*2+3];
char hash_key[2*NAME_LEN+2]; /* "db.tablename" */
char *afterdot;
int using_mysql_db= my_strcasecmp(&my_charset_latin1, database, "mysql");
DBUG_ENTER("dump_all_tables_in_db");
afterdot= strmov(hash_key, database);
*afterdot++= '.';
if (!strcmp(database, NDB_REP_DB)) /* Skip cluster internal database */
return 0;
if (init_dumping(database, init_dumping_tables))
return 1;
DBUG_RETURN(1);
if (opt_xml)
print_xml_tag(md_result_file, "", "\n", "database", "name=", database, NullS);
if (lock_tables)
@ -3307,7 +3335,7 @@ static int dump_all_tables_in_db(char *database)
fprintf(md_result_file,"\n--\n-- Flush Grant Tables \n--\n");
fprintf(md_result_file,"\n/*! FLUSH PRIVILEGES */;\n");
}
return 0;
DBUG_RETURN(0);
} /* dump_all_tables_in_db */
@ -3675,7 +3703,6 @@ static void print_value(FILE *file, MYSQL_RES *result, MYSQL_ROW row,
/*
SYNOPSIS
Check if we the table is one of the table types that should be ignored:
@ -3715,7 +3742,7 @@ char check_if_ignore_table(const char *table_name, char *table_type)
{
if (mysql_errno(mysql) != ER_PARSE_ERROR)
{ /* If old MySQL version */
verbose_msg("-- Warning: Couldn't get status information for " \
verbose_msg("-- Warning: Couldn't get status information for "
"table %s (%s)\n", table_name, mysql_error(mysql));
DBUG_RETURN(result); /* assume table is ok */
}
@ -4071,19 +4098,24 @@ static my_bool get_view_structure(char *table, char* db)
int main(int argc, char **argv)
{
int exit_code;
MY_INIT("mysqldump");
compatible_mode_normal_str[0]= 0;
default_charset= (char *)mysql_universal_client_charset;
bzero((char*) &ignore_table, sizeof(ignore_table));
if (get_options(&argc, &argv))
exit_code= get_options(&argc, &argv);
if (exit_code)
{
my_end(0);
exit(EX_USAGE);
free_resources(0);
exit(exit_code);
}
if (dbConnect(current_host, current_user, opt_password))
if (connect_to_db(current_host, current_user, opt_password))
{
free_resources(0);
exit(EX_MYSQLERR);
}
if (!path)
write_header(md_result_file, *argv);
@ -4141,15 +4173,6 @@ err:
dbDisconnect(current_host);
if (!path)
write_footer(md_result_file);
if (md_result_file != stdout)
my_fclose(md_result_file, MYF(0));
my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR));
if (hash_inited(&ignore_table))
hash_free(&ignore_table);
if (extended_insert)
dynstr_free(&extended_row);
if (insert_pat_inited)
dynstr_free(&insert_pat);
my_end(0);
free_resources();
return(first_error);
} /* main */

View File

@ -25,7 +25,7 @@
** * *
** *************************
*/
#define IMPORT_VERSION "3.5"
#define IMPORT_VERSION "3.6"
#include "client_priv.h"
#include "mysql_version.h"
@ -50,7 +50,7 @@ static char *add_load_option(char *ptr,const char *object,
static my_bool verbose=0,lock_tables=0,ignore_errors=0,opt_delete=0,
replace=0,silent=0,ignore=0,opt_compress=0,
opt_low_priority= 0, tty_password= 0;
static my_bool opt_use_threads= 0;
static my_bool opt_use_threads= 0, info_flag= 0;
static uint opt_local_file=0;
static char *opt_password=0, *current_user=0,
*current_host=0, *current_db=0, *fields_terminated=0,
@ -88,6 +88,8 @@ static struct my_option my_long_options[] =
0, 0, 0},
{"debug",'#', "Output debug log. Often this is 'd:t:o,filename'.", 0, 0, 0,
GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (gptr*) &info_flag,
(gptr*) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"delete", 'd', "First delete all rows from table.", (gptr*) &opt_delete,
(gptr*) &opt_delete, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"fields-terminated-by", OPT_FTB,
@ -663,6 +665,6 @@ int main(int argc, char **argv)
my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
#endif
free_defaults(argv_to_free);
my_end(0);
my_end(info_flag ? MY_CHECK_ERROR : 0);
return(exitcode);
}

View File

@ -16,7 +16,7 @@
/* Show databases, tables or columns */
#define SHOW_VERSION "9.5"
#define SHOW_VERSION "9.6"
#include "client_priv.h"
#include <my_sys.h>
@ -28,8 +28,8 @@
#include <sslopt-vars.h>
static my_string host=0,opt_password=0,user=0;
static my_bool opt_show_keys= 0, opt_compress= 0, opt_count=0, opt_status= 0,
tty_password= 0, opt_table_type= 0;
static my_bool opt_show_keys= 0, opt_compress= 0, opt_count=0, opt_status= 0;
static my_bool tty_password= 0, opt_table_type= 0, info_flag= 0;
static uint opt_verbose=0;
static char *default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME;
@ -129,8 +129,7 @@ int main(int argc, char **argv)
}
mysql.reconnect= 1;
switch (argc)
{
switch (argc) {
case 0: error=list_dbs(&mysql,wild); break;
case 1:
if (opt_status)
@ -151,7 +150,7 @@ int main(int argc, char **argv)
#ifdef HAVE_SMEM
my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
#endif
my_end(0);
my_end(info_flag ? MY_CHECK_ERROR : 0);
exit(error ? 1 : 0);
return 0; /* No compiler warnings */
}
@ -177,6 +176,8 @@ static struct my_option my_long_options[] =
0, 0, 0},
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (gptr*) &info_flag,
(gptr*) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG,
0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", (gptr*) &host, (gptr*) &host, 0, GET_STR,

View File

@ -592,7 +592,7 @@ get_random_string(char *buf)
DBUG_ENTER("get_random_string");
for (x= RAND_STRING_SIZE; x > 0; x--)
*buf_ptr++= ALPHANUMERICS[random() % ALPHANUMERICS_SIZE];
DBUG_PRINT("info", ("random string: '%*s'", buf_ptr - buf, buf));
DBUG_PRINT("info", ("random string: '%*s'", (int) (buf_ptr - buf), buf));
DBUG_RETURN(buf_ptr - buf);
}
@ -1031,7 +1031,7 @@ run_scheduler(stats *sptr, statement *stmts, uint concur, ulonglong limit)
for (x= 0; x < concur; x++)
{
int pid;
DBUG_PRINT("info", ("x %d concurrency %d", x, concurrency));
DBUG_PRINT("info", ("x: %d concurrency: %u", x, *concurrency));
pid= fork();
switch(pid)
{

View File

@ -29,6 +29,7 @@
Matt Wagner <matt@mysql.com>
Monty
Jani
Holyfoot
*/
#define MTEST_VERSION "3.0"
@ -80,13 +81,14 @@ enum {
OPT_SSL_CA, OPT_SSL_CAPATH, OPT_SSL_CIPHER, OPT_PS_PROTOCOL,
OPT_SP_PROTOCOL, OPT_CURSOR_PROTOCOL, OPT_VIEW_PROTOCOL,
OPT_SSL_VERIFY_SERVER_CERT, OPT_MAX_CONNECT_RETRIES,
OPT_MARK_PROGRESS
OPT_MARK_PROGRESS, OPT_CHARSETS_DIR, OPT_LOG_DIR, OPT_DEBUG_INFO
};
static int record= 0, opt_sleep= -1;
static char *db= 0, *pass= 0;
const char *user= 0, *host= 0, *unix_sock= 0, *opt_basedir= "./";
const char *opt_include= 0;
const char *opt_logdir= "";
const char *opt_include= 0, *opt_charsets_dir;
static int port= 0;
static int opt_max_connect_retries;
static my_bool opt_compress= 0, silent= 0, verbose= 0;
@ -97,6 +99,7 @@ static my_bool sp_protocol= 0, sp_protocol_enabled= 0;
static my_bool view_protocol= 0, view_protocol_enabled= 0;
static my_bool cursor_protocol= 0, cursor_protocol_enabled= 0;
static my_bool parsing_disabled= 0;
static my_bool info_flag;
static my_bool display_result_vertically= FALSE, display_metadata= FALSE;
static my_bool disable_query_log= 0, disable_result_log= 0;
static my_bool disable_warnings= 0, disable_ps_warnings= 0;
@ -145,7 +148,6 @@ static struct st_test_file* file_stack_end;
static CHARSET_INFO *charset_info= &my_charset_latin1; /* Default charset */
static const char *charset_name= "latin1"; /* Default character set name */
static const char *embedded_server_groups[]=
{
@ -221,6 +223,12 @@ struct st_connection
MYSQL* util_mysql;
char *name;
MYSQL_STMT* stmt;
const char *cur_query;
int cur_query_len;
pthread_mutex_t mutex;
pthread_cond_t cond;
int query_done;
};
struct st_connection connections[128];
struct st_connection* cur_con, *next_con, *connections_end;
@ -459,7 +467,6 @@ void mysql_disable_rpl_parse(MYSQL* mysql __attribute__((unused))) {}
int mysql_rpl_parse_enabled(MYSQL* mysql __attribute__((unused))) { return 1; }
my_bool mysql_rpl_probe(MYSQL *mysql __attribute__((unused))) { return 1; }
#endif
void replace_dynstr_append_mem(DYNAMIC_STRING *ds, const char *val,
int len);
void replace_dynstr_append(DYNAMIC_STRING *ds, const char *val);
@ -470,7 +477,56 @@ void handle_error(struct st_command*,
const char *err_sqlstate, DYNAMIC_STRING *ds);
void handle_no_error(struct st_command*);
#ifdef EMBEDDED_LIBRARY
/*
send_one_query executes query in separate thread what is
necessary in embedded library to run 'send' in proper way.
This implementation doesn't handle errors returned
by mysql_send_query. It's technically possible, though
i don't see where it is needed.
*/
pthread_handler_t send_one_query(void *arg)
{
struct st_connection *cn= (struct st_connection*)arg;
mysql_thread_init();
VOID(mysql_send_query(&cn->mysql, cn->cur_query, cn->cur_query_len));
mysql_thread_end();
pthread_mutex_lock(&cn->mutex);
cn->query_done= 1;
VOID(pthread_cond_signal(&cn->cond));
pthread_mutex_unlock(&cn->mutex);
pthread_exit(0);
return 0;
}
static int do_send_query(struct st_connection *cn, const char *q, int q_len,
int flags)
{
pthread_t tid;
if (flags & QUERY_REAP_FLAG)
return mysql_send_query(&cn->mysql, q, q_len);
if (pthread_mutex_init(&cn->mutex, NULL) ||
pthread_cond_init(&cn->cond, NULL))
die("Error in the thread library");
cn->cur_query= q;
cn->cur_query_len= q_len;
cn->query_done= 0;
if (pthread_create(&tid, NULL, send_one_query, (void*)cn))
die("Cannot start new thread for query");
return 0;
}
#else /*EMBEDDED_LIBRARY*/
#define do_send_query(cn,q,q_len,flags) mysql_send_query(&cn->mysql, q, q_len)
#endif /*EMBEDDED_LIBRARY*/
void do_eval(DYNAMIC_STRING *query_eval, const char *query,
const char *query_end, my_bool pass_through_escape_chars)
@ -753,7 +809,7 @@ void die(const char *fmt, ...)
/* Clean up and exit */
free_used_memory();
my_end(MY_CHECK_ERROR);
my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : MY_CHECK_ERROR);
if (!silent)
printf("not ok\n");
@ -793,7 +849,7 @@ void abort_not_supported_test(const char *fmt, ...)
/* Clean up and exit */
free_used_memory();
my_end(MY_CHECK_ERROR);
my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : MY_CHECK_ERROR);
if (!silent)
printf("skipped\n");
@ -892,8 +948,8 @@ int dyn_string_cmp(DYNAMIC_STRING* ds, const char *fname)
die(NullS);
if (!eval_result && (uint) stat_info.st_size != ds->length)
{
DBUG_PRINT("info",("Size differs: result size: %u file size: %llu",
ds->length, stat_info.st_size));
DBUG_PRINT("info",("Size differs: result size: %u file size: %lu",
ds->length, (ulong) stat_info.st_size));
DBUG_PRINT("info",("result: '%s'", ds->str));
DBUG_RETURN(RESULT_LENGTH_MISMATCH);
}
@ -3076,14 +3132,14 @@ void do_connect(struct st_command *command)
else if (!strncmp(con_options, "COMPRESS", 8))
con_compress= 1;
else
die("Illegal option to connect: %.*s", end - con_options, con_options);
die("Illegal option to connect: %.*s", (int) (end - con_options), con_options);
/* Process next option */
con_options= end;
}
if (next_con == connections_end)
die("Connection limit exhausted, you can have max %d connections",
(sizeof(connections)/sizeof(struct st_connection)));
die("Connection limit exhausted, you can have max %ld connections",
(long) (sizeof(connections)/sizeof(struct st_connection)));
if (find_connection_by_name(ds_connection_name.str))
die("Connection %s already exists", ds_connection_name.str);
@ -3093,7 +3149,11 @@ void do_connect(struct st_command *command)
if (opt_compress || con_compress)
mysql_options(&next_con->mysql, MYSQL_OPT_COMPRESS, NullS);
mysql_options(&next_con->mysql, MYSQL_OPT_LOCAL_INFILE, 0);
mysql_options(&next_con->mysql, MYSQL_SET_CHARSET_NAME, charset_name);
mysql_options(&next_con->mysql, MYSQL_SET_CHARSET_NAME,
charset_info->csname);
if (opt_charsets_dir)
mysql_options(&cur_con->mysql, MYSQL_SET_CHARSET_DIR,
opt_charsets_dir);
#ifdef HAVE_OPENSSL
if (opt_use_ssl || con_ssl)
@ -3779,6 +3839,9 @@ static struct my_option my_long_options[] =
0, 0, 0, 0, 0, 0},
{"basedir", 'b', "Basedir for tests.", (gptr*) &opt_basedir,
(gptr*) &opt_basedir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR,
"Directory where character sets are.", (gptr*) &opt_charsets_dir,
(gptr*) &opt_charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"compress", 'C', "Use the compressed server/client protocol.",
(gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
@ -3794,10 +3857,14 @@ static struct my_option my_long_options[] =
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (gptr*) &info_flag,
(gptr*) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", (gptr*) &host, (gptr*) &host, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"include", 'i', "Include SQL before each test case.", (gptr*) &opt_include,
(gptr*) &opt_include, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"logdir", OPT_LOG_DIR, "Directory for log files", (gptr*) &opt_logdir,
(gptr*) &opt_logdir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"mark-progress", OPT_MARK_PROGRESS,
"Write linenumber and elapsed time to <testname>.progress",
(gptr*) &opt_mark_progress, (gptr*) &opt_mark_progress, 0,
@ -4080,7 +4147,8 @@ void dump_result_to_reject_file(char *buf, int size)
void dump_result_to_log_file(char *buf, int size)
{
char log_file[FN_REFLEN];
str_to_file(fn_format(log_file, result_file_name, "", ".log",
str_to_file(fn_format(log_file, result_file_name, opt_logdir, ".log",
*opt_logdir ? MY_REPLACE_DIR | MY_REPLACE_EXT:
MY_REPLACE_EXT),
buf, size);
}
@ -4088,7 +4156,8 @@ void dump_result_to_log_file(char *buf, int size)
void dump_progress(void)
{
char log_file[FN_REFLEN];
str_to_file(fn_format(log_file, result_file_name, "", ".progress",
str_to_file(fn_format(log_file, result_file_name, opt_logdir, ".progress",
*opt_logdir ? MY_REPLACE_DIR | MY_REPLACE_EXT:
MY_REPLACE_EXT),
ds_progress.str, ds_progress.length);
}
@ -4492,7 +4561,6 @@ int append_warnings(DYNAMIC_STRING *ds, MYSQL* mysql)
}
/*
Run query using MySQL C API
@ -4509,11 +4577,12 @@ int append_warnings(DYNAMIC_STRING *ds, MYSQL* mysql)
error - function will not return
*/
void run_query_normal(MYSQL *mysql, struct st_command *command,
void run_query_normal(struct st_connection *cn, struct st_command *command,
int flags, char *query, int query_len,
DYNAMIC_STRING *ds, DYNAMIC_STRING *ds_warnings)
{
MYSQL_RES *res= 0;
MYSQL *mysql= &cn->mysql;
int err= 0, counter= 0;
DBUG_ENTER("run_query_normal");
DBUG_PRINT("enter",("flags: %d", flags));
@ -4524,14 +4593,26 @@ void run_query_normal(MYSQL *mysql, struct st_command *command,
/*
Send the query
*/
if (mysql_send_query(mysql, query, query_len))
if (do_send_query(cn, query, query_len, flags))
{
handle_error(command, mysql_errno(mysql), mysql_error(mysql),
mysql_sqlstate(mysql), ds);
goto end;
}
}
#ifdef EMBEDDED_LIBRARY
/*
Here we handle 'reap' command, so we need to check if the
query's thread was finished and probably wait
*/
else if (flags & QUERY_REAP_FLAG)
{
pthread_mutex_lock(&cn->mutex);
while (!cn->query_done)
pthread_cond_wait(&cn->cond, &cn->mutex);
pthread_mutex_unlock(&cn->mutex);
}
#endif /*EMBEDDED_LIBRARY*/
if (!(flags & QUERY_REAP_FLAG))
DBUG_VOID_RETURN;
@ -5022,8 +5103,9 @@ int util_query(MYSQL* org_mysql, const char* query){
*/
void run_query(MYSQL *mysql, struct st_command *command, int flags)
void run_query(struct st_connection *cn, struct st_command *command, int flags)
{
MYSQL *mysql= &cn->mysql;
DYNAMIC_STRING *ds;
DYNAMIC_STRING ds_result;
DYNAMIC_STRING ds_warnings;
@ -5180,7 +5262,7 @@ void run_query(MYSQL *mysql, struct st_command *command, int flags)
match_re(&ps_re, query))
run_query_stmt(mysql, command, query, query_len, ds, &ds_warnings);
else
run_query_normal(mysql, command, flags, query, query_len,
run_query_normal(cn, command, flags, query, query_len,
ds, &ds_warnings);
if (sp_created)
@ -5511,7 +5593,11 @@ int main(int argc, char **argv)
if (opt_compress)
mysql_options(&cur_con->mysql,MYSQL_OPT_COMPRESS,NullS);
mysql_options(&cur_con->mysql, MYSQL_OPT_LOCAL_INFILE, 0);
mysql_options(&cur_con->mysql, MYSQL_SET_CHARSET_NAME, charset_name);
mysql_options(&cur_con->mysql, MYSQL_SET_CHARSET_NAME,
charset_info->csname);
if (opt_charsets_dir)
mysql_options(&cur_con->mysql, MYSQL_SET_CHARSET_DIR,
opt_charsets_dir);
#ifdef HAVE_OPENSSL
@ -5641,7 +5727,7 @@ int main(int argc, char **argv)
strmake(command->require_file, save_file, sizeof(save_file));
save_file[0]= 0;
}
run_query(&cur_con->mysql, command, QUERY_REAP_FLAG|QUERY_SEND_FLAG);
run_query(cur_con, command, QUERY_REAP_FLAG|QUERY_SEND_FLAG);
display_result_vertically= old_display_result_vertically;
command->last_argument= command->end;
command_executed++;
@ -5672,7 +5758,7 @@ int main(int argc, char **argv)
strmake(command->require_file, save_file, sizeof(save_file));
save_file[0]= 0;
}
run_query(&cur_con->mysql, command, flags);
run_query(cur_con, command, flags);
command_executed++;
command->last_argument= command->end;
break;
@ -5698,7 +5784,7 @@ int main(int argc, char **argv)
the query and read the result some time later when reap instruction
is given on this connection.
*/
run_query(&cur_con->mysql, command, QUERY_SEND_FLAG);
run_query(cur_con, command, QUERY_SEND_FLAG);
command_executed++;
command->last_argument= command->end;
break;
@ -5900,7 +5986,7 @@ int main(int argc, char **argv)
timer_output();
free_used_memory();
my_end(MY_CHECK_ERROR);
my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : MY_CHECK_ERROR);
/* Yes, if we got this far the test has suceeded! Sakila smiles */
if (!silent)

View File

@ -434,7 +434,7 @@ rl_translate_keyseq (seq, array, len)
{
register int i, c, l, temp;
for (i = l = 0; c = seq[i]; i++)
for (i = l = 0; (c = seq[i]); i++)
{
if (c == '\\')
{
@ -735,7 +735,8 @@ _rl_read_file (filename, sizep)
file_size = (size_t)finfo.st_size;
/* check for overflow on very large files */
if (file_size != finfo.st_size || file_size + 1 < file_size)
if ((long long) file_size != (long long) finfo.st_size ||
file_size + 1 < file_size)
{
if (file >= 0)
close (file);
@ -765,8 +766,8 @@ _rl_read_file (filename, sizep)
/* Re-read the current keybindings file. */
int
rl_re_read_init_file (count, ignore)
int count, ignore;
rl_re_read_init_file (int count __attribute__((unused)),
int ignore __attribute__((unused)))
{
int r;
r = rl_read_init_file ((const char *)NULL);
@ -987,8 +988,7 @@ parser_if (args)
/* Invert the current parser state if there is anything on the stack. */
static int
parser_else (args)
char *args;
parser_else (char *args __attribute__((unused)))
{
register int i;
@ -1018,8 +1018,7 @@ parser_else (args)
/* Terminate a conditional, popping the value of
_rl_parsing_conditionalized_out from the stack. */
static int
parser_endif (args)
char *args;
parser_endif (char *args __attribute__((unused)))
{
if (if_stack_depth)
_rl_parsing_conditionalized_out = if_stack[--if_stack_depth];
@ -1142,7 +1141,7 @@ rl_parse_and_bind (string)
{
int passc = 0;
for (i = 1; c = string[i]; i++)
for (i = 1; (c = string[i]); i++)
{
if (passc)
{
@ -1218,7 +1217,7 @@ rl_parse_and_bind (string)
{
int delimiter = string[i++], passc;
for (passc = 0; c = string[i]; i++)
for (passc = 0; (c = string[i]); i++)
{
if (passc)
{
@ -1377,7 +1376,7 @@ static struct {
#if defined (VISIBLE_STATS)
{ "visible-stats", &rl_visible_stats, 0 },
#endif /* VISIBLE_STATS */
{ (char *)NULL, (int *)NULL }
{ (char *)NULL, (int *)NULL, 0 }
};
static int
@ -1446,7 +1445,7 @@ static struct {
{ "editing-mode", V_STRING, sv_editmode },
{ "isearch-terminators", V_STRING, sv_isrchterm },
{ "keymap", V_STRING, sv_keymap },
{ (char *)NULL, 0 }
{ (char *)NULL, 0, 0 }
};
static int
@ -1466,7 +1465,7 @@ find_string_var (name)
values result in 0 (false). */
static int
bool_to_int (value)
char *value;
const char *value;
{
return (value == 0 || *value == '\0' ||
(_rl_stricmp (value, "on") == 0) ||
@ -1725,13 +1724,13 @@ char *
rl_get_keymap_name_from_edit_mode ()
{
if (rl_editing_mode == emacs_mode)
return "emacs";
return (char*) "emacs";
#if defined (VI_MODE)
else if (rl_editing_mode == vi_mode)
return "vi";
return (char*) "vi";
#endif /* VI_MODE */
else
return "none";
return (char*) "none";
}
/* **************************************************************** */
@ -1966,7 +1965,7 @@ rl_function_dumper (print_readably)
fprintf (rl_outstream, "\n");
for (i = 0; name = names[i]; i++)
for (i = 0; (name = names[i]); i++)
{
rl_command_func_t *function;
char **invokers;
@ -2025,8 +2024,8 @@ rl_function_dumper (print_readably)
rl_outstream. If an explicit argument is given, then print
the output in such a way that it can be read back in. */
int
rl_dump_functions (count, key)
int count, key;
rl_dump_functions (int count __attribute__((unused)),
int key __attribute__((unused)))
{
if (rl_dispatching)
fprintf (rl_outstream, "\r\n");
@ -2105,8 +2104,7 @@ rl_macro_dumper (print_readably)
}
int
rl_dump_macros (count, key)
int count, key;
rl_dump_macros(int count __attribute__((unused)), int key __attribute__((unused)))
{
if (rl_dispatching)
fprintf (rl_outstream, "\r\n");
@ -2195,8 +2193,7 @@ rl_variable_dumper (print_readably)
rl_outstream. If an explicit argument is given, then print
the output in such a way that it can be read back in. */
int
rl_dump_variables (count, key)
int count, key;
rl_dump_variables(int count __attribute__((unused)), int key __attribute__((unused)))
{
if (rl_dispatching)
fprintf (rl_outstream, "\r\n");

View File

@ -59,7 +59,11 @@
#define largest_char 255 /* Largest character value. */
#define CTRL_CHAR(c) ((c) < control_character_threshold && (((c) & 0x80) == 0))
#if largest_char >= 255
#define META_CHAR(c) ((c) > meta_character_threshold)
#else
#define META_CHAR(c) ((c) > meta_character_threshold && (c) <= largest_char)
#endif
#define CTRL(c) ((c) & control_character_mask)
#define META(c) ((c) | meta_character_bit)

View File

@ -361,15 +361,15 @@ rl_complete (ignore, invoking_key)
/* List the possible completions. See description of rl_complete (). */
int
rl_possible_completions (ignore, invoking_key)
int ignore, invoking_key;
rl_possible_completions (int ignore __attribute__((unused)),
int invoking_key __attribute__((unused)))
{
return (rl_complete_internal ('?'));
}
int
rl_insert_completions (ignore, invoking_key)
int ignore, invoking_key;
rl_insert_completions (int ignore __attribute__((unused)),
int invoking_key __attribute__((unused)))
{
return (rl_complete_internal ('*'));
}
@ -761,10 +761,7 @@ print_filename (to_print, full_pathname)
}
static char *
rl_quote_filename (s, rtype, qcp)
char *s;
int rtype;
char *qcp;
rl_quote_filename (char *s, int rtype __attribute__((unused)), char *qcp)
{
char *r;
@ -872,7 +869,7 @@ _rl_find_completion_word (fp, dp)
completion, so use the word break characters to find the
substring on which to complete. */
#if defined (HANDLE_MULTIBYTE)
while (rl_point = _rl_find_prev_mbchar (rl_line_buffer, rl_point, MB_FIND_ANY))
while ((rl_point = _rl_find_prev_mbchar (rl_line_buffer, rl_point, MB_FIND_ANY)))
#else
while (--rl_point)
#endif
@ -1806,7 +1803,7 @@ rl_completion_matches (text, entry_function)
match_list = (char **)xmalloc ((match_list_size + 1) * sizeof (char *));
match_list[1] = (char *)NULL;
while (string = (*entry_function) (text, matches))
while ((string = (*entry_function) (text, matches)))
{
if (matches + 1 == match_list_size)
match_list = (char **)xrealloc
@ -1856,7 +1853,7 @@ rl_username_completion_function (text, state)
setpwent ();
}
while (entry = getpwent ())
while ((entry = getpwent ()))
{
/* Null usernames should result in all users as possible completions. */
if (namelen == 0 || (STREQN (username, entry->pw_name, namelen)))
@ -2092,8 +2089,7 @@ rl_filename_completion_function (text, state)
hit the end of the match list, we restore the original unmatched text,
ring the bell, and reset the counter to zero. */
int
rl_menu_complete (count, ignore)
int count, ignore;
rl_menu_complete (int count, int ignore __attribute__((unused)))
{
rl_compentry_func_t *our_func;
int matching_filenames, found_quote;

View File

@ -218,7 +218,7 @@ expand_prompt (pmt, lp, lip, niflp, vlp)
if (niflp)
*niflp = 0;
if (vlp)
*vlp = lp ? *lp : strlen (r);
*vlp = lp ? *lp : (int) strlen (r);
return r;
}
@ -435,7 +435,7 @@ rl_redisplay ()
return;
if (!rl_display_prompt)
rl_display_prompt = "";
rl_display_prompt = (char*) "";
if (invisible_line == 0)
{
@ -757,7 +757,7 @@ rl_redisplay ()
c_pos = out;
lb_linenum = newlines;
}
for (i = in; i < in+wc_bytes; i++)
for (i = in; i < (int) (in+wc_bytes); i++)
line[out++] = rl_line_buffer[i];
for (i = 0; i < wc_width; i++)
CHECK_LPOS();
@ -835,7 +835,7 @@ rl_redisplay ()
#define VIS_LLEN(l) ((l) > _rl_vis_botlin ? 0 : (vis_lbreaks[l+1] - vis_lbreaks[l]))
#define INV_LLEN(l) (inv_lbreaks[l+1] - inv_lbreaks[l])
#define VIS_CHARS(line) (visible_line + vis_lbreaks[line])
#define VIS_LINE(line) ((line) > _rl_vis_botlin) ? "" : VIS_CHARS(line)
#define VIS_LINE(line) ((line) > _rl_vis_botlin) ? (char*) "" : VIS_CHARS(line)
#define INV_LINE(line) (invisible_line + inv_lbreaks[line])
/* For each line in the buffer, do the updating display. */
@ -876,7 +876,7 @@ rl_redisplay ()
_rl_move_vert (linenum);
_rl_move_cursor_relative (0, tt);
_rl_clear_to_eol
((linenum == _rl_vis_botlin) ? strlen (tt) : _rl_screenwidth);
((linenum == _rl_vis_botlin) ? (int) strlen (tt) : _rl_screenwidth);
}
}
_rl_vis_botlin = inv_botlin;
@ -1086,7 +1086,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
int col_lendiff, col_temp;
#if defined (HANDLE_MULTIBYTE)
mbstate_t ps_new, ps_old;
int new_offset, old_offset, tmp;
int new_offset, old_offset;
#endif
/* If we're at the right edge of a terminal that supports xn, we're
@ -1837,7 +1837,7 @@ rl_reset_line_state ()
{
rl_on_new_line ();
rl_display_prompt = rl_prompt ? rl_prompt : "";
rl_display_prompt = rl_prompt ? rl_prompt : (char*) "";
forced_display = 1;
return 0;
}
@ -2212,7 +2212,7 @@ _rl_col_width (str, start, end)
int start, end;
{
wchar_t wc;
mbstate_t ps = {0};
mbstate_t ps;
int tmp, point, width, max;
if (end <= start)
@ -2221,6 +2221,7 @@ _rl_col_width (str, start, end)
point = 0;
max = end;
memset (&ps, 0, sizeof(ps));
while (point < start)
{
tmp = mbrlen (str + point, max, &ps);

View File

@ -87,14 +87,14 @@ char history_comment_char = '\0';
/* The list of characters which inhibit the expansion of text if found
immediately following history_expansion_char. */
char *history_no_expand_chars = " \t\n\r=";
char *history_no_expand_chars = (char*) " \t\n\r=";
/* If set to a non-zero value, single quotes inhibit history expansion.
The default is 0. */
int history_quotes_inhibit_expansion = 0;
/* Used to split words by history_tokenize_internal. */
char *history_word_delimiters = HISTORY_WORD_DELIMITERS;
char *history_word_delimiters = (char*) HISTORY_WORD_DELIMITERS;
/* If set, this points to a function that is called to verify that a
particular history expansion should be performed. */
@ -203,7 +203,7 @@ get_history_event (string, caller_index, delimiting_quote)
}
/* Only a closing `?' or a newline delimit a substring search string. */
for (local_index = i; c = string[i]; i++)
for (local_index = i; (c = string[i]); i++)
#if defined (HANDLE_MULTIBYTE)
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
{

View File

@ -184,7 +184,8 @@ read_history_range (filename, from, to)
file_size = (size_t)finfo.st_size;
/* check for overflow on very large files */
if (file_size != finfo.st_size || file_size + 1 < file_size)
if ((long long) file_size != (long long) finfo.st_size ||
file_size + 1 < file_size)
{
errno = overflow_errno;
goto error_and_exit;
@ -333,7 +334,8 @@ history_truncate_file (fname, lines)
file_size = (size_t)finfo.st_size;
/* check for overflow on very large files */
if (file_size != finfo.st_size || file_size + 1 < file_size)
if ((long long) file_size != (long long) finfo.st_size ||
file_size + 1 < file_size)
{
close (file);
#if defined (EFBIG)

View File

@ -405,7 +405,7 @@ rl_read_key ()
else
{
/* If input is coming from a macro, then use that. */
if (c = _rl_next_macro_key ())
if ((c= _rl_next_macro_key ()))
return (c);
/* If the user has an event function, then call it periodically. */

View File

@ -68,7 +68,7 @@ static char *prev_line_found;
static char *last_isearch_string;
static int last_isearch_string_len;
static char *default_isearch_terminators = "\033\012";
static char *default_isearch_terminators = (char*) "\033\012";
/* Search backwards through the history looking for a string which is typed
interactively. Start with the current line. */
@ -94,9 +94,8 @@ rl_forward_search_history (sign, key)
WHERE is the history list number of the current line. If it is
-1, then this line is the starting one. */
static void
rl_display_search (search_string, reverse_p, where)
char *search_string;
int reverse_p, where;
rl_display_search (char *search_string, int reverse_p,
int where __attribute__((unused)))
{
char *message;
int msglen, searchlen;
@ -143,8 +142,7 @@ rl_display_search (search_string, reverse_p, where)
DIRECTION is which direction to search; >= 0 means forward, < 0 means
backwards. */
static int
rl_search_history (direction, invoking_key)
int direction, invoking_key;
rl_search_history (int direction, int invoking_key __attribute__((unused)))
{
/* The string that the user types in to search for. */
char *search_string;

View File

@ -76,8 +76,7 @@ static int rl_yank_nth_arg_internal PARAMS((int, int, int));
/* How to say that you only want to save a certain amount
of kill material. */
int
rl_set_retained_kills (num)
int num;
rl_set_retained_kills (int num __attribute__((unused)))
{
return 0;
}
@ -293,8 +292,8 @@ rl_backward_kill_line (direction, ignore)
/* Kill the whole line, no matter where point is. */
int
rl_kill_full_line (count, ignore)
int count, ignore;
rl_kill_full_line (int count __attribute__((unused)),
int ignore __attribute__((unused)))
{
rl_begin_undo_group ();
rl_point = 0;
@ -311,8 +310,7 @@ rl_kill_full_line (count, ignore)
/* This does what C-w does in Unix. We can't prevent people from
using behaviour that they expect. */
int
rl_unix_word_rubout (count, key)
int count, key;
rl_unix_word_rubout (int count, int key __attribute__((unused)))
{
int orig_point;
@ -344,8 +342,7 @@ rl_unix_word_rubout (count, key)
/* This deletes one filename component in a Unix pathname. That is, it
deletes backward to directory separator (`/') or whitespace. */
int
rl_unix_filename_rubout (count, key)
int count, key;
rl_unix_filename_rubout (int count, int key __attribute__((unused)))
{
int orig_point, c;
@ -388,8 +385,8 @@ rl_unix_filename_rubout (count, key)
into the line at all, and if you aren't, then you know what you are
doing. */
int
rl_unix_line_discard (count, key)
int count, key;
rl_unix_line_discard (int count __attribute__((unused)),
int key __attribute__((unused)))
{
if (rl_point == 0)
rl_ding ();
@ -425,16 +422,16 @@ region_kill_internal (delete)
/* Copy the text in the region to the kill ring. */
int
rl_copy_region_to_kill (count, ignore)
int count, ignore;
rl_copy_region_to_kill (int count __attribute__((unused)),
int key __attribute__((unused)))
{
return (region_kill_internal (0));
}
/* Kill the text between the point and mark. */
int
rl_kill_region (count, ignore)
int count, ignore;
rl_kill_region (int count __attribute__((unused)),
int ignore __attribute__((unused)))
{
int r, npoint;
@ -498,8 +495,7 @@ rl_copy_backward_word (count, key)
/* Yank back the last killed text. This ignores arguments. */
int
rl_yank (count, ignore)
int count, ignore;
rl_yank (int count __attribute__((unused)), int ignore __attribute__((unused)))
{
if (rl_kill_ring == 0)
{
@ -517,8 +513,7 @@ rl_yank (count, ignore)
delete that text from the line, rotate the index down, and
yank back some other text. */
int
rl_yank_pop (count, key)
int count, key;
rl_yank_pop (int count __attribute__((unused)), int key __attribute__((unused)))
{
int l, n;

View File

@ -189,8 +189,8 @@ _rl_kill_kbd_macro ()
definition to the end of the existing macro, and start by
re-executing the existing macro. */
int
rl_start_kbd_macro (ignore1, ignore2)
int ignore1, ignore2;
rl_start_kbd_macro (int ignore1 __attribute__((unused)),
int ignore2 __attribute__((unused)))
{
if (RL_ISSTATE (RL_STATE_MACRODEF))
{
@ -214,8 +214,7 @@ rl_start_kbd_macro (ignore1, ignore2)
A numeric argument says to execute the macro right now,
that many times, counting the definition as the first time. */
int
rl_end_kbd_macro (count, ignore)
int count, ignore;
rl_end_kbd_macro (int count, int ignore __attribute__((unused)))
{
if (RL_ISSTATE (RL_STATE_MACRODEF) == 0)
{
@ -234,8 +233,7 @@ rl_end_kbd_macro (count, ignore)
/* Execute the most recently defined keyboard macro.
COUNT says how many times to execute it. */
int
rl_call_last_kbd_macro (count, ignore)
int count, ignore;
rl_call_last_kbd_macro (int count, int ignore __attribute__((unused)))
{
if (current_macro == 0)
_rl_abort_internal ();

View File

@ -154,8 +154,7 @@ rl_digit_loop ()
/* Add the current digit to the argument in progress. */
int
rl_digit_argument (ignore, key)
int ignore, key;
rl_digit_argument (int ignore __attribute__((unused)), int key)
{
rl_execute_next (key);
return (rl_digit_loop ());
@ -184,8 +183,8 @@ _rl_init_argument ()
Read a key. If the key has nothing to do with arguments, then
dispatch on it. If the key is the abort character then abort. */
int
rl_universal_argument (count, key)
int count, key;
rl_universal_argument (int count __attribute__((unused)),
int key __attribute__((unused)))
{
rl_numeric_arg *= 4;
return (rl_digit_loop ());
@ -314,9 +313,7 @@ _rl_history_set_point ()
}
void
rl_replace_from_history (entry, flags)
HIST_ENTRY *entry;
int flags; /* currently unused */
rl_replace_from_history (HIST_ENTRY *entry, int flags __attribute__((unused)))
{
/* Can't call with `1' because rl_undo_list might point to an undo list
from a history entry, just like we're setting up here. */
@ -342,16 +339,15 @@ rl_replace_from_history (entry, flags)
/* Meta-< goes to the start of the history. */
int
rl_beginning_of_history (count, key)
int count, key;
rl_beginning_of_history (int count __attribute__((unused)), int key)
{
return (rl_get_previous_history (1 + where_history (), key));
}
/* Meta-> goes to the end of the history. (The current line). */
int
rl_end_of_history (count, key)
int count, key;
rl_end_of_history (int count __attribute__((unused)),
int key __attribute__((unused)))
{
rl_maybe_replace_line ();
using_history ();
@ -455,8 +451,7 @@ rl_get_previous_history (count, key)
/* **************************************************************** */
/* How to toggle back and forth between editing modes. */
int
rl_vi_editing_mode (count, key)
int count, key;
rl_vi_editing_mode (int count __attribute__((unused)), int key)
{
#if defined (VI_MODE)
_rl_set_insert_mode (RL_IM_INSERT, 1); /* vi mode ignores insert mode */
@ -468,8 +463,8 @@ rl_vi_editing_mode (count, key)
}
int
rl_emacs_editing_mode (count, key)
int count, key;
rl_emacs_editing_mode (int count __attribute__((unused)),
int key __attribute__((unused)))
{
rl_editing_mode = emacs_mode;
_rl_set_insert_mode (RL_IM_INSERT, 1); /* emacs mode default is insert mode */
@ -479,8 +474,7 @@ rl_emacs_editing_mode (count, key)
/* Function for the rest of the library to use to set insert/overwrite mode. */
void
_rl_set_insert_mode (im, force)
int im, force;
_rl_set_insert_mode (int im, int force __attribute__((unused)))
{
#ifdef CURSOR_MODE
_rl_set_cursor (im, force);
@ -492,8 +486,7 @@ _rl_set_insert_mode (im, force)
/* Toggle overwrite mode. A positive explicit argument selects overwrite
mode. A negative or zero explicit argument selects insert mode. */
int
rl_overwrite_mode (count, key)
int count, key;
rl_overwrite_mode (int count, int key __attribute__((unused)))
{
if (rl_explicit_arg == 0)
_rl_set_insert_mode (rl_insert_mode ^ 1, 0);

View File

@ -111,7 +111,7 @@ _rl_init_eightbit ()
if (lspec == 0 || *lspec == 0)
lspec = setlocale (LC_CTYPE, (char *)NULL);
if (lspec == 0)
lspec = "";
lspec = (char*) "";
t = setlocale (LC_CTYPE, lspec);
if (t && *t && (t[0] != 'C' || t[1]) && (STREQ (t, "POSIX") == 0))

View File

@ -83,7 +83,9 @@ static void bind_arrow_keys_internal PARAMS((Keymap));
static void bind_arrow_keys PARAMS((void));
static void readline_default_bindings PARAMS((void));
#ifdef NOT_USED
static void reset_default_bindings PARAMS((void));
#endif
/* **************************************************************** */
/* */
@ -866,12 +868,14 @@ readline_default_bindings ()
/* Reset the default bindings for the terminal special characters we're
interested in back to rl_insert and read the new ones. */
#ifdef NOT_USED
static void
reset_default_bindings ()
{
rl_tty_unset_default_bindings (_rl_keymap);
rl_tty_set_default_bindings (_rl_keymap);
}
#endif
/* Bind some common arrow key sequences in MAP. */
static void

View File

@ -716,8 +716,7 @@ rl_deprep_terminal ()
/* **************************************************************** */
int
rl_restart_output (count, key)
int count, key;
rl_restart_output(int count __attribute__((unused)), int key __attribute__((unused)))
{
int fildes = fileno (rl_outstream);
#if defined (TIOCSTART)
@ -749,8 +748,7 @@ rl_restart_output (count, key)
}
int
rl_stop_output (count, key)
int count, key;
rl_stop_output(int count __attribute__((unused)), int key __attribute__((unused)))
{
int fildes = fileno (rl_instream);
@ -867,7 +865,6 @@ rltty_set_default_bindings (kmap)
{
TIOTYPE ttybuff;
int tty;
static int called = 0;
tty = fileno (rl_instream);

View File

@ -303,8 +303,7 @@ noninc_search (dir, pchar)
/* Search forward through the history list for a string. If the vi-mode
code calls this, KEY will be `?'. */
int
rl_noninc_forward_search (count, key)
int count, key;
rl_noninc_forward_search (int count __attribute__((unused)), int key)
{
noninc_search (1, (key == '?') ? '?' : 0);
return 0;
@ -313,8 +312,7 @@ rl_noninc_forward_search (count, key)
/* Reverse search the history list for a string. If the vi-mode code
calls this, KEY will be `/'. */
int
rl_noninc_reverse_search (count, key)
int count, key;
rl_noninc_reverse_search (int count __attribute__((unused)), int key)
{
noninc_search (-1, (key == '/') ? '/' : 0);
return 0;
@ -323,8 +321,8 @@ rl_noninc_reverse_search (count, key)
/* Search forward through the history list for the last string searched
for. If there is no saved search string, abort. */
int
rl_noninc_forward_search_again (count, key)
int count, key;
rl_noninc_forward_search_again (int count __attribute__((unused)),
int key __attribute__((unused)))
{
if (!noninc_search_string)
{
@ -338,8 +336,8 @@ rl_noninc_forward_search_again (count, key)
/* Reverse search in the history list for the last string searched
for. If there is no saved search string, abort. */
int
rl_noninc_reverse_search_again (count, key)
int count, key;
rl_noninc_reverse_search_again (int count __attribute__((unused)),
int key __attribute__((unused)))
{
if (!noninc_search_string)
{

View File

@ -344,7 +344,7 @@ get_term_capabilities (bp)
#if !defined (__DJGPP__) /* XXX - doesn't DJGPP have a termcap library? */
register int i;
for (i = 0; i < NUM_TC_STRINGS; i++)
for (i = 0; i < (int) NUM_TC_STRINGS; i++)
*(tc_strings[i].tc_value) = tgetstr ((char *)tc_strings[i].tc_var, bp);
#endif
tcap_initialized = 1;
@ -410,7 +410,7 @@ _rl_init_terminal_io (terminal_name)
/* Everything below here is used by the redisplay code (tputs). */
_rl_screenchars = _rl_screenwidth * _rl_screenheight;
_rl_term_cr = "\r";
_rl_term_cr = (char*) "\r";
_rl_term_im = _rl_term_ei = _rl_term_ic = _rl_term_IC = (char *)NULL;
_rl_term_up = _rl_term_dc = _rl_term_DC = _rl_visible_bell = (char *)NULL;
_rl_term_ku = _rl_term_kd = _rl_term_kl = _rl_term_kr = (char *)NULL;
@ -427,7 +427,7 @@ _rl_init_terminal_io (terminal_name)
tgoto if _rl_term_IC or _rl_term_DC is defined, but just in case we
change that later... */
PC = '\0';
BC = _rl_term_backspace = "\b";
BC = _rl_term_backspace = (char*) "\b";
UP = _rl_term_up;
return 0;
@ -442,7 +442,7 @@ _rl_init_terminal_io (terminal_name)
UP = _rl_term_up;
if (!_rl_term_cr)
_rl_term_cr = "\r";
_rl_term_cr = (char*) "\r";
_rl_term_autowrap = tgetflag ("am") && tgetflag ("xn");
@ -502,7 +502,7 @@ rl_get_termcap (cap)
if (tcap_initialized == 0)
return ((char *)NULL);
for (i = 0; i < NUM_TC_STRINGS; i++)
for (i = 0; i < (int) NUM_TC_STRINGS; i++)
{
if (tc_strings[i].tc_var[0] == cap[0] && strcmp (tc_strings[i].tc_var, cap) == 0)
return *(tc_strings[i].tc_value);

View File

@ -402,8 +402,7 @@ rl_backward (count, key)
/* Move to the beginning of the line. */
int
rl_beg_of_line (count, key)
int count, key;
rl_beg_of_line (int count __attribute__((unused)), int key __attribute__((unused)))
{
rl_point = 0;
return 0;
@ -411,8 +410,7 @@ rl_beg_of_line (count, key)
/* Move to the end of the line. */
int
rl_end_of_line (count, key)
int count, key;
rl_end_of_line (int count __attribute__((unused)), int key __attribute__((unused)))
{
rl_point = rl_end;
return 0;
@ -508,8 +506,7 @@ rl_backward_word (count, key)
/* Clear the current line. Numeric argument to C-l does this. */
int
rl_refresh_line (ignore1, ignore2)
int ignore1, ignore2;
rl_refresh_line (int count __attribute__((unused)), int key __attribute__((unused)))
{
int curr_line;
@ -547,8 +544,7 @@ rl_clear_screen (count, key)
}
int
rl_arrow_keys (count, c)
int count, c;
rl_arrow_keys (int count, int c __attribute__((unused)))
{
int ch;
@ -596,7 +592,7 @@ rl_arrow_keys (count, c)
#ifdef HANDLE_MULTIBYTE
static char pending_bytes[MB_LEN_MAX];
static int pending_bytes_length = 0;
static mbstate_t ps = {0};
static mbstate_t ps;
#endif
/* Insert the character C at the current location, moving point forward.
@ -832,8 +828,7 @@ rl_insert (count, c)
/* Insert the next typed character verbatim. */
int
rl_quoted_insert (count, key)
int count, key;
rl_quoted_insert (int count, int key __attribute__((unused)))
{
int c;
@ -854,8 +849,7 @@ rl_quoted_insert (count, key)
/* Insert a tab character. */
int
rl_tab_insert (count, key)
int count, key;
rl_tab_insert (int count, int key __attribute__((unused)))
{
return (_rl_insert_char (count, '\t'));
}
@ -864,8 +858,7 @@ rl_tab_insert (count, key)
KEY is the key that invoked this command. I guess it could have
meaning in the future. */
int
rl_newline (count, key)
int count, key;
rl_newline (int count __attribute__((unused)), int key __attribute__((unused)))
{
rl_done = 1;
@ -898,8 +891,8 @@ rl_newline (count, key)
is just a stub, you bind keys to it and the code in _rl_dispatch ()
is special cased. */
int
rl_do_lowercase_version (ignore1, ignore2)
int ignore1, ignore2;
rl_do_lowercase_version (int count __attribute__((unused)),
int key __attribute__((unused)))
{
return 0;
}
@ -1093,8 +1086,8 @@ rl_rubout_or_delete (count, key)
/* Delete all spaces and tabs around point. */
int
rl_delete_horizontal_space (count, ignore)
int count, ignore;
rl_delete_horizontal_space (int count __attribute__((unused)),
int key __attribute__((unused)))
{
int start = rl_point;
@ -1134,14 +1127,13 @@ rl_delete_or_show_completions (count, key)
/* Turn the current line into a comment in shell history.
A K*rn shell style function. */
int
rl_insert_comment (count, key)
int count, key;
rl_insert_comment (int count __attribute__((unused)), int key)
{
char *rl_comment_text;
int rl_comment_len;
rl_beg_of_line (1, key);
rl_comment_text = _rl_comment_begin ? _rl_comment_begin : RL_COMMENT_BEGIN_DEFAULT;
rl_comment_text = _rl_comment_begin ? _rl_comment_begin : (char*) RL_COMMENT_BEGIN_DEFAULT;
if (rl_explicit_arg == 0)
rl_insert_text (rl_comment_text);
@ -1173,24 +1165,21 @@ rl_insert_comment (count, key)
/* Uppercase the word at point. */
int
rl_upcase_word (count, key)
int count, key;
rl_upcase_word (int count, int key __attribute__((unused)))
{
return (rl_change_case (count, UpCase));
}
/* Lowercase the word at point. */
int
rl_downcase_word (count, key)
int count, key;
rl_downcase_word (int count, int key __attribute__((unused)))
{
return (rl_change_case (count, DownCase));
}
/* Upcase the first letter, downcase the rest. */
int
rl_capitalize_word (count, key)
int count, key;
rl_capitalize_word (int count, int key __attribute__((unused)))
{
return (rl_change_case (count, CapCase));
}
@ -1314,8 +1303,7 @@ rl_transpose_words (count, key)
/* Transpose the characters at point. If point is at the end of the line,
then transpose the characters before point. */
int
rl_transpose_chars (count, key)
int count, key;
rl_transpose_chars (int count, int key __attribute__((unused)))
{
#if defined (HANDLE_MULTIBYTE)
char *dummy;
@ -1486,15 +1474,13 @@ _rl_char_search (count, fdir, bdir)
#endif /* !HANDLE_MULTIBYTE */
int
rl_char_search (count, key)
int count, key;
rl_char_search (int count, int key __attribute__((unused)))
{
return (_rl_char_search (count, FFIND, BFIND));
}
int
rl_backward_char_search (count, key)
int count, key;
rl_backward_char_search (int count, int key __attribute__((unused)))
{
return (_rl_char_search (count, BFIND, FFIND));
}
@ -1519,16 +1505,15 @@ _rl_set_mark_at_pos (position)
/* A bindable command to set the mark. */
int
rl_set_mark (count, key)
int count, key;
rl_set_mark (int count, int key __attribute__((unused)))
{
return (_rl_set_mark_at_pos (rl_explicit_arg ? count : rl_point));
}
/* Exchange the position of mark and point. */
int
rl_exchange_point_and_mark (count, key)
int count, key;
rl_exchange_point_and_mark (int count __attribute__((unused)),
int key __attribute__((unused)))
{
if (rl_mark > rl_end)
rl_mark = -1;

View File

@ -190,7 +190,7 @@ tilde_expand (string)
int result_size, result_index;
result_index = result_size = 0;
if (result = strchr (string, '~'))
if ((result = strchr (string, '~')))
result = (char *)xmalloc (result_size = (strlen (string) + 16));
else
result = (char *)xmalloc (result_size = (strlen (string) + 1));

View File

@ -175,7 +175,7 @@ _rl_fix_last_undo_of_type (type, start, end)
for (rl = rl_undo_list; rl; rl = rl->next)
{
if (rl->what == type)
if (rl->what == (unsigned int) type)
{
rl->start = start;
rl->end = end;
@ -226,8 +226,7 @@ rl_modifying (start, end)
/* Revert the current line to its previous state. */
int
rl_revert_line (count, key)
int count, key;
rl_revert_line (int count __attribute__((unused)), int key __attribute__((unused)))
{
if (!rl_undo_list)
rl_ding ();
@ -241,8 +240,7 @@ rl_revert_line (count, key)
/* Do some undoing of things that were done. */
int
rl_undo_command (count, key)
int count, key;
rl_undo_command (int count, int key __attribute__((unused)))
{
if (count < 0)
return 0; /* Nothing to do. */

View File

@ -95,15 +95,13 @@ _rl_abort_internal ()
}
int
rl_abort (count, key)
int count, key;
rl_abort (int count __attribute__((unused)), int key __attribute__((unused)))
{
return (_rl_abort_internal ());
}
int
rl_tty_status (count, key)
int count, key;
rl_tty_status (int count __attribute__((unused)), int key __attribute__((unused)))
{
#if defined (TIOCSTAT)
ioctl (1, TIOCSTAT, (char *)0);
@ -152,8 +150,7 @@ rl_extend_line_buffer (len)
/* A function for simple tilde expansion. */
int
rl_tilde_expand (ignore, key)
int ignore, key;
rl_tilde_expand (int ignore __attribute__((unused)), int key __attribute__((unused)))
{
register int start, end;
char *homedir, *temp;

View File

@ -112,7 +112,7 @@ _rl_vi_initialize_line ()
{
register int i;
for (i = 0; i < sizeof (vi_mark_chars) / sizeof (int); i++)
for (i = 0; i < (int) (sizeof (vi_mark_chars) / sizeof (int)); i++)
vi_mark_chars[i] = -1;
}
@ -166,8 +166,7 @@ _rl_vi_stuff_insert (count)
redo a text modification command. The default for _rl_vi_last_command
puts you back into insert mode. */
int
rl_vi_redo (count, c)
int count, c;
rl_vi_redo (int count, int c __attribute__((unused)))
{
int r;
@ -205,8 +204,7 @@ rl_vi_undo (count, key)
/* Yank the nth arg from the previous line into this line at point. */
int
rl_vi_yank_arg (count, key)
int count, key;
rl_vi_yank_arg (int count, int key __attribute__((unused)))
{
/* Readline thinks that the first word on a line is the 0th, while vi
thinks the first word on a line is the 1st. Compensate. */
@ -286,8 +284,7 @@ rl_vi_search (count, key)
/* Completion, from vi's point of view. */
int
rl_vi_complete (ignore, key)
int ignore, key;
rl_vi_complete (int ignore __attribute__((unused)), int key)
{
if ((rl_point < rl_end) && (!whitespace (rl_line_buffer[rl_point])))
{
@ -313,8 +310,7 @@ rl_vi_complete (ignore, key)
/* Tilde expansion for vi mode. */
int
rl_vi_tilde_expand (ignore, key)
int ignore, key;
rl_vi_tilde_expand (int ignore __attribute__((unused)), int key)
{
rl_tilde_expand (0, key);
rl_vi_start_inserting (key, 1, rl_arg_sign);
@ -384,8 +380,7 @@ rl_vi_end_word (count, key)
/* Move forward a word the way that 'W' does. */
int
rl_vi_fWord (count, ignore)
int count, ignore;
rl_vi_fWord (int count, int ignore __attribute__((unused)))
{
while (count-- && rl_point < (rl_end - 1))
{
@ -401,8 +396,7 @@ rl_vi_fWord (count, ignore)
}
int
rl_vi_bWord (count, ignore)
int count, ignore;
rl_vi_bWord (int count, int ignore __attribute__((unused)))
{
while (count-- && rl_point > 0)
{
@ -425,8 +419,7 @@ rl_vi_bWord (count, ignore)
}
int
rl_vi_eWord (count, ignore)
int count, ignore;
rl_vi_eWord(int count, int ignore __attribute__((unused)))
{
while (count-- && rl_point < (rl_end - 1))
{
@ -456,8 +449,7 @@ rl_vi_eWord (count, ignore)
}
int
rl_vi_fword (count, ignore)
int count, ignore;
rl_vi_fword (int count, int ignore __attribute__((unused)))
{
while (count-- && rl_point < (rl_end - 1))
{
@ -482,8 +474,7 @@ rl_vi_fword (count, ignore)
}
int
rl_vi_bword (count, ignore)
int count, ignore;
rl_vi_bword (int count, int ignore __attribute__((unused)))
{
while (count-- && rl_point > 0)
{
@ -521,8 +512,7 @@ rl_vi_bword (count, ignore)
}
int
rl_vi_eword (count, ignore)
int count, ignore;
rl_vi_eword (int count, int ignore __attribute__((unused)))
{
while (count-- && rl_point < rl_end - 1)
{
@ -546,8 +536,7 @@ rl_vi_eword (count, ignore)
}
int
rl_vi_insert_beg (count, key)
int count, key;
rl_vi_insert_beg (int count __attribute__((unused)), int key)
{
rl_beg_of_line (1, key);
rl_vi_insertion_mode (1, key);
@ -555,8 +544,7 @@ rl_vi_insert_beg (count, key)
}
int
rl_vi_append_mode (count, key)
int count, key;
rl_vi_append_mode (int count __attribute__((unused)), int key)
{
if (rl_point < rl_end)
{
@ -575,8 +563,7 @@ rl_vi_append_mode (count, key)
}
int
rl_vi_append_eol (count, key)
int count, key;
rl_vi_append_eol (int count __attribute__((unused)), int key)
{
rl_end_of_line (1, key);
rl_vi_append_mode (1, key);
@ -585,8 +572,7 @@ rl_vi_append_eol (count, key)
/* What to do in the case of C-d. */
int
rl_vi_eof_maybe (count, c)
int count, c;
rl_vi_eof_maybe (int count __attribute__((unused)), int c __attribute__((unused)))
{
return (rl_newline (1, '\n'));
}
@ -596,8 +582,7 @@ rl_vi_eof_maybe (count, c)
/* Switching from one mode to the other really just involves
switching keymaps. */
int
rl_vi_insertion_mode (count, key)
int count, key;
rl_vi_insertion_mode (int count __attribute__((unused)), int key)
{
_rl_keymap = vi_insertion_keymap;
_rl_vi_last_key_before_insert = key;
@ -659,8 +644,7 @@ _rl_vi_done_inserting ()
}
int
rl_vi_movement_mode (count, key)
int count, key;
rl_vi_movement_mode (int count __attribute__((unused)), int key)
{
if (rl_point > 0)
rl_backward_char (1, key);
@ -729,8 +713,7 @@ _rl_vi_change_mbchar_case (count)
#endif
int
rl_vi_change_case (count, ignore)
int count, ignore;
rl_vi_change_case (int count, int ignore __attribute__((unused)))
{
int c, p;
@ -959,8 +942,7 @@ rl_digit_loop1 ()
}
int
rl_vi_delete_to (count, key)
int count, key;
rl_vi_delete_to (int count __attribute__((unused)), int key)
{
int c;
@ -985,8 +967,7 @@ rl_vi_delete_to (count, key)
}
int
rl_vi_change_to (count, key)
int count, key;
rl_vi_change_to (int count __attribute__((unused)), int key)
{
int c, start_pos;
@ -1038,8 +1019,7 @@ rl_vi_change_to (count, key)
}
int
rl_vi_yank_to (count, key)
int count, key;
rl_vi_yank_to (int count __attribute__((unused)), int key)
{
int c, save = rl_point;
@ -1094,8 +1074,7 @@ rl_vi_delete (count, key)
}
int
rl_vi_back_to_indent (count, key)
int count, key;
rl_vi_back_to_indent (int count __attribute__((unused)), int key)
{
rl_beg_of_line (1, key);
while (rl_point < rl_end && whitespace (rl_line_buffer[rl_point]))
@ -1104,8 +1083,7 @@ rl_vi_back_to_indent (count, key)
}
int
rl_vi_first_print (count, key)
int count, key;
rl_vi_first_print (int count __attribute__((unused)), int key)
{
return (rl_vi_back_to_indent (1, key));
}
@ -1173,8 +1151,7 @@ rl_vi_char_search (count, key)
/* Match brackets */
int
rl_vi_match (ignore, key)
int ignore, key;
rl_vi_match (int ignore __attribute__((unused)), int key)
{
int count = 1, brack, pos, tmp, pre;
@ -1284,8 +1261,7 @@ rl_vi_bracktype (c)
for test against 033 or ^C. Make sure that _rl_read_mbchar does
this right. */
int
rl_vi_change_char (count, key)
int count, key;
rl_vi_change_char (int count, int key __attribute__((unused)))
{
int c, p;
@ -1389,8 +1365,7 @@ rl_vi_overstrike_delete (count, key)
}
int
rl_vi_replace (count, key)
int count, key;
rl_vi_replace (int count __attribute__((unused)), int key __attribute__((unused)))
{
int i;
@ -1450,8 +1425,7 @@ rl_vi_possible_completions()
/* Functions to save and restore marks. */
int
rl_vi_set_mark (count, key)
int count, key;
rl_vi_set_mark (int count __attribute__((unused)), int key __attribute__((unused)))
{
int ch;
@ -1470,8 +1444,7 @@ rl_vi_set_mark (count, key)
}
int
rl_vi_goto_mark (count, key)
int count, key;
rl_vi_goto_mark (int count __attribute__((unused)), int key __attribute__((unused)))
{
int ch;

View File

@ -187,7 +187,7 @@ AC_DEFUN([MYSQL_SETUP_NDBCLUSTER], [
ndb_cxxflags_fix=""
TEST_NDBCLUSTER="--ndbcluster"
ndbcluster_includes="-I\$(top_builddir)/storage/ndb/include -I\$(top_builddir)/storage/ndb/include/ndbapi -I\$(top_builddir)/storage/ndb/include/mgmapi"
ndbcluster_includes="-I\$(top_builddir)/storage/ndb/include -I\$(top_srcdir)/storage/ndb/include -I\$(top_srcdir)/storage/ndb/include/ndbapi -I\$(top_srcdir)/storage/ndb/include/mgmapi"
ndbcluster_libs="\$(top_builddir)/storage/ndb/src/.libs/libndbclient.a"
ndbcluster_system_libs=""
ndb_mgmclient_libs="\$(top_builddir)/storage/ndb/src/mgmclient/libndbmgmclient.la"

View File

@ -28,10 +28,9 @@ AC_DEFUN([MYSQL_USE_BUNDLED_YASSL], [
yassl_dir="yassl"
AC_SUBST([yassl_dir])
yassl_libs="-L\$(top_srcdir)/extra/yassl/src -lyassl -L\$(top_srcdir)/extra/yassl/taocrypt/src -ltaocrypt"
yassl_libs="\$(top_builddir)/extra/yassl/src/libyassl.la \
\$(top_builddir)/extra/yassl/taocrypt/src/libtaocrypt.la"
AC_SUBST(yassl_libs)
yassl_includes="-I\$(top_srcdir)/extra/yassl/include"
AC_SUBST(yassl_includes)
AC_DEFINE([HAVE_OPENSSL], [1], [Defined by configure. Using yaSSL for SSL.])
AC_DEFINE([HAVE_YASSL], [1], [Defined by configure. Using yaSSL for SSL.])

View File

@ -7,7 +7,7 @@ AC_INIT(sql/mysqld.cc)
AC_CANONICAL_SYSTEM
# The Docs Makefile.am parses this line!
# remember to also change ndb version below and update version.c in ndb
AM_INIT_AUTOMAKE(mysql, 5.1.13-beta)
AM_INIT_AUTOMAKE(mysql, 5.1.14-beta)
AM_CONFIG_HEADER(config.h)
PROTOCOL_VERSION=10
@ -15,7 +15,6 @@ DOT_FRM_VERSION=6
# See the libtool docs for information on how to do shared lib versions.
SHARED_LIB_MAJOR_VERSION=15
SHARED_LIB_VERSION=$SHARED_LIB_MAJOR_VERSION:0:0
# Set all version vars based on $VERSION. How do we do this more elegant ?
# Remember that regexps needs to quote [ and ] since this is run through m4
MYSQL_NO_DASH_VERSION=`echo $VERSION | sed -e "s|[[a-z]]*-.*$||"`
@ -2166,10 +2165,6 @@ MYSQL_CHECK_SSL
# Has to be done late, as the plugin may need to check for existence of
# functions tested above
#--------------------------------------------------------------------
MYSQL_PLUGIN(ftexample, [Simple Parser],
[Simple full-text parser plugin])
MYSQL_PLUGIN_DIRECTORY(ftexample, [plugin/fulltext])
MYSQL_PLUGIN_DYNAMIC(ftexample, [mypluglib.la])
MYSQL_STORAGE_ENGINE(partition, partition, [Partition Support],
[MySQL Partitioning Support], [max,max-no-ndb])

View File

@ -169,7 +169,7 @@ register unsigned long *child_time;
*name_pos = temp->pos;
*time_entered = temp->time;
*child_time = temp->children;
DBUG_PRINT ("pop", ("%d %d %d",*name_pos,*time_entered,*child_time));
DBUG_PRINT ("pop", ("%d %lu %lu",*name_pos,*time_entered,*child_time));
rtnval = stacktop--;
}
DBUG_RETURN (rtnval);
@ -334,12 +334,12 @@ FILE *inf;
* function is found on the stack.
*/
while (pop (&oldpos, &oldtime, &oldchild)) {
DBUG_PRINT ("popped", ("%d %d", oldtime, oldchild));
DBUG_PRINT ("popped", ("%lu %lu", oldtime, oldchild));
time = fn_time - oldtime;
t = top ();
t -> children += time;
DBUG_PRINT ("update", ("%s", modules[t -> pos].name));
DBUG_PRINT ("update", ("%d", t -> children));
DBUG_PRINT ("update", ("%lu", t -> children));
time -= oldchild;
modules[oldpos].m_time += time;
modules[oldpos].m_calls++;
@ -520,19 +520,19 @@ register unsigned long int *s_calls, *s_time;
unsigned long int calls, time;
DBUG_ENTER ("out_body");
DBUG_PRINT ("out_body", ("%d,%d",*s_calls,*s_time));
DBUG_PRINT ("out_body", ("%lu,%lu",*s_calls,*s_time));
if (root == MAXPROCS) {
DBUG_PRINT ("out_body", ("%d,%d",*s_calls,*s_time));
DBUG_PRINT ("out_body", ("%lu,%lu",*s_calls,*s_time));
} else {
while (root != MAXPROCS) {
out_body (outf, s_table[root].lchild,s_calls,s_time);
out_item (outf, &modules[s_table[root].pos],&calls,&time);
DBUG_PRINT ("out_body", ("-- %d -- %d --", calls, time));
DBUG_PRINT ("out_body", ("-- %lu -- %lu --", calls, time));
*s_calls += calls;
*s_time += time;
root = s_table[root].rchild;
}
DBUG_PRINT ("out_body", ("%d,%d", *s_calls, *s_time));
DBUG_PRINT ("out_body", ("%lu,%lu", *s_calls, *s_time));
}
DBUG_VOID_RETURN;
}

View File

@ -1,4 +1,4 @@
INCLUDES = -I../include -I../taocrypt/include -I../taocrypt/mySTL
INCLUDES = -I$(srcdir)/../include -I$(srcdir)/../taocrypt/include -I$(srcdir)/../taocrypt/mySTL
noinst_LTLIBRARIES = libyassl.la
libyassl_la_SOURCES = buffer.cpp cert_wrapper.cpp crypto_wrapper.cpp \

View File

@ -918,7 +918,7 @@ void ERR_print_errors_fp(FILE* /*fp*/)
char* ERR_error_string(unsigned long errNumber, char* buffer)
{
static char* msg = "Please supply a buffer for error string";
static char* msg = (char*) "Please supply a buffer for error string";
if (buffer) {
SetErrorString(YasslError(errNumber), buffer);

View File

@ -1,4 +1,4 @@
INCLUDES = -I../include -I../mySTL
INCLUDES = -I$(srcdir)/../include -I$(srcdir)/../mySTL
bin_PROGRAMS = benchmark
benchmark_SOURCES = benchmark.cpp
benchmark_LDADD = $(top_builddir)/extra/yassl/taocrypt/src/libtaocrypt.la

View File

@ -42,7 +42,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\include" /I "..\..\mySTL" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\include" /I "..\mySTL" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
@ -65,7 +65,7 @@ LINK32=link.exe
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\include" /I "..\..\mySTL" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\include" /I "..\mySTL" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe

View File

@ -75,7 +75,7 @@ public:
typedef Integer Element;
AbstractRing() : AbstractGroup() {m_mg.m_pRing = this;}
AbstractRing(const AbstractRing &source) {m_mg.m_pRing = this;}
AbstractRing(const AbstractRing &source) :AbstractGroup() {m_mg.m_pRing = this;}
AbstractRing& operator=(const AbstractRing &source) {return *this;}
virtual bool IsUnit(const Element &a) const =0;

View File

@ -1,4 +1,4 @@
INCLUDES = -I../include -I../mySTL
INCLUDES = -I$(srcdir)/../include -I$(srcdir)/../mySTL
noinst_LTLIBRARIES = libtaocrypt.la

View File

@ -41,7 +41,7 @@ RSC=rc.exe
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "include" /I "..\mySTL" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "include" /I "mySTL" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
@ -64,7 +64,7 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /I "include" /I "..\mySTL" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /I "include" /I "mySTL" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# SUBTRACT CPP /Fr
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"

View File

@ -21,7 +21,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="include,..\mySTL"
AdditionalIncludeDirectories="include,mySTL"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
ExceptionHandling="FALSE"
BasicRuntimeChecks="3"
@ -75,7 +75,7 @@
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="include,..\mySTL"
AdditionalIncludeDirectories="include,mySTL"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
StringPooling="TRUE"
ExceptionHandling="FALSE"

View File

@ -42,7 +42,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /O2 /I "include" /I "../mySTL" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c
# ADD CPP /nologo /MT /W3 /O2 /I "include" /I "mySTL" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
@ -66,7 +66,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /I "include" /I "../mySTL" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /I "include" /I "mySTL" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe

View File

@ -1,4 +1,4 @@
INCLUDES = -I../include -I../mySTL
INCLUDES = -I$(srcdir)/../include -I$(srcdir)/../mySTL
bin_PROGRAMS = test
test_SOURCES = test.cpp
test_LDADD = $(top_builddir)/extra/yassl/taocrypt/src/libtaocrypt.la

View File

@ -1,4 +1,4 @@
INCLUDES = -I../include -I../taocrypt/include -I../taocrypt/mySTL
INCLUDES = -I$(srcdir)/../include -I$(srcdir)/../taocrypt/include -I$(srcdir)/../taocrypt/mySTL
bin_PROGRAMS = testsuite
testsuite_SOURCES = testsuite.cpp ../taocrypt/test/test.cpp \
../examples/client/client.cpp ../examples/server/server.cpp \

View File

@ -86,8 +86,8 @@ int main(int argc, char** argv)
// input output compare
byte input[TaoCrypt::MD5::DIGEST_SIZE];
byte output[TaoCrypt::MD5::DIGEST_SIZE];
file_test("input", input);
file_test("output", output);
file_test((char*) "input", input);
file_test((char*) "output", output);
assert(memcmp(input, output, sizeof(input)) == 0);
printf("\nAll tests passed!\n");

View File

@ -42,7 +42,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /O2 /I "../taocrypt/include" /I "../include" /I "../mySTL" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "NO_MAIN_DRIVER" /YX /FD /c
# ADD CPP /nologo /MT /W3 /O2 /I "../taocrypt/include" /I "../include" /I "../taocrypt/mySTL" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "NO_MAIN_DRIVER" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
@ -67,7 +67,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /I "../taocrypt/include" /I "../include" /I "../mySTL" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "NO_MAIN_DRIVER" /FR /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /I "../taocrypt/include" /I "../include" /I "../taocrypt/mySTL" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "NO_MAIN_DRIVER" /FR /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe

View File

@ -41,7 +41,7 @@ RSC=rc.exe
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "YASSL_PREFIX" /YX /FD /c
# ADD CPP /nologo /MT /W3 /O2 /I "include" /I "taocrypt\include" /I "mySTL" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "YASSL_PREFIX" /YX /FD /c
# ADD CPP /nologo /MT /W3 /O2 /I "include" /I "taocrypt\include" /I "taocrypt\mySTL" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "YASSL_PREFIX" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
@ -64,7 +64,7 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "YASSL_PREFIX" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /I "include" /I "taocrypt\include" /I "mySTL" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "YASSL_PREFIX" /FR /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /I "include" /I "taocrypt\include" /I "taocrypt\mySTL" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "YASSL_PREFIX" /FR /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe

View File

@ -21,7 +21,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="include,taocrypt\include,mySTL"
AdditionalIncludeDirectories="include,taocrypt\include,taocrypt\mySTL"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;YASSL_PREFIX"
ExceptionHandling="FALSE"
BasicRuntimeChecks="3"
@ -75,7 +75,7 @@
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="include,taocrypt\include,mySTL"
AdditionalIncludeDirectories="include,taocrypt\include,taocrypt\mySTL"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;YASSL_PREFIX"
StringPooling="TRUE"
ExceptionHandling="FALSE"

View File

@ -95,6 +95,7 @@ extern const char *client_errors[]; /* Error messages */
#define CR_NO_STMT_METADATA 2052
#define CR_NO_RESULT_SET 2053
#define CR_NOT_IMPLEMENTED 2054
#define CR_ERROR_LAST /*Copy last error nr:*/ 2054
#define CR_SERVER_LOST_EXTENDED 2055
#define CR_ERROR_LAST /*Copy last error nr:*/ 2055
/* Add error numbers before CR_ERROR_LAST and change it accordingly. */

View File

@ -190,8 +190,8 @@ typedef struct my_charset_handler_st
const unsigned char *s, const unsigned char *e);
/* Functions for case and sort conversion */
void (*caseup_str)(struct charset_info_st *, char *);
void (*casedn_str)(struct charset_info_st *, char *);
uint (*caseup_str)(struct charset_info_st *, char *);
uint (*casedn_str)(struct charset_info_st *, char *);
uint (*caseup)(struct charset_info_st *, char *src, uint srclen,
char *dst, uint dstlen);
uint (*casedn)(struct charset_info_st *, char *src, uint srclen,
@ -324,8 +324,8 @@ extern uint my_instr_simple(struct charset_info_st *,
/* Functions for 8bit */
extern void my_caseup_str_8bit(CHARSET_INFO *, char *);
extern void my_casedn_str_8bit(CHARSET_INFO *, char *);
extern uint my_caseup_str_8bit(CHARSET_INFO *, char *);
extern uint my_casedn_str_8bit(CHARSET_INFO *, char *);
extern uint my_caseup_8bit(CHARSET_INFO *, char *src, uint srclen,
char *dst, uint dstlen);
extern uint my_casedn_8bit(CHARSET_INFO *, char *src, uint srclen,
@ -415,8 +415,8 @@ int my_mbcharlen_8bit(CHARSET_INFO *, uint c);
/* Functions for multibyte charsets */
extern void my_caseup_str_mb(CHARSET_INFO *, char *);
extern void my_casedn_str_mb(CHARSET_INFO *, char *);
extern uint my_caseup_str_mb(CHARSET_INFO *, char *);
extern uint my_casedn_str_mb(CHARSET_INFO *, char *);
extern uint my_caseup_mb(CHARSET_INFO *, char *src, uint srclen,
char *dst, uint dstlen);
extern uint my_casedn_mb(CHARSET_INFO *, char *src, uint srclen,

View File

@ -869,9 +869,8 @@ typedef long my_ptrdiff_t;
typedef long long my_ptrdiff_t;
#endif
#if HAVE_SIZE_T
typedef size_t my_size_t;
#elif SIZEOF_CHARP <= SIZEOF_LONG
/* We can't set my_size_t to size_t as we want my_size_t to be unsigned */
#if SIZEOF_CHARP <= SIZEOF_LONG
typedef unsigned long my_size_t;
#else
typedef unsigned long long my_size_t;
@ -886,6 +885,22 @@ typedef unsigned long long my_size_t;
#define ADD_TO_PTR(ptr,size,type) (type) ((byte*) (ptr)+size)
#define PTR_BYTE_DIFF(A,B) (my_ptrdiff_t) ((byte*) (A) - (byte*) (B))
/*
Custom version of standard offsetof() macro which can be used to get
offsets of members in class for non-POD types (according to the current
version of C++ standard offsetof() macro can't be used in such cases and
attempt to do so causes warnings to be emitted, OTOH in many cases it is
still OK to assume that all instances of the class has the same offsets
for the same members).
This is temporary solution which should be removed once File_parser class
and related routines are refactored.
*/
#define my_offsetof(TYPE, MEMBER) \
((size_t)((char *)&(((TYPE *)0x10)->MEMBER) - (char*)0x10))
#define NullS (char *) 0
/* Nowdays we do not support MessyDos */
#ifndef NEAR

View File

@ -130,6 +130,9 @@ void pthread_exit(void *a); /* was #define pthread_exit(A) ExitThread(A)*/
#define my_pthread_setprio(A,B) SetThreadPriority(GetCurrentThread(), (B))
#define pthread_kill(A,B) pthread_dummy(0)
#define pthread_join(A,B) \
((WaitForSingleObject((A), INFINITE) != WAIT_OBJECT_0) || !CloseHandle(A))
/* Dummy defines for easier code */
#define pthread_attr_setdetachstate(A,B) pthread_dummy(0)
#define my_pthread_attr_setprio(A,B) pthread_attr_setprio(A,B)

View File

@ -880,7 +880,12 @@ extern int my_getncpus();
#define HAVE_MMAP
#endif
#ifndef __NETWARE__
int my_getpagesize(void);
#else
#define my_getpagesize() 8192
#endif
void *my_mmap(void *, size_t, int, int, int, my_off_t);
int my_munmap(void *, size_t);
#endif

View File

@ -73,6 +73,8 @@ typedef long my_time_t;
#define TIME_MAX_VALUE (TIME_MAX_HOUR*10000 + TIME_MAX_MINUTE*100 + \
TIME_MAX_SECOND)
my_bool check_date(const MYSQL_TIME *ltime, my_bool not_zero_date,
ulong flags, int *was_cut);
enum enum_mysql_timestamp_type
str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
uint flags, int *was_cut);

View File

@ -29,7 +29,8 @@
#define MYSQL_UDF_PLUGIN 0 /* User-defined function */
#define MYSQL_STORAGE_ENGINE_PLUGIN 1 /* Storage Engine */
#define MYSQL_FTPARSER_PLUGIN 2 /* Full-text parser plugin */
#define MYSQL_MAX_PLUGIN_TYPE_NUM 3 /* The number of plugin types */
#define MYSQL_DAEMON_PLUGIN 3 /* The daemon/raw plugin type */
#define MYSQL_MAX_PLUGIN_TYPE_NUM 4 /* The number of plugin types */
/* We use the following strings to define licenses for plugins */
#define PLUGIN_LICENSE_PROPRIETARY 0
@ -295,6 +296,13 @@ struct st_mysql_ftparser
int (*deinit)(MYSQL_FTPARSER_PARAM *param);
};
/*************************************************************************
API for Storage Engine plugin. (MYSQL_DAEMON_PLUGIN)
*/
/* handlertons of different MySQL releases are incompatible */
#define MYSQL_DAEMON_INTERFACE_VERSION (MYSQL_VERSION_ID << 8)
/*************************************************************************
API for Storage Engine plugin. (MYSQL_STORAGE_ENGINE_PLUGIN)
*/
@ -313,5 +321,15 @@ struct st_mysql_storage_engine
int interface_version;
};
/*
Here we define only the descriptor structure, that is referred from
st_mysql_plugin.
*/
struct st_mysql_daemon
{
int interface_version;
};
#endif

View File

@ -89,8 +89,8 @@ DEFS = -DDEFAULT_CHARSET_HOME="\"$(MYSQLBASEdir)\"" \
-DSHAREDIR="\"$(MYSQLSHAREdir)\"" $(target_defs)
if HAVE_YASSL
yassl_las = $(top_srcdir)/extra/yassl/src/libyassl.la \
$(top_srcdir)/extra/yassl/taocrypt/src/libtaocrypt.la
yassl_las = $(top_builddir)/extra/yassl/src/libyassl.la \
$(top_builddir)/extra/yassl/taocrypt/src/libtaocrypt.la
endif
# The automatic dependencies miss this

View File

@ -82,6 +82,7 @@ const char *client_errors[]=
"Prepared statement contains no metadata",
"Attempt to read a row while there is no result set associated with the statement",
"This feature is not implemented yet",
"Lost connection to MySQL server at '%s', system error: %d",
""
};
@ -145,6 +146,7 @@ const char *client_errors[]=
"Prepared statement contains no metadata",
"Attempt to read a row while there is no result set associated with the statement",
"This feature is not implemented yet",
"Lost connection to MySQL server at '%s', system error: %d",
""
};
@ -206,6 +208,7 @@ const char *client_errors[]=
"Prepared statement contains no metadata",
"Attempt to read a row while there is no result set associated with the statement",
"This feature is not implemented yet",
"Lost connection to MySQL server at '%s', system error: %d",
""
};
#endif

View File

@ -176,6 +176,7 @@ void STDCALL mysql_server_end()
end_embedded_server();
#endif
/* If library called my_init(), free memory allocated by it */
finish_client_errs();
if (!org_my_init_done)
{
my_end(MY_DONT_FREE_DBUG);
@ -184,8 +185,6 @@ void STDCALL mysql_server_end()
}
else
mysql_thread_end();
finish_client_errs();
free_charsets();
vio_end();
mysql_client_init= org_my_init_done= 0;
#ifdef EMBEDDED_SERVER
@ -2094,7 +2093,7 @@ mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, ulong length)
}
stmt->bind= stmt->params + stmt->param_count;
stmt->state= MYSQL_STMT_PREPARE_DONE;
DBUG_PRINT("info", ("Parameter count: %ld", stmt->param_count));
DBUG_PRINT("info", ("Parameter count: %u", stmt->param_count));
DBUG_RETURN(0);
}
@ -2437,10 +2436,10 @@ static my_bool store_param(MYSQL_STMT *stmt, MYSQL_BIND *param)
{
NET *net= &stmt->mysql->net;
DBUG_ENTER("store_param");
DBUG_PRINT("enter",("type: %d, buffer:%lx, length: %lu is_null: %d",
DBUG_PRINT("enter",("type: %d buffer: 0x%lx length: %lu is_null: %d",
param->buffer_type,
param->buffer ? param->buffer : "0", *param->length,
*param->is_null));
(long) (param->buffer ? param->buffer : NullS),
*param->length, *param->is_null));
if (*param->is_null)
store_param_null(net, param);
@ -2472,6 +2471,8 @@ static my_bool execute(MYSQL_STMT *stmt, char *packet, ulong length)
NET *net= &mysql->net;
char buff[4 /* size of stmt id */ +
5 /* execution flags */];
my_bool res;
DBUG_ENTER("execute");
DBUG_DUMP("packet", packet, length);
@ -2479,16 +2480,18 @@ static my_bool execute(MYSQL_STMT *stmt, char *packet, ulong length)
int4store(buff, stmt->stmt_id); /* Send stmt id to server */
buff[4]= (char) stmt->flags;
int4store(buff+5, 1); /* iteration count */
if (cli_advanced_command(mysql, COM_STMT_EXECUTE, buff, sizeof(buff),
res= test(cli_advanced_command(mysql, COM_STMT_EXECUTE, buff, sizeof(buff),
packet, length, 1, NULL) ||
(*mysql->methods->read_query_result)(mysql))
(*mysql->methods->read_query_result)(mysql));
stmt->affected_rows= mysql->affected_rows;
stmt->server_status= mysql->server_status;
stmt->insert_id= mysql->insert_id;
if (res)
{
set_stmt_errmsg(stmt, net->last_error, net->last_errno, net->sqlstate);
DBUG_RETURN(1);
}
stmt->affected_rows= mysql->affected_rows;
stmt->server_status= mysql->server_status;
stmt->insert_id= mysql->insert_id;
DBUG_RETURN(0);
}
@ -3319,8 +3322,8 @@ mysql_stmt_send_long_data(MYSQL_STMT *stmt, uint param_number,
MYSQL_BIND *param;
DBUG_ENTER("mysql_stmt_send_long_data");
DBUG_ASSERT(stmt != 0);
DBUG_PRINT("enter",("param no : %d, data : %lx, length : %ld",
param_number, data, length));
DBUG_PRINT("enter",("param no: %d data: 0x%lx, length : %ld",
param_number, (long) data, length));
/*
We only need to check for stmt->param_count, if it's not null
@ -4403,7 +4406,7 @@ my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind)
ulong bind_count= stmt->field_count;
uint param_count= 0;
DBUG_ENTER("mysql_stmt_bind_result");
DBUG_PRINT("enter",("field_count: %d", bind_count));
DBUG_PRINT("enter",("field_count: %lu", bind_count));
if (!bind_count)
{
@ -4763,14 +4766,6 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt)
DBUG_RETURN(1);
}
if (result->data)
{
free_root(&result->alloc, MYF(MY_KEEP_PREALLOC));
result->data= NULL;
result->rows= 0;
stmt->data_cursor= NULL;
}
if (stmt->update_max_length && !stmt->bind_result_done)
{
/*

View File

@ -36,12 +36,9 @@ libmysqlclient_r_la_LDFLAGS = $(target_ldflags)
# This is called from the toplevel makefile
link_sources:
set -x; \
for f in `cd $(top_srcdir)/libmysql && echo *.[ch]`; do \
for d in $(top_srcdir)/libmysql $(top_builddir)/libmysql; do \
for f in `cd $$d && echo *.[ch]`; do \
rm -f $$f; \
@LN_CP_F@ $(top_srcdir)/libmysql/$$f $$f; \
@LN_CP_F@ $$d/$$f $$f; \
done; \
done
for f in `cd $(top_builddir)/libmysql && echo *.[ch]`; do \
rm -f $$f; \
@LN_CP_F@ $(top_builddir)/libmysql/$$f $$f; \
done

View File

@ -29,8 +29,8 @@ DEFS = -DEMBEDDED_LIBRARY -DMYSQL_SERVER \
-DSHAREDIR="\"$(MYSQLSHAREdir)\"" \
-DLIBDIR="\"$(MYSQLLIBdir)\""
INCLUDES= -I$(top_builddir)/include -I$(top_srcdir)/include \
-I$(top_builddir)/include -I$(top_srcdir)/include \
-I$(top_srcdir)/sql -I$(top_srcdir)/sql/examples \
-I$(top_builddir)/sql -I$(top_srcdir)/sql \
-I$(top_srcdir)/sql/examples \
-I$(top_srcdir)/regex \
$(openssl_includes) @ZLIB_INCLUDES@ \
@condition_dependent_plugin_includes@
@ -94,8 +94,8 @@ INC_LIB= $(top_builddir)/regex/libregex.a \
$(yassl_inc_libs)
if HAVE_YASSL
yassl_inc_libs= $(top_srcdir)/extra/yassl/src/.libs/libyassl.a \
$(top_srcdir)/extra/yassl/taocrypt/src/.libs/libtaocrypt.a
yassl_inc_libs= $(top_builddir)/extra/yassl/src/.libs/libyassl.a \
$(top_builddir)/extra/yassl/taocrypt/src/.libs/libtaocrypt.a
endif
# Storage engine specific compilation options
@ -155,16 +155,28 @@ endif
#libmysqld_la_LDFLAGS = -version-info @SHARED_LIB_VERSION@
#CLEANFILES = $(libmysqld_la_LIBADD) libmysqld.la
# This is called from the toplevel makefile
# This is called from the toplevel makefile. If we can link now
# to an existing file in source, we do that, else we assume it
# will show up in the build tree eventually (generated file).
link_sources:
set -x; \
for f in $(sqlsources); do \
rm -f $$f; \
if test -e $(top_srcdir)/sql/$$f ; \
then \
@LN_CP_F@ $(top_srcdir)/sql/$$f $$f; \
else \
@LN_CP_F@ $(top_builddir)/sql/$$f $$f; \
fi ; \
done; \
for f in $(libmysqlsources); do \
rm -f $$f; \
if test -e $(top_srcdir)/libmysql/$$f ; \
then \
@LN_CP_F@ $(top_srcdir)/libmysql/$$f $$f; \
else \
@LN_CP_F@ $(top_builddir)/libmysql/$$f $$f; \
fi ; \
done; \
if test -n "$(sqlstoragesources)" ; \
then \

View File

@ -100,6 +100,7 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command,
mysql->affected_rows= ~(my_ulonglong) 0;
mysql->field_count= 0;
net->last_errno= 0;
thd->current_stmt= stmt;
thd->store_globals(); // Fix if more than one connect
/*
@ -278,24 +279,26 @@ static int emb_stmt_execute(MYSQL_STMT *stmt)
DBUG_ENTER("emb_stmt_execute");
char header[5];
THD *thd;
my_bool res;
int4store(header, stmt->stmt_id);
header[4]= stmt->flags;
thd= (THD*)stmt->mysql->thd;
thd->client_param_count= stmt->param_count;
thd->client_params= stmt->params;
if (emb_advanced_command(stmt->mysql, COM_STMT_EXECUTE,0,0,
res= test(emb_advanced_command(stmt->mysql, COM_STMT_EXECUTE, 0, 0,
header, sizeof(header), 1, stmt) ||
emb_read_query_result(stmt->mysql))
emb_read_query_result(stmt->mysql));
stmt->affected_rows= stmt->mysql->affected_rows;
stmt->insert_id= stmt->mysql->insert_id;
stmt->server_status= stmt->mysql->server_status;
if (res)
{
NET *net= &stmt->mysql->net;
set_stmt_errmsg(stmt, net->last_error, net->last_errno, net->sqlstate);
DBUG_RETURN(1);
}
stmt->affected_rows= stmt->mysql->affected_rows;
stmt->insert_id= stmt->mysql->insert_id;
stmt->server_status= stmt->mysql->server_status;
DBUG_RETURN(0);
}

View File

@ -206,7 +206,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
}
}
DBUG_PRINT("exit",("Mysql handler: %lx",mysql));
DBUG_PRINT("exit",("Mysql handler: 0x%lx", (long) mysql));
DBUG_RETURN(mysql);
error:

View File

@ -59,6 +59,7 @@ dist-hook:
-$(INSTALL_DATA) $(srcdir)/extra/binlog_tests/*.opt $(distdir)/extra/binlog_tests
-$(INSTALL_DATA) $(srcdir)/extra/rpl_tests/*.opt $(distdir)/extra/rpl_tests
$(INSTALL_DATA) $(srcdir)/include/*.inc $(distdir)/include
$(INSTALL_DATA) $(srcdir)/include/*.test $(distdir)/include
$(INSTALL_DATA) $(srcdir)/r/*.result $(srcdir)/r/*.require $(distdir)/r
$(INSTALL_DATA) $(srcdir)/std_data/Moscow_leap $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.dat $(srcdir)/std_data/*.000001 $(distdir)/std_data
@ -98,6 +99,7 @@ install-data-local:
-$(INSTALL_DATA) $(srcdir)/extra/binlog_tests/*.opt $(DESTDIR)$(testdir)/extra/binlog_tests
-$(INSTALL_DATA) $(srcdir)/extra/rpl_tests/*.opt $(DESTDIR)$(testdir)/extra/rpl_tests
$(INSTALL_DATA) $(srcdir)/include/*.inc $(DESTDIR)$(testdir)/include
$(INSTALL_DATA) $(srcdir)/include/*.test $(DESTDIR)$(testdir)/include
$(INSTALL_DATA) $(srcdir)/std_data/*.dat $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.*001 $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(DESTDIR)$(testdir)/std_data

View File

@ -59,4 +59,17 @@ insert into t1 values(null);
select * from t1;
drop table t1;
# bug#22027
create table t1 (a int);
create table if not exists t2 select * from t1;
# bug#22762
create temporary table tt1 (a int);
create table if not exists t3 like tt1;
--replace_column 2 # 5 #
--replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
show binlog events from 102;
drop table t1,t2,t3,tt1;
-- source extra/binlog_tests/binlog_insert_delayed.test

View File

@ -15,7 +15,8 @@
connection master;
eval CREATE TABLE t1 (a INT NOT NULL, KEY(a)) ENGINE=$engine_type;
eval CREATE TABLE t2 (a INT NOT NULL, KEY(a)) ENGINE=$engine_type;
eval CREATE TABLE t3 (a INT) ENGINE=$engine_type;
# requiring 'unique' for the timeout part of the test
eval CREATE TABLE t3 (a INT UNIQUE) ENGINE=$engine_type;
eval CREATE TABLE t4 (a INT) ENGINE=$engine_type;
show variables like 'slave_transaction_retries';
sync_slave_with_master;
@ -30,7 +31,9 @@ stop slave;
connection master;
begin;
# Let's keep BEGIN and the locked statement in two different relay logs.
let $1=200;
insert into t2 values (0); # t2,t1 actors of deadlock in repl-ed ta
#insert into t3 select * from t2 for update;
let $1=10;
disable_query_log;
while ($1)
{
@ -38,16 +41,14 @@ while ($1)
dec $1;
}
enable_query_log;
insert into t3 select * from t2 for update;
insert into t1 values(1);
commit;
save_master_pos;
connection slave;
begin;
# Let's make our transaction large so that it's slave who is chosen as
# victim
let $1=1000;
# Let's make our transaction large so that it's repl-ed msta that's victim
let $1=100;
disable_query_log;
while ($1)
{
@ -55,14 +56,21 @@ while ($1)
dec $1;
}
enable_query_log;
select * from t1 for update;
select * from t1 for update; # t1,t2 on local slave's
start slave;
# bad option, todo: replicate a non-transactional t_sync with the transaction
# and use wait_until_rows_count macro below
--real_sleep 3 # hope that slave is blocked now
insert into t2 values(22); # provoke deadlock, slave should be victim
#let $count=11;
#let $table=t_sync;
#--include wait_until_rows_count.inc
select * from t2 for update /* dl */; # provoke deadlock, repl-ed should be victim
commit;
sync_with_master;
select * from t1; # check that slave succeeded finally
select * from t2;
select * from t1; # check that repl-ed succeeded finally
select * from t2 /* must be 1 */;
# check that no error is reported
--replace_column 1 # 7 # 8 # 9 # 16 # 22 # 23 # 33 #
--replace_result $MASTER_MYPORT MASTER_MYPORT
@ -73,14 +81,16 @@ show slave status;
# 2) Test lock wait timeout
stop slave;
change master to master_log_pos=536; # the BEGIN log event
delete from t3;
change master to master_log_pos=544; # the BEGIN log event
begin;
select * from t2 for update; # hold lock
start slave;
--real_sleep 10 # slave should have blocked, and be retrying
--real_sleep 10 # repl-ed should have blocked, and be retrying
select count(*) from t3 /* must be zero */; # replaying begins after rollback
commit;
sync_with_master;
select * from t1; # check that slave succeeded finally
select * from t1; # check that repl-ed succeeded finally
select * from t2;
# check that no error is reported
--replace_column 1 # 7 # 8 # 9 # 11 # 16 # 22 # 23 # 33 #
@ -96,11 +106,13 @@ set global max_relay_log_size=0;
# This is really copy-paste of 2) of above
stop slave;
change master to master_log_pos=536;
delete from t3;
change master to master_log_pos=544;
begin;
select * from t2 for update;
start slave;
--real_sleep 10
select count(*) from t3 /* must be zero */; # replaying begins after rollback
commit;
sync_with_master;
select * from t1;
@ -115,4 +127,4 @@ connection master;
drop table t1,t2,t3,t4;
sync_slave_with_master;
# End of 4.1 tests
--echo End of 5.1 tests

View File

@ -0,0 +1,853 @@
#################################################
# Author: Jeb
# Date: 2006-09-07
# Purpose: To test having extra columns on the slave.
##################################################
########### Clean up ################
--disable_warnings
--disable_query_log
DROP TABLE IF EXISTS t1, t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17;
--enable_query_log
--enable_warnings
#################################################
############ Different Table Def Test ###########
#################################################
# Purpose: To have different table def on the #
# master and slave. Most of these tests#
# should stop the slave. #
#################################################
--echo **** Diff Table Def Start ****
##############################################
### Try to replicate w/ PK on diff columns ###
### Should Stop Slave ###
##############################################
--echo *** On Slave ***
sync_slave_with_master;
STOP SLAVE;
RESET SLAVE;
eval CREATE TABLE t1 (a INT, b INT PRIMARY KEY, c CHAR(20),
d FLOAT DEFAULT '2.00',
e CHAR(4) DEFAULT 'TEST')
ENGINE=$engine_type;
--echo *** Create t1 on Master ***
connection master;
eval CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c CHAR(10)
) ENGINE=$engine_type;
RESET MASTER;
--echo *** Start Slave ***
connection slave;
START SLAVE;
--echo *** Master Data Insert ***
connection master;
INSERT INTO t1 () VALUES(1,2,'TEXAS'),(2,1,'AUSTIN'),(3,4,'QA');
SELECT * FROM t1 ORDER BY a;
--echo *** Select from slave ***
sync_slave_with_master;
SELECT * FROM t1 ORDER BY a;
--echo *** Drop t1 ***
connection master;
DROP TABLE t1;
sync_slave_with_master;
############################################
### Try to replicate CHAR(10) to CHAR(5) ###
### Should Stop Slave or truncate value ###
############################################
## BUG22086
#--echo *** Create t2 on slave ***
#STOP SLAVE;
#RESET SLAVE;
#eval CREATE TABLE t2 (a INT, b INT PRIMARY KEY, c CHAR(5),
# d FLOAT DEFAULT '2.00',
# e CHAR(5) DEFAULT 'TEST2')
# ENGINE=$engine_type;
#
#--echo *** Create t2 on Master ***
#connection master;
#eval CREATE TABLE t2 (a INT PRIMARY KEY, b INT, c CHAR(10)
# ) ENGINE=$engine_type;
#RESET MASTER;
#
#--echo *** Start Slave ***
#connection slave;
#START SLAVE;
#
#--echo *** Master Data Insert ***
#connection master;
#
#INSERT INTO t2 () VALUES(1,2,'Kyle, TEX'),(2,1,'JOE AUSTIN'),(3,4,'QA TESTING');
#SELECT * FROM t2 ORDER BY a;
#--echo *** Select from slave ***
#sync_slave_with_master;
#SELECT * FROM t2 ORDER BY a;
#--echo *** Drop t2 ***
#connection master;
#DROP TABLE t2;
#sync_slave_with_master;
####################################
### Try to replicate BLOB to INT ###
### Should Stop Slave ###
####################################
--echo *** Create t3 on slave ***
STOP SLAVE;
RESET SLAVE;
eval CREATE TABLE t3 (a INT, b INT PRIMARY KEY, c CHAR(20),
d FLOAT DEFAULT '2.00',
e CHAR(5) DEFAULT 'TEST2')
ENGINE=$engine_type;
--echo *** Create t3 on Master ***
connection master;
eval CREATE TABLE t3 (a BLOB, b INT PRIMARY KEY, c CHAR(20)
) ENGINE=$engine_type;
RESET MASTER;
--echo *** Start Slave ***
connection slave;
START SLAVE;
--echo *** Master Data Insert ***
connection master;
set @b1 = 'b1';
set @b1 = concat(@b1,@b1);
INSERT INTO t3 () VALUES(@b1,2,'Kyle, TEX'),(@b1,1,'JOE AUSTIN'),(@b1,4,'QA TESTING');
--echo ********************************************
--echo *** Expect slave to fail with Error 1522 ***
--echo ********************************************
connection slave;
wait_for_slave_to_stop;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
--query_vertical SHOW SLAVE STATUS
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
--echo *** Drop t3 ***
connection master;
DROP TABLE t3;
sync_slave_with_master;
#####################################################
# Columns with different types, more columns at end #
# Expect: proper error message (wrong types) #
#####################################################
--echo *** Create t4 on slave ***
STOP SLAVE;
RESET SLAVE;
eval CREATE TABLE t4 (a INT, b INT PRIMARY KEY, c CHAR(20),
d FLOAT DEFAULT '2.00',
e CHAR(5) DEFAULT 'TEST2')
ENGINE=$engine_type;
--echo *** Create t4 on Master ***
connection master;
eval CREATE TABLE t4 (a DECIMAL(8,2), b INT PRIMARY KEY, c CHAR(20)
) ENGINE=$engine_type;
RESET MASTER;
--echo *** Start Slave ***
connection slave;
START SLAVE;
--echo *** Master Data Insert ***
connection master;
INSERT INTO t4 () VALUES(100.22,2,'Kyle, TEX'),(200.26,1,'JOE AUSTIN'),
(30000.22,4,'QA TESTING');
--echo ********************************************
--echo *** Expect slave to fail with Error 1522 ***
--echo ********************************************
connection slave;
wait_for_slave_to_stop;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
--query_vertical SHOW SLAVE STATUS
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
--echo *** Drop t4 ***
connection master;
DROP TABLE t4;
sync_slave_with_master;
#######################################################
# Columns with different types, same number of colums #
# Expect: Proper error message #
#######################################################
--echo *** Create t5 on slave ***
STOP SLAVE;
RESET SLAVE;
eval CREATE TABLE t5 (a INT PRIMARY KEY, b CHAR(5),
c FLOAT, d INT, e DOUBLE,
f DECIMAL(8,2))ENGINE=$engine_type;
--echo *** Create t5 on Master ***
connection master;
eval CREATE TABLE t5 (a INT PRIMARY KEY, b VARCHAR(6),
c DECIMAL(8,2), d BIT, e BLOB,
f FLOAT) ENGINE=$engine_type;
RESET MASTER;
--echo *** Start Slave ***
connection slave;
START SLAVE;
--echo *** Master Data Insert ***
connection master;
INSERT INTO t5 () VALUES(1,'Kyle',200.23,1,'b1b1',23.00098),
(2,'JOE',300.01,0,'b2b2',1.0000009);
--echo ********************************************
--echo *** Expect slave to fail with Error 1522 ***
--echo ********************************************
connection slave;
wait_for_slave_to_stop;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
--query_vertical SHOW SLAVE STATUS
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
--echo *** Drop t5 ***
connection master;
DROP TABLE t5;
sync_slave_with_master;
#######################################################
################## Continued ##########################
#######################################################
# Columns with different types, same number of colums #
# Expect: Proper error message #
#######################################################
--echo *** Create t6 on slave ***
STOP SLAVE;
RESET SLAVE;
eval CREATE TABLE t6 (a INT PRIMARY KEY, b CHAR(5),
c FLOAT, d INT)ENGINE=$engine_type;
--echo *** Create t6 on Master ***
connection master;
eval CREATE TABLE t6 (a INT PRIMARY KEY, b VARCHAR(6),
c DECIMAL(8,2), d BIT
) ENGINE=$engine_type;
RESET MASTER;
--echo *** Start Slave ***
connection slave;
START SLAVE;
--echo *** Master Data Insert ***
connection master;
INSERT INTO t6 () VALUES(1,'Kyle',200.23,1),
(2,'JOE',300.01,0);
--echo ********************************************
--echo *** Expect slave to fail with Error 1522 ***
--echo ********************************************
connection slave;
wait_for_slave_to_stop;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
--query_vertical SHOW SLAVE STATUS
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
#START SLAVE;
--echo *** Drop t6 ***
connection master;
DROP TABLE t6;
connection slave;
DROP TABLE t6;
START SLAVE;
#sync_slave_with_master;
--echo **** Diff Table Def End ****
#######################################
#### Extra Column on Slave Testing ####
#######################################
# Purpose: To test extra colums on the#
# Slave #
#######################################
--echo **** Extra Colums Start ****
##########################################
# More columns in slave at end of table, #
# added columns have default values #
# Expect: it should work, default values #
# should be used #
##########################################
--echo *** Create t7 on slave ***
STOP SLAVE;
RESET SLAVE;
eval CREATE TABLE t7 (a INT KEY, b BLOB, c CHAR(5),
d TIMESTAMP NULL DEFAULT '0000-00-00 00:00:00',
e CHAR(20) DEFAULT 'Extra Column Testing')
ENGINE=$engine_type;
--echo *** Create t7 on Master ***
connection master;
eval CREATE TABLE t7 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
) ENGINE=$engine_type;
RESET MASTER;
--echo *** Start Slave ***
connection slave;
START SLAVE;
--echo *** Master Data Insert ***
connection master;
set @b1 = 'b1';
set @b1 = concat(@b1,@b1);
INSERT INTO t7 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
SELECT * FROM t7 ORDER BY a;
--echo *** Select from slave ***
sync_slave_with_master;
SELECT * FROM t7 ORDER BY a;
--echo *** Drop t7 ***
connection master;
DROP TABLE t7;
sync_slave_with_master;
###########################################
# More columns in slave at end of table, #
# added columns do not have default values#
# Expect: Proper error message #
###########################################
# NOTE: This should fail but currently #
# works. BUG#22101 #
###########################################
--echo *** Create t8 on slave ***
STOP SLAVE;
RESET SLAVE;
eval CREATE TABLE t8 (a INT KEY, b BLOB, c CHAR(5),
d TIMESTAMP NULL DEFAULT '0000-00-00 00:00:00',
e INT)ENGINE=$engine_type;
--echo *** Create t8 on Master ***
connection master;
eval CREATE TABLE t8 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
) ENGINE=$engine_type;
RESET MASTER;
--echo *** Start Slave ***
connection slave;
START SLAVE;
--echo *** Master Data Insert ***
connection master;
set @b1 = 'b1b1b1b1';
set @b1 = concat(@b1,@b1);
INSERT INTO t8 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
### Uncomment once bug is fixed
#connection slave;
#wait_for_slave_to_stop;
#--replace_result $MASTER_MYPORT MASTER_PORT
#--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
#--query_vertical SHOW SLAVE STATUS
#SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
#START SLAVE;
--echo *** Drop t8 ***
connection master;
DROP TABLE t8;
sync_slave_with_master;
###########################################
############# Continued ###################
# More columns in slave at end of table, #
# added columns do not have default values#
# Expect: Proper error message #
###########################################
# Commented out due to Bug #23907 Extra Slave Col is not
# erroring on extra col with no default values.
########################################################
#--echo *** Create t9 on slave ***
#STOP SLAVE;
#RESET SLAVE;
#eval CREATE TABLE t9 (a INT KEY, b BLOB, c CHAR(5),
# d TIMESTAMP,
# e INT DEFAULT '1')ENGINE=$engine_type;
#--echo *** Create t9 on Master ***
#connection master;
#eval CREATE TABLE t9 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
# ) ENGINE=$engine_type;
#RESET MASTER;
#--echo *** Start Slave ***
#connection slave;
#START SLAVE;
#--echo *** Master Data Insert ***
#connection master;
#set @b1 = 'b1b1b1b1';
#set @b1 = concat(@b1,@b1);
#INSERT INTO t9 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
#--echo *************************************************
#--echo ** Currently giving wrong error see bug#22234 ***
#--echo *************************************************
#sync_slave_with_master;
#connection slave;
#--echo *** Select from T9 ***
#wait_for_slave_to_stop;
#--replace_result $MASTER_MYPORT MASTER_PORT
#--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
#--query_vertical SHOW SLAVE STATUS
#SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
#START SLAVE;
#--echo *** Drop t9 ***
#connection master;
#DROP TABLE t9;
#sync_slave_with_master;
############################################
# More columns in slave at middle of table #
# Expect: Proper error message #
############################################
--echo *** Create t10 on slave ***
STOP SLAVE;
RESET SLAVE;
eval CREATE TABLE t10 (a INT KEY, b BLOB, f DOUBLE DEFAULT '233',
c CHAR(5), e INT DEFAULT '1')ENGINE=$engine_type;
--echo *** Create t10 on Master ***
connection master;
eval CREATE TABLE t10 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
) ENGINE=$engine_type;
RESET MASTER;
--echo *** Start Slave ***
connection slave;
START SLAVE;
--echo *** Master Data Insert ***
connection master;
set @b1 = 'b1b1b1b1';
set @b1 = concat(@b1,@b1);
INSERT INTO t10 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
--echo ********************************************
--echo *** Expect slave to fail with Error 1522 ***
--echo ********************************************
connection slave;
wait_for_slave_to_stop;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
--query_vertical SHOW SLAVE STATUS
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
--echo *** Drop t10 ***
connection master;
DROP TABLE t10;
sync_slave_with_master;
############################################
############## Continued ###################
############################################
# More columns in slave at middle of table #
# Expect: Proper error message #
############################################
--echo *** Create t11 on slave ***
STOP SLAVE;
RESET SLAVE;
eval CREATE TABLE t11 (a INT KEY, b BLOB, f TEXT,
c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE=$engine_type;
--echo *** Create t11 on Master ***
connection master;
eval CREATE TABLE t11 (a INT PRIMARY KEY, b BLOB, c VARCHAR(254)
) ENGINE=$engine_type;
RESET MASTER;
--echo *** Start Slave ***
connection slave;
START SLAVE;
--echo *** Master Data Insert ***
connection master;
set @b1 = 'b1b1b1b1';
set @b1 = concat(@b1,@b1);
INSERT INTO t11 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
--echo ********************************************
--echo *** Expect slave to fail with Error 1522 ***
--echo ********************************************
connection slave;
wait_for_slave_to_stop;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
--query_vertical SHOW SLAVE STATUS
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
--echo *** Drop t11 ***
connection master;
DROP TABLE t11;
sync_slave_with_master;
############################################
############## Continued ###################
############################################
# More columns in slave at middle of table #
# Expect: This one should pass blob-text #
############################################
--echo *** Create t12 on slave ***
STOP SLAVE;
RESET SLAVE;
eval CREATE TABLE t12 (a INT KEY, b BLOB, f TEXT,
c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE=$engine_type;
--echo *** Create t12 on Master ***
connection master;
eval CREATE TABLE t12 (a INT PRIMARY KEY, b BLOB, c BLOB
) ENGINE=$engine_type;
RESET MASTER;
--echo *** Start Slave ***
connection slave;
START SLAVE;
--echo *** Master Data Insert ***
connection master;
set @b1 = 'b1b1b1b1';
set @b1 = concat(@b1,@b1);
INSERT INTO t12 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
SELECT * FROM t12 ORDER BY a;
--echo *** Select on Slave ***
sync_slave_with_master;
SELECT * FROM t12 ORDER BY a;
--echo *** Drop t12 ***
connection master;
DROP TABLE t12;
sync_slave_with_master;
--echo **** Extra Colums End ****
###############################
# BUG#22177 CURRENT_TIMESTAMP #
# Sould work with ^ #
###############################
--echo *** BUG 22177 Start ***
--echo *** Create t13 on slave ***
STOP SLAVE;
RESET SLAVE;
eval CREATE TABLE t13 (a INT KEY, b BLOB, c CHAR(5),
d INT DEFAULT '1',
e TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
)ENGINE=$engine_type;
--echo *** Create t13 on Master ***
connection master;
eval CREATE TABLE t13 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
) ENGINE=$engine_type;
RESET MASTER;
--echo *** Start Slave ***
connection slave;
START SLAVE;
--echo *** Master Data Insert ***
connection master;
set @b1 = 'b1b1b1b1';
set @b1 = concat(@b1,@b1);
INSERT INTO t13 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
SELECT * FROM t13 ORDER BY a;
--echo *** Select on Slave ****
sync_slave_with_master;
--replace_column 5 CURRENT_TIMESTAMP
SELECT * FROM t13 ORDER BY a;
--echo *** Drop t13 ***
connection master;
DROP TABLE t13;
sync_slave_with_master;
--echo *** 22117 END ***
##############################
# ALTER MASTER TABLE TESTING #
##############################
--echo *** Alter Master Table Testing Start ***
####################################################
# - Alter Master adding columns at middle of table #
# Expect: columns added #
####################################################
--echo *** Create t14 on slave ***
STOP SLAVE;
RESET SLAVE;
eval CREATE TABLE t14 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
c6 INT DEFAULT '1',
c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
)ENGINE=$engine_type;
--echo *** Create t14 on Master ***
connection master;
eval CREATE TABLE t14 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
) ENGINE=$engine_type;
RESET MASTER;
--echo *** Start Slave ***
connection slave;
START SLAVE;
--echo *** Master Data Insert ***
connection master;
ALTER TABLE t14 ADD COLUMN c2 DECIMAL(8,2) AFTER c1;
ALTER TABLE t14 ADD COLUMN c3 TEXT AFTER c2;
set @b1 = 'b1b1b1b1';
set @b1 = concat(@b1,@b1);
INSERT INTO t14 () VALUES(1,1.00,'Replication Testing Extra Col',@b1,'Kyle'),
(2,2.00,'This Test Should work',@b1,'JOE'),
(3,3.00,'If is does not, I will open a bug',@b1,'QA');
SELECT * FROM t14 ORDER BY c1;
--echo *** Select on Slave ****
sync_slave_with_master;
--replace_column 7 CURRENT_TIMESTAMP
SELECT * FROM t14 ORDER BY c1;
####################################################
# - Alter Master Dropping columns from the middle. #
# Expect: columns dropped #
####################################################
--echo *** connect to master and drop columns ***
connection master;
ALTER TABLE t14 DROP COLUMN c2;
ALTER TABLE t14 DROP COLUMN c4;
--echo *** Select from Master ***
SELECT * FROM t14 ORDER BY c1;
--echo *** Select from Slave ***
sync_slave_with_master;
--replace_column 5 CURRENT_TIMESTAMP
SELECT * FROM t14 ORDER BY c1;
--echo *** Drop t14 ***
connection master;
DROP TABLE t14;
sync_slave_with_master;
##############################################################
# - Alter Master adding columns that already exist on slave. #
# Expect: proper error message #
##############################################################
--echo *** Create t15 on slave ***
STOP SLAVE;
RESET SLAVE;
eval CREATE TABLE t15 (c1 INT KEY, c2 DECIMAL(8,2), c3 TEXT,
c4 BLOB, c5 CHAR(5),
c6 INT DEFAULT '1',
c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
)ENGINE=$engine_type;
--echo *** Create t15 on Master ***
connection master;
eval CREATE TABLE t15 (c1 INT PRIMARY KEY, c2 DECIMAL(8,2), c3 TEXT,
c4 BLOB, c5 CHAR(5)) ENGINE=$engine_type;
RESET MASTER;
--echo *** Start Slave ***
connection slave;
START SLAVE;
--echo *** Master Data Insert ***
connection master;
set @b1 = 'b1b1b1b1';
set @b1 = concat(@b1,@b1);
INSERT INTO t15 () VALUES(1,1.00,'Replication Testing Extra Col',@b1,'Kyle'),
(2,2.00,'This Test Should work',@b1,'JOE'),
(3,3.00,'If is does not, I will open a bug',@b1,'QA');
SELECT * FROM t15 ORDER BY c1;
--echo *** Select on Slave ****
sync_slave_with_master;
--replace_column 7 CURRENT_TIMESTAMP
SELECT * FROM t15 ORDER BY c1;
--echo *** Add column on master that is a Extra on Slave ***
connection master;
ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5;
--echo ********************************************
--echo *** Expect slave to fail with Error 1060 ***
--echo ********************************************
connection slave;
wait_for_slave_to_stop;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
--query_vertical SHOW SLAVE STATUS
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
--echo *** Try to insert in master ****
connection master;
INSERT INTO t15 () VALUES(5,2.00,'Replication Testing',@b1,'Buda',2);
SELECT * FROM t15 ORDER BY c1;
--echo *** Try to select from slave ****
sync_slave_with_master;
--replace_column 7 CURRENT_TIMESTAMP
SELECT * FROM t15 ORDER BY c1;
--echo *** DROP TABLE t15 ***
connection master;
DROP TABLE t15;
sync_slave_with_master;
####################################
# - Alter Master and ADD PARTITION #
# Expect:? #
####################################
--echo *** Create t16 on slave ***
STOP SLAVE;
RESET SLAVE;
eval CREATE TABLE t16 (c1 INT KEY, c2 DECIMAL(8,2), c3 TEXT,
c4 BLOB, c5 CHAR(5),
c6 INT DEFAULT '1',
c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
)ENGINE=$engine_type;
--echo *** Create t16 on Master ***
connection master;
eval CREATE TABLE t16 (c1 INT PRIMARY KEY, c2 DECIMAL(8,2), c3 TEXT,
c4 BLOB, c5 CHAR(5))ENGINE=$engine_type;
RESET MASTER;
--echo *** Start Slave ***
connection slave;
START SLAVE;
--echo *** Master Data Insert ***
connection master;
set @b1 = 'b1b1b1b1';
set @b1 = concat(@b1,@b1);
INSERT INTO t16 () VALUES(1,1.00,'Replication Testing Extra Col',@b1,'Kyle'),
(2,2.00,'This Test Should work',@b1,'JOE'),
(3,3.00,'If is does not, I will open a bug',@b1,'QA');
SELECT * FROM t16 ORDER BY c1;
--echo *** Select on Slave ****
sync_slave_with_master;
--replace_column 7 CURRENT_TIMESTAMP
SELECT * FROM t16 ORDER BY c1;
--echo *** Add Partition on master ***
connection master;
ALTER TABLE t16 PARTITION BY KEY(c1) PARTITIONS 4;
INSERT INTO t16 () VALUES(4,1.00,'Replication Rocks',@b1,'Omer');
SHOW CREATE TABLE t16;
--echo *** Show table on Slave ****
sync_slave_with_master;
SHOW CREATE TABLE t16;
--echo *** DROP TABLE t16 ***
connection master;
DROP TABLE t16;
sync_slave_with_master;
--echo *** Alter Master End ***
############################################
### Try to replicate BIGINT to SMALLINT ###
### Should Stop Slave ###
############################################
--echo *** Create t17 on slave ***
STOP SLAVE;
RESET SLAVE;
eval CREATE TABLE t17 (a SMALLINT, b INT PRIMARY KEY, c CHAR(5),
d FLOAT DEFAULT '2.00',
e CHAR(5) DEFAULT 'TEST2')
ENGINE=$engine_type;
--echo *** Create t17 on Master ***
connection master;
eval CREATE TABLE t17 (a BIGINT PRIMARY KEY, b INT, c CHAR(10)
) ENGINE=$engine_type;
RESET MASTER;
--echo *** Start Slave ***
connection slave;
START SLAVE;
--echo *** Master Data Insert ***
connection master;
INSERT INTO t17 () VALUES(9223372036854775807,2,'Kyle, TEX');
--echo ********************************************
--echo *** Expect slave to fail with Error 1522 ***
--echo ********************************************
connection slave;
wait_for_slave_to_stop;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
--query_vertical SHOW SLAVE STATUS
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
--echo ** DROP table t17 ***
connection master;
DROP TABLE t17;
sync_slave_with_master;
#### Clean Up ####
--disable_warnings
--disable_query_log
DROP TABLE IF EXISTS t1, t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17;
--enable_query_log
--enable_warnings
# END 5.1 Test Case

View File

@ -0,0 +1,507 @@
######################## rpl_ddl.test ########################
# #
# DDL statements (sometimes with implicit COMMIT) executed #
# by the master and it's propagation into the slave #
# #
##############################################################
#
# NOTE, PLEASE BE CAREFUL, WHEN MODIFYING THE TESTS !!
#
# 1. !All! objects to be dropped, renamed, altered ... must be created
# in AUTOCOMMIT= 1 mode before AUTOCOMMIT is set to 0 and the test
# sequences start.
#
# 2. Never use a test object, which was direct or indirect affected by a
# preceeding test sequence again.
# Except table d1.t1 where ONLY DML is allowed.
#
# If one preceeding test sequence hits a (sometimes not good visible,
# because the sql error code of the statement might be 0) bug
# and these rules are ignored, a following test sequence might earn ugly
# effects like failing 'sync_slave_with_master', crashes of the slave or
# abort of the test case etc..
#
# 3. The assignment of the DDL command to be tested to $my_stmt can
# be a bit difficult. "'" must be avoided, because the test
# routine "include/rpl_stmt_seq.inc" performs a
# eval SELECT CONCAT('######## ','$my_stmt',' ########') as "";
#
###############################################################
# Some preparations
###############################################################
# The sync_slave_with_master is needed to make the xids deterministic.
sync_slave_with_master;
connection master;
SET AUTOCOMMIT = 1;
#
# 1. DROP all objects, which probably already exist, but must be created here
#
--disable_warnings
DROP DATABASE IF EXISTS mysqltest1;
DROP DATABASE IF EXISTS mysqltest2;
DROP DATABASE IF EXISTS mysqltest3;
--enable_warnings
#
# 2. CREATE all objects needed
# working database is mysqltest1
# working (transactional!) is mysqltest1.t1
#
CREATE DATABASE mysqltest1;
CREATE DATABASE mysqltest2;
eval CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE=$engine_type;
INSERT INTO mysqltest1.t1 SET f1= 0;
eval CREATE TABLE mysqltest1.t2 (f1 BIGINT) ENGINE=$engine_type;
eval CREATE TABLE mysqltest1.t3 (f1 BIGINT) ENGINE=$engine_type;
eval CREATE TABLE mysqltest1.t4 (f1 BIGINT) ENGINE=$engine_type;
eval CREATE TABLE mysqltest1.t5 (f1 BIGINT) ENGINE=$engine_type;
eval CREATE TABLE mysqltest1.t6 (f1 BIGINT) ENGINE=$engine_type;
CREATE INDEX my_idx6 ON mysqltest1.t6(f1);
eval CREATE TABLE mysqltest1.t7 (f1 BIGINT) ENGINE=$engine_type;
INSERT INTO mysqltest1.t7 SET f1= 0;
eval CREATE TABLE mysqltest1.t8 (f1 BIGINT) ENGINE=$engine_type;
eval CREATE TABLE mysqltest1.t9 (f1 BIGINT) ENGINE=$engine_type;
eval CREATE TABLE mysqltest1.t10 (f1 BIGINT) ENGINE=$engine_type;
eval CREATE TABLE mysqltest1.t11 (f1 BIGINT) ENGINE=$engine_type;
eval CREATE TABLE mysqltest1.t12 (f1 BIGINT) ENGINE=$engine_type;
eval CREATE TABLE mysqltest1.t13 (f1 BIGINT) ENGINE=$engine_type;
eval CREATE TABLE mysqltest1.t14 (f1 BIGINT) ENGINE=$engine_type;
eval CREATE TABLE mysqltest1.t15 (f1 BIGINT) ENGINE=$engine_type;
eval CREATE TABLE mysqltest1.t16 (f1 BIGINT) ENGINE=$engine_type;
eval CREATE TABLE mysqltest1.t17 (f1 BIGINT) ENGINE=$engine_type;
eval CREATE TABLE mysqltest1.t18 (f1 BIGINT) ENGINE=$engine_type;
eval CREATE TABLE mysqltest1.t19 (f1 BIGINT) ENGINE=$engine_type;
CREATE TEMPORARY TABLE mysqltest1.t23 (f1 BIGINT);
#
# 3. master sessions: never do AUTOCOMMIT
# slave sessions: never do AUTOCOMMIT
#
SET AUTOCOMMIT = 0;
use mysqltest1;
sync_slave_with_master;
connection slave;
--disable_query_log
SELECT '-------- switch to slave --------' as "";
--enable_query_log
SET AUTOCOMMIT = 0;
use mysqltest1;
connection master;
--disable_query_log
SELECT '-------- switch to master -------' as "";
--enable_query_log
# We don't want to abort the whole test if one statement sent
# to the server gets an error, because the following test
# sequences are nearly independend of the previous statements.
--disable_abort_on_error
###############################################################
# Banal case: (explicit) COMMIT and ROLLBACK
# Just for checking if the test sequence is usable
###############################################################
let $my_stmt= COMMIT;
let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
let $my_stmt= ROLLBACK;
let $my_master_commit= false;
let $my_slave_commit= false;
--source include/rpl_stmt_seq.inc
###############################################################
# Cases with commands very similar to COMMIT
###############################################################
let $my_stmt= SET AUTOCOMMIT=1;
let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SET AUTOCOMMIT=0;
let $my_stmt= START TRANSACTION;
let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
let $my_stmt= BEGIN;
let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
###############################################################
# Cases with (BASE) TABLES and (UPDATABLE) VIEWs
###############################################################
let $my_stmt= DROP TABLE mysqltest1.t2;
let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SHOW TABLES LIKE 't2';
connection slave;
--disable_query_log
SELECT '-------- switch to slave --------' as "";
--enable_query_log
SHOW TABLES LIKE 't2';
connection master;
--disable_query_log
SELECT '-------- switch to master -------' as "";
--enable_query_log
# Note: Since this test is executed with a skip-innodb slave, the
# slave incorrectly commits the insert. One can *not* have InnoDB on
# master and MyISAM on slave and expect that a transactional rollback
# after a CREATE TEMPORARY TABLE should work correctly on the slave.
# For this to work properly the handler on the slave must be able to
# handle transactions (e.g. InnoDB or NDB).
let $my_stmt= DROP TEMPORARY TABLE mysqltest1.t23;
let $my_master_commit= false;
let $my_slave_commit= false;
--source include/rpl_stmt_seq.inc
SHOW TABLES LIKE 't23';
connection slave;
--disable_query_log
SELECT '-------- switch to slave --------' as "";
--enable_query_log
SHOW TABLES LIKE 't23';
connection master;
--disable_query_log
SELECT '-------- switch to master -------' as "";
--enable_query_log
let $my_stmt= RENAME TABLE mysqltest1.t3 to mysqltest1.t20;
let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SHOW TABLES LIKE 't20';
connection slave;
--disable_query_log
SELECT '-------- switch to slave --------' as "";
--enable_query_log
SHOW TABLES LIKE 't20';
connection master;
--disable_query_log
SELECT '-------- switch to master -------' as "";
--enable_query_log
let $my_stmt= ALTER TABLE mysqltest1.t4 ADD column f2 BIGINT;
let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
describe mysqltest1.t4;
connection slave;
--disable_query_log
SELECT '-------- switch to slave --------' as "";
--enable_query_log
describe mysqltest1.t4;
connection master;
--disable_query_log
SELECT '-------- switch to master -------' as "";
--enable_query_log
let $my_stmt= CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE=;
let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq2.inc
# Note: Since this test is executed with a skip-innodb slave, the
# slave incorrectly commits the insert. One can *not* have InnoDB on
# master and MyISAM on slave and expect that a transactional rollback
# after a CREATE TEMPORARY TABLE should work correctly on the slave.
# For this to work properly the handler on the slave must be able to
# handle transactions (e.g. InnoDB or NDB).
let $engine='';
let $eng_type='';
let $my_stmt= CREATE TEMPORARY TABLE mysqltest1.t22 (f1 BIGINT);
let $my_master_commit= false;
let $my_slave_commit= false;
--source include/rpl_stmt_seq.inc
let $my_stmt= TRUNCATE TABLE mysqltest1.t7;
let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SELECT * FROM mysqltest1.t7;
--echo -------- switch to slave --------
sync_slave_with_master;
SELECT * FROM mysqltest1.t7;
--echo -------- switch to master -------
connection master;
###############################################################
# Cases with LOCK/UNLOCK
###############################################################
# MySQL insists in locking mysqltest1.t1, because rpl_stmt_seq performs an
# INSERT into this table.
let $my_stmt= LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ;
let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
UNLOCK TABLES;
# No prior locking
let $my_stmt= UNLOCK TABLES;
let $my_master_commit= false;
let $my_slave_commit= false;
--source include/rpl_stmt_seq.inc
# With prior read locking
# Note that this test generate an error since the rpl_stmt_seq.inc
# tries to insert into t1.
LOCK TABLES mysqltest1.t1 READ;
let $my_stmt= UNLOCK TABLES;
let $my_master_commit= false;
let $my_slave_commit= false;
--source include/rpl_stmt_seq.inc
# With prior write locking
LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ;
let $my_stmt= UNLOCK TABLES;
let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
###############################################################
# Cases with INDEXES
###############################################################
let $my_stmt= DROP INDEX my_idx6 ON mysqltest1.t6;
let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SHOW INDEX FROM mysqltest1.t6;
connection slave;
--disable_query_log
SELECT '-------- switch to slave --------' as "";
--enable_query_log
SHOW INDEX FROM mysqltest1.t6;
connection master;
--disable_query_log
SELECT '-------- switch to master -------' as "";
--enable_query_log
let $my_stmt= CREATE INDEX my_idx5 ON mysqltest1.t5(f1);
let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SHOW INDEX FROM mysqltest1.t5;
connection slave;
--disable_query_log
SELECT '-------- switch to slave --------' as "";
--enable_query_log
SHOW INDEX FROM mysqltest1.t5;
connection master;
--disable_query_log
SELECT '-------- switch to master -------' as "";
--enable_query_log
###############################################################
# Cases with DATABASE
###############################################################
let $my_stmt= DROP DATABASE mysqltest2;
let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SHOW DATABASES LIKE "mysqltest2";
connection slave;
--disable_query_log
SELECT '-------- switch to slave --------' as "";
--enable_query_log
SHOW DATABASES LIKE "mysqltest2";
connection master;
--disable_query_log
SELECT '-------- switch to master -------' as "";
--enable_query_log
let $my_stmt= CREATE DATABASE mysqltest3;
let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SHOW DATABASES LIKE "mysqltest3";
connection slave;
--disable_query_log
SELECT '-------- switch to slave --------' as "";
--enable_query_log
SHOW DATABASES LIKE "mysqltest3";
connection master;
--disable_query_log
SELECT '-------- switch to master -------' as "";
--enable_query_log
# End of 4.1 tests
###############################################################
# Cases with stored procedures
###############################################################
let $my_stmt= CREATE PROCEDURE p1() READS SQL DATA SELECT "this is p1";
let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
--vertical_results
--replace_column 5 # 6 #
SHOW PROCEDURE STATUS LIKE 'p1';
--disable_query_log
SELECT '-------- switch to slave -------' as "";
--enable_query_log
connection slave;
--replace_column 5 # 6 #
SHOW PROCEDURE STATUS LIKE 'p1';
connection master;
--horizontal_results
let $my_stmt= ALTER PROCEDURE p1 COMMENT "I have been altered";
let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
--vertical_results
--replace_column 5 # 6 #
SHOW PROCEDURE STATUS LIKE 'p1';
--disable_query_log
SELECT '-------- switch to slave -------' as "";
--enable_query_log
connection slave;
--replace_column 5 # 6 #
SHOW PROCEDURE STATUS LIKE 'p1';
connection master;
--horizontal_results
let $my_stmt= DROP PROCEDURE p1;
let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
--vertical_results
SHOW PROCEDURE STATUS LIKE 'p1';
--disable_query_log
SELECT '-------- switch to slave -------' as "";
--enable_query_log
connection slave;
SHOW PROCEDURE STATUS LIKE 'p1';
connection master;
--horizontal_results
###############################################################
# Cases with VIEWs
###############################################################
let $my_stmt= CREATE OR REPLACE VIEW v1 as select * from t1;
let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SHOW CREATE VIEW v1;
--disable_query_log
SELECT '-------- switch to slave -------' as "";
--enable_query_log
connection slave;
SHOW CREATE VIEW v1;
connection master;
let $my_stmt= ALTER VIEW v1 AS select f1 from t1;
let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SHOW CREATE VIEW v1;
--disable_query_log
SELECT '-------- switch to slave -------' as "";
--enable_query_log
connection slave;
SHOW CREATE VIEW v1;
connection master;
let $my_stmt= DROP VIEW IF EXISTS v1;
let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
--error 1146
SHOW CREATE VIEW v1;
--disable_query_log
SELECT '-------- switch to slave -------' as "";
--enable_query_log
connection slave;
--error 1146
SHOW CREATE VIEW v1;
connection master;
###############################################################
# Cases with TRIGGERs
###############################################################
let $my_stmt= CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1;
let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SHOW TRIGGERS;
--disable_query_log
SELECT '-------- switch to slave -------' as "";
--enable_query_log
connection slave;
SHOW TRIGGERS;
connection master;
let $my_stmt= DROP TRIGGER trg1;
let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SHOW TRIGGERS;
--disable_query_log
SELECT '-------- switch to slave -------' as "";
--enable_query_log
connection slave;
SHOW TRIGGERS;
connection master;
###############################################################
# Cases with USERs
###############################################################
let $my_stmt= CREATE USER user1@localhost;
let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SELECT user FROM mysql.user WHERE user = 'user1';
--disable_query_log
SELECT '-------- switch to slave -------' as "";
--enable_query_log
connection slave;
SELECT user FROM mysql.user WHERE user = 'user1';
connection master;
let $my_stmt= RENAME USER user1@localhost TO rename1@localhost;
let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SELECT user FROM mysql.user WHERE user = 'rename1';
--disable_query_log
SELECT '-------- switch to slave -------' as "";
--enable_query_log
connection slave;
SELECT user FROM mysql.user WHERE user = 'rename1';
connection master;
let $my_stmt= DROP USER rename1@localhost;
let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SELECT user FROM mysql.user WHERE user = 'rename1';
--disable_query_log
SELECT '-------- switch to slave -------' as "";
--enable_query_log
connection slave;
SELECT user FROM mysql.user WHERE user = 'rename1';
connection master;
###############################################################
# Cleanup
###############################################################
--disable_warnings
DROP DATABASE IF EXISTS mysqltest1;
DROP DATABASE IF EXISTS mysqltest2;
DROP DATABASE IF EXISTS mysqltest3;
--enable_warnings
-- source include/master-slave-end.inc

View File

@ -5,7 +5,7 @@ source ./include/master-slave.inc;
# remote table creation
connection slave;
--replicate-ignore-db=federated
#--replicate-ignore-db=federated
stop slave;
--disable_warnings

View File

@ -22,4 +22,5 @@ SHOW VARIABLES LIKE 'server_id';
# Check that IM understands that mysqld1 is online, while mysqld2 is
# offline.
--replace_result starting XXXXX online XXXXX
SHOW INSTANCES;

View File

@ -1588,7 +1588,7 @@ INSERT INTO t1 (id) VALUES (NULL);
SELECT * FROM t1;
DROP TABLE t2, t1;
-- Test that foreign keys in temporary tables are not accepted (bug #12084)
# Test that foreign keys in temporary tables are not accepted (bug #12084)
eval CREATE TABLE t1
(
id INT PRIMARY KEY

View File

@ -7,7 +7,7 @@
# 1.
--connection slave
--replace_column 1 <the_epoch>
SELECT @the_epoch:=MAX(epoch) FROM cluster.apply_status;
SELECT @the_epoch:=MAX(epoch) FROM mysql.apply_status;
--let $the_epoch= `select @the_epoch`
# 2.
@ -15,7 +15,7 @@ SELECT @the_epoch:=MAX(epoch) FROM cluster.apply_status;
--replace_result $the_epoch <the_epoch>
--replace_column 1 <the_pos>
eval SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
FROM cluster.binlog_index WHERE epoch > $the_epoch ORDER BY epoch ASC LIMIT 1;
FROM mysql.binlog_index WHERE epoch > $the_epoch ORDER BY epoch ASC LIMIT 1;
--let $the_pos= `SELECT @the_pos`
--let $the_file= `SELECT @the_file`

View File

@ -100,4 +100,82 @@ eval set GLOBAL query_cache_size=$save_query_cache_size;
--enable_query_log
}
# End of 4.1 tests
#
# Test query cache with two interleaving transactions
#
# Establish connection1
connect (connection1,localhost,root,,);
eval SET SESSION STORAGE_ENGINE = $engine_type;
SET @@autocommit=1;
connection default;
--echo connection default
# This should be 'YES'.
SHOW VARIABLES LIKE 'have_query_cache';
SET GLOBAL query_cache_size = 200000;
flush status;
SET @@autocommit=1;
eval SET SESSION STORAGE_ENGINE = $engine_type;
CREATE TABLE t2 (s1 int, s2 varchar(1000), key(s1));
INSERT INTO t2 VALUES (1,repeat('a',10)),(2,repeat('a',10)),(3,repeat('a',10)),(4,repeat('a',10));
COMMIT;
START TRANSACTION;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
UPDATE t2 SET s2 = 'w' WHERE s1 = 3;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
show status like "Qcache_queries_in_cache";
connection connection1;
--echo connection connection1
START TRANSACTION;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
INSERT INTO t2 VALUES (5,'w');
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
COMMIT;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
show status like "Qcache_queries_in_cache";
connection default;
--echo connection default
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
COMMIT;
show status like "Qcache_queries_in_cache";
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
show status like "Qcache_queries_in_cache";
connection connection1;
--echo connection connection1
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
START TRANSACTION;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
INSERT INTO t2 VALUES (6,'w');
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
connection default;
--echo connection default
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
START TRANSACTION;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
DELETE from t2 WHERE s1=3;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
COMMIT;
connection connection1;
--echo connection connection1
COMMIT;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
show status like "Qcache_queries_in_cache";
show status like "Qcache_hits";
# Final cleanup
connection default;
drop table t2;
disconnect connection1;

View File

@ -0,0 +1,11 @@
#
# show server variables
#
--disable_query_log
--echo ===== ENGINES =====
show engines;
--echo ===== VARIABLES =====
show variables;
--echo ===== STOP =====
--enable_query_log

View File

@ -1,6 +1,6 @@
delimiter |;
---------------------------------------------------------------------------
# --------------------------------------------------------------------------
CREATE PROCEDURE sp_vars_check_dflt()
BEGIN
@ -40,7 +40,7 @@ BEGIN
SELECT v17, v18, v19, v20;
END|
---------------------------------------------------------------------------
# --------------------------------------------------------------------------
CREATE PROCEDURE sp_vars_check_assignment()
BEGIN
@ -89,35 +89,35 @@ BEGIN
SELECT d1, d2, d3;
END|
---------------------------------------------------------------------------
# --------------------------------------------------------------------------
CREATE FUNCTION sp_vars_check_ret1() RETURNS TINYINT
BEGIN
RETURN 1e200;
END|
---------------------------------------------------------------------------
# --------------------------------------------------------------------------
CREATE FUNCTION sp_vars_check_ret2() RETURNS TINYINT
BEGIN
RETURN 10 * 10 * 10;
END|
---------------------------------------------------------------------------
# --------------------------------------------------------------------------
CREATE FUNCTION sp_vars_check_ret3() RETURNS TINYINT
BEGIN
RETURN 'Hello, world';
END|
---------------------------------------------------------------------------
# --------------------------------------------------------------------------
CREATE FUNCTION sp_vars_check_ret4() RETURNS DECIMAL(64, 2)
BEGIN
RETURN 12 * 10 + 34 + 0.1234;
END|
---------------------------------------------------------------------------
# --------------------------------------------------------------------------
CREATE FUNCTION sp_vars_div_zero() RETURNS INTEGER
BEGIN
@ -126,6 +126,6 @@ BEGIN
RETURN div_zero;
END|
---------------------------------------------------------------------------
# --------------------------------------------------------------------------
delimiter ;|

View File

@ -2,6 +2,10 @@
# Test for strict-mode autoincrement
#
--disable_warnings
drop table if exists t1;
--enable_warnings
set @org_mode=@@sql_mode;
eval create table t1
(

View File

@ -1,5 +1,5 @@
#!/bin/sh
# Copyright (C) 1997-2002 MySQL AB
# Copyright (C) 1997-2006 MySQL AB
# For a more info consult the file COPYRIGHT distributed with this file
# This scripts creates the privilege tables db, host, user, tables_priv,
@ -7,19 +7,26 @@
if [ x$1 = x"--bin" ]; then
shift 1
BINARY_DIST=1
bindir=../bin
scriptdir=../bin
libexecdir=../libexec
# Check if it's a binary distribution or a 'make install'
if test -x ../libexec/mysqld
then
execdir=../libexec
elif test -x ../../sbin/mysqld # RPM installation
then
execdir=../../sbin
bindir=../../bin
scriptdir=../../bin
libexecdir=../../libexec
else
execdir=../bin
fi
bindir=../bin
BINARY_DIST=1
fix_bin=mysql-test
scriptdir=../bin
libexecdir=../libexec
else
execdir=../sql
bindir=../client

View File

@ -634,5 +634,4 @@ CREATE TABLE event (
PRIMARY KEY (db, name)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events';
CREATE DATABASE IF NOT EXISTS cluster;
CREATE TABLE IF NOT EXISTS cluster.binlog_index (Position BIGINT UNSIGNED NOT NULL, File VARCHAR(255) NOT NULL, epoch BIGINT UNSIGNED NOT NULL, inserts BIGINT UNSIGNED NOT NULL, updates BIGINT UNSIGNED NOT NULL, deletes BIGINT UNSIGNED NOT NULL, schemaops BIGINT UNSIGNED NOT NULL, PRIMARY KEY(epoch)) ENGINE=MYISAM;
CREATE TABLE IF NOT EXISTS mysql.binlog_index (Position BIGINT UNSIGNED NOT NULL, File VARCHAR(255) NOT NULL, epoch BIGINT UNSIGNED NOT NULL, inserts BIGINT UNSIGNED NOT NULL, updates BIGINT UNSIGNED NOT NULL, deletes BIGINT UNSIGNED NOT NULL, schemaops BIGINT UNSIGNED NOT NULL, PRIMARY KEY(epoch)) ENGINE=MYISAM;

View File

@ -582,7 +582,7 @@ sub mtr_im_start($$) {
mtr_add_arg($args, $opt);
}
$im->{'pid'} =
$im->{'spawner_pid'} =
mtr_spawn(
$::exe_im, # path to the executable
$args, # cmd-line args
@ -593,7 +593,7 @@ sub mtr_im_start($$) {
{ append_log_file => 1 } # append log files
);
unless ( $im->{'pid'} )
unless ( $im->{'spawner_pid'} )
{
mtr_error('Could not start Instance Manager.')
}

View File

@ -39,6 +39,7 @@ sub mtr_get_pid_from_file ($) {
# Read pid number from file
my $pid= <FILE>;
chomp $pid;
close FILE;
return $pid if $pid=~ /^(\d+)/;

View File

@ -937,6 +937,12 @@ sub check_expected_crash_and_restart($)
}
}
}
if ($::instance_manager->{'spawner_pid'} eq $ret_pid)
{
return;
}
mtr_warning("check_expected_crash_and_restart couldn't find an entry for pid: $ret_pid");
}

View File

@ -38,7 +38,7 @@ sub mtr_show_failed_diff ($) {
my $reject_file= "r/$tname.reject";
my $result_file= "r/$tname.result";
my $log_file= "r/$tname.log";
my $log_file= "$::opt_vardir/log/$tname.log";
my $eval_file= "r/$tname.eval";
if ( $::opt_suite ne "main" )
@ -89,10 +89,14 @@ sub mtr_report_test_skipped ($) {
{
print "[ disabled ] $tinfo->{'comment'}\n";
}
else
elsif ( $tinfo->{'comment'} )
{
print "[ skipped ] $tinfo->{'comment'}\n";
}
else
{
print "[ skipped ]\n";
}
}
sub mtr_report_tests_not_skipped_though_disabled ($) {
@ -243,6 +247,7 @@ sub mtr_report_stats ($) {
foreach my $pattern ( "^Warning:", "^Error:", "^==.* at 0x",
"InnoDB: Warning", "missing DBUG_RETURN",
"mysqld: Warning",
"allocated at line",
"Attempting backtrace", "Assertion .* failed" )
{
foreach my $errlog ( sort glob("$::opt_vardir/log/*.err") )

View File

@ -0,0 +1,156 @@
#
# This file is used from mysql-test-run.pl when choosing
# port numbers and directories to use for running mysqld.
#
use strict;
use Fcntl ':flock';
#
# Requested IDs are stored in a hash and released upon END.
#
my %mtr_unique_assigned_ids = ();
END {
while(my ($id,$file) = each(%mtr_unique_assigned_ids)) {
print "Autoreleasing $file:$id\n";
mtr_release_unique_id($file, $id);
}
}
#
# Require a unique, numerical ID, given a file name (where all
# requested IDs are stored), a minimum and a maximum value.
#
# We use flock to implement locking for the ID file and ignore
# possible problems arising from lack of support for it on
# some platforms (it should work on most, and the possible
# race condition would occur rarely). The proper solution for
# this is a daemon that manages IDs, of course.
#
# If no unique ID within the specified parameters can be
# obtained, return undef.
#
sub mtr_require_unique_id($$$) {
my $file = shift;
my $min = shift;
my $max = shift;
my $ret = undef;
my $changed = 0;
my $can_use_ps = `ps -e | grep '^[ ]*$$ '`;
if(eval("readlink '$file'") || eval("readlink '$file.sem'")) {
die 'lock file is a symbolic link';
}
chmod 0777, "$file.sem";
open SEM, ">", "$file.sem" or die "can't write to $file.sem";
flock SEM, LOCK_EX or die "can't lock $file.sem";
if(! -e $file) {
open FILE, ">", $file or die "can't create $file";
close FILE;
}
if(eval("readlink '$file'") || eval("readlink '$file.sem'")) {
die 'lock file is a symbolic link';
}
chmod 0777, $file;
open FILE, "+<", $file or die "can't open $file";
select undef,undef,undef,0.2;
seek FILE, 0, 0;
my %taken = ();
while(<FILE>) {
chomp;
my ($id, $pid) = split / /;
$taken{$id} = $pid;
if($can_use_ps) {
my $res = `ps -e | grep '^[ ]*$pid '`;
if(!$res) {
print "Ignoring slot $id used by missing process $pid.\n";
delete $taken{$id};
++$changed;
}
}
}
for(my $i=$min; $i<=$max; ++$i) {
if(! exists $taken{$i}) {
$ret = $i;
$taken{$i} = $$;
++$changed;
last;
}
}
if($changed) {
seek FILE, 0, 0;
truncate FILE, 0 or die "can't truncate $file";
for my $k (keys %taken) {
print FILE $k . ' ' . $taken{$k} . "\n";
}
}
close FILE;
flock SEM, LOCK_UN or warn "can't unlock $file.sem";
close SEM;
$mtr_unique_assigned_ids{$ret} = $file if defined $ret;
return $ret;
}
#
# Require a unique ID like above, but sleep if no ID can be
# obtained immediately.
#
sub mtr_require_unique_id_and_wait($$$) {
my $ret = mtr_require_unique_id($_[0],$_[1],$_[2]);
while(! defined $ret) {
sleep 30;
$ret = mtr_require_unique_id($_[0],$_[1],$_[2]);
print "Waiting for unique id to become available...\n" unless $ret;
}
return $ret;
}
#
# Release a unique ID.
#
sub mtr_release_unique_id($$) {
my $file = shift;
my $myid = shift;
if(eval("readlink '$file'") || eval("readlink '$file.sem'")) {
die 'lock file is a symbolic link';
}
open SEM, ">", "$file.sem" or die "can't write to $file.sem";
flock SEM, LOCK_EX or die "can't lock $file.sem";
if(eval("readlink '$file'") || eval("readlink '$file.sem'")) {
die 'lock file is a symbolic link';
}
if(! -e $file) {
open FILE, ">", $file or die "can't create $file";
close FILE;
}
open FILE, "+<", $file or die "can't open $file";
select undef,undef,undef,0.2;
seek FILE, 0, 0;
my %taken = ();
while(<FILE>) {
chomp;
my ($id, $pid) = split / /;
$taken{$id} = $pid;
}
delete $taken{$myid};
seek FILE, 0, 0;
truncate FILE, 0 or die "can't truncate $file";
for my $k (keys %taken) {
print FILE $k . ' ' . $taken{$k} . "\n";
}
close FILE;
flock SEM, LOCK_UN or warn "can't unlock $file.sem";
close SEM;
delete $mtr_unique_assigned_ids{$myid};
}
1;

View File

@ -129,7 +129,7 @@ find_valgrind()
fi
# >=2.1.2 requires the --tool option, some versions write to stdout, some to stderr
valgrind --help 2>&1 | grep "\-\-tool" > /dev/null && FIND_VALGRIND="$FIND_VALGRIND --tool=memcheck"
FIND_VALGRIND="$FIND_VALGRIND --alignment=8 --leak-check=yes --num-callers=16 --suppressions=$CWD/valgrind.supp"
FIND_VALGRIND="$FIND_VALGRIND --alignment=8 --leak-check=yes --num-callers=16 --suppressions=$MYSQL_TEST_DIR/valgrind.supp"
}
# No paths below as we can't be sure where the program is!
@ -180,18 +180,24 @@ fi
# Misc. Definitions
#--
if [ -d ../sql ] ; then
# BASEDIR is always above mysql-test directory ...
MYSQL_TEST_DIR=`pwd`
cd ..
if [ -d ./sql ] ; then
SOURCE_DIST=1
else
BINARY_DIST=1
fi
#BASEDIR is always one above mysql-test directory
CWD=`pwd`
# ... one level for tar.gz, two levels for a RPM installation
if [ ! -f ./bin/mysql_upgrade ] ; then
# Has to be RPM installation
cd ..
fi
fi
BASEDIR=`pwd`
cd $CWD
MYSQL_TEST_DIR=$BASEDIR/mysql-test
cd $MYSQL_TEST_DIR
MYSQL_TEST_WINDIR=$MYSQL_TEST_DIR
MYSQLTEST_VARDIR=$MYSQL_TEST_DIR/var
export MYSQL_TEST_DIR MYSQL_TEST_WINDIR MYSQLTEST_VARDIR
@ -784,8 +790,15 @@ else
if test -x "$BASEDIR/libexec/mysqld"
then
MYSQLD="$VALGRIND $BASEDIR/libexec/mysqld"
else
elif test -x "$BASEDIR/bin/mysqld"
then
MYSQLD="$VALGRIND $BASEDIR/bin/mysqld"
elif test -x "$BASEDIR/sbin/mysqld"
then
MYSQLD="$VALGRIND $BASEDIR/sbin/mysqld"
else
$ECHO "Fatal error: Cannot find program mysqld in $BASEDIR/{libexec,bin,sbin}" 1>&2
exit 1
fi
CLIENT_BINDIR="$BASEDIR/bin"
if test -d "$BASEDIR/tests"
@ -882,15 +895,15 @@ fi
# Save path and name of mysqldump
MYSQL_DUMP_DIR="$MYSQL_DUMP"
export MYSQL_DUMP_DIR
MYSQL_CHECK="$MYSQL_CHECK --no-defaults -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLCHECK_OPT"
MYSQL_DUMP="$MYSQL_DUMP --no-defaults -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
MYSQL_CHECK="$MYSQL_CHECK --no-defaults --debug-info -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLCHECK_OPT"
MYSQL_DUMP="$MYSQL_DUMP --no-defaults --debug-info -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
MYSQL_SLAP="$MYSQL_SLAP -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLSLAP_OPT"
MYSQL_DUMP_SLAVE="$MYSQL_DUMP_DIR --no-defaults -uroot --socket=$SLAVE_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
MYSQL_SHOW="$MYSQL_SHOW -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLSHOW_OPT"
MYSQL_BINLOG="$MYSQL_BINLOG --no-defaults --local-load=$MYSQL_TMP_DIR --character-sets-dir=$CHARSETSDIR $EXTRA_MYSQLBINLOG_OPT"
MYSQL_IMPORT="$MYSQL_IMPORT -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
MYSQL_SHOW="$MYSQL_SHOW --no-defaults --debug-info -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLSHOW_OPT"
MYSQL_BINLOG="$MYSQL_BINLOG --debug-info --no-defaults --local-load=$MYSQL_TMP_DIR --character-sets-dir=$CHARSETSDIR $EXTRA_MYSQLBINLOG_OPT"
MYSQL_IMPORT="$MYSQL_IMPORT --debug-info -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --no-defaults --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD --basedir=$BASEDIR --bindir=$CLIENT_BINDIR --verbose"
MYSQL="$MYSQL --no-defaults --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD"
MYSQL="$MYSQL --no-defaults --debug-info --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD"
export MYSQL MYSQL_CHECK MYSQL_DUMP MYSQL_DUMP_SLAVE MYSQL_SHOW MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES MYSQL_IMPORT
export CLIENT_BINDIR MYSQL_CLIENT_TEST CHARSETSDIR MYSQL_MY_PRINT_DEFAULTS
export MYSQL_SLAP
@ -1263,8 +1276,8 @@ start_ndbcluster()
rm_ndbcluster_tables()
{
$RM -f $1/cluster/apply_status*
$RM -f $1/cluster/schema*
$RM -f $1/mysql/apply_status*
$RM -f $1/mysql/schema*
}
stop_ndbcluster()
@ -1406,7 +1419,7 @@ start_master()
then
$ECHO "set args $master_args" > $GDB_MASTER_INIT$1
$ECHO "To start gdb for the master , type in another window:"
$ECHO "cd $CWD ; gdb -x $GDB_MASTER_INIT$1 $MASTER_MYSQLD"
$ECHO "cd $MYSQL_TEST_DIR ; gdb -x $GDB_MASTER_INIT$1 $MASTER_MYSQLD"
wait_for_master=1500
else
( $ECHO set args $master_args;
@ -1563,7 +1576,7 @@ start_slave()
then
$ECHO "set args $slave_args" > $GDB_SLAVE_INIT
echo "To start gdb for the slave, type in another window:"
echo "cd $CWD ; gdb -x $GDB_SLAVE_INIT $SLAVE_MYSQLD"
echo "cd $MYSQL_TEST_DIR ; gdb -x $GDB_SLAVE_INIT $SLAVE_MYSQLD"
wait_for_slave=1500
else
( $ECHO set args $slave_args;
@ -2164,12 +2177,15 @@ then
# Remove files that can cause problems
$RM -rf $MYSQL_TEST_DIR/var/ndbcluster
$RM -rf $MYSQL_TEST_DIR/var/tmp/snapshot*
$RM -f $MYSQL_TEST_DIR/var/run/* $MYSQL_TEST_DIR/var/tmp/*
$RM -rf $MYSQL_TEST_DIR/var/run/* $MYSQL_TEST_DIR/var/tmp/*
# Remove old berkeley db log files that can confuse the server
$RM -f $MASTER_MYDDIR/log.*
$RM -f $MASTER_MYDDIR"1"/log.*
# Remove old log and reject files
$RM -f r/*.reject r/*.progress r/*.log r/*.warnings
wait_for_master=$SLEEP_TIME_FOR_FIRST_MASTER
wait_for_slave=$SLEEP_TIME_FOR_FIRST_SLAVE
$ECHO "Installing Test Databases"

View File

@ -63,10 +63,8 @@ use Getopt::Long;
use Sys::Hostname;
use IO::Socket;
use IO::Socket::INET;
use Data::Dumper;
use strict;
use warnings;
use diagnostics;
select(STDOUT);
$| = 1; # Automatically flush STDOUT
@ -88,6 +86,7 @@ require "lib/mtr_diff.pl";
require "lib/mtr_match.pl";
require "lib/mtr_misc.pl";
require "lib/mtr_stress.pl";
require "lib/mtr_unique.pl";
$Devel::Trace::TRACE= 1;
@ -199,6 +198,7 @@ our $opt_client_ddd;
our $opt_manual_gdb;
our $opt_manual_ddd;
our $opt_manual_debug;
our $opt_mtr_build_thread=0;
our $opt_debugger;
our $opt_client_debugger;
@ -213,6 +213,11 @@ our $clusters;
our $instance_manager;
our $opt_master_myport;
our $opt_slave_myport;
our $im_port;
our $im_mysqld1_port;
our $im_mysqld2_port;
our $opt_ndbcluster_port;
our $opt_ndbconnectstring;
our $opt_ndbcluster_port_slave;
@ -220,6 +225,7 @@ our $opt_ndbconnectstring_slave;
our $opt_record;
our $opt_check_testcases;
my $opt_report_features;
our $opt_skip;
our $opt_skip_rpl;
@ -312,6 +318,7 @@ our %mysqld_variables;
sub main ();
sub initial_setup ();
sub command_line_setup ();
sub set_mtr_build_thread_ports($);
sub datadir_setup ();
sub executable_setup ();
sub environment_setup ();
@ -430,13 +437,16 @@ sub main () {
initialize_servers();
if ( $opt_report_features ) {
run_report_features();
}
run_suite($opt_suite, $tests);
}
mtr_exit(0);
}
##############################################################################
#
# Default settings
@ -450,45 +460,17 @@ sub command_line_setup () {
$opt_suite= "main"; # Special default suite
my $opt_comment;
my $opt_master_myport= 9306;
my $opt_slave_myport= 9308;
$opt_master_myport= 9306;
$opt_slave_myport= 9308;
$opt_ndbcluster_port= 9310;
$opt_ndbcluster_port_slave= 9311;
my $im_port= 9312;
my $im_mysqld1_port= 9313;
my $im_mysqld2_port= 9314;
$im_port= 9312;
$im_mysqld1_port= 9313;
$im_mysqld2_port= 9314;
#
# To make it easier for different devs to work on the same host,
# an environment variable can be used to control all ports. A small
# number is to be used, 0 - 16 or similar.
#
# Note the MASTER_MYPORT has to be set the same in all 4.x and 5.x
# versions of this script, else a 4.0 test run might conflict with a
# 5.1 test run, even if different MTR_BUILD_THREAD is used. This means
# all port numbers might not be used in this version of the script.
#
# Also note the limiteation of ports we are allowed to hand out. This
# differs between operating systems and configuration, see
# http://www.ncftp.com/ncftpd/doc/misc/ephemeral_ports.html
# But a fairly safe range seems to be 5001 - 32767
if ( $ENV{'MTR_BUILD_THREAD'} )
{
# Up to two masters, up to three slaves
$opt_master_myport= $ENV{'MTR_BUILD_THREAD'} * 10 + 10000; # and 1
$opt_slave_myport= $opt_master_myport + 2; # and 3 4
$opt_ndbcluster_port= $opt_master_myport + 5;
$opt_ndbcluster_port_slave= $opt_master_myport + 6;
$im_port= $opt_master_myport + 7;
$im_mysqld1_port= $opt_master_myport + 8;
$im_mysqld2_port= $opt_master_myport + 9;
}
if ( $opt_master_myport < 5001 or $opt_master_myport + 10 >= 32767 )
{
mtr_error("MTR_BUILD_THREAD number results in a port",
"outside 5001 - 32767",
"($opt_master_myport - $opt_master_myport + 10)");
set_mtr_build_thread_ports($ENV{'MTR_BUILD_THREAD'});
}
# This is needed for test log evaluation in "gen-build-status-page"
@ -540,6 +522,7 @@ sub command_line_setup () {
'im-port=i' => \$im_port, # Instance Manager port.
'im-mysqld1-port=i' => \$im_mysqld1_port, # Port of mysqld, controlled by IM
'im-mysqld2-port=i' => \$im_mysqld2_port, # Port of mysqld, controlled by IM
'mtr-build-thread=i' => \$opt_mtr_build_thread,
# Test case authoring
'record' => \$opt_record,
@ -591,9 +574,10 @@ sub command_line_setup () {
'tmpdir=s' => \$opt_tmpdir,
'vardir=s' => \$opt_vardir,
'benchdir=s' => \$glob_mysql_bench_dir,
'mem' => \$opt_mem,
'mem:s' => \$opt_mem,
# Misc
'report-features' => \$opt_report_features,
'comment=s' => \$opt_comment,
'debug' => \$opt_debug,
'fast' => \$opt_fast,
@ -621,6 +605,15 @@ sub command_line_setup () {
$glob_scriptname= basename($0);
if ($opt_mtr_build_thread != 0)
{
set_mtr_build_thread_ports($opt_mtr_build_thread)
}
elsif ($ENV{'MTR_BUILD_THREAD'})
{
$opt_mtr_build_thread= $ENV{'MTR_BUILD_THREAD'};
}
# We require that we are in the "mysql-test" directory
# to run mysql-test-run
if (! -f $glob_scriptname)
@ -637,7 +630,7 @@ sub command_line_setup () {
$glob_hostname= mtr_short_hostname();
# 'basedir' is always parent of "mysql-test" directory
# Find the absolute path to the test directory
$glob_mysql_test_dir= cwd();
if ( $glob_cygwin_perl )
{
@ -645,11 +638,27 @@ sub command_line_setup () {
$glob_mysql_test_dir= `cygpath -m "$glob_mysql_test_dir"`;
chomp($glob_mysql_test_dir);
}
# In most cases, the base directory we find everything relative to,
# is the parent directory of the "mysql-test" directory. For source
# distributions, TAR binary distributions and some other packages.
$glob_basedir= dirname($glob_mysql_test_dir);
# In the RPM case, binaries and libraries are installed in the
# default system locations, instead of having our own private base
# directory. And we install "/usr/share/mysql-test". Moving up one
# more directory relative to "mysql-test" gives us a usable base
# directory for RPM installs.
if ( ! $opt_source_dist and ! -d "$glob_basedir/bin" )
{
$glob_basedir= dirname($glob_basedir);
}
# Expect mysql-bench to be located adjacent to the source tree, by default
$glob_mysql_bench_dir= "$glob_basedir/../mysql-bench"
unless defined $glob_mysql_bench_dir;
$glob_mysql_bench_dir= undef
unless -d $glob_mysql_bench_dir;
$path_my_basedir=
$opt_source_dist ? $glob_mysql_test_dir : $glob_basedir;
@ -677,7 +686,8 @@ sub command_line_setup () {
"$path_client_bindir/mysqld-debug",
"$path_client_bindir/mysqld-max",
"$glob_basedir/libexec/mysqld",
"$glob_basedir/bin/mysqld");
"$glob_basedir/bin/mysqld",
"$glob_basedir/sbin/mysqld");
# Use the mysqld found above to find out what features are available
collect_mysqld_features();
@ -734,24 +744,25 @@ sub command_line_setup () {
# --------------------------------------------------------------------------
# Check if we should speed up tests by trying to run on tmpfs
# --------------------------------------------------------------------------
if ( $opt_mem )
if ( defined $opt_mem )
{
mtr_error("Can't use --mem and --vardir at the same time ")
if $opt_vardir;
mtr_error("Can't use --mem and --tmpdir at the same time ")
if $opt_tmpdir;
# Use /dev/shm as the preferred location for vardir and
# thus implicitly also tmpdir. Add other locations to list
my @tmpfs_locations= ($opt_mem, "/dev/shm");
# One could maybe use "mount" to find tmpfs location(s)
# Search through list of locations that are known
# to be "fast disks" to list to find a suitable location
# Use --mem=<dir> as first location to look.
my @tmpfs_locations= ($opt_mem, "/dev/shm", "/tmp");
foreach my $fs (@tmpfs_locations)
{
if ( -d $fs )
{
mtr_report("Using tmpfs in $fs");
$opt_mem= "$fs/var";
$opt_mem .= $ENV{'MTR_BUILD_THREAD'} if $ENV{'MTR_BUILD_THREAD'};
$opt_mem .= $opt_mtr_build_thread if $opt_mtr_build_thread;
last;
}
}
@ -793,6 +804,13 @@ sub command_line_setup () {
$opt_vardir= "$glob_mysql_test_dir/$opt_vardir";
}
# Ensure a proper error message
mkpath("$opt_vardir");
unless ( -d $opt_vardir and -w $opt_vardir )
{
mtr_error("Writable 'var' directory is needed, use the '--vardir' option");
}
# --------------------------------------------------------------------------
# Set tmpdir
# --------------------------------------------------------------------------
@ -1199,6 +1217,43 @@ sub command_line_setup () {
$path_snapshot= "$opt_tmpdir/snapshot_$opt_master_myport/";
}
#
# To make it easier for different devs to work on the same host,
# an environment variable can be used to control all ports. A small
# number is to be used, 0 - 16 or similar.
#
# Note the MASTER_MYPORT has to be set the same in all 4.x and 5.x
# versions of this script, else a 4.0 test run might conflict with a
# 5.1 test run, even if different MTR_BUILD_THREAD is used. This means
# all port numbers might not be used in this version of the script.
#
# Also note the limitation of ports we are allowed to hand out. This
# differs between operating systems and configuration, see
# http://www.ncftp.com/ncftpd/doc/misc/ephemeral_ports.html
# But a fairly safe range seems to be 5001 - 32767
#
sub set_mtr_build_thread_ports($) {
my $mtr_build_thread= shift;
# Up to two masters, up to three slaves
$opt_master_myport= $mtr_build_thread * 10 + 10000; # and 1
$opt_slave_myport= $opt_master_myport + 2; # and 3 4
$opt_ndbcluster_port= $opt_master_myport + 5;
$opt_ndbcluster_port_slave= $opt_master_myport + 6;
$im_port= $opt_master_myport + 7;
$im_mysqld1_port= $opt_master_myport + 8;
$im_mysqld2_port= $opt_master_myport + 9;
if ( $opt_master_myport < 5001 or $opt_master_myport + 10 >= 32767 )
{
mtr_error("MTR_BUILD_THREAD number results in a port",
"outside 5001 - 32767",
"($opt_master_myport - $opt_master_myport + 10)");
}
}
sub datadir_setup () {
# Make a list of all data_dirs
@ -1314,7 +1369,9 @@ sub executable_setup_im () {
$exe_im=
mtr_exe_maybe_exists(
"$glob_basedir/server-tools/instance-manager/mysqlmanager",
"$glob_basedir/libexec/mysqlmanager");
"$glob_basedir/libexec/mysqlmanager",
"$glob_basedir/bin/mysqlmanager",
"$glob_basedir/sbin/mysqlmanager");
return ($exe_im eq "");
}
@ -1466,7 +1523,7 @@ sub executable_setup () {
$exe_mysql_client_test=
mtr_exe_maybe_exists(vs_config_dirs('tests', 'mysql_client_test'),
"$glob_basedir/tests/mysql_client_test",
"$glob_basedir/bin");
"$glob_basedir/bin/mysql_client_test");
}
}
@ -1474,7 +1531,7 @@ sub executable_setup () {
sub generate_cmdline_mysqldump ($) {
my($mysqld) = @_;
return
"$exe_mysqldump --no-defaults -uroot " .
"$exe_mysqldump --no-defaults --debug-info -uroot " .
"--port=$mysqld->{'port'} " .
"--socket=$mysqld->{'path_sock'} --password=";
}
@ -1543,7 +1600,8 @@ sub environment_setup () {
if ( $opt_source_dist )
{
push(@ld_library_paths, "$glob_basedir/libmysql/.libs/",
"$glob_basedir/libmysql_r/.libs/");
"$glob_basedir/libmysql_r/.libs/",
"$glob_basedir/zlib.libs/");
}
else
{
@ -1614,7 +1672,7 @@ sub environment_setup () {
$ENV{'IM_PATH_SOCK'}= $instance_manager->{path_sock};
$ENV{'IM_USERNAME'}= $instance_manager->{admin_login};
$ENV{'IM_PASSWORD'}= $instance_manager->{admin_password};
$ENV{MTR_BUILD_THREAD}= 0 unless $ENV{MTR_BUILD_THREAD}; # Set if not set
$ENV{MTR_BUILD_THREAD}= $opt_mtr_build_thread;
$ENV{'EXE_MYSQL'}= $exe_mysql;
@ -1675,7 +1733,7 @@ sub environment_setup () {
# Setup env so childs can execute mysqlcheck
# ----------------------------------------------------
my $cmdline_mysqlcheck=
"$exe_mysqlcheck --no-defaults -uroot " .
"$exe_mysqlcheck --no-defaults --debug-info -uroot " .
"--port=$master->[0]->{'port'} " .
"--socket=$master->[0]->{'path_sock'} --password=";
@ -1726,7 +1784,7 @@ sub environment_setup () {
# Setup env so childs can execute mysqlimport
# ----------------------------------------------------
my $cmdline_mysqlimport=
"$exe_mysqlimport -uroot " .
"$exe_mysqlimport --debug-info -uroot " .
"--port=$master->[0]->{'port'} " .
"--socket=$master->[0]->{'path_sock'} --password=";
@ -1742,7 +1800,7 @@ sub environment_setup () {
# Setup env so childs can execute mysqlshow
# ----------------------------------------------------
my $cmdline_mysqlshow=
"$exe_mysqlshow -uroot " .
"$exe_mysqlshow --debug-info -uroot " .
"--port=$master->[0]->{'port'} " .
"--socket=$master->[0]->{'path_sock'} --password=";
@ -1758,7 +1816,7 @@ sub environment_setup () {
# ----------------------------------------------------
my $cmdline_mysqlbinlog=
"$exe_mysqlbinlog" .
" --no-defaults --local-load=$opt_tmpdir";
" --no-defaults --debug-info --local-load=$opt_tmpdir";
if ( $mysql_version_id >= 50000 )
{
$cmdline_mysqlbinlog .=" --character-sets-dir=$path_charsetsdir";
@ -1775,7 +1833,7 @@ sub environment_setup () {
# Setup env so childs can execute mysql
# ----------------------------------------------------
my $cmdline_mysql=
"$exe_mysql --no-defaults --host=localhost --user=root --password= " .
"$exe_mysql --no-defaults --debug-info --host=localhost --user=root --password= " .
"--port=$master->[0]->{'port'} " .
"--socket=$master->[0]->{'path_sock'} ".
"--character-sets-dir=$path_charsetsdir";
@ -2012,6 +2070,12 @@ sub cleanup_stale_files () {
}
closedir(DIR);
}
# Remove old log files
foreach my $name (glob("r/*.progress r/*.log r/*.warnings"))
{
unlink($name);
}
}
@ -2392,8 +2456,8 @@ sub ndbcluster_start ($$) {
sub rm_ndbcluster_tables ($) {
my $dir= shift;
foreach my $bin ( glob("$dir/cluster/apply_status*"),
glob("$dir/cluster/schema*") )
foreach my $bin ( glob("$dir/mysql/apply_status*"),
glob("$dir/mysql/schema*"))
{
unlink($bin);
}
@ -2953,10 +3017,6 @@ sub do_after_run_mysqltest($)
# Save info from this testcase run to mysqltest.log
mtr_appendfile_to_file($path_timefile, $path_mysqltest_log)
if -f $path_timefile;
# Remove the file that mysqltest writes info to
unlink($path_timefile);
}
@ -2964,14 +3024,14 @@ sub find_testcase_skipped_reason($)
{
my ($tinfo)= @_;
# Open mysqltest.log
# Open mysqltest-time
my $F= IO::File->new($path_timefile) or
mtr_error("can't open file \"$path_timefile\": $!");
my $reason;
while ( my $line= <$F> )
{
# Look for "reason: <reason fo skiping test>"
# Look for "reason: <reason for skipping test>"
if ( $line =~ /reason: (.*)/ )
{
$reason= $1;
@ -2996,9 +3056,9 @@ sub analyze_testcase_failure_sync_with_master($)
mtr_add_arg($args, "--no-defaults");
mtr_add_arg($args, "--silent");
mtr_add_arg($args, "-v");
mtr_add_arg($args, "--skip-safemalloc");
mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_sock'});
mtr_add_arg($args, "--port=%d", $master->[0]->{'port'});
@ -3106,6 +3166,9 @@ sub run_testcase ($) {
my $res= run_mysqltest($tinfo);
mtr_report_test_name($tinfo);
do_after_run_mysqltest($tinfo);
if ( $res == 0 )
{
mtr_report_test_passed($tinfo);
@ -3139,10 +3202,11 @@ sub run_testcase ($) {
"mysqltest returned unexpected code $res, it has probably crashed";
report_failure_and_restart($tinfo);
}
do_after_run_mysqltest($tinfo);
}
# Remove the file that mysqltest writes info to
unlink($path_timefile);
# ----------------------------------------------------------------------
# Stop Instance Manager if we are processing an IM-test case.
# ----------------------------------------------------------------------
@ -4063,12 +4127,12 @@ sub run_testcase_start_servers($) {
# tables ok FIXME This is a workaround so that only one mysqld
# create the tables
if ( ! sleep_until_file_created(
"$master->[0]->{'path_myddir'}/cluster/apply_status.ndb",
"$master->[0]->{'path_myddir'}/mysql/apply_status.ndb",
$master->[0]->{'start_timeout'},
$master->[0]->{'pid'}))
{
$tinfo->{'comment'}= "Failed to create 'cluster/apply_status' table";
$tinfo->{'comment'}= "Failed to create 'mysql/apply_status' table";
return 1;
}
}
@ -4181,9 +4245,9 @@ sub run_check_testcase ($$) {
mtr_add_arg($args, "--no-defaults");
mtr_add_arg($args, "--silent");
mtr_add_arg($args, "-v");
mtr_add_arg($args, "--skip-safemalloc");
mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
mtr_add_arg($args, "--socket=%s", $mysqld->{'path_sock'});
mtr_add_arg($args, "--port=%d", $mysqld->{'port'});
@ -4216,6 +4280,43 @@ sub run_check_testcase ($$) {
return $res;
}
##############################################################################
#
# Report the features that were compiled in
#
##############################################################################
sub run_report_features () {
my $args;
if ( ! $glob_use_embedded_server )
{
mysqld_start($master->[0],[],[]);
if ( ! $master->[0]->{'pid'} )
{
mtr_error("Can't start the mysqld server");
}
mysqld_wait_started($master->[0]);
}
my $tinfo = {};
$tinfo->{'name'} = 'report features';
$tinfo->{'result_file'} = undef;
$tinfo->{'component_id'} = 'mysqld';
$tinfo->{'path'} = 'include/report-features.test';
$tinfo->{'timezone'}= "GMT-3";
$tinfo->{'slave_num'} = 0;
$tinfo->{'master_opt'} = [];
$tinfo->{'slave_opt'} = [];
$tinfo->{'slave_mi'} = [];
$tinfo->{'comment'} = 'report server features';
run_mysqltest($tinfo);
if ( ! $glob_use_embedded_server )
{
stop_all_servers();
}
}
sub run_mysqltest ($) {
@ -4227,9 +4328,10 @@ sub run_mysqltest ($) {
mtr_add_arg($args, "--no-defaults");
mtr_add_arg($args, "--silent");
mtr_add_arg($args, "-v");
mtr_add_arg($args, "--skip-safemalloc");
mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
mtr_add_arg($args, "--logdir=%s/log", $opt_vardir);
if ($tinfo->{'component_id'} eq 'im')
{
@ -4314,13 +4416,11 @@ sub run_mysqltest ($) {
if ( $opt_ssl )
{
# Turn on SSL for _all_ test cases if option --ssl was used
mtr_add_arg($args, "--ssl",
$glob_mysql_test_dir);
mtr_add_arg($args, "--ssl");
}
elsif ( $opt_ssl_supported )
{
mtr_add_arg($args, "--skip-ssl",
$glob_mysql_test_dir);
mtr_add_arg($args, "--skip-ssl");
}
# ----------------------------------------------------------------------
@ -4355,8 +4455,10 @@ sub run_mysqltest ($) {
mtr_add_arg($args, "--test-file");
mtr_add_arg($args, $tinfo->{'path'});
if ( defined $tinfo->{'result_file'} ) {
mtr_add_arg($args, "--result-file");
mtr_add_arg($args, $tinfo->{'result_file'});
}
if ( $opt_record )
{
@ -4654,9 +4756,12 @@ Options to control directories to use
vardir=DIR The directory where files generated from the test run
is stored (default: ./var). Specifying a ramdisk or
tmpfs will speed up tests.
mem Run testsuite in "memory" using tmpfs if
available(default: /dev/shm)
reads path from MTR_MEM environment variable
mem[=DIR] Run testsuite in "memory" using tmpfs or ramdisk
Attempts to use DIR first if specified else
uses as builtin list of standard locations
for tmpfs (/dev/shm)
The option can also be set using environment
variable MTR_MEM=[DIR]
Options to control what test suites or cases to run
@ -4681,6 +4786,8 @@ Options that specify ports
slave_port=PORT Specify the port number used by the first slave
ndbcluster-port=PORT Specify the port number used by cluster
ndbcluster-port-slave=PORT Specify the port number used by slave cluster
mtr-build-thread=# Specify unique collection of ports. Can also be set by
setting the environment variable MTR_BUILD_THREAD.
Options for test case authoring

29
mysql-test/r/1st.result Normal file
View File

@ -0,0 +1,29 @@
show databases;
Database
information_schema
mysql
test
show tables in mysql;
Tables_in_mysql
binlog_index
columns_priv
db
event
func
general_log
help_category
help_keyword
help_relation
help_topic
host
plugin
proc
procs_priv
slow_log
tables_priv
time_zone
time_zone_leap_second
time_zone_name
time_zone_transition
time_zone_transition_type
user

View File

@ -13820,4 +13820,31 @@ i v
2 abc
4 3r4f
5 lmn
DROP TABLE t5;
CREATE TABLE `t5` (
`a` int(11) NOT NULL auto_increment,
b varchar(250),
c varchar(800),
KEY (`a`)
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1;
INSERT INTO t5 VALUES (NULL, "foo", "grok this!");
INSERT INTO t5 VALUES (NULL, "We the people", NULL);
INSERT INTO t5 VALUES (NULL, "in order to form a more peefect union", "secure the blessing of liberty");
INSERT INTO t5 VALUES (NULL, "establish justice", "to ourselves and");
INSERT INTO t5 VALUES (32, "ensure domestic tranquility", NULL);
INSERT INTO t5 VALUES (23, "provide for the common defense", "posterity");
INSERT INTO t5 VALUES (NULL, "promote the general welfare", "do ordain");
INSERT INTO t5 VALUES (NULL, "abcdeghijklmnopqrstuvwxyzabcdeghijklmnopqrstuvwxyzabcdeghijklmnopqrstuvwxyzabcdeghijklmnopqrstuvwxyzabcdeghijklmnopqrstuvwxyzabcdeghijklmnopqrstuvwxyzabcdeghijklmnopqrstuvwxyzabcdeghijklmnopqrstuvwxyzabcdeghijklmnopqrstuvwxyzabcdeghijklmnopqrstuvwxyzabc", "do ordain");
Warnings:
Warning 1265 Data truncated for column 'b' at row 1
SELECT * FROM t5;
a b c
1 foo grok this!
2 We the people NULL
3 in order to form a more peefect union secure the blessing of liberty
4 establish justice to ourselves and
32 ensure domestic tranquility NULL
23 provide for the common defense posterity
33 promote the general welfare do ordain
34 abcdeghijklmnopqrstuvwxyzabcdeghijklmnopqrstuvwxyzabcdeghijklmnopqrstuvwxyzabcdeghijklmnopqrstuvwxyzabcdeghijklmnopqrstuvwxyzabcdeghijklmnopqrstuvwxyzabcdeghijklmnopqrstuvwxyzabcdeghijklmnopqrstuvwxyzabcdeghijklmnopqrstuvwxyzabcdeghijklmnopqrstuvwxyz do ordain
drop table t1, t2, t4, t5;

View File

@ -245,6 +245,24 @@ select * from t1;
id
127
drop table t1;
create table t1 (a int);
create table if not exists t2 select * from t1;
create temporary table tt1 (a int);
create table if not exists t3 like tt1;
show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; create table t1 (id tinyint auto_increment primary key)
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # use `test`; drop table t1
master-bin.000001 # Query 1 # use `test`; create table t1 (a int)
master-bin.000001 # Query 1 # use `test`; CREATE TABLE IF NOT EXISTS `t2` (
`a` int(11) DEFAULT NULL
)
master-bin.000001 # Query 1 # use `test`; CREATE TABLE IF NOT EXISTS `t3` (
`a` int(11) DEFAULT NULL
)
drop table t1,t2,t3,tt1;
create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1;
insert delayed into t1 values (207);
@ -256,6 +274,14 @@ master-bin.000001 # Query 1 # use `test`; create table t1 (id tinyint auto_incre
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # use `test`; drop table t1
master-bin.000001 # Query 1 # use `test`; create table t1 (a int)
master-bin.000001 # Query 1 # use `test`; CREATE TABLE IF NOT EXISTS `t2` (
`a` int(11) DEFAULT NULL
)
master-bin.000001 # Query 1 # use `test`; CREATE TABLE IF NOT EXISTS `t3` (
`a` int(11) DEFAULT NULL
)
master-bin.000001 # Query 1 # use `test`; DROP TABLE `t1`,`t2`,`t3` /* generated by server */
master-bin.000001 # Query 1 # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F

View File

@ -155,6 +155,21 @@ select * from t1;
id
127
drop table t1;
create table t1 (a int);
create table if not exists t2 select * from t1;
create temporary table tt1 (a int);
create table if not exists t3 like tt1;
show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; create table t1 (id tinyint auto_increment primary key)
master-bin.000001 # Intvar 1 # INSERT_ID=127
master-bin.000001 # Query 1 # use `test`; insert into t1 values(null)
master-bin.000001 # Query 1 # use `test`; drop table t1
master-bin.000001 # Query 1 # use `test`; create table t1 (a int)
master-bin.000001 # Query 1 # use `test`; create table if not exists t2 select * from t1
master-bin.000001 # Query 1 # use `test`; create temporary table tt1 (a int)
master-bin.000001 # Query 1 # use `test`; create table if not exists t3 like tt1
drop table t1,t2,t3,tt1;
create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1;
insert delayed into t1 values (207);
@ -166,6 +181,11 @@ master-bin.000001 # Query 1 # use `test`; create table t1 (id tinyint auto_incre
master-bin.000001 # Intvar 1 # INSERT_ID=127
master-bin.000001 # Query 1 # use `test`; insert into t1 values(null)
master-bin.000001 # Query 1 # use `test`; drop table t1
master-bin.000001 # Query 1 # use `test`; create table t1 (a int)
master-bin.000001 # Query 1 # use `test`; create table if not exists t2 select * from t1
master-bin.000001 # Query 1 # use `test`; create temporary table tt1 (a int)
master-bin.000001 # Query 1 # use `test`; create table if not exists t3 like tt1
master-bin.000001 # Query 1 # use `test`; drop table t1,t2,t3,tt1
master-bin.000001 # Query 1 # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F

View File

@ -128,3 +128,94 @@ select t1.* from t1, t2, t3 where t3.state & 1 = 0 and t3.t1_id = t1.id and t3.t
id a
1 me
drop table t3,t2,t1;
SET SESSION STORAGE_ENGINE = InnoDB;
SET @@autocommit=1;
connection default
SHOW VARIABLES LIKE 'have_query_cache';
Variable_name Value
have_query_cache YES
SET GLOBAL query_cache_size = 200000;
flush status;
SET @@autocommit=1;
SET SESSION STORAGE_ENGINE = InnoDB;
CREATE TABLE t2 (s1 int, s2 varchar(1000), key(s1));
INSERT INTO t2 VALUES (1,repeat('a',10)),(2,repeat('a',10)),(3,repeat('a',10)),(4,repeat('a',10));
COMMIT;
START TRANSACTION;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
0
UPDATE t2 SET s2 = 'w' WHERE s1 = 3;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
1
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
connection connection1
START TRANSACTION;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
0
INSERT INTO t2 VALUES (5,'w');
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
1
COMMIT;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
1
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
connection default
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
1
COMMIT;
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
2
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
connection connection1
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
2
START TRANSACTION;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
2
INSERT INTO t2 VALUES (6,'w');
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
3
connection default
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
2
START TRANSACTION;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
2
DELETE from t2 WHERE s1=3;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
1
COMMIT;
connection connection1
COMMIT;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
2
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 2
drop table t2;

Some files were not shown because too many files have changed in this diff Show More