Merge perch.ndb.mysql.com:/home/jonas/src/tmp/mysql-5.0-ndb

into  perch.ndb.mysql.com:/home/jonas/src/mysql-5.0-ndb-bj
This commit is contained in:
jonas@perch.ndb.mysql.com 2006-09-29 11:37:21 +02:00
commit b52d86cff3
230 changed files with 6857 additions and 2144 deletions

View file

@ -671,6 +671,7 @@ mysql-test/*.ds?
mysql-test/*.vcproj
mysql-test/gmon.out
mysql-test/install_test_db
mysql-test/mtr
mysql-test/mysql-test-run
mysql-test/mysql-test-run.log
mysql-test/mysql_test_run_new
@ -913,6 +914,7 @@ ndb/src/common/mgmcommon/printConfig/*.d
ndb/src/common/portlib/libportlib.dsp
ndb/src/common/transporter/libtransporter.dsp
ndb/src/common/util/libgeneral.dsp
ndb/src/common/util/testBitmask.cpp
ndb/src/cw/cpcd/ndb_cpcd
ndb/src/dummy.cpp
ndb/src/kernel/blocks/backup/libbackup.dsp
@ -1138,6 +1140,7 @@ sql/*.ds?
sql/*.vcproj
sql/.gdbinit
sql/client.c
sql/f.c
sql/gen_lex_hash
sql/gmon.out
sql/lex_hash.h
@ -1296,4 +1299,3 @@ vio/viotest-sslconnect.cpp
vio/viotest.cpp
zlib/*.ds?
zlib/*.vcproj
ndb/src/common/util/testBitmask.cpp

View file

@ -1,6 +1,6 @@
#!/bin/sh
if ! test -f sql/mysqld.cc
if test ! -f sql/mysqld.cc
then
echo "You must run this script from the MySQL top-level directory"
exit 1
@ -122,12 +122,6 @@ fi
# (returns 0 if finds lines)
if ccache -V > /dev/null 2>&1
then
if ! (echo "$CC" | grep "ccache" > /dev/null)
then
CC="ccache $CC"
fi
if ! (echo "$CXX" | grep "ccache" > /dev/null)
then
CXX="ccache $CXX"
fi
echo "$CC" | grep "ccache" > /dev/null || CC="ccache $CC"
echo "$CXX" | grep "ccache" > /dev/null || CXX="ccache $CXX"
fi

View file

@ -3,209 +3,216 @@
# Check cpu of current machine and find the
# best compiler optimization flags for gcc
#
#
if test -r /proc/cpuinfo ; then
# on Linux (and others?) we can get detailed CPU information out of /proc
cpuinfo="cat /proc/cpuinfo"
check_cpu () {
if test -r /proc/cpuinfo ; then
# on Linux (and others?) we can get detailed CPU information out of /proc
cpuinfo="cat /proc/cpuinfo"
# detect CPU family
cpu_family=`$cpuinfo | grep 'family' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
if test -z "$cpu_family" ; then
cpu_family=`$cpuinfo | grep 'cpu' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
# detect CPU family
cpu_family=`$cpuinfo | grep 'family' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
if test -z "$cpu_family" ; then
cpu_family=`$cpuinfo | grep 'cpu' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
fi
# detect CPU vendor and model
cpu_vendor=`$cpuinfo | grep 'vendor_id' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
model_name=`$cpuinfo | grep 'model name' | cut -d ':' -f 2 | head -1`
if test -z "$model_name" ; then
model_name=`$cpuinfo | grep 'cpu model' | cut -d ':' -f 2 | head -1`
fi
# fallback: get CPU model from uname output
if test -z "$model_name" ; then
model_name=`uname -m`
fi
# parse CPU flags
for flag in `$cpuinfo | grep '^flags' | sed -e 's/^flags.*: //'`; do
eval cpu_flag_$flag=yes
done
else
# Fallback when there is no /proc/cpuinfo
case "`uname -s`" in
FreeBSD|OpenBSD)
cpu_family=`uname -m`;
model_name=`sysctl -n hw.model`
;;
Darwin)
cpu_family=`uname -p`
model_name=`machine`
;;
*)
cpu_family=`uname -m`;
model_name=`uname -p`;
;;
esac
fi
# detect CPU vendor and model
cpu_vendor=`$cpuinfo | grep 'vendor_id' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
model_name=`$cpuinfo | grep 'model name' | cut -d ':' -f 2 | head -1`
if test -z "$model_name" ; then
model_name=`$cpuinfo | grep 'cpu model' | cut -d ':' -f 2 | head -1`
fi
# fallback: get CPU model from uname output
if test -z "$model_name" ; then
model_name=`uname -m`
fi
# parse CPU flags
for flag in `$cpuinfo | grep '^flags' | sed -e 's/^flags.*: //'`; do
eval cpu_flag_$flag=yes
done
else
# Fallback when there is no /proc/cpuinfo
case "`uname -s`" in
FreeBSD|OpenBSD)
cpu_family=`uname -m`;
model_name=`sysctl -n hw.model`
# detect CPU shortname as used by gcc options
# this list is not complete, feel free to add further entries
cpu_arg=""
case "$cpu_family--$model_name" in
# DEC Alpha
Alpha*EV6*)
cpu_arg="ev6";
;;
Darwin)
cpu_family=`uname -p`
model_name=`machine`
# Intel ia32
*Xeon*)
# a Xeon is just another pentium4 ...
# ... unless it has the "lm" (long-mode) flag set,
# in that case it's a Xeon with EM64T support
if [ -z "$cpu_flag_lm" ]; then
cpu_arg="pentium4";
else
cpu_arg="nocona";
fi
;;
*Pentium*4*Mobile*)
cpu_arg="pentium4m";
;;
*Pentium*4*)
cpu_arg="pentium4";
;;
*Pentium*III*Mobile*)
cpu_arg="pentium3m";
;;
*Pentium*III*)
cpu_arg="pentium3";
;;
*Pentium*M*pro*)
cpu_arg="pentium-m";
;;
*Athlon*64*)
cpu_arg="athlon64";
;;
*Athlon*)
cpu_arg="athlon";
;;
*Opteron*)
cpu_arg="opteron";
;;
# MacOSX / Intel
*i386*i486*)
cpu_arg="pentium-m";
;;
# Intel ia64
*Itanium*)
# Don't need to set any flags for itanium(at the moment)
cpu_arg="";
;;
#
*ppc*)
cpu_arg='powerpc'
;;
*powerpc*)
cpu_arg='powerpc'
;;
# unknown
*)
cpu_family=`uname -m`;
model_name=`uname -p`;
cpu_arg="";
;;
esac
fi
# detect CPU shortname as used by gcc options
# this list is not complete, feel free to add further entries
cpu_arg=""
case "$cpu_family--$model_name" in
# DEC Alpha
Alpha*EV6*)
cpu_arg="ev6";
;;
# Intel ia32
*Xeon*)
# a Xeon is just another pentium4 ...
# ... unless it has the "lm" (long-mode) flag set,
# in that case it's a Xeon with EM64T support
if [ -z "$cpu_flag_lm" ]; then
cpu_arg="pentium4";
else
cpu_arg="nocona";
fi
;;
*Pentium*4*Mobile*)
cpu_arg="pentium4m";
;;
*Pentium*4*)
cpu_arg="pentium4";
;;
*Pentium*III*Mobile*)
cpu_arg="pentium3m";
;;
*Pentium*III*)
cpu_arg="pentium3";
;;
*Pentium*M*pro*)
cpu_arg="pentium-m";
;;
*Athlon*64*)
cpu_arg="athlon64";
;;
*Athlon*)
cpu_arg="athlon";
;;
*Opteron*)
cpu_arg="opteron";
;;
# Intel ia64
*Itanium*)
# Don't need to set any flags for itanium(at the moment)
cpu_arg="";
;;
#
*ppc*)
cpu_arg='powerpc'
;;
*powerpc*)
cpu_arg='powerpc'
;;
# unknown
*)
cpu_arg="";
;;
esac
if test -z "$cpu_arg"; then
echo "BUILD/check-cpu: Oops, could not find out what kind of cpu this machine is using."
check_cpu_cflags=""
return
fi
# different compiler versions have different option names
# for CPU specific command line options
if test -z "$CC" ; then
cc="gcc";
else
cc=$CC
fi
cc_ver=`$cc --version | sed 1q`
cc_verno=`echo $cc_ver | sed -e 's/[^0-9. ]//g; s/^ *//g; s/ .*//g'`
case "$cc_ver--$cc_verno" in
*GCC*)
# different gcc backends (and versions) have different CPU flags
case `gcc -dumpmachine` in
i?86-*)
case "$cc_verno" in
3.4*|3.5*|4.*)
check_cpu_args='-mtune=$cpu_arg -march=$cpu_arg'
;;
*)
check_cpu_args='-mcpu=$cpu_arg -march=$cpu_arg'
;;
esac
;;
ppc-*)
check_cpu_args='-mcpu=$cpu_arg -mtune=$cpu_arg'
;;
x86_64-*)
check_cpu_args='-mtune=$cpu_arg'
;;
*)
check_cpu_cflags=""
return
;;
esac
;;
2.95.*)
# GCC 2.95 doesn't expose its name in --version output
check_cpu_args='-m$cpu_arg'
;;
*)
if test -z "$cpu_arg"; then
echo "BUILD/check-cpu: Oops, could not find out what kind of cpu this machine is using." >&2
check_cpu_cflags=""
return
;;
esac
# now we check whether the compiler really understands the cpu type
touch __test.c
while [ "$cpu_arg" ] ; do
echo -n testing $cpu_arg "... "
# compile check
check_cpu_cflags=`eval echo $check_cpu_args`
if $cc -c $check_cpu_cflags __test.c 2>/dev/null; then
echo ok
break;
fi
echo failed
check_cpu_cflags=""
# different compiler versions have different option names
# for CPU specific command line options
if test -z "$CC" ; then
cc="gcc";
else
cc=$CC
fi
# if compile failed: check whether it supports a predecessor of this CPU
# this list is not complete, feel free to add further entries
case "$cpu_arg" in
# Intel ia32
nocona) cpu_arg=pentium4 ;;
prescott) cpu_arg=pentium4 ;;
pentium4m) cpu_arg=pentium4 ;;
pentium4) cpu_arg=pentium3 ;;
pentium3m) cpu_arg=pentium3 ;;
pentium3) cpu_arg=pentium2 ;;
pentium2) cpu_arg=pentiumpro ;;
pentiumpro) cpu_arg=pentium ;;
pentium) cpu_arg=i486 ;;
i486) cpu_arg=i386 ;;
cc_ver=`$cc --version | sed 1q`
cc_verno=`echo $cc_ver | sed -e 's/^.*gcc/gcc/g; s/[^0-9. ]//g; s/^ *//g; s/ .*//g'`
# power / powerPC
7450) cpu_arg=7400 ;;
*) cpu_arg="" ;;
case "$cc_ver--$cc_verno" in
*GCC*)
# different gcc backends (and versions) have different CPU flags
case `gcc -dumpmachine` in
i?86-*)
case "$cc_verno" in
3.4*|3.5*|4.*)
check_cpu_args='-mtune=$cpu_arg -march=$cpu_arg'
;;
*)
check_cpu_args='-mcpu=$cpu_arg -march=$cpu_arg'
;;
esac
;;
ppc-*)
check_cpu_args='-mcpu=$cpu_arg -mtune=$cpu_arg'
;;
x86_64-*)
check_cpu_args='-mtune=$cpu_arg'
;;
*)
check_cpu_cflags=""
return
;;
esac
;;
2.95.*)
# GCC 2.95 doesn't expose its name in --version output
check_cpu_args='-m$cpu_arg'
;;
*)
check_cpu_cflags=""
return
;;
esac
done
rm __test.*
# now we check whether the compiler really understands the cpu type
touch __test.c
while [ "$cpu_arg" ] ; do
# FIXME: echo -n isn't portable - see contortions autoconf goes through
echo -n testing $cpu_arg "... " >&2
# compile check
check_cpu_cflags=`eval echo $check_cpu_args`
if $cc -c $check_cpu_cflags __test.c 2>/dev/null; then
echo ok >&2
break;
fi
echo failed >&2
check_cpu_cflags=""
# if compile failed: check whether it supports a predecessor of this CPU
# this list is not complete, feel free to add further entries
case "$cpu_arg" in
# Intel ia32
nocona) cpu_arg=pentium4 ;;
prescott) cpu_arg=pentium4 ;;
pentium4m) cpu_arg=pentium4 ;;
pentium4) cpu_arg=pentium3 ;;
pentium3m) cpu_arg=pentium3 ;;
pentium3) cpu_arg=pentium2 ;;
pentium2) cpu_arg=pentiumpro ;;
pentiumpro) cpu_arg=pentium ;;
pentium) cpu_arg=i486 ;;
i486) cpu_arg=i386 ;;
# power / powerPC
7450) cpu_arg=7400 ;;
*) cpu_arg="" ;;
esac
done
rm __test.*
}
check_cpu

View file

@ -1 +1,4 @@
44d03f27qNdqJmARzBoP3Is_cN5e0w
44ec850ac2k4y2Omgr92GiWPBAVKGQ
44edb86b1iE5knJ97MbliK_3lCiAXA
44f33f3aj5KW5qweQeekY1LU0E9ZCg

132
CMakeLists.txt Executable file
View file

@ -0,0 +1,132 @@
PROJECT(MySql)
# This reads user configuration, generated by configure.js.
INCLUDE(win/configure.data)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/include/mysql_version.h.in
${CMAKE_SOURCE_DIR}/include/mysql_version.h @ONLY)
# Set standard options
ADD_DEFINITIONS(-D WITH_MYISAM_STORAGE_ENGINE)
ADD_DEFINITIONS(-D CMAKE_BUILD)
ADD_DEFINITIONS(-D HAVE_YASSL)
SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_myisam_plugin")
IF(WITH_ARCHIVE_STORAGE_ENGINE)
ADD_DEFINITIONS(-D HAVE_ARCHIVE_DB)
ENDIF(WITH_ARCHIVE_STORAGE_ENGINE)
IF (WITH_HEAP_STORAGE_ENGINE)
ADD_DEFINITIONS(-D WITH_HEAP_STORAGE_ENGINE)
SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_heap_plugin")
ENDIF (WITH_HEAP_STORAGE_ENGINE)
IF (WITH_MYISAMMRG_STORAGE_ENGINE)
ADD_DEFINITIONS(-D WITH_MYISAMMRG_STORAGE_ENGINE)
SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_myisammrg_plugin")
ENDIF (WITH_MYISAMMRG_STORAGE_ENGINE)
IF(WITH_INNOBASE_STORAGE_ENGINE)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/innobase/ib_config.h.in
${CMAKE_SOURCE_DIR}/innobase/ib_config.h @ONLY)
ADD_DEFINITIONS(-D HAVE_INNOBASE_DB)
ADD_DEFINITIONS(-D WITH_INNOBASE_STORAGE_ENGINE)
SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_innobase_plugin")
ENDIF(WITH_INNOBASE_STORAGE_ENGINE)
IF(WITH_FEDERATED_STORAGE_ENGINE)
ADD_DEFINITIONS(-D HAVE_FEDERATED_DB)
ADD_DEFINITIONS(-D WITH_FEDERATED_STORAGE_ENGINE)
SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_federated_plugin")
ENDIF(WITH_FEDERATED_STORAGE_ENGINE)
IF(WITH_BERKELEY_STORAGE_ENGINE)
ADD_DEFINITIONS(-D HAVE_BERKELEY_DB)
ADD_DEFINITIONS(-D WITH_BERKELEY_STORAGE_ENGINE)
SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_berkeley_plugin")
ENDIF(WITH_BERKELEY_STORAGE_ENGINE)
IF (WITH_BLACKHOLE_STORAGE_ENGINE)
ADD_DEFINITIONS(-D HAVE_BLACKHOLE_DB)
ENDIF (WITH_BLACKHOLE_STORAGE_ENGINE)
SET(localstatedir "C:\\mysql\\data")
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/support-files/my-huge.cnf.sh
${CMAKE_SOURCE_DIR}/support-files/my-huge.ini @ONLY)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/support-files/my-innodb-heavy-4G.cnf.sh
${CMAKE_SOURCE_DIR}/support-files/my-innodb-heavy-4G.ini @ONLY)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/support-files/my-large.cnf.sh
${CMAKE_SOURCE_DIR}/support-files/my-large.ini @ONLY)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/support-files/my-medium.cnf.sh
${CMAKE_SOURCE_DIR}/support-files/my-medium.ini @ONLY)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/support-files/my-small.cnf.sh
${CMAKE_SOURCE_DIR}/support-files/my-small.ini @ONLY)
IF(__NT__)
ADD_DEFINITIONS(-D __NT__)
ENDIF(__NT__)
IF(CYBOZU)
ADD_DEFINITIONS(-D CYBOZU)
ENDIF(CYBOZU)
# in some places we use DBUG_OFF
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -D DBUG_OFF")
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -D DBUG_OFF")
IF(CMAKE_GENERATOR MATCHES "Visual Studio 8")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /wd4996")
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /wd4996")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /wd4996")
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /wd4996")
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 8")
IF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR
CMAKE_GENERATOR MATCHES "Visual Studio 8")
# replace /MDd with /MTd
STRING(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG_INIT
${CMAKE_CXX_FLAGS_DEBUG_INIT})
STRING(REPLACE "/MDd" "/MTd" CMAKE_C_FLAGS_DEBUG_INIT
${CMAKE_C_FLAGS_DEBUG_INIT})
STRING(REPLACE "/MD" "/MT" CMAKE_C_FLAGS_RELEASE
${CMAKE_C_FLAGS_RELEASE})
STRING(REPLACE "/MDd" "/MTd" CMAKE_C_FLAGS_DEBUG
${CMAKE_C_FLAGS_DEBUG})
STRING(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELEASE
${CMAKE_CXX_FLAGS_RELEASE})
STRING(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG
${CMAKE_CXX_FLAGS_DEBUG})
# remove support for Exception handling
STRING(REPLACE "/GX" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS_INIT
${CMAKE_CXX_FLAGS_INIT})
STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS_DEBUG_INIT
${CMAKE_CXX_FLAGS_DEBUG_INIT})
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR
CMAKE_GENERATOR MATCHES "Visual Studio 8")
ADD_DEFINITIONS("-D_WINDOWS -D__WIN__ -D _CRT_SECURE_NO_DEPRECATE")
ADD_SUBDIRECTORY(vio)
ADD_SUBDIRECTORY(dbug)
ADD_SUBDIRECTORY(strings)
ADD_SUBDIRECTORY(regex)
ADD_SUBDIRECTORY(mysys)
ADD_SUBDIRECTORY(extra/yassl)
ADD_SUBDIRECTORY(extra/yassl/taocrypt)
ADD_SUBDIRECTORY(extra)
ADD_SUBDIRECTORY(zlib)
ADD_SUBDIRECTORY(heap)
ADD_SUBDIRECTORY(myisam)
ADD_SUBDIRECTORY(myisammrg)
ADD_SUBDIRECTORY(client)
ADD_SUBDIRECTORY(bdb)
ADD_SUBDIRECTORY(innobase)
ADD_SUBDIRECTORY(sql)
ADD_SUBDIRECTORY(sql/examples)
ADD_SUBDIRECTORY(server-tools/instance-manager)
ADD_SUBDIRECTORY(libmysql)
ADD_SUBDIRECTORY(tests)

View file

@ -20,7 +20,7 @@ AUTOMAKE_OPTIONS = foreign
# These are built from source in the Docs directory
EXTRA_DIST = INSTALL-SOURCE INSTALL-WIN-SOURCE \
README COPYING EXCEPTIONS-CLIENT
README COPYING EXCEPTIONS-CLIENT CMakeLists.txt
SUBDIRS = . include @docs_dirs@ @zlib_dir@ @yassl_dir@ \
@readline_topdir@ sql-common \
@thread_dirs@ pstack \
@ -33,7 +33,7 @@ DIST_SUBDIRS = . include @docs_dirs@ zlib \
@thread_dirs@ pstack \
@sql_union_dirs@ scripts @man_dirs@ tests SSL\
BUILD netware os2 @libmysqld_dirs@ \
@bench_dirs@ support-files @tools_dirs@
@bench_dirs@ support-files @tools_dirs@ win
# Run these targets before any others, also make part of clean target,
# to make sure we create new links after a clean.

View file

