This commit is contained in:
Alexey Botchkov 2009-09-29 17:49:36 +05:00
commit 45bdc1e063
1093 changed files with 268407 additions and 5525 deletions

View file

@ -3063,3 +3063,4 @@ sql/share/slovak
sql/share/spanish
sql/share/swedish
sql/share/ukrainian
libmysqld/examples/mysqltest.cc

View file

@ -47,8 +47,13 @@ check_cpu () {
model_name=`sysctl -n hw.model`
;;
Darwin)
cpu_family=`uname -p`
model_name=`machine`
cpu_family=`sysctl -n machdep.cpu.vendor`
model_name=`sysctl -n machdep.cpu.brand_string`
if [ -z "$cpu_family" -o -z "$model_name" ]
then
cpu_family=`uname -p`
model_name=`machine`
fi
;;
*)
cpu_family=`uname -m`;
@ -65,6 +70,11 @@ check_cpu () {
Alpha*EV6*)
cpu_arg="ev6";
;;
#Core 2 Duo
*Intel*Core\(TM\)2*)
cpu_arg="nocona"
core2="yes"
;;
# Intel ia32
*Intel*Core*|*X[eE][oO][nN]*)
# a Xeon is just another pentium4 ...
@ -129,10 +139,6 @@ check_cpu () {
*i386*)
cpu_arg="i386"
;;
#Core 2 Duo
*Intel*Core\(TM\)2*)
cpu_arg="nocona"
;;
# Intel ia64
*Itanium*)
cpu_arg="itanium"

View file

