mirror of
https://github.com/MariaDB/server.git
synced 2025-05-11 13:21:44 +03:00
Merge mysql.com:/usr/local/bk/mysql-5.0
into mysql.com:/home/pem/work/mysql-5.0
This commit is contained in:
commit
b42bf3cc55
19
.bzrignore
19
.bzrignore
@ -102,6 +102,7 @@ Makefile.in
|
|||||||
Makefile.in'
|
Makefile.in'
|
||||||
PENDING/*
|
PENDING/*
|
||||||
TAGS
|
TAGS
|
||||||
|
VC++Files/client/mysql_amd64.dsp
|
||||||
ac_available_languages_fragment
|
ac_available_languages_fragment
|
||||||
acinclude.m4
|
acinclude.m4
|
||||||
aclocal.m4
|
aclocal.m4
|
||||||
@ -274,6 +275,8 @@ client/mysqlmanager-pwgen
|
|||||||
client/mysqlmanagerc
|
client/mysqlmanagerc
|
||||||
client/mysqlshow
|
client/mysqlshow
|
||||||
client/mysqltest
|
client/mysqltest
|
||||||
|
client/mysqltestmanager-pwgen
|
||||||
|
client/mysqltestmanagerc
|
||||||
client/mysys_priv.h
|
client/mysys_priv.h
|
||||||
client/select_test
|
client/select_test
|
||||||
client/ssl_test
|
client/ssl_test
|
||||||
@ -284,10 +287,12 @@ cmd-line-utils/libedit/common.h
|
|||||||
cmd-line-utils/libedit/makelist
|
cmd-line-utils/libedit/makelist
|
||||||
comon.h
|
comon.h
|
||||||
config.cache
|
config.cache
|
||||||
|
config.guess
|
||||||
config.h
|
config.h
|
||||||
config.h.in
|
config.h.in
|
||||||
config.log
|
config.log
|
||||||
config.status
|
config.status
|
||||||
|
config.sub
|
||||||
configure
|
configure
|
||||||
configure.lineno
|
configure.lineno
|
||||||
core
|
core
|
||||||
@ -355,6 +360,7 @@ innobase/ib_config.h.in
|
|||||||
innobase/stamp-h1
|
innobase/stamp-h1
|
||||||
insert_test
|
insert_test
|
||||||
install
|
install
|
||||||
|
install-sh
|
||||||
isam/isamchk
|
isam/isamchk
|
||||||
isam/isamlog
|
isam/isamlog
|
||||||
isam/pack_isam
|
isam/pack_isam
|
||||||
@ -519,7 +525,9 @@ linked_libmysqldex_sources
|
|||||||
linked_server_sources
|
linked_server_sources
|
||||||
linked_tools_sources
|
linked_tools_sources
|
||||||
locked
|
locked
|
||||||
|
ltmain.sh
|
||||||
man/*.1
|
man/*.1
|
||||||
|
missing
|
||||||
mit-pthreads/config.flags
|
mit-pthreads/config.flags
|
||||||
mit-pthreads/include/bits
|
mit-pthreads/include/bits
|
||||||
mit-pthreads/include/pthread/machdep.h
|
mit-pthreads/include/pthread/machdep.h
|
||||||
@ -936,6 +944,7 @@ scripts/mysqld_multi
|
|||||||
scripts/mysqld_safe
|
scripts/mysqld_safe
|
||||||
scripts/mysqldumpslow
|
scripts/mysqldumpslow
|
||||||
scripts/mysqlhotcopy
|
scripts/mysqlhotcopy
|
||||||
|
scripts/mysqlhotcopy.sh.rej
|
||||||
scripts/safe_mysqld
|
scripts/safe_mysqld
|
||||||
select_test
|
select_test
|
||||||
server-tools/instance-manager/client.c
|
server-tools/instance-manager/client.c
|
||||||
@ -1100,18 +1109,10 @@ tmp/*
|
|||||||
tools/my_vsnprintf.c
|
tools/my_vsnprintf.c
|
||||||
tools/mysqlmanager
|
tools/mysqlmanager
|
||||||
tools/mysqlmngd
|
tools/mysqlmngd
|
||||||
|
tools/mysqltestmanager
|
||||||
tools/mysys_priv.h
|
tools/mysys_priv.h
|
||||||
vi.h
|
vi.h
|
||||||
vio/test-ssl
|
vio/test-ssl
|
||||||
vio/test-sslclient
|
vio/test-sslclient
|
||||||
vio/test-sslserver
|
vio/test-sslserver
|
||||||
vio/viotest-ssl
|
vio/viotest-ssl
|
||||||
VC++Files/client/mysql_amd64.dsp
|
|
||||||
client/mysqltestmanager-pwgen
|
|
||||||
client/mysqltestmanagerc
|
|
||||||
tools/mysqltestmanager
|
|
||||||
config.guess
|
|
||||||
config.sub
|
|
||||||
install-sh
|
|
||||||
ltmain.sh
|
|
||||||
missing
|
|
||||||
|
175
BUILD/check-cpu
175
BUILD/check-cpu
@ -6,113 +6,200 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
if test -r /proc/cpuinfo ; then
|
if test -r /proc/cpuinfo ; then
|
||||||
|
# on Linux (and others?) we can get detailed CPU information out of /proc
|
||||||
cpuinfo="cat /proc/cpuinfo"
|
cpuinfo="cat /proc/cpuinfo"
|
||||||
|
|
||||||
|
# detect CPU family
|
||||||
cpu_family=`$cpuinfo | grep 'family' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
|
cpu_family=`$cpuinfo | grep 'family' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
|
||||||
if test -z "$cpu_family" ; then
|
if test -z "$cpu_family" ; then
|
||||||
cpu_family=`$cpuinfo | grep 'cpu' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
|
cpu_family=`$cpuinfo | grep 'cpu' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# detect CPU vendor and model
|
||||||
cpu_vendor=`$cpuinfo | grep 'vendor_id' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
|
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`
|
model_name=`$cpuinfo | grep 'model name' | cut -d ':' -f 2 | head -1`
|
||||||
if test -z "$model_name" ; then
|
if test -z "$model_name" ; then
|
||||||
model_name=`$cpuinfo | grep 'cpu model' | cut -d ':' -f 2 | head -1`
|
model_name=`$cpuinfo | grep 'cpu model' | cut -d ':' -f 2 | head -1`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# fallback: get CPU model from uname output
|
||||||
if test -z "$model_name" ; then
|
if test -z "$model_name" ; then
|
||||||
model_name=`uname -m`
|
model_name=`uname -m`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# parse CPU flags
|
||||||
|
for flag in `$cpuinfo | grep '^flags' | sed -e 's/^flags.*: //'`; do
|
||||||
|
eval cpu_flag_$flag=yes
|
||||||
|
done
|
||||||
else
|
else
|
||||||
# Fallback when there is no /proc/cpuinfo
|
# Fallback when there is no /proc/cpuinfo
|
||||||
case "`uname -s`" in
|
case "`uname -s`" in
|
||||||
FreeBSD)
|
FreeBSD|OpenBSD)
|
||||||
cpu_family=`uname -m`;
|
cpu_family=`uname -m`;
|
||||||
model_name=`sysctl -b hw.model`
|
model_name=`sysctl -n hw.model`
|
||||||
|
;;
|
||||||
|
Darwin)
|
||||||
|
cpu_family=`uname -p`
|
||||||
|
model_name=`machine`
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
cpu_family=`uname -m`;
|
cpu_family=`uname -m`;
|
||||||
model_name="unknown";
|
model_name=`uname -p`;
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cpu_flag=""
|
# detect CPU shortname as used by gcc options
|
||||||
cpu_flag_old=""
|
# this list is not complete, feel free to add further entries
|
||||||
|
cpu_arg=""
|
||||||
case "$cpu_family--$model_name" in
|
case "$cpu_family--$model_name" in
|
||||||
|
# DEC Alpha
|
||||||
Alpha*EV6*)
|
Alpha*EV6*)
|
||||||
cpu_flag="ev6";
|
cpu_arg="ev6";
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
# Intel ia32
|
||||||
*Xeon*)
|
*Xeon*)
|
||||||
cpu_flag="nocona";
|
# 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*)
|
*Pentium*4*Mobile*)
|
||||||
cpu_flag="pentium4m";
|
cpu_arg="pentium4m";
|
||||||
;;
|
;;
|
||||||
*Pentium*4*CPU*)
|
*Pentium*4*)
|
||||||
cpu_flag="pentium4";
|
cpu_arg="pentium4";
|
||||||
;;
|
;;
|
||||||
*Pentium*III*Mobile*CPU*)
|
*Pentium*III*Mobile*)
|
||||||
cpu_flag="pentium3m";
|
cpu_arg="pentium3m";
|
||||||
;;
|
;;
|
||||||
*Pentium*III*CPU*)
|
*Pentium*III*)
|
||||||
cpu_flag="pentium3";
|
cpu_arg="pentium3";
|
||||||
;;
|
;;
|
||||||
*Pentium*M*pro*)
|
*Pentium*M*pro*)
|
||||||
cpu_flag="pentium-m";
|
cpu_arg="pentium-m";
|
||||||
cpu_flag_old="pentium";
|
|
||||||
;;
|
;;
|
||||||
*Athlon*64*)
|
*Athlon*64*)
|
||||||
cpu_flag="athlon64";
|
cpu_arg="athlon64";
|
||||||
cpu_flag_old="athlon";
|
|
||||||
;;
|
;;
|
||||||
*Athlon*)
|
*Athlon*)
|
||||||
cpu_flag="athlon";
|
cpu_arg="athlon";
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
# Intel ia64
|
||||||
*Itanium*)
|
*Itanium*)
|
||||||
# Don't need to set any flags for itanium(at the moment)
|
# Don't need to set any flags for itanium(at the moment)
|
||||||
cpu_flag="";
|
cpu_arg="";
|
||||||
;;
|
;;
|
||||||
*ppc)
|
|
||||||
cpu_flag="powerpc";
|
#
|
||||||
no_march=1;
|
*ppc*)
|
||||||
|
cpu_arg='powerpc'
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
*powerpc*)
|
||||||
|
cpu_arg='powerpc'
|
||||||
|
;;
|
||||||
|
|
||||||
|
# unknown
|
||||||
*)
|
*)
|
||||||
cpu_flag="";
|
cpu_arg="";
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if test -z "$cpu_flag"; then
|
|
||||||
echo "BUILD/check-cpu: Oops, could not findout what kind of cpu this machine is using."
|
if test -z "$cpu_arg"; then
|
||||||
check_cpu_flags=""
|
echo "BUILD/check-cpu: Oops, could not find out what kind of cpu this machine is using."
|
||||||
|
check_cpu_cflags=""
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "cpu_flag: $cpu_flag"
|
# different compiler versions have different option names
|
||||||
|
# for CPU specific command line options
|
||||||
if test -z "$CC" ; then
|
if test -z "$CC" ; then
|
||||||
cc="gcc";
|
cc="gcc";
|
||||||
else
|
else
|
||||||
cc=$CC
|
cc=$CC
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cc_ver=`$cc --version | sed 1q`
|
cc_ver=`$cc --version | sed 1q`
|
||||||
cc_verno=`echo $cc_ver | sed -e 's/[^0-9. ]//g; s/^ *//g; s/ .*//g'`
|
cc_verno=`echo $cc_ver | sed -e 's/[^0-9. ]//g; s/^ *//g; s/ .*//g'`
|
||||||
|
|
||||||
case "$cc_ver--$cc_verno" in
|
case "$cc_ver--$cc_verno" in
|
||||||
*GCC*--3.4*|*GCC*--3.5*|*GCC*--4.*)
|
|
||||||
check_cpu_cflags="-mtune=$cpu_flag -march=$cpu_flag"
|
|
||||||
;;
|
|
||||||
*GCC*)
|
*GCC*)
|
||||||
# Fix for older compiler versions
|
# different gcc backends (and versions) have different CPU flags
|
||||||
if test -n "$cpu_flag_old"; then
|
case `gcc -dumpmachine` in
|
||||||
cpu_flag="$cpu_flag_old"
|
i?86-*)
|
||||||
fi
|
case "$cc_verno" in
|
||||||
check_cpu_cflags="-mcpu=$cpu_flag -march=$cpu_flag"
|
3.4*|3.5*|4.*)
|
||||||
if test -n "$no_march"; then
|
check_cpu_args='-mtune=$cpu_arg -march=$cpu_arg'
|
||||||
check_cpu_cflags="-mcpu=$cpu_flag"
|
;;
|
||||||
fi
|
*)
|
||||||
|
check_cpu_args='-mcpu=$cpu_arg -march=$cpu_arg'
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
ppc-*)
|
||||||
|
check_cpu_args='-mcpu=$cpu_arg -mtune=$cpu_arg'
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
check_cpu_cflags=""
|
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
|
esac
|
||||||
echo $check_cpu_cflags
|
|
||||||
|
# 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=""
|
||||||
|
|
||||||
|
# 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.*
|
||||||
|
|
||||||
|
@ -52,6 +52,7 @@ dlenev@build.mysql.com
|
|||||||
dlenev@jabberwock.localdomain
|
dlenev@jabberwock.localdomain
|
||||||
dlenev@mysql.com
|
dlenev@mysql.com
|
||||||
ejonore@mc03.ndb.mysql.com
|
ejonore@mc03.ndb.mysql.com
|
||||||
|
elliot@mysql.com
|
||||||
evgen@moonbone.(none)
|
evgen@moonbone.(none)
|
||||||
evgen@moonbone.local
|
evgen@moonbone.local
|
||||||
gbichot@bk-internal.mysql.com
|
gbichot@bk-internal.mysql.com
|
||||||
@ -201,6 +202,7 @@ ndbdev@ndbmaster.mysql.com
|
|||||||
ndbdev@shark.
|
ndbdev@shark.
|
||||||
nick@mysql.com
|
nick@mysql.com
|
||||||
nick@nick.leippe.com
|
nick@nick.leippe.com
|
||||||
|
obarnir@mysql.com
|
||||||
papa@gbichot.local
|
papa@gbichot.local
|
||||||
patg@krsna.
|
patg@krsna.
|
||||||
patg@krsna.patg.net
|
patg@krsna.patg.net
|
||||||
|
@ -147,10 +147,6 @@ SOURCE="..\strings\ctype-czech.c"
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE="..\strings\ctype-cp932.c"
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE="..\strings\ctype-euc_kr.c"
|
SOURCE="..\strings\ctype-euc_kr.c"
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
122
client/mysql.cc
122
client/mysql.cc
@ -44,7 +44,7 @@
|
|||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char *VER= "14.10";
|
const char *VER= "14.11";
|
||||||
|
|
||||||
/* Don't try to make a nice table if the data is too big */
|
/* Don't try to make a nice table if the data is too big */
|
||||||
#define MAX_COLUMN_LENGTH 1024
|
#define MAX_COLUMN_LENGTH 1024
|
||||||
@ -1657,9 +1657,10 @@ int mysql_real_query_for_lazy(const char *buf, int length)
|
|||||||
{
|
{
|
||||||
for (uint retry=0;; retry++)
|
for (uint retry=0;; retry++)
|
||||||
{
|
{
|
||||||
|
int error;
|
||||||
if (!mysql_real_query(&mysql,buf,length))
|
if (!mysql_real_query(&mysql,buf,length))
|
||||||
return 0;
|
return 0;
|
||||||
int error= put_error(&mysql);
|
error= put_error(&mysql);
|
||||||
if (mysql_errno(&mysql) != CR_SERVER_GONE_ERROR || retry > 1 ||
|
if (mysql_errno(&mysql) != CR_SERVER_GONE_ERROR || retry > 1 ||
|
||||||
!opt_reconnect)
|
!opt_reconnect)
|
||||||
return error;
|
return error;
|
||||||
@ -1917,7 +1918,7 @@ com_go(String *buffer,char *line __attribute__((unused)))
|
|||||||
time_buff[0]=0;
|
time_buff[0]=0;
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
if (!mysql_num_rows(result) && ! quick)
|
if (!mysql_num_rows(result) && ! quick && !info_flag)
|
||||||
{
|
{
|
||||||
strmov(buff, "Empty set");
|
strmov(buff, "Empty set");
|
||||||
}
|
}
|
||||||
@ -2049,18 +2050,93 @@ com_ego(String *buffer,char *line)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *fieldtype2str(enum enum_field_types type) {
|
||||||
|
switch(type) {
|
||||||
|
case FIELD_TYPE_BIT: return "BIT";
|
||||||
|
case FIELD_TYPE_BLOB: return "BLOB";
|
||||||
|
case FIELD_TYPE_DATE: return "DATE";
|
||||||
|
case FIELD_TYPE_DATETIME: return "DATETIME";
|
||||||
|
case FIELD_TYPE_NEWDECIMAL: return "NEWDECIMAL";
|
||||||
|
case FIELD_TYPE_DECIMAL: return "DECIMAL";
|
||||||
|
case FIELD_TYPE_DOUBLE: return "DOUBLE";
|
||||||
|
case FIELD_TYPE_ENUM: return "ENUM";
|
||||||
|
case FIELD_TYPE_FLOAT: return "FLOAT";
|
||||||
|
case FIELD_TYPE_GEOMETRY: return "GEOMETRY";
|
||||||
|
case FIELD_TYPE_INT24: return "INT24";
|
||||||
|
case FIELD_TYPE_LONG: return "LONG";
|
||||||
|
case FIELD_TYPE_LONGLONG: return "LONGLONG";
|
||||||
|
case FIELD_TYPE_LONG_BLOB: return "LONG_BLOB";
|
||||||
|
case FIELD_TYPE_MEDIUM_BLOB: return "MEDIUM_BLOB";
|
||||||
|
case FIELD_TYPE_NEWDATE: return "NEWDATE";
|
||||||
|
case FIELD_TYPE_NULL: return "NULL";
|
||||||
|
case FIELD_TYPE_SET: return "SET";
|
||||||
|
case FIELD_TYPE_SHORT: return "SHORT";
|
||||||
|
case FIELD_TYPE_STRING: return "STRING";
|
||||||
|
case FIELD_TYPE_TIME: return "TIME";
|
||||||
|
case FIELD_TYPE_TIMESTAMP: return "TIMESTAMP";
|
||||||
|
case FIELD_TYPE_TINY: return "TINY";
|
||||||
|
case FIELD_TYPE_TINY_BLOB: return "TINY_BLOB";
|
||||||
|
case FIELD_TYPE_VAR_STRING: return "VAR_STRING";
|
||||||
|
case FIELD_TYPE_YEAR: return "YEAR";
|
||||||
|
default: return "?-unknown-?";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *fieldflags2str(uint f) {
|
||||||
|
static char buf[1024];
|
||||||
|
char *s=buf;
|
||||||
|
*s=0;
|
||||||
|
#define ff2s_check_flag(X) \
|
||||||
|
if (f & X ## _FLAG) { s=strmov(s, # X " "); f &= ~ X ## _FLAG; }
|
||||||
|
ff2s_check_flag(NOT_NULL);
|
||||||
|
ff2s_check_flag(PRI_KEY);
|
||||||
|
ff2s_check_flag(UNIQUE_KEY);
|
||||||
|
ff2s_check_flag(MULTIPLE_KEY);
|
||||||
|
ff2s_check_flag(BLOB);
|
||||||
|
ff2s_check_flag(UNSIGNED);
|
||||||
|
ff2s_check_flag(ZEROFILL);
|
||||||
|
ff2s_check_flag(BINARY);
|
||||||
|
ff2s_check_flag(ENUM);
|
||||||
|
ff2s_check_flag(AUTO_INCREMENT);
|
||||||
|
ff2s_check_flag(TIMESTAMP);
|
||||||
|
ff2s_check_flag(SET);
|
||||||
|
ff2s_check_flag(NO_DEFAULT_VALUE);
|
||||||
|
ff2s_check_flag(NUM);
|
||||||
|
ff2s_check_flag(PART_KEY);
|
||||||
|
ff2s_check_flag(GROUP);
|
||||||
|
ff2s_check_flag(UNIQUE);
|
||||||
|
ff2s_check_flag(BINCMP);
|
||||||
|
#undef ff2s_check_flag
|
||||||
|
if (f)
|
||||||
|
sprintf(s, " unknows=0x%04x", f);
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_field_types(MYSQL_RES *result)
|
print_field_types(MYSQL_RES *result)
|
||||||
{
|
{
|
||||||
MYSQL_FIELD *field;
|
MYSQL_FIELD *field;
|
||||||
|
uint i=0;
|
||||||
|
|
||||||
while ((field = mysql_fetch_field(result)))
|
while ((field = mysql_fetch_field(result)))
|
||||||
{
|
{
|
||||||
tee_fprintf(PAGER,"Catalog: '%s'\nDatabase: '%s'\nTable: '%s'\nName: '%s'\nType: %d\nLength: %ld\nMax length: %ld\nIs_null: %d\nFlags: %u\nDecimals: %u\n\n",
|
tee_fprintf(PAGER, "Field %3u: `%s`\n"
|
||||||
field->catalog, field->db, field->table, field->name,
|
"Catalog: `%s`\n"
|
||||||
(int) field->type,
|
"Database: `%s`\n"
|
||||||
field->length, field->max_length,
|
"Table: `%s`\n"
|
||||||
!IS_NOT_NULL(field->flags),
|
"Org_table: `%s`\n"
|
||||||
field->flags, field->decimals);
|
"Type: %s\n"
|
||||||
|
"Collation: %s (%u)\n"
|
||||||
|
"Length: %lu\n"
|
||||||
|
"Max_length: %lu\n"
|
||||||
|
"Decimals: %u\n"
|
||||||
|
"Flags: %s\n\n",
|
||||||
|
++i,
|
||||||
|
field->name, field->catalog, field->db, field->table,
|
||||||
|
field->org_table, fieldtype2str(field->type),
|
||||||
|
get_charset_name(field->charsetnr), field->charsetnr,
|
||||||
|
field->length, field->max_length, field->decimals,
|
||||||
|
fieldflags2str(field->flags));
|
||||||
}
|
}
|
||||||
tee_puts("", PAGER);
|
tee_puts("", PAGER);
|
||||||
}
|
}
|
||||||
@ -2078,6 +2154,8 @@ print_table_data(MYSQL_RES *result)
|
|||||||
if (info_flag)
|
if (info_flag)
|
||||||
{
|
{
|
||||||
print_field_types(result);
|
print_field_types(result);
|
||||||
|
if (!mysql_num_rows(result))
|
||||||
|
return;
|
||||||
mysql_field_seek(result,0);
|
mysql_field_seek(result,0);
|
||||||
}
|
}
|
||||||
separator.copy("+",1,charset_info);
|
separator.copy("+",1,charset_info);
|
||||||
@ -2237,22 +2315,23 @@ print_table_data_vertically(MYSQL_RES *result)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* print_warnings should be called right after executing a statement */
|
/* print_warnings should be called right after executing a statement */
|
||||||
static void
|
|
||||||
print_warnings()
|
static void print_warnings()
|
||||||
{
|
{
|
||||||
char query[30];
|
const char *query;
|
||||||
MYSQL_RES *result;
|
MYSQL_RES *result;
|
||||||
MYSQL_ROW cur;
|
MYSQL_ROW cur;
|
||||||
|
my_ulonglong num_rows;
|
||||||
|
|
||||||
/* Get the warnings */
|
/* Get the warnings */
|
||||||
strmov(query,"show warnings");
|
query= "show warnings";
|
||||||
mysql_real_query_for_lazy(query,strlen(query));
|
mysql_real_query_for_lazy(query, strlen(query));
|
||||||
mysql_store_result_for_lazy(&result);
|
mysql_store_result_for_lazy(&result);
|
||||||
|
|
||||||
/* Bail out when no warnings */
|
/* Bail out when no warnings */
|
||||||
my_ulonglong num_rows = mysql_num_rows(result);
|
if (!(num_rows= mysql_num_rows(result)))
|
||||||
if (num_rows == 0)
|
|
||||||
{
|
{
|
||||||
mysql_free_result(result);
|
mysql_free_result(result);
|
||||||
return;
|
return;
|
||||||
@ -2266,13 +2345,12 @@ print_warnings()
|
|||||||
mysql_free_result(result);
|
mysql_free_result(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char
|
|
||||||
*array_value(const char **array, char key)
|
static const char *array_value(const char **array, char key)
|
||||||
{
|
{
|
||||||
int x;
|
for (; *array; array+= 2)
|
||||||
for (x= 0; array[x]; x+= 2)
|
if (**array == key)
|
||||||
if (*array[x] == key)
|
return array[1];
|
||||||
return array[x + 1];
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,6 +246,7 @@ typedef struct
|
|||||||
|
|
||||||
static char *subst_env_var(const char *cmd);
|
static char *subst_env_var(const char *cmd);
|
||||||
static FILE *my_popen(const char *cmd, const char *mode);
|
static FILE *my_popen(const char *cmd, const char *mode);
|
||||||
|
#undef popen
|
||||||
#define popen(A,B) my_popen((A),(B))
|
#define popen(A,B) my_popen((A),(B))
|
||||||
#endif /* __NETWARE__ */
|
#endif /* __NETWARE__ */
|
||||||
|
|
||||||
@ -2587,13 +2588,13 @@ static void append_result(DYNAMIC_STRING *ds, MYSQL_RES *res)
|
|||||||
{
|
{
|
||||||
if (i)
|
if (i)
|
||||||
dynstr_append_mem(ds, "\t", 1);
|
dynstr_append_mem(ds, "\t", 1);
|
||||||
replace_dynstr_append_mem(ds, val, len);
|
replace_dynstr_append_mem(ds, val, (int)len);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dynstr_append(ds, fields[i].name);
|
dynstr_append(ds, fields[i].name);
|
||||||
dynstr_append_mem(ds, "\t", 1);
|
dynstr_append_mem(ds, "\t", 1);
|
||||||
replace_dynstr_append_mem(ds, val, len);
|
replace_dynstr_append_mem(ds, val, (int)len);
|
||||||
dynstr_append_mem(ds, "\n", 1);
|
dynstr_append_mem(ds, "\n", 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2960,7 +2961,7 @@ static int run_query_stmt(MYSQL *mysql, struct st_query *q, int flags)
|
|||||||
int error= 0; /* Function return code if "goto end;" */
|
int error= 0; /* Function return code if "goto end;" */
|
||||||
int err; /* Temporary storage of return code from calls */
|
int err; /* Temporary storage of return code from calls */
|
||||||
int query_len, got_error_on_execute;
|
int query_len, got_error_on_execute;
|
||||||
uint num_rows;
|
ulonglong num_rows;
|
||||||
char *query;
|
char *query;
|
||||||
MYSQL_RES *res= NULL; /* Note that here 'res' is meta data result set */
|
MYSQL_RES *res= NULL; /* Note that here 'res' is meta data result set */
|
||||||
DYNAMIC_STRING *ds;
|
DYNAMIC_STRING *ds;
|
||||||
@ -3215,13 +3216,13 @@ static int run_query_stmt(MYSQL *mysql, struct st_query *q, int flags)
|
|||||||
{
|
{
|
||||||
if (col_idx) /* No tab before first col */
|
if (col_idx) /* No tab before first col */
|
||||||
dynstr_append_mem(ds, "\t", 1);
|
dynstr_append_mem(ds, "\t", 1);
|
||||||
replace_dynstr_append_mem(ds, val, len);
|
replace_dynstr_append_mem(ds, val, (int)len);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dynstr_append(ds, field[col_idx].name);
|
dynstr_append(ds, field[col_idx].name);
|
||||||
dynstr_append_mem(ds, "\t", 1);
|
dynstr_append_mem(ds, "\t", 1);
|
||||||
replace_dynstr_append_mem(ds, val, len);
|
replace_dynstr_append_mem(ds, val, (int)len);
|
||||||
dynstr_append_mem(ds, "\n", 1);
|
dynstr_append_mem(ds, "\n", 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,12 +16,11 @@
|
|||||||
|
|
||||||
/* This file is originally from the mysql distribution. Coded by monty */
|
/* This file is originally from the mysql distribution. Coded by monty */
|
||||||
|
|
||||||
#include <my_global.h>
|
|
||||||
|
|
||||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||||
#pragma implementation // gcc: Class implementation
|
#pragma implementation // gcc: Class implementation
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <my_global.h>
|
||||||
#include <my_sys.h>
|
#include <my_sys.h>
|
||||||
#include <m_string.h>
|
#include <m_string.h>
|
||||||
#include <m_ctype.h>
|
#include <m_ctype.h>
|
||||||
|
@ -260,8 +260,6 @@ public:
|
|||||||
}
|
}
|
||||||
bool fill(uint32 max_length,char fill);
|
bool fill(uint32 max_length,char fill);
|
||||||
void strip_sp();
|
void strip_sp();
|
||||||
inline void caseup() { my_caseup(str_charset,Ptr,str_length); }
|
|
||||||
inline void casedn() { my_casedn(str_charset,Ptr,str_length); }
|
|
||||||
friend int sortcmp(const String *a,const String *b, CHARSET_INFO *cs);
|
friend int sortcmp(const String *a,const String *b, CHARSET_INFO *cs);
|
||||||
friend int stringcmp(const String *a,const String *b);
|
friend int stringcmp(const String *a,const String *b);
|
||||||
friend String *copy_if_not_alloced(String *a,String *b,uint32 arg_length);
|
friend String *copy_if_not_alloced(String *a,String *b,uint32 arg_length);
|
||||||
|
33
configure.in
33
configure.in
@ -6,7 +6,7 @@ AC_PREREQ(2.50)dnl Minimum Autoconf version required.
|
|||||||
AC_INIT(sql/mysqld.cc)
|
AC_INIT(sql/mysqld.cc)
|
||||||
AC_CANONICAL_SYSTEM
|
AC_CANONICAL_SYSTEM
|
||||||
# Don't forget to also update the NDB lines below.
|
# Don't forget to also update the NDB lines below.
|
||||||
AM_INIT_AUTOMAKE(mysql, 5.0.7-beta)
|
AM_INIT_AUTOMAKE(mysql, 5.0.8-beta)
|
||||||
AM_CONFIG_HEADER(config.h)
|
AM_CONFIG_HEADER(config.h)
|
||||||
|
|
||||||
PROTOCOL_VERSION=10
|
PROTOCOL_VERSION=10
|
||||||
@ -17,7 +17,7 @@ SHARED_LIB_VERSION=14:0:0
|
|||||||
# ndb version
|
# ndb version
|
||||||
NDB_VERSION_MAJOR=5
|
NDB_VERSION_MAJOR=5
|
||||||
NDB_VERSION_MINOR=0
|
NDB_VERSION_MINOR=0
|
||||||
NDB_VERSION_BUILD=7
|
NDB_VERSION_BUILD=8
|
||||||
NDB_VERSION_STATUS="beta"
|
NDB_VERSION_STATUS="beta"
|
||||||
|
|
||||||
# Set all version vars based on $VERSION. How do we do this more elegant ?
|
# Set all version vars based on $VERSION. How do we do this more elegant ?
|
||||||
@ -442,33 +442,33 @@ PS=$ac_cv_path_PS
|
|||||||
# Linux style
|
# Linux style
|
||||||
if $PS p $$ 2> /dev/null | grep $0 > /dev/null
|
if $PS p $$ 2> /dev/null | grep $0 > /dev/null
|
||||||
then
|
then
|
||||||
FIND_PROC="$PS p \$\$PID | grep \$\$MYSQLD > /dev/null"
|
FIND_PROC="$PS p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
|
||||||
# Solaris
|
# Solaris
|
||||||
elif $PS -fp $$ 2> /dev/null | grep $0 > /dev/null
|
elif $PS -fp $$ 2> /dev/null | grep $0 > /dev/null
|
||||||
then
|
then
|
||||||
FIND_PROC="$PS -p \$\$PID | grep \$\$MYSQLD > /dev/null"
|
FIND_PROC="$PS -p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
|
||||||
# BSD style
|
# BSD style
|
||||||
elif $PS -uaxww 2> /dev/null | grep $0 > /dev/null
|
elif $PS -uaxww 2> /dev/null | grep $0 > /dev/null
|
||||||
then
|
then
|
||||||
FIND_PROC="$PS -uaxww | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
|
FIND_PROC="$PS -uaxww | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
|
||||||
# SysV style
|
# SysV style
|
||||||
elif $PS -ef 2> /dev/null | grep $0 > /dev/null
|
elif $PS -ef 2> /dev/null | grep $0 > /dev/null
|
||||||
then
|
then
|
||||||
FIND_PROC="$PS -ef | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
|
FIND_PROC="$PS -ef | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
|
||||||
# Do anybody use this?
|
# Do anybody use this?
|
||||||
elif $PS $$ 2> /dev/null | grep $0 > /dev/null
|
elif $PS $$ 2> /dev/null | grep $0 > /dev/null
|
||||||
then
|
then
|
||||||
FIND_PROC="$PS \$\$PID | grep \$\$MYSQLD > /dev/null"
|
FIND_PROC="$PS \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
|
||||||
else
|
else
|
||||||
case $SYSTEM_TYPE in
|
case $SYSTEM_TYPE in
|
||||||
*freebsd*)
|
*freebsd*)
|
||||||
FIND_PROC="$PS p \$\$PID | grep \$\$MYSQLD > /dev/null"
|
FIND_PROC="$PS p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
|
||||||
;;
|
;;
|
||||||
*darwin*)
|
*darwin*)
|
||||||
FIND_PROC="$PS -uaxww | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
|
FIND_PROC="$PS -uaxww | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
|
||||||
;;
|
;;
|
||||||
*cygwin*)
|
*cygwin*)
|
||||||
FIND_PROC="$PS -e | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
|
FIND_PROC="$PS -e | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
|
||||||
;;
|
;;
|
||||||
*netware*)
|
*netware*)
|
||||||
FIND_PROC=
|
FIND_PROC=
|
||||||
@ -1765,12 +1765,23 @@ if test "$ac_cv_sizeof_off_t" -eq 0
|
|||||||
then
|
then
|
||||||
AC_MSG_ERROR("MySQL needs a off_t type.")
|
AC_MSG_ERROR("MySQL needs a off_t type.")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# do we need #pragma interface/#pragma implementation ?
|
||||||
|
# yes if it's gcc 2.x, and not icc pretending to be gcc, and not cygwin
|
||||||
|
AC_MSG_CHECKING(the need for @%:@pragma interface/implementation)
|
||||||
|
# instead of trying to match SYSTEM_TYPE and CC_VERSION (that doesn't
|
||||||
|
# follow any standard), we'll use well-defined preprocessor macros:
|
||||||
|
AC_TRY_CPP([
|
||||||
|
#if !defined(__CYGWIN__) && !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ < 3)
|
||||||
|
#error USE_PRAGMA_IMPLEMENTATION
|
||||||
|
#endif
|
||||||
|
],AC_MSG_RESULT(no) ,AC_MSG_RESULT(yes) ; CXXFLAGS="$CXXFLAGS -DUSE_PRAGMA_IMPLEMENTATION")
|
||||||
|
|
||||||
# This always gives a warning. Ignore it unless you are cross compiling
|
# This always gives a warning. Ignore it unless you are cross compiling
|
||||||
AC_C_BIGENDIAN
|
AC_C_BIGENDIAN
|
||||||
#---START: Used in for client configure
|
#---START: Used in for client configure
|
||||||
# Check base type of last arg to accept
|
# Check base type of last arg to accept
|
||||||
MYSQL_TYPE_ACCEPT
|
MYSQL_TYPE_ACCEPT
|
||||||
|
|
||||||
#---END:
|
#---END:
|
||||||
# Figure out what type of struct rlimit to use with setrlimit
|
# Figure out what type of struct rlimit to use with setrlimit
|
||||||
MYSQL_TYPE_STRUCT_RLIMIT
|
MYSQL_TYPE_STRUCT_RLIMIT
|
||||||
|
@ -37,16 +37,18 @@
|
|||||||
namespace mySTL {
|
namespace mySTL {
|
||||||
|
|
||||||
|
|
||||||
template<typename T, typename Deletor = void (*) (T*)>
|
template<typename T>
|
||||||
struct auto_ptr_ref {
|
struct auto_ptr_ref {
|
||||||
|
typedef void (*Deletor)(T*);
|
||||||
T* ptr_;
|
T* ptr_;
|
||||||
Deletor del_;
|
Deletor del_;
|
||||||
auto_ptr_ref(T* p, Deletor d) : ptr_(p), del_(d) {}
|
auto_ptr_ref(T* p, Deletor d) : ptr_(p), del_(d) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
template<typename T, typename Deletor = void (*) (T*)>
|
template<typename T>
|
||||||
class auto_ptr {
|
class auto_ptr {
|
||||||
|
typedef void (*Deletor)(T*);
|
||||||
T* ptr_;
|
T* ptr_;
|
||||||
Deletor del_;
|
Deletor del_;
|
||||||
|
|
||||||
|
@ -718,7 +718,7 @@ void processReply(SSL& ssl)
|
|||||||
mySTL::auto_ptr<input_buffer> buffered(ysDelete);
|
mySTL::auto_ptr<input_buffer> buffered(ysDelete);
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
mySTL::auto_ptr<input_buffer> tmp = DoProcessReply(ssl, buffered);
|
mySTL::auto_ptr<input_buffer> tmp(DoProcessReply(ssl, buffered));
|
||||||
if (tmp.get()) // had only part of a record's data, call again
|
if (tmp.get()) // had only part of a record's data, call again
|
||||||
buffered = tmp;
|
buffered = tmp;
|
||||||
else
|
else
|
||||||
|
@ -67,7 +67,7 @@ MK_FUNDAMENTAL_TYPE(float)
|
|||||||
MK_FUNDAMENTAL_TYPE( double)
|
MK_FUNDAMENTAL_TYPE( double)
|
||||||
MK_FUNDAMENTAL_TYPE(long double)
|
MK_FUNDAMENTAL_TYPE(long double)
|
||||||
|
|
||||||
#ifdef WORD64_AVAILABLE
|
#if defined(WORD64_AVAILABLE) && defined(WORD64_IS_DISTINCT_TYPE)
|
||||||
MK_FUNDAMENTAL_TYPE(word64)
|
MK_FUNDAMENTAL_TYPE(word64)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -45,10 +45,12 @@ typedef unsigned int word32;
|
|||||||
|
|
||||||
#if defined(__GNUC__) || defined(__MWERKS__) || defined(_LONGLONG_TYPE)
|
#if defined(__GNUC__) || defined(__MWERKS__) || defined(_LONGLONG_TYPE)
|
||||||
#define WORD64_AVAILABLE
|
#define WORD64_AVAILABLE
|
||||||
|
#define WORD64_IS_DISTINCT_TYPE
|
||||||
typedef unsigned long long word64;
|
typedef unsigned long long word64;
|
||||||
#define W64LIT(x) x##LL
|
#define W64LIT(x) x##LL
|
||||||
#elif defined(_MSC_VER) || defined(__BCPLUSPLUS__)
|
#elif defined(_MSC_VER) || defined(__BCPLUSPLUS__)
|
||||||
#define WORD64_AVAILABLE
|
#define WORD64_AVAILABLE
|
||||||
|
#define WORD64_IS_DISTINCT_TYPE
|
||||||
typedef unsigned __int64 word64;
|
typedef unsigned __int64 word64;
|
||||||
#define W64LIT(x) x##ui64
|
#define W64LIT(x) x##ui64
|
||||||
#elif defined(__DECCXX)
|
#elif defined(__DECCXX)
|
||||||
@ -66,8 +68,9 @@ typedef unsigned int word32;
|
|||||||
|
|
||||||
// TODO: FIXME, add asm multiply for x86_64 on Solaris and remove !__sun
|
// TODO: FIXME, add asm multiply for x86_64 on Solaris and remove !__sun
|
||||||
|
|
||||||
#if defined(__alpha__) || defined(__ia64__) || defined(_ARCH_PPC64) || \
|
#if defined(__alpha__) || (defined(__ia64__) && !defined(__INTEL_COMPILER)) || \
|
||||||
defined(__mips64) || (defined(__x86_64__) && !defined(__sun))
|
defined(_ARCH_PPC64) || defined(__mips64) || \
|
||||||
|
(defined(__x86_64__) && !defined(__sun))
|
||||||
// These platforms have 64-bit CPU registers. Unfortunately most C++ compilers
|
// These platforms have 64-bit CPU registers. Unfortunately most C++ compilers
|
||||||
// don't allow any way to access the 64-bit by 64-bit multiply instruction
|
// don't allow any way to access the 64-bit by 64-bit multiply instruction
|
||||||
// without using assembly, so in order to use word64 as word, the assembly
|
// without using assembly, so in order to use word64 as word, the assembly
|
||||||
|
@ -149,7 +149,8 @@ unsigned long Crop(unsigned long value, unsigned int size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if !(defined(_MSC_VER) && (_MSC_VER < 1300))
|
#if !(defined(_MSC_VER) && (_MSC_VER < 1300)) && \
|
||||||
|
!(defined(__HP_aCC) && (__HP_aCC <= 35700))
|
||||||
using std::new_handler;
|
using std::new_handler;
|
||||||
using std::set_new_handler;
|
using std::set_new_handler;
|
||||||
#endif
|
#endif
|
||||||
|
@ -392,7 +392,6 @@ inline double ulonglong2double(ulonglong value)
|
|||||||
/* #undef HAVE_CHARSET_armscii8 */
|
/* #undef HAVE_CHARSET_armscii8 */
|
||||||
/* #undef HAVE_CHARSET_ascii */
|
/* #undef HAVE_CHARSET_ascii */
|
||||||
#define HAVE_CHARSET_big5 1
|
#define HAVE_CHARSET_big5 1
|
||||||
#define HAVE_CHARSET_cp932
|
|
||||||
#define HAVE_CHARSET_cp1250 1
|
#define HAVE_CHARSET_cp1250 1
|
||||||
/* #undef HAVE_CHARSET_cp1251 */
|
/* #undef HAVE_CHARSET_cp1251 */
|
||||||
/* #undef HAVE_CHARSET_cp1256 */
|
/* #undef HAVE_CHARSET_cp1256 */
|
||||||
|
@ -44,6 +44,9 @@ typedef struct unicase_info_st
|
|||||||
uint16 sort;
|
uint16 sort;
|
||||||
} MY_UNICASE_INFO;
|
} MY_UNICASE_INFO;
|
||||||
|
|
||||||
|
extern MY_UNICASE_INFO *my_unicase_default[256];
|
||||||
|
extern MY_UNICASE_INFO *my_unicase_turkish[256];
|
||||||
|
|
||||||
#define MY_CS_ILSEQ 0
|
#define MY_CS_ILSEQ 0
|
||||||
#define MY_CS_ILUNI 0
|
#define MY_CS_ILUNI 0
|
||||||
#define MY_CS_TOOSMALL -1
|
#define MY_CS_TOOSMALL -1
|
||||||
@ -164,8 +167,10 @@ typedef struct my_charset_handler_st
|
|||||||
/* Functions for case and sort convertion */
|
/* Functions for case and sort convertion */
|
||||||
void (*caseup_str)(struct charset_info_st *, char *);
|
void (*caseup_str)(struct charset_info_st *, char *);
|
||||||
void (*casedn_str)(struct charset_info_st *, char *);
|
void (*casedn_str)(struct charset_info_st *, char *);
|
||||||
void (*caseup)(struct charset_info_st *, char *, uint);
|
uint (*caseup)(struct charset_info_st *, char *src, uint srclen,
|
||||||
void (*casedn)(struct charset_info_st *, char *, uint);
|
char *dst, uint dstlen);
|
||||||
|
uint (*casedn)(struct charset_info_st *, char *src, uint srclen,
|
||||||
|
char *dst, uint dstlen);
|
||||||
|
|
||||||
/* Charset dependant snprintf() */
|
/* Charset dependant snprintf() */
|
||||||
int (*snprintf)(struct charset_info_st *, char *to, uint n, const char *fmt,
|
int (*snprintf)(struct charset_info_st *, char *to, uint n, const char *fmt,
|
||||||
@ -216,9 +221,12 @@ typedef struct charset_info_st
|
|||||||
uint16 **sort_order_big;
|
uint16 **sort_order_big;
|
||||||
uint16 *tab_to_uni;
|
uint16 *tab_to_uni;
|
||||||
MY_UNI_IDX *tab_from_uni;
|
MY_UNI_IDX *tab_from_uni;
|
||||||
|
MY_UNICASE_INFO **caseinfo;
|
||||||
uchar *state_map;
|
uchar *state_map;
|
||||||
uchar *ident_map;
|
uchar *ident_map;
|
||||||
uint strxfrm_multiply;
|
uint strxfrm_multiply;
|
||||||
|
uchar caseup_multiply;
|
||||||
|
uchar casedn_multiply;
|
||||||
uint mbminlen;
|
uint mbminlen;
|
||||||
uint mbmaxlen;
|
uint mbmaxlen;
|
||||||
uint16 min_sort_char;
|
uint16 min_sort_char;
|
||||||
@ -286,8 +294,10 @@ extern uint my_instr_simple(struct charset_info_st *,
|
|||||||
/* Functions for 8bit */
|
/* Functions for 8bit */
|
||||||
extern void my_caseup_str_8bit(CHARSET_INFO *, char *);
|
extern void my_caseup_str_8bit(CHARSET_INFO *, char *);
|
||||||
extern void my_casedn_str_8bit(CHARSET_INFO *, char *);
|
extern void my_casedn_str_8bit(CHARSET_INFO *, char *);
|
||||||
extern void my_caseup_8bit(CHARSET_INFO *, char *, uint);
|
extern uint my_caseup_8bit(CHARSET_INFO *, char *src, uint srclen,
|
||||||
extern void my_casedn_8bit(CHARSET_INFO *, char *, uint);
|
char *dst, uint dstlen);
|
||||||
|
extern uint my_casedn_8bit(CHARSET_INFO *, char *src, uint srclen,
|
||||||
|
char *dst, uint dstlen);
|
||||||
|
|
||||||
extern int my_strcasecmp_8bit(CHARSET_INFO * cs, const char *, const char *);
|
extern int my_strcasecmp_8bit(CHARSET_INFO * cs, const char *, const char *);
|
||||||
|
|
||||||
@ -359,8 +369,10 @@ int my_mbcharlen_8bit(CHARSET_INFO *, uint c);
|
|||||||
/* Functions for multibyte charsets */
|
/* Functions for multibyte charsets */
|
||||||
extern void my_caseup_str_mb(CHARSET_INFO *, char *);
|
extern void my_caseup_str_mb(CHARSET_INFO *, char *);
|
||||||
extern void my_casedn_str_mb(CHARSET_INFO *, char *);
|
extern void my_casedn_str_mb(CHARSET_INFO *, char *);
|
||||||
extern void my_caseup_mb(CHARSET_INFO *, char *, uint);
|
extern uint my_caseup_mb(CHARSET_INFO *, char *src, uint srclen,
|
||||||
extern void my_casedn_mb(CHARSET_INFO *, char *, uint);
|
char *dst, uint dstlen);
|
||||||
|
extern uint my_casedn_mb(CHARSET_INFO *, char *src, uint srclen,
|
||||||
|
char *dst, uint dstlen);
|
||||||
extern int my_strcasecmp_mb(CHARSET_INFO * cs,const char *, const char *);
|
extern int my_strcasecmp_mb(CHARSET_INFO * cs,const char *, const char *);
|
||||||
|
|
||||||
int my_wildcmp_mb(CHARSET_INFO *,
|
int my_wildcmp_mb(CHARSET_INFO *,
|
||||||
@ -441,8 +453,6 @@ my_bool my_propagate_complex(CHARSET_INFO *cs, const uchar *str, uint len);
|
|||||||
#define my_mbcharlen(s, a) 1
|
#define my_mbcharlen(s, a) 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define my_caseup(s, a, l) ((s)->cset->caseup((s), (a), (l)))
|
|
||||||
#define my_casedn(s, a, l) ((s)->cset->casedn((s), (a), (l)))
|
|
||||||
#define my_caseup_str(s, a) ((s)->cset->caseup_str((s), (a)))
|
#define my_caseup_str(s, a) ((s)->cset->caseup_str((s), (a)))
|
||||||
#define my_casedn_str(s, a) ((s)->cset->casedn_str((s), (a)))
|
#define my_casedn_str(s, a) ((s)->cset->casedn_str((s), (a)))
|
||||||
#define my_strntol(s, a, b, c, d, e) ((s)->cset->strntol((s),(a),(b),(c),(d),(e)))
|
#define my_strntol(s, a, b, c, d, e) ((s)->cset->strntol((s),(a),(b),(c),(d),(e)))
|
||||||
|
@ -43,16 +43,11 @@
|
|||||||
#define HAVE_ERRNO_AS_DEFINE
|
#define HAVE_ERRNO_AS_DEFINE
|
||||||
#endif /* __CYGWIN__ */
|
#endif /* __CYGWIN__ */
|
||||||
|
|
||||||
/* Determine when to use "#pragma interface" */
|
/* to make command line shorter we'll define USE_PRAGMA_INTERFACE here */
|
||||||
#if !defined(__CYGWIN__) && !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ < 3)
|
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||||
#define USE_PRAGMA_INTERFACE
|
#define USE_PRAGMA_INTERFACE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Determine when to use "#pragma implementation" */
|
|
||||||
#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ < 3)
|
|
||||||
#define USE_PRAGMA_IMPLEMENTATION
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(i386) && !defined(__i386__)
|
#if defined(i386) && !defined(__i386__)
|
||||||
#define __i386__
|
#define __i386__
|
||||||
#endif
|
#endif
|
||||||
@ -290,13 +285,7 @@ C_MODE_END
|
|||||||
# endif
|
# endif
|
||||||
#endif /* TIME_WITH_SYS_TIME */
|
#endif /* TIME_WITH_SYS_TIME */
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
#if defined(HAVE_OPENSSL) && !defined(__FreeBSD__) && !defined(NeXT) && !defined(__OpenBSD__) && !defined(__APPLE__)
|
|
||||||
#define crypt unistd_crypt
|
|
||||||
#endif
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#ifdef HAVE_OPENSSL
|
|
||||||
#undef crypt
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
#if defined(__cplusplus) && defined(NO_CPLUSPLUS_ALLOCA)
|
#if defined(__cplusplus) && defined(NO_CPLUSPLUS_ALLOCA)
|
||||||
#undef HAVE_ALLOCA
|
#undef HAVE_ALLOCA
|
||||||
@ -306,13 +295,6 @@ C_MODE_END
|
|||||||
#include <alloca.h>
|
#include <alloca.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_ATOMIC_ADD
|
#ifdef HAVE_ATOMIC_ADD
|
||||||
#define __SMP__
|
|
||||||
#ifdef HAVE_LINUX_CONFIG_H
|
|
||||||
#include <linux/config.h> /* May define CONFIG_SMP */
|
|
||||||
#endif
|
|
||||||
#ifndef CONFIG_SMP
|
|
||||||
#define CONFIG_SMP
|
|
||||||
#endif
|
|
||||||
#if defined(__ia64__)
|
#if defined(__ia64__)
|
||||||
#define new my_arg_new
|
#define new my_arg_new
|
||||||
#define need_to_restore_new 1
|
#define need_to_restore_new 1
|
||||||
|
@ -181,7 +181,7 @@ extern void my_large_free(gptr ptr, myf my_flags);
|
|||||||
#endif /* _AIX */
|
#endif /* _AIX */
|
||||||
#if defined(__MWERKS__)
|
#if defined(__MWERKS__)
|
||||||
#undef alloca
|
#undef alloca
|
||||||
#define alloca __alloca
|
#define alloca _alloca
|
||||||
#endif /* __MWERKS__ */
|
#endif /* __MWERKS__ */
|
||||||
#if defined(__GNUC__) && !defined(HAVE_ALLOCA_H) && ! defined(alloca)
|
#if defined(__GNUC__) && !defined(HAVE_ALLOCA_H) && ! defined(alloca)
|
||||||
#define alloca __builtin_alloca
|
#define alloca __builtin_alloca
|
||||||
@ -836,7 +836,10 @@ my_bool my_gethwaddr(uchar *to);
|
|||||||
#define MAP_NOSYNC 0x0800
|
#define MAP_NOSYNC 0x0800
|
||||||
#define MAP_FAILED ((void *)-1)
|
#define MAP_FAILED ((void *)-1)
|
||||||
#define MS_SYNC 0x0000
|
#define MS_SYNC 0x0000
|
||||||
|
|
||||||
|
#ifndef __NETWARE__
|
||||||
#define HAVE_MMAP
|
#define HAVE_MMAP
|
||||||
|
#endif
|
||||||
|
|
||||||
int my_getpagesize(void);
|
int my_getpagesize(void);
|
||||||
void *my_mmap(void *, size_t, int, int, int, my_off_t);
|
void *my_mmap(void *, size_t, int, int, int, my_off_t);
|
||||||
|
@ -605,7 +605,7 @@ os_file_opendir(
|
|||||||
|
|
||||||
lpFindFileData = ut_malloc(sizeof(WIN32_FIND_DATA));
|
lpFindFileData = ut_malloc(sizeof(WIN32_FIND_DATA));
|
||||||
|
|
||||||
dir = FindFirstFile(path, lpFindFileData);
|
dir = FindFirstFile((LPCTSTR) path, lpFindFileData);
|
||||||
|
|
||||||
ut_free(lpFindFileData);
|
ut_free(lpFindFileData);
|
||||||
|
|
||||||
@ -686,15 +686,15 @@ next_file:
|
|||||||
ret = FindNextFile(dir, lpFindFileData);
|
ret = FindNextFile(dir, lpFindFileData);
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
ut_a(strlen(lpFindFileData->cFileName) < OS_FILE_MAX_PATH);
|
ut_a(strlen((char *) lpFindFileData->cFileName) < OS_FILE_MAX_PATH);
|
||||||
|
|
||||||
if (strcmp(lpFindFileData->cFileName, ".") == 0
|
if (strcmp((char *) lpFindFileData->cFileName, ".") == 0
|
||||||
|| strcmp(lpFindFileData->cFileName, "..") == 0) {
|
|| strcmp((char *) lpFindFileData->cFileName, "..") == 0) {
|
||||||
|
|
||||||
goto next_file;
|
goto next_file;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(info->name, lpFindFileData->cFileName);
|
strcpy(info->name, (char *) lpFindFileData->cFileName);
|
||||||
|
|
||||||
info->size = (ib_longlong)(lpFindFileData->nFileSizeLow)
|
info->size = (ib_longlong)(lpFindFileData->nFileSizeLow)
|
||||||
+ (((ib_longlong)(lpFindFileData->nFileSizeHigh)) << 32);
|
+ (((ib_longlong)(lpFindFileData->nFileSizeHigh)) << 32);
|
||||||
@ -830,7 +830,7 @@ os_file_create_directory(
|
|||||||
#ifdef __WIN__
|
#ifdef __WIN__
|
||||||
BOOL rcode;
|
BOOL rcode;
|
||||||
|
|
||||||
rcode = CreateDirectory(pathname, NULL);
|
rcode = CreateDirectory((LPCTSTR) pathname, NULL);
|
||||||
if (!(rcode != 0 ||
|
if (!(rcode != 0 ||
|
||||||
(GetLastError() == ERROR_ALREADY_EXISTS && !fail_if_exists))) {
|
(GetLastError() == ERROR_ALREADY_EXISTS && !fail_if_exists))) {
|
||||||
/* failure */
|
/* failure */
|
||||||
@ -914,7 +914,7 @@ try_again:
|
|||||||
ut_error;
|
ut_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
file = CreateFile(name,
|
file = CreateFile((LPCTSTR) name,
|
||||||
access,
|
access,
|
||||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||||
/* file can be read ansd written also
|
/* file can be read ansd written also
|
||||||
@ -1053,7 +1053,7 @@ os_file_create_simple_no_error_handling(
|
|||||||
ut_error;
|
ut_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
file = CreateFile(name,
|
file = CreateFile((LPCTSTR) name,
|
||||||
access,
|
access,
|
||||||
share_mode,
|
share_mode,
|
||||||
NULL, /* default security attributes */
|
NULL, /* default security attributes */
|
||||||
@ -1200,7 +1200,7 @@ try_again:
|
|||||||
ut_error;
|
ut_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
file = CreateFile(name,
|
file = CreateFile((LPCTSTR) name,
|
||||||
GENERIC_READ | GENERIC_WRITE, /* read and write
|
GENERIC_READ | GENERIC_WRITE, /* read and write
|
||||||
access */
|
access */
|
||||||
share_mode, /* File can be read also by other
|
share_mode, /* File can be read also by other
|
||||||
|
@ -121,7 +121,7 @@ os_event_create(
|
|||||||
event->handle = CreateEvent(NULL,/* No security attributes */
|
event->handle = CreateEvent(NULL,/* No security attributes */
|
||||||
TRUE, /* Manual reset */
|
TRUE, /* Manual reset */
|
||||||
FALSE, /* Initial state nonsignaled */
|
FALSE, /* Initial state nonsignaled */
|
||||||
name);
|
(LPCTSTR) name);
|
||||||
if (!event->handle) {
|
if (!event->handle) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"InnoDB: Could not create a Windows event semaphore; Windows error %lu\n",
|
"InnoDB: Could not create a Windows event semaphore; Windows error %lu\n",
|
||||||
@ -177,7 +177,7 @@ os_event_create_auto(
|
|||||||
event->handle = CreateEvent(NULL,/* No security attributes */
|
event->handle = CreateEvent(NULL,/* No security attributes */
|
||||||
FALSE, /* Auto-reset */
|
FALSE, /* Auto-reset */
|
||||||
FALSE, /* Initial state nonsignaled */
|
FALSE, /* Initial state nonsignaled */
|
||||||
name);
|
(LPCTSTR) name);
|
||||||
|
|
||||||
if (!event->handle) {
|
if (!event->handle) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
@ -440,7 +440,7 @@ os_mutex_create(
|
|||||||
|
|
||||||
mutex = CreateMutex(NULL, /* No security attributes */
|
mutex = CreateMutex(NULL, /* No security attributes */
|
||||||
FALSE, /* Initial state: no owner */
|
FALSE, /* Initial state: no owner */
|
||||||
name);
|
(LPCTSTR) name);
|
||||||
ut_a(mutex);
|
ut_a(mutex);
|
||||||
#else
|
#else
|
||||||
os_fast_mutex_t* mutex;
|
os_fast_mutex_t* mutex;
|
||||||
|
@ -1738,7 +1738,7 @@ myodbc_remove_escape(MYSQL *mysql,char *name)
|
|||||||
|
|
||||||
/* Default number of rows fetched per one COM_FETCH command. */
|
/* Default number of rows fetched per one COM_FETCH command. */
|
||||||
|
|
||||||
#define DEFAULT_PREFETCH_ROWS 1UL
|
#define DEFAULT_PREFETCH_ROWS (ulong) 1
|
||||||
|
|
||||||
/*
|
/*
|
||||||
These functions are called by function pointer MYSQL_STMT::read_row_func.
|
These functions are called by function pointer MYSQL_STMT::read_row_func.
|
||||||
@ -2809,10 +2809,13 @@ my_bool STDCALL mysql_stmt_attr_get(MYSQL_STMT *stmt,
|
|||||||
{
|
{
|
||||||
switch (attr_type) {
|
switch (attr_type) {
|
||||||
case STMT_ATTR_UPDATE_MAX_LENGTH:
|
case STMT_ATTR_UPDATE_MAX_LENGTH:
|
||||||
*(unsigned long *) value= stmt->update_max_length;
|
*(ulong*) value= stmt->update_max_length;
|
||||||
break;
|
break;
|
||||||
case STMT_ATTR_CURSOR_TYPE:
|
case STMT_ATTR_CURSOR_TYPE:
|
||||||
*(unsigned long *) value= stmt->flags;
|
*(ulong*) value= stmt->flags;
|
||||||
|
break;
|
||||||
|
case STMT_ATTR_PREFETCH_ROWS:
|
||||||
|
*(ulong*) value= stmt->prefetch_rows;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -3871,6 +3871,14 @@ int update_state_info(MI_CHECK *param, MI_INFO *info,uint update)
|
|||||||
if (!share->state.create_time)
|
if (!share->state.create_time)
|
||||||
share->state.create_time=share->state.check_time;
|
share->state.create_time=share->state.check_time;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
When tables are locked we haven't synched the share state and the
|
||||||
|
real state for a while so we better do it here before synching
|
||||||
|
the share state to disk. Only when table is write locked is it
|
||||||
|
necessary to perform this synch.
|
||||||
|
*/
|
||||||
|
if (info->lock_type == F_WRLCK)
|
||||||
|
share->state.state= *info->state;
|
||||||
if (mi_state_info_write(share->kfile,&share->state,1+2))
|
if (mi_state_info_write(share->kfile,&share->state,1+2))
|
||||||
goto err;
|
goto err;
|
||||||
share->changed=0;
|
share->changed=0;
|
||||||
|
@ -667,7 +667,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
|
|||||||
{
|
{
|
||||||
tmp_keydef.keysegs=1;
|
tmp_keydef.keysegs=1;
|
||||||
tmp_keydef.flag= HA_UNIQUE_CHECK;
|
tmp_keydef.flag= HA_UNIQUE_CHECK;
|
||||||
tmp_keydef.block_length= myisam_block_size;
|
tmp_keydef.block_length= (uint16)myisam_block_size;
|
||||||
tmp_keydef.keylength= MI_UNIQUE_HASH_LENGTH + pointer;
|
tmp_keydef.keylength= MI_UNIQUE_HASH_LENGTH + pointer;
|
||||||
tmp_keydef.minlength=tmp_keydef.maxlength=tmp_keydef.keylength;
|
tmp_keydef.minlength=tmp_keydef.maxlength=tmp_keydef.keylength;
|
||||||
tmp_keyseg.type= MI_UNIQUE_HASH_TYPE;
|
tmp_keyseg.type= MI_UNIQUE_HASH_TYPE;
|
||||||
|
@ -107,7 +107,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
|
|||||||
}
|
}
|
||||||
if (keyseg->flag & HA_SPACE_PACK)
|
if (keyseg->flag & HA_SPACE_PACK)
|
||||||
{
|
{
|
||||||
end=pos+length;
|
end= pos + length;
|
||||||
if (type != HA_KEYTYPE_NUM)
|
if (type != HA_KEYTYPE_NUM)
|
||||||
{
|
{
|
||||||
while (end > pos && end[-1] == ' ')
|
while (end > pos && end[-1] == ' ')
|
||||||
|
@ -68,7 +68,7 @@ int mi_rnext_same(MI_INFO *info, byte *buf)
|
|||||||
info->lastkey_length,SEARCH_BIGGER,
|
info->lastkey_length,SEARCH_BIGGER,
|
||||||
info->s->state.key_root[inx])))
|
info->s->state.key_root[inx])))
|
||||||
break;
|
break;
|
||||||
if (ha_key_cmp(keyinfo->seg,info->lastkey2,info->lastkey,
|
if (ha_key_cmp(keyinfo->seg, info->lastkey, info->lastkey2,
|
||||||
info->last_rkey_length, SEARCH_FIND, ¬_used))
|
info->last_rkey_length, SEARCH_FIND, ¬_used))
|
||||||
{
|
{
|
||||||
error=1;
|
error=1;
|
||||||
|
@ -471,20 +471,25 @@ static void update_record(char *record)
|
|||||||
ptr=blob_key;
|
ptr=blob_key;
|
||||||
memcpy_fixed(pos+4,&ptr,sizeof(char*)); /* Store pointer to new key */
|
memcpy_fixed(pos+4,&ptr,sizeof(char*)); /* Store pointer to new key */
|
||||||
if (keyinfo[0].seg[0].type != HA_KEYTYPE_NUM)
|
if (keyinfo[0].seg[0].type != HA_KEYTYPE_NUM)
|
||||||
my_casedn(default_charset_info,blob_key,length);
|
default_charset_info->cset->casedn(default_charset_info,
|
||||||
|
blob_key, length, blob_key, length);
|
||||||
pos+=recinfo[1].length;
|
pos+=recinfo[1].length;
|
||||||
}
|
}
|
||||||
else if (recinfo[1].type == FIELD_VARCHAR)
|
else if (recinfo[1].type == FIELD_VARCHAR)
|
||||||
{
|
{
|
||||||
uint pack_length= HA_VARCHAR_PACKLENGTH(recinfo[1].length-1);
|
uint pack_length= HA_VARCHAR_PACKLENGTH(recinfo[1].length-1);
|
||||||
uint length= pack_length == 1 ? (uint) *(uchar*) pos : uint2korr(pos);
|
uint length= pack_length == 1 ? (uint) *(uchar*) pos : uint2korr(pos);
|
||||||
my_casedn(default_charset_info,pos+pack_length,length);
|
default_charset_info->cset->casedn(default_charset_info,
|
||||||
|
pos + pack_length, length,
|
||||||
|
pos + pack_length, length);
|
||||||
pos+=recinfo[1].length;
|
pos+=recinfo[1].length;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (keyinfo[0].seg[0].type != HA_KEYTYPE_NUM)
|
if (keyinfo[0].seg[0].type != HA_KEYTYPE_NUM)
|
||||||
my_casedn(default_charset_info,pos,keyinfo[0].seg[0].length);
|
default_charset_info->cset->casedn(default_charset_info,
|
||||||
|
pos, keyinfo[0].seg[0].length,
|
||||||
|
pos, keyinfo[0].seg[0].length);
|
||||||
pos+=recinfo[1].length;
|
pos+=recinfo[1].length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,8 @@ testdir = $(benchdir_root)/mysql-test
|
|||||||
EXTRA_SCRIPTS = mysql-test-run.sh mysql-test-run.pl install_test_db.sh valgrind.supp
|
EXTRA_SCRIPTS = mysql-test-run.sh mysql-test-run.pl install_test_db.sh valgrind.supp
|
||||||
EXTRA_DIST = $(EXTRA_SCRIPTS)
|
EXTRA_DIST = $(EXTRA_SCRIPTS)
|
||||||
test_SCRIPTS = mysql-test-run install_test_db
|
test_SCRIPTS = mysql-test-run install_test_db
|
||||||
test_DATA = std_data/client-key.pem std_data/client-cert.pem std_data/cacert.pem
|
test_DATA = std_data/client-key.pem std_data/client-cert.pem std_data/cacert.pem \
|
||||||
|
std_data/server-cert.pem std_data/server-key.pem
|
||||||
CLEANFILES = $(test_SCRIPTS) $(test_DATA)
|
CLEANFILES = $(test_SCRIPTS) $(test_DATA)
|
||||||
|
|
||||||
INCLUDES = -I$(srcdir)/../include -I../include -I..
|
INCLUDES = -I$(srcdir)/../include -I../include -I..
|
||||||
@ -48,6 +49,7 @@ dist-hook:
|
|||||||
mkdir -p $(distdir)/t $(distdir)/r $(distdir)/include \
|
mkdir -p $(distdir)/t $(distdir)/r $(distdir)/include \
|
||||||
$(distdir)/std_data $(distdir)/lib
|
$(distdir)/std_data $(distdir)/lib
|
||||||
$(INSTALL_DATA) $(srcdir)/t/*.test $(distdir)/t
|
$(INSTALL_DATA) $(srcdir)/t/*.test $(distdir)/t
|
||||||
|
$(INSTALL_DATA) $(srcdir)/t/*.sql $(distdir)/t
|
||||||
-$(INSTALL_DATA) $(srcdir)/t/*.disabled $(distdir)/t
|
-$(INSTALL_DATA) $(srcdir)/t/*.disabled $(distdir)/t
|
||||||
$(INSTALL_DATA) $(srcdir)/t/*.opt $(srcdir)/t/*.sh $(srcdir)/t/*.slave-mi $(distdir)/t
|
$(INSTALL_DATA) $(srcdir)/t/*.opt $(srcdir)/t/*.sh $(srcdir)/t/*.slave-mi $(distdir)/t
|
||||||
$(INSTALL_DATA) $(srcdir)/include/*.inc $(distdir)/include
|
$(INSTALL_DATA) $(srcdir)/include/*.inc $(distdir)/include
|
||||||
@ -69,6 +71,7 @@ install-data-local:
|
|||||||
$(DESTDIR)$(testdir)/lib
|
$(DESTDIR)$(testdir)/lib
|
||||||
$(INSTALL_DATA) $(srcdir)/README $(DESTDIR)$(testdir)
|
$(INSTALL_DATA) $(srcdir)/README $(DESTDIR)$(testdir)
|
||||||
$(INSTALL_DATA) $(srcdir)/t/*.test $(DESTDIR)$(testdir)/t
|
$(INSTALL_DATA) $(srcdir)/t/*.test $(DESTDIR)$(testdir)/t
|
||||||
|
$(INSTALL_DATA) $(srcdir)/t/*.sql $(DESTDIR)$(testdir)/t
|
||||||
-$(INSTALL_DATA) $(srcdir)/t/*.disabled $(DESTDIR)$(testdir)/t
|
-$(INSTALL_DATA) $(srcdir)/t/*.disabled $(DESTDIR)$(testdir)/t
|
||||||
$(INSTALL_DATA) $(srcdir)/t/*.opt $(DESTDIR)$(testdir)/t
|
$(INSTALL_DATA) $(srcdir)/t/*.opt $(DESTDIR)$(testdir)/t
|
||||||
$(INSTALL_DATA) $(srcdir)/t/*.sh $(DESTDIR)$(testdir)/t
|
$(INSTALL_DATA) $(srcdir)/t/*.sh $(DESTDIR)$(testdir)/t
|
||||||
|
@ -174,11 +174,8 @@ where a=2
|
|||||||
limit 1';
|
limit 1';
|
||||||
execute stmt1 ;
|
execute stmt1 ;
|
||||||
select a,b from t1 where b = 'bla' ;
|
select a,b from t1 where b = 'bla' ;
|
||||||
# currently (May 2004, Version 4.1) it is impossible
|
prepare stmt1 from 'update t1 set b=''bla'' where a=2 limit ?';
|
||||||
-- error 1064
|
execute stmt1 using @arg00;
|
||||||
prepare stmt1 from 'update t1 set b=''bla''
|
|
||||||
where a=2
|
|
||||||
limit ?';
|
|
||||||
|
|
||||||
--disable_query_log
|
--disable_query_log
|
||||||
select '------ insert tests ------' as test_sequence ;
|
select '------ insert tests ------' as test_sequence ;
|
||||||
|
@ -300,10 +300,8 @@ set @arg00=1;
|
|||||||
prepare stmt1 from ' select a,b from t1 order by a
|
prepare stmt1 from ' select a,b from t1 order by a
|
||||||
limit 1 ';
|
limit 1 ';
|
||||||
execute stmt1 ;
|
execute stmt1 ;
|
||||||
# currently (May 2004, Version 4.1) it is impossible
|
prepare stmt1 from ' select a,b from t1 limit ? ';
|
||||||
-- error 1064
|
execute stmt1 using @arg00;
|
||||||
prepare stmt1 from ' select a,b from t1
|
|
||||||
limit ? ';
|
|
||||||
|
|
||||||
##### parameter used in many places
|
##### parameter used in many places
|
||||||
set @arg00='b' ;
|
set @arg00='b' ;
|
||||||
|
19
mysql-test/include/show_msg.inc
Executable file
19
mysql-test/include/show_msg.inc
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
#### include/show_msg.inc
|
||||||
|
#
|
||||||
|
# This file writes the value set in @message into the
|
||||||
|
# a protocol file as part of executing a test sequence
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
# Add the following to any *.test file:
|
||||||
|
# :
|
||||||
|
# set @message="This is a message example";
|
||||||
|
# --source include/show_msg.inc
|
||||||
|
# :
|
||||||
|
#
|
||||||
|
|
||||||
|
--disable_query_log
|
||||||
|
SET @utf8_message = CONVERT(@message using utf8);
|
||||||
|
select @utf8_message as ""
|
||||||
|
union
|
||||||
|
select repeat(CONVERT('-' using utf8),char_length(@utf8_message));
|
||||||
|
--enable_query_log
|
23
mysql-test/include/show_msg80.inc
Executable file
23
mysql-test/include/show_msg80.inc
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#### include/show_msg80.inc
|
||||||
|
#
|
||||||
|
# This file writes the value set in @message into the
|
||||||
|
# a protocol file as part of executing a test sequence
|
||||||
|
# with a dash line that is fixed on 80 characters.
|
||||||
|
# This can be used in the case of long messages,
|
||||||
|
# multi line messages that exceed 80 or if an 80 char
|
||||||
|
# line is desired for short messages.
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
# Add the following to any *.test file:
|
||||||
|
# :
|
||||||
|
# set @message="This is a message example";
|
||||||
|
# --source include/show_msg80.inc
|
||||||
|
# :
|
||||||
|
#
|
||||||
|
|
||||||
|
--disable_query_log
|
||||||
|
SET @utf8_message = CONVERT(@message using utf8);
|
||||||
|
select @utf8_message as ""
|
||||||
|
union
|
||||||
|
select repeat(CONVERT('-' using utf8),80);
|
||||||
|
--enable_query_log
|
@ -25,7 +25,7 @@ sub mtr_full_hostname () {
|
|||||||
if ( $hostname !~ /\./ )
|
if ( $hostname !~ /\./ )
|
||||||
{
|
{
|
||||||
my $address= gethostbyname($hostname)
|
my $address= gethostbyname($hostname)
|
||||||
or die "Couldn't resolve $hostname : $!";
|
or mtr_error("Couldn't resolve $hostname : $!");
|
||||||
my $fullname= gethostbyaddr($address, AF_INET);
|
my $fullname= gethostbyaddr($address, AF_INET);
|
||||||
$hostname= $fullname if $fullname;
|
$hostname= $fullname if $fullname;
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ sub mtr_spawn ($$$$$$);
|
|||||||
sub mtr_stop_mysqld_servers ($);
|
sub mtr_stop_mysqld_servers ($);
|
||||||
sub mtr_kill_leftovers ();
|
sub mtr_kill_leftovers ();
|
||||||
sub mtr_record_dead_children ();
|
sub mtr_record_dead_children ();
|
||||||
|
sub mtr_exit ($);
|
||||||
sub sleep_until_file_created ($$$);
|
sub sleep_until_file_created ($$$);
|
||||||
|
|
||||||
# static in C
|
# static in C
|
||||||
@ -784,4 +785,17 @@ sub sleep_until_file_created ($$$) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# When we exit, we kill off all children
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
sub mtr_exit ($) {
|
||||||
|
my $code= shift;
|
||||||
|
local $SIG{HUP} = 'IGNORE';
|
||||||
|
kill('HUP', -$$);
|
||||||
|
exit($code);
|
||||||
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
@ -268,7 +268,8 @@ sub mtr_warning (@) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub mtr_error (@) {
|
sub mtr_error (@) {
|
||||||
die "mysql-test-run: *** ERROR: ",join(" ", @_),"\n";
|
print STDERR "mysql-test-run: *** ERROR: ",join(" ", @_),"\n";
|
||||||
|
mtr_exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub mtr_debug (@) {
|
sub mtr_debug (@) {
|
||||||
|
@ -398,7 +398,7 @@ sub main () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
exit(0);
|
mtr_exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
@ -568,7 +568,9 @@ sub command_line_setup () {
|
|||||||
$opt_vardir= "$glob_mysql_test_dir/var";
|
$opt_vardir= "$glob_mysql_test_dir/var";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $opt_vardir !~ m,^/, )
|
# We make the path absolute, as the server will do a chdir() before usage
|
||||||
|
unless ( $opt_vardir =~ m,^/, or
|
||||||
|
($glob_win32 and $opt_vardir =~ m,^[a-z]:/,i) )
|
||||||
{
|
{
|
||||||
# Make absolute path, relative test dir
|
# Make absolute path, relative test dir
|
||||||
$opt_vardir= "$glob_mysql_test_dir/$opt_vardir";
|
$opt_vardir= "$glob_mysql_test_dir/$opt_vardir";
|
||||||
@ -1292,9 +1294,9 @@ sub install_db ($$) {
|
|||||||
mtr_report("Installing \u$type Databases");
|
mtr_report("Installing \u$type Databases");
|
||||||
|
|
||||||
open(IN, $init_db_sql)
|
open(IN, $init_db_sql)
|
||||||
or error("Can't open $init_db_sql: $!");
|
or mtr_error("Can't open $init_db_sql: $!");
|
||||||
open(OUT, ">", $init_db_sql_tmp)
|
open(OUT, ">", $init_db_sql_tmp)
|
||||||
or error("Can't write to $init_db_sql_tmp: $!");
|
or mtr_error("Can't write to $init_db_sql_tmp: $!");
|
||||||
while (<IN>)
|
while (<IN>)
|
||||||
{
|
{
|
||||||
chomp;
|
chomp;
|
||||||
@ -1568,7 +1570,7 @@ sub report_failure_and_restart ($) {
|
|||||||
{
|
{
|
||||||
stop_masters_slaves();
|
stop_masters_slaves();
|
||||||
}
|
}
|
||||||
exit(1);
|
mtr_exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
# FIXME always terminate on failure?!
|
# FIXME always terminate on failure?!
|
||||||
@ -2267,5 +2269,5 @@ Options not yet described, or that I want to look into more
|
|||||||
with-openssl
|
with-openssl
|
||||||
|
|
||||||
HERE
|
HERE
|
||||||
exit(1);
|
mtr_exit(1);
|
||||||
}
|
}
|
||||||
|
@ -887,7 +887,7 @@ report_stats () {
|
|||||||
|
|
||||||
found_error=0
|
found_error=0
|
||||||
# Find errors
|
# Find errors
|
||||||
for i in "^Warning:" "^Error:" "^==.* at 0x"
|
for i in "^Warning:" "^Error:" "^==.* at 0x" "InnoDB: Warning"
|
||||||
do
|
do
|
||||||
if $GREP "$i" $MY_LOG_DIR/warnings.tmp >> $MY_LOG_DIR/warnings
|
if $GREP "$i" $MY_LOG_DIR/warnings.tmp >> $MY_LOG_DIR/warnings
|
||||||
then
|
then
|
||||||
|
32
mysql-test/r/analyze.result
Normal file
32
mysql-test/r/analyze.result
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
create table t1 (a bigint);
|
||||||
|
lock tables t1 write;
|
||||||
|
insert into t1 values(0);
|
||||||
|
analyze table t1;
|
||||||
|
Table Op Msg_type Msg_text
|
||||||
|
test.t1 analyze status OK
|
||||||
|
unlock tables;
|
||||||
|
check table t1;
|
||||||
|
Table Op Msg_type Msg_text
|
||||||
|
test.t1 check status OK
|
||||||
|
drop table t1;
|
||||||
|
create table t1 (a bigint);
|
||||||
|
insert into t1 values(0);
|
||||||
|
lock tables t1 write;
|
||||||
|
delete from t1;
|
||||||
|
analyze table t1;
|
||||||
|
Table Op Msg_type Msg_text
|
||||||
|
test.t1 analyze status OK
|
||||||
|
unlock tables;
|
||||||
|
check table t1;
|
||||||
|
Table Op Msg_type Msg_text
|
||||||
|
test.t1 check status OK
|
||||||
|
drop table t1;
|
||||||
|
create table t1 (a bigint);
|
||||||
|
insert into t1 values(0);
|
||||||
|
analyze table t1;
|
||||||
|
Table Op Msg_type Msg_text
|
||||||
|
test.t1 analyze status OK
|
||||||
|
check table t1;
|
||||||
|
Table Op Msg_type Msg_text
|
||||||
|
test.t1 check status OK
|
||||||
|
drop table t1;
|
@ -355,3 +355,42 @@ CHECK TABLE t1;
|
|||||||
Table Op Msg_type Msg_text
|
Table Op Msg_type Msg_text
|
||||||
test.t1 check status OK
|
test.t1 check status OK
|
||||||
DROP TABLE IF EXISTS t1;
|
DROP TABLE IF EXISTS t1;
|
||||||
|
CREATE TABLE t1 ( `a` int(11) NOT NULL auto_increment, `b` int(11) default NULL,PRIMARY KEY (`a`),UNIQUE KEY `b` (`b`));
|
||||||
|
insert into t1 (b) values (1);
|
||||||
|
replace into t1 (b) values (2), (1), (3);
|
||||||
|
select * from t1;
|
||||||
|
a b
|
||||||
|
3 1
|
||||||
|
2 2
|
||||||
|
4 3
|
||||||
|
truncate table t1;
|
||||||
|
insert into t1 (b) values (1);
|
||||||
|
replace into t1 (b) values (2);
|
||||||
|
replace into t1 (b) values (1);
|
||||||
|
replace into t1 (b) values (3);
|
||||||
|
select * from t1;
|
||||||
|
a b
|
||||||
|
3 1
|
||||||
|
2 2
|
||||||
|
4 3
|
||||||
|
drop table t1;
|
||||||
|
create table t1 (rowid int not null auto_increment, val int not null,primary
|
||||||
|
key (rowid), unique(val));
|
||||||
|
replace into t1 (val) values ('1'),('2');
|
||||||
|
replace into t1 (val) values ('1'),('2');
|
||||||
|
insert into t1 (val) values ('1'),('2');
|
||||||
|
ERROR 23000: Duplicate entry '1' for key 2
|
||||||
|
select * from t1;
|
||||||
|
rowid val
|
||||||
|
3 1
|
||||||
|
4 2
|
||||||
|
drop table t1;
|
||||||
|
create table t1 (a int not null auto_increment primary key, val int);
|
||||||
|
insert into t1 (val) values (1);
|
||||||
|
update t1 set a=2 where a=1;
|
||||||
|
insert into t1 (val) values (1);
|
||||||
|
select * from t1;
|
||||||
|
a val
|
||||||
|
2 1
|
||||||
|
3 1
|
||||||
|
drop table t1;
|
||||||
|
@ -434,7 +434,7 @@ d date YES NULL
|
|||||||
e varchar(1) NO
|
e varchar(1) NO
|
||||||
f datetime YES NULL
|
f datetime YES NULL
|
||||||
g time YES NULL
|
g time YES NULL
|
||||||
h varbinary(23) NO
|
h longblob NO
|
||||||
dd time YES NULL
|
dd time YES NULL
|
||||||
select * from t2;
|
select * from t2;
|
||||||
a b c d e f g h dd
|
a b c d e f g h dd
|
||||||
@ -513,9 +513,9 @@ drop database mysqltest;
|
|||||||
select database();
|
select database();
|
||||||
database()
|
database()
|
||||||
NULL
|
NULL
|
||||||
select database();
|
select database(), user();
|
||||||
database()
|
database() user()
|
||||||
NULL
|
NULL mysqltest_1@localhost
|
||||||
use test;
|
use test;
|
||||||
create table t1 (a int, index `primary` (a));
|
create table t1 (a int, index `primary` (a));
|
||||||
ERROR 42000: Incorrect index name 'primary'
|
ERROR 42000: Incorrect index name 'primary'
|
||||||
@ -579,7 +579,6 @@ select * from t2;
|
|||||||
b
|
b
|
||||||
1
|
1
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
use test;
|
|
||||||
create table t1 (a int);
|
create table t1 (a int);
|
||||||
create table t1 select * from t1;
|
create table t1 select * from t1;
|
||||||
ERROR HY000: You can't specify target table 't1' for update in FROM clause
|
ERROR HY000: You can't specify target table 't1' for update in FROM clause
|
||||||
@ -597,3 +596,9 @@ ERROR 42000: Incorrect database name 'xyz'
|
|||||||
create table t1(t1.name int);
|
create table t1(t1.name int);
|
||||||
create table t2(test.t2.name int);
|
create table t2(test.t2.name int);
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
create database mysqltest;
|
||||||
|
use mysqltest;
|
||||||
|
drop database mysqltest;
|
||||||
|
create table test.t1 like x;
|
||||||
|
ERROR 42000: Incorrect database name 'NULL'
|
||||||
|
drop table if exists test.t1;
|
||||||
|
@ -7,3 +7,15 @@ SELECT a, length(a), a='', a=' ', a=' ' FROM t1;
|
|||||||
a length(a) a='' a=' ' a=' '
|
a length(a) a='' a=' ' a=' '
|
||||||
0 1 1 1
|
0 1 1 1
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
popisek varchar(30) collate cp1250_general_ci NOT NULL default '',
|
||||||
|
PRIMARY KEY (`popisek`)
|
||||||
|
);
|
||||||
|
INSERT INTO t1 VALUES ('2005-01-1');
|
||||||
|
SELECT * FROM t1 WHERE popisek = '2005-01-1';
|
||||||
|
popisek
|
||||||
|
2005-01-1
|
||||||
|
SELECT * FROM t1 WHERE popisek LIKE '2005-01-1';
|
||||||
|
popisek
|
||||||
|
2005-01-1
|
||||||
|
drop table t1;
|
||||||
|
@ -2396,3 +2396,27 @@ utf8_unicode_ci 6109
|
|||||||
utf8_unicode_ci 61
|
utf8_unicode_ci 61
|
||||||
utf8_unicode_ci 6120
|
utf8_unicode_ci 6120
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
CREATE TABLE t1 (id int, a varchar(30) character set utf8);
|
||||||
|
INSERT INTO t1 VALUES (1, _ucs2 0x01310069), (2, _ucs2 0x01310131);
|
||||||
|
INSERT INTO t1 VALUES (3, _ucs2 0x00690069), (4, _ucs2 0x01300049);
|
||||||
|
INSERT INTO t1 VALUES (5, _ucs2 0x01300130), (6, _ucs2 0x00490049);
|
||||||
|
SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu
|
||||||
|
FROM t1 ORDER BY id;
|
||||||
|
a la l ll u lu
|
||||||
|
ıi 3 ıi 3 II 2
|
||||||
|
ıı 4 ıı 4 II 2
|
||||||
|
ii 2 ii 2 II 2
|
||||||
|
İI 3 ii 2 İI 3
|
||||||
|
İİ 4 ii 2 İİ 4
|
||||||
|
II 2 ii 2 II 2
|
||||||
|
ALTER TABLE t1 MODIFY a VARCHAR(30) character set utf8 collate utf8_turkish_ci;
|
||||||
|
SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu
|
||||||
|
FROM t1 ORDER BY id;
|
||||||
|
a la l ll u lu
|
||||||
|
ıi 3 ıi 3 Iİ 3
|
||||||
|
ıı 4 ıı 4 II 2
|
||||||
|
ii 2 ii 2 İİ 4
|
||||||
|
İI 3 iı 3 İI 3
|
||||||
|
İİ 4 ii 2 İİ 4
|
||||||
|
II 2 ıı 4 II 2
|
||||||
|
DROP TABLE t1;
|
||||||
|
@ -891,3 +891,17 @@ string
|
|||||||
create table t1 (a varchar(255)) default character set utf8;
|
create table t1 (a varchar(255)) default character set utf8;
|
||||||
insert into t1 values (1.0);
|
insert into t1 values (1.0);
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
create table t1 (
|
||||||
|
id int not null,
|
||||||
|
city varchar(20) not null,
|
||||||
|
key (city(7),id)
|
||||||
|
) character set=utf8;
|
||||||
|
insert into t1 values (1,'Durban North');
|
||||||
|
insert into t1 values (2,'Durban');
|
||||||
|
select * from t1 where city = 'Durban';
|
||||||
|
id city
|
||||||
|
2 Durban
|
||||||
|
select * from t1 where city = 'Durban ';
|
||||||
|
id city
|
||||||
|
2 Durban
|
||||||
|
drop table t1;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
drop table if exists t1,t11,t12,t2;
|
drop table if exists t1,t2,t3,t11,t12;
|
||||||
CREATE TABLE t1 (a tinyint(3), b tinyint(5));
|
CREATE TABLE t1 (a tinyint(3), b tinyint(5));
|
||||||
INSERT INTO t1 VALUES (1,1);
|
INSERT INTO t1 VALUES (1,1);
|
||||||
INSERT LOW_PRIORITY INTO t1 VALUES (1,2);
|
INSERT LOW_PRIORITY INTO t1 VALUES (1,2);
|
||||||
@ -172,3 +172,23 @@ a
|
|||||||
0
|
0
|
||||||
2
|
2
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1 (a int not null,b int not null);
|
||||||
|
CREATE TABLE t2 (a int not null, b int not null, primary key (a,b));
|
||||||
|
CREATE TABLE t3 (a int not null, b int not null, primary key (a,b));
|
||||||
|
insert into t1 values (1,1),(2,1),(1,3);
|
||||||
|
insert into t2 values (1,1),(2,2),(3,3);
|
||||||
|
insert into t3 values (1,1),(2,1),(1,3);
|
||||||
|
select * from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b;
|
||||||
|
a b a b a b
|
||||||
|
1 1 1 1 1 1
|
||||||
|
2 1 2 2 2 1
|
||||||
|
1 3 1 1 1 3
|
||||||
|
explain select * from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
|
||||||
|
1 SIMPLE t2 index PRIMARY PRIMARY 8 NULL 3 Using where; Using index
|
||||||
|
1 SIMPLE t3 index PRIMARY PRIMARY 8 NULL 3 Using where; Using index
|
||||||
|
delete t2.*,t3.* from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b;
|
||||||
|
select * from t3;
|
||||||
|
a b
|
||||||
|
drop table t1,t2,t3;
|
||||||
|
@ -464,3 +464,11 @@ SELECT DISTINCT html,SUM(rout)/(SUM(rin)+1) as 'prod' FROM t1 GROUP BY rin;
|
|||||||
html prod
|
html prod
|
||||||
1 0.0000
|
1 0.0000
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
create table t1 (id int, dsc varchar(50));
|
||||||
|
insert into t1 values (1, "line number one"), (2, "line number two"), (3, "line number three");
|
||||||
|
select distinct id, IFNULL(dsc, '-') from t1;
|
||||||
|
id IFNULL(dsc, '-')
|
||||||
|
1 line number one
|
||||||
|
2 line number two
|
||||||
|
3 line number three
|
||||||
|
drop table t1;
|
||||||
|
@ -343,18 +343,6 @@ GROUP_CONCAT(b ORDER BY b)
|
|||||||
First Row
|
First Row
|
||||||
Second Row
|
Second Row
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
CREATE TABLE t1 (a_id tinyint(4) NOT NULL default '0', PRIMARY KEY (a_id)) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
|
||||||
INSERT INTO t1 VALUES (1),(2),(3);
|
|
||||||
CREATE TABLE t2 (b_id tinyint(4) NOT NULL default '0',b_a tinyint(4) NOT NULL default '0', PRIMARY KEY (b_id), KEY (b_a),
|
|
||||||
CONSTRAINT fk_b_a FOREIGN KEY (b_a) REFERENCES t1 (a_id) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
|
||||||
INSERT INTO t2 VALUES (1,1),(2,1),(3,1),(4,2),(5,2);
|
|
||||||
SELECT * FROM (SELECT t1.*,GROUP_CONCAT(t2.b_id SEPARATOR ',') as b_list FROM (t1 LEFT JOIN (t2) on t1.a_id = t2.b_a) GROUP BY t1.a_id ) AS xyz;
|
|
||||||
a_id b_list
|
|
||||||
1 1,2,3
|
|
||||||
2 4,5
|
|
||||||
3 NULL
|
|
||||||
DROP TABLE t2;
|
|
||||||
DROP TABLE t1;
|
|
||||||
CREATE TABLE t1 (A_ID INT NOT NULL,A_DESC CHAR(3) NOT NULL,PRIMARY KEY (A_ID));
|
CREATE TABLE t1 (A_ID INT NOT NULL,A_DESC CHAR(3) NOT NULL,PRIMARY KEY (A_ID));
|
||||||
INSERT INTO t1 VALUES (1,'ABC'), (2,'EFG'), (3,'HIJ');
|
INSERT INTO t1 VALUES (1,'ABC'), (2,'EFG'), (3,'HIJ');
|
||||||
CREATE TABLE t2 (A_ID INT NOT NULL,B_DESC CHAR(3) NOT NULL,PRIMARY KEY (A_ID,B_DESC));
|
CREATE TABLE t2 (A_ID INT NOT NULL,B_DESC CHAR(3) NOT NULL,PRIMARY KEY (A_ID,B_DESC));
|
||||||
@ -462,6 +450,49 @@ SELECT GROUP_CONCAT(id) AS gc FROM t1 HAVING gc IS NULL;
|
|||||||
gc
|
gc
|
||||||
NULL
|
NULL
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
create table t2 (a int, b int);
|
||||||
|
insert into t2 values (1,1), (2,2);
|
||||||
|
select b x, (select group_concat(x) from t2) from t2;
|
||||||
|
x (select group_concat(x) from t2)
|
||||||
|
1 1,1
|
||||||
|
2 2,2
|
||||||
|
drop table t2;
|
||||||
|
create table t1 (d int not null auto_increment,primary key(d), a int, b int, c int);
|
||||||
|
insert into t1(a,b) values (1,3), (1,4), (1,2), (2,7), (1,1), (1,2), (2,3), (2,3);
|
||||||
|
select d,a,b from t1 order by a;
|
||||||
|
d a b
|
||||||
|
1 1 3
|
||||||
|
2 1 4
|
||||||
|
3 1 2
|
||||||
|
5 1 1
|
||||||
|
6 1 2
|
||||||
|
4 2 7
|
||||||
|
7 2 3
|
||||||
|
8 2 3
|
||||||
|
explain select a, group_concat(b) from t1 group by a with rollup;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using filesort
|
||||||
|
select a, group_concat(b) from t1 group by a with rollup;
|
||||||
|
a group_concat(b)
|
||||||
|
1 3,4,2,1,2
|
||||||
|
2 7,3,3
|
||||||
|
NULL 3,4,2,1,2,7,3,3
|
||||||
|
select a, group_concat(distinct b) from t1 group by a with rollup;
|
||||||
|
a group_concat(distinct b)
|
||||||
|
1 3,4,2,1
|
||||||
|
2 7,3
|
||||||
|
NULL 3,4,2,1,7
|
||||||
|
select a, group_concat(b order by b) from t1 group by a with rollup;
|
||||||
|
a group_concat(b order by b)
|
||||||
|
1 1,2,2,3,4
|
||||||
|
2 3,3,7
|
||||||
|
NULL 1,2,2,3,3,3,4,7
|
||||||
|
select a, group_concat(distinct b order by b) from t1 group by a with rollup;
|
||||||
|
a group_concat(distinct b order by b)
|
||||||
|
1 1,2,3,4
|
||||||
|
2 3,7
|
||||||
|
NULL 1,2,3,4,7
|
||||||
|
drop table t1;
|
||||||
create table t1 (a char(3), b char(20), primary key (a, b));
|
create table t1 (a char(3), b char(20), primary key (a, b));
|
||||||
insert into t1 values ('ABW', 'Dutch'), ('ABW', 'English');
|
insert into t1 values ('ABW', 'Dutch'), ('ABW', 'English');
|
||||||
select group_concat(a) from t1 group by b;
|
select group_concat(a) from t1 group by b;
|
||||||
@ -469,10 +500,3 @@ group_concat(a)
|
|||||||
ABW
|
ABW
|
||||||
ABW
|
ABW
|
||||||
drop table t1;
|
drop table t1;
|
||||||
create table r2 (a int, b int);
|
|
||||||
insert into r2 values (1,1), (2,2);
|
|
||||||
select b x, (select group_concat(x) from r2) from r2;
|
|
||||||
x (select group_concat(x) from r2)
|
|
||||||
1 1,1
|
|
||||||
2 2,2
|
|
||||||
drop table r2;
|
|
||||||
|
@ -130,3 +130,19 @@ Warnings:
|
|||||||
Note 1003 select degrees(pi()) AS `degrees(pi())`,radians(360) AS `radians(360)`
|
Note 1003 select degrees(pi()) AS `degrees(pi())`,radians(360) AS `radians(360)`
|
||||||
select rand(rand);
|
select rand(rand);
|
||||||
ERROR 42S22: Unknown column 'rand' in 'field list'
|
ERROR 42S22: Unknown column 'rand' in 'field list'
|
||||||
|
create table t1 (col1 int, col2 decimal(60,30));
|
||||||
|
insert into t1 values(1,1234567890.12345);
|
||||||
|
select format(col2,7) from t1;
|
||||||
|
format(col2,7)
|
||||||
|
1,234,567,890.1234500
|
||||||
|
select format(col2,8) from t1;
|
||||||
|
format(col2,8)
|
||||||
|
1,234,567,890.12345000
|
||||||
|
insert into t1 values(7,1234567890123456.12345);
|
||||||
|
select format(col2,6) from t1 where col1=7;
|
||||||
|
format(col2,6)
|
||||||
|
1,234,567,890,123,456.123450
|
||||||
|
drop table t1;
|
||||||
|
select round(150, 2);
|
||||||
|
round(150, 2)
|
||||||
|
150.00
|
||||||
|
@ -688,3 +688,21 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select timestamp_diff(WEEK,_latin1'2001-02-01',_latin1'2001-05-01') AS `a1`,timestamp_diff(SECOND_FRAC,_latin1'2001-02-01 12:59:59.120000',_latin1'2001-05-01 12:58:58.119999') AS `a2`
|
Note 1003 select timestamp_diff(WEEK,_latin1'2001-02-01',_latin1'2001-05-01') AS `a1`,timestamp_diff(SECOND_FRAC,_latin1'2001-02-01 12:59:59.120000',_latin1'2001-05-01 12:58:58.119999') AS `a2`
|
||||||
|
select last_day('2005-00-00');
|
||||||
|
last_day('2005-00-00')
|
||||||
|
NULL
|
||||||
|
Warnings:
|
||||||
|
Warning 1292 Truncated incorrect datetime value: '2005-00-00'
|
||||||
|
select last_day('2005-00-01');
|
||||||
|
last_day('2005-00-01')
|
||||||
|
NULL
|
||||||
|
Warnings:
|
||||||
|
Warning 1292 Truncated incorrect datetime value: '2005-00-01'
|
||||||
|
select last_day('2005-01-00');
|
||||||
|
last_day('2005-01-00')
|
||||||
|
NULL
|
||||||
|
Warnings:
|
||||||
|
Warning 1292 Truncated incorrect datetime value: '2005-01-00'
|
||||||
|
select time_format('100:00:00', '%H %k %h %I %l');
|
||||||
|
time_format('100:00:00', '%H %k %h %I %l')
|
||||||
|
100 100 04 04 4
|
||||||
|
@ -711,3 +711,14 @@ select min(b) from t1;
|
|||||||
min(b)
|
min(b)
|
||||||
3000000000
|
3000000000
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
CREATE TABLE t1 (id int PRIMARY KEY, user_id int, hostname longtext);
|
||||||
|
INSERT INTO t1 VALUES
|
||||||
|
(1, 7, 'cache-dtc-af05.proxy.aol.com'),
|
||||||
|
(2, 3, 'what.ever.com'),
|
||||||
|
(3, 7, 'cache-dtc-af05.proxy.aol.com'),
|
||||||
|
(4, 7, 'cache-dtc-af05.proxy.aol.com');
|
||||||
|
SELECT hostname, COUNT(DISTINCT user_id) as no FROM t1
|
||||||
|
WHERE hostname LIKE '%aol%'
|
||||||
|
GROUP BY hostname;
|
||||||
|
hostname no
|
||||||
|
cache-dtc-af05.proxy.aol.com 1
|
||||||
|
@ -696,3 +696,8 @@ drop table t1;
|
|||||||
create table t1 (a int not null, b int not null auto_increment,
|
create table t1 (a int not null, b int not null auto_increment,
|
||||||
primary key(a, b)) engine=heap;
|
primary key(a, b)) engine=heap;
|
||||||
ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key
|
ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key
|
||||||
|
create table t1 (c char(255), primary key(c(90)));
|
||||||
|
insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
|
||||||
|
insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
|
||||||
|
ERROR 23000: Duplicate entry 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl' for key 1
|
||||||
|
drop table t1;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
DROP TABLE IF EXISTS t0,t1,t2;
|
||||||
show variables where variable_name like "skip_show_database";
|
show variables where variable_name like "skip_show_database";
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
skip_show_database OFF
|
skip_show_database OFF
|
||||||
@ -752,3 +753,73 @@ SELECT table_schema, count(*) FROM information_schema.TABLES GROUP BY TABLE_SCHE
|
|||||||
table_schema count(*)
|
table_schema count(*)
|
||||||
information_schema 15
|
information_schema 15
|
||||||
mysql 17
|
mysql 17
|
||||||
|
create database mysqltest;
|
||||||
|
create table mysqltest.t1 (f1 int, f2 int);
|
||||||
|
create table mysqltest.t2 (f1 int);
|
||||||
|
grant select (f1) on mysqltest.t1 to user1@localhost;
|
||||||
|
grant select on mysqltest.t2 to user2@localhost;
|
||||||
|
grant select on mysqltest.* to user3@localhost;
|
||||||
|
grant select on *.* to user4@localhost;
|
||||||
|
select * from information_schema.column_privileges;
|
||||||
|
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
|
||||||
|
'user1'@'localhost' NULL mysqltest t1 f1 SELECT NO
|
||||||
|
select * from information_schema.table_privileges;
|
||||||
|
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
|
||||||
|
select * from information_schema.schema_privileges;
|
||||||
|
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
|
||||||
|
select * from information_schema.user_privileges;
|
||||||
|
GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
|
||||||
|
'user1'@'localhost' NULL USAGE NO
|
||||||
|
show grants;
|
||||||
|
Grants for user1@localhost
|
||||||
|
GRANT USAGE ON *.* TO 'user1'@'localhost'
|
||||||
|
GRANT SELECT (f1) ON `mysqltest`.`t1` TO 'user1'@'localhost'
|
||||||
|
select * from information_schema.column_privileges;
|
||||||
|
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
|
||||||
|
select * from information_schema.table_privileges;
|
||||||
|
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
|
||||||
|
'user2'@'localhost' NULL mysqltest t2 SELECT NO
|
||||||
|
select * from information_schema.schema_privileges;
|
||||||
|
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
|
||||||
|
select * from information_schema.user_privileges;
|
||||||
|
GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
|
||||||
|
'user2'@'localhost' NULL USAGE NO
|
||||||
|
show grants;
|
||||||
|
Grants for user2@localhost
|
||||||
|
GRANT USAGE ON *.* TO 'user2'@'localhost'
|
||||||
|
GRANT SELECT ON `mysqltest`.`t2` TO 'user2'@'localhost'
|
||||||
|
select * from information_schema.column_privileges;
|
||||||
|
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
|
||||||
|
select * from information_schema.table_privileges;
|
||||||
|
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
|
||||||
|
select * from information_schema.schema_privileges;
|
||||||
|
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
|
||||||
|
'user3'@'localhost' NULL mysqltest SELECT NO
|
||||||
|
select * from information_schema.user_privileges;
|
||||||
|
GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
|
||||||
|
'user3'@'localhost' NULL USAGE NO
|
||||||
|
show grants;
|
||||||
|
Grants for user3@localhost
|
||||||
|
GRANT USAGE ON *.* TO 'user3'@'localhost'
|
||||||
|
GRANT SELECT ON `mysqltest`.* TO 'user3'@'localhost'
|
||||||
|
select * from information_schema.column_privileges where grantee like '%user%';
|
||||||
|
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
|
||||||
|
'user1'@'localhost' NULL mysqltest t1 f1 SELECT NO
|
||||||
|
select * from information_schema.table_privileges where grantee like '%user%';
|
||||||
|
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
|
||||||
|
'user2'@'localhost' NULL mysqltest t2 SELECT NO
|
||||||
|
select * from information_schema.schema_privileges where grantee like '%user%';
|
||||||
|
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
|
||||||
|
'user3'@'localhost' NULL mysqltest SELECT NO
|
||||||
|
select * from information_schema.user_privileges where grantee like '%user%';
|
||||||
|
GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
|
||||||
|
'user1'@'localhost' NULL USAGE NO
|
||||||
|
'user2'@'localhost' NULL USAGE NO
|
||||||
|
'user3'@'localhost' NULL USAGE NO
|
||||||
|
'user4'@'localhost' NULL SELECT NO
|
||||||
|
show grants;
|
||||||
|
Grants for user4@localhost
|
||||||
|
GRANT SELECT ON *.* TO 'user4'@'localhost'
|
||||||
|
drop user user1@localhost, user2@localhost, user3@localhost, user4@localhost;
|
||||||
|
use test;
|
||||||
|
drop database mysqltest;
|
||||||
|
@ -931,7 +931,6 @@ a
|
|||||||
1
|
1
|
||||||
2
|
2
|
||||||
truncate table t1;
|
truncate table t1;
|
||||||
truncate table t1;
|
|
||||||
insert into t1 values(1),(2);
|
insert into t1 values(1),(2);
|
||||||
delete from t1;
|
delete from t1;
|
||||||
select * from t1;
|
select * from t1;
|
||||||
@ -1451,16 +1450,22 @@ test.t3 NULL
|
|||||||
test.t4 NULL
|
test.t4 NULL
|
||||||
Warnings:
|
Warnings:
|
||||||
Error 1146 Table 'test.t4' doesn't exist
|
Error 1146 Table 'test.t4' doesn't exist
|
||||||
checksum table t1, t2, t3;
|
checksum table t1, t2, t3, t4;
|
||||||
Table Checksum
|
Table Checksum
|
||||||
test.t1 2948697075
|
test.t1 2948697075
|
||||||
test.t2 1157260244
|
test.t2 1157260244
|
||||||
test.t3 1157260244
|
test.t3 1157260244
|
||||||
checksum table t1, t2, t3 extended;
|
test.t4 NULL
|
||||||
|
Warnings:
|
||||||
|
Error 1146 Table 'test.t4' doesn't exist
|
||||||
|
checksum table t1, t2, t3, t4 extended;
|
||||||
Table Checksum
|
Table Checksum
|
||||||
test.t1 3092701434
|
test.t1 3092701434
|
||||||
test.t2 1157260244
|
test.t2 1157260244
|
||||||
test.t3 1157260244
|
test.t3 1157260244
|
||||||
|
test.t4 NULL
|
||||||
|
Warnings:
|
||||||
|
Error 1146 Table 'test.t4' doesn't exist
|
||||||
drop table t1,t2,t3;
|
drop table t1,t2,t3;
|
||||||
create table t1 (id int, name char(10) not null, name2 char(10) not null) engine=innodb;
|
create table t1 (id int, name char(10) not null, name2 char(10) not null) engine=innodb;
|
||||||
insert into t1 values(1,'first','fff'),(2,'second','sss'),(3,'third','ttt');
|
insert into t1 values(1,'first','fff'),(2,'second','sss'),(3,'third','ttt');
|
||||||
@ -1633,14 +1638,14 @@ t2 CREATE TABLE `t2` (
|
|||||||
drop table t2, t1;
|
drop table t2, t1;
|
||||||
show status like "binlog_cache_use";
|
show status like "binlog_cache_use";
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
Binlog_cache_use 154
|
Binlog_cache_use 153
|
||||||
show status like "binlog_cache_disk_use";
|
show status like "binlog_cache_disk_use";
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
Binlog_cache_disk_use 0
|
Binlog_cache_disk_use 0
|
||||||
create table t1 (a int) engine=innodb;
|
create table t1 (a int) engine=innodb;
|
||||||
show status like "binlog_cache_use";
|
show status like "binlog_cache_use";
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
Binlog_cache_use 155
|
Binlog_cache_use 154
|
||||||
show status like "binlog_cache_disk_use";
|
show status like "binlog_cache_disk_use";
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
Binlog_cache_disk_use 1
|
Binlog_cache_disk_use 1
|
||||||
@ -1649,11 +1654,51 @@ delete from t1;
|
|||||||
commit;
|
commit;
|
||||||
show status like "binlog_cache_use";
|
show status like "binlog_cache_use";
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
Binlog_cache_use 156
|
Binlog_cache_use 155
|
||||||
show status like "binlog_cache_disk_use";
|
show status like "binlog_cache_disk_use";
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
Binlog_cache_disk_use 1
|
Binlog_cache_disk_use 1
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
create table t1 (c char(10), index (c,c)) engine=innodb;
|
||||||
|
ERROR 42S21: Duplicate column name 'c'
|
||||||
|
create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=innodb;
|
||||||
|
ERROR 42S21: Duplicate column name 'c1'
|
||||||
|
create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2)) engine=innodb;
|
||||||
|
ERROR 42S21: Duplicate column name 'c1'
|
||||||
|
create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1)) engine=innodb;
|
||||||
|
ERROR 42S21: Duplicate column name 'c1'
|
||||||
|
create table t1 (c1 char(10), c2 char(10)) engine=innodb;
|
||||||
|
alter table t1 add key (c1,c1);
|
||||||
|
ERROR 42S21: Duplicate column name 'c1'
|
||||||
|
alter table t1 add key (c2,c1,c1);
|
||||||
|
ERROR 42S21: Duplicate column name 'c1'
|
||||||
|
alter table t1 add key (c1,c2,c1);
|
||||||
|
ERROR 42S21: Duplicate column name 'c1'
|
||||||
|
alter table t1 add key (c1,c1,c2);
|
||||||
|
ERROR 42S21: Duplicate column name 'c1'
|
||||||
|
drop table t1;
|
||||||
|
create table t1(a int(1) , b int(1)) engine=innodb;
|
||||||
|
insert into t1 values ('1111', '3333');
|
||||||
|
select distinct concat(a, b) from t1;
|
||||||
|
concat(a, b)
|
||||||
|
11113333
|
||||||
|
drop table t1;
|
||||||
|
CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB;
|
||||||
|
SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE);
|
||||||
|
ERROR HY000: The used table type doesn't support FULLTEXT indexes
|
||||||
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1 (a_id tinyint(4) NOT NULL default '0', PRIMARY KEY (a_id)) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||||
|
INSERT INTO t1 VALUES (1),(2),(3);
|
||||||
|
CREATE TABLE t2 (b_id tinyint(4) NOT NULL default '0',b_a tinyint(4) NOT NULL default '0', PRIMARY KEY (b_id), KEY (b_a),
|
||||||
|
CONSTRAINT fk_b_a FOREIGN KEY (b_a) REFERENCES t1 (a_id) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||||
|
INSERT INTO t2 VALUES (1,1),(2,1),(3,1),(4,2),(5,2);
|
||||||
|
SELECT * FROM (SELECT t1.*,GROUP_CONCAT(t2.b_id SEPARATOR ',') as b_list FROM (t1 LEFT JOIN (t2) on t1.a_id = t2.b_a) GROUP BY t1.a_id ) AS xyz;
|
||||||
|
a_id b_list
|
||||||
|
1 1,2,3
|
||||||
|
2 4,5
|
||||||
|
3 NULL
|
||||||
|
DROP TABLE t2;
|
||||||
|
DROP TABLE t1;
|
||||||
create table t1 (x bigint unsigned not null primary key) engine=innodb;
|
create table t1 (x bigint unsigned not null primary key) engine=innodb;
|
||||||
insert into t1(x) values (0xfffffffffffffff0),(0xfffffffffffffff1);
|
insert into t1(x) values (0xfffffffffffffff0),(0xfffffffffffffff1);
|
||||||
select * from t1;
|
select * from t1;
|
||||||
@ -1688,24 +1733,6 @@ select count(*) from t1 where x = 18446744073709551601;
|
|||||||
count(*)
|
count(*)
|
||||||
1
|
1
|
||||||
drop table t1;
|
drop table t1;
|
||||||
create table t1 (c char(10), index (c,c)) engine=innodb;
|
|
||||||
ERROR 42S21: Duplicate column name 'c'
|
|
||||||
create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=innodb;
|
|
||||||
ERROR 42S21: Duplicate column name 'c1'
|
|
||||||
create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2)) engine=innodb;
|
|
||||||
ERROR 42S21: Duplicate column name 'c1'
|
|
||||||
create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1)) engine=innodb;
|
|
||||||
ERROR 42S21: Duplicate column name 'c1'
|
|
||||||
create table t1 (c1 char(10), c2 char(10)) engine=innodb;
|
|
||||||
alter table t1 add key (c1,c1);
|
|
||||||
ERROR 42S21: Duplicate column name 'c1'
|
|
||||||
alter table t1 add key (c2,c1,c1);
|
|
||||||
ERROR 42S21: Duplicate column name 'c1'
|
|
||||||
alter table t1 add key (c1,c2,c1);
|
|
||||||
ERROR 42S21: Duplicate column name 'c1'
|
|
||||||
alter table t1 add key (c1,c1,c2);
|
|
||||||
ERROR 42S21: Duplicate column name 'c1'
|
|
||||||
drop table t1;
|
|
||||||
show status like "Innodb_buffer_pool_pages_total";
|
show status like "Innodb_buffer_pool_pages_total";
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
Innodb_buffer_pool_pages_total 512
|
Innodb_buffer_pool_pages_total 512
|
||||||
@ -1717,7 +1744,7 @@ Variable_name Value
|
|||||||
Innodb_rows_deleted 2070
|
Innodb_rows_deleted 2070
|
||||||
show status like "Innodb_rows_inserted";
|
show status like "Innodb_rows_inserted";
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
Innodb_rows_inserted 31709
|
Innodb_rows_inserted 31718
|
||||||
show status like "Innodb_rows_updated";
|
show status like "Innodb_rows_updated";
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
Innodb_rows_updated 29530
|
Innodb_rows_updated 29530
|
||||||
@ -2391,13 +2418,51 @@ drop table t1;
|
|||||||
set storage_engine=MyISAM;
|
set storage_engine=MyISAM;
|
||||||
create table t1 (v varchar(16384)) engine=innodb;
|
create table t1 (v varchar(16384)) engine=innodb;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
create table t1(a int(1) , b int(1)) engine=innodb;
|
create table t1 (a char(1), b char(1), key(a, b)) engine=innodb;
|
||||||
insert into t1 values ('1111', '3333');
|
insert into t1 values ('8', '6'), ('4', '7');
|
||||||
select distinct concat(a, b) from t1;
|
select min(a) from t1;
|
||||||
concat(a, b)
|
min(a)
|
||||||
11113333
|
4
|
||||||
|
select min(b) from t1 where a='8';
|
||||||
|
min(b)
|
||||||
|
6
|
||||||
|
drop table t1;
|
||||||
|
CREATE TABLE t1 ( `a` int(11) NOT NULL auto_increment, `b` int(11) default NULL,PRIMARY KEY (`a`),UNIQUE KEY `b` (`b`)) ENGINE=innodb;
|
||||||
|
insert into t1 (b) values (1);
|
||||||
|
replace into t1 (b) values (2), (1), (3);
|
||||||
|
select * from t1;
|
||||||
|
a b
|
||||||
|
3 1
|
||||||
|
2 2
|
||||||
|
4 3
|
||||||
|
truncate table t1;
|
||||||
|
insert into t1 (b) values (1);
|
||||||
|
replace into t1 (b) values (2);
|
||||||
|
replace into t1 (b) values (1);
|
||||||
|
replace into t1 (b) values (3);
|
||||||
|
select * from t1;
|
||||||
|
a b
|
||||||
|
3 1
|
||||||
|
2 2
|
||||||
|
4 3
|
||||||
|
drop table t1;
|
||||||
|
create table t1 (rowid int not null auto_increment, val int not null,primary
|
||||||
|
key (rowid), unique(val)) engine=innodb;
|
||||||
|
replace into t1 (val) values ('1'),('2');
|
||||||
|
replace into t1 (val) values ('1'),('2');
|
||||||
|
insert into t1 (val) values ('1'),('2');
|
||||||
|
ERROR 23000: Duplicate entry '1' for key 2
|
||||||
|
select * from t1;
|
||||||
|
rowid val
|
||||||
|
3 1
|
||||||
|
4 2
|
||||||
|
drop table t1;
|
||||||
|
create table t1 (a int not null auto_increment primary key, val int) engine=InnoDB;
|
||||||
|
insert into t1 (val) values (1);
|
||||||
|
update t1 set a=2 where a=1;
|
||||||
|
insert into t1 (val) values (1);
|
||||||
|
ERROR 23000: Duplicate entry '2' for key 1
|
||||||
|
select * from t1;
|
||||||
|
a val
|
||||||
|
2 1
|
||||||
drop table t1;
|
drop table t1;
|
||||||
CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB;
|
|
||||||
SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE);
|
|
||||||
ERROR HY000: The used table type doesn't support FULLTEXT indexes
|
|
||||||
DROP TABLE t1;
|
|
||||||
|
@ -132,6 +132,22 @@ a b
|
|||||||
handler t2 read last;
|
handler t2 read last;
|
||||||
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
|
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
|
||||||
handler t2 close;
|
handler t2 close;
|
||||||
|
handler t1 open;
|
||||||
|
handler t1 read a next;
|
||||||
|
a b
|
||||||
|
14 aaa
|
||||||
|
handler t1 read a next;
|
||||||
|
a b
|
||||||
|
15 bbb
|
||||||
|
handler t1 close;
|
||||||
|
handler t1 open;
|
||||||
|
handler t1 read a prev;
|
||||||
|
a b
|
||||||
|
22 iii
|
||||||
|
handler t1 read a prev;
|
||||||
|
a b
|
||||||
|
21 hhh
|
||||||
|
handler t1 close;
|
||||||
handler t1 open as t2;
|
handler t1 open as t2;
|
||||||
handler t2 read first;
|
handler t2 read first;
|
||||||
a b
|
a b
|
||||||
|
@ -329,3 +329,28 @@ ERROR 42S21: Duplicate column name 'c1'
|
|||||||
alter table t1 add key (c1,c1,c2);
|
alter table t1 add key (c1,c1,c2);
|
||||||
ERROR 42S21: Duplicate column name 'c1'
|
ERROR 42S21: Duplicate column name 'c1'
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
create table t1 (a varchar(10), b varchar(10), key(a(10),b(10)));
|
||||||
|
show create table t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`a` varchar(10) default NULL,
|
||||||
|
`b` varchar(10) default NULL,
|
||||||
|
KEY `a` (`a`,`b`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
alter table t1 modify b varchar(20);
|
||||||
|
show create table t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`a` varchar(10) default NULL,
|
||||||
|
`b` varchar(20) default NULL,
|
||||||
|
KEY `a` (`a`,`b`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
alter table t1 modify a varchar(20);
|
||||||
|
show create table t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`a` varchar(20) default NULL,
|
||||||
|
`b` varchar(20) default NULL,
|
||||||
|
KEY `a` (`a`,`b`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
drop table t1;
|
||||||
|
@ -148,3 +148,17 @@ a'b a"b
|
|||||||
select 'aaa\\','aa''a',"aa""a";
|
select 'aaa\\','aa''a',"aa""a";
|
||||||
aaa\ aa'a aa"a
|
aaa\ aa'a aa"a
|
||||||
aaa\ aa'a aa"a
|
aaa\ aa'a aa"a
|
||||||
|
SET @message = 'Here comes a message';
|
||||||
|
|
||||||
|
Here comes a message
|
||||||
|
--------------------
|
||||||
|
SET @message = USER();
|
||||||
|
|
||||||
|
root@localhost
|
||||||
|
--------------
|
||||||
|
SET @message = 'Here comes a very very long message that is longer then 80 characters
|
||||||
|
on multiple lines';
|
||||||
|
|
||||||
|
Here comes a very very long message that is longer then 80 characters
|
||||||
|
on multiple lines
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
@ -88,7 +88,7 @@ TV NULL NULL 600
|
|||||||
NULL NULL NULL 7785
|
NULL NULL NULL 7785
|
||||||
explain extended select product, country_id , year, sum(profit) from t1 group by product, country_id, year with rollup;
|
explain extended select product, country_id , year, sum(profit) from t1 group by product, country_id, year with rollup;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 15 Using temporary; Using filesort
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 15 Using filesort
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`product` AS `product`,`test`.`t1`.`country_id` AS `country_id`,`test`.`t1`.`year` AS `year`,sum(`test`.`t1`.`profit`) AS `sum(profit)` from `test`.`t1` group by `test`.`t1`.`product`,`test`.`t1`.`country_id`,`test`.`t1`.`year` with rollup
|
Note 1003 select `test`.`t1`.`product` AS `product`,`test`.`t1`.`country_id` AS `country_id`,`test`.`t1`.`year` AS `year`,sum(`test`.`t1`.`profit`) AS `sum(profit)` from `test`.`t1` group by `test`.`t1`.`product`,`test`.`t1`.`country_id`,`test`.`t1`.`year` with rollup
|
||||||
select product, country_id , sum(profit) from t1 group by product desc, country_id with rollup;
|
select product, country_id , sum(profit) from t1 group by product desc, country_id with rollup;
|
||||||
|
@ -634,3 +634,44 @@ id
|
|||||||
3
|
3
|
||||||
deallocate prepare stmt;
|
deallocate prepare stmt;
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
|
create table t1 (a int);
|
||||||
|
insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
|
||||||
|
prepare stmt from "select * from t1 limit ?, ?";
|
||||||
|
set @offset=0, @limit=1;
|
||||||
|
execute stmt using @offset, @limit;
|
||||||
|
a
|
||||||
|
1
|
||||||
|
select * from t1 limit 0, 1;
|
||||||
|
a
|
||||||
|
1
|
||||||
|
set @offset=3, @limit=2;
|
||||||
|
execute stmt using @offset, @limit;
|
||||||
|
a
|
||||||
|
4
|
||||||
|
5
|
||||||
|
select * from t1 limit 3, 2;
|
||||||
|
a
|
||||||
|
4
|
||||||
|
5
|
||||||
|
prepare stmt from "select * from t1 limit ?";
|
||||||
|
execute stmt using @limit;
|
||||||
|
a
|
||||||
|
1
|
||||||
|
2
|
||||||
|
prepare stmt from "select * from t1 where a in (select a from t1 limit ?)";
|
||||||
|
ERROR 42000: This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
|
||||||
|
prepare stmt from "select * from t1 union all select * from t1 limit ?, ?";
|
||||||
|
set @offset=9;
|
||||||
|
set @limit=2;
|
||||||
|
execute stmt using @offset, @limit;
|
||||||
|
a
|
||||||
|
10
|
||||||
|
1
|
||||||
|
prepare stmt from "(select * from t1 limit ?, ?) union all
|
||||||
|
(select * from t1 limit ?, ?) order by a limit ?";
|
||||||
|
execute stmt using @offset, @limit, @offset, @limit, @limit;
|
||||||
|
a
|
||||||
|
10
|
||||||
|
10
|
||||||
|
drop table t1;
|
||||||
|
deallocate prepare stmt;
|
||||||
|
@ -471,13 +471,13 @@ execute stmt1;
|
|||||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||||
def id 8 3 1 N 32929 0 63
|
def id 8 3 1 N 32929 0 63
|
||||||
def select_type 253 19 6 N 1 31 8
|
def select_type 253 19 6 N 1 31 8
|
||||||
def table 253 64 2 N 1 31 8
|
def table 253 64 2 Y 0 31 8
|
||||||
def type 253 10 3 N 1 31 8
|
def type 253 10 3 Y 0 31 8
|
||||||
def possible_keys 253 4096 0 Y 0 31 8
|
def possible_keys 253 4096 0 Y 0 31 8
|
||||||
def key 253 64 0 Y 0 31 8
|
def key 253 64 0 Y 0 31 8
|
||||||
def key_len 253 4096 0 Y 128 31 63
|
def key_len 253 4096 0 Y 128 31 63
|
||||||
def ref 253 1024 0 Y 0 31 8
|
def ref 253 1024 0 Y 0 31 8
|
||||||
def rows 8 10 1 N 32929 0 63
|
def rows 8 10 1 Y 32928 0 63
|
||||||
def Extra 253 255 14 N 1 31 8
|
def Extra 253 255 14 N 1 31 8
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using filesort
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using filesort
|
||||||
@ -487,13 +487,13 @@ execute stmt1 using @arg00;
|
|||||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||||
def id 8 3 1 N 32929 0 63
|
def id 8 3 1 N 32929 0 63
|
||||||
def select_type 253 19 6 N 1 31 8
|
def select_type 253 19 6 N 1 31 8
|
||||||
def table 253 64 2 N 1 31 8
|
def table 253 64 2 Y 0 31 8
|
||||||
def type 253 10 5 N 1 31 8
|
def type 253 10 5 Y 0 31 8
|
||||||
def possible_keys 253 4096 7 Y 0 31 8
|
def possible_keys 253 4096 7 Y 0 31 8
|
||||||
def key 253 64 7 Y 0 31 8
|
def key 253 64 7 Y 0 31 8
|
||||||
def key_len 253 4096 1 Y 128 31 63
|
def key_len 253 4096 1 Y 128 31 63
|
||||||
def ref 253 1024 0 Y 0 31 8
|
def ref 253 1024 0 Y 0 31 8
|
||||||
def rows 8 10 1 N 32929 0 63
|
def rows 8 10 1 Y 32928 0 63
|
||||||
def Extra 253 255 27 N 1 31 8
|
def Extra 253 255 27 N 1 31 8
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using where; Using filesort
|
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using where; Using filesort
|
||||||
|
@ -444,9 +444,10 @@ limit 1 ';
|
|||||||
execute stmt1 ;
|
execute stmt1 ;
|
||||||
a b
|
a b
|
||||||
1 one
|
1 one
|
||||||
prepare stmt1 from ' select a,b from t1
|
prepare stmt1 from ' select a,b from t1 limit ? ';
|
||||||
limit ? ';
|
execute stmt1 using @arg00;
|
||||||
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 2
|
a b
|
||||||
|
1 one
|
||||||
set @arg00='b' ;
|
set @arg00='b' ;
|
||||||
set @arg01=0 ;
|
set @arg01=0 ;
|
||||||
set @arg02=2 ;
|
set @arg02=2 ;
|
||||||
@ -1151,13 +1152,13 @@ execute stmt1;
|
|||||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||||
def id 8 3 1 N 32929 0 63
|
def id 8 3 1 N 32929 0 63
|
||||||
def select_type 253 19 6 N 1 31 8
|
def select_type 253 19 6 N 1 31 8
|
||||||
def table 253 64 2 N 1 31 8
|
def table 253 64 2 Y 0 31 8
|
||||||
def type 253 10 3 N 1 31 8
|
def type 253 10 3 Y 0 31 8
|
||||||
def possible_keys 253 4096 0 Y 0 31 8
|
def possible_keys 253 4096 0 Y 0 31 8
|
||||||
def key 253 64 0 Y 0 31 8
|
def key 253 64 0 Y 0 31 8
|
||||||
def key_len 253 4096 0 Y 128 31 63
|
def key_len 253 4096 0 Y 128 31 63
|
||||||
def ref 253 1024 0 Y 0 31 8
|
def ref 253 1024 0 Y 0 31 8
|
||||||
def rows 8 10 1 N 32929 0 63
|
def rows 8 10 1 Y 32928 0 63
|
||||||
def Extra 253 255 0 N 1 31 8
|
def Extra 253 255 0 N 1 31 8
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t9 ALL NULL NULL NULL NULL 2
|
1 SIMPLE t9 ALL NULL NULL NULL NULL 2
|
||||||
@ -1381,10 +1382,8 @@ execute stmt1 ;
|
|||||||
select a,b from t1 where b = 'bla' ;
|
select a,b from t1 where b = 'bla' ;
|
||||||
a b
|
a b
|
||||||
2 bla
|
2 bla
|
||||||
prepare stmt1 from 'update t1 set b=''bla''
|
prepare stmt1 from 'update t1 set b=''bla'' where a=2 limit ?';
|
||||||
where a=2
|
execute stmt1 using @arg00;
|
||||||
limit ?';
|
|
||||||
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 3
|
|
||||||
test_sequence
|
test_sequence
|
||||||
------ insert tests ------
|
------ insert tests ------
|
||||||
delete from t1 ;
|
delete from t1 ;
|
||||||
|
@ -444,9 +444,10 @@ limit 1 ';
|
|||||||
execute stmt1 ;
|
execute stmt1 ;
|
||||||
a b
|
a b
|
||||||
1 one
|
1 one
|
||||||
prepare stmt1 from ' select a,b from t1
|
prepare stmt1 from ' select a,b from t1 limit ? ';
|
||||||
limit ? ';
|
execute stmt1 using @arg00;
|
||||||
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 2
|
a b
|
||||||
|
1 one
|
||||||
set @arg00='b' ;
|
set @arg00='b' ;
|
||||||
set @arg01=0 ;
|
set @arg01=0 ;
|
||||||
set @arg02=2 ;
|
set @arg02=2 ;
|
||||||
@ -1151,13 +1152,13 @@ execute stmt1;
|
|||||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||||
def id 8 3 1 N 32929 0 63
|
def id 8 3 1 N 32929 0 63
|
||||||
def select_type 253 19 6 N 1 31 8
|
def select_type 253 19 6 N 1 31 8
|
||||||
def table 253 64 2 N 1 31 8
|
def table 253 64 2 Y 0 31 8
|
||||||
def type 253 10 3 N 1 31 8
|
def type 253 10 3 Y 0 31 8
|
||||||
def possible_keys 253 4096 0 Y 0 31 8
|
def possible_keys 253 4096 0 Y 0 31 8
|
||||||
def key 253 64 0 Y 0 31 8
|
def key 253 64 0 Y 0 31 8
|
||||||
def key_len 253 4096 0 Y 128 31 63
|
def key_len 253 4096 0 Y 128 31 63
|
||||||
def ref 253 1024 0 Y 0 31 8
|
def ref 253 1024 0 Y 0 31 8
|
||||||
def rows 8 10 1 N 32929 0 63
|
def rows 8 10 1 Y 32928 0 63
|
||||||
def Extra 253 255 0 N 1 31 8
|
def Extra 253 255 0 N 1 31 8
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t9 ALL NULL NULL NULL NULL 2
|
1 SIMPLE t9 ALL NULL NULL NULL NULL 2
|
||||||
@ -1364,10 +1365,8 @@ execute stmt1 ;
|
|||||||
select a,b from t1 where b = 'bla' ;
|
select a,b from t1 where b = 'bla' ;
|
||||||
a b
|
a b
|
||||||
2 bla
|
2 bla
|
||||||
prepare stmt1 from 'update t1 set b=''bla''
|
prepare stmt1 from 'update t1 set b=''bla'' where a=2 limit ?';
|
||||||
where a=2
|
execute stmt1 using @arg00;
|
||||||
limit ?';
|
|
||||||
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 3
|
|
||||||
test_sequence
|
test_sequence
|
||||||
------ insert tests ------
|
------ insert tests ------
|
||||||
delete from t1 ;
|
delete from t1 ;
|
||||||
|
@ -445,9 +445,10 @@ limit 1 ';
|
|||||||
execute stmt1 ;
|
execute stmt1 ;
|
||||||
a b
|
a b
|
||||||
1 one
|
1 one
|
||||||
prepare stmt1 from ' select a,b from t1
|
prepare stmt1 from ' select a,b from t1 limit ? ';
|
||||||
limit ? ';
|
execute stmt1 using @arg00;
|
||||||
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 2
|
a b
|
||||||
|
1 one
|
||||||
set @arg00='b' ;
|
set @arg00='b' ;
|
||||||
set @arg01=0 ;
|
set @arg01=0 ;
|
||||||
set @arg02=2 ;
|
set @arg02=2 ;
|
||||||
@ -1152,13 +1153,13 @@ execute stmt1;
|
|||||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||||
def id 8 3 1 N 32929 0 63
|
def id 8 3 1 N 32929 0 63
|
||||||
def select_type 253 19 6 N 1 31 8
|
def select_type 253 19 6 N 1 31 8
|
||||||
def table 253 64 2 N 1 31 8
|
def table 253 64 2 Y 0 31 8
|
||||||
def type 253 10 3 N 1 31 8
|
def type 253 10 3 Y 0 31 8
|
||||||
def possible_keys 253 4096 0 Y 0 31 8
|
def possible_keys 253 4096 0 Y 0 31 8
|
||||||
def key 253 64 0 Y 0 31 8
|
def key 253 64 0 Y 0 31 8
|
||||||
def key_len 253 4096 0 Y 128 31 63
|
def key_len 253 4096 0 Y 128 31 63
|
||||||
def ref 253 1024 0 Y 0 31 8
|
def ref 253 1024 0 Y 0 31 8
|
||||||
def rows 8 10 1 N 32929 0 63
|
def rows 8 10 1 Y 32928 0 63
|
||||||
def Extra 253 255 0 N 1 31 8
|
def Extra 253 255 0 N 1 31 8
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t9 ALL NULL NULL NULL NULL 2
|
1 SIMPLE t9 ALL NULL NULL NULL NULL 2
|
||||||
@ -1365,10 +1366,8 @@ execute stmt1 ;
|
|||||||
select a,b from t1 where b = 'bla' ;
|
select a,b from t1 where b = 'bla' ;
|
||||||
a b
|
a b
|
||||||
2 bla
|
2 bla
|
||||||
prepare stmt1 from 'update t1 set b=''bla''
|
prepare stmt1 from 'update t1 set b=''bla'' where a=2 limit ?';
|
||||||
where a=2
|
execute stmt1 using @arg00;
|
||||||
limit ?';
|
|
||||||
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 3
|
|
||||||
test_sequence
|
test_sequence
|
||||||
------ insert tests ------
|
------ insert tests ------
|
||||||
delete from t1 ;
|
delete from t1 ;
|
||||||
|
@ -487,9 +487,10 @@ limit 1 ';
|
|||||||
execute stmt1 ;
|
execute stmt1 ;
|
||||||
a b
|
a b
|
||||||
1 one
|
1 one
|
||||||
prepare stmt1 from ' select a,b from t1
|
prepare stmt1 from ' select a,b from t1 limit ? ';
|
||||||
limit ? ';
|
execute stmt1 using @arg00;
|
||||||
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 2
|
a b
|
||||||
|
1 one
|
||||||
set @arg00='b' ;
|
set @arg00='b' ;
|
||||||
set @arg01=0 ;
|
set @arg01=0 ;
|
||||||
set @arg02=2 ;
|
set @arg02=2 ;
|
||||||
@ -1194,13 +1195,13 @@ execute stmt1;
|
|||||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||||
def id 8 3 1 N 32929 0 63
|
def id 8 3 1 N 32929 0 63
|
||||||
def select_type 253 19 6 N 1 31 8
|
def select_type 253 19 6 N 1 31 8
|
||||||
def table 253 64 2 N 1 31 8
|
def table 253 64 2 Y 0 31 8
|
||||||
def type 253 10 3 N 1 31 8
|
def type 253 10 3 Y 0 31 8
|
||||||
def possible_keys 253 4096 0 Y 0 31 8
|
def possible_keys 253 4096 0 Y 0 31 8
|
||||||
def key 253 64 0 Y 0 31 8
|
def key 253 64 0 Y 0 31 8
|
||||||
def key_len 253 4096 0 Y 128 31 63
|
def key_len 253 4096 0 Y 128 31 63
|
||||||
def ref 253 1024 0 Y 0 31 8
|
def ref 253 1024 0 Y 0 31 8
|
||||||
def rows 8 10 1 N 32929 0 63
|
def rows 8 10 1 Y 32928 0 63
|
||||||
def Extra 253 255 0 N 1 31 8
|
def Extra 253 255 0 N 1 31 8
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t9 ALL NULL NULL NULL NULL 2
|
1 SIMPLE t9 ALL NULL NULL NULL NULL 2
|
||||||
@ -1407,10 +1408,8 @@ execute stmt1 ;
|
|||||||
select a,b from t1 where b = 'bla' ;
|
select a,b from t1 where b = 'bla' ;
|
||||||
a b
|
a b
|
||||||
2 bla
|
2 bla
|
||||||
prepare stmt1 from 'update t1 set b=''bla''
|
prepare stmt1 from 'update t1 set b=''bla'' where a=2 limit ?';
|
||||||
where a=2
|
execute stmt1 using @arg00;
|
||||||
limit ?';
|
|
||||||
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 3
|
|
||||||
test_sequence
|
test_sequence
|
||||||
------ insert tests ------
|
------ insert tests ------
|
||||||
delete from t1 ;
|
delete from t1 ;
|
||||||
@ -3500,9 +3499,10 @@ limit 1 ';
|
|||||||
execute stmt1 ;
|
execute stmt1 ;
|
||||||
a b
|
a b
|
||||||
1 one
|
1 one
|
||||||
prepare stmt1 from ' select a,b from t1
|
prepare stmt1 from ' select a,b from t1 limit ? ';
|
||||||
limit ? ';
|
execute stmt1 using @arg00;
|
||||||
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 2
|
a b
|
||||||
|
1 one
|
||||||
set @arg00='b' ;
|
set @arg00='b' ;
|
||||||
set @arg01=0 ;
|
set @arg01=0 ;
|
||||||
set @arg02=2 ;
|
set @arg02=2 ;
|
||||||
@ -4207,13 +4207,13 @@ execute stmt1;
|
|||||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||||
def id 8 3 1 N 32929 0 63
|
def id 8 3 1 N 32929 0 63
|
||||||
def select_type 253 19 6 N 1 31 8
|
def select_type 253 19 6 N 1 31 8
|
||||||
def table 253 64 2 N 1 31 8
|
def table 253 64 2 Y 0 31 8
|
||||||
def type 253 10 3 N 1 31 8
|
def type 253 10 3 Y 0 31 8
|
||||||
def possible_keys 253 4096 0 Y 0 31 8
|
def possible_keys 253 4096 0 Y 0 31 8
|
||||||
def key 253 64 0 Y 0 31 8
|
def key 253 64 0 Y 0 31 8
|
||||||
def key_len 253 4096 0 Y 128 31 63
|
def key_len 253 4096 0 Y 128 31 63
|
||||||
def ref 253 1024 0 Y 0 31 8
|
def ref 253 1024 0 Y 0 31 8
|
||||||
def rows 8 10 1 N 32929 0 63
|
def rows 8 10 1 Y 32928 0 63
|
||||||
def Extra 253 255 0 N 1 31 8
|
def Extra 253 255 0 N 1 31 8
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t9 ALL NULL NULL NULL NULL 2
|
1 SIMPLE t9 ALL NULL NULL NULL NULL 2
|
||||||
@ -4420,10 +4420,8 @@ execute stmt1 ;
|
|||||||
select a,b from t1 where b = 'bla' ;
|
select a,b from t1 where b = 'bla' ;
|
||||||
a b
|
a b
|
||||||
2 bla
|
2 bla
|
||||||
prepare stmt1 from 'update t1 set b=''bla''
|
prepare stmt1 from 'update t1 set b=''bla'' where a=2 limit ?';
|
||||||
where a=2
|
execute stmt1 using @arg00;
|
||||||
limit ?';
|
|
||||||
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 3
|
|
||||||
test_sequence
|
test_sequence
|
||||||
------ insert tests ------
|
------ insert tests ------
|
||||||
delete from t1 ;
|
delete from t1 ;
|
||||||
|
@ -444,9 +444,10 @@ limit 1 ';
|
|||||||
execute stmt1 ;
|
execute stmt1 ;
|
||||||
a b
|
a b
|
||||||
1 one
|
1 one
|
||||||
prepare stmt1 from ' select a,b from t1
|
prepare stmt1 from ' select a,b from t1 limit ? ';
|
||||||
limit ? ';
|
execute stmt1 using @arg00;
|
||||||
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 2
|
a b
|
||||||
|
1 one
|
||||||
set @arg00='b' ;
|
set @arg00='b' ;
|
||||||
set @arg01=0 ;
|
set @arg01=0 ;
|
||||||
set @arg02=2 ;
|
set @arg02=2 ;
|
||||||
@ -1151,13 +1152,13 @@ execute stmt1;
|
|||||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||||
def id 8 3 1 N 32929 0 63
|
def id 8 3 1 N 32929 0 63
|
||||||
def select_type 253 19 6 N 1 31 8
|
def select_type 253 19 6 N 1 31 8
|
||||||
def table 253 64 2 N 1 31 8
|
def table 253 64 2 Y 0 31 8
|
||||||
def type 253 10 3 N 1 31 8
|
def type 253 10 3 Y 0 31 8
|
||||||
def possible_keys 253 4096 0 Y 0 31 8
|
def possible_keys 253 4096 0 Y 0 31 8
|
||||||
def key 253 64 0 Y 0 31 8
|
def key 253 64 0 Y 0 31 8
|
||||||
def key_len 253 4096 0 Y 128 31 63
|
def key_len 253 4096 0 Y 128 31 63
|
||||||
def ref 253 1024 0 Y 0 31 8
|
def ref 253 1024 0 Y 0 31 8
|
||||||
def rows 8 10 1 N 32929 0 63
|
def rows 8 10 1 Y 32928 0 63
|
||||||
def Extra 253 255 0 N 1 31 8
|
def Extra 253 255 0 N 1 31 8
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t9 ALL NULL NULL NULL NULL 3
|
1 SIMPLE t9 ALL NULL NULL NULL NULL 3
|
||||||
@ -1364,10 +1365,8 @@ execute stmt1 ;
|
|||||||
select a,b from t1 where b = 'bla' ;
|
select a,b from t1 where b = 'bla' ;
|
||||||
a b
|
a b
|
||||||
2 bla
|
2 bla
|
||||||
prepare stmt1 from 'update t1 set b=''bla''
|
prepare stmt1 from 'update t1 set b=''bla'' where a=2 limit ?';
|
||||||
where a=2
|
execute stmt1 using @arg00;
|
||||||
limit ?';
|
|
||||||
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 3
|
|
||||||
test_sequence
|
test_sequence
|
||||||
------ insert tests ------
|
------ insert tests ------
|
||||||
delete from t1 ;
|
delete from t1 ;
|
||||||
|
@ -444,9 +444,10 @@ limit 1 ';
|
|||||||
execute stmt1 ;
|
execute stmt1 ;
|
||||||
a b
|
a b
|
||||||
1 one
|
1 one
|
||||||
prepare stmt1 from ' select a,b from t1
|
prepare stmt1 from ' select a,b from t1 limit ? ';
|
||||||
limit ? ';
|
execute stmt1 using @arg00;
|
||||||
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 2
|
a b
|
||||||
|
3 three
|
||||||
set @arg00='b' ;
|
set @arg00='b' ;
|
||||||
set @arg01=0 ;
|
set @arg01=0 ;
|
||||||
set @arg02=2 ;
|
set @arg02=2 ;
|
||||||
@ -1151,13 +1152,13 @@ execute stmt1;
|
|||||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||||
def id 8 3 1 N 32929 0 63
|
def id 8 3 1 N 32929 0 63
|
||||||
def select_type 253 19 6 N 1 31 8
|
def select_type 253 19 6 N 1 31 8
|
||||||
def table 253 64 2 N 1 31 8
|
def table 253 64 2 Y 0 31 8
|
||||||
def type 253 10 3 N 1 31 8
|
def type 253 10 3 Y 0 31 8
|
||||||
def possible_keys 253 4096 0 Y 0 31 8
|
def possible_keys 253 4096 0 Y 0 31 8
|
||||||
def key 253 64 0 Y 0 31 8
|
def key 253 64 0 Y 0 31 8
|
||||||
def key_len 253 4096 0 Y 128 31 63
|
def key_len 253 4096 0 Y 128 31 63
|
||||||
def ref 253 1024 0 Y 0 31 8
|
def ref 253 1024 0 Y 0 31 8
|
||||||
def rows 8 10 1 N 32929 0 63
|
def rows 8 10 1 Y 32928 0 63
|
||||||
def Extra 253 255 0 N 1 31 8
|
def Extra 253 255 0 N 1 31 8
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t9 ALL NULL NULL NULL NULL 2
|
1 SIMPLE t9 ALL NULL NULL NULL NULL 2
|
||||||
@ -1364,10 +1365,8 @@ execute stmt1 ;
|
|||||||
select a,b from t1 where b = 'bla' ;
|
select a,b from t1 where b = 'bla' ;
|
||||||
a b
|
a b
|
||||||
2 bla
|
2 bla
|
||||||
prepare stmt1 from 'update t1 set b=''bla''
|
prepare stmt1 from 'update t1 set b=''bla'' where a=2 limit ?';
|
||||||
where a=2
|
execute stmt1 using @arg00;
|
||||||
limit ?';
|
|
||||||
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 3
|
|
||||||
test_sequence
|
test_sequence
|
||||||
------ insert tests ------
|
------ insert tests ------
|
||||||
delete from t1 ;
|
delete from t1 ;
|
||||||
|
@ -2682,3 +2682,20 @@ AND FK_firma_id = 2;
|
|||||||
COUNT(*)
|
COUNT(*)
|
||||||
0
|
0
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
CREATE TABLE t1 (a int);
|
||||||
|
CREATE TABLE t2 (a int);
|
||||||
|
INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
|
||||||
|
INSERT INTO t2 VALUES (2), (4), (6);
|
||||||
|
SELECT t1.a FROM t1 STRAIGHT_JOIN t2 ON t1.a=t2.a;
|
||||||
|
a
|
||||||
|
2
|
||||||
|
4
|
||||||
|
EXPLAIN SELECT t1.a FROM t1 STRAIGHT_JOIN t2 ON t1.a=t2.a;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 5
|
||||||
|
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where
|
||||||
|
EXPLAIN SELECT t1.a FROM t1 INNER JOIN t2 ON t1.a=t2.a;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t2 ALL NULL NULL NULL NULL 3
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where
|
||||||
|
DROP TABLE t1,t2;
|
||||||
|
@ -672,3 +672,17 @@ select default(t30.s1) from t30;
|
|||||||
end|
|
end|
|
||||||
drop procedure bug10969|
|
drop procedure bug10969|
|
||||||
drop table t1|
|
drop table t1|
|
||||||
|
prepare stmt from "select 1";
|
||||||
|
create procedure p() deallocate prepare stmt;
|
||||||
|
ERROR 0A000: DEALLOCATE is not allowed in stored procedures
|
||||||
|
create function f() returns int begin deallocate prepare stmt;
|
||||||
|
ERROR 0A000: DEALLOCATE is not allowed in stored procedures
|
||||||
|
create procedure p() prepare stmt from "select 1";
|
||||||
|
ERROR 0A000: PREPARE is not allowed in stored procedures
|
||||||
|
create function f() returns int begin prepare stmt from "select 1";
|
||||||
|
ERROR 0A000: PREPARE is not allowed in stored procedures
|
||||||
|
create procedure p() execute stmt;
|
||||||
|
ERROR 0A000: EXECUTE is not allowed in stored procedures
|
||||||
|
create function f() returns int begin execute stmt;
|
||||||
|
ERROR 0A000: EXECUTE is not allowed in stored procedures
|
||||||
|
deallocate prepare stmt;
|
||||||
|
@ -40,3 +40,18 @@ Id User Host db Command Time State Info
|
|||||||
unlock tables;
|
unlock tables;
|
||||||
drop procedure bug9486;
|
drop procedure bug9486;
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
|
drop procedure if exists bug11158;
|
||||||
|
create procedure bug11158() delete t1 from t1, t2 where t1.id = t2.id;
|
||||||
|
create table t1 (id int, j int);
|
||||||
|
insert into t1 values (1, 1), (2, 2);
|
||||||
|
create table t2 (id int);
|
||||||
|
insert into t2 values (1);
|
||||||
|
call bug11158();
|
||||||
|
select * from t1;
|
||||||
|
id j
|
||||||
|
2 2
|
||||||
|
lock tables t2 read;
|
||||||
|
call bug11158();
|
||||||
|
unlock tables;
|
||||||
|
drop procedure bug11158;
|
||||||
|
drop table t1, t2;
|
||||||
|
@ -3134,4 +3134,44 @@ x
|
|||||||
x
|
x
|
||||||
3
|
3
|
||||||
drop procedure bug10961|
|
drop procedure bug10961|
|
||||||
|
DROP PROCEDURE IF EXISTS bug6866|
|
||||||
|
DROP VIEW IF EXISTS tv|
|
||||||
|
Warnings:
|
||||||
|
Note 1051 Unknown table 'test.tv'
|
||||||
|
DROP TABLE IF EXISTS tt1,tt2,tt3|
|
||||||
|
Warnings:
|
||||||
|
Note 1051 Unknown table 'tt1'
|
||||||
|
Note 1051 Unknown table 'tt2'
|
||||||
|
Note 1051 Unknown table 'tt3'
|
||||||
|
CREATE TABLE tt1 (a1 int, a2 int, a3 int, data varchar(10))|
|
||||||
|
CREATE TABLE tt2 (a2 int, data2 varchar(10))|
|
||||||
|
CREATE TABLE tt3 (a3 int, data3 varchar(10))|
|
||||||
|
INSERT INTO tt1 VALUES (1, 1, 4, 'xx')|
|
||||||
|
INSERT INTO tt2 VALUES (1, 'a')|
|
||||||
|
INSERT INTO tt2 VALUES (2, 'b')|
|
||||||
|
INSERT INTO tt2 VALUES (3, 'c')|
|
||||||
|
INSERT INTO tt3 VALUES (4, 'd')|
|
||||||
|
INSERT INTO tt3 VALUES (5, 'e')|
|
||||||
|
INSERT INTO tt3 VALUES (6, 'f')|
|
||||||
|
CREATE VIEW tv AS
|
||||||
|
SELECT tt1.*, tt2.data2, tt3.data3
|
||||||
|
FROM tt1 INNER JOIN tt2 ON tt1.a2 = tt2.a2
|
||||||
|
LEFT JOIN tt3 ON tt1.a3 = tt3.a3
|
||||||
|
ORDER BY tt1.a1, tt2.a2, tt3.a3|
|
||||||
|
CREATE PROCEDURE bug6866 (_a1 int)
|
||||||
|
BEGIN
|
||||||
|
SELECT * FROM tv WHERE a1 = _a1;
|
||||||
|
END|
|
||||||
|
CALL bug6866(1)|
|
||||||
|
a1 a2 a3 data data2 data3
|
||||||
|
1 1 4 xx a d
|
||||||
|
CALL bug6866(1)|
|
||||||
|
a1 a2 a3 data data2 data3
|
||||||
|
1 1 4 xx a d
|
||||||
|
CALL bug6866(1)|
|
||||||
|
a1 a2 a3 data data2 data3
|
||||||
|
1 1 4 xx a d
|
||||||
|
DROP PROCEDURE bug6866;
|
||||||
|
DROP VIEW tv|
|
||||||
|
DROP TABLE tt1, tt2, tt3|
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
drop table if exists t1, t2;
|
||||||
drop procedure if exists bug8850|
|
drop procedure if exists bug8850|
|
||||||
create table t1 (a int) engine=innodb|
|
create table t1 (a int) engine=innodb|
|
||||||
create procedure bug8850()
|
create procedure bug8850()
|
||||||
@ -20,3 +21,160 @@ a
|
|||||||
2
|
2
|
||||||
drop table t1|
|
drop table t1|
|
||||||
drop procedure bug8850|
|
drop procedure bug8850|
|
||||||
|
drop function if exists bug10015_1|
|
||||||
|
drop function if exists bug10015_2|
|
||||||
|
drop function if exists bug10015_3|
|
||||||
|
drop function if exists bug10015_4|
|
||||||
|
drop function if exists bug10015_5|
|
||||||
|
drop function if exists bug10015_6|
|
||||||
|
drop function if exists bug10015_7|
|
||||||
|
drop procedure if exists bug10015_8|
|
||||||
|
create table t1 (id int) engine=innodb|
|
||||||
|
create table t2 (id int primary key, j int) engine=innodb|
|
||||||
|
insert into t1 values (1),(2),(3)|
|
||||||
|
create function bug10015_1() returns int return (select count(*) from t1)|
|
||||||
|
select *, bug10015_1() from t1|
|
||||||
|
id bug10015_1()
|
||||||
|
1 3
|
||||||
|
2 3
|
||||||
|
3 3
|
||||||
|
drop function bug10015_1|
|
||||||
|
create function bug10015_2() returns int
|
||||||
|
begin
|
||||||
|
declare i, s int;
|
||||||
|
set i:= (select min(id) from t1);
|
||||||
|
set s:= (select max(id) from t1);
|
||||||
|
return (s - i);
|
||||||
|
end|
|
||||||
|
select *, bug10015_2() from t1|
|
||||||
|
id bug10015_2()
|
||||||
|
1 2
|
||||||
|
2 2
|
||||||
|
3 2
|
||||||
|
drop function bug10015_2|
|
||||||
|
create function bug10015_3() returns int
|
||||||
|
return (select max(a.id - b.id) from t1 as a, t1 as b where a.id >= b.id)|
|
||||||
|
select *, bug10015_3() from t1|
|
||||||
|
id bug10015_3()
|
||||||
|
1 2
|
||||||
|
2 2
|
||||||
|
3 2
|
||||||
|
drop function bug10015_3|
|
||||||
|
create function bug10015_4(i int) returns int
|
||||||
|
begin
|
||||||
|
declare m int;
|
||||||
|
set m:= (select max(id) from t2);
|
||||||
|
insert into t2 values (i, m);
|
||||||
|
return m;
|
||||||
|
end|
|
||||||
|
select *, bug10015_4(id) from t1|
|
||||||
|
id bug10015_4(id)
|
||||||
|
1 NULL
|
||||||
|
2 1
|
||||||
|
3 2
|
||||||
|
select * from t2|
|
||||||
|
id j
|
||||||
|
1 NULL
|
||||||
|
2 1
|
||||||
|
3 2
|
||||||
|
drop function bug10015_4|
|
||||||
|
create function bug10015_5(i int) returns int
|
||||||
|
begin
|
||||||
|
if (i = 5) then
|
||||||
|
insert into t2 values (1, 0);
|
||||||
|
end if;
|
||||||
|
return i;
|
||||||
|
end|
|
||||||
|
insert into t1 values (bug10015_5(4)), (bug10015_5(5))|
|
||||||
|
ERROR 23000: Duplicate entry '1' for key 1
|
||||||
|
select * from t1|
|
||||||
|
id
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
drop function bug10015_5|
|
||||||
|
create function bug10015_6(i int) returns int
|
||||||
|
begin
|
||||||
|
declare continue handler for sqlexception set @error_in_func:= 1;
|
||||||
|
if (i = 5) then
|
||||||
|
insert into t2 values (4, 0), (1, 0);
|
||||||
|
end if;
|
||||||
|
return i;
|
||||||
|
end|
|
||||||
|
set @error_in_func:= 0|
|
||||||
|
insert into t1 values (bug10015_6(5)), (bug10015_6(6))|
|
||||||
|
select @error_in_func|
|
||||||
|
@error_in_func
|
||||||
|
1
|
||||||
|
select * from t1|
|
||||||
|
id
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
5
|
||||||
|
6
|
||||||
|
select * from t2|
|
||||||
|
id j
|
||||||
|
1 NULL
|
||||||
|
2 1
|
||||||
|
3 2
|
||||||
|
4 0
|
||||||
|
drop function bug10015_6|
|
||||||
|
create function bug10015_7() returns int
|
||||||
|
begin
|
||||||
|
alter table t1 add k int;
|
||||||
|
return 1;
|
||||||
|
end|
|
||||||
|
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||||
|
create function bug10015_7() returns int
|
||||||
|
begin
|
||||||
|
start transaction;
|
||||||
|
return 1;
|
||||||
|
end|
|
||||||
|
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||||
|
create function bug10015_7() returns int
|
||||||
|
begin
|
||||||
|
drop table t1;
|
||||||
|
return 1;
|
||||||
|
end|
|
||||||
|
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||||
|
create function bug10015_7() returns int
|
||||||
|
begin
|
||||||
|
drop temporary table t1;
|
||||||
|
return 1;
|
||||||
|
end|
|
||||||
|
drop function bug10015_7|
|
||||||
|
create function bug10015_7() returns int
|
||||||
|
begin
|
||||||
|
commit;
|
||||||
|
return 1;
|
||||||
|
end|
|
||||||
|
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||||
|
create function bug10015_7() returns int
|
||||||
|
begin
|
||||||
|
call bug10015_8();
|
||||||
|
return 1;
|
||||||
|
end|
|
||||||
|
create procedure bug10015_8() alter table t1 add k int|
|
||||||
|
select *, bug10015_7() from t1|
|
||||||
|
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||||
|
drop procedure bug10015_8|
|
||||||
|
create procedure bug10015_8() start transaction|
|
||||||
|
select *, bug10015_7() from t1|
|
||||||
|
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||||
|
drop procedure bug10015_8|
|
||||||
|
create procedure bug10015_8() drop temporary table if exists t1_temp|
|
||||||
|
select *, bug10015_7() from t1|
|
||||||
|
id bug10015_7()
|
||||||
|
1 1
|
||||||
|
2 1
|
||||||
|
3 1
|
||||||
|
5 1
|
||||||
|
6 1
|
||||||
|
drop procedure bug10015_8|
|
||||||
|
create procedure bug10015_8() commit|
|
||||||
|
select *, bug10015_7() from t1|
|
||||||
|
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||||
|
drop procedure bug10015_8|
|
||||||
|
drop function bug10015_7|
|
||||||
|
drop table t1, t2|
|
||||||
|
@ -138,6 +138,8 @@ t1 CREATE TABLE `t1` (
|
|||||||
`min_num` decimal(7,6) default '0.000001'
|
`min_num` decimal(7,6) default '0.000001'
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
drop table t1 ;
|
drop table t1 ;
|
||||||
|
set @@SQL_MODE=NULL;
|
||||||
|
ERROR 42000: Variable 'sql_mode' can't be set to the value of 'NULL'
|
||||||
SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE='';
|
SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE='';
|
||||||
show local variables like 'SQL_MODE';
|
show local variables like 'SQL_MODE';
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
|
@ -458,3 +458,11 @@ select h from t1;
|
|||||||
h
|
h
|
||||||
a
|
a
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
create table t1 (a bit(8)) engine=heap;
|
||||||
|
insert into t1 values ('1111100000');
|
||||||
|
Warnings:
|
||||||
|
Warning 1264 Out of range value adjusted for column 'a' at row 1
|
||||||
|
select a+0 from t1;
|
||||||
|
a+0
|
||||||
|
255
|
||||||
|
drop table t1;
|
||||||
|
@ -414,8 +414,8 @@ Warning 1264 Out of range value adjusted for column 'a' at row 2
|
|||||||
Warning 1264 Out of range value adjusted for column 'a' at row 7
|
Warning 1264 Out of range value adjusted for column 'a' at row 7
|
||||||
select * from t1;
|
select * from t1;
|
||||||
a
|
a
|
||||||
9999999999
|
0
|
||||||
9999999999
|
0
|
||||||
1
|
1
|
||||||
1
|
1
|
||||||
1
|
1
|
||||||
@ -430,8 +430,8 @@ Warning 1264 Out of range value adjusted for column 'a' at row 2
|
|||||||
Warning 1264 Out of range value adjusted for column 'a' at row 7
|
Warning 1264 Out of range value adjusted for column 'a' at row 7
|
||||||
select * from t1;
|
select * from t1;
|
||||||
a
|
a
|
||||||
9999999999
|
0000000000
|
||||||
9999999999
|
0000000000
|
||||||
0000000001
|
0000000001
|
||||||
0000000001
|
0000000001
|
||||||
0000000001
|
0000000001
|
||||||
@ -446,8 +446,8 @@ Warning 1264 Out of range value adjusted for column 'a' at row 2
|
|||||||
Warning 1264 Out of range value adjusted for column 'a' at row 7
|
Warning 1264 Out of range value adjusted for column 'a' at row 7
|
||||||
select * from t1;
|
select * from t1;
|
||||||
a
|
a
|
||||||
9999999999
|
0000000000
|
||||||
9999999999
|
0000000000
|
||||||
0000000001
|
0000000001
|
||||||
0000000001
|
0000000001
|
||||||
0000000001
|
0000000001
|
||||||
|
@ -119,7 +119,7 @@ a
|
|||||||
99.99
|
99.99
|
||||||
99.99
|
99.99
|
||||||
99.99
|
99.99
|
||||||
99.99
|
0.00
|
||||||
0.00
|
0.00
|
||||||
0.00
|
0.00
|
||||||
0.00
|
0.00
|
||||||
@ -891,3 +891,40 @@ NULL
|
|||||||
select abs(NULL);
|
select abs(NULL);
|
||||||
abs(NULL)
|
abs(NULL)
|
||||||
NULL
|
NULL
|
||||||
|
set @@sql_mode='traditional';
|
||||||
|
create table t1( d1 decimal(18) unsigned, d2 decimal(20) unsigned, d3 decimal (22) unsigned);
|
||||||
|
insert into t1 values(1,-1,-1);
|
||||||
|
ERROR 22003: Out of range value adjusted for column 'd2' at row 1
|
||||||
|
drop table t1;
|
||||||
|
create table t1 (col1 decimal(5,2), col2 numeric(5,2));
|
||||||
|
insert into t1 values (999.999,999.999);
|
||||||
|
ERROR 22003: Out of range value adjusted for column 'col1' at row 1
|
||||||
|
insert into t1 values (-999.999,-999.999);
|
||||||
|
ERROR 22003: Out of range value adjusted for column 'col1' at row 1
|
||||||
|
select * from t1;
|
||||||
|
col1 col2
|
||||||
|
drop table t1;
|
||||||
|
set sql_mode='';
|
||||||
|
set @sav_dpi= @@div_precision_increment;
|
||||||
|
set @@div_precision_increment=15;
|
||||||
|
create table t1 (col1 int, col2 decimal(30,25), col3 numeric(30,25));
|
||||||
|
insert into t1 values (1,0.0123456789012345678912345,0.0123456789012345678912345);
|
||||||
|
select col2/9999999999 from t1 where col1=1;
|
||||||
|
col2/9999999999
|
||||||
|
0.000000000001234567890246913578
|
||||||
|
select 9999999999/col2 from t1 where col1=1;
|
||||||
|
9999999999/col2
|
||||||
|
810000007209.000065537105051
|
||||||
|
select 77777777/7777777;
|
||||||
|
77777777/7777777
|
||||||
|
10.000000900000090
|
||||||
|
drop table t1;
|
||||||
|
set div_precision_increment= @sav_dpi;
|
||||||
|
create table t1 (a decimal(4,2));
|
||||||
|
insert into t1 values (0.00);
|
||||||
|
select * from t1 where a > -0.00;
|
||||||
|
a
|
||||||
|
select * from t1 where a = -0.00;
|
||||||
|
a
|
||||||
|
0.00
|
||||||
|
drop table t1;
|
||||||
|
@ -126,13 +126,13 @@ Some sample data
|
|||||||
Some samples
|
Some samples
|
||||||
explain select * from t1 where v like 'This is a test' order by v;
|
explain select * from t1 where v like 'This is a test' order by v;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range v v 257 NULL 3 Using where; Using filesort
|
1 SIMPLE t1 range v v 258 NULL 3 Using where; Using index
|
||||||
explain select * from t1 where v='This is a test' order by v;
|
explain select * from t1 where v='This is a test' order by v;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref v v 257 const 3 Using where
|
1 SIMPLE t1 ref v v 258 const 3 Using where; Using index
|
||||||
explain select * from t1 where v like 'S%' order by v;
|
explain select * from t1 where v like 'S%' order by v;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range v v 257 NULL 2 Using where; Using filesort
|
1 SIMPLE t1 range v v 258 NULL 2 Using where; Using index
|
||||||
alter table t1 change v v varchar(256);
|
alter table t1 change v v varchar(256);
|
||||||
select * from t1 where v like 'This is a test' order by v;
|
select * from t1 where v like 'This is a test' order by v;
|
||||||
v
|
v
|
||||||
@ -150,13 +150,13 @@ Some sample data
|
|||||||
Some samples
|
Some samples
|
||||||
explain select * from t1 where v like 'This is a test' order by v;
|
explain select * from t1 where v like 'This is a test' order by v;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range v v 257 NULL 3 Using where; Using filesort
|
1 SIMPLE t1 range v v 259 NULL 3 Using where; Using index
|
||||||
explain select * from t1 where v='This is a test' order by v;
|
explain select * from t1 where v='This is a test' order by v;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref v v 257 const 3 Using where
|
1 SIMPLE t1 ref v v 259 const 3 Using where; Using index
|
||||||
explain select * from t1 where v like 'S%' order by v;
|
explain select * from t1 where v like 'S%' order by v;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range v v 257 NULL 2 Using where; Using filesort
|
1 SIMPLE t1 range v v 259 NULL 2 Using where; Using index
|
||||||
alter table t1 change v v varchar(257);
|
alter table t1 change v v varchar(257);
|
||||||
select * from t1 where v like 'This is a test' order by v;
|
select * from t1 where v like 'This is a test' order by v;
|
||||||
v
|
v
|
||||||
@ -174,13 +174,13 @@ Some sample data
|
|||||||
Some samples
|
Some samples
|
||||||
explain select * from t1 where v like 'This is a test' order by v;
|
explain select * from t1 where v like 'This is a test' order by v;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range v v 257 NULL 3 Using where; Using filesort
|
1 SIMPLE t1 range v v 260 NULL 3 Using where; Using index
|
||||||
explain select * from t1 where v='This is a test' order by v;
|
explain select * from t1 where v='This is a test' order by v;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref v v 257 const 3 Using where
|
1 SIMPLE t1 ref v v 260 const 3 Using where; Using index
|
||||||
explain select * from t1 where v like 'S%' order by v;
|
explain select * from t1 where v like 'S%' order by v;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range v v 257 NULL 2 Using where; Using filesort
|
1 SIMPLE t1 range v v 260 NULL 2 Using where; Using index
|
||||||
alter table t1 change v v varchar(258);
|
alter table t1 change v v varchar(258);
|
||||||
select * from t1 where v like 'This is a test' order by v;
|
select * from t1 where v like 'This is a test' order by v;
|
||||||
v
|
v
|
||||||
@ -198,13 +198,13 @@ Some sample data
|
|||||||
Some samples
|
Some samples
|
||||||
explain select * from t1 where v like 'This is a test' order by v;
|
explain select * from t1 where v like 'This is a test' order by v;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range v v 257 NULL 3 Using where; Using filesort
|
1 SIMPLE t1 range v v 261 NULL 3 Using where; Using index
|
||||||
explain select * from t1 where v='This is a test' order by v;
|
explain select * from t1 where v='This is a test' order by v;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref v v 257 const 3 Using where
|
1 SIMPLE t1 ref v v 261 const 3 Using where; Using index
|
||||||
explain select * from t1 where v like 'S%' order by v;
|
explain select * from t1 where v like 'S%' order by v;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range v v 257 NULL 2 Using where; Using filesort
|
1 SIMPLE t1 range v v 261 NULL 2 Using where; Using index
|
||||||
alter table t1 change v v varchar(259);
|
alter table t1 change v v varchar(259);
|
||||||
select * from t1 where v like 'This is a test' order by v;
|
select * from t1 where v like 'This is a test' order by v;
|
||||||
v
|
v
|
||||||
@ -222,13 +222,13 @@ Some sample data
|
|||||||
Some samples
|
Some samples
|
||||||
explain select * from t1 where v like 'This is a test' order by v;
|
explain select * from t1 where v like 'This is a test' order by v;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range v v 257 NULL 3 Using where; Using filesort
|
1 SIMPLE t1 range v v 262 NULL 3 Using where; Using index
|
||||||
explain select * from t1 where v='This is a test' order by v;
|
explain select * from t1 where v='This is a test' order by v;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref v v 257 const 3 Using where
|
1 SIMPLE t1 ref v v 262 const 3 Using where; Using index
|
||||||
explain select * from t1 where v like 'S%' order by v;
|
explain select * from t1 where v like 'S%' order by v;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range v v 257 NULL 2 Using where; Using filesort
|
1 SIMPLE t1 range v v 262 NULL 2 Using where; Using index
|
||||||
alter table t1 change v v varchar(258);
|
alter table t1 change v v varchar(258);
|
||||||
select * from t1 where v like 'This is a test' order by v;
|
select * from t1 where v like 'This is a test' order by v;
|
||||||
v
|
v
|
||||||
@ -246,13 +246,13 @@ Some sample data
|
|||||||
Some samples
|
Some samples
|
||||||
explain select * from t1 where v like 'This is a test' order by v;
|
explain select * from t1 where v like 'This is a test' order by v;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range v v 257 NULL 3 Using where; Using filesort
|
1 SIMPLE t1 range v v 261 NULL 3 Using where; Using index
|
||||||
explain select * from t1 where v='This is a test' order by v;
|
explain select * from t1 where v='This is a test' order by v;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref v v 257 const 3 Using where
|
1 SIMPLE t1 ref v v 261 const 3 Using where; Using index
|
||||||
explain select * from t1 where v like 'S%' order by v;
|
explain select * from t1 where v like 'S%' order by v;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range v v 257 NULL 2 Using where; Using filesort
|
1 SIMPLE t1 range v v 261 NULL 2 Using where; Using index
|
||||||
alter table t1 change v v varchar(257);
|
alter table t1 change v v varchar(257);
|
||||||
select * from t1 where v like 'This is a test' order by v;
|
select * from t1 where v like 'This is a test' order by v;
|
||||||
v
|
v
|
||||||
@ -270,13 +270,13 @@ Some sample data
|
|||||||
Some samples
|
Some samples
|
||||||
explain select * from t1 where v like 'This is a test' order by v;
|
explain select * from t1 where v like 'This is a test' order by v;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range v v 257 NULL 3 Using where; Using filesort
|
1 SIMPLE t1 range v v 260 NULL 3 Using where; Using index
|
||||||
explain select * from t1 where v='This is a test' order by v;
|
explain select * from t1 where v='This is a test' order by v;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref v v 257 const 3 Using where
|
1 SIMPLE t1 ref v v 260 const 3 Using where; Using index
|
||||||
explain select * from t1 where v like 'S%' order by v;
|
explain select * from t1 where v like 'S%' order by v;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range v v 257 NULL 2 Using where; Using filesort
|
1 SIMPLE t1 range v v 260 NULL 2 Using where; Using index
|
||||||
alter table t1 change v v varchar(256);
|
alter table t1 change v v varchar(256);
|
||||||
select * from t1 where v like 'This is a test' order by v;
|
select * from t1 where v like 'This is a test' order by v;
|
||||||
v
|
v
|
||||||
@ -294,13 +294,13 @@ Some sample data
|
|||||||
Some samples
|
Some samples
|
||||||
explain select * from t1 where v like 'This is a test' order by v;
|
explain select * from t1 where v like 'This is a test' order by v;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range v v 257 NULL 3 Using where; Using filesort
|
1 SIMPLE t1 range v v 259 NULL 3 Using where; Using index
|
||||||
explain select * from t1 where v='This is a test' order by v;
|
explain select * from t1 where v='This is a test' order by v;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref v v 257 const 3 Using where
|
1 SIMPLE t1 ref v v 259 const 3 Using where; Using index
|
||||||
explain select * from t1 where v like 'S%' order by v;
|
explain select * from t1 where v like 'S%' order by v;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range v v 257 NULL 2 Using where; Using filesort
|
1 SIMPLE t1 range v v 259 NULL 2 Using where; Using index
|
||||||
alter table t1 change v v varchar(255);
|
alter table t1 change v v varchar(255);
|
||||||
select * from t1 where v like 'This is a test' order by v;
|
select * from t1 where v like 'This is a test' order by v;
|
||||||
v
|
v
|
||||||
@ -318,13 +318,13 @@ Some sample data
|
|||||||
Some samples
|
Some samples
|
||||||
explain select * from t1 where v like 'This is a test' order by v;
|
explain select * from t1 where v like 'This is a test' order by v;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range v v 257 NULL 3 Using where; Using filesort
|
1 SIMPLE t1 range v v 258 NULL 3 Using where; Using index
|
||||||
explain select * from t1 where v='This is a test' order by v;
|
explain select * from t1 where v='This is a test' order by v;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref v v 257 const 3 Using where
|
1 SIMPLE t1 ref v v 258 const 3 Using where; Using index
|
||||||
explain select * from t1 where v like 'S%' order by v;
|
explain select * from t1 where v like 'S%' order by v;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range v v 257 NULL 2 Using where; Using filesort
|
1 SIMPLE t1 range v v 258 NULL 2 Using where; Using index
|
||||||
alter table t1 change v v varchar(254);
|
alter table t1 change v v varchar(254);
|
||||||
select * from t1 where v like 'This is a test' order by v;
|
select * from t1 where v like 'This is a test' order by v;
|
||||||
v
|
v
|
||||||
@ -392,3 +392,26 @@ group by t1.b, t1.a;
|
|||||||
a b min(t1.b)
|
a b min(t1.b)
|
||||||
22 NULL NULL
|
22 NULL NULL
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
|
create table t1 (f1 varchar(65500));
|
||||||
|
create index index1 on t1(f1(10));
|
||||||
|
show create table t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`f1` varchar(65500) default NULL,
|
||||||
|
KEY `index1` (`f1`(10))
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
alter table t1 modify f1 varchar(255);
|
||||||
|
show create table t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`f1` varchar(255) default NULL,
|
||||||
|
KEY `index1` (`f1`(10))
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
alter table t1 modify f1 tinytext;
|
||||||
|
show create table t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`f1` tinytext,
|
||||||
|
KEY `index1` (`f1`(10))
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
drop table t1;
|
||||||
|
@ -181,3 +181,56 @@ drop table t1;
|
|||||||
set table_type=MYISAM;
|
set table_type=MYISAM;
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1287 'table_type' is deprecated; use 'storage_engine' instead
|
Warning 1287 'table_type' is deprecated; use 'storage_engine' instead
|
||||||
|
create table t1 (a int);
|
||||||
|
insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
|
||||||
|
update t1 set a='abc';
|
||||||
|
Warnings:
|
||||||
|
Warning 1264 Out of range value adjusted for column 'a' at row 1
|
||||||
|
Warning 1264 Out of range value adjusted for column 'a' at row 2
|
||||||
|
Warning 1264 Out of range value adjusted for column 'a' at row 3
|
||||||
|
Warning 1264 Out of range value adjusted for column 'a' at row 4
|
||||||
|
Warning 1264 Out of range value adjusted for column 'a' at row 5
|
||||||
|
Warning 1264 Out of range value adjusted for column 'a' at row 6
|
||||||
|
Warning 1264 Out of range value adjusted for column 'a' at row 7
|
||||||
|
Warning 1264 Out of range value adjusted for column 'a' at row 8
|
||||||
|
Warning 1264 Out of range value adjusted for column 'a' at row 9
|
||||||
|
Warning 1264 Out of range value adjusted for column 'a' at row 10
|
||||||
|
show warnings limit 2, 1;
|
||||||
|
Level Code Message
|
||||||
|
Warning 1264 Out of range value adjusted for column 'a' at row 3
|
||||||
|
show warnings limit 0, 10;
|
||||||
|
Level Code Message
|
||||||
|
Warning 1264 Out of range value adjusted for column 'a' at row 1
|
||||||
|
Warning 1264 Out of range value adjusted for column 'a' at row 2
|
||||||
|
Warning 1264 Out of range value adjusted for column 'a' at row 3
|
||||||
|
Warning 1264 Out of range value adjusted for column 'a' at row 4
|
||||||
|
Warning 1264 Out of range value adjusted for column 'a' at row 5
|
||||||
|
Warning 1264 Out of range value adjusted for column 'a' at row 6
|
||||||
|
Warning 1264 Out of range value adjusted for column 'a' at row 7
|
||||||
|
Warning 1264 Out of range value adjusted for column 'a' at row 8
|
||||||
|
Warning 1264 Out of range value adjusted for column 'a' at row 9
|
||||||
|
Warning 1264 Out of range value adjusted for column 'a' at row 10
|
||||||
|
show warnings limit 9, 1;
|
||||||
|
Level Code Message
|
||||||
|
Warning 1264 Out of range value adjusted for column 'a' at row 10
|
||||||
|
show warnings limit 10, 1;
|
||||||
|
Level Code Message
|
||||||
|
show warnings limit 9, 2;
|
||||||
|
Level Code Message
|
||||||
|
Warning 1264 Out of range value adjusted for column 'a' at row 10
|
||||||
|
show warnings limit 0, 0;
|
||||||
|
Level Code Message
|
||||||
|
show warnings limit 1;
|
||||||
|
Level Code Message
|
||||||
|
Warning 1264 Out of range value adjusted for column 'a' at row 1
|
||||||
|
show warnings limit 0;
|
||||||
|
Level Code Message
|
||||||
|
show warnings limit 1, 0;
|
||||||
|
Level Code Message
|
||||||
|
select * from t1 limit 0;
|
||||||
|
a
|
||||||
|
select * from t1 limit 1, 0;
|
||||||
|
a
|
||||||
|
select * from t1 limit 0, 0;
|
||||||
|
a
|
||||||
|
drop table t1;
|
||||||
|
39
mysql-test/t/analyze.test
Normal file
39
mysql-test/t/analyze.test
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#
|
||||||
|
# Bug #10901 Analyze Table on new table destroys table
|
||||||
|
# This is minimal test case to get error
|
||||||
|
# The problem was that analyze table wrote the shared state to the file and this
|
||||||
|
# didn't include the inserts while locked. A check was needed to ensure that
|
||||||
|
# state information was not updated when executing analyze table for a locked table.
|
||||||
|
# The analyze table had to be within locks and check table had to be after unlocking
|
||||||
|
# since then it brings the wrong state from disk rather than from the currently
|
||||||
|
# correct internal state. The insert is needed since it changes the file state,
|
||||||
|
# number of records.
|
||||||
|
# The fix is to synchronise the state of the shared state and the current state before
|
||||||
|
# calling mi_state_info_write
|
||||||
|
#
|
||||||
|
create table t1 (a bigint);
|
||||||
|
lock tables t1 write;
|
||||||
|
insert into t1 values(0);
|
||||||
|
analyze table t1;
|
||||||
|
unlock tables;
|
||||||
|
check table t1;
|
||||||
|
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
create table t1 (a bigint);
|
||||||
|
insert into t1 values(0);
|
||||||
|
lock tables t1 write;
|
||||||
|
delete from t1;
|
||||||
|
analyze table t1;
|
||||||
|
unlock tables;
|
||||||
|
check table t1;
|
||||||
|
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
create table t1 (a bigint);
|
||||||
|
insert into t1 values(0);
|
||||||
|
analyze table t1;
|
||||||
|
check table t1;
|
||||||
|
|
||||||
|
drop table t1;
|
||||||
|
|
@ -218,3 +218,39 @@ CHECK TABLE t1;
|
|||||||
INSERT INTO t1 (b) VALUES ('bbbb');
|
INSERT INTO t1 (b) VALUES ('bbbb');
|
||||||
CHECK TABLE t1;
|
CHECK TABLE t1;
|
||||||
DROP TABLE IF EXISTS t1;
|
DROP TABLE IF EXISTS t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #11080 & #11005 Multi-row REPLACE fails on a duplicate key error
|
||||||
|
#
|
||||||
|
|
||||||
|
CREATE TABLE t1 ( `a` int(11) NOT NULL auto_increment, `b` int(11) default NULL,PRIMARY KEY (`a`),UNIQUE KEY `b` (`b`));
|
||||||
|
insert into t1 (b) values (1);
|
||||||
|
replace into t1 (b) values (2), (1), (3);
|
||||||
|
select * from t1;
|
||||||
|
truncate table t1;
|
||||||
|
insert into t1 (b) values (1);
|
||||||
|
replace into t1 (b) values (2);
|
||||||
|
replace into t1 (b) values (1);
|
||||||
|
replace into t1 (b) values (3);
|
||||||
|
select * from t1;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
create table t1 (rowid int not null auto_increment, val int not null,primary
|
||||||
|
key (rowid), unique(val));
|
||||||
|
replace into t1 (val) values ('1'),('2');
|
||||||
|
replace into t1 (val) values ('1'),('2');
|
||||||
|
--error 1062
|
||||||
|
insert into t1 (val) values ('1'),('2');
|
||||||
|
select * from t1;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Test that update changes internal auto-increment value
|
||||||
|
#
|
||||||
|
|
||||||
|
create table t1 (a int not null auto_increment primary key, val int);
|
||||||
|
insert into t1 (val) values (1);
|
||||||
|
update t1 set a=2 where a=1;
|
||||||
|
insert into t1 (val) values (1);
|
||||||
|
select * from t1;
|
||||||
|
drop table t1;
|
||||||
|
@ -414,14 +414,17 @@ drop database mysqltest;
|
|||||||
select database();
|
select database();
|
||||||
|
|
||||||
# Connect without a database
|
# Connect without a database
|
||||||
connect (user4,localhost,mysqltest_1,,*NO-ONE*);
|
connect (user1,localhost,mysqltest_1,,*NO-ONE*);
|
||||||
select database();
|
connection user1;
|
||||||
|
select database(), user();
|
||||||
|
connection default;
|
||||||
|
disconnect user1;
|
||||||
|
use test;
|
||||||
|
|
||||||
#
|
#
|
||||||
# Test for Bug 856 'Naming a key "Primary" causes trouble'
|
# Test for Bug 856 'Naming a key "Primary" causes trouble'
|
||||||
#
|
#
|
||||||
|
|
||||||
use test;
|
|
||||||
--error 1280
|
--error 1280
|
||||||
create table t1 (a int, index `primary` (a));
|
create table t1 (a int, index `primary` (a));
|
||||||
--error 1280
|
--error 1280
|
||||||
@ -478,8 +481,6 @@ drop table t1,t2;
|
|||||||
# This tests two additional possible errors and a hang if
|
# This tests two additional possible errors and a hang if
|
||||||
# an improper fix is present.
|
# an improper fix is present.
|
||||||
#
|
#
|
||||||
connection default;
|
|
||||||
use test;
|
|
||||||
create table t1 (a int);
|
create table t1 (a int);
|
||||||
--error 1093
|
--error 1093
|
||||||
create table t1 select * from t1;
|
create table t1 select * from t1;
|
||||||
@ -501,3 +502,15 @@ create table t1(xyz.t1.name int);
|
|||||||
create table t1(t1.name int);
|
create table t1(t1.name int);
|
||||||
create table t2(test.t2.name int);
|
create table t2(test.t2.name int);
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#11028: Crash on create table like
|
||||||
|
#
|
||||||
|
create database mysqltest;
|
||||||
|
use mysqltest;
|
||||||
|
drop database mysqltest;
|
||||||
|
--error 1102
|
||||||
|
create table test.t1 like x;
|
||||||
|
--disable_warnings
|
||||||
|
drop table if exists test.t1;
|
||||||
|
--enable_warnings
|
||||||
|
@ -10,3 +10,15 @@ CREATE TABLE t1 (a char(16)) character set cp1250 collate cp1250_czech_cs;
|
|||||||
INSERT INTO t1 VALUES ('');
|
INSERT INTO t1 VALUES ('');
|
||||||
SELECT a, length(a), a='', a=' ', a=' ' FROM t1;
|
SELECT a, length(a), a='', a=' ', a=' ' FROM t1;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#9759 Empty result with 'LIKE' and cp1250_czech_cs
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
popisek varchar(30) collate cp1250_general_ci NOT NULL default '',
|
||||||
|
PRIMARY KEY (`popisek`)
|
||||||
|
);
|
||||||
|
INSERT INTO t1 VALUES ('2005-01-1');
|
||||||
|
SELECT * FROM t1 WHERE popisek = '2005-01-1';
|
||||||
|
SELECT * FROM t1 WHERE popisek LIKE '2005-01-1';
|
||||||
|
drop table t1;
|
||||||
|
@ -455,3 +455,18 @@ drop table t1;
|
|||||||
|
|
||||||
SET collation_connection='utf8_unicode_ci';
|
SET collation_connection='utf8_unicode_ci';
|
||||||
-- source include/ctype_filesort.inc
|
-- source include/ctype_filesort.inc
|
||||||
|
|
||||||
|
#
|
||||||
|
# Check UPPER/LOWER changeing length
|
||||||
|
#
|
||||||
|
# Result shorter than argument
|
||||||
|
CREATE TABLE t1 (id int, a varchar(30) character set utf8);
|
||||||
|
INSERT INTO t1 VALUES (1, _ucs2 0x01310069), (2, _ucs2 0x01310131);
|
||||||
|
INSERT INTO t1 VALUES (3, _ucs2 0x00690069), (4, _ucs2 0x01300049);
|
||||||
|
INSERT INTO t1 VALUES (5, _ucs2 0x01300130), (6, _ucs2 0x00490049);
|
||||||
|
SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu
|
||||||
|
FROM t1 ORDER BY id;
|
||||||
|
ALTER TABLE t1 MODIFY a VARCHAR(30) character set utf8 collate utf8_turkish_ci;
|
||||||
|
SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu
|
||||||
|
FROM t1 ORDER BY id;
|
||||||
|
DROP TABLE t1;
|
||||||
|
@ -731,3 +731,18 @@ select ifnull(NULL, _utf8'string');
|
|||||||
create table t1 (a varchar(255)) default character set utf8;
|
create table t1 (a varchar(255)) default character set utf8;
|
||||||
insert into t1 values (1.0);
|
insert into t1 values (1.0);
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#10253 compound index length and utf8 char set
|
||||||
|
# produces invalid query results
|
||||||
|
#
|
||||||
|
create table t1 (
|
||||||
|
id int not null,
|
||||||
|
city varchar(20) not null,
|
||||||
|
key (city(7),id)
|
||||||
|
) character set=utf8;
|
||||||
|
insert into t1 values (1,'Durban North');
|
||||||
|
insert into t1 values (2,'Durban');
|
||||||
|
select * from t1 where city = 'Durban';
|
||||||
|
select * from t1 where city = 'Durban ';
|
||||||
|
drop table t1;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
--disable_warnings
|
--disable_warnings
|
||||||
drop table if exists t1,t11,t12,t2;
|
drop table if exists t1,t2,t3,t11,t12;
|
||||||
--enable_warnings
|
--enable_warnings
|
||||||
CREATE TABLE t1 (a tinyint(3), b tinyint(5));
|
CREATE TABLE t1 (a tinyint(3), b tinyint(5));
|
||||||
INSERT INTO t1 VALUES (1,1);
|
INSERT INTO t1 VALUES (1,1);
|
||||||
@ -152,3 +152,20 @@ INSERT INTO t1 VALUES (0),(1),(2);
|
|||||||
DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a LIMIT 1;
|
DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a LIMIT 1;
|
||||||
SELECT * FROM t1;
|
SELECT * FROM t1;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Test of multi-delete where we are not scanning the first table
|
||||||
|
#
|
||||||
|
|
||||||
|
CREATE TABLE t1 (a int not null,b int not null);
|
||||||
|
CREATE TABLE t2 (a int not null, b int not null, primary key (a,b));
|
||||||
|
CREATE TABLE t3 (a int not null, b int not null, primary key (a,b));
|
||||||
|
insert into t1 values (1,1),(2,1),(1,3);
|
||||||
|
insert into t2 values (1,1),(2,2),(3,3);
|
||||||
|
insert into t3 values (1,1),(2,1),(1,3);
|
||||||
|
select * from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b;
|
||||||
|
explain select * from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b;
|
||||||
|
delete t2.*,t3.* from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b;
|
||||||
|
# This should be empty
|
||||||
|
select * from t3;
|
||||||
|
drop table t1,t2,t3;
|
||||||
|
@ -332,3 +332,11 @@ CREATE TABLE t1 (
|
|||||||
INSERT INTO t1 VALUES ('1',1,0);
|
INSERT INTO t1 VALUES ('1',1,0);
|
||||||
SELECT DISTINCT html,SUM(rout)/(SUM(rin)+1) as 'prod' FROM t1 GROUP BY rin;
|
SELECT DISTINCT html,SUM(rout)/(SUM(rin)+1) as 'prod' FROM t1 GROUP BY rin;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug 9784 DISTINCT IFNULL truncates data
|
||||||
|
#
|
||||||
|
create table t1 (id int, dsc varchar(50));
|
||||||
|
insert into t1 values (1, "line number one"), (2, "line number two"), (3, "line number three");
|
||||||
|
select distinct id, IFNULL(dsc, '-') from t1;
|
||||||
|
drop table t1;
|
||||||
|
@ -213,21 +213,6 @@ INSERT INTO t1 VALUES (1,'First Row'), (2,'Second Row');
|
|||||||
SELECT GROUP_CONCAT(b ORDER BY b) FROM t1 GROUP BY a;
|
SELECT GROUP_CONCAT(b ORDER BY b) FROM t1 GROUP BY a;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
#
|
|
||||||
# check null values #1
|
|
||||||
#
|
|
||||||
|
|
||||||
--disable_warnings
|
|
||||||
CREATE TABLE t1 (a_id tinyint(4) NOT NULL default '0', PRIMARY KEY (a_id)) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
|
||||||
INSERT INTO t1 VALUES (1),(2),(3);
|
|
||||||
CREATE TABLE t2 (b_id tinyint(4) NOT NULL default '0',b_a tinyint(4) NOT NULL default '0', PRIMARY KEY (b_id), KEY (b_a),
|
|
||||||
CONSTRAINT fk_b_a FOREIGN KEY (b_a) REFERENCES t1 (a_id) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
|
||||||
--enable_warnings
|
|
||||||
INSERT INTO t2 VALUES (1,1),(2,1),(3,1),(4,2),(5,2);
|
|
||||||
SELECT * FROM (SELECT t1.*,GROUP_CONCAT(t2.b_id SEPARATOR ',') as b_list FROM (t1 LEFT JOIN (t2) on t1.a_id = t2.b_a) GROUP BY t1.a_id ) AS xyz;
|
|
||||||
DROP TABLE t2;
|
|
||||||
DROP TABLE t1;
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# check null values #2
|
# check null values #2
|
||||||
#
|
#
|
||||||
@ -285,6 +270,28 @@ CREATE TABLE t1 (id int);
|
|||||||
SELECT GROUP_CONCAT(id) AS gc FROM t1 HAVING gc IS NULL;
|
SELECT GROUP_CONCAT(id) AS gc FROM t1 HAVING gc IS NULL;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #8656: Crash with group_concat on alias in outer table
|
||||||
|
#
|
||||||
|
create table t2 (a int, b int);
|
||||||
|
insert into t2 values (1,1), (2,2);
|
||||||
|
select b x, (select group_concat(x) from t2) from t2;
|
||||||
|
drop table t2;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #7405: problems with rollup
|
||||||
|
#
|
||||||
|
|
||||||
|
create table t1 (d int not null auto_increment,primary key(d), a int, b int, c int);
|
||||||
|
insert into t1(a,b) values (1,3), (1,4), (1,2), (2,7), (1,1), (1,2), (2,3), (2,3);
|
||||||
|
select d,a,b from t1 order by a;
|
||||||
|
explain select a, group_concat(b) from t1 group by a with rollup;
|
||||||
|
select a, group_concat(b) from t1 group by a with rollup;
|
||||||
|
select a, group_concat(distinct b) from t1 group by a with rollup;
|
||||||
|
select a, group_concat(b order by b) from t1 group by a with rollup;
|
||||||
|
select a, group_concat(distinct b order by b) from t1 group by a with rollup;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
#
|
#
|
||||||
# Bug #6475
|
# Bug #6475
|
||||||
#
|
#
|
||||||
@ -292,12 +299,3 @@ create table t1 (a char(3), b char(20), primary key (a, b));
|
|||||||
insert into t1 values ('ABW', 'Dutch'), ('ABW', 'English');
|
insert into t1 values ('ABW', 'Dutch'), ('ABW', 'English');
|
||||||
select group_concat(a) from t1 group by b;
|
select group_concat(a) from t1 group by b;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
#
|
|
||||||
# Bug #8656: Crash with group_concat on alias in outer table
|
|
||||||
#
|
|
||||||
create table r2 (a int, b int);
|
|
||||||
insert into r2 values (1,1), (2,2);
|
|
||||||
select b x, (select group_concat(x) from r2) from r2;
|
|
||||||
drop table r2;
|
|
||||||
|
|
||||||
|
@ -67,3 +67,20 @@ explain extended select degrees(pi()),radians(360);
|
|||||||
|
|
||||||
--error 1054
|
--error 1054
|
||||||
select rand(rand);
|
select rand(rand);
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #8459 (FORMAT returns incorrect result)
|
||||||
|
#
|
||||||
|
create table t1 (col1 int, col2 decimal(60,30));
|
||||||
|
insert into t1 values(1,1234567890.12345);
|
||||||
|
select format(col2,7) from t1;
|
||||||
|
select format(col2,8) from t1;
|
||||||
|
insert into t1 values(7,1234567890123456.12345);
|
||||||
|
select format(col2,6) from t1 where col1=7;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #10083 (round doesn't increase decimals)
|
||||||
|
#
|
||||||
|
select round(150, 2);
|
||||||
|
@ -336,3 +336,17 @@ DROP TABLE t1;
|
|||||||
|
|
||||||
explain extended select timestampdiff(SQL_TSI_WEEK, '2001-02-01', '2001-05-01') as a1,
|
explain extended select timestampdiff(SQL_TSI_WEEK, '2001-02-01', '2001-05-01') as a1,
|
||||||
timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:58:58.119999') as a2;
|
timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:58:58.119999') as a2;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #10568
|
||||||
|
#
|
||||||
|
|
||||||
|
select last_day('2005-00-00');
|
||||||
|
select last_day('2005-00-01');
|
||||||
|
select last_day('2005-01-00');
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #10590: %h, %I, and %l format specifies should all return results in
|
||||||
|
# the 0-11 range
|
||||||
|
#
|
||||||
|
select time_format('100:00:00', '%H %k %h %I %l');
|
||||||
|
@ -522,3 +522,20 @@ insert into t1 values(3000000000);
|
|||||||
select * from t1;
|
select * from t1;
|
||||||
select min(b) from t1;
|
select min(b) from t1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Test for bug #11088: GROUP BY a BLOB colimn with COUNT(DISTINCT column1)
|
||||||
|
#
|
||||||
|
|
||||||
|
CREATE TABLE t1 (id int PRIMARY KEY, user_id int, hostname longtext);
|
||||||
|
|
||||||
|
INSERT INTO t1 VALUES
|
||||||
|
(1, 7, 'cache-dtc-af05.proxy.aol.com'),
|
||||||
|
(2, 3, 'what.ever.com'),
|
||||||
|
(3, 7, 'cache-dtc-af05.proxy.aol.com'),
|
||||||
|
(4, 7, 'cache-dtc-af05.proxy.aol.com');
|
||||||
|
|
||||||
|
SELECT hostname, COUNT(DISTINCT user_id) as no FROM t1
|
||||||
|
WHERE hostname LIKE '%aol%'
|
||||||
|
GROUP BY hostname;
|
||||||
|
|
||||||
|
@ -426,3 +426,12 @@ drop table t1;
|
|||||||
--error 1075
|
--error 1075
|
||||||
create table t1 (a int not null, b int not null auto_increment,
|
create table t1 (a int not null, b int not null auto_increment,
|
||||||
primary key(a, b)) engine=heap;
|
primary key(a, b)) engine=heap;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #10566: Verify that we can create a prefixed key with length > 255
|
||||||
|
#
|
||||||
|
create table t1 (c char(255), primary key(c(90)));
|
||||||
|
insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
|
||||||
|
--error 1062
|
||||||
|
insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
|
||||||
|
drop table t1;
|
||||||
|
@ -4,6 +4,11 @@
|
|||||||
# Test for information_schema.schemata &
|
# Test for information_schema.schemata &
|
||||||
# show databases
|
# show databases
|
||||||
|
|
||||||
|
--disable_warnings
|
||||||
|
DROP TABLE IF EXISTS t0,t1,t2;
|
||||||
|
--enable_warnings
|
||||||
|
|
||||||
|
|
||||||
show variables where variable_name like "skip_show_database";
|
show variables where variable_name like "skip_show_database";
|
||||||
grant select, update, execute on test.* to mysqltest_2@localhost;
|
grant select, update, execute on test.* to mysqltest_2@localhost;
|
||||||
grant select, update on test.* to mysqltest_1@localhost;
|
grant select, update on test.* to mysqltest_1@localhost;
|
||||||
@ -493,3 +498,47 @@ flush privileges;
|
|||||||
#
|
#
|
||||||
SELECT table_schema, count(*) FROM information_schema.TABLES GROUP BY TABLE_SCHEMA;
|
SELECT table_schema, count(*) FROM information_schema.TABLES GROUP BY TABLE_SCHEMA;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #10964 Information Schema:Authorization check on privilege tables is improper
|
||||||
|
#
|
||||||
|
|
||||||
|
create database mysqltest;
|
||||||
|
create table mysqltest.t1 (f1 int, f2 int);
|
||||||
|
create table mysqltest.t2 (f1 int);
|
||||||
|
grant select (f1) on mysqltest.t1 to user1@localhost;
|
||||||
|
grant select on mysqltest.t2 to user2@localhost;
|
||||||
|
grant select on mysqltest.* to user3@localhost;
|
||||||
|
grant select on *.* to user4@localhost;
|
||||||
|
|
||||||
|
connect (con1,localhost,user1,,);
|
||||||
|
connect (con2,localhost,user2,,);
|
||||||
|
connect (con3,localhost,user3,,);
|
||||||
|
connect (con4,localhost,user4,,);
|
||||||
|
connection con1;
|
||||||
|
select * from information_schema.column_privileges;
|
||||||
|
select * from information_schema.table_privileges;
|
||||||
|
select * from information_schema.schema_privileges;
|
||||||
|
select * from information_schema.user_privileges;
|
||||||
|
show grants;
|
||||||
|
connection con2;
|
||||||
|
select * from information_schema.column_privileges;
|
||||||
|
select * from information_schema.table_privileges;
|
||||||
|
select * from information_schema.schema_privileges;
|
||||||
|
select * from information_schema.user_privileges;
|
||||||
|
show grants;
|
||||||
|
connection con3;
|
||||||
|
select * from information_schema.column_privileges;
|
||||||
|
select * from information_schema.table_privileges;
|
||||||
|
select * from information_schema.schema_privileges;
|
||||||
|
select * from information_schema.user_privileges;
|
||||||
|
show grants;
|
||||||
|
connection con4;
|
||||||
|
select * from information_schema.column_privileges where grantee like '%user%';
|
||||||
|
select * from information_schema.table_privileges where grantee like '%user%';
|
||||||
|
select * from information_schema.schema_privileges where grantee like '%user%';
|
||||||
|
select * from information_schema.user_privileges where grantee like '%user%';
|
||||||
|
show grants;
|
||||||
|
connection default;
|
||||||
|
drop user user1@localhost, user2@localhost, user3@localhost, user4@localhost;
|
||||||
|
use test;
|
||||||
|
drop database mysqltest;
|
||||||
|
@ -615,7 +615,6 @@ truncate table t1;
|
|||||||
insert into t1 values(1),(2);
|
insert into t1 values(1),(2);
|
||||||
select * from t1;
|
select * from t1;
|
||||||
truncate table t1;
|
truncate table t1;
|
||||||
truncate table t1;
|
|
||||||
insert into t1 values(1),(2);
|
insert into t1 values(1),(2);
|
||||||
delete from t1;
|
delete from t1;
|
||||||
select * from t1;
|
select * from t1;
|
||||||
@ -1056,8 +1055,8 @@ insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, "");
|
|||||||
insert t2 select * from t1;
|
insert t2 select * from t1;
|
||||||
insert t3 select * from t1;
|
insert t3 select * from t1;
|
||||||
checksum table t1, t2, t3, t4 quick;
|
checksum table t1, t2, t3, t4 quick;
|
||||||
checksum table t1, t2, t3;
|
checksum table t1, t2, t3, t4;
|
||||||
checksum table t1, t2, t3 extended;
|
checksum table t1, t2, t3, t4 extended;
|
||||||
#show table status;
|
#show table status;
|
||||||
drop table t1,t2,t3;
|
drop table t1,t2,t3;
|
||||||
|
|
||||||
@ -1176,28 +1175,6 @@ show status like "binlog_cache_use";
|
|||||||
show status like "binlog_cache_disk_use";
|
show status like "binlog_cache_disk_use";
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
#
|
|
||||||
# range optimizer problem
|
|
||||||
#
|
|
||||||
|
|
||||||
create table t1 (x bigint unsigned not null primary key) engine=innodb;
|
|
||||||
insert into t1(x) values (0xfffffffffffffff0),(0xfffffffffffffff1);
|
|
||||||
select * from t1;
|
|
||||||
select count(*) from t1 where x>0;
|
|
||||||
select count(*) from t1 where x=0;
|
|
||||||
select count(*) from t1 where x<0;
|
|
||||||
select count(*) from t1 where x < -16;
|
|
||||||
select count(*) from t1 where x = -16;
|
|
||||||
explain select count(*) from t1 where x > -16;
|
|
||||||
|
|
||||||
# The following result should be (2). To be fixed when we add 'unsigned flag' to
|
|
||||||
# Field::store(longlong)
|
|
||||||
select count(*) from t1 where x > -16;
|
|
||||||
select * from t1 where x > -16;
|
|
||||||
select count(*) from t1 where x = 18446744073709551601;
|
|
||||||
|
|
||||||
drop table t1;
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Bug #6126: Duplicate columns in keys gives misleading error message
|
# Bug #6126: Duplicate columns in keys gives misleading error message
|
||||||
#
|
#
|
||||||
@ -1220,6 +1197,62 @@ alter table t1 add key (c1,c2,c1);
|
|||||||
alter table t1 add key (c1,c1,c2);
|
alter table t1 add key (c1,c1,c2);
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #4082: integer truncation
|
||||||
|
#
|
||||||
|
|
||||||
|
create table t1(a int(1) , b int(1)) engine=innodb;
|
||||||
|
insert into t1 values ('1111', '3333');
|
||||||
|
select distinct concat(a, b) from t1;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# BUG#7709 test case - Boolean fulltext query against unsupported
|
||||||
|
# engines does not fail
|
||||||
|
#
|
||||||
|
|
||||||
|
CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB;
|
||||||
|
--error 1214;
|
||||||
|
SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE);
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# check null values #1
|
||||||
|
#
|
||||||
|
|
||||||
|
--disable_warnings
|
||||||
|
CREATE TABLE t1 (a_id tinyint(4) NOT NULL default '0', PRIMARY KEY (a_id)) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||||
|
INSERT INTO t1 VALUES (1),(2),(3);
|
||||||
|
CREATE TABLE t2 (b_id tinyint(4) NOT NULL default '0',b_a tinyint(4) NOT NULL default '0', PRIMARY KEY (b_id), KEY (b_a),
|
||||||
|
CONSTRAINT fk_b_a FOREIGN KEY (b_a) REFERENCES t1 (a_id) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||||
|
--enable_warnings
|
||||||
|
INSERT INTO t2 VALUES (1,1),(2,1),(3,1),(4,2),(5,2);
|
||||||
|
SELECT * FROM (SELECT t1.*,GROUP_CONCAT(t2.b_id SEPARATOR ',') as b_list FROM (t1 LEFT JOIN (t2) on t1.a_id = t2.b_a) GROUP BY t1.a_id ) AS xyz;
|
||||||
|
DROP TABLE t2;
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# range optimizer problem
|
||||||
|
#
|
||||||
|
|
||||||
|
create table t1 (x bigint unsigned not null primary key) engine=innodb;
|
||||||
|
insert into t1(x) values (0xfffffffffffffff0),(0xfffffffffffffff1);
|
||||||
|
select * from t1;
|
||||||
|
select count(*) from t1 where x>0;
|
||||||
|
select count(*) from t1 where x=0;
|
||||||
|
select count(*) from t1 where x<0;
|
||||||
|
select count(*) from t1 where x < -16;
|
||||||
|
select count(*) from t1 where x = -16;
|
||||||
|
explain select count(*) from t1 where x > -16;
|
||||||
|
|
||||||
|
# The following result should be (2). To be fixed when we add 'unsigned flag' to
|
||||||
|
# Field::store(longlong)
|
||||||
|
select count(*) from t1 where x > -16;
|
||||||
|
select * from t1 where x > -16;
|
||||||
|
select count(*) from t1 where x = 18446744073709551601;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
|
||||||
# Test for testable InnoDB status variables. This test
|
# Test for testable InnoDB status variables. This test
|
||||||
# uses previous ones(pages_created, rows_deleted, ...).
|
# uses previous ones(pages_created, rows_deleted, ...).
|
||||||
show status like "Innodb_buffer_pool_pages_total";
|
show status like "Innodb_buffer_pool_pages_total";
|
||||||
@ -1302,20 +1335,50 @@ create table t1 (v varchar(16384)) engine=innodb;
|
|||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
#
|
#
|
||||||
# Bug #4082: integer truncation
|
# BUG#11039 Wrong key length in min()
|
||||||
#
|
#
|
||||||
|
|
||||||
create table t1(a int(1) , b int(1)) engine=innodb;
|
create table t1 (a char(1), b char(1), key(a, b)) engine=innodb;
|
||||||
insert into t1 values ('1111', '3333');
|
insert into t1 values ('8', '6'), ('4', '7');
|
||||||
select distinct concat(a, b) from t1;
|
select min(a) from t1;
|
||||||
|
select min(b) from t1 where a='8';
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
#
|
#
|
||||||
# BUG#7709 test case - Boolean fulltext query against unsupported
|
# Bug #11080 & #11005 Multi-row REPLACE fails on a duplicate key error
|
||||||
# engines does not fail
|
|
||||||
#
|
#
|
||||||
|
|
||||||
CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB;
|
CREATE TABLE t1 ( `a` int(11) NOT NULL auto_increment, `b` int(11) default NULL,PRIMARY KEY (`a`),UNIQUE KEY `b` (`b`)) ENGINE=innodb;
|
||||||
--error 1214;
|
insert into t1 (b) values (1);
|
||||||
SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE);
|
replace into t1 (b) values (2), (1), (3);
|
||||||
DROP TABLE t1;
|
select * from t1;
|
||||||
|
truncate table t1;
|
||||||
|
insert into t1 (b) values (1);
|
||||||
|
replace into t1 (b) values (2);
|
||||||
|
replace into t1 (b) values (1);
|
||||||
|
replace into t1 (b) values (3);
|
||||||
|
select * from t1;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
create table t1 (rowid int not null auto_increment, val int not null,primary
|
||||||
|
key (rowid), unique(val)) engine=innodb;
|
||||||
|
replace into t1 (val) values ('1'),('2');
|
||||||
|
replace into t1 (val) values ('1'),('2');
|
||||||
|
--error 1062
|
||||||
|
insert into t1 (val) values ('1'),('2');
|
||||||
|
select * from t1;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Test that update does not change internal auto-increment value
|
||||||
|
#
|
||||||
|
|
||||||
|
create table t1 (a int not null auto_increment primary key, val int) engine=InnoDB;
|
||||||
|
insert into t1 (val) values (1);
|
||||||
|
update t1 set a=2 where a=1;
|
||||||
|
# We should get the following error because InnoDB does not update the counter
|
||||||
|
--error 1062
|
||||||
|
insert into t1 (val) values (1);
|
||||||
|
select * from t1;
|
||||||
|
drop table t1;
|
||||||
|
@ -69,6 +69,16 @@ handler t2 read next;
|
|||||||
handler t2 read last;
|
handler t2 read last;
|
||||||
handler t2 close;
|
handler t2 close;
|
||||||
|
|
||||||
|
handler t1 open;
|
||||||
|
handler t1 read a next; # this used to crash as a bug#5373
|
||||||
|
handler t1 read a next;
|
||||||
|
handler t1 close;
|
||||||
|
|
||||||
|
handler t1 open;
|
||||||
|
handler t1 read a prev; # this used to crash as a bug#5373
|
||||||
|
handler t1 read a prev;
|
||||||
|
handler t1 close;
|
||||||
|
|
||||||
handler t1 open as t2;
|
handler t1 open as t2;
|
||||||
handler t2 read first;
|
handler t2 read first;
|
||||||
alter table t1 engine=innodb;
|
alter table t1 engine=innodb;
|
||||||
|
@ -324,3 +324,16 @@ alter table t1 add key (c1,c2,c1);
|
|||||||
--error 1060
|
--error 1060
|
||||||
alter table t1 add key (c1,c1,c2);
|
alter table t1 add key (c1,c1,c2);
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# If we use a partial field for a key that is actually the length of the
|
||||||
|
# field, and we extend the field, we end up with a key that includes the
|
||||||
|
# whole new length of the field.
|
||||||
|
#
|
||||||
|
create table t1 (a varchar(10), b varchar(10), key(a(10),b(10)));
|
||||||
|
show create table t1;
|
||||||
|
alter table t1 modify b varchar(20);
|
||||||
|
show create table t1;
|
||||||
|
alter table t1 modify a varchar(20);
|
||||||
|
show create table t1;
|
||||||
|
drop table t1;
|
||||||
|
@ -295,3 +295,23 @@ select 1 as `a'b`, 2 as `a"b`;
|
|||||||
|
|
||||||
# Test escaping of quotes
|
# Test escaping of quotes
|
||||||
select 'aaa\\','aa''a',"aa""a";
|
select 'aaa\\','aa''a',"aa""a";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Check of include/show_msg.inc
|
||||||
|
#
|
||||||
|
|
||||||
|
# The message contains in most cases a string with the default character set
|
||||||
|
SET @message = 'Here comes a message';
|
||||||
|
--source include/show_msg.inc
|
||||||
|
|
||||||
|
# The message could also contain a string with character set utf8
|
||||||
|
SET @message = USER();
|
||||||
|
--source include/show_msg.inc
|
||||||
|
|
||||||
|
# The message contains more then 80 characters on multiple lines
|
||||||
|
SET @message = 'Here comes a very very long message that is longer then 80 characters
|
||||||
|
on multiple lines';
|
||||||
|
--source include/show_msg80.inc
|
||||||
|
|
||||||
|
@ -214,4 +214,4 @@ drop table if exists t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
|
|||||||
# Test BUG#10287
|
# Test BUG#10287
|
||||||
#
|
#
|
||||||
|
|
||||||
--exec $NDB_TOOLS_DIR/ndb_select_all -d sys -D , SYSTAB_0 | grep 520093696
|
--exec $NDB_TOOLS_DIR/ndb_select_all --no-defaults -d sys -D , SYSTAB_0 | grep 520093696
|
||||||
|
@ -664,3 +664,32 @@ select t2.id from t2, t1 where (t1.id=1 and t2.t1_id=t1.id);
|
|||||||
|
|
||||||
deallocate prepare stmt;
|
deallocate prepare stmt;
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#7306 LIMIT ?, ? and also WL#1785 " Prepared statements: implement
|
||||||
|
# support for placeholders in LIMIT clause."
|
||||||
|
# Add basic test coverage for the feature.
|
||||||
|
#
|
||||||
|
create table t1 (a int);
|
||||||
|
insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
|
||||||
|
prepare stmt from "select * from t1 limit ?, ?";
|
||||||
|
set @offset=0, @limit=1;
|
||||||
|
execute stmt using @offset, @limit;
|
||||||
|
select * from t1 limit 0, 1;
|
||||||
|
set @offset=3, @limit=2;
|
||||||
|
execute stmt using @offset, @limit;
|
||||||
|
select * from t1 limit 3, 2;
|
||||||
|
prepare stmt from "select * from t1 limit ?";
|
||||||
|
execute stmt using @limit;
|
||||||
|
--error 1235
|
||||||
|
prepare stmt from "select * from t1 where a in (select a from t1 limit ?)";
|
||||||
|
prepare stmt from "select * from t1 union all select * from t1 limit ?, ?";
|
||||||
|
set @offset=9;
|
||||||
|
set @limit=2;
|
||||||
|
execute stmt using @offset, @limit;
|
||||||
|
prepare stmt from "(select * from t1 limit ?, ?) union all
|
||||||
|
(select * from t1 limit ?, ?) order by a limit ?";
|
||||||
|
execute stmt using @offset, @limit, @offset, @limit, @limit;
|
||||||
|
|
||||||
|
drop table t1;
|
||||||
|
deallocate prepare stmt;
|
||||||
|
@ -2255,3 +2255,19 @@ AND FK_firma_id = 2;
|
|||||||
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Test for bug #10084: STRAIGHT_JOIN with ON expression
|
||||||
|
#
|
||||||
|
|
||||||
|
CREATE TABLE t1 (a int);
|
||||||
|
CREATE TABLE t2 (a int);
|
||||||
|
INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
|
||||||
|
INSERT INTO t2 VALUES (2), (4), (6);
|
||||||
|
|
||||||
|
SELECT t1.a FROM t1 STRAIGHT_JOIN t2 ON t1.a=t2.a;
|
||||||
|
|
||||||
|
EXPLAIN SELECT t1.a FROM t1 STRAIGHT_JOIN t2 ON t1.a=t2.a;
|
||||||
|
EXPLAIN SELECT t1.a FROM t1 INNER JOIN t2 ON t1.a=t2.a;
|
||||||
|
|
||||||
|
DROP TABLE t1,t2;
|
||||||
|
|
||||||
|
@ -965,3 +965,24 @@ drop procedure bug10969|
|
|||||||
drop table t1|
|
drop table t1|
|
||||||
|
|
||||||
delimiter ;|
|
delimiter ;|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#10975, #10605, #7115: Dynamic SQL by means of
|
||||||
|
# PREPARE/EXECUTE/DEALLOCATE is not supported yet.
|
||||||
|
# Check that an error message is returned.
|
||||||
|
#
|
||||||
|
prepare stmt from "select 1";
|
||||||
|
--error ER_SP_BADSTATEMENT
|
||||||
|
create procedure p() deallocate prepare stmt;
|
||||||
|
--error ER_SP_BADSTATEMENT
|
||||||
|
create function f() returns int begin deallocate prepare stmt;
|
||||||
|
--error ER_SP_BADSTATEMENT
|
||||||
|
create procedure p() prepare stmt from "select 1";
|
||||||
|
--error ER_SP_BADSTATEMENT
|
||||||
|
create function f() returns int begin prepare stmt from "select 1";
|
||||||
|
--error ER_SP_BADSTATEMENT
|
||||||
|
create procedure p() execute stmt;
|
||||||
|
--error ER_SP_BADSTATEMENT
|
||||||
|
create function f() returns int begin execute stmt;
|
||||||
|
deallocate prepare stmt;
|
||||||
|
|
||||||
|
@ -84,6 +84,32 @@ reap;
|
|||||||
drop procedure bug9486;
|
drop procedure bug9486;
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
|
|
||||||
|
#
|
||||||
|
# BUG#11158: Can't perform multi-delete in stored procedure
|
||||||
|
#
|
||||||
|
--disable_warnings
|
||||||
|
drop procedure if exists bug11158;
|
||||||
|
--enable_warnings
|
||||||
|
create procedure bug11158() delete t1 from t1, t2 where t1.id = t2.id;
|
||||||
|
create table t1 (id int, j int);
|
||||||
|
insert into t1 values (1, 1), (2, 2);
|
||||||
|
create table t2 (id int);
|
||||||
|
insert into t2 values (1);
|
||||||
|
# Procedure should work and cause proper effect (delete only first row)
|
||||||
|
call bug11158();
|
||||||
|
select * from t1;
|
||||||
|
# Also let us test that we obtain only read (and thus non exclusive) lock
|
||||||
|
# for table from which we are not going to delete rows.
|
||||||
|
connection con2root;
|
||||||
|
lock tables t2 read;
|
||||||
|
connection con1root;
|
||||||
|
call bug11158();
|
||||||
|
connection con2root;
|
||||||
|
unlock tables;
|
||||||
|
connection con1root;
|
||||||
|
# Clean-up
|
||||||
|
drop procedure bug11158;
|
||||||
|
drop table t1, t2;
|
||||||
|
|
||||||
#
|
#
|
||||||
# BUG#NNNN: New bug synopsis
|
# BUG#NNNN: New bug synopsis
|
||||||
|
@ -3268,12 +3268,6 @@ drop procedure bug8762|
|
|||||||
#
|
#
|
||||||
# BUG#5240: Stored procedure crash if function has cursor declaration
|
# BUG#5240: Stored procedure crash if function has cursor declaration
|
||||||
#
|
#
|
||||||
# The following test case fails in --ps-protocol mode due to some bugs
|
|
||||||
# in algorithm which calculates list of tables to be locked for queries
|
|
||||||
# using Stored Functions. It is disabled until Dmitri fixes this.
|
|
||||||
#
|
|
||||||
--disable_ps_protocol
|
|
||||||
|
|
||||||
--disable_warnings
|
--disable_warnings
|
||||||
drop function if exists bug5240|
|
drop function if exists bug5240|
|
||||||
--enable_warnings
|
--enable_warnings
|
||||||
@ -3293,8 +3287,6 @@ insert into t1 values ("answer", 42)|
|
|||||||
select id, bug5240() from t1|
|
select id, bug5240() from t1|
|
||||||
drop function bug5240|
|
drop function bug5240|
|
||||||
|
|
||||||
--enable_ps_protocol
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# BUG#5278: Stored procedure packets out of order if SET PASSWORD.
|
# BUG#5278: Stored procedure packets out of order if SET PASSWORD.
|
||||||
#
|
#
|
||||||
@ -3849,6 +3841,50 @@ call bug10961()|
|
|||||||
|
|
||||||
drop procedure bug10961|
|
drop procedure bug10961|
|
||||||
|
|
||||||
|
#
|
||||||
|
# BUG #6866: Second call of a stored procedure using a view with on expressions
|
||||||
|
#
|
||||||
|
|
||||||
|
--disable_warnings
|
||||||
|
DROP PROCEDURE IF EXISTS bug6866|
|
||||||
|
--enable_warnings
|
||||||
|
|
||||||
|
DROP VIEW IF EXISTS tv|
|
||||||
|
DROP TABLE IF EXISTS tt1,tt2,tt3|
|
||||||
|
|
||||||
|
CREATE TABLE tt1 (a1 int, a2 int, a3 int, data varchar(10))|
|
||||||
|
CREATE TABLE tt2 (a2 int, data2 varchar(10))|
|
||||||
|
CREATE TABLE tt3 (a3 int, data3 varchar(10))|
|
||||||
|
|
||||||
|
INSERT INTO tt1 VALUES (1, 1, 4, 'xx')|
|
||||||
|
|
||||||
|
INSERT INTO tt2 VALUES (1, 'a')|
|
||||||
|
INSERT INTO tt2 VALUES (2, 'b')|
|
||||||
|
INSERT INTO tt2 VALUES (3, 'c')|
|
||||||
|
|
||||||
|
INSERT INTO tt3 VALUES (4, 'd')|
|
||||||
|
INSERT INTO tt3 VALUES (5, 'e')|
|
||||||
|
INSERT INTO tt3 VALUES (6, 'f')|
|
||||||
|
|
||||||
|
CREATE VIEW tv AS
|
||||||
|
SELECT tt1.*, tt2.data2, tt3.data3
|
||||||
|
FROM tt1 INNER JOIN tt2 ON tt1.a2 = tt2.a2
|
||||||
|
LEFT JOIN tt3 ON tt1.a3 = tt3.a3
|
||||||
|
ORDER BY tt1.a1, tt2.a2, tt3.a3|
|
||||||
|
|
||||||
|
CREATE PROCEDURE bug6866 (_a1 int)
|
||||||
|
BEGIN
|
||||||
|
SELECT * FROM tv WHERE a1 = _a1;
|
||||||
|
END|
|
||||||
|
|
||||||
|
CALL bug6866(1)|
|
||||||
|
CALL bug6866(1)|
|
||||||
|
CALL bug6866(1)|
|
||||||
|
|
||||||
|
DROP PROCEDURE bug6866;
|
||||||
|
|
||||||
|
DROP VIEW tv|
|
||||||
|
DROP TABLE tt1, tt2, tt3|
|
||||||
|
|
||||||
#
|
#
|
||||||
# BUG#NNNN: New bug synopsis
|
# BUG#NNNN: New bug synopsis
|
||||||
|
@ -4,6 +4,10 @@
|
|||||||
|
|
||||||
-- source include/have_innodb.inc
|
-- source include/have_innodb.inc
|
||||||
|
|
||||||
|
--disable_warnings
|
||||||
|
drop table if exists t1, t2;
|
||||||
|
--enable_warnings
|
||||||
|
|
||||||
delimiter |;
|
delimiter |;
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -35,6 +39,146 @@ drop table t1|
|
|||||||
drop procedure bug8850|
|
drop procedure bug8850|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# BUG#10015: Crash in InnoDB if stored routines are used
|
||||||
|
# (crash happens in auto-commit mode)
|
||||||
|
#
|
||||||
|
--disable_warnings
|
||||||
|
drop function if exists bug10015_1|
|
||||||
|
drop function if exists bug10015_2|
|
||||||
|
drop function if exists bug10015_3|
|
||||||
|
drop function if exists bug10015_4|
|
||||||
|
drop function if exists bug10015_5|
|
||||||
|
drop function if exists bug10015_6|
|
||||||
|
drop function if exists bug10015_7|
|
||||||
|
drop procedure if exists bug10015_8|
|
||||||
|
--enable_warnings
|
||||||
|
create table t1 (id int) engine=innodb|
|
||||||
|
create table t2 (id int primary key, j int) engine=innodb|
|
||||||
|
insert into t1 values (1),(2),(3)|
|
||||||
|
create function bug10015_1() returns int return (select count(*) from t1)|
|
||||||
|
select *, bug10015_1() from t1|
|
||||||
|
drop function bug10015_1|
|
||||||
|
# Test couple of a bit more complex cases
|
||||||
|
create function bug10015_2() returns int
|
||||||
|
begin
|
||||||
|
declare i, s int;
|
||||||
|
set i:= (select min(id) from t1);
|
||||||
|
set s:= (select max(id) from t1);
|
||||||
|
return (s - i);
|
||||||
|
end|
|
||||||
|
select *, bug10015_2() from t1|
|
||||||
|
drop function bug10015_2|
|
||||||
|
create function bug10015_3() returns int
|
||||||
|
return (select max(a.id - b.id) from t1 as a, t1 as b where a.id >= b.id)|
|
||||||
|
select *, bug10015_3() from t1|
|
||||||
|
drop function bug10015_3|
|
||||||
|
create function bug10015_4(i int) returns int
|
||||||
|
begin
|
||||||
|
declare m int;
|
||||||
|
set m:= (select max(id) from t2);
|
||||||
|
insert into t2 values (i, m);
|
||||||
|
return m;
|
||||||
|
end|
|
||||||
|
select *, bug10015_4(id) from t1|
|
||||||
|
select * from t2|
|
||||||
|
drop function bug10015_4|
|
||||||
|
# Now let us test how statement rollback works
|
||||||
|
# This function will cause the whole stmt to be rolled back,
|
||||||
|
# there should not be any traces left.
|
||||||
|
create function bug10015_5(i int) returns int
|
||||||
|
begin
|
||||||
|
if (i = 5) then
|
||||||
|
insert into t2 values (1, 0);
|
||||||
|
end if;
|
||||||
|
return i;
|
||||||
|
end|
|
||||||
|
--error 1062
|
||||||
|
insert into t1 values (bug10015_5(4)), (bug10015_5(5))|
|
||||||
|
select * from t1|
|
||||||
|
drop function bug10015_5|
|
||||||
|
# Thanks to error-handler this function should not cause rollback
|
||||||
|
# of statement calling it. But insert statement in it should be
|
||||||
|
# rolled back completely and don't leave any traces in t2.
|
||||||
|
# Unfortunately we can't implement such behavior in 5.0, so it
|
||||||
|
# is something to be fixed in later 5.* releases (TODO).
|
||||||
|
create function bug10015_6(i int) returns int
|
||||||
|
begin
|
||||||
|
declare continue handler for sqlexception set @error_in_func:= 1;
|
||||||
|
if (i = 5) then
|
||||||
|
insert into t2 values (4, 0), (1, 0);
|
||||||
|
end if;
|
||||||
|
return i;
|
||||||
|
end|
|
||||||
|
set @error_in_func:= 0|
|
||||||
|
insert into t1 values (bug10015_6(5)), (bug10015_6(6))|
|
||||||
|
select @error_in_func|
|
||||||
|
select * from t1|
|
||||||
|
select * from t2|
|
||||||
|
drop function bug10015_6|
|
||||||
|
# Let us test that we don't allow any statements causing transaction
|
||||||
|
# commit in stored functions (we test only most interesting cases here).
|
||||||
|
# Cases which can be caught at creation time:
|
||||||
|
--error 1422
|
||||||
|
create function bug10015_7() returns int
|
||||||
|
begin
|
||||||
|
alter table t1 add k int;
|
||||||
|
return 1;
|
||||||
|
end|
|
||||||
|
--error 1422
|
||||||
|
create function bug10015_7() returns int
|
||||||
|
begin
|
||||||
|
start transaction;
|
||||||
|
return 1;
|
||||||
|
end|
|
||||||
|
--error 1422
|
||||||
|
create function bug10015_7() returns int
|
||||||
|
begin
|
||||||
|
drop table t1;
|
||||||
|
return 1;
|
||||||
|
end|
|
||||||
|
# It should be OK to drop temporary table.
|
||||||
|
create function bug10015_7() returns int
|
||||||
|
begin
|
||||||
|
drop temporary table t1;
|
||||||
|
return 1;
|
||||||
|
end|
|
||||||
|
drop function bug10015_7|
|
||||||
|
--error 1422
|
||||||
|
create function bug10015_7() returns int
|
||||||
|
begin
|
||||||
|
commit;
|
||||||
|
return 1;
|
||||||
|
end|
|
||||||
|
# Now let us test cases which we can catch only at run-time:
|
||||||
|
create function bug10015_7() returns int
|
||||||
|
begin
|
||||||
|
call bug10015_8();
|
||||||
|
return 1;
|
||||||
|
end|
|
||||||
|
create procedure bug10015_8() alter table t1 add k int|
|
||||||
|
--error 1422
|
||||||
|
select *, bug10015_7() from t1|
|
||||||
|
drop procedure bug10015_8|
|
||||||
|
create procedure bug10015_8() start transaction|
|
||||||
|
--error 1422
|
||||||
|
select *, bug10015_7() from t1|
|
||||||
|
drop procedure bug10015_8|
|
||||||
|
# Again it is OK to drop temporary table
|
||||||
|
# We are surpressing warnings since they are not essential
|
||||||
|
create procedure bug10015_8() drop temporary table if exists t1_temp|
|
||||||
|
--disable_warnings
|
||||||
|
select *, bug10015_7() from t1|
|
||||||
|
--enable_warnings
|
||||||
|
drop procedure bug10015_8|
|
||||||
|
create procedure bug10015_8() commit|
|
||||||
|
--error 1422
|
||||||
|
select *, bug10015_7() from t1|
|
||||||
|
drop procedure bug10015_8|
|
||||||
|
drop function bug10015_7|
|
||||||
|
drop table t1, t2|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# BUG#NNNN: New bug synopsis
|
# BUG#NNNN: New bug synopsis
|
||||||
#
|
#
|
||||||
|
@ -80,6 +80,11 @@ create table t1 ( min_num dec(6,6) default .000001);
|
|||||||
show create table t1;
|
show create table t1;
|
||||||
drop table t1 ;
|
drop table t1 ;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #10732: Set SQL_MODE to NULL gives garbled error message
|
||||||
|
#
|
||||||
|
--error 1231
|
||||||
|
set @@SQL_MODE=NULL;
|
||||||
|
|
||||||
#
|
#
|
||||||
# test for
|
# test for
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user