summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BitKeeper/etc/config2
-rw-r--r--Docs/README.1st76
-rw-r--r--VC++Files/tests/mysql_client_test.dsp16
-rw-r--r--client/Makefile.am4
-rw-r--r--client/mysqldump.c9
-rw-r--r--client/mysqltest.c5
-rw-r--r--cmd-line-utils/libedit/Makefile.am3
-rw-r--r--cmd-line-utils/libedit/chared.c4
-rw-r--r--cmd-line-utils/readline/Makefile.am3
-rw-r--r--configure.in4
-rw-r--r--dbug/Makefile.am3
-rw-r--r--extra/Makefile.am3
-rw-r--r--heap/Makefile.am3
-rw-r--r--include/my_global.h12
-rw-r--r--isam/Makefile.am3
-rw-r--r--libmysql/Makefile.am3
-rw-r--r--libmysql_r/Makefile.am5
-rw-r--r--libmysqld/Makefile.am3
-rw-r--r--libmysqld/examples/Makefile.am3
-rw-r--r--merge/Makefile.am3
-rw-r--r--myisam/Makefile.am3
-rw-r--r--myisam/mi_create.c10
-rw-r--r--myisammrg/Makefile.am3
-rw-r--r--mysql-test/Makefile.am2
-rw-r--r--mysql-test/lib/mtr_cases.pl43
-rw-r--r--mysql-test/lib/mtr_misc.pl11
-rwxr-xr-xmysql-test/mysql-test-run.pl43
-rw-r--r--mysql-test/r/ctype_utf8.result19
-rw-r--r--mysql-test/r/func_des_encrypt.result3
-rw-r--r--mysql-test/r/func_str.result18
-rw-r--r--mysql-test/r/grant.result5
-rw-r--r--mysql-test/r/lowercase_table2.result2
-rw-r--r--mysql-test/r/ndb_autodiscover.result14
-rw-r--r--mysql-test/r/ps.result97
-rw-r--r--mysql-test/r/query_cache.result87
-rw-r--r--mysql-test/r/rpl_deadlock.result2
-rw-r--r--mysql-test/r/rpl_innodb.result37
-rw-r--r--mysql-test/r/show_check.result25
-rw-r--r--mysql-test/r/sql_mode.result6
-rw-r--r--mysql-test/r/subselect.result6
-rw-r--r--mysql-test/r/variables.result4
-rw-r--r--mysql-test/std_data/loaddata_pair.dat2
-rw-r--r--mysql-test/t/ctype_utf8.test10
-rw-r--r--mysql-test/t/func_des_encrypt.test9
-rw-r--r--mysql-test/t/func_str.test14
-rw-r--r--mysql-test/t/grant.test9
-rw-r--r--mysql-test/t/lowercase_table2.test2
-rw-r--r--mysql-test/t/ndb_autodiscover.test27
-rw-r--r--mysql-test/t/ps.test98
-rw-r--r--mysql-test/t/query_cache.test44
-rw-r--r--mysql-test/t/rpl_deadlock.test2
-rw-r--r--mysql-test/t/rpl_innodb.test46
-rw-r--r--mysql-test/t/show_check.test9
-rw-r--r--mysql-test/t/subselect.test8
-rw-r--r--mysql-test/t/variables.test6
-rw-r--r--mysys/Makefile.am3
-rw-r--r--netware/Makefile.am2
-rw-r--r--regex/Makefile.am3
-rw-r--r--scripts/make_binary_distribution.sh11
-rw-r--r--scripts/make_win_src_distribution.sh3
-rw-r--r--scripts/mysql_config.sh18
-rw-r--r--sql/Makefile.am4
-rw-r--r--sql/des_key_file.cc18
-rw-r--r--sql/field_conv.cc33
-rw-r--r--sql/ha_ndbcluster.cc60
-rw-r--r--sql/ha_ndbcluster.h5
-rw-r--r--sql/item.cc40
-rw-r--r--sql/item.h1
-rw-r--r--sql/item_func.cc15
-rw-r--r--sql/item_strfunc.cc30
-rw-r--r--sql/item_subselect.h1
-rw-r--r--sql/log.cc2
-rw-r--r--sql/log_event.cc15
-rw-r--r--sql/mysql_priv.h3
-rw-r--r--sql/mysqld.cc2
-rw-r--r--sql/net_serv.cc2
-rw-r--r--sql/slave.cc2
-rw-r--r--sql/sql_acl.cc3
-rw-r--r--sql/sql_cache.cc17
-rw-r--r--sql/sql_error.cc2
-rw-r--r--sql/sql_lex.h1
-rw-r--r--sql/sql_parse.cc8
-rw-r--r--sql/sql_prepare.cc13
-rw-r--r--sql/sql_select.cc28
-rw-r--r--sql/sql_show.cc6
-rw-r--r--sql/sql_table.cc10
-rw-r--r--strings/Makefile.am3
-rw-r--r--support-files/mysql.spec.sh2
-rw-r--r--tests/Makefile.am3
-rw-r--r--tools/Makefile.am8
-rw-r--r--vio/Makefile.am3
-rw-r--r--vio/vio.c4
-rw-r--r--vio/viosocket.c4
-rw-r--r--vio/viossl.c2
-rw-r--r--zlib/inftrees.c2
95 files changed, 950 insertions, 335 deletions
diff --git a/BitKeeper/etc/config b/BitKeeper/etc/config
index c609fcdbd49..6ddd492ebc4 100644
--- a/BitKeeper/etc/config
+++ b/BitKeeper/etc/config
@@ -24,7 +24,7 @@ description: MySQL - fast and reliable SQL database
# repository is commercial it can be an internal email address or "none"
# to disable logging.
#
-logging: logging@openlogging.org
+logging: none
#
# If this field is set, all checkins will appear to be made by this user,
# in effect making this a single user package. Single user packages are
diff --git a/Docs/README.1st b/Docs/README.1st
deleted file mode 100644
index 980c043224a..00000000000
--- a/Docs/README.1st
+++ /dev/null
@@ -1,76 +0,0 @@
-This ALPHA build of MySQL 4.1 for the Windows platform does not come
-with an installer. A full-featured installer is being developed for the
-4.1 series, and it is scheduled to be released with MySQL 4.1 BETA.
-
-** FRESH INSTALL **
-
-To install MySQL 4.1 as a 'fresh' install, unzip this archive to a directory
-of your choice (we suggest 'c:\', which will cause MySQL to be installed in
-a directory named 'mysql' in 'c:\'). You should then follow the directions
-in the user manual for starting/stopping MySQL:
-
-(Windows 9x/ME) http://www.mysql.com/doc/en/Win95_start.html
-(Windows NT/2000/XP) http://www.mysql.com/doc/en/NT_start.html
-
-** UPGRADE INSTALL **
-
-To install MySQL 4.1 as an upgrade to your current version of MySQL, you need
-to perform the following steps:
-
-* Back up your original installation (always a good idea!)
-
-* Unzip the 4.1 archive to a directory that is different than where your
- current MySQL installation is located. (Or, if you do unzip this
- archive into the same location as your existing installation, do NOT
- unpack the 'data' subdirectory. If you unpack the 'data' directory,
- your existing databases will be overwritten.)
-
-* Shut down all MySQL server processes/services.
-
-* Remove the Win32 MySQL service (if appropriate for your OS):
-
- c:\mysql\bin\mysqld-nt --remove
-
-* Exit 'WinMySQLAdmin' (if it is running).
-
-* If you unzipped this archive into a directory different than that
- of your existing MySQL installation, copy from the archive all its
- directories and their contents EXCEPT the 'data' directory into the
- existing installation.
-
-* Start the MySQL server with the '--skip-grant-tables' option. Assuming
- your MySQL installation is located at 'c:\mysql', the command looks like
- this:
-
- c:\mysql\bin\mysqld-opt --skip-grant-tables
-
- If your installation is located in some other directory, adjust the
- pathname in that command (and in the following commands).
-
-* Execute the 'mysql_fix_privilege_tables.sql' script that is located in
- the 'scripts' directory:
-
- c:\mysql\bin\mysql -f mysql < c:\mysql\scripts\mysql_fix_privilege_tables.sql
-
- This script performs any actions necessary to convert your grant tables
- to the current format. You may see some "duplicate column" warnings as
- it runs; these can be ignored.
-
-* Stop the server:
-
- c:\mysql\bin\mysqladmin -u root shutdown
-
-* Re-install the Win32 MySQL service (if required):
-
- c:\mysql\bin\mysqld-nt --install
-
-* Re-start the server or service using your normal startup procedure.
-
-** Further Questions **
-
-You can find further information about running MySQL on Windows in the
-manual that ships in the 'Doc' subdirectory, or online at the MySQL AB
-web site:
-
-http://www.mysql.com/doc/en/Windows.html
-
diff --git a/VC++Files/tests/mysql_client_test.dsp b/VC++Files/tests/mysql_client_test.dsp
index 14873c8a94c..012129a208b 100644
--- a/VC++Files/tests/mysql_client_test.dsp
+++ b/VC++Files/tests/mysql_client_test.dsp
@@ -41,8 +41,8 @@ RSC=rc.exe
# PROP Output_Dir ".\Debug"
# PROP Intermediate_Dir ".\Debug"
# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /I "../include" /I "../" /Z7 /W3 /Od /G6 /D "_DEBUG" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /Fp".\Debug/mysql_client_test.pch" /Fo".\Debug/" /Fd".\Debug/" /GZ /c /GX
-# ADD CPP /nologo /MTd /I "../include" /I "../" /Z7 /W3 /Od /G6 /D "_DEBUG" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /Fp".\Debug/mysql_client_test.pch" /Fo".\Debug/" /Fd".\Debug/" /GZ /c /GX
+# ADD BASE CPP /nologo /MTd /I "../include" /I "../" /Z7 /W3 /Od /G6 /D "_DEBUG" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /Fp".\Debug/mysql_client_test.pch" /Fo".\Debug/" /Fd".\Debug/" /GZ /FD /c /GX
+# ADD CPP /nologo /MTd /I "../include" /I "../" /Z7 /W3 /Od /G6 /D "_DEBUG" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /Fp".\Debug/mysql_client_test.pch" /Fo".\Debug/" /Fd".\Debug/" /GZ /FD /c /GX
# ADD BASE MTL /nologo /tlb".\Debug\mysql_client_test.tlb" /win32
# ADD MTL /nologo /tlb".\Debug\mysql_client_test.tlb" /win32
# ADD BASE RSC /l 1033
@@ -51,8 +51,8 @@ BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib mysqlclient.lib wsock32.lib mysys.lib regex.lib /nologo /out:"..\mysql_client_test.exe" /incremental:yes /libpath:"..\lib_debug\" /debug /pdb:".\Debug\mysql_client_test.pdb" /pdbtype:sept /map:".\Debug\mysql_client_test.map" /subsystem:console
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib mysqlclient.lib wsock32.lib mysys.lib regex.lib /nologo /out:"..\mysql_client_test.exe" /incremental:yes /libpath:"..\lib_debug\" /debug /pdb:".\Debug\mysql_client_test.pdb" /pdbtype:sept /map:".\Debug\mysql_client_test.map" /subsystem:console
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib mysqlclient.lib wsock32.lib mysys.lib regex.lib /nologo /out:"..\client_debug\mysql_client_test.exe" /incremental:yes /libpath:"..\lib_debug\" /debug /pdb:".\Debug\mysql_client_test.pdb" /pdbtype:sept /map:".\Debug\mysql_client_test.map" /subsystem:console
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib mysqlclient.lib wsock32.lib mysys.lib regex.lib /nologo /out:"..\client_debug\mysql_client_test.exe" /incremental:yes /libpath:"..\lib_debug\" /debug /pdb:".\Debug\mysql_client_test.pdb" /pdbtype:sept /map:".\Debug\mysql_client_test.map" /subsystem:console
!ELSEIF "$(CFG)" == "mysql_client_test - Win32 Release"
@@ -66,8 +66,8 @@ LINK32=link.exe
# PROP Output_Dir ".\Release"
# PROP Intermediate_Dir ".\Release"
# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /I "../include" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /GF /Gy /Fp".\Release/mysql_client_test.pch" /Fo".\Release/" /Fd".\Release/" /c /GX
-# ADD CPP /nologo /MTd /I "../include" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /GF /Gy /Fp".\Release/mysql_client_test.pch" /Fo".\Release/" /Fd".\Release/" /c /GX
+# ADD BASE CPP /nologo /MTd /I "../include" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /GF /Gy /Fp".\Release/mysql_client_test.pch" /Fo".\Release/" /Fd".\Release/" /FD /c /GX
+# ADD CPP /nologo /MTd /I "../include" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /GF /Gy /Fp".\Release/mysql_client_test.pch" /Fo".\Release/" /Fd".\Release/" /FD /c /GX
# ADD BASE MTL /nologo /tlb".\Release\mysql_client_test.tlb" /win32
# ADD MTL /nologo /tlb".\Release\mysql_client_test.tlb" /win32
# ADD BASE RSC /l 1033
@@ -76,8 +76,8 @@ BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /out:"..\mysql_client_test.exe" /incremental:no /pdb:".\Release\mysql_client_test.pdb" /pdbtype:sept /subsystem:console
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /out:"..\mysql_client_test.exe" /incremental:no /pdb:".\Release\mysql_client_test.pdb" /pdbtype:sept /subsystem:console
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib mysqlclient.lib mysys.lib regex.lib /nologo /out:"..\client_release\mysql_client_test.exe" /incremental:no /libpath:"..\lib_release\" /pdb:".\Release\mysql_client_test.pdb" /pdbtype:sept /subsystem:console
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib mysqlclient.lib mysys.lib regex.lib /nologo /out:"..\client_release\mysql_client_test.exe" /incremental:no /libpath:"..\lib_release\" /pdb:".\Release\mysql_client_test.pdb" /pdbtype:sept /subsystem:console
!ENDIF
diff --git a/client/Makefile.am b/client/Makefile.am
index da13c3e9763..1e8851fb3b9 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -17,8 +17,8 @@
# This file is public domain and comes with NO WARRANTY of any kind
#AUTOMAKE_OPTIONS = nostdinc
-INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/regex \
- $(openssl_includes)
+INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
+ -I$(top_srcdir)/regex $(openssl_includes)
LIBS = @CLIENT_LIBS@
LDADD= @CLIENT_EXTRA_LDFLAGS@ \
$(top_builddir)/libmysql/libmysqlclient.la
diff --git a/client/mysqldump.c b/client/mysqldump.c
index fb5270c3222..4d340cb4051 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -2356,6 +2356,7 @@ static int do_show_master_status(MYSQL *mysql_con)
row = mysql_fetch_row(master);
if (row && row[0] && row[1])
{
+ /* SHOW MASTER STATUS reports file and position */
if (opt_comments)
fprintf(md_result_file,
"\n--\n-- Position to start replication or point-in-time "
@@ -2365,6 +2366,14 @@ static int do_show_master_status(MYSQL *mysql_con)
comment_prefix, row[0], row[1]);
check_io(md_result_file);
}
+ else if (!ignore_errors)
+ {
+ /* SHOW MASTER STATUS reports nothing and --force is not enabled */
+ my_printf_error(0, "Error: Binlogging on server not active",
+ MYF(0), mysql_error(mysql_con));
+ mysql_free_result(master);
+ return 1;
+ }
mysql_free_result(master);
}
return 0;
diff --git a/client/mysqltest.c b/client/mysqltest.c
index 87c34591b89..b7f4ceb9c20 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -60,7 +60,12 @@
#include <sys/stat.h>
#include <violite.h>
#include <regex.h> /* Our own version of lib */
+#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
+#endif
+#ifndef WEXITSTATUS
+# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
+#endif
#define MAX_QUERY 131072
#define MAX_VAR_NAME 256
#define MAX_COLUMNS 256
diff --git a/cmd-line-utils/libedit/Makefile.am b/cmd-line-utils/libedit/Makefile.am
index 03f3eb65fbc..af1bf8b2c97 100644
--- a/cmd-line-utils/libedit/Makefile.am
+++ b/cmd-line-utils/libedit/Makefile.am
@@ -5,7 +5,8 @@
ASRC=vi.c emacs.c common.c
AHDR=vi.h emacs.h common.h
-INCLUDES = -I$(top_srcdir)/include -I$(srcdir)/../.. -I..
+INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
+ -I$(srcdir)/../.. -I..
noinst_LIBRARIES = libedit.a
diff --git a/cmd-line-utils/libedit/chared.c b/cmd-line-utils/libedit/chared.c
index 21fc8bc2c1d..4cb6e00d26e 100644
--- a/cmd-line-utils/libedit/chared.c
+++ b/cmd-line-utils/libedit/chared.c
@@ -51,13 +51,13 @@ cv_undo(EditLine *el)
{
c_undo_t *vu = &el->el_chared.c_undo;
c_redo_t *r = &el->el_chared.c_redo;
- uint size;
+ int size;
/* Save entire line for undo */
size = el->el_line.lastchar - el->el_line.buffer;
vu->len = size;
vu->cursor = el->el_line.cursor - el->el_line.buffer;
- memcpy(vu->buf, el->el_line.buffer, size);
+ memcpy(vu->buf, el->el_line.buffer, (size_t)size);
/* save command info for redo */
r->count = el->el_state.doingarg ? el->el_state.argument : 0;
diff --git a/cmd-line-utils/readline/Makefile.am b/cmd-line-utils/readline/Makefile.am
index 87880517166..14d25ff62c0 100644
--- a/cmd-line-utils/readline/Makefile.am
+++ b/cmd-line-utils/readline/Makefile.am
@@ -3,7 +3,8 @@
# Copyright (C) 1994,1996,1997 Free Software Foundation, Inc.
# Last -I$(top_srcdir) needed for RedHat!
-INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)
+INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
+ -I$(top_srcdir)
noinst_LIBRARIES = libreadline.a
diff --git a/configure.in b/configure.in
index 0889e9a3257..af7ce8b1c3d 100644
--- a/configure.in
+++ b/configure.in
@@ -5,7 +5,7 @@ AC_INIT(sql/mysqld.cc)
AC_CANONICAL_SYSTEM
# The Docs Makefile.am parses this line!
# remember to also change ndb version below and update version.c in ndb
-AM_INIT_AUTOMAKE(mysql, 4.1.13)
+AM_INIT_AUTOMAKE(mysql, 4.1.14)
AM_CONFIG_HEADER(config.h)
PROTOCOL_VERSION=10
@@ -16,7 +16,7 @@ SHARED_LIB_VERSION=14:0:0
# ndb version
NDB_VERSION_MAJOR=4
NDB_VERSION_MINOR=1
-NDB_VERSION_BUILD=13
+NDB_VERSION_BUILD=14
NDB_VERSION_STATUS=""
# Set all version vars based on $VERSION. How do we do this more elegant ?
diff --git a/dbug/Makefile.am b/dbug/Makefile.am
index bd512ee1d1d..3ddb5bc17e1 100644
--- a/dbug/Makefile.am
+++ b/dbug/Makefile.am
@@ -15,7 +15,8 @@
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA
-INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include
+INCLUDES = @MT_INCLUDES@ \
+ -I$(top_builddir)/include -I$(top_srcdir)/include
LDADD = libdbug.a ../strings/libmystrings.a
pkglib_LIBRARIES = libdbug.a
noinst_HEADERS = dbug_long.h
diff --git a/extra/Makefile.am b/extra/Makefile.am
index aec7ad7dda5..467f426f1a5 100644
--- a/extra/Makefile.am
+++ b/extra/Makefile.am
@@ -14,7 +14,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include \
+INCLUDES = @MT_INCLUDES@ \
+ -I$(top_builddir)/include -I$(top_srcdir)/include \
@ndbcluster_includes@ -I$(top_srcdir)/sql
LDADD = @CLIENT_EXTRA_LDFLAGS@ ../mysys/libmysys.a \
../dbug/libdbug.a ../strings/libmystrings.a
diff --git a/heap/Makefile.am b/heap/Makefile.am
index ec631148dce..9ce09757802 100644
--- a/heap/Makefile.am
+++ b/heap/Makefile.am
@@ -14,7 +14,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include
+INCLUDES = @MT_INCLUDES@ \
+ -I$(top_builddir)/include -I$(top_srcdir)/include
LDADD = libheap.a ../mysys/libmysys.a ../dbug/libdbug.a \
../strings/libmystrings.a
pkglib_LIBRARIES = libheap.a
diff --git a/include/my_global.h b/include/my_global.h
index 9b53be66db0..eab6050d2dc 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -318,6 +318,11 @@ C_MODE_END
#undef HAVE_FINITE
#undef LONGLONG_MIN /* These get wrongly defined in QNX 6.2 */
#undef LONGLONG_MAX /* standard system library 'limits.h' */
+#ifdef __cplusplus
+#define HAVE_RINT /* rint() and isnan() functions are not */
+#define rint(a) std::rint(a) /* visible in C++ scope due to an error */
+#define isnan(a) std::isnan(a) /* in the usr/include/math.h on QNX */
+#endif
#endif
/* We can not live without the following defines */
@@ -370,10 +375,7 @@ int __void__;
#endif
/* Define some useful general macros */
-#if defined(__cplusplus) && defined(__GNUC__)
-#define max(a, b) ((a) >? (b))
-#define min(a, b) ((a) <? (b))
-#elif !defined(max)
+#if !defined(max)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#endif
@@ -795,7 +797,7 @@ typedef off_t os_off_t;
#define socket_errno WSAGetLastError()
#define SOCKET_EINTR WSAEINTR
#define SOCKET_EAGAIN WSAEINPROGRESS
-#define SOCKET_EWOULDBLOCK WSAEINPROGRESS
+#define SOCKET_EWOULDBLOCK WSAEWOULDBLOCK
#define SOCKET_ENFILE ENFILE
#define SOCKET_EMFILE EMFILE
#elif defined(OS2)
diff --git a/isam/Makefile.am b/isam/Makefile.am
index 6d9e4176d43..335346d2423 100644
--- a/isam/Makefile.am
+++ b/isam/Makefile.am
@@ -14,7 +14,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include
+INCLUDES = @MT_INCLUDES@ \
+ -I$(top_builddir)/include -I$(top_srcdir)/include
LDADD = @CLIENT_EXTRA_LDFLAGS@ libnisam.a ../mysys/libmysys.a \
../dbug/libdbug.a ../strings/libmystrings.a
pkglib_LIBRARIES = libnisam.a
diff --git a/libmysql/Makefile.am b/libmysql/Makefile.am
index 72ff44ecef3..4bd9eddafb0 100644
--- a/libmysql/Makefile.am
+++ b/libmysql/Makefile.am
@@ -23,7 +23,8 @@
target = libmysqlclient.la
target_defs = -DUNDEF_THREADS_HACK -DDONT_USE_RAID @LIB_EXTRA_CCFLAGS@
LIBS = @CLIENT_LIBS@
-INCLUDES = -I$(top_srcdir)/include $(openssl_includes) @ZLIB_INCLUDES@
+INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
+ $(openssl_includes) @ZLIB_INCLUDES@
include $(srcdir)/Makefile.shared
diff --git a/libmysql_r/Makefile.am b/libmysql_r/Makefile.am
index 0a5c380ff35..a76ef675189 100644
--- a/libmysql_r/Makefile.am
+++ b/libmysql_r/Makefile.am
@@ -24,8 +24,9 @@ target = libmysqlclient_r.la
target_defs = -DDONT_USE_RAID -DMYSQL_CLIENT @LIB_EXTRA_CCFLAGS@
LIBS = @LIBS@ @ZLIB_LIBS@ @openssl_libs@
-INCLUDES = @MT_INCLUDES@ \
- -I$(top_srcdir)/include $(openssl_includes) @ZLIB_INCLUDES@
+INCLUDES = @MT_INCLUDES@ \
+ -I$(top_builddir)/include -I$(top_srcdir)/include \
+ $(openssl_includes) @ZLIB_INCLUDES@
## automake barfs if you don't use $(srcdir) or $(top_srcdir) in include
include $(top_srcdir)/libmysql/Makefile.shared
diff --git a/libmysqld/Makefile.am b/libmysqld/Makefile.am
index f578e87ae4a..f4e9d4e6b39 100644
--- a/libmysqld/Makefile.am
+++ b/libmysqld/Makefile.am
@@ -25,7 +25,8 @@ DEFS = -DEMBEDDED_LIBRARY -DMYSQL_SERVER \
-DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \
-DDATADIR="\"$(MYSQLDATAdir)\"" \
-DSHAREDIR="\"$(MYSQLSHAREdir)\""
-INCLUDES= @MT_INCLUDES@ @bdb_includes@ -I$(top_srcdir)/include \
+INCLUDES= @MT_INCLUDES@ @bdb_includes@ \
+ -I$(top_builddir)/include -I$(top_srcdir)/include \
-I$(top_srcdir)/sql -I$(top_srcdir)/sql/examples -I$(top_srcdir)/regex \
$(openssl_includes) @ZLIB_INCLUDES@
diff --git a/libmysqld/examples/Makefile.am b/libmysqld/examples/Makefile.am
index 278aa66b328..d19023c100f 100644
--- a/libmysqld/examples/Makefile.am
+++ b/libmysqld/examples/Makefile.am
@@ -30,7 +30,8 @@ link_sources:
done;
DEFS = -DEMBEDDED_LIBRARY
-INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include -I$(srcdir) \
+INCLUDES = @MT_INCLUDES@ \
+ -I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir) \
-I$(top_srcdir) -I$(top_srcdir)/client -I$(top_srcdir)/regex \
$(openssl_includes)
LIBS = @LIBS@ @WRAPLIBS@ @CLIENT_LIBS@
diff --git a/merge/Makefile.am b/merge/Makefile.am
index 25e15e9c6ec..080e5e61747 100644
--- a/merge/Makefile.am
+++ b/merge/Makefile.am
@@ -14,7 +14,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include
+INCLUDES = @MT_INCLUDES@ \
+ -I$(top_builddir)/include -I$(top_srcdir)/include
pkglib_LIBRARIES = libmerge.a
noinst_HEADERS = mrg_def.h
libmerge_a_SOURCES = mrg_open.c mrg_extra.c mrg_info.c mrg_locking.c \
diff --git a/myisam/Makefile.am b/myisam/Makefile.am
index 0b8a25e3404..6f304c8143d 100644
--- a/myisam/Makefile.am
+++ b/myisam/Makefile.am
@@ -17,7 +17,8 @@
EXTRA_DIST = mi_test_all.sh mi_test_all.res
pkgdata_DATA = mi_test_all mi_test_all.res
-INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include
+INCLUDES = @MT_INCLUDES@ \
+ -I$(top_builddir)/include -I$(top_srcdir)/include
LDADD = @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
$(top_builddir)/mysys/libmysys.a \
$(top_builddir)/dbug/libdbug.a \
diff --git a/myisam/mi_create.c b/myisam/mi_create.c
index d363f3d5b67..890ee61fd7f 100644
--- a/myisam/mi_create.c
+++ b/myisam/mi_create.c
@@ -194,11 +194,10 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
test(test_all_bits(options, HA_OPTION_CHECKSUM | HA_PACK_RECORD));
min_pack_length+=packed;
- if (!ci->data_file_length)
+ if (!ci->data_file_length && ci->max_rows)
{
- if (ci->max_rows == 0 || pack_reclength == INT_MAX32)
- ci->data_file_length= INT_MAX32-1; /* Should be enough */
- else if ((~(ulonglong) 0)/ci->max_rows < (ulonglong) pack_reclength)
+ if (pack_reclength == INT_MAX32 ||
+ (~(ulonglong) 0)/ci->max_rows < (ulonglong) pack_reclength)
ci->data_file_length= ~(ulonglong) 0;
else
ci->data_file_length=(ulonglong) ci->max_rows*pack_reclength;
@@ -724,10 +723,13 @@ err:
uint mi_get_pointer_length(ulonglong file_length, uint def)
{
+ DBUG_ASSERT(def >= 2 && def <= 7);
if (file_length) /* If not default */
{
+#ifdef NOT_YET_READY_FOR_8_BYTE_POINTERS
if (file_length >= (longlong) 1 << 56)
def=8;
+#endif
if (file_length >= (longlong) 1 << 48)
def=7;
if (file_length >= (longlong) 1 << 40)
diff --git a/myisammrg/Makefile.am b/myisammrg/Makefile.am
index b5b1260385b..3cd8cfdedea 100644
--- a/myisammrg/Makefile.am
+++ b/myisammrg/Makefile.am
@@ -14,7 +14,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include
+INCLUDES = @MT_INCLUDES@ \
+ -I$(top_builddir)/include -I$(top_srcdir)/include
pkglib_LIBRARIES = libmyisammrg.a
noinst_HEADERS = myrg_def.h
libmyisammrg_a_SOURCES = myrg_open.c myrg_extra.c myrg_info.c myrg_locking.c \
diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am
index 0c27edb02e7..e7abcd3fc95 100644
--- a/mysql-test/Makefile.am
+++ b/mysql-test/Makefile.am
@@ -39,7 +39,7 @@ 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)
-INCLUDES = -I$(srcdir)/../include -I../include -I..
+INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I..
EXTRA_PROGRAMS = mysql_test_run_new
noinst_HEADERS = my_manage.h
mysql_test_run_new_SOURCES= mysql_test_run_new.c my_manage.c my_create_tables.c
diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pl
index 72cbe72bc0a..12714ddc1ad 100644
--- a/mysql-test/lib/mtr_cases.pl
+++ b/mysql-test/lib/mtr_cases.pl
@@ -8,7 +8,7 @@ use File::Basename;
use strict;
sub collect_test_cases ($);
-sub collect_one_test_case ($$$$$);
+sub collect_one_test_case ($$$$$$);
##############################################################################
#
@@ -46,18 +46,36 @@ sub collect_test_cases ($) {
{
mtr_error("Test case $tname ($testdir/$elem) is not found");
}
- collect_one_test_case($testdir,$resdir,$tname,$elem,$cases);
+ collect_one_test_case($testdir,$resdir,$tname,$elem,$cases,{});
}
closedir TESTDIR;
}
else
{
+ # ----------------------------------------------------------------------
+ # Skip some tests listed in disabled.def
+ # ----------------------------------------------------------------------
+ my %skiplist;
+ my $skipfile= "$testdir/disabled.def";
+ if ( open(SKIPFILE, $skipfile) )
+ {
+ while ( <SKIPFILE> )
+ {
+ chomp;
+ if ( /^\s*(\S+)\s*:\s*(.*?)\s*$/ )
+ {
+ $skiplist{$1}= $2;
+ }
+ }
+ close SKIPFILE;
+ }
+
foreach my $elem ( sort readdir(TESTDIR) ) {
my $tname= mtr_match_extension($elem,"test");
next if ! defined $tname;
next if $::opt_do_test and ! defined mtr_match_prefix($elem,$::opt_do_test);
- collect_one_test_case($testdir,$resdir,$tname,$elem,$cases);
+ collect_one_test_case($testdir,$resdir,$tname,$elem,$cases,\%skiplist);
}
closedir TESTDIR;
}
@@ -95,12 +113,13 @@ sub collect_test_cases ($) {
##############################################################################
-sub collect_one_test_case($$$$$) {
+sub collect_one_test_case($$$$$$) {
my $testdir= shift;
my $resdir= shift;
my $tname= shift;
my $elem= shift;
my $cases= shift;
+ my $skiplist=shift;
my $path= "$testdir/$elem";
@@ -154,6 +173,14 @@ sub collect_one_test_case($$$$$) {
}
}
+ if ( defined mtr_match_prefix($tname,"federated") )
+ {
+ $tinfo->{'slave_num'}= 1; # Default, use one slave
+
+ # FIXME currently we always restart slaves
+ $tinfo->{'slave_restart'}= 1;
+ }
+
# FIXME what about embedded_server + ndbcluster, skip ?!
my $master_opt_file= "$testdir/$tname-master.opt";
@@ -264,6 +291,14 @@ sub collect_one_test_case($$$$$) {
}
}
+ # FIXME why this late?
+ if ( $skiplist->{$tname} )
+ {
+ $tinfo->{'skip'}= 1;
+ $tinfo->{'disable'}= 1; # Sub type of 'skip'
+ $tinfo->{'comment'}= $skiplist->{$tname} if $skiplist->{$tname};
+ }
+
if ( -f $disabled )
{
$tinfo->{'skip'}= 1;
diff --git a/mysql-test/lib/mtr_misc.pl b/mysql-test/lib/mtr_misc.pl
index aba6f78c9de..c1aab340a16 100644
--- a/mysql-test/lib/mtr_misc.pl
+++ b/mysql-test/lib/mtr_misc.pl
@@ -83,18 +83,19 @@ sub mtr_script_exists (@) {
}
sub mtr_exe_exists (@) {
- foreach my $path ( @_ )
+ my @path= @_;
+ map {$_.= ".exe"} @path if $::glob_win32;
+ foreach my $path ( @path )
{
- $path.= ".exe" if $::opt_win32;
return $path if -x $path;
}
- if ( @_ == 1 )
+ if ( @path == 1 )
{
- mtr_error("Could not find $_[0]");
+ mtr_error("Could not find $path[0]");
}
else
{
- mtr_error("Could not find any of " . join(" ", @_));
+ mtr_error("Could not find any of " . join(" ", @path));
}
}
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 1a31bbee1d5..4272c05f7dc 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -419,7 +419,8 @@ sub initial_setup () {
{
# Windows programs like 'mysqld' needs Windows paths
$glob_mysql_test_dir= `cygpath -m $glob_mysql_test_dir`;
- $glob_cygwin_shell= `cygpath -w $ENV{'SHELL'}`; # The Windows path c:\...
+ my $shell= $ENV{'SHELL'} || "/bin/bash";
+ $glob_cygwin_shell= `cygpath -w $shell`; # The Windows path c:\...
chomp($glob_mysql_test_dir);
chomp($glob_cygwin_shell);
}
@@ -791,13 +792,15 @@ sub executable_setup () {
my $path_examples= "$glob_basedir/libmysqld/examples";
$exe_mysqltest= mtr_exe_exists("$path_examples/mysqltest");
$exe_mysql_client_test=
- mtr_exe_exists("$path_examples/mysql_client_test_embedded");
+ mtr_exe_exists("$path_examples/mysql_client_test_embedded",
+ "/usr/bin/false");
}
else
{
$exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest");
$exe_mysql_client_test=
- mtr_exe_exists("$glob_basedir/tests/mysql_client_test");
+ mtr_exe_exists("$glob_basedir/tests/mysql_client_test",
+ "/usr/bin/false");
}
$exe_mysqldump= mtr_exe_exists("$path_client_bindir/mysqldump");
$exe_mysqlshow= mtr_exe_exists("$path_client_bindir/mysqlshow");
@@ -819,7 +822,8 @@ sub executable_setup () {
$exe_mysqladmin= mtr_exe_exists("$path_client_bindir/mysqladmin");
$exe_mysql= mtr_exe_exists("$path_client_bindir/mysql");
$exe_mysql_fix_system_tables=
- mtr_script_exists("$path_client_bindir/mysql_fix_privilege_tables");
+ mtr_script_exists("$path_client_bindir/mysql_fix_privilege_tables",
+ "$glob_basedir/scripts/mysql_fix_privilege_tables");
$path_language= mtr_path_exists("$glob_basedir/share/mysql/english/",
"$glob_basedir/share/english/");
@@ -833,13 +837,15 @@ sub executable_setup () {
$exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest_embedded");
$exe_mysql_client_test=
mtr_exe_exists("$glob_basedir/tests/mysql_client_test_embedded",
- "$path_client_bindir/mysql_client_test_embedded");
+ "$path_client_bindir/mysql_client_test_embedded",
+ "/usr/bin/false");
}
else
{
$exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest");
$exe_mysql_client_test=
- mtr_exe_exists("$path_client_bindir/mysql_client_test");
+ mtr_exe_exists("$path_client_bindir/mysql_client_test",
+ "/usr/bin/false"); # FIXME temporary
}
$path_ndb_tools_dir= "$glob_basedir/bin";
@@ -1551,17 +1557,17 @@ sub do_before_start_master ($$) {
$tname ne "rpl_crash_binlog_ib_3b")
{
# FIXME we really want separate dir for binlogs
- foreach my $bin ( glob("$opt_vardir/log/master*-bin.*") )
+ foreach my $bin ( glob("$opt_vardir/log/master*-bin*") )
{
unlink($bin);
}
}
# Remove old master.info and relay-log.info files
- unlink("$opt_vardir/master-data/master.info");
- unlink("$opt_vardir/master-data/relay-log.info");
- unlink("$opt_vardir/master1-data/master.info");
- unlink("$opt_vardir/master1-data/relay-log.info");
+ unlink("$master->[0]->{'path_myddir'}/master.info");
+ unlink("$master->[0]->{'path_myddir'}/relay-log.info");
+ unlink("$master->[1]->{'path_myddir'}/master.info");
+ unlink("$master->[1]->{'path_myddir'}/relay-log.info");
# Run master initialization shell script if one exists
if ( $init_script )
@@ -1588,13 +1594,13 @@ sub do_before_start_slave ($$) {
$tname ne "rpl_crash_binlog_ib_3b" )
{
# FIXME we really want separate dir for binlogs
- foreach my $bin ( glob("$opt_vardir/log/slave*-bin.*") )
+ foreach my $bin ( glob("$opt_vardir/log/slave*-bin*") )
{
unlink($bin);
}
# FIXME really master?!
- unlink("$opt_vardir/slave-data/master.info");
- unlink("$opt_vardir/slave-data/relay-log.info");
+ unlink("$slave->[0]->{'path_myddir'}/master.info");
+ unlink("$slave->[0]->{'path_myddir'}/relay-log.info");
}
# Run slave initialization shell script if one exists
@@ -1608,8 +1614,10 @@ sub do_before_start_slave ($$) {
}
}
- `rm -f $opt_vardir/slave-data/log.*`;
-# unlink("$opt_vardir/slave-data/log.*");
+ foreach my $bin ( glob("$slave->[0]->{'path_myddir'}/log.*") )
+ {
+ unlink($bin);
+ }
}
sub mysqld_arguments ($$$$$) {
@@ -1655,7 +1663,8 @@ sub mysqld_arguments ($$$$$) {
if ( $type eq 'master' )
{
- mtr_add_arg($args, "%s--log-bin=%s/log/master-bin", $prefix, $opt_vardir);
+ mtr_add_arg($args, "%s--log-bin=%s/log/master-bin%s", $prefix,
+ $opt_vardir, $sidx);
mtr_add_arg($args, "%s--pid-file=%s", $prefix,
$master->[$idx]->{'path_mypid'});
mtr_add_arg($args, "%s--port=%d", $prefix,
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
index 290d6d93421..150c06840c6 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -412,7 +412,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c` char(10) character set utf8 default NULL,
- UNIQUE KEY `a` TYPE HASH (`c`(1))
+ UNIQUE KEY `a` USING HASH (`c`(1))
) ENGINE=HEAP DEFAULT CHARSET=latin1
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
insert into t1 values ('aa');
@@ -448,7 +448,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c` char(10) character set utf8 default NULL,
- UNIQUE KEY `a` TYPE BTREE (`c`(1))
+ UNIQUE KEY `a` USING BTREE (`c`(1))
) ENGINE=HEAP DEFAULT CHARSET=latin1
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
insert into t1 values ('aa');
@@ -570,7 +570,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c` char(10) character set utf8 collate utf8_bin default NULL,
- UNIQUE KEY `a` TYPE HASH (`c`(1))
+ UNIQUE KEY `a` USING HASH (`c`(1))
) ENGINE=HEAP DEFAULT CHARSET=latin1
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
insert into t1 values ('aa');
@@ -606,7 +606,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c` char(10) character set utf8 collate utf8_bin default NULL,
- UNIQUE KEY `a` TYPE BTREE (`c`(1))
+ UNIQUE KEY `a` USING BTREE (`c`(1))
) ENGINE=HEAP DEFAULT CHARSET=latin1
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
insert into t1 values ('aa');
@@ -943,6 +943,17 @@ content msisdn
ERR Имри.Ðфимим.Ðеимимримдмримрмрирор имримримримр имридм ирбднримрфмририримрфмфмим.Ðд.Д имдимримрад.Ðдимримримрмдиримримримр м.Дадимфшьмримд им.Ðдимимрн имадми 1234567890
11 g 1234567890
DROP TABLE t1,t2;
+create table t1 (a char(20) character set utf8);
+insert into t1 values ('123456'),('андрей');
+alter table t1 modify a char(2) character set utf8;
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+Warning 1265 Data truncated for column 'a' at row 2
+select char_length(a), length(a), a from t1 order by a;
+char_length(a) length(a) a
+2 2 12
+2 4 ан
+drop table t1;
CREATE TABLE t1 (
a varchar(255) NOT NULL default '',
KEY a (a)
diff --git a/mysql-test/r/func_des_encrypt.result b/mysql-test/r/func_des_encrypt.result
new file mode 100644
index 00000000000..46b30bdab58
--- /dev/null
+++ b/mysql-test/r/func_des_encrypt.result
@@ -0,0 +1,3 @@
+select des_encrypt('hello');
+des_encrypt('hello')
+€Ö2nV“Ø}
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index cbedf4370ff..18a04574596 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -850,3 +850,21 @@ trackname artistname
April In Paris Vernon Duke Vernon Duke
Autumn In New York NULL
DROP TABLE t1,t2,t3;
+create table t1 (b varchar(5));
+insert t1 values ('ab'), ('abc'), ('abcd'), ('abcde');
+select *,substring(b,1),substring(b,-1),substring(b,-2),substring(b,-3),substring(b,-4),substring(b,-5) from t1;
+b substring(b,1) substring(b,-1) substring(b,-2) substring(b,-3) substring(b,-4) substring(b,-5)
+ab ab b ab
+abc abc c bc abc
+abcd abcd d cd bcd abcd
+abcde abcde e de cde bcde abcde
+select * from (select *,substring(b,1),substring(b,-1),substring(b,-2),substring(b,-3),substring(b,-4),substring(b,-5) from t1) t;
+b substring(b,1) substring(b,-1) substring(b,-2) substring(b,-3) substring(b,-4) substring(b,-5)
+ab ab b ab
+abc abc c bc abc
+abcd abcd d cd bcd abcd
+abcde abcde e de cde bcde abcde
+drop table t1;
+select hex(29223372036854775809), hex(-29223372036854775809);
+hex(29223372036854775809) hex(-29223372036854775809)
+FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result
index bb37480aaf8..e9e1d4cd620 100644
--- a/mysql-test/r/grant.result
+++ b/mysql-test/r/grant.result
@@ -435,3 +435,8 @@ ERROR 42000: INSERT,CREATE command denied to user 'mysqltest_1'@'localhost' for
revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
delete from mysql.user where user=_binary'mysqltest_1';
drop database mysqltest;
+use mysql;
+insert into tables_priv values ('','test_db','mysqltest_1','test_table','test_grantor',CURRENT_TIMESTAMP,'Select','Select');
+flush privileges;
+delete from tables_priv where host = '' and user = 'mysqltest_1';
+flush privileges;
diff --git a/mysql-test/r/lowercase_table2.result b/mysql-test/r/lowercase_table2.result
index f93a10dfbad..44235cbf900 100644
--- a/mysql-test/r/lowercase_table2.result
+++ b/mysql-test/r/lowercase_table2.result
@@ -1,7 +1,7 @@
DROP TABLE IF EXISTS t1,t2,t3,t2aA,t1Aa;
DROP DATABASE IF EXISTS `TEST_$1`;
DROP DATABASE IF EXISTS `test_$1`;
-DROP DATABASE mysqltest_LC2;
+DROP DATABASE IF EXISTS mysqltest_LC2;
CREATE TABLE T1 (a int);
INSERT INTO T1 VALUES (1);
SHOW TABLES LIKE "T1";
diff --git a/mysql-test/r/ndb_autodiscover.result b/mysql-test/r/ndb_autodiscover.result
index b278d6eb048..5a1a82832fa 100644
--- a/mysql-test/r/ndb_autodiscover.result
+++ b/mysql-test/r/ndb_autodiscover.result
@@ -358,20 +358,6 @@ Database
mysql
test
use test;
-CREATE TABLE sys.SYSTAB_0 (a int);
-ERROR 42S01: Table 'SYSTAB_0' already exists
-select * from sys.SYSTAB_0;
-ERROR HY000: Failed to open 'SYSTAB_0', error while unpacking from engine
-CREATE TABLE IF NOT EXISTS sys.SYSTAB_0 (a int);
-show warnings;
-Level Code Message
-select * from sys.SYSTAB_0;
-ERROR HY000: Failed to open 'SYSTAB_0', error while unpacking from engine
-drop table sys.SYSTAB_0;
-ERROR 42S02: Unknown table 'SYSTAB_0'
-drop table IF EXISTS sys.SYSTAB_0;
-Warnings:
-Note 1051 Unknown table 'SYSTAB_0'
CREATE TABLE t9 (
a int NOT NULL PRIMARY KEY,
b int
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index ca38f1c75cb..ee558e0ea89 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -563,3 +563,100 @@ execute stmt;
execute stmt;
deallocate prepare stmt;
drop table t1;
+create table t1 (
+id int(11) unsigned not null primary key auto_increment,
+partner_id varchar(35) not null,
+t1_status_id int(10) unsigned
+);
+insert into t1 values ("1", "partner1", "10"), ("2", "partner2", "10"),
+("3", "partner3", "10"), ("4", "partner4", "10");
+create table t2 (
+id int(11) unsigned not null default '0',
+t1_line_id int(11) unsigned not null default '0',
+article_id varchar(20),
+sequence int(11) not null default '0',
+primary key (id,t1_line_id)
+);
+insert into t2 values ("1", "1", "sup", "0"), ("2", "1", "sup", "1"),
+("2", "2", "sup", "2"), ("2", "3", "sup", "3"),
+("2", "4", "imp", "4"), ("3", "1", "sup", "0"),
+("4", "1", "sup", "0");
+create table t3 (
+id int(11) not null default '0',
+preceeding_id int(11) not null default '0',
+primary key (id,preceeding_id)
+);
+create table t4 (
+user_id varchar(50) not null,
+article_id varchar(20) not null,
+primary key (user_id,article_id)
+);
+insert into t4 values("nicke", "imp");
+prepare stmt from
+'select distinct t1.partner_id
+from t1 left join t3 on t1.id = t3.id
+ left join t1 pp on pp.id = t3.preceeding_id
+where
+ exists (
+ select *
+ from t2 as pl_inner
+ where pl_inner.id = t1.id
+ and pl_inner.sequence <= (
+ select min(sequence) from t2 pl_seqnr
+ where pl_seqnr.id = t1.id
+ )
+ and exists (
+ select * from t4
+ where t4.article_id = pl_inner.article_id
+ and t4.user_id = ?
+ )
+ )
+ and t1.id = ?
+group by t1.id
+having count(pp.id) = 0';
+set @user_id = 'nicke';
+set @id = '2';
+execute stmt using @user_id, @id;
+partner_id
+execute stmt using @user_id, @id;
+partner_id
+deallocate prepare stmt;
+drop table t1, t2, t3, t4;
+prepare stmt from 'select ?=?';
+set @a='CHRISTINE ';
+set @b='CHRISTINE';
+execute stmt using @a, @b;
+?=?
+1
+execute stmt using @a, @b;
+?=?
+1
+set @a=1, @b=2;
+execute stmt using @a, @b;
+?=?
+0
+set @a='CHRISTINE ';
+set @b='CHRISTINE';
+execute stmt using @a, @b;
+?=?
+1
+deallocate prepare stmt;
+create table t1 (utext varchar(20) character set ucs2);
+insert into t1 values ("lily");
+insert into t1 values ("river");
+prepare stmt from 'select utext from t1 where utext like ?';
+set @param1='%%';
+execute stmt using @param1;
+utext
+lily
+river
+execute stmt using @param1;
+utext
+lily
+river
+select utext from t1 where utext like '%%';
+utext
+lily
+river
+drop table t1;
+deallocate prepare stmt;
diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result
index 55f9bc6c224..2884b9b3fe4 100644
--- a/mysql-test/r/query_cache.result
+++ b/mysql-test/r/query_cache.result
@@ -971,4 +971,91 @@ abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzab
zyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcba
flush query cache;
drop table t1, t2;
+flush status;
+CREATE TABLE t1 (
+`date` datetime NOT NULL default '0000-00-00 00:00:00',
+KEY `date` (`date`)
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('20050326');
+INSERT INTO t1 VALUES ('20050325');
+SELECT COUNT(*) FROM t1 WHERE date BETWEEN '20050326' AND '20050327 0:0:0';
+COUNT(*)
+0
+Warnings:
+Warning 1292 Truncated incorrect datetime value: '20050327 0:0:0'
+Warning 1292 Truncated incorrect datetime value: '20050327 0:0:0'
+SELECT COUNT(*) FROM t1 WHERE date BETWEEN '20050326' AND '20050328 0:0:0';
+COUNT(*)
+0
+Warnings:
+Warning 1292 Truncated incorrect datetime value: '20050328 0:0:0'
+Warning 1292 Truncated incorrect datetime value: '20050328 0:0:0'
+SELECT COUNT(*) FROM t1 WHERE date BETWEEN '20050326' AND '20050327 0:0:0';
+COUNT(*)
+0
+Warnings:
+Warning 1292 Truncated incorrect datetime value: '20050327 0:0:0'
+Warning 1292 Truncated incorrect datetime value: '20050327 0:0:0'
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 0
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 0
+drop table t1;
+create table t1 (a int);
+insert into t1 values (1);
+reset query cache;
+flush status;
+select * from (select * from t1) a;
+a
+1
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 0
+select * from (select * from t1) a;
+a
+1
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 1
+insert into t1 values (2);
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 1
+select * from (select * from t1) a;
+a
+1
+2
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 2
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 1
+drop table t1;
set GLOBAL query_cache_size=0;
diff --git a/mysql-test/r/rpl_deadlock.result b/mysql-test/r/rpl_deadlock.result
index 8808a973855..8eb9d64fcae 100644
--- a/mysql-test/r/rpl_deadlock.result
+++ b/mysql-test/r/rpl_deadlock.result
@@ -84,4 +84,4 @@ a
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 13110 # # master-bin.000001 Yes Yes 0 0 13110 # None 0 No #
-drop table t1,t2;
+drop table t1,t2,t3,t4;
diff --git a/mysql-test/r/rpl_innodb.result b/mysql-test/r/rpl_innodb.result
new file mode 100644
index 00000000000..ebf1d79c4d0
--- /dev/null
+++ b/mysql-test/r/rpl_innodb.result
@@ -0,0 +1,37 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t4 (
+id INT(5) unsigned NOT NULL auto_increment,
+name varchar(15) NOT NULL default '',
+number varchar(35) NOT NULL default 'default',
+PRIMARY KEY (id),
+UNIQUE KEY unique_rec (name,number)
+) ENGINE=InnoDB;
+LOAD DATA
+INFILE '../../std_data/loaddata_pair.dat'
+REPLACE INTO TABLE t4
+(name,number);
+SELECT * FROM t4;
+id name number
+1 XXX 12345
+2 XXY 12345
+SELECT * FROM t4;
+id name number
+1 XXX 12345
+2 XXY 12345
+LOAD DATA
+INFILE '../../std_data/loaddata_pair.dat'
+REPLACE INTO TABLE t4
+(name,number);
+SELECT * FROM t4;
+id name number
+3 XXX 12345
+4 XXY 12345
+SELECT * FROM t4;
+id name number
+3 XXX 12345
+4 XXY 12345
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index 4a9e28e9ea4..1e5e8f442a8 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -420,7 +420,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`i` int(11) default NULL,
- KEY `i` TYPE HASH (`i`)
+ KEY `i` USING HASH (`i`)
) ENGINE=HEAP DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MEMORY;
@@ -428,7 +428,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`i` int(11) default NULL,
- KEY `i` TYPE BTREE (`i`)
+ KEY `i` USING BTREE (`i`)
) ENGINE=HEAP DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
@@ -444,7 +444,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`i` int(11) default NULL,
- KEY `i` TYPE BTREE (`i`)
+ KEY `i` USING BTREE (`i`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
@@ -467,14 +467,14 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`i` int(11) default NULL,
- KEY `i` TYPE BTREE (`i`)
+ KEY `i` USING BTREE (`i`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
ALTER TABLE t1 ENGINE=MEMORY;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`i` int(11) default NULL,
- KEY `i` TYPE BTREE (`i`)
+ KEY `i` USING BTREE (`i`)
) ENGINE=HEAP DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1(
@@ -498,3 +498,18 @@ def Comment 253 255 0 N 129 31 63
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 0 PRIMARY 1 field1 A 0 1000 NULL BTREE
drop table t1;
+create table t1 (
+c1 int NOT NULL,
+c2 int NOT NULL,
+PRIMARY KEY USING HASH (c1),
+INDEX USING BTREE(c2)
+);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL default '0',
+ `c2` int(11) NOT NULL default '0',
+ PRIMARY KEY USING HASH (`c1`),
+ KEY `c2` USING BTREE (`c2`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
diff --git a/mysql-test/r/sql_mode.result b/mysql-test/r/sql_mode.result
index 652913d1fdb..4e1693e15ec 100644
--- a/mysql-test/r/sql_mode.result
+++ b/mysql-test/r/sql_mode.result
@@ -17,7 +17,7 @@ t1 CREATE TABLE `t1` (
`pseudo` varchar(35) character set latin2 NOT NULL default '',
`email` varchar(60) character set latin2 NOT NULL default '',
PRIMARY KEY (`a`),
- UNIQUE KEY `email` TYPE BTREE (`email`)
+ UNIQUE KEY `email` USING BTREE (`email`)
) ENGINE=HEAP DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
set @@sql_mode="ansi_quotes";
show variables like 'sql_mode';
@@ -30,7 +30,7 @@ t1 CREATE TABLE "t1" (
"pseudo" varchar(35) character set latin2 NOT NULL default '',
"email" varchar(60) character set latin2 NOT NULL default '',
PRIMARY KEY ("a"),
- UNIQUE KEY "email" TYPE BTREE ("email")
+ UNIQUE KEY "email" USING BTREE ("email")
) ENGINE=HEAP DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
set @@sql_mode="no_table_options";
show variables like 'sql_mode';
@@ -43,7 +43,7 @@ t1 CREATE TABLE `t1` (
`pseudo` varchar(35) character set latin2 NOT NULL default '',
`email` varchar(60) character set latin2 NOT NULL default '',
PRIMARY KEY (`a`),
- UNIQUE KEY `email` TYPE BTREE (`email`)
+ UNIQUE KEY `email` USING BTREE (`email`)
)
set @@sql_mode="no_key_options";
show variables like 'sql_mode';
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index 1f3542802a7..8615c8e661b 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -2721,3 +2721,9 @@ SELECT s.ip, count( e.itemid ) FROM `t1` e JOIN t2 s ON s.sessionid = e.sessioni
ip count( e.itemid )
10.10.10.1 1
drop tables t1,t2;
+create table t1 (fld enum('0','1'));
+insert into t1 values ('1');
+select * from (select max(fld) from t1) as foo;
+max(fld)
+1
+drop table t1;
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index 602750d5033..e370202cc9f 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -482,10 +482,10 @@ t1 CREATE TABLE `t1` (
`c3` longtext
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
-SET GLOBAL MYISAM_DATA_POINTER_SIZE= 8;
+SET GLOBAL MYISAM_DATA_POINTER_SIZE= 7;
SHOW VARIABLES LIKE 'MYISAM_DATA_POINTER_SIZE';
Variable_name Value
-myisam_data_pointer_size 8
+myisam_data_pointer_size 7
SET GLOBAL table_cache=-1;
SHOW VARIABLES LIKE 'table_cache';
Variable_name Value
diff --git a/mysql-test/std_data/loaddata_pair.dat b/mysql-test/std_data/loaddata_pair.dat
new file mode 100644
index 00000000000..5a4f6b57af8
--- /dev/null
+++ b/mysql-test/std_data/loaddata_pair.dat
@@ -0,0 +1,2 @@
+XXX 12345
+XXY 12345
diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test
index 638d1f1de5c..151bd91feb9 100644
--- a/mysql-test/t/ctype_utf8.test
+++ b/mysql-test/t/ctype_utf8.test
@@ -799,6 +799,16 @@ SELECT content, t2.msisdn FROM t1, t2 WHERE t1.msisdn = '1234567890';
DROP TABLE t1,t2;
#
+# Bug#11591: CHAR column with utf8 does not work properly
+# (more chars than expected)
+#
+create table t1 (a char(20) character set utf8);
+insert into t1 values ('123456'),('андрей');
+alter table t1 modify a char(2) character set utf8;
+select char_length(a), length(a), a from t1 order by a;
+drop table t1;
+
+#
# Bug#9557 MyISAM utf8 table crash
#
CREATE TABLE t1 (
diff --git a/mysql-test/t/func_des_encrypt.test b/mysql-test/t/func_des_encrypt.test
new file mode 100644
index 00000000000..201a0051c58
--- /dev/null
+++ b/mysql-test/t/func_des_encrypt.test
@@ -0,0 +1,9 @@
+-- source include/have_openssl.inc
+
+# This test can't be in func_encrypt.test, because it requires
+# --des-key-file to not be set.
+
+#
+# Bug #11643: des_encrypt() causes server to die
+#
+select des_encrypt('hello');
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
index f5f9ddac3b5..ae3cdc361ab 100644
--- a/mysql-test/t/func_str.test
+++ b/mysql-test/t/func_str.test
@@ -597,3 +597,17 @@ SELECT CONCAT_WS(' ', trackname, artistname) trackname, artistname
WHERE CONCAT_WS(' ', trackname, artistname) LIKE '%In%';
DROP TABLE t1,t2,t3;
+
+#
+# Correct length reporting from substring() (BUG#10269)
+#
+create table t1 (b varchar(5));
+insert t1 values ('ab'), ('abc'), ('abcd'), ('abcde');
+select *,substring(b,1),substring(b,-1),substring(b,-2),substring(b,-3),substring(b,-4),substring(b,-5) from t1;
+select * from (select *,substring(b,1),substring(b,-1),substring(b,-2),substring(b,-3),substring(b,-4),substring(b,-5) from t1) t;
+drop table t1;
+
+#
+# Bug #9854 hex() and out of range handling
+#
+select hex(29223372036854775809), hex(-29223372036854775809);
diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test
index 1c8fbe0ff0d..6c38aac1ebd 100644
--- a/mysql-test/t/grant.test
+++ b/mysql-test/t/grant.test
@@ -392,3 +392,12 @@ revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
delete from mysql.user where user=_binary'mysqltest_1';
drop database mysqltest;
+#
+# Bug #11330: Entry in tables_priv with host = '' causes crash
+#
+connection default;
+use mysql;
+insert into tables_priv values ('','test_db','mysqltest_1','test_table','test_grantor',CURRENT_TIMESTAMP,'Select','Select');
+flush privileges;
+delete from tables_priv where host = '' and user = 'mysqltest_1';
+flush privileges;
diff --git a/mysql-test/t/lowercase_table2.test b/mysql-test/t/lowercase_table2.test
index 5e38c59386d..f5cf292482e 100644
--- a/mysql-test/t/lowercase_table2.test
+++ b/mysql-test/t/lowercase_table2.test
@@ -13,7 +13,7 @@ enable_query_log;
DROP TABLE IF EXISTS t1,t2,t3,t2aA,t1Aa;
DROP DATABASE IF EXISTS `TEST_$1`;
DROP DATABASE IF EXISTS `test_$1`;
-DROP DATABASE mysqltest_LC2;
+DROP DATABASE IF EXISTS mysqltest_LC2;
--enable_warnings
CREATE TABLE T1 (a int);
diff --git a/mysql-test/t/ndb_autodiscover.test b/mysql-test/t/ndb_autodiscover.test
index 49ed8c894fe..1eed78b43df 100644
--- a/mysql-test/t/ndb_autodiscover.test
+++ b/mysql-test/t/ndb_autodiscover.test
@@ -460,19 +460,20 @@ use test;
# a table with tha same name as a table that can't be
# discovered( for example a table created via NDBAPI)
---error 1050
-CREATE TABLE sys.SYSTAB_0 (a int);
---error 1105
-select * from sys.SYSTAB_0;
-
-CREATE TABLE IF NOT EXISTS sys.SYSTAB_0 (a int);
-show warnings;
---error 1105
-select * from sys.SYSTAB_0;
-
---error 1051
-drop table sys.SYSTAB_0;
-drop table IF EXISTS sys.SYSTAB_0;
+# Test disabled since it doesn't work on case insensitive systems
+#--error 1050
+#CREATE TABLE sys.SYSTAB_0 (a int);
+#--error 1105
+#select * from sys.SYSTAB_0;
+
+#CREATE TABLE IF NOT EXISTS sys.SYSTAB_0 (a int);
+#show warnings;
+#--error 1105
+#select * from sys.SYSTAB_0;
+
+#--error 1051
+#drop table sys.SYSTAB_0;
+#drop table IF EXISTS sys.SYSTAB_0;
######################################################
# Note! This should always be the last step in this
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index bb1052c7337..01d62a2e198 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -581,3 +581,101 @@ execute stmt;
execute stmt;
deallocate prepare stmt;
drop table t1;
+
+#
+# Bug#11458 "Prepared statement with subselects return random data":
+# drop PARAM_TABLE_BIT from the list of tables used by a subquery
+#
+create table t1 (
+ id int(11) unsigned not null primary key auto_increment,
+ partner_id varchar(35) not null,
+ t1_status_id int(10) unsigned
+);
+
+insert into t1 values ("1", "partner1", "10"), ("2", "partner2", "10"),
+ ("3", "partner3", "10"), ("4", "partner4", "10");
+
+create table t2 (
+ id int(11) unsigned not null default '0',
+ t1_line_id int(11) unsigned not null default '0',
+ article_id varchar(20),
+ sequence int(11) not null default '0',
+ primary key (id,t1_line_id)
+);
+
+insert into t2 values ("1", "1", "sup", "0"), ("2", "1", "sup", "1"),
+ ("2", "2", "sup", "2"), ("2", "3", "sup", "3"),
+ ("2", "4", "imp", "4"), ("3", "1", "sup", "0"),
+ ("4", "1", "sup", "0");
+
+create table t3 (
+ id int(11) not null default '0',
+ preceeding_id int(11) not null default '0',
+ primary key (id,preceeding_id)
+);
+
+create table t4 (
+ user_id varchar(50) not null,
+ article_id varchar(20) not null,
+ primary key (user_id,article_id)
+);
+
+insert into t4 values("nicke", "imp");
+
+prepare stmt from
+'select distinct t1.partner_id
+from t1 left join t3 on t1.id = t3.id
+ left join t1 pp on pp.id = t3.preceeding_id
+where
+ exists (
+ select *
+ from t2 as pl_inner
+ where pl_inner.id = t1.id
+ and pl_inner.sequence <= (
+ select min(sequence) from t2 pl_seqnr
+ where pl_seqnr.id = t1.id
+ )
+ and exists (
+ select * from t4
+ where t4.article_id = pl_inner.article_id
+ and t4.user_id = ?
+ )
+ )
+ and t1.id = ?
+group by t1.id
+having count(pp.id) = 0';
+set @user_id = 'nicke';
+set @id = '2';
+execute stmt using @user_id, @id;
+execute stmt using @user_id, @id;
+deallocate prepare stmt;
+drop table t1, t2, t3, t4;
+
+#
+# Bug#9379: make sure that Item::collation is reset when one sets
+# a parameter marker from a string variable.
+#
+prepare stmt from 'select ?=?';
+set @a='CHRISTINE ';
+set @b='CHRISTINE';
+execute stmt using @a, @b;
+execute stmt using @a, @b;
+set @a=1, @b=2;
+execute stmt using @a, @b;
+set @a='CHRISTINE ';
+set @b='CHRISTINE';
+execute stmt using @a, @b;
+deallocate prepare stmt;
+#
+# Bug#9442 Set parameter make query fail if column character set is UCS2
+#
+create table t1 (utext varchar(20) character set ucs2);
+insert into t1 values ("lily");
+insert into t1 values ("river");
+prepare stmt from 'select utext from t1 where utext like ?';
+set @param1='%%';
+execute stmt using @param1;
+execute stmt using @param1;
+select utext from t1 where utext like '%%';
+drop table t1;
+deallocate prepare stmt;
diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test
index 170f150f7aa..d5042d34b74 100644
--- a/mysql-test/t/query_cache.test
+++ b/mysql-test/t/query_cache.test
@@ -730,4 +730,48 @@ flush query cache;
drop table t1, t2;
+#
+# Query with warning prohibited to query cache (BUG#9414)
+#
+flush status;
+CREATE TABLE t1 (
+ `date` datetime NOT NULL default '0000-00-00 00:00:00',
+ KEY `date` (`date`)
+) ENGINE=MyISAM;
+
+INSERT INTO t1 VALUES ('20050326');
+INSERT INTO t1 VALUES ('20050325');
+SELECT COUNT(*) FROM t1 WHERE date BETWEEN '20050326' AND '20050327 0:0:0';
+SELECT COUNT(*) FROM t1 WHERE date BETWEEN '20050326' AND '20050328 0:0:0';
+SELECT COUNT(*) FROM t1 WHERE date BETWEEN '20050326' AND '20050327 0:0:0';
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_inserts";
+show status like "Qcache_hits";
+drop table t1;
+
+#
+# queries with subquery in the FROM clause (BUG#11522)
+#
+create table t1 (a int);
+insert into t1 values (1);
+reset query cache;
+flush status;
+select * from (select * from t1) a;
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_inserts";
+show status like "Qcache_hits";
+select * from (select * from t1) a;
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_inserts";
+show status like "Qcache_hits";
+insert into t1 values (2);
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_inserts";
+show status like "Qcache_hits";
+select * from (select * from t1) a;
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_inserts";
+show status like "Qcache_hits";
+drop table t1;
+
set GLOBAL query_cache_size=0;
diff --git a/mysql-test/t/rpl_deadlock.test b/mysql-test/t/rpl_deadlock.test
index 9ad6362f7e7..da932df5347 100644
--- a/mysql-test/t/rpl_deadlock.test
+++ b/mysql-test/t/rpl_deadlock.test
@@ -107,5 +107,5 @@ select * from t2;
show slave status;
connection master;
-drop table t1,t2;
+drop table t1,t2,t3,t4;
sync_slave_with_master;
diff --git a/mysql-test/t/rpl_innodb.test b/mysql-test/t/rpl_innodb.test
new file mode 100644
index 00000000000..b171dced26e
--- /dev/null
+++ b/mysql-test/t/rpl_innodb.test
@@ -0,0 +1,46 @@
+# File for specialities regarding replication from or to InnoDB
+# tables.
+
+source include/master-slave.inc;
+source include/have_innodb.inc;
+
+#
+# Bug#11401: Load data infile 'REPLACE INTO' fails on slave.
+#
+connection master;
+CREATE TABLE t4 (
+ id INT(5) unsigned NOT NULL auto_increment,
+ name varchar(15) NOT NULL default '',
+ number varchar(35) NOT NULL default 'default',
+ PRIMARY KEY (id),
+ UNIQUE KEY unique_rec (name,number)
+) ENGINE=InnoDB;
+
+--disable_warnings
+LOAD DATA
+ INFILE '../../std_data/loaddata_pair.dat'
+ REPLACE INTO TABLE t4
+ (name,number);
+--enable_warnings
+SELECT * FROM t4;
+
+sync_slave_with_master;
+SELECT * FROM t4;
+
+connection master;
+--disable_warnings
+LOAD DATA
+ INFILE '../../std_data/loaddata_pair.dat'
+ REPLACE INTO TABLE t4
+ (name,number);
+--enable_warnings
+SELECT * FROM t4;
+
+sync_slave_with_master;
+SELECT * FROM t4;
+
+connection master;
+--disable_query_log
+DROP TABLE t4;
+--enable_query_log
+sync_slave_with_master;
diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test
index f80e720275a..76691ad79b1 100644
--- a/mysql-test/t/show_check.test
+++ b/mysql-test/t/show_check.test
@@ -368,3 +368,12 @@ show index from t1;
--disable_metadata
drop table t1;
+# Test for BUG#11635: mysqldump exports TYPE instead of USING for HASH
+create table t1 (
+ c1 int NOT NULL,
+ c2 int NOT NULL,
+ PRIMARY KEY USING HASH (c1),
+ INDEX USING BTREE(c2)
+);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index e585022563f..12593438805 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -1746,3 +1746,11 @@ CREATE TABLE `t2` (
INSERT INTO `t2` VALUES (1, 1, 1, '10.10.10.1');
SELECT s.ip, count( e.itemid ) FROM `t1` e JOIN t2 s ON s.sessionid = e.sessionid WHERE e.sessionid = ( SELECT sessionid FROM t2 ORDER BY sessionid DESC LIMIT 1 ) GROUP BY s.ip HAVING count( e.itemid ) >0 LIMIT 0 , 30;
drop tables t1,t2;
+
+# BUG#11821 : Select from subselect using aggregate function on an enum
+# segfaults:
+create table t1 (fld enum('0','1'));
+insert into t1 values ('1');
+select * from (select max(fld) from t1) as foo;
+drop table t1;
+
diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test
index e45218a9ed7..b8a12323cf9 100644
--- a/mysql-test/t/variables.test
+++ b/mysql-test/t/variables.test
@@ -363,9 +363,13 @@ drop table t1;
#
# Bug #6993: myisam_data_pointer_size
+# Wrong bug report, data pointer size must be restricted to 7,
+# setting to 8 will not work on all computers, myisamchk and
+# the server may see a wrong value, such as 0 or negative number
+# if 8 bytes is set.
#
-SET GLOBAL MYISAM_DATA_POINTER_SIZE= 8;
+SET GLOBAL MYISAM_DATA_POINTER_SIZE= 7;
SHOW VARIABLES LIKE 'MYISAM_DATA_POINTER_SIZE';
#
diff --git a/mysys/Makefile.am b/mysys/Makefile.am
index ab35ccb21ba..a80df810c1c 100644
--- a/mysys/Makefile.am
+++ b/mysys/Makefile.am
@@ -18,7 +18,8 @@ MYSQLDATAdir = $(localstatedir)
MYSQLSHAREdir = $(pkgdatadir)
MYSQLBASEdir= $(prefix)
INCLUDES = @MT_INCLUDES@ \
- @ZLIB_INCLUDES@ -I$(top_srcdir)/include -I$(srcdir)
+ @ZLIB_INCLUDES@ -I$(top_builddir)/include \
+ -I$(top_srcdir)/include -I$(srcdir)
pkglib_LIBRARIES = libmysys.a
LDADD = libmysys.a ../dbug/libdbug.a \
../strings/libmystrings.a
diff --git a/netware/Makefile.am b/netware/Makefile.am
index 2467270f27b..aeb93d1575d 100644
--- a/netware/Makefile.am
+++ b/netware/Makefile.am
@@ -15,7 +15,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
if HAVE_NETWARE
-INCLUDES = -I$(srcdir)/../include -I../include -I..
+INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I..
LDADD = @CLIENT_EXTRA_LDFLAGS@ ../mysys/libmysys.a \
../dbug/libdbug.a ../strings/libmystrings.a
bin_PROGRAMS = mysqld_safe mysql_install_db mysql_test_run libmysql
diff --git a/regex/Makefile.am b/regex/Makefile.am
index ee7fc5463b7..bcba6818b1b 100644
--- a/regex/Makefile.am
+++ b/regex/Makefile.am
@@ -15,7 +15,8 @@
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA
-INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include
+INCLUDES = @MT_INCLUDES@ \
+ -I$(top_builddir)/include -I$(top_srcdir)/include
noinst_LIBRARIES = libregex.a
LDADD= libregex.a $(top_builddir)/strings/libmystrings.a
noinst_HEADERS = cclass.h cname.h regex2.h utils.h engine.c regex.h
diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh
index 2f49104ad46..3b8cc1ca12a 100644
--- a/scripts/make_binary_distribution.sh
+++ b/scripts/make_binary_distribution.sh
@@ -15,6 +15,7 @@ MV="mv"
STRIP=1
DEBUG=0
SILENT=0
+MACHINE=
TMP=/tmp
SUFFIX=""
NDBCLUSTER=
@@ -26,6 +27,7 @@ parse_arguments() {
--tmp=*) TMP=`echo "$arg" | sed -e "s;--tmp=;;"` ;;
--suffix=*) SUFFIX=`echo "$arg" | sed -e "s;--suffix=;;"` ;;
--no-strip) STRIP=0 ;;
+ --machine=*) MACHINE=`echo "$arg" | sed -e "s;--machine=;;"` ;;
--silent) SILENT=1 ;;
--with-ndbcluster) NDBCLUSTER=1 ;;
*)
@@ -286,8 +288,17 @@ if [ x$NDBCLUSTER = x1 ]; then
rm -rf $BASE/ndb-stage
fi
+# Use the override --machine if present
+if [ -n "$MACHINE" ] ; then
+ machine=$MACHINE
+fi
+
# Change the distribution to a long descriptive name
NEW_NAME=mysql@MYSQL_SERVER_SUFFIX@-$version-$system-$machine$SUFFIX
+
+# Print the platform name for build logs
+echo "PLATFORM NAME: $system-$machine"
+
BASE2=$TMP/$NEW_NAME
rm -r -f $BASE2
mv $BASE $BASE2
diff --git a/scripts/make_win_src_distribution.sh b/scripts/make_win_src_distribution.sh
index b8dd907920c..71d61b7a02d 100644
--- a/scripts/make_win_src_distribution.sh
+++ b/scripts/make_win_src_distribution.sh
@@ -357,6 +357,9 @@ if [ -d $BASE/SSL/SCCS ]
then
find $BASE/ -type d -name SCCS -printf " \"%p\"" | xargs rm -r -f
fi
+find $BASE/ -type d -name .deps -printf " \"%p\"" | xargs rm -r -f
+find $BASE/ -type d -name .libs -printf " \"%p\"" | xargs rm -r -f
+rm -r -f "$BASE/mysql-test/var"
#
# Initialize the initial data directory
diff --git a/scripts/mysql_config.sh b/scripts/mysql_config.sh
index a5c8af5ecb2..16e50c044ca 100644
--- a/scripts/mysql_config.sh
+++ b/scripts/mysql_config.sh
@@ -60,11 +60,19 @@ fix_path ()
get_full_path ()
{
- case $1 in
- /*) echo "$1";;
- ./*) tmp=`pwd`/$1; echo $tmp | sed -e 's;/\./;/;' ;;
- *) which $1 ;;
- esac
+ file=$1
+
+ # if the file is a symlink, try to resolve it
+ if [ -h $file ];
+ then
+ file=`ls -l $file | awk '{ print $NF }'`
+ fi
+
+ case $file in
+ /*) echo "$file";;
+ */*) tmp=`pwd`/$file; echo $tmp | sed -e 's;/\./;/;' ;;
+ *) which $file ;;
+ esac
}
me=`get_full_path $0`
diff --git a/sql/Makefile.am b/sql/Makefile.am
index a76adbd0d57..ea7cea9c7b9 100644
--- a/sql/Makefile.am
+++ b/sql/Makefile.am
@@ -21,8 +21,8 @@ MYSQLSHAREdir = $(pkgdatadir)
MYSQLBASEdir= $(prefix)
INCLUDES = @MT_INCLUDES@ @ZLIB_INCLUDES@ \
@bdb_includes@ @innodb_includes@ @ndbcluster_includes@ \
- -I$(top_srcdir)/include -I$(top_srcdir)/regex \
- -I$(srcdir) $(openssl_includes)
+ -I$(top_builddir)/include -I$(top_srcdir)/include \
+ -I$(top_srcdir)/regex -I$(srcdir) $(openssl_includes)
WRAPLIBS= @WRAPLIBS@
SUBDIRS = share
libexec_PROGRAMS = mysqld
diff --git a/sql/des_key_file.cc b/sql/des_key_file.cc
index c6b4c5f2c34..558e3f16ad2 100644
--- a/sql/des_key_file.cc
+++ b/sql/des_key_file.cc
@@ -22,7 +22,17 @@
struct st_des_keyschedule des_keyschedule[10];
uint des_default_key;
pthread_mutex_t LOCK_des_key_file;
-static int initialized;
+static int initialized= 0;
+
+void
+init_des_key_file()
+{
+ if (!initialized)
+ {
+ initialized=1;
+ pthread_mutex_init(&LOCK_des_key_file,MY_MUTEX_INIT_FAST);
+ }
+}
/*
Function which loads DES keys from plaintext file into memory on MySQL
@@ -45,11 +55,7 @@ load_des_key_file(const char *file_name)
DBUG_ENTER("load_des_key_file");
DBUG_PRINT("enter",("name: %s",file_name));
- if (!initialized)
- {
- initialized=1;
- pthread_mutex_init(&LOCK_des_key_file,MY_MUTEX_INIT_FAST);
- }
+ init_des_key_file();
VOID(pthread_mutex_lock(&LOCK_des_key_file));
if ((file=my_open(file_name,O_RDONLY | O_BINARY ,MYF(MY_WME))) < 0 ||
diff --git a/sql/field_conv.cc b/sql/field_conv.cc
index 8b362bbf807..a447716a818 100644
--- a/sql/field_conv.cc
+++ b/sql/field_conv.cc
@@ -326,21 +326,28 @@ static void do_field_real(Copy_field *copy)
static void do_cut_string(Copy_field *copy)
{ // Shorter string field
- memcpy(copy->to_ptr,copy->from_ptr,copy->to_length);
-
- /* Check if we loosed any important characters */
- char *ptr,*end;
- for (ptr=copy->from_ptr+copy->to_length,end=copy->from_ptr+copy->from_length ;
- ptr != end ;
- ptr++)
+ int well_formed_error;
+ CHARSET_INFO *cs= copy->from_field->charset();
+ const char *from_end= copy->from_ptr + copy->from_length;
+ uint copy_length= cs->cset->well_formed_len(cs, copy->from_ptr, from_end,
+ copy->to_length / cs->mbmaxlen,
+ &well_formed_error);
+ if (copy->to_length < copy_length)
+ copy_length= copy->to_length;
+ memcpy(copy->to_ptr, copy->from_ptr, copy_length);
+
+ /* Check if we lost any important characters */
+ if (well_formed_error ||
+ cs->cset->scan(cs, copy->from_ptr + copy_length, from_end,
+ MY_SEQ_SPACES) < (copy->from_length - copy_length))
{
- if (!my_isspace(system_charset_info, *ptr)) // QQ: ucs incompatible
- {
- copy->to_field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_WARN_DATA_TRUNCATED, 1);
- break;
- }
+ copy->to_field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_WARN_DATA_TRUNCATED, 1);
}
+
+ if (copy_length < copy->to_length)
+ cs->cset->fill(cs, copy->to_ptr + copy_length,
+ copy->to_length - copy_length, ' ');
}
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 65c5fcb7de4..e14d4b13311 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -1113,42 +1113,23 @@ int ha_ndbcluster::set_primary_key(NdbOperation *op, const byte *key)
}
-int ha_ndbcluster::set_primary_key_from_old_data(NdbOperation *op, const byte *old_data)
+int ha_ndbcluster::set_primary_key_from_record(NdbOperation *op, const byte *record)
{
KEY* key_info= table->key_info + table->primary_key;
KEY_PART_INFO* key_part= key_info->key_part;
KEY_PART_INFO* end= key_part+key_info->key_parts;
- DBUG_ENTER("set_primary_key_from_old_data");
+ DBUG_ENTER("set_primary_key_from_record");
for (; key_part != end; key_part++)
{
Field* field= key_part->field;
if (set_ndb_key(op, field,
- key_part->fieldnr-1, old_data+key_part->offset))
+ key_part->fieldnr-1, record+key_part->offset))
ERR_RETURN(op->getNdbError());
}
DBUG_RETURN(0);
}
-
-int ha_ndbcluster::set_primary_key(NdbOperation *op)
-{
- DBUG_ENTER("set_primary_key");
- KEY* key_info= table->key_info + table->primary_key;
- KEY_PART_INFO* key_part= key_info->key_part;
- KEY_PART_INFO* end= key_part+key_info->key_parts;
-
- for (; key_part != end; key_part++)
- {
- Field* field= key_part->field;
- if (set_ndb_key(op, field,
- key_part->fieldnr-1, field->ptr))
- ERR_RETURN(op->getNdbError());
- }
- DBUG_RETURN(0);
-}
-
-
/*
Read one record from NDB using primary key
*/
@@ -1241,9 +1222,9 @@ int ha_ndbcluster::complemented_pk_read(const byte *old_data, byte *new_data)
op->readTuple(lm) != 0)
ERR_RETURN(trans->getNdbError());
- int res;
- if ((res= set_primary_key_from_old_data(op, old_data)))
- ERR_RETURN(trans->getNdbError());
+ int res;
+ if ((res= set_primary_key_from_record(op, old_data)))
+ ERR_RETURN(trans->getNdbError());
// Read all unreferenced non-key field(s)
for (i= 0; i < no_fields; i++)
@@ -1273,7 +1254,7 @@ int ha_ndbcluster::complemented_pk_read(const byte *old_data, byte *new_data)
Peek to check if a particular row already exists
*/
-int ha_ndbcluster::peek_row()
+int ha_ndbcluster::peek_row(const byte *record)
{
NdbConnection *trans= m_active_trans;
NdbOperation *op;
@@ -1287,7 +1268,7 @@ int ha_ndbcluster::peek_row()
ERR_RETURN(trans->getNdbError());
int res;
- if ((res= set_primary_key(op)))
+ if ((res= set_primary_key_from_record(op, record)))
ERR_RETURN(trans->getNdbError());
if (execute_no_commit_ie(this,trans) != 0)
@@ -1841,7 +1822,7 @@ int ha_ndbcluster::write_row(byte *record)
if(m_ignore_dup_key && table->primary_key != MAX_KEY)
{
- int peek_res= peek_row();
+ int peek_res= peek_row(record);
if (!peek_res)
{
@@ -1891,9 +1872,7 @@ int ha_ndbcluster::write_row(byte *record)
m_skip_auto_increment= !auto_increment_column_changed;
}
- if ((res= (m_primary_key_update ?
- set_primary_key_from_old_data(op, record)
- : set_primary_key(op))))
+ if ((res= set_primary_key_from_record(op, record)))
return res;
}
@@ -2030,7 +2009,7 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data)
if ((table->primary_key != MAX_KEY) &&
(key_cmp(table->primary_key, old_data, new_data)))
{
- int read_res, insert_res, delete_res;
+ int read_res, insert_res, delete_res, undo_res;
DBUG_PRINT("info", ("primary key update, doing pk read+delete+insert"));
// Get all old fields, since we optimize away fields not in query
@@ -2059,9 +2038,14 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data)
DBUG_PRINT("info", ("insert failed"));
if (trans->commitStatus() == NdbConnection::Started)
{
- // Undo write_row(new_data)
+ // Undo delete_row(old_data)
m_primary_key_update= TRUE;
- insert_res= write_row((byte *)old_data);
+ undo_res= write_row((byte *)old_data);
+ if (undo_res)
+ push_warning(current_thd,
+ MYSQL_ERROR::WARN_LEVEL_WARN,
+ undo_res,
+ "NDB failed undoing delete at primary key update");
m_primary_key_update= FALSE;
}
DBUG_RETURN(insert_res);
@@ -2110,7 +2094,7 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data)
else
{
int res;
- if ((res= set_primary_key_from_old_data(op, old_data)))
+ if ((res= set_primary_key_from_record(op, old_data)))
DBUG_RETURN(res);
}
}
@@ -2191,10 +2175,8 @@ int ha_ndbcluster::delete_row(const byte *record)
else
{
int res;
- if ((res= (m_primary_key_update ?
- set_primary_key_from_old_data(op, record)
- : set_primary_key(op))))
- return res;
+ if ((res= set_primary_key_from_record(op, record)))
+ return res;
}
}
diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h
index 5c1d121a157..4b3a30fb9b9 100644
--- a/sql/ha_ndbcluster.h
+++ b/sql/ha_ndbcluster.h
@@ -168,7 +168,7 @@ class ha_ndbcluster: public handler
int pk_read(const byte *key, uint key_len, byte *buf);
int complemented_pk_read(const byte *old_data, byte *new_data);
- int peek_row();
+ int peek_row(const byte *record);
int unique_index_read(const byte *key, uint key_len,
byte *buf);
int ordered_index_scan(const key_range *start_key,
@@ -196,8 +196,7 @@ class ha_ndbcluster: public handler
friend int g_get_ndb_blobs_value(NdbBlob *ndb_blob, void *arg);
int get_ndb_blobs_value(NdbBlob *last_ndb_blob);
int set_primary_key(NdbOperation *op, const byte *key);
- int set_primary_key(NdbOperation *op);
- int set_primary_key_from_old_data(NdbOperation *op, const byte *old_data);
+ int set_primary_key_from_record(NdbOperation *op, const byte *record);
int set_bounds(NdbIndexScanOperation *ndb_op, const key_range *keys[2]);
int key_cmp(uint keynr, const byte * old_row, const byte * new_row);
void print_results();
diff --git a/sql/item.cc b/sql/item.cc
index ee78d596891..6f224983d4e 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -917,6 +917,7 @@ void Item_param::set_null()
max_length= 0;
decimals= 0;
state= NULL_VALUE;
+ item_type= Item::NULL_ITEM;
DBUG_VOID_RETURN;
}
@@ -1116,6 +1117,7 @@ void Item_param::reset()
to the binary log.
*/
str_value.set_charset(&my_charset_bin);
+ collation.set(&my_charset_bin, DERIVATION_COERCIBLE);
state= NO_VALUE;
maybe_null= 1;
null_value= 0;
@@ -1363,38 +1365,12 @@ bool Item_param::convert_str_value(THD *thd)
*/
str_value_ptr.set(str_value.ptr(), str_value.length(),
str_value.charset());
+ /* Synchronize item charset with value charset */
+ collation.set(str_value.charset(), DERIVATION_COERCIBLE);
}
return rc;
}
-bool Item_param::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
-{
- DBUG_ASSERT(fixed == 0);
- SELECT_LEX *cursel= (SELECT_LEX *) thd->lex->current_select;
-
- /*
- Parameters in a subselect should mark the subselect as not constant
- during prepare
- */
- if (state == NO_VALUE)
- {
- /*
- SELECT_LEX_UNIT::item set only for subqueries, so test of it presence
- can be barrier to stop before derived table SELECT or very outer SELECT
- */
- for(;
- cursel->master_unit()->item;
- cursel= cursel->outer_select())
- {
- Item_subselect *subselect_item= cursel->master_unit()->item;
- subselect_item->used_tables_cache|= OUTER_REF_TABLE_BIT;
- subselect_item->const_item_cache= 0;
- }
- }
- fixed= 1;
- return 0;
-}
-
bool Item_param::basic_const_item() const
{
@@ -3163,9 +3139,13 @@ void Item_type_holder::get_full_info(Item *item)
if (fld_type == MYSQL_TYPE_ENUM ||
fld_type == MYSQL_TYPE_SET)
{
+ if (item->type() == Item::SUM_FUNC_ITEM &&
+ (((Item_sum*)item)->sum_func() == Item_sum::MAX_FUNC ||
+ ((Item_sum*)item)->sum_func() == Item_sum::MIN_FUNC))
+ item = ((Item_sum*)item)->args[0];
/*
- We can have enum/set type after merging only if we have one enum/set
- field and number of NULL fields
+ We can have enum/set type after merging only if we have one enum|set
+ field (or MIN|MAX(enum|set field)) and number of NULL fields
*/
DBUG_ASSERT((enum_set_typelib &&
get_real_type(item) == MYSQL_TYPE_NULL) ||
diff --git a/sql/item.h b/sql/item.h
index 20d6718609c..895463ceeca 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -565,7 +565,6 @@ public:
bool get_time(TIME *tm);
bool get_date(TIME *tm, uint fuzzydate);
int save_in_field(Field *field, bool no_conversions);
- bool fix_fields(THD *, struct st_table_list *, Item **);
void set_null();
void set_int(longlong i, uint32 max_length_arg);
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 442ef15bba8..4e0b6d8813f 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -188,7 +188,20 @@ bool Item_func::agg_arg_charsets(DTCollation &coll,
break; // we cannot return here, we need to restore "arena".
}
conv->fix_fields(thd, 0, &conv);
- *arg= conv;
+ /*
+ If in statement prepare, then we create a converter for two
+ constant items, do it once and then reuse it.
+ If we're in execution of a prepared statement, arena is NULL,
+ and the conv was created in runtime memory. This can be
+ the case only if the argument is a parameter marker ('?'),
+ because for all true constants the charset converter has already
+ been created in prepare. In this case register the change for
+ rollback.
+ */
+ if (arena)
+ *arg= conv;
+ else
+ thd->change_item_tree(arg, conv);
}
if (arena)
thd->restore_backup_item_arena(arena, &backup);
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 881a8a7c915..6a4dd0d7418 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -388,6 +388,9 @@ String *Item_func_des_encrypt::val_str(String *str)
if (arg_count == 1)
{
+ /* Make sure LOCK_des_key_file was initialized. */
+ init_des_key_file();
+
/* Protect against someone doing FLUSH DES_KEY_FILE */
VOID(pthread_mutex_lock(&LOCK_des_key_file));
keyschedule= des_keyschedule[key_number=des_default_key];
@@ -398,6 +401,10 @@ String *Item_func_des_encrypt::val_str(String *str)
key_number= (uint) args[1]->val_int();
if (key_number > 9)
goto error;
+
+ /* Make sure LOCK_des_key_file was initialized. */
+ init_des_key_file();
+
VOID(pthread_mutex_lock(&LOCK_des_key_file));
keyschedule= des_keyschedule[key_number];
VOID(pthread_mutex_unlock(&LOCK_des_key_file));
@@ -485,6 +492,10 @@ String *Item_func_des_decrypt::val_str(String *str)
// Check if automatic key and that we have privilege to uncompress using it
if (!(current_thd->master_access & SUPER_ACL) || key_number > 9)
goto error;
+
+ /* Make sure LOCK_des_key_file was initialized. */
+ init_des_key_file();
+
VOID(pthread_mutex_lock(&LOCK_des_key_file));
keyschedule= des_keyschedule[key_number];
VOID(pthread_mutex_unlock(&LOCK_des_key_file));
@@ -1065,7 +1076,8 @@ void Item_func_substr::fix_length_and_dec()
collation.set(args[0]->collation);
if (args[1]->const_item())
{
- int32 start=(int32) args[1]->val_int()-1;
+ int32 start= (int32) args[1]->val_int();
+ start= (int32)((start < 0) ? max_length + start : start - 1);
if (start < 0 || start >= (int32) max_length)
max_length=0; /* purecov: inspected */
else
@@ -2336,9 +2348,21 @@ String *Item_func_hex::val_str(String *str)
DBUG_ASSERT(fixed == 1);
if (args[0]->result_type() != STRING_RESULT)
{
- /* Return hex of unsigned longlong value */
- longlong dec= args[0]->val_int();
+ ulonglong dec;
char ans[65],*ptr;
+ /* Return hex of unsigned longlong value */
+ if (args[0]->result_type() == REAL_RESULT)
+ {
+ double val= args[0]->val();
+ if ((val <= (double) LONGLONG_MIN) ||
+ (val >= (double) (ulonglong) ULONGLONG_MAX))
+ dec= ~(longlong) 0;
+ else
+ dec= (ulonglong) (val + (val > 0 ? 0.5 : -0.5));
+ }
+ else
+ dec= (ulonglong) args[0]->val_int();
+
if ((null_value= args[0]->null_value))
return 0;
ptr= longlong2str(dec,ans,16);
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index 20ba838e61c..dec32398a80 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -119,7 +119,6 @@ public:
friend class Item_in_optimizer;
friend bool Item_field::fix_fields(THD *, TABLE_LIST *, Item **);
friend bool Item_ref::fix_fields(THD *, TABLE_LIST *, Item **);
- friend bool Item_param::fix_fields(THD *, TABLE_LIST *, Item **);
};
/* single value subselect */
diff --git a/sql/log.cc b/sql/log.cc
index c8a3b512b6d..a67f35e30bf 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -853,6 +853,8 @@ int MYSQL_LOG::purge_logs(const char *to_log,
of space that deletion will free. In most cases,
deletion won't work either, so it's not a problem.
*/
+ sql_print_information("Failed to execute my_stat on file '%s'",
+ log_info.log_file_name);
tmp= 0;
}
}
diff --git a/sql/log_event.cc b/sql/log_event.cc
index a4319f63b83..cda385c911b 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -1809,11 +1809,25 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
"` <...>", NullS) - load_data_query);
thd->query= load_data_query;
}
+
+ /*
+ We need to set thd->lex->sql_command and thd->lex->duplicates
+ since InnoDB tests these variables to decide if this is a LOAD
+ DATA ... REPLACE INTO ... statement even though mysql_parse()
+ is not called. This is not needed in 5.0 since there the LOAD
+ DATA ... statement is replicated using mysql_parse(), which
+ sets the thd->lex fields correctly.
+ */
+ thd->lex->sql_command= SQLCOM_LOAD;
if (sql_ex.opt_flags & REPLACE_FLAG)
+ {
+ thd->lex->duplicates= DUP_REPLACE;
handle_dup= DUP_REPLACE;
+ }
else if (sql_ex.opt_flags & IGNORE_FLAG)
{
ignore= 1;
+ thd->lex->duplicates= DUP_ERROR;
handle_dup= DUP_ERROR;
}
else
@@ -1831,6 +1845,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
If reading from net (a 3.23 master), mysql_load() will change this
to IGNORE.
*/
+ thd->lex->duplicates= DUP_ERROR;
handle_dup= DUP_ERROR;
}
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index cc58e34d582..722b76796b2 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -251,6 +251,8 @@ extern CHARSET_INFO *national_charset_info, *table_alias_charset;
#define UNCACHEABLE_SIDEEFFECT 4
// forcing to save JOIN for explain
#define UNCACHEABLE_EXPLAIN 8
+/* Don't evaluate subqueries in prepare even if they're not correlated */
+#define UNCACHEABLE_PREPARE 16
#ifdef EXTRA_DEBUG
/*
@@ -624,6 +626,7 @@ extern char *des_key_file;
extern struct st_des_keyschedule des_keyschedule[10];
extern uint des_default_key;
extern pthread_mutex_t LOCK_des_key_file;
+void init_des_key_file();
bool load_des_key_file(const char *file_name);
void free_des_key_file();
#endif /* HAVE_OPENSSL */
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 99c96a69ceb..a757c47366d 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -5153,7 +5153,7 @@ The minimum value for this variable is 4096.",
"Default pointer size to be used for MyISAM tables.",
(gptr*) &myisam_data_pointer_size,
(gptr*) &myisam_data_pointer_size, 0, GET_ULONG, REQUIRED_ARG,
- 4, 2, 8, 0, 1, 0},
+ 4, 2, 7, 0, 1, 0},
{"myisam_max_extra_sort_file_size", OPT_MYISAM_MAX_EXTRA_SORT_FILE_SIZE,
"Used to help MySQL to decide when to use the slow but safe key cache index create method.",
(gptr*) &global_system_variables.myisam_max_extra_sort_file_size,
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index bd4505a3d7f..9d84d0b2427 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -132,7 +132,7 @@ my_bool my_net_init(NET *net, Vio* vio)
if (vio != 0) /* If real connection */
{
net->fd = vio_fd(vio); /* For perl DBI/DBD */
-#if defined(MYSQL_SERVER) && !defined(___WIN__) && !defined(__EMX__) && !defined(OS2)
+#if defined(MYSQL_SERVER) && !defined(__WIN__) && !defined(__EMX__) && !defined(OS2)
if (!(test_flags & TEST_BLOCKING))
{
my_bool old_mode;
diff --git a/sql/slave.cc b/sql/slave.cc
index 5a2d3af3845..68769fc1f98 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -4462,6 +4462,7 @@ void rotate_relay_log(MASTER_INFO* mi)
RELAY_LOG_INFO* rli= &mi->rli;
lock_slave_threads(mi);
+ pthread_mutex_lock(&mi->data_lock);
pthread_mutex_lock(&rli->data_lock);
/*
We need to test inited because otherwise, new_file() will attempt to lock
@@ -4492,6 +4493,7 @@ void rotate_relay_log(MASTER_INFO* mi)
rli->relay_log.harvest_bytes_written(&rli->log_space_total);
end:
pthread_mutex_unlock(&rli->data_lock);
+ pthread_mutex_unlock(&mi->data_lock);
unlock_slave_threads(mi);
DBUG_VOID_RETURN;
}
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 849192154da..d191da32189 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -1866,7 +1866,8 @@ GRANT_TABLE::GRANT_TABLE(TABLE *form, TABLE *col_privs)
if (cols)
{
int key_len;
- col_privs->field[0]->store(host.hostname,(uint) strlen(host.hostname),
+ col_privs->field[0]->store(host.hostname,
+ host.hostname ? (uint) strlen(host.hostname) : 0,
&my_charset_latin1);
col_privs->field[1]->store(db,(uint) strlen(db), &my_charset_latin1);
col_privs->field[2]->store(user,(uint) strlen(user), &my_charset_latin1);
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index 8deb3489782..366a13d59ba 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -2114,6 +2114,13 @@ my_bool Query_cache::register_all_tables(Query_cache_block *block,
for (n=0; tables_used; tables_used=tables_used->next, n++, block_table++)
{
+ if (tables_used->derived)
+ {
+ DBUG_PRINT("qcache", ("derived table skipped"));
+ n--;
+ block_table--;
+ continue;
+ }
DBUG_PRINT("qcache",
("table %s, db %s, openinfo at 0x%lx, keylen %u, key at 0x%lx",
tables_used->real_name, tables_used->db,
@@ -2671,7 +2678,8 @@ TABLE_COUNTER_TYPE Query_cache::is_cacheable(THD *thd, uint32 query_len,
table_alias_charset used here because it depends of
lower_case_table_names variable
*/
- if (tables_used->table->tmp_table != NO_TMP_TABLE ||
+ if ((tables_used->table->tmp_table != NO_TMP_TABLE &&
+ !tables_used->derived) ||
(*tables_type & HA_CACHE_TBL_NOCACHE) ||
(tables_used->db_length == 5 &&
my_strnncoll(table_alias_charset, (uchar*)tables_used->db, 6,
@@ -2682,7 +2690,12 @@ TABLE_COUNTER_TYPE Query_cache::is_cacheable(THD *thd, uint32 query_len,
other non-cacheable table(s)"));
DBUG_RETURN(0);
}
- if (tables_used->table->db_type == DB_TYPE_MRG_MYISAM)
+ if (tables_used->derived)
+ {
+ table_count--;
+ DBUG_PRINT("qcache", ("derived table skipped"));
+ }
+ else if (tables_used->table->db_type == DB_TYPE_MRG_MYISAM)
{
ha_myisammrg *handler = (ha_myisammrg *)tables_used->table->file;
MYRG_INFO *file = handler->myrg_info();
diff --git a/sql/sql_error.cc b/sql/sql_error.cc
index a31e15d0745..b24d15b6e3b 100644
--- a/sql/sql_error.cc
+++ b/sql/sql_error.cc
@@ -108,6 +108,8 @@ MYSQL_ERROR *push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level,
if (level == MYSQL_ERROR::WARN_LEVEL_NOTE && !(thd->options & OPTION_SQL_NOTES))
return(0);
+ query_cache_abort(&thd->net);
+
if (thd->query_id != thd->warn_id)
mysql_reset_errors(thd);
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 927982e444f..07b5c9d8edf 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -257,6 +257,7 @@ public:
UNCACHEABLE_RAND
UNCACHEABLE_SIDEEFFECT
UNCACHEABLE_EXPLAIN
+ UNCACHEABLE_PREPARE
*/
uint8 uncacheable;
enum sub_select_type linkage;
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index d7fd3239df5..dc55a842263 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -4123,6 +4123,14 @@ mysql_new_select(LEX *lex, bool move_down)
select_lex->select_number= ++lex->thd->select_number;
select_lex->init_query();
select_lex->init_select();
+ /*
+ Don't evaluate this subquery during statement prepare even if
+ it's a constant one. The flag is switched off in the end of
+ mysql_stmt_prepare.
+ */
+ if (lex->thd->current_arena->is_stmt_prepare())
+ select_lex->uncacheable|= UNCACHEABLE_PREPARE;
+
if (move_down)
{
lex->subqueries= TRUE;
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 9e2612c5661..f7e2bd0467e 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -1657,13 +1657,18 @@ int mysql_stmt_prepare(THD *thd, char *packet, uint packet_length,
{
stmt->setup_set_params();
SELECT_LEX *sl= stmt->lex->all_selects_list;
- /*
- Save WHERE clause pointers, because they may be changed during query
- optimisation.
- */
for (; sl; sl= sl->next_select_in_list())
{
+ /*
+ Save WHERE clause pointers, because they may be changed
+ during query optimisation.
+ */
sl->prep_where= sl->where;
+ /*
+ Switch off a temporary flag that prevents evaluation of
+ subqueries in statement prepare.
+ */
+ sl->uncacheable&= ~UNCACHEABLE_PREPARE;
}
stmt->state= Item_arena::PREPARED;
}
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 044dc60e4b6..972fb4e0368 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -134,8 +134,8 @@ static void read_cached_record(JOIN_TAB *tab);
static bool cmp_buffer_with_ref(JOIN_TAB *tab);
static bool setup_new_fields(THD *thd,TABLE_LIST *tables,List<Item> &fields,
List<Item> &all_fields,ORDER *new_order);
-static ORDER *create_distinct_group(THD *thd, ORDER *order,
- List<Item> &fields,
+static ORDER *create_distinct_group(THD *thd, Item **ref_pointer_array,
+ ORDER *order, List<Item> &fields,
bool *all_order_by_fields_used);
static bool test_if_subpart(ORDER *a,ORDER *b);
static TABLE *get_sort_by_table(ORDER *a,ORDER *b,TABLE_LIST *tables);
@@ -642,7 +642,8 @@ JOIN::optimize()
bool all_order_fields_used;
if (order)
skip_sort_order= test_if_skip_sort_order(tab, order, select_limit, 1);
- if ((group_list=create_distinct_group(thd, order, fields_list,
+ if ((group_list=create_distinct_group(thd, select_lex->ref_pointer_array,
+ order, fields_list,
&all_order_fields_used)))
{
bool skip_group= (skip_sort_order &&
@@ -8222,12 +8223,10 @@ cp_buffer_from_ref(THD *thd, TABLE_REF *ref)
thd->count_cuted_fields= CHECK_FIELD_IGNORE;
for (store_key **copy=ref->key_copy ; *copy ; copy++)
{
- int res;
- if ((res= (*copy)->copy()))
+ if ((*copy)->copy() & 1)
{
thd->count_cuted_fields= save_count_cuted_fields;
- if ((res= res & 1))
- return res; // Something went wrong
+ return 1; // Something went wrong
}
}
thd->count_cuted_fields= save_count_cuted_fields;
@@ -8440,12 +8439,14 @@ setup_new_fields(THD *thd,TABLE_LIST *tables,List<Item> &fields,
*/
static ORDER *
-create_distinct_group(THD *thd, ORDER *order_list, List<Item> &fields,
+create_distinct_group(THD *thd, Item **ref_pointer_array,
+ ORDER *order_list, List<Item> &fields,
bool *all_order_by_fields_used)
{
List_iterator<Item> li(fields);
Item *item;
ORDER *order,*group,**prev;
+ uint index= 0;
*all_order_by_fields_used= 1;
while ((item=li++))
@@ -8477,11 +8478,17 @@ create_distinct_group(THD *thd, ORDER *order_list, List<Item> &fields,
ORDER *ord=(ORDER*) thd->calloc(sizeof(ORDER));
if (!ord)
return 0;
- ord->item=li.ref();
+ /*
+ We have here only field_list (not all_field_list), so we can use
+ simple indexing of ref_pointer_array (order in the array and in the
+ list are same)
+ */
+ ord->item= ref_pointer_array + index;
ord->asc=1;
*prev=ord;
prev= &ord->next;
}
+ index++;
}
*prev=0;
return group;
@@ -8818,7 +8825,8 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
DBUG_RETURN(0);
err:
- delete [] param->copy_field; // This is never 0
+ if (copy)
+ delete [] param->copy_field;
param->copy_field=0;
err2:
DBUG_RETURN(TRUE);
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 7e0ee0dab68..636c88847eb 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -1414,15 +1414,15 @@ store_create_info(THD *thd, TABLE *table, String *packet)
!limited_mysql_mode && !foreign_db_mode)
{
if (key_info->algorithm == HA_KEY_ALG_BTREE)
- packet->append(" TYPE BTREE", 11);
+ packet->append(" USING BTREE", 12);
if (key_info->algorithm == HA_KEY_ALG_HASH)
- packet->append(" TYPE HASH", 10);
+ packet->append(" USING HASH", 11);
// +BAR: send USING only in non-default case: non-spatial rtree
if ((key_info->algorithm == HA_KEY_ALG_RTREE) &&
!(key_info->flags & HA_SPATIAL))
- packet->append(" TYPE RTREE", 11);
+ packet->append(" USING RTREE", 12);
// No need to send TYPE FULLTEXT, it is sent as FULLTEXT KEY
}
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index e27cd7196ed..204a8df6e9a 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1346,14 +1346,12 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
/* Check if table exists */
if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
{
- char tmp_table_name[tmp_file_prefix_length+22+22+22+3];
- my_snprintf(tmp_table_name, sizeof(tmp_table_name), "%s%lx_%lx_%x",
- tmp_file_prefix, current_pid, thd->thread_id,
- thd->tmp_table++);
+ my_snprintf(path, sizeof(path), "%s%s%lx_%lx_%x%s",
+ mysql_tmpdir, tmp_file_prefix, current_pid, thd->thread_id,
+ thd->tmp_table++, reg_ext);
if (lower_case_table_names)
- my_casedn_str(files_charset_info, tmp_table_name);
+ my_casedn_str(files_charset_info, path);
create_info->table_options|=HA_CREATE_DELAY_KEY_WRITE;
- build_table_path(path, sizeof(path), db, tmp_table_name, reg_ext);
}
else
build_table_path(path, sizeof(path), db, alias, reg_ext);
diff --git a/strings/Makefile.am b/strings/Makefile.am
index fa149817270..3f954f3c6a0 100644
--- a/strings/Makefile.am
+++ b/strings/Makefile.am
@@ -16,7 +16,8 @@
# This file is public domain and comes with NO WARRANTY of any kind
-INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include
+INCLUDES = @MT_INCLUDES@ \
+ -I$(top_builddir)/include -I$(top_srcdir)/include
pkglib_LIBRARIES = libmystrings.a
# Exact one of ASSEMBLER_X
diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh
index 06e9c2c75f0..2e4f7d12573 100644
--- a/support-files/mysql.spec.sh
+++ b/support-files/mysql.spec.sh
@@ -179,7 +179,7 @@ Summary: MySQL - server with extended functionality
Group: Applications/Databases
Provides: mysql-Max
Obsoletes: mysql-Max
-Requires: MySQL-server >= 4.0
+Requires: MySQL-server >= @MYSQL_BASE_VERSION@
%description Max
Optional MySQL server binary that supports additional features like:
diff --git a/tests/Makefile.am b/tests/Makefile.am
index de4fbb2a4f2..3c781b7e45b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -32,7 +32,8 @@ noinst_PROGRAMS = insert_test select_test thread_test
#
# C Test for 4.1 protocol
#
-INCLUDES = -I$(top_srcdir)/include $(openssl_includes)
+INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
+ $(openssl_includes)
LIBS = @CLIENT_LIBS@
LDADD = @CLIENT_EXTRA_LDFLAGS@ ../libmysql/libmysqlclient.la
mysql_client_test_LDADD= $(LDADD) $(CXXLDFLAGS)
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 5528df4dd68..bf81005ca2c 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -15,9 +15,11 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# Process this file with automake to create Makefile.in
-INCLUDES=@MT_INCLUDES@ -I$(top_srcdir)/include $(openssl_includes)
-LDADD= @CLIENT_EXTRA_LDFLAGS@ @openssl_libs@ \
- $(top_builddir)/libmysql_r/libmysqlclient_r.la @ZLIB_LIBS@
+INCLUDES= @MT_INCLUDES@ -I$(top_builddir)/include \
+ -I$(top_srcdir)/include $(openssl_includes)
+LDADD= @CLIENT_EXTRA_LDFLAGS@ @openssl_libs@ \
+ $(top_builddir)/libmysql_r/libmysqlclient_r.la \
+ @ZLIB_LIBS@
bin_PROGRAMS= mysqlmanager
mysqlmanager_SOURCES= mysqlmanager.c
mysqlmanager_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
diff --git a/vio/Makefile.am b/vio/Makefile.am
index 9c961025080..e27daa7ac35 100644
--- a/vio/Makefile.am
+++ b/vio/Makefile.am
@@ -14,7 +14,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-INCLUDES= -I$(top_srcdir)/include $(openssl_includes)
+INCLUDES= -I$(top_builddir)/include -I$(top_srcdir)/include \
+ $(openssl_includes)
LDADD= @CLIENT_EXTRA_LDFLAGS@ $(openssl_libs)
pkglib_LIBRARIES= libvio.a
noinst_PROGRAMS = test-ssl test-sslserver test-sslclient
diff --git a/vio/vio.c b/vio/vio.c
index 978780d2632..4660efe3048 100644
--- a/vio/vio.c
+++ b/vio/vio.c
@@ -130,7 +130,7 @@ Vio *vio_new(my_socket sd, enum enum_vio_type type, my_bool localhost)
sprintf(vio->desc,
(vio->type == VIO_TYPE_SOCKET ? "socket (%d)" : "TCP/IP (%d)"),
vio->sd);
-#if !defined(___WIN__) && !defined(__EMX__) && !defined(OS2)
+#if !defined(__WIN__) && !defined(__EMX__) && !defined(OS2)
#if !defined(NO_FCNTL_NONBLOCK)
#if defined(__FreeBSD__)
fcntl(sd, F_SETFL, vio->fcntl_mode); /* Yahoo! FreeBSD patch */
@@ -145,7 +145,7 @@ Vio *vio_new(my_socket sd, enum enum_vio_type type, my_bool localhost)
{
/* set to blocking mode by default */
ulong arg=0, r;
- r = ioctlsocket(sd,FIONBIO,(void*) &arg, sizeof(arg));
+ r = ioctlsocket(sd,FIONBIO,(void*) &arg);
vio->fcntl_mode &= ~O_NONBLOCK;
}
#endif
diff --git a/vio/viosocket.c b/vio/viosocket.c
index 904b75583a9..c7561890ead 100644
--- a/vio/viosocket.c
+++ b/vio/viosocket.c
@@ -82,7 +82,7 @@ int vio_blocking(Vio * vio __attribute__((unused)), my_bool set_blocking_mode,
DBUG_PRINT("enter", ("set_blocking_mode: %d old_mode: %d",
(int) set_blocking_mode, (int) *old_mode));
-#if !defined(___WIN__) && !defined(__EMX__)
+#if !defined(__WIN__) && !defined(__EMX__)
#if !defined(NO_FCNTL_NONBLOCK)
if (vio->sd >= 0)
{
@@ -115,7 +115,7 @@ int vio_blocking(Vio * vio __attribute__((unused)), my_bool set_blocking_mode,
vio->fcntl_mode |= O_NONBLOCK; /* set bit */
}
if (old_fcntl != vio->fcntl_mode)
- r = ioctlsocket(vio->sd,FIONBIO,(void*) &arg, sizeof(arg));
+ r = ioctlsocket(vio->sd,FIONBIO,(void*) &arg);
}
#ifndef __EMX__
else
diff --git a/vio/viossl.c b/vio/viossl.c
index 043d23f0238..2f608209a53 100644
--- a/vio/viossl.c
+++ b/vio/viossl.c
@@ -315,7 +315,7 @@ int sslaccept(struct st_VioSSLAcceptorFd* ptr, Vio* vio, long timeout)
vio_blocking(vio, net_blocking, &unused);
DBUG_RETURN(1);
}
-#ifndef DBUF_OFF
+#ifndef DBUG_OFF
DBUG_PRINT("info",("SSL_get_cipher_name() = '%s'"
,SSL_get_cipher_name((SSL*) vio->ssl_arg)));
client_cert = SSL_get_peer_certificate ((SSL*) vio->ssl_arg);
diff --git a/zlib/inftrees.c b/zlib/inftrees.c
index 8a896b28793..509461d9273 100644
--- a/zlib/inftrees.c
+++ b/zlib/inftrees.c
@@ -134,7 +134,7 @@ unsigned short FAR *work;
left -= count[len];
if (left < 0) return -1; /* over-subscribed */
}
- if (left > 0 && (type == CODES || (codes - count[0] != 1)))
+ if (left > 0 && (type == CODES || max != 1))
return -1; /* incomplete set */
/* generate offsets into symbol table for each length for sorting */