Merge mysql.com:/home/jimw/my/mysql-5.0-17043

into  mysql.com:/home/jimw/my/mysql-5.0-clean
This commit is contained in:
unknown 2006-04-19 14:18:35 -07:00
commit d8df724af2
313 changed files with 18365 additions and 2819 deletions

View file

@ -1275,3 +1275,6 @@ zlib/*.ds?
zlib/*.vcproj
scripts/mysql_upgrade
include/openssl
mysql-test/r/bdb.log
mysql-test/r/im_client_port.log
mysql-test/r/udf.log

View file

@ -44,8 +44,8 @@ set -e
export AM_MAKEFLAGS
AM_MAKEFLAGS="-j 4"
# SSL library to use. Should be changed to --with-yassl
SSL_LIBRARY=--with-openssl
# SSL library to use.
SSL_LIBRARY=--with-yassl
# If you are not using codefusion add "-Wpointer-arith" to WARNINGS
# The following warning flag will give too many warnings:

View file

@ -63,7 +63,7 @@ Licensee.
4. Price and payment.
No later than thirty (30) days after submission of the Order Form, Licensee
shall remit one non-refundable license fee per Licensed Copy as posted on
http://order.mysql.com on the date Licensee submitted the Order Form (the
http://shop.mysql.com on the date Licensee submitted the Order Form (the
"License Fee"). All payments shall be made in Euros or U.S. dollars. Licensee
shall be responsible for paying all local, state, federal and international
sales, value added, excise and other taxes and duties payable in connection

2
README
View file

@ -8,7 +8,7 @@ License information can be found in these files:
For further information about MySQL or additional documentation, see:
- The latest information about MySQL: http://www.mysql.com
- The current MySQL documentation: http:/dev.mysql.com/doc
- The current MySQL documentation: http://dev.mysql.com/doc
Some manual sections of special interest:

View file

@ -19,7 +19,6 @@
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/D MYSQL_SERVER_SUFFIX=-max"
Optimization="2"
InlineFunctionExpansion="1"
OptimizeForProcessor="2"

View file

@ -20,7 +20,6 @@
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/D MYSQL_SERVER_SUFFIX=-nt-max"
Optimization="2"
InlineFunctionExpansion="1"
OptimizeForProcessor="2"
@ -175,7 +174,6 @@
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/D MYSQL_SERVER_SUFFIX=-nt"
Optimization="2"
InlineFunctionExpansion="1"
OptimizeForProcessor="2"

View file

@ -86,7 +86,6 @@
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/D MYSQL_SERVER_SUFFIX=-pro"
Optimization="2"
InlineFunctionExpansion="1"
OptimizeForProcessor="2"

View file

@ -71,7 +71,6 @@
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/D MYSQL_SERVER_SUFFIX=-pro"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="../include,../regex,../libmysqld,../sql,../zlib"

View file

@ -67,7 +67,6 @@
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/D MYSQL_SERVER_SUFFIX=-max"
Optimization="2"
InlineFunctionExpansion="1"
OptimizeForProcessor="2"

View file

@ -20,7 +20,6 @@
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/D MYSQL_SERVER_SUFFIX=-classic-nt"
Optimization="2"
InlineFunctionExpansion="1"
OptimizeForProcessor="2"
@ -82,7 +81,6 @@
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/D MYSQL_SERVER_SUFFIX=-max"
Optimization="2"
InlineFunctionExpansion="1"
OptimizeForProcessor="2"
@ -143,7 +141,6 @@
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/D MYSQL_SERVER_SUFFIX=-nt-max"
Optimization="2"
InlineFunctionExpansion="1"
OptimizeForProcessor="2"
@ -207,7 +204,6 @@
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/D MYSQL_SERVER_SUFFIX=-nt"
Optimization="2"
InlineFunctionExpansion="1"
OptimizeForProcessor="2"
@ -271,7 +267,6 @@
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/D MYSQL_SERVER_SUFFIX=-pro-nt"
Optimization="2"
InlineFunctionExpansion="1"
OptimizeForProcessor="2"
@ -393,7 +388,6 @@
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/D MYSQL_SERVER_SUFFIX=-pro"
Optimization="2"
InlineFunctionExpansion="1"
OptimizeForProcessor="2"
@ -455,7 +449,6 @@
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/D MYSQL_SERVER_SUFFIX=-classic"
Optimization="2"
InlineFunctionExpansion="1"
OptimizeForProcessor="2"

View file

@ -185,7 +185,7 @@ void tee_fprintf(FILE *file, const char *fmt, ...);
void tee_fputs(const char *s, FILE *file);
void tee_puts(const char *s, FILE *file);
void tee_putc(int c, FILE *file);
static void tee_print_sized_data(const char *data, unsigned int length, unsigned int width);
static void tee_print_sized_data(const char *, unsigned int, unsigned int, bool);
/* The names of functions that actually do the manipulation. */
static int get_options(int argc,char **argv);
static int com_quit(String *str,char*),
@ -653,7 +653,7 @@ static struct my_option my_long_options[] =
"Base name of shared memory.", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"socket", 'S', "Socket file to use for connection.",
{"socket", 'S', "Socket file to use for connection. (This will override --port unless --protocol=TCP is specified.)",
(gptr*) &opt_mysql_unix_port, (gptr*) &opt_mysql_unix_port, 0, GET_STR_ALLOC,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#include "sslopt-longopts.h"
@ -940,6 +940,13 @@ static int get_options(int argc, char **argv)
connect_flag= 0; /* Not in interactive mode */
}
if (opt_mysql_port && (!opt_protocol) && (!opt_mysql_unix_port))
{
/* Not checking return type since we are using a constant value */
/* straight from the initialization of sql_protocol_typelib. */
opt_protocol= find_type("TCP", &sql_protocol_typelib, 0);
}
if (strcmp(default_charset, charset_info->csname) &&
!(charset_info= get_charset_by_csname(default_charset,
MY_CS_PRIMARY, MYF(MY_WME))))
@ -2261,8 +2268,10 @@ print_table_data(MYSQL_RES *result)
MYSQL_ROW cur;
MYSQL_FIELD *field;
bool *num_flag;
bool *not_null_flag;
num_flag=(bool*) my_alloca(sizeof(bool)*mysql_num_fields(result));
not_null_flag=(bool*) my_alloca(sizeof(bool)*mysql_num_fields(result));
if (info_flag)
{
print_field_types(result);
@ -2280,7 +2289,7 @@ print_table_data(MYSQL_RES *result)
length=max(length,field->max_length);
if (length < 4 && !IS_NOT_NULL(field->flags))
length=4; // Room for "NULL"
field->max_length=length+1;
field->max_length=length;
separator.fill(separator.length()+length+2,'-');
separator.append('+');
}
@ -2296,6 +2305,7 @@ print_table_data(MYSQL_RES *result)
MAX_COLUMN_LENGTH),
field->name);
num_flag[off]= IS_NUM(field->type);
not_null_flag[off]= IS_NOT_NULL(field->flags);
}
(void) tee_fputs("\n", PAGER);
tee_puts((char*) separator.ptr(), PAGER);
@ -2308,44 +2318,62 @@ print_table_data(MYSQL_RES *result)
mysql_field_seek(result, 0);
for (uint off= 0; off < mysql_num_fields(result); off++)
{
const char *str= cur[off] ? cur[off] : "NULL";
uint currlength;
uint maxlength;
uint numcells;
const char *buffer;
uint data_length;
uint field_max_length;
bool right_justified;
uint visible_length;
uint extra_padding;
/* If this column may have a null value, use "NULL" for empty. */
if (! not_null_flag[off] && (lengths[off] == 0))
{
buffer= "NULL";
data_length= 4;
}
else
{
buffer= cur[off];
data_length= (uint) lengths[off];
}
field= mysql_fetch_field(result);
maxlength= field->max_length;
currlength= (uint) lengths[off];
numcells= charset_info->cset->numcells(charset_info,
str, str + currlength);
if (maxlength > MAX_COLUMN_LENGTH)
{
tee_print_sized_data(str, currlength, maxlength);
tee_fputs(" |", PAGER);
}
field_max_length= field->max_length;
/*
How many text cells on the screen will this string span? If it contains
multibyte characters, then the number of characters we occupy on screen
will be fewer than the number of bytes we occupy in memory.
We need to find how much screen real-estate we will occupy to know how
many extra padding-characters we should send with the printing function.
*/
visible_length= charset_info->cset->numcells(charset_info, buffer, buffer + data_length);
extra_padding= data_length - visible_length;
if (field_max_length > MAX_COLUMN_LENGTH)
tee_print_sized_data(buffer, data_length, MAX_COLUMN_LENGTH+extra_padding, FALSE);
else
{
if (num_flag[off] != 0)
tee_fprintf(PAGER, " %-*s|", maxlength + currlength - numcells, str);
if (num_flag[off] != 0) /* if it is numeric, we right-justify it */
tee_print_sized_data(buffer, data_length, field_max_length+extra_padding, TRUE);
else
{
tee_print_sized_data(str, currlength, maxlength);
tee_print_sized_data(buffer, data_length, field_max_length+extra_padding, FALSE);
}
tee_fputs(" | ", PAGER);
}
}
}
(void) tee_fputs("\n", PAGER);
}
tee_puts((char*) separator.ptr(), PAGER);
my_afree((gptr) num_flag);
my_afree((gptr) not_null_flag);
}
static void
tee_print_sized_data(const char *data, unsigned int length, unsigned int width)
tee_print_sized_data(const char *data, unsigned int data_length, unsigned int total_bytes_to_send, bool right_justified)
{
/*
It is not a number, so print each character justified to the left.
For '\0's print ASCII spaces instead, as '\0' is eaten by (at
least my) console driver, and that messes up the pretty table
grid. (The \0 is also the reason we can't use fprintf() .)
@ -2353,9 +2381,11 @@ tee_print_sized_data(const char *data, unsigned int length, unsigned int width)
unsigned int i;
const char *p;
tee_putc(' ', PAGER);
if (right_justified)
for (i= data_length; i < total_bytes_to_send; i++)
tee_putc((int)' ', PAGER);
for (i= 0, p= data; i < length; i+= 1, p+= 1)
for (i= 0, p= data; i < data_length; i+= 1, p+= 1)
{
if (*p == '\0')
tee_putc((int)' ', PAGER);
@ -2363,8 +2393,8 @@ tee_print_sized_data(const char *data, unsigned int length, unsigned int width)
tee_putc((int)*p, PAGER);
}
i+= 1;
for ( ; i < width; i+= 1)
if (! right_justified)
for (i= data_length; i < total_bytes_to_send; i++)
tee_putc((int)' ', PAGER);
}
@ -3354,7 +3384,7 @@ put_info(const char *str,INFO_TYPE info_type, uint error, const char *sqlstate)
if (info_type == INFO_ERROR)
{
if (!opt_nobeep)
putchar('\007'); /* This should make a bell */
putchar('\a'); /* This should make a bell */
vidattr(A_STANDOUT);
if (error)
{

View file

@ -373,8 +373,10 @@ const char *command_names[]=
"enable_rpl_parse",
"disable_rpl_parse",
"eval_result",
/* Enable/disable that the _query_ is logged to result file */
"enable_query_log",
"disable_query_log",
/* Enable/disable that the _result_ from a query is logged to result file */
"enable_result_log",
"disable_result_log",
"server_start",
@ -425,6 +427,7 @@ static VAR* var_init(VAR* v, const char *name, int name_len, const char *val,
static void var_free(void* v);
void dump_result_to_reject_file(const char *record_file, char *buf, int size);
void dump_result_to_log_file(const char *record_file, char *buf, int size);
int close_connection(struct st_query*);
static void set_charset(struct st_query*);
@ -615,6 +618,8 @@ static void die(const char *fmt, ...)
{
va_list args;
DBUG_ENTER("die");
/* Print the error message */
va_start(args, fmt);
if (fmt)
{
@ -629,6 +634,12 @@ static void die(const char *fmt, ...)
fflush(stderr);
}
va_end(args);
/* Dump the result that has been accumulated so far to .log file */
if (result_file && ds_res.length)
dump_result_to_log_file(result_file, ds_res.str, ds_res.length);
/* Clean up and exit */
free_used_memory();
my_end(MY_CHECK_ERROR);
@ -752,8 +763,8 @@ err:
check_result
ds - content to be checked
fname - name of file to check against
require_option - if set and check fails, the test will be aborted with the special
exit code "not supported test"
require_option - if set and check fails, the test will be aborted
with the special exit code "not supported test"
RETURN VALUES
error - the function will not return
@ -3129,6 +3140,12 @@ void dump_result_to_reject_file(const char *record_file, char *buf, int size)
str_to_file(fn_format(reject_file, record_file,"",".reject",2), buf, size);
}
void dump_result_to_log_file(const char *record_file, char *buf, int size)
{
char log_file[FN_REFLEN];
str_to_file(fn_format(log_file, record_file,"",".log",2), buf, size);
}
#ifdef __WIN__
@ -3708,7 +3725,17 @@ static void handle_error(const char *query, struct st_query *q,
DBUG_ENTER("handle_error");
if (q->require_file)
{
/*
The query after a "--require" failed. This is fine as long the server
returned a valid reponse. Don't allow 2013 or 2006 to trigger an
abort_not_supported_test
*/
if (err_errno == CR_SERVER_LOST ||
err_errno == CR_SERVER_GONE_ERROR)
die("require query '%s' failed: %d: %s", query, err_errno, err_error);
abort_not_supported_test();
}
if (q->abort_on_error)
die("query '%s' failed: %d: %s", query, err_errno, err_error);
@ -4474,6 +4501,35 @@ static void init_var_hash(MYSQL *mysql)
DBUG_VOID_RETURN;
}
static void mark_progress(int line)
{
#ifdef NOT_YET
static FILE* fp = NULL;
static double first;
struct timeval tv;
double now;
if (!fp)
{
fp = fopen("/tmp/mysqltest_progress.log", "wt");
if (!fp)
{
abort();
}
gettimeofday(&tv, NULL);
first = tv.tv_sec * 1e6 + tv.tv_usec;
}
gettimeofday(&tv, NULL);
now = tv.tv_sec * 1e6 + tv.tv_usec;
fprintf(fp, "%d %f\n", parser.current_line, (now - first) / 1e6);
#endif
}
int main(int argc, char **argv)
{
@ -4824,6 +4880,7 @@ int main(int argc, char **argv)
}
parser.current_line += current_line_inc;
mark_progress(parser.current_line);
}
start_lineno= 0;

View file

@ -361,7 +361,8 @@ AC_CACHE_VAL(mysql_cv_termcap_lib,
[AC_CHECK_LIB(ncurses, tgetent, mysql_cv_termcap_lib=libncurses,
[AC_CHECK_LIB(curses, tgetent, mysql_cv_termcap_lib=libcurses,
[AC_CHECK_LIB(termcap, tgetent, mysql_cv_termcap_lib=libtermcap,
mysql_cv_termcap_lib=NOT_FOUND)])])])
[AC_CHECK_LIB(tinfo, tgetent, mysql_cv_termcap_lib=libtinfo,
mysql_cv_termcap_lib=NOT_FOUND)])])])])
AC_MSG_CHECKING(for termcap functions library)
if test "$mysql_cv_termcap_lib" = "NOT_FOUND"; then
AC_MSG_ERROR([No curses/termcap library found])
@ -369,6 +370,8 @@ elif test "$mysql_cv_termcap_lib" = "libtermcap"; then
TERMCAP_LIB=-ltermcap
elif test "$mysql_cv_termcap_lib" = "libncurses"; then
TERMCAP_LIB=-lncurses
elif test "$mysql_cv_termcap_lib" = "libtinfo"; then
TERMCAP_LIB=-ltinfo
else
TERMCAP_LIB=-lcurses
fi

View file