@ -13,7 +13,10 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.7 FATAL_ERROR)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)
IF(COMMAND cmake_policy)
cmake_policy(SET CMP0005 NEW)
ENDIF(COMMAND cmake_policy)
PROJECT(MySql)
@ -28,60 +31,17 @@ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/include/mysql_version.h.in
# Set standard options
ADD_DEFINITIONS(-DHAVE_YASSL)
ADD_DEFINITIONS(-DCMAKE_CONFIGD)
ADD_DEFINITIONS(-DDEFAULT_MYSQL_HOME="c:/Program Files/MySQL/MySQL Server ${MYSQL_BASE_VERSION}/")
ADD_DEFINITIONS(-DDEFAULT_BASEDIR="c:/Program Files/MySQL/")
ADD_DEFINITIONS(-DMYSQL_DATADIR="c:/Program Files/MySQL/MySQL Server ${MYSQL_BASE_VERSION}/data")
ADD_DEFINITIONS(-DDEFAULT_CHARSET_HOME="c:/Program Files/MySQL/MySQL Server ${MYSQL_BASE_VERSION}/")
ADD_DEFINITIONS(-DPACKAGE=mysql)
ADD_DEFINITIONS(-DSHAREDIR="share")
# Set debug options
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DFORCE_INIT_OF_VARS")
# Note that some engines are always compiled in, MyISAM, MyISAMMRG and HEAP,
# these three plugin defintions are dummys for symmetry
SET(WITH_HEAP_STORAGE_ENGINE TRUE)
ADD_DEFINITIONS(-DWITH_HEAP_STORAGE_ENGINE)
SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_heap_plugin")
SET(WITH_MYISAM_STORAGE_ENGINE TRUE)
ADD_DEFINITIONS(-DWITH_MYISAM_STORAGE_ENGINE)
SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_myisam_plugin")
SET(WITH_MYISAMMRG_STORAGE_ENGINE TRUE)
ADD_DEFINITIONS(-DWITH_MYISAMMRG_STORAGE_ENGINE)
SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_myisammrg_plugin")
IF(WITH_COMMUNITY_FEATURES)
ADD_DEFINITIONS(-DENABLED_PROFILING -DCOMMUNITY_SERVER)
ENDIF(WITH_COMMUNITY_FEATURES)
IF(WITH_ARCHIVE_STORAGE_ENGINE)
ADD_DEFINITIONS(-DWITH_ARCHIVE_STORAGE_ENGINE)
SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_archive_plugin")
ENDIF(WITH_ARCHIVE_STORAGE_ENGINE)
IF(WITH_BLACKHOLE_STORAGE_ENGINE)
ADD_DEFINITIONS(-DWITH_BLACKHOLE_STORAGE_ENGINE)
SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_blackhole_plugin")
ENDIF(WITH_BLACKHOLE_STORAGE_ENGINE)
IF(WITH_CSV_STORAGE_ENGINE)
ADD_DEFINITIONS(-DWITH_CSV_STORAGE_ENGINE)
SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_csv_plugin")
ENDIF(WITH_CSV_STORAGE_ENGINE)
IF(WITH_EXAMPLE_STORAGE_ENGINE)
ADD_DEFINITIONS(-DWITH_EXAMPLE_STORAGE_ENGINE)
SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_example_plugin")
ENDIF(WITH_EXAMPLE_STORAGE_ENGINE)
IF(WITH_INNOBASE_STORAGE_ENGINE)
ADD_DEFINITIONS(-DWITH_INNOBASE_STORAGE_ENGINE)
SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_innobase_plugin")
ENDIF(WITH_INNOBASE_STORAGE_ENGINE)
IF(WITH_PARTITION_STORAGE_ENGINE)
ADD_DEFINITIONS(-DWITH_PARTITION_STORAGE_ENGINE)
SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_partition_plugin")
ENDIF(WITH_PARTITION_STORAGE_ENGINE)
IF(WITH_FEDERATED_STORAGE_ENGINE)
ADD_DEFINITIONS(-DWITH_FEDERATED_STORAGE_ENGINE)
SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_federated_plugin")
ENDIF(WITH_FEDERATED_STORAGE_ENGINE)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/sql/sql_builtin.cc.in
${CMAKE_SOURCE_DIR}/sql/sql_builtin.cc @ONLY)
SET(localstatedir "C:\\mysql\\data")
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/support-files/my-huge.cnf.sh
@ -95,9 +55,9 @@ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/support-files/my-medium.cnf.sh
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/support-files/my-small.cnf.sh
${CMAKE_SOURCE_DIR}/support-files/my-small.ini @ONLY)
IF(__NT__)
ADD_DEFINITIONS(-D__NT__)
ENDIF(__NT__)
ADD_DEFINITIONS(-D__NT__)
IF(CYBOZU)
ADD_DEFINITIONS(-DCYBOZU)
ENDIF(CYBOZU)
@ -126,6 +86,16 @@ IF(MSVC AND NOT CMAKE_GENERATOR MATCHES "Visual Studio 7")
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /wd4996")
ENDIF(MSVC AND NOT CMAKE_GENERATOR MATCHES "Visual Studio 7")
IF(CMAKE_GENERATOR MATCHES "Visual Studio 7")
# VS2003 has a bug that prevents linking mysqld with module definition file
# (/DEF option for linker). Linker would incorrectly complain about multiply
# defined symbols. Workaround is to disable dynamic plugins, so /DEF is not
# used.
MESSAGE("Warning: Building MySQL with Visual Studio 2003.NET is no more supported.")
MESSAGE("Please use a newer version of Visual Studio.")
SET(WITHOUT_DYNAMIC_PLUGINS TRUE)
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7")
# Settings for Visual Studio 7 and above.
IF(MSVC)
# replace /MDd with /MTd
@ -167,14 +137,19 @@ ENDIF(MSVC)
IF(WIN32)
ADD_DEFINITIONS("-D_WINDOWS -D__WIN__ -D_CRT_SECURE_NO_DEPRECATE")
ADD_DEFINITIONS("-D_WIN32_WINNT=0x0501")
ENDIF(WIN32)
# default to x86 platform. We'll check for X64 in a bit
SET (PLATFORM X86)
# This definition is necessary to work around a bug with Intellisense described
# here: http://tinyurl.com/2cb428. Syntax highlighting is important for proper
# debugger functionality.
IF(CMAKE_SIZEOF_VOID_P MATCHES 8)
MESSAGE(STATUS "Detected 64-bit platform.")
ADD_DEFINITIONS("-D_WIN64")
SET (PLATFORM X64)
ENDIF(CMAKE_SIZEOF_VOID_P MATCHES 8)
IF(EMBED_MANIFESTS)
@ -227,6 +202,81 @@ IF(EMBED_MANIFESTS)
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 8 2005 Win64")
ENDIF(EMBED_MANIFESTS)
# Figure out what engines to build and how (statically or dynamically),
# add preprocessor defines for storage engines.
IF(WITHOUT_DYNAMIC_PLUGINS)
MESSAGE("Dynamic plugins are disabled.")
ENDIF(WITHOUT_DYNAMIC_PLUGINS)
FILE(GLOB STORAGE_SUBDIRS storage/*)
FOREACH(SUBDIR ${STORAGE_SUBDIRS})
FILE(RELATIVE_PATH DIRNAME ${PROJECT_SOURCE_DIR}/storage ${SUBDIR})
STRING(TOUPPER ${DIRNAME} ENGINE)
STRING(TOLOWER ${DIRNAME} ENGINE_LOWER)
IF (EXISTS ${SUBDIR}/CMakeLists.txt)
# Check MYSQL_STORAGE_ENGINE macro is present
FILE(STRINGS ${SUBDIR}/CMakeLists.txt HAVE_STORAGE_ENGINE REGEX MYSQL_STORAGE_ENGINE)
IF(HAVE_STORAGE_ENGINE)
SET(ENGINE_BUILD_TYPE "DYNAMIC")
# Read plug.in to find out if a plugin is mandatory and whether it supports
# build as shared library (dynamic).
IF(EXISTS ${SUBDIR}/plug.in)
FILE(READ ${SUBDIR}/plug.in PLUGIN_FILE_CONTENT)
STRING (REGEX MATCH "MYSQL_PLUGIN_DYNAMIC" MYSQL_PLUGIN_DYNAMIC ${PLUGIN_FILE_CONTENT})
STRING (REGEX MATCH "MYSQL_PLUGIN_MANDATORY" MYSQL_PLUGIN_MANDATORY ${PLUGIN_FILE_CONTENT})
STRING (REGEX MATCH "MYSQL_PLUGIN_STATIC" MYSQL_PLUGIN_STATIC ${PLUGIN_FILE_CONTENT})
IF(MYSQL_PLUGIN_MANDATORY)
SET(WITH_${ENGINE}_STORAGE_ENGINE TRUE)
ENDIF(MYSQL_PLUGIN_MANDATORY)
IF (WITH_${ENGINE}_STORAGE_ENGINE AND MYSQL_PLUGIN_STATIC)
SET(ENGINE_BUILD_TYPE "STATIC")
ELSEIF(NOT WITHOUT_${ENGINE}_STORAGE_ENGINE AND MYSQL_PLUGIN_DYNAMIC AND NOT WITHOUT_DYNAMIC_PLUGINS)
SET(ENGINE_BUILD_TYPE "DYNAMIC")
ELSE(WITH_${ENGINE}_STORAGE_ENGINE AND MYSQL_PLUGIN_STATIC)
SET(ENGINE_BUILD_TYPE "NONE")
ENDIF(WITH_${ENGINE}_STORAGE_ENGINE AND MYSQL_PLUGIN_STATIC)
IF (ENGINE_BUILD_TYPE STREQUAL "STATIC")
SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_${ENGINE_LOWER}_plugin")
SET (MYSQLD_STATIC_ENGINE_LIBS ${MYSQLD_STATIC_ENGINE_LIBS} ${ENGINE_LOWER})
SET (STORAGE_ENGINE_DEFS "${STORAGE_ENGINE_DEFS} -DWITH_${ENGINE}_STORAGE_ENGINE")
SET (WITH_${ENGINE}_STORAGE_ENGINE TRUE)
ENDIF (ENGINE_BUILD_TYPE STREQUAL "STATIC")
ENDIF(EXISTS ${SUBDIR}/plug.in)
IF(NOT ENGINE_BUILD_TYPE STREQUAL "NONE")
LIST(APPEND ${ENGINE_BUILD_TYPE}_ENGINE_DIRECTORIES ${SUBDIR})
ENDIF(NOT ENGINE_BUILD_TYPE STREQUAL "NONE")
ENDIF(HAVE_STORAGE_ENGINE)
ENDIF(EXISTS ${SUBDIR}/CMakeLists.txt)
ENDFOREACH(SUBDIR ${STORAGE_SUBDIRS})
# Special handling for partition(not really pluggable)
IF(NOT WITHOUT_PARTITION_STORAGE_ENGINE)
SET (STORAGE_ENGINE_DEFS "${STORAGE_ENGINE_DEFS} -DWITH_PARTITION_STORAGE_ENGINE")
SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_partition_plugin")
ENDIF(NOT WITHOUT_PARTITION_STORAGE_ENGINE)
ADD_DEFINITIONS(${STORAGE_ENGINE_DEFS})
# Now write out our mysql_plugin_defs struct
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/sql/sql_builtin.cc.in
${CMAKE_SOURCE_DIR}/sql/sql_builtin.cc @ONLY)
# Add subdirectories for storage engines
SET (ENGINE_BUILD_TYPE "STATIC")
FOREACH(DIR ${STATIC_ENGINE_DIRECTORIES})
ADD_SUBDIRECTORY(${DIR})
ENDFOREACH(DIR ${STATIC_ENGINE_DIRECTORIES})
SET (ENGINE_BUILD_TYPE "DYNAMIC")
FOREACH(DIR ${DYNAMIC_ENGINE_DIRECTORIES})
ADD_SUBDIRECTORY(${DIR})
ENDFOREACH(DIR ${DYNAMIC_ENGINE_DIRECTORIES})
# FIXME "debug" only needed if build type is "Debug", but
# CMAKE_BUILD_TYPE is not set during configure time.
ADD_SUBDIRECTORY(vio)
@ -239,28 +289,7 @@ ADD_SUBDIRECTORY(zlib)
ADD_SUBDIRECTORY(extra/yassl)
ADD_SUBDIRECTORY(extra/yassl/taocrypt)
ADD_SUBDIRECTORY(extra)
ADD_SUBDIRECTORY(storage/heap)
ADD_SUBDIRECTORY(storage/myisam)
ADD_SUBDIRECTORY(storage/myisammrg)
ADD_SUBDIRECTORY(client)
IF(WITH_ARCHIVE_STORAGE_ENGINE)
ADD_SUBDIRECTORY(storage/archive)
ENDIF(WITH_ARCHIVE_STORAGE_ENGINE)
IF(WITH_BLACKHOLE_STORAGE_ENGINE)
ADD_SUBDIRECTORY(storage/blackhole)
ENDIF(WITH_BLACKHOLE_STORAGE_ENGINE)
IF(WITH_CSV_STORAGE_ENGINE)
ADD_SUBDIRECTORY(storage/csv)
ENDIF(WITH_CSV_STORAGE_ENGINE)
IF(WITH_EXAMPLE_STORAGE_ENGINE)
ADD_SUBDIRECTORY(storage/example)
ENDIF(WITH_EXAMPLE_STORAGE_ENGINE)
IF(WITH_FEDERATED_STORAGE_ENGINE)
ADD_SUBDIRECTORY(storage/federated)
ENDIF(WITH_FEDERATED_STORAGE_ENGINE)
IF(WITH_INNOBASE_STORAGE_ENGINE)
ADD_SUBDIRECTORY(storage/innobase)
ENDIF(WITH_INNOBASE_STORAGE_ENGINE)
ADD_SUBDIRECTORY(sql)
ADD_SUBDIRECTORY(server-tools/instance-manager)
ADD_SUBDIRECTORY(libmysql)

1249
README

File diff suppressed because it is too large Load diff

View file

@ -71,7 +71,7 @@ mysqldump_SOURCES= mysqldump.c \
$(top_srcdir)/mysys/mf_getdate.c
mysqlimport_SOURCES= mysqlimport.c
mysqlimport_CFLAGS= -DTHREAD -UUNDEF_THREADS_HACK
mysqlimport_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
@CLIENT_EXTRA_LDFLAGS@ \
$(LIBMYSQLCLIENT_LA) \
@ -80,14 +80,14 @@ mysqlimport_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
mysqlshow_SOURCES= mysqlshow.c
mysqlslap_SOURCES= mysqlslap.c
mysqlslap_CFLAGS= -DTHREAD -UUNDEF_THREADS_HACK
mysqlslap_CFLAGS= -DTHREAD -UMYSQL_CLIENT_NO_THREADS
mysqlslap_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
@CLIENT_EXTRA_LDFLAGS@ \
$(LIBMYSQLCLIENT_LA) \
$(top_builddir)/mysys/libmysys.a
mysqltest_SOURCES= mysqltest.cc
mysqltest_CXXFLAGS= -DTHREAD -UUNDEF_THREADS_HACK
mysqltest_CXXFLAGS= -DTHREAD -UMYSQL_CLIENT_NO_THREADS
mysqltest_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
@CLIENT_EXTRA_LDFLAGS@ \
$(LIBMYSQLCLIENT_LA) \
@ -99,9 +99,9 @@ mysql_upgrade_SOURCES= mysql_upgrade.c \
$(top_srcdir)/mysys/my_getpagesize.c
# Fix for mit-threads
DEFS = -DUNDEF_THREADS_HACK \
DEFS = -DMYSQL_CLIENT_NO_THREADS \
-DDEFAULT_MYSQL_HOME="\"$(prefix)\"" \
-DDATADIR="\"$(localstatedir)\""
-DMYSQL_DATADIR="\"$(localstatedir)\""
sql_src=log_event.h mysql_priv.h rpl_constants.h \
rpl_utility.h rpl_tblmap.h rpl_tblmap.cc \

View file

@ -86,7 +86,7 @@ extern "C" {
#endif
#undef bcmp // Fix problem with new readline
#if defined( __WIN__)
#if defined(__WIN__)
#include <conio.h>
#elif !defined(__NETWARE__)
#include <readline/readline.h>
@ -106,7 +106,7 @@ extern "C" {
#define cmp_database(cs,A,B) strcmp((A),(B))
#endif
#if !defined( __WIN__) && !defined(__NETWARE__) && !defined(THREAD)
#if !defined(__WIN__) && !defined(__NETWARE__) && !defined(THREAD)
#define USE_POPEN
#endif
@ -115,7 +115,7 @@ extern "C" {
#define PROMPT_CHAR '\\'
#define DEFAULT_DELIMITER ";"
#define MAX_BATCH_BUFFER_SIZE (1024L * 1024L)
#define MAX_BATCH_BUFFER_SIZE (1024L * 1024L * 1024L)
typedef struct st_status
{
@ -170,6 +170,8 @@ static const char *xmlmeta[] = {
"<", "&lt;",
">", "&gt;",
"\"", "&quot;",
/* Turn \0 into a space. Why not &#0;? That's not valid XML or HTML. */
"\0", " ",
0, 0
};
static const char *day_names[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
@ -1860,7 +1862,7 @@ static int read_and_execute(bool interactive)
if (opt_outfile && glob_buffer.is_empty())
fflush(OUTFILE);
#if defined( __WIN__) || defined(__NETWARE__)
#if defined(__WIN__) || defined(__NETWARE__)
tee_fputs(prompt, stdout);
#if defined(__NETWARE__)
line=fgets(linebuffer, sizeof(linebuffer)-1, stdin);
@ -1871,7 +1873,7 @@ static int read_and_execute(bool interactive)
if (p != NULL)
*p = '\0';
}
#else defined(__WIN__)
#else
if (!tmpbuf.is_alloced())
tmpbuf.alloc(65535);
tmpbuf.length(0);
@ -1897,7 +1899,7 @@ static int read_and_execute(bool interactive)
if (opt_outfile)
fputs(prompt, OUTFILE);
line= readline(prompt);
#endif /* defined( __WIN__) || defined(__NETWARE__) */
#endif /* defined(__WIN__) || defined(__NETWARE__) */
/*
When Ctrl+d or Ctrl+z is pressed, the line may be NULL on some OS
@ -1945,10 +1947,10 @@ static int read_and_execute(bool interactive)
}
}
#if defined( __WIN__) || defined(__NETWARE__)
#if defined(__WIN__) || defined(__NETWARE__)
buffer.free();
#endif
#if defined( __WIN__)
#if defined(__WIN__)
tmpbuf.free();
#endif
@ -2004,7 +2006,7 @@ static COMMANDS *find_command(char *name,char cmd_char)
(uchar*)commands[i].name,len) &&
!commands[i].name[len] &&
(!end || (end && commands[i].takes_params))) ||
!name && commands[i].cmd_char == cmd_char))
(!name && commands[i].cmd_char == cmd_char)))
{
DBUG_PRINT("exit",("found command: %s", commands[i].name));
DBUG_RETURN(&commands[i]);
@ -2163,7 +2165,7 @@ static bool add_line(String &buffer,char *line,char *in_string,
buffer.length(0);
}
else if (!*ml_comment && (!*in_string && (inchar == '#' ||
inchar == '-' && pos[1] == '-' &&
(inchar == '-' && pos[1] == '-' &&
/*
The third byte is either whitespace or is the
end of the line -- which would occur only
@ -2171,7 +2173,7 @@ static bool add_line(String &buffer,char *line,char *in_string,
itself whitespace and should also match.
*/
(my_isspace(charset_info,pos[2]) ||
!pos[2]))))
!pos[2])))))
{
// Flush previously accepted characters
if (out != line)
@ -2302,8 +2304,10 @@ extern "C" char **new_mysql_completion (const char *text, int start, int end);
*/
#if defined(USE_NEW_READLINE_INTERFACE)
static int fake_magic_space(int, int);
extern "C" char *no_completion(const char*,int)
#elif defined(USE_LIBEDIT_INTERFACE)
static int fake_magic_space(const char *, int);
extern "C" int no_completion(const char*,int)
#else
extern "C" char *no_completion()
@ -2380,6 +2384,18 @@ static int not_in_history(const char *line)
return 1;
}
#if defined(USE_NEW_READLINE_INTERFACE)
static int fake_magic_space(int, int)
#else
static int fake_magic_space(const char *, int)
#endif
{
rl_insert(1, ' ');
return 0;
}
static void initialize_readline (char *name)
{
/* Allow conditional parsing of the ~/.inputrc file. */
@ -2389,12 +2405,15 @@ static void initialize_readline (char *name)
#if defined(USE_NEW_READLINE_INTERFACE)
rl_attempted_completion_function= (rl_completion_func_t*)&new_mysql_completion;
rl_completion_entry_function= (rl_compentry_func_t*)&no_completion;
rl_add_defun("magic-space", (rl_command_func_t *)&fake_magic_space, -1);
#elif defined(USE_LIBEDIT_INTERFACE)
#ifdef HAVE_LOCALE_H
setlocale(LC_ALL,""); /* so as libedit use isprint */
#endif
rl_attempted_completion_function= (CPPFunction*)&new_mysql_completion;
rl_completion_entry_function= &no_completion;
rl_add_defun("magic-space", (Function*)&fake_magic_space, -1);
#else
rl_attempted_completion_function= (CPPFunction*)&new_mysql_completion;
rl_completion_entry_function= &no_completion;
@ -2732,7 +2751,7 @@ static int com_server_help(String *buffer __attribute__((unused)),
{
MYSQL_ROW cur;
const char *server_cmd= buffer->ptr();
char cmd_buf[100];
char cmd_buf[100 + 1];
MYSQL_RES *result;
int error;
@ -3308,6 +3327,9 @@ print_table_data(MYSQL_RES *result)
uint visible_length;
uint extra_padding;
if (off)
(void) tee_fputs(" ", PAGER);
if (cur[off] == NULL)
{
buffer= "NULL";
@ -3342,7 +3364,7 @@ print_table_data(MYSQL_RES *result)
else
tee_print_sized_data(buffer, data_length, field_max_length+extra_padding, FALSE);
}
tee_fputs(" | ", PAGER);
tee_fputs(" |", PAGER);
}
(void) tee_fputs("\n", PAGER);
}
@ -3482,11 +3504,29 @@ print_table_data_vertically(MYSQL_RES *result)
mysql_field_seek(result,0);
tee_fprintf(PAGER,
"*************************** %d. row ***************************\n", row_count);
ulong *lengths= mysql_fetch_lengths(result);
for (uint off=0; off < mysql_num_fields(result); off++)
{
field= mysql_fetch_field(result);
tee_fprintf(PAGER, "%*s: ",(int) max_length,field->name);
tee_fprintf(PAGER, "%s\n",cur[off] ? (char*) cur[off] : "NULL");
if (cur[off])
{
unsigned int i;
const char *p;
for (i= 0, p= cur[off]; i < lengths[off]; i+= 1, p+= 1)
{
if (*p == '\0')
tee_putc((int)' ', PAGER);
else
tee_putc((int)*p, PAGER);
}
tee_putc('\n', PAGER);
}
else
tee_fprintf(PAGER, "NULL\n");
}
}
}
@ -3521,7 +3561,7 @@ static void print_warnings()
messages. To be safe, skip printing the duplicate only if it is the only
warning.
*/
if (!cur || num_rows == 1 && error == (uint) strtoul(cur[1], NULL, 10))
if (!cur || (num_rows == 1 && error == (uint) strtoul(cur[1], NULL, 10)))
goto end;
/* Print the warnings */
@ -3553,7 +3593,7 @@ xmlencode_print(const char *src, uint length)
tee_fputs("NULL", PAGER);
else
{
for (const char *p = src; *p && length; *p++, length--)
for (const char *p = src; length; *p++, length--)
{
const char *t;
if ((t = array_value(xmlmeta, *p)))
@ -3573,7 +3613,12 @@ safe_put_field(const char *pos,ulong length)
else
{
if (opt_raw_data)
tee_fputs(pos, PAGER);
{
unsigned long i;
/* Can't use tee_fputs(), it stops with NUL characters. */
for (i= 0; i < length; i++, pos++)
tee_putc(*pos, PAGER);
}
else for (const char *end=pos+length ; pos != end ; pos++)
{
#ifdef USE_MB
@ -3774,7 +3819,8 @@ com_edit(String *buffer,char *line __attribute__((unused)))
!(editor = (char *)getenv("VISUAL")))
editor = "vi";
strxmov(buff,editor," ",filename,NullS);
(void) system(buff);
if(system(buff) == -1)
goto err;
MY_STAT stat_arg;
if (!my_stat(filename,&stat_arg,MYF(MY_WME)))
@ -4264,41 +4310,36 @@ com_status(String *buffer __attribute__((unused)),
MYSQL_RES *result;
LINT_INIT(result);
if (mysql_real_query_for_lazy(
C_STRING_WITH_LEN("select DATABASE(), USER() limit 1")))
return 0;
tee_puts("--------------", stdout);
usage(1); /* Print version */
if (connected)
tee_fprintf(stdout, "\nConnection id:\t\t%lu\n",mysql_thread_id(&mysql));
/*
Don't remove "limit 1",
it is protection againts SQL_SELECT_LIMIT=0
*/
if (mysql_store_result_for_lazy(&result))
{
tee_fprintf(stdout, "\nConnection id:\t\t%lu\n",mysql_thread_id(&mysql));
/*
Don't remove "limit 1",
it is protection againts SQL_SELECT_LIMIT=0
*/
if (!mysql_query(&mysql,"select DATABASE(), USER() limit 1") &&
(result=mysql_use_result(&mysql)))
MYSQL_ROW cur=mysql_fetch_row(result);
if (cur)
{
MYSQL_ROW cur=mysql_fetch_row(result);
if (cur)
{
tee_fprintf(stdout, "Current database:\t%s\n", cur[0] ? cur[0] : "");
tee_fprintf(stdout, "Current user:\t\t%s\n", cur[1]);
}
mysql_free_result(result);
}
tee_fprintf(stdout, "Current database:\t%s\n", cur[0] ? cur[0] : "");
tee_fprintf(stdout, "Current user:\t\t%s\n", cur[1]);
}
mysql_free_result(result);
}
#ifdef HAVE_OPENSSL
if ((status_str= mysql_get_ssl_cipher(&mysql)))
tee_fprintf(stdout, "SSL:\t\t\tCipher in use is %s\n",
status_str);
else
#endif /* HAVE_OPENSSL */
tee_puts("SSL:\t\t\tNot in use", stdout);
}
if ((status_str= mysql_get_ssl_cipher(&mysql)))
tee_fprintf(stdout, "SSL:\t\t\tCipher in use is %s\n",
status_str);
else
{
vidattr(A_BOLD);
tee_fprintf(stdout, "\nNo connection\n");
vidattr(A_NORMAL);
return 0;
}
#endif /* HAVE_OPENSSL */
tee_puts("SSL:\t\t\tNot in use", stdout);
if (skip_updates)
{
vidattr(A_BOLD);
@ -4317,8 +4358,14 @@ com_status(String *buffer __attribute__((unused)),
tee_fprintf(stdout, "Insert id:\t\t%s\n", llstr(id, buff));
/* "limit 1" is protection against SQL_SELECT_LIMIT=0 */
if (!mysql_query(&mysql,"select @@character_set_client, @@character_set_connection, @@character_set_server, @@character_set_database limit 1") &&
(result=mysql_use_result(&mysql)))
if (mysql_real_query_for_lazy(C_STRING_WITH_LEN(
"select @@character_set_client, @@character_set_connection, "
"@@character_set_server, @@character_set_database limit 1")))
{
if (mysql_errno(&mysql) == CR_SERVER_GONE_ERROR)
return 0;
}
if (mysql_store_result_for_lazy(&result))
{
MYSQL_ROW cur=mysql_fetch_row(result);
if (cur)
@ -4556,7 +4603,7 @@ void tee_putc(int c, FILE *file)
putc(c, OUTFILE);
}
#if defined( __WIN__) || defined(__NETWARE__)
#if defined(__WIN__) || defined(__NETWARE__)
#include <time.h>
#else
#include <sys/times.h>
@ -4568,7 +4615,7 @@ void tee_putc(int c, FILE *file)
static ulong start_timer(void)
{
#if defined( __WIN__) || defined(__NETWARE__)
#if defined(__WIN__) || defined(__NETWARE__)
return clock();
#else
struct tms tms_tmp;

View file

@ -54,6 +54,8 @@ static char **defaults_argv;
static my_bool not_used; /* Can't use GET_BOOL without a value pointer */
static my_bool opt_write_binlog;
#include <help_start.h>
static struct my_option my_long_options[]=
@ -124,6 +126,11 @@ static struct my_option my_long_options[]=
{"verbose", 'v', "Display more output about the process",
(uchar**) &opt_verbose, (uchar**) &opt_verbose, 0,
GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"write-binlog", OPT_WRITE_BINLOG,
"All commands including mysqlcheck are binlogged. Enabled by default;"
"use --skip-write-binlog when commands should not be sent to replication slaves.",
(uchar**) &opt_write_binlog, (uchar**) &opt_write_binlog, 0, GET_BOOL, NO_ARG,
1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@ -253,8 +260,12 @@ get_one_option(int optid, const struct my_option *opt,
break;
case 'b': /* --basedir */
case 'v': /* --verbose */
case 'd': /* --datadir */
fprintf(stderr, "%s: the '--%s' option is always ignored\n",
my_progname, optid == 'b' ? "basedir" : "datadir");
/* FALLTHROUGH */
case 'v': /* --verbose */
case 'f': /* --force */
add_option= FALSE;
break;
@ -444,6 +455,8 @@ static int run_query(const char *query, DYNAMIC_STRING *ds_res,
int ret;
File fd;
char query_file_path[FN_REFLEN];
const uchar sql_log_bin[]= "SET SQL_LOG_BIN=0;";
DBUG_ENTER("run_query");
DBUG_PRINT("enter", ("query: %s", query));
if ((fd= create_temp_file(query_file_path, opt_tmpdir,
@ -451,6 +464,22 @@ static int run_query(const char *query, DYNAMIC_STRING *ds_res,
MYF(MY_WME))) < 0)
die("Failed to create temporary file for defaults");
/*
Master and slave should be upgraded separately. All statements executed
by mysql_upgrade will not be binlogged.
'SET SQL_LOG_BIN=0' is executed before any other statements.
*/
if (!opt_write_binlog)
{
if (my_write(fd, sql_log_bin, sizeof(sql_log_bin)-1,
MYF(MY_FNABP | MY_WME)))
{
my_close(fd, MYF(0));
my_delete(query_file_path, MYF(0));
die("Failed to write to '%s'", query_file_path);
}
}
if (my_write(fd, (uchar*) query, strlen(query),
MYF(MY_FNABP | MY_WME)))
{
@ -548,6 +577,7 @@ static int upgrade_already_done(void)
FILE *in;
char upgrade_info_file[FN_REFLEN]= {0};
char buf[sizeof(MYSQL_SERVER_VERSION)+1];
char *res;
if (get_upgrade_info_file_name(upgrade_info_file))
return 0; /* Could not get filename => not sure */
@ -560,7 +590,7 @@ static int upgrade_already_done(void)
will be detected by the strncmp
*/
bzero(buf, sizeof(buf));
fgets(buf, sizeof(buf), in);
res= fgets(buf, sizeof(buf), in);
my_fclose(in, MYF(0));
@ -643,6 +673,7 @@ static int run_mysqlcheck_upgrade(void)
"--check-upgrade",
"--all-databases",
"--auto-repair",
opt_write_binlog ? "--write-binlog" : "--skip-write-binlog",
NULL);
}
@ -657,6 +688,7 @@ static int run_mysqlcheck_fixnames(void)
"--all-databases",
"--fix-db-names",
"--fix-table-names",
opt_write_binlog ? "--write-binlog" : "--skip-write-binlog",
NULL);
}

View file

@ -22,9 +22,10 @@
#endif
#include <sys/stat.h>
#include <mysql.h>
#include <sql_common.h>
#define ADMIN_VERSION "8.42"
#define MAX_MYSQL_VAR 256
#define MAX_MYSQL_VAR 512
#define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */
#define MAX_TRUNC_LENGTH 3
@ -353,6 +354,11 @@ int main(int argc,char *argv[])
if (sql_connect(&mysql, option_wait))
{
/*
We couldn't get an initial connection and will definitely exit.
The following just determines the exit-code we'll give.
*/
unsigned int err= mysql_errno(&mysql);
if (err >= CR_MIN_ERROR && err <= CR_MAX_ERROR)
error= 1;
@ -371,41 +377,79 @@ int main(int argc,char *argv[])
}
else
{
/*
--count=0 aborts right here. Otherwise iff --sleep=t ("interval")
is given a t!=0, we get an endless loop, or n iterations if --count=n
was given an n!=0. If --sleep wasn't given, we get one iteration.
To wit, --wait loops the connection-attempts, while --sleep loops
the command execution (endlessly if no --count is given).
*/
while (!interrupted && (!opt_count_iterations || nr_iterations))
{
new_line = 0;
if ((error=execute_commands(&mysql,argc,commands)))
if ((error= execute_commands(&mysql,argc,commands)))
{
/*
Unknown/malformed command always aborts and can't be --forced.
If the user got confused about the syntax, proceeding would be
dangerous ...
*/
if (error > 0)
break; /* Wrong command error */
if (!option_force)
break;
/*
Command was well-formed, but failed on the server. Might succeed
on retry (if conditions on server change etc.), but needs --force
to retry.
*/
if (!option_force)
break;
} /* if((error= ... */
if (interval) /* --sleep=interval given */
{
/*
If connection was dropped (unintentionally, or due to SHUTDOWN),
re-establish it if --wait ("retry-connect") was given and user
didn't signal for us to die. Otherwise, signal failure.
*/
if (mysql.net.vio == 0)
{
if (option_wait && !interrupted)
{
mysql_close(&mysql);
if (!sql_connect(&mysql, option_wait))
{
sleep(1); /* Don't retry too rapidly */
continue; /* Retry */
}
sleep(1);
sql_connect(&mysql, option_wait);
/*
continue normally and decrease counters so that
"mysqladmin --count=1 --wait=1 shutdown"
cannot loop endlessly.
*/
}
error=1;
break;
}
}
if (interval)
{
else
{
/*
connexion broke, and we have no order to re-establish it. fail.
*/
if (!option_force)
error= 1;
break;
}
} /* lost connection */
sleep(interval);
if (new_line)
puts("");
if (opt_count_iterations)
nr_iterations--;
}
else
break;
}
mysql_close(&mysql);
}
break; /* no --sleep, done looping */
} /* command-loop */
} /* got connection */
mysql_close(&mysql);
my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
my_free(user,MYF(MY_ALLOW_ZERO_PTR));
#ifdef HAVE_SMEM
@ -423,6 +467,17 @@ sig_handler endprog(int signal_number __attribute__((unused)))
interrupted=1;
}
/**
@brief connect to server, optionally waiting for same to come up
@param mysql connection struct
@param wait wait for server to come up?
(0: no, ~0: forever, n: cycles)
@return Operation result
@retval 0 success
@retval 1 failure
*/
static my_bool sql_connect(MYSQL *mysql, uint wait)
{
@ -431,7 +486,7 @@ static my_bool sql_connect(MYSQL *mysql, uint wait)
for (;;)
{
if (mysql_real_connect(mysql,host,user,opt_password,NullS,tcp_port,
unix_port, 0))
unix_port, CLIENT_REMEMBER_OPTIONS))
{
mysql->reconnect= 1;
if (info)
@ -442,9 +497,9 @@ static my_bool sql_connect(MYSQL *mysql, uint wait)
return 0;
}
if (!wait)
if (!wait) // was or reached 0, fail
{
if (!option_silent)
if (!option_silent) // print diagnostics
{
if (!host)
host= (char*) LOCAL_HOST;
@ -468,11 +523,18 @@ static my_bool sql_connect(MYSQL *mysql, uint wait)
}
return 1;
}
if (wait != (uint) ~0)
wait--; /* One less retry */
wait--; /* count down, one less retry */
if ((mysql_errno(mysql) != CR_CONN_HOST_ERROR) &&
(mysql_errno(mysql) != CR_CONNECTION_ERROR))
{
/*
Error is worse than "server doesn't answer (yet?)";
fail even if we still have "wait-coins" unless --force
was also given.
*/
fprintf(stderr,"Got error: %s\n", mysql_error(mysql));
if (!option_force)
return 1;
@ -496,11 +558,18 @@ static my_bool sql_connect(MYSQL *mysql, uint wait)
}
/*
Execute a command.
Return 0 on ok
-1 on retryable error
1 on fatal error
/**
@brief Execute all commands
@details We try to execute all commands we were given, in the order
given, but return with non-zero as soon as we encounter trouble.
By that token, individual commands can be considered a conjunction
with boolean short-cut.
@return success?
@retval 0 Yes! ALL commands worked!
@retval 1 No, one failed and will never work (malformed): fatal error!
@retval -1 No, one failed on the server, may work next time!
*/
static int execute_commands(MYSQL *mysql,int argc, char **argv)
@ -570,7 +639,6 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
mysql_error(mysql));
return -1;
}
mysql_close(mysql); /* Close connection to avoid error messages */
argc=1; /* force SHUTDOWN to be the last command */
if (got_pidfile)
{
@ -743,6 +811,9 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
mysql_error(mysql));
return -1;
}
DBUG_ASSERT(mysql_num_rows(res) < MAX_MYSQL_VAR);
if (!opt_vertical)
print_header(res);
else
@ -1033,14 +1104,16 @@ static void usage(void)
static int drop_db(MYSQL *mysql, const char *db)
{
char name_buff[FN_REFLEN+20], buf[10];
char *input;
if (!option_force)
{
puts("Dropping the database is potentially a very bad thing to do.");
puts("Any data stored in the database will be destroyed.\n");
printf("Do you really want to drop the '%s' database [y/N] ",db);
fflush(stdout);
VOID(fgets(buf,sizeof(buf)-1,stdin));
if ((*buf != 'y') && (*buf != 'Y'))
input= fgets(buf, sizeof(buf)-1, stdin);
if (!input || ((*input != 'y') && (*input != 'Y')))
{
puts("\nOK, aborting database drop!");
return -1;

View file

@ -17,10 +17,8 @@
TODO: print the catalog (some USE catalog.db ????).
Standalone program to read a MySQL binary log (or relay log);
can read files produced by 3.23, 4.x, 5.0 servers.
Standalone program to read a MySQL binary log (or relay log).
Can read binlogs from 3.23/4.x/5.0 and relay logs from 4.x/5.0.
Should be able to read any file of these categories, even with
--start-position.
An important fact: the Format_desc event of the log is at most the 3rd event
@ -681,6 +679,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
{
char ll_buff[21];
Log_event_type ev_type= ev->get_type_code();
my_bool destroy_evt= TRUE;
DBUG_ENTER("process_event");
print_event_info->short_form= short_form;
Exit_status retval= OK_CONTINUE;
@ -689,8 +688,8 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
Format events are not concerned by --offset and such, we always need to
read them to be able to process the wanted events.
*/
if ((rec_count >= offset) &&
((my_time_t)(ev->when) >= start_datetime) ||
if (((rec_count >= offset) &&
((my_time_t)(ev->when) >= start_datetime)) ||
(ev_type == FORMAT_DESCRIPTION_EVENT))
{
if (ev_type != FORMAT_DESCRIPTION_EVENT)
@ -871,12 +870,63 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
break;
}
case TABLE_MAP_EVENT:
{
Table_map_log_event *map= ((Table_map_log_event *)ev);
if (shall_skip_database(map->get_db_name()))
{
print_event_info->m_table_map_ignored.set_table(map->get_table_id(), map);
destroy_evt= FALSE;
goto end;
}
}
case WRITE_ROWS_EVENT:
case DELETE_ROWS_EVENT:
case UPDATE_ROWS_EVENT:
case PRE_GA_WRITE_ROWS_EVENT:
case PRE_GA_DELETE_ROWS_EVENT:
case PRE_GA_UPDATE_ROWS_EVENT:
{
if (ev_type != TABLE_MAP_EVENT)
{
Rows_log_event *e= (Rows_log_event*) ev;
Table_map_log_event *ignored_map=
print_event_info->m_table_map_ignored.get_table(e->get_table_id());
bool skip_event= (ignored_map != NULL);
/*
end of statement check:
i) destroy/free ignored maps
ii) if skip event, flush cache now
*/
if (e->get_flags(Rows_log_event::STMT_END_F))
{
/*
Now is safe to clear ignored map (clear_tables will also
delete original table map events stored in the map).
*/
if (print_event_info->m_table_map_ignored.count() > 0)
print_event_info->m_table_map_ignored.clear_tables();
/*
One needs to take into account an event that gets
filtered but was last event in the statement. If this is
the case, previous rows events that were written into
IO_CACHEs still need to be copied from cache to
result_file (as it would happen in ev->print(...) if
event was not skipped).
*/
if (skip_event)
{
if ((copy_event_cache_to_file_and_reinit(&print_event_info->head_cache, result_file) ||
copy_event_cache_to_file_and_reinit(&print_event_info->body_cache, result_file)))
goto err;
}
}
/* skip the event check */
if (skip_event)
goto end;
}
/*
These events must be printed in base64 format, if printed.
base64 format requires a FD event to be safe, so if no FD
@ -900,6 +950,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
goto err;
}
/* FALL THROUGH */
}
default:
ev->print(result_file, print_event_info);
}
@ -919,7 +970,8 @@ end:
{
if (remote_opt)
ev->temp_buf= 0;
delete ev;
if (destroy_evt) /* destroy it later if not set (ignored table map) */
delete ev;
}
DBUG_RETURN(retval);
}
@ -934,10 +986,13 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"base64-output", OPT_BASE64_OUTPUT_MODE,
/* 'unspec' is not mentioned because it is just a placeholder. */
"Determine when the output statements should be base64-encoded BINLOG "
"statements: 'never' disables it and works only for binlogs without "
"row-based events; 'auto' is the default and prints base64 only when "
"necessary (i.e., for row-based events and format description events); "
"'decode-rows' suppresses BINLOG statements for row events, but does "
"not exit as an error if a row event is found, unlike 'never'; "
"'always' prints base64 whenever possible. 'always' is for debugging "
"only and should not be used in a production system. The default is "
"'auto'. --base64-output is a short form for --base64-output=always."

View file

@ -442,7 +442,7 @@ static int process_selected_tables(char *db, char **table_names, int tables)
{
if (use_db(db))
return 1;
if (opt_all_in_1)
if (opt_all_in_1 && what_to_do != DO_UPGRADE)
{
/*
We need table list in form `a`, `b`, `c`
@ -536,7 +536,7 @@ static int process_all_tables_in_db(char *database)
num_columns= mysql_num_fields(res);
if (opt_all_in_1)
if (opt_all_in_1 && what_to_do != DO_UPGRADE)
{
/*
We need table list in form `a`, `b`, `c`
@ -652,6 +652,17 @@ static int use_db(char *database)
return 0;
} /* use_db */
static int disable_binlog()
{
const char *stmt= "SET SQL_LOG_BIN=0";
if (mysql_query(sock, stmt))
{
fprintf(stderr, "Failed to %s\n", stmt);
fprintf(stderr, "Error: %s\n", mysql_error(sock));
return 1;
}
return 0;
}
static int handle_request_for_tables(char *tables, uint length)
{
@ -844,6 +855,14 @@ int main(int argc, char **argv)
if (dbConnect(current_host, current_user, opt_password))
exit(EX_MYSQLERR);
if (!opt_write_binlog)
{
if (disable_binlog()) {
first_error= 1;
goto end;
}
}
if (opt_auto_repair &&
my_init_dynamic_array(&tables4repair, sizeof(char)*(NAME_LEN*2+2),16,64))
{

View file

@ -3137,6 +3137,12 @@ static void dump_table(char *table, char *db)
dynstr_append_checked(&query_string, filename);
dynstr_append_checked(&query_string, "'");
dynstr_append_checked(&query_string, " /*!50138 CHARACTER SET ");
dynstr_append_checked(&query_string, default_charset == mysql_universal_client_charset ?
my_charset_bin.name : /* backward compatibility */
default_charset);
dynstr_append_checked(&query_string, " */");
if (fields_terminated || enclosed || opt_enclosed || escaped)
dynstr_append_checked(&query_string, " FIELDS");
@ -3821,6 +3827,10 @@ static int dump_all_databases()
return 1;
while ((row= mysql_fetch_row(tableres)))
{
if (mysql_get_server_version(mysql) >= 50003 &&
!my_strcasecmp(&my_charset_latin1, row[0], "information_schema"))
continue;
if (dump_all_tables_in_db(row[0]))
result=1;
}
@ -3835,6 +3845,10 @@ static int dump_all_databases()
}
while ((row= mysql_fetch_row(tableres)))
{
if (mysql_get_server_version(mysql) >= 50003 &&
!my_strcasecmp(&my_charset_latin1, row[0], "information_schema"))
continue;
if (dump_all_views_in_db(row[0]))
result=1;
}
@ -3941,10 +3955,6 @@ int init_dumping_tables(char *qdatabase)
static int init_dumping(char *database, int init_func(char*))
{
if (mysql_get_server_version(mysql) >= 50003 &&
!my_strcasecmp(&my_charset_latin1, database, "information_schema"))
return 1;
if (mysql_select_db(mysql, database))
{
DB_error(mysql, "when selecting the database");
@ -4003,6 +4013,7 @@ static int dump_all_tables_in_db(char *database)
DBUG_RETURN(1);
if (opt_xml)
print_xml_tag(md_result_file, "", "\n", "database", "name=", database, NullS);
if (lock_tables)
{
DYNAMIC_STRING query;
@ -4236,7 +4247,10 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
}
end= pos;
if (lock_tables)
/* Can't LOCK TABLES in INFORMATION_SCHEMA, so don't try. */
if (lock_tables &&
!(mysql_get_server_version(mysql) >= 50003 &&
!my_strcasecmp(&my_charset_latin1, db, "information_schema")))
{
if (mysql_real_query(mysql, lock_tables_query.str,
lock_tables_query.length-1))
@ -4802,7 +4816,8 @@ static my_bool get_view_structure(char *table, char* db)
result_table);
check_io(sql_file);
}
fprintf(sql_file, "/*!50001 DROP TABLE %s*/;\n", opt_quoted_table);
/* Table might not exist if this view was dumped with --tab. */
fprintf(sql_file, "/*!50001 DROP TABLE IF EXISTS %s*/;\n", opt_quoted_table);
if (opt_drop)
{
fprintf(sql_file, "/*!50001 DROP VIEW IF EXISTS %s*/;\n",
@ -4993,7 +5008,7 @@ int main(int argc, char **argv)
exit_code= get_options(&argc, &argv);
if (exit_code)
{
free_resources(0);
free_resources();
exit(exit_code);
}
@ -5001,14 +5016,14 @@ int main(int argc, char **argv)
{
if(!(stderror_file= freopen(log_error_file, "a+", stderr)))
{
free_resources(0);
free_resources();
exit(EX_MYSQLERR);
}
}
if (connect_to_db(current_host, current_user, opt_password))
{
free_resources(0);
free_resources();
exit(EX_MYSQLERR);
}
if (!path)

View file

@ -303,7 +303,8 @@ static int get_options(int *argc, char ***argv)
static int write_to_table(char *filename, MYSQL *mysql)
{
char tablename[FN_REFLEN], hard_path[FN_REFLEN],
sql_statement[FN_REFLEN*16+256], *end;
escaped_name[FN_REFLEN * 2 + 1],
sql_statement[FN_REFLEN*16+256], *end, *pos;
DBUG_ENTER("write_to_table");
DBUG_PRINT("enter",("filename: %s",filename));
@ -338,15 +339,25 @@ static int write_to_table(char *filename, MYSQL *mysql)
fprintf(stdout, "Loading data from SERVER file: %s into %s\n",
hard_path, tablename);
}
mysql_real_escape_string(mysql, escaped_name, hard_path,
(unsigned long) strlen(hard_path));
sprintf(sql_statement, "LOAD DATA %s %s INFILE '%s'",
opt_low_priority ? "LOW_PRIORITY" : "",
opt_local_file ? "LOCAL" : "", hard_path);
opt_local_file ? "LOCAL" : "", escaped_name);
end= strend(sql_statement);
if (replace)
end= strmov(end, " REPLACE");
if (ignore)
end= strmov(end, " IGNORE");
end= strmov(strmov(end, " INTO TABLE "), tablename);
end= strmov(end, " INTO TABLE `");
/* Turn any ` into `` in table name. */
for (pos= tablename; *pos; pos++)
{
if (*pos == '`')
*end++= '`';
*end++= *pos;
}
end= strmov(end, "`");
if (fields_terminated || enclosed || opt_enclosed || escaped)
end= strmov(end, " FIELDS");

View file

@ -423,6 +423,7 @@ void concurrency_loop(MYSQL *mysql, uint current, option_string *eptr)
stats *sptr;
conclusions conclusion;
unsigned long long client_limit;
int sysret;
head_sptr= (stats *)my_malloc(sizeof(stats) * iterations,
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
@ -463,7 +464,9 @@ void concurrency_loop(MYSQL *mysql, uint current, option_string *eptr)
run_query(mysql, "SET AUTOCOMMIT=0", strlen("SET AUTOCOMMIT=0"));
if (pre_system)
system(pre_system);
if ((sysret= system(pre_system)) != 0)
fprintf(stderr, "Warning: Execution of pre_system option returned %d.\n",
sysret);
/*
Pre statements are always run after all other logic so they can
@ -478,7 +481,9 @@ void concurrency_loop(MYSQL *mysql, uint current, option_string *eptr)
run_statements(mysql, post_statements);
if (post_system)
system(post_system);
if ((sysret= system(post_system)) != 0)
fprintf(stderr, "Warning: Execution of post_system option returned %d.\n",
sysret);
/* We are finished with this run */
if (auto_generate_sql_autoincrement || auto_generate_sql_guid_primary)
@ -565,8 +570,7 @@ static struct my_option my_long_options[] =
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"csv", OPT_SLAP_CSV,
"Generate CSV output to named file or to stdout if no file is named.",
(uchar**) &opt_csv_str, (uchar**) &opt_csv_str, 0, GET_STR,
OPT_ARG, 0, 0, 0, 0, 0, 0},
NULL, NULL, 0, GET_STR, OPT_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},
@ -740,6 +744,11 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
DBUG_PUSH(argument ? argument : default_dbug_option);
debug_check_flag= 1;
break;
case OPT_SLAP_CSV:
if (!argument)
argument= (char *)"-"; /* use stdout */
opt_csv_str= argument;
break;
#include <sslopt-case.h>
case 'V':
print_version();

View file

@ -280,6 +280,7 @@ enum enum_commands {
Q_SEND_QUIT, Q_CHANGE_USER, Q_MKDIR, Q_RMDIR,
Q_LIST_FILES, Q_LIST_FILES_WRITE_FILE, Q_LIST_FILES_APPEND_FILE,
Q_SEND_SHUTDOWN, Q_SHUTDOWN_SERVER,
Q_MOVE_FILE,
Q_UNKNOWN, /* Unknown command. */
Q_COMMENT, /* Comments, ignored. */
@ -376,6 +377,7 @@ const char *command_names[]=
"list_files_append_file",
"send_shutdown",
"shutdown_server",
"move_file",
0
};
@ -415,6 +417,7 @@ static struct st_expected_errors saved_expected_errors;
struct st_command
{
char *query, *query_buf,*first_argument,*last_argument,*end;
DYNAMIC_STRING content;
int first_word_len, query_len;
my_bool abort_on_error;
struct st_expected_errors expected_errors;
@ -429,10 +432,12 @@ DYNAMIC_STRING ds_res;
char builtin_echo[FN_REFLEN];
static void cleanup_and_exit(int exit_code) __attribute__((noreturn));
void die(const char *fmt, ...)
ATTRIBUTE_FORMAT(printf, 1, 2);
ATTRIBUTE_FORMAT(printf, 1, 2) __attribute__((noreturn));
void abort_not_supported_test(const char *fmt, ...)
ATTRIBUTE_FORMAT(printf, 1, 2);
ATTRIBUTE_FORMAT(printf, 1, 2) __attribute__((noreturn));
void verbose_msg(const char *fmt, ...)
ATTRIBUTE_FORMAT(printf, 1, 2);
void log_msg(const char *fmt, ...)
@ -966,6 +971,7 @@ void check_command_args(struct st_command *command,
for (i= 0; i < num_args; i++)
{
const struct command_arg *arg= &args[i];
char delimiter;
switch (arg->type) {
/* A string */
@ -974,8 +980,15 @@ void check_command_args(struct st_command *command,
while (*ptr && *ptr == ' ')
ptr++;
start= ptr;
/* Find end of arg, terminated by "delimiter_arg" */
while (*ptr && *ptr != delimiter_arg)
delimiter = delimiter_arg;
/* If start of arg is ' ` or " search to matching quote end instead */
if (*ptr && strchr ("'`\"", *ptr))
{
delimiter= *ptr;
start= ++ptr;
}
/* Find end of arg, terminated by "delimiter" */
while (*ptr && *ptr != delimiter)
ptr++;
if (ptr > start)
{
@ -987,6 +1000,11 @@ void check_command_args(struct st_command *command,
/* Empty string */
init_dynamic_string(arg->ds, "", 0, 0);
}
/* Find real end of arg, terminated by "delimiter_arg" */
/* This will do nothing if arg was not closed by quotes */
while (*ptr && *ptr != delimiter_arg)
ptr++;
command->last_argument= (char*)ptr;
/* Step past the delimiter */
@ -1123,6 +1141,8 @@ void free_used_memory()
{
struct st_command **q= dynamic_element(&q_lines, i, struct st_command**);
my_free((*q)->query_buf,MYF(MY_ALLOW_ZERO_PTR));
if ((*q)->content.str)
dynstr_free(&(*q)->content);
my_free((*q),MYF(0));
}
for (i= 0; i < 10; i++)
@ -1148,6 +1168,7 @@ void free_used_memory()
mysql_server_end();
/* Don't use DBUG after mysql_server_end() */
DBUG_VIOLATION_HELPER_LEAVE;
return;
}
@ -1445,34 +1466,38 @@ static int run_tool(const char *tool_path, DYNAMIC_STRING *ds_res, ...)
Test if diff is present. This is needed on Windows systems
as the OS returns 1 whether diff is successful or if it is
not present.
Takes name of diff program as argument
We run diff -v and look for output in stdout.
We don't redirect stderr to stdout to make for a simplified check
Windows will output '"diff"' is not recognized... to stderr if it is
not present.
*/
int diff_check (const char *diff_name)
#ifdef __WIN__
static int diff_check(const char *diff_name)
{
char buf[512]= {0};
FILE *res_file;
char cmd[128];
my_snprintf (cmd, sizeof(cmd), "%s -v", diff_name);
int have_diff = 0;
FILE *res_file;
char buf[128];
int have_diff= 0;
if (!(res_file= popen(cmd, "r")))
die("popen(\"%s\", \"r\") failed", cmd);
my_snprintf(buf, sizeof(buf), "%s -v", diff_name);
/* if diff is not present, nothing will be in stdout to increment have_diff */
if (fgets(buf, sizeof(buf), res_file))
{
have_diff += 1;
}
pclose(res_file);
return have_diff;
if (!(res_file= popen(buf, "r")))
die("popen(\"%s\", \"r\") failed", buf);
/* if diff is not present, nothing will be in stdout to increment have_diff */
if (fgets(buf, sizeof(buf), res_file))
have_diff= 1;
pclose(res_file);
return have_diff;
}
#endif
/*
Show the diff of two files using the systems builtin diff
command. If no such diff command exist, just dump the content
@ -1510,7 +1535,7 @@ void show_diff(DYNAMIC_STRING* ds,
else
diff_name = 0;
#else
diff_name = "diff"; // Otherwise always assume it's called diff
diff_name = "diff"; /* Otherwise always assume it's called diff */
#endif
if (diff_name)
@ -1794,7 +1819,7 @@ void check_result()
log_file.file_name(), reject_file, errno);
show_diff(NULL, result_file_name, reject_file);
die(mess);
die("%s", mess);
break;
}
default: /* impossible */
@ -2466,7 +2491,7 @@ void do_source(struct st_command *command)
}
dynstr_free(&ds_filename);
return;
DBUG_VOID_RETURN;
}
@ -2889,6 +2914,42 @@ void do_copy_file(struct st_command *command)
}
/*
SYNOPSIS
do_move_file
command command handle
DESCRIPTION
move_file <from_file> <to_file>
Move <from_file> to <to_file>
*/
void do_move_file(struct st_command *command)
{
int error;
static DYNAMIC_STRING ds_from_file;
static DYNAMIC_STRING ds_to_file;
const struct command_arg move_file_args[] = {
{ "from_file", ARG_STRING, TRUE, &ds_from_file, "Filename to move from" },
{ "to_file", ARG_STRING, TRUE, &ds_to_file, "Filename to move to" }
};
DBUG_ENTER("do_move_file");
check_command_args(command, command->first_argument,
move_file_args,
sizeof(move_file_args)/sizeof(struct command_arg),
' ');
DBUG_PRINT("info", ("Move %s to %s", ds_from_file.str, ds_to_file.str));
error= (my_rename(ds_from_file.str, ds_to_file.str,
MYF(0)) != 0);
handle_command_error(command, error);
dynstr_free(&ds_from_file);
dynstr_free(&ds_to_file);
DBUG_VOID_RETURN;
}
/*
SYNOPSIS
do_chmod_file
@ -3232,21 +3293,30 @@ void do_write_file_command(struct st_command *command, my_bool append)
sizeof(write_file_args)/sizeof(struct command_arg),
' ');
/* If no delimiter was provided, use EOF */
if (ds_delimiter.length == 0)
dynstr_set(&ds_delimiter, "EOF");
if (!append && access(ds_filename.str, F_OK) == 0)
{
/* The file should not be overwritten */
die("File already exist: '%s'", ds_filename.str);
}
init_dynamic_string(&ds_content, "", 1024, 1024);
read_until_delimiter(&ds_content, &ds_delimiter);
DBUG_PRINT("info", ("Writing to file: %s", ds_filename.str));
str_to_file2(ds_filename.str, ds_content.str, ds_content.length, append);
dynstr_free(&ds_content);
ds_content= command->content;
/* If it hasn't been done already by a loop iteration, fill it in */
if (! ds_content.str)
{
/* If no delimiter was provided, use EOF */
if (ds_delimiter.length == 0)
dynstr_set(&ds_delimiter, "EOF");
init_dynamic_string(&ds_content, "", 1024, 1024);
read_until_delimiter(&ds_content, &ds_delimiter);
command->content= ds_content;
}
/* This function could be called even if "false", so check before printing */
if (cur_block->ok)
{
DBUG_PRINT("info", ("Writing to file: %s", ds_filename.str));
str_to_file2(ds_filename.str, ds_content.str, ds_content.length, append);
}
dynstr_free(&ds_filename);
dynstr_free(&ds_delimiter);
DBUG_VOID_RETURN;
@ -3389,12 +3459,17 @@ void do_diff_files(struct st_command *command)
die("command \"diff_files\" failed, file '%s' does not exist",
ds_filename2.str);
if ((error= compare_files(ds_filename.str, ds_filename2.str)))
if ((error= compare_files(ds_filename.str, ds_filename2.str)) &&
match_expected_error(command, error, NULL) < 0)
{
/* Compare of the two files failed, append them to output
so the failure can be analyzed
so the failure can be analyzed, but only if it was not
expected to fail.
*/
show_diff(&ds_res, ds_filename.str, ds_filename2.str);
log_file.write(&ds_res);
log_file.flush();
dynstr_set(&ds_res, 0);
}
dynstr_free(&ds_filename);
@ -3650,10 +3725,9 @@ void do_wait_for_slave_to_stop(struct st_command *c __attribute__((unused)))
MYSQL* mysql = &cur_con->mysql;
for (;;)
{
MYSQL_RES *res;
MYSQL_RES *UNINIT_VAR(res);
MYSQL_ROW row;
int done;
LINT_INIT(res);
if (mysql_query(mysql,"show status like 'Slave_running'") ||
!(res=mysql_store_result(mysql)))
@ -4546,7 +4620,7 @@ void select_connection(struct st_command *command)
};
check_command_args(command, command->first_argument, connection_args,
sizeof(connection_args)/sizeof(struct command_arg),
',');
' ');
DBUG_PRINT("info", ("changing connection: %s", ds_connection.str));
select_connection_name(ds_connection.str);
@ -5185,13 +5259,12 @@ my_bool end_of_query(int c)
int read_line(char *buf, int size)
{
char c, last_quote;
char c, UNINIT_VAR(last_quote);
char *p= buf, *buf_end= buf + size - 1;
int skip_char= 0;
enum {R_NORMAL, R_Q, R_SLASH_IN_Q,
R_COMMENT, R_LINE_START} state= R_LINE_START;
DBUG_ENTER("read_line");
LINT_INIT(last_quote);
start_lineno= cur_file->lineno;
DBUG_PRINT("info", ("Starting to read at lineno: %d", start_lineno));
@ -6423,8 +6496,7 @@ void run_query_normal(struct st_connection *cn, struct st_command *command,
if (!disable_result_log)
{
ulonglong affected_rows; /* Ok to be undef if 'disable_info' is set */
LINT_INIT(affected_rows);
ulonglong UNINIT_VAR(affected_rows); /* Ok to be undef if 'disable_info' is set */
if (res)
{
@ -7110,6 +7182,10 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
run_query_normal(cn, command, flags, query, query_len,
ds, &ds_warnings);
dynstr_free(&ds_warnings);
if (command->type == Q_EVAL)
dynstr_free(&eval_query);
if (display_result_sorted)
{
/* Sort the result set and append it to result */
@ -7140,11 +7216,8 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
check_require(ds, command->require_file);
}
dynstr_free(&ds_warnings);
if (ds == &ds_result)
dynstr_free(&ds_result);
if (command->type == Q_EVAL)
dynstr_free(&eval_query);
DBUG_VOID_RETURN;
}
@ -7453,6 +7526,8 @@ static void init_signal_handling(void)
#endif
sigaction(SIGILL, &sa, NULL);
sigaction(SIGFPE, &sa, NULL);
DBUG_VOID_RETURN;
}
#endif /* !__WIN__ */
@ -7627,7 +7702,31 @@ int main(int argc, char **argv)
command->type= Q_COMMENT;
}
if (cur_block->ok)
my_bool ok_to_do= cur_block->ok;
/*
Some commands need to be "done" the first time if they may get
re-iterated over in a true context. This can only happen if there's
a while loop at some level above the current block.
*/
if (!ok_to_do)
{
if (command->type == Q_SOURCE ||
command->type == Q_WRITE_FILE ||
command->type == Q_APPEND_FILE ||
command->type == Q_PERL)
{
for (struct st_block *stb= cur_block-1; stb >= block_stack; stb--)
{
if (stb->cmd == cmd_while)
{
ok_to_do= 1;
break;
}
}
}
}
if (ok_to_do)
{
command->last_argument= command->first_argument;
processed = 1;
@ -7680,6 +7779,7 @@ int main(int argc, char **argv)
case Q_CHANGE_USER: do_change_user(command); break;
case Q_CAT_FILE: do_cat_file(command); break;
case Q_COPY_FILE: do_copy_file(command); break;
case Q_MOVE_FILE: do_move_file(command); break;
case Q_CHMOD_FILE: do_chmod_file(command); break;
case Q_PERL: do_perl(command); break;
case Q_DELIMITER:
@ -7935,6 +8035,8 @@ int main(int argc, char **argv)
if (parsing_disabled)
die("Test ended with parsing disabled");
my_bool empty_result= FALSE;
/*
The whole test has been executed _sucessfully_.
Time to compare result or save it to record file.
@ -7975,11 +8077,20 @@ int main(int argc, char **argv)
}
else
{
die("The test didn't produce any output");
/* Empty output is an error *unless* we also have an empty result file */
if (! result_file_name || record ||
compare_files (log_file.file_name(), result_file_name))
{
die("The test didn't produce any output");
}
else
{
empty_result= TRUE; /* Meaning empty was expected */
}
}
if (!command_executed && result_file_name)
die("No queries executed but result file found!");
if (!command_executed && result_file_name && !empty_result)
die("No queries executed but non-empty result file found!");
verbose_msg("Test has succeeded!");
timer_output();
@ -8066,6 +8177,8 @@ void do_get_replace_column(struct st_command *command)
}
my_free(start, MYF(0));
command->last_argument= command->end;
DBUG_VOID_RETURN;
}

View file

@ -31,7 +31,7 @@ noinst_HEADERS = readline.h chardefs.h keymaps.h \
EXTRA_DIST= emacs_keymap.c vi_keymap.c
DEFS = -DUNDEF_THREADS_HACK -DHAVE_CONFIG_H -DNO_KILL_INTR
DEFS = -DMYSQL_CLIENT_NO_THREADS -DHAVE_CONFIG_H -DNO_KILL_INTR
# Don't update the files from bitkeeper
%::SCCS/s.%

View file

@ -79,7 +79,7 @@ static int _rl_read_init_file PARAMS((const char *, int));
static int glean_key_from_name PARAMS((char *));
static int find_boolean_var PARAMS((const char *));
static char *_rl_get_string_variable_value PARAMS((const char *));
static const char *_rl_get_string_variable_value PARAMS((const char *));
static int substring_member_of_array PARAMS((char *, const char **));
static int currently_reading_init_file;
@ -339,9 +339,7 @@ rl_generic_bind (type, keyseq, data, map)
char *keys;
int keys_len;
register int i;
KEYMAP_ENTRY k;
k.function = 0;
KEYMAP_ENTRY k= { 0, NULL };
/* If no keys to bind to, exit right away. */
if (keyseq == 0 || *keyseq == 0)
@ -442,7 +440,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 == '\\')
{
@ -701,7 +699,7 @@ rl_function_of_keyseq (keyseq, map, type)
{
unsigned char ic = keyseq[i];
if (META_CHAR (ic) && _rl_convert_meta_chars_to_ascii)
if (META_CHAR_FOR_UCHAR (ic) && _rl_convert_meta_chars_to_ascii)
{
if (map[ESC].type == ISKMAP)
{
@ -776,7 +774,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 ((sizeof(off_t) > sizeof(size_t) && finfo.st_size > (off_t)(size_t)~0) ||
file_size + 1 < file_size)
{
if (file >= 0)
close (file);
@ -807,7 +806,7 @@ _rl_read_file (filename, sizep)
/* Re-read the current keybindings file. */
int
rl_re_read_init_file (count, ignore)
int count, ignore;
int count __attribute__((unused)), ignore __attribute__((unused));
{
int r;
r = rl_read_init_file ((const char *)NULL);
@ -1031,7 +1030,7 @@ parser_if (args)
/* Invert the current parser state if there is anything on the stack. */
static int
parser_else (args)
char *args;
char *args __attribute__((unused));
{
register int i;
@ -1062,7 +1061,7 @@ parser_else (args)
_rl_parsing_conditionalized_out from the stack. */
static int
parser_endif (args)
char *args;
char *args __attribute__((unused));
{
if (if_stack_depth)
_rl_parsing_conditionalized_out = if_stack[--if_stack_depth];
@ -1185,7 +1184,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)
{
@ -1276,7 +1275,7 @@ rl_parse_and_bind (string)
int delimiter, passc;
delimiter = string[i++];
for (passc = 0; c = string[i]; i++)
for (passc = 0; (c = string[i]); i++)
{
if (passc)
{
@ -1436,7 +1435,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
@ -1505,7 +1504,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, (_rl_sv_func_t*)NULL }
};
static int
@ -1532,7 +1531,7 @@ bool_to_int (value)
(value[0] == '1' && value[1] == '\0'));
}
char *
const char *
rl_variable_value (name)
const char *name;
{
@ -1799,7 +1798,7 @@ rl_set_keymap_from_edit_mode ()
#endif /* VI_MODE */
}
char *
const char *
rl_get_keymap_name_from_edit_mode ()
{
if (rl_editing_mode == emacs_mode)
@ -2048,7 +2047,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;
@ -2108,7 +2107,7 @@ rl_function_dumper (print_readably)
the output in such a way that it can be read back in. */
int
rl_dump_functions (count, key)
int count, key;
int count __attribute__((unused)), key __attribute__((unused));
{
if (rl_dispatching)
fprintf (rl_outstream, "\r\n");
@ -2188,7 +2187,7 @@ rl_macro_dumper (print_readably)
int
rl_dump_macros (count, key)
int count, key;
int count __attribute__((unused)), key __attribute__((unused));
{
if (rl_dispatching)
fprintf (rl_outstream, "\r\n");
@ -2197,12 +2196,13 @@ rl_dump_macros (count, key)
return (0);
}
static char *
static const char *
_rl_get_string_variable_value (name)
const char *name;
{
static char numbuf[32];
char *ret;
const char *ret;
char *tmp;
if (_rl_stricmp (name, "bell-style") == 0)
{
@ -2230,11 +2230,11 @@ _rl_get_string_variable_value (name)
{
if (_rl_isearch_terminators == 0)
return 0;
ret = _rl_untranslate_macro_value (_rl_isearch_terminators);
if (ret)
tmp = _rl_untranslate_macro_value (_rl_isearch_terminators);
if (tmp)
{
strncpy (numbuf, ret, sizeof (numbuf) - 1);
free (ret);
strncpy (numbuf, tmp, sizeof (numbuf) - 1);
free (tmp);
numbuf[sizeof(numbuf) - 1] = '\0';
}
else
@ -2257,7 +2257,7 @@ rl_variable_dumper (print_readably)
int print_readably;
{
int i;
char *v;
const char *v;
for (i = 0; boolean_varlist[i].name; i++)
{
@ -2286,7 +2286,7 @@ rl_variable_dumper (print_readably)
the output in such a way that it can be read back in. */
int
rl_dump_variables (count, key)
int count, key;
int count __attribute__((unused)), key __attribute__((unused));
{
if (rl_dispatching)
fprintf (rl_outstream, "\r\n");

View file

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

View file

@ -359,14 +359,14 @@ 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;
int ignore __attribute__((unused)), invoking_key __attribute__((unused));
{
return (rl_complete_internal ('?'));
}
int
rl_insert_completions (ignore, invoking_key)
int ignore, invoking_key;
int ignore __attribute__((unused)), invoking_key __attribute__((unused));
{
return (rl_complete_internal ('*'));
}
@ -696,7 +696,8 @@ print_filename (to_print, full_pathname)
char *to_print, *full_pathname;
{
int printed_len, extension_char, slen, tlen;
char *s, c, *new_full_pathname, *dn;
char *s, c, *new_full_pathname;
const char *dn;
extension_char = 0;
printed_len = fnprint (to_print);
@ -783,7 +784,7 @@ print_filename (to_print, full_pathname)
static char *
rl_quote_filename (s, rtype, qcp)
char *s;
int rtype;
int rtype __attribute__((unused));
char *qcp;
{
char *r;
@ -884,7 +885,7 @@ _rl_find_completion_word (fp, dp)
/* We didn't find an unclosed quoted substring upon which to do
completion, so use the word break characters to find the
substring on which to complete. */
while (rl_point = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_ANY))
while ((rl_point = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_ANY)))
{
scan = rl_line_buffer[rl_point];
@ -1803,7 +1804,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
@ -2111,7 +2112,7 @@ rl_filename_completion_function (text, state)
ring the bell, and reset the counter to zero. */
int
rl_menu_complete (count, ignore)
int count, ignore;
int count, ignore __attribute__((unused));
{
rl_compentry_func_t *our_func;
int matching_filenames, found_quote;

View file

@ -127,7 +127,7 @@ int _rl_want_redisplay = 0;
/* The stuff that gets printed out before the actual text of the line.
This is usually pointing to rl_prompt. */
char *rl_display_prompt = (char *)NULL;
const char *rl_display_prompt = (const char *)NULL;
/* Pseudo-global variables declared here. */
@ -229,7 +229,10 @@ expand_prompt (pmt, lp, lip, niflp, vlp)
int *lp, *lip, *niflp, *vlp;
{
char *r, *ret, *p, *igstart;
int l, rl, last, ignoring, ninvis, invfl, invflset, ind, pind, physchars;
int l, rl, last, ignoring, ninvis, invfl, invflset, physchars;
#if defined (HANDLE_MULTIBYTE)
int ind, pind;
#endif
/* Short-circuit if we can. */
if ((MB_CUR_MAX <= 1 || rl_byte_oriented) && strchr (pmt, RL_PROMPT_START_IGNORE) == 0)
@ -242,7 +245,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;
}
@ -459,12 +462,13 @@ rl_redisplay ()
register int in, out, c, linenum, cursor_linenum;
register char *line;
int inv_botlin, lb_botlin, lb_linenum, o_cpos;
int newlines, lpos, temp, modmark, n0, num;
char *prompt_this_line;
int newlines, lpos, temp, modmark;
const char *prompt_this_line;
#if defined (HANDLE_MULTIBYTE)
int num, n0= 0;
wchar_t wc;
size_t wc_bytes;
int wc_width;
int wc_width= 0;
mbstate_t ps;
int _rl_wrapped_multicolumn = 0;
#endif
@ -626,7 +630,6 @@ rl_redisplay ()
contents of the command line? */
while (lpos >= _rl_screenwidth)
{
int z;
/* fix from Darin Johnson <darin@acuson.com> for prompt string with
invisible characters that is longer than the screen width. The
prompt_invis_chars_first_line variable could be made into an array
@ -635,6 +638,7 @@ rl_redisplay ()
prompts that exceed two physical lines?
Additional logic fix from Edward Catmur <ed@catmur.co.uk> */
#if defined (HANDLE_MULTIBYTE)
int z;
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
{
n0 = num;
@ -824,7 +828,7 @@ rl_redisplay ()
cpos_buffer_position = out;
lb_linenum = newlines;
}
for (i = in; i < in+wc_bytes; i++)
for (i = in; i < in+(int)wc_bytes; i++)
line[out++] = rl_line_buffer[i];
for (i = 0; i < wc_width; i++)
CHECK_LPOS();
@ -878,6 +882,7 @@ rl_redisplay ()
if (_rl_horizontal_scroll_mode == 0 && _rl_term_up && *_rl_term_up)
{
int nleft, pos, changed_screen_line, tx;
char empty_str[1] = { 0 };
if (!rl_display_fixed || forced_display)
{
@ -902,7 +907,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) ? empty_str : VIS_CHARS(line)
#define INV_LINE(line) (invisible_line + inv_lbreaks[line])
/* For each line in the buffer, do the updating display. */
@ -969,7 +974,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;
@ -1888,7 +1893,7 @@ rl_character_len (c, pos)
uc = (unsigned char)c;
if (META_CHAR (uc))
if (META_CHAR_FOR_UCHAR (uc))
return ((_rl_output_meta_chars == 0) ? 4 : 1);
if (uc == '\t')
@ -2261,7 +2266,7 @@ static void
redraw_prompt (t)
char *t;
{
char *oldp;
const char *oldp;
oldp = rl_display_prompt;
rl_save_prompt ();

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=";
const char *history_no_expand_chars = " \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;
const char *history_word_delimiters = 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

@ -186,7 +186,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 ((sizeof(off_t) > sizeof(size_t) && finfo.st_size > (off_t)(size_t)~0) ||
file_size + 1 < file_size)
{
errno = overflow_errno;
goto error_and_exit;
@ -310,6 +311,7 @@ history_truncate_file (fname, lines)
int file, chars_read, rv;
struct stat finfo;
size_t file_size;
size_t bytes_written;
buffer = (char *)NULL;
filename = history_filename (fname);
@ -339,7 +341,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 ((sizeof(off_t) > sizeof(size_t) && finfo.st_size > (off_t)(size_t)~0) ||
file_size + 1 < file_size)
{
close (file);
#if defined (EFBIG)
@ -398,7 +401,7 @@ history_truncate_file (fname, lines)
truncate to. */
if (bp > buffer && ((file = open (filename, O_WRONLY|O_TRUNC|O_BINARY, 0600)) != -1))
{
write (file, bp, chars_read - (bp - buffer));
bytes_written= write (file, bp, chars_read - (bp - buffer));
#if defined (__BEOS__)
/* BeOS ignores O_TRUNC. */

View file

@ -243,9 +243,9 @@ extern int history_length;
extern int history_max_entries;
extern char history_expansion_char;
extern char history_subst_char;
extern char *history_word_delimiters;
extern const char *history_word_delimiters;
extern char history_comment_char;
extern char *history_no_expand_chars;
extern const char *history_no_expand_chars;
extern char *history_search_delimiter_chars;
extern int history_quotes_inhibit_expansion;

View file

@ -420,7 +420,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

@ -75,7 +75,7 @@ static int _rl_isearch_cleanup PARAMS((_rl_search_cxt *, int));
static char *last_isearch_string;
static int last_isearch_string_len;
static char *default_isearch_terminators = "\033\012";
static const char *default_isearch_terminators = "\033\012";
_rl_search_cxt *
_rl_scxt_alloc (type, flags)
@ -119,7 +119,7 @@ _rl_scxt_alloc (type, flags)
void
_rl_scxt_dispose (cxt, flags)
_rl_search_cxt *cxt;
int flags;
int flags __attribute__((unused));
{
FREE (cxt->search_string);
FREE (cxt->allocated_line);
@ -154,7 +154,7 @@ rl_forward_search_history (sign, key)
static void
rl_display_search (search_string, reverse_p, where)
char *search_string;
int reverse_p, where;
int reverse_p, where __attribute__((unused));
{
char *message;
int msglen, searchlen;
@ -614,7 +614,7 @@ _rl_isearch_cleanup (cxt, r)
backwards. */
static int
rl_search_history (direction, invoking_key)
int direction, invoking_key;
int direction, invoking_key __attribute__((unused));
{
_rl_search_cxt *cxt; /* local for now, but saved globally */
int c, r;

View file

@ -79,7 +79,7 @@ static int rl_yank_nth_arg_internal PARAMS((int, int, int));
of kill material. */
int
rl_set_retained_kills (num)
int num;
int num __attribute__((unused));
{
return 0;
}
@ -296,7 +296,7 @@ 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;
int count __attribute__((unused)), ignore __attribute__((unused));
{
rl_begin_undo_group ();
rl_point = 0;
@ -314,7 +314,7 @@ rl_kill_full_line (count, ignore)
using behaviour that they expect. */
int
rl_unix_word_rubout (count, key)
int count, key;
int count, key __attribute__((unused));
{
int orig_point;
@ -347,7 +347,7 @@ rl_unix_word_rubout (count, key)
deletes backward to directory separator (`/') or whitespace. */
int
rl_unix_filename_rubout (count, key)
int count, key;
int count, key __attribute__((unused));
{
int orig_point, c;
@ -391,7 +391,7 @@ rl_unix_filename_rubout (count, key)
doing. */
int
rl_unix_line_discard (count, key)
int count, key;
int count __attribute__((unused)), key __attribute__((unused));
{
if (rl_point == 0)
rl_ding ();
@ -428,7 +428,7 @@ 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;
int count __attribute__((unused)), ignore __attribute__((unused));
{
return (region_kill_internal (0));
}
@ -436,7 +436,7 @@ rl_copy_region_to_kill (count, ignore)
/* Kill the text between the point and mark. */
int
rl_kill_region (count, ignore)
int count, ignore;
int count __attribute__((unused)), ignore __attribute__((unused));
{
int r, npoint;
@ -501,7 +501,7 @@ rl_copy_backward_word (count, key)
/* Yank back the last killed text. This ignores arguments. */
int
rl_yank (count, ignore)
int count, ignore;
int count __attribute__((unused)), ignore __attribute__((unused));
{
if (rl_kill_ring == 0)
{
@ -520,7 +520,7 @@ rl_yank (count, ignore)
yank back some other text. */
int
rl_yank_pop (count, key)
int count, key;
int count __attribute__((unused)), key __attribute__((unused));
{
int l, n;

View file

@ -201,7 +201,7 @@ _rl_kill_kbd_macro ()
re-executing the existing macro. */
int
rl_start_kbd_macro (ignore1, ignore2)
int ignore1, ignore2;
int ignore1 __attribute__((unused)), ignore2 __attribute__((unused));
{
if (RL_ISSTATE (RL_STATE_MACRODEF))
{
@ -226,7 +226,7 @@ rl_start_kbd_macro (ignore1, ignore2)
that many times, counting the definition as the first time. */
int
rl_end_kbd_macro (count, ignore)
int count, ignore;
int count, ignore __attribute__((unused));
{
if (RL_ISSTATE (RL_STATE_MACRODEF) == 0)
{
@ -246,7 +246,7 @@ rl_end_kbd_macro (count, ignore)
COUNT says how many times to execute it. */
int
rl_call_last_kbd_macro (count, ignore)
int count, ignore;
int count, ignore __attribute__((unused));
{
if (current_macro == 0)
_rl_abort_internal ();

View file

@ -346,8 +346,8 @@ _rl_char_value (buf, ind)
#undef _rl_find_next_mbchar
int
_rl_find_next_mbchar (string, seed, count, flags)
char *string;
int seed, count, flags;
char *string __attribute__((unused));
int seed, count, flags __attribute__((unused));
{
#if defined (HANDLE_MULTIBYTE)
return _rl_find_next_mbchar_internal (string, seed, count, flags);
@ -362,8 +362,8 @@ _rl_find_next_mbchar (string, seed, count, flags)
#undef _rl_find_prev_mbchar
int
_rl_find_prev_mbchar (string, seed, flags)
char *string;
int seed, flags;
char *string __attribute__((unused));
int seed, flags __attribute__((unused));
{
#if defined (HANDLE_MULTIBYTE)
return _rl_find_prev_mbchar_internal (string, seed, flags);

View file

@ -228,7 +228,7 @@ _rl_reset_argument ()
/* Start a numeric argument with initial value KEY */
int
rl_digit_argument (ignore, key)
int ignore, key;
int ignore __attribute__((unused)), key;
{
_rl_arg_init ();
if (RL_ISSTATE (RL_STATE_CALLBACK))
@ -249,7 +249,7 @@ rl_digit_argument (ignore, key)
dispatch on it. If the key is the abort character then abort. */
int
rl_universal_argument (count, key)
int count, key;
int count __attribute__((unused)), key __attribute__((unused));
{
_rl_arg_init ();
rl_numeric_arg *= 4;
@ -413,7 +413,7 @@ _rl_history_set_point ()
void
rl_replace_from_history (entry, flags)
HIST_ENTRY *entry;
int flags; /* currently unused */
int flags __attribute__((unused)); /* currently 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. */
@ -440,7 +440,7 @@ rl_replace_from_history (entry, flags)
/* Meta-< goes to the start of the history. */
int
rl_beginning_of_history (count, key)
int count, key;
int count __attribute__((unused)), key;
{
return (rl_get_previous_history (1 + where_history (), key));
}
@ -448,7 +448,7 @@ rl_beginning_of_history (count, key)
/* Meta-> goes to the end of the history. (The current line). */
int
rl_end_of_history (count, key)
int count, key;
int count __attribute__((unused)), key __attribute__((unused));
{
rl_maybe_replace_line ();
using_history ();
@ -553,7 +553,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;
int count __attribute__((unused)), key;
{
#if defined (VI_MODE)
_rl_set_insert_mode (RL_IM_INSERT, 1); /* vi mode ignores insert mode */
@ -566,7 +566,7 @@ rl_vi_editing_mode (count, key)
int
rl_emacs_editing_mode (count, key)
int count, key;
int count __attribute__((unused)), key __attribute__((unused));
{
rl_editing_mode = emacs_mode;
_rl_set_insert_mode (RL_IM_INSERT, 1); /* emacs mode default is insert mode */
@ -577,7 +577,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;
int im, force __attribute__((unused));
{
#ifdef CURSOR_MODE
_rl_set_cursor (im, force);
@ -590,7 +590,7 @@ _rl_set_insert_mode (im, force)
mode. A negative or zero explicit argument selects insert mode. */
int
rl_overwrite_mode (count, key)
int count, key;
int count, key __attribute__((unused));
{
if (rl_explicit_arg == 0)
_rl_set_insert_mode (rl_insert_mode ^ 1, 0);

View file

@ -101,7 +101,8 @@ _rl_init_eightbit ()
/* If we have setlocale(3), just check the current LC_CTYPE category
value, and go into eight-bit mode if it's not C or POSIX. */
#if defined (HAVE_SETLOCALE)
char *lspec, *t;
const char *lspec;
char *t;
/* Set the LC_CTYPE locale category from environment variables. */
lspec = _rl_get_locale_var ("LC_CTYPE");
@ -127,7 +128,8 @@ _rl_init_eightbit ()
return (0);
#else /* !HAVE_SETLOCALE */
char *lspec, *t;
const char *lspec;
char *t;
int i;
/* We don't have setlocale. Finesse it. Check the environment for the

View file

@ -90,7 +90,7 @@ static void bind_arrow_keys_internal PARAMS((Keymap));
static void bind_arrow_keys PARAMS((void));
static void readline_default_bindings PARAMS((void));
static void reset_default_bindings PARAMS((void));
static void reset_default_bindings PARAMS((void)) __attribute__((unused));
static int _rl_subseq_result PARAMS((int, Keymap, int, int));
static int _rl_subseq_getchar PARAMS((int));

View file

@ -304,7 +304,7 @@ extern int rl_bind_keyseq_if_unbound PARAMS((const char *, rl_command_func_t *))
extern int rl_bind_keyseq_if_unbound_in_map PARAMS((const char *, rl_command_func_t *, Keymap));
extern int rl_generic_bind PARAMS((int, const char *, char *, Keymap));
extern char *rl_variable_value PARAMS((const char *));
extern const char *rl_variable_value PARAMS((const char *));
extern int rl_variable_bind PARAMS((const char *, const char *));
/* Backwards compatibility, use rl_bind_keyseq_in_map instead. */
@ -343,7 +343,7 @@ extern void rl_set_keymap PARAMS((Keymap));
extern Keymap rl_get_keymap PARAMS((void));
/* Undocumented; used internally only. */
extern void rl_set_keymap_from_edit_mode PARAMS((void));
extern char *rl_get_keymap_name_from_edit_mode PARAMS((void));
extern const char *rl_get_keymap_name_from_edit_mode PARAMS((void));
/* Functions for manipulating the funmap, which maps command names to functions. */
extern int rl_add_funmap_entry PARAMS((const char *, rl_command_func_t *));
@ -406,7 +406,7 @@ extern void rl_set_screen_size PARAMS((int, int));
extern void rl_get_screen_size PARAMS((int *, int *));
extern void rl_reset_screen_size PARAMS((void));
extern char *rl_get_termcap PARAMS((const char *));
extern const char *rl_get_termcap PARAMS((const char *));
/* Functions for character input. */
extern int rl_stuff_char PARAMS((int));

View file

@ -77,7 +77,7 @@ typedef struct __rl_search_context
int sline_len;
int sline_index;
char *search_terminators;
const char *search_terminators;
} _rl_search_cxt;
/* Callback data for reading numeric arguments */
@ -164,7 +164,7 @@ extern int rl_set_retained_kills PARAMS((int));
extern void _rl_set_screen_size PARAMS((int, int));
/* undo.c */
extern int _rl_fix_last_undo_of_type PARAMS((int, int, int));
extern int _rl_fix_last_undo_of_type PARAMS((enum undo_code, int, int));
/* util.c */
extern char *_rl_savestring PARAMS((const char *));
@ -359,7 +359,7 @@ extern int _rl_vis_botlin;
extern int _rl_last_c_pos;
extern int _rl_suppress_redisplay;
extern int _rl_want_redisplay;
extern char *rl_display_prompt;
extern const char *rl_display_prompt;
/* isearch.c */
extern char *_rl_isearch_terminators;
@ -398,17 +398,17 @@ extern _rl_search_cxt *_rl_nscxt;
/* terminal.c */
extern int _rl_enable_keypad;
extern int _rl_enable_meta;
extern char *_rl_term_clreol;
extern char *_rl_term_clrpag;
extern char *_rl_term_im;
extern char *_rl_term_ic;
extern char *_rl_term_ei;
extern char *_rl_term_DC;
extern char *_rl_term_up;
extern char *_rl_term_dc;
extern char *_rl_term_cr;
extern char *_rl_term_IC;
extern char *_rl_term_forward_char;
extern const char *_rl_term_clreol;
extern const char *_rl_term_clrpag;
extern const char *_rl_term_im;
extern const char *_rl_term_ic;
extern const char *_rl_term_ei;
extern const char *_rl_term_DC;
extern const char *_rl_term_up;
extern const char *_rl_term_dc;
extern const char *_rl_term_cr;
extern const char *_rl_term_IC;
extern const char *_rl_term_forward_char;
extern int _rl_screenheight;
extern int _rl_screenwidth;
extern int _rl_screenchars;

View file

@ -764,7 +764,7 @@ rl_deprep_terminal ()
int
rl_restart_output (count, key)
int count, key;
int count __attribute__((unused)), key __attribute__((unused));
{
#if defined (__MINGW32__)
return 0;
@ -802,7 +802,7 @@ rl_restart_output (count, key)
int
rl_stop_output (count, key)
int count, key;
int count __attribute__((unused)), key __attribute__((unused));
{
#if defined (__MINGW32__)
return 0;

View file

@ -211,7 +211,7 @@ _rl_nsearch_init (dir, pchar)
rl_end = rl_point = 0;
p = _rl_make_prompt_for_search (pchar ? pchar : ':');
rl_message ("%s", p, 0);
rl_message ("%s", p);
free (p);
RL_SETSTATE(RL_STATE_NSEARCH);
@ -383,7 +383,7 @@ noninc_search (dir, pchar)
code calls this, KEY will be `?'. */
int
rl_noninc_forward_search (count, key)
int count, key;
int count __attribute__((unused)), key;
{
return noninc_search (1, (key == '?') ? '?' : 0);
}
@ -392,7 +392,7 @@ rl_noninc_forward_search (count, key)
calls this, KEY will be `/'. */
int
rl_noninc_reverse_search (count, key)
int count, key;
int count __attribute__((unused)), key;
{
return noninc_search (-1, (key == '/') ? '/' : 0);
}
@ -401,7 +401,7 @@ rl_noninc_reverse_search (count, key)
for. If there is no saved search string, abort. */
int
rl_noninc_forward_search_again (count, key)
int count, key;
int count __attribute__((unused)), key __attribute__((unused));
{
int r;
@ -418,7 +418,7 @@ rl_noninc_forward_search_again (count, key)
for. If there is no saved search string, abort. */
int
rl_noninc_reverse_search_again (count, key)
int count, key;
int count __attribute__((unused)), key __attribute__((unused));
{
int r;

View file

@ -104,34 +104,36 @@ char PC, *BC, *UP;
#endif /* __linux__ */
/* Some strings to control terminal actions. These are output by tputs (). */
char *_rl_term_clreol;
char *_rl_term_clrpag;
char *_rl_term_cr;
char *_rl_term_backspace;
char *_rl_term_goto;
char *_rl_term_pc;
const char *_rl_term_clreol;
const char *_rl_term_clrpag;
const char *_rl_term_cr;
const char *_rl_term_backspace;
char _rl_term_backspace_default[2] = { '\b', 0 };
const char *_rl_term_goto;
const char *_rl_term_pc;
/* Non-zero if we determine that the terminal can do character insertion. */
int _rl_terminal_can_insert = 0;
/* How to insert characters. */
char *_rl_term_im;
char *_rl_term_ei;
char *_rl_term_ic;
char *_rl_term_ip;
char *_rl_term_IC;
const char *_rl_term_im;
const char *_rl_term_ei;
const char *_rl_term_ic;
const char *_rl_term_ip;
const char *_rl_term_IC;
/* How to delete characters. */
char *_rl_term_dc;
char *_rl_term_DC;
const char *_rl_term_dc;
const char *_rl_term_DC;
char *_rl_term_forward_char;
const char *_rl_term_forward_char;
/* How to go up a line. */
char *_rl_term_up;
const char *_rl_term_up;
char _rl_term_up_default[2] = { 0, 0 };
/* A visible bell; char if the terminal can be made to flash the screen. */
static char *_rl_visible_bell;
static const char *_rl_visible_bell;
/* Non-zero means the terminal can auto-wrap lines. */
int _rl_term_autowrap = -1;
@ -141,33 +143,33 @@ static int term_has_meta;
/* The sequences to write to turn on and off the meta key, if this
terminal has one. */
static char *_rl_term_mm;
static char *_rl_term_mo;
static const char *_rl_term_mm;
static const char *_rl_term_mo;
/* The key sequences output by the arrow keys, if this terminal has any. */
static char *_rl_term_ku;
static char *_rl_term_kd;
static char *_rl_term_kr;
static char *_rl_term_kl;
static const char *_rl_term_ku;
static const char *_rl_term_kd;
static const char *_rl_term_kr;
static const char *_rl_term_kl;
/* How to initialize and reset the arrow keys, if this terminal has any. */
static char *_rl_term_ks;
static char *_rl_term_ke;
static const char *_rl_term_ks;
static const char *_rl_term_ke;
/* The key sequences sent by the Home and End keys, if any. */
static char *_rl_term_kh;
static char *_rl_term_kH;
static char *_rl_term_at7; /* @7 */
static const char *_rl_term_kh;
static const char *_rl_term_kH;
static const char *_rl_term_at7; /* @7 */
/* Delete key */
static char *_rl_term_kD;
static const char *_rl_term_kD;
/* Insert key */
static char *_rl_term_kI;
static const char *_rl_term_kI;
/* Cursor control */
static char *_rl_term_vs; /* very visible */
static char *_rl_term_ve; /* normal */
static const char *_rl_term_vs; /* very visible */
static const char *_rl_term_ve; /* normal */
static void bind_termcap_arrow_keys PARAMS((Keymap));
@ -362,7 +364,7 @@ rl_resize_terminal ()
struct _tc_string {
const char *tc_var;
char **tc_value;
const char **tc_value;
};
/* This should be kept sorted, just in case we decide to change the
@ -409,7 +411,7 @@ get_term_capabilities (bp)
char **bp;
{
#if !defined (__DJGPP__) /* XXX - doesn't DJGPP have a termcap library? */
register int i;
register unsigned int i;
for (i = 0; i < NUM_TC_STRINGS; i++)
*(tc_strings[i].tc_value) = tgetstr ((char *)tc_strings[i].tc_var, bp);
@ -496,8 +498,9 @@ _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";
UP = _rl_term_up;
_rl_term_backspace = _rl_term_backspace_default;
BC = (char*)_rl_term_backspace;
UP = (char*)_rl_term_up;
return 0;
}
@ -507,8 +510,8 @@ _rl_init_terminal_io (terminal_name)
/* Set up the variables that the termcap library expects the application
to provide. */
PC = _rl_term_pc ? *_rl_term_pc : 0;
BC = _rl_term_backspace;
UP = _rl_term_up;
BC = (char*)_rl_term_backspace;
UP = (char*)_rl_term_up;
if (!_rl_term_cr)
_rl_term_cr = "\r";
@ -568,11 +571,11 @@ bind_termcap_arrow_keys (map)
_rl_keymap = xkeymap;
}
char *
const char *
rl_get_termcap (cap)
const char *cap;
{
register int i;
register unsigned int i;
if (tcap_initialized == 0)
return ((char *)NULL);

View file

@ -410,7 +410,7 @@ rl_backward (count, key)
/* Move to the beginning of the line. */
int
rl_beg_of_line (count, key)
int count, key;
int count __attribute__((unused)), key __attribute__((unused));
{
rl_point = 0;
return 0;
@ -419,7 +419,7 @@ rl_beg_of_line (count, key)
/* Move to the end of the line. */
int
rl_end_of_line (count, key)
int count, key;
int count __attribute__((unused)), key __attribute__((unused));
{
rl_point = rl_end;
return 0;
@ -527,7 +527,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;
int ignore1 __attribute__((unused)), ignore2 __attribute__((unused));
{
int curr_line;
@ -566,7 +566,7 @@ rl_clear_screen (count, key)
int
rl_arrow_keys (count, c)
int count, c;
int count, c __attribute__((unused));
{
int ch;
@ -884,7 +884,7 @@ _rl_insert_next_callback (data)
int
rl_quoted_insert (count, key)
int count, key;
int count, key __attribute__((unused));
{
/* Let's see...should the callback interface futz with signal handling? */
#if defined (HANDLE_SIGNALS)
@ -907,7 +907,7 @@ rl_quoted_insert (count, key)
/* Insert a tab character. */
int
rl_tab_insert (count, key)
int count, key;
int count, key __attribute__((unused));
{
return (_rl_insert_char (count, '\t'));
}
@ -917,7 +917,7 @@ rl_tab_insert (count, key)
meaning in the future. */
int
rl_newline (count, key)
int count, key;
int count __attribute__((unused)), key __attribute__((unused));
{
rl_done = 1;
@ -951,7 +951,7 @@ rl_newline (count, key)
is special cased. */
int
rl_do_lowercase_version (ignore1, ignore2)
int ignore1, ignore2;
int ignore1 __attribute__((unused)), ignore2 __attribute__((unused));
{
return 0;
}
@ -1118,7 +1118,7 @@ rl_rubout_or_delete (count, key)
/* Delete all spaces and tabs around point. */
int
rl_delete_horizontal_space (count, ignore)
int count, ignore;
int count __attribute__((unused)), ignore __attribute__((unused));
{
int start = rl_point;
@ -1163,9 +1163,9 @@ rl_delete_or_show_completions (count, key)
A K*rn shell style function. */
int
rl_insert_comment (count, key)
int count, key;
int count __attribute__((unused)), key;
{
char *rl_comment_text;
const char *rl_comment_text;
int rl_comment_len;
rl_beg_of_line (1, key);
@ -1202,7 +1202,7 @@ rl_insert_comment (count, key)
/* Uppercase the word at point. */
int
rl_upcase_word (count, key)
int count, key;
int count, key __attribute__((unused));
{
return (rl_change_case (count, UpCase));
}
@ -1210,7 +1210,7 @@ rl_upcase_word (count, key)
/* Lowercase the word at point. */
int
rl_downcase_word (count, key)
int count, key;
int count, key __attribute__((unused));
{
return (rl_change_case (count, DownCase));
}
@ -1218,7 +1218,7 @@ rl_downcase_word (count, key)
/* Upcase the first letter, downcase the rest. */
int
rl_capitalize_word (count, key)
int count, key;
int count, key __attribute__((unused));
{
return (rl_change_case (count, CapCase));
}
@ -1381,7 +1381,7 @@ rl_transpose_words (count, key)
then transpose the characters before point. */
int
rl_transpose_chars (count, key)
int count, key;
int count, key __attribute__((unused));
{
#if defined (HANDLE_MULTIBYTE)
char *dummy;
@ -1557,7 +1557,7 @@ _rl_char_search_callback (data)
int
rl_char_search (count, key)
int count, key;
int count, key __attribute__((unused));
{
#if defined (READLINE_CALLBACKS)
if (RL_ISSTATE (RL_STATE_CALLBACK))
@ -1575,7 +1575,7 @@ rl_char_search (count, key)
int
rl_backward_char_search (count, key)
int count, key;
int count, key __attribute__((unused));
{
#if defined (READLINE_CALLBACKS)
if (RL_ISSTATE (RL_STATE_CALLBACK))
@ -1612,7 +1612,7 @@ _rl_set_mark_at_pos (position)
/* A bindable command to set the mark. */
int
rl_set_mark (count, key)
int count, key;
int count, key __attribute__((unused));
{
return (_rl_set_mark_at_pos (rl_explicit_arg ? count : rl_point));
}
@ -1620,7 +1620,7 @@ rl_set_mark (count, key)
/* Exchange the position of mark and point. */
int
rl_exchange_point_and_mark (count, key)
int count, key;
int count __attribute__((unused)), key __attribute__((unused));
{
if (rl_mark > rl_end)
rl_mark = -1;

View file

@ -196,7 +196,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

@ -137,7 +137,8 @@ UNDO_LIST *
_rl_copy_undo_list (head)
UNDO_LIST *head;
{
UNDO_LIST *list, *new, *roving, *c;
UNDO_LIST *list, *new, *c;
UNDO_LIST *roving= NULL;
list = head;
new = 0;
@ -231,7 +232,8 @@ rl_do_undo ()
int
_rl_fix_last_undo_of_type (type, start, end)
int type, start, end;
enum undo_code type;
int start, end;
{
UNDO_LIST *rl;
@ -289,7 +291,7 @@ rl_modifying (start, end)
/* Revert the current line to its previous state. */
int
rl_revert_line (count, key)
int count, key;
int count __attribute__((unused)), key __attribute__((unused));
{
if (!rl_undo_list)
rl_ding ();
@ -309,7 +311,7 @@ rl_revert_line (count, key)
/* Do some undoing of things that were done. */
int
rl_undo_command (count, key)
int count, key;
int count, key __attribute__((unused));
{
if (count < 0)
return 0; /* Nothing to do. */

View file

@ -81,8 +81,13 @@ rl_alphabetic (c)
#if defined (HANDLE_MULTIBYTE)
int
_rl_walphabetic (wc)
wchar_t wc;
/*
Portability issue with VisualAge C++ Professional / C for AIX Compiler, Version 6:
"util.c", line 84.1: 1506-343 (S) Redeclaration of _rl_walphabetic differs
from previous declaration on line 110 of "rlmbutil.h".
So, put type in the function signature here.
*/
_rl_walphabetic (wchar_t wc)
{
int c;
@ -115,14 +120,14 @@ _rl_abort_internal ()
int
rl_abort (count, key)
int count, key;
int count __attribute__((unused)), key __attribute__((unused));
{
return (_rl_abort_internal ());
}
int
rl_tty_status (count, key)
int count, key;
int count __attribute__((unused)), key __attribute__((unused));
{
#if defined (TIOCSTAT)
ioctl (1, TIOCSTAT, (char *)0);
@ -172,7 +177,7 @@ rl_extend_line_buffer (len)
/* A function for simple tilde expansion. */
int
rl_tilde_expand (ignore, key)
int ignore, key;
int ignore __attribute__((unused)), key __attribute__((unused));
{
register int start, end;
char *homedir, *temp;

View file

@ -131,7 +131,7 @@ static int _rl_vi_callback_char_search PARAMS((_rl_callback_generic_arg *));
void
_rl_vi_initialize_line ()
{
register int i;
register size_t i;
for (i = 0; i < sizeof (vi_mark_chars) / sizeof (int); i++)
vi_mark_chars[i] = -1;
@ -190,7 +190,7 @@ _rl_vi_stuff_insert (count)
puts you back into insert mode. */
int
rl_vi_redo (count, c)
int count, c;
int count, c __attribute__((unused));
{
int r;
@ -238,7 +238,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;
int count, 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. */
@ -321,7 +321,7 @@ rl_vi_search (count, key)
/* Completion, from vi's point of view. */
int
rl_vi_complete (ignore, key)
int ignore, key;
int ignore __attribute__((unused)), key;
{
if ((rl_point < rl_end) && (!whitespace (rl_line_buffer[rl_point])))
{
@ -348,7 +348,7 @@ rl_vi_complete (ignore, key)
/* Tilde expansion for vi mode. */
int
rl_vi_tilde_expand (ignore, key)
int ignore, key;
int ignore __attribute__((unused)), key;
{
rl_tilde_expand (0, key);
rl_vi_start_inserting (key, 1, rl_arg_sign);
@ -419,7 +419,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;
int count, ignore __attribute__((unused));
{
while (count-- && rl_point < (rl_end - 1))
{
@ -436,7 +436,7 @@ rl_vi_fWord (count, ignore)
int
rl_vi_bWord (count, ignore)
int count, ignore;
int count, ignore __attribute__((unused));
{
while (count-- && rl_point > 0)
{
@ -460,7 +460,7 @@ rl_vi_bWord (count, ignore)
int
rl_vi_eWord (count, ignore)
int count, ignore;
int count, ignore __attribute__((unused));
{
while (count-- && rl_point < (rl_end - 1))
{
@ -491,7 +491,7 @@ rl_vi_eWord (count, ignore)
int
rl_vi_fword (count, ignore)
int count, ignore;
int count, ignore __attribute__((unused));
{
while (count-- && rl_point < (rl_end - 1))
{
@ -517,7 +517,7 @@ rl_vi_fword (count, ignore)
int
rl_vi_bword (count, ignore)
int count, ignore;
int count, ignore __attribute__((unused));
{
while (count-- && rl_point > 0)
{
@ -556,7 +556,7 @@ rl_vi_bword (count, ignore)
int
rl_vi_eword (count, ignore)
int count, ignore;
int count, ignore __attribute__((unused));
{
while (count-- && rl_point < rl_end - 1)
{
@ -581,7 +581,7 @@ rl_vi_eword (count, ignore)
int
rl_vi_insert_beg (count, key)
int count, key;
int count __attribute__((unused)), key;
{
rl_beg_of_line (1, key);
rl_vi_insertion_mode (1, key);
@ -610,7 +610,7 @@ _rl_vi_append_forward (key)
int
rl_vi_append_mode (count, key)
int count, key;
int count __attribute__((unused)), key;
{
_rl_vi_append_forward (key);
rl_vi_start_inserting (key, 1, rl_arg_sign);
@ -619,7 +619,7 @@ rl_vi_append_mode (count, key)
int
rl_vi_append_eol (count, key)
int count, key;
int count __attribute__((unused)), key;
{
rl_end_of_line (1, key);
rl_vi_append_mode (1, key);
@ -629,7 +629,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;
int count __attribute__((unused)), c __attribute__((unused));
{
return (rl_newline (1, '\n'));
}
@ -640,7 +640,7 @@ rl_vi_eof_maybe (count, c)
switching keymaps. */
int
rl_vi_insertion_mode (count, key)
int count, key;
int count __attribute__((unused)), key;
{
_rl_keymap = vi_insertion_keymap;
_rl_vi_last_key_before_insert = key;
@ -703,7 +703,7 @@ _rl_vi_done_inserting ()
int
rl_vi_movement_mode (count, key)
int count, key;
int count __attribute__((unused)), key;
{
if (rl_point > 0)
rl_backward_char (1, key);
@ -783,7 +783,7 @@ _rl_vi_change_mbchar_case (count)
int
rl_vi_change_case (count, ignore)
int count, ignore;
int count, ignore __attribute__((unused));
{
int c, p;
@ -1031,7 +1031,7 @@ rl_digit_loop1 ()
int
rl_vi_delete_to (count, key)
int count, key;
int count __attribute__((unused)), key;
{
int c;
@ -1057,7 +1057,7 @@ rl_vi_delete_to (count, key)
int
rl_vi_change_to (count, key)
int count, key;
int count __attribute__((unused)), key;
{
int c, start_pos;
@ -1110,7 +1110,7 @@ rl_vi_change_to (count, key)
int
rl_vi_yank_to (count, key)
int count, key;
int count __attribute__((unused)), key;
{
int c, save;
@ -1202,7 +1202,7 @@ rl_vi_delete (count, key)
int
rl_vi_back_to_indent (count, key)
int count, key;
int count __attribute__((unused)), key;
{
rl_beg_of_line (1, key);
while (rl_point < rl_end && whitespace (rl_line_buffer[rl_point]))
@ -1212,7 +1212,7 @@ rl_vi_back_to_indent (count, key)
int
rl_vi_first_print (count, key)
int count, key;
int count __attribute__((unused)), key;
{
return (rl_vi_back_to_indent (1, key));
}
@ -1319,7 +1319,7 @@ rl_vi_char_search (count, key)
/* Match brackets */
int
rl_vi_match (ignore, key)
int ignore, key;
int ignore __attribute__((unused)), key;
{
int count = 1, brack, pos, tmp, pre;
@ -1426,7 +1426,7 @@ rl_vi_bracktype (c)
static int
_rl_vi_change_char (count, c, mb)
int count, c;
char *mb;
char *mb __attribute__((unused));
{
int p;
@ -1458,8 +1458,8 @@ _rl_vi_change_char (count, c, mb)
static int
_rl_vi_callback_getchar (mb, mlen)
char *mb;
int mlen;
char *mb __attribute__((unused));
int mlen __attribute__((unused));
{
int c;
@ -1494,7 +1494,7 @@ _rl_vi_callback_change_char (data)
int
rl_vi_change_char (count, key)
int count, key;
int count, key __attribute__((unused));
{
int c;
char mb[MB_LEN_MAX];
@ -1582,7 +1582,7 @@ rl_vi_overstrike_delete (count, key)
int
rl_vi_replace (count, key)
int count, key;
int count __attribute__((unused)), key __attribute__((unused));
{
int i;
@ -1663,7 +1663,7 @@ _rl_vi_set_mark ()
#if defined (READLINE_CALLBACKS)
static int
_rl_vi_callback_set_mark (data)
_rl_callback_generic_arg *data;
_rl_callback_generic_arg *data __attribute__((unused));
{
_rl_callback_func = 0;
_rl_want_redisplay = 1;
@ -1674,7 +1674,7 @@ _rl_vi_callback_set_mark (data)
int
rl_vi_set_mark (count, key)
int count, key;
int count __attribute__((unused)), key __attribute__((unused));
{
#if defined (READLINE_CALLBACKS)
if (RL_ISSTATE (RL_STATE_CALLBACK))
@ -1721,7 +1721,7 @@ _rl_vi_goto_mark ()
#if defined (READLINE_CALLBACKS)
static int
_rl_vi_callback_goto_mark (data)
_rl_callback_generic_arg *data;
_rl_callback_generic_arg *data __attribute__((unused));
{
_rl_callback_func = 0;
_rl_want_redisplay = 1;
@ -1732,7 +1732,7 @@ _rl_vi_callback_goto_mark (data)
int
rl_vi_goto_mark (count, key)
int count, key;
int count __attribute__((unused)), key __attribute__((unused));
{
#if defined (READLINE_CALLBACKS)
if (RL_ISSTATE (RL_STATE_CALLBACK))

View file

@ -456,6 +456,10 @@ fi
AC_DEFUN([MYSQL_STACK_DIRECTION],
[AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction,
[AC_TRY_RUN([#include <stdlib.h>
/* Prevent compiler optimization by HP's compiler, see bug#42213 */
#if defined(__HP_cc) || defined (__HP_aCC) || defined (__hpux)
#pragma noinline
#endif
int find_stack_direction ()
{
static char *addr = 0;

View file

@ -70,12 +70,16 @@ AC_CHECK_HEADERS(wctype.h)
AC_CHECK_HEADERS(wchar.h)
AC_CHECK_HEADERS(langinfo.h)
AC_CHECK_FUNC(mbsrtowcs, AC_DEFINE([HAVE_MBSRTOWCS],[],[Define if you have mbsrtowcs]))
AC_CHECK_FUNC(mbrtowc, AC_DEFINE([HAVE_MBRTOWC],[],[Define if you have mbrtowc]))
AC_CHECK_FUNC(mbrlen, AC_DEFINE([HAVE_MBRLEN],[],[Define if you have mbrlen]))
AC_CHECK_FUNC(wctomb, AC_DEFINE([HAVE_WCTOMB],[],[Define if you have wctomb]))
AC_CHECK_FUNC(wcwidth, AC_DEFINE([HAVE_WCWIDTH],[],[Define if you have wcwidth]))
AC_CHECK_FUNC(wcsdup, AC_DEFINE([HAVE_WCSDUP],[],[Define if you check wcsdup]))
AC_CHECK_FUNC(mbrlen, AC_DEFINE(HAVE_MBRLEN,[],[Define if you have mbrlen]))
AC_CHECK_FUNC(mbscmp, AC_DEFINE(HAVE_MBSCMP,[],[Define if you have mbscmp]))
AC_CHECK_FUNC(mbsrtowcs, AC_DEFINE(HAVE_MBSRTOWCS,[],[Define if you have mbsrtowcs]))
AC_CHECK_FUNC(wcrtomb, AC_DEFINE(HAVE_WCRTOMB,[],[Define if you have wcrtomb]))
AC_CHECK_FUNC(mbrtowc, AC_DEFINE(HAVE_MBRTOWC,[],[Define if you have mbrtowc]))
AC_CHECK_FUNC(wcscoll, AC_DEFINE(HAVE_WCSCOLL,[],[Define if you have wcscoll]))
AC_CHECK_FUNC(wcsdup, AC_DEFINE(HAVE_WCSDUP,[],[Define if you have wcsdup]))
AC_CHECK_FUNC(wcwidth, AC_DEFINE(HAVE_WCWIDTH,[],[Define if you have wcwidth]))
AC_CHECK_FUNC(wctype, AC_DEFINE(HAVE_WCTYPE,[],[Define if you have wctype]))
AC_CACHE_CHECK([for mbstate_t], mysql_cv_have_mbstate_t,
[AC_TRY_COMPILE([
@ -88,6 +92,8 @@ if test $mysql_cv_have_mbstate_t = yes; then
AC_DEFINE([HAVE_MBSTATE_T],[],[Define if mysql_cv_have_mbstate_t=yes])
fi
AC_CHECK_FUNCS(iswlower iswupper towlower towupper iswctype)
AC_CACHE_CHECK([for nl_langinfo and CODESET], mysql_cv_langinfo_codeset,
[AC_TRY_LINK(
[#include <langinfo.h>],
@ -97,4 +103,41 @@ if test $mysql_cv_langinfo_codeset = yes; then
AC_DEFINE([HAVE_LANGINFO_CODESET],[],[Define if mysql_cv_langinfo_codeset=yes])
fi
dnl check for wchar_t in <wchar.h>
AC_CACHE_CHECK([for wchar_t in wchar.h], bash_cv_type_wchar_t,
[AC_TRY_COMPILE(
[#include <wchar.h>
],
[
wchar_t foo;
foo = 0;
], bash_cv_type_wchar_t=yes, bash_cv_type_wchar_t=no)])
if test $bash_cv_type_wchar_t = yes; then
AC_DEFINE(HAVE_WCHAR_T, 1, [systems should define this type here])
fi
dnl check for wctype_t in <wctype.h>
AC_CACHE_CHECK([for wctype_t in wctype.h], bash_cv_type_wctype_t,
[AC_TRY_COMPILE(
[#include <wctype.h>],
[
wctype_t foo;
foo = 0;
], bash_cv_type_wctype_t=yes, bash_cv_type_wctype_t=no)])
if test $bash_cv_type_wctype_t = yes; then
AC_DEFINE(HAVE_WCTYPE_T, 1, [systems should define this type here])
fi
dnl check for wint_t in <wctype.h>
AC_CACHE_CHECK([for wint_t in wctype.h], bash_cv_type_wint_t,
[AC_TRY_COMPILE(
[#include <wctype.h>],
[
wint_t foo;
foo = 0;
], bash_cv_type_wint_t=yes, bash_cv_type_wint_t=no)])
if test $bash_cv_type_wint_t = yes; then
AC_DEFINE(HAVE_WINT_T, 1, [systems should define this type here])
fi
])

View file

@ -10,7 +10,7 @@ AC_CANONICAL_SYSTEM
#
# When changing major version number please also check switch statement
# in mysqlbinlog::check_master_version().
AM_INIT_AUTOMAKE(mysql, 5.1.36)
AM_INIT_AUTOMAKE(mysql, 5.1.40)
AM_CONFIG_HEADER([include/config.h:config.h.in])
PROTOCOL_VERSION=10
@ -603,10 +603,11 @@ AC_SUBST(NOINST_LDFLAGS)
# Check if we are using Linux and a glibc compiled with static nss
# (this is true on the MySQL build machines to avoid NSS problems)
#
AC_CHECK_TOOL([NM], [nm])
if test "$TARGET_LINUX" = "true" -a "$static_nss" = ""
then
tmp=`nm /usr/lib*/libc.a | grep _nss_files_getaliasent_r`
tmp=`$NM ${other_libc_lib:-/usr/lib*}/libc.a | grep _nss_files_getaliasent_r1`
if test -n "$tmp"
then
STATIC_NSS_FLAGS="-lc -lnss_files -lnss_dns -lresolv"
@ -1624,7 +1625,7 @@ esac
# Build optimized or debug version ?
# First check for gcc and g++
if test "$ac_cv_prog_gcc" = "yes"
if test "$GCC" = "yes"
then
DEBUG_CFLAGS="-g"
DEBUG_OPTIMIZE_CC="-O"
@ -1632,9 +1633,16 @@ then
else
DEBUG_CFLAGS="-g"
DEBUG_OPTIMIZE_CC=""
OPTIMIZE_CFLAGS="-O"
case $SYSTEM_TYPE in
*solaris*)
OPTIMIZE_CFLAGS="-O1"
;;
*)
OPTIMIZE_CFLAGS="-O"
;;
esac
fi
if test "$ac_cv_prog_cxx_g" = "yes"
if test "$GXX" = "yes"
then
DEBUG_CXXFLAGS="-g"
DEBUG_OPTIMIZE_CXX="-O"
@ -1642,7 +1650,14 @@ then
else
DEBUG_CXXFLAGS="-g"
DEBUG_OPTIMIZE_CXX=""
OPTIMIZE_CXXFLAGS="-O"
case $SYSTEM_TYPE in
*solaris*)
OPTIMIZE_CXXFLAGS="-O1"
;;
*)
OPTIMIZE_CXXFLAGS="-O"
;;
esac
fi
case $SYSTEM_TYPE in
@ -2076,6 +2091,25 @@ case "$mysql_cv_sys_os" in
# unsupported priority values are passed to pthread_setschedprio.
# Since the only supported value is 1, treat it as inexistent.
;;
SunOS) # Bug#42599 error: `pthread_setschedprio' was not declared in this scope
# In some installations, the pthread.h header used by GCC does not
# declare the pthread_setscheprio prototype, but the function is
# implemented. Since the function is used in C++ code, ensure that
# the function prototype is present.
AC_MSG_CHECKING([whether pthread_setschedprio is declared])
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([#include <pthread.h>],
[(void)(pthread_setschedprio);])],
[ac_cv_func_pthread_setschedprio=yes],
[ac_cv_func_pthread_setschedprio=no])
AC_LANG_POP([C++])
AC_MSG_RESULT([$ac_cv_func_pthread_setschedprio])
if test "$ac_cv_func_pthread_setschedprio" = yes; then
AC_DEFINE(HAVE_PTHREAD_SETSCHEDPRIO, 1,
[Define to 1 if you have the `pthread_setschedprio' function.])
fi
;;
*) AC_CHECK_FUNCS(pthread_setschedprio)
;;
esac

View file

@ -32,6 +32,7 @@
.\" === Set line length
.\".ll 6.5i
.TL
.warn 0
D B U G
.P 0
C Program Debugging Package

View file

@ -441,7 +441,7 @@ public:
const Ciphers& GetCiphers() const;
const DH_Parms& GetDH_Parms() const;
const Stats& GetStats() const;
const VerifyCallback getVerifyCallback() const;
VerifyCallback getVerifyCallback() const;
pem_password_cb GetPasswordCb() const;
void* GetUserData() const;
bool GetSessionCacheOff() const;

View file

@ -790,15 +790,17 @@ void processReply(SSL& ssl)
if (ssl.GetError()) return;
if (DoProcessReply(ssl))
{
// didn't complete process
if (!ssl.getSocket().IsNonBlocking()) {
// keep trying now, blocking ok
while (!ssl.GetError())
if (DoProcessReply(ssl) == 0) break;
}
}
else
// user will have try again later, non blocking
ssl.SetError(YasslError(SSL_ERROR_WANT_READ));
}
}
@ -873,10 +875,12 @@ void sendServerKeyExchange(SSL& ssl, BufferOutput buffer)
void sendChangeCipher(SSL& ssl, BufferOutput buffer)
{
if (ssl.getSecurity().get_parms().entity_ == server_end)
{
if (ssl.getSecurity().get_resuming())
ssl.verifyState(clientKeyExchangeComplete);
else
ssl.verifyState(clientFinishedComplete);
}
if (ssl.GetError()) return;
ChangeCipherSpec ccs;

View file

@ -1305,6 +1305,7 @@ void ServerHello::Process(input_buffer&, SSL& ssl)
ssl.useSecurity().use_connection().sessionID_Set_ = false;
if (ssl.getSecurity().get_resuming())
{
if (memcmp(session_id_, ssl.getSecurity().get_resume().GetID(),
ID_LEN) == 0) {
ssl.set_masterSecret(ssl.getSecurity().get_resume().GetSecret());
@ -1319,6 +1320,7 @@ void ServerHello::Process(input_buffer&, SSL& ssl)
ssl.useSecurity().set_resuming(false);
ssl.useLog().Trace("server denied resumption");
}
}
if (ssl.CompressionOn() && !compression_method_)
ssl.UnSetCompression(); // server isn't supporting yaSSL zlib request

View file

@ -1833,7 +1833,7 @@ SSL_CTX::GetCA_List() const
}
const VerifyCallback SSL_CTX::getVerifyCallback() const
VerifyCallback SSL_CTX::getVerifyCallback() const
{
return verifyCallback_;
}

View file

@ -96,10 +96,12 @@ inline void Mode_BASE::Process(byte* out, const byte* in, word32 sz)
if (mode_ == ECB)
ECB_Process(out, in, sz);
else if (mode_ == CBC)
{
if (dir_ == ENCRYPTION)
CBC_Encrypt(out, in, sz);
else
CBC_Decrypt(out, in, sz);
}
}

View file

@ -781,10 +781,12 @@ void CertDecoder::GetDate(DateType dt)
source_.advance(length);
if (!ValidateDate(date, b, dt) && verify_)
{
if (dt == BEFORE)
source_.SetError(BEFORE_DATE_E);
else
source_.SetError(AFTER_DATE_E);
}
// save for later use
if (dt == BEFORE) {
@ -1062,6 +1064,7 @@ word32 DecodeDSA_Signature(byte* decoded, const byte* encoded, word32 sz)
}
word32 rLen = GetLength(source);
if (rLen != 20)
{
if (rLen == 21) { // zero at front, eat
source.next();
--rLen;
@ -1074,6 +1077,7 @@ word32 DecodeDSA_Signature(byte* decoded, const byte* encoded, word32 sz)
source.SetError(DSA_SZ_E);
return 0;
}
}
memcpy(decoded, source.get_buffer() + source.get_index(), rLen);
source.advance(rLen);
@ -1084,6 +1088,7 @@ word32 DecodeDSA_Signature(byte* decoded, const byte* encoded, word32 sz)
}
word32 sLen = GetLength(source);
if (sLen != 20)
{
if (sLen == 21) {
source.next(); // zero at front, eat
--sLen;
@ -1096,6 +1101,7 @@ word32 DecodeDSA_Signature(byte* decoded, const byte* encoded, word32 sz)
source.SetError(DSA_SZ_E);
return 0;
}
}
memcpy(decoded + rLen, source.get_buffer() + source.get_index(), sLen);
source.advance(sLen);

View file

@ -131,7 +131,7 @@ extern "C" {
#define DEFAULT_BASEDIR "sys:/"
#define SHAREDIR "share/"
#define DEFAULT_CHARSET_HOME "sys:/mysql/"
#define DATADIR "data/"
#define MYSQL_DATADIR "data/"
/* 64-bit file system calls */
#define SIZEOF_OFF_T 8

View file

@ -17,15 +17,6 @@
#define BIG_TABLES
#ifdef __WIN2000__
/* We have to do this define before including windows.h to get the AWE API
functions */
#define _WIN32_WINNT 0x0500
#else
/* Get NT 4.0 functions */
#define _WIN32_WINNT 0x0400
#endif
#if defined(_MSC_VER) && _MSC_VER >= 1400
/* Avoid endless warnings about sprintf() etc. being unsafe. */
#define _CRT_SECURE_NO_DEPRECATE 1
@ -322,13 +313,15 @@ inline ulonglong double2ulonglong(double d)
#ifdef _CUSTOMCONFIG_
#include <custom_conf.h>
#else
#ifndef CMAKE_CONFIGD
#define DEFAULT_MYSQL_HOME "c:\\mysql"
#define DATADIR "c:\\mysql\\data"
#define MYSQL_DATADIR "c:\\mysql\\data"
#define PACKAGE "mysql"
#define DEFAULT_BASEDIR "C:\\"
#define SHAREDIR "share"
#define DEFAULT_CHARSET_HOME "C:/mysql/"
#endif
#endif
#ifndef DEFAULT_HOME_ENV
#define DEFAULT_HOME_ENV MYSQL_HOME
#endif

View file

@ -106,7 +106,7 @@ void my_hash_replace(HASH *hash, HASH_SEARCH_STATE *state, uchar *new_row);
my_bool my_hash_check(HASH *hash); /* Only in debug library */
#define my_hash_clear(H) bzero((char*) (H), sizeof(*(H)))
#define my_hash_inited(H) ((H)->array.buffer != 0)
#define my_hash_inited(H) ((H)->blength != 0)
#define my_hash_init_opt(A,B,C,D,E,F,G,H) \
(!my_hash_inited(A) && _my_hash_init(A,0,B,C,D,E,F,G, H CALLER_INFO))

View file

@ -285,7 +285,7 @@ typedef struct charset_info_st
#define ILLEGAL_CHARSET_INFO_NUMBER (~0U)
extern CHARSET_INFO my_charset_bin;
extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_bin;
extern CHARSET_INFO my_charset_big5_chinese_ci;
extern CHARSET_INFO my_charset_big5_bin;
extern CHARSET_INFO my_charset_cp932_japanese_ci;
@ -298,7 +298,7 @@ extern CHARSET_INFO my_charset_gb2312_chinese_ci;
extern CHARSET_INFO my_charset_gb2312_bin;
extern CHARSET_INFO my_charset_gbk_chinese_ci;
extern CHARSET_INFO my_charset_gbk_bin;
extern CHARSET_INFO my_charset_latin1;
extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_latin1;
extern CHARSET_INFO my_charset_latin1_german2_ci;
extern CHARSET_INFO my_charset_latin1_bin;
extern CHARSET_INFO my_charset_latin2_czech_ci;
@ -315,7 +315,7 @@ extern CHARSET_INFO my_charset_utf8_general_ci;
extern CHARSET_INFO my_charset_utf8_unicode_ci;
extern CHARSET_INFO my_charset_utf8_bin;
extern CHARSET_INFO my_charset_cp1250_czech_ci;
extern CHARSET_INFO my_charset_filename;
extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_filename;
/* declarations for simple charsets */
extern size_t my_strnxfrm_simple(CHARSET_INFO *, uchar *, size_t,

View file

@ -441,7 +441,8 @@ enum ha_base_keytype {
#define HA_ERR_INITIALIZATION 174 /* Error during initialization */
#define HA_ERR_FILE_TOO_SHORT 175 /* File too short */
#define HA_ERR_WRONG_CRC 176 /* Wrong CRC on page */
#define HA_ERR_LAST 176 /* Copy of last error nr */
#define HA_ERR_TOO_MANY_CONCURRENT_TRXS 177 /*Too many active concurrent transactions */
#define HA_ERR_LAST 177 /* Copy of last error nr */
/* Number of different errors */
#define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1)

View file

@ -16,6 +16,29 @@
#ifndef _dbug_h
#define _dbug_h
#if defined(__cplusplus) && !defined(DBUG_OFF)
class Dbug_violation_helper
{
public:
inline Dbug_violation_helper() :
_entered(TRUE)
{ }
inline ~Dbug_violation_helper()
{
assert(!_entered);
}
inline void leave()
{
_entered= FALSE;
}
private:
bool _entered;
};
#endif /* C++ */
#ifdef __cplusplus
extern "C" {
#endif
@ -47,11 +70,31 @@ extern void _db_lock_file_(void);
extern void _db_unlock_file_(void);
extern FILE *_db_fp_(void);
#define DBUG_ENTER(a) const char *_db_func_, *_db_file_; uint _db_level_; \
char **_db_framep_; \
_db_enter_ (a,__FILE__,__LINE__,&_db_func_,&_db_file_,&_db_level_, \
&_db_framep_)
#ifdef __cplusplus
#define DBUG_ENTER(a) \
const char *_db_func_, *_db_file_; \
uint _db_level_; \
char **_db_framep_; \
Dbug_violation_helper dbug_violation_helper; \
_db_enter_ (a, __FILE__, __LINE__, &_db_func_, &_db_file_, \
&_db_level_, &_db_framep_)
#define DBUG_VIOLATION_HELPER_LEAVE dbug_violation_helper.leave()
#else /* C */
#define DBUG_ENTER(a) \
const char *_db_func_, *_db_file_; \
uint _db_level_; \
char **_db_framep_; \
_db_enter_ (a, __FILE__, __LINE__, &_db_func_, &_db_file_, \
&_db_level_, &_db_framep_)
#define DBUG_VIOLATION_HELPER_LEAVE do { } while(0)
#endif /* C++ */
#define DBUG_LEAVE \
DBUG_VIOLATION_HELPER_LEAVE; \
_db_return_ (__LINE__, &_db_func_, &_db_file_, &_db_level_)
#define DBUG_RETURN(a1) do {DBUG_LEAVE; return(a1);} while(0)
#define DBUG_VOID_RETURN do {DBUG_LEAVE; return;} while(0)
@ -85,6 +128,7 @@ extern FILE *_db_fp_(void);
#define DBUG_ENTER(a1)
#define DBUG_LEAVE
#define DBUG_VIOLATION_HELPER_LEAVE
#define DBUG_RETURN(a1) do { return(a1); } while(0)
#define DBUG_VOID_RETURN do { return; } while(0)
#define DBUG_EXECUTE(keyword,a1) do { } while(0)
@ -93,13 +137,13 @@ extern FILE *_db_fp_(void);
#define DBUG_EVALUATE_IF(keyword,a1,a2) (a2)
#define DBUG_PRINT(keyword,arglist) do { } while(0)
#define DBUG_PUSH(a1)
#define DBUG_SET(a1)
#define DBUG_SET_INITIAL(a1)
#define DBUG_SET(a1) do { } while(0)
#define DBUG_SET_INITIAL(a1) do { } while(0)
#define DBUG_POP()
#define DBUG_PROCESS(a1)
#define DBUG_SETJMP(a1) setjmp(a1)
#define DBUG_LONGJMP(a1) longjmp(a1)
#define DBUG_DUMP(keyword,a1,a2)
#define DBUG_DUMP(keyword,a1,a2) do { } while(0)
#define DBUG_END()
#define DBUG_ASSERT(A) do { } while(0)
#define DBUG_LOCK_FILE

View file

@ -276,7 +276,7 @@
#endif
/* The client defines this to avoid all thread code */
#if defined(UNDEF_THREADS_HACK)
#if defined(MYSQL_CLIENT_NO_THREADS) || defined(UNDEF_THREADS_HACK)
#undef THREAD
#undef HAVE_LINUXTHREADS
#undef HAVE_NPTL
@ -558,10 +558,23 @@ int __void__;
#define LINT_INIT(var)
#endif
#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || defined(HAVE_purify)
#define PURIFY_OR_LINT_INIT(var) var=0
/*
Suppress uninitialized variable warning without generating code.
The _cplusplus is a temporary workaround for C++ code pending a fix
for a g++ bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34772).
*/
#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || defined(__cplusplus) || \
!defined(__GNUC__)
#define UNINIT_VAR(x) x= 0
#else
#define PURIFY_OR_LINT_INIT(var)
#define UNINIT_VAR(x) x= x
#endif
/* Define some useful general macros */
#if !defined(max)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#endif
#if !defined(HAVE_UINT)
@ -1573,4 +1586,17 @@ static inline double rint(double x)
}
#endif /* HAVE_RINT */
/*
MYSQL_PLUGIN_IMPORT macro is used to export mysqld data
(i.e variables) for usage in storage engine loadable plugins.
Outside of Windows, it is dummy.
*/
#ifndef MYSQL_PLUGIN_IMPORT
#if (defined(_WIN32) && defined(MYSQL_DYNAMIC_PLUGIN))
#define MYSQL_PLUGIN_IMPORT __declspec(dllimport)
#else
#define MYSQL_PLUGIN_IMPORT
#endif
#endif
#endif /* my_global_h */

View file

@ -67,6 +67,7 @@ extern int NEAR my_errno; /* Last error in mysys */
#define MY_HOLD_ON_ERROR 256 /* my_realloc() ; Return old ptr on error */
#define MY_DONT_OVERWRITE_FILE 1024 /* my_copy: Don't overwrite file */
#define MY_THREADSAFE 2048 /* my_seek(): lock fd mutex */
#define MY_SYNC 4096 /* my_copy(): sync dst file */
#define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */
#define MY_GIVE_INFO 2 /* Give time info about process*/
@ -221,8 +222,8 @@ extern uint my_large_page_size;
#endif
/* charsets */
extern CHARSET_INFO *default_charset_info;
extern CHARSET_INFO *all_charsets[256];
extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *default_charset_info;
extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *all_charsets[256];
extern CHARSET_INFO compiled_charsets[];
/* statistics */
@ -237,8 +238,8 @@ extern void (*my_sigtstp_cleanup)(void),
(*my_sigtstp_restart)(void),
(*my_abort_hook)(int);
/* Executed when comming from shell */
extern int NEAR my_umask, /* Default creation mask */
NEAR my_umask_dir,
extern MYSQL_PLUGIN_IMPORT int NEAR my_umask; /* Default creation mask */
extern int NEAR my_umask_dir,
NEAR my_recived_signals, /* Signals we have got */
NEAR my_safe_to_handle_signal, /* Set when allowed to SIGTSTP */
NEAR my_dont_interrupt; /* call remember_intr when set */
@ -511,7 +512,7 @@ typedef int (*qsort2_cmp)(const void *, const void *, const void *);
((info)->write_pos + (Count) <=(info)->write_end ?\
(memcpy((info)->write_pos, (Buffer), (size_t)(Count)),\
((info)->write_pos+=(Count)),0) : \
(*(info)->write_function)((info),(Buffer),(Count)))
(*(info)->write_function)((info),(uchar *)(Buffer),(Count)))
#define my_b_get(info) \
((info)->read_pos != (info)->read_end ?\

View file

@ -47,6 +47,7 @@ typedef struct st_mymerge_info /* Struct from h_info */
ulonglong deleted; /* Deleted records in database */
ulonglong recpos; /* Pos for last used record */
ulonglong data_file_length;
ulonglong dupp_key_pos; /* Offset of the Duplicate key in the merge table */
uint reclength; /* Recordlength */
int errkey; /* With key was dupplicated on err */
uint options; /* HA_OPTION_... used */
@ -88,7 +89,8 @@ extern MYRG_INFO *myrg_parent_open(const char *parent_name,
void *callback_param);
extern int myrg_attach_children(MYRG_INFO *m_info, int handle_locking,
MI_INFO *(*callback)(void*),
void *callback_param);
void *callback_param,
my_bool *need_compat_check);
extern int myrg_detach_children(MYRG_INFO *m_info);
extern int myrg_panic(enum ha_panic_function function);
extern int myrg_rfirst(MYRG_INFO *file,uchar *buf,int inx);

View file

@ -16,6 +16,16 @@
#ifndef _my_plugin_h
#define _my_plugin_h
/*
On Windows, exports from DLL need to be declared
*/
#if (defined(_WIN32) && defined(MYSQL_DYNAMIC_PLUGIN))
#define MYSQL_PLUGIN_EXPORT extern "C" __declspec(dllexport)
#else
#define MYSQL_PLUGIN_EXPORT
#endif
#ifdef __cplusplus
class THD;
class Item;
@ -90,9 +100,9 @@ int PSIZE= sizeof(struct st_mysql_plugin); \
struct st_mysql_plugin DECLS[]= {
#else
#define __MYSQL_DECLARE_PLUGIN(NAME, VERSION, PSIZE, DECLS) \
int _mysql_plugin_interface_version_= MYSQL_PLUGIN_INTERFACE_VERSION; \
int _mysql_sizeof_struct_st_plugin_= sizeof(struct st_mysql_plugin); \
struct st_mysql_plugin _mysql_plugin_declarations_[]= {
MYSQL_PLUGIN_EXPORT int _mysql_plugin_interface_version_= MYSQL_PLUGIN_INTERFACE_VERSION; \
MYSQL_PLUGIN_EXPORT int _mysql_sizeof_struct_st_plugin_= sizeof(struct st_mysql_plugin); \
MYSQL_PLUGIN_EXPORT struct st_mysql_plugin _mysql_plugin_declarations_[]= {
#endif
#define mysql_declare_plugin(NAME) \

View file

@ -109,6 +109,14 @@ typedef my_socket YASSL_SOCKET_T;
#include <openssl/ssl.h>
#include <openssl/err.h>
enum enum_ssl_init_error
{
SSL_INITERR_NOERROR= 0, SSL_INITERR_CERT, SSL_INITERR_KEY,
SSL_INITERR_NOMATCH, SSL_INITERR_BAD_PATHS, SSL_INITERR_CIPHERS,
SSL_INITERR_MEMFAIL, SSL_INITERR_LASTERR
};
const char* sslGetErrString(enum enum_ssl_init_error err);
struct st_VioSSLFd
{
SSL_CTX *ssl_context;
@ -124,7 +132,7 @@ struct st_VioSSLFd
struct st_VioSSLFd
*new_VioSSLAcceptorFd(const char *key_file, const char *cert_file,
const char *ca_file,const char *ca_path,
const char *cipher);
const char *cipher, enum enum_ssl_init_error* error);
void free_vio_ssl_acceptor_fd(struct st_VioSSLFd *fd);
#endif /* HAVE_OPENSSL */

View file

@ -21,7 +21,7 @@
# This file is public domain and comes with NO WARRANTY of any kind
target = libmysqlclient.la
target_defs = -DUNDEF_THREADS_HACK -DDONT_USE_RAID @LIB_EXTRA_CCFLAGS@
target_defs = -DMYSQL_CLIENT_NO_THREADS -DDONT_USE_RAID @LIB_EXTRA_CCFLAGS@
LIBS = @CLIENT_LIBS@
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
$(openssl_includes) @ZLIB_INCLUDES@
@ -104,7 +104,7 @@ do-lib-dist:
echo "# A very minimal Makefile to compile" > $$dir/Makefile; \
echo "# the minimized libmysql library" >> $$dir/Makefile; \
echo "# This file is autogenerated from Makefile.am" >> $$dir/Makefile; \
echo 'CFLAGS= -I. -DUNDEF_THREADS_HACK' >>$$dir/Makefile; \
echo 'CFLAGS= -I. -DMYSQL_CLIENT_NO_THREADS' >>$$dir/Makefile; \
echo "obj=$$objs" >>$$dir/Makefile; \
echo 'all: libmysql.a' >>$$dir/Makefile; \
echo 'libmysql.a: $$(obj)' >>$$dir/Makefile; \

View file

@ -85,7 +85,7 @@ BUILT_SOURCES = link_sources
CLEANFILES = $(target_libadd) $(SHLIBOBJS) \
$(target) $(BUILT_SOURCES)
DEFS = -DDEFAULT_CHARSET_HOME="\"$(MYSQLBASEdir)\"" \
-DDATADIR="\"$(MYSQLDATAdir)\"" \
-DMYSQL_DATADIR="\"$(MYSQLDATAdir)\"" \
-DDEFAULT_HOME_ENV=MYSQL_HOME \
-DDEFAULT_GROUP_SUFFIX_ENV=MYSQL_GROUP_SUFFIX \
-DDEFAULT_SYSCONFDIR="\"$(sysconfdir)\"" \

View file

@ -1635,8 +1635,7 @@ myodbc_remove_escape(MYSQL *mysql,char *name)
char *to;
#ifdef USE_MB
my_bool use_mb_flag=use_mb(mysql->charset);
char *end;
LINT_INIT(end);
char *UNINIT_VAR(end);
if (use_mb_flag)
for (end=name; *end ; end++) ;
#endif

View file

@ -87,63 +87,16 @@ FOREACH(rpath ${VIO_SOURCES})
SET(LIB_SOURCES ${LIB_SOURCES} ../vio/${rpath})
ENDFOREACH(rpath)
# Engines
INCLUDE(${CMAKE_SOURCE_DIR}/storage/heap/CMakeLists.txt)
FOREACH(rpath ${HEAP_SOURCES})
SET(LIB_SOURCES ${LIB_SOURCES} ../storage/heap/${rpath})
ENDFOREACH(rpath)
INCLUDE(${CMAKE_SOURCE_DIR}/storage/myisam/CMakeLists.txt)
FOREACH(rpath ${MYISAM_SOURCES})
SET(LIB_SOURCES ${LIB_SOURCES} ../storage/myisam/${rpath})
ENDFOREACH(rpath)
INCLUDE(${CMAKE_SOURCE_DIR}/storage/myisammrg/CMakeLists.txt)
FOREACH(rpath ${MYISAMMRG_SOURCES})
SET(LIB_SOURCES ${LIB_SOURCES} ../storage/myisammrg/${rpath})
ENDFOREACH(rpath)
IF(WITH_ARCHIVE_STORAGE_ENGINE)
INCLUDE(${CMAKE_SOURCE_DIR}/storage/archive/CMakeLists.txt)
FOREACH(rpath ${ARCHIVE_SOURCES})
SET(LIB_SOURCES ${LIB_SOURCES} ../storage/archive/${rpath})
FOREACH (ENGINE_LIB ${MYSQLD_STATIC_ENGINE_LIBS})
INCLUDE(${CMAKE_SOURCE_DIR}/storage/${ENGINE_LIB}/CMakeLists.txt)
STRING(TOUPPER ${ENGINE_LIB} ENGINE_LIB_UPPER)
FOREACH(rpath ${${ENGINE_LIB_UPPER}_SOURCES})
SET(LIB_SOURCES ${LIB_SOURCES} ${CMAKE_SOURCE_DIR}/storage/${ENGINE_LIB}/${rpath})
ENDFOREACH(rpath)
ENDIF(WITH_ARCHIVE_STORAGE_ENGINE)
ENDFOREACH(ENGINE_LIB)
IF(WITH_BLACKHOLE_STORAGE_ENGINE)
INCLUDE(${CMAKE_SOURCE_DIR}/storage/blackhole/CMakeLists.txt)
FOREACH(rpath ${BLACKHOLE_SOURCES})
SET(LIB_SOURCES ${LIB_SOURCES} ../storage/blackhole/${rpath})
ENDFOREACH(rpath)
ENDIF(WITH_BLACKHOLE_STORAGE_ENGINE)
IF(WITH_EXAMPLE_STORAGE_ENGINE)
INCLUDE(${CMAKE_SOURCE_DIR}/storage/example/CMakeLists.txt)
FOREACH(rpath ${EXAMPLE_SOURCES})
SET(LIB_SOURCES ${LIB_SOURCES} ../storage/example/${rpath})
ENDFOREACH(rpath)
ENDIF(WITH_EXAMPLE_STORAGE_ENGINE)
IF(WITH_FEDERATED_STORAGE_ENGINE)
INCLUDE(${CMAKE_SOURCE_DIR}/storage/federated/CMakeLists.txt)
FOREACH(rpath ${FEDERATED_SOURCES})
SET(LIB_SOURCES ${LIB_SOURCES} ../storage/federated/${rpath})
ENDFOREACH(rpath)
ENDIF(WITH_FEDERATED_STORAGE_ENGINE)
IF(WITH_INNOBASE_STORAGE_ENGINE)
INCLUDE(${CMAKE_SOURCE_DIR}/storage/innobase/CMakeLists.txt)
FOREACH(rpath ${INNOBASE_SOURCES})
SET(LIB_SOURCES ${LIB_SOURCES} ../storage/innobase/${rpath})
ENDFOREACH(rpath)
ENDIF(WITH_INNOBASE_STORAGE_ENGINE)
IF(WITH_CSV_STORAGE_ENGINE)
INCLUDE(${CMAKE_SOURCE_DIR}/storage/csv/CMakeLists.txt)
FOREACH(rpath ${CSV_SOURCES})
SET(LIB_SOURCES ${LIB_SOURCES} ../storage/csv/${rpath})
ENDFOREACH(rpath)
ENDIF(WITH_CSV_STORAGE_ENGINE)
SET(SOURCE_SUBLIBS FALSE)

View file

@ -26,7 +26,7 @@ pkgplugindir = $(pkglibdir)/plugin
EXTRA_DIST = libmysqld.def CMakeLists.txt
DEFS = -DEMBEDDED_LIBRARY -DMYSQL_SERVER \
-DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \
-DDATADIR="\"$(MYSQLDATAdir)\"" \
-DMYSQL_DATADIR="\"$(MYSQLDATAdir)\"" \
-DSHAREDIR="\"$(MYSQLSHAREdir)\"" \
-DPLUGINDIR="\"$(pkgplugindir)\""
INCLUDES= -I$(top_builddir)/include -I$(top_srcdir)/include \

View file

@ -79,4 +79,4 @@ public:
uint emb_count_querycache_size(THD *thd);
int emb_load_querycache_result(THD *thd, Querycache_stream *src);
void emb_store_querycache_result(Querycache_stream *dst, THD* thd);
void net_send_eof(THD *thd, uint server_status, uint total_warn_count);
bool net_send_eof(THD *thd, uint server_status, uint total_warn_count);

View file

@ -806,11 +806,11 @@ MYSQL_DATA *THD::alloc_new_dataset()
*/
static
void
bool
write_eof_packet(THD *thd, uint server_status, uint total_warn_count)
{
if (!thd->mysql) // bootstrap file handling
return;
return FALSE;
/*
The following test should never be true, but it's better to do it
because if 'is_fatal_error' is set the server is not going to execute
@ -825,6 +825,7 @@ write_eof_packet(THD *thd, uint server_status, uint total_warn_count)
*/
thd->cur_data->embedded_info->warning_count=
(thd->spcont ? 0 : min(total_warn_count, 65535));
return FALSE;
}
@ -1035,31 +1036,34 @@ bool Protocol_binary::write()
@sa Server implementation of net_send_ok in protocol.cc for
description of the arguments.
@return The function does not return errors.
@return
@retval TRUE An error occurred
@retval FALSE Success
*/
void
bool
net_send_ok(THD *thd,
uint server_status, uint total_warn_count,
ha_rows affected_rows, ulonglong id, const char *message)
{
DBUG_ENTER("emb_net_send_ok");
MYSQL_DATA *data;
bool error;
MYSQL *mysql= thd->mysql;
if (!mysql) // bootstrap file handling
DBUG_VOID_RETURN;
DBUG_RETURN(FALSE);
if (!(data= thd->alloc_new_dataset()))
return;
return TRUE;
data->embedded_info->affected_rows= affected_rows;
data->embedded_info->insert_id= id;
if (message)
strmake(data->embedded_info->info, message,
sizeof(data->embedded_info->info)-1);
write_eof_packet(thd, server_status, total_warn_count);
error= write_eof_packet(thd, server_status, total_warn_count);
thd->cur_data= 0;
DBUG_VOID_RETURN;
DBUG_RETURN(error);
}
@ -1068,27 +1072,41 @@ net_send_ok(THD *thd,
@sa net_send_ok
@return This function does not return errors.
@return
@retval TRUE An error occurred
@retval FALSE Success
*/
void
bool
net_send_eof(THD *thd, uint server_status, uint total_warn_count)
{
write_eof_packet(thd, server_status, total_warn_count);
bool error= write_eof_packet(thd, server_status, total_warn_count);
thd->cur_data= 0;
return error;
}
void net_send_error_packet(THD *thd, uint sql_errno, const char *err)
bool net_send_error_packet(THD *thd, uint sql_errno, const char *err)
{
MYSQL_DATA *data= thd->cur_data ? thd->cur_data : thd->alloc_new_dataset();
struct embedded_query_result *ei= data->embedded_info;
MYSQL_DATA *data= thd->cur_data;
struct embedded_query_result *ei;
if (!thd->mysql) // bootstrap file handling
{
fprintf(stderr, "ERROR: %d %s\n", sql_errno, err);
return TRUE;
}
if (!data)
data= thd->alloc_new_dataset();
ei= data->embedded_info;
ei->last_errno= sql_errno;
strmake(ei->info, err, sizeof(ei->info)-1);
strmov(ei->sqlstate, mysql_errno_to_sqlstate(sql_errno));
ei->server_status= thd->server_status;
thd->cur_data= 0;
return FALSE;
}

View file

@ -164,6 +164,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
port=0;
unix_socket=0;
client_flag|=mysql->options.client_flag;
/* Send client information for access check */
client_flag|=CLIENT_CAPABILITIES;
if (client_flag & CLIENT_MULTI_STATEMENTS)

View file

@ -23,7 +23,7 @@ EXTRA_DIST = $(man1_MANS) $(man8_MANS)
# "make_win_*" are not needed in Unix binary packages,
install-data-hook:
rm -f $(DESTDIR)$(manlibdir)/man1/make_win_*
rm -f $(DESTDIR)$(mandir)/man1/make_win_*
# Don't update the files from bitkeeper
%::SCCS/s.%

View file

@ -17,7 +17,8 @@
## Process this file with automake to create Makefile.in
testdir = $(prefix)/mysql-test
testroot = $(prefix)
testdir = $(testroot)/mysql-test
test_SCRIPTS = mtr \
mysql-test-run \
@ -25,6 +26,7 @@ test_SCRIPTS = mtr \
mysql-stress-test.pl
nobase_test_DATA = \
valgrind.supp \
lib/v1/mysql-test-run.pl \
lib/v1/mtr_cases.pl \
lib/v1/mtr_io.pl \
@ -41,7 +43,6 @@ nobase_test_DATA = \
lib/v1/mtr_im.pl \
lib/v1/mtr_process.pl \
lib/v1/mtr_unique.pl \
\
lib/mtr_cases.pm \
lib/mtr_gcov.pl \
lib/mtr_gprof.pl \
@ -69,9 +70,8 @@ nobase_test_DATA = \
SUBDIRS = lib/My/SafeProcess
EXTRA_DIST = README \
valgrind.supp \
$(test_SCRIPTS) \
$(nobase_test_DATA)
$(nobase_test_DATA)
# List of directories containing test + result files and the
# related test data files that should be copied
@ -93,12 +93,13 @@ TEST_DIRS = t r include std_data std_data/parts collections \
suite/jp suite/jp/t suite/jp/r suite/jp/std_data suite/jp/include \
suite/manual/t suite/manual/r \
suite/ndb_team suite/ndb_team/t suite/ndb_team/r \
suite/rpl suite/rpl/data suite/rpl/include suite/rpl/r \
suite/rpl suite/rpl/include suite/rpl/r \
suite/rpl/t \
suite/stress/include suite/stress/t suite/stress/r \
suite/ndb suite/ndb/t suite/ndb/r \
suite/rpl_ndb suite/rpl_ndb/t suite/rpl_ndb/r \
suite/parts suite/parts/t suite/parts/r suite/parts/inc
suite/parts suite/parts/t suite/parts/r suite/parts/inc \
suite/innodb suite/innodb/t suite/innodb/r suite/innodb/include
# Used by dist-hook and install-data-local to copy all
# test files into either dist or install directory

View file

@ -23,3 +23,10 @@ The syntax is as follows:
start with the same characters up to the last letter before the asterisk
are considered experimental:
main.a* # get rid of main.alias, main.alibaba and main.agliolio
6) Optionally, the test case may be followed by one or more platform
qualifiers beginning with @ or @!. The test will then be considered
experimental only/except on that platform. Basic OS names as
reported by $^O in Perl, or 'windows' are supported, this includes
solaris, linux, windows, aix, darwin, ... Example:
main.alias @aix @windows # Fails on those

View file

@ -1 +1 @@
perl mysql-test-run.pl --timer --force --comment=rpl_ndb_row --suite=rpl_ndb,ndb --mysqld=--binlog-format=row --experimental=collections/default.experimental
perl mysql-test-run.pl --timer --force --comment=rpl_ndb_row --vardir=var-rpl_ndb_row --suite=rpl_ndb,ndb --mysqld=--binlog-format=row --experimental=collections/default.experimental

View file

@ -1 +1,8 @@
funcs_1.charset_collation_1 # depends on compile-time decisions
main.plugin_load @solaris # Bug#42144
binlog.binlog_tmp_table* # Bug#45578: Test binlog_tmp_table fails ramdonly on PB2: Unknown table 't2'
main.ctype_gbk_binlog @solaris # Bug#46010: main.ctype_gbk_binlog fails sporadically : Table 't2' already exists
rpl.rpl_row_create_table* # Bug#45576: rpl_row_create_table fails on PB2
rpl_ndb.rpl_ndb_log # Bug#38998
rpl.rpl_innodb_bug28430* @solaris # Bug#46029
rpl.rpl_get_master_version_and_clock* # Bug#46931 2009-08-26 alik rpl.rpl_get_master_version_and_clock fails on hpux11.31

View file

@ -1,5 +1,5 @@
perl mysql-test-run.pl --timer --force --comment=n_mix --mysqld=--binlog-format=mixed --experimental=collections/default.experimental
perl mysql-test-run.pl --timer --force --comment=ps_row --ps-protocol --mysqld=--binlog-format=row --experimental=collections/default.experimental
perl mysql-test-run.pl --timer --force --comment=embedded --embedded --experimental=collections/default.experimental
perl mysql-test-run.pl --timer --force --comment=rpl_binlog_row --suite=rpl,binlog --mysqld=--binlog-format=row --experimental=collections/default.experimental
perl mysql-test-run.pl --timer --force --comment=funcs_1 --suite=funcs_1 --experimental=collections/default.experimental
perl mysql-test-run.pl --timer --force --parallel=auto --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --experimental=collections/default.experimental
perl mysql-test-run.pl --timer --force --parallel=auto --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row --experimental=collections/default.experimental
perl mysql-test-run.pl --timer --force --parallel=auto --comment=embedded --vardir=var-emebbed --embedded --experimental=collections/default.experimental
perl mysql-test-run.pl --timer --force --parallel=auto --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --suite=rpl,binlog --mysqld=--binlog-format=row --experimental=collections/default.experimental
perl mysql-test-run.pl --timer --force --parallel=auto --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1 --experimental=collections/default.experimental

View file

@ -258,3 +258,15 @@ dec $it;
}
show master status /* must show new binlog index after rotating */;
drop table t3;
--echo #
--echo # Bug #45998: database crashes when running "create as select"
--echo #
CREATE DATABASE test1;
USE test1;
DROP DATABASE test1;
CREATE TABLE test.t1(a int);
INSERT INTO test.t1 VALUES (1), (2);
CREATE TABLE test.t2 SELECT * FROM test.t1;
USE test;
DROP TABLES t1, t2;

View file

@ -1,27 +1,62 @@
--disable_warnings
drop database if exists `drop-temp+table-test`;
DROP DATABASE IF EXISTS `drop-temp+table-test`;
--enable_warnings
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
connection con1;
reset master;
create database `drop-temp+table-test`;
use `drop-temp+table-test`;
create temporary table shortn1 (a int);
create temporary table `table:name` (a int);
create temporary table shortn2 (a int);
select get_lock("a",10);
RESET MASTER;
CREATE DATABASE `drop-temp+table-test`;
USE `drop-temp+table-test`;
CREATE TEMPORARY TABLE shortn1 (a INT);
CREATE TEMPORARY TABLE `table:name` (a INT);
CREATE TEMPORARY TABLE shortn2 (a INT);
##############################################################################
# BUG#46572 DROP TEMPORARY table IF EXISTS does not have a consistent behavior
# in ROW mode
#
# In RBR, 'DROP TEMPORARY TABLE ...' statement should never be binlogged no
# matter if the tables exist or not. In contrast, both in SBR and MBR, the
# statement should be always binlogged no matter if the tables exist or not.
##############################################################################
CREATE TEMPORARY TABLE tmp(c1 int);
CREATE TEMPORARY TABLE tmp1(c1 int);
CREATE TEMPORARY TABLE tmp2(c1 int);
CREATE TEMPORARY TABLE tmp3(c1 int);
CREATE TABLE t(c1 int);
DROP TEMPORARY TABLE IF EXISTS tmp;
--disable_warnings
# Before fixing BUG#46572, 'DROP TEMPORARY TABLE IF EXISTS...' statement was
# binlogged when the table did not exist in RBR.
DROP TEMPORARY TABLE IF EXISTS tmp;
# In RBR, 'DROP TEMPORARY TABLE ...' statement is never binlogged no matter if
# the tables exist or not.
DROP TEMPORARY TABLE IF EXISTS tmp, tmp1;
DROP TEMPORARY TABLE tmp3;
#In RBR, tmp2 will NOT be binlogged, because it is a temporary table.
DROP TABLE IF EXISTS tmp2, t;
#In RBR, tmp2 will be binlogged, because it does not exist and master do not know
# whether it is a temporary table or not.
DROP TABLE IF EXISTS tmp2, t;
--enable_warnings
SELECT GET_LOCK("a",10);
disconnect con1;
connection con2;
# We want to SHOW BINLOG EVENTS, to know what was logged. But there is no
# guarantee that logging of the terminated con1 has been done yet.
# To be sure that logging has been done, we use a user lock.
select get_lock("a",10);
let $VERSION=`select version()`;
SELECT GET_LOCK("a",10);
let $VERSION=`SELECT VERSION()`;
source include/show_binlog_events.inc;
drop database `drop-temp+table-test`;
DROP DATABASE `drop-temp+table-test`;
# End of 4.1 tests

View file

@ -163,5 +163,81 @@ show create table t1;
connection master;
drop table t1;
# End cleanup
#
# BUG#45999 Row based replication fails when auto_increment field = 0.
# Store engine of Slaves auto-generates new sequence numbers for
# auto_increment fields if the values of them are 0. There is an inconsistency
# between slave and master. When MODE_NO_AUTO_VALUE_ON_ZERO are masters treat
#
source include/master-slave-reset.inc;
connection master;
--disable_warnings
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
--enable_warnings
eval CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=$engine_type;
eval CREATE TABLE t2 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=$engine_type2;
SET SQL_MODE='';
# Value of the id will be 1;
INSERT INTO t1 VALUES(NULL);
INSERT INTO t2 VALUES(NULL);
SELECT * FROM t1;
SELECT * FROM t2;
# Value of the id will be 2;
INSERT INTO t1 VALUES();
INSERT INTO t2 VALUES();
SELECT * FROM t1;
SELECT * FROM t2;
# Value of the id will be 3. The master treats 0 as NULL or empty because
# NO_AUTO_VALUE_ON_ZERO is not assign to SQL_MODE.
INSERT INTO t1 VALUES(0);
INSERT INTO t2 VALUES(0);
SELECT * FROM t1;
SELECT * FROM t2;
SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
# Value of the id will be 0. The master does not treat 0 as NULL or empty
# because NO_AUTO_VALUE_ON_ZERO has assigned to SQL_MODE.
INSERT INTO t1 VALUES(0);
INSERT INTO t2 VALUES(0);
SELECT * FROM t1;
SELECT * FROM t2;
INSERT INTO t1 VALUES(4);
INSERT INTO t2 VALUES(4);
FLUSH LOGS;
sync_slave_with_master;
let $diff_table_1= master:test.t1;
let $diff_table_2= slave:test.t1;
source include/diff_tables.inc;
let $diff_table_1= master:test.t2;
let $diff_table_2= slave:test.t2;
source include/diff_tables.inc;
connection master;
DROP TABLE t1;
DROP TABLE t2;
sync_slave_with_master;
connection master;
let $MYSQLD_DATADIR= `SELECT @@DATADIR`;
--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 | $MYSQL test
sync_slave_with_master;
let $diff_table_1= master:test.t1;
let $diff_table_2= slave:test.t1;
source include/diff_tables.inc;
let $diff_table_1= master:test.t2;
let $diff_table_2= slave:test.t2;
source include/diff_tables.inc;
# End cleanup
DROP TABLE t1;
DROP TABLE t2;
SET SQL_MODE='';
sync_slave_with_master;

View file

@ -22,6 +22,8 @@ DROP TABLE IF EXISTS t1, t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t14a,t15,t1
# should stop the slave. #
#################################################
call mtr.add_suppression("Slave: Unknown table 't6' Error_code: 1051");
--echo **** Diff Table Def Start ****
##############################################

View file

@ -0,0 +1,73 @@
#
# BUG#45214
# The common part of the "rpl_get_master_version_and_clock" test.
# Restart slave under network disconnection between slave and master
# following the steps:
# 1 - Got DBUG_SYNC_POINT lock
# 2 - Set DBUG_SYNC_POINT before call mysql_real_query(...) function in get_master_version_and_clock(...) function and hang here
# 3 - shutdown master server for simulating network disconnection
# 4 - Release DBUG_SYNC_POINT lock
# 5 - Check if the slave I/O thread tries to reconnect to master.
#
# Note: Please make sure initialize the $debug_lock when call the test script.
#
connection slave;
if (`SELECT '$debug_lock' = ''`)
{
--die Cannot continue. Please set value for $debug_lock.
}
# Restart slave
--disable_warnings
stop slave;
source include/wait_for_slave_to_stop.inc;
start slave;
source include/wait_for_slave_to_start.inc;
connection master;
# Write file to make mysql-test-run.pl expect the "crash", but don't start
# it until it's told to
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
wait
EOF
# Send shutdown to the connected server and give
# it 10 seconds to die before zapping it
shutdown_server 10;
connection slave;
eval SELECT RELEASE_LOCK($debug_lock);
# Show slave last IO errno
connection slave;
source include/wait_for_slave_io_error.inc;
let $last_io_errno= query_get_value("show slave status", Last_IO_Errno, 1);
--echo Check network error happened here
if (`SELECT '$last_io_errno' = '2013' || # CR_SERVER_LOST
'$last_io_errno' = '2003' || # CR_CONN_HOST_ERROR
'$last_io_errno' = '2002' || # CR_CONNECTION_ERROR
'$last_io_errno' = '2006' || # CR_SERVER_GONE_ERROR
'$last_io_errno' = '1040' || # ER_CON_COUNT_ERROR
'$last_io_errno' = '1053' # ER_SERVER_SHUTDOWN
`)
{
--echo NETWORK ERROR
}
# Write file to make mysql-test-run.pl start up the server again
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
restart
EOF
connection master;
# Turn on reconnect
--enable_reconnect
# Call script that will poll the server waiting for it to be back online again
--source include/wait_until_connected_again.inc
# Turn off reconnect again
--disable_reconnect
connection slave;
source include/wait_for_slave_to_start.inc;

View file

@ -0,0 +1,710 @@
###################################################################################
# This test checks if transactions that mixes transactional and non-transactional
# tables are correctly handled in statement mode. In an nutshell, we have what
# follows:
#
# 1) "B T T C" generates in binlog the "B T T C" entries.
#
# 2) "B T T R" generates in binlog an "empty" entry.
#
# 3) "B T N C" generates in binlog the "B T N C" entries.
#
# 4) "B T N R" generates in binlog the "B T N R" entries.
#
# 5) "T" generates in binlog the "B T C" entry.
#
# 6) "N" generates in binlog the "N" entry.
#
# 7) "M" generates in binglog the "B M C" entries.
#
# 8) "B N N T C" generates in binglog the "N N B T C" entries.
#
# 9) "B N N T R" generates in binlog the "N N B T R" entries.
#
# 10) "B N N C" generates in binglog the "N N" entries.
#
# 11) "B N N R" generates in binlog the "N N" entries.
#
# 12) "B M T C" generates in the binlog the "B M T C" entries.
#
# 13) "B M T R" generates in the binlog the "B M T R" entries.
###################################################################################
--echo ###################################################################################
--echo # CONFIGURATION
--echo ###################################################################################
connection master;
SET SQL_LOG_BIN=0;
CREATE TABLE nt_1 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
CREATE TABLE nt_2 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
CREATE TABLE nt_3 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
CREATE TABLE nt_4 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
CREATE TABLE tt_1 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
CREATE TABLE tt_2 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
CREATE TABLE tt_3 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
CREATE TABLE tt_4 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
SET SQL_LOG_BIN=1;
connection slave;
SET SQL_LOG_BIN=0;
CREATE TABLE nt_1 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
CREATE TABLE nt_2 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
CREATE TABLE nt_3 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
CREATE TABLE nt_4 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
CREATE TABLE tt_1 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
CREATE TABLE tt_2 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
CREATE TABLE tt_3 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
CREATE TABLE tt_4 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
SET SQL_LOG_BIN=1;
connection master;
DELIMITER |;
CREATE FUNCTION f1 () RETURNS VARCHAR(64)
BEGIN
RETURN "Testing...";
END|
CREATE FUNCTION f2 () RETURNS VARCHAR(64)
BEGIN
RETURN f1();
END|
CREATE PROCEDURE pc_i_tt_3 (IN x INT, IN y VARCHAR(64))
BEGIN
INSERT INTO tt_3 VALUES (y,x,x);
END|
CREATE TRIGGER tr_i_tt_3_to_nt_3 BEFORE INSERT ON tt_3 FOR EACH ROW
BEGIN
INSERT INTO nt_3 VALUES (NEW.a, NEW.b, NEW.c);
END|
CREATE TRIGGER tr_i_nt_4_to_tt_4 BEFORE INSERT ON nt_4 FOR EACH ROW
BEGIN
INSERT INTO tt_4 VALUES (NEW.a, NEW.b, NEW.c);
END|
DELIMITER ;|
--echo ###################################################################################
--echo # MIXING TRANSACTIONAL and NON-TRANSACTIONAL TABLES
--echo ###################################################################################
connection master;
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
--echo #1) "B T T C" generates in binlog the "B T T C" entries.
--echo #
BEGIN;
INSERT INTO tt_1 VALUES ("new text 4", 4, "new text 4");
INSERT INTO tt_2 VALUES ("new text 4", 4, "new text 4");
COMMIT;
--source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
--echo #1.e) "B T T C" with error in T generates in binlog the "B T T C" entries.
--echo #
INSERT INTO tt_1 VALUES ("new text -2", -2, "new text -2");
BEGIN;
--error ER_DUP_ENTRY
INSERT INTO tt_1 VALUES ("new text -1", -1, "new text -1"), ("new text -2", -2, "new text -2");
INSERT INTO tt_2 VALUES ("new text -3", -3, "new text -3");
COMMIT;
BEGIN;
INSERT INTO tt_2 VALUES ("new text -5", -5, "new text -5");
--error ER_DUP_ENTRY
INSERT INTO tt_2 VALUES ("new text -4", -4, "new text -4"), ("new text -5", -5, "new text -5");
COMMIT;
--source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
--echo #2) "B T T R" generates in binlog an "empty" entry.
--echo #
BEGIN;
INSERT INTO tt_1 VALUES ("new text 5", 5, "new text 5");
INSERT INTO tt_2 VALUES ("new text 5", 5, "new text 5");
ROLLBACK;
--source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
--echo #2.e) "B T T R" with error in T generates in binlog an "empty" entry.
--echo #
INSERT INTO tt_1 VALUES ("new text -7", -7, "new text -7");
BEGIN;
--error ER_DUP_ENTRY
INSERT INTO tt_1 VALUES ("new text -6", -6, "new text -6"), ("new text -7", -7, "new text -7");
INSERT INTO tt_2 VALUES ("new text -8", -8, "new text -8");
ROLLBACK;
BEGIN;
INSERT INTO tt_2 VALUES ("new text -10", -10, "new text -10");
--error ER_DUP_ENTRY
INSERT INTO tt_2 VALUES ("new text -9", -9, "new text -9"), ("new text -10", -10, "new text -10");
ROLLBACK;
--source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
--echo #3) "B T N C" generates in binlog the "B T N C" entries.
--echo #
BEGIN;
INSERT INTO tt_1 VALUES ("new text 6", 6, "new text 6");
INSERT INTO nt_1 VALUES ("new text 6", 6, "new text 6");
COMMIT;
--source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
--echo #3.e) "B T N C" with error in either T or N generates in binlog the "B T N C" entries.
--echo #
INSERT INTO tt_1 VALUES ("new text -12", -12, "new text -12");
BEGIN;
--error ER_DUP_ENTRY
INSERT INTO tt_1 VALUES ("new text -11", -11, "new text -11"), ("new text -12", -12, "new text -12");
INSERT INTO nt_1 VALUES ("new text -13", -13, "new text -13");
COMMIT;
BEGIN;
INSERT INTO tt_1 VALUES ("new text -14", -14, "new text -14");
INSERT INTO nt_1 VALUES ("new text -16", -16, "new text -16");
--error ER_DUP_ENTRY
INSERT INTO nt_1 VALUES ("new text -15", -15, "new text -15"), ("new text -16", -16, "new text -16");
COMMIT;
--source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
--echo #4) "B T N R" generates in binlog the "B T N R" entries.
--echo #
BEGIN;
INSERT INTO tt_1 VALUES ("new text 7", 7, "new text 7");
INSERT INTO nt_1 VALUES ("new text 7", 7, "new text 7");
ROLLBACK;
--source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
--echo #4.e) "B T N R" with error in either T or N generates in binlog the "B T N R" entries.
--echo #
INSERT INTO tt_1 VALUES ("new text -17", -17, "new text -17");
BEGIN;
--error ER_DUP_ENTRY
INSERT INTO tt_1 VALUES ("new text -16", -16, "new text -16"), ("new text -17", -17, "new text -17");
INSERT INTO nt_1 VALUES ("new text -18", -18, "new text -18");
ROLLBACK;
BEGIN;
INSERT INTO tt_1 VALUES ("new text -19", -19, "new text -19");
INSERT INTO nt_1 VALUES ("new text -21", -21, "new text -21");
--error ER_DUP_ENTRY
INSERT INTO nt_1 VALUES ("new text -20", -20, "new text -20"), ("new text -21", -21, "new text -21");
ROLLBACK;
--source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
--echo #5) "T" generates in binlog the "B T C" entry.
--echo #
INSERT INTO tt_1 VALUES ("new text 8", 8, "new text 8");
--source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
--echo #5.e) "T" with error in T generates in binlog an "empty" entry.
--echo #
INSERT INTO tt_1 VALUES ("new text -1", -1, "new text -1");
--error ER_DUP_ENTRY
INSERT INTO tt_1 VALUES ("new text -1", -1, "new text -1"), ("new text -22", -22, "new text -22");
--error ER_DUP_ENTRY
INSERT INTO tt_1 VALUES ("new text -23", -23, "new text -23"), ("new text -1", -1, "new text -1");
--source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
--echo #6) "N" generates in binlog the "N" entry.
--echo #
INSERT INTO nt_1 VALUES ("new text 9", 9, "new text 9");
--source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
--echo #6.e) "N" with error in N generates in binlog an empty entry if the error
--echo # happens in the first tuple. Otherwise, generates the "N" entry and
--echo # the error is appended.
--echo #
INSERT INTO nt_1 VALUES ("new text -1", -1, "new text -1");
--error ER_DUP_ENTRY
INSERT INTO nt_1 VALUES ("new text -1", -1, "new text -1");
--error ER_DUP_ENTRY
INSERT INTO nt_1 VALUES ("new text -24", -24, "new text -24"), ("new text -1", -1, "new text -1");
--source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
--echo #7) "M" generates in binglog the "B M C" entries.
--echo #
DELETE FROM nt_1;
INSERT INTO nt_1 SELECT * FROM tt_1;
DELETE FROM tt_1;
INSERT INTO tt_1 SELECT * FROM nt_1;
INSERT INTO tt_3 VALUES ("new text 000", 000, '');
INSERT INTO tt_3 VALUES("new text 100", 100, f1());
INSERT INTO nt_4 VALUES("new text 100", 100, f1());
INSERT INTO tt_3 VALUES("new text 200", 200, f2());
INSERT INTO nt_4 VALUES ("new text 300", 300, '');
INSERT INTO nt_4 VALUES ("new text 400", 400, f1());
INSERT INTO nt_4 VALUES ("new text 500", 500, f2());
CALL pc_i_tt_3(600, "Testing...");
UPDATE nt_3, nt_4, tt_3, tt_4 SET nt_3.a= "new text 1", nt_4.a= "new text 1", tt_3.a= "new text 1", tt_4.a= "new text 1" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
UPDATE tt_3, tt_4, nt_3, nt_4 SET tt_3.a= "new text 2", tt_4.a= "new text 2", nt_3.a= "new text 2", nt_4.a = "new text 2" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 3", nt_3.a= "new text 3", nt_4.a= "new text 3", tt_4.a = "new text 3" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 4", nt_3.a= "new text 4", nt_4.a= "new text 4", tt_4.a = "new text 4" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
--source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
--echo #7.e) "M" with error in M generates in binglog the "B M R" entries.
--echo #
INSERT INTO nt_3 VALUES ("new text -26", -26, '');
SELECT * FROM tt_3;
--error ER_DUP_ENTRY
INSERT INTO tt_3 VALUES ("new text -25", -25, ''), ("new text -26", -26, '');
SELECT * FROM tt_3;
INSERT INTO tt_4 VALUES ("new text -26", -26, '');
SELECT * FROM nt_4;
--error ER_DUP_ENTRY
INSERT INTO nt_4 VALUES ("new text -25", -25, ''), ("new text -26", -26, '');
SELECT * FROM nt_4;
--source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
--echo #8) "B N N T C" generates in binglog the "N N B T C" entries.
--echo #
BEGIN;
INSERT INTO nt_1 VALUES ("new text 10", 10, "new text 10");
INSERT INTO nt_2 VALUES ("new text 10", 10, "new text 10");
INSERT INTO tt_1 VALUES ("new text 10", 10, "new text 10");
COMMIT;
--source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
--echo #
--echo #8.e) "B N N T R" See 6.e and 9.e.
--echo #
--echo
--echo
--echo
--echo
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
--echo #9) "B N N T R" generates in binlog the "N N B T R" entries.
--echo #
BEGIN;
INSERT INTO nt_1 VALUES ("new text 11", 11, "new text 11");
INSERT INTO nt_2 VALUES ("new text 11", 11, "new text 11");
INSERT INTO tt_1 VALUES ("new text 11", 11, "new text 11");
ROLLBACK;
--source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
--echo #9.e) "B N N T R" with error in N generates in binlog the "N N B T R" entries.
--echo #
BEGIN;
INSERT INTO nt_1 VALUES ("new text -25", -25, "new text -25");
INSERT INTO nt_2 VALUES ("new text -25", -25, "new text -25");
--error ER_DUP_ENTRY
INSERT INTO nt_2 VALUES ("new text -26", -26, "new text -26"), ("new text -25", -25, "new text -25");
INSERT INTO tt_1 VALUES ("new text -27", -27, "new text -27");
ROLLBACK;
--source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
--echo #10) "B N N C" generates in binglog the "N N" entries.
--echo #
BEGIN;
INSERT INTO nt_1 VALUES ("new text 12", 12, "new text 12");
INSERT INTO nt_2 VALUES ("new text 12", 12, "new text 12");
COMMIT;
--source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
--echo #
--echo #10.e) "B N N C" See 6.e and 9.e.
--echo #
--echo
--echo
--echo
--echo
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
--echo #11) "B N N R" generates in binlog the "N N" entries.
--echo #
BEGIN;
INSERT INTO nt_1 VALUES ("new text 13", 13, "new text 13");
INSERT INTO nt_2 VALUES ("new text 13", 13, "new text 13");
ROLLBACK;
--source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
--echo #
--echo #11.e) "B N N R" See 6.e and 9.e.
--echo #
--echo
--echo
--echo
--echo
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
--echo #12) "B M T C" generates in the binlog the "B M T C" entries.
--echo #
DELETE FROM nt_1;
BEGIN;
INSERT INTO nt_1 SELECT * FROM tt_1;
INSERT INTO tt_2 VALUES ("new text 14", 14, "new text 14");
COMMIT;
DELETE FROM tt_1;
BEGIN;
INSERT INTO tt_1 SELECT * FROM nt_1;
INSERT INTO tt_2 VALUES ("new text 15", 15, "new text 15");
COMMIT;
BEGIN;
INSERT INTO tt_3 VALUES ("new text 700", 700, '');
INSERT INTO tt_1 VALUES ("new text 800", 800, '');
COMMIT;
BEGIN;
INSERT INTO tt_3 VALUES("new text 900", 900, f1());
INSERT INTO tt_1 VALUES ("new text 1000", 1000, '');
COMMIT;
BEGIN;
INSERT INTO tt_3 VALUES(1100, 1100, f2());
INSERT INTO tt_1 VALUES ("new text 1200", 1200, '');
COMMIT;
BEGIN;
INSERT INTO nt_4 VALUES ("new text 1300", 1300, '');
INSERT INTO tt_1 VALUES ("new text 1400", 1400, '');
COMMIT;
BEGIN;
INSERT INTO nt_4 VALUES("new text 1500", 1500, f1());
INSERT INTO tt_1 VALUES ("new text 1600", 1600, '');
COMMIT;
BEGIN;
INSERT INTO nt_4 VALUES("new text 1700", 1700, f2());
INSERT INTO tt_1 VALUES ("new text 1800", 1800, '');
COMMIT;
BEGIN;
CALL pc_i_tt_3(1900, "Testing...");
INSERT INTO tt_1 VALUES ("new text 2000", 2000, '');
COMMIT;
BEGIN;
UPDATE nt_3, nt_4, tt_3, tt_4 SET nt_3.a= "new text 5", nt_4.a= "new text 5", tt_3.a= "new text 5", tt_4.a= "new text 5" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
INSERT INTO tt_1 VALUES ("new text 2100", 2100, '');
COMMIT;
BEGIN;
UPDATE tt_3, tt_4, nt_3, nt_4 SET tt_3.a= "new text 6", tt_4.a= "new text 6", nt_3.a= "new text 6", nt_4.a = "new text 6" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
INSERT INTO tt_1 VALUES ("new text 2200", 2200, '');
COMMIT;
BEGIN;
UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 7", nt_3.a= "new text 7", nt_4.a= "new text 7", tt_4.a = "new text 7" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
INSERT INTO tt_1 VALUES ("new text 2300", 2300, '');
COMMIT;
BEGIN;
UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 8", nt_3.a= "new text 8", nt_4.a= "new text 8", tt_4.a = "new text 8" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
INSERT INTO tt_1 VALUES ("new text 2400", 2400, '');
COMMIT;
--source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
--echo #12.e) "B M T C" with error in M generates in the binlog the "B M T C" entries.
--echo #
--echo # There is a bug in the slave that needs to be fixed before enabling
--echo # this part of the test. A bug report will be filed referencing this
--echo # test case.
BEGIN;
INSERT INTO nt_3 VALUES ("new text -28", -28, '');
--error ER_DUP_ENTRY
INSERT INTO tt_3 VALUES ("new text -27", -27, ''), ("new text -28", -28, '');
INSERT INTO tt_1 VALUES ("new text -27", -27, '');
COMMIT;
BEGIN;
INSERT INTO tt_4 VALUES ("new text -28", -28, '');
--error ER_DUP_ENTRY
INSERT INTO nt_4 VALUES ("new text -27", -27, ''), ("new text -28", -28, '');
INSERT INTO tt_1 VALUES ("new text -28", -28, '');
COMMIT;
--source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
--echo #13) "B M T R" generates in the binlog the "B M T R" entries
--echo #
DELETE FROM nt_1;
BEGIN;
INSERT INTO nt_1 SELECT * FROM tt_1;
INSERT INTO tt_2 VALUES ("new text 17", 17, "new text 17");
ROLLBACK;
DELETE FROM tt_1;
BEGIN;
INSERT INTO tt_1 SELECT * FROM nt_1;
INSERT INTO tt_2 VALUES ("new text 18", 18, "new text 18");
ROLLBACK;
INSERT INTO tt_1 SELECT * FROM nt_1;
BEGIN;
INSERT INTO tt_3 VALUES ("new text 2500", 2500, '');
INSERT INTO tt_1 VALUES ("new text 2600", 2600, '');
ROLLBACK;
BEGIN;
INSERT INTO tt_3 VALUES("new text 2700", 2700, f1());
INSERT INTO tt_1 VALUES ("new text 2800", 2800, '');
ROLLBACK;
BEGIN;
INSERT INTO tt_3 VALUES(2900, 2900, f2());
INSERT INTO tt_1 VALUES ("new text 3000", 3000, '');
ROLLBACK;
BEGIN;
INSERT INTO nt_4 VALUES ("new text 3100", 3100, '');
INSERT INTO tt_1 VALUES ("new text 3200", 3200, '');
ROLLBACK;
BEGIN;
INSERT INTO nt_4 VALUES("new text 3300", 3300, f1());
INSERT INTO tt_1 VALUES ("new text 3400", 3400, '');
ROLLBACK;
BEGIN;
INSERT INTO nt_4 VALUES("new text 3500", 3500, f2());
INSERT INTO tt_1 VALUES ("new text 3600", 3600, '');
ROLLBACK;
BEGIN;
CALL pc_i_tt_3(3700, "Testing...");
INSERT INTO tt_1 VALUES ("new text 3700", 3700, '');
ROLLBACK;
BEGIN;
UPDATE nt_3, nt_4, tt_3, tt_4 SET nt_3.a= "new text 9", nt_4.a= "new text 9", tt_3.a= "new text 9", tt_4.a= "new text 9" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
INSERT INTO tt_1 VALUES ("new text 3800", 3800, '');
ROLLBACK;
BEGIN;
UPDATE tt_3, tt_4, nt_3, nt_4 SET tt_3.a= "new text 10", tt_4.a= "new text 10", nt_3.a= "new text 10", nt_4.a = "new text 10" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
INSERT INTO tt_1 VALUES ("new text 3900", 3900, '');
ROLLBACK;
BEGIN;
UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 11", nt_3.a= "new text 11", nt_4.a= "new text 11", tt_4.a = "new text 11" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
INSERT INTO tt_1 VALUES ("new text 4000", 4000, '');
ROLLBACK;
BEGIN;
UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 12", nt_3.a= "new text 12", nt_4.a= "new text 12", tt_4.a = "new text 12" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
INSERT INTO tt_1 VALUES ("new text 4100", 4100, '');
ROLLBACK;
--source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
--echo #13.e) "B M T R" with error in M generates in the binlog the "B M T R" entries.
--echo #
BEGIN;
INSERT INTO nt_3 VALUES ("new text -30", -30, '');
--error ER_DUP_ENTRY
INSERT INTO tt_3 VALUES ("new text -29", -29, ''), ("new text -30", -30, '');
INSERT INTO tt_1 VALUES ("new text -30", -30, '');
ROLLBACK;
BEGIN;
INSERT INTO tt_4 VALUES ("new text -30", -30, '');
--error ER_DUP_ENTRY
INSERT INTO nt_4 VALUES ("new text -29", -29, ''), ("new text -30", -30, '');
INSERT INTO tt_1 VALUES ("new text -31", -31, '');
ROLLBACK;
--source include/show_binlog_events.inc
connection master;
sync_slave_with_master;
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/test-master.sql
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/test-slave.sql
--diff_files $MYSQLTEST_VARDIR/tmp/test-master.sql $MYSQLTEST_VARDIR/tmp/test-slave.sql
--echo ###################################################################################
--echo # CLEAN
--echo ###################################################################################
connection master;
DROP TABLE tt_1;
DROP TABLE tt_2;
DROP TABLE tt_3;
DROP TABLE tt_4;
DROP TABLE nt_1;
DROP TABLE nt_2;
DROP TABLE nt_3;
DROP TABLE nt_4;
DROP PROCEDURE pc_i_tt_3;
DROP FUNCTION f1;
DROP FUNCTION f2;
sync_slave_with_master;

View file

@ -41,3 +41,57 @@ reset slave;
start slave;
sync_with_master;
show status like 'slave_open_temp_tables';
#
#Bug#34654 RESET SLAVE does not clear LAST_IO_Err*
#
# clearing the status
stop slave;
reset slave;
let $last_io_errno= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1);
echo *** errno must be zero: $last_io_errno ***;
#
# verifying start slave resets Last_IO_Error and Last_IO_Errno.
#
change master to master_user='impossible_user_name';
start slave;
source include/wait_for_slave_io_error.inc;
let $last_io_errno= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1);
--disable_query_log
eval SELECT $last_io_errno > 0 as ONE;
--enable_query_log
source include/stop_slave.inc;
change master to master_user='root';
source include/start_slave.inc;
let $last_io_errno= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1);
let $last_io_error= query_get_value(SHOW SLAVE STATUS, Last_IO_Error, 1);
--echo *** last errno must be zero: $last_io_errno ***
--echo *** last error must be blank: $last_io_error ***
#
# verifying reset slave resets Last_{IO,SQL}_Err{or,no}
#
source include/stop_slave.inc;
change master to master_user='impossible_user_name';
start slave;
source include/wait_for_slave_io_error.inc;
let $last_io_errno= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1);
--disable_query_log
eval SELECT $last_io_errno > 0 as ONE;
--enable_query_log
source include/stop_slave.inc;
reset slave;
let $last_io_errno= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1);
let $last_io_error= query_get_value(SHOW SLAVE STATUS, Last_IO_Error, 1);
let $last_sql_errno= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1);
let $last_sql_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1);
--echo *** io last errno must be zero: $last_io_errno ***
--echo *** io last error must be blank: $last_io_error ***
--echo *** sql last errno must be zero: $last_sql_errno ***
--echo *** sql last error must be blank: $last_sql_error ***

View file

@ -9,29 +9,27 @@
#############################################################################
# Begin clean up test section
connection master;
--disable_warnings
create database if not exists mysqltest1;
DROP PROCEDURE IF EXISTS mysqltest1.p1;
DROP PROCEDURE IF EXISTS mysqltest1.p2;
DROP TABLE IF EXISTS mysqltest1.t2;
DROP TABLE IF EXISTS mysqltest1.t1;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS p2;
--enable_warnings
# End of cleanup
# Begin test section 1
eval CREATE TABLE IF NOT EXISTS mysqltest1.t1(name CHAR(16), birth DATE,PRIMARY KEY(name))ENGINE=$engine_type;
eval CREATE TABLE IF NOT EXISTS mysqltest1.t2(name CHAR(16), age INT ,PRIMARY KEY(name))ENGINE=$engine_type;
eval CREATE TABLE IF NOT EXISTS t1(name CHAR(16), birth DATE,PRIMARY KEY(name))ENGINE=$engine_type;
eval CREATE TABLE IF NOT EXISTS t2(name CHAR(16), age INT ,PRIMARY KEY(name))ENGINE=$engine_type;
delimiter |;
CREATE PROCEDURE mysqltest1.p1()
CREATE PROCEDURE p1()
BEGIN
DECLARE done INT DEFAULT 0;
DECLARE spa CHAR(16);
DECLARE spb INT;
DECLARE cur1 CURSOR FOR SELECT name,
(YEAR(CURDATE())-YEAR(birth))-(RIGHT(CURDATE(),5)<RIGHT(birth,5))
FROM mysqltest1.t1;
FROM t1;
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
OPEN cur1;
@ -41,7 +39,7 @@ BEGIN
FETCH cur1 INTO spa, spb;
IF NOT done THEN
START TRANSACTION;
INSERT INTO mysqltest1.t2 VALUES (spa,spb);
INSERT INTO t2 VALUES (spa,spb);
COMMIT;
END IF;
UNTIL done END REPEAT;
@ -49,30 +47,29 @@ BEGIN
SET AUTOCOMMIT=1;
CLOSE cur1;
END|
CREATE PROCEDURE mysqltest1.p2()
CREATE PROCEDURE p2()
BEGIN
INSERT INTO mysqltest1.t1 VALUES ('MySQL','1993-02-04'),('ROCKS', '1990-08-27'),('Texas', '1999-03-30'),('kyle','2005-1-1');
INSERT INTO t1 VALUES ('MySQL','1993-02-04'),('ROCKS', '1990-08-27'),('Texas', '1999-03-30'),('kyle','2005-1-1');
END|
delimiter ;|
CALL mysqltest1.p2();
CALL p2();
sync_slave_with_master;
connection master;
CALL mysqltest1.p1();
CALL p1();
sync_slave_with_master;
connection master;
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/sp006_master.sql
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/sp006_slave.sql
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp006_master.sql
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp006_slave.sql
DROP PROCEDURE IF EXISTS mysqltest1.p1;
DROP PROCEDURE IF EXISTS mysqltest1.p2;
DROP TABLE IF EXISTS mysqltest1.t1;
DROP TABLE IF EXISTS mysqltest1.t2;
DROP DATABASE mysqltest1;
DROP TABLE t1;
DROP TABLE t2;
DROP PROCEDURE p1;
DROP PROCEDURE p2;
# Lets compare. Note: If they match test will pass, if they do not match
# the test will show that the diff statement failed and not reject file

View file

@ -669,13 +669,9 @@ call p_verify_status_increment(1, 0, 1, 0);
insert t1 set a=3;
call p_verify_status_increment(2, 2, 2, 2);
savepoint a;
call p_verify_status_increment(0, 0, 0, 0);
call p_verify_status_increment(1, 0, 1, 0);
insert t1 set a=4;
--echo # Binlog does not register itself this time for other than the 1st
--echo # statement of the transaction with MIXED/STATEMENT binlog_format.
--echo # It needs registering with the ROW format. Therefore 1,0,2,2 are
--echo # the correct arguments to this test after bug#40221 fixed.
call p_verify_status_increment(1, 0, 2, 2);
call p_verify_status_increment(2, 2, 2, 2);
release savepoint a;
rollback;
call p_verify_status_increment(0, 0, 0, 0);
@ -729,9 +725,9 @@ call p_verify_status_increment(4, 4, 4, 4);
alter table t3 add column (b int);
call p_verify_status_increment(2, 0, 2, 0);
alter table t3 rename t4;
call p_verify_status_increment(1, 0, 1, 0);
call p_verify_status_increment(2, 2, 2, 2);
rename table t4 to t3;
call p_verify_status_increment(1, 0, 1, 0);
call p_verify_status_increment(2, 2, 2, 2);
truncate table t3;
call p_verify_status_increment(4, 4, 4, 4);
create view v1 as select * from t2;

View file

@ -0,0 +1,7 @@
#
# Whether server supports dynamic loading.
#
--require r/have_dynamic_loading.require
disable_query_log;
show variables like 'have_dynamic_loading';
enable_query_log;

View file

@ -2,10 +2,7 @@
# Check if server has support for loading udf's
# i.e it will support dlopen
#
--require r/have_dynamic_loading.require
disable_query_log;
show variables like 'have_dynamic_loading';
enable_query_log;
--source include/have_dynamic_loading.inc
#
# Check if the variable EXAMPLE_PLUGIN is set

View file

@ -0,0 +1,4 @@
--require r/have_mysql_upgrade.result
--disable_query_log
select LENGTH("$MYSQL_UPGRADE")>0 as have_mysql_upgrade;
--enable_query_log

View file

@ -0,0 +1,4 @@
disable_query_log;
--require r/not_true.require
select (PLUGIN_LIBRARY LIKE 'ha_innodb_plugin%') as `TRUE` from information_schema.plugins where PLUGIN_NAME='InnoDB';
enable_query_log;

View file

@ -2,10 +2,7 @@
# Check if server has support for loading udf's
# i.e it will support dlopen
#
--require r/have_dynamic_loading.require
disable_query_log;
show variables like 'have_dynamic_loading';
enable_query_log;
--source include/have_dynamic_loading.inc
#
# Check if the variable SIMPLE_PARSER is set

View file

@ -2,10 +2,7 @@
# Check if server has support for loading udf's
# i.e it will support dlopen
#
--require r/have_dynamic_loading.require
disable_query_log;
show variables like 'have_dynamic_loading';
enable_query_log;
--source include/have_dynamic_loading.inc
#
# Check if the variable UDF_EXAMPLE_LIB is set

View file

@ -527,4 +527,30 @@ where exists (select 1 from t2, t3
drop table t0, t1, t2, t3;
--echo #
--echo # BUG#44810: index merge and order by with low sort_buffer_size
--echo # crashes server!
--echo #
CREATE TABLE t1(a VARCHAR(128),b VARCHAR(128),KEY(A),KEY(B));
INSERT INTO t1 VALUES (REPEAT('a',128),REPEAT('b',128));
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
SET SESSION sort_buffer_size=1;
EXPLAIN
SELECT * FROM t1 FORCE INDEX(a,b) WHERE a LIKE 'a%' OR b LIKE 'b%'
ORDER BY a,b;
# we don't actually care about the result : we're checking if it crashes
--disable_result_log
SELECT * FROM t1 FORCE INDEX(a,b) WHERE a LIKE 'a%' OR b LIKE 'b%'
ORDER BY a,b;
--enable_result_log
SET SESSION sort_buffer_size=DEFAULT;
DROP TABLE t1;
--echo End of 5.0 tests

View file

@ -1171,6 +1171,16 @@ CREATE TABLE t1 (f1 INTEGER PRIMARY KEY COMMENT 'My ID#', f2 INTEGER DEFAULT NUL
SHOW CREATE TABLE t1;
DROP TABLE t1;
--echo #
--echo # Bug #36995: valgrind error in remove_const during subquery executions
--echo #
create table t1 (a bit(1) not null,b int) engine=myisam;
create table t2 (c int) engine=innodb;
explain
select b from t1 where a not in (select b from t1,t2 group by a) group by a;
DROP TABLE t1,t2;
--echo End of 5.0 tests
# Fix for BUG#19243 "wrong LAST_INSERT_ID() after ON DUPLICATE KEY
@ -1488,43 +1498,12 @@ INSERT INTO t1 VALUES
(4,1,3,'pk',NULL),(5,1,3,'c2',NULL),
(2,1,4,'c_extra',NULL),(3,1,4,'c_extra',NULL);
EXPLAIN SELECT * FROM t1 WHERE tid = 1 AND vid = 3 ORDER BY idx DESC;
EXPLAIN SELECT * FROM t1 FORCE INDEX (PRIMARY) WHERE tid = 1 AND vid = 3 ORDER BY idx DESC;
SELECT * FROM t1 WHERE tid = 1 AND vid = 3 ORDER BY idx DESC;
SELECT * FROM t1 FORCE INDEX (PRIMARY) WHERE tid = 1 AND vid = 3 ORDER BY idx DESC;
DROP TABLE t1;
#
# Bug#21704: Renaming column does not update FK definition.
#
#
# --disable_warnings
# DROP TABLE IF EXISTS t1;
# DROP TABLE IF EXISTS t2;
# --enable_warnings
#
# CREATE TABLE t1(id INT PRIMARY KEY)
# ENGINE=innodb;
#
# CREATE TABLE t2(
# t1_id INT PRIMARY KEY,
# CONSTRAINT fk1 FOREIGN KEY (t1_id) REFERENCES t1(id))
# ENGINE=innodb;
#
# --echo
#
# --disable_result_log
# --error ER_ERROR_ON_RENAME
# ALTER TABLE t1 CHANGE id id2 INT;
# --enable_result_log
#
# --echo
#
# DROP TABLE t2;
# DROP TABLE t1;
#
--echo #
--echo # Bug #44290: explain crashes for subquery with distinct in
--echo # SQL_SELECT::test_quick_select

View file

@ -132,16 +132,16 @@ INSERT INTO global_suppressions VALUES
("Error in Log_event::read_log_event\\\(\\\): 'Sanity check failed', data_len: 258, event_type: 49"),
("Statement is not safe to log in statement format"),
("Statement may not be safe to log in statement format"),
/* test case for Bug#bug29807 copies a stray frm into database */
("InnoDB: Error: table `test`.`bug29807` does not exist in the InnoDB internal"),
("Cannot find or open table test\/bug29807 from"),
/* innodb foreign key tests that fail in ALTER or RENAME produce this */
("InnoDB: Error: in ALTER TABLE `test`.`t[12]`"),
("InnoDB: Error: in ALTER TABLE `test`.`t[123]`"),
("InnoDB: Error: in RENAME TABLE table `test`.`t1`"),
("InnoDB: Error: table `test`.`t[12]` does not exist in the InnoDB internal"),
("InnoDB: Error: table `test`.`t[123]` does not exist in the InnoDB internal"),
/* Test case for Bug#14233 produces the following warnings: */
("Stored routine 'test'.'bug14233_1': invalid value in column mysql.proc"),
@ -162,6 +162,8 @@ INSERT INTO global_suppressions VALUES
("Slave: Unknown column 'c7' in 't15' Error_code: 1054"),
("Slave: Can't DROP 'c7'.* 1091"),
("Slave: Key column 'c6'.* 1072"),
("Slave I/O: The slave I/O thread stops because a fatal error is encountered when it try to get the value of SERVER_ID variable from master."),
(".SELECT UNIX_TIMESTAMP... failed on master, do not trust column Seconds_Behind_Master of SHOW SLAVE STATUS"),
/* Test case for Bug#31590 in order_by.test produces the following error */
("Out of sort memory; increase server sort buffer size"),
@ -171,6 +173,7 @@ INSERT INTO global_suppressions VALUES
this error message.
*/
("Can't find file: '.\\\\test\\\\\\?{8}.frm'"),
("Slave: Unknown table 't1' Error_code: 1051"),
("THE_LAST_SUPPRESSION")||

View file

@ -0,0 +1,12 @@
# include/no_valgrind_without_big.inc
#
# If we are running with Valgrind ($VALGRIND_TEST <> 0) than the resource
# consumption (storage space needed, runtime ...) will be extreme.
# Therefore we require that the option "--big-test" is also set.
#
if (`SELECT $VALGRIND_TEST <> 0 AND '$BIG_TEST' = ''`)
{
--skip Need "--big-test" when running with Valgrind
}

View file

@ -0,0 +1,69 @@
# Created for verifying bug#20577.
# expects TABLE t1 (... , a DATE, ...)
--sorted_result
SELECT * FROM t1 WHERE a < '1001-01-01';
--sorted_result
SELECT * FROM t1 WHERE a <= '1001-01-01';
--sorted_result
SELECT * FROM t1 WHERE a >= '1001-01-01';
--sorted_result
SELECT * FROM t1 WHERE a > '1001-01-01';
--sorted_result
SELECT * FROM t1 WHERE a = '1001-01-01';
--sorted_result
SELECT * FROM t1 WHERE a < '1001-00-00';
--sorted_result
SELECT * FROM t1 WHERE a <= '1001-00-00';
--sorted_result
SELECT * FROM t1 WHERE a >= '1001-00-00';
--sorted_result
SELECT * FROM t1 WHERE a > '1001-00-00';
--sorted_result
SELECT * FROM t1 WHERE a = '1001-00-00';
--echo # Disabling warnings for the invalid date
--disable_warnings
--sorted_result
SELECT * FROM t1 WHERE a < '1999-02-31';
--sorted_result
SELECT * FROM t1 WHERE a <= '1999-02-31';
--sorted_result
SELECT * FROM t1 WHERE a >= '1999-02-31';
--sorted_result
SELECT * FROM t1 WHERE a > '1999-02-31';
--sorted_result
SELECT * FROM t1 WHERE a = '1999-02-31';
--enable_warnings
--sorted_result
SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00';
--sorted_result
SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01';
--sorted_result
SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00';
--sorted_result
SELECT * FROM t1 WHERE a BETWEEN '0001-01-01' AND '1001-01-01';
if ($explain_partitions)
{
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1001-01-01';
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-01-01';
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-01-01';
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1001-01-01';
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1001-01-01';
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1001-00-00';
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-00-00';
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-00-00';
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1001-00-00';
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1001-00-00';
--echo # Disabling warnings for the invalid date
--disable_warnings
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1999-02-31';
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1999-02-31';
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1999-02-31';
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1999-02-31';
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1999-02-31';
--enable_warnings
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00';
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01';
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00';
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-01' AND '1001-01-01';
}

View file

@ -0,0 +1,35 @@
connection master;
--disable_warnings
DROP DATABASE IF EXISTS mysqltest;
--enable_warnings
CREATE DATABASE mysqltest CHARSET UTF8;
USE mysqltest;
CREATE TABLE t (cl varchar(100)) CHARSET UTF8;
if (!$LOAD_LOCAL)
{
LOAD DATA INFILE '../../std_data/loaddata_utf8.dat' INTO TABLE t
FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
}
if ($LOAD_LOCAL)
{
LOAD DATA LOCAL INFILE './std_data/loaddata_utf8.dat' INTO TABLE t
FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
}
save_master_pos;
echo ----------content on master----------;
SELECT hex(cl) FROM t;
connection slave;
sync_with_master;
echo ----------content on slave----------;
USE mysqltest;
SELECT hex(cl) FROM t;
connection master;
DROP DATABASE mysqltest;
save_master_pos;
connection slave;
sync_with_master;

View file

@ -0,0 +1,23 @@
# ==== Purpose ====
#
# Waits until the IO thread of the current connection has got an
# error, or until a timeout is reached.
#
# ==== Usage ====
#
# source include/wait_for_slave_io_error.inc;
#
# Parameters to this macro are $slave_timeout and
# $slave_keep_connection. See wait_for_slave_param.inc for
# descriptions.
let $old_slave_param_comparison= $slave_param_comparison;
let $slave_param= Last_IO_Errno;
let $slave_param_comparison= !=;
let $slave_param_value= 0;
let $slave_error_message= Failed while waiting for slave to produce an error in its sql thread;
source include/wait_for_slave_param.inc;
let $slave_error_message= ;
let $slave_param_comparison= $old_slave_param_comparison;

View file

@ -204,8 +204,10 @@ my @mysqld_rules=
{ 'port' => \&fix_port },
{ 'socket' => \&fix_socket },
{ '#log-error' => \&fix_log_error },
{ 'log' => \&fix_log },
{ 'log-slow-queries' => \&fix_log_slow_queries },
{ 'general_log' => 1 },
{ 'general_log_file' => \&fix_log },
{ 'slow_query_log' => 1 },
{ 'slow_query_log_file' => \&fix_log_slow_queries },
{ '#user' => sub { return shift->{ARGS}->{user} || ""; } },
{ '#password' => sub { return shift->{ARGS}->{password} || ""; } },
{ 'server-id' => \&fix_server_id, },

View file

@ -106,10 +106,13 @@ sub check_socket_path_length {
my ($path)= @_;
return 0 if IS_WINDOWS;
# This may not be true, but we can't test for it on AIX due to Perl bug
# See Bug #45771
return 0 if ($^O eq 'aix');
require IO::Socket::UNIX;
my $truncated= 1; # Be negative
my $truncated= undef;
# Create a tempfile name with same length as "path"
my $tmpdir = tempdir( CLEANUP => 0);
@ -122,6 +125,7 @@ sub check_socket_path_length {
Local => $testfile,
Listen => 1,
);
$truncated= 1; # Be negatvie
die "Could not create UNIX domain socket: $!"
unless defined $sock;
@ -133,6 +137,9 @@ sub check_socket_path_length {
};
die "Unexpected failure when checking socket path length: $@"
if $@ and not defined $truncated;
$sock= undef; # Close socket
rmtree($tmpdir); # Remove the tempdir and any socket file created
return $truncated;

View file

@ -13,7 +13,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
safedir = $(prefix)/mysql-test/lib/My/SafeProcess
testroot = $(prefix)
safedir = $(testroot)/mysql-test/lib/My/SafeProcess
#nobase_bin_PROGRAMS = ...
safe_PROGRAMS = my_safe_process

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