first merge from main

This commit is contained in:
Bjorn Munch 2009-09-02 18:58:17 +02:00
commit a829604260
913 changed files with 259642 additions and 4535 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`;

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
@ -169,12 +139,16 @@ IF(WIN32)
ADD_DEFINITIONS("-D_WINDOWS -D__WIN__ -D_CRT_SECURE_NO_DEPRECATE")
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 +201,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 +288,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

@ -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"};
@ -1979,7 +1981,7 @@ static COMMANDS *find_command(char *name,char cmd_char)
*/
if (strstr(name, "\\g") || (strstr(name, delimiter) &&
!(strlen(name) >= 9 &&
!my_strnncoll(charset_info,
!my_strnncoll(&my_charset_latin1,
(uchar*) name, 9,
(const uchar*) "delimiter",
9))))
@ -2000,11 +2002,11 @@ static COMMANDS *find_command(char *name,char cmd_char)
{
if (commands[i].func &&
((name &&
!my_strnncoll(charset_info,(uchar*)name,len,
!my_strnncoll(&my_charset_latin1, (uchar*)name, len,
(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");
}
}
}
@ -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
@ -4264,41 +4309,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 +4357,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)

View file

@ -39,6 +39,7 @@ static uint my_end_arg= 0;
static char *opt_user= (char*)"root";
static DYNAMIC_STRING ds_args;
static DYNAMIC_STRING conn_args;
static char *opt_password= 0;
static my_bool tty_password= 0;
@ -135,6 +136,7 @@ static void free_used_memory(void)
free_defaults(defaults_argv);
dynstr_free(&ds_args);
dynstr_free(&conn_args);
}
@ -204,7 +206,7 @@ static void add_one_option(DYNAMIC_STRING* ds,
}
}
dynstr_append_os_quoted(ds, "--", opt->name, eq, arg, NullS);
dynstr_append(&ds_args, " ");
dynstr_append(ds, " ");
}
@ -232,7 +234,7 @@ get_one_option(int optid, const struct my_option *opt,
case 'p':
if (argument == disabled_my_option)
argument= (char*) ""; // Don't require password
argument= (char*) ""; /* Don't require password */
tty_password= 1;
add_option= FALSE;
if (argument)
@ -251,11 +253,24 @@ 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;
case 'h': /* --host */
case 'W': /* --pipe */
case 'P': /* --port */
case 'S': /* --socket */
case OPT_MYSQL_PROTOCOL: /* --protocol */
case OPT_SHARED_MEMORY_BASE_NAME: /* --shared-memory-base-name */
add_one_option(&conn_args, opt, argument);
break;
}
if (add_option)
@ -603,6 +618,20 @@ static void create_mysql_upgrade_info_file(void)
}
/*
Print connection-related arguments.
*/
static void print_conn_args(const char *tool_name)
{
if (conn_args.str[0])
verbose("Running '%s' with connection arguments: %s", tool_name,
conn_args.str);
else
verbose("Running '%s with default connection arguments", tool_name);
}
/*
Check and upgrade(if neccessary) all tables
in the server using "mysqlcheck --check-upgrade .."
@ -610,7 +639,7 @@ static void create_mysql_upgrade_info_file(void)
static int run_mysqlcheck_upgrade(void)
{
verbose("Running 'mysqlcheck'...");
print_conn_args("mysqlcheck");
return run_tool(mysqlcheck_path,
NULL, /* Send output from mysqlcheck directly to screen */
"--no-defaults",
@ -624,7 +653,7 @@ static int run_mysqlcheck_upgrade(void)
static int run_mysqlcheck_fixnames(void)
{
verbose("Running 'mysqlcheck'...");
print_conn_args("mysqlcheck");
return run_tool(mysqlcheck_path,
NULL, /* Send output from mysqlcheck directly to screen */
"--no-defaults",
@ -753,7 +782,8 @@ int main(int argc, char **argv)
strncpy(self_name, argv[0], FN_REFLEN);
}
if (init_dynamic_string(&ds_args, "", 512, 256))
if (init_dynamic_string(&ds_args, "", 512, 256) ||
init_dynamic_string(&conn_args, "", 512, 256))
die("Out of memory");
load_defaults("my", load_default_groups, &argc, &argv);

View file

@ -24,7 +24,7 @@
#include <mysql.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
@ -371,7 +371,7 @@ int main(int argc,char *argv[])
}
else
{
while (!interrupted && (!opt_count_iterations || nr_iterations))
while (!interrupted)
{
new_line = 0;
if ((error=execute_commands(&mysql,argc,commands)))
@ -395,11 +395,11 @@ int main(int argc,char *argv[])
}
if (interval)
{
if (opt_count_iterations && --nr_iterations == 0)
break;
sleep(interval);
if (new_line)
puts("");
if (opt_count_iterations)
nr_iterations--;
}
else
break;
@ -743,6 +743,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

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

@ -287,7 +287,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break;
case 'p':
if (argument == disabled_my_option)
argument= (char*) ""; // Don't require password
argument= (char*) ""; /* Don't require password */
if (argument)
{
char *start = argument;
@ -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`