@ -174,7 +174,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mysqlimport", "client\mysql
{44D9C7DC-6636-4B82-BD01-6876C64017DF} = {44D9C7DC-6636-4B82-BD01-6876C64017DF}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mysql_upgrade", "client\mysql_upgrade.vcproj", "{AD95DAD3-6DB9-4F8B-A345-7A39A83AAD3D}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mysql_upgrade", "client\mysql_upgrade.vcproj", "{AD95DAD3-6DB9-4F8B-A345-7A39A83AAD3A}"
ProjectSection(ProjectDependencies) = postProject
{BA86AE72-0CF5-423D-BBA2-E12B0D72EBFB} = {BA86AE72-0CF5-423D-BBA2-E12B0D72EBFB}
{26383276-4843-494B-8BE0-8936ED3EBAAB} = {26383276-4843-494B-8BE0-8936ED3EBAAB}
@ -990,6 +990,33 @@ Global
{AD95DAD3-6DB9-4F8B-A345-7A39A83AAD3D}.pro nt.Build.0 = Release|Win32
{AD95DAD3-6DB9-4F8B-A345-7A39A83AAD3D}.Release.ActiveCfg = Release|Win32
{AD95DAD3-6DB9-4F8B-A345-7A39A83AAD3D}.Release.Build.0 = Release|Win32
{AD95DAD3-6DB9-4F8B-A345-7A39A83AAD3A}.classic.ActiveCfg = classic|Win32
{AD95DAD3-6DB9-4F8B-A345-7A39A83AAD3A}.classic.Build.0 = classic|Win32
{AD95DAD3-6DB9-4F8B-A345-7A39A83AAD3A}.classic nt.ActiveCfg = classic|Win32
{AD95DAD3-6DB9-4F8B-A345-7A39A83AAD3A}.classic nt.Build.0 = classic|Win32
{AD95DAD3-6DB9-4F8B-A345-7A39A83AAD3A}.Debug.ActiveCfg = Debug|Win32
{AD95DAD3-6DB9-4F8B-A345-7A39A83AAD3A}.Debug.Build.0 = Debug|Win32
{AD95DAD3-6DB9-4F8B-A345-7A39A83AAD3A}.Embedded_Classic.ActiveCfg = classic|Win32
{AD95DAD3-6DB9-4F8B-A345-7A39A83AAD3A}.Embedded_Debug.ActiveCfg = Debug|Win32
{AD95DAD3-6DB9-4F8B-A345-7A39A83AAD3A}.Embedded_Pro.ActiveCfg = classic|Win32
{AD95DAD3-6DB9-4F8B-A345-7A39A83AAD3A}.Embedded_ProGPL.ActiveCfg = Release|Win32
{AD95DAD3-6DB9-4F8B-A345-7A39A83AAD3A}.Embedded_Release.ActiveCfg = Release|Win32
{AD95DAD3-6DB9-4F8B-A345-7A39A83AAD3A}.Max.ActiveCfg = Release|Win32
{AD95DAD3-6DB9-4F8B-A345-7A39A83AAD3A}.Max.Build.0 = Release|Win32
{AD95DAD3-6DB9-4F8B-A345-7A39A83AAD3A}.Max nt.ActiveCfg = Release|Win32
{AD95DAD3-6DB9-4F8B-A345-7A39A83AAD3A}.Max nt.Build.0 = Release|Win32
{AD95DAD3-6DB9-4F8B-A345-7A39A83AAD3A}.nt.ActiveCfg = Release|Win32
{AD95DAD3-6DB9-4F8B-A345-7A39A83AAD3A}.nt.Build.0 = Release|Win32
{AD95DAD3-6DB9-4F8B-A345-7A39A83AAD3A}.pro.ActiveCfg = Release|Win32
{AD95DAD3-6DB9-4F8B-A345-7A39A83AAD3A}.pro.Build.0 = Release|Win32
{AD95DAD3-6DB9-4F8B-A345-7A39A83AAD3A}.pro gpl.ActiveCfg = Release|Win32
{AD95DAD3-6DB9-4F8B-A345-7A39A83AAD3A}.pro gpl.Build.0 = Release|Win32
{AD95DAD3-6DB9-4F8B-A345-7A39A83AAD3A}.pro gpl nt.ActiveCfg = Release|Win32
{AD95DAD3-6DB9-4F8B-A345-7A39A83AAD3A}.pro gpl nt.Build.0 = Release|Win32
{AD95DAD3-6DB9-4F8B-A345-7A39A83AAD3A}.pro nt.ActiveCfg = Release|Win32
{AD95DAD3-6DB9-4F8B-A345-7A39A83AAD3A}.pro nt.Build.0 = Release|Win32
{AD95DAD3-6DB9-4F8B-A345-7A39A83AAD3A}.Release.ActiveCfg = Release|Win32
{AD95DAD3-6DB9-4F8B-A345-7A39A83AAD3A}.Release.Build.0 = Release|Win32
{94B86159-C581-42CD-825D-C69CBC237E5C}.classic.ActiveCfg = Release|Win32
{94B86159-C581-42CD-825D-C69CBC237E5C}.classic.Build.0 = Release|Win32
{94B86159-C581-42CD-825D-C69CBC237E5C}.classic nt.ActiveCfg = Release|Win32

44
bdb/CMakeLists.txt Executable file
View file

@ -0,0 +1,44 @@
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/bdb/build_win32
${CMAKE_SOURCE_DIR}/bdb/dbinc
${CMAKE_SOURCE_DIR}/bdb)
# BDB needs a number of source files that are auto-generated by the unix
# configure. So to build BDB, it is necessary to copy these over to the Windows
# bitkeeper tree, or to use a source .tar.gz package which already has these
# files.
ADD_LIBRARY(bdb btree/bt_compare.c btree/bt_conv.c btree/bt_curadj.c btree/bt_cursor.c
btree/bt_delete.c btree/bt_method.c btree/bt_open.c btree/bt_put.c btree/bt_rec.c
btree/bt_reclaim.c btree/bt_recno.c btree/bt_rsearch.c btree/bt_search.c
btree/bt_split.c btree/bt_stat.c btree/bt_upgrade.c btree/bt_verify.c btree/btree_auto.c
db/crdel_auto.c db/crdel_rec.c db/db.c db/db_am.c db/db_auto.c common/db_byteorder.c
db/db_cam.c db/db_conv.c db/db_dispatch.c db/db_dup.c common/db_err.c common/db_getlong.c
common/db_idspace.c db/db_iface.c db/db_join.c common/db_log2.c db/db_meta.c
db/db_method.c db/db_open.c db/db_overflow.c db/db_pr.c db/db_rec.c db/db_reclaim.c
db/db_remove.c db/db_rename.c db/db_ret.c env/db_salloc.c env/db_shash.c db/db_truncate.c
db/db_upg.c db/db_upg_opd.c db/db_vrfy.c db/db_vrfyutil.c dbm/dbm.c dbreg/dbreg.c
dbreg/dbreg_auto.c dbreg/dbreg_rec.c dbreg/dbreg_util.c env/env_file.c env/env_method.c
env/env_open.c env/env_recover.c env/env_region.c fileops/fileops_auto.c fileops/fop_basic.c
fileops/fop_rec.c fileops/fop_util.c hash/hash.c hash/hash_auto.c hash/hash_conv.c
hash/hash_dup.c hash/hash_func.c hash/hash_meta.c hash/hash_method.c hash/hash_open.c
hash/hash_page.c hash/hash_rec.c hash/hash_reclaim.c hash/hash_stat.c hash/hash_upgrade.c
hash/hash_verify.c hmac/hmac.c hsearch/hsearch.c lock/lock.c lock/lock_deadlock.c
lock/lock_method.c lock/lock_region.c lock/lock_stat.c lock/lock_util.c log/log.c
log/log_archive.c log/log_compare.c log/log_get.c log/log_method.c log/log_put.c
mp/mp_alloc.c mp/mp_bh.c mp/mp_fget.c mp/mp_fopen.c mp/mp_fput.c
mp/mp_fset.c mp/mp_method.c mp/mp_region.c mp/mp_register.c mp/mp_stat.c mp/mp_sync.c
mp/mp_trickle.c mutex/mut_tas.c mutex/mut_win32.c mutex/mutex.c os_win32/os_abs.c
os/os_alloc.c os_win32/os_clock.c os_win32/os_config.c os_win32/os_dir.c os_win32/os_errno.c
os_win32/os_fid.c os_win32/os_fsync.c os_win32/os_handle.c os/os_id.c os_win32/os_map.c
os/os_method.c os/os_oflags.c os_win32/os_open.c os/os_region.c os_win32/os_rename.c
os/os_root.c os/os_rpath.c os_win32/os_rw.c os_win32/os_seek.c os_win32/os_sleep.c
os_win32/os_spin.c os_win32/os_stat.c os/os_tmpdir.c os_win32/os_type.c os/os_unlink.c
qam/qam.c qam/qam_auto.c qam/qam_conv.c qam/qam_files.c qam/qam_method.c qam/qam_open.c
qam/qam_rec.c qam/qam_stat.c qam/qam_upgrade.c qam/qam_verify.c rep/rep_method.c
rep/rep_record.c rep/rep_region.c rep/rep_util.c hmac/sha1.c
clib/strcasecmp.c txn/txn.c txn/txn_auto.c txn/txn_method.c txn/txn_rec.c
txn/txn_recover.c txn/txn_region.c txn/txn_stat.c txn/txn_util.c common/util_log.c
common/util_sig.c xa/xa.c xa/xa_db.c xa/xa_map.c)

View file

@ -23,7 +23,7 @@ top_srcdir = @top_srcdir@
# distdir and top_distdir are set by the calling Makefile
bdb_build = build_unix
files = LICENSE Makefile Makefile.in README
files = LICENSE Makefile Makefile.in README CMakeLists.txt
subdirs = btree build_vxworks build_win32 clib common cxx db dbinc \
dbinc_auto db185 db_archive db_checkpoint db_deadlock db_dump \
db_dump185 db_load db_printlog db_recover db_stat db_upgrade \

79
client/CMakeLists.txt Executable file
View file

@ -0,0 +1,79 @@
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
# The old Windows build method used renamed (.cc -> .cpp) source files, fails
# in #include in mysqlbinlog.cc. So disable that using the USING_CMAKE define.
ADD_DEFINITIONS(-DUSING_CMAKE)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/zlib
${CMAKE_SOURCE_DIR}/extra/yassl/include
${CMAKE_SOURCE_DIR}/libmysql
${CMAKE_SOURCE_DIR}/regex
${CMAKE_SOURCE_DIR}/mysys
${CMAKE_SOURCE_DIR}/sql
${CMAKE_SOURCE_DIR}/strings)
ADD_LIBRARY(mysqlclient ../mysys/array.c ../strings/bchange.c ../strings/bmove.c
../strings/bmove_upp.c ../mysys/charset-def.c ../mysys/charset.c
../sql-common/client.c ../strings/ctype-big5.c ../strings/ctype-bin.c
../strings/ctype-cp932.c ../strings/ctype-czech.c ../strings/ctype-euc_kr.c
../strings/ctype-eucjpms.c ../strings/ctype-extra.c ../strings/ctype-gb2312.c
../strings/ctype-gbk.c ../strings/ctype-latin1.c ../strings/ctype-mb.c
../strings/ctype-simple.c ../strings/ctype-sjis.c ../strings/ctype-tis620.c
../strings/ctype-uca.c ../strings/ctype-ucs2.c ../strings/ctype-ujis.c
../strings/ctype-utf8.c ../strings/ctype-win1250ch.c ../strings/ctype.c
../mysys/default.c ../libmysql/errmsg.c ../mysys/errors.c
../libmysql/get_password.c ../strings/int2str.c ../strings/is_prefix.c
../libmysql/libmysql.c ../mysys/list.c ../strings/llstr.c
../strings/longlong2str.c ../libmysql/manager.c ../mysys/mf_cache.c
../mysys/mf_dirname.c ../mysys/mf_fn_ext.c ../mysys/mf_format.c
../mysys/mf_iocache.c ../mysys/mf_iocache2.c ../mysys/mf_loadpath.c
../mysys/mf_pack.c ../mysys/mf_path.c ../mysys/mf_tempfile.c ../mysys/mf_unixpath.c
../mysys/mf_wcomp.c ../mysys/mulalloc.c ../mysys/my_access.c ../mysys/my_alloc.c
../mysys/my_chsize.c ../mysys/my_compress.c ../mysys/my_create.c
../mysys/my_delete.c ../mysys/my_div.c ../mysys/my_error.c ../mysys/my_file.c
../mysys/my_fopen.c ../mysys/my_fstream.c ../mysys/my_gethostbyname.c
../mysys/my_getopt.c ../mysys/my_getwd.c ../mysys/my_init.c ../mysys/my_lib.c
../mysys/my_malloc.c ../mysys/my_messnc.c ../mysys/my_net.c ../mysys/my_once.c
../mysys/my_open.c ../mysys/my_pread.c ../mysys/my_pthread.c ../mysys/my_read.c
../mysys/my_realloc.c ../mysys/my_rename.c ../mysys/my_seek.c
../mysys/my_static.c ../strings/my_strtoll10.c ../mysys/my_symlink.c
../mysys/my_symlink2.c ../mysys/my_thr_init.c ../sql-common/my_time.c
../strings/my_vsnprintf.c ../mysys/my_wincond.c ../mysys/my_winthread.c
../mysys/my_write.c ../sql/net_serv.cc ../sql-common/pack.c ../sql/password.c
../mysys/safemalloc.c ../mysys/sha1.c ../strings/str2int.c
../strings/str_alloc.c ../strings/strcend.c ../strings/strcont.c ../strings/strend.c
../strings/strfill.c ../mysys/string.c ../strings/strinstr.c ../strings/strmake.c
../strings/strmov.c ../strings/strnlen.c ../strings/strnmov.c ../strings/strtod.c
../strings/strtoll.c ../strings/strtoull.c ../strings/strxmov.c ../strings/strxnmov.c
../mysys/thr_mutex.c ../mysys/typelib.c ../vio/vio.c ../vio/viosocket.c
../vio/viossl.c ../vio/viosslfactories.c ../strings/xml.c)
ADD_DEPENDENCIES(mysqlclient GenError)
ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc sql_string.cc)
LINK_DIRECTORIES(${MYSQL_BINARY_DIR}/mysys ${MYSQL_BINARY_DIR}/zlib)
TARGET_LINK_LIBRARIES(mysql mysqlclient mysys yassl taocrypt zlib dbug wsock32)
ADD_EXECUTABLE(mysqltest mysqltest.c)
TARGET_LINK_LIBRARIES(mysqltest mysqlclient mysys yassl taocrypt zlib dbug regex wsock32)
ADD_EXECUTABLE(mysqlcheck mysqlcheck.c)
TARGET_LINK_LIBRARIES(mysqlcheck mysqlclient dbug yassl taocrypt zlib wsock32)
ADD_EXECUTABLE(mysqldump mysqldump.c ../sql-common/my_user.c)
TARGET_LINK_LIBRARIES(mysqldump mysqlclient mysys dbug yassl taocrypt zlib wsock32)
ADD_EXECUTABLE(mysqlimport mysqlimport.c)
TARGET_LINK_LIBRARIES(mysqlimport mysqlclient mysys dbug yassl taocrypt zlib wsock32)
ADD_EXECUTABLE(mysqlshow mysqlshow.c)
TARGET_LINK_LIBRARIES(mysqlshow mysqlclient mysys dbug yassl taocrypt zlib wsock32)
ADD_EXECUTABLE(mysqlbinlog mysqlbinlog.cc ../mysys/mf_tempdir.c ../mysys/my_new.cc
../mysys/my_bit.c ../mysys/my_bitmap.c
../mysys/base64.c)
TARGET_LINK_LIBRARIES(mysqlbinlog mysqlclient dbug yassl taocrypt zlib wsock32)
ADD_EXECUTABLE(mysqladmin mysqladmin.cc)
TARGET_LINK_LIBRARIES(mysqladmin mysqlclient mysys dbug yassl taocrypt zlib wsock32)

View file

@ -60,6 +60,8 @@ DEFS = -DUNDEF_THREADS_HACK \
-DDEFAULT_MYSQL_HOME="\"$(prefix)\"" \
-DDATADIR="\"$(localstatedir)\""
EXTRA_DIST = get_password.c CMakeLists.txt
link_sources:
for f in $(sql_src) ; do \
rm -f $$f; \

View file

@ -1974,6 +1974,9 @@ com_charset(String *buffer __attribute__((unused)), char *line)
if (new_cs)
{
charset_info= new_cs;
mysql_set_character_set(&mysql, charset_info->csname);
default_charset= (char *)charset_info->csname;
default_charset_used= 1;
put_info("Charset changed", INFO_INFO);
}
else put_info("Charset is not found", INFO_INFO);
@ -2351,9 +2354,14 @@ print_table_data(MYSQL_RES *result)
(void) tee_fputs("|", PAGER);
for (uint off=0; (field = mysql_fetch_field(result)) ; off++)
{
tee_fprintf(PAGER, " %-*s |",(int) min(field->max_length,
uint name_length= (uint) strlen(field->name);
uint numcells= charset_info->cset->numcells(charset_info,
field->name,
field->name + name_length);
uint display_length= field->max_length + name_length - numcells;
tee_fprintf(PAGER, " %-*s |",(int) min(display_length,
MAX_COLUMN_LENGTH),
field->name);
field->name);
num_flag[off]= IS_NUM(field->type);
not_null_flag[off]= IS_NOT_NULL(field->flags);
}

View file

@ -157,17 +157,29 @@ static int create_defaults_file(const char *path, const char *our_defaults_path)
File our_defaults_file, defaults_file;
char buffer[512];
char *buffer_end;
int failed_to_open_count= 0;
int error;
/* check if the defaults file is needed at all */
if (!opt_password)
return 0;
defaults_file= my_open(path, O_BINARY | O_CREAT | O_WRONLY,
retry_open:
defaults_file= my_open(path, O_BINARY | O_CREAT | O_WRONLY | O_EXCL,
MYF(MY_FAE | MY_WME));
if (defaults_file < 0)
return 1;
{
if (failed_to_open_count == 0)
{
remove(path);
failed_to_open_count+= 1;
goto retry_open;
}
else
return 1;
}
upgrade_defaults_created= 1;
if (our_defaults_path)
{

View file

@ -1490,14 +1490,13 @@ int main(int argc, char** argv)
the server
*/
#ifdef __WIN__
#include "my_decimal.h"
#include "decimal.c"
#if defined(__WIN__) && !defined(CMAKE_BUILD)
#include "my_decimal.cpp"
#include "log_event.cpp"
#else
#include "my_decimal.h"
#include "decimal.c"
#include "my_decimal.cc"
#include "log_event.cc"
#endif

View file

@ -417,7 +417,9 @@ static void print_value(FILE *file, MYSQL_RES *result, MYSQL_ROW row,
int string_value);
static int dump_selected_tables(char *db, char **table_names, int tables);
static int dump_all_tables_in_db(char *db);
static int init_dumping(char *);
static int init_dumping_views(char *);
static int init_dumping_tables(char *);
static int init_dumping(char *, int init_func(char*));
static int dump_databases(char **);
static int dump_all_databases();
static char *quote_name(const char *name, char *buff, my_bool force);
@ -848,8 +850,9 @@ static int get_options(int *argc, char ***argv)
static void DB_error(MYSQL *mysql, const char *when)
{
DBUG_ENTER("DB_error");
my_printf_error(0,"Got error: %d: %s %s", MYF(0),
mysql_errno(mysql), mysql_error(mysql), when);
fprintf(stderr, "%s: Got error: %d: %s %s\n", my_progname,
mysql_errno(mysql), mysql_error(mysql), when);
fflush(stderr);
safe_exit(EX_MYSQLERR);
DBUG_VOID_RETURN;
} /* DB_error */
@ -877,8 +880,9 @@ static int mysql_query_with_error_report(MYSQL *mysql_con, MYSQL_RES **res,
if (mysql_query(mysql_con, query) ||
(res && !((*res)= mysql_store_result(mysql_con))))
{
my_printf_error(0, "Couldn't execute '%s': %s (%d)", MYF(0),
query, mysql_error(mysql_con), mysql_errno(mysql_con));
fprintf(stderr, "%s: Couldn't execute '%s': %s (%d)\n",
my_progname, query,
mysql_error(mysql_con), mysql_errno(mysql_con));
safe_exit(EX_MYSQLERR);
return 1;
}
@ -2232,7 +2236,10 @@ static void dump_table(char *table, char *db)
check_io(md_result_file);
}
if (mysql_query_with_error_report(mysql, 0, query))
{
DB_error(mysql, "when retrieving data from server");
goto err;
}
if (quick)
res=mysql_use_result(mysql);
else
@ -2635,7 +2642,76 @@ static int dump_databases(char **db_names)
} /* dump_databases */
static int init_dumping(char *database)
/*
View Specific database initalization.
SYNOPSIS
init_dumping_views
qdatabase quoted name of the database
RETURN VALUES
0 Success.
1 Failure.
*/
int init_dumping_views(char *qdatabase)
{
return 0;
} /* init_dumping_views */
/*
Table Specific database initalization.
SYNOPSIS
init_dumping_tables
qdatabase quoted name of the database
RETURN VALUES
0 Success.
1 Failure.
*/
int init_dumping_tables(char *qdatabase)
{
if (!opt_create_db)
{
char qbuf[256];
MYSQL_ROW row;
MYSQL_RES *dbinfo;
my_snprintf(qbuf, sizeof(qbuf),
"SHOW CREATE DATABASE IF NOT EXISTS %s",
qdatabase);
if (mysql_query(mysql, qbuf) || !(dbinfo = mysql_store_result(mysql)))
{
/* Old server version, dump generic CREATE DATABASE */
if (opt_drop_database)
fprintf(md_result_file,
"\n/*!40000 DROP DATABASE IF EXISTS %s;*/\n",
qdatabase);
fprintf(md_result_file,
"\nCREATE DATABASE /*!32312 IF NOT EXISTS*/ %s;\n",
qdatabase);
}
else
{
if (opt_drop_database)
fprintf(md_result_file,
"\n/*!40000 DROP DATABASE IF EXISTS %s*/;\n",
qdatabase);
row = mysql_fetch_row(dbinfo);
if (row[1])
{
fprintf(md_result_file,"\n%s;\n",row[1]);
}
}
}
return 0;
} /* init_dumping_tables */
static int init_dumping(char *database, int init_func(char*))
{
if (mysql_get_server_version(mysql) >= 50003 &&
!my_strcasecmp(&my_charset_latin1, database, "information_schema"))
@ -2660,40 +2736,10 @@ static int init_dumping(char *database)
fprintf(md_result_file,"\n--\n-- Current Database: %s\n--\n", qdatabase);
check_io(md_result_file);
}
if (!opt_create_db)
{
char qbuf[256];
MYSQL_ROW row;
MYSQL_RES *dbinfo;
my_snprintf(qbuf, sizeof(qbuf),
"SHOW CREATE DATABASE IF NOT EXISTS %s",
qdatabase);
/* Call the view or table specific function */
init_func(qdatabase);
if (mysql_query(mysql, qbuf) || !(dbinfo = mysql_store_result(mysql)))
{
/* Old server version, dump generic CREATE DATABASE */
if (opt_drop_database)
fprintf(md_result_file,
"\n/*!40000 DROP DATABASE IF EXISTS %s;*/\n",
qdatabase);
fprintf(md_result_file,
"\nCREATE DATABASE /*!32312 IF NOT EXISTS*/ %s;\n",
qdatabase);
}
else
{
if (opt_drop_database)
fprintf(md_result_file,
"\n/*!40000 DROP DATABASE IF EXISTS %s*/;\n",
qdatabase);
row = mysql_fetch_row(dbinfo);
if (row[1])
{
fprintf(md_result_file,"\n%s;\n",row[1]);
}
}
}
fprintf(md_result_file,"\nUSE %s;\n", qdatabase);
check_io(md_result_file);
}
@ -2725,7 +2771,7 @@ static int dump_all_tables_in_db(char *database)
afterdot= strmov(hash_key, database);
*afterdot++= '.';
if (init_dumping(database))
if (init_dumping(database, init_dumping_tables))
return 1;
if (opt_xml)
print_xml_tag1(md_result_file, "", "database name=", database, "\n");
@ -2797,23 +2843,8 @@ static my_bool dump_all_views_in_db(char *database)
uint numrows;
char table_buff[NAME_LEN*2+3];
if (mysql_select_db(mysql, database))
{
DB_error(mysql, "when selecting the database");
if (init_dumping(database, init_dumping_views))
return 1;
}
if (opt_databases || opt_alldbs)
{
char quoted_database_buf[NAME_LEN*2+3];
char *qdatabase= quote_name(database,quoted_database_buf,opt_quoted);
if (opt_comments)
{
fprintf(md_result_file,"\n--\n-- Current Database: %s\n--\n", qdatabase);
check_io(md_result_file);
}
fprintf(md_result_file,"\nUSE %s;\n", qdatabase);
check_io(md_result_file);
}
if (opt_xml)
print_xml_tag1(md_result_file, "", "database name=", database, "\n");
if (lock_tables)
@ -2908,7 +2939,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
char **dump_tables, **pos, **end;
DBUG_ENTER("dump_selected_tables");
if (init_dumping(db))
if (init_dumping(db, init_dumping_tables))
return 1;
init_alloc_root(&root, 8192, 0);

View file

@ -1655,20 +1655,17 @@ AC_ARG_WITH(debug,
if test "$with_debug" = "yes"
then
# Medium debug.
AC_DEFINE([DBUG_ON], [1], [Use libdbug])
CFLAGS="$DEBUG_CFLAGS $DEBUG_OPTIMIZE_CC -DSAFE_MUTEX $CFLAGS"
CXXFLAGS="$DEBUG_CXXFLAGS $DEBUG_OPTIMIZE_CXX -DSAFE_MUTEX $CXXFLAGS"
CFLAGS="$DEBUG_CFLAGS $DEBUG_OPTIMIZE_CC -DDBUG_ON -DSAFE_MUTEX $CFLAGS"
CXXFLAGS="$DEBUG_CXXFLAGS $DEBUG_OPTIMIZE_CXX -DDBUG_ON -DSAFE_MUTEX $CXXFLAGS"
elif test "$with_debug" = "full"
then
# Full debug. Very slow in some cases
AC_DEFINE([DBUG_ON], [1], [Use libdbug])
CFLAGS="$DEBUG_CFLAGS -DSAFE_MUTEX -DSAFEMALLOC $CFLAGS"
CXXFLAGS="$DEBUG_CXXFLAGS -DSAFE_MUTEX -DSAFEMALLOC $CXXFLAGS"
CFLAGS="$DEBUG_CFLAGS -DDBUG_ON -DSAFE_MUTEX -DSAFEMALLOC $CFLAGS"
CXXFLAGS="$DEBUG_CXXFLAGS -DDBUG_ON -DSAFE_MUTEX -DSAFEMALLOC $CXXFLAGS"
else
# Optimized version. No debug
AC_DEFINE([DBUG_OFF], [1], [Don't use libdbug])
CFLAGS="$OPTIMIZE_CFLAGS $CFLAGS"
CXXFLAGS="$OPTIMIZE_CXXFLAGS $CXXFLAGS"
CFLAGS="$OPTIMIZE_CFLAGS -DDBUG_OFF $CFLAGS"
CXXFLAGS="$OPTIMIZE_CXXFLAGS -DDBUG_OFF $CXXFLAGS"
fi
# Force static compilation to avoid linking problems/get more speed
@ -2830,7 +2827,7 @@ AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl
cmd-line-utils/Makefile dnl
cmd-line-utils/libedit/Makefile dnl
zlib/Makefile dnl
cmd-line-utils/readline/Makefile)
cmd-line-utils/readline/Makefile win/Makefile)
AC_CONFIG_COMMANDS([default], , test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h)
AC_OUTPUT

5
dbug/CMakeLists.txt Executable file
View file

@ -0,0 +1,5 @@
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX -D__WIN32__")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
ADD_LIBRARY(dbug dbug.c factorial.c sanity.c)

View file

@ -22,7 +22,8 @@ noinst_HEADERS = dbug_long.h
libdbug_a_SOURCES = dbug.c sanity.c
EXTRA_DIST = example1.c example2.c example3.c \
user.r monty.doc readme.prof dbug_add_tags.pl \
my_main.c main.c factorial.c dbug_analyze.c
my_main.c main.c factorial.c dbug_analyze.c \
CMakeLists.txt
NROFF_INC = example1.r example2.r example3.r main.r \
factorial.r output1.r output2.r output3.r \
output4.r output5.r

View file

@ -66,13 +66,10 @@
* Check of malloc on entry/exit (option "S")
*/
#include <my_global.h>
/* This file won't compile unless DBUG_OFF is undefined locally */
#ifdef DBUG_OFF
#undef DBUG_OFF
#endif
#include <my_global.h>
#include <m_string.h>
#include <errno.h>
#if defined(MSDOS) || defined(__WIN__)

32
extra/CMakeLists.txt Executable file
View file

@ -0,0 +1,32 @@
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
ADD_EXECUTABLE(comp_err comp_err.c)
TARGET_LINK_LIBRARIES(comp_err dbug mysys strings wsock32)
GET_TARGET_PROPERTY(COMP_ERR_EXE comp_err LOCATION)
ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_SOURCE_DIR}/include/mysqld_error.h
COMMAND ${COMP_ERR_EXE}
--charset=${PROJECT_SOURCE_DIR}/sql/share/charsets
--out-dir=${PROJECT_SOURCE_DIR}/sql/share/
--header_file=${PROJECT_SOURCE_DIR}/include/mysqld_error.h
--name_file=${PROJECT_SOURCE_DIR}/include/mysqld_ername.h
--state_file=${PROJECT_SOURCE_DIR}/include/sql_state.h
--in_file=${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt
DEPENDS comp_err ${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt)
ADD_CUSTOM_TARGET(GenError
ALL
DEPENDS ${PROJECT_SOURCE_DIR}/include/mysqld_error.h)
ADD_EXECUTABLE(my_print_defaults my_print_defaults.c)
TARGET_LINK_LIBRARIES(my_print_defaults strings mysys dbug taocrypt odbc32 odbccp32 wsock32)
ADD_EXECUTABLE(perror perror.c)
TARGET_LINK_LIBRARIES(perror strings mysys dbug wsock32)
ADD_EXECUTABLE(replace replace.c)
TARGET_LINK_LIBRARIES(replace strings mysys dbug wsock32)

View file

@ -43,6 +43,7 @@ $(top_builddir)/include/sql_state.h: $(top_builddir)/include/mysqld_error.h
bin_PROGRAMS = replace comp_err perror resolveip my_print_defaults \
resolve_stack_dump mysql_waitpid innochecksum
noinst_PROGRAMS = charset2html
EXTRA_DIST = CMakeLists.txt
# Don't update the files from bitkeeper
%::SCCS/s.%

View file

@ -188,8 +188,9 @@ int main(int argc, char *argv[])
DBUG_RETURN(1);
}
clean_up(lang_head, error_head);
DBUG_LEAVE; /* we can't call my_end after DBUG_RETURN */
my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
DBUG_RETURN(0);
return(0);
}
}

