summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.bzrignore6
-rwxr-xr-x[-rw-r--r--]BUILD/SETUP.sh18
-rwxr-xr-xBUILD/compile-pentium64-debug13
-rw-r--r--BitKeeper/etc/logging_ok2
-rwxr-xr-xBuild-tools/Do-compile2
-rw-r--r--Docs/Images/Makefile.am4
-rw-r--r--VC++Files/client/mysqltest.dsp12
-rw-r--r--VC++Files/libmysqld/libmysqld.dsp4
-rw-r--r--VC++Files/mysqldemb/mysqldemb.dsp4
-rw-r--r--client/Makefile.am2
-rw-r--r--client/mysqlbinlog.cc15
-rw-r--r--configure.in14
-rw-r--r--dbug/Makefile.am4
-rw-r--r--extra/Makefile.am29
-rw-r--r--extra/comp_err.c8
-rw-r--r--include/Makefile.am9
-rw-r--r--include/m_ctype.h4
-rw-r--r--include/my_global.h4
-rw-r--r--include/my_sys.h2
-rw-r--r--innobase/include/eval0eval.ic2
-rw-r--r--innobase/include/rem0rec.ic4
-rw-r--r--innobase/include/trx0trx.h4
-rw-r--r--innobase/include/univ.i6
-rw-r--r--innobase/os/os0file.c7
-rw-r--r--innobase/row/row0mysql.c12
-rw-r--r--innobase/ut/ut0mem.c4
-rw-r--r--innobase/ut/ut0ut.c7
-rw-r--r--libmysql/Makefile.am2
-rw-r--r--libmysql/libmysql.c4
-rw-r--r--libmysql_r/Makefile.am2
-rw-r--r--libmysqld/Makefile.am2
-rw-r--r--libmysqld/examples/Makefile.am15
-rw-r--r--mysql-test/include/have_federated_db.inc2
-rw-r--r--mysql-test/include/ndb_default_cluster.inc4
-rw-r--r--mysql-test/include/testdb_only.inc30
-rw-r--r--mysql-test/mysql-test-run.sh37
-rw-r--r--mysql-test/r/federated.result119
-rw-r--r--mysql-test/r/have_federated_db.require2
-rw-r--r--mysql-test/r/information_schema.result7
-rw-r--r--mysql-test/r/insert_select.result12
-rw-r--r--mysql-test/r/lowercase_table2.result14
-rw-r--r--mysql-test/r/ndb_alter_table.result8
-rw-r--r--mysql-test/r/ndb_autodiscover.result4
-rw-r--r--mysql-test/r/ndb_default_cluster.require2
-rw-r--r--mysql-test/r/ndb_index_ordered.result44
-rw-r--r--mysql-test/r/ndb_index_unique.result14
-rw-r--r--mysql-test/r/order_by.result17
-rw-r--r--mysql-test/r/testdb_only.require2
-rw-r--r--mysql-test/r/user_limits.result7
-rw-r--r--mysql-test/t/archive.test2
-rw-r--r--mysql-test/t/federated.test104
-rw-r--r--mysql-test/t/information_schema.test2
-rw-r--r--mysql-test/t/insert_select.test15
-rw-r--r--mysql-test/t/lowercase_table2.test14
-rw-r--r--mysql-test/t/ndb_alter_table.test4
-rw-r--r--mysql-test/t/ndb_autodiscover.test2
-rw-r--r--mysql-test/t/ndb_index_ordered.test30
-rw-r--r--mysql-test/t/ndb_index_unique.test21
-rw-r--r--mysql-test/t/ndb_restore.test1
-rw-r--r--mysql-test/t/order_by.test10
-rw-r--r--mysql-test/t/user_limits.test8
-rw-r--r--mysys/my_static.c2
-rw-r--r--ndb/Makefile.am3
-rw-r--r--ndb/docs/Makefile.am4
-rw-r--r--ndb/examples/configurations/demos.tarbin40960 -> 0 bytes
-rw-r--r--ndb/include/Makefile.am1
-rw-r--r--ndb/include/kernel/signaldata/CreateIndx.hpp2
-rw-r--r--ndb/include/kernel/signaldata/DictTabInfo.hpp12
-rw-r--r--ndb/include/mgmapi/mgmapi_config_parameters.h1
-rw-r--r--ndb/include/ndb_constants.h4
-rw-r--r--ndb/include/ndbapi/NdbDictionary.hpp4
-rw-r--r--ndb/include/ndbapi/NdbScanFilter.hpp2
-rw-r--r--ndb/include/ndbapi/ndb_opt_defaults.h23
-rw-r--r--ndb/include/transporter/TransporterDefinitions.hpp1
-rw-r--r--ndb/include/util/NdbSqlUtil.hpp6
-rw-r--r--ndb/include/util/ndb_opts.h59
-rw-r--r--ndb/ndbapi-examples/Makefile (renamed from ndb/examples/Makefile)0
-rw-r--r--ndb/ndbapi-examples/mgmapi_logevent_example/Makefile (renamed from ndb/examples/mgmapi_logevent_example/Makefile)0
-rw-r--r--ndb/ndbapi-examples/mgmapi_logevent_example/mgmapi_logevent.cpp (renamed from ndb/examples/mgmapi_logevent_example/mgmapi_logevent.cpp)0
-rw-r--r--ndb/ndbapi-examples/ndbapi_async_example/Makefile (renamed from ndb/examples/ndbapi_async_example/Makefile)0
-rw-r--r--ndb/ndbapi-examples/ndbapi_async_example/ndbapi_async.cpp (renamed from ndb/examples/ndbapi_async_example/ndbapi_async.cpp)0
-rw-r--r--ndb/ndbapi-examples/ndbapi_async_example/readme.txt (renamed from ndb/examples/ndbapi_async_example/readme.txt)0
-rw-r--r--ndb/ndbapi-examples/ndbapi_async_example1/Makefile (renamed from ndb/examples/ndbapi_async_example1/Makefile)0
-rw-r--r--ndb/ndbapi-examples/ndbapi_async_example1/ndbapi_async1.cpp (renamed from ndb/examples/ndbapi_async_example1/ndbapi_async1.cpp)0
-rw-r--r--ndb/ndbapi-examples/ndbapi_event_example/Makefile (renamed from ndb/examples/ndbapi_event_example/Makefile)0
-rw-r--r--ndb/ndbapi-examples/ndbapi_event_example/ndbapi_event.cpp (renamed from ndb/examples/ndbapi_event_example/ndbapi_event.cpp)0
-rw-r--r--ndb/ndbapi-examples/ndbapi_retries_example/Makefile (renamed from ndb/examples/ndbapi_retries_example/Makefile)0
-rw-r--r--ndb/ndbapi-examples/ndbapi_retries_example/ndbapi_retries.cpp (renamed from ndb/examples/ndbapi_retries_example/ndbapi_retries.cpp)0
-rw-r--r--ndb/ndbapi-examples/ndbapi_scan_example/Makefile (renamed from ndb/examples/ndbapi_scan_example/Makefile)0
-rw-r--r--ndb/ndbapi-examples/ndbapi_scan_example/ndbapi_scan.cpp (renamed from ndb/examples/ndbapi_scan_example/ndbapi_scan.cpp)0
-rw-r--r--ndb/ndbapi-examples/ndbapi_scan_example/readme.txt (renamed from ndb/examples/ndbapi_scan_example/readme.txt)0
-rw-r--r--ndb/ndbapi-examples/ndbapi_simple_example/Makefile (renamed from ndb/examples/ndbapi_simple_example/Makefile)0
-rw-r--r--ndb/ndbapi-examples/ndbapi_simple_example/ndbapi_simple.cpp (renamed from ndb/examples/ndbapi_simple_example/ndbapi_simple.cpp)0
-rw-r--r--ndb/ndbapi-examples/ndbapi_simple_index_example/Makefile (renamed from ndb/examples/ndbapi_simple_index_example/Makefile)0
-rw-r--r--ndb/ndbapi-examples/ndbapi_simple_index_example/ndbapi_simple_index.cpp (renamed from ndb/examples/ndbapi_simple_index_example/ndbapi_simple_index.cpp)0
-rw-r--r--ndb/src/common/mgmcommon/IPCConfig.cpp11
-rw-r--r--ndb/src/common/portlib/NdbThread.c19
-rw-r--r--ndb/src/common/transporter/SHM_Transporter.cpp8
-rw-r--r--ndb/src/common/transporter/TransporterRegistry.cpp74
-rw-r--r--ndb/src/common/util/NdbSqlUtil.cpp42
-rw-r--r--ndb/src/cw/cpcd/main.cpp5
-rw-r--r--ndb/src/kernel/blocks/dbdict/Dbdict.cpp58
-rw-r--r--ndb/src/kernel/vm/Configuration.cpp23
-rw-r--r--ndb/src/mgmclient/main.cpp23
-rw-r--r--ndb/src/mgmsrv/ConfigInfo.cpp42
-rw-r--r--ndb/src/mgmsrv/main.cpp30
-rw-r--r--ndb/src/ndbapi/NdbDictionary.cpp6
-rw-r--r--ndb/src/ndbapi/NdbDictionaryImpl.cpp22
-rw-r--r--ndb/src/ndbapi/NdbRecAttr.cpp99
-rw-r--r--ndb/test/include/NdbSchemaOp.hpp4
-rw-r--r--ndb/test/run-test/Makefile.am2
-rw-r--r--ndb/tools/delete_all.cpp23
-rw-r--r--ndb/tools/desc.cpp25
-rw-r--r--ndb/tools/drop_index.cpp23
-rw-r--r--ndb/tools/drop_tab.cpp23
-rw-r--r--ndb/tools/listTables.cpp27
-rw-r--r--ndb/tools/restore/restore_main.cpp20
-rw-r--r--ndb/tools/select_all.cpp23
-rw-r--r--ndb/tools/select_count.cpp23
-rw-r--r--ndb/tools/waiter.cpp25
-rw-r--r--scripts/Makefile.am2
-rw-r--r--server-tools/instance-manager/Makefile.am2
-rw-r--r--sql/Makefile.am6
-rw-r--r--sql/examples/ha_archive.cc60
-rw-r--r--sql/examples/ha_archive.h4
-rw-r--r--sql/field.cc109
-rw-r--r--sql/field.h4
-rw-r--r--sql/filesort.cc4
-rw-r--r--sql/ha_federated.cc296
-rwxr-xr-xsql/ha_federated.h8
-rw-r--r--sql/ha_innodb.cc5
-rw-r--r--sql/ha_ndbcluster.cc77
-rw-r--r--sql/ha_ndbcluster.h1
-rw-r--r--sql/handler.cc14
-rw-r--r--sql/item_create.cc5
-rw-r--r--sql/item_sum.cc6
-rw-r--r--sql/item_timefunc.cc17
-rw-r--r--sql/key.cc4
-rw-r--r--sql/mysql_priv.h9
-rw-r--r--sql/mysqld.cc19
-rw-r--r--sql/opt_range.cc2
-rw-r--r--sql/set_var.cc14
-rw-r--r--sql/set_var.h2
-rw-r--r--sql/share/Makefile.am5
-rw-r--r--sql/sql_acl.cc4
-rw-r--r--sql/sql_analyse.cc40
-rw-r--r--sql/sql_class.h2
-rw-r--r--sql/sql_help.cc7
-rw-r--r--sql/sql_insert.cc47
-rw-r--r--sql/sql_parse.cc1
-rw-r--r--sql/sql_select.cc11
-rw-r--r--sql/sql_show.cc18
-rw-r--r--sql/table.cc6
-rw-r--r--strings/ctype-big5.c1
-rw-r--r--strings/ctype-bin.c2
-rw-r--r--strings/ctype-cp932.c1
-rw-r--r--strings/ctype-czech.c1
-rw-r--r--strings/ctype-euc_kr.c1
-rw-r--r--strings/ctype-eucjpms.c1
-rw-r--r--strings/ctype-gb2312.c1
-rw-r--r--strings/ctype-gbk.c1
-rw-r--r--strings/ctype-latin1.c1
-rw-r--r--strings/ctype-mb.c1
-rw-r--r--strings/ctype-simple.c10
-rw-r--r--strings/ctype-sjis.c1
-rw-r--r--strings/ctype-tis620.c1
-rw-r--r--strings/ctype-uca.c2
-rw-r--r--strings/ctype-ucs2.c2
-rw-r--r--strings/ctype-ujis.c1
-rw-r--r--strings/ctype-utf8.c37
-rw-r--r--strings/ctype-win1250ch.c1
-rw-r--r--tools/Makefile.am2
172 files changed, 1628 insertions, 820 deletions
diff --git a/.bzrignore b/.bzrignore
index 460ea002bff..bb1cdb1c0c3 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -382,8 +382,11 @@ libmysqld/examples/link_sources
libmysqld/examples/my_readline.h
libmysqld/examples/mysql
libmysqld/examples/mysql.cc
+libmysqld/examples/mysql_client_test.c
+libmysqld/examples/mysql_client_test_embedded
libmysqld/examples/mysqltest
libmysqld/examples/mysqltest.c
+libmysqld/examples/mysqltest_embedded
libmysqld/examples/readline.cc
libmysqld/examples/sql_string.cc
libmysqld/examples/sql_string.h
@@ -1049,3 +1052,6 @@ vio/test-ssl
vio/test-sslclient
vio/test-sslserver
vio/viotest-ssl
+include/mysqld_ername.h
+include/mysqld_error.h
+include/sql_state.h
diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh
index fa20fd14571..b899b9a7d9b 100644..100755
--- a/BUILD/SETUP.sh
+++ b/BUILD/SETUP.sh
@@ -6,12 +6,15 @@ then
exit 1
fi
+prefix_configs="--prefix=/usr/local/mysql"
just_print=
just_configure=
full_debug=
while test $# -gt 0
do
case "$1" in
+ --prefix=* ) prefix_configs="$1"; shift ;;
+ --with-debug=full ) full_debug="=full"; shift ;;
-c | --just-configure ) just_configure=1; shift ;;
-n | --just-print | --print ) just_print=1; shift ;;
-h | --help ) cat <<EOF; exit 0 ;;
@@ -19,13 +22,15 @@ Usage: $0 [-h|-n] [configure-options]
-h, --help Show this help message.
-n, --just-print Don't actually run any commands; just print them.
-c, --just-configure Stop after running configure.
-
-Any other options will be passed directly to configure.
+ --with-debug=full Build with full debug.
+ --prefix=path Build with prefix 'path'.
Note: this script is intended for internal use by MySQL developers.
EOF
- --with-debug=full ) full_debug="=full"; shift ;;
- * ) break ;;
+ * )
+ echo "Unknown option '$1'"
+ exit 1
+ break ;;
esac
done
@@ -62,11 +67,12 @@ fast_cflags="-O3 -fno-omit-frame-pointer"
reckless_cflags="-O3 -fomit-frame-pointer "
debug_cflags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS -DSAFEMALLOC -DPEDANTIC_SAFEMALLOC -DSAFE_MUTEX"
+debug_extra_cflags="-O1 -Wuninitialized"
base_cxxflags="-felide-constructors -fno-exceptions -fno-rtti"
amd64_cxxflags="-DBIG_TABLES"
-base_configs="--prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-readline"
+base_configs="$prefix_configs --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-readline"
static_link="--with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static"
amd64_configs=""
alpha_configs="" # Not used yet
@@ -80,7 +86,7 @@ local_infile_configs="--enable-local-infile"
debug_configs="--with-debug$full_debug"
if [ -z "$full_debug" ]
then
- debug_cflags="$debug_cflags -O1 -Wuninitialized"
+ debug_cflags="$debug_cflags $debug_extra_cflags"
fi
if gmake --version > /dev/null 2>&1
diff --git a/BUILD/compile-pentium64-debug b/BUILD/compile-pentium64-debug
new file mode 100755
index 00000000000..0299669f79a
--- /dev/null
+++ b/BUILD/compile-pentium64-debug
@@ -0,0 +1,13 @@
+#! /bin/sh
+
+path=`dirname $0`
+. "$path/SETUP.sh" $@ --with-debug=full
+
+extra_flags="$pentium64_cflags $debug_cflags"
+c_warnings="$c_warnings $debug_extra_warnings"
+cxx_warnings="$cxx_warnings $debug_extra_warnings"
+extra_configs="$pentium_configs $debug_configs $static_link"
+
+extra_configs="$extra_configs "
+
+. "$path/FINISH.sh"
diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok
index 83ad1717ba3..6f99987bd9b 100644
--- a/BitKeeper/etc/logging_ok
+++ b/BitKeeper/etc/logging_ok
@@ -172,6 +172,7 @@ nick@nick.leippe.com
papa@gbichot.local
patg@krsna.patg.net
patg@patrick-galbraiths-computer.local
+patg@pc248.lfp.kcls.org
paul@central.snake.net
paul@frost.snake.net
paul@ice.local
@@ -240,6 +241,7 @@ tonu@x153.internalnet
tonu@x3.internalnet
tsmith@build.mysql.com
tulin@build.mysql.com
+tulin@mysql.com
ulli@morbus.(none)
venu@hundin.mysql.fi
venu@myvenu.com
diff --git a/Build-tools/Do-compile b/Build-tools/Do-compile
index 68d5b5166ea..03fad4d0f51 100755
--- a/Build-tools/Do-compile
+++ b/Build-tools/Do-compile
@@ -156,7 +156,7 @@ $ENV{'MYSQL_TCP_PORT'}= $mysql_tcp_port= 3334 + $opt_build_thread*2;
$ENV{'MYSQL_UNIX_PORT'}=$mysql_unix_port="$opt_tmp/mysql$opt_suffix.build";
$ENV{"PERL5LIB"}="$pwd/$host/perl5:$pwd/$host/perl5/site_perl";
$slave_port=$mysql_tcp_port+16;
-$ndbcluster_port= 9350 + $opt_build_thread*2;
+$ndbcluster_port= 9350 + $opt_build_thread*4;
$manager_port=$mysql_tcp_port+1;
$mysqladmin_args="--no-defaults -u root --connect_timeout=5 --shutdown_timeout=20";
diff --git a/Docs/Images/Makefile.am b/Docs/Images/Makefile.am
index b57d701d8a0..8ba1ff7382c 100644
--- a/Docs/Images/Makefile.am
+++ b/Docs/Images/Makefile.am
@@ -27,9 +27,5 @@ EXTRA_DIST =
all:
:
-# Nothing to cleanup in this dummy directory.
-clean:
- :
-
# Don't update the files from bitkeeper
%::SCCS/s.%
diff --git a/VC++Files/client/mysqltest.dsp b/VC++Files/client/mysqltest.dsp
index d04dc5bfce8..1ebd7a59b0c 100644
--- a/VC++Files/client/mysqltest.dsp
+++ b/VC++Files/client/mysqltest.dsp
@@ -42,8 +42,8 @@ RSC=rc.exe
# PROP Output_Dir ".\debug"
# PROP Intermediate_Dir ".\debug"
# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /I "../include" /I "../regex" /I "../" /Z7 /W3 /Od /G6 /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_WINDOWS" /D "_MBCS" /Fp".\debug/mysqltest.pch" /Fo".\debug/" /Fd".\debug/" /GZ /c /GX
-# ADD CPP /nologo /MTd /I "../include" /I "../regex" /I "../" /Z7 /W3 /Od /G6 /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_WINDOWS" /D "_MBCS" /Fp".\debug/mysqltest.pch" /Fo".\debug/" /Fd".\debug/" /GZ /c /GX
+# ADD BASE CPP /nologo /MTd /I "../extra" /I "../include" /I "../regex" /I "../" /Z7 /W3 /Od /G6 /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_WINDOWS" /D "_MBCS" /Fp".\debug/mysqltest.pch" /Fo".\debug/" /Fd".\debug/" /GZ /c /GX
+# ADD CPP /nologo /MTd /I "../extra" /I "../include" /I "../regex" /I "../" /Z7 /W3 /Od /G6 /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_WINDOWS" /D "_MBCS" /Fp".\debug/mysqltest.pch" /Fo".\debug/" /Fd".\debug/" /GZ /c /GX
# ADD BASE MTL /nologo /tlb".\debug\mysqltest.tlb" /win32
# ADD MTL /nologo /tlb".\debug\mysqltest.tlb" /win32
# ADD BASE RSC /l 1033 /d "_DEBUG"
@@ -67,8 +67,8 @@ LINK32=link.exe
# PROP Output_Dir ".\classic"
# PROP Intermediate_Dir ".\classic"
# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /I "../include" /I "../regex" /I "../" /W3 /Ob1 /G6 /D "_CONSOLE" /D "_WINDOWS" /D "LICENSE=Commercial" /D "DBUG_OFF" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\classic/mysqltest.pch" /Fo".\classic/" /Fd".\classic/" /c /GX
-# ADD CPP /nologo /MT /I "../include" /I "../regex" /I "../" /W3 /Ob1 /G6 /D "_CONSOLE" /D "_WINDOWS" /D "LICENSE=Commercial" /D "DBUG_OFF" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\classic/mysqltest.pch" /Fo".\classic/" /Fd".\classic/" /c /GX
+# ADD BASE CPP /nologo /MT /I "../extra" /I "../include" /I "../regex" /I "../" /W3 /Ob1 /G6 /D "_CONSOLE" /D "_WINDOWS" /D "LICENSE=Commercial" /D "DBUG_OFF" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\classic/mysqltest.pch" /Fo".\classic/" /Fd".\classic/" /c /GX
+# ADD CPP /nologo /MT /I "../extra" /I "../include" /I "../regex" /I "../" /W3 /Ob1 /G6 /D "_CONSOLE" /D "_WINDOWS" /D "LICENSE=Commercial" /D "DBUG_OFF" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\classic/mysqltest.pch" /Fo".\classic/" /Fd".\classic/" /c /GX
# ADD BASE MTL /nologo /tlb".\classic\mysqltest.tlb" /win32
# ADD MTL /nologo /tlb".\classic\mysqltest.tlb" /win32
# ADD BASE RSC /l 1033 /d "NDEBUG"
@@ -92,8 +92,8 @@ LINK32=link.exe
# PROP Output_Dir ".\release"
# PROP Intermediate_Dir ".\release"
# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /I "../include" /I "../regex" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_CONSOLE" /D "_WINDOWS" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\release/mysqltest.pch" /Fo".\release/" /Fd".\release/" /c /GX
-# ADD CPP /nologo /MT /I "../include" /I "../regex" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_CONSOLE" /D "_WINDOWS" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\release/mysqltest.pch" /Fo".\release/" /Fd".\release/" /c /GX
+# ADD BASE CPP /nologo /MT /I "../extra" /I "../include" /I "../regex" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_CONSOLE" /D "_WINDOWS" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\release/mysqltest.pch" /Fo".\release/" /Fd".\release/" /c /GX
+# ADD CPP /nologo /MT /I "../extra" /I "../include" /I "../regex" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_CONSOLE" /D "_WINDOWS" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\release/mysqltest.pch" /Fo".\release/" /Fd".\release/" /c /GX
# ADD BASE MTL /nologo /tlb".\release\mysqltest.tlb" /win32
# ADD MTL /nologo /tlb".\release\mysqltest.tlb" /win32
# ADD BASE RSC /l 1033 /d "NDEBUG"
diff --git a/VC++Files/libmysqld/libmysqld.dsp b/VC++Files/libmysqld/libmysqld.dsp
index 99912228445..019589289cd 100644
--- a/VC++Files/libmysqld/libmysqld.dsp
+++ b/VC++Files/libmysqld/libmysqld.dsp
@@ -228,10 +228,6 @@ SOURCE=..\sql\ha_innodb.cpp
# End Source File
# Begin Source File
-SOURCE=..\sql\ha_isammrg.cpp
-# End Source File
-# Begin Source File
-
SOURCE=..\sql\ha_myisam.cpp
# End Source File
# Begin Source File
diff --git a/VC++Files/mysqldemb/mysqldemb.dsp b/VC++Files/mysqldemb/mysqldemb.dsp
index a8207d436a0..61a745ff7e8 100644
--- a/VC++Files/mysqldemb/mysqldemb.dsp
+++ b/VC++Files/mysqldemb/mysqldemb.dsp
@@ -169,10 +169,6 @@ SOURCE=..\sql\ha_innodb.cpp
# End Source File
# Begin Source File
-SOURCE=..\sql\ha_isammrg.cpp
-# End Source File
-# Begin Source File
-
SOURCE=..\sql\ha_myisam.cpp
# End Source File
# Begin Source File
diff --git a/client/Makefile.am b/client/Makefile.am
index 9b62d698e38..2721953629e 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -18,7 +18,7 @@
#AUTOMAKE_OPTIONS = nostdinc
INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/regex \
- $(openssl_includes) -I$(top_srcdir)/extra
+ $(openssl_includes) -I$(top_builddir)/include
LIBS = @CLIENT_LIBS@
LDADD= @CLIENT_EXTRA_LDFLAGS@ \
$(top_builddir)/libmysql/libmysqlclient.la
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index 45daa64705a..caf126f2830 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -744,7 +744,7 @@ static int parse_args(int *argc, char*** argv)
static MYSQL* safe_connect()
{
- MYSQL *local_mysql = mysql_init(NULL);
+ MYSQL *local_mysql= mysql_init(NULL);
if (!local_mysql)
die("Failed on mysql_init");
@@ -752,9 +752,13 @@ static MYSQL* safe_connect()
if (opt_protocol)
mysql_options(local_mysql, MYSQL_OPT_PROTOCOL, (char*) &opt_protocol);
if (!mysql_real_connect(local_mysql, host, user, pass, 0, port, sock, 0))
- die("failed on connect: %s", mysql_error(local_mysql));
+ {
+ char errmsg[256];
+ strmake(errmsg, mysql_error(local_mysql), sizeof(errmsg)-1);
+ mysql_close(local_mysql);
+ die("failed on connect: %s", errmsg);
+ }
local_mysql->reconnect= 1;
-
return local_mysql;
}
@@ -781,9 +785,8 @@ static int check_master_version(MYSQL* mysql,
if (mysql_query(mysql, "SELECT VERSION()") ||
!(res = mysql_store_result(mysql)))
{
- char errmsg[FN_REFLEN];
-
- strmake(errmsg, mysql_error(mysql), sizeof(errmsg) - 1);
+ char errmsg[256];
+ strmake(errmsg, mysql_error(mysql), sizeof(errmsg)-1);
mysql_close(mysql);
die("Error checking master version: %s", errmsg);
}
diff --git a/configure.in b/configure.in
index fbbf3918c45..b2d8d65439d 100644
--- a/configure.in
+++ b/configure.in
@@ -1531,14 +1531,11 @@ then
fi
fi
-TOOLS_LIBS="$NON_THREADED_CLIENT_LIBS"
-
# Should we use named pthread library ?
AC_MSG_CHECKING("named thread libs:")
if test "$with_named_thread" != "no"
then
LIBS="$with_named_thread $LIBS $with_named_thread"
- TOOLS_LIBS="$with_named_thread $TOOLS_LIBS $with_named_thread"
with_posix_threads="yes"
with_mit_threads="no"
AC_MSG_RESULT("$with_named_thread")
@@ -1557,9 +1554,7 @@ else
then
AC_MSG_CHECKING("for pthread_create in -lpthread");
ac_save_LIBS="$LIBS"
- ac_save_TOOLS_LIBS="$TOOLS_LIBS"
LIBS="$LIBS -lpthread"
- TOOLS_LIBS="$TOOLS_LIBS -lpthread"
AC_TRY_LINK(
[#include <pthread.h>],
[ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
@@ -1568,7 +1563,6 @@ else
if test "$with_posix_threads" = "no"
then
LIBS=" $ac_save_LIBS -lpthreads"
- TOOLS_LIBS=" $ac_save_TOOLS_LIBS -lpthreads"
AC_MSG_CHECKING("for pthread_create in -lpthreads");
AC_TRY_LINK(
[#include <pthread.h>],
@@ -1579,7 +1573,6 @@ else
then
# This is for FreeBSD
LIBS="$ac_save_LIBS -pthread"
- TOOLS_LIBS="$ac_save_TOOLS_LIBS -pthread"
AC_MSG_CHECKING("for pthread_create in -pthread");
AC_TRY_LINK(
[#include <pthread.h>],
@@ -1590,7 +1583,6 @@ else
then
with_mit_threads="yes"
LIBS="$ac_save_LIBS"
- TOOLS_LIBS="$ac_save_TOOLS_LIBS"
fi
fi
fi
@@ -1678,12 +1670,12 @@ if test "$with_debug" = "yes"
then
# Medium debug.
CFLAGS="$DEBUG_CFLAGS $DEBUG_OPTIMIZE_CC -DDBUG_ON -DSAFE_MUTEX $CFLAGS"
- CXXFLAGS="$DEBUG_CXXFLAGS $DEBUG_OPTIMIZE_CXX -DSAFE_MUTEX $CXXFLAGS"
+ CXXFLAGS="$DEBUG_CXXFLAGS $DEBUG_OPTIMIZE_CXX -DDBUG_ON -DSAFE_MUTEX $CXXFLAGS"
elif test "$with_debug" = "full"
then
# Full debug. Very slow in some cases
CFLAGS="$DEBUG_CFLAGS -DDBUG_ON -DSAFE_MUTEX -DSAFEMALLOC $CFLAGS"
- CXXFLAGS="$DEBUG_CXXFLAGS -DSAFE_MUTEX -DSAFEMALLOC $CXXFLAGS"
+ CXXFLAGS="$DEBUG_CXXFLAGS -DDBUG_ON -DSAFE_MUTEX -DSAFEMALLOC $CXXFLAGS"
else
# Optimized version. No debug
CFLAGS="$OPTIMIZE_CFLAGS -DDBUG_OFF $CFLAGS"
@@ -2656,8 +2648,6 @@ AC_SUBST(sql_union_dirs)
# Some usefull subst
AC_SUBST(CC)
AC_SUBST(GXX)
-#Remove TOOLS_LIBS, because this is included in LIBRARIES
-#AC_SUBST(TOOLS_LIBS)
# Set configuration options for make_binary_distribution
case $SYSTEM_TYPE in
diff --git a/dbug/Makefile.am b/dbug/Makefile.am
index f8ddf0e6567..a951aff6094 100644
--- a/dbug/Makefile.am
+++ b/dbug/Makefile.am
@@ -26,6 +26,7 @@ EXTRA_DIST = example1.c example2.c example3.c \
NROFF_INC = example1.r example2.r example3.r main.r \
factorial.r output1.r output2.r output3.r \
output4.r output5.r
+CLEANFILES = $(NROFF_INC) user.t user.ps
# Must be linked with libs that are not compiled yet
@@ -59,8 +60,5 @@ output5.r: factorial
@RM@ -f $@
@SED@ -e 's!\\!\\\\!g' $< > $@
-clean:
- @RM@ -f $(NROFF_INC) user.t user.ps
-
# Don't update the files from bitkeeper
%::SCCS/s.%
diff --git a/extra/Makefile.am b/extra/Makefile.am
index 9f18cbf96e6..43981753515 100644
--- a/extra/Makefile.am
+++ b/extra/Makefile.am
@@ -16,25 +16,26 @@
INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include \
@ndbcluster_includes@ -I$(top_srcdir)/sql \
- -I$(top_srcdir)/extra
+ -I$(top_builddir)/include
LDADD = @CLIENT_EXTRA_LDFLAGS@ ../mysys/libmysys.a \
../dbug/libdbug.a ../strings/libmystrings.a
-BUILT_SOURCES= mysqld_error.h sql_state.h mysqld_ername.h
+BUILT_SOURCES= $(top_builddir)/include/mysqld_error.h \
+ $(top_builddir)/include/sql_state.h \
+ $(top_builddir)/include/mysqld_ername.h
pkginclude_HEADERS= $(BUILT_SOURCES)
-created_sources = created_include_files
-CLEANFILES = $(created_sources)
-SUPERCLEANFILES = $(BUILT_SOURCES)
-
-all: $(created_sources)
+CLEANFILES = $(BUILT_SOURCES)
# This will build mysqld_error.h and sql_state.h
-mysqld_error.h: created_include_files
-mysqld_ername.h: created_include_files
-sql_state.h: created_include_files
-
-created_include_files: comp_err
- $(top_builddir)/extra/comp_err --charset=$(srcdir)/../sql/share/charsets --out-dir=$(top_builddir)/sql/share/ --header_file=$(top_builddir)/extra/mysqld_error.h --name_file=$(top_builddir)/extra/mysqld_ername.h --state_file=$(top_builddir)/extra/sql_state.h --in_file=$(srcdir)/../sql/share/errmsg.txt
- touch created_include_files
+$(top_builddir)/include/mysqld_error.h: comp_err
+ $(top_builddir)/extra/comp_err \
+ --charset=$(top_srcdir)/sql/share/charsets \
+ --out-dir=$(top_builddir)/sql/share/ \
+ --header_file=$(top_builddir)/include/mysqld_error.h \
+ --name_file=$(top_builddir)/include/mysqld_ername.h \
+ --state_file=$(top_builddir)/include/sql_state.h \
+ --in_file=$(top_srcdir)/sql/share/errmsg.txt
+$(top_builddir)/include/mysqld_ername.h: $(top_builddir)/include/mysqld_error.h
+$(top_builddir)/include/sql_state.h: $(top_builddir)/include/mysqld_error.h
bin_PROGRAMS = replace comp_err perror resolveip my_print_defaults \
resolve_stack_dump mysql_waitpid
diff --git a/extra/comp_err.c b/extra/comp_err.c
index baed28a0350..a554fc2437e 100644
--- a/extra/comp_err.c
+++ b/extra/comp_err.c
@@ -41,7 +41,7 @@ static char *HEADERFILE= (char*) "mysqld_error.h";
static char *NAMEFILE= (char*) "mysqld_ername.h";
static char *STATEFILE= (char*) "sql_state.h";
static char *TXTFILE= (char*) "../sql/share/errmsg.txt";
-static char *DATADIR= (char*) "../sql/share/";
+static char *DATADIRECTORY= (char*) "../sql/share/";
static char *default_dbug_option= (char*) "d:t:O,/tmp/comp_err.trace";
/* Header for errmsg.sys files */
@@ -112,8 +112,8 @@ static struct my_option my_long_options[]=
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"in_file", 'F', "Input file", (gptr *) & TXTFILE, (gptr *) & TXTFILE,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"out_dir", 'D', "Output base directory", (gptr *) & DATADIR,
- (gptr *) & DATADIR,
+ {"out_dir", 'D', "Output base directory", (gptr *) & DATADIRECTORY,
+ (gptr *) & DATADIRECTORY,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"out_file", 'O', "Output filename (errmsg.sys)", (gptr *) & OUTFILE,
(gptr *) & OUTFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -281,7 +281,7 @@ static int create_sys_files(struct languages *lang_head,
DBUG_RETURN(1);
}
- outfile_end= strxmov(outfile, DATADIR,
+ outfile_end= strxmov(outfile, DATADIRECTORY,
tmp_lang->lang_long_name, NullS);
if (!my_stat(outfile, &stat_info,MYF(0)))
{
diff --git a/include/Makefile.am b/include/Makefile.am
index e11ca2b4647..08beb4b7236 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -33,15 +33,10 @@ noinst_HEADERS = config-win.h config-os2.h config-netware.h \
mysql_version.h.in my_handler.h my_time.h decimal.h
# mysql_version.h are generated
-SUPERCLEANFILES = mysql_version.h my_config.h
+CLEANFILES = mysql_version.h my_config.h readline
# Some include files that may be moved and patched by configure
-DISTCLEANFILES = sched.h $(SUPERCLEANFILES)
-
-clean:
- $(RM) -fr readline
-distclean:
- $(RM) -fr readline
+DISTCLEANFILES = sched.h $(CLEANFILES)
all-local: my_config.h
diff --git a/include/m_ctype.h b/include/m_ctype.h
index c2354c7feff..c41c7385b3d 100644
--- a/include/m_ctype.h
+++ b/include/m_ctype.h
@@ -110,6 +110,7 @@ typedef struct my_collation_handler_st
my_bool diff_if_only_endspace_difference);
int (*strnxfrm)(struct charset_info_st *,
uchar *, uint, const uchar *, uint);
+ uint (*strnxfrmlen)(struct charset_info_st *, uint);
my_bool (*like_range)(struct charset_info_st *,
const char *s, uint s_length,
pchar w_prefix, pchar w_one, pchar w_many,
@@ -259,7 +260,8 @@ extern CHARSET_INFO my_charset_cp1250_czech_ci;
/* declarations for simple charsets */
extern int my_strnxfrm_simple(CHARSET_INFO *, uchar *, uint, const uchar *,
- uint);
+ uint);
+uint my_strnxfrmlen_simple(CHARSET_INFO *, uint);
extern int my_strnncoll_simple(CHARSET_INFO *, const uchar *, uint,
const uchar *, uint, my_bool);
diff --git a/include/my_global.h b/include/my_global.h
index 21ba4331cb1..f27eb4733bd 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -530,7 +530,11 @@ typedef SOCKET_SIZE_TYPE size_socket;
#define FN_LEN 256 /* Max file name len */
#define FN_HEADLEN 253 /* Max length of filepart of file name */
#define FN_EXTLEN 20 /* Max length of extension (part of FN_LEN) */
+#ifdef PATH_MAX
+#define FN_REFLEN PATH_MAX/* Max length of full path-name */
+#else
#define FN_REFLEN 512 /* Max length of full path-name */
+#endif
#define FN_EXTCHAR '.'
#define FN_HOMELIB '~' /* ~/ is used as abbrev for home dir */
#define FN_CURLIB '.' /* ./ is used as abbrev for current dir */
diff --git a/include/my_sys.h b/include/my_sys.h
index d11dc4a3e46..72d4bec74b1 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -259,6 +259,8 @@ extern char wild_many,wild_one,wild_prefix;
extern const char *charsets_dir;
extern char *defaults_extra_file;
+extern my_bool timed_mutexes;
+
typedef struct wild_file_pack /* Struct to hold info when selecting files */
{
uint wilds; /* How many wildcards */
diff --git a/innobase/include/eval0eval.ic b/innobase/include/eval0eval.ic
index 2530c869206..069cbfe5f37 100644
--- a/innobase/include/eval0eval.ic
+++ b/innobase/include/eval0eval.ic
@@ -205,8 +205,6 @@ eval_node_copy_and_alloc_val(
{
byte* data;
- ut_ad(UNIV_SQL_NULL > ULINT_MAX);
-
if (len == UNIV_SQL_NULL) {
dfield_set_len(que_node_get_val(node), len);
diff --git a/innobase/include/rem0rec.ic b/innobase/include/rem0rec.ic
index ca69b9ca871..366f1c3f77d 100644
--- a/innobase/include/rem0rec.ic
+++ b/innobase/include/rem0rec.ic
@@ -526,7 +526,7 @@ bits of a record. (Only compact records have status bits.) */
UNIV_INLINE
ulint
rec_get_info_and_status_bits(
-/*==============*/
+/*=========================*/
/* out: info bits */
rec_t* rec, /* in: physical record */
ibool comp) /* in: TRUE=compact page format */
@@ -550,7 +550,7 @@ bits of a record. (Only compact records have status bits.) */
UNIV_INLINE
void
rec_set_info_and_status_bits(
-/*==============*/
+/*=========================*/
rec_t* rec, /* in: physical record */
ibool comp, /* in: TRUE=compact page format */
ulint bits) /* in: info bits */
diff --git a/innobase/include/trx0trx.h b/innobase/include/trx0trx.h
index 76b051105de..b63afdd526c 100644
--- a/innobase/include/trx0trx.h
+++ b/innobase/include/trx0trx.h
@@ -383,7 +383,9 @@ struct trx_struct{
dulint commit_lsn; /* lsn at the time of the commit */
ibool dict_operation; /* TRUE if the trx is used to create
a table, create an index, or drop a
- table */
+ table. This is a hint that the table
+ may need to be dropped in crash
+ recovery. */
dulint table_id; /* table id if the preceding field is
TRUE */
/*------------------------------*/
diff --git a/innobase/include/univ.i b/innobase/include/univ.i
index c413c3bc67e..5d1e8e208cd 100644
--- a/innobase/include/univ.i
+++ b/innobase/include/univ.i
@@ -81,9 +81,11 @@ memory is read outside the allocated blocks. */
/* Make a non-inline debug version */
#ifdef DBUG_ON
-# define UNIV_DEBUG
+#define UNIV_DEBUG
#endif /* DBUG_ON */
+
/*
+#define UNIV_DEBUG
#define UNIV_MEM_DEBUG
#define UNIV_IBUF_DEBUG
#define UNIV_SYNC_DEBUG
@@ -122,7 +124,7 @@ by one. */
/* Definition for inline version */
#ifdef __WIN__
-#define UNIV_INLINE __inline
+#define UNIV_INLINE __inline
#else
/* config.h contains the right def for 'inline' for the current compiler */
#if (__GNUC__ == 2)
diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c
index 64d80350275..a2c5365993c 100644
--- a/innobase/os/os0file.c
+++ b/innobase/os/os0file.c
@@ -15,6 +15,13 @@ Created 10/21/1995 Heikki Tuuri
#include "fil0fil.h"
#include "buf0buf.h"
+#if defined(UNIV_HOTBACKUP) && defined(__WIN__)
+/* Add includes for the _stat() call to compile on Windows */
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+#endif /* UNIV_HOTBACKUP */
+
#undef HAVE_FDATASYNC
#ifdef POSIX_ASYNC_IO
diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c
index 6aaa0cbcf1b..2c4eebedaf7 100644
--- a/innobase/row/row0mysql.c
+++ b/innobase/row/row0mysql.c
@@ -2561,17 +2561,6 @@ do not allow the TRUNCATE. We also reserve the data dictionary latch. */
goto funct_exit;
}
- if (table->n_mysql_handles_opened > 1) {
- ut_print_timestamp(stderr);
-fputs(" InnoDB: Warning: MySQL is trying to truncate table ", stderr);
- ut_print_name(stderr, trx, table->name);
- fputs("\n"
-"InnoDB: though there are still open handles to it.\n", stderr);
- err = DB_ERROR;
-
- goto funct_exit;
- }
-
/* TODO: could we replace the counter n_foreign_key_checks_running
with lock checks on the table? Acquire here an exclusive lock on the
table, and rewrite lock0lock.c and the lock wait in srv0srv.c so that
@@ -2594,7 +2583,6 @@ fputs(" InnoDB: Warning: MySQL is trying to truncate table ", stderr);
lock_reset_all_on_table(table);
- trx->dict_operation = TRUE;
trx->table_id = table->id;
/* scan SYS_INDEXES for all indexes of the table */
diff --git a/innobase/ut/ut0mem.c b/innobase/ut/ut0mem.c
index 6ed61b0b5de..9e026ed0011 100644
--- a/innobase/ut/ut0mem.c
+++ b/innobase/ut/ut0mem.c
@@ -88,7 +88,9 @@ ut_malloc_low(
"InnoDB: Check if you should increase the swap file or\n"
"InnoDB: ulimits of your operating system.\n"
"InnoDB: On FreeBSD check you have compiled the OS with\n"
- "InnoDB: a big enough maximum process size.\n",
+ "InnoDB: a big enough maximum process size.\n"
+ "InnoDB: Note that in most 32-bit computers the process\n"
+ "InnoDB: memory space is limited to 2 GB or 4 GB.\n",
(ulong) n, (ulong) ut_total_allocated_memory,
#ifdef __WIN__
(ulong) GetLastError()
diff --git a/innobase/ut/ut0ut.c b/innobase/ut/ut0ut.c
index f35b4dea5e0..6f2aa0957d8 100644
--- a/innobase/ut/ut0ut.c
+++ b/innobase/ut/ut0ut.c
@@ -82,10 +82,17 @@ ut_usectime(
ulint* sec, /* out: seconds since the Epoch */
ulint* ms) /* out: microseconds since the Epoch+*sec */
{
+#ifdef __WIN__
+ SYSTEMTIME st;
+ GetLocalTime(&st);
+ *sec = (ulint) st.wSecond;
+ *ms = (ulint) st.wMilliseconds;
+#else
struct timeval tv;
gettimeofday(&tv,NULL);
*sec = (ulint) tv.tv_sec;
*ms = (ulint) tv.tv_usec;
+#endif
}
/**************************************************************
diff --git a/libmysql/Makefile.am b/libmysql/Makefile.am
index 91ee5e66c83..0670a0befa8 100644
--- a/libmysql/Makefile.am
+++ b/libmysql/Makefile.am
@@ -24,7 +24,7 @@ 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@ \
- -I$(top_srcdir)/extra
+ -I$(top_builddir)/include
include $(srcdir)/Makefile.shared
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index c6815d2a5ce..258391ac899 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -1740,7 +1740,7 @@ static int stmt_read_row_no_data(MYSQL_STMT *stmt, unsigned char **row);
STMT_ATTR_UPDATE_MAX_LENGTH attribute is set.
*/
static void stmt_update_metadata(MYSQL_STMT *stmt, MYSQL_ROWS *data);
-static bool setup_one_fetch_function(MYSQL_BIND *bind, MYSQL_FIELD *field);
+static my_bool setup_one_fetch_function(MYSQL_BIND *bind, MYSQL_FIELD *field);
/*
Maximum sizes of MYSQL_TYPE_DATE, MYSQL_TYPE_TIME, MYSQL_TYPE_DATETIME
@@ -3718,7 +3718,7 @@ static void fetch_float_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
longlongstore(buffer, data);
}
*param->error= value != (param->is_unsigned ?
- (double) (*(ulonglong*) buffer) :
+ ulonglong2double(*(ulonglong*) buffer) :
(double) (*(longlong*) buffer));
break;
case MYSQL_TYPE_FLOAT:
diff --git a/libmysql_r/Makefile.am b/libmysql_r/Makefile.am
index e8c576ca2b1..b83ee36dd39 100644
--- a/libmysql_r/Makefile.am
+++ b/libmysql_r/Makefile.am
@@ -26,7 +26,7 @@ LIBS = @LIBS@ @ZLIB_LIBS@ @openssl_libs@
INCLUDES = @MT_INCLUDES@ \
-I$(top_srcdir)/include $(openssl_includes) @ZLIB_INCLUDES@ \
- -I$(top_srcdir)/extra
+ -I$(top_builddir)/include
## 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 4cd53216434..2f90d22f990 100644
--- a/libmysqld/Makefile.am
+++ b/libmysqld/Makefile.am
@@ -28,7 +28,7 @@ DEFS = -DEMBEDDED_LIBRARY -DMYSQL_SERVER \
INCLUDES= @MT_INCLUDES@ @bdb_includes@ -I$(top_srcdir)/include \
-I$(top_srcdir)/sql -I$(top_srcdir)/sql/examples \
-I$(top_srcdir)/regex \
- -I$(top_srcdir)/extra \
+ -I$(top_builddir)/include \
$(openssl_includes) @ZLIB_INCLUDES@
noinst_LIBRARIES = libmysqld_int.a
diff --git a/libmysqld/examples/Makefile.am b/libmysqld/examples/Makefile.am
index d70d7330e55..bd18e7154aa 100644
--- a/libmysqld/examples/Makefile.am
+++ b/libmysqld/examples/Makefile.am
@@ -1,7 +1,8 @@
-noinst_PROGRAMS = mysql
-bin_PROGRAMS = mysqltest_embedded mysql_client_test_embedded
-client_sources = $(mysqltest_embedded_SOURCES) $(mysql_SOURCES)
-tests_sources= $(mysql_client_test_embedded_SOURCES)
+noinst_PROGRAMS = mysql
+bin_PROGRAMS = mysqltest_embedded mysql_client_test_embedded
+client_sources = $(mysqltest_embedded_SOURCES) $(mysql_SOURCES)
+tests_sources = $(mysql_client_test_embedded_SOURCES)
+CLEANFILES = $(client_sources) $(tests_sources)
link_sources:
for f in $(client_sources); do \
@@ -16,7 +17,7 @@ link_sources:
DEFS = -DEMBEDDED_LIBRARY
INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include -I$(srcdir) \
-I$(top_srcdir) -I$(top_srcdir)/client -I$(top_srcdir)/regex \
- -I$(top_srcdir)/extra $(openssl_includes)
+ -I$(top_builddir)/include $(openssl_includes)
LIBS = @LIBS@ @WRAPLIBS@ @CLIENT_LIBS@
LDADD = @CLIENT_EXTRA_LDFLAGS@ ../libmysqld.a @innodb_system_libs@ @LIBDL@ $(CXXLDFLAGS)
@@ -31,9 +32,5 @@ mysql_LDADD = @readline_link@ @TERMCAP_LIB@ $(LDADD)
mysql_client_test_embedded_LINK = $(CXXLINK)
mysql_client_test_embedded_SOURCES = mysql_client_test.c
-clean:
- rm -f $(client_sources)
- rm -f $(tests_sources)
-
# Don't update the files from bitkeeper
%::SCCS/s.%
diff --git a/mysql-test/include/have_federated_db.inc b/mysql-test/include/have_federated_db.inc
index 7247c5db4b2..e4cf1366fda 100644
--- a/mysql-test/include/have_federated_db.inc
+++ b/mysql-test/include/have_federated_db.inc
@@ -1,4 +1,4 @@
-- require r/have_federated_db.require
disable_query_log;
-show variables like "have_federated_db";
+show variables like "have_federated_engine";
enable_query_log;
diff --git a/mysql-test/include/ndb_default_cluster.inc b/mysql-test/include/ndb_default_cluster.inc
new file mode 100644
index 00000000000..2f900b6a0b4
--- /dev/null
+++ b/mysql-test/include/ndb_default_cluster.inc
@@ -0,0 +1,4 @@
+-- require r/ndb_default_cluster.require
+disable_query_log;
+show status like "Ndb_connected_host";
+enable_query_log;
diff --git a/mysql-test/include/testdb_only.inc b/mysql-test/include/testdb_only.inc
new file mode 100644
index 00000000000..ddc3f123d45
--- /dev/null
+++ b/mysql-test/include/testdb_only.inc
@@ -0,0 +1,30 @@
+#################### include/testdb_only.inc ######################
+# #
+# We must prevent to work on databases created by customers, #
+# because we DROP/CREATE/MODIFY objects with sometimes common #
+# names like STAFF, EMPLOYEE etc. #
+# #
+# Therefore we check the environment variable USE_RUNNING_SERVER. #
+# USE_RUNNING_SERVER is exported by "mysql-test-run" and could #
+# contain the following values: #
+# 0 -- mysql-test-run was started without the --extern option #
+# That means the test will be performed within the test #
+# area 'mysql-test/var/...' . #
+# 1 -- mysql-test-run was started with the --extern option #
+# That means the test will be performed by an already #
+# running server and data modifications will most probably #
+# outside of the common test area 'mysql-test/var/...' . #
+# #
+# If USE_RUNNING_SERVER is not 0 the test will be skipped. #
+# #
+###################################################################
+
+--disable_query_log
+eval set @USE_RUNNING_SERVER= '$USE_RUNNING_SERVER';
+--require r/testdb_only.require
+SELECT 'use extern server'
+ AS "Variable_name ",
+ IF(@USE_RUNNING_SERVER= '1','YES',
+ IF(@USE_RUNNING_SERVER= '0','NO','UNEXPECTED'))
+ AS "Value" ;
+--enable_query_log
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index 1e3052de8e8..73f10fca5cf 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -224,7 +224,7 @@ EXTRA_MASTER_OPT=""
EXTRA_MYSQL_TEST_OPT=""
EXTRA_MYSQLDUMP_OPT=""
EXTRA_MYSQLBINLOG_OPT=""
-USE_RUNNING_SERVER=""
+USE_RUNNING_SERVER=0
USE_NDBCLUSTER=""
USE_RUNNING_NDBCLUSTER=""
DO_GCOV=""
@@ -255,7 +255,7 @@ NDBD_EXTRA_OPTS=
while test $# -gt 0; do
case "$1" in
--embedded-server) USE_EMBEDDED_SERVER=1 USE_MANAGER=0 NO_SLAVE=1 ; \
- USE_RUNNING_SERVER="" RESULT_EXT=".es" TEST_MODE="embedded" ;;
+ USE_RUNNING_SERVER=0 RESULT_EXT=".es" TEST_MODE="embedded" ;;
--user=*) DBUSER=`$ECHO "$1" | $SED -e "s;--user=;;"` ;;
--force) FORCE=1 ;;
--timer) USE_TIMER=1 ;;
@@ -265,8 +265,8 @@ while test $# -gt 0; do
MASTER_MYSQLD=`$ECHO "$1" | $SED -e "s;--master-binary=;;"` ;;
--slave-binary=*)
SLAVE_MYSQLD=`$ECHO "$1" | $SED -e "s;--slave-binary=;;"` ;;
- --local) USE_RUNNING_SERVER="" ;;
- --extern) USE_RUNNING_SERVER="1" ;;
+ --local) USE_RUNNING_SERVER=0 ;;
+ --extern) USE_RUNNING_SERVER=1 ;;
--with-ndbcluster)
USE_NDBCLUSTER="--ndbcluster" ;;
--ndb-connectstring=*)
@@ -303,7 +303,7 @@ while test $# -gt 0; do
--no-manager | --skip-manager) USE_MANAGER=0 ;;
--manager)
USE_MANAGER=1
- USE_RUNNING_SERVER=
+ USE_RUNNING_SERVER=0
;;
--start-and-exit)
START_AND_EXIT=1
@@ -372,7 +372,7 @@ while test $# -gt 0; do
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --gdb"
# This needs to be checked properly
# USE_MANAGER=1
- USE_RUNNING_SERVER=""
+ USE_RUNNING_SERVER=0
;;
--client-gdb )
if [ x$BINARY_DIST = x1 ] ; then
@@ -385,7 +385,7 @@ while test $# -gt 0; do
--manual-gdb )
DO_GDB=1
MANUAL_GDB=1
- USE_RUNNING_SERVER=""
+ USE_RUNNING_SERVER=0
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --gdb"
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --gdb"
;;
@@ -394,7 +394,7 @@ while test $# -gt 0; do
$ECHO "Note: you will get more meaningful output on a source distribution compiled with debugging option when running tests with --ddd option"
fi
DO_DDD=1
- USE_RUNNING_SERVER=""
+ USE_RUNNING_SERVER=0
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --gdb"
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --gdb"
;;
@@ -412,7 +412,7 @@ while test $# -gt 0; do
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-safemalloc --skip-bdb"
SLEEP_TIME_AFTER_RESTART=10
SLEEP_TIME_FOR_DELETE=60
- USE_RUNNING_SERVER=""
+ USE_RUNNING_SERVER=0
if test "$1" = "--valgrind-all"
then
VALGRIND="$VALGRIND -v --show-reachable=yes"
@@ -627,9 +627,9 @@ fi
if [ -z "$1" ]
then
- USE_RUNNING_SERVER=""
+ USE_RUNNING_SERVER=0
fi
-if [ -n "$USE_RUNNING_SERVER" ]
+if [ $USE_RUNNING_SERVER -eq 1 ]
then
MASTER_MYSOCK=$LOCAL_SOCKET;
DBUSER=${DBUSER:-test}
@@ -801,7 +801,7 @@ report_stats () {
$ECHO "http://www.mysql.com/doc/en/MySQL_test_suite.html"
fi
- if test -z "$USE_RUNNING_SERVER"
+ if [ $USE_RUNNING_SERVER -eq 0 ]
then
# Report if there was any fatal warnings/errors in the log files
@@ -1511,7 +1511,7 @@ run_testcase ()
done
fi
- if [ -z "$USE_RUNNING_SERVER" ] ;
+ if [ $USE_RUNNING_SERVER -eq 0 ] ;
then
if [ -f $master_opt_file ] ;
then
@@ -1655,7 +1655,7 @@ run_testcase ()
if [ x$FORCE != x1 ] ; then
$ECHO "Aborting: $tname failed in $TEST_MODE mode. To continue, re-run with '--force'."
$ECHO
- if [ -z "$DO_GDB" ] && [ -z "$USE_RUNNING_SERVER" ] && \
+ if [ -z "$DO_GDB" ] && [ $USE_RUNNING_SERVER -eq 0 ] && \
[ -z "$DO_DDD" ] && [ -z "$USE_EMBEDDED_SERVER" ]
then
mysql_stop
@@ -1664,7 +1664,7 @@ run_testcase ()
exit 1
fi
FAILED_CASES="$FAILED_CASES $tname"
- if [ -z "$DO_GDB" ] && [ -z "$USE_RUNNING_SERVER" ] && \
+ if [ -z "$DO_GDB" ] && [ $USE_RUNNING_SERVER -eq 0 ] && \
[ -z "$DO_DDD" ] && [ -z "$USE_EMBEDDED_SERVER" ]
then
mysql_restart
@@ -1683,7 +1683,7 @@ run_testcase ()
[ "$DO_GCOV" ] && gcov_prepare
[ "$DO_GPROF" ] && gprof_prepare
-if [ -z "$USE_RUNNING_SERVER" ]
+if [ $USE_RUNNING_SERVER -eq 0 ]
then
if [ -z "$FAST_START" ]
then
@@ -1744,6 +1744,9 @@ fi
$ECHO "Starting Tests"
+# Some test cases need USE_RUNNING_SERVER
+export USE_RUNNING_SERVER
+
#
# This can probably be deleted
#
@@ -1816,7 +1819,7 @@ fi
$ECHO $DASH72
$ECHO
-if [ -z "$DO_GDB" ] && [ -z "$USE_RUNNING_SERVER" ] && [ -z "$DO_DDD" ]
+if [ -z "$DO_GDB" ] && [ $USE_RUNNING_SERVER -eq 0 ] && [ -z "$DO_DDD" ]
then
mysql_stop
fi
diff --git a/mysql-test/r/federated.result b/mysql-test/r/federated.result
index 8cadb120c2e..4ed0b45a4c5 100644
--- a/mysql-test/r/federated.result
+++ b/mysql-test/r/federated.result
@@ -130,9 +130,9 @@ delete from federated.t1;
select * from federated.t1 where id = 5;
id name other created
drop table if exists federated.t1;
-CREATE TABLE federated.t1 ( `id` int(20) NOT NULL auto_increment, `name` varchar(32), `other` varchar(20), PRIMARY KEY (`id`) ) ENGINE="FEDERATED" DEFAULT CHARSET=latin1 COMMENT='mysql://root@127.0.0.1:9308/federated/t1';
-drop table if exists federated.t1;
CREATE TABLE federated.t1 ( `id` int(20) NOT NULL auto_increment, `name` varchar(32), `other` varchar(20), PRIMARY KEY (`id`) );
+drop table if exists federated.t1;
+CREATE TABLE federated.t1 ( `id` int(20) NOT NULL auto_increment, `name` varchar(32), `other` varchar(20), PRIMARY KEY (`id`) ) ENGINE="FEDERATED" DEFAULT CHARSET=latin1 COMMENT='mysql://root@127.0.0.1:9308/federated/t1';
insert into federated.t1 (name, other) values ('First Name', 11111);
insert into federated.t1 (name, other) values ('Second Name', NULL);
insert into federated.t1 (name, other) values ('Third Name', 33333);
@@ -162,7 +162,7 @@ id name other
7 Seventh Name NULL
10 NULL fee fie foe fum
update federated.t1 set name = 'Fourth Name', other = 'four four four' where name IS NULL and other IS NULL;
-update federated.t1 set other = 'two two two two' where name = 'Secend Name';
+update federated.t1 set other = 'two two two two' where name = 'Second Name';
update federated.t1 set other = 'seven seven' where name like 'Sec%';
update federated.t1 set other = 'seven seven' where name = 'Seventh Name';
update federated.t1 set name = 'Tenth Name' where other like 'fee fie%';
@@ -181,6 +181,85 @@ id name other
9 Ninth Name 99999
10 Tenth Name fee fie foe fum
drop table if exists federated.t1;
+CREATE TABLE federated.t1 ( `id` int(20) NOT NULL auto_increment, `name`
+varchar(32) NOT NULL DEFAULT '', `other` varchar(20) NOT NULL DEFAULT '', PRIMARY KEY (`id`), key nameoth (name, other) );
+drop table if exists federated.t1;
+CREATE TABLE federated.t1 ( `id` int(20) NOT NULL auto_increment, `name` varchar(32) NOT NULL DEFAULT '', `other` varchar(20) NOT NULL DEFAULT '', PRIMARY KEY (`id`), key nameoth (name, other)) ENGINE="FEDERATED" DEFAULT CHARSET=latin1 COMMENT='mysql://root@127.0.0.1:9308/federated/t1';
+insert into federated.t1 (name, other) values ('First Name', '1111');
+insert into federated.t1 (name, other) values ('Second Name', '2222');
+insert into federated.t1 (name, other) values ('Third Name', '3333');
+select * from federated.t1 where name = 'Second Name';
+id name other
+2 Second Name 2222
+select * from federated.t1 where other = '2222';
+id name other
+2 Second Name 2222
+select * from federated.t1 where name = 'Third Name';
+id name other
+3 Third Name 3333
+select * from federated.t1 where name = 'Third Name' and other = '3333';
+id name other
+3 Third Name 3333
+drop table if exists federated.t1;
+CREATE TABLE federated.t1
+(id int NOT NULL auto_increment,
+name char(32) NOT NULL DEFAULT '',
+bincol binary(4) NOT NULL,
+floatval decimal(5,2) NOT NULL DEFAULT 0.0,
+other int NOT NULL DEFAULT 0,
+primary key(id),
+key nameoth(name, other),
+key bincol(bincol),
+key floatval(floatval));
+drop table if exists federated.t1;
+CREATE TABLE federated.t1
+(id int NOT NULL auto_increment,
+name char(32) NOT NULL DEFAULT '',
+bincol binary(4) NOT NULL,
+floatval decimal(5,2) NOT NULL DEFAULT 0.0,
+other int NOT NULL DEFAULT 0,
+primary key(id),
+key nameoth(name,other),
+key bincol(bincol),
+key floatval(floatval))
+ENGINE="FEDERATED" DEFAULT CHARSET=latin1 COMMENT='mysql://root@127.0.0.1:9308/federated/t1';
+insert into federated.t1 (name, bincol, floatval, other) values ('first', 0x65, 11.11, 1111);
+insert into federated.t1 (name, bincol, floatval, other) values ('second', 0x66, 22.22, 2222);
+insert into federated.t1 (name, bincol, floatval, other) values ('third', 'g', 22.22, 2222);
+select * from federated.t1;
+id name bincol floatval other
+1 first e 11.11 1111
+2 second f 22.22 2222
+3 third g 22.22 2222
+select * from federated.t1 where name = 'second';
+id name bincol floatval other
+2 second f 22.22 2222
+select * from federated.t1 where bincol= 'f';
+id name bincol floatval other
+2 second f 22.22 2222
+select * from federated.t1 where bincol= 0x66;
+id name bincol floatval other
+2 second f 22.22 2222
+select * from federated.t1 where bincol= 0x67;
+id name bincol floatval other
+3 third g 22.22 2222
+select * from federated.t1 where bincol= 'g';
+id name bincol floatval other
+3 third g 22.22 2222
+select * from federated.t1 where floatval=11.11;
+id name bincol floatval other
+1 first e 11.11 1111
+select * from federated.t1 where name='third';
+id name bincol floatval other
+3 third g 22.22 2222
+select * from federated.t1 where other=2222;
+id name bincol floatval other
+2 second f 22.22 2222
+3 third g 22.22 2222
+select * from federated.t1 where name='third' and other=2222;
+id name bincol floatval other
+3 third g 22.22 2222
+drop table if exists federated.t1;
CREATE TABLE federated.t1 (id int, name varchar(32), floatval float, other int) DEFAULT CHARSET=latin1;
drop table if exists federated.t1;
CREATE TABLE federated.t1 (id int, name varchar(32), floatval float, other int) ENGINE="FEDERATED" DEFAULT CHARSET=latin1 COMMENT='mysql://root@127.0.0.1:9308/federated/t1';
@@ -550,16 +629,46 @@ delete from federated.t1 where i50=20;
select * from federated.t1;
i1 i2 i3 i4 i5 i6 i7 i8 i9 i10 i11 i12 i13 i14 i15 i16 i17 i18 i19 i20 i21 i22 i23 i24 i25 i26 i27 i28 i29 i30 i31 i32 i33 i34 i35 i36 i37 i38 i39 i40 i41 i42 i43 i44 i45 i46 i47 i48 i49 i50 i51 i52 i53 i54 i55 i56 i57 i58 i59 i60 i61 i62 i63 i64 i65 i66 i67 i68 i69 i70 i71 i72 i73 i74 i75 i76 i77 i78 i79 i80 i81 i82 i83 i84 i85 i86 i87 i88 i89 i90 i91 i92 i93 i94 i95 i96 i97 i98 i99 i100 i101 i102 i103 i104 i105 i106 i107 i108 i109 i110 i111 i112 i113 i114 i115 i116 i117 i118 i119 i120 i121 i122 i123 i124 i125 i126 i127 i128 i129 i130 i131 i132 i133 i134 i135 i136 i137 i138 i139 i140 i141 i142 i143 i144 i145 i146 i147 i148 i149 i150 i151 i152 i153 i154 i155 i156 i157 i158 i159 i160 i161 i162 i163 i164 i165 i166 i167 i168 i169 i170 i171 i172 i173 i174 i175 i176 i177 i178 i179 i180 i181 i182 i183 i184 i185 i186 i187 i188 i189 i190 i191 i192 i193 i194 i195 i196 i197 i198 i199 i200 i201 i202 i203 i204 i205 i206 i207 i208 i209 i210 i211 i212 i213 i214 i215 i216 i217 i218 i219 i220 i221 i222 i223 i224 i225 i226 i227 i228 i229 i230 i231 i232 i233 i234 i235 i236 i237 i238 i239 i240 i241 i242 i243 i244 i245 i246 i247 i248 i249 i250 i251 i252 i253 i254 i255 i256 i257 i258 i259 i260 i261 i262 i263 i264 i265 i266 i267 i268 i269 i270 i271 i272 i273 i274 i275 i276 i277 i278 i279 i280 i281 i282 i283 i284 i285 i286 i287 i288 i289 i290 i291 i292 i293 i294 i295 i296 i297 i298 i299 i300 i301 i302 i303 i304 i305 i306 i307 i308 i309 i310 i311 i312 i313 i314 i315 i316 i317 i318 i319 i320 i321 i322 i323 i324 i325 i326 i327 i328 i329 i330 i331 i332 i333 i334 i335 i336 i337 i338 i339 i340 i341 i342 i343 i344 i345 i346 i347 i348 i349 i350 i351 i352 i353 i354 i355 i356 i357 i358 i359 i360 i361 i362 i363 i364 i365 i366 i367 i368 i369 i370 i371 i372 i373 i374 i375 i376 i377 i378 i379 i380 i381 i382 i383 i384 i385 i386 i387 i388 i389 i390 i391 i392 i393 i394 i395 i396 i397 i398 i399 i400 i401 i402 i403 i404 i405 i406 i407 i408 i409 i410 i411 i412 i413 i414 i415 i416 i417 i418 i419 i420 i421 i422 i423 i424 i425 i426 i427 i428 i429 i430 i431 i432 i433 i434 i435 i436 i437 i438 i439 i440 i441 i442 i443 i444 i445 i446 i447 i448 i449 i450 i451 i452 i453 i454 i455 i456 i457 i458 i459 i460 i461 i462 i463 i464 i465 i466 i467 i468 i469 i470 i471 i472 i473 i474 i475 i476 i477 i478 i479 i480 i481 i482 i483 i484 i485 i486 i487 i488 i489 i490 i491 i492 i493 i494 i495 i496 i497 i498 i499 i500 i501 i502 i503 i504 i505 i506 i507 i508 i509 i510 i511 i512 i513 i514 i515 i516 i517 i518 i519 i520 i521 i522 i523 i524 i525 i526 i527 i528 i529 i530 i531 i532 i533 i534 i535 i536 i537 i538 i539 i540 i541 i542 i543 i544 i545 i546 i547 i548 i549 i550 i551 i552 i553 i554 i555 i556 i557 i558 i559 i560 i561 i562 i563 i564 i565 i566 i567 i568 i569 i570 i571 i572 i573 i574 i575 i576 i577 i578 i579 i580 i581 i582 i583 i584 i585 i586 i587 i588 i589 i590 i591 i592 i593 i594 i595 i596 i597 i598 i599 i600 i601 i602 i603 i604 i605 i606 i607 i608 i609 i610 i611 i612 i613 i614 i615 i616 i617 i618 i619 i620 i621 i622 i623 i624 i625 i626 i627 i628 i629 i630 i631 i632 i633 i634 i635 i636 i637 i638 i639 i640 i641 i642 i643 i644 i645 i646 i647 i648 i649 i650 i651 i652 i653 i654 i655 i656 i657 i658 i659 i660 i661 i662 i663 i664 i665 i666 i667 i668 i669 i670 i671 i672 i673 i674 i675 i676 i677 i678 i679 i680 i681 i682 i683 i684 i685 i686 i687 i688 i689 i690 i691 i692 i693 i694 i695 i696 i697 i698 i699 i700 i701 i702 i703 i704 i705 i706 i707 i708 i709 i710 i711 i712 i713 i714 i715 i716 i717 i718 i719 i720 i721 i722 i723 i724 i725 i726 i727 i728 i729 i730 i731 i732 i733 i734 i735 i736 i737 i738 i739 i740 i741 i742 i743 i744 i745 i746 i747 i748 i749 i750 i751 i752 i753 i754 i755 i756 i757 i758 i759 i760 i761 i762 i763 i764 i765 i766 i767 i768 i769 i770 i771 i772 i773 i774 i775 i776 i777 i778 i779 i780 i781 i782 i783 i784 i785 i786 i787 i788 i789 i790 i791 i792 i793 i794 i795 i796 i797 i798 i799 i800 i801 i802 i803 i804 i805 i806 i807 i808 i809 i810 i811 i812 i813 i814 i815 i816 i817 i818 i819 i820 i821 i822 i823 i824 i825 i826 i827 i828 i829 i830 i831 i832 i833 i834 i835 i836 i837 i838 i839 i840 i841 i842 i843 i844 i845 i846 i847 i848 i849 i850 i851 i852 i853 i854 i855 i856 i857 i858 i859 i860 i861 i862 i863 i864 i865 i866 i867 i868 i869 i870 i871 i872 i873 i874 i875 i876 i877 i878 i879 i880 i881 i882 i883 i884 i885 i886 i887 i888 i889 i890 i891 i892 i893 i894 i895 i896 i897 i898 i899 i900 i901 i902 i903 i904 i905 i906 i907 i908 i909 i910 i911 i912 i913 i914 i915 i916 i917 i918 i919 i920 i921 i922 i923 i924 i925 i926 i927 i928 i929 i930 i931 i932 i933 i934 i935 i936 i937 i938 i939 i940 i941 i942 i943 i944 i945 i946 i947 i948 i949 i950 i951 i952 i953 i954 i955 i956 i957 i958 i959 i960 i961 i962 i963 i964 i965 i966 i967 i968 i969 i970 i971 i972 i973 i974 i975 i976 i977 i978 i979 i980 i981 i982 i983 i984 i985 i986 i987 i988 i989 i990 i991 i992 i993 i994 i995 i996 i997 i998 i999 i1000 b
drop table if exists federated.t1;
-create table federated.t1 (id int NOT NULL auto_increment, code char(20) NOT NULL, fileguts blob, creation_date datetime, entered_time datetime default '2004-04-04 04:04:04', primary key(id), index(code)) DEFAULT CHARSET=latin1;
+create table federated.t1 (id int NOT NULL auto_increment, code char(20) NOT NULL, fileguts blob NOT NULL, creation_date datetime, entered_time datetime default '2004-04-04 04:04:04', primary key(id), index(code), index(fileguts(10))) DEFAULT CHARSET=latin1;
drop table if exists federated.t1;
-create table federated.t1 (id int NOT NULL auto_increment, code char(20) NOT NULL, fileguts blob, creation_date datetime, entered_time datetime default '2004-04-04 04:04:04', primary key(id), index(code)) ENGINE="FEDERATED" DEFAULT CHARSET=latin1 COMMENT='mysql://root@127.0.0.1:9308/federated/t1';
+create table federated.t1 (id int NOT NULL auto_increment, code char(20) NOT NULL, fileguts blob NOT NULL, creation_date datetime, entered_time datetime default '2004-04-04 04:04:04', primary key(id), index(code), index(fileguts(10))) ENGINE="FEDERATED" DEFAULT CHARSET=latin1 COMMENT='mysql://root@127.0.0.1:9308/federated/t1';
insert into federated.t1 (code, fileguts, creation_date) values ('ASDFWERQWETWETAWETA', '*()w*09*$()*#)(*09*^90*d)(*s()d8g)(s*ned)(*)(s*d)(*hn(d*)(*sbn)D((#$*(#*%%&#&^$#&#&#&#&^&#*&*#$*&^*(&#(&Q*&&(*!&!(*&*(#&*(%&#<S-F8>*<S-F8><S-F8><S-F8>#<S-F8>#<S-F8>#<S-F8>[[', '2003-03-03 03:03:03');
insert into federated.t1 (code, fileguts, creation_date) values ('DEUEUEUEUEUEUEUEUEU', '*()w*09*$()*#)(*09*^90*d)(*s()d8g)(s*ned)(*)(s*d)(*hn(d*)(*sbn)D((#$*(#*%%&#&^$#&#&#&#&^&#*&*#$*&^*(&#(&Q*&&(*!&!(*&*(#&*(%&#<S-F8>*<S-F8><S-F8><S-F8>#<S-F8>#<S-F8>#<S-F8>[[', '2004-04-04 04:04:04');
+insert into federated.t1 (code, fileguts, creation_date) values ('DEUEUEUEUEUEUEUEUEU', 'jimbob', '2004-04-04 04:04:04');
select * from federated.t1;
id code fileguts creation_date entered_time
1 ASDFWERQWETWETAWETA *()w*09*$()*#)(*09*^90*d)(*s()d8g)(s*ned)(*)(s*d)(*hn(d*)(*sbn)D((#$*(#*%%&#&^$#&#&#&#&^&#*&*#$*&^*(&#(&Q*&&(*!&!(*&*(#&*(%&#<S-F8>*<S-F8><S-F8><S-F8>#<S-F8>#<S-F8>#<S-F8>[[ 2003-03-03 03:03:03 2004-04-04 04:04:04
2 DEUEUEUEUEUEUEUEUEU *()w*09*$()*#)(*09*^90*d)(*s()d8g)(s*ned)(*)(s*d)(*hn(d*)(*sbn)D((#$*(#*%%&#&^$#&#&#&#&^&#*&*#$*&^*(&#(&Q*&&(*!&!(*&*(#&*(%&#<S-F8>*<S-F8><S-F8><S-F8>#<S-F8>#<S-F8>#<S-F8>[[ 2004-04-04 04:04:04 2004-04-04 04:04:04
+3 DEUEUEUEUEUEUEUEUEU jimbob 2004-04-04 04:04:04 2004-04-04 04:04:04
+select * from federated.t1 where fileguts = 'jimbob';
+id code fileguts creation_date entered_time
+3 DEUEUEUEUEUEUEUEUEU jimbob 2004-04-04 04:04:04 2004-04-04 04:04:04
+drop table if exists federated.t1;
+CREATE TABLE federated.t1 ( `id` int(20) NOT NULL auto_increment, `country_id` int(20) NOT NULL DEFAULT 0, `name` varchar(32), `other` varchar(20), PRIMARY KEY (`id`), key (country_id));
drop table if exists federated.t1;
+CREATE TABLE federated.t1 ( `id` int(20) NOT NULL auto_increment, `country_id` int(20) NOT NULL DEFAULT 0, `name` varchar(32), `other` varchar(20), PRIMARY KEY (`id`), key (country_id) ) ENGINE="FEDERATED" DEFAULT CHARSET=latin1 COMMENT='mysql://root@127.0.0.1:9308/federated/t1';
+insert into federated.t1 (name, country_id, other) values ('Kumar', 1, 11111);
+insert into federated.t1 (name, country_id, other) values ('Lenz', 2, 22222);
+insert into federated.t1 (name, country_id, other) values ('Marizio', 3, 33333);
+insert into federated.t1 (name, country_id, other) values ('Monty', 4, 33333);
+insert into federated.t1 (name, country_id, other) values ('Sanja', 5, 33333);
+drop table if exists federated.countries;
+Warnings:
+Note 1051 Unknown table 'countries'
+CREATE TABLE federated.countries ( `id` int(20) NOT NULL auto_increment, `country` varchar(32), primary key (id));
+insert into federated.countries (country) values ('India');
+insert into federated.countries (country) values ('Germany');
+insert into federated.countries (country) values ('Italy');
+insert into federated.countries (country) values ('Finland');
+insert into federated.countries (country) values ('Ukraine');
+select federated.t1.*, federated.countries.country from federated.t1 left join federated.countries on federated.t1.country_id = federated.countries.id;
+id country_id name other country
+1 1 Kumar 11111 India
+2 2 Lenz 22222 Germany
+3 3 Marizio 33333 Italy
+4 4 Monty 33333 Finland
+5 5 Sanja 33333 Ukraine
+drop table federated.countries;
drop table if exists federated.t1;
drop database if exists federated;
drop table if exists federated.t1;
diff --git a/mysql-test/r/have_federated_db.require b/mysql-test/r/have_federated_db.require
index dda556a2974..f4c521a8f35 100644
--- a/mysql-test/r/have_federated_db.require
+++ b/mysql-test/r/have_federated_db.require
@@ -1,2 +1,2 @@
Variable_name Value
-have_federated_db YES
+have_federated_engine YES
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index 9bf4ee28b3b..eed3132c195 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -571,8 +571,11 @@ where table_schema='information_schema' limit 2;
TABLE_NAME TABLE_TYPE ENGINE
SCHEMATA TEMPORARY MyISAM
TABLES TEMPORARY MyISAM
-show tables from information_schema like "t%";
-Tables_in_information_schema (t%)
+show tables from information_schema like "T%";
+Tables_in_information_schema (T%)
+TABLES
+TABLE_PRIVILEGES
+TABLE_CONSTRAINTS
create database information_schema;
ERROR HY000: Can't create database 'information_schema'; database exists
use information_schema;
diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result
index 94d33f8090b..8882b95f2d8 100644
--- a/mysql-test/r/insert_select.result
+++ b/mysql-test/r/insert_select.result
@@ -638,3 +638,15 @@ No Field Count
0 1 100
0 2 100
drop table t1, t2;
+CREATE TABLE t1 (
+ID int(11) NOT NULL auto_increment,
+NO int(11) NOT NULL default '0',
+SEQ int(11) NOT NULL default '0',
+PRIMARY KEY (ID),
+KEY t1$NO (SEQ,NO)
+) ENGINE=MyISAM;
+INSERT INTO t1 (SEQ, NO) SELECT "1" AS SEQ, IF(MAX(NO) IS NULL, 0, MAX(NO)) + 1 AS NO FROM t1 WHERE (SEQ = 1);
+select SQL_BUFFER_RESULT * from t1 WHERE (SEQ = 1);
+ID NO SEQ
+1 1 1
+drop table t1;
diff --git a/mysql-test/r/lowercase_table2.result b/mysql-test/r/lowercase_table2.result
index cfd8f78a77c..a79b6b04063 100644
--- a/mysql-test/r/lowercase_table2.result
+++ b/mysql-test/r/lowercase_table2.result
@@ -1,4 +1,4 @@
-DROP TABLE IF EXISTS t1,t2,T1,T2,t3,T3,tT;
+DROP TABLE IF EXISTS t1,t2,T1,T2,t3,T3;
DROP DATABASE IF EXISTS `TEST_$1`;
DROP DATABASE IF EXISTS `test_$1`;
CREATE TABLE T1 (a int);
@@ -131,13 +131,13 @@ show tables like 't1%';
Tables_in_test (t1%)
t1
drop table t1;
-create temporary table tT(a int(11), b varchar(8));
-insert into tT values (1, 'abc');
-select * from tT;
+create temporary table T1(a int(11), b varchar(8));
+insert into T1 values (1, 'abc');
+select * from T1;
a b
1 abc
-alter table tT add index (a);
-select * from tT;
+alter table T1 add index (a);
+select * from T1;
a b
1 abc
-drop table tT;
+drop table T1;
diff --git a/mysql-test/r/ndb_alter_table.result b/mysql-test/r/ndb_alter_table.result
index 2857a4b5cc7..2aab46014a9 100644
--- a/mysql-test/r/ndb_alter_table.result
+++ b/mysql-test/r/ndb_alter_table.result
@@ -34,13 +34,13 @@ col5 enum('PENDING', 'ACTIVE', 'DISABLED') not null,
col6 int not null, to_be_deleted int) ENGINE=ndbcluster;
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
-t1 ndbcluster 10 Dynamic 0 0 0 0 0 0 1 NULL NULL NULL latin1_swedish_ci NULL number_of_replicas: 2
+t1 ndbcluster 10 Dynamic 0 0 # # 0 # 1 # # # latin1_swedish_ci NULL #
SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
insert into t1 values
(0,4,3,5,"PENDING",1,7),(NULL,4,3,5,"PENDING",1,7),(31,4,3,5,"PENDING",1,7), (7,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7), (100,4,3,5,"PENDING",1,7), (99,4,3,5,"PENDING",1,7), (8,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7);
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
-t1 ndbcluster 10 Dynamic 9 96 131072 0 0 0 101 NULL NULL NULL latin1_swedish_ci NULL number_of_replicas: 2
+t1 ndbcluster 10 Dynamic 9 96 # # 0 # 101 # # # latin1_swedish_ci NULL #
select * from t1 order by col1;
col1 col2 col3 col4 col5 col6 to_be_deleted
0 4 3 5 PENDING 1 7
@@ -60,7 +60,7 @@ change column col2 fourth varchar(30) not null after col3,
modify column col6 int not null first;
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
-t1 ndbcluster 10 Dynamic 9 152 131072 0 0 0 102 NULL NULL NULL latin1_swedish_ci NULL number_of_replicas: 2
+t1 ndbcluster 10 Dynamic 9 152 # # 0 # 102 # # # latin1_swedish_ci NULL #
select * from t1 order by col1;
col6 col1 col3 fourth col4 col4_5 col5 col7 col8
1 0 3 4 5 PENDING 0000-00-00 00:00:00
@@ -75,7 +75,7 @@ col6 col1 col3 fourth col4 col4_5 col5 col7 col8
insert into t1 values (2, NULL,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00');
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
-t1 ndbcluster 10 Dynamic 10 152 131072 0 0 0 103 NULL NULL NULL latin1_swedish_ci NULL number_of_replicas: 2
+t1 ndbcluster 10 Dynamic 10 152 # # 0 # 103 # # # latin1_swedish_ci NULL #
select * from t1 order by col1;
col6 col1 col3 fourth col4 col4_5 col5 col7 col8
1 0 3 4 5 PENDING 0000-00-00 00:00:00
diff --git a/mysql-test/r/ndb_autodiscover.result b/mysql-test/r/ndb_autodiscover.result
index b89b4ce1f21..ba21483a9b0 100644
--- a/mysql-test/r/ndb_autodiscover.result
+++ b/mysql-test/r/ndb_autodiscover.result
@@ -144,8 +144,8 @@ Handler_discover 1
flush tables;
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
-t6 MyISAM 9 Fixed 1 260 # # # 0 NULL # # NULL # NULL
-t7 ndbcluster 9 Fixed 1 276 # # # 0 NULL # # NULL # NULL number_of_replicas: 2
+t6 MyISAM 9 Fixed 1 260 # # # 0 NULL # # NULL # NULL #
+t7 ndbcluster 9 Fixed 1 276 # # # 0 NULL # # NULL # NULL #
show status like 'handler_discover%';
Variable_name Value
Handler_discover 2
diff --git a/mysql-test/r/ndb_default_cluster.require b/mysql-test/r/ndb_default_cluster.require
new file mode 100644
index 00000000000..aa4988cdca3
--- /dev/null
+++ b/mysql-test/r/ndb_default_cluster.require
@@ -0,0 +1,2 @@
+Variable_name Value
+Ndb_connected_host localhost
diff --git a/mysql-test/r/ndb_index_ordered.result b/mysql-test/r/ndb_index_ordered.result
index 7558e5cdb11..9aa7559d660 100644
--- a/mysql-test/r/ndb_index_ordered.result
+++ b/mysql-test/r/ndb_index_ordered.result
@@ -432,16 +432,16 @@ index(ye),
index(ti),
index(ts)
) engine=ndb;
-insert into t1 (pk,dt,da,ye,ti) values
-(1, '1901-05-05 23:00:59', '1901-05-05', '1901', '23:00:59'),
-(2, '1912-09-05 13:00:59', '1912-09-05', '1912', '13:00:59'),
-(3, '1945-12-31 00:00:00', '1945-12-31', '1945', '00:00:00'),
-(4, '1955-12-31 00:00:00', '1955-12-31', '1955', '00:00:00'),
-(5, '1963-06-06 06:06:06', '1963-06-06', '1963', '06:06:06'),
-(6, '1993-06-06 06:06:06', '1993-06-06', '1993', '06:06:06'),
-(7, '2001-01-01 10:11:10', '2001-01-01', '2001', '10:11:10'),
-(8, '2001-01-01 10:11:11', '2001-01-01', '2001', '10:11:11'),
-(9, '2005-01-31 23:59:59', '2005-01-31', '2005', '23:59:59');
+insert into t1 (pk,dt,da,ye,ti,ts) values
+(1, '1901-05-05 23:00:59', '1901-05-05', '1901', '23:00:59', '2001-01-01 23:00:59'),
+(2, '1912-09-05 13:00:59', '1912-09-05', '1912', '13:00:59', '2001-01-01 13:00:59'),
+(3, '1945-12-31 00:00:00', '1945-12-31', '1945', '00:00:00', '2001-01-01 00:00:00'),
+(4, '1955-12-31 00:00:00', '1955-12-31', '1955', '00:00:00', '2001-01-01 00:00:00'),
+(5, '1963-06-06 06:06:06', '1963-06-06', '1963', '06:06:06', '2001-01-01 06:06:06'),
+(6, '1993-06-06 06:06:06', '1993-06-06', '1993', '06:06:06', '2001-01-01 06:06:06'),
+(7, '2001-01-01 10:11:10', '2001-01-01', '2001', '10:11:10', '2001-01-01 10:11:10'),
+(8, '2001-01-01 10:11:11', '2001-01-01', '2001', '10:11:11', '2001-01-01 10:11:11'),
+(9, '2005-01-31 23:59:59', '2005-01-31', '2005', '23:59:59', '2001-01-01 23:59:59');
select count(*)-9 from t1 use index (dt) where dt > '1900-01-01 00:00:00';
count(*)-9
0
@@ -529,6 +529,30 @@ count(*)-8
select count(*)-9 from t1 use index (ti) where ti <= '23:59:59';
count(*)-9
0
+select count(*)-9 from t1 use index (ts) where ts >= '2001-01-01 00:00:00';
+count(*)-9
+0
+select count(*)-7 from t1 use index (ts) where ts > '2001-01-01 00:00:00';
+count(*)-7
+0
+select count(*)-7 from t1 use index (ts) where ts > '2001-01-01 05:05:05';
+count(*)-7
+0
+select count(*)-5 from t1 use index (ts) where ts > '2001-01-01 06:06:06';
+count(*)-5
+0
+select count(*)-5 from t1 use index (ts) where ts < '2001-01-01 10:11:11';
+count(*)-5
+0
+select count(*)-6 from t1 use index (ts) where ts <= '2001-01-01 10:11:11';
+count(*)-6
+0
+select count(*)-8 from t1 use index (ts) where ts < '2001-01-01 23:59:59';
+count(*)-8
+0
+select count(*)-9 from t1 use index (ts) where ts <= '2001-01-01 23:59:59';
+count(*)-9
+0
drop table t1;
create table t1(a int primary key, b int not null, index(b));
insert into t1 values (1,1), (2,2);
diff --git a/mysql-test/r/ndb_index_unique.result b/mysql-test/r/ndb_index_unique.result
index d9397ad42e1..517d09ddf29 100644
--- a/mysql-test/r/ndb_index_unique.result
+++ b/mysql-test/r/ndb_index_unique.result
@@ -612,3 +612,17 @@ a b c
3 NULL NULL
4 4 NULL
drop table t1, t8;
+create table t1(
+id integer not null auto_increment,
+month integer not null,
+year integer not null,
+code varchar( 2) not null,
+primary key ( id),
+unique idx_t1( month, code, year)
+) engine=ndb;
+INSERT INTO t1 (month, year, code) VALUES (4,2004,'12');
+INSERT INTO t1 (month, year, code) VALUES (5,2004,'12');
+select * from t1 where code = '12' and month = 4 and year = 2004 ;
+id month year code
+1 4 2004 12
+drop table t1;
diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result
index 5674fbb9177..3474da93d75 100644
--- a/mysql-test/r/order_by.result
+++ b/mysql-test/r/order_by.result
@@ -778,3 +778,20 @@ sid wnid
39560 01019090000
37994 01019090000
drop table t1;
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (2), (1), (1), (2), (1);
+SELECT a FROM t1 ORDER BY a;
+a
+1
+1
+1
+2
+2
+(SELECT a FROM t1) ORDER BY a;
+a
+1
+1
+1
+2
+2
+DROP TABLE t1;
diff --git a/mysql-test/r/testdb_only.require b/mysql-test/r/testdb_only.require
new file mode 100644
index 00000000000..e717418fdb6
--- /dev/null
+++ b/mysql-test/r/testdb_only.require
@@ -0,0 +1,2 @@
+Variable_name Value
+use extern server NO
diff --git a/mysql-test/r/user_limits.result b/mysql-test/r/user_limits.result
index b374b05e3f0..75062e97200 100644
--- a/mysql-test/r/user_limits.result
+++ b/mysql-test/r/user_limits.result
@@ -6,6 +6,7 @@ delete from mysql.tables_priv where user like 'mysqltest\_%';
delete from mysql.columns_priv where user like 'mysqltest\_%';
flush privileges;
grant usage on *.* to mysqltest_1@localhost with max_queries_per_hour 2;
+flush user_resources;
select * from t1;
i
select * from t1;
@@ -16,6 +17,7 @@ select * from t1;
ERROR 42000: User 'mysqltest_1' has exceeded the 'max_questions' resource (current value: 2)
drop user mysqltest_1@localhost;
grant usage on *.* to mysqltest_1@localhost with max_updates_per_hour 2;
+flush user_resources;
select * from t1;
i
select * from t1;
@@ -34,6 +36,7 @@ select * from t1;
i
drop user mysqltest_1@localhost;
grant usage on *.* to mysqltest_1@localhost with max_connections_per_hour 2;
+flush user_resources;
select * from t1;
i
select * from t1;
@@ -47,6 +50,7 @@ ERROR 42000: User 'mysqltest_1' has exceeded the 'max_connections' resource (cur
drop user mysqltest_1@localhost;
flush privileges;
grant usage on *.* to mysqltest_1@localhost with max_user_connections 2;
+flush user_resources;
select * from t1;
i
select * from t1;
@@ -56,6 +60,7 @@ ERROR 42000: User 'mysqltest_1' has exceeded the 'max_user_connections' resource
select * from t1;
i
grant usage on *.* to mysqltest_1@localhost with max_user_connections 3;
+flush user_resources;
select * from t1;
i
connect(localhost,mysqltest_1,,test,MYSQL_PORT,MYSQL_SOCK);
@@ -71,6 +76,7 @@ select @@session.max_user_connections, @@global.max_user_connections;
@@session.max_user_connections @@global.max_user_connections
2 2
grant usage on *.* to mysqltest_1@localhost;
+flush user_resources;
select @@session.max_user_connections, @@global.max_user_connections;
@@session.max_user_connections @@global.max_user_connections
2 2
@@ -79,6 +85,7 @@ i
connect(localhost,mysqltest_1,,test,MYSQL_PORT,MYSQL_SOCK);
ERROR 42000: User mysqltest_1 already has more than 'max_user_connections' active connections
grant usage on *.* to mysqltest_1@localhost with max_user_connections 3;
+flush user_resources;
select @@session.max_user_connections, @@global.max_user_connections;
@@session.max_user_connections @@global.max_user_connections
3 2
diff --git a/mysql-test/t/archive.test b/mysql-test/t/archive.test
index 8cf54610914..f7ec603ca79 100644
--- a/mysql-test/t/archive.test
+++ b/mysql-test/t/archive.test
@@ -1,6 +1,6 @@
#
# Simple test for archive example
-# Taken fromm the select test
+# Taken from the select test
#
-- source include/have_archive.inc
diff --git a/mysql-test/t/federated.test b/mysql-test/t/federated.test
index aa62377be64..413509a0a6a 100644
--- a/mysql-test/t/federated.test
+++ b/mysql-test/t/federated.test
@@ -68,12 +68,14 @@ select * from federated.t1 where id = 5;
delete from federated.t1;
select * from federated.t1 where id = 5;
-drop table if exists federated.t1;
-CREATE TABLE federated.t1 ( `id` int(20) NOT NULL auto_increment, `name` varchar(32), `other` varchar(20), PRIMARY KEY (`id`) ) ENGINE="FEDERATED" DEFAULT CHARSET=latin1 COMMENT='mysql://root@127.0.0.1:9308/federated/t1';
-
connection slave;
drop table if exists federated.t1;
CREATE TABLE federated.t1 ( `id` int(20) NOT NULL auto_increment, `name` varchar(32), `other` varchar(20), PRIMARY KEY (`id`) );
+
+connection master;
+drop table if exists federated.t1;
+CREATE TABLE federated.t1 ( `id` int(20) NOT NULL auto_increment, `name` varchar(32), `other` varchar(20), PRIMARY KEY (`id`) ) ENGINE="FEDERATED" DEFAULT CHARSET=latin1 COMMENT='mysql://root@127.0.0.1:9308/federated/t1';
+
insert into federated.t1 (name, other) values ('First Name', 11111);
insert into federated.t1 (name, other) values ('Second Name', NULL);
insert into federated.t1 (name, other) values ('Third Name', 33333);
@@ -90,19 +92,78 @@ select * from federated.t1 where name IS NULL;
select * from federated.t1 where name IS NULL and other IS NULL;
select * from federated.t1 where name IS NULL or other IS NULL;
update federated.t1 set name = 'Fourth Name', other = 'four four four' where name IS NULL and other IS NULL;
-update federated.t1 set other = 'two two two two' where name = 'Secend Name';
+update federated.t1 set other = 'two two two two' where name = 'Second Name';
update federated.t1 set other = 'seven seven' where name like 'Sec%';
update federated.t1 set other = 'seven seven' where name = 'Seventh Name';
update federated.t1 set name = 'Tenth Name' where other like 'fee fie%';
select * from federated.t1 where name IS NULL or other IS NULL ;
select * from federated.t1;
+# test multi-keys
connection slave;
drop table if exists federated.t1;
-CREATE TABLE federated.t1 (id int, name varchar(32), floatval float, other int) DEFAULT CHARSET=latin1;
+CREATE TABLE federated.t1 ( `id` int(20) NOT NULL auto_increment, `name`
+varchar(32) NOT NULL DEFAULT '', `other` varchar(20) NOT NULL DEFAULT '', PRIMARY KEY (`id`), key nameoth (name, other) );
connection master;
+drop table if exists federated.t1;
+CREATE TABLE federated.t1 ( `id` int(20) NOT NULL auto_increment, `name` varchar(32) NOT NULL DEFAULT '', `other` varchar(20) NOT NULL DEFAULT '', PRIMARY KEY (`id`), key nameoth (name, other)) ENGINE="FEDERATED" DEFAULT CHARSET=latin1 COMMENT='mysql://root@127.0.0.1:9308/federated/t1';
+insert into federated.t1 (name, other) values ('First Name', '1111');
+insert into federated.t1 (name, other) values ('Second Name', '2222');
+insert into federated.t1 (name, other) values ('Third Name', '3333');
+select * from federated.t1 where name = 'Second Name';
+select * from federated.t1 where other = '2222';
+select * from federated.t1 where name = 'Third Name';
+select * from federated.t1 where name = 'Third Name' and other = '3333';
+
+connection slave;
+drop table if exists federated.t1;
+CREATE TABLE federated.t1
+ (id int NOT NULL auto_increment,
+ name char(32) NOT NULL DEFAULT '',
+ bincol binary(4) NOT NULL,
+ floatval decimal(5,2) NOT NULL DEFAULT 0.0,
+ other int NOT NULL DEFAULT 0,
+ primary key(id),
+ key nameoth(name, other),
+ key bincol(bincol),
+ key floatval(floatval));
+
+# test other types of indexes
+connection master;
+drop table if exists federated.t1;
+CREATE TABLE federated.t1
+ (id int NOT NULL auto_increment,
+ name char(32) NOT NULL DEFAULT '',
+ bincol binary(4) NOT NULL,
+ floatval decimal(5,2) NOT NULL DEFAULT 0.0,
+ other int NOT NULL DEFAULT 0,
+ primary key(id),
+ key nameoth(name,other),
+ key bincol(bincol),
+ key floatval(floatval))
+ ENGINE="FEDERATED" DEFAULT CHARSET=latin1 COMMENT='mysql://root@127.0.0.1:9308/federated/t1';
+
+insert into federated.t1 (name, bincol, floatval, other) values ('first', 0x65, 11.11, 1111);
+insert into federated.t1 (name, bincol, floatval, other) values ('second', 0x66, 22.22, 2222);
+insert into federated.t1 (name, bincol, floatval, other) values ('third', 'g', 22.22, 2222);
+select * from federated.t1;
+select * from federated.t1 where name = 'second';
+select * from federated.t1 where bincol= 'f';
+select * from federated.t1 where bincol= 0x66;
+select * from federated.t1 where bincol= 0x67;
+select * from federated.t1 where bincol= 'g';
+select * from federated.t1 where floatval=11.11;
+select * from federated.t1 where name='third';
+select * from federated.t1 where other=2222;
+select * from federated.t1 where name='third' and other=2222;
+
# test NULLs
+connection slave;
+drop table if exists federated.t1;
+CREATE TABLE federated.t1 (id int, name varchar(32), floatval float, other int) DEFAULT CHARSET=latin1;
+
+connection master;
drop table if exists federated.t1;
CREATE TABLE federated.t1 (id int, name varchar(32), floatval float, other int) ENGINE="FEDERATED" DEFAULT CHARSET=latin1 COMMENT='mysql://root@127.0.0.1:9308/federated/t1';
# these both should be the same
@@ -452,15 +513,17 @@ select * from federated.t1;
connection slave;
drop table if exists federated.t1;
-create table federated.t1 (id int NOT NULL auto_increment, code char(20) NOT NULL, fileguts blob, creation_date datetime, entered_time datetime default '2004-04-04 04:04:04', primary key(id), index(code)) DEFAULT CHARSET=latin1;
+create table federated.t1 (id int NOT NULL auto_increment, code char(20) NOT NULL, fileguts blob NOT NULL, creation_date datetime, entered_time datetime default '2004-04-04 04:04:04', primary key(id), index(code), index(fileguts(10))) DEFAULT CHARSET=latin1;
connection master;
drop table if exists federated.t1;
-create table federated.t1 (id int NOT NULL auto_increment, code char(20) NOT NULL, fileguts blob, creation_date datetime, entered_time datetime default '2004-04-04 04:04:04', primary key(id), index(code)) ENGINE="FEDERATED" DEFAULT CHARSET=latin1 COMMENT='mysql://root@127.0.0.1:9308/federated/t1';
+create table federated.t1 (id int NOT NULL auto_increment, code char(20) NOT NULL, fileguts blob NOT NULL, creation_date datetime, entered_time datetime default '2004-04-04 04:04:04', primary key(id), index(code), index(fileguts(10))) ENGINE="FEDERATED" DEFAULT CHARSET=latin1 COMMENT='mysql://root@127.0.0.1:9308/federated/t1';
insert into federated.t1 (code, fileguts, creation_date) values ('ASDFWERQWETWETAWETA', '*()w*09*$()*#)(*09*^90*d)(*s()d8g)(s*ned)(*)(s*d)(*hn(d*)(*sbn)D((#$*(#*%%&#&^$#&#&#&#&^&#*&*#$*&^*(&#(&Q*&&(*!&!(*&*(#&*(%&#<S-F8>*<S-F8><S-F8><S-F8>#<S-F8>#<S-F8>#<S-F8>[[', '2003-03-03 03:03:03');
insert into federated.t1 (code, fileguts, creation_date) values ('DEUEUEUEUEUEUEUEUEU', '*()w*09*$()*#)(*09*^90*d)(*s()d8g)(s*ned)(*)(s*d)(*hn(d*)(*sbn)D((#$*(#*%%&#&^$#&#&#&#&^&#*&*#$*&^*(&#(&Q*&&(*!&!(*&*(#&*(%&#<S-F8>*<S-F8><S-F8><S-F8>#<S-F8>#<S-F8>#<S-F8>[[', '2004-04-04 04:04:04');
+insert into federated.t1 (code, fileguts, creation_date) values ('DEUEUEUEUEUEUEUEUEU', 'jimbob', '2004-04-04 04:04:04');
select * from federated.t1;
-drop table if exists federated.t1;
+select * from federated.t1 where fileguts = 'jimbob';
+# test blob indexes
# TODO
#
@@ -490,11 +553,36 @@ drop table if exists federated.t1;
# drop table if exists federated.t1;
#
+# test joins with non-federated table
connection slave;
drop table if exists federated.t1;
+CREATE TABLE federated.t1 ( `id` int(20) NOT NULL auto_increment, `country_id` int(20) NOT NULL DEFAULT 0, `name` varchar(32), `other` varchar(20), PRIMARY KEY (`id`), key (country_id));
+
+connection master;
+drop table if exists federated.t1;
+CREATE TABLE federated.t1 ( `id` int(20) NOT NULL auto_increment, `country_id` int(20) NOT NULL DEFAULT 0, `name` varchar(32), `other` varchar(20), PRIMARY KEY (`id`), key (country_id) ) ENGINE="FEDERATED" DEFAULT CHARSET=latin1 COMMENT='mysql://root@127.0.0.1:9308/federated/t1';
+insert into federated.t1 (name, country_id, other) values ('Kumar', 1, 11111);
+insert into federated.t1 (name, country_id, other) values ('Lenz', 2, 22222);
+insert into federated.t1 (name, country_id, other) values ('Marizio', 3, 33333);
+insert into federated.t1 (name, country_id, other) values ('Monty', 4, 33333);
+insert into federated.t1 (name, country_id, other) values ('Sanja', 5, 33333);
+
+
+drop table if exists federated.countries;
+CREATE TABLE federated.countries ( `id` int(20) NOT NULL auto_increment, `country` varchar(32), primary key (id));
+insert into federated.countries (country) values ('India');
+insert into federated.countries (country) values ('Germany');
+insert into federated.countries (country) values ('Italy');
+insert into federated.countries (country) values ('Finland');
+insert into federated.countries (country) values ('Ukraine');
+
+select federated.t1.*, federated.countries.country from federated.t1 left join federated.countries on federated.t1.country_id = federated.countries.id;
+
+drop table federated.countries;
connection master;
--disable_warnings
+drop table if exists federated.t1;
drop database if exists federated;
--enable_warnings
diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
index a4886fd8245..177867f5205 100644
--- a/mysql-test/t/information_schema.test
+++ b/mysql-test/t/information_schema.test
@@ -281,7 +281,7 @@ drop view vo;
select TABLE_NAME,TABLE_TYPE,ENGINE
from information_schema.tables
where table_schema='information_schema' limit 2;
-show tables from information_schema like "t%";
+show tables from information_schema like "T%";
--error 1007
create database information_schema;
diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test
index 15509b06679..a5b163b3533 100644
--- a/mysql-test/t/insert_select.test
+++ b/mysql-test/t/insert_select.test
@@ -180,3 +180,18 @@ insert into t2 Select null, Field, Count From t1 Where Month=20030901 and Type=2
select * from t2;
drop table t1, t2;
+
+#
+# BUG#6034 - Error code 124: Wrong medium type
+#
+CREATE TABLE t1 (
+ ID int(11) NOT NULL auto_increment,
+ NO int(11) NOT NULL default '0',
+ SEQ int(11) NOT NULL default '0',
+ PRIMARY KEY (ID),
+ KEY t1$NO (SEQ,NO)
+) ENGINE=MyISAM;
+INSERT INTO t1 (SEQ, NO) SELECT "1" AS SEQ, IF(MAX(NO) IS NULL, 0, MAX(NO)) + 1 AS NO FROM t1 WHERE (SEQ = 1);
+select SQL_BUFFER_RESULT * from t1 WHERE (SEQ = 1);
+drop table t1;
+
diff --git a/mysql-test/t/lowercase_table2.test b/mysql-test/t/lowercase_table2.test
index 237dcd29950..a766e39abab 100644
--- a/mysql-test/t/lowercase_table2.test
+++ b/mysql-test/t/lowercase_table2.test
@@ -10,7 +10,7 @@ show variables like "lower_case_table_names";
enable_query_log;
--disable_warnings
-DROP TABLE IF EXISTS t1,t2,T1,T2,t3,T3,tT;
+DROP TABLE IF EXISTS t1,t2,T1,T2,t3,T3;
DROP DATABASE IF EXISTS `TEST_$1`;
DROP DATABASE IF EXISTS `test_$1`;
--enable_warnings
@@ -105,9 +105,9 @@ drop table t1;
# Bug #7261: Alter table loses temp table
#
-create temporary table tT(a int(11), b varchar(8));
-insert into tT values (1, 'abc');
-select * from tT;
-alter table tT add index (a);
-select * from tT;
-drop table tT;
+create temporary table T1(a int(11), b varchar(8));
+insert into T1 values (1, 'abc');
+select * from T1;
+alter table T1 add index (a);
+select * from T1;
+drop table T1;
diff --git a/mysql-test/t/ndb_alter_table.test b/mysql-test/t/ndb_alter_table.test
index 892443a1407..3544a50c3e1 100644
--- a/mysql-test/t/ndb_alter_table.test
+++ b/mysql-test/t/ndb_alter_table.test
@@ -47,10 +47,12 @@ col3 varchar (20) not null,
col4 varchar(4) not null,
col5 enum('PENDING', 'ACTIVE', 'DISABLED') not null,
col6 int not null, to_be_deleted int) ENGINE=ndbcluster;
+--replace_column 7 # 8 # 10 # 12 # 13 # 14 # 18 #
show table status;
SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
insert into t1 values
(0,4,3,5,"PENDING",1,7),(NULL,4,3,5,"PENDING",1,7),(31,4,3,5,"PENDING",1,7), (7,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7), (100,4,3,5,"PENDING",1,7), (99,4,3,5,"PENDING",1,7), (8,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7);
+--replace_column 7 # 8 # 10 # 12 # 13 # 14 # 18 #
show table status;
select * from t1 order by col1;
alter table t1
@@ -59,9 +61,11 @@ add column col7 varchar(30) not null after col5,
add column col8 datetime not null, drop column to_be_deleted,
change column col2 fourth varchar(30) not null after col3,
modify column col6 int not null first;
+--replace_column 7 # 8 # 10 # 12 # 13 # 14 # 18 #
show table status;
select * from t1 order by col1;
insert into t1 values (2, NULL,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00');
+--replace_column 7 # 8 # 10 # 12 # 13 # 14 # 18 #
show table status;
select * from t1 order by col1;
delete from t1;
diff --git a/mysql-test/t/ndb_autodiscover.test b/mysql-test/t/ndb_autodiscover.test
index 2159e6b6e62..713aa326e4d 100644
--- a/mysql-test/t/ndb_autodiscover.test
+++ b/mysql-test/t/ndb_autodiscover.test
@@ -176,7 +176,7 @@ show status like 'handler_discover%';
flush tables;
system rm var/master-data/test/t7.frm ;
---replace_column 7 # 8 # 9 # 12 # 13 # 15 #
+--replace_column 7 # 8 # 9 # 12 # 13 # 15 # 18 #
show table status;
show status like 'handler_discover%';
diff --git a/mysql-test/t/ndb_index_ordered.test b/mysql-test/t/ndb_index_ordered.test
index 1e70eac181e..bea21f65381 100644
--- a/mysql-test/t/ndb_index_ordered.test
+++ b/mysql-test/t/ndb_index_ordered.test
@@ -220,16 +220,16 @@ create table t1 (
index(ts)
) engine=ndb;
-insert into t1 (pk,dt,da,ye,ti) values
- (1, '1901-05-05 23:00:59', '1901-05-05', '1901', '23:00:59'),
- (2, '1912-09-05 13:00:59', '1912-09-05', '1912', '13:00:59'),
- (3, '1945-12-31 00:00:00', '1945-12-31', '1945', '00:00:00'),
- (4, '1955-12-31 00:00:00', '1955-12-31', '1955', '00:00:00'),
- (5, '1963-06-06 06:06:06', '1963-06-06', '1963', '06:06:06'),
- (6, '1993-06-06 06:06:06', '1993-06-06', '1993', '06:06:06'),
- (7, '2001-01-01 10:11:10', '2001-01-01', '2001', '10:11:10'),
- (8, '2001-01-01 10:11:11', '2001-01-01', '2001', '10:11:11'),
- (9, '2005-01-31 23:59:59', '2005-01-31', '2005', '23:59:59');
+insert into t1 (pk,dt,da,ye,ti,ts) values
+ (1, '1901-05-05 23:00:59', '1901-05-05', '1901', '23:00:59', '2001-01-01 23:00:59'),
+ (2, '1912-09-05 13:00:59', '1912-09-05', '1912', '13:00:59', '2001-01-01 13:00:59'),
+ (3, '1945-12-31 00:00:00', '1945-12-31', '1945', '00:00:00', '2001-01-01 00:00:00'),
+ (4, '1955-12-31 00:00:00', '1955-12-31', '1955', '00:00:00', '2001-01-01 00:00:00'),
+ (5, '1963-06-06 06:06:06', '1963-06-06', '1963', '06:06:06', '2001-01-01 06:06:06'),
+ (6, '1993-06-06 06:06:06', '1993-06-06', '1993', '06:06:06', '2001-01-01 06:06:06'),
+ (7, '2001-01-01 10:11:10', '2001-01-01', '2001', '10:11:10', '2001-01-01 10:11:10'),
+ (8, '2001-01-01 10:11:11', '2001-01-01', '2001', '10:11:11', '2001-01-01 10:11:11'),
+ (9, '2005-01-31 23:59:59', '2005-01-31', '2005', '23:59:59', '2001-01-01 23:59:59');
# datetime
select count(*)-9 from t1 use index (dt) where dt > '1900-01-01 00:00:00';
@@ -268,6 +268,16 @@ select count(*)-6 from t1 use index (ti) where ti <= '10:11:11';
select count(*)-8 from t1 use index (ti) where ti < '23:59:59';
select count(*)-9 from t1 use index (ti) where ti <= '23:59:59';
+# timestamp
+select count(*)-9 from t1 use index (ts) where ts >= '2001-01-01 00:00:00';
+select count(*)-7 from t1 use index (ts) where ts > '2001-01-01 00:00:00';
+select count(*)-7 from t1 use index (ts) where ts > '2001-01-01 05:05:05';
+select count(*)-5 from t1 use index (ts) where ts > '2001-01-01 06:06:06';
+select count(*)-5 from t1 use index (ts) where ts < '2001-01-01 10:11:11';
+select count(*)-6 from t1 use index (ts) where ts <= '2001-01-01 10:11:11';
+select count(*)-8 from t1 use index (ts) where ts < '2001-01-01 23:59:59';
+select count(*)-9 from t1 use index (ts) where ts <= '2001-01-01 23:59:59';
+
drop table t1;
# bug#7798
diff --git a/mysql-test/t/ndb_index_unique.test b/mysql-test/t/ndb_index_unique.test
index d585ac107bc..2fc7c496fea 100644
--- a/mysql-test/t/ndb_index_unique.test
+++ b/mysql-test/t/ndb_index_unique.test
@@ -286,3 +286,24 @@ select * from t8 order by a;
select * from t1 order by a;
drop table t1, t8;
+###############################
+# Bug 8101
+#
+# Unique index not specified in the same order as in table
+#
+
+create table t1(
+ id integer not null auto_increment,
+ month integer not null,
+ year integer not null,
+ code varchar( 2) not null,
+ primary key ( id),
+ unique idx_t1( month, code, year)
+) engine=ndb;
+
+INSERT INTO t1 (month, year, code) VALUES (4,2004,'12');
+INSERT INTO t1 (month, year, code) VALUES (5,2004,'12');
+
+select * from t1 where code = '12' and month = 4 and year = 2004 ;
+
+drop table t1;
diff --git a/mysql-test/t/ndb_restore.test b/mysql-test/t/ndb_restore.test
index 09939ec119d..3a77289a8fb 100644
--- a/mysql-test/t/ndb_restore.test
+++ b/mysql-test/t/ndb_restore.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/ndb_default_cluster.inc
--disable_warnings
use test;
diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test
index 02e49f9750d..9608b7900ee 100644
--- a/mysql-test/t/order_by.test
+++ b/mysql-test/t/order_by.test
@@ -539,3 +539,13 @@ explain select * from t1 where wnid like '0101%' order by wnid;
select * from t1 where wnid like '0101%' order by wnid;
drop table t1;
+
+#
+# Bug #7672 - a wrong result for a select query in braces followed by order by
+#
+
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (2), (1), (1), (2), (1);
+SELECT a FROM t1 ORDER BY a;
+(SELECT a FROM t1) ORDER BY a;
+DROP TABLE t1;
diff --git a/mysql-test/t/user_limits.test b/mysql-test/t/user_limits.test
index 50c16e5e114..729894a588a 100644
--- a/mysql-test/t/user_limits.test
+++ b/mysql-test/t/user_limits.test
@@ -19,6 +19,8 @@ flush privileges;
# Test of MAX_QUERIES_PER_HOUR limit
grant usage on *.* to mysqltest_1@localhost with max_queries_per_hour 2;
+# This ensures that counters are reset and makes test scheduling independent
+flush user_resources;
connect (mqph, localhost, mysqltest_1,,);
connection mqph;
select * from t1;
@@ -37,6 +39,7 @@ disconnect mqph2;
# Test of MAX_UPDATES_PER_HOUR limit
grant usage on *.* to mysqltest_1@localhost with max_updates_per_hour 2;
+flush user_resources;
connect (muph, localhost, mysqltest_1,,);
connection muph;
select * from t1;
@@ -60,6 +63,7 @@ disconnect muph2;
# Test of MAX_CONNECTIONS_PER_HOUR limit
grant usage on *.* to mysqltest_1@localhost with max_connections_per_hour 2;
+flush user_resources;
connect (mcph1, localhost, mysqltest_1,,);
connection mcph1;
select * from t1;
@@ -86,6 +90,7 @@ drop user mysqltest_1@localhost;
# We need this to reset internal mqh_used variable
flush privileges;
grant usage on *.* to mysqltest_1@localhost with max_user_connections 2;
+flush user_resources;
connect (muc1, localhost, mysqltest_1,,);
connection muc1;
select * from t1;
@@ -102,6 +107,7 @@ select * from t1;
# Changing of limit should also help (and immediately)
connection default;
grant usage on *.* to mysqltest_1@localhost with max_user_connections 3;
+flush user_resources;
connect (muc4, localhost, mysqltest_1,,);
connection muc4;
select * from t1;
@@ -127,6 +133,7 @@ set global max_user_connections= 2;
select @@session.max_user_connections, @@global.max_user_connections;
# Let us check that global limit works
grant usage on *.* to mysqltest_1@localhost;
+flush user_resources;
connect (muca1, localhost, mysqltest_1,,);
connection muca1;
select @@session.max_user_connections, @@global.max_user_connections;
@@ -139,6 +146,7 @@ connect (muca3, localhost, mysqltest_1,,);
# Now we are testing that per-account limit prevails over gloabl limit
connection default;
grant usage on *.* to mysqltest_1@localhost with max_user_connections 3;
+flush user_resources;
connect (muca3, localhost, mysqltest_1,,);
connection muca3;
select @@session.max_user_connections, @@global.max_user_connections;
diff --git a/mysys/my_static.c b/mysys/my_static.c
index 57d41676390..8207463ea50 100644
--- a/mysys/my_static.c
+++ b/mysys/my_static.c
@@ -25,6 +25,8 @@
#include "my_alarm.h"
#endif
+my_bool timed_mutexes= 0;
+
/* from my_init */
my_string home_dir=0,my_progname=0;
char NEAR curr_dir[FN_REFLEN]= {0},
diff --git a/ndb/Makefile.am b/ndb/Makefile.am
index 32c821383e6..3aac54b38ee 100644
--- a/ndb/Makefile.am
+++ b/ndb/Makefile.am
@@ -1,12 +1,13 @@
SUBDIRS = src tools . include @ndb_opt_subdirs@
DIST_SUBDIRS = src tools include test docs
-EXTRA_DIST = config
+EXTRA_DIST = config ndbapi-examples
include $(top_srcdir)/ndb/config/common.mk.am
dist-hook:
-rm -rf `find $(distdir) -type d -name SCCS`
-rm -rf `find $(distdir) -type d -name old_files`
+ -rm -rf `find $(distdir)/ndbapi-examples -name '*.o'`
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" != "." -a "$$subdir" != "include"; then \
files="`find $$subdir -name '*\.h'` `find $$subdir -name '*\.hpp'`"; \
diff --git a/ndb/docs/Makefile.am b/ndb/docs/Makefile.am
index 6d4cdc12cf6..afa91857771 100644
--- a/ndb/docs/Makefile.am
+++ b/ndb/docs/Makefile.am
@@ -9,7 +9,7 @@ DOXYOUT = .doxyout
NDB_RELEASE = @NDB_VERSION_MAJOR@.@NDB_VERSION_MINOR@.@NDB_VERSION_BUILD@-@NDB_VERSION_STATUS@
-clean:
+clean-local:
rm -rf ndbapi.pdf ndbapi.html mgmapi.pdf mgmapi.html
rm -rf $(DOXYTMP) $(DOXYOUT)
@@ -48,7 +48,7 @@ ndbapi.html: $(noinst_HEADERS)
@RM@ -rf $(DOXYTMP) $(DOXYOUT); \
mkdir -p $(DOXYTMP) $(DOXYOUT); \
@CP@ $(top_srcdir)/ndb/include/ndbapi/* $(DOXYTMP); \
- @CP@ $(top_srcdir)/ndb/examples/*/*.[ch]pp $(DOXYTMP); \
+ @CP@ $(top_srcdir)/ndb/ndbapi-examples/*/*.[ch]pp $(DOXYTMP); \
@PERL@ $(DOXYDIR)/predoxy.pl; \
mv footer.html $(DOXYTMP); \
(cd $(DOXYTMP) ; @DOXYGEN@ ../$(DOXYDIR)/Doxyfile.ndbapi); \
diff --git a/ndb/examples/configurations/demos.tar b/ndb/examples/configurations/demos.tar
deleted file mode 100644
index d8cae90ec5b..00000000000
--- a/ndb/examples/configurations/demos.tar
+++ /dev/null
Binary files differ
diff --git a/ndb/include/Makefile.am b/ndb/include/Makefile.am
index 56d9bbf01fb..10f297492e9 100644
--- a/ndb/include/Makefile.am
+++ b/ndb/include/Makefile.am
@@ -9,6 +9,7 @@ ndb_version.h
ndbapiinclude_HEADERS = \
ndbapi/ndbapi_limits.h \
+ndbapi/ndb_opt_defaults.h \
ndbapi/Ndb.hpp \
ndbapi/NdbApi.hpp \
ndbapi/NdbTransaction.hpp \
diff --git a/ndb/include/kernel/signaldata/CreateIndx.hpp b/ndb/include/kernel/signaldata/CreateIndx.hpp
index 3e277b38dea..7d6c0f756dc 100644
--- a/ndb/include/kernel/signaldata/CreateIndx.hpp
+++ b/ndb/include/kernel/signaldata/CreateIndx.hpp
@@ -207,7 +207,7 @@ public:
NotUnique = 4251,
AllocationError = 4252,
CreateIndexTableFailed = 4253,
- InvalidAttributeOrder = 4255
+ DuplicateAttributes = 4258
};
private:
diff --git a/ndb/include/kernel/signaldata/DictTabInfo.hpp b/ndb/include/kernel/signaldata/DictTabInfo.hpp
index 6ae8a8a2985..61c043f2998 100644
--- a/ndb/include/kernel/signaldata/DictTabInfo.hpp
+++ b/ndb/include/kernel/signaldata/DictTabInfo.hpp
@@ -276,7 +276,9 @@ public:
ExtBit = NdbSqlUtil::Type::Bit,
ExtLongvarchar = NdbSqlUtil::Type::Longvarchar,
ExtLongvarbinary = NdbSqlUtil::Type::Longvarbinary,
- ExtTime = NdbSqlUtil::Type::Time
+ ExtTime = NdbSqlUtil::Type::Time,
+ ExtYear = NdbSqlUtil::Type::Year,
+ ExtTimestamp = NdbSqlUtil::Type::Timestamp
};
// Attribute data interpretation
@@ -389,6 +391,14 @@ public:
AttributeSize = DictTabInfo::an8Bit;
AttributeArraySize = 3 * AttributeExtLength;
break;
+ case DictTabInfo::ExtYear:
+ AttributeSize = DictTabInfo::an8Bit;
+ AttributeArraySize = 1 * AttributeExtLength;
+ break;
+ case DictTabInfo::ExtTimestamp:
+ AttributeSize = DictTabInfo::an8Bit;
+ AttributeArraySize = 4 * AttributeExtLength;
+ break;
default:
return false;
};
diff --git a/ndb/include/mgmapi/mgmapi_config_parameters.h b/ndb/include/mgmapi/mgmapi_config_parameters.h
index 62fa24d3c04..68b63d78fa8 100644
--- a/ndb/include/mgmapi/mgmapi_config_parameters.h
+++ b/ndb/include/mgmapi/mgmapi_config_parameters.h
@@ -121,6 +121,7 @@
#define CFG_SHM_CHECKSUM 501
#define CFG_SHM_KEY 502
#define CFG_SHM_BUFFER_MEM 503
+#define CFG_SHM_SIGNUM 504
#define CFG_SCI_HOST1_ID_0 550
#define CFG_SCI_HOST1_ID_1 551
diff --git a/ndb/include/ndb_constants.h b/ndb/include/ndb_constants.h
index a04afe1bd72..da3fc2cbdd8 100644
--- a/ndb/include/ndb_constants.h
+++ b/ndb/include/ndb_constants.h
@@ -61,7 +61,9 @@
#define NDB_TYPE_LONG_VARCHAR 23
#define NDB_TYPE_LONG_VARBINARY 24
#define NDB_TYPE_TIME 25
+#define NDB_TYPE_YEAR 26
+#define NDB_TYPE_TIMESTAMP 27
-#define NDB_TYPE_MAX 26
+#define NDB_TYPE_MAX 28
#endif
diff --git a/ndb/include/ndbapi/NdbDictionary.hpp b/ndb/include/ndbapi/NdbDictionary.hpp
index 80c0831f675..91cfc0cb22a 100644
--- a/ndb/include/ndbapi/NdbDictionary.hpp
+++ b/ndb/include/ndbapi/NdbDictionary.hpp
@@ -196,7 +196,9 @@ public:
Bit = NDB_TYPE_BIT, ///< Bit, length specifies no of bits
Longvarchar = NDB_TYPE_LONG_VARCHAR, ///< Length bytes: 2, little-endian
Longvarbinary = NDB_TYPE_LONG_VARBINARY, ///< Length bytes: 2, little-endian
- Time = NDB_TYPE_TIME ///< Time without date
+ Time = NDB_TYPE_TIME, ///< Time without date
+ Year = NDB_TYPE_YEAR, ///< Year 1901-2155 (1 byte)
+ Timestamp = NDB_TYPE_TIMESTAMP ///< Unix time
};
/**
diff --git a/ndb/include/ndbapi/NdbScanFilter.hpp b/ndb/include/ndbapi/NdbScanFilter.hpp
index 5f214451321..7c575169dc1 100644
--- a/ndb/include/ndbapi/NdbScanFilter.hpp
+++ b/ndb/include/ndbapi/NdbScanFilter.hpp
@@ -53,7 +53,7 @@ public:
COND_GE = 2, ///< upper bound
COND_GT = 3, ///< upper bound, strict
COND_EQ = 4, ///< equality
- COND_NE = 5
+ COND_NE = 5 ///< not equal
};
/**
diff --git a/ndb/include/ndbapi/ndb_opt_defaults.h b/ndb/include/ndbapi/ndb_opt_defaults.h
new file mode 100644
index 00000000000..d03a9dcc36f
--- /dev/null
+++ b/ndb/include/ndbapi/ndb_opt_defaults.h
@@ -0,0 +1,23 @@
+/* Copyright (C) 2003 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#ifndef NDB_OPT_DEFAULTS_H
+#define NDB_OPT_DEFAULTS_H
+
+#define OPT_NDB_SHM_SIGNUM_DEFAULT 0
+#define OPT_NDB_SHM_DEFAULT 0
+
+#endif
diff --git a/ndb/include/transporter/TransporterDefinitions.hpp b/ndb/include/transporter/TransporterDefinitions.hpp
index 4ff6b2073eb..d4763ba4c37 100644
--- a/ndb/include/transporter/TransporterDefinitions.hpp
+++ b/ndb/include/transporter/TransporterDefinitions.hpp
@@ -77,6 +77,7 @@ struct SHM_TransporterConfiguration {
Uint32 shmKey;
Uint32 shmSize;
+ int signum;
};
/**
diff --git a/ndb/include/util/NdbSqlUtil.hpp b/ndb/include/util/NdbSqlUtil.hpp
index 75e2a819174..a8a2979558a 100644
--- a/ndb/include/util/NdbSqlUtil.hpp
+++ b/ndb/include/util/NdbSqlUtil.hpp
@@ -92,7 +92,9 @@ public:
Bit = NDB_TYPE_BIT,
Longvarchar = NDB_TYPE_LONG_VARCHAR,
Longvarbinary = NDB_TYPE_LONG_VARBINARY,
- Time = NDB_TYPE_TIME
+ Time = NDB_TYPE_TIME,
+ Year = NDB_TYPE_YEAR,
+ Timestamp = NDB_TYPE_TIMESTAMP
};
Enum m_typeId; // redundant
Cmp* m_cmp; // comparison method
@@ -161,6 +163,8 @@ private:
static Cmp cmpLongvarchar;
static Cmp cmpLongvarbinary;
static Cmp cmpTime;
+ static Cmp cmpYear;
+ static Cmp cmpTimestamp;
};
#endif
diff --git a/ndb/include/util/ndb_opts.h b/ndb/include/util/ndb_opts.h
index 9151aee6cf2..aa7a02f58ae 100644
--- a/ndb/include/util/ndb_opts.h
+++ b/ndb/include/util/ndb_opts.h
@@ -22,24 +22,16 @@
#include <my_getopt.h>
#include <mysql_version.h>
#include <ndb_version.h>
+#include <ndb_opt_defaults.h>
#define NDB_STD_OPTS_VARS \
const char *opt_connect_str= 0;\
-my_bool opt_ndb_shm;\
my_bool opt_ndb_optimized_node_selection
-#define NDB_STD_OPTS_OPTIONS \
-OPT_NDB_SHM= 256,\
-OPT_NDB_OPTIMIZED_NODE_SELECTION
+my_bool opt_ndb_shm;
#define OPT_NDB_CONNECTSTRING 'c'
-#if defined(NOT_ENOUGH_TESTED) && defined(NDB_SHM_TRANSPORTER) && MYSQL_VERSION_ID >= 50000
-#define OPT_NDB_SHM_DEFAULT 1
-#else
-#define OPT_NDB_SHM_DEFAULT 0
-#endif
-
#define NDB_STD_OPTS_COMMON \
{ "usage", '?', "Display this help and exit.", \
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \
@@ -75,4 +67,51 @@ OPT_NDB_OPTIMIZED_NODE_SELECTION
#define NDB_STD_OPTS(prog_name) NDB_STD_OPTS_COMMON
#endif
+static void ndb_std_print_version()
+{
+ printf("MySQL distrib %s, for %s (%s)\n",
+ MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
+}
+
+static void usage();
+
+enum ndb_std_options {
+ OPT_NDB_SHM= 256,
+ OPT_NDB_SHM_SIGNUM,
+ OPT_NDB_OPTIMIZED_NODE_SELECTION,
+ NDB_STD_OPTIONS_LAST /* should always be last in this enum */
+};
+
+static my_bool
+ndb_std_get_one_option(int optid,
+ const struct my_option *opt __attribute__((unused)),
+ const char *argument)
+{
+ switch (optid) {
+ case '#':
+ if (argument)
+ {
+ DBUG_PUSH(argument);
+ }
+ break;
+ case 'V':
+ ndb_std_print_version();
+ exit(0);
+ case '?':
+ usage();
+ exit(0);
+ case OPT_NDB_SHM:
+ if (opt_ndb_shm)
+ {
+#ifndef NDB_SHM_TRANSPORTER
+ printf("Warning: binary not compiled with shared memory support,\n"
+ "Tcp connections will now be used instead\n");
+ opt_ndb_shm= 0;
+#endif
+ }
+ break;
+ }
+ return 0;
+}
+
#endif /*_NDB_OPTS_H */
diff --git a/ndb/examples/Makefile b/ndb/ndbapi-examples/Makefile
index 965dc3ec29f..965dc3ec29f 100644
--- a/ndb/examples/Makefile
+++ b/ndb/ndbapi-examples/Makefile
diff --git a/ndb/examples/mgmapi_logevent_example/Makefile b/ndb/ndbapi-examples/mgmapi_logevent_example/Makefile
index c1ca32dfe17..c1ca32dfe17 100644
--- a/ndb/examples/mgmapi_logevent_example/Makefile
+++ b/ndb/ndbapi-examples/mgmapi_logevent_example/Makefile
diff --git a/ndb/examples/mgmapi_logevent_example/mgmapi_logevent.cpp b/ndb/ndbapi-examples/mgmapi_logevent_example/mgmapi_logevent.cpp
index 5ec1fba6314..5ec1fba6314 100644
--- a/ndb/examples/mgmapi_logevent_example/mgmapi_logevent.cpp
+++ b/ndb/ndbapi-examples/mgmapi_logevent_example/mgmapi_logevent.cpp
diff --git a/ndb/examples/ndbapi_async_example/Makefile b/ndb/ndbapi-examples/ndbapi_async_example/Makefile
index 4df9367fc29..4df9367fc29 100644
--- a/ndb/examples/ndbapi_async_example/Makefile
+++ b/ndb/ndbapi-examples/ndbapi_async_example/Makefile
diff --git a/ndb/examples/ndbapi_async_example/ndbapi_async.cpp b/ndb/ndbapi-examples/ndbapi_async_example/ndbapi_async.cpp
index aa745f4d28d..aa745f4d28d 100644
--- a/ndb/examples/ndbapi_async_example/ndbapi_async.cpp
+++ b/ndb/ndbapi-examples/ndbapi_async_example/ndbapi_async.cpp
diff --git a/ndb/examples/ndbapi_async_example/readme.txt b/ndb/ndbapi-examples/ndbapi_async_example/readme.txt
index 47cb4bf9ffa..47cb4bf9ffa 100644
--- a/ndb/examples/ndbapi_async_example/readme.txt
+++ b/ndb/ndbapi-examples/ndbapi_async_example/readme.txt
diff --git a/ndb/examples/ndbapi_async_example1/Makefile b/ndb/ndbapi-examples/ndbapi_async_example1/Makefile
index b6fc31a00e5..b6fc31a00e5 100644
--- a/ndb/examples/ndbapi_async_example1/Makefile
+++ b/ndb/ndbapi-examples/ndbapi_async_example1/Makefile
diff --git a/ndb/examples/ndbapi_async_example1/ndbapi_async1.cpp b/ndb/ndbapi-examples/ndbapi_async_example1/ndbapi_async1.cpp
index e8bc19e267b..e8bc19e267b 100644
--- a/ndb/examples/ndbapi_async_example1/ndbapi_async1.cpp
+++ b/ndb/ndbapi-examples/ndbapi_async_example1/ndbapi_async1.cpp
diff --git a/ndb/examples/ndbapi_event_example/Makefile b/ndb/ndbapi-examples/ndbapi_event_example/Makefile
index 07d244c9346..07d244c9346 100644
--- a/ndb/examples/ndbapi_event_example/Makefile
+++ b/ndb/ndbapi-examples/ndbapi_event_example/Makefile
diff --git a/ndb/examples/ndbapi_event_example/ndbapi_event.cpp b/ndb/ndbapi-examples/ndbapi_event_example/ndbapi_event.cpp
index 286f6fafbab..286f6fafbab 100644
--- a/ndb/examples/ndbapi_event_example/ndbapi_event.cpp
+++ b/ndb/ndbapi-examples/ndbapi_event_example/ndbapi_event.cpp
diff --git a/ndb/examples/ndbapi_retries_example/Makefile b/ndb/ndbapi-examples/ndbapi_retries_example/Makefile
index c7a8946cd9a..c7a8946cd9a 100644
--- a/ndb/examples/ndbapi_retries_example/Makefile
+++ b/ndb/ndbapi-examples/ndbapi_retries_example/Makefile
diff --git a/ndb/examples/ndbapi_retries_example/ndbapi_retries.cpp b/ndb/ndbapi-examples/ndbapi_retries_example/ndbapi_retries.cpp
index 8c29fe31446..8c29fe31446 100644
--- a/ndb/examples/ndbapi_retries_example/ndbapi_retries.cpp
+++ b/ndb/ndbapi-examples/ndbapi_retries_example/ndbapi_retries.cpp
diff --git a/ndb/examples/ndbapi_scan_example/Makefile b/ndb/ndbapi-examples/ndbapi_scan_example/Makefile
index c5883757e5e..c5883757e5e 100644
--- a/ndb/examples/ndbapi_scan_example/Makefile
+++ b/ndb/ndbapi-examples/ndbapi_scan_example/Makefile
diff --git a/ndb/examples/ndbapi_scan_example/ndbapi_scan.cpp b/ndb/ndbapi-examples/ndbapi_scan_example/ndbapi_scan.cpp
index f0dc74bf3f5..f0dc74bf3f5 100644
--- a/ndb/examples/ndbapi_scan_example/ndbapi_scan.cpp
+++ b/ndb/ndbapi-examples/ndbapi_scan_example/ndbapi_scan.cpp
diff --git a/ndb/examples/ndbapi_scan_example/readme.txt b/ndb/ndbapi-examples/ndbapi_scan_example/readme.txt
index 47cb4bf9ffa..47cb4bf9ffa 100644
--- a/ndb/examples/ndbapi_scan_example/readme.txt
+++ b/ndb/ndbapi-examples/ndbapi_scan_example/readme.txt
diff --git a/ndb/examples/ndbapi_simple_example/Makefile b/ndb/ndbapi-examples/ndbapi_simple_example/Makefile
index 99d4bfe68a6..99d4bfe68a6 100644
--- a/ndb/examples/ndbapi_simple_example/Makefile
+++ b/ndb/ndbapi-examples/ndbapi_simple_example/Makefile
diff --git a/ndb/examples/ndbapi_simple_example/ndbapi_simple.cpp b/ndb/ndbapi-examples/ndbapi_simple_example/ndbapi_simple.cpp
index 152d4fa44af..152d4fa44af 100644
--- a/ndb/examples/ndbapi_simple_example/ndbapi_simple.cpp
+++ b/ndb/ndbapi-examples/ndbapi_simple_example/ndbapi_simple.cpp
diff --git a/ndb/examples/ndbapi_simple_index_example/Makefile b/ndb/ndbapi-examples/ndbapi_simple_index_example/Makefile
index dc17ff0eeaa..dc17ff0eeaa 100644
--- a/ndb/examples/ndbapi_simple_index_example/Makefile
+++ b/ndb/ndbapi-examples/ndbapi_simple_index_example/Makefile
diff --git a/ndb/examples/ndbapi_simple_index_example/ndbapi_simple_index.cpp b/ndb/ndbapi-examples/ndbapi_simple_index_example/ndbapi_simple_index.cpp
index 5afaf6078d1..5afaf6078d1 100644
--- a/ndb/examples/ndbapi_simple_index_example/ndbapi_simple_index.cpp
+++ b/ndb/ndbapi-examples/ndbapi_simple_index_example/ndbapi_simple_index.cpp
diff --git a/ndb/src/common/mgmcommon/IPCConfig.cpp b/ndb/src/common/mgmcommon/IPCConfig.cpp
index dd78e1dbfbd..e25aeee8813 100644
--- a/ndb/src/common/mgmcommon/IPCConfig.cpp
+++ b/ndb/src/common/mgmcommon/IPCConfig.cpp
@@ -14,7 +14,9 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "IPCConfig.hpp"
+#include <ndb_global.h>
+#include <ndb_opt_defaults.h>
+#include <IPCConfig.hpp>
#include <NdbOut.hpp>
#include <NdbHost.h>
@@ -381,7 +383,12 @@ IPCConfig::configureTransporters(Uint32 nodeId,
if(iter.get(CFG_SHM_KEY, &conf.shmKey)) break;
if(iter.get(CFG_SHM_BUFFER_MEM, &conf.shmSize)) break;
-
+ {
+ Uint32 tmp;
+ if(iter.get(CFG_SHM_SIGNUM, &tmp)) break;
+ conf.signum= tmp;
+ }
+
conf.port= server_port;
conf.localHostName = localHostName;
conf.remoteHostName = remoteHostName;
diff --git a/ndb/src/common/portlib/NdbThread.c b/ndb/src/common/portlib/NdbThread.c
index 8cd6c306514..5f2e6021c43 100644
--- a/ndb/src/common/portlib/NdbThread.c
+++ b/ndb/src/common/portlib/NdbThread.c
@@ -24,6 +24,10 @@
/*#define USE_PTHREAD_EXTRAS*/
+#ifdef NDB_SHM_TRANSPORTER
+int g_ndb_shm_signum= 0;
+#endif
+
struct NdbThread
{
pthread_t thread;
@@ -37,14 +41,19 @@ void*
ndb_thread_wrapper(void* _ss){
void * ret;
struct NdbThread * ss = (struct NdbThread *)_ss;
+ DBUG_ENTER("ndb_thread_wrapper");
#ifdef NDB_SHM_TRANSPORTER
- sigset_t mask;
- sigemptyset(&mask);
- sigaddset(&mask, SIGUSR1);
- pthread_sigmask(SIG_BLOCK, &mask, 0);
+ if (g_ndb_shm_signum)
+ {
+ sigset_t mask;
+ DBUG_PRINT("info",("Block signum %d",g_ndb_shm_signum));
+ sigemptyset(&mask);
+ sigaddset(&mask, g_ndb_shm_signum);
+ pthread_sigmask(SIG_BLOCK, &mask, 0);
+ }
#endif
ret= (* ss->func)(ss->object);
- return ret;
+ DBUG_RETURN(ret);
}
diff --git a/ndb/src/common/transporter/SHM_Transporter.cpp b/ndb/src/common/transporter/SHM_Transporter.cpp
index f0cbf822e53..eed3ad77be6 100644
--- a/ndb/src/common/transporter/SHM_Transporter.cpp
+++ b/ndb/src/common/transporter/SHM_Transporter.cpp
@@ -26,6 +26,8 @@
#include <InputStream.hpp>
#include <OutputStream.hpp>
+extern int g_ndb_shm_signum;
+
SHM_Transporter::SHM_Transporter(TransporterRegistry &t_reg,
const char *lHostName,
const char *rHostName,
@@ -62,7 +64,9 @@ SHM_Transporter::~SHM_Transporter(){
bool
SHM_Transporter::initTransporter(){
- return true;
+ if (g_ndb_shm_signum)
+ return true;
+ return false;
}
void
@@ -355,6 +359,6 @@ SHM_Transporter::doSend()
if(m_last_signal)
{
m_last_signal = 0;
- kill(m_remote_pid, SIGUSR1);
+ kill(m_remote_pid, g_ndb_shm_signum);
}
}
diff --git a/ndb/src/common/transporter/TransporterRegistry.cpp b/ndb/src/common/transporter/TransporterRegistry.cpp
index 215b2a05f63..7b0f2d7247b 100644
--- a/ndb/src/common/transporter/TransporterRegistry.cpp
+++ b/ndb/src/common/transporter/TransporterRegistry.cpp
@@ -38,6 +38,7 @@
#ifdef NDB_SHM_TRANSPORTER
#include "SHM_Transporter.hpp"
+extern int g_ndb_shm_signum;
#endif
#include "TransporterCallback.hpp"
@@ -152,22 +153,13 @@ TransporterRegistry::disconnectAll(){
bool
TransporterRegistry::init(NodeId nodeId) {
+ DBUG_ENTER("TransporterRegistry::init");
nodeIdSpecified = true;
localNodeId = nodeId;
DEBUG("TransporterRegistry started node: " << localNodeId);
-#ifdef NDB_SHM_TRANSPORTER
- /**
- * Make sure to block SIGUSR1
- * TransporterRegistry::init is run from "main" thread
- */
- sigset_t mask;
- sigemptyset(&mask);
- sigaddset(&mask, SIGUSR1);
- pthread_sigmask(SIG_BLOCK, &mask, 0);
-#endif
-return true;
+ DBUG_RETURN(true);
}
bool
@@ -406,6 +398,7 @@ TransporterRegistry::createTransporter(SCI_TransporterConfiguration *config) {
bool
TransporterRegistry::createTransporter(SHM_TransporterConfiguration *config) {
+ DBUG_ENTER("TransporterRegistry::createTransporter SHM");
#ifdef NDB_SHM_TRANSPORTER
if(!nodeIdSpecified){
init(config->localNodeId);
@@ -414,6 +407,22 @@ TransporterRegistry::createTransporter(SHM_TransporterConfiguration *config) {
if(config->localNodeId != localNodeId)
return false;
+ if (!g_ndb_shm_signum) {
+ g_ndb_shm_signum= config->signum;
+ DBUG_PRINT("info",("Block signum %d",g_ndb_shm_signum));
+ /**
+ * Make sure to block g_ndb_shm_signum
+ * TransporterRegistry::init is run from "main" thread
+ */
+ sigset_t mask;
+ sigemptyset(&mask);
+ sigaddset(&mask, g_ndb_shm_signum);
+ pthread_sigmask(SIG_BLOCK, &mask, 0);
+ }
+
+ if(config->signum != g_ndb_shm_signum)
+ return false;
+
if(theTransporters[config->remoteNodeId] != NULL)
return false;
@@ -443,9 +452,9 @@ TransporterRegistry::createTransporter(SHM_TransporterConfiguration *config) {
nTransporters++;
nSHMTransporters++;
- return true;
+ DBUG_RETURN(true);
#else
- return false;
+ DBUG_RETURN(false);
#endif
}
@@ -1337,6 +1346,7 @@ shm_sig_handler(int signo)
void
TransporterRegistry::startReceiving()
{
+ DBUG_ENTER("TransporterRegistry::startReceiving");
#ifdef NDB_OSE_TRANSPORTER
if(theOSEReceiver != NULL){
theOSEReceiver->createPhantom();
@@ -1355,26 +1365,34 @@ TransporterRegistry::startReceiving()
#ifdef NDB_SHM_TRANSPORTER
m_shm_own_pid = getpid();
- struct sigaction sa;
- sigemptyset(&sa.sa_mask);
- sigaddset(&sa.sa_mask, SIGUSR1);
- pthread_sigmask(SIG_UNBLOCK, &sa.sa_mask, 0);
- sa.sa_handler = shm_sig_handler;
- sigemptyset(&sa.sa_mask);
- sa.sa_flags = 0;
- int ret;
- while((ret = sigaction(SIGUSR1, &sa, 0)) == -1 && errno == EINTR);
- if(ret != 0)
+ if (g_ndb_shm_signum)
{
- g_eventLogger.error("Failed to install signal handler for SHM transporter"
- " errno: %d (%s)", errno,
+ DBUG_PRINT("info",("Install signal handler for signum %d",
+ g_ndb_shm_signum));
+ struct sigaction sa;
+ sigemptyset(&sa.sa_mask);
+ sigaddset(&sa.sa_mask, g_ndb_shm_signum);
+ pthread_sigmask(SIG_UNBLOCK, &sa.sa_mask, 0);
+ sa.sa_handler = shm_sig_handler;
+ sigemptyset(&sa.sa_mask);
+ sa.sa_flags = 0;
+ int ret;
+ while((ret = sigaction(g_ndb_shm_signum, &sa, 0)) == -1 && errno == EINTR);
+ if(ret != 0)
+ {
+ DBUG_PRINT("error",("Install failed"));
+ g_eventLogger.error("Failed to install signal handler for"
+ " SHM transporter errno: %d (%s)", errno,
#ifdef HAVE_STRERROR
- strerror(errno));
+ strerror(errno)
#else
- "");
+ ""
#endif
+ );
+ }
}
-#endif
+#endif // NDB_SHM_TRANSPORTER
+ DBUG_VOID_RETURN;
}
void
diff --git a/ndb/src/common/util/NdbSqlUtil.cpp b/ndb/src/common/util/NdbSqlUtil.cpp
index 82f99d0e7fd..d5f06f119ee 100644
--- a/ndb/src/common/util/NdbSqlUtil.cpp
+++ b/ndb/src/common/util/NdbSqlUtil.cpp
@@ -179,6 +179,14 @@ NdbSqlUtil::m_typeList[] = {
{
Type::Time,
cmpTime
+ },
+ {
+ Type::Year,
+ cmpYear
+ },
+ {
+ Type::Timestamp,
+ cmpTimestamp
}
};
@@ -670,6 +678,40 @@ NdbSqlUtil::cmpLongvarbinary(const void* info, const void* p1, unsigned n1, cons
return CmpUnknown;
}
+int
+NdbSqlUtil::cmpYear(const void* info, const void* p1, unsigned n1, const void* p2, unsigned n2, bool full)
+{
+ if (n2 >= sizeof(Uint8)) {
+ Uint8 v1, v2;
+ memcpy(&v1, p1, sizeof(Uint8));
+ memcpy(&v2, p2, sizeof(Uint8));
+ if (v1 < v2)
+ return -1;
+ if (v1 > v2)
+ return +1;
+ return 0;
+ }
+ assert(! full);
+ return CmpUnknown;
+}
+
+int
+NdbSqlUtil::cmpTimestamp(const void* info, const void* p1, unsigned n1, const void* p2, unsigned n2, bool full)
+{
+ if (n2 >= sizeof(Uint32)) {
+ Uint32 v1, v2;
+ memcpy(&v1, p1, sizeof(Uint32));
+ memcpy(&v2, p2, sizeof(Uint32));
+ if (v1 < v2)
+ return -1;
+ if (v1 > v2)
+ return +1;
+ return 0;
+ }
+ assert(! full);
+ return CmpUnknown;
+}
+
// check charset
bool
diff --git a/ndb/src/cw/cpcd/main.cpp b/ndb/src/cw/cpcd/main.cpp
index 300b51d7b5a..25632f132e9 100644
--- a/ndb/src/cw/cpcd/main.cpp
+++ b/ndb/src/cw/cpcd/main.cpp
@@ -15,7 +15,10 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <ndb_global.h> /* Needed for mkdir(2) */
-#include <ndb_opts.h>
+#include <my_sys.h>
+#include <my_getopt.h>
+#include <mysql_version.h>
+#include <ndb_version.h>
#include "CPCD.hpp"
#include "APIService.hpp"
diff --git a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
index 30b3e88bd82..6301c95d1e4 100644
--- a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
+++ b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
@@ -6301,6 +6301,7 @@ Dbdict::createIndex_slavePrepare(Signal* signal, OpCreateIndexPtr opPtr)
void
Dbdict::createIndex_toCreateTable(Signal* signal, OpCreateIndexPtr opPtr)
{
+ Uint32 attrid_map[MAX_ATTRIBUTES_IN_INDEX];
Uint32 k;
jam();
const CreateIndxReq* const req = &opPtr.p->m_request;
@@ -6369,39 +6370,49 @@ Dbdict::createIndex_toCreateTable(Signal* signal, OpCreateIndexPtr opPtr)
// tree node size in words (make configurable later)
indexPtr.p->tupKeyLength = MAX_TTREE_NODE_SIZE;
}
- // hash index attributes must currently be in table order
- Uint32 prevAttrId = RNIL;
+
+ AttributeMask mask;
+ mask.clear();
for (k = 0; k < opPtr.p->m_attrList.sz; k++) {
jam();
- bool found = false;
- for (Uint32 tAttr = tablePtr.p->firstAttribute; tAttr != RNIL; ) {
- AttributeRecord* aRec = c_attributeRecordPool.getPtr(tAttr);
- tAttr = aRec->nextAttrInTable;
- if (aRec->attributeId != opPtr.p->m_attrList.id[k])
+ unsigned current_id= opPtr.p->m_attrList.id[k];
+ AttributeRecord* aRec= NULL;
+ Uint32 tAttr= tablePtr.p->firstAttribute;
+ for (; tAttr != RNIL; tAttr= aRec->nextAttrInTable)
+ {
+ aRec = c_attributeRecordPool.getPtr(tAttr);
+ if (aRec->attributeId != current_id)
continue;
jam();
- found = true;
- const Uint32 a = aRec->attributeDescriptor;
- if (indexPtr.p->isHashIndex()) {
- const Uint32 s1 = AttributeDescriptor::getSize(a);
- const Uint32 s2 = AttributeDescriptor::getArraySize(a);
- indexPtr.p->tupKeyLength += ((1 << s1) * s2 + 31) >> 5;
- }
+ break;
}
- if (! found) {
+ if (tAttr == RNIL) {
jam();
opPtr.p->m_errorCode = CreateIndxRef::BadRequestType;
opPtr.p->m_errorLine = __LINE__;
return;
}
- if (indexPtr.p->isHashIndex() &&
- k > 0 && prevAttrId >= opPtr.p->m_attrList.id[k]) {
+ if (mask.get(current_id))
+ {
jam();
- opPtr.p->m_errorCode = CreateIndxRef::InvalidAttributeOrder;
+ opPtr.p->m_errorCode = CreateIndxRef::DuplicateAttributes;
opPtr.p->m_errorLine = __LINE__;
return;
}
- prevAttrId = opPtr.p->m_attrList.id[k];
+ mask.set(current_id);
+
+ const Uint32 a = aRec->attributeDescriptor;
+ unsigned kk= k;
+ if (indexPtr.p->isHashIndex()) {
+ const Uint32 s1 = AttributeDescriptor::getSize(a);
+ const Uint32 s2 = AttributeDescriptor::getArraySize(a);
+ indexPtr.p->tupKeyLength += ((1 << s1) * s2 + 31) >> 5;
+ // reorder the attributes according to the tableid order
+ // for unque indexes
+ for (; kk > 0 && current_id < attrid_map[kk-1]>>16; kk--)
+ attrid_map[kk]= attrid_map[kk-1];
+ }
+ attrid_map[kk]= k | (current_id << 16);
}
indexPtr.p->noOfPrimkey = indexPtr.p->noOfAttributes;
// plus concatenated primary table key attribute
@@ -6421,12 +6432,17 @@ Dbdict::createIndex_toCreateTable(Signal* signal, OpCreateIndexPtr opPtr)
// write index key attributes
AttributeRecordPtr aRecPtr;
c_attributeRecordPool.getPtr(aRecPtr, tablePtr.p->firstAttribute);
- for (k = 0; k < opPtr.p->m_attrList.sz; k++) {
+ for (unsigned k = 0; k < opPtr.p->m_attrList.sz; k++) {
+ // insert the attributes in the order decided above in attrid_map
+ // k is new order, current_id is in previous order
+ // ToDo: make sure "current_id" is stored with the table and
+ // passed up to NdbDictionary
+ unsigned current_id= opPtr.p->m_attrList.id[attrid_map[k] & 0xffff];
jam();
for (Uint32 tAttr = tablePtr.p->firstAttribute; tAttr != RNIL; ) {
AttributeRecord* aRec = c_attributeRecordPool.getPtr(tAttr);
tAttr = aRec->nextAttrInTable;
- if (aRec->attributeId != opPtr.p->m_attrList.id[k])
+ if (aRec->attributeId != current_id)
continue;
jam();
const Uint32 a = aRec->attributeDescriptor;
diff --git a/ndb/src/kernel/vm/Configuration.cpp b/ndb/src/kernel/vm/Configuration.cpp
index 4ad7050ce63..f35a5859ff8 100644
--- a/ndb/src/kernel/vm/Configuration.cpp
+++ b/ndb/src/kernel/vm/Configuration.cpp
@@ -47,8 +47,7 @@ extern "C" {
extern EventLogger g_eventLogger;
enum ndbd_options {
- NDB_STD_OPTS_OPTIONS,
- OPT_INITIAL,
+ OPT_INITIAL = NDB_STD_OPTIONS_LAST,
OPT_NODAEMON
};
@@ -82,14 +81,10 @@ static void short_usage_sub(void)
{
printf("Usage: %s [OPTIONS]\n", my_progname);
}
-static void print_version()
-{
- printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
-}
static void usage()
{
short_usage_sub();
- print_version();
+ ndb_std_print_version();
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
@@ -97,18 +92,8 @@ static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
- switch (optid) {
- case '#':
- DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndbd.trace");
- break;
- case 'V':
- print_version();
- exit(0);
- case '?':
- usage();
- exit(0);
- }
- return 0;
+ return ndb_std_get_one_option(optid, opt,
+ argument ? argument : "d:t:O,/tmp/ndbd.trace");
}
bool
diff --git a/ndb/src/mgmclient/main.cpp b/ndb/src/mgmclient/main.cpp
index 9417c03805f..73f0bad86c0 100644
--- a/ndb/src/mgmclient/main.cpp
+++ b/ndb/src/mgmclient/main.cpp
@@ -56,9 +56,6 @@ handler(int sig){
}
}
-enum ndb_mgm_options {
- NDB_STD_OPTS_OPTIONS
-};
NDB_STD_OPTS_VARS;
static const char default_prompt[]= "ndb_mgm> ";
@@ -83,14 +80,10 @@ static void short_usage_sub(void)
{
printf("Usage: %s [OPTIONS] [hostname [port]]\n", my_progname);
}
-static void print_version()
-{
- printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
-}
static void usage()
{
short_usage_sub();
- print_version();
+ ndb_std_print_version();
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
@@ -98,18 +91,8 @@ static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
- switch (optid) {
- case '#':
- DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_mgm.trace");
- break;
- case 'V':
- print_version();
- exit(0);
- case '?':
- usage();
- exit(0);
- }
- return 0;
+ return ndb_std_get_one_option(optid, opt, argument ? argument :
+ "d:t:O,/tmp/ndb_mgm.trace");
}
static int
diff --git a/ndb/src/mgmsrv/ConfigInfo.cpp b/ndb/src/mgmsrv/ConfigInfo.cpp
index ed49a551b09..a9c53f606e2 100644
--- a/ndb/src/mgmsrv/ConfigInfo.cpp
+++ b/ndb/src/mgmsrv/ConfigInfo.cpp
@@ -15,6 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <ndb_global.h>
+#include <ndb_opt_defaults.h>
#include <NdbTCP.h>
#include "ConfigInfo.hpp"
@@ -1766,6 +1767,18 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
STR_VALUE(MAX_INT_RNIL) },
{
+ CFG_SHM_SIGNUM,
+ "Signum",
+ "SHM",
+ "Signum to be used for signalling",
+ ConfigInfo::CI_USED,
+ false,
+ ConfigInfo::CI_INT,
+ UNDEFINED,
+ "0",
+ STR_VALUE(MAX_INT_RNIL) },
+
+ {
CFG_CONNECTION_NODE_1,
"NodeId1",
"SHM",
@@ -3190,18 +3203,27 @@ bool
fixShmKey(InitConfigFileParser::Context & ctx, const char *)
{
DBUG_ENTER("fixShmKey");
- Uint32 id1= 0, id2= 0, key= 0;
- require(ctx.m_currentSection->get("NodeId1", &id1));
- require(ctx.m_currentSection->get("NodeId2", &id2));
- if(ctx.m_currentSection->get("ShmKey", &key))
{
- DBUG_RETURN(true);
+ Uint32 signum;
+ if(!ctx.m_currentSection->get("Signum", &signum))
+ {
+ signum= OPT_NDB_SHM_SIGNUM_DEFAULT;
+ ctx.m_currentSection->put("Signum", signum);
+ DBUG_PRINT("info",("Added Signum=%u", signum));
+ }
+ }
+ {
+ Uint32 id1= 0, id2= 0, key= 0;
+ require(ctx.m_currentSection->get("NodeId1", &id1));
+ require(ctx.m_currentSection->get("NodeId2", &id2));
+ if(!ctx.m_currentSection->get("ShmKey", &key))
+ {
+ require(ctx.m_userProperties.get("ShmUniqueId", &key));
+ key= key << 16 | (id1 > id2 ? id1 << 8 | id2 : id2 << 8 | id1);
+ ctx.m_currentSection->put("ShmKey", key);
+ DBUG_PRINT("info",("Added ShmKey=0x%x", key));
+ }
}
-
- require(ctx.m_userProperties.get("ShmUniqueId", &key));
- key= key << 16 | (id1 > id2 ? id1 << 8 | id2 : id2 << 8 | id1);
- ctx.m_currentSection->put("ShmKey", key);
- DBUG_PRINT("info",("Added ShmKey=0x%x", key));
DBUG_RETURN(true);
}
diff --git a/ndb/src/mgmsrv/main.cpp b/ndb/src/mgmsrv/main.cpp
index 482bc2e89cc..67975f8539d 100644
--- a/ndb/src/mgmsrv/main.cpp
+++ b/ndb/src/mgmsrv/main.cpp
@@ -134,8 +134,7 @@ extern EventLogger g_eventLogger;
extern int global_mgmt_server_check;
enum ndb_mgmd_options {
- NDB_STD_OPTS_OPTIONS,
- OPT_INTERACTIVE,
+ OPT_INTERACTIVE = NDB_STD_OPTIONS_LAST,
OPT_NO_NODEID_CHECKS,
OPT_NO_DAEMON
};
@@ -169,14 +168,10 @@ static void short_usage_sub(void)
{
printf("Usage: %s [OPTIONS]\n", my_progname);
}
-static void print_version()
-{
- printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
-}
static void usage()
{
short_usage_sub();
- print_version();
+ ndb_std_print_version();
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
@@ -184,25 +179,8 @@ static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
- switch (optid) {
- case '#':
- DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_mgmd.trace");
- break;
- case 'V':
- print_version();
- exit(0);
- case OPT_NDB_SHM:
-#ifndef NDB_SHM_TRANSPORTER
- printf("Warning: binary not compiled with shared memory support,\n"
- "use configure option --with-ndb-shm to enable support.\n"
- "Tcp connections will now be used instead\n");
- opt_ndb_shm= 0;
-#endif
- break;
- case '?':
- usage();
- exit(0);
- }
+ ndb_std_get_one_option(optid, opt, argument ? argument :
+ "d:t:O,/tmp/ndb_mgmd.trace");
return 0;
}
diff --git a/ndb/src/ndbapi/NdbDictionary.cpp b/ndb/src/ndbapi/NdbDictionary.cpp
index 93a82e4bc83..346f5de9eb5 100644
--- a/ndb/src/ndbapi/NdbDictionary.cpp
+++ b/ndb/src/ndbapi/NdbDictionary.cpp
@@ -980,6 +980,12 @@ operator<<(NdbOut& out, const NdbDictionary::Column& col)
case NdbDictionary::Column::Time:
out << "Time";
break;
+ case NdbDictionary::Column::Year:
+ out << "Year";
+ break;
+ case NdbDictionary::Column::Timestamp:
+ out << "Timestamp";
+ break;
case NdbDictionary::Column::Undefined:
out << "Undefined";
break;
diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.cpp b/ndb/src/ndbapi/NdbDictionaryImpl.cpp
index 498c5716c73..a089a818fb5 100644
--- a/ndb/src/ndbapi/NdbDictionaryImpl.cpp
+++ b/ndb/src/ndbapi/NdbDictionaryImpl.cpp
@@ -144,6 +144,8 @@ NdbColumnImpl::init(Type t)
m_cs = default_cs;
break;
case Time:
+ case Year:
+ case Timestamp:
m_precision = 0;
m_scale = 0;
m_length = 1;
@@ -2148,26 +2150,6 @@ NdbDictInterface::createIndex(Ndb & ndb,
}
attributeList.id[i] = col->m_attrId;
}
- if (it == DictTabInfo::UniqueHashIndex) {
- // Sort index attributes according to primary table (using insertion sort)
- for(i = 1; i < attributeList.sz; i++) {
- unsigned int temp = attributeList.id[i];
- unsigned int j = i;
- while((j > 0) && (attributeList.id[j - 1] > temp)) {
- attributeList.id[j] = attributeList.id[j - 1];
- j--;
- }
- attributeList.id[j] = temp;
- }
- // Check for illegal duplicate attributes
- for(i = 0; i<attributeList.sz; i++) {
- if ((i != (attributeList.sz - 1)) &&
- (attributeList.id[i] == attributeList.id[i+1])) {
- m_error.code = 4258;
- return -1;
- }
- }
- }
LinearSectionPtr ptr[3];
ptr[0].p = (Uint32*)&attributeList;
ptr[0].sz = 1 + attributeList.sz;
diff --git a/ndb/src/ndbapi/NdbRecAttr.cpp b/ndb/src/ndbapi/NdbRecAttr.cpp
index 30ba5c112fa..85b08c0cfa4 100644
--- a/ndb/src/ndbapi/NdbRecAttr.cpp
+++ b/ndb/src/ndbapi/NdbRecAttr.cpp
@@ -178,10 +178,11 @@ NdbOut& operator<<(NdbOut& out, const NdbRecAttr &r)
return out;
}
- if (r.arraySize() > 1)
+ uint length = r.getColumn()->getLength();
+ if (length > 1)
out << "[";
- for (Uint32 j = 0; j < r.arraySize(); j++)
+ for (Uint32 j = 0; j < length; j++)
{
if (j > 0)
out << " ";
@@ -221,13 +222,13 @@ NdbOut& operator<<(NdbOut& out, const NdbRecAttr &r)
break;
case NdbDictionary::Column::Char:
ndbrecattr_print_string(out,"Char",r.aRef(),r.arraySize());
- j = r.arraySize();
+ j = length;
break;
case NdbDictionary::Column::Varchar:
{
unsigned len = *(const unsigned char*)r.aRef();
ndbrecattr_print_string(out,"Varchar", r.aRef()+1,len);
- j = r.arraySize();
+ j = length;
}
break;
case NdbDictionary::Column::Float:
@@ -236,6 +237,86 @@ NdbOut& operator<<(NdbOut& out, const NdbRecAttr &r)
case NdbDictionary::Column::Double:
out << r.double_value();
break;
+ // for dates cut-and-paste from field.cc
+ case NdbDictionary::Column::Datetime:
+ {
+ ulonglong tmp=r.u_64_value();
+ long part1,part2,part3;
+ part1=(long) (tmp/LL(1000000));
+ part2=(long) (tmp - (ulonglong) part1*LL(1000000));
+ char buf[40];
+ char* pos=(char*) buf+19;
+ *pos--=0;
+ *pos--= (char) ('0'+(char) (part2%10)); part2/=10;
+ *pos--= (char) ('0'+(char) (part2%10)); part3= (int) (part2 / 10);
+ *pos--= ':';
+ *pos--= (char) ('0'+(char) (part3%10)); part3/=10;
+ *pos--= (char) ('0'+(char) (part3%10)); part3/=10;
+ *pos--= ':';
+ *pos--= (char) ('0'+(char) (part3%10)); part3/=10;
+ *pos--= (char) ('0'+(char) part3);
+ *pos--= '/';
+ *pos--= (char) ('0'+(char) (part1%10)); part1/=10;
+ *pos--= (char) ('0'+(char) (part1%10)); part1/=10;
+ *pos--= '-';
+ *pos--= (char) ('0'+(char) (part1%10)); part1/=10;
+ *pos--= (char) ('0'+(char) (part1%10)); part3= (int) (part1/10);
+ *pos--= '-';
+ *pos--= (char) ('0'+(char) (part3%10)); part3/=10;
+ *pos--= (char) ('0'+(char) (part3%10)); part3/=10;
+ *pos--= (char) ('0'+(char) (part3%10)); part3/=10;
+ *pos=(char) ('0'+(char) part3);
+ out << buf;
+ }
+ break;
+ case NdbDictionary::Column::Date:
+ {
+ uint32 tmp=(uint32) uint3korr(r.aRef());
+ int part;
+ char buf[40];
+ char *pos=(char*) buf+10;
+ *pos--=0;
+ part=(int) (tmp & 31);
+ *pos--= (char) ('0'+part%10);
+ *pos--= (char) ('0'+part/10);
+ *pos--= '-';
+ part=(int) (tmp >> 5 & 15);
+ *pos--= (char) ('0'+part%10);
+ *pos--= (char) ('0'+part/10);
+ *pos--= '-';
+ part=(int) (tmp >> 9);
+ *pos--= (char) ('0'+part%10); part/=10;
+ *pos--= (char) ('0'+part%10); part/=10;
+ *pos--= (char) ('0'+part%10); part/=10;
+ *pos= (char) ('0'+part);
+ out << buf;
+ }
+ break;
+ case NdbDictionary::Column::Time:
+ {
+ long tmp=(long) sint3korr(r.aRef());
+ int hour=(uint) (tmp/10000);
+ int minute=(uint) (tmp/100 % 100);
+ int second=(uint) (tmp % 100);
+ char buf[40];
+ sprintf(buf, "%02d:%02d:%02d", hour, minute, second);
+ out << buf;
+ }
+ break;
+ case NdbDictionary::Column::Year:
+ {
+ uint year = 1900 + r.u_char_value();
+ char buf[40];
+ sprintf(buf, "%04d", year);
+ out << buf;
+ }
+ break;
+ case NdbDictionary::Column::Timestamp:
+ {
+ time_t time = r.u_32_value();
+ out << (uint)time;
+ }
+ break;
case NdbDictionary::Column::Blob:
{
const NdbBlob::Head* h = (const NdbBlob::Head*)r.aRef();
@@ -244,7 +325,7 @@ NdbOut& operator<<(NdbOut& out, const NdbRecAttr &r)
unsigned n = r.arraySize() - sizeof(*h);
for (unsigned k = 0; k < n && k < h->length; k++)
out.print("%02X", (int)p[k]);
- j = r.arraySize();
+ j = length;
}
break;
case NdbDictionary::Column::Text:
@@ -255,26 +336,26 @@ NdbOut& operator<<(NdbOut& out, const NdbRecAttr &r)
unsigned n = r.arraySize() - sizeof(*h);
for (unsigned k = 0; k < n && k < h->length; k++)
out.print("%c", (int)p[k]);
- j = r.arraySize();
+ j = length;
}
break;
case NdbDictionary::Column::Longvarchar:
{
unsigned len = uint2korr(r.aRef());
ndbrecattr_print_string(out,"Longvarchar", r.aRef()+2,len);
- j = r.arraySize();
+ j = length;
}
break;
default: /* no print functions for the rest, just print type */
out << (int) r.getType();
- j = r.arraySize();
+ j = length;
if (j > 1)
out << " " << j << " times";
break;
}
}
- if (r.arraySize() > 1)
+ if (length > 1)
{
out << "]";
}
diff --git a/ndb/test/include/NdbSchemaOp.hpp b/ndb/test/include/NdbSchemaOp.hpp
index e2fb4015b88..77e704c0e5c 100644
--- a/ndb/test/include/NdbSchemaOp.hpp
+++ b/ndb/test/include/NdbSchemaOp.hpp
@@ -575,10 +575,6 @@ convertColumnTypeToAttrType(NdbDictionary::Column::Type _type)
case NdbDictionary::Column::Binary:
case NdbDictionary::Column::Varbinary:
return String;
- case NdbDictionary::Column::Datetime:
- case NdbDictionary::Column::Date:
- case NdbDictionary::Column::Time:
- case NdbDictionary::Column::Undefined:
default:
return NoAttrTypeDef;
}
diff --git a/ndb/test/run-test/Makefile.am b/ndb/test/run-test/Makefile.am
index 83dcb3dbbcf..a0033d7e838 100644
--- a/ndb/test/run-test/Makefile.am
+++ b/ndb/test/run-test/Makefile.am
@@ -6,7 +6,7 @@ include $(top_srcdir)/ndb/config/type_util.mk.am
include $(top_srcdir)/ndb/config/type_mgmapiclient.mk.am
test_PROGRAMS = atrt
-test_DATA=daily-basic-tests.txt daily-devel-tests.txt
+test_DATA=daily-basic-tests.txt daily-devel-tests.txt 16node-tests.txt
test_SCRIPTS=atrt-analyze-result.sh atrt-gather-result.sh atrt-setup.sh \
atrt-clear-result.sh make-config.sh make-index.sh make-html-reports.sh
diff --git a/ndb/tools/delete_all.cpp b/ndb/tools/delete_all.cpp
index 38a9cdd9354..4a153208c65 100644
--- a/ndb/tools/delete_all.cpp
+++ b/ndb/tools/delete_all.cpp
@@ -24,9 +24,6 @@
static int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, int parallelism=240);
-enum ndb_delete_all {
- NDB_STD_OPTS_OPTIONS
-};
NDB_STD_OPTS_VARS;
static const char* _dbname = "TEST_DB";
@@ -38,16 +35,12 @@ static struct my_option my_long_options[] =
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
-static void print_version()
-{
- printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
-}
static void usage()
{
char desc[] =
"tabname\n"\
"This program will delete all records in the specified table using scan delete.\n";
- print_version();
+ ndb_std_print_version();
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
@@ -55,18 +48,8 @@ static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
- switch (optid) {
- case '#':
- DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_delete_all.trace");
- break;
- case 'V':
- print_version();
- exit(0);
- case '?':
- usage();
- exit(0);
- }
- return 0;
+ return ndb_std_get_one_option(optid, opt, argument ? argument :
+ "d:t:O,/tmp/ndb_delete_all.trace");
}
int main(int argc, char** argv){
diff --git a/ndb/tools/desc.cpp b/ndb/tools/desc.cpp
index b18f97a05b1..3bfa332ea79 100644
--- a/ndb/tools/desc.cpp
+++ b/ndb/tools/desc.cpp
@@ -19,9 +19,6 @@
#include <NDBT.hpp>
#include <NdbApi.hpp>
-enum ndb_desc_options {
- NDB_STD_OPTS_OPTIONS
-};
NDB_STD_OPTS_VARS;
static const char* _dbname = "TEST_DB";
@@ -37,17 +34,13 @@ static struct my_option my_long_options[] =
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
-static void print_version()
-{
- printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
-}
static void usage()
{
char desc[] =
"tabname\n"\
"This program list all properties of table(s) in NDB Cluster.\n"\
- " ex: desc T1 T2 T4\n";
- print_version();
+ " ex: desc T1 T2 T4\n";
+ ndb_std_print_version();
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
@@ -55,18 +48,8 @@ static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
- switch (optid) {
- case '#':
- DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_desc.trace");
- break;
- case 'V':
- print_version();
- exit(0);
- case '?':
- usage();
- exit(0);
- }
- return 0;
+ return ndb_std_get_one_option(optid, opt, argument ? argument :
+ "d:t:O,/tmp/ndb_desc.trace");
}
int main(int argc, char** argv){
diff --git a/ndb/tools/drop_index.cpp b/ndb/tools/drop_index.cpp
index 47baee0b66f..90528a2a5a4 100644
--- a/ndb/tools/drop_index.cpp
+++ b/ndb/tools/drop_index.cpp
@@ -21,9 +21,6 @@
#include <NdbApi.hpp>
#include <NDBT.hpp>
-enum ndb_drop_index_options {
- NDB_STD_OPTS_OPTIONS
-};
NDB_STD_OPTS_VARS;
static const char* _dbname = "TEST_DB";
@@ -35,16 +32,12 @@ static struct my_option my_long_options[] =
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
-static void print_version()
-{
- printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
-}
static void usage()
{
char desc[] =
"<indexname>+\n"\
"This program will drop index(es) in Ndb\n";
- print_version();
+ ndb_std_print_version();
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
@@ -52,18 +45,8 @@ static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
- switch (optid) {
- case '#':
- DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_drop_index.trace");
- break;
- case 'V':
- print_version();
- exit(0);
- case '?':
- usage();
- exit(0);
- }
- return 0;
+ return ndb_std_get_one_option(optid, opt, argument ? argument :
+ "d:t:O,/tmp/ndb_drop_index.trace");
}
int main(int argc, char** argv){
diff --git a/ndb/tools/drop_tab.cpp b/ndb/tools/drop_tab.cpp
index 6d128321994..a0a5262bace 100644
--- a/ndb/tools/drop_tab.cpp
+++ b/ndb/tools/drop_tab.cpp
@@ -21,9 +21,6 @@
#include <NdbApi.hpp>
#include <NDBT.hpp>
-enum ndb_drop_table_options {
- NDB_STD_OPTS_OPTIONS
-};
NDB_STD_OPTS_VARS;
static const char* _dbname = "TEST_DB";
@@ -35,16 +32,12 @@ static struct my_option my_long_options[] =
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
-static void print_version()
-{
- printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
-}
static void usage()
{
char desc[] =
"tabname\n"\
"This program will drop one table in Ndb\n";
- print_version();
+ ndb_std_print_version();
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
@@ -52,18 +45,8 @@ static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
- switch (optid) {
- case '#':
- DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_drop_table.trace");
- break;
- case 'V':
- print_version();
- exit(0);
- case '?':
- usage();
- exit(0);
- }
- return 0;
+ return ndb_std_get_one_option(optid, opt, argument ? argument :
+ "d:t:O,/tmp/ndb_drop_table.trace");
}
int main(int argc, char** argv){
diff --git a/ndb/tools/listTables.cpp b/ndb/tools/listTables.cpp
index e018bd6d9a5..a49fbde596e 100644
--- a/ndb/tools/listTables.cpp
+++ b/ndb/tools/listTables.cpp
@@ -161,9 +161,6 @@ list(const char * tabname,
}
}
-enum ndb_show_tables_options {
- NDB_STD_OPTS_OPTIONS
-};
NDB_STD_OPTS_VARS;
static const char* _dbname = "TEST_DB";
@@ -186,20 +183,16 @@ static struct my_option my_long_options[] =
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
-static void print_version()
-{
- printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
-}
static void usage()
{
char desc[] =
"tabname\n"\
"This program list all system objects in NDB Cluster.\n"\
"Type of objects to display can be limited with -t option\n"\
- " ex: list_tables -t 2 would show all UserTables\n"\
+ " ex: ndb_show_tables -t 2 would show all UserTables\n"\
"To show all indexes for a table write table name as final argument\n"\
- " ex: list_tables T1\n";
- print_version();
+ " ex: ndb_show_tables T1\n";
+ ndb_std_print_version();
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
@@ -207,18 +200,8 @@ static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
- switch (optid) {
- case '#':
- DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_show_tables.trace");
- break;
- case 'V':
- print_version();
- exit(0);
- case '?':
- usage();
- exit(0);
- }
- return 0;
+ return ndb_std_get_one_option(optid, opt, argument ? argument :
+ "d:t:O,/tmp/ndb_show_tables.trace");
}
int main(int argc, char** argv){
diff --git a/ndb/tools/restore/restore_main.cpp b/ndb/tools/restore/restore_main.cpp
index 528a9634658..326020d7118 100644
--- a/ndb/tools/restore/restore_main.cpp
+++ b/ndb/tools/restore/restore_main.cpp
@@ -36,9 +36,6 @@ static Vector<class BackupConsumer *> g_consumers;
static const char* ga_backupPath = "." DIR_SEPARATOR;
-enum ndb_restore_options {
- NDB_STD_OPTS_OPTIONS
-};
NDB_STD_OPTS_VARS;
/**
@@ -101,14 +98,10 @@ static void short_usage_sub(void)
{
printf("Usage: %s [OPTIONS] [<path to backup files>]\n", my_progname);
}
-static void print_version()
-{
- printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
-}
static void usage()
{
short_usage_sub();
- print_version();
+ ndb_std_print_version();
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
@@ -116,13 +109,9 @@ static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
+ ndb_std_get_one_option(optid, opt, argument ? argument :
+ "d:t:O,/tmp/ndb_restore.trace");
switch (optid) {
- case '#':
- DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_restore.trace");
- break;
- case 'V':
- print_version();
- exit(0);
case 'n':
if (ga_nodeId == 0)
{
@@ -137,9 +126,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
exit(1);
}
break;
- case '?':
- usage();
- exit(0);
}
return 0;
}
diff --git a/ndb/tools/select_all.cpp b/ndb/tools/select_all.cpp
index ecb7db91060..a3d07e3938b 100644
--- a/ndb/tools/select_all.cpp
+++ b/ndb/tools/select_all.cpp
@@ -36,9 +36,6 @@ int scanReadRecords(Ndb*,
bool orderby,
bool descending);
-enum ndb_select_all_options {
- NDB_STD_OPTS_OPTIONS
-};
NDB_STD_OPTS_VARS;
static const char* _dbname = "TEST_DB";
@@ -75,10 +72,6 @@ static struct my_option my_long_options[] =
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
-static void print_version()
-{
- printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
-}
static void usage()
{
char desc[] =
@@ -88,7 +81,7 @@ static void usage()
"(It only print error messages if it encounters a permanent error.)\n"\
"It can also be used to dump the content of a table to file \n"\
" ex: select_all --no-header --delimiter=';' T4 > T4.data\n";
- print_version();
+ ndb_std_print_version();
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
@@ -96,18 +89,8 @@ static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
- switch (optid) {
- case '#':
- DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_select_all.trace");
- break;
- case 'V':
- print_version();
- exit(0);
- case '?':
- usage();
- exit(0);
- }
- return 0;
+ return ndb_std_get_one_option(optid, opt, argument ? argument :
+ "d:t:O,/tmp/ndb_select_all.trace");
}
int main(int argc, char** argv){
diff --git a/ndb/tools/select_count.cpp b/ndb/tools/select_count.cpp
index f2b78de4b37..41e66c8b367 100644
--- a/ndb/tools/select_count.cpp
+++ b/ndb/tools/select_count.cpp
@@ -32,9 +32,6 @@ select_count(Ndb* pNdb, const NdbDictionary::Table* pTab,
int* count_rows,
NdbOperation::LockMode lock);
-enum ndb_select_count_options {
- NDB_STD_OPTS_OPTIONS
-};
NDB_STD_OPTS_VARS;
static const char* _dbname = "TEST_DB";
@@ -54,16 +51,12 @@ static struct my_option my_long_options[] =
GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
-static void print_version()
-{
- printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
-}
static void usage()
{
char desc[] =
"tabname1 ... tabnameN\n"\
"This program will count the number of records in tables\n";
- print_version();
+ ndb_std_print_version();
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
@@ -71,18 +64,8 @@ static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
- switch (optid) {
- case '#':
- DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_select_count.trace");
- break;
- case 'V':
- print_version();
- exit(0);
- case '?':
- usage();
- exit(0);
- }
- return 0;
+ return ndb_std_get_one_option(optid, opt, argument ? argument :
+ "d:t:O,/tmp/ndb_select_count.trace");
}
int main(int argc, char** argv){
diff --git a/ndb/tools/waiter.cpp b/ndb/tools/waiter.cpp
index dfdb11524e3..cc6a21428c8 100644
--- a/ndb/tools/waiter.cpp
+++ b/ndb/tools/waiter.cpp
@@ -31,8 +31,7 @@ waitClusterStatus(const char* _addr, ndb_mgm_node_status _status,
unsigned int _timeout);
enum ndb_waiter_options {
- NDB_STD_OPTS_OPTIONS,
- OPT_WAIT_STATUS_NOT_STARTED
+ OPT_WAIT_STATUS_NOT_STARTED = NDB_STD_OPTIONS_LAST
};
NDB_STD_OPTS_VARS;
@@ -53,32 +52,20 @@ static struct my_option my_long_options[] =
GET_INT, REQUIRED_ARG, 120, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
-static void print_version()
-{
- printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
-}
+
static void usage()
{
- print_version();
+ ndb_std_print_version();
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
+
static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
- switch (optid) {
- case '#':
- DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_drop_table.trace");
- break;
- case 'V':
- print_version();
- exit(0);
- case '?':
- usage();
- exit(0);
- }
- return 0;
+ return ndb_std_get_one_option(optid, opt, argument ? argument :
+ "d:t:O,/tmp/ndb_drop_table.trace");
}
int main(int argc, char** argv){
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 71b70fc0e4a..221fab13635 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -90,7 +90,7 @@ CLEANFILES = @server_scripts@ \
fill_help_tables \
mysql_create_system_tables
-SUPERCLEANFILES = mysqlbug
+DISTCLEANFILES = mysqlbug
# We want the right version and configure comand line in mysqlbug
mysqlbug: ${top_builddir}/config.status mysqlbug.sh
diff --git a/server-tools/instance-manager/Makefile.am b/server-tools/instance-manager/Makefile.am
index c2bf501eca7..c9c9009a8ec 100644
--- a/server-tools/instance-manager/Makefile.am
+++ b/server-tools/instance-manager/Makefile.am
@@ -14,7 +14,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-INCLUDES= -I$(top_srcdir)/include -I$(top_srcdir)/extra
+INCLUDES= -I$(top_srcdir)/include -I$(top_builddir)/include
DEFS= -DMYSQL_INSTANCE_MANAGER -DMYSQL_SERVER
diff --git a/sql/Makefile.am b/sql/Makefile.am
index 8ff55898ba4..3c520ac971c 100644
--- a/sql/Makefile.am
+++ b/sql/Makefile.am
@@ -22,7 +22,7 @@ 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_srcdir)/extra
+ -I$(srcdir) $(openssl_includes) -I$(top_builddir)/include
WRAPLIBS= @WRAPLIBS@
SUBDIRS = share
libexec_PROGRAMS = mysqld
@@ -115,6 +115,7 @@ DEFS = -DMYSQL_SERVER \
# Don't put lex_hash.h in BUILT_SOURCES as this will give infinite recursion
BUILT_SOURCES = sql_yacc.cc sql_yacc.h
EXTRA_DIST = udf_example.cc $(BUILT_SOURCES)
+DISTCLEANFILES = lex_hash.h
AM_YFLAGS = -d
mysql_tzinfo_to_sql.cc:
@@ -160,8 +161,5 @@ sql_lex.o: lex_hash.h
udf_example.so: udf_example.cc
$(CXXCOMPILE) -shared -o $@ $<
-distclean:
- rm -f lex_hash.h
-
# Don't update the files from bitkeeper
%::SCCS/s.%
diff --git a/sql/examples/ha_archive.cc b/sql/examples/ha_archive.cc
index dccff88bf1f..436c72702a0 100644
--- a/sql/examples/ha_archive.cc
+++ b/sql/examples/ha_archive.cc
@@ -117,7 +117,6 @@
/* Variables for archive share methods */
pthread_mutex_t archive_mutex;
static HASH archive_open_tables;
-static int archive_init= 0;
/* The file extension */
#define ARZ ".ARZ" // The data file
@@ -143,6 +142,46 @@ static byte* archive_get_key(ARCHIVE_SHARE *share,uint *length,
return (byte*) share->table_name;
}
+
+/*
+ Initialize the archive handler.
+
+ SYNOPSIS
+ archive_db_init()
+ void
+
+ RETURN
+ FALSE OK
+ TRUE Error
+*/
+
+bool archive_db_init()
+{
+ VOID(pthread_mutex_init(&archive_mutex, MY_MUTEX_INIT_FAST));
+ return (hash_init(&archive_open_tables, system_charset_info, 32, 0, 0,
+ (hash_get_key) archive_get_key, 0, 0));
+}
+
+
+/*
+ Release the archive handler.
+
+ SYNOPSIS
+ archive_db_end()
+ void
+
+ RETURN
+ FALSE OK
+*/
+
+bool archive_db_end()
+{
+ hash_free(&archive_open_tables);
+ VOID(pthread_mutex_destroy(&archive_mutex));
+ return FALSE;
+}
+
+
/*
This method reads the header of a datafile and returns whether or not it was successful.
*/
@@ -269,23 +308,6 @@ ARCHIVE_SHARE *ha_archive::get_share(const char *table_name, TABLE *table)
uint length;
char *tmp_name;
- if (!archive_init)
- {
- /* Hijack a mutex for init'ing the storage engine */
- pthread_mutex_lock(&LOCK_mysql_create_db);
- if (!archive_init)
- {
- VOID(pthread_mutex_init(&archive_mutex,MY_MUTEX_INIT_FAST));
- if (hash_init(&archive_open_tables,system_charset_info,32,0,0,
- (hash_get_key) archive_get_key,0,0))
- {
- pthread_mutex_unlock(&LOCK_mysql_create_db);
- return NULL;
- }
- archive_init++;
- }
- pthread_mutex_unlock(&LOCK_mysql_create_db);
- }
pthread_mutex_lock(&archive_mutex);
length=(uint) strlen(table_name);
@@ -371,6 +393,7 @@ int ha_archive::free_share(ARCHIVE_SHARE *share)
(void)write_meta_file(share->meta_file, share->rows_recorded, FALSE);
if (gzclose(share->archive_write) == Z_ERRNO)
rc= 1;
+ my_close(share->meta_file,MYF(0));
my_free((gptr) share, MYF(0));
}
pthread_mutex_unlock(&archive_mutex);
@@ -787,6 +810,7 @@ int ha_archive::repair(THD* thd, HA_CHECK_OPT* check_opt)
goto error;
}
(void)write_meta_file(meta_file, rows_recorded, TRUE);
+ my_close(meta_file,MYF(0));
rc= 0;
}
diff --git a/sql/examples/ha_archive.h b/sql/examples/ha_archive.h
index 07bc7baa400..a511b5c67d6 100644
--- a/sql/examples/ha_archive.h
+++ b/sql/examples/ha_archive.h
@@ -105,3 +105,7 @@ public:
THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to,
enum thr_lock_type lock_type);
};
+
+bool archive_db_init(void);
+bool archive_db_end(void);
+
diff --git a/sql/field.cc b/sql/field.cc
index 7d0e69681c0..aa2c5805bfe 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -524,6 +524,115 @@ Field *Field::new_key_field(MEM_ROOT *root, struct st_table *new_table,
return tmp;
}
+/*
+ SYNOPSIS
+ Field::quote_data()
+ unquoted_string Pointer pointing to the value of a field
+
+ DESCRIPTION
+ Simple method that passes the field type to the method "type_quote"
+ To get a true/false value as to whether the value in string1 needs
+ to be enclosed with quotes. This ensures that values in the final
+ sql statement to be passed to the remote server will be quoted properly
+
+ RETURN_VALUE
+ void Immediately - if string doesn't need quote
+ void Upon prepending/appending quotes on each side of variable
+
+*/
+bool Field::quote_data(String *unquoted_string)
+{
+ char escaped_string[IO_SIZE];
+ char *unquoted_string_buffer= (char *)(unquoted_string->ptr());
+ uint need_quotes;
+
+ DBUG_ENTER("Field::quote_data");
+ // this is the same call that mysql_real_escape_string() calls
+ escape_string_for_mysql(&my_charset_bin, (char *)escaped_string,
+ unquoted_string->ptr(), unquoted_string->length());
+
+
+ if (is_null())
+ DBUG_RETURN(0);
+
+ need_quotes= needs_quotes();
+
+ if (need_quotes == 0)
+ {
+ DBUG_RETURN(0);
+ }
+ else
+ {
+ // reset string, then re-append with quotes and escaped values
+ unquoted_string->length(0);
+ if (unquoted_string->append("'"))
+ DBUG_RETURN(1);
+ if (unquoted_string->append((char *)escaped_string))
+ DBUG_RETURN(1);
+ if (unquoted_string->append("'"))
+ DBUG_RETURN(1);
+ }
+ //DBUG_PRINT("Field::quote_data",
+ // ("FINAL quote_flag %d unquoted_string %s escaped_string %s",
+ //needs_quotes, unquoted_string->c_ptr_quick(), escaped_string));
+ DBUG_RETURN(0);
+}
+
+/*
+ Quote a field type if needed
+
+ SYNOPSIS
+ Field::type_quote
+
+ DESCRIPTION
+ Simple method to give true/false whether a field should be quoted.
+ Used when constructing INSERT and UPDATE queries to the remote server
+ see write_row and update_row
+
+ RETURN VALUE
+ 0 if value is of type NOT needing quotes
+ 1 if value is of type needing quotes
+*/
+bool Field::needs_quotes(void)
+{
+ DBUG_ENTER("Field::type_quote");
+
+ switch(type()) {
+ //FIX this when kernel is fixed
+ case MYSQL_TYPE_VARCHAR :
+ case FIELD_TYPE_STRING :
+ case FIELD_TYPE_VAR_STRING :
+ case FIELD_TYPE_YEAR :
+ case FIELD_TYPE_NEWDATE :
+ case FIELD_TYPE_TIME :
+ case FIELD_TYPE_TIMESTAMP :
+ case FIELD_TYPE_DATE :
+ case FIELD_TYPE_DATETIME :
+ case FIELD_TYPE_TINY_BLOB :
+ case FIELD_TYPE_BLOB :
+ case FIELD_TYPE_MEDIUM_BLOB :
+ case FIELD_TYPE_LONG_BLOB :
+ case FIELD_TYPE_GEOMETRY :
+ DBUG_RETURN(1);
+
+ case FIELD_TYPE_DECIMAL :
+ case FIELD_TYPE_TINY :
+ case FIELD_TYPE_SHORT :
+ case FIELD_TYPE_INT24 :
+ case FIELD_TYPE_LONG :
+ case FIELD_TYPE_FLOAT :
+ case FIELD_TYPE_DOUBLE :
+ case FIELD_TYPE_LONGLONG :
+ case FIELD_TYPE_NULL :
+ case FIELD_TYPE_SET :
+ case FIELD_TYPE_ENUM :
+ DBUG_RETURN(0);
+
+ default: DBUG_RETURN(0);
+ }
+ DBUG_RETURN(0);
+
+}
/****************************************************************************
Field_null, a field that always return NULL
diff --git a/sql/field.h b/sql/field.h
index fd1ef09d14f..af300c8d471 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -228,6 +228,8 @@ public:
ptr= old_ptr;
return str;
}
+ bool quote_data(String *unquoted_string);
+ bool needs_quotes(void);
virtual bool send_binary(Protocol *protocol);
virtual char *pack(char* to, const char *from, uint max_length=~(uint) 0)
{
@@ -1228,7 +1230,7 @@ public:
int cmp(const char *a, const char *b)
{ return cmp_binary(a, b); }
int key_cmp(const byte *a, const byte *b)
- { return cmp_binary(a, b); }
+ { return cmp_binary((char *) a, (char *) b); }
int key_cmp(const byte *str, uint length);
int cmp_offset(uint row_offset);
void get_key_image(char *buff, uint length, imagetype type);
diff --git a/sql/filesort.cc b/sql/filesort.cc
index 21f75fa5ea0..c4dbb82d8a5 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -1184,7 +1184,7 @@ sortlength(SORT_FIELD *sortorder, uint s_length, bool *multi_byte_charset)
{
sortorder->need_strxnfrm= 1;
*multi_byte_charset= 1;
- sortorder->length= sortorder->length*cs->strxfrm_multiply;
+ sortorder->length= cs->coll->strnxfrmlen(cs, sortorder->length);
}
}
if (sortorder->field->maybe_null())
@@ -1197,7 +1197,7 @@ sortlength(SORT_FIELD *sortorder, uint s_length, bool *multi_byte_charset)
sortorder->length=sortorder->item->max_length;
if (use_strnxfrm((cs=sortorder->item->collation.collation)))
{
- sortorder->length= sortorder->length*cs->strxfrm_multiply;
+ sortorder->length= cs->coll->strnxfrmlen(cs, sortorder->length);
sortorder->need_strxnfrm= 1;
*multi_byte_charset= 1;
}
diff --git a/sql/ha_federated.cc b/sql/ha_federated.cc
index ea8633febe6..5185e0bbe9a 100644
--- a/sql/ha_federated.cc
+++ b/sql/ha_federated.cc
@@ -123,8 +123,8 @@
ha_federated::write_row
<for every field/column>
- ha_federated::quote_data
- ha_federated::quote_data
+ Field::quote_data
+ Field::quote_data
</for every field/column>
ha_federated::reset
@@ -136,18 +136,18 @@
ha_federated::index_init
ha_federated::index_read
ha_federated::index_read_idx
- ha_federated::quote_data
+ Field::quote_data
ha_federated::rnd_next
ha_federated::convert_row_to_internal_format
ha_federated::update_row
<quote 3 cols, new and old data>
- <ha_federated::quote_data
- <ha_federated::quote_data
- <ha_federated::quote_data
- <ha_federated::quote_data
- <ha_federated::quote_data
- <ha_federated::quote_data
+ Field::quote_data
+ Field::quote_data
+ Field::quote_data
+ Field::quote_data
+ Field::quote_data
+ Field::quote_data
</quote 3 cols, new and old data>
ha_federated::extra
@@ -415,7 +415,7 @@ static int parse_url(FEDERATED_SHARE *share, TABLE *table, uint table_create_fla
share->scheme= my_strdup(table->s->comment, MYF(0));
- if (share->username= strstr(share->scheme, "://"))
+ if ((share->username= strstr(share->scheme, "://")))
{
share->scheme[share->username - share->scheme] = '\0';
if (strcmp(share->scheme, "mysql") != 0)
@@ -429,18 +429,18 @@ static int parse_url(FEDERATED_SHARE *share, TABLE *table, uint table_create_fla
}
share->username+= 3;
- if (share->hostname= strchr(share->username, '@'))
+ if ((share->hostname= strchr(share->username, '@')))
{
share->username[share->hostname - share->username]= '\0';
share->hostname++;
- if (share->password= strchr(share->username, ':'))
+ if ((share->password= strchr(share->username, ':')))
{
share->username[share->password - share->username]= '\0';
share->password++;
share->username= share->username;
// make sure there isn't an extra / or @
- if (strchr(share->password, '/') || strchr(share->hostname, '@'))
+ if ((strchr(share->password, '/') || strchr(share->hostname, '@')))
{
DBUG_PRINT("ha_federated::parse_url",
("this connection string is not in the correct format!!!\n"));
@@ -453,14 +453,14 @@ static int parse_url(FEDERATED_SHARE *share, TABLE *table, uint table_create_fla
user:@hostname:port/database/table
Then password is a null string, so set to NULL
*/
- if (share->password[0] == '\0')
+ if ((share->password[0] == '\0'))
share->password= NULL;
}
else
share->username= share->username;
// make sure there isn't an extra / or @
- if (strchr(share->username, '/') || strchr(share->hostname, '@'))
+ if ((strchr(share->username, '/')) || (strchr(share->hostname, '@')))
{
DBUG_PRINT("ha_federated::parse_url",
("this connection string is not in the correct format!!!\n"));
@@ -469,12 +469,12 @@ Then password is a null string, so set to NULL
DBUG_RETURN(-1);
}
- if (share->database= strchr(share->hostname, '/'))
+ if ((share->database= strchr(share->hostname, '/')))
{
share->hostname[share->database - share->hostname]= '\0';
share->database++;
- if (share->sport= strchr(share->hostname, ':'))
+ if ((share->sport= strchr(share->hostname, ':')))
{
share->hostname[share->sport - share->hostname]= '\0';
share->sport++;
@@ -484,7 +484,7 @@ Then password is a null string, so set to NULL
share->port= atoi(share->sport);
}
- if (share->table_base_name= strchr(share->database, '/'))
+ if ((share->table_base_name= strchr(share->database, '/')))
{
share->database[share->table_base_name - share->database]= '\0';
share->table_base_name++;
@@ -507,7 +507,7 @@ Then password is a null string, so set to NULL
DBUG_RETURN(-1);
}
// make sure there's not an extra /
- if (strchr(share->table_base_name, '/'))
+ if ((strchr(share->table_base_name, '/')))
{
DBUG_PRINT("ha_federated::parse_url",
("this connection string is not in the correct format!!!\n"));
@@ -586,126 +586,117 @@ uint ha_federated::convert_row_to_internal_format(byte *record, MYSQL_ROW row)
DBUG_RETURN(0);
}
-/*
- SYNOPSIS
- quote_data()
- unquoted_string Pointer pointing to the value of a field
- field MySQL Field pointer to field being checked for type
-
- DESCRIPTION
- Simple method that passes the field type to the method "type_quote"
- To get a true/false value as to whether the value in string1 needs
- to be enclosed with quotes. This ensures that values in the final
- sql statement to be passed to the remote server will be quoted properly
-
- RETURN_VALUE
- void Immediately - if string doesn't need quote
- void Upon prepending/appending quotes on each side of variable
-
-*/
-void ha_federated::quote_data(String *unquoted_string, Field *field )
+bool ha_federated::create_where_from_key(
+ String *to,
+ KEY *key_info,
+ const byte *key,
+ uint key_length
+ )
{
- char escaped_string[IO_SIZE];
- char *unquoted_string_buffer;
-
- unquoted_string_buffer= unquoted_string->c_ptr_quick();
-
- int quote_flag;
- DBUG_ENTER("ha_federated::quote_data");
- // this is the same call that mysql_real_escape_string() calls
- escape_string_for_mysql(&my_charset_bin, (char *)escaped_string,
- unquoted_string->c_ptr_quick(), unquoted_string->length());
-
- DBUG_PRINT("ha_federated::quote_data",
- ("escape_string_for_mysql unescaped %s escaped %s",
- unquoted_string->c_ptr_quick(), escaped_string));
-
- if (field->is_null())
- {
- DBUG_PRINT("ha_federated::quote_data",
- ("NULL, no quoted needed for unquoted_string %s, returning.",
- unquoted_string->c_ptr_quick()));
- DBUG_VOID_RETURN;
- }
+ uint second_loop= 0;
+ KEY_PART_INFO *key_part;
+ bool needs_quotes;
- quote_flag= type_quote(field->type());
-
- if (quote_flag == 0)
- {
- DBUG_PRINT("ha_federated::quote_data",
- ("quote flag 0 no quoted needed for unquoted_string %s, returning.",
- unquoted_string->c_ptr_quick()));
- DBUG_VOID_RETURN;
- }
- else
+ DBUG_ENTER("ha_federated::create_where_from_key");
+ for (key_part= key_info->key_part ; (int) key_length > 0 ; key_part++)
{
- // reset string, then re-append with quotes and escaped values
- unquoted_string->length(0);
- unquoted_string->append("'");
- unquoted_string->append((char *)escaped_string);
- unquoted_string->append("'");
- }
- DBUG_PRINT("ha_federated::quote_data",
- ("FINAL quote_flag %d unquoted_string %s escaped_string %s",
- quote_flag, unquoted_string->c_ptr_quick(), escaped_string));
- DBUG_VOID_RETURN;
-}
-
-/*
- Quote a field type if needed
+ Field *field= key_part->field;
+ needs_quotes= field->needs_quotes();
+ //bool needs_quotes= type_quote(field->type());
+ DBUG_PRINT("ha_federated::create_where_from_key", ("key name %s type %d", field->field_name, field->type()));
+ uint length= key_part->length;
+
+ if (second_loop++ && to->append(" AND ",5))
+ DBUG_RETURN(1);
+ if (to->append('`') || to->append(field->field_name) ||
+ to->append("` ",2))
+ DBUG_RETURN(1); // Out of memory
+
+ if (key_part->null_bit)
+ {
+ if (*key++)
+ {
+ if (to->append("IS NULL",7))
+ DBUG_PRINT("ha_federated::create_where_from_key", ("NULL type %s", to->c_ptr_quick()));
+ DBUG_RETURN(1);
+ key_length-= key_part->store_length;
+ key+= key_part->store_length-1;
+ continue;
+ }
+ key_length--;
+ }
+ if (to->append("= "))
+ DBUG_RETURN(1);
+ if (needs_quotes && to->append("'"))
+ DBUG_RETURN(1);
+ if (key_part->type == HA_KEYTYPE_BIT)
+ {
+ /* This is can be threated as a hex string */
+ Field_bit *field= (Field_bit *) (key_part->field);
+ char buff[64+2], *ptr;
+ byte *end= (byte *)(key) + length;
+
+ buff[0]='0';
+ buff[1]='x';
+ for (ptr= buff+2 ; key < end ; key++)
+ {
+ uint tmp= (uint) (uchar) *key;
+ *ptr++=_dig_vec_upper[tmp >> 4];
+ *ptr++=_dig_vec_upper[tmp & 15];
+ }
+ if (to->append(buff, (uint) (ptr-buff)))
+ DBUG_RETURN(1);
- SYNOPSIS
- ha_federated::type_quote
- int field Enumerated field type number
+ DBUG_PRINT("ha_federated::create_where_from_key", ("bit type %s", to->c_ptr_quick()));
+ key_length-= length;
+ continue;
+ }
+ if (key_part->key_part_flag & HA_BLOB_PART)
+ {
+ uint blob_length= uint2korr(key);
+ key+= HA_KEY_BLOB_LENGTH;
+ key_length-= HA_KEY_BLOB_LENGTH;
+ if (append_escaped(to, (char *)(key), blob_length))
+ DBUG_RETURN(1);
+
+ DBUG_PRINT("ha_federated::create_where_from_key", ("blob type %s", to->c_ptr_quick()));
+ length= key_part->length;
+ }
+ else if (key_part->key_part_flag & HA_VAR_LENGTH_PART)
+ {
+ length= uint2korr(key);
+ key+= HA_KEY_BLOB_LENGTH;
+ if (append_escaped(to, (char *)(key), length))
+ DBUG_RETURN(1);
- DESCRIPTION
- Simple method to give true/false whether a field should be quoted.
- Used when constructing INSERT and UPDATE queries to the remote server
- see write_row and update_row
+ DBUG_PRINT("ha_federated::create_where_from_key", ("varchar type %s", to->c_ptr_quick()));
+ }
+ else
+ {
+ DBUG_PRINT("ha_federated::create_where_from_key", ("else block, unknown type so far"));
+ char buff[MAX_FIELD_WIDTH];
+ String str(buff, sizeof(buff), field->charset()), *res;
- RETURN VALUE
- 0 if value is of type NOT needing quotes
- 1 if value is of type needing quotes
-*/
-uint ha_federated::type_quote(int type)
-{
- DBUG_ENTER("ha_federated::type_quote");
- DBUG_PRINT("ha_federated::type_quote", ("field type %d", type));
-
- switch(type) {
- //FIX this is a bug, fix when kernel is fixed
- case MYSQL_TYPE_VARCHAR :
- case FIELD_TYPE_STRING :
- case FIELD_TYPE_VAR_STRING :
- case FIELD_TYPE_YEAR :
- case FIELD_TYPE_NEWDATE :
- case FIELD_TYPE_TIME :
- case FIELD_TYPE_TIMESTAMP :
- case FIELD_TYPE_DATE :
- case FIELD_TYPE_DATETIME :
- case FIELD_TYPE_TINY_BLOB :
- case FIELD_TYPE_BLOB :
- case FIELD_TYPE_MEDIUM_BLOB :
- case FIELD_TYPE_LONG_BLOB :
- case FIELD_TYPE_GEOMETRY :
- DBUG_RETURN(1);
+ res= field->val_str(&str, (char *)(key));
+ if (field->result_type() == STRING_RESULT)
+ {
+ if (append_escaped(to, (char *) res->ptr(), res->length()))
+ DBUG_RETURN(1);
+ res= field->val_str(&str, (char *)(key));
- case FIELD_TYPE_DECIMAL :
- case FIELD_TYPE_TINY :
- case FIELD_TYPE_SHORT :
- case FIELD_TYPE_INT24 :
- case FIELD_TYPE_LONG :
- case FIELD_TYPE_FLOAT :
- case FIELD_TYPE_DOUBLE :
- case FIELD_TYPE_LONGLONG :
- case FIELD_TYPE_NULL :
- case FIELD_TYPE_SET :
- case FIELD_TYPE_ENUM :
+ DBUG_PRINT("ha_federated::create_where_from_key", ("else block, string type", to->c_ptr_quick()));
+ }
+ else if (to->append(res->ptr(), res->length()))
+ DBUG_RETURN(1);
+ }
+ if (needs_quotes && to->append("'"))
+ DBUG_RETURN(1);
+ DBUG_PRINT("ha_federated::create_where_from_key", ("final value for 'to' %s", to->c_ptr_quick()));
+ key+= length;
+ key_length-= length;
DBUG_RETURN(0);
-
- default: DBUG_RETURN(0);
}
- DBUG_RETURN(0);
+ DBUG_RETURN(1);
}
int load_conn_info(FEDERATED_SHARE *share, TABLE *table)
@@ -975,7 +966,7 @@ int ha_federated::write_row(byte * buf)
int x= 0, num_fields= 0;
Field **field;
ulong current_query_id= 1;
- ulong tmp_query_id;
+ ulong tmp_query_id= 1;
int all_fields_have_same_query_id= 1;
char insert_buffer[IO_SIZE];
@@ -1060,7 +1051,8 @@ int ha_federated::write_row(byte * buf)
insert_string.append((*field)->field_name);
// quote these fields if they require it
- quote_data(&insert_field_value_string, *field);
+
+ (*field)->quote_data(&insert_field_value_string);
// append the value
values_string.append(insert_field_value_string);
insert_field_value_string.length(0);
@@ -1068,9 +1060,10 @@ int ha_federated::write_row(byte * buf)
// append commas between both fields and fieldnames
insert_string.append(',');
values_string.append(',');
- DBUG_PRINT("ha_federated::write_row",
- ("insert_string %s values_string %s insert_field_value_string %s",
- insert_string.c_ptr_quick(), values_string.c_ptr_quick(), insert_field_value_string.c_ptr_quick()));
+ DBUG_PRINT("ha_federated::write_row",
+ ("insert_string %s values_string %s insert_field_value_string %s",
+ insert_string.c_ptr_quick(), values_string.c_ptr_quick(),
+ insert_field_value_string.c_ptr_quick()));
}
}
@@ -1137,8 +1130,8 @@ int ha_federated::update_row(
byte * new_data
)
{
- uint x= 0;
- uint has_a_primary_key;
+ int x= 0;
+ uint has_a_primary_key= 0;
int primary_key_field_num;
char old_field_value_buffer[IO_SIZE], new_field_value_buffer[IO_SIZE];
char update_buffer[IO_SIZE], where_buffer[IO_SIZE];
@@ -1205,7 +1198,7 @@ int ha_federated::update_row(
{
// otherwise =
(*field)->val_str(&new_field_value);
- quote_data(&new_field_value, *field);
+ (*field)->quote_data(&new_field_value);
if ( has_a_primary_key )
{
@@ -1223,7 +1216,7 @@ int ha_federated::update_row(
{
(*field)->val_str(&old_field_value,
(char *)(old_data + (*field)->offset()));
- quote_data(&old_field_value, *field);
+ (*field)->quote_data(&old_field_value);
where_string.append(old_field_value);
}
}
@@ -1235,7 +1228,7 @@ int ha_federated::update_row(
{
(*field)->val_str(&old_field_value,
(char *)(old_data + (*field)->offset()));
- quote_data(&old_field_value, *field);
+ (*field)->quote_data(&old_field_value);
where_string.append(old_field_value);
}
}
@@ -1312,7 +1305,7 @@ int ha_federated::delete_row(const byte * buf)
{
delete_string.append("=");
(*field)->val_str(&data_string);
- quote_data(&data_string, *field);
+ (*field)->quote_data(&data_string);
}
delete_string.append(data_string);
@@ -1366,8 +1359,11 @@ int ha_federated::index_read_idx(byte * buf, uint index, const byte * key,
__attribute__((unused)))
{
char index_value[IO_SIZE];
+ char key_value[IO_SIZE];
+ char test_value[IO_SIZE];
String index_string(index_value, sizeof(index_value), &my_charset_bin);
index_string.length(0);
+ uint keylen;
char sql_query_buffer[IO_SIZE];
String sql_query(sql_query_buffer, sizeof(sql_query_buffer), &my_charset_bin);
@@ -1376,20 +1372,20 @@ int ha_federated::index_read_idx(byte * buf, uint index, const byte * key,
DBUG_ENTER("ha_federated::index_read_idx");
statistic_increment(table->in_use->status_var.ha_read_key_count,&LOCK_status);
- index_string.length(0);
- sql_query.length(0);
-
sql_query.append(share->select_query);
sql_query.append(" WHERE ");
- sql_query.append(table->key_info[index].key_part->field->field_name);
- sql_query.append(" = ");
- table->key_info[index].key_part->field->val_str(&index_string, (char *)(key));
- quote_data(&index_string, table->key_info[index].key_part->field);
+ keylen= strlen((char *)(key));
+ create_where_from_key(&index_string, &table->key_info[index], key, keylen);
sql_query.append(index_string);
DBUG_PRINT("ha_federated::index_read_idx",
- ("sql_query %s", sql_query.c_ptr_quick()));
+ ("current key %d key value %s index_string value %s length %d", index, (char *)(key),index_string.c_ptr_quick(),
+ index_string.length()));
+
+ DBUG_PRINT("ha_federated::index_read_idx",
+ ("current position %d sql_query %s", current_position,
+ sql_query.c_ptr_quick()));
if (mysql_real_query(mysql, sql_query.c_ptr_quick(), sql_query.length()))
{
@@ -1540,7 +1536,7 @@ int ha_federated::rnd_pos(byte * buf, byte *pos)
{
DBUG_ENTER("ha_federated::rnd_pos");
statistic_increment(table->in_use->status_var.ha_read_rnd_count,&LOCK_status);
- memcpy(current_position, pos, sizeof(MYSQL_ROW_OFFSET)); // pos is not aligned
+ memcpy_fixed(&current_position, pos, sizeof(MYSQL_ROW_OFFSET)); // pos is not aligned
result->current_row= 0;
result->data_cursor= current_position;
DBUG_RETURN(rnd_next(buf));
diff --git a/sql/ha_federated.h b/sql/ha_federated.h
index c11960a836f..56f5e6de4b7 100755
--- a/sql/ha_federated.h
+++ b/sql/ha_federated.h
@@ -71,10 +71,8 @@ private:
return 0 on success
return errorcode otherwise
*/
- //FIX
uint convert_row_to_internal_format(byte *buf, MYSQL_ROW row);
- uint type_quote(int type);
- void quote_data(String *string1, Field *field);
+ bool ha_federated::create_where_from_key(String *to, KEY *key_info, const byte *key, uint key_length);
public:
ha_federated(TABLE *table): handler(table),
@@ -104,7 +102,7 @@ public:
{
return (HA_TABLE_SCAN_ON_INDEX | HA_NOT_EXACT_COUNT |
HA_PRIMARY_KEY_IN_READ_INDEX | HA_FILE_BASED | HA_AUTO_PART_KEY |
- HA_TABLE_SCAN_ON_INDEX);
+ HA_TABLE_SCAN_ON_INDEX | HA_CAN_INDEX_BLOBS);
}
/*
This is a bitmap of flags that says how the storage engine
@@ -132,7 +130,7 @@ public:
/*
The next method will never be called if you do not implement indexes.
*/
- virtual double read_time(ha_rows rows) { return (double) rows / 20.0+1; }
+ virtual double read_time(uint index, uint ranges, ha_rows rows) { return (double) rows / 20.0+1; }
/*
Everything below are methods that we implment in ha_federated.cc.
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index 18ab6f42d28..01580586bf6 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -5787,11 +5787,12 @@ ha_innobase::store_lock(
if (lock_type != TL_IGNORE && lock.type == TL_UNLOCK) {
/* If we are not doing a LOCK TABLE or DISCARD/IMPORT
- TABLESPACE, then allow multiple writers */
+ TABLESPACE or TRUNCATE TABLE, then allow multiple writers */
if ((lock_type >= TL_WRITE_CONCURRENT_INSERT &&
lock_type <= TL_WRITE) && !thd->in_lock_tables
- && !thd->tablespace_op) {
+ && !thd->tablespace_op
+ && thd->lex->sql_command != SQLCOM_TRUNCATE) {
lock_type = TL_WRITE_ALLOW_WRITE;
}
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index badb486d16b..c12055a1d63 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -1055,6 +1055,42 @@ int ha_ndbcluster::get_metadata(const char *path)
DBUG_RETURN(build_index_list(table, ILBP_OPEN));
}
+static int fix_unique_index_attr_order(NDB_INDEX_DATA &data,
+ const NDBINDEX *index,
+ KEY *key_info)
+{
+ DBUG_ENTER("fix_unique_index_attr_order");
+ unsigned sz= index->getNoOfIndexColumns();
+
+ if (data.unique_index_attrid_map)
+ my_free((char*)data.unique_index_attrid_map, MYF(0));
+ data.unique_index_attrid_map= (unsigned char*)my_malloc(sz,MYF(MY_WME));
+
+ KEY_PART_INFO* key_part= key_info->key_part;
+ KEY_PART_INFO* end= key_part+key_info->key_parts;
+ DBUG_ASSERT(key_info->key_parts == sz);
+ for (unsigned i= 0; key_part != end; key_part++, i++)
+ {
+ const char *field_name= key_part->field->field_name;
+ unsigned name_sz= strlen(field_name);
+ if (name_sz >= NDB_MAX_ATTR_NAME_SIZE)
+ name_sz= NDB_MAX_ATTR_NAME_SIZE-1;
+#ifndef DBUG_OFF
+ data.unique_index_attrid_map[i]= 255;
+#endif
+ for (unsigned j= 0; j < sz; j++)
+ {
+ const NdbDictionary::Column *c= index->getColumn(j);
+ if (strncmp(field_name, c->getName(), name_sz) == 0)
+ {
+ data.unique_index_attrid_map[i]= j;
+ break;
+ }
+ }
+ DBUG_ASSERT(data.unique_index_attrid_map[i] != 255);
+ }
+ DBUG_RETURN(0);
+}
int ha_ndbcluster::build_index_list(TABLE *tab, enum ILBP phase)
{
@@ -1129,7 +1165,8 @@ int ha_ndbcluster::build_index_list(TABLE *tab, enum ILBP phase)
const NDBINDEX *index= dict->getIndex(unique_index_name, m_tabname);
if (!index) DBUG_RETURN(1);
m_index[i].unique_index= (void *) index;
- }
+ error= fix_unique_index_attr_order(m_index[i], index, key_info);
+ }
}
DBUG_RETURN(error);
@@ -1187,6 +1224,11 @@ void ha_ndbcluster::release_metadata()
{
m_index[i].unique_index= NULL;
m_index[i].index= NULL;
+ if (m_index[i].unique_index_attrid_map)
+ {
+ my_free((char *)m_index[i].unique_index_attrid_map, MYF(0));
+ m_index[i].unique_index_attrid_map= NULL;
+ }
}
DBUG_VOID_RETURN;
@@ -1355,7 +1397,7 @@ ha_ndbcluster::set_index_key(NdbOperation *op,
const byte* ptr= key_part->null_bit ? key_ptr + 1 : key_ptr;
char buf[256];
shrink_varchar(field, ptr, buf);
- if (set_ndb_key(op, field, i, ptr))
+ if (set_ndb_key(op, field, m_index[active_index].unique_index_attrid_map[i], ptr))
ERR_RETURN(m_active_trans->getNdbError());
key_ptr+= key_part->store_length;
}
@@ -1858,13 +1900,10 @@ int ha_ndbcluster::set_bounds(NdbIndexScanOperation *op,
// Set bound if not cancelled via type -1
if (p.bound_type != -1)
{
- char truncated_field_name[NDB_MAX_ATTR_NAME_SIZE];
- strnmov(truncated_field_name,field->field_name,sizeof(truncated_field_name));
- truncated_field_name[sizeof(truncated_field_name)-1]= '\0';
const char* ptr= p.bound_ptr;
char buf[256];
shrink_varchar(field, ptr, buf);
- if (op->setBound(truncated_field_name, p.bound_type, ptr))
+ if (op->setBound(i, p.bound_type, ptr))
ERR_RETURN(op->getNdbError());
}
}
@@ -3634,14 +3673,14 @@ static int create_ndb_column(NDBCOL &col,
col.setLength(1);
break;
// Date types
- case MYSQL_TYPE_TIMESTAMP:
- col.setType(NDBCOL::Unsigned);
- col.setLength(1);
- break;
case MYSQL_TYPE_DATETIME:
col.setType(NDBCOL::Datetime);
col.setLength(1);
break;
+ case MYSQL_TYPE_DATE: // ?
+ col.setType(NDBCOL::Char);
+ col.setLength(field->pack_length());
+ break;
case MYSQL_TYPE_NEWDATE:
col.setType(NDBCOL::Date);
col.setLength(1);
@@ -3650,10 +3689,13 @@ static int create_ndb_column(NDBCOL &col,
col.setType(NDBCOL::Time);
col.setLength(1);
break;
- case MYSQL_TYPE_DATE: // ?
- case MYSQL_TYPE_YEAR:
- col.setType(NDBCOL::Char);
- col.setLength(field->pack_length());
+ case MYSQL_TYPE_YEAR:
+ col.setType(NDBCOL::Year);
+ col.setLength(1);
+ break;
+ case MYSQL_TYPE_TIMESTAMP:
+ col.setType(NDBCOL::Timestamp);
+ col.setLength(1);
break;
// Char types
case MYSQL_TYPE_STRING:
@@ -4192,9 +4234,10 @@ ha_ndbcluster::ha_ndbcluster(TABLE *table_arg):
for (i= 0; i < MAX_KEY; i++)
{
- m_index[i].type= UNDEFINED_INDEX;
- m_index[i].unique_index= NULL;
- m_index[i].index= NULL;
+ m_index[i].type= UNDEFINED_INDEX;
+ m_index[i].unique_index= NULL;
+ m_index[i].index= NULL;
+ m_index[i].unique_index_attrid_map= NULL;
}
DBUG_VOID_RETURN;
diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h
index 52b7a0ac915..c660d8f618d 100644
--- a/sql/ha_ndbcluster.h
+++ b/sql/ha_ndbcluster.h
@@ -52,6 +52,7 @@ typedef struct ndb_index_data {
NDB_INDEX_TYPE type;
void *index;
void *unique_index;
+ unsigned char *unique_index_attrid_map;
} NDB_INDEX_DATA;
typedef struct st_ndbcluster_share {
diff --git a/sql/handler.cc b/sql/handler.cc
index b1b741dfee9..059d1feaed1 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -373,6 +373,16 @@ int ha_init()
opt_using_transactions=1;
}
#endif
+#ifdef HAVE_ARCHIVE_DB
+ if (have_archive_db == SHOW_OPTION_YES)
+ {
+ if (archive_db_init())
+ {
+ have_archive_db= SHOW_OPTION_DISABLED;
+ error= 1;
+ }
+ }
+#endif
return error;
}
@@ -404,6 +414,10 @@ int ha_panic(enum ha_panic_function flag)
if (have_ndbcluster == SHOW_OPTION_YES)
error|=ndbcluster_end();
#endif
+#ifdef HAVE_ARCHIVE_DB
+ if (have_archive_db == SHOW_OPTION_YES)
+ error|= archive_db_end();
+#endif
if (ha_finish_errors())
error= 1;
return error;
diff --git a/sql/item_create.cc b/sql/item_create.cc
index 8a5aeb6c9b7..9fb44658dd5 100644
--- a/sql/item_create.cc
+++ b/sql/item_create.cc
@@ -370,13 +370,14 @@ Item *create_func_space(Item *a)
{
uint dummy_errors;
sp= new Item_string("",0,cs);
- sp->str_value.copy(" ", 1, &my_charset_latin1, cs, &dummy_errors);
+ if (sp)
+ sp->str_value.copy(" ", 1, &my_charset_latin1, cs, &dummy_errors);
}
else
{
sp= new Item_string(" ",1,cs);
}
- return new Item_func_repeat(sp, a);
+ return sp ? new Item_func_repeat(sp, a) : 0;
}
Item *create_func_soundex(Item* a)
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index be89aa3f86d..29837c3afbd 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -1234,7 +1234,7 @@ int composite_key_cmp(void* arg, byte* key1, byte* key2)
{
Field* f = *field;
int len = *lengths++;
- int res = f->cmp(key1, key2);
+ int res = f->cmp((char *) key1, (char *) key2);
if (res)
return res;
key1 += len;
@@ -1688,7 +1688,7 @@ int group_concat_key_cmp_with_distinct(void* arg, byte* key1,
{
int res;
uint offset= (uint) (field->ptr - record);
- if ((res= field->cmp(key1 + offset, key2 + offset)))
+ if ((res= field->cmp((char *) key1 + offset, (char *) key2 + offset)))
return res;
}
}
@@ -1722,7 +1722,7 @@ int group_concat_key_cmp_with_order(void* arg, byte* key1, byte* key2)
{
int res;
uint offset= (uint) (field->ptr - record);
- if ((res= field->cmp(key1 + offset, key2 + offset)))
+ if ((res= field->cmp((char *) key1 + offset, (char *) key2 + offset)))
return (*order_item)->asc ? res : -res;
}
}
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 32813454fef..5a069aee554 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -2134,7 +2134,6 @@ String *Item_char_typecast::val_str(String *str)
String *res;
uint32 length;
-#if 0
if (!charset_conversion)
{
if (!(res= args[0]->val_str(str)))
@@ -2144,7 +2143,6 @@ String *Item_char_typecast::val_str(String *str)
}
}
else
-#endif
{
// Convert character set if differ
uint dummy_errors;
@@ -2182,9 +2180,18 @@ String *Item_char_typecast::val_str(String *str)
void Item_char_typecast::fix_length_and_dec()
{
uint32 char_length;
- charset_conversion= !my_charset_same(args[0]->collation.collation, cast_cs) &&
- args[0]->collation.collation != &my_charset_bin &&
- cast_cs != &my_charset_bin;
+ /*
+ We always force character set conversion if cast_cs
+ is a multi-byte character set. It garantees that the
+ result of CAST is a well-formed string.
+ For single-byte character sets we allow just to copy
+ from the argument. A single-byte character sets string
+ is always well-formed.
+ */
+ charset_conversion= (cast_cs->mbmaxlen > 1) ||
+ !my_charset_same(args[0]->collation.collation, cast_cs) &&
+ args[0]->collation.collation != &my_charset_bin &&
+ cast_cs != &my_charset_bin;
collation.set(cast_cs, DERIVATION_IMPLICIT);
char_length= (cast_length >= 0) ? cast_length :
args[0]->max_length/args[0]->collation.collation->mbmaxlen;
diff --git a/sql/key.cc b/sql/key.cc
index aec294e370a..c5ed60b129c 100644
--- a/sql/key.cc
+++ b/sql/key.cc
@@ -135,7 +135,7 @@ void key_copy(byte *to_key, byte *from_record, KEY *key_info, uint key_length)
{
key_length-= HA_KEY_BLOB_LENGTH;
length= min(key_length, key_part->length);
- key_part->field->get_key_image(to_key, length, Field::itRAW);
+ key_part->field->get_key_image((char *) to_key, length, Field::itRAW);
to_key+= HA_KEY_BLOB_LENGTH;
}
else
@@ -217,7 +217,7 @@ void key_restore(byte *to_record, byte *from_key, KEY *key_info,
{
key_length-= HA_KEY_BLOB_LENGTH;
length= min(key_length, key_part->length);
- key_part->field->set_key_image(from_key, length);
+ key_part->field->set_key_image((char *) from_key, length);
from_key+= HA_KEY_BLOB_LENGTH;
}
else
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 5a222a1ce10..bd0e1455eb2 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -712,6 +712,10 @@ void free_des_key_file();
/* sql_do.cc */
bool mysql_do(THD *thd, List<Item> &values);
+/* sql_analyse.h */
+bool append_escaped(String *to_str, String *from_str);
+bool append_escaped(String *to_str, char *from, uint from_len);
+
/* sql_show.cc */
bool mysqld_show_open_tables(THD *thd,const char *wild);
bool mysqld_show_logs(THD *thd);
@@ -978,7 +982,7 @@ extern Gt_creator gt_creator;
extern Lt_creator lt_creator;
extern Ge_creator ge_creator;
extern Le_creator le_creator;
-extern char language[LIBLEN],reg_ext[FN_EXTLEN];
+extern char language[FN_REFLEN], reg_ext[FN_EXTLEN];
extern char glob_hostname[FN_REFLEN], mysql_home[FN_REFLEN];
extern char pidfile_name[FN_REFLEN], system_time_zone[30], *opt_init_file;
extern char log_error_file[FN_REFLEN];
@@ -1001,8 +1005,7 @@ extern ulong ha_read_count, ha_discover_count;
extern ulong table_cache_size;
extern ulong max_connections,max_connect_errors, connect_timeout;
extern ulong slave_net_timeout;
-extern ulong max_user_connections;
-extern my_bool timed_mutexes;
+extern uint max_user_connections;
extern ulong what_to_log,flush_time;
extern ulong query_buff_size, thread_stack,thread_stack_min;
extern ulong binlog_cache_size, max_binlog_cache_size, open_files_limit;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index db18c275a4d..ae27af1e755 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -333,9 +333,9 @@ ulong delayed_insert_errors,flush_time, thread_created;
ulong specialflag=0;
ulong binlog_cache_use= 0, binlog_cache_disk_use= 0;
ulong max_connections,max_used_connections,
- max_connect_errors, max_user_connections = 0;
+ max_connect_errors;
+uint max_user_connections= 0;
ulong thread_id=1L,current_pid;
-my_bool timed_mutexes= 0;
ulong slow_launch_threads = 0, sync_binlog_period;
ulong expire_logs_days = 0;
ulong rpl_recovery_rank=0;
@@ -351,7 +351,7 @@ char *default_tz_name;
char log_error_file[FN_REFLEN], glob_hostname[FN_REFLEN];
char* log_error_file_ptr= log_error_file;
char mysql_real_data_home[FN_REFLEN],
- language[LIBLEN],reg_ext[FN_EXTLEN], mysql_charsets_dir[FN_REFLEN],
+ language[FN_REFLEN], reg_ext[FN_EXTLEN], mysql_charsets_dir[FN_REFLEN],
*mysqld_user,*mysqld_chroot, *opt_init_file,
*opt_init_connect, *opt_init_slave,
def_ft_boolean_syntax[sizeof(ft_boolean_syntax)];
@@ -3036,12 +3036,11 @@ You should consider changing lower_case_table_names to 1 or 2",
(test_if_case_insensitive(mysql_real_data_home) == 1)))
{
if (global_system_variables.log_warnings)
- sql_print_warning("\
-You have forced lower_case_table_names to 2 through a command-line \
-option, even though your file system '%s' is case sensitive. This means \
-that you can create a table that you can then no longer access. \
-You should consider changing lower_case_table_names to 0.",
+ sql_print_warning("lower_case_table_names was set to 2, even though your "
+ "the file system '%s' is case sensitive. Now setting "
+ "lower_case_table_names to 0 to avoid future problems.",
mysql_real_data_home);
+ lower_case_table_names= 0;
}
select_thread=pthread_self();
@@ -5262,8 +5261,8 @@ The minimum value for this variable is 4096.",
REQUIRED_ARG, 32, 1, ~0L, 0, 1, 0},
{"max_user_connections", OPT_MAX_USER_CONNECTIONS,
"The maximum number of active connections for a single user (0 = no limit).",
- (gptr*) &max_user_connections, (gptr*) &max_user_connections, 0, GET_ULONG,
- REQUIRED_ARG, 0, 1, ~0L, 0, 1, 0},
+ (gptr*) &max_user_connections, (gptr*) &max_user_connections, 0, GET_UINT,
+ REQUIRED_ARG, 0, 1, ~0, 0, 1, 0},
{"max_write_lock_count", OPT_MAX_WRITE_LOCK_COUNT,
"After this many write locks, allow some read locks to run in between.",
(gptr*) &max_write_lock_count, (gptr*) &max_write_lock_count, 0, GET_ULONG,
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index c3b84564504..e5799bfd509 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -1891,7 +1891,7 @@ double get_sweep_read_cost(const PARAM *param, ha_rows records)
else
{
double n_blocks=
- ceil((double)param->table->file->data_file_length / IO_SIZE);
+ ceil(ulonglong2double(param->table->file->data_file_length) / IO_SIZE);
double busy_blocks=
n_blocks * (1.0 - pow(1.0 - 1.0/n_blocks, rows2double(records)));
if (busy_blocks < 1.0)
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 552d2692c3c..d09de8550f0 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -28,7 +28,7 @@
- If the variable is thread specific, add it to 'system_variables' struct.
If not, add it to mysqld.cc and an declaration in 'mysql_priv.h'
- If the variable should be changed from the command line, add a definition
- of it in the my_option structure list in mysqld.dcc
+ of it in the my_option structure list in mysqld.cc
- Don't forget to initialize new fields in global_system_variables and
max_system_variables!
- If the variable should show up in 'show variables' add it to the
@@ -587,6 +587,7 @@ sys_var *sys_variables[]=
&sys_max_tmp_tables,
&sys_max_user_connections,
&sys_max_write_lock_count,
+ &sys_multi_range_count,
&sys_myisam_data_pointer_size,
&sys_myisam_max_extra_sort_file_size,
&sys_myisam_max_sort_file_size,
@@ -736,7 +737,7 @@ struct show_var_st init_vars[]= {
{"have_crypt", (char*) &have_crypt, SHOW_HAVE},
{"have_csv", (char*) &have_csv_db, SHOW_HAVE},
{"have_example_engine", (char*) &have_example_db, SHOW_HAVE},
- {"have_federated_db", (char*) &have_federated_db, SHOW_HAVE},
+ {"have_federated_engine", (char*) &have_federated_db, SHOW_HAVE},
{"have_geometry", (char*) &have_geometry, SHOW_HAVE},
{"have_innodb", (char*) &have_innodb, SHOW_HAVE},
{"have_isam", (char*) &have_isam, SHOW_HAVE},
@@ -832,6 +833,7 @@ struct show_var_st init_vars[]= {
{sys_max_tmp_tables.name, (char*) &sys_max_tmp_tables, SHOW_SYS},
{sys_max_user_connections.name,(char*) &sys_max_user_connections, SHOW_SYS},
{sys_max_write_lock_count.name, (char*) &sys_max_write_lock_count,SHOW_SYS},
+ {sys_multi_range_count.name, (char*) &sys_multi_range_count, SHOW_SYS},
{sys_myisam_data_pointer_size.name, (char*) &sys_myisam_data_pointer_size, SHOW_SYS},
{sys_myisam_max_extra_sort_file_size.name,
(char*) &sys_myisam_max_extra_sort_file_size,
@@ -1605,6 +1607,14 @@ Item *sys_var::item(THD *thd, enum_var_type var_type, LEX_STRING *base)
var_type= OPT_GLOBAL;
}
switch (type()) {
+ case SHOW_INT:
+ {
+ uint value;
+ pthread_mutex_lock(&LOCK_global_system_variables);
+ value= *(uint*) value_ptr(thd, var_type, base);
+ pthread_mutex_unlock(&LOCK_global_system_variables);
+ return new Item_uint((int32) value);
+ }
case SHOW_LONG:
{
ulong value;
diff --git a/sql/set_var.h b/sql/set_var.h
index 7c9f11041c8..0f30f764ed5 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -740,7 +740,7 @@ public:
return type != OPT_GLOBAL || !option_limits;
}
void set_default(THD *thd, enum_var_type type);
- SHOW_TYPE type() { return SHOW_LONG; }
+ SHOW_TYPE type() { return SHOW_INT; }
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
};
diff --git a/sql/share/Makefile.am b/sql/share/Makefile.am
index cfbbb36c489..608bbdb7ae6 100644
--- a/sql/share/Makefile.am
+++ b/sql/share/Makefile.am
@@ -14,10 +14,11 @@ dist-hook:
all: english/errmsg.sys
# Use the english errmsg.sys as a flag that all errmsg.sys needs to be
-# created. Normally these are created by extra/Makefile.am
+# created. Normally these are created by extra/Makefile
english/errmsg.sys: errmsg.txt
- $(top_builddir)/extra/comp_err --charset=$(srcdir)/charsets --out-dir=$(top_builddir)/sql/share/ --header_file=$(top_builddir)/extra/mysqld_error.h --state_file=$(top_builddir)/extra/sql_state.h --in_file=errmsg.txt
+ rm $(top_builddir)/include/mysqld_error.h
+ (cd $(top_builddir)/extra && $(MAKE))
install-data-local:
for lang in @AVAILABLE_LANGUAGES@; \
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index f9d95b2cde5..71d042eda02 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -1494,12 +1494,12 @@ static bool update_user_table(THD *thd, const char *host, const char *user,
DBUG_RETURN(1); /* purecov: deadcode */
table->field[0]->store(host,(uint) strlen(host), system_charset_info);
table->field[1]->store(user,(uint) strlen(user), system_charset_info);
- key_copy(user_key, table->record[0], table->key_info,
+ key_copy((byte *) user_key, table->record[0], table->key_info,
table->key_info->key_length);
table->file->extra(HA_EXTRA_RETRIEVE_ALL_COLS);
if (table->file->index_read_idx(table->record[0], 0,
- user_key, table->key_info->key_length,
+ (byte *) user_key, table->key_info->key_length,
HA_READ_KEY_EXACT))
{
my_message(ER_PASSWORD_NO_MATCH, ER(ER_PASSWORD_NO_MATCH),
diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc
index ce58c585061..3f97cab1511 100644
--- a/sql/sql_analyse.cc
+++ b/sql/sql_analyse.cc
@@ -59,7 +59,8 @@ int compare_ulonglong2(void* cmp_arg __attribute__((unused)),
return compare_ulonglong(s,t);
}
-static bool append_escaped(String *to_str, String *from_str);
+bool append_escaped(String *to_str, String *from_str);
+bool append_escaped(String *to_str, char *from, uint from_len);
Procedure *
proc_analyse_init(THD *thd, ORDER *param, select_result *result,
@@ -1052,7 +1053,7 @@ uint check_ulonglong(const char *str, uint length)
1 Out of memory
*/
-static bool append_escaped(String *to_str, String *from_str)
+bool append_escaped(String *to_str, String *from_str)
{
char *from, *end, c;
@@ -1086,3 +1087,38 @@ static bool append_escaped(String *to_str, String *from_str)
}
return 0;
}
+
+bool append_escaped(String *to_str, char *from, uint from_len)
+{
+ char *end, c;
+
+ if (to_str->realloc(to_str->length() + from_len))
+ return 1;
+
+ end= from + from_len;
+
+ for (; from < end; from++)
+ {
+ c= *from;
+ switch (c) {
+ case '\0':
+ c= '0';
+ break;
+ case '\032':
+ c= 'Z';
+ break;
+ case '\\':
+ case '\'':
+ break;
+ default:
+ goto normal_character;
+ }
+ if (to_str->append('\\'))
+ return 1;
+
+ normal_character:
+ if (to_str->append(c))
+ return 1;
+ }
+ return 0;
+}
diff --git a/sql/sql_class.h b/sql/sql_class.h
index f635aa62000..240208584e7 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -1281,6 +1281,7 @@ public:
unit= u;
return 0;
}
+ virtual int prepare2(void) { return 0; }
/*
Because of peculiarities of prepared statements protocol
we need to know number of columns in the result set (if
@@ -1380,6 +1381,7 @@ class select_insert :public select_result_interceptor {
enum_duplicates duplic, bool ignore);
~select_insert();
int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
+ int prepare2(void);
bool send_data(List<Item> &items);
virtual void store_values(List<Item> &values);
void send_error(uint errcode,const char *err);
diff --git a/sql/sql_help.cc b/sql/sql_help.cc
index 7bf28a439b6..759b535da53 100644
--- a/sql/sql_help.cc
+++ b/sql/sql_help.cc
@@ -558,8 +558,13 @@ SQL_SELECT *prepare_simple_select(THD *thd, Item *cond, TABLE_LIST *tables,
{
if (!cond->fixed)
cond->fix_fields(thd, tables, &cond); // can never fail
+
+ /* Assume that no indexes cover all required fields */
+ table->used_keys.clear_all();
+
SQL_SELECT *res= make_select(table,0,0,cond,error);
- if (*error || (res && res->check_quick(thd, 0, HA_POS_ERROR)))
+ if (*error || (res && res->check_quick(thd, 0, HA_POS_ERROR)) ||
+ (res->quick && res->quick->reset()))
{
delete res;
res=0;
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index ceb31f76953..4cb62d5e9d7 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -1802,13 +1802,22 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
thd->lex->current_select->options|= OPTION_BUFFER_RESULT;
thd->lex->current_select->join->select_options|= OPTION_BUFFER_RESULT;
}
-
+ else
+ {
+ /*
+ We must not yet prepare the result table if it is the same as one of the
+ source tables (INSERT SELECT). The preparation may disable
+ indexes on the result table, which may be used during the select, if it
+ is the same table (Bug #6034). Do the preparation after the select phase
+ in select_insert::prepare2().
+ */
+ if (info.ignore || info.handle_duplicates != DUP_ERROR)
+ table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
+ table->file->start_bulk_insert((ha_rows) 0);
+ }
restore_record(table,s->default_values); // Get empty record
table->next_number_field=table->found_next_number_field;
thd->cuted_fields=0;
- if (info.ignore || info.handle_duplicates != DUP_ERROR)
- table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
- table->file->start_bulk_insert((ha_rows) 0);
thd->no_trans_update= 0;
thd->abort_on_warning= (!info.ignore &&
(thd->variables.sql_mode &
@@ -1819,6 +1828,36 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
}
+/*
+ Finish the preparation of the result table.
+
+ SYNOPSIS
+ select_insert::prepare2()
+ void
+
+ DESCRIPTION
+ If the result table is the same as one of the source tables (INSERT SELECT),
+ the result table is not finally prepared at the join prepair phase.
+ Do the final preparation now.
+
+ RETURN
+ 0 OK
+*/
+
+int select_insert::prepare2(void)
+{
+ DBUG_ENTER("select_insert::prepare2");
+
+ if (thd->lex->current_select->options & OPTION_BUFFER_RESULT)
+ {
+ if (info.ignore || info.handle_duplicates != DUP_ERROR)
+ table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
+ table->file->start_bulk_insert((ha_rows) 0);
+ }
+ return 0;
+}
+
+
void select_insert::cleanup()
{
/* select_insert/select_create are never re-used in prepared statement */
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index c0bcaf771a5..7205baae59e 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -5339,6 +5339,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
ptr->table_name, information_schema_name.str);
DBUG_RETURN(0);
}
+ ptr->schema_table_name= ptr->table_name;
ptr->schema_table= schema_table;
}
ptr->select_lex= lex->current_select;
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index acb7d8f48f1..60273d21d9f 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1164,6 +1164,7 @@ JOIN::exec()
DBUG_VOID_RETURN;
}
}
+ (void) result->prepare2(); // Currently, this cannot fail.
if (!tables_list)
{ // Only test of functions
@@ -4473,16 +4474,9 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
x = used key parts (1 <= x <= c)
*/
double rec_per_key;
-#if 0
- if (!(rec_per_key=(double)
- keyinfo->rec_per_key[keyinfo->key_parts-1]))
- rec_per_key=(double) s->records/rec+1;
-#else
rec_per_key= keyinfo->rec_per_key[keyinfo->key_parts-1] ?
(double) keyinfo->rec_per_key[keyinfo->key_parts-1] :
(double) s->records/rec+1;
-#endif
-
if (!s->records)
tmp=0;
else if (rec_per_key/(double) s->records >= 0.01)
@@ -13159,7 +13153,8 @@ bool JOIN::change_result(select_result *res)
{
DBUG_ENTER("JOIN::change_result");
result= res;
- if (!procedure && result->prepare(fields_list, select_lex->master_unit()))
+ if (!procedure && (result->prepare(fields_list, select_lex->master_unit()) ||
+ result->prepare2()))
{
DBUG_RETURN(TRUE);
}
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index b909e9cec1b..e9126871045 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -1802,7 +1802,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
res= open_and_lock_tables(thd, show_table_list);
if (schema_table->process_table(thd, show_table_list,
table, res, show_table_list->db,
- show_table_list->table_name))
+ show_table_list->alias))
{
DBUG_RETURN(1);
}
@@ -1911,7 +1911,8 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
show_table_list->lock_type= lock_type;
res= open_and_lock_tables(thd, show_table_list);
if (schema_table->process_table(thd, show_table_list, table,
- res, base_name, file_name))
+ res, base_name,
+ show_table_list->alias))
{
DBUG_RETURN(1);
}
@@ -3183,8 +3184,17 @@ int mysql_schema_table(THD *thd, LEX *lex, TABLE_LIST *table_list)
}
table->s->tmp_table= TMP_TABLE;
table->grant.privilege= SELECT_ACL;
- table->alias_name_used= 0;
- table_list->schema_table_name= table_list->table_name;
+ /*
+ This test is necessary to make
+ case insensitive file systems +
+ upper case table names(information schema tables) +
+ views
+ working correctly
+ */
+ if (table_list->schema_table_name)
+ table->alias_name_used= my_strcasecmp(table_alias_charset,
+ table_list->schema_table_name,
+ table_list->alias);
table_list->table_name= (char*) table->s->table_name;
table_list->table= table;
table->next= thd->derived_tables;
diff --git a/sql/table.cc b/sql/table.cc
index 82ad32341c0..69a132329c0 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -305,7 +305,7 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
if (!(record= (char *) alloc_root(&outparam->mem_root,
rec_buff_length * records)))
goto err; /* purecov: inspected */
- share->default_values= record;
+ share->default_values= (byte *) record;
if (my_pread(file,(byte*) record, (uint) share->reclength,
(ulong) (uint2korr(head+6)+
((uint2korr(head+14) == 0xffff ?
@@ -320,9 +320,9 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
}
else
{
- outparam->record[0]= record+ rec_buff_length;
+ outparam->record[0]= (byte *) record+ rec_buff_length;
if (records > 2)
- outparam->record[1]= record+ rec_buff_length*2;
+ outparam->record[1]= (byte *) record+ rec_buff_length*2;
else
outparam->record[1]= outparam->record[0]; // Safety
}
diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c
index a2db7de244e..70c5ec633be 100644
--- a/strings/ctype-big5.c
+++ b/strings/ctype-big5.c
@@ -6293,6 +6293,7 @@ static MY_COLLATION_HANDLER my_collation_big5_chinese_ci_handler =
my_strnncoll_big5,
my_strnncollsp_big5,
my_strnxfrm_big5,
+ my_strnxfrmlen_simple,
my_like_range_big5,
my_wildcmp_mb,
my_strcasecmp_mb,
diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c
index 401605a462f..50c66a63e97 100644
--- a/strings/ctype-bin.c
+++ b/strings/ctype-bin.c
@@ -447,6 +447,7 @@ MY_COLLATION_HANDLER my_collation_8bit_bin_handler =
my_strnncoll_8bit_bin,
my_strnncollsp_8bit_bin,
my_strnxfrm_8bit_bin,
+ my_strnxfrmlen_simple,
my_like_range_simple,
my_wildcmp_bin,
my_strcasecmp_bin,
@@ -461,6 +462,7 @@ static MY_COLLATION_HANDLER my_collation_binary_handler =
my_strnncoll_binary,
my_strnncollsp_binary,
my_strnxfrm_bin,
+ my_strnxfrmlen_simple,
my_like_range_simple,
my_wildcmp_bin,
my_strcasecmp_bin,
diff --git a/strings/ctype-cp932.c b/strings/ctype-cp932.c
index 804f87b2a5b..c47f2c2d8ce 100644
--- a/strings/ctype-cp932.c
+++ b/strings/ctype-cp932.c
@@ -5454,6 +5454,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
my_strnncoll_cp932,
my_strnncollsp_cp932,
my_strnxfrm_cp932,
+ my_strnxfrmlen_simple,
my_like_range_cp932,
my_wildcmp_mb, /* wildcmp */
my_strcasecmp_8bit,
diff --git a/strings/ctype-czech.c b/strings/ctype-czech.c
index 2834dbb28ff..f5a410afc50 100644
--- a/strings/ctype-czech.c
+++ b/strings/ctype-czech.c
@@ -593,6 +593,7 @@ static MY_COLLATION_HANDLER my_collation_latin2_czech_ci_handler =
my_strnncoll_czech,
my_strnncollsp_czech,
my_strnxfrm_czech,
+ my_strnxfrmlen_simple,
my_like_range_czech,
my_wildcmp_8bit,
my_strcasecmp_8bit,
diff --git a/strings/ctype-euc_kr.c b/strings/ctype-euc_kr.c
index ee792d9c3e4..289b7309ea0 100644
--- a/strings/ctype-euc_kr.c
+++ b/strings/ctype-euc_kr.c
@@ -8641,6 +8641,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
my_strnncoll_simple, /* strnncoll */
my_strnncollsp_simple,
my_strnxfrm_simple, /* strnxfrm */
+ my_strnxfrmlen_simple,
my_like_range_simple, /* like_range */
my_wildcmp_mb, /* wildcmp */
my_strcasecmp_mb,
diff --git a/strings/ctype-eucjpms.c b/strings/ctype-eucjpms.c
index 5b108d24f4b..8c8d237cf48 100644
--- a/strings/ctype-eucjpms.c
+++ b/strings/ctype-eucjpms.c
@@ -8636,6 +8636,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
my_strnncoll_simple,/* strnncoll */
my_strnncollsp_simple,
my_strnxfrm_simple, /* strnxfrm */
+ my_strnxfrmlen_simple,
my_like_range_simple,/* like_range */
my_wildcmp_mb, /* wildcmp */
my_strcasecmp_mb,
diff --git a/strings/ctype-gb2312.c b/strings/ctype-gb2312.c
index f17cc94723f..73e4132dd7f 100644
--- a/strings/ctype-gb2312.c
+++ b/strings/ctype-gb2312.c
@@ -5692,6 +5692,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
my_strnncoll_simple, /* strnncoll */
my_strnncollsp_simple,
my_strnxfrm_simple, /* strnxfrm */
+ my_strnxfrmlen_simple,
my_like_range_simple, /* like_range */
my_wildcmp_mb, /* wildcmp */
my_strcasecmp_mb, /* instr */
diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c
index dc4aea60096..6b47b537fb9 100644
--- a/strings/ctype-gbk.c
+++ b/strings/ctype-gbk.c
@@ -9939,6 +9939,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
my_strnncoll_gbk,
my_strnncollsp_gbk,
my_strnxfrm_gbk,
+ my_strnxfrmlen_simple,
my_like_range_gbk,
my_wildcmp_mb,
my_strcasecmp_mb,
diff --git a/strings/ctype-latin1.c b/strings/ctype-latin1.c
index b5da99a7452..043645684cf 100644
--- a/strings/ctype-latin1.c
+++ b/strings/ctype-latin1.c
@@ -693,6 +693,7 @@ static MY_COLLATION_HANDLER my_collation_german2_ci_handler=
my_strnncoll_latin1_de,
my_strnncollsp_latin1_de,
my_strnxfrm_latin1_de,
+ my_strnxfrmlen_simple,
my_like_range_simple,
my_wildcmp_8bit,
my_strcasecmp_8bit,
diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c
index 4be21599fef..e902730d65a 100644
--- a/strings/ctype-mb.c
+++ b/strings/ctype-mb.c
@@ -912,6 +912,7 @@ MY_COLLATION_HANDLER my_collation_mb_bin_handler =
my_strnncoll_mb_bin,
my_strnncollsp_mb_bin,
my_strnxfrm_mb_bin,
+ my_strnxfrmlen_simple,
my_like_range_simple,
my_wildcmp_mb_bin,
my_strcasecmp_mb_bin,
diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c
index bb623ef66f1..e436d5f8702 100644
--- a/strings/ctype-simple.c
+++ b/strings/ctype-simple.c
@@ -22,6 +22,15 @@
#include "stdarg.h"
/*
+ Returns the number of bytes required for strnxfrm().
+*/
+uint my_strnxfrmlen_simple(CHARSET_INFO *cs, uint len)
+{
+ return len * (cs->strxfrm_multiply ? cs->strxfrm_multiply : 1);
+}
+
+
+/*
Converts a string into its sort key.
SYNOPSIS
@@ -1365,6 +1374,7 @@ MY_COLLATION_HANDLER my_collation_8bit_simple_ci_handler =
my_strnncoll_simple,
my_strnncollsp_simple,
my_strnxfrm_simple,
+ my_strnxfrmlen_simple,
my_like_range_simple,
my_wildcmp_8bit,
my_strcasecmp_8bit,
diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c
index c1e41dc2d94..22cc8d9818d 100644
--- a/strings/ctype-sjis.c
+++ b/strings/ctype-sjis.c
@@ -4627,6 +4627,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
my_strnncoll_sjis,
my_strnncollsp_sjis,
my_strnxfrm_sjis,
+ my_strnxfrmlen_simple,
my_like_range_sjis,
my_wildcmp_mb, /* wildcmp */
my_strcasecmp_8bit,
diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c
index c6bdd106ad4..9ba35e1c8ec 100644
--- a/strings/ctype-tis620.c
+++ b/strings/ctype-tis620.c
@@ -927,6 +927,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
my_strnncoll_tis620,
my_strnncollsp_tis620,
my_strnxfrm_tis620,
+ my_strnxfrmlen_simple,
my_like_range_tis620,
my_wildcmp_8bit, /* wildcmp */
my_strcasecmp_8bit,
diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c
index 2353c9397a2..8345d0474f2 100644
--- a/strings/ctype-uca.c
+++ b/strings/ctype-uca.c
@@ -8024,6 +8024,7 @@ MY_COLLATION_HANDLER my_collation_ucs2_uca_handler =
my_strnncoll_ucs2_uca,
my_strnncollsp_ucs2_uca,
my_strnxfrm_ucs2_uca,
+ my_strnxfrmlen_simple,
my_like_range_ucs2,
my_wildcmp_uca,
NULL,
@@ -8504,6 +8505,7 @@ MY_COLLATION_HANDLER my_collation_any_uca_handler =
my_strnncoll_any_uca,
my_strnncollsp_any_uca,
my_strnxfrm_any_uca,
+ my_strnxfrmlen_simple,
my_like_range_mb,
my_wildcmp_uca,
NULL,
diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c
index adfd4794e36..0d45cceb64d 100644
--- a/strings/ctype-ucs2.c
+++ b/strings/ctype-ucs2.c
@@ -1499,6 +1499,7 @@ static MY_COLLATION_HANDLER my_collation_ucs2_general_ci_handler =
my_strnncoll_ucs2,
my_strnncollsp_ucs2,
my_strnxfrm_ucs2,
+ my_strnxfrmlen_simple,
my_like_range_ucs2,
my_wildcmp_ucs2_ci,
my_strcasecmp_ucs2,
@@ -1513,6 +1514,7 @@ static MY_COLLATION_HANDLER my_collation_ucs2_bin_handler =
my_strnncoll_ucs2_bin,
my_strnncollsp_ucs2_bin,
my_strnxfrm_ucs2_bin,
+ my_strnxfrmlen_simple,
my_like_range_simple,
my_wildcmp_ucs2_bin,
my_strcasecmp_ucs2_bin,
diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c
index fc1496df280..deaddcc76f6 100644
--- a/strings/ctype-ujis.c
+++ b/strings/ctype-ujis.c
@@ -8501,6 +8501,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
my_strnncoll_simple,/* strnncoll */
my_strnncollsp_simple,
my_strnxfrm_simple, /* strnxfrm */
+ my_strnxfrmlen_simple,
my_like_range_simple,/* like_range */
my_wildcmp_mb, /* wildcmp */
my_strcasecmp_mb,
diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c
index 1f9f158a73d..e17e7587e85 100644
--- a/strings/ctype-utf8.c
+++ b/strings/ctype-utf8.c
@@ -2238,6 +2238,12 @@ int my_wildcmp_utf8(CHARSET_INFO *cs,
}
+static
+uint my_strnxfrmlen_utf8(CHARSET_INFO *cs __attribute__((unused)), uint len)
+{
+ return (len * 2 + 2) / 3;
+}
+
static int my_strnxfrm_utf8(CHARSET_INFO *cs,
uchar *dst, uint dstlen,
const uchar *src, uint srclen)
@@ -2245,29 +2251,33 @@ static int my_strnxfrm_utf8(CHARSET_INFO *cs,
my_wc_t wc;
int res;
int plane;
- uchar *de = dst + dstlen;
+ uchar *de= dst + dstlen;
+ uchar *de_beg= de - 1;
const uchar *se = src + srclen;
- while( src < se && dst < de )
+ while (dst < de_beg)
{
- if ((res=my_utf8_uni(cs,&wc, src, se))<0)
- {
+ if ((res=my_utf8_uni(cs,&wc, src, se)) <= 0)
break;
- }
src+=res;
- srclen-=res;
plane=(wc>>8) & 0xFF;
wc = uni_plane[plane] ? uni_plane[plane][wc & 0xFF].sort : wc;
- if ((res=my_uni_utf8(cs,wc,dst,de)) <0)
- {
- break;
- }
- dst+=res;
+ *dst++= wc >> 8;
+ *dst++= wc & 0xFF;
+
}
- if (dst < de)
- bfill(dst, de - dst, ' ');
+
+ while (dst < de_beg) /* Fill the tail with keys for space character */
+ {
+ *dst++= 0x00;
+ *dst++= 0x20;
+ }
+
+ if (dst < de) /* Clear the last byte, if "dstlen" was an odd number */
+ *de= 0x00;
+
return dstlen;
}
@@ -2306,6 +2316,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
my_strnncoll_utf8,
my_strnncollsp_utf8,
my_strnxfrm_utf8,
+ my_strnxfrmlen_utf8,
my_like_range_mb,
my_wildcmp_utf8,
my_strcasecmp_utf8,
diff --git a/strings/ctype-win1250ch.c b/strings/ctype-win1250ch.c
index b58a8f0f1e5..37611a5bd20 100644
--- a/strings/ctype-win1250ch.c
+++ b/strings/ctype-win1250ch.c
@@ -626,6 +626,7 @@ static MY_COLLATION_HANDLER my_collation_czech_ci_handler =
my_strnncoll_win1250ch,
my_strnncollsp_win1250ch,
my_strnxfrm_win1250ch,
+ my_strnxfrmlen_simple,
my_like_range_win1250ch,
my_wildcmp_8bit,
my_strcasecmp_8bit,
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 55801c22c48..1cb07f85e5a 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -16,7 +16,7 @@
# Process this file with automake to create Makefile.in
INCLUDES=@MT_INCLUDES@ -I$(top_srcdir)/include $(openssl_includes) \
- -I$(top_srcdir)/extra
+ -I$(top_builddir)/include
LDADD= @CLIENT_EXTRA_LDFLAGS@ @openssl_libs@ \
$(top_builddir)/libmysql_r/libmysqlclient_r.la @ZLIB_LIBS@
bin_PROGRAMS= mysqlmanager