View file

@ -703,7 +703,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
#endif
case 'p':
if (argument == disabled_my_option)
argument= (char*) ""; // Don't require password
argument= (char*) ""; /* Don't require password */
if (argument)
{
char *start=argument;
@ -1397,18 +1397,19 @@ static char *cover_definer_clause_in_sp(const char *def_str,
SYNOPSIS
open_sql_file_for_table
name name of the table or view
flags flags (as per "man 2 open")
RETURN VALUES
0 Failed to open file
> 0 Handle of the open file
*/
static FILE* open_sql_file_for_table(const char* table)
static FILE* open_sql_file_for_table(const char* table, int flags)
{
FILE* res;
char filename[FN_REFLEN], tmp_path[FN_REFLEN];
convert_dirname(tmp_path,path,NullS);
res= my_fopen(fn_format(filename, table, tmp_path, ".sql", 4),
O_WRONLY, MYF(MY_WME));
flags, MYF(MY_WME));
return res;
}
@ -2290,7 +2291,7 @@ static uint get_table_structure(char *table, char *db, char *table_type,
if (path)
{
if (!(sql_file= open_sql_file_for_table(table)))
if (!(sql_file= open_sql_file_for_table(table, O_WRONLY)))
DBUG_RETURN(0);
write_header(sql_file, db);
@ -2501,7 +2502,7 @@ static uint get_table_structure(char *table, char *db, char *table_type,
{
if (path)
{
if (!(sql_file= open_sql_file_for_table(table)))
if (!(sql_file= open_sql_file_for_table(table, O_WRONLY)))
DBUG_RETURN(0);
write_header(sql_file, db);
}
@ -2725,12 +2726,10 @@ continue_xml:
DBUG_RETURN((uint) num_fields);
} /* get_table_structure */
static void dump_trigger_old(MYSQL_RES *show_triggers_rs,
static void dump_trigger_old(FILE *sql_file, MYSQL_RES *show_triggers_rs,
MYSQL_ROW *show_trigger_row,
const char *table_name)
{
FILE *sql_file= md_result_file;
char quoted_table_name_buf[NAME_LEN * 2 + 3];
char *quoted_table_name= quote_name(table_name, quoted_table_name_buf, 1);
@ -2796,11 +2795,10 @@ static void dump_trigger_old(MYSQL_RES *show_triggers_rs,
DBUG_VOID_RETURN;
}
static int dump_trigger(MYSQL_RES *show_create_trigger_rs,
static int dump_trigger(FILE *sql_file, MYSQL_RES *show_create_trigger_rs,
const char *db_name,
const char *db_cl_name)
{
FILE *sql_file= md_result_file;
MYSQL_ROW row;
int db_cl_altered= FALSE;
@ -2864,22 +2862,28 @@ static int dump_triggers_for_table(char *table_name, char *db_name)
uint old_opt_compatible_mode= opt_compatible_mode;
MYSQL_RES *show_triggers_rs;
MYSQL_ROW row;
FILE *sql_file= md_result_file;
char db_cl_name[MY_CS_NAME_SIZE];
int ret= TRUE;
DBUG_ENTER("dump_triggers_for_table");
DBUG_PRINT("enter", ("db: %s, table_name: %s", db_name, table_name));
if (path && !(sql_file= open_sql_file_for_table(table_name,
O_WRONLY | O_APPEND)))
DBUG_RETURN(1);
/* Do not use ANSI_QUOTES on triggers in dump */
opt_compatible_mode&= ~MASK_ANSI_QUOTES;
/* Get database collation. */
if (switch_character_set_results(mysql, "binary"))
DBUG_RETURN(TRUE);
goto done;
if (fetch_db_collation(db_name, db_cl_name, sizeof (db_cl_name)))
DBUG_RETURN(TRUE);
goto done;
/* Get list of triggers. */
@ -2888,7 +2892,7 @@ static int dump_triggers_for_table(char *table_name, char *db_name)
quote_for_like(table_name, name_buff));
if (mysql_query_with_error_report(mysql, &show_triggers_rs, query_buff))
DBUG_RETURN(TRUE);
goto done;
/* Dump triggers. */
@ -2909,17 +2913,15 @@ static int dump_triggers_for_table(char *table_name, char *db_name)
provide all the necessary information to restore trigger properly.
*/
dump_trigger_old(show_triggers_rs, &row, table_name);
dump_trigger_old(sql_file, show_triggers_rs, &row, table_name);
}
else
{
MYSQL_RES *show_create_trigger_rs= mysql_store_result(mysql);
if (!show_create_trigger_rs ||
dump_trigger(show_create_trigger_rs, db_name, db_cl_name))
{
DBUG_RETURN(TRUE);
}
dump_trigger(sql_file, show_create_trigger_rs, db_name, db_cl_name))
goto done;
mysql_free_result(show_create_trigger_rs);
}
@ -2929,7 +2931,7 @@ static int dump_triggers_for_table(char *table_name, char *db_name)
mysql_free_result(show_triggers_rs);
if (switch_character_set_results(mysql, default_charset))
DBUG_RETURN(TRUE);
goto done;
/*
make sure to set back opt_compatible mode to
@ -2937,7 +2939,13 @@ static int dump_triggers_for_table(char *table_name, char *db_name)
*/
opt_compatible_mode=old_opt_compatible_mode;
DBUG_RETURN(FALSE);
ret= FALSE;
done:
if (path)
my_fclose(sql_file, MYF(0));
DBUG_RETURN(ret);
}
static void add_load_option(DYNAMIC_STRING *str, const char *option,
@ -3129,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");
@ -3813,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;
}
@ -3827,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;
}
@ -3933,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");
@ -3995,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;
@ -4228,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))
@ -4782,7 +4804,7 @@ static my_bool get_view_structure(char *table, char* db)
/* If requested, open separate .sql file for this view */
if (path)
{
if (!(sql_file= open_sql_file_for_table(table)))
if (!(sql_file= open_sql_file_for_table(table, O_WRONLY)))
DBUG_RETURN(1);
write_header(sql_file, db);
@ -4794,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",

View file

@ -222,7 +222,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
#endif
case 'p':
if (argument == disabled_my_option)
argument= (char*) ""; // Don't require password
argument= (char*) ""; /* Don't require password */
if (argument)
{
char *start=argument;
@ -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

@ -282,7 +282,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break;
case 'p':
if (argument == disabled_my_option)
argument= (char*) ""; // Don't require password
argument= (char*) ""; /* Don't require password */
if (argument)
{
char *start=argument;

View file

@ -565,8 +565,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},
@ -713,7 +712,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break;
case 'p':
if (argument == disabled_my_option)
argument= (char*) ""; // Don't require password
argument= (char*) ""; /* Don't require password */
if (argument)
{
char *start= argument;
@ -740,6 +739,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

@ -1463,34 +1463,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

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;
@ -442,7 +442,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 +701,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 +776,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 +808,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 +1032,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 +1063,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 +1186,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 +1277,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 +1437,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 +1506,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 +1533,7 @@ bool_to_int (value)
(value[0] == '1' && value[1] == '\0'));
}
char *
const char *
rl_variable_value (name)
const char *name;
{
@ -1799,7 +1800,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 +2049,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 +2109,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 +2189,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 +2198,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 +2232,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 +2259,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 +2288,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,9 +462,10 @@ 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;
wchar_t wc;
size_t wc_bytes;
int wc_width;
@ -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;
@ -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;
@ -339,7 +340,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)

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

@ -231,7 +231,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 +290,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 +310,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

@ -115,14 +115,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 +172,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.39)
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

@ -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

@ -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

@ -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
@ -1573,4 +1573,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

@ -221,8 +221,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 +237,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 +511,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

@ -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

@ -803,11 +803,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
@ -822,6 +822,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;
}
@ -1032,31 +1033,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);
}
@ -1065,27 +1069,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