6
extra/yassl/CMakeLists.txt Executable file
View file

@ -0,0 +1,6 @@
ADD_DEFINITIONS("-DWIN32 -D_LIB -DYASSL_PREFIX")
INCLUDE_DIRECTORIES(include taocrypt/include mySTL)
ADD_LIBRARY(yassl src/buffer.cpp src/cert_wrapper.cpp src/crypto_wrapper.cpp src/handshake.cpp src/lock.cpp
src/log.cpp src/socket_wrapper.cpp src/ssl.cpp src/timer.cpp src/yassl_error.cpp
src/yassl_imp.cpp src/yassl_int.cpp)

View file

@ -1,2 +1,2 @@
SUBDIRS = taocrypt src testsuite
EXTRA_DIST = yassl.dsp yassl.dsw $(wildcard mySTL/*.hpp)
EXTRA_DIST = yassl.dsp yassl.dsw $(wildcard mySTL/*.hpp) CMakeLists.txt

View file

@ -30,7 +30,7 @@ sub generate_prefix($$)
next;
}
if ( /^\s*[a-zA-Z0-9*_ ]+\s+([_a-zA-Z0-9]+)\s*\(/ )
if ( /^\s*[a-zA-Z0-9*_ ]+\s+\*?([_a-zA-Z0-9]+)\s*\(/ )
{
print OUT "#define $1 ya$1\n";
}

View file

@ -1,5 +1,6 @@
#define Copyright yaCopyright
#define yaSSL_CleanUp yayaSSL_CleanUp
#define BN_bin2bn yaBN_bin2bn
#define DH_new yaDH_new
#define DH_free yaDH_free
#define RSA_free yaRSA_free
@ -92,6 +93,12 @@
#define SSL_want_read yaSSL_want_read
#define SSL_want_write yaSSL_want_write
#define SSL_pending yaSSL_pending
#define SSLv3_method yaSSLv3_method
#define SSLv3_server_method yaSSLv3_server_method
#define SSLv3_client_method yaSSLv3_client_method
#define TLSv1_server_method yaTLSv1_server_method
#define TLSv1_client_method yaTLSv1_client_method
#define SSLv23_server_method yaSSLv23_server_method
#define SSL_CTX_use_certificate_file yaSSL_CTX_use_certificate_file
#define SSL_CTX_use_PrivateKey_file yaSSL_CTX_use_PrivateKey_file
#define SSL_CTX_set_cipher_list yaSSL_CTX_set_cipher_list
@ -115,11 +122,13 @@
#define RAND_write_file yaRAND_write_file
#define RAND_load_file yaRAND_load_file
#define RAND_status yaRAND_status
#define RAND_bytes yaRAND_bytes
#define DES_set_key yaDES_set_key
#define DES_set_odd_parity yaDES_set_odd_parity
#define DES_ecb_encrypt yaDES_ecb_encrypt
#define SSL_CTX_set_default_passwd_cb_userdata yaSSL_CTX_set_default_passwd_cb_userdata
#define SSL_SESSION_free yaSSL_SESSION_free
#define SSL_peek yaSSL_peek
#define SSL_get_certificate yaSSL_get_certificate
#define SSL_get_privatekey yaSSL_get_privatekey
#define X509_get_pubkey yaX509_get_pubkey

View file

@ -0,0 +1,10 @@
INCLUDE_DIRECTORIES(../mySTL include)
ADD_LIBRARY(taocrypt src/aes.cpp src/aestables.cpp src/algebra.cpp src/arc4.cpp src/asn.cpp src/coding.cpp
src/des.cpp src/dh.cpp src/dsa.cpp src/file.cpp src/hash.cpp src/integer.cpp src/md2.cpp
src/md4.cpp src/md5.cpp src/misc.cpp src/random.cpp src/ripemd.cpp src/rsa.cpp src/sha.cpp
include/aes.hpp include/algebra.hpp include/arc4.hpp include/asn.hpp include/block.hpp
include/coding.hpp include/des.hpp include/dh.hpp include/dsa.hpp include/dsa.hpp
include/error.hpp include/file.hpp include/hash.hpp include/hmac.hpp include/integer.hpp
include/md2.hpp include/md5.hpp include/misc.hpp include/modarith.hpp include/modes.hpp
include/random.hpp include/ripemd.hpp include/rsa.hpp include/sha.hpp)

View file

@ -1,2 +1,2 @@
SUBDIRS = src test benchmark
EXTRA_DIST = taocrypt.dsw taocrypt.dsp
EXTRA_DIST = taocrypt.dsw taocrypt.dsp CMakeLists.txt

View file

@ -29,7 +29,7 @@
#include "runtime.hpp"
#include "misc.hpp"
#if !defined(YASSL_MYSQL_COMPATIBLE)
extern "C" {
// for libcurl configure test, these are the signatures they use
@ -37,6 +37,7 @@ extern "C" {
char CRYPTO_lock() { return 0;}
char CRYPTO_add_lock() { return 0;}
} // extern "C"
#endif
#ifdef YASSL_PURE_C

8
heap/CMakeLists.txt Executable file
View file

@ -0,0 +1,8 @@
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
ADD_LIBRARY(heap _check.c _rectest.c hp_block.c hp_clear.c hp_close.c hp_create.c
hp_delete.c hp_extra.c hp_hash.c hp_info.c hp_open.c hp_panic.c
hp_rename.c hp_rfirst.c hp_rkey.c hp_rlast.c hp_rnext.c hp_rprev.c
hp_rrnd.c hp_rsame.c hp_scan.c hp_static.c hp_update.c hp_write.c)

View file

@ -28,6 +28,6 @@ libheap_a_SOURCES = hp_open.c hp_extra.c hp_close.c hp_panic.c hp_info.c \
hp_rnext.c hp_rlast.c hp_rprev.c hp_clear.c \
hp_rkey.c hp_block.c \
hp_hash.c _check.c _rectest.c hp_static.c
EXTRA_DIST = CMakeLists.txt
# Don't update the files from bitkeeper
%::SCCS/s.%

View file

@ -97,6 +97,7 @@ extern void _db_unlock_file(void);
#define DBUG_UNLOCK_FILE
#define DBUG_OUTPUT(A)
#define DBUG_ASSERT(A) {}
#define DBUG_LEAVE
#endif
#ifdef __cplusplus
}

View file

@ -165,7 +165,6 @@ struct st_mysql_options {
char *ssl_ca; /* PEM CA file */
char *ssl_capath; /* PEM directory of CA-s? */
char *ssl_cipher; /* cipher to use */
my_bool ssl_verify_server_cert; /* if to verify server cert */
char *shared_memory_base_name;
unsigned long max_allowed_packet;
my_bool use_ssl; /* if to use SSL or not */

View file

@ -134,8 +134,10 @@ enum enum_server_command
#define CLIENT_TRANSACTIONS 8192 /* Client knows about transactions */
#define CLIENT_RESERVED 16384 /* Old flag for 4.1 protocol */
#define CLIENT_SECURE_CONNECTION 32768 /* New 4.1 authentication */
#define CLIENT_MULTI_STATEMENTS 65536 /* Enable/disable multi-stmt support */
#define CLIENT_MULTI_RESULTS 131072 /* Enable/disable multi-results */
#define CLIENT_MULTI_STATEMENTS (((ulong) 1) << 16) /* Enable/disable multi-stmt support */
#define CLIENT_MULTI_RESULTS (((ulong) 1) << 17) /* Enable/disable multi-results */
#define CLIENT_SSL_VERIFY_SERVER_CERT (((ulong) 1) << 30)
#define CLIENT_REMEMBER_OPTIONS (((ulong) 1) << 31)
#define SERVER_STATUS_IN_TRANS 1 /* Transaction has started */
@ -209,7 +211,13 @@ typedef struct st_net {
char last_error[MYSQL_ERRMSG_SIZE], sqlstate[SQLSTATE_LENGTH+1];
unsigned int last_errno;
unsigned char error;
/*
'query_cache_query' should be accessed only via query cache
functions and methods to maintain proper locking.
*/
gptr query_cache_query;
my_bool report_error; /* We should report error (we have unreported error) */
my_bool return_errno;
} NET;

35
innobase/CMakeLists.txt Executable file
View file

@ -0,0 +1,35 @@
#SET(CMAKE_CXX_FLAGS_DEBUG "-DSAFEMALLOC -DSAFE_MUTEX")
#SET(CMAKE_C_FLAGS_DEBUG "-DSAFEMALLOC -DSAFE_MUTEX")
ADD_DEFINITIONS(-DMYSQL_SERVER -D_WIN32 -DWIN32 -D_LIB)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include include)
ADD_LIBRARY(innobase btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c btr/btr0sea.c
buf/buf0buf.c buf/buf0flu.c buf/buf0lru.c buf/buf0rea.c
data/data0data.c data/data0type.c
dict/dict0boot.c dict/dict0crea.c dict/dict0dict.c dict/dict0load.c dict/dict0mem.c
dyn/dyn0dyn.c
eval/eval0eval.c eval/eval0proc.c
fil/fil0fil.c
fsp/fsp0fsp.c
fut/fut0fut.c fut/fut0lst.c
ha/ha0ha.c ha/hash0hash.c
ibuf/ibuf0ibuf.c
pars/lexyy.c pars/pars0grm.c pars/pars0opt.c pars/pars0pars.c pars/pars0sym.c
lock/lock0lock.c
log/log0log.c log/log0recv.c
mach/mach0data.c
mem/mem0mem.c mem/mem0pool.c
mtr/mtr0log.c mtr/mtr0mtr.c
os/os0file.c os/os0proc.c os/os0sync.c os/os0thread.c
page/page0cur.c page/page0page.c
que/que0que.c
read/read0read.c
rem/rem0cmp.c rem/rem0rec.c
row/row0ins.c row/row0mysql.c row/row0purge.c row/row0row.c row/row0sel.c row/row0uins.c
row/row0umod.c row/row0undo.c row/row0upd.c row/row0vers.c
srv/srv0que.c srv/srv0srv.c srv/srv0start.c
sync/sync0arr.c sync/sync0rw.c sync/sync0sync.c
thr/thr0loc.c
trx/trx0purge.c trx/trx0rec.c trx/trx0roll.c trx/trx0rseg.c trx/trx0sys.c trx/trx0trx.c trx/trx0undo.c
usr/usr0sess.c
ut/ut0byte.c ut/ut0dbg.c ut/ut0mem.c ut/ut0rnd.c ut/ut0ut.c )

View file

@ -25,6 +25,7 @@ noinst_HEADERS = ib_config.h
SUBDIRS = os ut btr buf data dict dyn eval fil fsp fut \
ha ibuf include lock log mach mem mtr page \
pars que read rem row srv sync thr trx usr
EXTRA_DIST = CMakeLists.txt
# Don't update the files from bitkeeper
%::SCCS/s.%

54
libmysql/CMakeLists.txt Executable file
View file

@ -0,0 +1,54 @@
# Need to set USE_TLS, since __declspec(thread) approach to thread local
# storage does not work properly in DLLs.
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX -DUSE_TLS")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX -DUSE_TLS")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/zlib
${CMAKE_SOURCE_DIR}/extra/yassl/include
${CMAKE_SOURCE_DIR}/libmysql
${CMAKE_SOURCE_DIR}/regex
${CMAKE_SOURCE_DIR}/sql
${CMAKE_SOURCE_DIR}/strings)
ADD_LIBRARY(libmysql SHARED dll.c libmysql.def
../mysys/array.c ../strings/bchange.c ../strings/bmove.c
../strings/bmove_upp.c ../mysys/charset-def.c ../mysys/charset.c
../sql-common/client.c ../strings/ctype-big5.c ../strings/ctype-bin.c
../strings/ctype-cp932.c ../strings/ctype-czech.c ../strings/ctype-euc_kr.c
../strings/ctype-eucjpms.c ../strings/ctype-extra.c ../strings/ctype-gb2312.c
../strings/ctype-gbk.c ../strings/ctype-latin1.c ../strings/ctype-mb.c
../strings/ctype-simple.c ../strings/ctype-sjis.c ../strings/ctype-tis620.c
../strings/ctype-uca.c ../strings/ctype-ucs2.c ../strings/ctype-ujis.c
../strings/ctype-utf8.c ../strings/ctype-win1250ch.c ../strings/ctype.c
../mysys/default.c ../libmysql/errmsg.c ../mysys/errors.c
../libmysql/get_password.c ../strings/int2str.c ../strings/is_prefix.c
../libmysql/libmysql.c ../mysys/list.c ../strings/llstr.c
../strings/longlong2str.c ../libmysql/manager.c ../mysys/mf_cache.c
../mysys/mf_dirname.c ../mysys/mf_fn_ext.c ../mysys/mf_format.c
../mysys/mf_iocache.c ../mysys/mf_iocache2.c ../mysys/mf_loadpath.c
../mysys/mf_pack.c ../mysys/mf_path.c ../mysys/mf_tempfile.c ../mysys/mf_unixpath.c
../mysys/mf_wcomp.c ../mysys/mulalloc.c ../mysys/my_access.c ../mysys/my_alloc.c
../mysys/my_chsize.c ../mysys/my_compress.c ../mysys/my_create.c
../mysys/my_delete.c ../mysys/my_div.c ../mysys/my_error.c ../mysys/my_file.c
../mysys/my_fopen.c ../mysys/my_fstream.c ../mysys/my_gethostbyname.c
../mysys/my_getopt.c ../mysys/my_getwd.c ../mysys/my_init.c ../mysys/my_lib.c
../mysys/my_malloc.c ../mysys/my_messnc.c ../mysys/my_net.c ../mysys/my_once.c
../mysys/my_open.c ../mysys/my_pread.c ../mysys/my_pthread.c ../mysys/my_read.c
../mysys/my_realloc.c ../mysys/my_rename.c ../mysys/my_seek.c
../mysys/my_static.c ../strings/my_strtoll10.c ../mysys/my_symlink.c
../mysys/my_symlink2.c ../mysys/my_thr_init.c ../sql-common/my_time.c
../strings/my_vsnprintf.c ../mysys/my_wincond.c ../mysys/my_winthread.c
../mysys/my_write.c ../sql/net_serv.cc ../sql-common/pack.c ../sql/password.c
../mysys/safemalloc.c ../mysys/sha1.c ../strings/str2int.c
../strings/str_alloc.c ../strings/strcend.c ../strings/strcont.c ../strings/strend.c
../strings/strfill.c ../mysys/string.c ../strings/strinstr.c ../strings/strmake.c
../strings/strmov.c ../strings/strnlen.c ../strings/strnmov.c ../strings/strtod.c
../strings/strtoll.c ../strings/strtoull.c ../strings/strxmov.c ../strings/strxnmov.c
../mysys/thr_mutex.c ../mysys/typelib.c ../vio/vio.c ../vio/viosocket.c
../vio/viossl.c ../vio/viosslfactories.c ../strings/xml.c)
ADD_DEPENDENCIES(libmysql dbug vio mysys strings GenError zlib yassl taocrypt)
TARGET_LINK_LIBRARIES(libmysql mysys strings wsock32)
ADD_EXECUTABLE(myTest mytest.c)
TARGET_LINK_LIBRARIES(myTest libmysql)

View file

@ -31,7 +31,7 @@ include $(srcdir)/Makefile.shared
libmysqlclient_la_SOURCES = $(target_sources)
libmysqlclient_la_LIBADD = $(target_libadd) $(yassl_las)
libmysqlclient_la_LDFLAGS = $(target_ldflags)
EXTRA_DIST = Makefile.shared libmysql.def
EXTRA_DIST = Makefile.shared libmysql.def dll.c mytest.c CMakeLists.txt
noinst_HEADERS = client_settings.h
# This is called from the toplevel makefile

175
libmysql/mytest.c Normal file
View file