@ -14,7 +14,8 @@ AC_DEFUN([MYSQL_FIND_OPENSSL], [
for d in /usr/ssl/lib /usr/local/ssl/lib /usr/lib/openssl \
/usr/lib /usr/lib64 /opt/ssl/lib /opt/openssl/lib \
/usr/freeware/lib32 /usr/local/lib/ ; do
if test -f $d/libssl.a || test -f $d/libssl.so || test -f $d/libssl.dylib ; then
# Just to be safe, we test for ".so" anyway
if test -f $d/libssl.a || test -f $d/libssl.so || test -f $d/libssl$shrext_cmds ; then
OPENSSL_LIB=$d
fi
done
@ -26,7 +27,8 @@ AC_DEFUN([MYSQL_FIND_OPENSSL], [
if test -f $incs/openssl/ssl.h ; then
OPENSSL_INCLUDE=-I$incs
fi
if test -f $libs/libssl.a || test -f $libs/libssl.so || test -f $libs/libssl.dylib ; then
# Just to be safe, we test for ".so" anyway
if test -f $libs/libssl.a || test -f $libs/libssl.so || test -f $libs/libssl$shrext_cmds ; then
OPENSSL_LIB=$libs
fi
;;

View file

@ -17,7 +17,6 @@ AC_DEFUN([MYSQL_CHECK_YASSL], [
yassl_dir="extra/yassl"
yassl_libs="-L\$(top_srcdir)/extra/yassl/src -lyassl -L\$(top_srcdir)/extra/yassl/taocrypt/src -ltaocrypt"
yassl_includes="-I\$(top_srcdir)/extra/yassl/include"
yassl_libs_with_path="\$(top_srcdir)/extra/yassl/src/libyassl.la \$(top_srcdir)/extra/yassl/taocrypt/src/libtaocrypt.la"
AC_DEFINE([HAVE_OPENSSL], [1], [Defined by configure. Using yaSSL for OpenSSL emulation.])
AC_DEFINE([HAVE_YASSL], [1], [Defined by configure. Using yaSSL for OpenSSL emulation.])
# System specific checks
@ -38,8 +37,7 @@ AC_DEFUN([MYSQL_CHECK_YASSL], [
AC_MSG_RESULT(no)
fi
AC_SUBST(yassl_libs)
AC_SUBST(yassl_libs_with_path)
AC_SUBST(yassl_includes)
AC_SUBST(yassl_dir)
AM_CONDITIONAL([HAVE_YASSL], [ test "with_yassl" = "yes" ])
AM_CONDITIONAL([HAVE_YASSL], [ test "$with_yassl" = "yes" ])
])

View file

@ -13,9 +13,9 @@ mysql_cv_compress="yes"
dnl Auxiliary macro to check for zlib at given path
AC_DEFUN([MYSQL_CHECK_ZLIB_DIR], [
save_INCLUDES="$INCLUDES"
save_CPPFLAGS="$CPPFLAGS"
save_LIBS="$LIBS"
INCLUDES="$INCLUDES $ZLIB_INCLUDES"
CPPFLAGS="$ZLIB_INCLUDES $CPPFLAGS"
LIBS="$LIBS $ZLIB_LIBS"
AC_CACHE_VAL([mysql_cv_compress],
[AC_TRY_LINK([#include <zlib.h>],
@ -24,7 +24,7 @@ AC_CACHE_VAL([mysql_cv_compress],
AC_MSG_RESULT([ok])],
[mysql_cv_compress="no"])
])
INCLUDES="$save_INCLUDES"
CPPFLAGS="$save_CPPFLAGS"
LIBS="$save_LIBS"
])
@ -89,8 +89,9 @@ case $SYSTEM_TYPE in
fi
;;
*)
# Just to be safe, we test for ".so" anyway
if test \( -f "$mysql_zlib_dir/lib/libz.a" -o -f "$mysql_zlib_dir/lib/libz.so" -o \
-f "$mysql_zlib_dir/lib/libz.sl" -o -f "$mysql_zlib_dir/lib/libz.dylib" \) \
-f "$mysql_zlib_dir/lib/libz$shrext_cmds" \) \
-a -f "$mysql_zlib_dir/include/zlib.h"; then
ZLIB_INCLUDES="-I$mysql_zlib_dir/include"
ZLIB_LIBS="-L$mysql_zlib_dir/lib -lz"

View file

@ -7,7 +7,7 @@ AC_INIT(sql/mysqld.cc)
AC_CANONICAL_SYSTEM
# The Docs Makefile.am parses this line!
# remember to also change ndb version below and update version.c in ndb
AM_INIT_AUTOMAKE(mysql, 5.0.20)
AM_INIT_AUTOMAKE(mysql, 5.0.21)
AM_CONFIG_HEADER(config.h)
PROTOCOL_VERSION=10
@ -19,7 +19,7 @@ SHARED_LIB_VERSION=$SHARED_LIB_MAJOR_VERSION:0:0
# ndb version
NDB_VERSION_MAJOR=5
NDB_VERSION_MINOR=0
NDB_VERSION_BUILD=20
NDB_VERSION_BUILD=21
NDB_VERSION_STATUS=""
# Set all version vars based on $VERSION. How do we do this more elegant ?
@ -805,6 +805,9 @@ AC_SUBST(WRAPLIBS)
if test "$TARGET_LINUX" = "true"; then
AC_MSG_CHECKING([for atomic operations])
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
atom_ops=
AC_TRY_RUN([
#include <asm/atomic.h>
@ -840,6 +843,8 @@ int main()
if test -z "$atom_ops"; then atom_ops="no"; fi
AC_MSG_RESULT($atom_ops)
AC_LANG_RESTORE
AC_ARG_WITH(pstack,
[ --with-pstack Use the pstack backtrace library],
[ USE_PSTACK=$withval ],
@ -1547,6 +1552,18 @@ else
fi
#---END:
# dlopen, dlerror
case "$with_mysqld_ldflags " in
*"-static "*)
# No need to check for dlopen when mysqld is linked with
# -all-static or -static as it won't be able to load any functions.
# NOTE! It would be better if it was possible to test if dlopen
# can be used, but a good way to test it couldn't be found
;;
*)
# Check for dlopen, needed for user definable functions
# This must be checked after threads on AIX
# We only need this for mysqld, not for the clients.
@ -1558,6 +1575,15 @@ LIBDL=$LIBS
LIBS="$my_save_LIBS"
AC_SUBST(LIBDL)
my_save_LIBS="$LIBS"
LIBS="$LIBS $LIBDL"
AC_CHECK_FUNCS(dlopen dlerror)
LIBS="$my_save_LIBS"
;;
esac
# System characteristics
case $SYSTEM_TYPE in
*netware*) ;;
@ -1925,11 +1951,6 @@ then
fi]
)
my_save_LIBS="$LIBS"
LIBS="$LIBS $LIBDL"
AC_CHECK_FUNCS(dlopen dlerror)
LIBS="$my_save_LIBS"
# Check definition of gethostbyaddr_r (glibc2 defines this with 8 arguments)
ac_save_CXXFLAGS="$CXXFLAGS"
AC_CACHE_CHECK([style of gethost* routines], mysql_cv_gethost_style,

View file

@ -407,20 +407,29 @@ inline double ulonglong2double(ulonglong value)
#define shared_memory_buffer_length 16000
#define default_shared_memory_base_name "MYSQL"
#ifdef CYBOZU
#define MYSQL_DEFAULT_CHARSET_NAME "utf8"
#define MYSQL_DEFAULT_COLLATION_NAME "utf8_general_cs"
#define HAVE_UTF8_GENERAL_CS 1
#else
#define MYSQL_DEFAULT_CHARSET_NAME "latin1"
#define MYSQL_DEFAULT_COLLATION_NAME "latin1_swedish_ci"
#endif
#define HAVE_SPATIAL 1
#define HAVE_RTREE_KEYS 1
/* #undef HAVE_OPENSSL */
/* #undef HAVE_YASSL */
#define HAVE_OPENSSL 1
#define HAVE_YASSL 1
/* Define charsets you want */
/* #undef HAVE_CHARSET_armscii8 */
/* #undef HAVE_CHARSET_ascii */
#ifndef CYBOZU
#define HAVE_CHARSET_big5 1
#define HAVE_CHARSET_cp1250 1
#endif
/* #undef HAVE_CHARSET_cp1251 */
/* #undef HAVE_CHARSET_cp1256 */
/* #undef HAVE_CHARSET_cp1257 */
@ -429,27 +438,33 @@ inline double ulonglong2double(ulonglong value)
/* #undef HAVE_CHARSET_cp866 */
#define HAVE_CHARSET_cp932 1
/* #undef HAVE_CHARSET_dec8 */
#ifndef CYBOZU
#define HAVE_CHARSET_eucjpms 1
#define HAVE_CHARSET_euckr 1
#define HAVE_CHARSET_gb2312 1
#define HAVE_CHARSET_gbk 1
#endif
/* #undef HAVE_CHARSET_greek */
/* #undef HAVE_CHARSET_hebrew */
/* #undef HAVE_CHARSET_hp8 */
/* #undef HAVE_CHARSET_keybcs2 */
/* #undef HAVE_CHARSET_koi8r */
/* #undef HAVE_CHARSET_koi8u */
#ifndef CYBOZU
#define HAVE_CHARSET_latin1 1
#define HAVE_CHARSET_latin2 1
#endif
/* #undef HAVE_CHARSET_latin5 */
/* #undef HAVE_CHARSET_latin7 */
/* #undef HAVE_CHARSET_macce */
/* #undef HAVE_CHARSET_macroman */
#define HAVE_CHARSET_sjis 1
/* #undef HAVE_CHARSET_swe7 */
#ifndef CYBOZU
#define HAVE_CHARSET_tis620 1
#define HAVE_CHARSET_ucs2 1
#define HAVE_CHARSET_ujis 1
#endif
#define HAVE_CHARSET_utf8 1
#define HAVE_UCA_COLLATIONS 1

View file

@ -44,13 +44,23 @@ typedef struct unicase_info_st
uint16 sort;
} MY_UNICASE_INFO;
extern MY_UNICASE_INFO *my_unicase_default[256];
extern MY_UNICASE_INFO *my_unicase_turkish[256];
#define MY_CS_ILSEQ 0
#define MY_CS_ILUNI 0
#define MY_CS_TOOSMALL -1
#define MY_CS_TOOFEW(n) (-1-(n))
/* wm_wc and wc_mb return codes */
#define MY_CS_ILSEQ 0 /* Wrong by sequence: wb_wc */
#define MY_CS_ILUNI 0 /* Cannot encode Unicode to charset: wc_mb */
#define MY_CS_TOOSMALL -101 /* Need at least one byte: wc_mb and mb_wc */
#define MY_CS_TOOSMALL2 -102 /* Need at least two bytes: wc_mb and mb_wc */
#define MY_CS_TOOSMALL3 -103 /* Need at least three bytes: wc_mb and mb_wc */
/* These following three are currently not really used */
#define MY_CS_TOOSMALL4 -104 /* Need at least 4 bytes: wc_mb and mb_wc */
#define MY_CS_TOOSMALL5 -105 /* Need at least 5 bytes: wc_mb and mb_wc */
#define MY_CS_TOOSMALL6 -106 /* Need at least 6 bytes: wc_mb and mb_wc */
/* A helper macros for "need at least n bytes" */
#define MY_CS_TOOSMALLN(n) (-100-(n))
#define MY_SEQ_INTTAIL 1
#define MY_SEQ_SPACES 2
@ -360,6 +370,11 @@ int my_wildcmp_8bit(CHARSET_INFO *,
const char *wildstr,const char *wildend,
int escape, int w_one, int w_many);
int my_wildcmp_bin(CHARSET_INFO *,
const char *str,const char *str_end,
const char *wildstr,const char *wildend,
int escape, int w_one, int w_many);
uint my_numchars_8bit(CHARSET_INFO *, const char *b, const char *e);
uint my_numcells_8bit(CHARSET_INFO *, const char *b, const char *e);
uint my_charpos_8bit(CHARSET_INFO *, const char *b, const char *e, uint pos);

View file

@ -287,8 +287,10 @@ typedef struct st_mysql
from mysql_stmt_close if close had to cancel result set of this object.
*/
my_bool *unbuffered_fetch_owner;
#if defined(EMBEDDED_LIBRARY) || defined(EMBEDDED_LIBRARY_COMPATIBLE) || MYSQL_VERSION_ID >= 50100
/* needed for embedded server - no net buffer to store the 'info' */
char *info_buffer;
#endif
} MYSQL;
typedef struct st_mysql_res {

View file

@ -1915,13 +1915,13 @@ btr_cur_pessimistic_update(
ut_a(rec || optim_err != DB_UNDERFLOW);
if (rec) {
offsets = rec_get_offsets(rec, index, offsets,
ULINT_UNDEFINED, &heap);
lock_rec_restore_from_page_infimum(rec, page);
rec_set_field_extern_bits(rec, index,
ext_vect, n_ext_vect, mtr);
offsets = rec_get_offsets(rec, index, offsets,
ULINT_UNDEFINED, &heap);
if (!rec_get_deleted_flag(rec, rec_offs_comp(offsets))) {
/* The new inserted record owns its possible externally
stored fields */
@ -3329,7 +3329,10 @@ btr_store_big_rec_extern_fields(
dict_index_t* index, /* in: index of rec; the index tree
MUST be X-latched */
rec_t* rec, /* in: record */
const ulint* offsets, /* in: rec_get_offsets(rec, index) */
const ulint* offsets, /* in: rec_get_offsets(rec, index);
the "external storage" flags in offsets
will not correspond to rec when
this function returns */
big_rec_t* big_rec_vec, /* in: vector containing fields
to be stored externally */
mtr_t* local_mtr __attribute__((unused))) /* in: mtr

View file

@ -1600,14 +1600,30 @@ btr_search_validate(void)
ulint n_page_dumps = 0;
ibool ok = TRUE;
ulint i;
ulint cell_count;
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
/* How many cells to check before temporarily releasing
btr_search_latch. */
ulint chunk_size = 10000;
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
rw_lock_x_lock(&btr_search_latch);
for (i = 0; i < hash_get_n_cells(btr_search_sys->hash_index); i++) {
cell_count = hash_get_n_cells(btr_search_sys->hash_index);
for (i = 0; i < cell_count; i++) {
/* We release btr_search_latch every once in a while to
give other queries a chance to run. */
if ((i != 0) && ((i % chunk_size) == 0)) {
rw_lock_x_unlock(&btr_search_latch);
os_thread_yield();
rw_lock_x_lock(&btr_search_latch);
}
node = hash_get_nth_cell(btr_search_sys->hash_index, i)->node;
while (node != NULL) {
@ -1661,10 +1677,21 @@ btr_search_validate(void)
}
}
if (!ha_validate(btr_search_sys->hash_index)) {
for (i = 0; i < cell_count; i += chunk_size) {
ulint end_index = ut_min(i + chunk_size - 1, cell_count - 1);
/* We release btr_search_latch every once in a while to
give other queries a chance to run. */
if (i != 0) {
rw_lock_x_unlock(&btr_search_latch);
os_thread_yield();
rw_lock_x_lock(&btr_search_latch);
}
if (!ha_validate(btr_search_sys->hash_index, i, end_index)) {
ok = FALSE;
}
}
rw_lock_x_unlock(&btr_search_latch);
if (UNIV_LIKELY_NULL(heap)) {

View file

@ -464,12 +464,17 @@ buf_block_init(
byte* frame) /* in: pointer to buffer frame, or NULL if in
the case of AWE there is no frame */
{
block->magic_n = 0;
block->state = BUF_BLOCK_NOT_USED;
block->frame = frame;
block->awe_info = NULL;
block->buf_fix_count = 0;
block->io_fix = 0;
block->modify_clock = ut_dulint_zero;
block->file_page_was_freed = FALSE;

View file

@ -294,14 +294,14 @@ buf_LRU_try_free_flushed_blocks(void)
}
/**********************************************************************
Returns TRUE if less than 15 % of the buffer pool is available. This can be
Returns TRUE if less than 25 % of the buffer pool is available. This can be
used in heuristics to prevent huge transactions eating up the whole buffer
pool for their locks. */
ibool
buf_LRU_buf_pool_running_out(void)
/*==============================*/
/* out: TRUE if less than 15 % of buffer pool
/* out: TRUE if less than 25 % of buffer pool
left */
{
ibool ret = FALSE;
@ -309,7 +309,7 @@ buf_LRU_buf_pool_running_out(void)
mutex_enter(&(buf_pool->mutex));
if (!recv_recovery_on && UT_LIST_GET_LEN(buf_pool->free)
+ UT_LIST_GET_LEN(buf_pool->LRU) < buf_pool->max_size / 7) {
+ UT_LIST_GET_LEN(buf_pool->LRU) < buf_pool->max_size / 4) {
ret = TRUE;
}
@ -340,11 +340,11 @@ loop:
mutex_enter(&(buf_pool->mutex));
if (!recv_recovery_on && UT_LIST_GET_LEN(buf_pool->free)
+ UT_LIST_GET_LEN(buf_pool->LRU) < buf_pool->max_size / 10) {
+ UT_LIST_GET_LEN(buf_pool->LRU) < buf_pool->max_size / 20) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: ERROR: over 9 / 10 of the buffer pool is occupied by\n"
" InnoDB: ERROR: over 95 percent of the buffer pool is occupied by\n"
"InnoDB: lock heaps or the adaptive hash index! Check that your\n"
"InnoDB: transactions do not set too many row locks.\n"
"InnoDB: Your buffer pool size is %lu MB. Maybe you should make\n"
@ -356,17 +356,17 @@ loop:
ut_error;
} else if (!recv_recovery_on && UT_LIST_GET_LEN(buf_pool->free)
+ UT_LIST_GET_LEN(buf_pool->LRU) < buf_pool->max_size / 5) {
+ UT_LIST_GET_LEN(buf_pool->LRU) < buf_pool->max_size / 3) {
if (!buf_lru_switched_on_innodb_mon) {
/* Over 80 % of the buffer pool is occupied by lock
/* Over 67 % of the buffer pool is occupied by lock
heaps or the adaptive hash index. This may be a memory
leak! */
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: WARNING: over 4 / 5 of the buffer pool is occupied by\n"
" InnoDB: WARNING: over 67 percent of the buffer pool is occupied by\n"
"InnoDB: lock heaps or the adaptive hash index! Check that your\n"
"InnoDB: transactions do not set too many row locks.\n"
"InnoDB: Your buffer pool size is %lu MB. Maybe you should make\n"

View file

@ -252,7 +252,7 @@ dtype_print(
} else if (prtype == DATA_ENGLISH) {
fputs("DATA_ENGLISH", stderr);
} else {
fprintf(stderr, "prtype %lu", (ulong) mtype);
fprintf(stderr, "prtype %lu", (ulong) prtype);
}
}

View file

@ -2194,8 +2194,9 @@ dict_foreign_error_report(
fputs(msg, file);
fputs(" Constraint:\n", file);
dict_print_info_on_foreign_key_in_create_format(file, NULL, fk, TRUE);
putc('\n', file);
if (fk->foreign_index) {
fputs("\nThe index in the foreign key in table is ", file);
fputs("The index in the foreign key in table is ", file);
ut_print_name(file, NULL, fk->foreign_index->name);
fputs(
"\nSee http://dev.mysql.com/doc/mysql/en/InnoDB_foreign_key_constraints.html\n"

View file

@ -3557,6 +3557,7 @@ fil_extend_space_to_desired_size(
*actual_size = space->size;
#ifndef UNIV_HOTBACKUP
if (space_id == 0) {
ulint pages_per_mb = (1024 * 1024) / UNIV_PAGE_SIZE;
@ -3566,6 +3567,7 @@ fil_extend_space_to_desired_size(
srv_data_file_sizes[srv_n_data_files - 1] =
(node->size / pages_per_mb) * pages_per_mb;
}
#endif /* !UNIV_HOTBACKUP */
/*
printf("Extended %s to %lu, actual size %lu pages\n", space->name,
@ -3820,6 +3822,31 @@ fil_node_complete_io(
}
}
/************************************************************************
Report information about an invalid page access. */
static
void
fil_report_invalid_page_access(
/*===========================*/
ulint block_offset, /* in: block offset */
ulint space_id, /* in: space id */
const char* space_name, /* in: space name */
ulint byte_offset, /* in: byte offset */
ulint len, /* in: I/O length */
ulint type) /* in: I/O type */
{
fprintf(stderr,
"InnoDB: Error: trying to access page number %lu in space %lu,\n"
"InnoDB: space name %s,\n"
"InnoDB: which is outside the tablespace bounds.\n"
"InnoDB: Byte offset %lu, len %lu, i/o type %lu.\n"
"InnoDB: If you get this error at mysqld startup, please check that\n"
"InnoDB: your my.cnf matches the ibdata files that you have in the\n"
"InnoDB: MySQL server.\n",
(ulong) block_offset, (ulong) space_id, space_name,
(ulong) byte_offset, (ulong) len, (ulong) type);
}
/************************************************************************
Reads or writes data. This operation is asynchronous (aio). */
@ -3926,14 +3953,8 @@ fil_io(
for (;;) {
if (node == NULL) {
fprintf(stderr,
"InnoDB: Error: trying to access page number %lu in space %lu,\n"
"InnoDB: space name %s,\n"
"InnoDB: which is outside the tablespace bounds.\n"
"InnoDB: Byte offset %lu, len %lu, i/o type %lu\n",
(ulong) block_offset, (ulong) space_id,
space->name, (ulong) byte_offset, (ulong) len,
(ulong) type);
fil_report_invalid_page_access(block_offset, space_id,
space->name, byte_offset, len, type);
ut_error;
}
@ -3962,15 +3983,10 @@ fil_io(
if (space->purpose == FIL_TABLESPACE && space->id != 0
&& node->size <= block_offset) {
fprintf(stderr,
"InnoDB: Error: trying to access page number %lu in space %lu,\n"
"InnoDB: space name %s,\n"
"InnoDB: which is outside the tablespace bounds.\n"
"InnoDB: Byte offset %lu, len %lu, i/o type %lu\n",
(ulong) block_offset, (ulong) space_id,
space->name, (ulong) byte_offset, (ulong) len,
(ulong) type);
ut_a(0);
fil_report_invalid_page_access(block_offset, space_id,
space->name, byte_offset, len, type);
ut_error;
}
/* Now we have made the changes in the data structures of system */

View file

@ -276,20 +276,26 @@ ha_remove_all_nodes_to_page(
}
/*****************************************************************
Validates a hash table. */
Validates a given range of the cells in hash table. */
ibool
ha_validate(
/*========*/
/* out: TRUE if ok */
hash_table_t* table) /* in: hash table */
hash_table_t* table, /* in: hash table */
ulint start_index, /* in: start index */
ulint end_index) /* in: end index */
{
hash_cell_t* cell;
ha_node_t* node;
ibool ok = TRUE;
ulint i;
for (i = 0; i < hash_get_n_cells(table); i++) {
ut_a(start_index <= end_index);
ut_a(start_index < hash_get_n_cells(table));
ut_a(end_index < hash_get_n_cells(table));
for (i = start_index; i <= end_index; i++) {
cell = hash_get_nth_cell(table, i);

View file

@ -459,7 +459,10 @@ btr_store_big_rec_extern_fields(
dict_index_t* index, /* in: index of rec; the index tree
MUST be X-latched */
rec_t* rec, /* in: record */
const ulint* offsets, /* in: rec_get_offsets(rec, index) */
const ulint* offsets, /* in: rec_get_offsets(rec, index);
the "external storage" flags in offsets
will not correspond to rec when
this function returns */
big_rec_t* big_rec_vec, /* in: vector containing fields
to be stored externally */
mtr_t* local_mtr); /* in: mtr containing the latch to

View file

@ -26,14 +26,14 @@ void
buf_LRU_try_free_flushed_blocks(void);
/*==================================*/
/**********************************************************************
Returns TRUE if less than 15 % of the buffer pool is available. This can be
Returns TRUE if less than 25 % of the buffer pool is available. This can be
used in heuristics to prevent huge transactions eating up the whole buffer
pool for their locks. */
ibool
buf_LRU_buf_pool_running_out(void);
/*==============================*/
/* out: TRUE if less than 15 % of buffer pool
/* out: TRUE if less than 25 % of buffer pool
left */
/*#######################################################################

View file

@ -114,13 +114,15 @@ ha_remove_all_nodes_to_page(
ulint fold, /* in: fold value */
page_t* page); /* in: buffer page */
/*****************************************************************
Validates a hash table. */
Validates a given range of the cells in hash table. */
ibool
ha_validate(
/*========*/
/* out: TRUE if ok */
hash_table_t* table); /* in: hash table */
hash_table_t* table, /* in: hash table */
ulint start_index, /* in: start index */
ulint end_index); /* in: end index */
/*****************************************************************
Prints info of a hash table. */

View file

@ -175,19 +175,6 @@ page_rec_is_comp(
/* out: nonzero if in compact format */
const rec_t* rec) /* in: record */
{
#ifdef UNIV_RELEASE_NOT_YET_STABLE
if (UNIV_UNLIKELY((ulint)rec < (ulint)(buf_pool->frame_zero))
|| UNIV_UNLIKELY((ulint)rec >= (ulint)(buf_pool->high_end))) {
ut_print_timestamp(stderr);
fprintf(stderr,
"InnoDB: Error: trying to read a stray page rec %p\n"
"InnoDB: buf pool start is at %p, end at %p\n",
rec, buf_pool->frame_zero,
buf_pool->high_end);
ut_error;
}
#endif
return(page_is_comp(ut_align_down((rec_t*) rec, UNIV_PAGE_SIZE)));
}

View file

@ -80,10 +80,6 @@ memory is read outside the allocated blocks. */
/* Make a non-inline debug version */
/* You can remove this define when the release is stable. This define adds
some consistency checks to code. They use a little CPU time. */
#define UNIV_RELEASE_NOT_YET_STABLE
/*
#define UNIV_DEBUG
#define UNIV_MEM_DEBUG

View file

@ -28,6 +28,7 @@ Created 4/20/1996 Heikki Tuuri
#include "eval0eval.h"
#include "data0data.h"
#include "usr0sess.h"
#include "buf0lru.h"
#define ROW_INS_PREV 1
#define ROW_INS_NEXT 2
@ -278,10 +279,17 @@ row_ins_sec_index_entry_by_modify(
}
} else {
ut_a(mode == BTR_MODIFY_TREE);
if (buf_LRU_buf_pool_running_out()) {
err = DB_LOCK_TABLE_FULL;
goto func_exit;
}
err = btr_cur_pessimistic_update(BTR_KEEP_SYS_FLAG, cursor,
&dummy_big_rec, update, 0, thr, mtr);
}
func_exit:
mem_heap_free(heap);
return(err);
@ -342,10 +350,16 @@ row_ins_clust_index_entry_by_modify(
}
} else {
ut_a(mode == BTR_MODIFY_TREE);
if (buf_LRU_buf_pool_running_out()) {
err = DB_LOCK_TABLE_FULL;
goto func_exit;
}
err = btr_cur_pessimistic_update(0, cursor, big_rec, update,
0, thr, mtr);
}
func_exit:
mem_heap_free(heap);
return(err);
@ -1860,7 +1874,6 @@ row_ins_duplicate_error_in_clust(
err = DB_DUPLICATE_KEY;
goto func_exit;
}
mem_heap_free(heap);
}
ut_a(!(cursor->index->type & DICT_CLUSTERED));
@ -1869,6 +1882,9 @@ row_ins_duplicate_error_in_clust(
err = DB_SUCCESS;
func_exit:
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
return(err);
#else /* UNIV_HOTBACKUP */
/* This function depends on MySQL code that is not included in
@ -2068,6 +2084,12 @@ row_ins_index_entry_low(
&insert_rec, &big_rec, thr, &mtr);
} else {
ut_a(mode == BTR_MODIFY_TREE);
if (buf_LRU_buf_pool_running_out()) {
err = DB_LOCK_TABLE_FULL;
goto function_exit;
}
err = btr_cur_pessimistic_insert(0, &cursor, entry,
&insert_rec, &big_rec, thr, &mtr);
}

View file

@ -2358,16 +2358,16 @@ row_sel_field_store_in_mysql_format(
} else if (templ->type == DATA_MYSQL) {
memcpy(dest, data, len);
ut_a(templ->mysql_col_len >= len);
ut_a(templ->mbmaxlen >= templ->mbminlen);
ut_ad(templ->mysql_col_len >= len);
ut_ad(templ->mbmaxlen >= templ->mbminlen);
ut_a(templ->mbmaxlen > templ->mbminlen
ut_ad(templ->mbmaxlen > templ->mbminlen
|| templ->mysql_col_len == len);
/* The following assertion would fail for old tables
containing UTF-8 ENUM columns due to Bug #9526. */
ut_ad(!templ->mbmaxlen
|| !(templ->mysql_col_len % templ->mbmaxlen));
ut_a(len * templ->mbmaxlen >= templ->mysql_col_len);
ut_ad(len * templ->mbmaxlen >= templ->mysql_col_len);
if (templ->mbminlen != templ->mbmaxlen) {
/* Pad with spaces. This undoes the stripping
@ -2377,7 +2377,7 @@ row_sel_field_store_in_mysql_format(
memset(dest + len, 0x20, templ->mysql_col_len - len);
}
} else {
ut_a(templ->type == DATA_CHAR
ut_ad(templ->type == DATA_CHAR
|| templ->type == DATA_FIXBINARY
/*|| templ->type == DATA_SYS_CHILD
|| templ->type == DATA_SYS*/

View file

@ -28,6 +28,7 @@ Created 12/27/1996 Heikki Tuuri
#include "log0log.h"
#include "pars0sym.h"
#include "eval0eval.h"
#include "buf0lru.h"
/* What kind of latch and lock can we assume when the control comes to
@ -1523,6 +1524,10 @@ row_upd_clust_rec(
return(err);
}
if (buf_LRU_buf_pool_running_out()) {
return(DB_LOCK_TABLE_FULL);
}
/* We may have to modify the tree structure: do a pessimistic descent
down the index tree */

View file

@ -29,7 +29,7 @@ INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
include $(srcdir)/Makefile.shared
libmysqlclient_la_SOURCES = $(target_sources)
libmysqlclient_la_LIBADD = $(target_libadd) $(yassl_libs_with_path)
libmysqlclient_la_LIBADD = $(target_libadd) $(yassl_las)
libmysqlclient_la_LDFLAGS = $(target_ldflags)
EXTRA_DIST = Makefile.shared libmysql.def
noinst_HEADERS = client_settings.h

View file

@ -85,8 +85,14 @@ DEFS = -DDEFAULT_CHARSET_HOME="\"$(MYSQLBASEdir)\"" \
-DDATADIR="\"$(MYSQLDATAdir)\"" \
-DDEFAULT_HOME_ENV=MYSQL_HOME \
-DDEFAULT_GROUP_SUFFIX_ENV=MYSQL_GROUP_SUFFIX \
-DDEFAULT_SYSCONFDIR="\"$(sysconfdir)\"" \
-DSHAREDIR="\"$(MYSQLSHAREdir)\"" $(target_defs)
if HAVE_YASSL
yassl_las = $(top_srcdir)/extra/yassl/src/libyassl.la \
$(top_srcdir)/extra/yassl/taocrypt/src/libtaocrypt.la
endif
# The automatic dependencies miss this
#bmove_upp.lo: $(LTCHARSET_OBJS)

View file

@ -1386,35 +1386,6 @@ mysql_get_server_info(MYSQL *mysql)
}
/*
Get version number for server in a form easy to test on
SYNOPSIS
mysql_get_server_version()
mysql Connection
EXAMPLE
4.1.0-alfa -> 40100
NOTES
We will ensure that a newer server always has a bigger number.
RETURN
Signed number > 323000
*/
ulong STDCALL
mysql_get_server_version(MYSQL *mysql)
{
uint major, minor, version;
char *pos= mysql->server_version, *end_pos;
major= (uint) strtoul(pos, &end_pos, 10); pos=end_pos+1;
minor= (uint) strtoul(pos, &end_pos, 10); pos=end_pos+1;
version= (uint) strtoul(pos, &end_pos, 10);
return (ulong) major*10000L+(ulong) (minor*100+version);
}
const char * STDCALL
mysql_get_host_info(MYSQL *mysql)
{

View file

@ -32,7 +32,7 @@ include $(top_srcdir)/libmysql/Makefile.shared
libmysql_dir = $(top_srcdir)/libmysql
libmysqlclient_r_la_SOURCES = $(target_sources)
libmysqlclient_r_la_LIBADD = $(target_libadd) $(yassl_libs_with_path)
libmysqlclient_r_la_LIBADD = $(target_libadd) $(yassl_las)
libmysqlclient_r_la_LDFLAGS = $(target_ldflags)
# This is called from the toplevel makefile

View file

@ -1189,16 +1189,22 @@ my_bool _mi_memmap_file(MI_INFO *info)
MYISAM_SHARE *share=info->s;
DBUG_ENTER("mi_memmap_file");
if (!info->s->file_map)
if (!share->file_map)
{
my_off_t data_file_length= share->state.state.data_file_length;
if (data_file_length > (my_off_t) (~((size_t) 0)) - MEMMAP_EXTRA_MARGIN)
{
DBUG_PRINT("warning", ("File is too large for mmap"));
DBUG_RETURN(0);
}
if (my_seek(info->dfile,0L,MY_SEEK_END,MYF(0)) <
share->state.state.data_file_length+MEMMAP_EXTRA_MARGIN)
data_file_length + MEMMAP_EXTRA_MARGIN)
{
DBUG_PRINT("warning",("File isn't extended for memmap"));
DBUG_RETURN(0);
}
file_map=(byte*)
my_mmap(0,(size_t)(share->state.state.data_file_length+MEMMAP_EXTRA_MARGIN),PROT_READ,
my_mmap(0, (size_t) (data_file_length + MEMMAP_EXTRA_MARGIN), PROT_READ,
MAP_SHARED | MAP_NORESERVE, info->dfile, 0L);
if (file_map == (byte*) MAP_FAILED)
{
@ -1206,7 +1212,7 @@ my_bool _mi_memmap_file(MI_INFO *info)
my_errno=errno;
DBUG_RETURN(0);
}
info->s->file_map=file_map;
share->file_map= file_map;
}
info->opt_flag|= MEMMAP_USED;
info->read_record=share->read_record=_mi_read_mempack_record;

View file

@ -1471,7 +1471,7 @@ _mi_calc_var_pack_key_length(MI_KEYDEF *keyinfo,uint nod_flag,uchar *next_key,
if (!*key++)
{
s_temp->key=key;
s_temp->ref_length=s_temp->key_length=0;
s_temp->key_length= 0;
s_temp->totlength=key_length-1+diff_flag;
s_temp->next_key_pos=0; /* No next key */
return (s_temp->totlength);
@ -1626,12 +1626,12 @@ _mi_calc_var_pack_key_length(MI_KEYDEF *keyinfo,uint nod_flag,uchar *next_key,
s_temp->prev_length= org_key_length;
s_temp->n_ref_length=s_temp->n_length= org_key_length;
length+= org_key_length;
/* +get_pack_length(org_key_length); */
}
return (int) length;
}
ref_length=n_length;
/* Get information about not packed key suffix */
get_key_pack_length(n_length,next_length_pack,next_key);
/* Test if new keys has fewer characters that match the previous key */
@ -1640,7 +1640,6 @@ _mi_calc_var_pack_key_length(MI_KEYDEF *keyinfo,uint nod_flag,uchar *next_key,
s_temp->part_of_prev_key= 0;
s_temp->prev_length= ref_length;
s_temp->n_ref_length= s_temp->n_length= n_length+ref_length;
/* s_temp->prev_key+= get_pack_length(org_key_length); */
return (int) length+ref_length-next_length_pack;
}
if (ref_length+pack_marker > new_ref_length)
@ -1651,9 +1650,7 @@ _mi_calc_var_pack_key_length(MI_KEYDEF *keyinfo,uint nod_flag,uchar *next_key,
s_temp->prev_length= ref_length - new_pack_length;
s_temp->n_ref_length=s_temp->n_length=n_length + s_temp->prev_length;
s_temp->prev_key+= new_pack_length;
/* +get_pack_length(org_key_length); */
length= length-get_pack_length(ref_length)+
get_pack_length(new_pack_length);
length-= (next_length_pack - get_pack_length(s_temp->n_length));
return (int) length + s_temp->prev_length;
}
}

View file

@ -32,12 +32,14 @@ endif
benchdir_root= $(prefix)
testdir = $(benchdir_root)/mysql-test
EXTRA_SCRIPTS = mysql-test-run.sh mysql-test-run.pl install_test_db.sh valgrind.supp
EXTRA_SCRIPTS = mysql-test-run.sh install_test_db.sh valgrind.supp $(PRESCRIPTS)
EXTRA_DIST = $(EXTRA_SCRIPTS)
test_SCRIPTS = mysql-test-run install_test_db
GENSCRIPTS = mysql-test-run install_test_db
PRESCRIPTS = mysql-test-run.pl
test_SCRIPTS = $(GENSCRIPTS) $(PRESCRIPTS)
test_DATA = std_data/client-key.pem std_data/client-cert.pem std_data/cacert.pem \
std_data/server-cert.pem std_data/server-key.pem
CLEANFILES = $(test_SCRIPTS) $(test_DATA)
CLEANFILES = $(GENSCRIPTS) $(test_DATA)
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I..
EXTRA_PROGRAMS = mysql_test_run_new

View file

@ -0,0 +1,9 @@
--exec $MYSQL test -e 'show processlist' | grep 'Binlog Dump' | cut -f1 > $MYSQLTEST_VARDIR/tmp/bl_dump_thread_id
--disable_warnings
drop table if exists t999;
--enable_warnings
create temporary table t999 (f int);
--replace_result $MYSQLTEST_VARDIR "."
eval LOAD DATA INFILE "$MYSQLTEST_VARDIR/tmp/bl_dump_thread_id" into table t999;
let $id = `select f from t999`;
drop table t999;

View file

@ -0,0 +1,4 @@
-- require r/have_latin2_ch.require
disable_query_log;
show collation like "latin2_czech_cs";
enable_query_log;

View file

@ -0,0 +1,12 @@
#
# To check if the udf_example.so is available,
# try to load one function from it.
#
#
--require r/have_udf.require
--disable_abort_on_error
CREATE FUNCTION metaphon RETURNS STRING SONAME 'udf_example.so';
--disable_query_log
DROP FUNCTION metaphon;
--enable_query_log
--enable_abort_on_error

View file

@ -0,0 +1,158 @@
# include/wait_slave_status.inc
#
# Created by Matthias Leich
#
# SUMMARY
#
# Waits until slave has reached certain state or maximum time reached.
#
# (This script will not work, when the SHOW command delivers more than one
# result record, because only the first record will be caught.)
#
# USAGE
#
# Set $result_pattern in test file and source this file:
#
# let $result_pattern= <pattern used for LIKE on the result of
# SHOW STATUS SLAVE>
# --include wait_slave_status.inc
#
# EXAMPLE
#
# The script rpl_until.test:
# ...
# --replace_result $MASTER_MYPORT MASTER_MYPORT
# --replace_column 1 # 9 # 23 # 33 #
# --vertical_results show slave status;
#
# outputs
# show slave status;
# Slave_IO_State #
# Master_Host 127.0.0.1
# Master_User root
# Master_Port MASTER_MYPORT
# Connect_Retry 1
# Master_Log_File master-bin.000001
# Read_Master_Log_Pos 776
# Relay_Log_File slave-relay-bin.000004
# Relay_Log_Pos #
# Relay_Master_Log_File master-bin.000001
# Slave_IO_Running Yes
# Slave_SQL_Running No
# Replicate_Do_DB
# Replicate_Ignore_DB
# Replicate_Do_Table
# Replicate_Ignore_Table
# Replicate_Wild_Do_Table
# Replicate_Wild_Ignore_Table
# Last_Errno 0
# Last_Error
# Skip_Counter 0
# Exec_Master_Log_Pos 319
# Relay_Log_Space #
# Until_Condition Master
# Until_Log_File master-bin.000001
# Until_Log_Pos 319
# Master_SSL_Allowed No
# Master_SSL_CA_File
# Master_SSL_CA_Path
# Master_SSL_Cert
# Master_SSL_Cipher
# Master_SSL_Key
# Seconds_Behind_Master #
#
# The main problem with the "show slave status;" in rpl_until is, that
# depending on the total test engine power and the current load caused by
# other processes, the expected slave status might be not reached though
# it will happen in maybe some seconds.
#
# The typical problem with rpl_until is that Slave_IO_Running is "No"
# instead of "Yes".
#
# The expected result follows the LIKE pattern:
#
# let $result_pattern= '%127.0.0.1%root%1%master-bin.000001%776%slave-relay-bin.000004%master-bin.000001%Yes%No%0%0%319%Master%master-bin.000001%319%No%';
#
# The Slave_IO_Running value is the "Yes" just after the "master-bin.000001".
#
# How to get this pattern ?
#
# Any lines "--replace_result ..." and "--replace_colum ..." just before
# the SHOW TABLE STATUS and of course the expected result itself
# show us columns where the content must be unified, because it is non
# deterministic or it depends on the current test environment.
#
# Unfortunately "--replace_result ..." and "--replace_colum ..." do not
# affect the result of our assignment let $my_val= `SHOW SLAVE STATUS`;
# Therefore such content must be covered by '%'.
#
# Please be careful. A more simple pattern might be dangerous, because we
# might get "wrong" matches. Example: There might be several "Yes" and "No"
# within one result row.
#
###############################################################################
# We do not want to print the auxiliary commands, because they are not of
# interest and their amount will vary depending how fast we get the
# desired state.
--disable_query_log
# The protocol should show
# - the setting of $result_pattern and
# - that this file is sourced ,
# because this increases the chance to use the protocol as replay script.
eval SELECT "let \$result_pattern= $result_pattern ;" AS "";
SELECT '--source include/wait_slave_status.inc' AS "";
# We accept to wait maximum 30 seconds (0.2 sec/loop).
let $max_wait= 150;
while ($max_wait)
{
let $my_val= `SHOW SLAVE STATUS`;
# Now we have the first record of the SHOW result set as one fat string
# within the variable $my_val.
eval SET @my_val = '$my_val';
# DEBUG eval SELECT @my_val AS "response to SHOW SLAVE STATUS";
eval SELECT @my_val LIKE $result_pattern INTO @success;
# @success is '1' if we have a match
# '0' if we have no match
# DEBUG SELECT @success;
let $success= `SELECT @success`;
let $no_success= `SELECT @success = 0`;
if ($success)
{
# We reached the expected result and want to jump out of the loop
# without unneeded sleeps.
# Attention: Do not set $max_wait to 0, because "while" with negative value
# does not work.
let $max_wait= 1;
}
if ($no_success)
{
# We did not reach the expected result and will have to sleep again
# or jump out of the loop, when max_wait is exhausted.
real_sleep 0.2;
}
dec $max_wait;
}
--enable_query_log
if ($no_success)
{
let $message= ! Attention: Timeout in wait_slave_status.inc.
| Possible reasons with decreasing probability:
| - The LIKE pattern ($result_pattern) is wrong, because the
| testcase was altered or the layout of the
| SHOW SLAVE STATUS result set changed.
| - There is a new bug within the replication.
| - We met an extreme testing environment and $max_wait is
| too small.;
--source include/show_msg80.inc
--echo DEBUG INFO START (wait_slave_status.inc):
--echo $result_pattern
--vertical_results
show slave status;
--echo DEBUG INFO END
}

View file

@ -465,8 +465,7 @@ sub mtr_kill_leftovers () {
if ( kill(0, @pids) ) # Check if some left
{
# FIXME maybe just mtr_warning() ?
mtr_error("can't kill process(es) " . join(" ", @pids));
mtr_warning("can't kill process(es) " . join(" ", @pids));
}
}
}
@ -479,7 +478,7 @@ sub mtr_kill_leftovers () {
{
if ( mtr_ping_mysqld_server($srv->{'port'}, $srv->{'sockfile'}) )
{
mtr_error("can't kill old mysqld holding port $srv->{'port'}");
mtr_warning("can't kill old mysqld holding port $srv->{'port'}");
}
}
}

View file

@ -36,6 +36,7 @@ sub mtr_show_failed_diff ($) {
my $reject_file= "r/$tname.reject";
my $result_file= "r/$tname.result";
my $log_file= "r/$tname.log";
my $eval_file= "r/$tname.eval";
if ( $::opt_suite ne "main" )
@ -43,6 +44,7 @@ sub mtr_show_failed_diff ($) {
$reject_file= "$::glob_mysql_test_dir/suite/$::opt_suite/$reject_file";
$result_file= "$::glob_mysql_test_dir/suite/$::opt_suite/$result_file";
$eval_file= "$::glob_mysql_test_dir/suite/$::opt_suite/$eval_file";
$log_file= "$::glob_mysql_test_dir/suite/$::opt_suite/$log_file";
}
if ( -f $eval_file )
@ -70,6 +72,12 @@ sub mtr_show_failed_diff ($) {
print "http://www.mysql.com/doc/en/Reporting_mysqltest_bugs.html\n";
print "to find the reason to this problem and how to report this.\n\n";
}
if ( -f $log_file )
{
print "Result from queries before failure can be found in $log_file\n";
# FIXME Maybe a tail -f -n 10 $log_file here
}
}
sub mtr_report_test_name ($) {

View file

@ -78,6 +78,12 @@ sub mtr_timer_start($$$) {
{
# Child, redirect output and exec
# FIXME do we need to redirect streams?
# Don't do the ^C cleanup in the timeout child processes!
# There is actually a race here, if we get ^C after fork(), but before
# clearing the signal handler.
$SIG{INT}= 'DEFAULT';
$0= "mtr_timer(timers,$name,$duration)";
sleep($duration);
exit(0);

View file

@ -134,6 +134,7 @@ our $glob_win32= 0; # OS and native Win32 executables
our $glob_win32_perl= 0; # ActiveState Win32 Perl
our $glob_cygwin_perl= 0; # Cygwin Perl
our $glob_cygwin_shell= undef;
our $glob_use_libtool= 1;
our $glob_mysql_test_dir= undef;
our $glob_mysql_bench_dir= undef;
our $glob_hostname= undef;
@ -205,7 +206,6 @@ our $opt_cursor_protocol;
our $opt_view_protocol;
our $opt_current_test;
our $opt_ddd;
our $opt_debug;
our $opt_do_test;
our @opt_cases; # The test cases names in argv
@ -219,9 +219,16 @@ our $opt_gcov;
our $opt_gcov_err;
our $opt_gcov_msg;
our $glob_debugger= 0;
our $opt_gdb;
our $opt_client_gdb;
our $opt_ddd;
our $opt_client_ddd;
our $opt_manual_gdb;
our $opt_manual_ddd;
our $opt_manual_debug;
our $opt_debugger;
our $opt_client_debugger;
our $opt_gprof;
our $opt_gprof_dir;
@ -278,11 +285,12 @@ our $opt_timer;
our $opt_user;
our $opt_user_test;
our $opt_valgrind;
our $opt_valgrind_mysqld;
our $opt_valgrind_mysqltest;
our $opt_valgrind_all;
our $opt_valgrind= 0;
our $opt_valgrind_mysqld= 0;
our $opt_valgrind_mysqltest= 0;
our $opt_valgrind_all= 0;
our $opt_valgrind_options;
our $opt_valgrind_path;
our $opt_stress= "";
our $opt_stress_suite= "main";
@ -294,8 +302,6 @@ our $opt_stress_test_duration= 0;
our $opt_stress_init_file= "";
our $opt_stress_test_file= "";
our $opt_verbose;
our $opt_wait_for_master;
our $opt_wait_for_slave;
our $opt_wait_timeout= 10;
@ -306,6 +312,9 @@ our $opt_udiff;
our $opt_skip_ndbcluster;
our $opt_with_ndbcluster;
our $opt_with_ndbcluster_only= 0; # dummy, ignored
our $opt_with_openssl;
our $exe_ndb_mgm;
our $path_ndb_tools_dir;
@ -446,6 +455,12 @@ sub initial_setup () {
$glob_cygwin_perl= ($^O eq "cygwin");
$glob_win32= ($glob_win32_perl or $glob_cygwin_perl);
# Use libtool on all platforms except windows
if ( $glob_win32 )
{
$glob_use_libtool= 0;
}
# We require that we are in the "mysql-test" directory
# to run mysql-test-run
@ -516,6 +531,10 @@ sub command_line_setup () {
# 5.1 test run, even if different MTR_BUILD_THREAD is used. This means
# all port numbers might not be used in this version of the script.
#
# Also note the limiteation of ports we are allowed to hand out. This
# differs between operating systems and configuration, see
# http://www.ncftp.com/ncftpd/doc/misc/ephemeral_ports.html
# But a fairly safe range seems to be 5001 - 32767
if ( $ENV{'MTR_BUILD_THREAD'} )
{
# Up to two masters, up to three slaves
@ -527,6 +546,13 @@ sub command_line_setup () {
$im_mysqld2_port= $opt_master_myport + 8;
}
if ( $opt_master_myport < 5001 or $opt_master_myport + 10 >= 32767 )
{
mtr_error("MTR_BUILD_THREAD number results in a port",
"outside 5001 - 32767",
"($opt_master_myport - $opt_master_myport + 10)");
}
# Read the command line
# Note: Keep list, and the order, in sync with usage at end of this file
@ -549,6 +575,7 @@ sub command_line_setup () {
'force' => \$opt_force,
'with-ndbcluster' => \$opt_with_ndbcluster,
'skip-ndbcluster|skip-ndb' => \$opt_skip_ndbcluster,
'with-ndbcluster-only' => \$opt_with_ndbcluster_only,
'do-test=s' => \$opt_do_test,
'suite=s' => \$opt_suite,
'skip-rpl' => \$opt_skip_rpl,
@ -577,9 +604,13 @@ sub command_line_setup () {
# Debugging
'gdb' => \$opt_gdb,
'manual-gdb' => \$opt_manual_gdb,
'client-gdb' => \$opt_client_gdb,
'manual-gdb' => \$opt_manual_gdb,
'manual-debug' => \$opt_manual_debug,
'ddd' => \$opt_ddd,
'client-ddd' => \$opt_client_ddd,
'debugger=s' => \$opt_debugger,
'client-debugger=s' => \$opt_client_debugger,
'strace-client' => \$opt_strace_client,
'master-binary=s' => \$exe_master_mysqld,
'slave-binary=s' => \$exe_slave_mysqld,
@ -587,10 +618,12 @@ sub command_line_setup () {
# Coverage, profiling etc
'gcov' => \$opt_gcov,
'gprof' => \$opt_gprof,
'valgrind:s' => \$opt_valgrind,
'valgrind-mysqltest:s' => \$opt_valgrind_mysqltest,
'valgrind-all:s' => \$opt_valgrind_all,
'valgrind' => \$opt_valgrind,
'valgrind-mysqltest' => \$opt_valgrind_mysqltest,
'valgrind-mysqld' => \$opt_valgrind_mysqld,
'valgrind-all' => \$opt_valgrind_all,
'valgrind-options=s' => \$opt_valgrind_options,
'valgrind-path=s' => \$opt_valgrind_path,
# Stress testing
'stress' => \$opt_stress,
@ -603,6 +636,10 @@ sub command_line_setup () {
'stress-test-count=i' => \$opt_stress_test_count,
'stress-test-duration=i' => \$opt_stress_test_duration,
# Directories
'tmpdir=s' => \$opt_tmpdir,
'vardir=s' => \$opt_vardir,
# Misc
'big-test' => \$opt_big_test,
'comment=s' => \$opt_comment,
@ -620,12 +657,9 @@ sub command_line_setup () {
'start-and-exit' => \$opt_start_and_exit,
'start-from=s' => \$opt_start_from,
'timer' => \$opt_timer,
'tmpdir=s' => \$opt_tmpdir,
'unified-diff|udiff' => \$opt_udiff,
'user-test=s' => \$opt_user_test,
'user=s' => \$opt_user,
'vardir=s' => \$opt_vardir,
'verbose' => \$opt_verbose,
'wait-timeout=i' => \$opt_wait_timeout,
'testcase-timeout=i' => \$opt_testcase_timeout,
'suite-timeout=i' => \$opt_suite_timeout,
@ -647,6 +681,11 @@ sub command_line_setup () {
print '#' x 78, "\n\n";
}
if ( $opt_with_ndbcluster_only )
{
print "# Option '--with-ndbcluster-only' is ignored in this release.\n";
}
foreach my $arg ( @ARGV )
{
if ( $arg =~ /^--skip-/ )
@ -757,29 +796,18 @@ sub command_line_setup () {
mtr_error("Coverage test needs the source - please use source dist");
}
if ( $opt_gdb )
# Check debug related options
if ( $opt_gdb || $opt_client_gdb || $opt_ddd || $opt_client_ddd ||
$opt_manual_gdb || $opt_manual_ddd || $opt_manual_debug ||
$opt_debugger || $opt_client_debugger )
{
# Indicate that we are using debugger
$glob_debugger= 1;
# Increase timeouts
$opt_wait_timeout= 300;
if ( $opt_extern )
{
mtr_error("Can't use --extern with --gdb");
}
}
if ( $opt_manual_gdb )
{
$opt_gdb= 1;
if ( $opt_extern )
{
mtr_error("Can't use --extern with --manual-gdb");
}
}
if ( $opt_ddd )
{
if ( $opt_extern )
{
mtr_error("Can't use --extern with --ddd");
mtr_error("Can't use --extern when using debugger");
}
}
@ -798,22 +826,20 @@ sub command_line_setup () {
$opt_with_ndbcluster= 0;
}
# The ":s" in the argument spec, means we have three different cases
#
# undefined option not set
# "" option set with no argument
# "somestring" option is name/path of valgrind executable
# Take executable path from any of them, if any
$opt_valgrind_mysqld= $opt_valgrind;
$opt_valgrind= $opt_valgrind_mysqltest if $opt_valgrind_mysqltest;
$opt_valgrind= $opt_valgrind_all if $opt_valgrind_all;
# If valgrind flag not defined, define if other valgrind flags are
unless ( defined $opt_valgrind )
# Turn on valgrinding of all executables if "valgrind" or "valgrind-all"
if ( $opt_valgrind or $opt_valgrind_all )
{
$opt_valgrind= ""
if defined $opt_valgrind_mysqltest or defined $opt_valgrind_all;
mtr_report("Turning on valgrind for all executables");
$opt_valgrind= 1;
$opt_valgrind_mysqld= 1;
$opt_valgrind_mysqltest= 1;
}
elsif ( $opt_valgrind_mysqld or $opt_valgrind_mysqltest )
{
# If test's are run for a specific executable, turn on
# verbose and show-reachable
$opt_valgrind= 1;
$opt_valgrind_all= 1;
}
if ( ! $opt_testcase_timeout )
@ -828,12 +854,11 @@ sub command_line_setup () {
$opt_suite_timeout*= 4 if defined $opt_valgrind;
}
if ( defined $opt_valgrind )
# Increase times to wait for executables to start if using valgrind
if ( $opt_valgrind )
{
$opt_sleep_time_after_restart= 10;
$opt_sleep_time_for_delete= 60;
# >=2.1.2 requires the --tool option, some versions write to stdout, some to stderr
# valgrind --help 2>&1 | grep "\-\-tool" > /dev/null && VALGRIND="$VALGRIND --tool=memcheck"
}
if ( ! $opt_user )
@ -1022,20 +1047,8 @@ sub executable_setup () {
"/usr/bin/false");
}
else
{
if ( $opt_valgrind_mysqltest )
{
# client/mysqltest might be a libtool .sh script, so look for real exe
# to avoid valgrinding bash ;)
$exe_mysqltest=
mtr_exe_exists("$path_client_bindir/.libs/lt-mysqltest",
"$path_client_bindir/.libs/mysqltest",
"$path_client_bindir/mysqltest");
}
else
{
$exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest");
}
$exe_mysql_client_test=
mtr_exe_exists("$glob_basedir/tests/mysql_client_test",
"$path_client_bindir/mysql_client_test",
@ -1140,6 +1153,14 @@ sub environment_setup () {
($ENV{'DYLD_LIBRARY_PATH'} ? ":$ENV{'DYLD_LIBRARY_PATH'}" : "");
}
# --------------------------------------------------------------------------
# Add the path where mysqld will find udf_example.so
# --------------------------------------------------------------------------
$ENV{'LD_LIBRARY_PATH'}=
"$glob_basedir/sql/.libs" .
($ENV{'LD_LIBRARY_PATH'} ? ":$ENV{'LD_LIBRARY_PATH'}" : "");
# --------------------------------------------------------------------------
# Also command lines in .opt files may contain env vars
# --------------------------------------------------------------------------
@ -1568,8 +1589,9 @@ sub run_suite () {
mtr_print_line();
if ( ! $opt_gdb and ! $glob_use_running_server and
! $opt_ddd and ! $glob_use_embedded_server )
if ( ! $glob_debugger and
! $glob_use_running_server and
! $glob_use_embedded_server )
{
stop_masters_slaves();
}
@ -2110,11 +2132,32 @@ sub save_installed_db () {
}
}
#
# Save any interesting files in the data_dir
# before the data dir is removed.
#
sub save_files_before_restore($$) {
my $test_name= shift;
my $data_dir= shift;
my $save_name= "$opt_vardir/log/$test_name";
# Look for core files
foreach my $core_file ( glob("$data_dir/core*") )
{
my $core_name= basename($core_file);
mtr_report("Saving $core_name");
mkdir($save_name) if ! -d $save_name;
rename("$core_file", "$save_name/$core_name");
}
}
#
# Restore snapshot of the installed test db(s)
# if the snapshot exists
#
sub restore_installed_db () {
sub restore_installed_db ($) {
my $test_name= shift;
if ( -d $path_snapshot)
{
@ -2125,6 +2168,7 @@ sub restore_installed_db () {
foreach my $data_dir (@data_dir_lst)
{
my $name= basename($data_dir);
save_files_before_restore($test_name, $data_dir);
rmtree("$data_dir");
copy_dir("$path_snapshot/$name", "$data_dir");
}
@ -2152,7 +2196,7 @@ sub report_failure_and_restart ($) {
if ( $opt_force )
{
# Restore the snapshot of the installed test db
restore_installed_db();
restore_installed_db($tinfo->{'name'});
print "Resuming Tests\n\n";
return;
}
@ -2160,8 +2204,9 @@ sub report_failure_and_restart ($) {
my $test_mode= join(" ", @::glob_test_mode) || "default";
print "Aborting: $tinfo->{'name'} failed in $test_mode mode. ";
print "To continue, re-run with '--force'.\n";
if ( ! $opt_gdb and ! $glob_use_running_server and
! $opt_ddd and ! $glob_use_embedded_server )
if ( ! $glob_debugger and
! $glob_use_running_server and
! $glob_use_embedded_server )
{
stop_masters_slaves();
}
@ -2288,7 +2333,7 @@ sub mysqld_arguments ($$$$$$) {
mtr_add_arg($args, "%s--language=%s", $prefix, $path_language);
mtr_add_arg($args, "%s--tmpdir=$opt_tmpdir", $prefix);
if ( defined $opt_valgrind_mysqld )
if ( $opt_valgrind_mysqld )
{
mtr_add_arg($args, "%s--skip-safemalloc", $prefix);
mtr_add_arg($args, "%s--skip-bdb", $prefix);
@ -2426,7 +2471,8 @@ sub mysqld_arguments ($$$$$$) {
mtr_add_arg($args, "%s--log-warnings", $prefix);
}
if ( $opt_gdb or $opt_client_gdb or $opt_manual_gdb or $opt_ddd)
# Indicate to "mysqld" it will be debugged in debugger
if ( $glob_debugger )
{
mtr_add_arg($args, "%s--gdb", $prefix);
}
@ -2502,7 +2548,7 @@ sub mysqld_start ($$$$$) {
my $args; # Arg vector
my $exe;
my $pid;
my $pid= -1;
if ( $type eq 'master' )
{
@ -2519,7 +2565,7 @@ sub mysqld_start ($$$$$) {
mtr_init_args(\$args);
if ( defined $opt_valgrind_mysqld )
if ( $opt_valgrind_mysqld )
{
valgrind_arguments($args, \$exe);
}
@ -2527,29 +2573,57 @@ sub mysqld_start ($$$$$) {
mysqld_arguments($args,$type,$idx,$extra_opt,$slave_master_info,
$using_ndbcluster);
if ( $opt_gdb || $opt_manual_gdb)
{
gdb_arguments(\$args, \$exe, "$type"."_$idx");
}
elsif ( $opt_ddd || $opt_manual_ddd )
{
ddd_arguments(\$args, \$exe, "$type"."_$idx");
}
elsif ( $opt_debugger )
{
debugger_arguments(\$args, \$exe, "$type"."_$idx");
}
elsif ( $opt_manual_debug )
{
print "\nStart $type in your debugger\n" .
"dir: $glob_mysql_test_dir\n" .
"exe: $exe\n" .
"args: " . join(" ", @$args) . "\n\n" .
"Waiting ....\n";
# Indicate the exe should not be started
$exe= undef;
}
if ( $type eq 'master' )
{
if ( $pid= mtr_spawn($exe, $args, "",
if ( ! defined $exe or
$pid= mtr_spawn($exe, $args, "",
$master->[$idx]->{'path_myerr'},
$master->[$idx]->{'path_myerr'},
"",
{ append_log_file => 1 }) )
{
return sleep_until_file_created($master->[$idx]->{'path_mypid'},
$master->[$idx]->{'start_timeout'}, $pid);
$master->[$idx]->{'start_timeout'},
$pid);
}
}
if ( $type eq 'slave' )
{
if ( $pid= mtr_spawn($exe, $args, "",
if ( ! defined $exe or
$pid= mtr_spawn($exe, $args, "",
$slave->[$idx]->{'path_myerr'},
$slave->[$idx]->{'path_myerr'},
"",
{ append_log_file => 1 }) )
{
return sleep_until_file_created($slave->[$idx]->{'path_mypid'},
$master->[$idx]->{'start_timeout'}, $pid);
$master->[$idx]->{'start_timeout'},
$pid);
}
}
@ -2868,11 +2942,6 @@ sub run_mysqltest ($) {
mtr_init_args(\$args);
if ( defined $opt_valgrind_mysqltest )
{
valgrind_arguments($args, \$exe);
}
mtr_add_arg($args, "--no-defaults");
mtr_add_arg($args, "--silent");
mtr_add_arg($args, "-v");
@ -2988,7 +3057,21 @@ sub run_mysqltest ($) {
# Add arguments that should not go into the MYSQL_TEST env var
# ----------------------------------------------------------------------
mtr_add_arg($args, "-R");
if ( $opt_valgrind_mysqltest )
{
# Prefix the Valgrind options to the argument list.
# We do this here, since we do not want to Valgrind the nested invocations
# of mysqltest; that would mess up the stderr output causing test failure.
my @args_saved = @$args;
mtr_init_args(\$args);
valgrind_arguments($args, \$exe);
mtr_add_arg($args, "%s", $_) for @args_saved;
}
mtr_add_arg($args, "--test-file");
mtr_add_arg($args, $tinfo->{'path'});
mtr_add_arg($args, "--result-file");
mtr_add_arg($args, $tinfo->{'result_file'});
if ( $opt_record )
@ -2996,21 +3079,209 @@ sub run_mysqltest ($) {
mtr_add_arg($args, "--record");
}
if ( $opt_client_gdb )
{
gdb_arguments(\$args, \$exe, "client");
}
elsif ( $opt_client_ddd )
{
ddd_arguments(\$args, \$exe, "client");
}
elsif ( $opt_client_debugger )
{
debugger_arguments(\$args, \$exe, "client");
}
if ($glob_use_libtool and $opt_valgrind)
{
# Add "libtool --mode-execute" before the test to execute
# if running in valgrind(to avoid valgrinding bash)
unshift(@$args, "--mode=execute", $exe);
$exe= "libtool";
}
if ( $opt_check_testcases )
{
run_check_testcase("before");
}
my $res = mtr_run_test($exe,$args,$tinfo->{'path'},"",$path_timefile,"");
my $res = mtr_run_test($exe,$args,"","",$path_timefile,"");
if ( $opt_check_testcases )
{
run_check_testcase("after");
}
return $res;
}
#
# Modify the exe and args so that program is run in gdb in xterm
#
sub gdb_arguments {
my $args= shift;
my $exe= shift;
my $type= shift;
# Write $args to gdb init file
my $str= join(" ", @$$args);
my $gdb_init_file= "$opt_tmpdir/gdbinit.$type";
# Remove the old gdbinit file
unlink($gdb_init_file);
if ( $type eq "client" )
{
# write init file for client
mtr_tofile($gdb_init_file,
"set args $str\n" .
"break main\n");
}
else
{
# write init file for mysqld
mtr_tofile($gdb_init_file,
"set args $str\n" .
"break mysql_parse\n" .
"commands 1\n" .
"disable 1\n" .
"end\n" .
"run");
}
if ( $opt_manual_gdb )
{
print "\nTo start gdb for $type, type in another window:\n";
print "cd $glob_mysql_test_dir;\n";
print "gdb -x $gdb_init_file $$exe\n";
# Indicate the exe should not be started
$$exe= undef;
return;
}
$$args= [];
mtr_add_arg($$args, "-title");
mtr_add_arg($$args, "$type");
mtr_add_arg($$args, "-e");
if ( $glob_use_libtool )
{
mtr_add_arg($$args, "libtool");
mtr_add_arg($$args, "--mode=execute");
}
mtr_add_arg($$args, "gdb");
mtr_add_arg($$args, "-x");
mtr_add_arg($$args, "$gdb_init_file");
mtr_add_arg($$args, "$$exe");
$$exe= "xterm";
}
#
# Modify the exe and args so that program is run in ddd
#
sub ddd_arguments {
my $args= shift;
my $exe= shift;
my $type= shift;
# Write $args to ddd init file
my $str= join(" ", @$$args);
my $gdb_init_file= "$opt_tmpdir/gdbinit.$type";
# Remove the old gdbinit file
unlink($gdb_init_file);
if ( $type eq "client" )
{
# write init file for client
mtr_tofile($gdb_init_file,
"set args $str\n" .
"break main\n");
}
else
{
# write init file for mysqld
mtr_tofile($gdb_init_file,
"file $$exe\n" .
"set args $str\n" .
"break mysql_parse\n" .
"commands 1\n" .
"disable 1\n" .
"end\n" .
"run");
}
if ( $opt_manual_ddd )
{
print "\nTo start ddd for $type, type in another window:\n";
print "cd $glob_mysql_test_dir;\n";
print "ddd -x $gdb_init_file $$exe\n";
# Indicate the exe should not be started
$$exe= undef;
return;
}
my $save_exe= $$exe;
$$args= [];
if ( $glob_use_libtool )
{
$$exe= "libtool";
mtr_add_arg($$args, "--mode=execute");
mtr_add_arg($$args, "ddd");
}
else
{
$$exe= "ddd";
}
mtr_add_arg($$args, "--command=$gdb_init_file");
mtr_add_arg($$args, "$save_exe");
}
#
# Modify the exe and args so that program is run in the selected debugger
#
sub debugger_arguments {
my $args= shift;
my $exe= shift;
my $debugger= $opt_debugger || $opt_client_debugger;
if ( $debugger eq "vcexpress" or $debugger eq "vc")
{
# vc[express] /debugexe exe arg1 .. argn
# Add /debugexe and name of the exe before args
unshift(@$$args, "/debugexe");
unshift(@$$args, "$$exe");
}
elsif ( $debugger eq "windbg" )
{
# windbg exe arg1 .. argn
# Add name of the exe before args
unshift(@$$args, "$$exe");
}
else
{
mtr_error("Unknown argument \"$debugger\" passed to --debugger");
}
# Set exe to debuggername
$$exe= $debugger;
}
#
# Modify the exe and args so that program is run in valgrind
#
sub valgrind_arguments {
my $args= shift;
my $exe= shift;
@ -3022,7 +3293,7 @@ sub valgrind_arguments {
mtr_add_arg($args, "--suppressions=%s/valgrind.supp", $glob_mysql_test_dir)
if -f "$glob_mysql_test_dir/valgrind.supp";
if ( defined $opt_valgrind_all )
if ( $opt_valgrind_all )
{
mtr_add_arg($args, "-v");
mtr_add_arg($args, "--show-reachable=yes");
@ -3030,14 +3301,13 @@ sub valgrind_arguments {
if ( $opt_valgrind_options )
{
# FIXME split earlier and put into @glob_valgrind_*
mtr_add_arg($args, split(' ', $opt_valgrind_options));
}
mtr_add_arg($args, $$exe);
$$exe= $opt_valgrind || "valgrind";
$$exe= $opt_valgrind_path || "valgrind";
}
@ -3068,6 +3338,13 @@ Options to control what engine/variation to run
bench Run the benchmark suite FIXME
small-bench FIXME
Options to control directories to use
vardir=DIR The directory where files generated from the test run
is stored(default: ./var). Specifying a ramdisk or tmpfs
will speed up tests.
tmpdir=DIR The directory where temporary files are stored
(default: ./var/tmp).
Options to control what test suites or cases to run
force Continue to run the suite after failure
@ -3103,10 +3380,14 @@ Options to run test on running server
Options for debugging the product
gdb FIXME
manual-gdb FIXME
client-gdb FIXME
ddd FIXME
gdb Start the mysqld(s) in gdb
manual-gdb Let user manually start mysqld in gdb, before running test(s)
manual-debug Let user manually start mysqld in debugger, before running test(s)
client-gdb Start mysqltest client in gdb
ddd Start mysqld in ddd
client-ddd Start mysqltest client in ddd
debugger=NAME Start mysqld in the selected debugger
client-debugger=NAME Start mysqltest in the selected debugger
strace-client FIXME
master-binary=PATH Specify the master "mysqld" to use
slave-binary=PATH Specify the slave "mysqld" to use
@ -3115,16 +3396,17 @@ Options for coverage, profiling etc
gcov FIXME
gprof FIXME
valgrind[=EXE] Run the "mysqld" server using valgrind, optionally
specifying the executable path/name
valgrind-mysqltest[=EXE] In addition, run the "mysqltest" executable with valgrind
valgrind-all[=EXE] Adds verbose flag, and --show-reachable to valgrind
valgrind Run the "mysqltest" and "mysqld" executables using valgrind
valgrind-all Same as "valgrind" but will also add "verbose" and "--show-reachable"
flags to valgrind
valgrind-mysqltest Run the "mysqltest" executable with valgrind
valgrind-mysqld Run the "mysqld" executable with valgrind
valgrind-options=ARGS Extra options to give valgrind
valgrind-path=[EXE] Path to the valgrind executable
Misc options
comment=STR Write STR to the output
verbose Verbose output from this script
script-debug Debug this script itself
timer Show test case execution time
start-and-exit Only initiate and start the "mysqld" servers, use the startup
@ -3152,7 +3434,6 @@ Options not yet described, or that I want to look into more
old-master
sleep=SECONDS
socket=PATH
tmpdir=DIR
user-test=s
wait-timeout=SECONDS
warnings

View file

@ -277,6 +277,7 @@ EXTRA_MYSQLSHOW_OPT=""
EXTRA_MYSQLBINLOG_OPT=""
USE_RUNNING_SERVER=0
USE_NDBCLUSTER=@USE_NDBCLUSTER@
USE_NDBCLUSTER_ONLY=0
USE_RUNNING_NDBCLUSTER=""
USE_PURIFY=""
PURIFY_LOGS=""
@ -315,6 +316,8 @@ STRESS_INIT_FILE=""
STRESS_TEST_FILE=""
STRESS_TEST=""
$ECHO "Logging: $0 $*" # To ensure we see all arguments in the output, for the test analysis tool
while test $# -gt 0; do
case "$1" in
--embedded-server)
@ -341,6 +344,10 @@ while test $# -gt 0; do
--extern) USE_RUNNING_SERVER=1 ;;
--with-ndbcluster)
USE_NDBCLUSTER="--ndbcluster" ;;
--with-ndbcluster-only)
USE_NDBCLUSTER="--ndbcluster"
USE_NDBCLUSTER_SLAVE="--ndbcluster"
USE_NDBCLUSTER_ONLY=1 ;;
--ndb-connectstring=*)
USE_NDBCLUSTER="--ndbcluster" ;
USE_RUNNING_NDBCLUSTER=`$ECHO "$1" | $SED -e "s;--ndb-connectstring=;;"` ;;
@ -1654,6 +1661,11 @@ run_testcase ()
result_file="r/$tname.result"
echo $tname > $CURRENT_TEST
SKIP_SLAVE=`$EXPR \( $tname : rpl \) = 0 \& \( $tname : federated \) = 0`
NDBCLUSTER_TEST=`$EXPR \( $tname : '.*ndb.*' \) != 0`
if [ "x$USE_NDBCLUSTER_ONLY" = "x1" -a "x$NDBCLUSTER_TEST" != "x1" ] ; then
skip_test $tname
return
fi
if [ "$USE_MANAGER" = 1 ] ; then
many_slaves=`$EXPR \( \( $tname : rpl_failsafe \) != 0 \) \| \( \( $tname : rpl_chain_temp_table \) != 0 \)`
fi

View file

@ -337,6 +337,17 @@ Warning 1105 Cast to signed converted positive out-of-range integer to it's nega
select cast(1.0e+300 as signed int);
cast(1.0e+300 as signed int)
9223372036854775807
CREATE TABLE t1 (f1 double);
INSERT INTO t1 SET f1 = -1.0e+30 ;
INSERT INTO t1 SET f1 = +1.0e+30 ;
SELECT f1 AS double_val, CAST(f1 AS SIGNED INT) AS cast_val FROM t1;
double_val cast_val
-1e+30 -9223372036854775808
1e+30 9223372036854775807
Warnings:
Warning 1292 Truncated incorrect INTEGER value: '-1e+30'
Warning 1292 Truncated incorrect INTEGER value: '1e+30'
DROP TABLE t1;
select cast('1.2' as decimal(3,2));
cast('1.2' as decimal(3,2))
1.20

View file

@ -746,6 +746,8 @@ t2 CREATE TABLE `t2` (
`a2` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2;
create table t1(a set("a,b","c,d") not null);
ERROR 22007: Illegal set 'a,b' value found during parsing
create table t1 (i int) engine=myisam max_rows=100000000000;
show create table t1;
Table Create Table

View file

@ -189,3 +189,6 @@ select hex(a) from t1 where a = _big5 0xF9DC;
hex(a)
E5ABBA
drop table t1;
select hex(convert(_big5 0xC84041 using ucs2));
hex(convert(_big5 0xC84041 using ucs2))
003F0041

View file

@ -15,3 +15,32 @@ SELECT HEX(f1) FROM t1;
HEX(f1)
8300
DROP table t1;
CREATE TABLE t4 (s1 CHAR(50) CHARACTER SET latin1,
s2 CHAR(50) CHARACTER SET cp932,
d DECIMAL(10,2))|
CREATE 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|
CALL bug18293("Foo's a Bar", _cp932 0xED40ED41ED42, 47.93)|
SELECT HEX(s1),HEX(s2),d FROM t4|
HEX(s1) HEX(s2) d
466F6F2773206120426172 ED40ED41ED42 47.93
DROP PROCEDURE bug18293|
DROP TABLE t4|
SHOW BINLOG EVENTS FROM 393|
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 393 Query 1 556 use `test`; CREATE TABLE t4 (s1 CHAR(50) CHARACTER SET latin1,
s2 CHAR(50) CHARACTER SET cp932,
d DECIMAL(10,2))
master-bin.000001 556 Query 1 801 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 801 Query 1 1006 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1'Foo\'s a Bar'), NAME_CONST('ins2',_cp932 0xED40ED41ED42), NAME_CONST('ind',47.93))
master-bin.000001 1006 Query 1 1092 use `test`; DROP PROCEDURE bug18293
master-bin.000001 1092 Query 1 1168 use `test`; DROP TABLE t4

View file

@ -9819,3 +9819,9 @@ eucjpms_bin 6109
eucjpms_bin 61
eucjpms_bin 6120
drop table t1;
select hex(convert(_eucjpms 0xA5FE41 using ucs2));
hex(convert(_eucjpms 0xA5FE41 using ucs2))
003F0041
select hex(convert(_eucjpms 0x8FABF841 using ucs2));
hex(convert(_eucjpms 0x8FABF841 using ucs2))
003F0041

View file

@ -165,3 +165,6 @@ hex(a)
A1A1
A3A0
DROP TABLE t1;
select hex(convert(_gbk 0xA14041 using ucs2));
hex(convert(_gbk 0xA14041 using ucs2))
003F0041

View file

@ -369,3 +369,25 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
SELECT '„a' as str;
str
„a
set @str= _latin1 'ABC €°§ß²³µ~ äöüÄÖÜ áéíóú ÀÈÌÒÙ @ abc';
SELECT convert(@str collate latin1_bin using utf8);
convert(@str collate latin1_bin using utf8)
ABC €°§ß²³µ~ äöüÄÖÜ áéíóú ÀÈÌÒÙ @ abc
SELECT convert(@str collate latin1_general_ci using utf8);
convert(@str collate latin1_general_ci using utf8)
ABC €°§ß²³µ~ äöüÄÖÜ áéíóú ÀÈÌÒÙ @ abc
SELECT convert(@str collate latin1_german1_ci using utf8);
convert(@str collate latin1_german1_ci using utf8)
ABC €°§ß²³µ~ äöüÄÖÜ áéíóú ÀÈÌÒÙ @ abc
SELECT convert(@str collate latin1_danish_ci using utf8);
convert(@str collate latin1_danish_ci using utf8)
ABC €°§ß²³µ~ äöüÄÖÜ áéíóú ÀÈÌÒÙ @ abc
SELECT convert(@str collate latin1_spanish_ci using utf8);
convert(@str collate latin1_spanish_ci using utf8)
ABC €°§ß²³µ~ äöüÄÖÜ áéíóú ÀÈÌÒÙ @ abc
SELECT convert(@str collate latin1_german2_ci using utf8);
convert(@str collate latin1_german2_ci using utf8)
ABC €°§ß²³µ~ äöüÄÖÜ áéíóú ÀÈÌÒÙ @ abc
SELECT convert(@str collate latin1_swedish_ci using utf8);
convert(@str collate latin1_swedish_ci using utf8)
ABC €°§ß²³µ~ äöüÄÖÜ áéíóú ÀÈÌÒÙ @ abc

View file

@ -0,0 +1,30 @@
drop table if exists t1;
set names latin2;
select 'A' = 'a' collate latin2_czech_cs;
'A' = 'a' collate latin2_czech_cs
0
create table t1 (
id int(5) not null,
tt char(255) not null
) character set latin2 collate latin2_czech_cs;
insert into t1 values (1,'Aa');
insert into t1 values (2,'Aas');
alter table t1 add primary key aaa(tt);
select * from t1 where tt like 'Aa%';
id tt
1 Aa
2 Aas
select * from t1 ignore index (primary) where tt like 'Aa%';
id tt
1 Aa
2 Aas
select * from t1 where tt like '%Aa%';
id tt
1 Aa
2 Aas
select * from t1 where tt like 'AA%';
id tt
select * from t1 ignore index (primary) where tt like 'AA%';
id tt
select * from t1 where tt like '%AA%';
id tt

View file

@ -674,6 +674,18 @@ Warnings:
Warning 1264 Out of range value adjusted for column 'Field1' at row 1
DROP TABLE t1;
SET NAMES latin1;
SELECT CONVERT(103, CHAR(50) UNICODE);
CONVERT(103, CHAR(50) UNICODE)
103
SELECT CONVERT(103.0, CHAR(50) UNICODE);
CONVERT(103.0, CHAR(50) UNICODE)
103.0
SELECT CONVERT(-103, CHAR(50) UNICODE);
CONVERT(-103, CHAR(50) UNICODE)
-103
SELECT CONVERT(-103.0, CHAR(50) UNICODE);
CONVERT(-103.0, CHAR(50) UNICODE)
-103.0
CREATE TABLE t1 (
a varchar(255) NOT NULL default '',
KEY a (a)
@ -719,3 +731,11 @@ lily
river
drop table t1;
deallocate prepare stmt;
create table t1(a blob, b text charset utf8, c text charset ucs2);
select data_type, character_octet_length, character_maximum_length
from information_schema.columns where table_name='t1';
data_type character_octet_length character_maximum_length
blob 65535 65535
text 65535 65535
text 65535 32767
drop table t1;

View file

@ -0,0 +1,6 @@
show variables like "%character_set_ser%";
Variable_name Value
character_set_server ucs2
DROP TABLE IF EXISTS t1;
create table t1 (a int);
drop table t1;

View file

@ -2307,6 +2307,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
select hex(convert(_ujis 0xA5FE41 using ucs2));
hex(convert(_ujis 0xA5FE41 using ucs2))
003F0041
select hex(convert(_ujis 0x8FABF841 using ucs2));
hex(convert(_ujis 0x8FABF841 using ucs2))
003F0041
DROP TABLE IF EXISTS t1, t2;
DROP PROCEDURE IF EXISTS sp1;
set names ujis;

View file

@ -1066,6 +1066,52 @@ LENGTH(bug)
100
DROP TABLE t2;
DROP TABLE t1;
SET NAMES utf8;
DROP TABLE IF EXISTS t1;
Warnings:
Note 1051 Unknown table 't1'
CREATE TABLE t1(a VARCHAR(255), KEY(a)) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
INSERT INTO t1 VALUES('uu');
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
INSERT INTO t1 VALUES('uU');
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
INSERT INTO t1 VALUES('uu');
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
INSERT INTO t1 VALUES('uuABC');
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
INSERT INTO t1 VALUES('UuABC');
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
INSERT INTO t1 VALUES('uuABC');
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
alter table t1 add b int;
INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',1);
INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',2);
delete from t1 where b=1;
INSERT INTO t1 VALUES('UUABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',1);
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',3);
INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',4);
delete from t1 where b=3;
INSERT INTO t1 VALUES('uUABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',3);
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
CREATE TABLE t1(id varchar(20) NOT NULL) DEFAULT CHARSET=utf8;
INSERT INTO t1 VALUES ('xxx'), ('aa'), ('yyy'), ('aa');
SELECT id FROM t1;

View file

@ -447,12 +447,12 @@ t1 CREATE TABLE `t1` (
DROP TABLE t1;
CREATE TABLE t1 (a TEXT, FULLTEXT KEY(a));
INSERT INTO t1 VALUES('test'),('test1'),('test');
PREPARE stmt from "SELECT a, MATCH(a) AGAINST('test1 test') FROM t1 WHERE MATCH(a) AGAINST('test1 test')";
PREPARE stmt from "SELECT a, FORMAT(MATCH(a) AGAINST('test1 test'),6) FROM t1 WHERE MATCH(a) AGAINST('test1 test')";
EXECUTE stmt;
a MATCH(a) AGAINST('test1 test')
test1 0.68526661396027
a FORMAT(MATCH(a) AGAINST('test1 test'),6)
test1 0.685267
EXECUTE stmt;
a MATCH(a) AGAINST('test1 test')
test1 0.68526661396027
a FORMAT(MATCH(a) AGAINST('test1 test'),6)
test1 0.685267
DEALLOCATE PREPARE stmt;
DROP TABLE t1;

View file

@ -596,6 +596,21 @@ GROUP_CONCAT(a ORDER BY a)
,x
,z
DROP TABLE t1;
create table t1(f1 int);
insert into t1 values(1),(2),(3);
select f1, group_concat(f1+1) from t1 group by f1 with rollup;
f1 group_concat(f1+1)
1 2
2 3
3 4
NULL 2,3,4
select count(distinct (f1+1)) from t1 group by f1 with rollup;
count(distinct (f1+1))
1
1
1
3
drop table t1;
set names latin1;
create table t1 (a char, b char);
insert into t1 values ('a', 'a'), ('a', 'b'), ('b', 'a'), ('b', 'b');
@ -611,3 +626,8 @@ latin1
latin1
drop table t1, t2, t3;
set names default;
create table t1 (c1 varchar(10), c2 int);
select charset(group_concat(c1 order by c2)) from t1;
charset(group_concat(c1 order by c2))
latin1
drop table t1;

View file

@ -35,3 +35,14 @@ select -1 >> 0, -1 << 0;
select -1 >> 1, -1 << 1;
-1 >> 1 -1 << 1
9223372036854775807 18446744073709551614
drop table if exists t1,t2;
create table t1(a int);
create table t2(a int, b int);
insert into t1 values (1), (2), (3);
insert into t2 values (1, 7), (3, 7);
select t1.a, t2.a, t2.b, bit_count(t2.b) from t1 left join t2 on t1.a=t2.a;
a a b bit_count(t2.b)
1 1 7 3
2 NULL NULL NULL
3 3 7 3
drop table t1, t2;

View file

@ -360,6 +360,42 @@ extract(SECOND FROM "1999-01-02 10:11:12")
select extract(MONTH FROM "2001-02-00");
extract(MONTH FROM "2001-02-00")
2
SELECT EXTRACT(QUARTER FROM '2004-01-15') AS quarter;
quarter
1
SELECT EXTRACT(QUARTER FROM '2004-02-15') AS quarter;
quarter
1
SELECT EXTRACT(QUARTER FROM '2004-03-15') AS quarter;
quarter
1
SELECT EXTRACT(QUARTER FROM '2004-04-15') AS quarter;
quarter
2
SELECT EXTRACT(QUARTER FROM '2004-05-15') AS quarter;
quarter
2
SELECT EXTRACT(QUARTER FROM '2004-06-15') AS quarter;
quarter
2
SELECT EXTRACT(QUARTER FROM '2004-07-15') AS quarter;
quarter
3
SELECT EXTRACT(QUARTER FROM '2004-08-15') AS quarter;
quarter
3
SELECT EXTRACT(QUARTER FROM '2004-09-15') AS quarter;
quarter
3
SELECT EXTRACT(QUARTER FROM '2004-10-15') AS quarter;
quarter
4
SELECT EXTRACT(QUARTER FROM '2004-11-15') AS quarter;
quarter
4
SELECT EXTRACT(QUARTER FROM '2004-12-15') AS quarter;
quarter
4
SELECT "1900-01-01 00:00:00" + INTERVAL 2147483648 SECOND;
"1900-01-01 00:00:00" + INTERVAL 2147483648 SECOND
1968-01-20 03:14:08
@ -811,3 +847,28 @@ timestampdiff(year,'2004-02-28','2005-02-28')
select timestampdiff(year,'2004-02-29','2005-02-28');
timestampdiff(year,'2004-02-29','2005-02-28')
0
CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, day date);
CREATE TABLE t2 (id int NOT NULL PRIMARY KEY, day date);
INSERT INTO t1 VALUES
(1, '2005-06-01'), (2, '2005-02-01'), (3, '2005-07-01');
INSERT INTO t2 VALUES
(1, '2005-08-01'), (2, '2005-06-15'), (3, '2005-07-15');
SELECT * FROM t1, t2
WHERE t1.day BETWEEN
'2005.09.01' - INTERVAL 6 MONTH AND t2.day;
id day id day
1 2005-06-01 1 2005-08-01
3 2005-07-01 1 2005-08-01
1 2005-06-01 2 2005-06-15
1 2005-06-01 3 2005-07-15
3 2005-07-01 3 2005-07-15
SELECT * FROM t1, t2
WHERE CAST(t1.day AS DATE) BETWEEN
'2005.09.01' - INTERVAL 6 MONTH AND t2.day;
id day id day
1 2005-06-01 1 2005-08-01
3 2005-07-01 1 2005-08-01
1 2005-06-01 2 2005-06-15
1 2005-06-01 3 2005-07-15
3 2005-07-01 3 2005-07-15
DROP TABLE t1,t2;

View file

@ -1954,6 +1954,15 @@ id select_type table type possible_keys key key_len ref rows Extra
explain select sum(ord(a1)) from t1 where (a1 > 'a') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 163 NULL 128 Using where; Using index
explain select distinct(a1) from t1 where ord(a2) = 98;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL idx_t1_1 163 NULL 128 Using where; Using index
select distinct(a1) from t1 where ord(a2) = 98;
a1
a
b
c
d
explain select a1 from t1 where a2 = 'b' group by a1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range NULL idx_t1_1 130 NULL 5 Using where; Using index for group-by
@ -2070,3 +2079,40 @@ SELECT a FROM t1 WHERE a LIKE 'B%' GROUP BY a;
a
BB
DROP TABLE t1;
CREATE TABLE t1 (
a int(11) NOT NULL DEFAULT '0',
b varchar(16) COLLATE latin1_general_ci NOT NULL DEFAULT '',
PRIMARY KEY (a,b)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
CREATE PROCEDURE a(x INT)
BEGIN
DECLARE rnd INT;
DECLARE cnt INT;
WHILE x > 0 DO
SET rnd= x % 100;
SET cnt = (SELECT COUNT(*) FROM t1 WHERE a = rnd);
INSERT INTO t1(a,b) VALUES (rnd, CAST(cnt AS CHAR));
SET x= x - 1;
END WHILE;
END|
CALL a(1000);
SELECT a FROM t1 WHERE a=0;
a
0
0
0
0
0
0
0
0
0
0
SELECT DISTINCT a FROM t1 WHERE a=0;
a
0
SELECT COUNT(DISTINCT a) FROM t1 WHERE a=0;
COUNT(DISTINCT a)
1
DROP TABLE t1;
DROP PROCEDURE a;

View file

@ -0,0 +1,2 @@
Collation Charset Id Default Compiled Sortlen
latin2_czech_cs latin2 2 Yes 4

View file

@ -0,0 +1 @@
CREATE FUNCTION metaphon RETURNS STRING SONAME 'udf_example.so';

View file

@ -12,7 +12,7 @@ explain extended select count(a) as b from t1 where a=0 having b >=0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
Note 1003 select count(`test`.`t1`.`a`) AS `b` from `test`.`t1` where (`test`.`t1`.`a` = 0) having (count(`test`.`t1`.`a`) >= 0)
Note 1003 select count(`test`.`t1`.`a`) AS `b` from `test`.`t1` where 0 having (count(`test`.`t1`.`a`) >= 0)
drop table t1;
CREATE TABLE t1 (
raw_id int(10) NOT NULL default '0',
@ -359,3 +359,36 @@ group by s1 collate latin1_swedish_ci having s1 = 'y';
s1 count(s1)
y 1
drop table t1;
DROP SCHEMA IF EXISTS HU;
CREATE SCHEMA HU ;
USE HU ;
CREATE TABLE STAFF
(EMPNUM CHAR(3) NOT NULL UNIQUE,
EMPNAME CHAR(20),
GRADE DECIMAL(4),
CITY CHAR(15));
CREATE TABLE PROJ
(PNUM CHAR(3) NOT NULL UNIQUE,
PNAME CHAR(20),
PTYPE CHAR(6),
BUDGET DECIMAL(9),
CITY CHAR(15));
INSERT INTO STAFF VALUES ('E1','Alice',12,'Deale');
INSERT INTO STAFF VALUES ('E2','Betty',10,'Vienna');
INSERT INTO STAFF VALUES ('E3','Carmen',13,'Vienna');
INSERT INTO STAFF VALUES ('E4','Don',12,'Deale');
INSERT INTO STAFF VALUES ('E5','Ed',13,'Akron');
INSERT INTO PROJ VALUES ('P1','MXSS','Design',10000,'Deale');
INSERT INTO PROJ VALUES ('P2','CALM','Code',30000,'Vienna');
INSERT INTO PROJ VALUES ('P3','SDP','Test',30000,'Tampa');
INSERT INTO PROJ VALUES ('P4','SDP','Design',20000,'Deale');
INSERT INTO PROJ VALUES ('P5','IRM','Test',10000,'Vienna');
INSERT INTO PROJ VALUES ('P6','PAYR','Design',50000,'Deale');
SELECT EMPNUM, GRADE*1000
FROM HU.STAFF WHERE GRADE * 1000 >
ANY (SELECT SUM(BUDGET) FROM HU.PROJ
GROUP BY CITY, PTYPE
HAVING HU.PROJ.CITY = HU.STAFF.CITY);
EMPNUM GRADE*1000
E3 13000
DROP SCHEMA HU;

View file

@ -260,3 +260,25 @@ t_vers t_rele t_cust filler1
7.6 a
7.6 a
drop table t1;
create table t1 (
pk int(11) not null auto_increment,
a int(11) not null default '0',
b int(11) not null default '0',
c int(11) not null default '0',
filler1 datetime, filler2 varchar(15),
filler3 longtext,
kp1 varchar(4), kp2 varchar(7),
kp3 varchar(2), kp4 varchar(4),
kp5 varchar(7),
filler4 char(1),
primary key (pk),
key idx1(a,b,c),
key idx2(c),
key idx3(kp1,kp2,kp3,kp4,kp5)
) engine=innodb default charset=latin1;
set @fill=NULL;
SELECT COUNT(*) FROM t1 WHERE b = 0 AND a = 0 AND c = 13286427 AND
kp1='279' AND kp2='ELM0678' AND kp3='6' AND kp4='10' AND kp5 = 'R ';
COUNT(*)
1
drop table t1;

View file

@ -201,34 +201,34 @@ latin1 cp1252 West European latin1_swedish_ci 1
select * from information_schema.COLLATIONS
where COLLATION_NAME like 'latin1%';
COLLATION_NAME CHARACTER_SET_NAME ID IS_DEFAULT IS_COMPILED SORTLEN
latin1_german1_ci latin1 5 0
latin1_swedish_ci latin1 8 Yes Yes 1
latin1_danish_ci latin1 15 0
latin1_german2_ci latin1 31 Yes 2
latin1_bin latin1 47 Yes 1
latin1_general_ci latin1 48 0
latin1_general_cs latin1 49 0
latin1_spanish_ci latin1 94 0
latin1_german1_ci latin1 5 # 1
latin1_swedish_ci latin1 8 Yes # 1
latin1_danish_ci latin1 15 # 1
latin1_german2_ci latin1 31 # 2
latin1_bin latin1 47 # 1
latin1_general_ci latin1 48 # 1
latin1_general_cs latin1 49 # 1
latin1_spanish_ci latin1 94 # 1
SHOW COLLATION LIKE 'latin1%';
Collation Charset Id Default Compiled Sortlen
latin1_german1_ci latin1 5 0
latin1_swedish_ci latin1 8 Yes Yes 1
latin1_danish_ci latin1 15 0
latin1_german2_ci latin1 31 Yes 2
latin1_bin latin1 47 Yes 1
latin1_general_ci latin1 48 0
latin1_general_cs latin1 49 0
latin1_spanish_ci latin1 94 0
latin1_german1_ci latin1 5 # 1
latin1_swedish_ci latin1 8 Yes # 1
latin1_danish_ci latin1 15 # 1
latin1_german2_ci latin1 31 # 2
latin1_bin latin1 47 # 1
latin1_general_ci latin1 48 # 1
latin1_general_cs latin1 49 # 1
latin1_spanish_ci latin1 94 # 1
SHOW COLLATION WHERE collation like 'latin1%';
Collation Charset Id Default Compiled Sortlen
latin1_german1_ci latin1 5 0
latin1_swedish_ci latin1 8 Yes Yes 1
latin1_danish_ci latin1 15 0
latin1_german2_ci latin1 31 Yes 2
latin1_bin latin1 47 Yes 1
latin1_general_ci latin1 48 0
latin1_general_cs latin1 49 0
latin1_spanish_ci latin1 94 0
latin1_german1_ci latin1 5 # 1
latin1_swedish_ci latin1 8 Yes # 1
latin1_danish_ci latin1 15 # 1
latin1_german2_ci latin1 31 # 2
latin1_bin latin1 47 # 1
latin1_general_ci latin1 48 # 1
latin1_general_cs latin1 49 # 1
latin1_spanish_ci latin1 94 # 1
select * from information_schema.COLLATION_CHARACTER_SET_APPLICABILITY
where COLLATION_NAME like 'latin1%';
COLLATION_NAME CHARACTER_SET_NAME
@ -281,6 +281,13 @@ sub1 sub1
select count(*) from information_schema.ROUTINES;
count(*)
2
create view v1 as select routine_schema, routine_name from information_schema.routines
order by routine_schema, routine_name;
select * from v1;
routine_schema routine_name
test sel2
test sub1
drop view v1;
select ROUTINE_NAME, ROUTINE_DEFINITION from information_schema.ROUTINES;
ROUTINE_NAME ROUTINE_DEFINITION
show create function sub1;
@ -1034,14 +1041,6 @@ select 1 from (select 1 from test.t1) a;
1
use test;
drop table t1;
create table t1(a blob, b text charset utf8, c text charset ucs2);
select data_type, character_octet_length, character_maximum_length
from information_schema.columns where table_name='t1';
data_type character_octet_length character_maximum_length
blob 65535 65535
text 65535 65535
text 65535 32767
drop table t1;
create table t1 (f1 int(11));
create view v1 as select * from t1;
drop table t1;

View file

@ -27,4 +27,18 @@ create database `inf%`;
use `inf%`;
show tables;
Tables_in_inf%
grant all privileges on `inf%`.* to 'mysqltest_1'@'localhost';
create table t1 (f1 int);
create function func1(curr_int int) returns int
begin
declare ret_val int;
select max(f1) from t1 into ret_val;
return ret_val;
end|
create view v1 as select f1 from t1 where f1 = func1(f1);
select * from information_schema.tables;
drop user mysqltest_1@localhost;
drop view v1;
drop function func1;
drop table t1;
drop database `inf%`;

View file

@ -1821,7 +1821,7 @@ Variable_name Value
innodb_sync_spin_loops 20
show variables like "innodb_thread_concurrency";
Variable_name Value
innodb_thread_concurrency 0
innodb_thread_concurrency 8
set global innodb_thread_concurrency=1001;
show variables like "innodb_thread_concurrency";
Variable_name Value
@ -3232,3 +3232,47 @@ drop trigger t2t;
drop trigger t3t;
drop trigger t4t;
drop table t1, t2, t3, t4, t5;
create table t1(a date) engine=innodb;
create table t2(a date, key(a)) engine=innodb;
insert into t1 values('2005-10-01');
insert into t2 values('2005-10-01');
select * from t1, t2
where t2.a between t1.a - interval 2 day and t1.a + interval 2 day;
a a
2005-10-01 2005-10-01
drop table t1, t2;
CREATE TABLE t1 (
a BIGINT(20) NOT NULL,
PRIMARY KEY (a)
) ENGINE=INNODB DEFAULT CHARSET=UTF8;
CREATE TABLE t2 (
a BIGINT(20) NOT NULL,
b VARCHAR(128) NOT NULL,
c TEXT NOT NULL,
PRIMARY KEY (a,b),
KEY idx_t2_b_c (b,c(200)),
CONSTRAINT t_fk FOREIGN KEY (a) REFERENCES t1 (a)
ON DELETE CASCADE
) ENGINE=INNODB DEFAULT CHARSET=UTF8;
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (1, 'bar', 'vbar');
INSERT INTO t2 VALUES (1, 'BAR2', 'VBAR');
INSERT INTO t2 VALUES (1, 'bar_bar', 'bibi');
INSERT INTO t2 VALUES (1, 'customer_over', '1');
SELECT * FROM t2 WHERE b = 'customer_over';
a b c
1 customer_over 1
SELECT * FROM t2 WHERE BINARY b = 'customer_over';
a b c
1 customer_over 1
SELECT DISTINCT p0.a FROM t2 p0 WHERE p0.b = 'customer_over';
a
1
/* Bang: Empty result set, above was expected: */
SELECT DISTINCT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over';
a
1
SELECT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over';
a
1
drop table t2, t1;

View file

@ -299,3 +299,9 @@ select count(*) from t2;
count(*)
25500
drop table t1,t2,t3;
create table t1 (n int);
create view v1 as select * from t1;
insert delayed into v1 values (1);
ERROR HY000: 'test.v1' is not BASE TABLE
drop table t1;
drop view v1;

View file

@ -1504,3 +1504,61 @@ id type cid id pid pid type
1 A NULL NULL NULL NULL NULL
DROP VIEW v1;
DROP TABLE t1,t2,t3;
CREATE TABLE t1 (id1 int PRIMARY KEY, id2 int);
CREATE TABLE t2 (id1 int PRIMARY KEY, id2 int);
CREATE TABLE t3 (id1 int PRIMARY KEY, id2 int);
CREATE TABLE t4 (id1 int PRIMARY KEY, id2 int);
CREATE TABLE t5 (id1 int PRIMARY KEY, id2 int);
SELECT t1.id1 AS id, t5.id1 AS ngroupbynsa
FROM t1 INNER JOIN t2 ON t2.id2 = t1.id1
LEFT OUTER JOIN
(t3 INNER JOIN t4 ON t4.id1 = t3.id2 INNER JOIN t5 ON t4.id2 = t5.id1)
ON t3.id2 IS NOT NULL
WHERE t1.id1=2;
id ngroupbynsa
PREPARE stmt FROM
"SELECT t1.id1 AS id, t5.id1 AS ngroupbynsa
FROM t1 INNER JOIN t2 ON t2.id2 = t1.id1
LEFT OUTER JOIN
(t3 INNER JOIN t4 ON t4.id1 = t3.id2 INNER JOIN t5 ON t4.id2 = t5.id1)
ON t3.id2 IS NOT NULL
WHERE t1.id1=2";
EXECUTE stmt;
id ngroupbynsa
EXECUTE stmt;
id ngroupbynsa
EXECUTE stmt;
id ngroupbynsa
EXECUTE stmt;
id ngroupbynsa
INSERT INTO t1 VALUES (1,1), (2,1), (3,2);
INSERT INTO t2 VALUES (2,1), (3,2), (4,3);
INSERT INTO t3 VALUES (1,1), (3,2), (2,NULL);
INSERT INTO t4 VALUES (1,1), (2,1), (3,3);
INSERT INTO t5 VALUES (1,1), (2,2), (3,3), (4,3);
EXECUTE stmt;
id ngroupbynsa
2 1
2 1
EXECUTE stmt;
id ngroupbynsa
2 1
2 1
EXECUTE stmt;
id ngroupbynsa
2 1
2 1
EXECUTE stmt;
id ngroupbynsa
2 1
2 1
SELECT t1.id1 AS id, t5.id1 AS ngroupbynsa
FROM t1 INNER JOIN t2 ON t2.id2 = t1.id1
LEFT OUTER JOIN
(t3 INNER JOIN t4 ON t4.id1 = t3.id2 INNER JOIN t5 ON t4.id2 = t5.id1)
ON t3.id2 IS NOT NULL
WHERE t1.id1=2;
id ngroupbynsa
2 1
2 1
DROP TABLE t1,t2,t3,t4,t5;

View file

@ -1135,3 +1135,22 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 4 Using where
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1
DROP TABLE t1,t2;
CREATE TABLE t1 (id int(11) NOT NULL PRIMARY KEY, name varchar(20),
INDEX (name)) ENGINE=InnoDB;
CREATE TABLE t2 (id int(11) NOT NULL PRIMARY KEY, fkey int(11),
FOREIGN KEY (fkey) REFERENCES t2(id)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,'A1'),(2,'A2'),(3,'B');
INSERT INTO t2 VALUES (1,1),(2,2),(3,2),(4,3),(5,3);
EXPLAIN
SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id
WHERE t1.name LIKE 'A%';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index PRIMARY,name name 23 NULL 3 Using where; Using index
1 SIMPLE t2 ref fkey fkey 5 test.t1.id 1 Using where; Using index
EXPLAIN
SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id
WHERE t1.name LIKE 'A%' OR FALSE;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index PRIMARY,name name 23 NULL 3 Using where; Using index
1 SIMPLE t2 ref fkey fkey 5 test.t1.id 1 Using where; Using index
DROP TABLE t1,t2;

View file

@ -47,6 +47,17 @@ unlock tables;
lock tables t1 write, t1 as t1_alias read;
insert into t1 select index1,nr from t1 as t1_alias;
drop table t1,t2;
create table t1 (c1 int);
create table t2 (c1 int);
create table t3 (c1 int);
lock tables t1 write, t2 write, t3 write;
drop table t2, t3, t1;
create table t1 (c1 int);
create table t2 (c1 int);
create table t3 (c1 int);
lock tables t1 write, t2 write, t3 write, t1 as t4 read;
alter table t2 add column c2 int;
drop table t1, t2, t3;
create table t1 ( a int(11) not null auto_increment, primary key(a));
create table t2 ( a int(11) not null auto_increment, primary key(a));
lock tables t1 write, t2 read;

View file

@ -74,5 +74,26 @@ c_cp932
+----------------------+------------+--------+
| >a < | b | 123421 |
| >a < | 0123456789 | 4 |
| >abcd< | | 4 |
| >abcd< | NULL | 4 |
+----------------------+------------+--------+
+------+------+---------------------------+
| i | j | k |
+------+------+---------------------------+
| 1 | NULL | NULL |
| NULL | NULL | <-----------------------> |
| NULL | NULL | <----- |
| NULL | NULL | Τη γλώσσα |
| NULL | NULL | ᛖᚴ ᚷᛖᛏ |
+------+------+---------------------------+
+------+---+------+
| i | j | k |
+------+---+------+
| NULL | 1 | NULL |
+------+---+------+
+-------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| i | int(11) | YES | | NULL | |
| j | int(11) | NO | | NULL | |
| k | int(11) | YES | | NULL | |
+-------+---------+------+-----+---------+-------+

View file

@ -0,0 +1,42 @@
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
a INT NOT NULL PRIMARY KEY,
b INT NOT NULL
) ENGINE=ndbcluster;
BEGIN;
INSERT INTO t1 VALUES (9410,9412);
BEGIN;
INSERT INTO t1 VALUES (9411,9412);
BEGIN;
INSERT INTO t1 VALUES (9412,9412);
BEGIN;
INSERT INTO t1 VALUES (9413,9412);
BEGIN;
INSERT INTO t1 VALUES (9414,9412);
BEGIN;
INSERT INTO t1 VALUES (9415,9412);
ROLLBACK;
ROLLBACK;
ROLLBACK;
ROLLBACK;
ROLLBACK;
ROLLBACK;
drop table t1;
CREATE TABLE t1 (
a INT NOT NULL PRIMARY KEY,
b INT NOT NULL,
c INT NOT NULL
) ENGINE=ndbcluster;
select * from t1;
ERROR HY000: Got error 241 'Invalid schema object version' from ndbcluster
select * from t1;
a b c
select * from t1;
a b c
select * from t1;
a b c
select * from t1;
a b c
select * from t1;
a b c
drop table t1;

View file

@ -1766,5 +1766,21 @@ select * from t3 left join t4 on t4.attr2 = t3.attr2 where t4.attr1 > 1 and t4.a
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
1 SIMPLE t4 ALL NULL NULL NULL NULL 6 Using where
create table t5 (a int primary key auto_increment, b tinytext not null)
engine = ndb;
insert into t5 (b) values ('jonas'), ('jensing'), ('johan');
set engine_condition_pushdown = off;
select * from t5 where b like '%jo%' order by a;
a b
1 jonas
3 johan
set engine_condition_pushdown = on;
explain select * from t5 where b like '%jo%';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t5 ALL NULL NULL NULL NULL 3 Using where
select * from t5 where b like '%jo%' order by a;
a b
1 jonas
3 johan
set engine_condition_pushdown = @old_ecpd;
DROP TABLE t1,t2,t3,t4;
DROP TABLE t1,t2,t3,t4,t5;

View file

@ -577,6 +577,25 @@ pk1 b c
2 2 17
4 4 3
6 6 3
DELETE FROM t1;
CREATE UNIQUE INDEX bi ON t1(b);
INSERT INTO t1 VALUES
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
INSERT INTO t1 VALUES(0,1,0),(21,21,21) ON DUPLICATE KEY UPDATE pk1=b+10,b=b+10;
select * from t1 order by pk1;
pk1 b c
2 2 2
3 3 3
4 4 4
5 5 5
6 6 6
7 7 7
8 8 8
9 9 9
10 10 10
11 11 1
21 21 21
DROP TABLE t1;
CREATE TABLE t1(a INT) ENGINE=ndb;
INSERT IGNORE INTO t1 VALUES (1);
@ -586,7 +605,7 @@ INSERT IGNORE INTO t1 SELECT a FROM t1;
INSERT IGNORE INTO t1 SELECT a FROM t1;
INSERT IGNORE INTO t1 VALUES (1);
INSERT IGNORE INTO t1 VALUES (1);
SELECT * FROM t1;
SELECT * FROM t1 ORDER BY a;
a
1
1
@ -606,4 +625,27 @@ a
1
1
1
DELETE FROM t1;
CREATE UNIQUE INDEX ai ON t1(a);
INSERT IGNORE INTO t1 VALUES (1);
INSERT IGNORE INTO t1 VALUES (1);
INSERT IGNORE INTO t1 VALUES (NULL),(2);
SELECT * FROM t1 ORDER BY a;
a
NULL
1
2
DROP TABLE t1;
CREATE TABLE t1(pk INT NOT NULL PRIMARY KEY, a INT, UNIQUE (a)) ENGINE=ndb;
INSERT IGNORE INTO t1 VALUES (1,1),(2,2),(3,3);
INSERT IGNORE INTO t1 VALUES (4,NULL),(5,NULL),(6,NULL),(7,4);
SELECT * FROM t1 ORDER BY pk;
pk a
1 1
2 2
3 3
4 NULL
5 NULL
6 NULL
7 4
DROP TABLE t1;

View file

@ -263,3 +263,107 @@ a b c d
10 10 10 10
drop table t2;
drop table t1;
CREATE TABLE t1 (
a int(11) NOT NULL,
b int(11) NOT NULL,
c datetime default NULL,
PRIMARY KEY (a),
KEY idx_bc (b,c)
) ENGINE=ndbcluster;
INSERT INTO t1 VALUES
(406989,67,'2006-02-23 17:08:46'), (150078,67,'2005-10-26 11:17:45'),
(406993,67,'2006-02-27 11:20:57'), (245655,67,'2005-12-08 15:59:08'),
(406994,67,'2006-02-27 11:26:46'), (256,67,NULL),
(398341,67,'2006-02-20 04:48:44'), (254,67,NULL),(1120,67,NULL),
(406988,67,'2006-02-23 17:07:22'), (255,67,NULL),
(398340,67,'2006-02-20 04:38:53'),(406631,67,'2006-02-23 10:49:42'),
(245653,67,'2005-12-08 15:59:07'),(406992,67,'2006-02-24 16:47:18'),
(245654,67,'2005-12-08 15:59:08'),(406995,67,'2006-02-28 11:55:00'),
(127261,67,'2005-10-13 12:17:58'),(406991,67,'2006-02-24 16:42:32'),
(245652,67,'2005-12-08 15:58:27'),(398545,67,'2006-02-20 04:53:13'),
(154504,67,'2005-10-28 11:53:01'),(9199,67,NULL),(1,67,'2006-02-23 15:01:35'),
(223456,67,NULL),(4101,67,NULL),(1133,67,NULL),
(406990,67,'2006-02-23 18:01:45'),(148815,67,'2005-10-25 15:34:17'),
(148812,67,'2005-10-25 15:30:01'),(245651,67,'2005-12-08 15:58:27'),
(154503,67,'2005-10-28 11:52:38');
create table t11 select * from t1 where b = 67 AND (c IS NULL OR c > NOW()) order by 3 asc;
create table t12 select * from t1 where b = 67 AND (c IS NULL OR c > NOW()) order by 3 desc;
create table t21 select * from t1 where b = 67 AND (c IS NULL OR c > '2005-12-08') order by 3 asc;
create table t22 select * from t1 where b = 67 AND (c IS NULL OR c > '2005-12-08') order by 3 desc;
select * from t11 order by 1,2,3;
a b c
254 67 NULL
255 67 NULL
256 67 NULL
1120 67 NULL
1133 67 NULL
4101 67 NULL
9199 67 NULL
223456 67 NULL
select * from t12 order by 1,2,3;
a b c
254 67 NULL
255 67 NULL
256 67 NULL
1120 67 NULL
1133 67 NULL
4101 67 NULL
9199 67 NULL
223456 67 NULL
select * from t21 order by 1,2,3;
a b c
1 67 2006-02-23 15:01:35
254 67 NULL
255 67 NULL
256 67 NULL
1120 67 NULL
1133 67 NULL
4101 67 NULL
9199 67 NULL
223456 67 NULL
245651 67 2005-12-08 15:58:27
245652 67 2005-12-08 15:58:27
245653 67 2005-12-08 15:59:07
245654 67 2005-12-08 15:59:08
245655 67 2005-12-08 15:59:08
398340 67 2006-02-20 04:38:53
398341 67 2006-02-20 04:48:44
398545 67 2006-02-20 04:53:13
406631 67 2006-02-23 10:49:42
406988 67 2006-02-23 17:07:22
406989 67 2006-02-23 17:08:46
406990 67 2006-02-23 18:01:45
406991 67 2006-02-24 16:42:32
406992 67 2006-02-24 16:47:18
406993 67 2006-02-27 11:20:57
406994 67 2006-02-27 11:26:46
406995 67 2006-02-28 11:55:00
select * from t22 order by 1,2,3;
a b c
1 67 2006-02-23 15:01:35
254 67 NULL
255 67 NULL
256 67 NULL
1120 67 NULL
1133 67 NULL
4101 67 NULL
9199 67 NULL
223456 67 NULL
245651 67 2005-12-08 15:58:27
245652 67 2005-12-08 15:58:27
245653 67 2005-12-08 15:59:07
245654 67 2005-12-08 15:59:08
245655 67 2005-12-08 15:59:08
398340 67 2006-02-20 04:38:53
398341 67 2006-02-20 04:48:44
398545 67 2006-02-20 04:53:13
406631 67 2006-02-23 10:49:42
406988 67 2006-02-23 17:07:22
406989 67 2006-02-23 17:08:46
406990 67 2006-02-23 18:01:45
406991 67 2006-02-24 16:42:32
406992 67 2006-02-24 16:47:18
406993 67 2006-02-27 11:20:57
406994 67 2006-02-27 11:26:46
406995 67 2006-02-28 11:55:00
DROP TABLE t1, t11, t12, t21, t22;

View file

@ -19,3 +19,15 @@ gesuchnr benutzer_id
2 1
3 2
drop table t1;
CREATE TABLE t1(i INT PRIMARY KEY AUTO_INCREMENT,
j INT,
k INT,
UNIQUE INDEX(j)
) ENGINE = ndb;
INSERT INTO t1 VALUES (1,1,23),(2,2,24);
REPLACE INTO t1 (j,k) VALUES (1,42);
REPLACE INTO t1 (i,j) VALUES (17,2);
SELECT * from t1 ORDER BY i;
i j k
3 1 42
17 2 24

View file

@ -108,6 +108,9 @@ set @fvar= 123.4567;
prepare stmt1 from @fvar;
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 '123.4567' at line 1
drop table t1,t2;
deallocate prepare stmt3;
deallocate prepare stmt4;
deallocate prepare stmt5;
PREPARE stmt1 FROM "select _utf8 'A' collate utf8_bin = ?";
set @var='A';
EXECUTE stmt1 USING @var;
@ -253,6 +256,7 @@ set names latin1;
execute `ü`;
1234
1234
deallocate prepare `ü`;
set names default;
create table t1 (a varchar(10)) charset=utf8;
insert into t1 (a) values ('yahoo');
@ -781,6 +785,7 @@ EXECUTE b12651;
1
DROP VIEW b12651_V1;
DROP TABLE b12651_T1, b12651_T2;
DEALLOCATE PREPARE b12651;
prepare stmt from "select @@time_zone";
execute stmt;
@@time_zone
@ -873,6 +878,130 @@ length(a)
10
drop table t1;
deallocate prepare stmt;
create table t1 (col1 integer, col2 integer);
insert into t1 values(100,100),(101,101),(102,102),(103,103);
prepare stmt from 'select col1, col2 from t1 where (col1, col2) in ((?,?))';
set @a=100, @b=100;
execute stmt using @a,@b;
col1 col2
100 100
set @a=101, @b=101;
execute stmt using @a,@b;
col1 col2
101 101
set @a=102, @b=102;
execute stmt using @a,@b;
col1 col2
102 102
set @a=102, @b=103;
execute stmt using @a,@b;
col1 col2
deallocate prepare stmt;
drop table t1;
set @old_max_prepared_stmt_count= @@max_prepared_stmt_count;
show variables like 'max_prepared_stmt_count';
Variable_name Value
max_prepared_stmt_count 16382
show variables like 'prepared_stmt_count';
Variable_name Value
prepared_stmt_count 0
select @@max_prepared_stmt_count, @@prepared_stmt_count;
@@max_prepared_stmt_count @@prepared_stmt_count
16382 0
set global max_prepared_stmt_count=-1;
select @@max_prepared_stmt_count;
@@max_prepared_stmt_count
0
set global max_prepared_stmt_count=10000000000000000;
select @@max_prepared_stmt_count;
@@max_prepared_stmt_count
1048576
set global max_prepared_stmt_count=default;
select @@max_prepared_stmt_count;
@@max_prepared_stmt_count
16382
set @@max_prepared_stmt_count=1;
ERROR HY000: Variable 'max_prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL
set max_prepared_stmt_count=1;
ERROR HY000: Variable 'max_prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL
set local max_prepared_stmt_count=1;
ERROR HY000: Variable 'max_prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL
set local prepared_stmt_count=0;
ERROR HY000: Variable 'prepared_stmt_count' is a read only variable
set @@prepared_stmt_count=0;
ERROR HY000: Variable 'prepared_stmt_count' is a read only variable
set global prepared_stmt_count=1;
ERROR HY000: Variable 'prepared_stmt_count' is a read only variable
set global max_prepared_stmt_count=1;
select @@max_prepared_stmt_count;
@@max_prepared_stmt_count
1
set global max_prepared_stmt_count=0;
select @@max_prepared_stmt_count, @@prepared_stmt_count;
@@max_prepared_stmt_count @@prepared_stmt_count
0 0
prepare stmt from "select 1";
ERROR 42000: Can't create more than max_prepared_stmt_count statements (current value: 0)
select @@prepared_stmt_count;
@@prepared_stmt_count
0
set global max_prepared_stmt_count=1;
prepare stmt from "select 1";
select @@prepared_stmt_count;
@@prepared_stmt_count
1
prepare stmt1 from "select 1";
ERROR 42000: Can't create more than max_prepared_stmt_count statements (current value: 1)
select @@prepared_stmt_count;
@@prepared_stmt_count
1
deallocate prepare stmt;
select @@prepared_stmt_count;
@@prepared_stmt_count
0
prepare stmt from "select 1";
select @@prepared_stmt_count;
@@prepared_stmt_count
1
prepare stmt from "select 2";
select @@prepared_stmt_count;
@@prepared_stmt_count
1
select @@prepared_stmt_count, @@max_prepared_stmt_count;
@@prepared_stmt_count @@max_prepared_stmt_count
1 1
set global max_prepared_stmt_count=0;
prepare stmt from "select 1";
ERROR 42000: Can't create more than max_prepared_stmt_count statements (current value: 0)
execute stmt;
ERROR HY000: Unknown prepared statement handler (stmt) given to EXECUTE
select @@prepared_stmt_count;
@@prepared_stmt_count
0
prepare stmt from "select 1";
ERROR 42000: Can't create more than max_prepared_stmt_count statements (current value: 0)
select @@prepared_stmt_count;
@@prepared_stmt_count
0
set global max_prepared_stmt_count=3;
select @@max_prepared_stmt_count, @@prepared_stmt_count;
@@max_prepared_stmt_count @@prepared_stmt_count
3 0
prepare stmt from "select 1";
prepare stmt from "select 2";
prepare stmt1 from "select 3";
prepare stmt2 from "select 4";
ERROR 42000: Can't create more than max_prepared_stmt_count statements (current value: 3)
prepare stmt2 from "select 4";
ERROR 42000: Can't create more than max_prepared_stmt_count statements (current value: 3)
select @@max_prepared_stmt_count, @@prepared_stmt_count;
@@max_prepared_stmt_count @@prepared_stmt_count
3 3
deallocate prepare stmt;
select @@max_prepared_stmt_count, @@prepared_stmt_count;
@@max_prepared_stmt_count @@prepared_stmt_count
3 0
set global max_prepared_stmt_count= @old_max_prepared_stmt_count;
create table t1 (id int);
prepare ins_call from "insert into t1 (id) values (1)";
execute ins_call;
@ -880,3 +1009,50 @@ select row_count();
row_count()
1
drop table t1;
create table t1 (a int, b int);
insert into t1 (a,b) values (2,8),(1,9),(3,7);
prepare stmt from "select * from t1 order by ?";
set @a=NULL;
execute stmt using @a;
a b
2 8
1 9
3 7
set @a=1;
execute stmt using @a;
a b
1 9
2 8
3 7
set @a=2;
execute stmt using @a;
a b
3 7
2 8
1 9
deallocate prepare stmt;
select * from t1 order by 1;
a b
1 9
2 8
3 7
prepare stmt from "select * from t1 order by ?+1";
set @a=0;
execute stmt using @a;
a b
2 8
1 9
3 7
set @a=1;
execute stmt using @a;
a b
2 8
1 9
3 7
deallocate prepare stmt;
select * from t1 order by 1+1;
a b
2 8
1 9
3 7
drop table t1;

View file

@ -314,4 +314,34 @@ drop procedure f2;
drop procedure f3;
drop procedure f4;
drop table t1;
reset query cache;
drop function if exists f1;
create table t1 (id int);
create function f1 ()
returns int
begin
declare i_var int;
set i_var = sleep(3);
insert into t1 values(3);
set i_var = sleep(3);
return 0;
end;|
select f1();
select sleep(4);
sleep(4)
0
select * from t1;
id
3
f1()
0
select * from t1;
id
3
reset query cache;
select * from t1;
id
3
drop table t1;
drop function f1;
set GLOBAL query_cache_size=0;

View file

@ -89,3 +89,17 @@ f
7
drop table t1,t2;
create temporary table t3 (f int);
create temporary table t4 (f int);
create table t5 (f int);
drop table if exists t999;
create temporary table t999 (f int);
LOAD DATA INFILE "./tmp/bl_dump_thread_id" into table t999;
drop table t999;
insert into t4 values (1);
kill `select id from information_schema.processlist where command='Binlog Dump'`;
insert into t5 select * from t4;
select * from t5 /* must be 1 after reconnection */;
f
1
drop temporary table t4;
drop table t5;

View file

@ -3371,3 +3371,22 @@ NULL a NULL
drop table t1,t2;
select * from (select * left join t on f1=f2) tt;
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 'on f1=f2) tt' at line 1
CREATE TABLE t1 (sku int PRIMARY KEY, pr int);
CREATE TABLE t2 (sku int PRIMARY KEY, sppr int, name varchar(255));
INSERT INTO t1 VALUES
(10, 10), (20, 10), (30, 20), (40, 30), (50, 10), (60, 10);
INSERT INTO t2 VALUES
(10, 10, 'aaa'), (20, 10, 'bbb'), (30, 10, 'ccc'), (40, 20, 'ddd'),
(50, 10, 'eee'), (60, 20, 'fff'), (70, 20, 'ggg'), (80, 30, 'hhh');
SELECT t2.sku, t2.sppr, t2.name, t1.sku, t1.pr
FROM t2, t1 WHERE t2.sku=20 AND (t2.sku=t1.sku OR t2.sppr=t1.sku);
sku sppr name sku pr
20 10 bbb 10 10
20 10 bbb 20 10
EXPLAIN
SELECT t2.sku, t2.sppr, t2.name, t1.sku, t1.pr
FROM t2, t1 WHERE t2.sku=20 AND (t2.sku=t1.sku OR t2.sppr=t1.sku);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 Using where
DROP TABLE t1,t2;

View file

@ -634,10 +634,18 @@ flush tables;
return 5;
end|
ERROR 0A000: FLUSH is not allowed in stored function or trigger
create procedure bug9529_90123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123()
create procedure bug9529_901234567890123456789012345678901234567890123456789012345()
begin
end|
ERROR 42000: Identifier name 'bug9529_90123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890' is too long
ERROR 42000: Identifier name 'bug9529_901234567890123456789012345678901234567890123456789012345' is too long
drop procedure if exists bug17015_0123456789012345678901234567890123456789012345678901234|
create procedure bug17015_0123456789012345678901234567890123456789012345678901234()
begin
end|
show procedure status like 'bug17015%'|
Db Name Type Definer Modified Created Security_type Comment
test bug17015_0123456789012345678901234567890123456789012345678901234 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
drop procedure bug17015_0123456789012345678901234567890123456789012345678901234|
drop procedure if exists bug10969|
create procedure bug10969()
begin

View file

@ -214,3 +214,26 @@ drop function f1;
drop function f2;
drop function f3;
drop procedure sp1;
drop table if exists t1;
drop view if exists v1, v2, v3;
drop function if exists bug15683;
create table t1 (f1 bigint, f2 varchar(20), f3 bigint);
insert into t1 set f1 = 1, f2 = 'schoenenbourg', f3 = 1;
create view v1 as select 1 from t1 union all select 1;
create view v2 as select 1 from v1;
create view v3 as select 1 as f1 from v2;
create function bug15683() returns bigint
begin
return (select count(*) from v3);
end|
prepare stmt from "select bug15683()";
execute stmt;
bug15683()
2
execute stmt;
bug15683()
2
deallocate prepare stmt;
drop table t1;
drop view v1, v2, v3;
drop function bug15683;

View file

@ -4802,4 +4802,50 @@ f1 bug13575(f1)
3 ccc
drop function bug13575;
drop table t3|
drop procedure if exists bug16474_1|
drop procedure if exists bug16474_2|
delete from t1|
insert into t1 values ('c', 2), ('b', 3), ('a', 1)|
create procedure bug16474_1()
begin
declare x int;
select id from t1 order by x;
end|
drop procedure if exists bug14945|
create table t3 (id int not null auto_increment primary key)|
create procedure bug14945() deterministic truncate t3|
insert into t3 values (null)|
call bug14945()|
insert into t3 values (null)|
select * from t3|
id
1
drop table t3|
drop procedure bug14945|
create procedure bug16474_2(x int)
select id from t1 order by x|
call bug16474_1()|
id
c
b
a
call bug16474_2(1)|
id
c
b
a
call bug16474_2(2)|
id
c
b
a
drop procedure bug16474_1|
drop procedure bug16474_2|
set @x = 2|
select * from t1 order by @x|
id data
c 2
b 3
a 1
delete from t1|
drop table t1,t2;

View file

@ -23,3 +23,23 @@ select 1;
show status like 'last_query_cost';
Variable_name Value
Last_query_cost 0.000000
FLUSH STATUS;
SHOW STATUS LIKE 'max_used_connections';
Variable_name Value
Max_used_connections 1
SET @save_thread_cache_size=@@thread_cache_size;
SET GLOBAL thread_cache_size=3;
SHOW STATUS LIKE 'max_used_connections';
Variable_name Value
Max_used_connections 3
FLUSH STATUS;
SHOW STATUS LIKE 'max_used_connections';
Variable_name Value
Max_used_connections 2
SHOW STATUS LIKE 'max_used_connections';
Variable_name Value
Max_used_connections 3
SHOW STATUS LIKE 'max_used_connections';
Variable_name Value
Max_used_connections 4
SET GLOBAL thread_cache_size=@save_thread_cache_size;

View file

@ -547,7 +547,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 Using index
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
Note 1003 select `test`.`t1`.`numreponse` AS `numreponse` from `test`.`t1` where ((`test`.`t1`.`numreponse` = (select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where (`test`.`t1`.`numeropost` = _latin1'1'))) and (`test`.`t1`.`numeropost` = _latin1'1'))
Note 1003 select `test`.`t1`.`numreponse` AS `numreponse` from `test`.`t1` where ((`test`.`t1`.`numeropost` = _latin1'1'))
drop table t1;
CREATE TABLE t1 (a int(1));
INSERT INTO t1 VALUES (1);
@ -3156,3 +3156,16 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 9 Using where
2 DEPENDENT SUBQUERY t1 index NULL a 8 NULL 9 Using filesort
DROP TABLE t1;
create table t1( f1 int,f2 int);
insert into t1 values (1,1),(2,2);
select tt.t from (select 'crash1' as t, f2 from t1) as tt left join t1 on tt.t = 'crash2' and tt.f2 = t1.f2 where tt.t = 'crash1';
t
crash1
crash1
drop table t1;
create table t1 (c int, key(c));
insert into t1 values (1142477582), (1142455969);
create table t2 (a int, b int);
insert into t2 values (2, 1), (1, 0);
delete from t1 where c <= 1140006215 and (select b from t2 where a = 2) = 1;
drop table t1, t2;

View file

@ -0,0 +1,84 @@
drop table if exists t1;
create table t1 (a varchar(16), b int) engine=innodb;
create trigger t1_bi before insert on t1 for each row
begin
set new.a := upper(new.a);
set new.b := new.b + 3;
end|
select trigger_schema, trigger_name, event_object_schema,
event_object_table, action_statement from information_schema.triggers
where event_object_schema = 'test' and event_object_table = 't1';
trigger_schema trigger_name event_object_schema event_object_table action_statement
test t1_bi test t1 begin
set new.a := upper(new.a);
set new.b := new.b + 3;
end
insert into t1 values ('The Lion', 10);
select * from t1;
a b
THE LION 13
optimize table t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
select trigger_schema, trigger_name, event_object_schema,
event_object_table, action_statement from information_schema.triggers
where event_object_schema = 'test' and event_object_table = 't1';
trigger_schema trigger_name event_object_schema event_object_table action_statement
test t1_bi test t1 begin
set new.a := upper(new.a);
set new.b := new.b + 3;
end
insert into t1 values ('The Unicorn', 20);
select * from t1;
a b
THE LION 13
THE UNICORN 23
alter table t1 add column c int default 0;
select trigger_schema, trigger_name, event_object_schema,
event_object_table, action_statement from information_schema.triggers
where event_object_schema = 'test' and event_object_table = 't1';
trigger_schema trigger_name event_object_schema event_object_table action_statement
test t1_bi test t1 begin
set new.a := upper(new.a);
set new.b := new.b + 3;
end
insert into t1 values ('Alice', 30, 1);
select * from t1;
a b c
THE LION 13 0
THE UNICORN 23 0
ALICE 33 1
alter table t1 rename to t1;
select trigger_schema, trigger_name, event_object_schema,
event_object_table, action_statement from information_schema.triggers
where event_object_schema = 'test' and event_object_table = 't1';
trigger_schema trigger_name event_object_schema event_object_table action_statement
test t1_bi test t1 begin
set new.a := upper(new.a);
set new.b := new.b + 3;
end
insert into t1 values ('The Crown', 40, 1);
select * from t1;
a b c
THE LION 13 0
THE UNICORN 23 0
ALICE 33 1
THE CROWN 43 1
alter table t1 rename to t1, add column d int default 0;
select trigger_schema, trigger_name, event_object_schema,
event_object_table, action_statement from information_schema.triggers
where event_object_schema = 'test' and event_object_table = 't1';
trigger_schema trigger_name event_object_schema event_object_table action_statement
test t1_bi test t1 begin
set new.a := upper(new.a);
set new.b := new.b + 3;
end
insert into t1 values ('The Pie', 50, 1, 1);
select * from t1;
a b c d
THE LION 13 0 0
THE UNICORN 23 0 0
ALICE 33 1 0
THE CROWN 43 1 0
THE PIE 53 1 1
drop table t1;

View file

@ -2,6 +2,7 @@ drop table if exists t1, t2, t3, t4;
drop view if exists v1;
drop database if exists mysqltest;
drop function if exists f1;
drop function if exists f2;
drop procedure if exists p1;
create table t1 (i int);
create trigger trg before insert on t1 for each row set @a:=1;
@ -860,6 +861,37 @@ trigger_schema trigger_name event_object_schema event_object_table action_statem
mysqltest t1_bi mysqltest t1 set @a:=new.id
drop trigger test.t1_bi;
ERROR HY000: Trigger does not exist
alter table t1 rename to test.t1;
ERROR HY000: Trigger in wrong schema
insert into t1 values (103);
select @a;
@a
103
select trigger_schema, trigger_name, event_object_schema,
event_object_table, action_statement from information_schema.triggers
where event_object_schema = 'test' or event_object_schema = 'mysqltest';
trigger_schema trigger_name event_object_schema event_object_table action_statement
mysqltest t1_bi mysqltest t1 set @a:=new.id
drop trigger test.t1_bi;
ERROR HY000: Trigger does not exist
alter table t1 rename to test.t1, add column val int default 0;
ERROR HY000: Trigger in wrong schema
insert into t1 values (104);
select @a;
@a
104
select trigger_schema, trigger_name, event_object_schema,
event_object_table, action_statement from information_schema.triggers
where event_object_schema = 'test' or event_object_schema = 'mysqltest';
trigger_schema trigger_name event_object_schema event_object_table action_statement
mysqltest t1_bi mysqltest t1 set @a:=new.id
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop trigger test.t1_bi;
ERROR HY000: Trigger does not exist
drop trigger t1_bi;
drop table t1;
drop database mysqltest;
@ -897,3 +929,39 @@ create trigger t1_bi before insert on t1 for each row return 0;
ERROR 42000: RETURN is only allowed in a FUNCTION
insert into t1 values (1);
drop table t1;
create table t1 (a varchar(64), b int);
create table t2 like t1;
create trigger t1_ai after insert on t1 for each row
set @a:= (select max(a) from t1);
insert into t1 (a) values
("Twas"),("brillig"),("and"),("the"),("slithy"),("toves"),
("Did"),("gyre"),("and"),("gimble"),("in"),("the"),("wabe");
create trigger t2_ai after insert on t2 for each row
set @a:= (select max(a) from t2);
insert into t2 select * from t1;
load data infile '../std_data_ln/words.dat' into table t1 (a);
drop trigger t1_ai;
drop trigger t2_ai;
create function f1() returns int return (select max(b) from t1);
insert into t1 values
("All",f1()),("mimsy",f1()),("were",f1()),("the",f1()),("borogoves",f1()),
("And",f1()),("the",f1()),("mome", f1()),("raths",f1()),("outgrabe",f1());
create function f2() returns int return (select max(b) from t2);
insert into t2 select a, f2() from t1;
load data infile '../std_data_ln/words.dat' into table t1 (a) set b:= f1();
drop table t1;
drop function f1;
drop function f2;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
conn_id INT,
trigger_conn_id INT
);
CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
SET NEW.trigger_conn_id = CONNECTION_ID();
INSERT INTO t1 (conn_id, trigger_conn_id) VALUES (CONNECTION_ID(), -1);
INSERT INTO t1 (conn_id, trigger_conn_id) VALUES (CONNECTION_ID(), -1);
SELECT * FROM t1 WHERE conn_id != trigger_conn_id;
conn_id trigger_conn_id
DROP TRIGGER t1_bi;
DROP TABLE t1;

View file

@ -564,3 +564,12 @@ b1+0 sum(b1) sum(b2)
1 4 4
2 2 2
drop table t1, t2;
create table t1 (a bit(7));
insert into t1 values (0x60);
select * from t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t1 t1 a a 16 7 1 Y 0 0 63
a
`
drop table t1;
End of 5.0 tests

View file

@ -402,3 +402,12 @@ t1 CREATE TABLE `t1` (
`b` bit(10) default NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a bit(7)) engine=innodb;
insert into t1 values (0x60);
select * from t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t1 t1 a a 16 7 1 Y 0 0 63
a
`
drop table t1;
End of 5.0 tests

87
mysql-test/r/udf.result Normal file
View file

@ -0,0 +1,87 @@
drop table if exists t1;
CREATE FUNCTION metaphon RETURNS STRING SONAME 'udf_example.so';
CREATE FUNCTION myfunc_double RETURNS REAL SONAME 'udf_example.so';
CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME 'udf_example.so';
ERROR HY000: Can't find function 'myfunc_nonexist' in library
CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME 'udf_example.so';
CREATE FUNCTION sequence RETURNS INTEGER SONAME "udf_example.so";
CREATE FUNCTION lookup RETURNS STRING SONAME 'udf_example.so';
CREATE FUNCTION reverse_lookup
RETURNS STRING SONAME 'udf_example.so';
CREATE AGGREGATE FUNCTION avgcost
RETURNS REAL SONAME 'udf_example.so';
select myfunc_double();
ERROR HY000: myfunc_double must have at least one argument
select myfunc_double(1);
myfunc_double(1)
49.00
select myfunc_double(78654);
myfunc_double(78654)
54.00
select myfunc_nonexist();
ERROR 42000: FUNCTION test.myfunc_nonexist does not exist
select myfunc_int();
myfunc_int()
0
select lookup();
ERROR HY000: Wrong arguments to lookup; Use the source
select lookup("127.0.0.1");
lookup("127.0.0.1")
127.0.0.1
select lookup(127,0,0,1);
ERROR HY000: Wrong arguments to lookup; Use the source
select lookup("localhost");
lookup("localhost")
127.0.0.1
select reverse_lookup();
ERROR HY000: Wrong number of arguments to reverse_lookup; Use the source
select reverse_lookup("127.0.0.1");
select reverse_lookup(127,0,0,1);
select reverse_lookup("localhost");
reverse_lookup("localhost")
NULL
select avgcost();
ERROR HY000: wrong number of arguments: AVGCOST() requires two arguments
select avgcost(100,23.76);
ERROR HY000: wrong argument type: AVGCOST() requires an INT and a REAL
create table t1(sum int, price float(24));
insert into t1 values(100, 50.00), (100, 100.00);
select avgcost(sum, price) from t1;
avgcost(sum, price)
75.0000
delete from t1;
insert into t1 values(100, 54.33), (200, 199.99);
select avgcost(sum, price) from t1;
avgcost(sum, price)
151.4367
drop table t1;
select metaphon('hello');
metaphon('hello')
HL
CREATE PROCEDURE `XXX1`(in testval varchar(10))
begin
select metaphon(testval);
end//
call XXX1('hello');
metaphon(testval)
HL
drop procedure xxx1;
CREATE PROCEDURE `XXX2`()
begin
declare testval varchar(10);
set testval = 'hello';
select metaphon(testval);
end//
call XXX2();
metaphon(testval)
HL
drop procedure xxx2;
DROP FUNCTION metaphon;
DROP FUNCTION myfunc_double;
DROP FUNCTION myfunc_nonexist;
ERROR 42000: FUNCTION test.myfunc_nonexist does not exist
DROP FUNCTION myfunc_int;
DROP FUNCTION sequence;
DROP FUNCTION lookup;
DROP FUNCTION reverse_lookup;
DROP FUNCTION avgcost;

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