@ -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

@ -25,6 +25,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 +42,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 +69,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 +92,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

@ -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,2 +1,14 @@
funcs_1.charset_collation_1 # depends on compile-time decisions
main.plugin_load @solaris # Bug #42144
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.rpl_extraColmaster_myisam* @windows # Bug#46013: rpl_extraColmaster_myisam fails on pb2
rpl.rpl_stm_reset_slave* @windows # Bug#46014: rpl_stm_reset_slave crashes the server sporadically in pb2
rpl.rpl_extraCol_myisam* # Bug#40796
rpl.rpl_extraColmaster_innodb* # Bug#40796
rpl.rpl_extraCol_innodb* # Bug#40796
rpl_ndb.rpl_ndb_log # Bug#38998
rpl.rpl_innodb_bug28430* @solaris # Bug#46029
rpl.rpl_row_basic_3innodb* # Bug#45243
rpl.rpl_truncate_3innodb* @windows # Bug#46030

View file

@ -1,5 +1,5 @@
perl mysql-test-run.pl --timer --force --parallel=auto --comment=n_mix --mysqld=--binlog-format=mixed --experimental=collections/default.experimental
perl mysql-test-run.pl --timer --force --parallel=auto --comment=ps_row --ps-protocol --mysqld=--binlog-format=row --experimental=collections/default.experimental
perl mysql-test-run.pl --timer --force --parallel=auto --comment=embedded --embedded --experimental=collections/default.experimental
perl mysql-test-run.pl --timer --force --parallel=auto --comment=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 --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

@ -0,0 +1,63 @@
#
# 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 Slave_IO_Errno= $last_io_errno;
# 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

@ -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

@ -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);

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

@ -139,9 +139,9 @@ INSERT INTO global_suppressions VALUES
("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"),

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,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