@ -0,0 +1,175 @@
/*C4*/
/****************************************************************/
/* Author: Jethro Wright, III TS : 3/ 4/1998 9:15 */
/* Date: 02/18/1998 */
/* mytest.c : do some testing of the libmySQL.DLL.... */
/* */
/* History: */
/* 02/18/1998 jw3 also sprach zarathustra.... */
/****************************************************************/
#include <windows.h>
#include <stdio.h>
#include <string.h>
#include <mysql.h>
#define DEFALT_SQL_STMT "SELECT * FROM db"
#ifndef offsetof
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
#endif
/********************************************************
**
** main :-
**
********************************************************/
int
main( int argc, char * argv[] )
{
char szSQL[ 200 ], aszFlds[ 25 ][ 25 ], szDB[ 50 ] ;
const char *pszT;
int i, j, k, l, x ;
MYSQL * myData ;
MYSQL_RES * res ;
MYSQL_FIELD * fd ;
MYSQL_ROW row ;
//....just curious....
printf( "sizeof( MYSQL ) == %d\n", (int) sizeof( MYSQL ) ) ;
if ( argc == 2 )
{
strcpy( szDB, argv[ 1 ] ) ;
strcpy( szSQL, DEFALT_SQL_STMT ) ;
if (!strcmp(szDB,"--debug"))
{
strcpy( szDB, "mysql" ) ;
printf("Some mysql struct information (size and offset):\n");
printf("net:\t%3d %3d\n",(int) sizeof(myData->net),
(int) offsetof(MYSQL,net));
printf("host:\t%3d %3d\n",(int) sizeof(myData->host),
(int) offsetof(MYSQL,host));
printf("port:\t%3d %3d\n", (int) sizeof(myData->port),
(int) offsetof(MYSQL,port));
printf("protocol_version:\t%3d %3d\n",
(int) sizeof(myData->protocol_version),
(int) offsetof(MYSQL,protocol_version));
printf("thread_id:\t%3d %3d\n",(int) sizeof(myData->thread_id),
(int) offsetof(MYSQL,thread_id));
printf("affected_rows:\t%3d %3d\n",(int) sizeof(myData->affected_rows),
(int) offsetof(MYSQL,affected_rows));
printf("packet_length:\t%3d %3d\n",(int) sizeof(myData->packet_length),
(int) offsetof(MYSQL,packet_length));
printf("status:\t%3d %3d\n",(int) sizeof(myData->status),
(int) offsetof(MYSQL,status));
printf("fields:\t%3d %3d\n",(int) sizeof(myData->fields),
(int) offsetof(MYSQL,fields));
printf("field_alloc:\t%3d %3d\n",(int) sizeof(myData->field_alloc),
(int) offsetof(MYSQL,field_alloc));
printf("free_me:\t%3d %3d\n",(int) sizeof(myData->free_me),
(int) offsetof(MYSQL,free_me));
printf("options:\t%3d %3d\n",(int) sizeof(myData->options),
(int) offsetof(MYSQL,options));
puts("");
}
}
else if ( argc > 2 ) {
strcpy( szDB, argv[ 1 ] ) ;
strcpy( szSQL, argv[ 2 ] ) ;
}
else {
strcpy( szDB, "mysql" ) ;
strcpy( szSQL, DEFALT_SQL_STMT ) ;
}
//....
if ( (myData = mysql_init((MYSQL*) 0)) &&
mysql_real_connect( myData, NULL, NULL, NULL, NULL, MYSQL_PORT,
NULL, 0 ) )
{
myData->reconnect= 1;
if ( mysql_select_db( myData, szDB ) < 0 ) {
printf( "Can't select the %s database !\n", szDB ) ;
mysql_close( myData ) ;
return 2 ;
}
}
else {
printf( "Can't connect to the mysql server on port %d !\n",
MYSQL_PORT ) ;
mysql_close( myData ) ;
return 1 ;
}
//....
if ( ! mysql_query( myData, szSQL ) ) {
res = mysql_store_result( myData ) ;
i = (int) mysql_num_rows( res ) ; l = 1 ;
printf( "Query: %s\nNumber of records found: %ld\n", szSQL, i ) ;
//....we can get the field-specific characteristics here....
for ( x = 0 ; fd = mysql_fetch_field( res ) ; x++ )
strcpy( aszFlds[ x ], fd->name ) ;
//....
while ( row = mysql_fetch_row( res ) ) {
j = mysql_num_fields( res ) ;
printf( "Record #%ld:-\n", l++ ) ;
for ( k = 0 ; k < j ; k++ )
printf( " Fld #%d (%s): %s\n", k + 1, aszFlds[ k ],
(((row[k]==NULL)||(!strlen(row[k])))?"NULL":row[k])) ;
puts( "==============================\n" ) ;
}
mysql_free_result( res ) ;
}
else printf( "Couldn't execute %s on the server !\n", szSQL ) ;
//....
puts( "==== Diagnostic info ====" ) ;
pszT = mysql_get_client_info() ;
printf( "Client info: %s\n", pszT ) ;
//....
pszT = mysql_get_host_info( myData ) ;
printf( "Host info: %s\n", pszT ) ;
//....
pszT = mysql_get_server_info( myData ) ;
printf( "Server info: %s\n", pszT ) ;
//....
res = mysql_list_processes( myData ) ; l = 1 ;
if (res)
{
for ( x = 0 ; fd = mysql_fetch_field( res ) ; x++ )
strcpy( aszFlds[ x ], fd->name ) ;
while ( row = mysql_fetch_row( res ) ) {
j = mysql_num_fields( res ) ;
printf( "Process #%ld:-\n", l++ ) ;
for ( k = 0 ; k < j ; k++ )
printf( " Fld #%d (%s): %s\n", k + 1, aszFlds[ k ],
(((row[k]==NULL)||(!strlen(row[k])))?"NULL":row[k])) ;
puts( "==============================\n" ) ;
}
}
else
{
printf("Got error %s when retreiving processlist\n",mysql_error(myData));
}
//....
res = mysql_list_tables( myData, "%" ) ; l = 1 ;
for ( x = 0 ; fd = mysql_fetch_field( res ) ; x++ )
strcpy( aszFlds[ x ], fd->name ) ;
while ( row = mysql_fetch_row( res ) ) {
j = mysql_num_fields( res ) ;
printf( "Table #%ld:-\n", l++ ) ;
for ( k = 0 ; k < j ; k++ )
printf( " Fld #%d (%s): %s\n", k + 1, aszFlds[ k ],
(((row[k]==NULL)||(!strlen(row[k])))?"NULL":row[k])) ;
puts( "==============================\n" ) ;
}
//....
pszT = mysql_stat( myData ) ;
puts( pszT ) ;
//....
mysql_close( myData ) ;
return 0 ;
}

View file

@ -163,3 +163,4 @@ EXPORTS
my_charset_bin
my_charset_same
modify_defaults_file
mysql_set_server_option

26
myisam/CMakeLists.txt Executable file
View file

@ -0,0 +1,26 @@
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
ADD_LIBRARY(myisam ft_boolean_search.c ft_nlq_search.c ft_parser.c ft_static.c ft_stem.c
ft_stopwords.c ft_update.c mi_cache.c mi_changed.c mi_check.c
mi_checksum.c mi_close.c mi_create.c mi_dbug.c mi_delete.c
mi_delete_all.c mi_delete_table.c mi_dynrec.c mi_extra.c mi_info.c
mi_key.c mi_keycache.c mi_locking.c mi_log.c mi_open.c
mi_packrec.c mi_page.c mi_panic.c mi_preload.c mi_range.c mi_rename.c
mi_rfirst.c mi_rlast.c mi_rnext.c mi_rnext_same.c mi_rprev.c mi_rrnd.c
mi_rsame.c mi_rsamepos.c mi_scan.c mi_search.c mi_static.c mi_statrec.c
mi_unique.c mi_update.c mi_write.c rt_index.c rt_key.c rt_mbr.c
rt_split.c sort.c sp_key.c ft_eval.h myisamdef.h rt_index.h mi_rkey.c)
ADD_EXECUTABLE(myisam_ftdump myisam_ftdump.c)
TARGET_LINK_LIBRARIES(myisam_ftdump myisam mysys dbug strings zlib wsock32)
ADD_EXECUTABLE(myisamchk myisamchk.c)
TARGET_LINK_LIBRARIES(myisamchk myisam mysys dbug strings zlib wsock32)
ADD_EXECUTABLE(myisamlog myisamlog.c)
TARGET_LINK_LIBRARIES(myisamlog myisam mysys dbug strings zlib wsock32)
ADD_EXECUTABLE(myisampack myisampack.c)
TARGET_LINK_LIBRARIES(myisampack myisam mysys dbug strings zlib wsock32)

View file

@ -14,7 +14,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
EXTRA_DIST = mi_test_all.sh mi_test_all.res
EXTRA_DIST = mi_test_all.sh mi_test_all.res ft_stem.c CMakeLists.txt
pkgdata_DATA = mi_test_all mi_test_all.res
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include

9
myisammrg/CMakeLists.txt Executable file
View file

@ -0,0 +1,9 @@
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
ADD_LIBRARY(myisammrg myrg_close.c myrg_create.c myrg_delete.c myrg_extra.c myrg_info.c
myrg_locking.c myrg_open.c myrg_panic.c myrg_queue.c myrg_range.c
myrg_rfirst.c myrg_rkey.c myrg_rlast.c myrg_rnext.c myrg_rnext_same.c
myrg_rprev.c myrg_rrnd.c myrg_rsame.c myrg_static.c myrg_update.c
myrg_write.c)

View file

@ -23,6 +23,6 @@ libmyisammrg_a_SOURCES = myrg_open.c myrg_extra.c myrg_info.c myrg_locking.c \
myrg_rkey.c myrg_rfirst.c myrg_rlast.c myrg_rnext.c \
myrg_rprev.c myrg_queue.c myrg_write.c myrg_range.c \
myrg_rnext_same.c
EXTRA_DIST = CMakeLists.txt
# Don't update the files from bitkeeper
%::SCCS/s.%

View file

@ -34,7 +34,7 @@ benchdir_root= $(prefix)
testdir = $(benchdir_root)/mysql-test
EXTRA_SCRIPTS = mysql-test-run.sh install_test_db.sh valgrind.supp $(PRESCRIPTS)
EXTRA_DIST = $(EXTRA_SCRIPTS)
GENSCRIPTS = mysql-test-run install_test_db
GENSCRIPTS = mysql-test-run install_test_db mtr
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 \
@ -112,6 +112,11 @@ std_data/server-cert.pem: $(top_srcdir)/SSL/$(@F)
std_data/server-key.pem: $(top_srcdir)/SSL/$(@F)
@RM@ -f $@; @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data
# mtr - a shortcut for executing mysql-test-run.pl
mtr:
$(RM) -f mtr
$(LN_S) mysql-test-run.pl mtr
SUFFIXES = .sh
.sh:

View file

@ -2,10 +2,6 @@
# that ensure that starting conditions (environment) for the IM-test are as
# expected.
# Wait for mysqld1 (guarded instance) to start.
--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD1_PATH_PID 30 started
# Check the running instances.
--connect (mysql1_con,localhost,root,,mysql,$IM_MYSQLD1_PORT,$IM_MYSQLD1_SOCK)
@ -14,6 +10,8 @@
SHOW VARIABLES LIKE 'server_id';
--source include/not_windows.inc
--connection default
# Let IM detect that mysqld1 is online. This delay should be longer than

View file

@ -1,7 +0,0 @@
--connect (dflt_server_con,localhost,root,,mysql,$IM_MYSQLD1_PORT,$IM_MYSQLD1_SOCK)
--connection dflt_server_con
--source include/not_windows.inc
--connection default
--disconnect dflt_server_con

View file