@ -89,7 +89,7 @@ static void die(const char* fmt, ...)
}
static void kill_child (void)
static void kill_child(void)
{
int status= 0;
@ -119,7 +119,7 @@ static void kill_child (void)
}
static void handle_abort (int sig)
extern "C" void handle_abort(int sig)
{
message("Got signal %d, child_pid: %d, sending ABRT", sig, child_pid);
@ -128,8 +128,8 @@ static void handle_abort (int sig)
}
}
static void handle_signal (int sig)
extern "C" void handle_signal(int sig)
{
message("Got signal %d, child_pid: %d", sig, child_pid);
terminated= 1;
@ -152,7 +152,7 @@ int main(int argc, char* const argv[] )
pid_t own_pid= getpid();
pid_t parent_pid= getppid();
bool nocore = false;
/* Install signal handlers */
signal(SIGTERM, handle_signal);
signal(SIGINT, handle_signal);
@ -232,10 +232,11 @@ int main(int argc, char* const argv[] )
message("setrlimit failed, errno=%d", errno);
}
}
// Signal that child is ready
buf= 37;
write(pfd[1], &buf, 1);
if ((write(pfd[1], &buf, 1)) < 1)
die("Failed to signal that child is ready");
// Close write end
close(pfd[1]);
@ -246,8 +247,10 @@ int main(int argc, char* const argv[] )
close(pfd[1]); // Close unused write end
// Wait for child to signal it's ready
read(pfd[0], &buf, 1);
if(buf != 37)
if ((read(pfd[0], &buf, 1)) < 1)
die("Failed to read signal from child");
if (buf != 37)
die("Didn't get 37 from pipe");
close(pfd[0]); // Close read end
@ -272,7 +275,7 @@ int main(int argc, char* const argv[] )
if (WIFEXITED(status))
{
// Process has exited, collect return status
int ret_code= WEXITSTATUS(status);
ret_code= WEXITSTATUS(status);
message("Child exit: %d", ret_code);
// Exit with exit status of the child
exit(ret_code);
@ -287,6 +290,6 @@ int main(int argc, char* const argv[] )
}
kill_child();
exit(1);
return 1;
}

View file

@ -480,6 +480,67 @@ sub collect_one_suite($)
#print_testcases(@cases);
}
}
# ----------------------------------------------------------------------
# Testing InnoDB plugin.
# ----------------------------------------------------------------------
my $lib_innodb_plugin=
mtr_file_exists(::vs_config_dirs('storage/innodb_plugin', 'ha_innodb_plugin.dll'),
"$::basedir/storage/innodb_plugin/.libs/ha_innodb_plugin.so",
"$::basedir/lib/mysql/plugin/ha_innodb_plugin.so",
"$::basedir/lib/mysql/plugin/ha_innodb_plugin.dll");
if ($::mysql_version_id >= 50100 && !(IS_WINDOWS && $::opt_embedded_server) &&
$lib_innodb_plugin)
{
my @new_cases;
foreach my $test (@cases)
{
next if ($test->{'skip'} || !$test->{'innodb_test'});
# Exceptions
next if ($test->{'name'} eq 'main.innodb'); # Failed with wrong errno (fk)
next if ($test->{'name'} eq 'main.index_merge_innodb'); # Explain diff
# innodb_file_per_table is rw with innodb_plugin
next if ($test->{'name'} eq 'sys_vars.innodb_file_per_table_basic');
# innodb_lock_wait_timeout is rw with innodb_plugin
next if ($test->{'name'} eq 'sys_vars.innodb_lock_wait_timeout_basic');
# Diff around innodb_thread_concurrency variable
next if ($test->{'name'} eq 'sys_vars.innodb_thread_concurrency_basic');
# Copy test options
my $new_test= My::Test->new();
while (my ($key, $value) = each(%$test))
{
if (ref $value eq "ARRAY")
{
push(@{$new_test->{$key}}, @$value);
}
else
{
$new_test->{$key}= $value;
}
}
my $plugin_filename= basename($lib_innodb_plugin);
push(@{$new_test->{master_opt}}, '--ignore-builtin-innodb');
push(@{$new_test->{master_opt}}, '--plugin-dir=' . dirname($lib_innodb_plugin));
push(@{$new_test->{master_opt}}, "--plugin_load=innodb=$plugin_filename;innodb_locks=$plugin_filename");
push(@{$new_test->{slave_opt}}, '--ignore-builtin-innodb');
push(@{$new_test->{slave_opt}}, '--plugin-dir=' . dirname($lib_innodb_plugin));
push(@{$new_test->{slave_opt}}, "--plugin_load=innodb=$plugin_filename;innodb_locks=$plugin_filename");
if ($new_test->{combination})
{
$new_test->{combination}.= ' + InnoDB plugin';
}
else
{
$new_test->{combination}= 'InnoDB plugin';
}
push(@new_cases, $new_test);
}
push(@cases, @new_cases);
}
# ----------------------------------------------------------------------
# End of testing InnoDB plugin.
# ----------------------------------------------------------------------
optimize_cases(\@cases);
#print_testcases(@cases);

View file

@ -126,7 +126,7 @@ my $path_config_file; # The generated config file, var/my.cnf
# executables will be used by the test suite.
our $opt_vs_config = $ENV{'MTR_VS_CONFIG'};
my $DEFAULT_SUITES= "main,binlog,federated,rpl,rpl_ndb,ndb";
my $DEFAULT_SUITES= "main,binlog,federated,rpl,rpl_ndb,ndb,innodb";
my $opt_suites;
our $opt_verbose= 0; # Verbose output, enable with --verbose
@ -1792,16 +1792,27 @@ sub environment_setup {
# --------------------------------------------------------------------------
# Add the path where mysqld will find ha_example.so
# --------------------------------------------------------------------------
if ($mysql_version_id >= 50100) {
if ($mysql_version_id >= 50100 && !(IS_WINDOWS && $opt_embedded_server)) {
my $plugin_filename;
if (IS_WINDOWS)
{
$plugin_filename = "ha_example.dll";
}
else
{
$plugin_filename = "ha_example.so";
}
my $lib_example_plugin=
mtr_file_exists(vs_config_dirs('storage/example', 'ha_example.dll'),
"$basedir/storage/example/.libs/ha_example.so",
"$basedir/lib/mysql/plugin/ha_example.so",);
mtr_file_exists(vs_config_dirs('storage/example',$plugin_filename),
"$basedir/storage/example/.libs/".$plugin_filename,
"$basedir/lib/mysql/plugin/".$plugin_filename);
$ENV{'EXAMPLE_PLUGIN'}=
($lib_example_plugin ? basename($lib_example_plugin) : "");
$ENV{'EXAMPLE_PLUGIN_OPT'}= "--plugin-dir=".
($lib_example_plugin ? dirname($lib_example_plugin) : "");
$ENV{'HA_EXAMPLE_SO'}="'".$plugin_filename."'";
$ENV{'EXAMPLE_PLUGIN_LOAD'}="--plugin_load=;EXAMPLE=".$plugin_filename.";";
}
# ----------------------------------------------------

View file

@ -0,0 +1,29 @@
#
# Bug #40113: Embedded SELECT inside UPDATE or DELETE can timeout
# without error
#
CREATE TABLE t1 (a int, b int, PRIMARY KEY (a,b)) ENGINE=InnoDB;
INSERT INTO t1 (a,b) VALUES (1070109,99);
CREATE TABLE t2 (b int, a int, PRIMARY KEY (b)) ENGINE=InnoDB;
INSERT INTO t2 (b,a) VALUES (7,1070109);
SELECT * FROM t1;
a b
1070109 99
BEGIN;
SELECT b FROM t2 WHERE b=7 FOR UPDATE;
b
7
BEGIN;
SELECT b FROM t2 WHERE b=7 FOR UPDATE;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
INSERT INTO t1 (a) VALUES ((SELECT a FROM t2 WHERE b=7));
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
UPDATE t1 SET a='7000000' WHERE a=(SELECT a FROM t2 WHERE b=7);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
DELETE FROM t1 WHERE a=(SELECT a FROM t2 WHERE b=7);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SELECT * FROM t1;
a b
1070109 99
DROP TABLE t2, t1;
End of 5.0 tests

View file

@ -0,0 +1,14 @@
#
# Bug #46080: group_concat(... order by) crashes server when
# sort_buffer_size cannot allocate
#
CREATE TABLE t1(a CHAR(255));
INSERT INTO t1 VALUES ('a');
SET @@SESSION.sort_buffer_size=5*16*1000000;
SET @@SESSION.max_heap_table_size=5*1000000;
# Must not crash.
SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a;
DROP TABLE t1;
SET @@SESSION.sort_buffer_size=default;
SET @@SESSION.max_heap_table_size=default;
End of 5.0 tests

View file

@ -766,15 +766,11 @@ call p_verify_status_increment(2, 2, 2, 2);
SUCCESS
savepoint a;
call p_verify_status_increment(0, 0, 0, 0);
call p_verify_status_increment(1, 0, 1, 0);
SUCCESS
insert t1 set a=4;
# Binlog does not register itself this time for other than the 1st
# statement of the transaction with MIXED/STATEMENT binlog_format.
# It needs registering with the ROW format. Therefore 1,0,2,2 are
# 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);
SUCCESS
release savepoint a;

View file

@ -1894,4 +1894,18 @@ DROP TABLE t1;
create table `me:i`(id int);
drop table `me:i`;
# --
# -- Bug#45829: CREATE TABLE TRANSACTIONAL PAGE_CHECKSUM ROW_FORMAT=PAGE accepted, does nothing
# --
drop table if exists t1,t2,t3;
create table t1 (a int) transactional=0;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'transactional=0' at line 1
create table t2 (a int) page_checksum=1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'page_checksum=1' at line 1
create table t3 (a int) row_format=page;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'page' at line 1
# -- End of Bug#45829
End of 5.1 tests

View file

@ -9,10 +9,10 @@ EXECUTE stmt1 USING @var1;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; CREATE TABLE t1(f1 blob)
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # COMMIT
SELECT HEX(f1) FROM t1;
HEX(f1)
8300

View file

@ -9,7 +9,7 @@ EXECUTE stmt1 USING @var1;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; CREATE TABLE t1(f1 blob)
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES('ƒ\0')
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES(0x8300)
SELECT HEX(f1) FROM t1;
HEX(f1)
8300
@ -29,22 +29,22 @@ HEX(s1) HEX(s2) d
466F6F2773206120426172 ED40ED41ED42 47.93
DROP PROCEDURE bug18293|
DROP TABLE t4|
SHOW BINLOG EVENTS FROM 369|
SHOW BINLOG EVENTS FROM 370|
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 369 Query 1 535 use `test`; CREATE TABLE t4 (s1 CHAR(50) CHARACTER SET latin1,
master-bin.000001 370 Query 1 536 use `test`; CREATE TABLE t4 (s1 CHAR(50) CHARACTER SET latin1,
s2 CHAR(50) CHARACTER SET cp932,
d DECIMAL(10,2))
master-bin.000001 535 Query 1 784 use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `bug18293`(IN ins1 CHAR(50),
master-bin.000001 536 Query 1 785 use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `bug18293`(IN ins1 CHAR(50),
IN ins2 CHAR(50) CHARACTER SET cp932,
IN ind DECIMAL(10,2))
BEGIN
INSERT INTO t4 VALUES (ins1, ins2, ind);
END
master-bin.000001 784 Query 1 1048 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172 COLLATE 'latin1_swedish_ci'), NAME_CONST('ins2',_cp932 0xED40ED41ED42 COLLATE 'cp932_japanese_ci'), NAME_CONST('ind',47.93))
master-bin.000001 1048 Query 1 1137 use `test`; DROP PROCEDURE bug18293
master-bin.000001 1137 Query 1 1216 use `test`; DROP TABLE t4
master-bin.000001 785 Query 1 1049 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172 COLLATE 'latin1_swedish_ci'), NAME_CONST('ins2',_cp932 0xED40ED41ED42 COLLATE 'cp932_japanese_ci'), NAME_CONST('ind',47.93))
master-bin.000001 1049 Query 1 1138 use `test`; DROP PROCEDURE bug18293
master-bin.000001 1138 Query 1 1217 use `test`; DROP TABLE t4
End of 5.0 tests
SHOW BINLOG EVENTS FROM 364;
SHOW BINLOG EVENTS FROM 365;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment.
CREATE TABLE t1 (a varchar(16)) character set cp932;

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,26 @@
SET NAMES gbk;
CREATE TABLE t1 (
f1 BLOB
) ENGINE=MyISAM DEFAULT CHARSET=gbk;
CREATE PROCEDURE p1(IN val BLOB)
BEGIN
SET @tval = val;
SET @sql_cmd = CONCAT_WS(' ', 'insert into t1(f1) values(?)');
PREPARE stmt FROM @sql_cmd;
EXECUTE stmt USING @tval;
DEALLOCATE PREPARE stmt;
END|
SET @`tcontent`:=_binary 0x50434B000900000000000000E9000000 COLLATE `binary`/*!*/;
CALL p1(@`tcontent`);
FLUSH LOGS;
DROP PROCEDURE p1;
RENAME TABLE t1 to t2;
SELECT hex(f1) FROM t2;
hex(f1)
50434B000900000000000000E9000000
SELECT hex(f1) FROM t1;
hex(f1)
50434B000900000000000000E9000000
DROP PROCEDURE p1;
DROP TABLE t1;
DROP TABLE t2;