@ -82,7 +82,7 @@ sub collect_test_cases ($) {
if ( $mysqld_test_exists and $im_test_exists )
{
mtr_error("Ambiguos test case name ($tname)");
mtr_error("Ambiguous test case name ($tname)");
}
elsif ( ! $mysqld_test_exists and ! $im_test_exists )
{
@ -154,34 +154,38 @@ sub collect_test_cases ($) {
if ( $::opt_reorder )
{
@$cases = sort {
if ( ! $a->{'master_restart'} and ! $b->{'master_restart'} )
{
return $a->{'name'} cmp $b->{'name'};
}
if ( $a->{'master_restart'} and $b->{'master_restart'} )
{
my $cmp= mtr_cmp_opts($a->{'master_opt'}, $b->{'master_opt'});
if ( $cmp == 0 )
{
return $a->{'name'} cmp $b->{'name'};
}
else
{
return $cmp;
}
}
my %sort_criteria;
my $tinfo;
if ( $a->{'master_restart'} )
{
return 1; # Is greater
}
else
{
return -1; # Is less
}
} @$cases;
# Make a mapping of test name to a string that represents how that test
# should be sorted among the other tests. Put the most important criterion
# first, then a sub-criterion, then sub-sub-criterion, et c.
foreach $tinfo (@$cases)
{
my @this_criteria = ();
# Append the criteria for sorting, in order of importance.
push(@this_criteria, join("!", sort @{$tinfo->{'master_opt'}}) . "~"); # Ending with "~" makes empty sort later than filled
push(@this_criteria, "ndb=" . ($tinfo->{'ndb_test'} ? "1" : "0"));
push(@this_criteria, "restart=" . ($tinfo->{'master_restart'} ? "1" : "0"));
push(@this_criteria, "big_test=" . ($tinfo->{'big_test'} ? "1" : "0"));
push(@this_criteria, join("|", sort keys %{$tinfo})); # Group similar things together. The values may differ substantially. FIXME?
push(@this_criteria, $tinfo->{'name'}); # Finally, order by the name
$sort_criteria{$tinfo->{"name"}} = join(" ", @this_criteria);
}
@$cases = sort { $sort_criteria{$a->{"name"}} cmp $sort_criteria{$b->{"name"}}; } @$cases;
### For debugging the sort-order
# foreach $tinfo (@$cases)
# {
# print $sort_criteria{$tinfo->{"name"}};
# print " -> \t";
# print $tinfo->{"name"};
# print "\n";
# }
}
return $cases;

View file

@ -19,13 +19,39 @@ sub mtr_tonewfile($@);
##############################################################################
sub mtr_get_pid_from_file ($) {
my $file= shift;
my $pid_file_path= shift;
my $TOTAL_ATTEMPTS= 30;
my $timeout= 1;
open(FILE,"<",$file) or mtr_error("can't open file \"$file\": $!");
my $pid= <FILE>;
chomp($pid);
close FILE;
return $pid;
# We should read from the file until we get correct pid. As it is
# stated in BUG#21884, pid file can be empty at some moment. So, we should
# read it until we get valid data.
for (my $cur_attempt= 1; $cur_attempt <= $TOTAL_ATTEMPTS; ++$cur_attempt)
{
mtr_debug("Reading pid file '$pid_file_path' " .
"($cur_attempt of $TOTAL_ATTEMPTS)...");
open(FILE, '<', $pid_file_path)
or mtr_error("can't open file \"$pid_file_path\": $!");
my $pid= <FILE>;
chomp($pid) if defined $pid;
close FILE;
return $pid if defined $pid && $pid ne '';
mtr_debug("Pid file '$pid_file_path' is empty. " .
"Sleeping $timeout second(s)...");
sleep(1);
}
mtr_error("Pid file '$pid_file_path' is corrupted. " .
"Can not retrieve PID in " .
($timeout * $TOTAL_ATTEMPTS) . " seconds.");
}
sub mtr_get_opts_from_file ($) {

View file

@ -20,7 +20,29 @@ sub mtr_record_dead_children ();
sub mtr_exit ($);
sub sleep_until_file_created ($$$);
sub mtr_kill_processes ($);
sub mtr_kill_process ($$$$);
sub mtr_ping_mysqld_server ($);
# Private IM-related operations.
sub mtr_im_kill_process ($$$$);
sub mtr_im_load_pids ($);
sub mtr_im_terminate ($);
sub mtr_im_check_alive ($);
sub mtr_im_check_main_alive ($);
sub mtr_im_check_angel_alive ($);
sub mtr_im_check_mysqlds_alive ($);
sub mtr_im_check_mysqld_alive ($$);
sub mtr_im_cleanup ($);
sub mtr_im_rm_file ($);
sub mtr_im_errlog ($);
sub mtr_im_kill ($);
sub mtr_im_wait_for_connection ($$$);
sub mtr_im_wait_for_mysqld($$$);
# Public IM-related operations.
sub mtr_im_start ($$);
sub mtr_im_stop ($);
# static in C
sub spawn_impl ($$$$$$$$);
@ -359,40 +381,54 @@ sub mtr_process_exit_status {
sub mtr_kill_leftovers () {
# First, kill all masters and slaves that would conflict with
# this run. Make sure to remove the PID file, if any.
# FIXME kill IM manager first, else it will restart the servers, how?!
mtr_debug("mtr_kill_leftovers(): started.");
mtr_im_stop($::instance_manager);
# Kill mysqld servers (masters and slaves) that would conflict with this
# run. Make sure to remove the PID file, if any.
# Don't touch IM-managed mysqld instances -- they should be stopped by
# mtr_im_stop().
mtr_debug("Collecting mysqld-instances to shutdown...");
my @args;
for ( my $idx; $idx < 2; $idx++ )
for ( my $idx= 0; $idx < 2; $idx++ )
{
my $pidfile= $::master->[$idx]->{'path_mypid'};
my $sockfile= $::master->[$idx]->{'path_mysock'};
my $port= $::master->[$idx]->{'path_myport'};
push(@args,{
pid => 0, # We don't know the PID
pidfile => $::instance_manager->{'instances'}->[$idx]->{'path_pid'},
sockfile => $::instance_manager->{'instances'}->[$idx]->{'path_sock'},
port => $::instance_manager->{'instances'}->[$idx]->{'port'},
pidfile => $pidfile,
sockfile => $sockfile,
port => $port,
});
mtr_debug(" - Master mysqld " .
"(idx: $idx; pid: '$pidfile'; socket: '$sockfile'; port: $port)");
$::master->[$idx]->{'pid'}= 0; # Assume we are done with it
}
for ( my $idx; $idx < 2; $idx++ )
for ( my $idx= 0; $idx < 3; $idx++ )
{
push(@args,{
pid => 0, # We don't know the PID
pidfile => $::master->[$idx]->{'path_mypid'},
sockfile => $::master->[$idx]->{'path_mysock'},
port => $::master->[$idx]->{'path_myport'},
});
}
my $pidfile= $::slave->[$idx]->{'path_mypid'};
my $sockfile= $::slave->[$idx]->{'path_mysock'};
my $port= $::slave->[$idx]->{'path_myport'};
for ( my $idx; $idx < 3; $idx++ )
{
push(@args,{
pid => 0, # We don't know the PID
pidfile => $::slave->[$idx]->{'path_mypid'},
sockfile => $::slave->[$idx]->{'path_mysock'},
port => $::slave->[$idx]->{'path_myport'},
pidfile => $pidfile,
sockfile => $sockfile,
port => $port,
});
mtr_debug(" - Slave mysqld " .
"(idx: $idx; pid: '$pidfile'; socket: '$sockfile'; port: $port)");
$::slave->[$idx]->{'pid'}= 0; # Assume we are done with it
}
mtr_mysqladmin_shutdown(\@args, 20);
@ -413,6 +449,8 @@ sub mtr_kill_leftovers () {
# FIXME $path_run_dir or something
my $rundir= "$::opt_vardir/run";
mtr_debug("Processing PID files in directory '$rundir'...");
if ( -d $rundir )
{
opendir(RUNDIR, $rundir)
@ -426,8 +464,12 @@ sub mtr_kill_leftovers () {
if ( -f $pidfile )
{
mtr_debug("Processing PID file: '$pidfile'...");
my $pid= mtr_get_pid_from_file($pidfile);
mtr_debug("Got pid: $pid from file '$pidfile'");
# Race, could have been removed between I tested with -f
# and the unlink() below, so I better check again with -f
@ -438,14 +480,24 @@ sub mtr_kill_leftovers () {
if ( $::glob_cygwin_perl or kill(0, $pid) )
{
mtr_debug("There is process with pid $pid -- scheduling for kill.");
push(@pids, $pid); # We know (cygwin guess) it exists
}
else
{
mtr_debug("There is no process with pid $pid -- skipping.");
}
}
}
closedir(RUNDIR);
if ( @pids )
{
mtr_debug("Killing the following processes with PID files: " .
join(' ', @pids) . "...");
start_reap_all();
if ( $::glob_cygwin_perl )
{
# We have no (easy) way of knowing the Cygwin controlling
@ -459,6 +511,7 @@ sub mtr_kill_leftovers () {
my $retries= 10; # 10 seconds
do
{
mtr_debug("Sending SIGKILL to pids: " . join(' ', @pids));
kill(9, @pids);
mtr_debug("Sleep 1 second waiting for processes to die");
sleep(1) # Wait one second
@ -469,19 +522,29 @@ sub mtr_kill_leftovers () {
mtr_warning("can't kill process(es) " . join(" ", @pids));
}
}
stop_reap_all();
}
}
else
{
mtr_debug("Directory for PID files ($rundir) does not exist.");
}
# We may have failed everything, bug we now check again if we have
# the listen ports free to use, and if they are free, just go for it.
mtr_debug("Checking known mysqld servers...");
foreach my $srv ( @args )
{
if ( mtr_ping_mysqld_server($srv->{'port'}, $srv->{'sockfile'}) )
if ( mtr_ping_mysqld_server($srv->{'port'}) )
{
mtr_warning("can't kill old mysqld holding port $srv->{'port'}");
}
}
mtr_debug("mtr_kill_leftovers(): finished.");
}
##############################################################################
@ -653,10 +716,15 @@ sub mtr_mysqladmin_shutdown {
my %mysql_admin_pids;
my @to_kill_specs;
mtr_debug("mtr_mysqladmin_shutdown(): starting...");
mtr_debug("Collecting mysqld-instances to shutdown...");
foreach my $srv ( @$spec )
{
if ( mtr_ping_mysqld_server($srv->{'port'}, $srv->{'sockfile'}) )
if ( mtr_ping_mysqld_server($srv->{'port'}) )
{
mtr_debug("Mysqld (port: $srv->{port}) needs to be stopped.");
push(@to_kill_specs, $srv);
}
}
@ -688,6 +756,9 @@ sub mtr_mysqladmin_shutdown {
mtr_add_arg($args, "--shutdown_timeout=$adm_shutdown_tmo");
mtr_add_arg($args, "shutdown");
mtr_debug("Shutting down mysqld " .
"(port: $srv->{port}; socket: '$srv->{sockfile}')...");
my $path_mysqladmin_log= "$::opt_vardir/log/mysqladmin.log";
my $pid= mtr_spawn($::exe_mysqladmin, $args,
"", $path_mysqladmin_log, $path_mysqladmin_log, "",
@ -719,14 +790,18 @@ sub mtr_mysqladmin_shutdown {
my $res= 1; # If we just fall through, we are done
# in the sense that the servers don't
# listen to their ports any longer
mtr_debug("Waiting for mysqld servers to stop...");
TIME:
while ( $timeout-- )
{
foreach my $srv ( @to_kill_specs )
{
$res= 1; # We are optimistic
if ( mtr_ping_mysqld_server($srv->{'port'}, $srv->{'sockfile'}) )
if ( mtr_ping_mysqld_server($srv->{'port'}) )
{
mtr_debug("Mysqld (port: $srv->{port}) is still alive.");
mtr_debug("Sleep 1 second waiting for processes to stop using port");
sleep(1); # One second
$res= 0;
@ -736,7 +811,14 @@ sub mtr_mysqladmin_shutdown {
last; # If we got here, we are done
}
$timeout or mtr_debug("At least one server is still listening to its port");
if ($res)
{
mtr_debug("mtr_mysqladmin_shutdown(): All mysqld instances are down.");
}
else
{
mtr_debug("mtr_mysqladmin_shutdown(): At least one server is alive.");
}
return $res;
}
@ -795,7 +877,7 @@ sub stop_reap_all {
$SIG{CHLD}= 'DEFAULT';
}
sub mtr_ping_mysqld_server () {
sub mtr_ping_mysqld_server ($) {
my $port= shift;
my $remote= "localhost";
@ -810,13 +892,18 @@ sub mtr_ping_mysqld_server () {
{
mtr_error("can't create socket: $!");
}
mtr_debug("Pinging server (port: $port)...");
if ( connect(SOCK, $paddr) )
{
mtr_debug("Server (port: $port) is alive.");
close(SOCK); # FIXME check error?
return 1;
}
else
{
mtr_debug("Server (port: $port) is dead.");
return 0;
}
}
@ -886,34 +973,6 @@ sub mtr_kill_processes ($) {
}
}
sub mtr_kill_process ($$$$) {
my $pid= shift;
my $signal= shift;
my $total_retries= shift;
my $timeout= shift;
for (my $cur_attempt= 1; $cur_attempt <= $total_retries; ++$cur_attempt)
{
mtr_debug("Sending $signal to $pid...");
kill($signal, $pid);
unless (kill (0, $pid))
{
mtr_debug("Process $pid died.");
return;
}
mtr_debug("Sleeping $timeout second(s) waiting for processes to die...");
sleep($timeout);
}
mtr_debug("Process $pid is still alive after $total_retries " .
"of sending signal $signal.");
}
##############################################################################
#
# When we exit, we kill off all children
@ -943,4 +1002,676 @@ sub mtr_exit ($) {
exit($code);
}
##############################################################################
#
# Instance Manager management routines.
#
##############################################################################
sub mtr_im_kill_process ($$$$) {
my $pid_lst= shift;
my $signal= shift;
my $total_retries= shift;
my $timeout= shift;
my %pids;
foreach my $pid (@{$pid_lst})
{
$pids{$pid}= 1;
}
for (my $cur_attempt= 1; $cur_attempt <= $total_retries; ++$cur_attempt)
{
foreach my $pid (keys %pids)
{
mtr_debug("Sending $signal to $pid...");
kill($signal, $pid);
unless (kill (0, $pid))
{
mtr_debug("Process $pid died.");
delete $pids{$pid};
}
}
return if scalar keys %pids == 0;
mtr_debug("Sleeping $timeout second(s) waiting for processes to die...");
sleep($timeout);
}
mtr_debug("Process(es) " .
join(' ', keys %pids) .
" is still alive after $total_retries " .
"of sending signal $signal.");
}
###########################################################################
sub mtr_im_load_pids($) {
my $instance_manager= shift;
mtr_debug("Loading PID files...");
# Obtain mysqld-process pids.
my $instances = $instance_manager->{'instances'};
for (my $idx= 0; $idx < 2; ++$idx)
{
mtr_debug("IM-guarded mysqld[$idx] PID file: '" .
$instances->[$idx]->{'path_pid'} . "'.");
my $mysqld_pid;
if (-r $instances->[$idx]->{'path_pid'})
{
$mysqld_pid= mtr_get_pid_from_file($instances->[$idx]->{'path_pid'});
mtr_debug("IM-guarded mysqld[$idx] PID: $mysqld_pid.");
}
else
{
$mysqld_pid= undef;
mtr_debug("IM-guarded mysqld[$idx]: no PID file.");
}
$instances->[$idx]->{'pid'}= $mysqld_pid;
}
# Re-read Instance Manager PIDs from the file, since during tests Instance
# Manager could have been restarted, so its PIDs could have been changed.
# - IM-main
mtr_debug("IM-main PID file: '$instance_manager->{path_pid}'.");
if (-f $instance_manager->{'path_pid'})
{
$instance_manager->{'pid'} =
mtr_get_pid_from_file($instance_manager->{'path_pid'});
mtr_debug("IM-main PID: $instance_manager->{pid}.");
}
else
{
mtr_debug("IM-main: no PID file.");
$instance_manager->{'pid'}= undef;
}
# - IM-angel
mtr_debug("IM-angel PID file: '$instance_manager->{path_angel_pid}'.");
if (-f $instance_manager->{'path_angel_pid'})
{
$instance_manager->{'angel_pid'} =
mtr_get_pid_from_file($instance_manager->{'path_angel_pid'});
mtr_debug("IM-angel PID: $instance_manager->{'angel_pid'}.");
}
else
{
mtr_debug("IM-angel: no PID file.");
$instance_manager->{'angel_pid'} = undef;
}
}
###########################################################################
sub mtr_im_terminate($) {
my $instance_manager= shift;
# Load pids from pid-files. We should do it first of all, because IM deletes
# them on shutdown.
mtr_im_load_pids($instance_manager);
mtr_debug("Shutting Instance Manager down...");
# Ignoring SIGCHLD so that all children could rest in peace.
start_reap_all();
# Send SIGTERM to IM-main.
if (defined $instance_manager->{'pid'})
{
mtr_debug("IM-main pid: $instance_manager->{pid}.");
mtr_debug("Stopping IM-main...");
mtr_im_kill_process([ $instance_manager->{'pid'} ], 'TERM', 10, 1);
}
else
{
mtr_debug("IM-main pid: n/a.");
}
# If IM-angel was alive, wait for it to die.
if (defined $instance_manager->{'angel_pid'})
{
mtr_debug("IM-angel pid: $instance_manager->{'angel_pid'}.");
mtr_debug("Waiting for IM-angel to die...");
my $total_attempts= 10;
for (my $cur_attempt=1; $cur_attempt <= $total_attempts; ++$cur_attempt)
{
unless (kill (0, $instance_manager->{'angel_pid'}))
{
mtr_debug("IM-angel died.");
last;
}
sleep(1);
}
}
else
{
mtr_debug("IM-angel pid: n/a.");
}
stop_reap_all();
# Re-load PIDs.
mtr_im_load_pids($instance_manager);
}
###########################################################################
sub mtr_im_check_alive($) {
my $instance_manager= shift;
mtr_debug("Checking whether IM-components are alive...");
return 1 if mtr_im_check_main_alive($instance_manager);
return 1 if mtr_im_check_angel_alive($instance_manager);
return 1 if mtr_im_check_mysqlds_alive($instance_manager);
return 0;
}
###########################################################################
sub mtr_im_check_main_alive($) {
my $instance_manager= shift;
# Check that the process, that we know to be IM's, is dead.
if (defined $instance_manager->{'pid'})
{
if (kill (0, $instance_manager->{'pid'}))
{
mtr_debug("IM-main (PID: $instance_manager->{pid}) is alive.");
return 1;
}
else
{
mtr_debug("IM-main (PID: $instance_manager->{pid}) is dead.");
}
}
else
{
mtr_debug("No PID file for IM-main.");
}
# Check that IM does not accept client connections.
if (mtr_ping_mysqld_server($instance_manager->{'port'}))
{
mtr_debug("IM-main (port: $instance_manager->{port}) " .
"is accepting connections.");
mtr_im_errlog("IM-main is accepting connections on port " .
"$instance_manager->{port}, but there is no " .
"process information.");
return 1;
}
else
{
mtr_debug("IM-main (port: $instance_manager->{port}) " .
"does not accept connections.");
return 0;
}
}
###########################################################################
sub mtr_im_check_angel_alive($) {
my $instance_manager= shift;
# Check that the process, that we know to be the Angel, is dead.
if (defined $instance_manager->{'angel_pid'})
{
if (kill (0, $instance_manager->{'angel_pid'}))
{
mtr_debug("IM-angel (PID: $instance_manager->{angel_pid}) is alive.");
return 1;
}
else
{
mtr_debug("IM-angel (PID: $instance_manager->{angel_pid}) is dead.");
return 0;
}
}
else
{
mtr_debug("No PID file for IM-angel.");
return 0;
}
}
###########################################################################
sub mtr_im_check_mysqlds_alive($) {
my $instance_manager= shift;
mtr_debug("Checking for IM-guarded mysqld instances...");
my $instances = $instance_manager->{'instances'};
for (my $idx= 0; $idx < 2; ++$idx)
{
mtr_debug("Checking mysqld[$idx]...");
return 1
if mtr_im_check_mysqld_alive($instance_manager, $instances->[$idx]);
}
}
###########################################################################
sub mtr_im_check_mysqld_alive($$) {
my $instance_manager= shift;
my $mysqld_instance= shift;
# Check that the process is dead.
if (defined $instance_manager->{'pid'})
{
if (kill (0, $instance_manager->{'pid'}))
{
mtr_debug("Mysqld instance (PID: $mysqld_instance->{pid}) is alive.");
return 1;
}
else
{
mtr_debug("Mysqld instance (PID: $mysqld_instance->{pid}) is dead.");
}
}
else
{
mtr_debug("No PID file for mysqld instance.");
}
# Check that mysqld does not accept client connections.
if (mtr_ping_mysqld_server($mysqld_instance->{'port'}))
{
mtr_debug("Mysqld instance (port: $mysqld_instance->{port}) " .
"is accepting connections.");
mtr_im_errlog("Mysqld is accepting connections on port " .
"$mysqld_instance->{port}, but there is no " .
"process information.");
return 1;
}
else
{
mtr_debug("Mysqld instance (port: $mysqld_instance->{port}) " .
"does not accept connections.");
return 0;
}
}
###########################################################################
sub mtr_im_cleanup($) {
my $instance_manager= shift;
mtr_im_rm_file($instance_manager->{'path_pid'});
mtr_im_rm_file($instance_manager->{'path_sock'});
mtr_im_rm_file($instance_manager->{'path_angel_pid'});
for (my $idx= 0; $idx < 2; ++$idx)
{
mtr_im_rm_file($instance_manager->{'instances'}->[$idx]->{'path_pid'});
mtr_im_rm_file($instance_manager->{'instances'}->[$idx]->{'path_sock'});
}
}
###########################################################################
sub mtr_im_rm_file($)
{
my $file_path= shift;
if (-f $file_path)
{
mtr_debug("Removing '$file_path'...");
mtr_warning("Can not remove '$file_path'.")
unless unlink($file_path);
}
else
{
mtr_debug("File '$file_path' does not exist already.");
}
}
###########################################################################
sub mtr_im_errlog($) {
my $msg= shift;
# Complain in error log so that a warning will be shown.
#
# TODO: unless BUG#20761 is fixed, we will print the warning to stdout, so
# that it can be seen on console and does not produce pushbuild error.
# my $errlog= "$opt_vardir/log/mysql-test-run.pl.err";
#
# open (ERRLOG, ">>$errlog") ||
# mtr_error("Can not open error log ($errlog)");
#
# my $ts= localtime();
# print ERRLOG
# "Warning: [$ts] $msg\n";
#
# close ERRLOG;
my $ts= localtime();
print "Warning: [$ts] $msg\n";
}
###########################################################################
sub mtr_im_kill($) {
my $instance_manager= shift;
# Re-load PIDs. That can be useful because some processes could have been
# restarted.
mtr_im_load_pids($instance_manager);
# Ignoring SIGCHLD so that all children could rest in peace.
start_reap_all();
# Kill IM-angel first of all.
if (defined $instance_manager->{'angel_pid'})
{
mtr_debug("Killing IM-angel (PID: $instance_manager->{angel_pid})...");
mtr_im_kill_process([ $instance_manager->{'angel_pid'} ], 'KILL', 10, 1)
}
else
{
mtr_debug("IM-angel is dead.");
}
# Re-load PIDs again.
mtr_im_load_pids($instance_manager);
# Kill IM-main.
if (defined $instance_manager->{'pid'})
{
mtr_debug("Killing IM-main (PID: $instance_manager->pid})...");
mtr_im_kill_process([ $instance_manager->{'pid'} ], 'KILL', 10, 1);
}
else
{
mtr_debug("IM-main is dead.");
}
# Re-load PIDs again.
mtr_im_load_pids($instance_manager);
# Kill guarded mysqld instances.
my @mysqld_pids;
mtr_debug("Collecting PIDs of mysqld instances to kill...");
for (my $idx= 0; $idx < 2; ++$idx)
{
my $pid= $instance_manager->{'instances'}->[$idx]->{'pid'};
next unless defined $pid;
mtr_debug(" - IM-guarded mysqld[$idx] PID: $pid.");
push (@mysqld_pids, $pid);
}
if (scalar @mysqld_pids > 0)
{
mtr_debug("Killing IM-guarded mysqld instances...");
mtr_im_kill_process(\@mysqld_pids, 'KILL', 10, 1);
}
# That's all.
stop_reap_all();
}
##############################################################################
sub mtr_im_wait_for_connection($$$) {
my $instance_manager= shift;
my $total_attempts= shift;
my $connect_timeout= shift;
mtr_debug("Waiting for IM on port $instance_manager->{port} " .
"to start accepting connections...");
for (my $cur_attempt= 1; $cur_attempt <= $total_attempts; ++$cur_attempt)
{
mtr_debug("Trying to connect to IM ($cur_attempt of $total_attempts)...");
if (mtr_ping_mysqld_server($instance_manager->{'port'}))
{
mtr_debug("IM is accepting connections " .
"on port $instance_manager->{port}.");
return 1;
}
mtr_debug("Sleeping $connect_timeout...");
sleep($connect_timeout);
}
mtr_debug("IM does not accept connections " .
"on port $instance_manager->{port} after " .
($total_attempts * $connect_timeout) . " seconds.");
return 0;
}
##############################################################################
sub mtr_im_wait_for_mysqld($$$) {
my $mysqld= shift;
my $total_attempts= shift;
my $connect_timeout= shift;
mtr_debug("Waiting for IM-guarded mysqld on port $mysqld->{port} " .
"to start accepting connections...");
for (my $cur_attempt= 1; $cur_attempt <= $total_attempts; ++$cur_attempt)
{
mtr_debug("Trying to connect to mysqld " .
"($cur_attempt of $total_attempts)...");
if (mtr_ping_mysqld_server($mysqld->{'port'}))
{
mtr_debug("Mysqld is accepting connections " .
"on port $mysqld->{port}.");
return 1;
}
mtr_debug("Sleeping $connect_timeout...");
sleep($connect_timeout);
}
mtr_debug("Mysqld does not accept connections " .
"on port $mysqld->{port} after " .
($total_attempts * $connect_timeout) . " seconds.");
return 0;
}
##############################################################################
sub mtr_im_start($$) {
my $instance_manager = shift;
my $opts = shift;
mtr_debug("Starting Instance Manager...");
my $args;
mtr_init_args(\$args);
mtr_add_arg($args, "--defaults-file=%s",
$instance_manager->{'defaults_file'});
foreach my $opt (@{$opts})
{
mtr_add_arg($args, $opt);
}
$instance_manager->{'pid'} =
mtr_spawn(
$::exe_im, # path to the executable
$args, # cmd-line args
'', # stdin
$instance_manager->{'path_log'}, # stdout
$instance_manager->{'path_err'}, # stderr
'', # pid file path (not used)
{ append_log_file => 1 } # append log files
);
if ( ! $instance_manager->{'pid'} )
{
mtr_report('Could not start Instance Manager');
return;
}
# Instance Manager can be run in daemon mode. In this case, it creates
# several processes and the parent process, created by mtr_spawn(), exits just
# after start. So, we have to obtain Instance Manager PID from the PID file.
if ( ! sleep_until_file_created(
$instance_manager->{'path_pid'},
$instance_manager->{'start_timeout'},
-1)) # real PID is still unknown
{
mtr_report("Instance Manager PID file is missing");
return;
}
$instance_manager->{'pid'} =
mtr_get_pid_from_file($instance_manager->{'path_pid'});
mtr_debug("Instance Manager started. PID: $instance_manager->{pid}.");
# Wait until we can connect to IM.
my $IM_CONNECT_TIMEOUT= 30;
unless (mtr_im_wait_for_connection($instance_manager,
$IM_CONNECT_TIMEOUT, 1))
{
mtr_debug("Can not connect to Instance Manager " .
"in $IM_CONNECT_TIMEOUT seconds after start.");
mtr_debug("Aborting test suite...");
mtr_kill_leftovers();
mtr_error("Can not connect to Instance Manager " .
"in $IM_CONNECT_TIMEOUT seconds after start.");
}
# Wait until we can connect to guarded mysqld-instances
# (in other words -- wait for IM to start guarded instances).
for (my $idx= 0; $idx < 2; ++$idx)
{
my $mysqld= $instance_manager->{'instances'}->[$idx];
next if exists $mysqld->{'nonguarded'};
mtr_debug("Waiting for mysqld[$idx] to start...");
unless (mtr_im_wait_for_mysqld($mysqld, 30, 1))
{
mtr_debug("Can not connect to mysqld[$idx] " .
"in $IM_CONNECT_TIMEOUT seconds after start.");
mtr_debug("Aborting test suite...");
mtr_kill_leftovers();
mtr_error("Can not connect to mysqld[$idx] " .
"in $IM_CONNECT_TIMEOUT seconds after start.");
}
mtr_debug("mysqld[$idx] started.");
}
mtr_debug("Instance Manager started.");
}
##############################################################################
sub mtr_im_stop($) {
my $instance_manager= shift;
mtr_debug("Stopping Instance Manager...");
# Try graceful shutdown.
mtr_im_terminate($instance_manager);
# Check that all processes died.
unless (mtr_im_check_alive($instance_manager))
{
mtr_debug("Instance Manager has been stopped successfully.");
mtr_im_cleanup($instance_manager);
return 1;
}
# Instance Manager don't want to die. We should kill it.
mtr_im_errlog("Instance Manager did not shutdown gracefully.");
mtr_im_kill($instance_manager);
# Check again that all IM-related processes have been killed.
my $im_is_alive= mtr_im_check_alive($instance_manager);
mtr_im_cleanup($instance_manager);
if ($im_is_alive)
{
mtr_error("Can not kill Instance Manager or its children.");
return 0;
}
mtr_debug("Instance Manager has been killed successfully.");
return 1;
}
###########################################################################
1;

View file

@ -336,7 +336,7 @@ sub snapshot_setup ();
sub executable_setup ();
sub environment_setup ();
sub kill_running_server ();
sub kill_and_cleanup ();
sub cleanup_stale_files ();
sub check_ssl_support ();
sub check_running_as_root();
sub check_ndbcluster_support ();
@ -356,8 +356,6 @@ sub mysqld_arguments ($$$$$$);
sub stop_masters_slaves ();
sub stop_masters ();
sub stop_slaves ();
sub im_start ($$);
sub im_stop ($);
sub run_mysqltest ($);
sub usage ($);
@ -499,7 +497,7 @@ sub command_line_setup () {
my $opt_master_myport= 9306;
my $opt_slave_myport= 9308;
$opt_ndbcluster_port= 9350;
my $im_port= 9310;
my $im_port= 9311;
my $im_mysqld1_port= 9312;
my $im_mysqld2_port= 9314;
@ -1044,20 +1042,30 @@ sub executable_setup () {
if ( $glob_win32 )
{
$path_client_bindir= mtr_path_exists("$glob_basedir/client_release",
"$glob_basedir/client_debug",
"$glob_basedir/client_debug",
"$glob_basedir/client/release",
"$glob_basedir/client/debug",
"$glob_basedir/bin",);
$exe_mysqld= mtr_exe_exists ("$path_client_bindir/mysqld-max-nt",
"$path_client_bindir/mysqld-max",
"$path_client_bindir/mysqld-nt",
"$path_client_bindir/mysqld",
"$path_client_bindir/mysqld-debug",
"$path_client_bindir/mysqld-max");
$path_language= mtr_path_exists("$glob_basedir/share/english/");
$path_charsetsdir= mtr_path_exists("$glob_basedir/share/charsets");
"$path_client_bindir/mysqld-max",
"$glob_basedir/sql/release/mysqld",
"$glob_basedir/sql/debug/mysqld");
$path_language= mtr_path_exists("$glob_basedir/share/english/",
"$glob_basedir/sql/share/english/");
$path_charsetsdir= mtr_path_exists("$glob_basedir/share/charsets",
"$glob_basedir/sql/share/charsets/");
$exe_my_print_defaults=
mtr_exe_exists("$path_client_bindir/my_print_defaults");
mtr_exe_exists("$path_client_bindir/my_print_defaults",
"$glob_basedir/extra/release/my_print_defaults",
"$glob_basedir/extra/debug/my_print_defaults");
$exe_perror=
mtr_exe_exists("$path_client_bindir/perror");
mtr_exe_exists("$path_client_bindir/perror",
"$glob_basedir/extra/release/perror",
"$glob_basedir/extra/debug/perror");
}
else
{
@ -1087,6 +1095,9 @@ sub executable_setup () {
$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",
"$glob_basedir/tests/release/mysql_client_test",
"$glob_basedir/tests/debug/mysql_client_test",
"$path_client_bindir/mysql_client_test",
"/usr/bin/false");
}
@ -1098,7 +1109,8 @@ sub executable_setup () {
$exe_mysqladmin= mtr_exe_exists("$path_client_bindir/mysqladmin");
$exe_mysql= mtr_exe_exists("$path_client_bindir/mysql");
$exe_mysql_fix_system_tables=
mtr_script_exists("$glob_basedir/scripts/mysql_fix_privilege_tables");
mtr_script_exists("$glob_basedir/scripts/mysql_fix_privilege_tables",
"/usr/bin/false");
$path_ndb_tools_dir= mtr_path_exists("$glob_basedir/ndb/tools");
$exe_ndb_mgm= "$glob_basedir/ndb/src/mgmclient/ndb_mgm";
$lib_udf_example=
@ -1116,7 +1128,8 @@ sub executable_setup () {
$exe_mysql= mtr_exe_exists("$path_client_bindir/mysql");
$exe_mysql_fix_system_tables=
mtr_script_exists("$path_client_bindir/mysql_fix_privilege_tables",
"$glob_basedir/scripts/mysql_fix_privilege_tables");
"$glob_basedir/scripts/mysql_fix_privilege_tables",
"/usr/bin/false");
$exe_my_print_defaults=
mtr_exe_exists("$path_client_bindir/my_print_defaults");
$exe_perror=
@ -1150,7 +1163,9 @@ sub executable_setup () {
}
else
{
$exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest");
$exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest",
"$glob_basedir/client/release/mysqltest",
"$glob_basedir/client/debug/mysqltest");
$exe_mysql_client_test=
mtr_exe_exists("$path_client_bindir/mysql_client_test",
"/usr/bin/false"); # FIXME temporary
@ -1303,6 +1318,7 @@ sub kill_running_server () {
mtr_report("Killing Possible Leftover Processes");
mkpath("$opt_vardir/log"); # Needed for mysqladmin log
mtr_kill_leftovers();
$using_ndbcluster_master= $opt_with_ndbcluster;
@ -1311,9 +1327,7 @@ sub kill_running_server () {
}
}
sub kill_and_cleanup () {
kill_running_server ();
sub cleanup_stale_files () {
mtr_report("Removing Stale Files");
@ -1692,13 +1706,11 @@ sub run_suite () {
sub initialize_servers () {
if ( ! $glob_use_running_server )
{
if ( $opt_start_dirty )
kill_running_server();
unless ( $opt_start_dirty )
{
kill_running_server();
}
else
{
kill_and_cleanup();
cleanup_stale_files();
mysql_install_db();
if ( $opt_force )
{
@ -2100,7 +2112,7 @@ sub run_testcase ($) {
im_create_defaults_file($instance_manager);
im_start($instance_manager, $tinfo->{im_opts});
mtr_im_start($instance_manager, $tinfo->{im_opts});
}
# ----------------------------------------------------------------------
@ -2195,10 +2207,9 @@ sub run_testcase ($) {
# Stop Instance Manager if we are processing an IM-test case.
# ----------------------------------------------------------------------
if ( ! $glob_use_running_server and $tinfo->{'component_id'} eq 'im' and
$instance_manager->{'pid'} )
if ( ! $glob_use_running_server and $tinfo->{'component_id'} eq 'im' )
{
im_stop($instance_manager);
mtr_im_stop($instance_manager);
}
}
@ -2726,11 +2737,8 @@ sub stop_masters_slaves () {
print "Ending Tests\n";
if ( $instance_manager->{'pid'} )
{
print "Shutting-down Instance Manager\n";
im_stop($instance_manager);
}
print "Shutting-down Instance Manager\n";
mtr_im_stop($instance_manager);
print "Shutting-down MySQL daemon\n\n";
stop_masters();
@ -2792,230 +2800,6 @@ sub stop_slaves () {
mtr_stop_mysqld_servers(\@args);
}
##############################################################################
#
# Instance Manager management routines.
#
##############################################################################
sub im_start($$) {
my $instance_manager = shift;
my $opts = shift;
my $args;
mtr_init_args(\$args);
mtr_add_arg($args, "--defaults-file=%s",
$instance_manager->{'defaults_file'});
foreach my $opt (@{$opts})
{
mtr_add_arg($args, $opt);
}
$instance_manager->{'pid'} =
mtr_spawn(
$exe_im, # path to the executable
$args, # cmd-line args
'', # stdin
$instance_manager->{'path_log'}, # stdout
$instance_manager->{'path_err'}, # stderr
'', # pid file path (not used)
{ append_log_file => 1 } # append log files
);
if ( ! $instance_manager->{'pid'} )
{
mtr_report('Could not start Instance Manager');
return;
}
# Instance Manager can be run in daemon mode. In this case, it creates
# several processes and the parent process, created by mtr_spawn(), exits just
# after start. So, we have to obtain Instance Manager PID from the PID file.
if ( ! sleep_until_file_created(
$instance_manager->{'path_pid'},
$instance_manager->{'start_timeout'},
-1)) # real PID is still unknown
{
mtr_report("Instance Manager PID file is missing");
return;
}
$instance_manager->{'pid'} =
mtr_get_pid_from_file($instance_manager->{'path_pid'});
}
sub im_stop($) {
my $instance_manager = shift;
# Obtain mysqld-process pids before we start stopping IM (it can delete pid
# files).
my @mysqld_pids = ();
my $instances = $instance_manager->{'instances'};
push(@mysqld_pids, mtr_get_pid_from_file($instances->[0]->{'path_pid'}))
if -r $instances->[0]->{'path_pid'};
push(@mysqld_pids, mtr_get_pid_from_file($instances->[1]->{'path_pid'}))
if -r $instances->[1]->{'path_pid'};
# Re-read pid from the file, since during tests Instance Manager could have
# been restarted, so its pid could have been changed.
$instance_manager->{'pid'} =
mtr_get_pid_from_file($instance_manager->{'path_pid'})
if -f $instance_manager->{'path_pid'};
if (-f $instance_manager->{'path_angel_pid'})
{
$instance_manager->{'angel_pid'} =
mtr_get_pid_from_file($instance_manager->{'path_angel_pid'})
}
else
{
$instance_manager->{'angel_pid'} = undef;
}
# Inspired from mtr_stop_mysqld_servers().
start_reap_all();
# Try graceful shutdown.
mtr_debug("IM-main pid: $instance_manager->{'pid'}");
mtr_debug("Stopping IM-main...");
mtr_kill_process($instance_manager->{'pid'}, 'TERM', 10, 1);
# If necessary, wait for angel process to die.
if (defined $instance_manager->{'angel_pid'})
{
mtr_debug("IM-angel pid: $instance_manager->{'angel_pid'}");
mtr_debug("Waiting for IM-angel to die...");
my $total_attempts= 10;
for (my $cur_attempt=1; $cur_attempt <= $total_attempts; ++$cur_attempt)
{
unless (kill (0, $instance_manager->{'angel_pid'}))
{
mtr_debug("IM-angel died.");
last;
}
sleep(1);
}
}
# Check that all processes died.
my $clean_shutdown= 0;
while (1)
{
# Check that IM-main died.
if (kill (0, $instance_manager->{'pid'}))
{
mtr_debug("IM-main is still alive.");
last;
}
# Check that IM-angel died.
if (defined $instance_manager->{'angel_pid'} &&
kill (0, $instance_manager->{'angel_pid'}))
{
mtr_debug("IM-angel is still alive.");
last;
}
# Check that all guarded mysqld-instances died.
my $guarded_mysqlds_dead= 1;
foreach my $pid (@mysqld_pids)
{
if (kill (0, $pid))
{
mtr_debug("Guarded mysqld ($pid) is still alive.");
$guarded_mysqlds_dead= 0;
last;
}
}
last unless $guarded_mysqlds_dead;
# Ok, all necessary processes are dead.
$clean_shutdown= 1;
last;
}
# Kill leftovers (the order is important).
if ($clean_shutdown)
{
mtr_debug("IM-shutdown was clean -- all processed died.");
}
else
{
mtr_debug("IM failed to shutdown gracefully. We have to clean the mess...");
}
unless ($clean_shutdown)
{
if (defined $instance_manager->{'angel_pid'})
{
mtr_debug("Killing IM-angel...");
mtr_kill_process($instance_manager->{'angel_pid'}, 'KILL', 10, 1)
}
mtr_debug("Killing IM-main...");
mtr_kill_process($instance_manager->{'pid'}, 'KILL', 10, 1);
# Shutdown managed mysqld-processes. Some of them may be nonguarded, so IM
# will not stop them on shutdown. So, we should firstly try to end them
# legally.
mtr_debug("Killing guarded mysqld(s)...");
mtr_kill_processes(\@mysqld_pids);
# Complain in error log so that a warning will be shown.
#
# TODO: unless BUG#20761 is fixed, we will print the warning
# to stdout, so that it can be seen on console and does not
# produce pushbuild error.
# my $errlog= "$opt_vardir/log/mysql-test-run.pl.err";
#
# open (ERRLOG, ">>$errlog") ||
# mtr_error("Can not open error log ($errlog)");
#
# my $ts= localtime();
# print ERRLOG
# "Warning: [$ts] Instance Manager did not shutdown gracefully.\n";
#
# close ERRLOG;
my $ts= localtime();
print "Warning: [$ts] Instance Manager did not shutdown gracefully.\n";
}
# That's all.
stop_reap_all();
$instance_manager->{'pid'} = undef;
$instance_manager->{'angel_pid'} = undef;
}
#
# Run include/check-testcase.test
# Before a testcase, run in record mode, save result file to var

View file

@ -42,3 +42,10 @@ CHAR(31) = '' '' = CHAR(31)
SELECT CHAR(30) = '', '' = CHAR(30);
CHAR(30) = '' '' = CHAR(30)
0 0
create table t1 (a tinyint(1),b binary(1));
insert into t1 values (0x01,0x01);
select * from t1 where a=b;
a b
select * from t1 where a=b and b=0x01;
a b
drop table if exists t1;

View file

@ -248,3 +248,14 @@ select rpad(c1,3,'
rpad(c1,3,'ö') rpad('ö',3,c1)
ßöö ößß
drop table t1;
set names koi8r;
create table t1(a char character set cp1251 default _koi8r 0xFF);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(1) character set cp1251 default '˙'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1(a char character set latin1 default _cp1251 0xFF);
ERROR 42000: Invalid default value for 'a'
End of 4.1 tests

View file

@ -730,6 +730,45 @@ id MIN(s)
1 ZZZ
2 ZZZ
DROP TABLE t1;
drop table if exists bug20536;
set names latin1;
create table bug20536 (id bigint not null auto_increment primary key, name
varchar(255) character set ucs2 not null);
insert into `bug20536` (`id`,`name`) values (1, _latin1 x'7465737431'), (2, "'test\\_2'");
select md5(name) from bug20536;
md5(name)
f4b7ce8b45a20e3c4e84bef515d1525c
48d95db0d8305c2fe11548a3635c9385
select sha1(name) from bug20536;
sha1(name)
e0b52f38deddb9f9e8d5336b153592794cb49baf
677d4d505355eb5b0549b865fcae4b7f0c28aef5
select make_set(3, name, upper(name)) from bug20536;
make_set(3, name, upper(name))
test1,TEST1
'test\_2','TEST\_2'
select export_set(5, name, upper(name)) from bug20536;
export_set(5, name, upper(name))
test1,TEST1,test1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1
'test\_2','TEST\_2','test\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2'
select export_set(5, name, upper(name), ",", 5) from bug20536;
export_set(5, name, upper(name), ",", 5)
test1,TEST1,test1,TEST1,TEST1
'test\_2','TEST\_2','test\_2','TEST\_2','TEST\_2'
select password(name) from bug20536;
password(name)
????????????????????
????????????????????
select old_password(name) from bug20536;
old_password(name)
????????
????????
select quote(name) from bug20536;
quote(name)
????????
????????????????
drop table bug20536;
End of 4.1 tests
CREATE TABLE t1 (a varchar(64) character set ucs2, b decimal(10,3));
INSERT INTO t1 VALUES ("1.1", 0), ("2.1", 0);
update t1 set b=a;
@ -765,3 +804,4 @@ blob 65535 65535
text 65535 65535
text 65535 32767
drop table t1;
End of 5.0 tests

View file

@ -924,6 +924,37 @@ NULL
select ifnull(NULL, _utf8'string');
ifnull(NULL, _utf8'string')
string
set names utf8;
create table t1 (s1 char(5) character set utf8 collate utf8_lithuanian_ci);
insert into t1 values ('I'),('K'),('Y');
select * from t1 where s1 < 'K' and s1 = 'Y';
s1
I
Y
select * from t1 where 'K' > s1 and s1 = 'Y';
s1
I
Y
drop table t1;
create table t1 (s1 char(5) character set utf8 collate utf8_czech_ci);
insert into t1 values ('c'),('d'),('h'),('ch'),('CH'),('cH'),('Ch'),('i');
select * from t1 where s1 > 'd' and s1 = 'CH';
s1
ch
CH
Ch
select * from t1 where 'd' < s1 and s1 = 'CH';
s1
ch
CH
Ch
select * from t1 where s1 = 'cH' and s1 <> 'ch';
s1
cH
select * from t1 where 'cH' = s1 and s1 <> 'ch';
s1
cH
drop table t1;
create table t1 (a varchar(255)) default character set utf8;
insert into t1 values (1.0);
drop table t1;

View file

@ -563,6 +563,17 @@ id IFNULL(dsc, '-')
2 line number two
3 line number three
drop table t1;
CREATE TABLE t1 (a int primary key, b int);
INSERT INTO t1 (a,b) values (1,1), (2,3), (3,2);
explain SELECT DISTINCT a, b FROM t1 ORDER BY b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort
SELECT DISTINCT a, b FROM t1 ORDER BY b;
a b
1 1
3 2
2 3
DROP TABLE t1;
CREATE TABLE t1 (
ID int(11) NOT NULL auto_increment,
x varchar(20) default NULL,

View file

@ -72,3 +72,16 @@ show tables;
Tables_in_test
t1
drop table t1;
drop database if exists mysqltest;
drop table if exists t1;
create table t1 (i int);
lock tables t1 read;
create database mysqltest;
drop table t1;
show open tables;
drop database mysqltest;
select 1;
1
1
unlock tables;
End of 5.0 tests

View file

@ -87,6 +87,10 @@ SELECT IS_USED_LOCK('bug16501');
IS_USED_LOCK('bug16501')
NULL
DROP TABLE t1;
select export_set(3, _latin1'foo', _utf8'bar', ',', 4);
export_set(3, _latin1'foo', _utf8'bar', ',', 4)
foo,foo,bar,bar
End of 4.1 tests
create table t1 as select uuid(), length(uuid());
show create table t1;
Table Create Table
@ -130,3 +134,4 @@ timediff(b, a) >= '00:00:03'
drop table t2;
drop table t1;
set global query_cache_size=default;
End of 5.0 tests

View file

@ -1053,3 +1053,15 @@ id day id day
3 2005-07-01 3 2005-07-15
DROP TABLE t1,t2;
set time_zone= @@global.time_zone;
SET NAMES latin1;
SET character_set_results = NULL;
SHOW VARIABLES LIKE 'character_set_results';
Variable_name Value
character_set_results
CREATE TABLE testBug8868 (field1 DATE, field2 VARCHAR(32) CHARACTER SET BINARY);
INSERT INTO testBug8868 VALUES ('2006-09-04', 'abcd');
SELECT DATE_FORMAT(field1,'%b-%e %l:%i%p') as fmtddate, field2 FROM testBug8868;
fmtddate field2
Sep-4 12:00AM abcd
DROP TABLE testBug8868;
SET NAMES DEFAULT;

View file

@ -943,6 +943,31 @@ DROP TABLE mysqltest3.t_nn;
DROP DATABASE mysqltest3;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'mysqltest_1'@'localhost';
DROP USER 'mysqltest_1'@'localhost';
use test;
create user mysqltest1_thisisreallytoolong;
ERROR HY000: Operation CREATE USER failed for 'mysqltest1_thisisreallytoolong'@'%'
ERROR HY000: String 'mysqltest1_thisisreallytoolong' is too long for user name (should be no longer than 16)
GRANT CREATE ON mysqltest.* TO 1234567890abcdefGHIKL@localhost;
ERROR HY000: String '1234567890abcdefGHIKL' is too long for user name (should be no longer than 16)
GRANT CREATE ON mysqltest.* TO some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY;
ERROR HY000: String '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY' is too long for host name (should be no longer than 60)
REVOKE CREATE ON mysqltest.* FROM 1234567890abcdefGHIKL@localhost;
ERROR HY000: String '1234567890abcdefGHIKL' is too long for user name (should be no longer than 16)
REVOKE CREATE ON mysqltest.* FROM some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY;
ERROR HY000: String '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY' is too long for host name (should be no longer than 60)
GRANT CREATE ON t1 TO 1234567890abcdefGHIKL@localhost;
ERROR HY000: String '1234567890abcdefGHIKL' is too long for user name (should be no longer than 16)
GRANT CREATE ON t1 TO some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY;
ERROR HY000: String '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY' is too long for host name (should be no longer than 60)
REVOKE CREATE ON t1 FROM 1234567890abcdefGHIKL@localhost;
ERROR HY000: String '1234567890abcdefGHIKL' is too long for user name (should be no longer than 16)
REVOKE CREATE ON t1 FROM some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY;
ERROR HY000: String '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY' is too long for host name (should be no longer than 60)
GRANT EXECUTE ON PROCEDURE p1 TO 1234567890abcdefGHIKL@localhost;
ERROR HY000: String '1234567890abcdefGHIKL' is too long for user name (should be no longer than 16)
GRANT EXECUTE ON PROCEDURE p1 TO some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY;
ERROR HY000: String '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY' is too long for host name (should be no longer than 60)
REVOKE EXECUTE ON PROCEDURE p1 FROM 1234567890abcdefGHIKL@localhost;
ERROR HY000: String '1234567890abcdefGHIKL' is too long for user name (should be no longer than 16)
REVOKE EXECUTE ON PROCEDURE t1 FROM some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY;
ERROR HY000: String '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY' is too long for host name (should be no longer than 60)
End of 5.0 tests

View file

@ -821,3 +821,12 @@ a b real_b
68 France France
DROP VIEW v1;
DROP TABLE t1,t2;
CREATE TABLE t1 (a INT, b INT, KEY(a));
INSERT INTO t1 VALUES (1, 1), (2, 2), (3,3), (4,4);
EXPLAIN SELECT a, SUM(b) FROM t1 GROUP BY a LIMIT 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL a 5 NULL 4
EXPLAIN SELECT a, SUM(b) FROM t1 IGNORE INDEX (a) GROUP BY a LIMIT 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort
DROP TABLE t1;

View file

@ -294,3 +294,4 @@ DROP TABLE t1;
CREATE TABLE t1 (a INT, UNIQUE USING BTREE(a)) ENGINE=MEMORY;
INSERT INTO t1 VALUES(NULL),(NULL);
DROP TABLE t1;
End of 5.0 tests

View file

@ -1,4 +1,3 @@
Success: the process has been started.
SHOW VARIABLES LIKE 'server_id';
Variable_name Value
server_id 1

View file

@ -1,4 +1,3 @@
Success: the process has been started.
SHOW VARIABLES LIKE 'server_id';
Variable_name Value
server_id 1

View file

@ -1,4 +1,3 @@
Success: the process has been started.
SHOW VARIABLES LIKE 'server_id';
Variable_name Value
server_id 1

View file

@ -1,4 +1,3 @@
Success: the process has been started.
SHOW VARIABLES LIKE 'server_id';
Variable_name Value
server_id 1

View file

@ -1,4 +1,3 @@
Success: the process has been started.
SHOW VARIABLES LIKE 'server_id';
Variable_name Value
server_id 1

View file

@ -83,6 +83,27 @@ b a
3 3
3 3
DROP TABLE t1, t2, t3;
CREATE TABLE `t1` (`id1` INT) ;
INSERT INTO `t1` (`id1`) VALUES (1),(5),(2);
CREATE TABLE `t2` (
`id1` INT,
`id2` INT NOT NULL,
`id3` INT,
`id4` INT NOT NULL,
UNIQUE (`id2`,`id4`),
KEY (`id1`)
) ENGINE=InnoDB;
INSERT INTO `t2`(`id1`,`id2`,`id3`,`id4`) VALUES
(1,1,1,0),
(1,1,2,1),
(5,1,2,2),
(6,1,2,3),
(1,2,2,2),
(1,2,1,1);
SELECT `id1` FROM `t1` WHERE `id1` NOT IN (SELECT `id1` FROM `t2` WHERE `id2` = 1 AND `id3` = 2);
id1
2
DROP TABLE t1, t2;
create table t1m (a int) engine=myisam;
create table t1i (a int) engine=innodb;
create table t2m (a int) engine=myisam;
@ -297,3 +318,22 @@ explain select distinct f1, f2 from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range NULL PRIMARY 5 NULL 3 Using index for group-by; Using temporary
drop table t1;
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 t2 index NULL fkey 5 NULL 5 Using index
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.fkey 1 Using where
DROP TABLE t1,t2;

View file

@ -737,7 +737,7 @@ explain select s.*, '*', m.*, (s.match_1_h - m.home) UUX from
(t2 s left join t1 m on m.match_id = 1)
order by m.match_id desc;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE s ALL NULL NULL NULL NULL 10
1 SIMPLE s ALL NULL NULL NULL NULL 10 Using temporary; Using filesort
1 SIMPLE m const match_id,match_id_2 match_id 1 const 1
explain select s.*, '*', m.*, (s.match_1_h - m.home) UUX from
(t2 s left join t1 m on m.match_id = 1)
@ -1137,25 +1137,6 @@ 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 t2 index NULL fkey 5 NULL 5 Using index
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.fkey 1 Using where
DROP TABLE t1,t2;
DROP VIEW IF EXISTS v1,v2;
DROP TABLE IF EXISTS t1,t2;
CREATE TABLE t1 (a int);

View file

@ -76,3 +76,17 @@ a
a
1
drop table t1;
create table t1 (a int);
insert into t1 values (1),(2),(3),(4),(5),(6),(7);
explain select count(*) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where; Using temporary
select count(*) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
c
7
explain select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where; Using temporary
select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
c
28

View file

@ -59,16 +59,16 @@ database()
test
unlock tables;
drop table t1;
c_cp932
+----------------------+------------+--------+
| concat('>',col1,'<') | col2 | col3 |
+----------------------+------------+--------+

View file

@ -1403,92 +1403,6 @@ UNLOCK TABLES;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
DROP TABLE t1;
create database db1;
use db1;
CREATE TABLE t2 (
a varchar(30) default NULL,
KEY a (a(5))
);
INSERT INTO t2 VALUES ('alfred');
INSERT INTO t2 VALUES ('angie');
INSERT INTO t2 VALUES ('bingo');
INSERT INTO t2 VALUES ('waffle');
INSERT INTO t2 VALUES ('lemon');
create view v2 as select * from t2 where a like 'a%' with check option;
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t2`;
CREATE TABLE `t2` (
`a` varchar(30) default NULL,
KEY `a` (`a`(5))
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `t2` WRITE;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
INSERT INTO `t2` VALUES ('alfred'),('angie'),('bingo'),('waffle'),('lemon');
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
UNLOCK TABLES;
DROP TABLE IF EXISTS `v2`;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 CREATE TABLE `v2` (
`a` varchar(30)
) */;
/*!50001 DROP TABLE IF EXISTS `v2`*/;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where (`t2`.`a` like _latin1'a%') */
/*!50002 WITH CASCADED CHECK OPTION */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
drop table t2;
drop view v2;
drop database db1;
create database db2;
use db2;
create table t1 (a int);
create table t2 (a int, b varchar(10), primary key(a));
insert into t2 values (1, "on"), (2, "off"), (10, "pol"), (12, "meg");
insert into t1 values (289), (298), (234), (456), (789);
create view v1 as select * from t2;
create view v2 as select * from t1;
drop table t1, t2;
drop view v1, v2;
drop database db2;
create database db1;
use db1;
show tables;
Tables_in_db1
t1
t2
v1
v2
select * from t2 order by a;
a b
1 on
2 off
10 pol
12 meg
drop table t1, t2;
drop database db1;
--fields-optionally-enclosed-by="
CREATE DATABASE mysqldump_test_db;
USE mysqldump_test_db;
CREATE TABLE t1 ( a INT );
@ -1681,6 +1595,7 @@ select * from t1;
a b
Osnabrück Köln
drop table t1;
--fields-optionally-enclosed-by="
create table `t1` (
t1_name varchar(255) default null,
t1_id int(10) unsigned not null auto_increment,
@ -1718,7 +1633,162 @@ t1 CREATE TABLE `t1` (
KEY `t1_name` (`t1_name`)
) ENGINE=MyISAM AUTO_INCREMENT=1003 DEFAULT CHARSET=latin1
drop table `t1`;
create table t1(a int);
create table t2(a int);
create table t3(a int);
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t3`;
CREATE TABLE `t3` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `t2`;
CREATE TABLE `t2` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
drop table t1, t2, t3;
create table t1 (a int);
mysqldump: Couldn't execute 'SELECT /*!40001 SQL_NO_CACHE */ * FROM `t1` WHERE xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx': 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 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1 (1064)
mysqldump: Got error: 1064: 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 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1 when retrieving data from server
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
drop table t1;
End of 4.1 tests
create database db1;
use db1;
CREATE TABLE t2 (
a varchar(30) default NULL,
KEY a (a(5))
);
INSERT INTO t2 VALUES ('alfred');
INSERT INTO t2 VALUES ('angie');
INSERT INTO t2 VALUES ('bingo');
INSERT INTO t2 VALUES ('waffle');
INSERT INTO t2 VALUES ('lemon');
create view v2 as select * from t2 where a like 'a%' with check option;
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t2`;
CREATE TABLE `t2` (
`a` varchar(30) default NULL,
KEY `a` (`a`(5))
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `t2` WRITE;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
INSERT INTO `t2` VALUES ('alfred'),('angie'),('bingo'),('waffle'),('lemon');
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
UNLOCK TABLES;
DROP TABLE IF EXISTS `v2`;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 CREATE TABLE `v2` (
`a` varchar(30)
) */;
/*!50001 DROP TABLE IF EXISTS `v2`*/;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where (`t2`.`a` like _latin1'a%') */
/*!50002 WITH CASCADED CHECK OPTION */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
drop table t2;
drop view v2;
drop database db1;
use test;
create database db2;
use db2;
create table t1 (a int);
create table t2 (a int, b varchar(10), primary key(a));
insert into t2 values (1, "on"), (2, "off"), (10, "pol"), (12, "meg");
insert into t1 values (289), (298), (234), (456), (789);
create view v1 as select * from t2;
create view v2 as select * from t1;
drop table t1, t2;
drop view v1, v2;
drop database db2;
use test;
create database db1;
use db1;
show tables;
Tables_in_db1
t1
t2
v1
v2
select * from t2 order by a;
a b
1 on
2 off
10 pol
12 meg
drop table t1, t2;
drop database db1;
use test;
create table t1(a int);
create view v1 as select * from t1;
@ -2623,44 +2693,6 @@ UNLOCK TABLES;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
drop table t1;
create table t1(a int);
create table t2(a int);
create table t3(a int);
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t3`;
CREATE TABLE `t3` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `t2`;
CREATE TABLE `t2` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
drop table t1, t2, t3;
End of 4.1 tests
create table t1 (a int);
insert into t1 values (289), (298), (234), (456), (789);
create definer = CURRENT_USER view v1 as select * from t1;
@ -2892,3 +2924,19 @@ CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
drop table t1;
drop user mysqltest_1@localhost;
create database mysqldump_myDB;
use mysqldump_myDB;
create user myDB_User;
grant create view, select on mysqldump_myDB.* to myDB_User@localhost;
create table t1 (c1 int);
insert into t1 values (3);
use mysqldump_myDB;
create view v1 (c1) as select * from t1;
use mysqldump_myDB;
drop view v1;
drop table t1;
revoke all privileges on mysqldump_myDB.* from myDB_User@localhost;
drop user myDB_User;
drop database mysqldump_myDB;
use test;
End of 5.0 tests

View file

@ -1307,7 +1307,7 @@ select auto from t1 where
('1901-01-01 01:01:01' between date_time and date_time)
order by auto;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where with pushed condition; Using filesort
1 SIMPLE t1 range medium_index medium_index 3 NULL 10 Using where with pushed condition; Using filesort
select auto from t1 where
("aaaa" between string and string) and
("aaaa" between vstring and vstring) and
@ -1409,7 +1409,7 @@ select auto from t1 where
('1901-01-01 01:01:01' not between date_time and date_time)
order by auto;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where with pushed condition; Using filesort
1 SIMPLE t1 range medium_index medium_index 3 NULL 20 Using where with pushed condition; Using filesort
select auto from t1 where
("aaaa" not between string and string) and
("aaaa" not between vstring and vstring) and

View file

@ -9,3 +9,6 @@ ndbd,1,localhost ndbd,2,localhost ndbd,3,localhost ndbd,4,localhost ndb_mgmd,5,l
ndbd,2,localhost ndbd,3,localhost ndbd,4,localhost ndbd,5,localhost ndb_mgmd,6,localhost mysqld,1, mysqld,7, mysqld,8, mysqld,9, mysqld,10,
ndbd,3,localhost ndbd,4,localhost ndbd,5,localhost ndbd,6,localhost ndb_mgmd,1,localhost ndb_mgmd,2,localhost mysqld,11, mysqld,12, mysqld,13, mysqld,14, mysqld,15,
shm,3,4,35,3 shm,3,5,35,3 shm,3,6,35,3 shm,4,5,35,4 shm,4,6,35,4 shm,5,6,35,5 tcp,11,3,55,3 tcp,11,4,55,4 tcp,11,5,55,5 tcp,11,6,55,6 tcp,12,3,55,3 tcp,12,4,55,4 tcp,12,5,55,5 tcp,12,6,55,6 tcp,13,3,55,3 tcp,13,4,55,4 tcp,13,5,55,5 tcp,13,6,55,6 tcp,14,3,55,3 tcp,14,4,55,4 tcp,14,5,55,5 tcp,14,6,55,6 tcp,15,3,55,3 tcp,15,4,55,4 tcp,15,5,55,5 tcp,15,6,55,6 tcp,1,3,55,1 tcp,1,4,55,1 tcp,1,5,55,1 tcp,1,6,55,1 tcp,2,3,55,2 tcp,2,4,55,2 tcp,2,5,55,2 tcp,2,6,55,2
1 2 3
1 2 3

View file

@ -854,3 +854,40 @@ b a
20 1
10 2
DROP TABLE t1;
CREATE TABLE t1 (a int, b int, PRIMARY KEY (a));
INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
explain SELECT t1.b as a, t2.b as c FROM
t1 LEFT JOIN t1 t2 ON (t1.a = t2.a AND t2.a = 2)
ORDER BY c;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary; Using filesort
1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1
SELECT t2.b as c FROM
t1 LEFT JOIN t1 t2 ON (t1.a = t2.a AND t2.a = 2)
ORDER BY c;
c
NULL
NULL
2
explain SELECT t1.b as a, t2.b as c FROM
t1 JOIN t1 t2 ON (t1.a = t2.a AND t2.a = 2)
ORDER BY c;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1
CREATE TABLE t2 LIKE t1;
INSERT INTO t2 SELECT * from t1;
CREATE TABLE t3 LIKE t1;
INSERT INTO t3 SELECT * from t1;
CREATE TABLE t4 LIKE t1;
INSERT INTO t4 SELECT * from t1;
INSERT INTO t1 values (0,0),(4,4);
SELECT t2.b FROM t1 LEFT JOIN (t2, t3 LEFT JOIN t4 ON t3.a=t4.a)
ON (t1.a=t2.a AND t1.b=t3.b) order by t2.b;
b
NULL
NULL
1
2
3
DROP TABLE t1,t2,t3,t4;

View file

@ -1297,3 +1297,18 @@ ERROR 3D000: No database selected
create temporary table t1 (i int);
ERROR 3D000: No database selected
use test;
DROP TABLE IF EXISTS t1, t2, t3;
CREATE TABLE t1 (i BIGINT, j BIGINT);
CREATE TABLE t2 (i BIGINT);
CREATE TABLE t3 (i BIGINT, j BIGINT);
PREPARE stmt FROM "SELECT * FROM t1 JOIN t2 ON (t2.i = t1.i)
LEFT JOIN t3 ON ((t3.i, t3.j) = (t1.i, t1.j))
WHERE t1.i = ?";
SET @a= 1;
EXECUTE stmt USING @a;
i j i i j
EXECUTE stmt USING @a;
i j i i j
DEALLOCATE PREPARE stmt;
DROP TABLE IF EXISTS t1, t2, t3;
End of 5.0 tests.

View file

@ -947,18 +947,24 @@ COUNT(*)
Warnings:
Warning 1292 Incorrect datetime value: '20050327 invalid' for column 'date' at row 1
Warning 1292 Incorrect datetime value: '20050327 invalid' for column 'date' at row 1
Warning 1292 Truncated incorrect DOUBLE value: '20050327 invalid'
Warning 1292 Truncated incorrect DOUBLE value: '20050327 invalid'
SELECT COUNT(*) FROM t1 WHERE date BETWEEN '20050326' AND '20050328 invalid';
COUNT(*)
0
Warnings:
Warning 1292 Incorrect datetime value: '20050328 invalid' for column 'date' at row 1
Warning 1292 Incorrect datetime value: '20050328 invalid' for column 'date' at row 1
Warning 1292 Truncated incorrect DOUBLE value: '20050328 invalid'
Warning 1292 Truncated incorrect DOUBLE value: '20050328 invalid'
SELECT COUNT(*) FROM t1 WHERE date BETWEEN '20050326' AND '20050327 invalid';
COUNT(*)
0
Warnings:
Warning 1292 Incorrect datetime value: '20050327 invalid' for column 'date' at row 1
Warning 1292 Incorrect datetime value: '20050327 invalid' for column 'date' at row 1
Warning 1292 Truncated incorrect DOUBLE value: '20050327 invalid'
Warning 1292 Truncated incorrect DOUBLE value: '20050327 invalid'
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0

View file

@ -838,3 +838,106 @@ select a, hex(filler) from t1 where a not between 'b' and 'b';
a hex(filler)
a 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
drop table t1,t2,t3;
create table t1 (a int);
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t2 (a int, key(a));
insert into t2 select 2*(A.a + 10*(B.a + 10*C.a)) from t1 A, t1 B, t1 C;
set @a="select * from t2 force index (a) where a NOT IN(0";
select count(*) from (select @a:=concat(@a, ',', a) from t2 ) Z;
count(*)
1000
set @a=concat(@a, ')');
insert into t2 values (11),(13),(15);
set @b= concat("explain ", @a);
prepare stmt1 from @b;
execute stmt1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 index a a 5 NULL 1003 Using where; Using index
prepare stmt1 from @a;
execute stmt1;
a
11
13
15
drop table t1, t2;
CREATE TABLE t1 (
id int NOT NULL DEFAULT '0',
b int NOT NULL DEFAULT '0',
c int NOT NULL DEFAULT '0',
INDEX idx1(b,c), INDEX idx2(c));
INSERT INTO t1(id) VALUES (1), (2), (3), (4), (5), (6), (7), (8);
INSERT INTO t1(b,c) VALUES (3,4), (3,4);
SELECT * FROM t1 WHERE b<=3 AND 3<=c;
id b c
0 3 4
0 3 4
SELECT * FROM t1 WHERE 3 BETWEEN b AND c;
id b c
0 3 4
0 3 4
EXPLAIN SELECT * FROM t1 WHERE b<=3 AND 3<=c;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range idx1,idx2 idx2 4 NULL 3 Using where
EXPLAIN SELECT * FROM t1 WHERE 3 BETWEEN b AND c;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range idx1,idx2 idx2 4 NULL 3 Using where
SELECT * FROM t1 WHERE 0 < b OR 0 > c;
id b c
0 3 4
0 3 4
SELECT * FROM t1 WHERE 0 NOT BETWEEN b AND c;
id b c
0 3 4
0 3 4
EXPLAIN SELECT * FROM t1 WHERE 0 < b OR 0 > c;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge idx1,idx2 idx1,idx2 4,4 NULL 4 Using sort_union(idx1,idx2); Using where
EXPLAIN SELECT * FROM t1 WHERE 0 NOT BETWEEN b AND c;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge idx1,idx2 idx1,idx2 4,4 NULL 4 Using sort_union(idx1,idx2); Using where
DROP TABLE t1;
CREATE TABLE t1 (
item char(20) NOT NULL default '',
started datetime NOT NULL default '0000-00-00 00:00:00',
price decimal(16,3) NOT NULL default '0.000',
PRIMARY KEY (item,started)
) ENGINE=MyISAM;
INSERT INTO t1 VALUES
('A1','2005-11-01 08:00:00',1000),
('A1','2005-11-15 00:00:00',2000),
('A1','2005-12-12 08:00:00',3000),
('A2','2005-12-01 08:00:00',1000);
EXPLAIN SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref PRIMARY PRIMARY 20 const 2 Using where
Warnings:
Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00' for column 'started' at row 1
Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00' for column 'started' at row 1
SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00';
item started price
A1 2005-11-01 08:00:00 1000.000
A1 2005-11-15 00:00:00 2000.000
Warnings:
Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00' for column 'started' at row 1
Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00' for column 'started' at row 1
SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-02 00:00:00';
item started price
A1 2005-11-01 08:00:00 1000.000
A1 2005-11-15 00:00:00 2000.000
DROP INDEX `PRIMARY` ON t1;
EXPLAIN SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
Warnings:
Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00' for column 'started' at row 1
SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00';
item started price
A1 2005-11-01 08:00:00 1000.000
A1 2005-11-15 00:00:00 2000.000
Warnings:
Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00' for column 'started' at row 1
SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-02 00:00:00';
item started price
A1 2005-11-01 08:00:00 1000.000
A1 2005-11-15 00:00:00 2000.000
DROP TABLE t1;

View file

@ -2328,9 +2328,9 @@ explain select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3
left join t4 on id3 = id4 where id2 = 1 or id4 = 1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 system NULL NULL NULL NULL 0 const row not found
1 SIMPLE t4 const id4 NULL NULL NULL 1
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
1 SIMPLE t2 ALL NULL NULL NULL NULL 1
1 SIMPLE t4 ALL id4 NULL NULL NULL 1 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 1 Using where
select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3
left join t4 on id3 = id4 where id2 = 1 or id4 = 1;
id1 id2 id3 id4 id44
@ -3479,3 +3479,41 @@ Warning 1466 Leading spaces are removed from name ' a '
execute stmt;
a
1
CREATE TABLE t1 (a int NOT NULL PRIMARY KEY, b int NOT NULL);
INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4);
CREATE TABLE t2 (c int NOT NULL, INDEX idx(c));
INSERT INTO t2 VALUES
(1), (1), (1), (1), (1), (1), (1), (1),
(2), (2), (2), (2),
(3), (3),
(4);
EXPLAIN SELECT b FROM t1, t2 WHERE b=c AND a=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
1 SIMPLE t2 ref idx idx 4 const 7 Using index
EXPLAIN SELECT b FROM t1, t2 WHERE b=c AND a=4;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
1 SIMPLE t2 ref idx idx 4 const 1 Using index
DROP TABLE t1, t2;
CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, a int);
INSERT INTO t1 VALUES (1,2), (2,NULL), (3,2);
CREATE TABLE t2 (b int, c INT, INDEX idx1(b));
INSERT INTO t2 VALUES (2,1), (3,2);
CREATE TABLE t3 (d int, e int, INDEX idx1(d));
INSERT INTO t3 VALUES (2,10), (2,20), (1,30), (2,40), (2,50);
EXPLAIN
SELECT * FROM t1 LEFT JOIN t2 ON t2.b=t1.a INNER JOIN t3 ON t3.d=t1.id
WHERE t1.id=2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
1 SIMPLE t2 const idx1 NULL NULL NULL 1
1 SIMPLE t3 ref idx1 idx1 5 const 3 Using where
SELECT * FROM t1 LEFT JOIN t2 ON t2.b=t1.a INNER JOIN t3 ON t3.d=t1.id
WHERE t1.id=2;
id a b c d e
2 NULL NULL NULL 2 10
2 NULL NULL NULL 2 20
2 NULL NULL NULL 2 40
2 NULL NULL NULL 2 50
DROP TABLE t1,t2,t3;

View file

@ -634,6 +634,45 @@ flush tables;
return 5;
end|
ERROR 0A000: FLUSH is not allowed in stored function or trigger
create function bug8409() returns int begin reset query cache;
return 1; end|
ERROR 0A000: RESET is not allowed in stored function or trigger
create function bug8409() returns int begin reset master;
return 1; end|
ERROR 0A000: RESET is not allowed in stored function or trigger
create function bug8409() returns int begin reset slave;
return 1; end|
ERROR 0A000: RESET is not allowed in stored function or trigger
create function bug8409() returns int begin flush hosts;
return 1; end|
ERROR 0A000: FLUSH is not allowed in stored function or trigger
create function bug8409() returns int begin flush privileges;
return 1; end|
ERROR 0A000: FLUSH is not allowed in stored function or trigger
create function bug8409() returns int begin flush tables with read lock;
return 1; end|
ERROR 0A000: FLUSH is not allowed in stored function or trigger
create function bug8409() returns int begin flush tables;
return 1; end|
ERROR 0A000: FLUSH is not allowed in stored function or trigger
create function bug8409() returns int begin flush logs;
return 1; end|
ERROR 0A000: FLUSH is not allowed in stored function or trigger
create function bug8409() returns int begin flush status;
return 1; end|
ERROR 0A000: FLUSH is not allowed in stored function or trigger
create function bug8409() returns int begin flush slave;
return 1; end|
ERROR 0A000: FLUSH is not allowed in stored function or trigger
create function bug8409() returns int begin flush master;
return 1; end|
ERROR 0A000: FLUSH is not allowed in stored function or trigger
create function bug8409() returns int begin flush des_key_file;
return 1; end|
ERROR 0A000: FLUSH is not allowed in stored function or trigger
create function bug8409() returns int begin flush user_resources;
return 1; end|
ERROR 0A000: FLUSH is not allowed in stored function or trigger
create procedure bug9529_901234567890123456789012345678901234567890123456789012345()
begin
end|

View file

@ -4872,8 +4872,6 @@ declare continue handler for sqlexception begin end;
select no_such_function();
end|
call bug18787()|
no_such_function()
NULL
drop procedure bug18787|
create database bug18344_012345678901|
use bug18344_012345678901|
@ -5222,6 +5220,126 @@ CHARSET(p3) COLLATION(p3)
greek greek_general_ci
use test|
DROP DATABASE mysqltest1|
drop table if exists t3|
drop table if exists t4|
drop procedure if exists bug8153_subselect|
drop procedure if exists bug8153_subselect_a|
drop procedure if exists bug8153_subselect_b|
drop procedure if exists bug8153_proc_a|
drop procedure if exists bug8153_proc_b|
create table t3 (a int)|
create table t4 (a int)|
insert into t3 values (1), (1), (2), (3)|
insert into t4 values (1), (1)|
create procedure bug8153_subselect()
begin
declare continue handler for sqlexception
begin
select 'statement failed';
end;
update t3 set a=a+1 where (select a from t4 where a=1) is null;
select 'statement after update';
end|
call bug8153_subselect()|
statement failed
statement failed
statement after update
statement after update
select * from t3|
a
1
1
2
3
call bug8153_subselect()|
statement failed
statement failed
statement after update
statement after update
select * from t3|
a
1
1
2
3
drop procedure bug8153_subselect|
create procedure bug8153_subselect_a()
begin
declare continue handler for sqlexception
begin
select 'in continue handler';
end;
select 'reachable code a1';
call bug8153_subselect_b();
select 'reachable code a2';
end|
create procedure bug8153_subselect_b()
begin
select 'reachable code b1';
update t3 set a=a+1 where (select a from t4 where a=1) is null;
select 'unreachable code b2';
end|
call bug8153_subselect_a()|
reachable code a1
reachable code a1
reachable code b1
reachable code b1
in continue handler
in continue handler
reachable code a2
reachable code a2
select * from t3|
a
1
1
2
3
call bug8153_subselect_a()|
reachable code a1
reachable code a1
reachable code b1
reachable code b1
in continue handler
in continue handler
reachable code a2
reachable code a2
select * from t3|
a
1
1
2
3
drop procedure bug8153_subselect_a|
drop procedure bug8153_subselect_b|
create procedure bug8153_proc_a()
begin
declare continue handler for sqlexception
begin
select 'in continue handler';
end;
select 'reachable code a1';
call bug8153_proc_b();
select 'reachable code a2';
end|
create procedure bug8153_proc_b()
begin
select 'reachable code b1';
select no_such_function();
select 'unreachable code b2';
end|
call bug8153_proc_a()|
reachable code a1
reachable code a1
reachable code b1
reachable code b1
in continue handler
in continue handler
reachable code a2
reachable code a2
drop procedure bug8153_proc_a|
drop procedure bug8153_proc_b|
drop table t3|
drop table t4|
drop procedure if exists bug19862|
CREATE TABLE t11 (a INT)|
CREATE TABLE t12 (a INT)|
@ -5256,4 +5374,24 @@ a
1
use test|
drop table t3|
DROP PROCEDURE IF EXISTS bug16899_p1|
DROP FUNCTION IF EXISTS bug16899_f1|
CREATE DEFINER=1234567890abcdefGHIKL@localhost PROCEDURE bug16899_p1()
BEGIN
SET @a = 1;
END|
ERROR HY000: String '1234567890abcdefGHIKL' is too long for user name (should be no longer than 16)
CREATE DEFINER=some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY
FUNCTION bug16899_f1() RETURNS INT
BEGIN
RETURN 1;
END|
ERROR HY000: String '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY' is too long for host name (should be no longer than 60)
drop procedure if exists bug21416|
create procedure bug21416() show create procedure bug21416|
call bug21416()|
Procedure sql_mode Create Procedure
bug21416 CREATE DEFINER=`root`@`localhost` PROCEDURE `bug21416`()
show create procedure bug21416
drop procedure bug21416|
drop table t1,t2;

View file

@ -2915,6 +2915,28 @@ select * from t1 where NOT(s1 = ALL (select s1/s1 from t1));
s1
2
drop table t1;
create table t1 (
retailerID varchar(8) NOT NULL,
statusID int(10) unsigned NOT NULL,
changed datetime NOT NULL,
UNIQUE KEY retailerID (retailerID, statusID, changed)
);
INSERT INTO t1 VALUES("0026", "1", "2005-12-06 12:18:56");
INSERT INTO t1 VALUES("0026", "2", "2006-01-06 12:25:53");
INSERT INTO t1 VALUES("0037", "1", "2005-12-06 12:18:56");
INSERT INTO t1 VALUES("0037", "2", "2006-01-06 12:25:53");
INSERT INTO t1 VALUES("0048", "1", "2006-01-06 12:37:50");
INSERT INTO t1 VALUES("0059", "1", "2006-01-06 12:37:50");
select * from t1 r1
where (r1.retailerID,(r1.changed)) in
(SELECT r2.retailerId,(max(changed)) from t1 r2
group by r2.retailerId);
retailerID statusID changed
0026 2 2006-01-06 12:25:53
0037 2 2006-01-06 12:25:53
0048 1 2006-01-06 12:37:50
0059 1 2006-01-06 12:37:50
drop table t1;
create table t1 (df decimal(5,1));
insert into t1 values(1.1);
insert into t1 values(2.2);

View file

@ -626,12 +626,51 @@ Trigger Event Table Statement Timing Created sql_mode Definer
t1_bi INSERT t1 set new.a = '2004-01-00' BEFORE # root@localhost
drop table t1;
create table t1 (id int);
create trigger t1_ai after insert on t1 for each row reset query cache;
ERROR 0A000: RESET is not allowed in stored function or trigger
create trigger t1_ai after insert on t1 for each row reset master;
ERROR 0A000: RESET is not allowed in stored function or trigger
create trigger t1_ai after insert on t1 for each row reset slave;
ERROR 0A000: RESET is not allowed in stored function or trigger
create trigger t1_ai after insert on t1 for each row flush hosts;
ERROR 0A000: FLUSH is not allowed in stored function or trigger
create trigger t1_ai after insert on t1 for each row flush tables with read lock;
ERROR 0A000: FLUSH is not allowed in stored function or trigger
create trigger t1_ai after insert on t1 for each row flush logs;
ERROR 0A000: FLUSH is not allowed in stored function or trigger
create trigger t1_ai after insert on t1 for each row flush status;
ERROR 0A000: FLUSH is not allowed in stored function or trigger
create trigger t1_ai after insert on t1 for each row flush slave;
ERROR 0A000: FLUSH is not allowed in stored function or trigger
create trigger t1_ai after insert on t1 for each row flush master;
ERROR 0A000: FLUSH is not allowed in stored function or trigger
create trigger t1_ai after insert on t1 for each row flush des_key_file;
ERROR 0A000: FLUSH is not allowed in stored function or trigger
create trigger t1_ai after insert on t1 for each row flush user_resources;
ERROR 0A000: FLUSH is not allowed in stored function or trigger
create trigger t1_ai after insert on t1 for each row flush tables;
ERROR 0A000: FLUSH is not allowed in stored function or trigger
create trigger t1_ai after insert on t1 for each row flush privileges;
ERROR 0A000: FLUSH is not allowed in stored function or trigger
create procedure p1() flush tables;
drop procedure if exists p1;
create trigger t1_ai after insert on t1 for each row call p1();
create procedure p1() flush tables;
insert into t1 values (0);
ERROR 0A000: FLUSH is not allowed in stored function or trigger
drop procedure p1;
create procedure p1() reset query cache;
insert into t1 values (0);
ERROR 0A000: RESET is not allowed in stored function or trigger
drop procedure p1;
create procedure p1() reset master;
insert into t1 values (0);
ERROR 0A000: RESET is not allowed in stored function or trigger
drop procedure p1;
create procedure p1() reset slave;
insert into t1 values (0);
ERROR 0A000: RESET is not allowed in stored function or trigger
drop procedure p1;
create procedure p1() flush hosts;
insert into t1 values (0);
ERROR 0A000: FLUSH is not allowed in stored function or trigger
drop procedure p1;
@ -639,6 +678,38 @@ create procedure p1() flush privileges;
insert into t1 values (0);
ERROR 0A000: FLUSH is not allowed in stored function or trigger
drop procedure p1;
create procedure p1() flush tables with read lock;
insert into t1 values (0);
ERROR 0A000: FLUSH is not allowed in stored function or trigger
drop procedure p1;
create procedure p1() flush tables;
insert into t1 values (0);
ERROR 0A000: FLUSH is not allowed in stored function or trigger
drop procedure p1;
create procedure p1() flush logs;
insert into t1 values (0);
ERROR 0A000: FLUSH is not allowed in stored function or trigger
drop procedure p1;
create procedure p1() flush status;
insert into t1 values (0);
ERROR 0A000: FLUSH is not allowed in stored function or trigger
drop procedure p1;
create procedure p1() flush slave;
insert into t1 values (0);
ERROR 0A000: FLUSH is not allowed in stored function or trigger
drop procedure p1;
create procedure p1() flush master;
insert into t1 values (0);
ERROR 0A000: FLUSH is not allowed in stored function or trigger
drop procedure p1;
create procedure p1() flush des_key_file;
insert into t1 values (0);
ERROR 0A000: FLUSH is not allowed in stored function or trigger
drop procedure p1;
create procedure p1() flush user_resources;
insert into t1 values (0);
ERROR 0A000: FLUSH is not allowed in stored function or trigger
drop procedure p1;
drop table t1;
create table t1 (id int, data int, username varchar(16));
insert into t1 (id, data) values (1, 0);
@ -1089,4 +1160,17 @@ begin
set @a:= 1;
end|
ERROR HY000: Triggers can not be created on system tables
use test|
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
CREATE TABLE t1(c INT);
CREATE TABLE t2(c INT);
CREATE DEFINER=1234567890abcdefGHIKL@localhost
TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1;
ERROR HY000: String '1234567890abcdefGHIKL' is too long for user name (should be no longer than 16)
CREATE DEFINER=some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY
TRIGGER t2_bi BEFORE INSERT ON t2 FOR EACH ROW SET @a = 2;
ERROR HY000: String '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY' is too long for host name (should be no longer than 60)
DROP TABLE t1;
DROP TABLE t2;
End of 5.0 tests

View file

@ -168,3 +168,14 @@ dt
0000-00-00 00:00:00
0000-00-00 00:00:00
drop table t1;
CREATE TABLE t1(a DATETIME NOT NULL);
INSERT INTO t1 VALUES ('20060606155555');
SELECT a FROM t1 WHERE a=(SELECT MAX(a) FROM t1) AND (a="20060606155555");
a
2006-06-06 15:55:55
PREPARE s FROM 'SELECT a FROM t1 WHERE a=(SELECT MAX(a) FROM t1) AND (a="20060606155555")';
EXECUTE s;
a
2006-06-06 15:55:55
DROP PREPARE s;
DROP TABLE t1;

View file

@ -422,3 +422,34 @@ DROP TABLE IF EXISTS t1;
CREATE TABLE t1(f1 CHAR(100) DEFAULT 'test');
INSERT INTO t1 VALUES(SUBSTR(f1, 1, 3));
DROP TABLE IF EXISTS t1;
drop table if exists t1, t2, t3;
create table t3 (
id int(11),
en varchar(255) character set utf8,
cz varchar(255) character set utf8
);
truncate table t3;
insert into t3 (id, en, cz) values
(1,'en string 1','cz string 1'),
(2,'en string 2','cz string 2'),
(3,'en string 3','cz string 3');
create table t1 (
id int(11),
name_id int(11)
);
insert into t1 (id, name_id) values (1,1), (2,3), (3,3);
create table t2 (id int(11));
insert into t2 (id) values (1), (2), (3);
select t1.*, t2.id, t3.en, t3.cz from t1 left join t2 on t1.id=t2.id
left join t3 on t1.id=t3.id order by t3.id;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t1 t1 id id 3 11 1 Y 32768 0 63
def test t1 t1 name_id name_id 3 11 1 Y 32768 0 63
def test t2 t2 id id 3 11 1 Y 32768 0 63
def test t3 t3 en en 253 255 11 Y 0 0 8
def test t3 t3 cz cz 253 255 11 Y 0 0 8
id name_id id en cz
1 1 1 en string 1 cz string 1
2 3 2 en string 2 cz string 2
3 3 3 en string 3 cz string 3
drop table t1, t2, t3;

View file

@ -292,3 +292,12 @@ SELECT @a;
@a
18446744071710965857
drop table bigfailure;
create table t1(f1 int, f2 int);
insert into t1 values (1,2),(2,3),(3,1);
select @var:=f2 from t1 group by f1 order by f2 desc limit 1;
@var:=f2
3
select @var;
@var
3
drop table t1;

View file

@ -689,6 +689,12 @@ select @@log_queries_not_using_indexes;
show variables like 'log_queries_not_using_indexes';
Variable_name Value
log_queries_not_using_indexes OFF
select @@"";
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 '""' at line 1
select @@&;
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 '&' at line 1
select @@@;
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 '@' at line 1
End of 5.0 tests
set global binlog_cache_size =@my_binlog_cache_size;
set global connect_timeout =@my_connect_timeout;

View file

@ -2850,3 +2850,70 @@ Tables_in_test
t1
DROP TABLE t1;
DROP VIEW IF EXISTS v1;
CREATE DATABASE bug21261DB;
USE bug21261DB;
CREATE TABLE t1 (x INT);
CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT x FROM t1;
GRANT INSERT, UPDATE ON v1 TO 'user21261'@'localhost';
GRANT INSERT, UPDATE ON t1 TO 'user21261'@'localhost';
CREATE TABLE t2 (y INT);
GRANT SELECT ON t2 TO 'user21261'@'localhost';
INSERT INTO v1 (x) VALUES (5);
UPDATE v1 SET x=1;
GRANT SELECT ON v1 TO 'user21261'@'localhost';
GRANT SELECT ON t1 TO 'user21261'@'localhost';
UPDATE v1,t2 SET x=1 WHERE x=y;
SELECT * FROM t1;
x
1
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'user21261'@'localhost';
DROP USER 'user21261'@'localhost';
DROP VIEW v1;
DROP TABLE t1;
DROP DATABASE bug21261DB;
USE test;
create table t1 (f1 datetime);
create view v1 as select * from t1 where f1 between now() and now() + interval 1 minute;
show create view v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` where (`t1`.`f1` between now() and (now() + interval 1 minute))
drop view v1;
drop table t1;
DROP TABLE IF EXISTS t1;
DROP VIEW IF EXISTS v1;
DROP VIEW IF EXISTS v2;
CREATE TABLE t1(a INT, b INT);
CREATE DEFINER=1234567890abcdefGHIKL@localhost
VIEW v1 AS SELECT a FROM t1;
ERROR HY000: String '1234567890abcdefGHIKL' is too long for user name (should be no longer than 16)
CREATE DEFINER=some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY
VIEW v2 AS SELECT b FROM t1;
ERROR HY000: String '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY' is too long for host name (should be no longer than 60)
DROP TABLE t1;
DROP FUNCTION IF EXISTS f1;
DROP FUNCTION IF EXISTS f2;
DROP VIEW IF EXISTS v1, v2;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (i INT);
CREATE VIEW v1 AS SELECT * FROM t1;
CREATE FUNCTION f1() RETURNS INT
BEGIN
INSERT INTO v1 VALUES (0);
RETURN 0;
END |
SELECT f1();
f1()
0
CREATE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t1;
CREATE FUNCTION f2() RETURNS INT
BEGIN
INSERT INTO v2 VALUES (0);
RETURN 0;
END |
SELECT f2();
ERROR HY000: The target table v2 of the INSERT is not updatable
DROP FUNCTION f1;
DROP FUNCTION f2;
DROP VIEW v1, v2;
DROP TABLE t1;
End of 5.0 tests.

Binary file not shown.

View file

@ -37,3 +37,12 @@ SELECT CHAR(31) = '', '' = CHAR(31);
SELECT CHAR(30) = '', '' = CHAR(30);
# End of 4.1 tests
#
#Bug #21159: Optimizer: wrong result after AND with different data types
#
create table t1 (a tinyint(1),b binary(1));
insert into t1 values (0x01,0x01);
select * from t1 where a=b;
select * from t1 where a=b and b=0x01;
drop table if exists t1;

View file

@ -187,4 +187,16 @@ select rpad(c1,3,'
#select case c1 when 'ß' then 'ß' when 'ö' then 'ö' else 'c' end from t1;
#select export_set(5,c1,'ö'), export_set(5,'ö',c1) from t1;
drop table t1;
# End of 4.1 tests
#
# Bug 20695: problem with field default value's character set
#
set names koi8r;
create table t1(a char character set cp1251 default _koi8r 0xFF);
show create table t1;
drop table t1;
--error 1067
create table t1(a char character set latin1 default _cp1251 0xFF);
--echo End of 4.1 tests

View file

@ -465,7 +465,51 @@ INSERT INTO t1 VALUES (1, 'ZZZZZ'), (1, 'ZZZ'), (2, 'ZZZ'), (2, 'ZZZZZ');
SELECT id, MIN(s) FROM t1 GROUP BY id;
DROP TABLE t1;
# End of 4.1 tests
#
# Bug #20536: md5() with GROUP BY and UCS2 return different results on myisam/innodb
#
--disable_warnings
drop table if exists bug20536;
--enable_warnings
set names latin1;
create table bug20536 (id bigint not null auto_increment primary key, name
varchar(255) character set ucs2 not null);
insert into `bug20536` (`id`,`name`) values (1, _latin1 x'7465737431'), (2, "'test\\_2'");
select md5(name) from bug20536;
select sha1(name) from bug20536;
select make_set(3, name, upper(name)) from bug20536;
select export_set(5, name, upper(name)) from bug20536;
select export_set(5, name, upper(name), ",", 5) from bug20536;
# Some broken functions: add these tests just to document current behavior.
# PASSWORD and OLD_PASSWORD don't work with UCS2 strings, but to fix it would
# not be backwards compatible in all cases, so it's best to leave it alone
select password(name) from bug20536;
select old_password(name) from bug20536;
# Disable test case as encrypt relies on 'crypt' function.
# "decrypt" is noramlly tested in func_crypt.test which have a
# "have_crypt.inc" test
--disable_parsing
# ENCRYPT relies on OS function crypt() which takes a NUL-terminated string; it
# doesn't return good results for strings with embedded 0 bytes. It won't be
# fixed unless we choose to re-implement the crypt() function ourselves to take
# an extra size_t string_length argument.
select encrypt(name, 'SALT') from bug20536;
--enable_parsing
# QUOTE doesn't work with UCS2 data. It would require a total rewrite
# of Item_func_quote::val_str(), which isn't worthwhile until UCS2 is
# supported fully as a client character set.
select quote(name) from bug20536;
drop table bug20536;
--echo End of 4.1 tests
#
# Conversion from an UCS2 string to a decimal column
@ -497,3 +541,5 @@ 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';
drop table t1;
--echo End of 5.0 tests

View file

@ -727,6 +727,24 @@ drop table t1;
select repeat(_utf8'+',3) as h union select NULL;
select ifnull(NULL, _utf8'string');
#
# Bug#9509 Optimizer: wrong result after AND with comparisons
#
set names utf8;
create table t1 (s1 char(5) character set utf8 collate utf8_lithuanian_ci);
insert into t1 values ('I'),('K'),('Y');
select * from t1 where s1 < 'K' and s1 = 'Y';
select * from t1 where 'K' > s1 and s1 = 'Y';
drop table t1;
create table t1 (s1 char(5) character set utf8 collate utf8_czech_ci);
insert into t1 values ('c'),('d'),('h'),('ch'),('CH'),('cH'),('Ch'),('i');
select * from t1 where s1 > 'd' and s1 = 'CH';
select * from t1 where 'd' < s1 and s1 = 'CH';
select * from t1 where s1 = 'cH' and s1 <> 'ch';
select * from t1 where 'cH' = s1 and s1 <> 'ch';
drop table t1;
#
# Bug#10714: Inserting double value into utf8 column crashes server
#

View file

@ -385,6 +385,17 @@ insert into t1 values (1, "line number one"), (2, "line number two"), (3, "line
select distinct id, IFNULL(dsc, '-') from t1;
drop table t1;
#
# Bug 21456: SELECT DISTINCT(x) produces incorrect results when using order by
#
CREATE TABLE t1 (a int primary key, b int);
INSERT INTO t1 (a,b) values (1,1), (2,3), (3,2);
explain SELECT DISTINCT a, b FROM t1 ORDER BY b;
SELECT DISTINCT a, b FROM t1 ORDER BY b;
DROP TABLE t1;
# End of 4.1 tests

View file

@ -81,3 +81,44 @@ show tables;
drop table t1;
# End of 4.1 tests
#
# Test for bug#21216 "Simultaneous DROP TABLE and SHOW OPEN TABLES causes
# server to crash". Crash (caused by failed assertion in 5.0 or by null
# pointer dereference in 5.1) happened when one ran SHOW OPEN TABLES
# while concurrently doing DROP TABLE (or RENAME TABLE, CREATE TABLE LIKE
# or any other command that takes name-lock) in other connection.
#
# Also includes test for similar bug#12212 "Crash that happens during
# removing of database name from cache" reappeared in 5.1 as bug#19403
# In its case crash happened when one concurrently executed DROP DATABASE
# and one of name-locking command.
#
--disable_warnings
drop database if exists mysqltest;
drop table if exists t1;
--enable_warnings
create table t1 (i int);
lock tables t1 read;
create database mysqltest;
connect (addconroot1, localhost, root,,);
--send drop table t1
connect (addconroot2, localhost, root,,);
# Server should not crash in any of the following statements
--disable_result_log
show open tables;
--enable_result_log
--send drop database mysqltest
connection default;
select 1;
unlock tables;
connection addconroot1;
--reap
connection addconroot2;
--reap
disconnect addconroot1;
disconnect addconroot2;
connection default;
--echo End of 5.0 tests

View file

@ -78,7 +78,13 @@ connection default;
DROP TABLE t1;
# End of 4.1 tests
#
# Bug #21531: EXPORT_SET() doesn't accept args with coercible character sets
#
select export_set(3, _latin1'foo', _utf8'bar', ',', 4);
--echo End of 4.1 tests
#
# Test for BUG#9535
@ -87,7 +93,9 @@ create table t1 as select uuid(), length(uuid());
show create table t1;
drop table t1;
#
# Bug #6760: Add SLEEP() function
#
create table t1 (a timestamp default '2005-05-05 01:01:01',
b timestamp default '2005-05-05 01:01:01');
insert into t1 set a = now();
@ -117,4 +125,4 @@ drop table t2;
drop table t1;
set global query_cache_size=default;
# End of 5.0 tests
--echo End of 5.0 tests

View file

@ -583,3 +583,21 @@ DROP TABLE t1,t2;
# Restore timezone to default
set time_zone= @@global.time_zone;
#
# 21913: DATE_FORMAT() Crashes mysql server if I use it through
# mysql-connector-j driver.
#
SET NAMES latin1;
SET character_set_results = NULL;
SHOW VARIABLES LIKE 'character_set_results';
CREATE TABLE testBug8868 (field1 DATE, field2 VARCHAR(32) CHARACTER SET BINARY);
INSERT INTO testBug8868 VALUES ('2006-09-04', 'abcd');
SELECT DATE_FORMAT(field1,'%b-%e %l:%i%p') as fmtddate, field2 FROM testBug8868;
DROP TABLE testBug8868;
SET NAMES DEFAULT;

View file

@ -682,8 +682,6 @@ drop table t2;
drop table t1;
#
# Bug#20214: Incorrect error when user calls SHOW CREATE VIEW on non
# privileged view
@ -807,12 +805,62 @@ DROP DATABASE mysqltest3;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'mysqltest_1'@'localhost';
DROP USER 'mysqltest_1'@'localhost';
# restore the original database
use test;
#
# Bug #10668: CREATE USER does not enforce username length limit
#
--error ER_CANNOT_USER
--error ER_WRONG_STRING_LENGTH
create user mysqltest1_thisisreallytoolong;
#
# Test for BUG#16899: Possible buffer overflow in handling of DEFINER-clause.
#
# These checks are intended to ensure that appropriate errors are risen when
# illegal user name or hostname is specified in user-clause of GRANT/REVOKE
# statements.
#
# Working with database-level privileges.
--error ER_WRONG_STRING_LENGTH
GRANT CREATE ON mysqltest.* TO 1234567890abcdefGHIKL@localhost;
--error ER_WRONG_STRING_LENGTH
GRANT CREATE ON mysqltest.* TO some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY;
--error ER_WRONG_STRING_LENGTH
REVOKE CREATE ON mysqltest.* FROM 1234567890abcdefGHIKL@localhost;
--error ER_WRONG_STRING_LENGTH
REVOKE CREATE ON mysqltest.* FROM some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY;
# Working with table-level privileges.
--error ER_WRONG_STRING_LENGTH
GRANT CREATE ON t1 TO 1234567890abcdefGHIKL@localhost;
--error ER_WRONG_STRING_LENGTH
GRANT CREATE ON t1 TO some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY;
--error ER_WRONG_STRING_LENGTH
REVOKE CREATE ON t1 FROM 1234567890abcdefGHIKL@localhost;
--error ER_WRONG_STRING_LENGTH
REVOKE CREATE ON t1 FROM some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY;
# Working with routine-level privileges.
--error ER_WRONG_STRING_LENGTH
GRANT EXECUTE ON PROCEDURE p1 TO 1234567890abcdefGHIKL@localhost;
--error ER_WRONG_STRING_LENGTH
GRANT EXECUTE ON PROCEDURE p1 TO some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY;
--error ER_WRONG_STRING_LENGTH
REVOKE EXECUTE ON PROCEDURE p1 FROM 1234567890abcdefGHIKL@localhost;
--error ER_WRONG_STRING_LENGTH
REVOKE EXECUTE ON PROCEDURE t1 FROM some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY;
--echo End of 5.0 tests

View file

@ -655,3 +655,15 @@ where t2.b=v1.a GROUP BY t2.b;
DROP VIEW v1;
DROP TABLE t1,t2;
#
# Bug #21174: Index degrades sort performance and
# optimizer does not honor IGNORE INDEX
#
CREATE TABLE t1 (a INT, b INT, KEY(a));
INSERT INTO t1 VALUES (1, 1), (2, 2), (3,3), (4,4);
EXPLAIN SELECT a, SUM(b) FROM t1 GROUP BY a LIMIT 2;
EXPLAIN SELECT a, SUM(b) FROM t1 IGNORE INDEX (a) GROUP BY a LIMIT 2;
DROP TABLE t1;

View file

@ -1,3 +1,4 @@
-- source include/not_embedded.inc
#
# test of HANDLER ...
#

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