View file

@ -40,6 +40,14 @@ abcd abcd
efgh efgh
ijkl ijkl
DROP TABLE t1;
#
# Bug#43827 Server closes connections and restarts
#
CREATE TABLE t1 (c1 VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_test_ci);
INSERT INTO t1 SELECT REPEAT('a',11);
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
DROP TABLE t1;
show collation like 'ucs2_vn_ci';
Collation Charset Id Default Compiled Sortlen
ucs2_vn_ci ucs2 242 8

View file

@ -165,7 +165,7 @@ CREATE TABLE `good
ERROR HY000: Invalid utf8 character string: 'ÐÌÏÈÏ'
SET NAMES utf8;
CREATE TABLE `goodÐÌÏÈÏ` (a int);
ERROR HY000: Invalid utf8 character string: 'ÐÌÏÈÏ` (a int)'
ERROR HY000: Invalid utf8 character string: 'ÐÌÏÈÏ'
set names latin1;
create table t1 (a char(10) character set koi8r, b text character set koi8r);
insert into t1 values ('test','test');

View file

@ -383,3 +383,21 @@ select t2.* from (select * from t1) as A inner join t2 on A.ID = t2.FID;
ID DATA FID
drop table t1, t2;
drop user mysqltest_1;
# End of 4.1 tests
SELECT 0 FROM
(SELECT 0) t01, (SELECT 0) t02, (SELECT 0) t03, (SELECT 0) t04, (SELECT 0) t05,
(SELECT 0) t06, (SELECT 0) t07, (SELECT 0) t08, (SELECT 0) t09, (SELECT 0) t10,
(SELECT 0) t11, (SELECT 0) t12, (SELECT 0) t13, (SELECT 0) t14, (SELECT 0) t15,
(SELECT 0) t16, (SELECT 0) t17, (SELECT 0) t18, (SELECT 0) t19, (SELECT 0) t20,
(SELECT 0) t21, (SELECT 0) t22, (SELECT 0) t23, (SELECT 0) t24, (SELECT 0) t25,
(SELECT 0) t26, (SELECT 0) t27, (SELECT 0) t28, (SELECT 0) t29, (SELECT 0) t30,
(SELECT 0) t31, (SELECT 0) t32, (SELECT 0) t33, (SELECT 0) t34, (SELECT 0) t35,
(SELECT 0) t36, (SELECT 0) t37, (SELECT 0) t38, (SELECT 0) t39, (SELECT 0) t40,
(SELECT 0) t41, (SELECT 0) t42, (SELECT 0) t43, (SELECT 0) t44, (SELECT 0) t45,
(SELECT 0) t46, (SELECT 0) t47, (SELECT 0) t48, (SELECT 0) t49, (SELECT 0) t50,
(SELECT 0) t51, (SELECT 0) t52, (SELECT 0) t53, (SELECT 0) t54, (SELECT 0) t55,
(SELECT 0) t56, (SELECT 0) t57, (SELECT 0) t58, (SELECT 0) t59, (SELECT 0) t60,
(SELECT 0) t61;
0
0
# End of 5.0 tests

View file

@ -543,3 +543,11 @@ awrd bwrd cwrd
awrd bwrd cwrd
awrd bwrd cwrd
DROP TABLE t1;
CREATE TABLE t1 (col text, FULLTEXT KEY full_text (col));
PREPARE s FROM
"SELECT MATCH (col) AGAINST('findme') FROM t1 ORDER BY MATCH (col) AGAINST('findme')"
;
EXECUTE s;
MATCH (col) AGAINST('findme')
DEALLOCATE PREPARE s;
DROP TABLE t1;

View file

@ -95,3 +95,14 @@ Note 1003 select password('idkfa ') AS `password('idkfa ')`,old_password('idkfa'
select encrypt('1234','_.');
encrypt('1234','_.')
#
#
# Bug #44767: invalid memory reads in password() and old_password()
# functions
#
CREATE TABLE t1(c1 MEDIUMBLOB);
INSERT INTO t1 VALUES (REPEAT('a', 1024));
SELECT OLD_PASSWORD(c1), PASSWORD(c1) FROM t1;
OLD_PASSWORD(c1) PASSWORD(c1)
77023ffe214c04ff *82E58A2C08AAFE72C8EB523069CD8ADB33F78F58
DROP TABLE t1;
End of 5.0 tests

View file

@ -437,6 +437,13 @@ a ROUND(a)
-1e+16 -10000000000000002
1e+16 10000000000000002
DROP TABLE t1;
CREATE TABLE t1(f1 LONGTEXT) engine=myisam;
INSERT INTO t1 VALUES ('a');
SELECT 1 FROM (SELECT ROUND(f1) AS a FROM t1) AS s WHERE a LIKE 'a';
1
SELECT 1 FROM (SELECT ROUND(f1, f1) AS a FROM t1) AS s WHERE a LIKE 'a';
1
DROP TABLE t1;
End of 5.0 tests
SELECT 1e308 + 1e308;
1e308 + 1e308

View file

@ -146,3 +146,16 @@ NULL
0
0
drop table t1;
CREATE TABLE t1( a SET('a', 'b', 'c') );
CREATE TABLE t2( a SET('a', 'b', 'c') );
INSERT INTO t1 VALUES ('d');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
INSERT INTO t2 VALUES ('');
SELECT CONVERT( a USING latin1 ) FROM t1;
CONVERT( a USING latin1 )
SELECT CONVERT( a USING latin1 ) FROM t2;
CONVERT( a USING latin1 )
DROP TABLE t1, t2;

View file

@ -984,4 +984,52 @@ f4 geometry YES NULL
f5 datetime YES NULL
drop view v1;
drop table t1;
SELECT MultiPoint(12345,'');
MultiPoint(12345,'')
NULL
SELECT MultiPoint(123451,'');
MultiPoint(123451,'')
NULL
SELECT MultiPoint(1234512,'');
MultiPoint(1234512,'')
NULL
SELECT MultiPoint(12345123,'');
MultiPoint(12345123,'')
NULL
SELECT MultiLineString(12345,'');
MultiLineString(12345,'')
NULL
SELECT MultiLineString(123451,'');
MultiLineString(123451,'')
NULL
SELECT MultiLineString(1234512,'');
MultiLineString(1234512,'')
NULL
SELECT MultiLineString(12345123,'');
MultiLineString(12345123,'')
NULL
SELECT LineString(12345,'');
LineString(12345,'')
NULL
SELECT LineString(123451,'');
LineString(123451,'')
NULL
SELECT LineString(1234512,'');
LineString(1234512,'')
NULL
SELECT LineString(12345123,'');
LineString(12345123,'')
NULL
SELECT Polygon(12345,'');
Polygon(12345,'')
NULL
SELECT Polygon(123451,'');
Polygon(123451,'')
NULL
SELECT Polygon(1234512,'');
Polygon(1234512,'')
NULL
SELECT Polygon(12345123,'');
Polygon(12345123,'')
NULL
End of 5.1 tests

View file

@ -1358,3 +1358,58 @@ DROP USER 'userbug33464'@'localhost';
USE test;
DROP DATABASE dbbug33464;
SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
CREATE USER user1;
CREATE USER user2;
GRANT CREATE ON db1.* TO 'user1'@'localhost';
GRANT CREATE ROUTINE ON db1.* TO 'user1'@'localhost';
GRANT CREATE ON db1.* TO 'user2'@'%';
GRANT CREATE ROUTINE ON db1.* TO 'user2'@'%';
FLUSH PRIVILEGES;
SHOW GRANTS FOR 'user1'@'localhost';
Grants for user1@localhost
GRANT USAGE ON *.* TO 'user1'@'localhost'
GRANT CREATE, CREATE ROUTINE ON `db1`.* TO 'user1'@'localhost'
** Connect as user1 and create a procedure.
** The creation will imply implicitly assigned
** EXECUTE and ALTER ROUTINE privileges to
** the current user user1@localhost.
SELECT @@GLOBAL.sql_mode;
@@GLOBAL.sql_mode
SELECT @@SESSION.sql_mode;
@@SESSION.sql_mode
CREATE DATABASE db1;
CREATE PROCEDURE db1.proc1(p1 INT)
BEGIN
SET @x = 0;
REPEAT SET @x = @x + 1; UNTIL @x > p1 END REPEAT;
END ;||
** Connect as user2 and create a procedure.
** Implicitly assignment of privileges will
** fail because the user2@localhost is an
** unknown user.
CREATE PROCEDURE db1.proc2(p1 INT)
BEGIN
SET @x = 0;
REPEAT SET @x = @x + 1; UNTIL @x > p1 END REPEAT;
END ;||
Warnings:
Warning 1404 Failed to grant EXECUTE and ALTER ROUTINE privileges
SHOW GRANTS FOR 'user1'@'localhost';
Grants for user1@localhost
GRANT USAGE ON *.* TO 'user1'@'localhost'
GRANT CREATE, CREATE ROUTINE ON `db1`.* TO 'user1'@'localhost'
GRANT EXECUTE, ALTER ROUTINE ON PROCEDURE `db1`.`proc1` TO 'user1'@'localhost'
SHOW GRANTS FOR 'user2';
Grants for user2@%
GRANT USAGE ON *.* TO 'user2'@'%'
GRANT CREATE, CREATE ROUTINE ON `db1`.* TO 'user2'@'%'
DROP PROCEDURE db1.proc1;
DROP PROCEDURE db1.proc2;
REVOKE ALL ON db1.* FROM 'user1'@'localhost';
REVOKE ALL ON db1.* FROM 'user2'@'%';
DROP USER 'user1';
DROP USER 'user1'@'localhost';
DROP USER 'user2';
DROP DATABASE db1;

View file

@ -2462,4 +2462,43 @@ c
1
2
DROP TABLE t1;
#
# Bug #45386: Wrong query result with MIN function in field list,
# WHERE and GROUP BY clause
#
CREATE TABLE t (a INT, b INT, INDEX (a,b));
INSERT INTO t VALUES (2,0), (2,0), (2,1), (2,1);
INSERT INTO t SELECT * FROM t;
# test MIN
#should use range with index for group by
EXPLAIN
SELECT a, MIN(b) FROM t WHERE b <> 0 GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t range NULL a 10 NULL 9 Using where; Using index for group-by
#should return 1 row
SELECT a, MIN(b) FROM t WHERE b <> 0 GROUP BY a;
a MIN(b)
2 1
# test MAX
#should use range with index for group by
EXPLAIN
SELECT a, MAX(b) FROM t WHERE b <> 1 GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t range NULL a 10 NULL 9 Using where; Using index for group-by
#should return 1 row
SELECT a, MAX(b) FROM t WHERE b <> 1 GROUP BY a;
a MAX(b)
2 0
# test 3 ranges and use the middle one
INSERT INTO t SELECT a, 2 FROM t;
#should use range with index for group by
EXPLAIN
SELECT a, MAX(b) FROM t WHERE b > 0 AND b < 2 GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t range NULL a 10 NULL 9 Using where; Using index for group-by
#should return 1 row
SELECT a, MAX(b) FROM t WHERE b > 0 AND b < 2 GROUP BY a;
a MAX(b)
2 1
DROP TABLE t;
End of 5.0 tests

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