diff --git a/.bzrignore b/.bzrignore index d170e7f9027..cce2f366517 100644 --- a/.bzrignore +++ b/.bzrignore @@ -1,21 +1,39 @@ *.a *.bb *.bbg +*.bin *.core *.d *.da +*.exe *.gcov +*.idb *.la +*.lib *.lo +*.map *.o +*.obj +*.pch +*.pdb *.reject +*.res +*.sbr *.so *.spec */*_pure_*warnings */.pure *~ .*.swp +./README.build-files ./config.h +./copy_mysql_files.bat +./fix-project-files +./mysql*.ds? +./mysql.ncb +./mysql.sln +./mysql.suo +./prepare .defs.mk .depend .depend.mk @@ -115,6 +133,8 @@ autom4te.cache/* autom4te.cache/output.0 autom4te.cache/requests autom4te.cache/traces.0 +bdb/*.ds? +bdb/*.vcproj bdb/README bdb/btree/btree_auto.c bdb/build_unix/* @@ -256,6 +276,9 @@ bkpush.log bkpush.log* build.log build_tags.sh +client/*.ds? +client/*.vcproj +client/completion_hash.cpp client/decimal.c client/insert_test client/log_event.cc @@ -265,9 +288,12 @@ client/mf_iocache.cc client/my_decimal.cc client/my_decimal.h client/mysql +client/mysql.cpp client/mysqladmin client/mysqladmin.c +client/mysqladmin.cpp client/mysqlbinlog +client/mysqlbinlog.cpp client/mysqlcheck client/mysqldump client/mysqlimport @@ -278,14 +304,20 @@ client/mysqltest client/mysqltestmanager-pwgen client/mysqltestmanagerc client/mysys_priv.h +client/readline.cpp client/select_test +client/sql_string.cpp client/ssl_test client/thimble client/thread_test +client_debug/* +client_release/* client_test cmd-line-utils/libedit/common.h cmd-line-utils/libedit/makelist comon.h +comp_err/*.ds? +comp_err/*.vcproj config.cache config.guess config.h @@ -295,10 +327,14 @@ config.status config.sub configure configure.lineno +contrib/*.ds? +contrib/*.vcproj core core.* core.2430 db-*.*.* +dbug/*.ds? +dbug/*.vcproj dbug/dbug_analyze dbug/example*.r dbug/factorial @@ -309,6 +345,9 @@ dbug/user.ps dbug/user.t depcomp emacs.h +examples/*.ds? +examples/*.vcproj +examples/udf_example/udf_example.def extra/charset2html extra/comp_err extra/created_include_files @@ -330,6 +369,8 @@ fcns.h gdbinit gmon.out hardcopy.0 +heap/*.ds? +heap/*.vcproj heap/hp_test1 heap/hp_test2 help @@ -345,6 +386,8 @@ include/readline/*.h include/readline/readline.h include/sql_state.h include/widec.h +innobase/*.ds? +innobase/*.vcproj innobase/autom4te-2.53.cache/* innobase/autom4te-2.53.cache/output.0 innobase/autom4te-2.53.cache/requests @@ -363,18 +406,28 @@ innobase/stamp-h1 insert_test install install-sh +isam/*.ds? +isam/*.vcproj isam/isamchk isam/isamlog isam/pack_isam isam/test1 isam/test2 isam/test3 +isamchk/*.ds? +isamchk/*.vcproj +lib_debug/* +lib_release/* libmysql/*.c +libmysql/*.ds? +libmysql/*.vcproj libmysql/conf_to_src +libmysql/debug/libmysql.exp libmysql/my_static.h libmysql/my_time.c libmysql/mysys_priv.h libmysql/net.c +libmysql/release/libmysql.exp libmysql/vio_priv.h libmysql_r/*.c libmysql_r/acconfig.h @@ -382,12 +435,15 @@ libmysql_r/conf_to_src libmysql_r/my_static.h libmysql_r/mysys_priv.h libmysql_r/vio_priv.h +libmysqld/*.ds? +libmysqld/*.vcproj libmysqld/backup_dir libmysqld/client.c libmysqld/client_settings.h libmysqld/convert.cc libmysqld/derror.cc libmysqld/discover.cc +libmysqld/emb_qcache.cpp libmysqld/errmsg.c libmysqld/examples/client_test.c libmysqld/examples/client_test.cc @@ -413,6 +469,7 @@ libmysqld/get_password.c libmysqld/gstream.cc libmysqld/ha_archive.cc libmysqld/ha_berkeley.cc +libmysqld/ha_blackhole.cc libmysqld/ha_example.cc libmysqld/ha_federated.cc libmysqld/ha_heap.cc @@ -422,9 +479,11 @@ libmysqld/ha_isam.cc libmysqld/ha_isammrg.cc libmysqld/ha_myisam.cc libmysqld/ha_myisammrg.cc +libmysqld/ha_ndbcluster.cc libmysqld/ha_partition.cc libmysqld/ha_tina.cc libmysqld/handler.cc +libmysqld/handlerton.cc libmysqld/hash_filo.cc libmysqld/hostname.cc libmysqld/init.cc @@ -441,6 +500,7 @@ libmysqld/item_sum.cc libmysqld/item_timefunc.cc libmysqld/item_uniq.cc libmysqld/key.cc +libmysqld/lib_sql.cpp libmysqld/libmysql.c libmysqld/lock.cc libmysqld/log.cc @@ -498,6 +558,7 @@ libmysqld/sql_map.cc libmysqld/sql_olap.cc libmysqld/sql_parse.cc libmysqld/sql_partition.cc +libmysqld/sql_plugin.cc libmysqld/sql_prepare.cc libmysqld/sql_rename.cc libmysqld/sql_repl.cc @@ -514,6 +575,8 @@ libmysqld/sql_unions.cc libmysqld/sql_update.cc libmysqld/sql_view.cc libmysqld/sql_yacc.cc +libmysqld/sql_yacc.cpp +libmysqld/sql_yacc.h libmysqld/stacktrace.c libmysqld/strfunc.cc libmysqld/table.cc @@ -522,6 +585,9 @@ libmysqld/time.cc libmysqld/tztime.cc libmysqld/uniques.cc libmysqld/unireg.cc +libmysqltest/*.ds? +libmysqltest/*.vcproj +libmysqltest/mytest.c libtool linked_client_sources linked_include_sources @@ -534,6 +600,8 @@ linked_tools_sources locked ltmain.sh man/*.1 +merge/*.ds? +merge/*.vcproj missing mit-pthreads/config.flags mit-pthreads/include/bits @@ -545,6 +613,10 @@ mit-pthreads/pg++ mit-pthreads/pgcc mit-pthreads/syscall.S mkinstalldirs +my_print_defaults/*.ds? +my_print_defaults/*.vcproj +myisam/*.ds? +myisam/*.vcproj myisam/FT1.MYD myisam/FT1.MYI myisam/ft_dump @@ -570,17 +642,31 @@ myisam/test1.MYD myisam/test1.MYI myisam/test2.MYD myisam/test2.MYI +myisam_ftdump/*.ds? +myisam_ftdump/*.vcproj +myisamchk/*.ds? +myisamchk/*.vcproj +myisamlog/*.ds? +myisamlog/*.vcproj +myisammrg/*.ds? +myisammrg/*.vcproj +myisampack/*.ds? +myisampack/*.vcproj mysql-4.0.2-alpha-pc-linux-gnu-i686.tar.gz mysql-4.0.2-alpha.tar.gz mysql-4.1.8-win-src.zip mysql-5.0.2-alpha.tar.gz mysql-max-4.0.2-alpha-pc-linux-gnu-i686.tar.gz +mysql-test/*.ds? +mysql-test/*.vcproj mysql-test/gmon.out mysql-test/install_test_db mysql-test/mysql-test-run mysql-test/mysql-test-run.log mysql-test/mysql_test_run_new mysql-test/ndb/ndbcluster +mysql-test/r/*.err +mysql-test/r/*.out mysql-test/r/*.reject mysql-test/r/alter_table.err mysql-test/r/archive.err @@ -652,13 +738,25 @@ mysql-test/var/* mysql.kdevprj mysql.proj mysql_priv.h +mysqlbinlog/*.ds? +mysqlbinlog/*.vcproj +mysqlcheck/*.ds? +mysqlcheck/*.vcproj mysqld.S mysqld.sym +mysqldemb/*.ds? +mysqldemb/*.vcproj +mysqlserver/*.ds? +mysqlserver/*.vcproj mysys/#mf_iocache.c# +mysys/*.ds? +mysys/*.vcproj mysys/charset2html mysys/getopt.c mysys/getopt1.c mysys/main.cc +mysys/my_new.cpp +mysys/raid.cpp mysys/ste5KbMa mysys/test_charset mysys/test_dir @@ -922,13 +1020,20 @@ ndbcluster-1186/ndb_3.pid ndbcluster-1186/ndb_3_cluster.log ndbcluster-1186/ndb_3_out.log ndbcluster-1186/ndbcluster.pid +pack_isam/*.ds? +perror/*.ds? +perror/*.vcproj pull.log +regex/*.ds? +regex/*.vcproj regex/re repl-tests/test-repl-ts/repl-timestamp.master.reject repl-tests/test-repl/foo-dump-slave.master. repl-tests/test-repl/sum-wlen-slave.master. repl-tests/test-repl/sum-wlen-slave.master.re repl-tests/test-repl/sum-wlen-slave.master.reje +replace/*.ds? +replace/*.vcproj scripts/fill_func_tables scripts/fill_func_tables.sql scripts/fill_help_tables @@ -959,11 +1064,31 @@ scripts/mysqlhotcopy scripts/mysqlhotcopy.sh.rej scripts/safe_mysqld select_test +server-tools/instance-manager/buffer.cpp server-tools/instance-manager/client.c server-tools/instance-manager/client_settings.h +server-tools/instance-manager/command.cpp +server-tools/instance-manager/commands.cpp server-tools/instance-manager/errmsg.c +server-tools/instance-manager/guardian.cpp +server-tools/instance-manager/instance.cpp +server-tools/instance-manager/instance_map.cpp +server-tools/instance-manager/instance_options.cpp +server-tools/instance-manager/listener.cpp +server-tools/instance-manager/log.cpp +server-tools/instance-manager/manager.cpp +server-tools/instance-manager/messages.cpp +server-tools/instance-manager/mysql_connection.cpp server-tools/instance-manager/mysqlmanager +server-tools/instance-manager/mysqlmanager.cpp +server-tools/instance-manager/options.cpp +server-tools/instance-manager/parse.cpp +server-tools/instance-manager/parse_output.cpp +server-tools/instance-manager/priv.cpp +server-tools/instance-manager/protocol.cpp server-tools/instance-manager/thr_alarm.c +server-tools/instance-manager/thread_registry.cpp +server-tools/instance-manager/user_map.cpp sql-bench/Results-linux/ATIS-mysql_bdb-Linux_2.2.14_my_SMP_i686 sql-bench/bench-count-distinct sql-bench/bench-init.pl @@ -992,11 +1117,19 @@ sql-bench/test-insert sql-bench/test-select sql-bench/test-transactions sql-bench/test-wisconsin +sql/*.cpp +sql/*.ds? +sql/*.vcproj sql/.gdbinit sql/client.c sql/gen_lex_hash sql/gmon.out +sql/handlerton.cc sql/lex_hash.h +sql/max/* +sql/message.h +sql/message.mc +sql/message.rc sql/mini_client_errors.c sql/my_time.c sql/mysql_tzinfo_to_sql @@ -1336,17 +1469,22 @@ storage/ndb/src/common/util/libgeneral.dsp storage/ndb/src/cw/cpcd/ndb_cpcd storage/ndb/src/dummy.cpp storage/ndb/src/kernel/blocks/backup/libbackup.dsp +storage/ndb/src/kernel/blocks/backup/ndb_print_backup_file storage/ndb/src/kernel/blocks/backup/restore/ndb_restore storage/ndb/src/kernel/blocks/cmvmi/libcmvmi.dsp storage/ndb/src/kernel/blocks/dbacc/libdbacc.dsp storage/ndb/src/kernel/blocks/dbdict/libdbdict.dsp +storage/ndb/src/kernel/blocks/dbdict/ndb_print_schema_file storage/ndb/src/kernel/blocks/dbdih/libdbdih.dsp +storage/ndb/src/kernel/blocks/dbdih/ndb_print_sys_file storage/ndb/src/kernel/blocks/dblqh/libdblqh.dsp storage/ndb/src/kernel/blocks/dbtc/libdbtc.dsp storage/ndb/src/kernel/blocks/dbtup/libdbtup.dsp +storage/ndb/src/kernel/blocks/dbtup/test_varpage storage/ndb/src/kernel/blocks/dbtux/libdbtux.dsp storage/ndb/src/kernel/blocks/dbutil/libdbutil.dsp storage/ndb/src/kernel/blocks/grep/libgrep.dsp +storage/ndb/src/kernel/blocks/ndb_print_file storage/ndb/src/kernel/blocks/ndbcntr/libndbcntr.dsp storage/ndb/src/kernel/blocks/ndbfs/libndbfs.dsp storage/ndb/src/kernel/blocks/qmgr/libqmgr.dsp @@ -1441,6 +1579,8 @@ storage/ndb/tools/ndb_show_tables.dsp storage/ndb/tools/ndb_test_platform storage/ndb/tools/ndb_waiter storage/ndb/tools/ndb_waiter.dsp +strings/*.ds? +strings/*.vcproj strings/conf_to_src strings/ctype_autoconf.c strings/ctype_extra_sources.c @@ -1521,10 +1661,15 @@ test/tools/hugoScanUpdate test/tools/ndb_cpcc test/tools/restart test/tools/verify_index +test1/* test_xml +tests/*.ds? +tests/*.vcproj tests/client_test tests/connect_test tests/mysql_client_test +thr_insert_test/* +thr_test/* thread_test tmp/* tools/my_vsnprintf.c @@ -1533,8 +1678,13 @@ tools/mysqlmngd tools/mysqltestmanager tools/mysys_priv.h vi.h +vio/*.ds? +vio/*.vcproj vio/test-ssl vio/test-sslclient vio/test-sslserver vio/viotest-ssl -libmysqld/sql_plugin.cc +vio/viotest-sslconnect.cpp +vio/viotest.cpp +zlib/*.ds? +zlib/*.vcproj diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh index cd1a348dfbc..eece41d72e6 100755 --- a/BUILD/SETUP.sh +++ b/BUILD/SETUP.sh @@ -57,7 +57,7 @@ global_warnings="-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wch c_warnings="$global_warnings -Wunused" cxx_warnings="$global_warnings -Woverloaded-virtual -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor" base_max_configs="--with-innodb --with-berkeley-db --with-ndbcluster --with-archive-storage-engine --with-big-tables --with-blackhole-storage-engine --with-federated-storage-engine --with-csv-storage-engine --with-partition $SSL_LIBRARY" -base_max_no_ndb_configs="--with-innodb --with-berkeley-db --without-ndbcluster --with-archive-storage-engine --with-big-tables --with-blackhole-storage-engine --with-federated-storage-engine --with-csv-storage-engine $SSL_LIBRARY" +base_max_no_ndb_configs="--with-innodb --with-berkeley-db --without-ndbcluster --with-archive-storage-engine --with-big-tables --with-blackhole-storage-engine --with-federated-storage-engine --with-csv-storage-engine --with-partition $SSL_LIBRARY" max_leave_isam_configs="--with-innodb --with-berkeley-db --with-ndbcluster --with-archive-storage-engine --with-federated-storage-engine --with-blackhole-storage-engine --with-csv-storage-engine --with-embedded-server --with-big-tables --with-partition $SSL_LIBRARY" max_configs="$base_max_configs --with-embedded-server" max_no_ndb_configs="$base_max_no_ndb_configs --with-embedded-server" diff --git a/BUILD/check-cpu b/BUILD/check-cpu index dc894c91cbd..583e31ee389 100755 --- a/BUILD/check-cpu +++ b/BUILD/check-cpu @@ -59,7 +59,7 @@ case "$cpu_family--$model_name" in ;; # Intel ia32 - *Xeon*) + *X[eE][oO][nN]*) # a Xeon is just another pentium4 ... # ... unless it has the "lm" (long-mode) flag set, # in that case it's a Xeon with EM64T support diff --git a/BUILD/compile-dist b/BUILD/compile-dist index a8d180eace1..6cc537cdf9c 100755 --- a/BUILD/compile-dist +++ b/BUILD/compile-dist @@ -45,6 +45,11 @@ fi # Make sure to enable all features that affect "make dist" ./configure \ --with-embedded-server \ + --with-archive-storage-engine \ + --with-blackhole-storage-engine \ + --with-csv-storage-engine \ + --with-example-storage-engine \ + --with-federated-storage-engine \ --with-berkeley-db \ --with-innodb \ --enable-thread-safe-client \ diff --git a/BUILD/compile-pentium64-valgrind-max b/BUILD/compile-pentium64-valgrind-max index 2e4ff8e0082..ef932920130 100755 --- a/BUILD/compile-pentium64-valgrind-max +++ b/BUILD/compile-pentium64-valgrind-max @@ -3,13 +3,13 @@ path=`dirname $0` . "$path/SETUP.sh" -extra_flags="$pentium64_cflags $debug_cflags -USAFEMALLOC -UFORCE_INIT_OF_VARS -DHAVE_purify -DMYSQL_SERVER_SUFFIX=-valgrind-max" +extra_flags="$pentium64_cflags $debug_cflags $max_cflags -USAFEMALLOC -UFORCE_INIT_OF_VARS -DHAVE_purify -DMYSQL_SERVER_SUFFIX=-valgrind-max" c_warnings="$c_warnings $debug_extra_warnings" cxx_warnings="$cxx_warnings $debug_extra_warnings" extra_configs="$pentium_configs $debug_configs" # We want to test isam when building with valgrind -extra_configs="$extra_configs --with-berkeley-db --with-innodb --with-isam --with-embedded-server --with-openssl --with-raid --with-ndbcluster" +extra_configs="$extra_configs $max_leave_isam_configs --with-isam" . "$path/FINISH.sh" diff --git a/BUILD/compile-sap b/BUILD/compile-sap deleted file mode 100755 index 376afaf6f56..00000000000 --- a/BUILD/compile-sap +++ /dev/null @@ -1,9 +0,0 @@ -#! /bin/sh - -path=`dirname $0` -. "$path/SETUP.sh" - -extra_flags="$pentium_cflags" -extra_configs="$pentium_configs --without-berkeley-db" - -. "$path/FINISH.sh" diff --git a/BUILD/compile-sap-debug b/BUILD/compile-sap-debug deleted file mode 100755 index d7e70f868cc..00000000000 --- a/BUILD/compile-sap-debug +++ /dev/null @@ -1,9 +0,0 @@ -#! /bin/sh - -path=`dirname $0` -. "$path/SETUP.sh" - -extra_flags="$pentium_cflags $debug_cflags" -extra_configs="$pentium_configs $debug_configs --without-berkeley-db $static_link" - -. "$path/FINISH.sh" diff --git a/Docs/Makefile.am b/Docs/Makefile.am index b1f69381774..542c82d8f58 100644 --- a/Docs/Makefile.am +++ b/Docs/Makefile.am @@ -18,11 +18,11 @@ noinst_SCRIPTS = Support/generate-text-files.pl EXTRA_DIST = $(noinst_SCRIPTS) mysql.info INSTALL-BINARY -all: txt_files - -txt_files: ../INSTALL-SOURCE ../INSTALL-WIN-SOURCE ../EXCEPTIONS-CLIENT \ +TXT_FILES= ../INSTALL-SOURCE ../INSTALL-WIN-SOURCE ../EXCEPTIONS-CLIENT \ INSTALL-BINARY ../support-files/MacOSX/ReadMe.txt +all-local: $(TXT_FILES) + # make sure that "make install" installs the info page, too # automake only seems to take care of this automatically, # if we're building the info page from texi directly. @@ -30,28 +30,37 @@ install-data-hook: mysql.info $(mkinstalldirs) $(DESTDIR)$(infodir) $(INSTALL_DATA) $(srcdir)/mysql.info $(DESTDIR)$(infodir) -CLEAN_FILES: $(txt_files) - touch $(txt_files) +uninstall-local: + @RM@ -f $(DESTDIR)$(infodir)/mysql.info + +# Problems with "make distclean", works differently for make files +# generated by different versions of the automake. Some require the +# generated files explicitly in DISTCLEANFILES. +DISTCLEANFILES = $(TXT_FILES) + +# This target is not used in builds, just for convinience +CLEAN_FILES: $(TXT_FILES) + touch $(TXT_FILES) GT = $(srcdir)/Support/generate-text-files.pl ../INSTALL-SOURCE: mysql.info $(GT) - perl -w $(GT) mysql.info "installing-source" "windows-source-build" > $@ + perl -w $(GT) $< "installing-source" "windows-source-build" > $@ ../INSTALL-WIN-SOURCE: mysql.info $(GT) - perl -w $(GT) mysql.info "windows-source-build" "post-installation" > $@ + perl -w $(GT) $< "windows-source-build" "post-installation" > $@ # We put the description for the binary installation here so that # people who download source wont have to see it. It is moved up to # the toplevel by the script that makes the binary tar files. INSTALL-BINARY: mysql.info $(GT) - perl -w $(GT) mysql.info "installing-binary" "installing-source" > $@ + perl -w $(GT) $< "installing-binary" "installing-source" > $@ ../EXCEPTIONS-CLIENT: mysql.info $(GT) - perl -w $(GT) mysql.info "mysql-floss-license-exception" "function-index" > $@ + perl -w $(GT) $< "mysql-floss-license-exception" "function-index" > $@ ../support-files/MacOSX/ReadMe.txt: mysql.info $(GT) - perl -w $(GT) mysql.info "mac-os-x-installation" "netware-installation" > $@ + perl -w $(GT) $< "mac-os-x-installation" "netware-installation" > $@ # Don't update the files from bitkeeper %::SCCS/s.% diff --git a/Makefile.am b/Makefile.am index 16cd8fcffd1..e78a762af53 100644 --- a/Makefile.am +++ b/Makefile.am @@ -19,7 +19,8 @@ AUTOMAKE_OPTIONS = foreign # These are built from source in the Docs directory -EXTRA_DIST = INSTALL-SOURCE README COPYING EXCEPTIONS-CLIENT +EXTRA_DIST = INSTALL-SOURCE INSTALL-WIN-SOURCE \ + README COPYING EXCEPTIONS-CLIENT SUBDIRS = . include @docs_dirs@ @zlib_dir@ @yassl_dir@ \ @readline_topdir@ sql-common \ @thread_dirs@ pstack \ @@ -37,16 +38,19 @@ DIST_SUBDIRS = . include @docs_dirs@ zlib \ BUILD netware os2 @libmysqld_dirs@\ @bench_dirs@ support-files server-tools tools -# Relink after clean -linked_sources = linked_client_sources linked_server_sources \ - linked_libmysql_sources linked_libmysql_r_sources \ - linked_libmysqld_sources linked_libmysqldex_sources \ +# Run these targets before any others, also make part of clean target, +# to make sure we create new links after a clean. +BUILT_SOURCES = linked_client_sources linked_server_sources \ + @linked_client_targets@ \ + @linked_libmysqld_targets@ \ linked_include_sources @linked_netware_sources@ -CLEANFILES = $(linked_sources) - -# This is just so that the linking is done early. -all-local: $(linked_sources) +# The db.h file is a bit special, see note in "configure.in". +# In the case we didn't compile with bdb, a dummy file is put +# there, but will not be removed by the bdb make file becuase +# it will never be called. +CLEANFILES = $(BUILT_SOURCES) bdb/build_unix/db.h +DISTCLEANFILES = ac_available_languages_fragment linked_include_sources: cd include; $(MAKE) link_sources @@ -76,13 +80,8 @@ linked_netware_sources: cd @netware_dir@; $(MAKE) link_sources echo timestamp > linked_netware_sources -#avoid recursive make calls in sql directory linked_server_sources: - cd sql; rm -f mini_client_errors.c;\ - @LN_CP_F@ ../libmysql/errmsg.c mini_client_errors.c;\ - rm -f pack.c;@LN_CP_F@ ../sql-common/pack.c pack.c;\ - rm -f client.c;@LN_CP_F@ ../sql-common/client.c client.c;\ - rm -f my_time.c;@LN_CP_F@ ../sql-common/my_time.c my_time.c + cd sql; $(MAKE) link_sources echo timestamp > linked_server_sources # Create permission databases @@ -94,7 +93,7 @@ bin-dist: all # Remove BK's "SCCS" subdirectories from source distribution dist-hook: - rm -rf `find $(distdir) -type d -name SCCS` + rm -rf `find $(distdir) -type d -name SCCS -print` tags: support-files/build-tags diff --git a/VC++Files/libmysqld/libmysqld.vcproj b/VC++Files/libmysqld/libmysqld.vcproj index eb411f79362..32a2e098564 100644 --- a/VC++Files/libmysqld/libmysqld.vcproj +++ b/VC++Files/libmysqld/libmysqld.vcproj @@ -21,8 +21,8 @@ + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -304,7 +304,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -312,7 +312,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -340,7 +340,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -348,7 +348,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -376,7 +376,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -384,7 +384,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -412,7 +412,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -420,7 +420,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -448,7 +448,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -456,7 +456,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -484,7 +484,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -492,7 +492,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -520,7 +520,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -528,7 +528,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -556,7 +556,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -564,7 +564,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -592,7 +592,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -600,7 +600,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -628,7 +628,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -636,7 +636,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -664,7 +664,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -672,7 +672,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -700,7 +700,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -708,7 +708,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -736,7 +736,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -744,7 +744,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -772,7 +772,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -780,7 +780,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + Name="pro|Win32" + ExcludedFromBuild="TRUE"> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> + Name="Release|Win32" + ExcludedFromBuild="TRUE"> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + Name="classic|Win32" + ExcludedFromBuild="TRUE"> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -844,7 +847,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -852,7 +855,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -880,15 +883,16 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + Name="classic|Win32" + ExcludedFromBuild="TRUE"> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -916,7 +920,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -924,7 +928,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -952,7 +956,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -960,7 +964,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -988,7 +992,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -996,7 +1000,43 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + + + + + + + + + + + + + + + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -1024,7 +1064,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -1032,7 +1072,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -1060,7 +1100,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -1068,7 +1108,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -1096,7 +1136,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -1104,7 +1144,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -1132,7 +1172,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -1140,7 +1180,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -1168,7 +1208,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -1176,7 +1216,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -1204,7 +1244,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -1212,7 +1252,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -1240,7 +1280,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -1248,7 +1288,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -1276,7 +1316,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -1284,7 +1324,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -1312,7 +1352,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -1320,7 +1360,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -1348,7 +1388,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -1356,7 +1396,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -1384,7 +1424,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -1392,7 +1432,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -1420,7 +1460,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -1428,7 +1468,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -1456,7 +1496,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -1464,7 +1504,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -1492,7 +1532,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -1500,7 +1540,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -1528,7 +1568,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -1536,7 +1576,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -1564,7 +1604,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -1572,7 +1612,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -1600,7 +1640,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -1608,7 +1648,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -1636,7 +1676,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -1644,7 +1684,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -1672,7 +1712,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -1680,7 +1720,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -1708,7 +1748,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -1716,7 +1756,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -1747,7 +1787,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -1755,7 +1795,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -1783,7 +1823,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -1791,7 +1831,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -1819,7 +1859,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -1827,7 +1867,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -1855,7 +1895,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -1863,7 +1903,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -1891,7 +1931,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -1899,7 +1939,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -1927,7 +1967,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -1935,7 +1975,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -1963,7 +2003,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -1971,7 +2011,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -1999,7 +2039,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -2007,7 +2047,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -2035,7 +2075,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -2043,7 +2083,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -2071,7 +2111,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -2079,7 +2119,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -2107,7 +2147,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -2115,7 +2155,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -2143,7 +2183,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -2151,7 +2191,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -2179,7 +2219,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -2187,7 +2227,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -2215,7 +2255,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -2223,7 +2263,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -2251,7 +2291,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -2259,7 +2299,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -2287,7 +2327,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -2295,7 +2335,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -2323,7 +2363,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -2331,7 +2371,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -2359,7 +2399,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -2367,7 +2407,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -2395,7 +2435,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -2403,7 +2443,43 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + + + + + + + + + + + + + + + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -2431,7 +2507,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -2439,7 +2515,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -2467,7 +2543,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -2475,7 +2551,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -2503,7 +2579,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -2511,7 +2587,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -2539,7 +2615,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -2547,7 +2623,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -2575,7 +2651,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -2583,7 +2659,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -2611,7 +2687,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -2619,7 +2695,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -2647,7 +2723,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -2655,7 +2731,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -2683,7 +2759,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -2691,7 +2767,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -2719,7 +2795,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -2727,7 +2803,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -2755,7 +2831,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -2763,7 +2839,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -2791,7 +2867,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -2799,7 +2875,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -2827,7 +2903,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -2835,7 +2911,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -2863,7 +2939,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -2871,7 +2947,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -2899,7 +2975,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -2907,7 +2983,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -2935,7 +3011,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -2943,7 +3019,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -2971,7 +3047,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -2979,7 +3055,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -3007,7 +3083,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -3015,7 +3091,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -3043,7 +3119,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -3051,7 +3127,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -3079,7 +3155,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -3087,7 +3163,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -3115,7 +3191,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -3123,7 +3199,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -3151,7 +3227,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -3159,7 +3235,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -3187,7 +3263,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -3195,7 +3271,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -3223,7 +3299,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -3231,7 +3307,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -3259,7 +3335,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -3267,7 +3343,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -3295,7 +3371,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -3303,7 +3379,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -3331,7 +3407,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -3339,7 +3415,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -3367,7 +3443,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -3375,7 +3451,79 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -3403,7 +3551,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -3411,7 +3559,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -3439,7 +3587,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -3447,7 +3595,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -3475,7 +3623,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -3483,7 +3631,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -3511,7 +3659,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -3519,7 +3667,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -3547,7 +3695,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -3555,7 +3703,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -3583,7 +3731,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -3591,7 +3739,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -3619,7 +3767,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -3627,7 +3775,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -3655,7 +3803,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -3663,7 +3811,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -3691,7 +3839,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -3699,7 +3847,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -3727,7 +3875,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -3735,7 +3883,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -3763,7 +3911,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -3771,7 +3919,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -3799,7 +3947,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -3807,7 +3955,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -3835,7 +3983,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -3843,7 +3991,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -3871,7 +4019,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -3879,7 +4027,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -3907,7 +4055,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -3915,7 +4063,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -3943,7 +4091,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -3951,7 +4099,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -3979,7 +4127,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -3987,7 +4135,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -4015,7 +4163,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -4023,7 +4171,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -4051,7 +4199,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -4059,7 +4207,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -4087,7 +4235,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -4095,7 +4243,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -4123,7 +4271,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -4131,7 +4279,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -4159,7 +4307,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -4167,7 +4315,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -4195,7 +4343,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -4203,7 +4351,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -4231,7 +4379,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -4239,7 +4387,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -4267,7 +4415,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -4275,7 +4423,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -4303,7 +4451,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -4311,7 +4459,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -4339,7 +4487,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -4347,7 +4495,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -4375,7 +4523,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -4383,7 +4531,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -4411,7 +4559,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -4419,7 +4567,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -4447,7 +4595,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -4455,7 +4603,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/> @@ -4483,7 +4631,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/> @@ -4491,7 +4639,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> diff --git a/VC++Files/myisam_ftdump/myisam_ftdump.vcproj b/VC++Files/myisam_ftdump/myisam_ftdump.vcproj index 4d1013775fa..20c69b9f5bf 100644 --- a/VC++Files/myisam_ftdump/myisam_ftdump.vcproj +++ b/VC++Files/myisam_ftdump/myisam_ftdump.vcproj @@ -140,7 +140,7 @@ Name="Source Files" Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"> + RelativePath="..\storage\myisam\myisam_ftdump.c"> + RelativePath="..\storage\myisam\myisamchk.c"> + RelativePath="..\storage\myisam\myisamlog.c"> + RelativePath="..\storage\myisam\myisampack.c"> + Name="classic|Win32" + ExcludedFromBuild="TRUE"> + Name="classic nt|Win32" + ExcludedFromBuild="TRUE"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Name="classic|Win32" + ExcludedFromBuild="TRUE"> + Name="classic nt|Win32" + ExcludedFromBuild="TRUE"> + Name="nt|Win32" + ExcludedFromBuild="TRUE"> + Name="pro nt|Win32" + ExcludedFromBuild="TRUE"> + Name="pro|Win32" + ExcludedFromBuild="TRUE"> + Name="classic|Win32" + ExcludedFromBuild="TRUE"> + Name="Release|Win32" + ExcludedFromBuild="TRUE"> + Name="classic nt|Win32" + ExcludedFromBuild="TRUE"> + Name="nt|Win32" + ExcludedFromBuild="TRUE"> + Name="pro nt|Win32" + ExcludedFromBuild="TRUE"> + Name="pro|Win32" + ExcludedFromBuild="TRUE"> + Name="classic|Win32" + ExcludedFromBuild="TRUE"> + Name="Release|Win32" + ExcludedFromBuild="TRUE"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name="classic nt|Win32" + ExcludedFromBuild="TRUE"> + Name="nt|Win32" + ExcludedFromBuild="TRUE"> + Name="pro nt|Win32" + ExcludedFromBuild="TRUE"> + Name="pro|Win32" + ExcludedFromBuild="TRUE"> + Name="classic|Win32" + ExcludedFromBuild="TRUE"> + Name="Release|Win32" + ExcludedFromBuild="TRUE"> + Name="classic nt|Win32" + ExcludedFromBuild="TRUE"> + Name="classic|Win32" + ExcludedFromBuild="TRUE"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RelativePath="..\storage\myisammrg\myrg_rnext_same.c"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RelativePath="os_win32\os_truncate.c"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -190,7 +190,7 @@ Name="VCCustomBuildTool"/> diff --git a/VC++Files/storage/myisammrg/myisammrg.vcproj b/VC++Files/storage/myisammrg/myisammrg.vcproj index c620bdfb22b..b186eda538d 100644 --- a/VC++Files/storage/myisammrg/myisammrg.vcproj +++ b/VC++Files/storage/myisammrg/myisammrg.vcproj @@ -89,7 +89,7 @@ Name="VCCustomBuildTool"/> @@ -190,7 +190,7 @@ Name="VCCustomBuildTool"/> diff --git a/VC++Files/strings/strings.vcproj b/VC++Files/strings/strings.vcproj index 8e16a0c7221..9712217f742 100644 --- a/VC++Files/strings/strings.vcproj +++ b/VC++Files/strings/strings.vcproj @@ -683,6 +683,25 @@ PreprocessorDefinitions=""/> + + + + + + + + type == MYSQL_TYPE_TINY_BLOB)) ? 1 : 0; if (extended_insert) { - ulong length = lengths[i]; if (i == 0) dynstr_set(&extended_row,"("); else @@ -2267,19 +2279,19 @@ static void dump_table(char *table, char *db) { print_xml_tag1(md_result_file, "\t\t", "field name=", field->name, ""); - print_quoted_xml(md_result_file, row[i], lengths[i]); + print_quoted_xml(md_result_file, row[i], length); fputs("\n", md_result_file); } - else if (opt_hex_blob && is_blob) + else if (opt_hex_blob && is_blob && length) { /* sakaik got the idea to to provide blob's in hex notation. */ - char *ptr= row[i], *end= ptr+ lengths[i]; + char *ptr= row[i], *end= ptr + length; fputs("0x", md_result_file); for (; ptr < end ; ptr++) fprintf(md_result_file, "%02X", *((uchar *)ptr)); } else - unescape(md_result_file, row[i], lengths[i]); + unescape(md_result_file, row[i], length); } else { diff --git a/client/mysqlimport.c b/client/mysqlimport.c index 19d4ef16ef9..8694093f06b 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -59,7 +59,7 @@ static char *shared_memory_base_name=0; static struct my_option my_long_options[] = { #ifdef __NETWARE__ - {"auto-close", OPT_AUTO_CLOSE, "Auto close the screen on exit for Netware.", + {"autoclose", OPT_AUTO_CLOSE, "Auto close the screen on exit for Netware.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif {"character-sets-dir", OPT_CHARSETS_DIR, @@ -121,7 +121,7 @@ static struct my_option my_long_options[] = NO_ARG, 0, 0, 0, 0, 0, 0}, #endif {"port", 'P', "Port number to use for connection.", (gptr*) &opt_mysql_port, - (gptr*) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0, + (gptr*) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory).", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, diff --git a/client/mysqlshow.c b/client/mysqlshow.c index 8f6be6cf70b..504f0d9844b 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -157,7 +157,7 @@ int main(int argc, char **argv) static struct my_option my_long_options[] = { #ifdef __NETWARE__ - {"auto-close", OPT_AUTO_CLOSE, "Auto close the screen on exit for Netware.", + {"autoclose", OPT_AUTO_CLOSE, "Auto close the screen on exit for Netware.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif {"character-sets-dir", 'c', "Directory where character sets are.", @@ -188,7 +188,7 @@ static struct my_option my_long_options[] = "Password to use when connecting to server. If password is not given it's asked from the tty.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"port", 'P', "Port number to use for connection.", (gptr*) &opt_mysql_port, - (gptr*) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0, + (gptr*) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #ifdef __WIN__ {"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG, diff --git a/client/mysqltest.c b/client/mysqltest.c index 58c0928c36d..ba1b92b31a3 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -2763,7 +2763,7 @@ static struct my_option my_long_options[] = {"password", 'p', "Password to use when connecting to server.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"port", 'P', "Port number to use for connection.", (gptr*) &port, - (gptr*) &port, 0, GET_INT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0, 0}, + (gptr*) &port, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"ps-protocol", OPT_PS_PROTOCOL, "Use prepared statements protocol for communication", (gptr*) &ps_protocol, (gptr*) &ps_protocol, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -3314,20 +3314,23 @@ static int handle_error(const char *query, struct st_query *q, ((q->expected_errno[i].type == ERR_SQLSTATE) && (strcmp(q->expected_errno[i].code.sqlstate, err_sqlstate) == 0))) { - if (q->expected_errors == 1) + if (!disable_result_log) { - /* Only log error if there is one possible error */ - dynstr_append_mem(ds, "ERROR ", 6); - replace_dynstr_append(ds, err_sqlstate); - dynstr_append_mem(ds, ": ", 2); - replace_dynstr_append(ds, err_error); - dynstr_append_mem(ds,"\n",1); + if (q->expected_errors == 1) + { + /* Only log error if there is one possible error */ + dynstr_append_mem(ds, "ERROR ", 6); + replace_dynstr_append(ds, err_sqlstate); + dynstr_append_mem(ds, ": ", 2); + replace_dynstr_append(ds, err_error); + dynstr_append_mem(ds,"\n",1); + } + /* Don't log error if we may not get an error */ + else if (q->expected_errno[0].type == ERR_SQLSTATE || + (q->expected_errno[0].type == ERR_ERRNO && + q->expected_errno[0].code.errnum != 0)) + dynstr_append(ds,"Got one of the listed errors\n"); } - /* Don't log error if we may not get an error */ - else if (q->expected_errno[0].type == ERR_SQLSTATE || - (q->expected_errno[0].type == ERR_ERRNO && - q->expected_errno[0].code.errnum != 0)) - dynstr_append(ds,"Got one of the listed errors\n"); /* OK */ DBUG_RETURN(0); } @@ -3335,11 +3338,14 @@ static int handle_error(const char *query, struct st_query *q, DBUG_PRINT("info",("i: %d expected_errors: %d", i, q->expected_errors)); - dynstr_append_mem(ds, "ERROR ",6); - replace_dynstr_append(ds, err_sqlstate); - dynstr_append_mem(ds, ": ", 2); - replace_dynstr_append(ds, err_error); - dynstr_append_mem(ds, "\n", 1); + if (!disable_result_log) + { + dynstr_append_mem(ds, "ERROR ",6); + replace_dynstr_append(ds, err_sqlstate); + dynstr_append_mem(ds, ": ", 2); + replace_dynstr_append(ds, err_error); + dynstr_append_mem(ds, "\n", 1); + } if (i) { diff --git a/cmd-line-utils/libedit/Makefile.am b/cmd-line-utils/libedit/Makefile.am index af1bf8b2c97..ae6755f1c5c 100644 --- a/cmd-line-utils/libedit/Makefile.am +++ b/cmd-line-utils/libedit/Makefile.am @@ -2,8 +2,8 @@ # Makefile for the GNU readline library. # Copyright (C) 1994,1996,1997 Free Software Foundation, Inc. -ASRC=vi.c emacs.c common.c -AHDR=vi.h emacs.h common.h +ASRC = $(srcdir)/vi.c $(srcdir)/emacs.c $(srcdir)/common.c +AHDR = vi.h emacs.h common.h INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \ -I$(srcdir)/../.. -I.. @@ -42,16 +42,16 @@ SUFFIXES = .sh $< > $@-t @MV@ $@-t $@ -vi.h: vi.c makelist - sh ./makelist -h ./vi.c > $@.tmp && \ +vi.h: $(srcdir)/vi.c makelist + sh ./makelist -h $(srcdir)/vi.c > $@.tmp && \ mv $@.tmp $@ -emacs.h: emacs.c makelist - sh ./makelist -h ./emacs.c > $@.tmp && \ +emacs.h: $(srcdir)/emacs.c makelist + sh ./makelist -h $(srcdir)/emacs.c > $@.tmp && \ mv $@.tmp $@ -common.h: common.c makelist - sh ./makelist -h ./common.c > $@.tmp && \ +common.h: $(srcdir)/common.c makelist + sh ./makelist -h $(srcdir)/common.c > $@.tmp && \ mv $@.tmp $@ help.c: ${ASRC} makelist diff --git a/config/ac-macros/yassl.m4 b/config/ac-macros/yassl.m4 index 9d9a4d55000..77208faee0c 100644 --- a/config/ac-macros/yassl.m4 +++ b/config/ac-macros/yassl.m4 @@ -16,28 +16,28 @@ AC_DEFUN([MYSQL_CHECK_YASSL], [ AC_MSG_RESULT([using bundled yaSSL]) yassl_dir="extra/yassl" yassl_libs="-L\$(top_srcdir)/extra/yassl/src -lyassl -L\$(top_srcdir)/extra/yassl/taocrypt/src -ltaocrypt" - yassl_libs_with_path="\$(top_srcdir)/extra/yassl/src/libyassl.a \$(top_srcdir)/extra/yassl/taocrypt/src/libtaocrypt.a" yassl_includes="-I\$(top_srcdir)/extra/yassl/include" + yassl_libs_with_path="\$(top_srcdir)/extra/yassl/src/libyassl.la \$(top_srcdir)/extra/yassl/taocrypt/src/libtaocrypt.la" AC_DEFINE([HAVE_OPENSSL], [1], [Defined by configure. Using yaSSL for OpenSSL emulation.]) AC_DEFINE([HAVE_YASSL], [1], [Defined by configure. Using yaSSL for OpenSSL emulation.]) # System specific checks yassl_integer_extra_cxxflags="" case $host_cpu--$CXX_VERSION in sparc*--*Sun*C++*5.6*) - # Disable inlining when compiling taocrypt/src/integer.cpp - yassl_integer_extra_cxxflags="+d" - AC_MSG_NOTICE([disabling inlining for yassl/taocrypt/src/integer.cpp]) + # Disable inlining when compiling taocrypt/src/ + yassl_taocrypt_extra_cxxflags="+d" + AC_MSG_NOTICE([disabling inlining for yassl/taocrypt/src/]) ;; esac - AC_SUBST([yassl_integer_extra_cxxflags]) + AC_SUBST([yassl_taocrypt_extra_cxxflags]) else yassl_dir="" AC_MSG_RESULT(no) fi AC_SUBST(yassl_libs) + AC_SUBST(yassl_libs_with_path) AC_SUBST(yassl_includes) AC_SUBST(yassl_dir) - AC_SUBST(yassl_libs_with_path) AM_CONDITIONAL([HAVE_YASSL], [ test "with_yassl" = "yes" ]) ]) diff --git a/config/ac-macros/zlib.m4 b/config/ac-macros/zlib.m4 index 94a26f33dd3..ec55f19b98f 100644 --- a/config/ac-macros/zlib.m4 +++ b/config/ac-macros/zlib.m4 @@ -19,7 +19,7 @@ INCLUDES="$INCLUDES $ZLIB_INCLUDES" LIBS="$LIBS $ZLIB_LIBS" AC_CACHE_VAL([mysql_cv_compress], [AC_TRY_LINK([#include ], - [return compress(0, (unsigned long*) 0, "", 0);], + [return zlibCompileFlags();], [mysql_cv_compress="yes" AC_MSG_RESULT([ok])], [mysql_cv_compress="no"]) @@ -89,8 +89,9 @@ case $SYSTEM_TYPE in fi ;; *) - if test -f "$mysql_zlib_dir/lib/libz.a" -a \ - -f "$mysql_zlib_dir/include/zlib.h"; then + if test \( -f "$mysql_zlib_dir/lib/libz.a" -o -f "$mysql_zlib_dir/lib/libz.so" -o \ + -f "$mysql_zlib_dir/lib/libz.sl" -o -f "$mysql_zlib_dir/lib/libz.dylib" \) \ + -a -f "$mysql_zlib_dir/include/zlib.h"; then ZLIB_INCLUDES="-I$mysql_zlib_dir/include" ZLIB_LIBS="-L$mysql_zlib_dir/lib -lz" MYSQL_CHECK_ZLIB_DIR diff --git a/configure.in b/configure.in index 553449a493c..a01d962e3ea 100644 --- a/configure.in +++ b/configure.in @@ -6,8 +6,7 @@ AC_PREREQ(2.52)dnl Minimum Autoconf version required. AC_INIT(sql/mysqld.cc) AC_CANONICAL_SYSTEM # The Docs Makefile.am parses this line! -# Don't forget to also update the NDB lines below. -AM_INIT_AUTOMAKE(mysql, 5.1.2-alpha) +AM_INIT_AUTOMAKE(mysql, 5.1.4-alpha) AM_CONFIG_HEADER(config.h) PROTOCOL_VERSION=10 @@ -61,7 +60,6 @@ AC_DEFINE_UNQUOTED([DOT_FRM_VERSION], [$DOT_FRM_VERSION], [Version of .frm files]) AC_SUBST(SHARED_LIB_VERSION) AC_SUBST(AVAILABLE_LANGUAGES) -AC_SUBST(AVAILABLE_LANGUAGES_ERRORS) # Canonicalize the configuration name. @@ -311,6 +309,10 @@ case "$target_os" in # Use the built-in alloca() CFLAGS="$CFLAGS -Kalloca" CXXFLAGS="$CFLAGS -Kalloca" + # Use no_implicit for templates + CXXFLAGS="$CXXFLAGS -Tno_implicit" + AC_DEFINE([HAVE_EXPLICIT_TEMPLATE_INSTANTIATION], + [1], [Defined by configure. Use explicit template instantiation.]) fi ;; esac @@ -1533,6 +1535,19 @@ if expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null; then OPTIMIZE_CXXFLAGS="-O3 -DNDEBUG" fi +# If the user specified CFLAGS, we won't add any optimizations +if test -n "$SAVE_CFLAGS" +then + OPTIMIZE_CFLAGS="" + DEBUG_OPTIMIZE_CC="" +fi +# Ditto for CXXFLAGS +if test -n "$SAVE_CXXFLAGS" +then + OPTIMIZE_CXXFLAGS="" + DEBUG_OPTIMIZE_CXX="" +fi + AC_ARG_WITH(debug, [ --without-debug Build a production version without debugging code], [with_debug=$withval], @@ -1804,7 +1819,7 @@ AC_CHECK_FUNCS(alarm bcmp bfill bmove bzero chsize cuserid fchmod fcntl \ getcwd gethostbyaddr_r gethostbyname_r getpass getpassphrase getpwnam \ getpwuid getrlimit getrusage getwd gmtime_r index initgroups isnan \ localtime_r locking longjmp lrand48 madvise mallinfo memcpy memmove \ - mkstemp mlockall perror poll pread pthread_attr_create mmap getpagesize \ + mkstemp mlockall perror poll pread pthread_attr_create mmap mmap64 getpagesize \ pthread_attr_getstacksize pthread_attr_setprio pthread_attr_setschedparam \ pthread_attr_setstacksize pthread_condattr_create pthread_getsequence_np \ pthread_key_delete pthread_rwlock_rdlock pthread_setprio \ @@ -2165,6 +2180,7 @@ then AC_MSG_WARN([extra-tools disabled because --enable-thread-safe-client wasn't used]) else tools_dirs="tools" + AC_CONFIG_FILES(tools/Makefile) fi fi @@ -2186,9 +2202,12 @@ MYSQL_CHECK_OPENSSL MYSQL_CHECK_YASSL libmysqld_dirs= +linked_libmysqld_targets= if test "$with_embedded_server" = "yes" then libmysqld_dirs=libmysqld + linked_libmysqld_targets="linked_libmysqld_sources linked_libmysqldex_sources" + AC_CONFIG_FILES(libmysqld/Makefile libmysqld/examples/Makefile) # We can't build embedded library without building the server, because # we depend on libmysys, libmystrings, libmyisam, etc. with_server=yes @@ -2197,6 +2216,7 @@ fi # mysql_config --libmysqld-libs will print out something like # -L/path/to/lib/mysql -lmysqld -lmyisam -lmysys -lmystrings -ldbug ... AC_SUBST([libmysqld_dirs]) +AC_SUBST([linked_libmysqld_targets]) # Shall we build the docs? AC_ARG_WITH(docs, @@ -2301,7 +2321,7 @@ then readline_basedir="libedit" readline_dir="$readline_topdir/$readline_basedir" readline_link="\$(top_builddir)/cmd-line-utils/libedit/libedit.a" - readline_h_ln_cmd="\$(LN) -s \$(top_builddir)/cmd-line-utils/libedit/readline readline" + readline_h_ln_cmd="\$(LN) -s \$(top_srcdir)/cmd-line-utils/libedit/readline readline" compile_libedit=yes AC_DEFINE_UNQUOTED(HAVE_HIST_ENTRY, 1) AC_DEFINE_UNQUOTED(USE_LIBEDIT_INTERFACE, 1) @@ -2311,7 +2331,7 @@ then readline_basedir="readline" readline_dir="$readline_topdir/$readline_basedir" readline_link="\$(top_builddir)/cmd-line-utils/readline/libreadline.a" - readline_h_ln_cmd="\$(LN) -s \$(top_builddir)/cmd-line-utils/readline readline" + readline_h_ln_cmd="\$(LN) -s \$(top_srcdir)/cmd-line-utils/readline readline" compile_readline=yes AC_DEFINE_UNQUOTED(USE_NEW_READLINE_INTERFACE, 1) else @@ -2416,6 +2436,7 @@ if test "$THREAD_SAFE_CLIENT" != "no" then sql_client_dirs="libmysql_r $sql_client_dirs" linked_client_targets="$linked_client_targets linked_libmysql_r_sources" + AC_CONFIG_FILES(libmysql_r/Makefile) AC_DEFINE([THREAD_SAFE_CLIENT], [1], [Should be client be thread safe]) fi @@ -2504,7 +2525,7 @@ case $SYSTEM_TYPE in esac for CONF in $other_configures; do - (cd `dirname $CONF`; ./`basename $CONF`) + (cd `dirname $CONF`; ./`basename $CONF` --build=$build_alias) done AC_SUBST(MAKE_BINARY_DISTRIBUTION_OPTIONS) @@ -2515,12 +2536,11 @@ AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl storage/myisam/Makefile storage/myisammrg/Makefile dnl os2/Makefile os2/include/Makefile os2/include/sys/Makefile dnl man/Makefile BUILD/Makefile vio/Makefile dnl - libmysql_r/Makefile libmysqld/Makefile libmysqld/examples/Makefile dnl libmysql/Makefile client/Makefile dnl pstack/Makefile pstack/aout/Makefile sql/Makefile sql/share/Makefile dnl sql/handlerton.cc sql-common/Makefile SSL/Makefile dnl dbug/Makefile scripts/Makefile dnl - include/Makefile sql-bench/Makefile tools/Makefile dnl + include/Makefile sql-bench/Makefile dnl server-tools/Makefile server-tools/instance-manager/Makefile dnl tests/Makefile Docs/Makefile support-files/Makefile dnl support-files/MacOSX/Makefile mysql-test/Makefile dnl diff --git a/extra/Makefile.am b/extra/Makefile.am index feb96cdaf24..a2b4dce374a 100644 --- a/extra/Makefile.am +++ b/extra/Makefile.am @@ -23,6 +23,9 @@ BUILT_SOURCES= $(top_builddir)/include/mysqld_error.h \ $(top_builddir)/include/mysqld_ername.h pkginclude_HEADERS= $(BUILT_SOURCES) CLEANFILES = $(BUILT_SOURCES) +# We never use SUBDIRS here, but needed for automake 1.6.3 +# to generate code to handle DIST_SUBDIRS +SUBDIRS= DIST_SUBDIRS= yassl # This will build mysqld_error.h and sql_state.h diff --git a/extra/innochecksum.c b/extra/innochecksum.c index 739953298af..bae5f3e8821 100644 --- a/extra/innochecksum.c +++ b/extra/innochecksum.c @@ -28,6 +28,8 @@ #define _LARGEFILE_SOURCE #define _LARGEFILE64_SOURCE +#define _XOPEN_SOURCE /* needed to include getopt.h on some platforms. */ + #include #include #include diff --git a/extra/yassl/Makefile.am b/extra/yassl/Makefile.am index 7c1f2ea5acb..7ec49ec8c33 100644 --- a/extra/yassl/Makefile.am +++ b/extra/yassl/Makefile.am @@ -1,2 +1,2 @@ SUBDIRS = taocrypt src -EXTRA_DIST = yassl.dsp yassl.dsw mySTL/*.hpp +EXTRA_DIST = yassl.dsp yassl.dsw yassl.vcproj $(wildcard mySTL/*.hpp) diff --git a/extra/yassl/src/Makefile.am b/extra/yassl/src/Makefile.am index 4ebb9a2d862..a852ca4019b 100644 --- a/extra/yassl/src/Makefile.am +++ b/extra/yassl/src/Makefile.am @@ -1,8 +1,8 @@ INCLUDES = -I../include -I../taocrypt/include -I../mySTL -noinst_LIBRARIES = libyassl.a -libyassl_a_SOURCES = buffer.cpp cert_wrapper.cpp crypto_wrapper.cpp \ +noinst_LTLIBRARIES = libyassl.la +libyassl_la_SOURCES = buffer.cpp cert_wrapper.cpp crypto_wrapper.cpp \ handshake.cpp lock.cpp log.cpp socket_wrapper.cpp ssl.cpp \ template_instnt.cpp timer.cpp yassl_imp.cpp yassl_error.cpp yassl_int.cpp -EXTRA_DIST = ../include/*.hpp ../include/openssl/*.h +EXTRA_DIST = $(wildcard ../include/*.hpp) $(wildcard ../include/openssl/*.h) AM_CXXFLAGS = -DYASSL_PURE_C diff --git a/extra/yassl/src/socket_wrapper.cpp b/extra/yassl/src/socket_wrapper.cpp index 91cea1f9753..285e0dee2e5 100644 --- a/extra/yassl/src/socket_wrapper.cpp +++ b/extra/yassl/src/socket_wrapper.cpp @@ -39,7 +39,7 @@ #include #endif // _WIN32 -#ifdef __sun +#if defined(__sun) || defined(__SCO_VERSION__) #include #endif diff --git a/extra/yassl/src/timer.cpp b/extra/yassl/src/timer.cpp index 4fe0d3aa4f9..8b7d2d17a84 100644 --- a/extra/yassl/src/timer.cpp +++ b/extra/yassl/src/timer.cpp @@ -26,13 +26,17 @@ #include "runtime.hpp" #include "timer.hpp" +#ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN +#include +#else +#include +#endif + namespace yaSSL { #ifdef _WIN32 - #define WIN32_LEAN_AND_MEAN - #include - timer_d timer() { static bool init(false); @@ -57,8 +61,6 @@ namespace yaSSL { #else // _WIN32 - #include - timer_d timer() { struct timeval tv; diff --git a/extra/yassl/taocrypt/Makefile.am b/extra/yassl/taocrypt/Makefile.am index af3ded7abfd..c8413af3285 100644 --- a/extra/yassl/taocrypt/Makefile.am +++ b/extra/yassl/taocrypt/Makefile.am @@ -1,2 +1,2 @@ SUBDIRS = src -EXTRA_DIST = taocrypt.dsw taocrypt.dsp +EXTRA_DIST = taocrypt.dsw taocrypt.dsp taocrypt.vcproj diff --git a/extra/yassl/taocrypt/src/Makefile.am b/extra/yassl/taocrypt/src/Makefile.am index 9ce083e9e56..d89fa95a940 100644 --- a/extra/yassl/taocrypt/src/Makefile.am +++ b/extra/yassl/taocrypt/src/Makefile.am @@ -1,15 +1,11 @@ INCLUDES = -I../include -I../../mySTL -noinst_LIBRARIES = libtaoint.a libtaocrypt.a +noinst_LTLIBRARIES = libtaocrypt.la -libtaoint_a_SOURCES = integer.cpp -libtaoint_a_CXXFLAGS = @yassl_integer_extra_cxxflags@ - -libtaocrypt_a_SOURCES = aes.cpp aestables.cpp algebra.cpp arc4.cpp asn.cpp \ +libtaocrypt_la_SOURCES = aes.cpp aestables.cpp algebra.cpp arc4.cpp asn.cpp \ coding.cpp dh.cpp des.cpp dsa.cpp file.cpp hash.cpp \ md2.cpp md5.cpp misc.cpp random.cpp ripemd.cpp rsa.cpp sha.cpp \ - template_instnt.cpp -libtaocrypt_a_LIBADD = libtaoint_a-integer.o + template_instnt.cpp integer.cpp +libtaocrypt_la_CXXFLAGS = @yassl_taocrypt_extra_cxxflags@ -DYASSL_PURE_C -EXTRA_DIST = ../include/*.hpp -AM_CXXFLAGS = -DYASSL_PURE_C +EXTRA_DIST = $(wildcard ../include/*.hpp) diff --git a/include/Makefile.am b/include/Makefile.am index 8c3a575453d..d2605628a7d 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -38,20 +38,12 @@ CLEANFILES = mysql_version.h my_config.h readline # Some include files that may be moved and patched by configure DISTCLEANFILES = sched.h $(CLEANFILES) -all-local: my_config.h - -# Since we include my_config.h it better exist from the beginning link_sources: - $(CP) ../config.h my_config.h -$(RM) -fr readline @readline_h_ln_cmd@ -# Keep automake happy - my_config.h: ../config.h $(CP) ../config.h my_config.h - -$(RM) -fr readline - @readline_h_ln_cmd@ # These files should not be included in distributions since they are # generated by configure from the .h.in files diff --git a/include/config-win.h b/include/config-win.h index fe099c11a2f..edfb4ecc5c7 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -279,10 +279,10 @@ inline double ulonglong2double(ulonglong value) *((T)+4)=(uchar) (((A) >> 32)); } #define int8store(T,A) *((ulonglong *) (T))= (ulonglong) (A) -#define doubleget(V,M) { *((long *) &V) = *((long*) M); \ - *(((long *) &V)+1) = *(((long*) M)+1); } -#define doublestore(T,V) { *((long *) T) = *((long*) &V); \ - *(((long *) T)+1) = *(((long*) &V)+1); } +#define doubleget(V,M) do { *((long *) &V) = *((long*) M); \ + *(((long *) &V)+1) = *(((long*) M)+1); } while(0) +#define doublestore(T,V) do { *((long *) T) = *((long*) &V); \ + *(((long *) T)+1) = *(((long*) &V)+1); } while(0) #define float4get(V,M) { *((long *) &(V)) = *((long*) (M)); } #define floatstore(T,V) memcpy((byte*)(T), (byte*)(&V), sizeof(float)) #define floatget(V,M) memcpy((byte*)(&V), (byte*)(M), sizeof(float)) @@ -392,8 +392,8 @@ inline double ulonglong2double(ulonglong value) #define HAVE_SPATIAL 1 #define HAVE_RTREE_KEYS 1 -#define HAVE_OPENSSL 1 -#define HAVE_YASSL 1 +/* #undef HAVE_OPENSSL */ +/* #undef HAVE_YASSL */ /* Define charsets you want */ /* #undef HAVE_CHARSET_armscii8 */ diff --git a/include/my_base.h b/include/my_base.h index c11e52fb996..c688591e1d5 100644 --- a/include/my_base.h +++ b/include/my_base.h @@ -152,7 +152,8 @@ enum ha_extra_function { other fields intact. When this is off (by default) InnoDB will use memcpy to overwrite entire row. */ - HA_EXTRA_KEYREAD_PRESERVE_FIELDS + HA_EXTRA_KEYREAD_PRESERVE_FIELDS, + HA_EXTRA_MMAP }; /* The following is parameter to ha_panic() */ @@ -244,7 +245,7 @@ enum ha_base_keytype { #define HA_OPTION_CHECKSUM 32 #define HA_OPTION_DELAY_KEY_WRITE 64 #define HA_OPTION_NO_PACK_KEYS 128 /* Reserved for MySQL */ -#define HA_OPTION_CREATE_FROM_ENGINE 256 +#define HA_OPTION_CREATE_FROM_ENGINE 256 #define HA_OPTION_TEMP_COMPRESS_RECORD ((uint) 16384) /* set by isamchk */ #define HA_OPTION_READ_ONLY_DATA ((uint) 32768) /* Set by isamchk */ @@ -256,15 +257,48 @@ enum ha_base_keytype { #define HA_CREATE_CHECKSUM 8 #define HA_CREATE_DELAY_KEY_WRITE 64 - /* Bits in flag to _status */ +/* + The following flags (OR-ed) are passed to handler::info() method. + The method copies misc handler information out of the storage engine + to data structures accessible from MySQL -#define HA_STATUS_POS 1 /* Return position */ -#define HA_STATUS_NO_LOCK 2 /* Don't use external lock */ -#define HA_STATUS_TIME 4 /* Return update time */ -#define HA_STATUS_CONST 8 /* Return constants values */ -#define HA_STATUS_VARIABLE 16 -#define HA_STATUS_ERRKEY 32 -#define HA_STATUS_AUTO 64 + Same flags are also passed down to mi_status, myrg_status, etc. +*/ + +/* this one is not used */ +#define HA_STATUS_POS 1 +/* + assuming the table keeps shared actual copy of the 'info' and + local, possibly outdated copy, the following flag means that + it should not try to get the actual data (locking the shared structure) + slightly outdated version will suffice +*/ +#define HA_STATUS_NO_LOCK 2 +/* update the time of the last modification (in handler::update_time) */ +#define HA_STATUS_TIME 4 +/* + update the 'constant' part of the info: + handler::max_data_file_length, max_index_file_length, create_time + sortkey, ref_length, block_size, data_file_name, index_file_name. + handler::table->s->keys_in_use, keys_for_keyread, rec_per_key +*/ +#define HA_STATUS_CONST 8 +/* + update the 'variable' part of the info: + handler::records, deleted, data_file_length, index_file_length, + delete_length, check_time, mean_rec_length +*/ +#define HA_STATUS_VARIABLE 16 +/* + get the information about the key that caused last duplicate value error + update handler::errkey and handler::dupp_ref + see handler::get_dup_key() +*/ +#define HA_STATUS_ERRKEY 32 +/* + update handler::auto_increment_value +*/ +#define HA_STATUS_AUTO 64 /* Errorcodes given by functions */ diff --git a/include/my_bitmap.h b/include/my_bitmap.h index b7ad575b2d3..33cd61de8a0 100644 --- a/include/my_bitmap.h +++ b/include/my_bitmap.h @@ -84,6 +84,7 @@ extern void bitmap_lock_xor(MY_BITMAP *map, const MY_BITMAP *map2); extern void bitmap_lock_invert(MY_BITMAP *map); #endif /* Fast, not thread safe, bitmap functions */ +#define bitmap_buffer_size(bits) 4*(((bits)+31)/32); #define no_bytes_in_map(map) (((map)->n_bits + 7)/8) #define no_words_in_map(map) (((map)->n_bits + 31)/32) #define bytes_word_aligned(bytes) (4*((bytes + 3)/4)) diff --git a/include/my_global.h b/include/my_global.h index be7b668fdc0..234cc2f64dc 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -641,6 +641,15 @@ typedef SOCKET_SIZE_TYPE size_socket; #define O_NOFOLLOW 0 #endif +/* additional file share flags for win32 */ +#ifdef __WIN__ +#define _SH_DENYRWD 0x110 /* deny read/write mode & delete */ +#define _SH_DENYWRD 0x120 /* deny write mode & delete */ +#define _SH_DENYRDD 0x130 /* deny read mode & delete */ +#define _SH_DENYDEL 0x140 /* deny delete only */ +#endif /* __WIN__ */ + + /* #define USE_RECORD_LOCK */ /* Unsigned types supported by the compiler */ @@ -653,11 +662,7 @@ 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_pthread.h b/include/my_pthread.h index ee2c801ff6e..6f60a6df2c1 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -536,9 +536,15 @@ void safe_mutex_end(FILE *file); #define pthread_cond_timedwait(A,B,C) safe_cond_timedwait((A),(B),(C),__FILE__,__LINE__) #define pthread_mutex_trylock(A) pthread_mutex_lock(A) #define pthread_mutex_t safe_mutex_t -#define safe_mutex_assert_owner(mp) DBUG_ASSERT((mp)->count > 0 && pthread_equal(pthread_self(),(mp)->thread)) +#define safe_mutex_assert_owner(mp) \ + DBUG_ASSERT((mp)->count > 0 && \ + pthread_equal(pthread_self(), (mp)->thread)) +#define safe_mutex_assert_not_owner(mp) \ + DBUG_ASSERT(! (mp)->count || \ + ! pthread_equal(pthread_self(), (mp)->thread)) #else #define safe_mutex_assert_owner(mp) +#define safe_mutex_assert_not_owner(mp) #endif /* SAFE_MUTEX */ /* READ-WRITE thread locking */ diff --git a/include/my_sys.h b/include/my_sys.h index 76031806b82..cda308f222a 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -601,6 +601,7 @@ extern char *_my_strdup_with_length(const byte *from, uint length, #ifdef __WIN__ extern int my_access(const char *path, int amode); +extern File my_sopen(const char *path, int oflag, int shflag, int pmode); #else #define my_access access #endif @@ -820,7 +821,11 @@ my_bool my_gethwaddr(uchar *to); #define MAP_NOSYNC 0 #endif +#ifdef HAVE_MMAP64 +#define my_mmap(a,b,c,d,e,f) mmap64(a,b,c,d,e,f) +#else #define my_mmap(a,b,c,d,e,f) mmap(a,b,c,d,e,f) +#endif #ifdef HAVE_GETPAGESIZE #define my_getpagesize() getpagesize() #else diff --git a/libmysql/Makefile.am b/libmysql/Makefile.am index 403ff415378..a3e16b521a9 100644 --- a/libmysql/Makefile.am +++ b/libmysql/Makefile.am @@ -22,14 +22,14 @@ target = libmysqlclient.la target_defs = -DUNDEF_THREADS_HACK -DDONT_USE_RAID @LIB_EXTRA_CCFLAGS@ -LIBS = @CLIENT_LIBS@ @yassl_libs@ +LIBS = @CLIENT_LIBS@ INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \ $(openssl_includes) $(yassl_includes) @ZLIB_INCLUDES@ include $(srcdir)/Makefile.shared libmysqlclient_la_SOURCES = $(target_sources) -libmysqlclient_la_LIBADD = $(target_libadd) +libmysqlclient_la_LIBADD = $(target_libadd) $(yassl_libs_with_path) libmysqlclient_la_LDFLAGS = $(target_ldflags) EXTRA_DIST = Makefile.shared libmysql.def noinst_HEADERS = client_settings.h @@ -43,33 +43,33 @@ link_sources: vs=`echo $(vio_objects) | sed "s;\.lo;.c;g"`; \ scs=`echo $(sql_cmn_objects) | sed "s;\.lo;.c;g"`; \ for f in $$ss; do \ - rm -f $(srcdir)/$$f; \ - @LN_CP_F@ $(srcdir)/../strings/$$f $(srcdir)/$$f; \ + rm -f $$f; \ + @LN_CP_F@ $(top_srcdir)/strings/$$f $$f; \ done; \ for f in $$vs $(vioheaders); do \ - rm -f $(srcdir)/$$f; \ - @LN_CP_F@ $(srcdir)/../vio/$$f $(srcdir)/$$f; \ + rm -f $$f; \ + @LN_CP_F@ $(top_srcdir)/vio/$$f $$f; \ done; \ for f in $$scs; do \ - rm -f $(srcdir)/$$f; \ - @LN_CP_F@ $(srcdir)/../sql-common/$$f $(srcdir)/$$f; \ + rm -f $$f; \ + @LN_CP_F@ $(top_srcdir)/sql-common/$$f $$f; \ done; \ for f in $(mystringsextra); do \ - rm -f $(srcdir)/$$f; \ - @LN_CP_F@ $(srcdir)/../strings/$$f $(srcdir)/$$f; \ + rm -f $$f; \ + @LN_CP_F@ $(top_srcdir)/strings/$$f $$f; \ done; \ for f in $$ds; do \ - rm -f $(srcdir)/$$f; \ - @LN_CP_F@ $(srcdir)/../dbug/$$f $(srcdir)/$$f; \ + rm -f $$f; \ + @LN_CP_F@ $(top_srcdir)/dbug/$$f $$f; \ done; \ for f in $$ms $(mysysheaders); do \ - rm -f $(srcdir)/$$f; \ - @LN_CP_F@ $(srcdir)/../mysys/$$f $(srcdir)/$$f; \ + rm -f $$f; \ + @LN_CP_F@ $(top_srcdir)/mysys/$$f $$f; \ done; \ - rm -f $(srcdir)/net.c; \ - @LN_CP_F@ $(srcdir)/../sql/net_serv.cc $(srcdir)/net.c ; \ - rm -f $(srcdir)/password.c; \ - @LN_CP_F@ $(srcdir)/../sql/password.c $(srcdir)/password.c + rm -f net.c; \ + @LN_CP_F@ $(top_srcdir)/sql/net_serv.cc net.c ; \ + rm -f password.c; \ + @LN_CP_F@ $(top_srcdir)/sql/password.c password.c # This part requires GNUmake # diff --git a/libmysql_r/Makefile.am b/libmysql_r/Makefile.am index 6ab09368cc5..ee6dd4cfded 100644 --- a/libmysql_r/Makefile.am +++ b/libmysql_r/Makefile.am @@ -39,6 +39,6 @@ libmysqlclient_r_la_LDFLAGS = $(target_ldflags) link_sources: set -x; \ for f in `cd $(libmysql_dir) && echo *.[ch]`; do \ - rm -f $(srcdir)/$$f; \ - @LN_CP_F@ $(libmysql_dir)/$$f $(srcdir)/$$f; \ + rm -f $$f; \ + @LN_CP_F@ $(libmysql_dir)/$$f $$f; \ done diff --git a/libmysqld/Makefile.am b/libmysqld/Makefile.am index 14125c79e10..da0418eaf9c 100644 --- a/libmysqld/Makefile.am +++ b/libmysqld/Makefile.am @@ -143,19 +143,19 @@ endif link_sources: set -x; \ for f in $(sqlsources); do \ - rm -f $(srcdir)/$$f; \ - @LN_CP_F@ $(srcdir)/../sql/$$f $(srcdir)/$$f; \ + rm -f $$f; \ + @LN_CP_F@ $(top_srcdir)/sql/$$f $$f; \ done; \ for f in $(libmysqlsources); do \ - rm -f $(srcdir)/$$f; \ - @LN_CP_F@ $(srcdir)/../libmysql/$$f $(srcdir)/$$f; \ + rm -f $$f; \ + @LN_CP_F@ $(top_srcdir)/libmysql/$$f $$f; \ done; \ for f in $(sqlstoragesources); do \ - rm -f $(srcdir)/$$f; \ - @LN_CP_F@ `find $(srcdir)/../sql -name $$f` $(srcdir)/$$f; \ + rm -f $$f; \ + @LN_CP_F@ `find $(srcdir)/../sql -name $$f` $$f; \ done; \ - rm -f $(srcdir)/client_settings.h; \ - @LN_CP_F@ $(srcdir)/../libmysql/client_settings.h $(srcdir)/client_settings.h; + rm -f client_settings.h; \ + @LN_CP_F@ $(top_srcdir)/libmysql/client_settings.h client_settings.h clean-local: diff --git a/libmysqld/examples/Makefile.am b/libmysqld/examples/Makefile.am index 0bd3f06a9f3..7ee8adfef80 100644 --- a/libmysqld/examples/Makefile.am +++ b/libmysqld/examples/Makefile.am @@ -21,20 +21,21 @@ tests_sources = $(mysql_client_test_embedded_SOURCES) CLEANFILES = $(client_sources) $(tests_sources) link_sources: + set -x; \ for f in $(client_sources); do \ - rm -f $(srcdir)/$$f; \ - @LN_CP_F@ $(srcdir)/../../client/$$f $(srcdir)/$$f; \ - done; + rm -f $$f; \ + @LN_CP_F@ $(top_srcdir)/client/$$f $$f; \ + done; \ for f in $(tests_sources); do \ - rm -f $(srcdir)/$$f; \ - @LN_CP_F@ $(srcdir)/../../tests/$$f $(srcdir)/$$f; \ - done; + rm -f $$f; \ + @LN_CP_F@ $(top_srcdir)/tests/$$f $$f; \ + done DEFS = -DEMBEDDED_LIBRARY INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir) \ -I$(top_srcdir) -I$(top_srcdir)/client -I$(top_srcdir)/regex \ - $(openssl_includes) -LIBS = @LIBS@ @WRAPLIBS@ @CLIENT_LIBS@ + $(openssl_includes) $(yassl_includes) +LIBS = @LIBS@ @WRAPLIBS@ @CLIENT_LIBS@ $(yassl_libs) LDADD = @CLIENT_EXTRA_LDFLAGS@ ../libmysqld.a @LIBDL@ $(CXXLDFLAGS) mysqltest_embedded_LINK = $(CXXLINK) diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am index 2142a84419e..a63b4cbf178 100644 --- a/mysql-test/Makefile.am +++ b/mysql-test/Makefile.am @@ -85,6 +85,9 @@ install-data-local: $(INSTALL_DATA) $(srcdir)/lib/init_db.sql $(DESTDIR)$(testdir)/lib $(INSTALL_DATA) $(srcdir)/lib/*.pl $(DESTDIR)$(testdir)/lib +uninstall-local: + @RM@ -f -r $(DESTDIR)$(testdir) + std_data/client-key.pem: @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data std_data/client-cert.pem: diff --git a/mysql-test/include/is_debug_build.inc b/mysql-test/include/is_debug_build.inc new file mode 100644 index 00000000000..23a2814e2bb --- /dev/null +++ b/mysql-test/include/is_debug_build.inc @@ -0,0 +1,4 @@ +-- require r/is_debug_build.require +--disable_query_log +select instr(version(), "debug") > 0; +--enable_query_log diff --git a/mysql-test/lib/mtr_misc.pl b/mysql-test/lib/mtr_misc.pl index 9a12d842998..a76f1b2d7b1 100644 --- a/mysql-test/lib/mtr_misc.pl +++ b/mysql-test/lib/mtr_misc.pl @@ -9,7 +9,7 @@ use strict; sub mtr_full_hostname (); sub mtr_short_hostname (); sub mtr_init_args ($); -sub mtr_add_arg ($$); +sub mtr_add_arg ($$@); sub mtr_path_exists(@); sub mtr_script_exists(@); sub mtr_exe_exists(@); @@ -51,7 +51,7 @@ sub mtr_init_args ($) { $$args = []; # Empty list } -sub mtr_add_arg ($$) { +sub mtr_add_arg ($$@) { my $args= shift; my $format= shift; my @fargs = @_; diff --git a/mysql-test/lib/mtr_stress.pl b/mysql-test/lib/mtr_stress.pl new file mode 100644 index 00000000000..a57d94e8043 --- /dev/null +++ b/mysql-test/lib/mtr_stress.pl @@ -0,0 +1,172 @@ +# -*- cperl -*- + +# This is a library file used by the Perl version of mysql-test-run, +# and is part of the translation of the Bourne shell script with the +# same name. + +use strict; +use File::Spec; + +# These are not to be prefixed with "mtr_" + +sub run_stress_test (); + +############################################################################## +# +# Run tests in the stress mode +# +############################################################################## + +sub run_stress_test () +{ + + my $args; + my $stress_basedir; + my $stress_suitedir; + + mtr_report("Starting stress testing\n"); + + if ( ! $::glob_use_embedded_server and ! $::opt_local_master ) + { + $::master->[0]->{'pid'}= mysqld_start('master',0,[],[]); + if ( ! $::master->[0]->{'pid'} ) + { + mtr_error("Can't start the mysqld server"); + } + } + + my $stress_basedir=File::Spec->catdir($::opt_vardir, "stress"); + + #Clean up stress dir + if ( -d $stress_basedir ) + { + rmtree($stress_basedir); + } + mkpath($stress_basedir); + + if ($::opt_stress_suite ne 'main' && $::opt_stress_suite ne 'default' ) + { + $stress_suitedir=File::Spec->catdir($::glob_mysql_test_dir, "suite", + $::opt_stress_suite); + } + else + { + $stress_suitedir=$::glob_mysql_test_dir; + } + + if ( -d $stress_suitedir ) + { + #$stress_suite_t_dir=File::Spec->catdir($stress_suitedir, "t"); + #$stress_suite_r_dir=File::Spec->catdir($stress_suitedir, "r"); + #FIXME: check dirs above for existence to ensure that test suite + # contains tests and results dirs + } + else + { + mtr_error("Specified test suite $::opt_stress_suite doesn't exist"); + } + + if ( @::opt_cases ) + { + $::opt_stress_test_file=File::Spec->catfile($stress_basedir, "stress_tests.txt"); + open(STRESS_FILE, ">$::opt_stress_test_file"); + print STRESS_FILE join("\n",@::opt_cases),"\n"; + close(STRESS_FILE); + } + elsif ( $::opt_stress_test_file ) + { + $::opt_stress_test_file=File::Spec->catfile($stress_suitedir, + $::opt_stress_test_file); + if ( ! -f $::opt_stress_test_file ) + { + mtr_error("Specified file $::opt_stress_test_file with list of tests does not exist\n", + "Please ensure that file exists and has proper permissions"); + } + } + else + { + $::opt_stress_test_file=File::Spec->catfile($stress_suitedir, + "stress_tests.txt"); + if ( ! -f $::opt_stress_test_file ) + { + mtr_error("Default file $::opt_stress_test_file with list of tests does not exist\n", + "Please use --stress-test-file option to specify custom one or you can\n", + "just specify name of test for testing as last argument in command line"); + + } + } + + if ( $::opt_stress_init_file ) + { + $::opt_stress_init_file=File::Spec->catfile($stress_suitedir, + $::opt_stress_init_file); + if ( ! -f $::opt_stress_init_file ) + { + mtr_error("Specified file $::opt_stress_init_file with list of tests does not exist\n", + "Please ensure that file exists and has proper permissions"); + } + } + else + { + $::opt_stress_init_file=File::Spec->catfile($stress_suitedir, + "stress_init.txt"); + if ( ! -f $::opt_stress_init_file ) + { + $::opt_stress_init_file=''; + } + } + + if ( $::opt_stress_mode ne 'random' && $::opt_stress_mode ne 'seq' ) + { + mtr_error("You specified wrong mode $::opt_stress_mode for stress test\n", + "Correct values are 'random' or 'seq'"); + } + + mtr_init_args(\$args); + + mtr_add_arg($args, "--server-socket=%s", $::master->[0]->{'path_mysock'}); + mtr_add_arg($args, "--server-user=%s", $::opt_user); + mtr_add_arg($args, "--server-database=%s", "test"); + mtr_add_arg($args, "--stress-suite-basedir=%s", $::glob_mysql_test_dir); + mtr_add_arg($args, "--suite=%s", $::opt_stress_suite); + mtr_add_arg($args, "--stress-tests-file=%s", $::opt_stress_test_file); + mtr_add_arg($args, "--stress-basedir=%s", $stress_basedir); + mtr_add_arg($args, "--server-logs-dir=%s", $stress_basedir); + mtr_add_arg($args, "--stress-mode=%s", $::opt_stress_mode); + mtr_add_arg($args, "--mysqltest=%s", $::exe_mysqltest); + mtr_add_arg($args, "--threads=%s", $::opt_stress_threads); + mtr_add_arg($args, "--verbose"); + mtr_add_arg($args, "--cleanup"); + mtr_add_arg($args, "--log-error-details"); + mtr_add_arg($args, "--abort-on-error"); + + if ( $::opt_stress_init_file ) + { + mtr_add_arg($args, "--stress-init-file=%", $::opt_stress_init_file); + } + + if ( $::opt_stress_loop_count ) + { + mtr_add_arg($args, "--loop-count=%s", $::opt_stress_loop_count); + } + + if ( $::opt_stress_test_count ) + { + mtr_add_arg($args, "--test-count=%s", $::opt_stress_test_count); + } + + if ( $::opt_stress_test_duration ) + { + mtr_add_arg($args, "--test-duration=%s", $::opt_stress_test_duration); + } + + #Run stress test + mtr_run("$::glob_mysql_test_dir/mysql-stress-test.pl", $args, "", "", "", ""); + + if ( ! $::glob_use_embedded_server ) + { + stop_masters(); + } +} + +1; diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 72b65d4287c..64cebaebb62 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -96,6 +96,7 @@ require "lib/mtr_report.pl"; require "lib/mtr_diff.pl"; require "lib/mtr_match.pl"; require "lib/mtr_misc.pl"; +require "lib/mtr_stress.pl"; $Devel::Trace::TRACE= 1; @@ -271,6 +272,16 @@ our $opt_valgrind_mysqltest; our $opt_valgrind_all; our $opt_valgrind_options; +our $opt_stress= ""; +our $opt_stress_suite= "main"; +our $opt_stress_mode= "random"; +our $opt_stress_threads= 5; +our $opt_stress_test_count= 20; +our $opt_stress_loop_count= ""; +our $opt_stress_test_duration= ""; +our $opt_stress_init_file= ""; +our $opt_stress_test_file= ""; + our $opt_verbose; our $opt_wait_for_master; @@ -391,6 +402,10 @@ sub main () { { run_benchmarks(shift); # Shift what? Extra arguments?! } + elsif ( $opt_stress ) + { + run_stress_test() + } else { run_tests(); @@ -547,6 +562,17 @@ sub command_line_setup () { 'valgrind-all:s' => \$opt_valgrind_all, 'valgrind-options=s' => \$opt_valgrind_options, + # Stress testing + 'stress' => \$opt_stress, + 'stress-suite=s' => \$opt_stress_suite, + 'stress-threads=i' => \$opt_stress_threads, + 'stress-test-file=s' => \$opt_stress_test_file, + 'stress-init-file=s' => \$opt_stress_init_file, + 'stress-mode=s' => \$opt_stress_mode, + 'stress-loop-count=i' => \$opt_stress_loop_count, + 'stress-test-count=i' => \$opt_stress_test_count, + 'stress-test-duration=i' => \$opt_stress_test_duration, + # Misc 'big-test' => \$opt_big_test, 'debug' => \$opt_debug, @@ -901,6 +927,9 @@ sub executable_setup () { "$path_client_bindir/mysqld-debug",); $path_language= mtr_path_exists("$glob_basedir/share/english/"); $path_charsetsdir= mtr_path_exists("$glob_basedir/share/charsets"); + + $exe_my_print_defaults= + mtr_exe_exists("$path_client_bindir/my_print_defaults"); } else { @@ -911,6 +940,8 @@ sub executable_setup () { $exe_im= mtr_exe_exists( "$glob_basedir/server-tools/instance-manager/mysqlmanager"); + $exe_my_print_defaults= + mtr_exe_exists("$glob_basedir/extra/my_print_defaults"); } if ( $glob_use_embedded_server ) @@ -930,15 +961,13 @@ sub executable_setup () { } $exe_mysqlcheck= mtr_exe_exists("$path_client_bindir/mysqlcheck"); $exe_mysqldump= mtr_exe_exists("$path_client_bindir/mysqldump"); - $exe_mysqlimport= mtr_exe_exists("$path_client_bindir/mysqlimport"); + $exe_mysqlimport= mtr_exe_exists("$path_client_bindir/mysqlimport"); $exe_mysqlshow= mtr_exe_exists("$path_client_bindir/mysqlshow"); $exe_mysqlbinlog= mtr_exe_exists("$path_client_bindir/mysqlbinlog"); $exe_mysqladmin= mtr_exe_exists("$path_client_bindir/mysqladmin"); $exe_mysql= mtr_exe_exists("$path_client_bindir/mysql"); $exe_mysql_fix_system_tables= mtr_script_exists("$glob_basedir/scripts/mysql_fix_privilege_tables"); - $exe_my_print_defaults= - mtr_script_exists("$glob_basedir/extra/my_print_defaults"); $path_ndb_tools_dir= mtr_path_exists("$glob_basedir/storage/ndb/tools"); $exe_ndb_mgm= "$glob_basedir/storage/ndb/src/mgmclient/ndb_mgm"; } @@ -947,6 +976,7 @@ sub executable_setup () { $path_client_bindir= mtr_path_exists("$glob_basedir/bin"); $exe_mysqlcheck= mtr_exe_exists("$path_client_bindir/mysqlcheck"); $exe_mysqldump= mtr_exe_exists("$path_client_bindir/mysqldump"); + $exe_mysqlimport= mtr_exe_exists("$path_client_bindir/mysqlimport"); $exe_mysqlshow= mtr_exe_exists("$path_client_bindir/mysqlshow"); $exe_mysqlbinlog= mtr_exe_exists("$path_client_bindir/mysqlbinlog"); $exe_mysqladmin= mtr_exe_exists("$path_client_bindir/mysqladmin"); @@ -955,7 +985,7 @@ sub executable_setup () { mtr_script_exists("$path_client_bindir/mysql_fix_privilege_tables", "$glob_basedir/scripts/mysql_fix_privilege_tables"); $exe_my_print_defaults= - mtr_script_exists("$path_client_bindir/my_print_defaults"); + mtr_exe_exists("$path_client_bindir/my_print_defaults"); $path_language= mtr_path_exists("$glob_basedir/share/mysql/english/", "$glob_basedir/share/english/"); @@ -2008,7 +2038,7 @@ sub mysqld_arguments ($$$$$) { mtr_add_arg($args, "%s--basedir=%s", $prefix, $path_my_basedir); mtr_add_arg($args, "%s--character-sets-dir=%s", $prefix, $path_charsetsdir); mtr_add_arg($args, "%s--core", $prefix); - mtr_add_arg($args, "%s--log-bin-trust-routine-creators", $prefix); + mtr_add_arg($args, "%s--log-bin-trust-function-creators", $prefix); mtr_add_arg($args, "%s--default-character-set=latin1", $prefix); mtr_add_arg($args, "%s--language=%s", $prefix, $path_language); mtr_add_arg($args, "%s--tmpdir=$opt_tmpdir", $prefix); @@ -2131,7 +2161,7 @@ sub mysqld_arguments ($$$$$) { mtr_add_arg($args, "%s--key_buffer_size=1M", $prefix); mtr_add_arg($args, "%s--sort_buffer=256K", $prefix); mtr_add_arg($args, "%s--max_heap_table_size=1M", $prefix); - mtr_add_arg($args, "%s--log-bin-trust-routine-creators", $prefix); + mtr_add_arg($args, "%s--log-bin-trust-function-creators", $prefix); if ( $opt_ssl_supported ) { diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index 037040bf0de..13badc4f244 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -1275,7 +1275,7 @@ start_master() --language=$LANGUAGE \ --innodb_data_file_path=ibdata1:128M:autoextend \ --open-files-limit=1024 \ - --log-bin-trust-routine-creators \ + --log-bin-trust-function-creators \ $MASTER_40_ARGS \ $SMALL_SERVER \ $EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT \ @@ -1296,7 +1296,7 @@ start_master() --tmpdir=$MYSQL_TMP_DIR \ --language=$LANGUAGE \ --innodb_data_file_path=ibdata1:128M:autoextend \ - --log-bin-trust-routine-creators \ + --log-bin-trust-function-creators \ $MASTER_40_ARGS \ $SMALL_SERVER \ $EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT \ @@ -1320,16 +1320,16 @@ start_master() if [ x$DO_DDD = x1 ] then - $ECHO "set args $master_args" > $GDB_MASTER_INIT + $ECHO "set args $master_args" > $GDB_MASTER_INIT$1 manager_launch master ddd -display $DISPLAY --debugger \ - "gdb -x $GDB_MASTER_INIT" $MASTER_MYSQLD + "gdb -x $GDB_MASTER_INIT$1" $MASTER_MYSQLD elif [ x$DO_GDB = x1 ] then if [ x$MANUAL_GDB = x1 ] then - $ECHO "set args $master_args" > $GDB_MASTER_INIT + $ECHO "set args $master_args" > $GDB_MASTER_INIT$1 $ECHO "To start gdb for the master , type in another window:" - $ECHO "cd $CWD ; gdb -x $GDB_MASTER_INIT $MASTER_MYSQLD" + $ECHO "cd $CWD ; gdb -x $GDB_MASTER_INIT$1 $MASTER_MYSQLD" wait_for_master=1500 else ( $ECHO set args $master_args; @@ -1341,9 +1341,9 @@ disa 1 end r EOF - fi ) > $GDB_MASTER_INIT + fi ) > $GDB_MASTER_INIT$1 manager_launch master $XTERM -display $DISPLAY \ - -title "Master" -e gdb -x $GDB_MASTER_INIT $MASTER_MYSQLD + -title "Master" -e gdb -x $GDB_MASTER_INIT$1 $MASTER_MYSQLD fi else manager_launch master $MASTER_MYSQLD $master_args @@ -1429,7 +1429,7 @@ start_slave() --report-port=$slave_port \ --master-retry-count=10 \ -O slave_net_timeout=10 \ - --log-bin-trust-routine-creators \ + --log-bin-trust-function-creators \ $SMALL_SERVER \ $EXTRA_SLAVE_OPT $EXTRA_SLAVE_MYSQLD_OPT" CUR_MYERR=$slave_err @@ -1965,10 +1965,10 @@ then $MYSQLADMIN --no-defaults --socket=$MASTER_MYSOCK -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1 $MYSQLADMIN --no-defaults --socket=$MASTER_MYSOCK1 -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1 $MYSQLADMIN --no-defaults --socket=$SLAVE_MYSOCK -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1 - $MYSQLADMIN --no-defaults --host=$hostname --port=$MASTER_MYPORT -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1 - $MYSQLADMIN --no-defaults --host=$hostname --port=`expr $MASTER_MYPORT+1` -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1 - $MYSQLADMIN --no-defaults --host=$hostname --port=$SLAVE_MYPORT -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1 - $MYSQLADMIN --no-defaults --host=$hostname --port=`expr $SLAVE_MYPORT + 1` -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1 + $MYSQLADMIN --no-defaults --host=$hostname --port=$MASTER_MYPORT --protocol=tcp -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1 + $MYSQLADMIN --no-defaults --host=$hostname --protocol=tcp --port=`expr $MASTER_MYPORT+1` -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1 + $MYSQLADMIN --no-defaults --host=$hostname --protocol=tcp --port=$SLAVE_MYPORT -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1 + $MYSQLADMIN --no-defaults --host=$hostname --protocol=tcp --port=`expr $SLAVE_MYPORT + 1` -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1 sleep_until_file_deleted 0 $MASTER_MYPID sleep_until_file_deleted 0 $MASTER_MYPID"1" sleep_until_file_deleted 0 $SLAVE_MYPID diff --git a/mysql-test/mysql_test_run_new.c b/mysql-test/mysql_test_run_new.c index 33a69eba872..79db71fa274 100644 --- a/mysql-test/mysql_test_run_new.c +++ b/mysql-test/mysql_test_run_new.c @@ -486,7 +486,7 @@ void start_master() #endif add_arg(&al, "--local-infile"); add_arg(&al, "--core"); - add_arg(&al, "--log-bin-trust-routine-creators"); + add_arg(&al, "--log-bin-trust-function-creators"); add_arg(&al, "--datadir=%s", master_dir); #ifndef __WIN__ add_arg(&al, "--pid-file=%s", master_pid); diff --git a/mysql-test/ndb/ndb_config_1_node.ini b/mysql-test/ndb/ndb_config_1_node.ini new file mode 100644 index 00000000000..53a54161432 --- /dev/null +++ b/mysql-test/ndb/ndb_config_1_node.ini @@ -0,0 +1,37 @@ +[ndbd default] +NoOfReplicas= 1 +MaxNoOfConcurrentTransactions= 64 +MaxNoOfConcurrentOperations= CHOOSE_MaxNoOfConcurrentOperations +DataMemory= CHOOSE_DataMemory +IndexMemory= CHOOSE_IndexMemory +Diskless= CHOOSE_Diskless +TimeBetweenWatchDogCheck= 30000 +DataDir= CHOOSE_FILESYSTEM +MaxNoOfOrderedIndexes= CHOOSE_MaxNoOfOrderedIndexes +MaxNoOfAttributes= CHOOSE_MaxNoOfAttributes +TimeBetweenGlobalCheckpoints= 500 +NoOfFragmentLogFiles= 3 + +[ndbd] +HostName= CHOOSE_HOSTNAME_1 # hostname is a valid network adress + +[ndb_mgmd] +HostName= CHOOSE_HOSTNAME_1 # hostname is a valid network adress +DataDir= CHOOSE_FILESYSTEM # +PortNumber= CHOOSE_PORT_MGM + +[mysqld] + +[mysqld] + +[mysqld] + +[mysqld] + +[mysqld] + +[mysqld] + +[mysqld] + +[mysqld] diff --git a/mysql-test/ndb/ndb_config_2_node.ini b/mysql-test/ndb/ndb_config_2_node.ini index a6a56376f33..f3c9f42a7ac 100644 --- a/mysql-test/ndb/ndb_config_2_node.ini +++ b/mysql-test/ndb/ndb_config_2_node.ini @@ -1,5 +1,6 @@ [ndbd default] NoOfReplicas= 2 +MaxNoOfConcurrentTransactions= 64 MaxNoOfConcurrentOperations= CHOOSE_MaxNoOfConcurrentOperations DataMemory= CHOOSE_DataMemory IndexMemory= CHOOSE_IndexMemory @@ -7,6 +8,9 @@ Diskless= CHOOSE_Diskless TimeBetweenWatchDogCheck= 30000 DataDir= CHOOSE_FILESYSTEM MaxNoOfOrderedIndexes= CHOOSE_MaxNoOfOrderedIndexes +MaxNoOfAttributes= CHOOSE_MaxNoOfAttributes +TimeBetweenGlobalCheckpoints= 500 +NoOfFragmentLogFiles= 3 [ndbd] HostName= CHOOSE_HOSTNAME_1 # hostname is a valid network adress @@ -26,3 +30,11 @@ PortNumber= CHOOSE_PORT_MGM [mysqld] [mysqld] + +[mysqld] + +[mysqld] + +[mysqld] + +[mysqld] diff --git a/mysql-test/ndb/ndb_config_4_node.ini b/mysql-test/ndb/ndb_config_4_node.ini new file mode 100644 index 00000000000..207b383bb83 --- /dev/null +++ b/mysql-test/ndb/ndb_config_4_node.ini @@ -0,0 +1,46 @@ +[ndbd default] +NoOfReplicas= 2 +MaxNoOfConcurrentTransactions= 64 +MaxNoOfConcurrentOperations= CHOOSE_MaxNoOfConcurrentOperations +DataMemory= CHOOSE_DataMemory +IndexMemory= CHOOSE_IndexMemory +Diskless= CHOOSE_Diskless +TimeBetweenWatchDogCheck= 30000 +DataDir= CHOOSE_FILESYSTEM +MaxNoOfOrderedIndexes= CHOOSE_MaxNoOfOrderedIndexes +MaxNoOfAttributes= CHOOSE_MaxNoOfAttributes +TimeBetweenGlobalCheckpoints= 500 +NoOfFragmentLogFiles= 3 + +[ndbd] +HostName= CHOOSE_HOSTNAME_1 # hostname is a valid network adress + +[ndbd] +HostName= CHOOSE_HOSTNAME_2 # hostname is a valid network adress + +[ndbd] +HostName= CHOOSE_HOSTNAME_3 # hostname is a valid network adress + +[ndbd] +HostName= CHOOSE_HOSTNAME_4 # hostname is a valid network adress + +[ndb_mgmd] +HostName= CHOOSE_HOSTNAME_1 # hostname is a valid network adress +DataDir= CHOOSE_FILESYSTEM # +PortNumber= CHOOSE_PORT_MGM + +[mysqld] + +[mysqld] + +[mysqld] + +[mysqld] + +[mysqld] + +[mysqld] + +[mysqld] + +[mysqld] diff --git a/mysql-test/ndb/ndbcluster.sh b/mysql-test/ndb/ndbcluster.sh index e2a7132081d..991c5a5291d 100644 --- a/mysql-test/ndb/ndbcluster.sh +++ b/mysql-test/ndb/ndbcluster.sh @@ -51,12 +51,15 @@ stop_ndb= initial_ndb= status_ndb= ndb_diskless=0 +ndbd_nodes=2 ndb_no_ord=512 +ndb_no_attr=2048 ndb_con_op=105000 ndb_dmem=80M ndb_imem=24M +VERBOSE=100 NDB_MGM_EXTRA_OPTS= NDB_MGMD_EXTRA_OPTS= NDBD_EXTRA_OPTS= @@ -76,14 +79,17 @@ while test $# -gt 0; do --debug*) flags_ndb="$flags_ndb $1" ;; + --ndbd-nodes=*) + ndbd_nodes=`echo "$1" | sed -e "s;--ndbd-nodes=;;"` + ;; --status) status_ndb=1 ;; --small) - ndb_no_ord=128 - ndb_con_op=10000 - ndb_dmem=40M - ndb_imem=12M + ndb_no_ord=32 + ndb_con_op=5000 + ndb_dmem=10M + ndb_imem=1M ;; --diskless) ndb_diskless=1 @@ -106,6 +112,9 @@ while test $# -gt 0; do --ndbd-extra-opts=*) NDBD_EXTRA_OPTS=`echo "$1" | sed -e "s;--ndbd-extra-opts=;;"` ;; + --verbose=*) + VERBOSE=`echo "$1" | sed -e "s;--verbose=;;"` + ;; -- ) shift; break ;; --* ) $ECHO "Unrecognized option: $1"; exit 1 ;; * ) break ;; @@ -114,9 +123,10 @@ while test $# -gt 0; do done fs_ndb="$fsdir/ndbcluster-$port" +config_ini=ndb/ndb_config_${ndbd_nodes}_node.ini NDB_HOME= -if [ ! -x "$fsdir" ]; then +if [ ! -d "$fsdir" ]; then echo "$fsdir missing" exit 1 fi @@ -132,6 +142,10 @@ if [ ! -x "$exec_waiter" ]; then echo "$exec_waiter missing" exit 1 fi +if [ ! -f "$config_ini" ]; then + echo "$config_ini missing, unsupported number of nodes" + exit 1 +fi exec_mgmtclient="$exec_mgmtclient --no-defaults $NDB_MGM_EXTRA_OPTS" exec_mgmtsrvr="$exec_mgmtsrvr --no-defaults $NDB_MGMD_EXTRA_OPTS" @@ -183,6 +197,7 @@ fi if [ $initial_ndb ] ; then rm -rf $fs_ndb/ndb_* 2>&1 | cat > /dev/null sed \ + -e s,"CHOOSE_MaxNoOfAttributes","$ndb_no_attr",g \ -e s,"CHOOSE_MaxNoOfOrderedIndexes","$ndb_no_ord",g \ -e s,"CHOOSE_MaxNoOfConcurrentOperations","$ndb_con_op",g \ -e s,"CHOOSE_DataMemory","$ndb_dmem",g \ @@ -191,7 +206,7 @@ if [ $initial_ndb ] ; then -e s,"CHOOSE_HOSTNAME_".*,"$ndb_host",g \ -e s,"CHOOSE_FILESYSTEM","$fs_ndb",g \ -e s,"CHOOSE_PORT_MGM","$ndb_mgmd_port",g \ - < ndb/ndb_config_2_node.ini \ + < "$config_ini" \ > "$fs_ndb/config.ini" fi @@ -202,7 +217,7 @@ if ( cd "$fs_ndb" ; $exec_mgmtsrvr -f config.ini ) ; then :; else echo "Unable to start $exec_mgmtsrvr from `pwd`" exit 1 fi -if sleep_until_file_created $fs_ndb/ndb_3.pid 120 +if sleep_until_file_created $fs_ndb/ndb_`expr $ndbd_nodes + 1`.pid 120 then :; else exit 1 fi @@ -210,38 +225,43 @@ cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile" # Start database node -echo "Starting ndbd" -( cd "$fs_ndb" ; $exec_ndb $flags_ndb & ) -if sleep_until_file_created $fs_ndb/ndb_1.pid 120 -then :; else - stop_default_ndbcluster - exit 1 -fi -cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile" - -# Start database node - -echo "Starting ndbd" -( cd "$fs_ndb" ; $exec_ndb $flags_ndb & ) -if sleep_until_file_created $fs_ndb/ndb_2.pid 120 -then :; else - stop_default_ndbcluster - exit 1 -fi -cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile" +id=1 +while [ $id -le $ndbd_nodes ] +do + if [ `expr $VERBOSE \> 1` = 1 ] ; then + echo "Starting ndbd $id($ndbd_nodes)" + fi + ( cd "$fs_ndb" ; $exec_ndb $flags_ndb & ) + if sleep_until_file_created $fs_ndb/ndb_${id}.pid 120 + then :; else + stop_default_ndbcluster + exit 1 + fi + cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile" + id=`expr $id + 1` +done # test if Ndb Cluster starts properly -echo "Waiting for started..." -if ( $exec_waiter ) | grep "NDBT_ProgramExit: 0 - OK"; then :; else - echo "Ndbcluster startup failed" +if [ `expr $VERBOSE \> 1` = 1 ] ; then + echo "Waiting for started..." +fi +if ( $exec_waiter ) | grep "NDBT_ProgramExit: 0 - OK" > /dev/null 2>&1 ; then :; else + if [ `expr $VERBOSE \> 0` = 1 ] ; then + echo "Ndbcluster startup failed" + fi stop_default_ndbcluster exit 1 fi +if [ `expr $VERBOSE \> 1` = 1 ] ; then + echo "Ok" +fi cat `find "$fs_ndb" -name 'ndb_*.pid'` > $fs_ndb/$pidfile -status_ndbcluster +if [ `expr $VERBOSE \> 2` = 1 ] ; then + status_ndbcluster +fi } status_ndbcluster() { diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result index e3e9dab78bd..5b40b250786 100644 --- a/mysql-test/r/alter_table.result +++ b/mysql-test/r/alter_table.result @@ -556,6 +556,12 @@ ERROR 3D000: No database selected alter table test.t1 rename test.t1; use test; drop table t1; +create table t1 (mycol int(10) not null); +alter table t1 alter column mycol set default 0; +desc t1; +Field Type Null Key Default Extra +mycol int(10) NO 0 +drop table t1; create table t1 (v varchar(32)); insert into t1 values ('def'),('abc'),('hij'),('3r4f'); select * from t1; diff --git a/mysql-test/r/analyze.result b/mysql-test/r/analyze.result index 0b44a502b13..17686d597a4 100644 --- a/mysql-test/r/analyze.result +++ b/mysql-test/r/analyze.result @@ -30,3 +30,19 @@ check table t1; Table Op Msg_type Msg_text test.t1 check status OK drop table t1; +create table t1 (a mediumtext, fulltext key key1(a)) charset utf8 collate utf8_general_ci engine myisam; +insert into t1 values ('hello'); +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Table is already up to date +drop table t1; +CREATE TABLE t1 (a int); +prepare stmt1 from "SELECT * FROM t1 PROCEDURE ANALYSE()"; +execute stmt1; +Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype +execute stmt1; +Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype +deallocate prepare stmt1; diff --git a/mysql-test/r/auto_increment.result b/mysql-test/r/auto_increment.result index 61a42b004a9..89f30c9d1f4 100644 --- a/mysql-test/r/auto_increment.result +++ b/mysql-test/r/auto_increment.result @@ -163,7 +163,7 @@ last_insert_id() 255 insert into t1 set i = null; Warnings: -Warning 1264 Out of range value adjusted for column 'i' at row 1 +Warning 1264 Out of range value for column 'i' at row 1 select last_insert_id(); last_insert_id() 255 @@ -232,7 +232,7 @@ a b delete from t1 where a=0; update t1 set a=NULL where b=6; Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 4 +Warning 1048 Column 'a' cannot be null update t1 set a=300 where b=7; SET SQL_MODE=''; insert into t1(a,b)values(NULL,8); @@ -274,7 +274,7 @@ a b delete from t1 where a=0; update t1 set a=NULL where b=13; Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 9 +Warning 1048 Column 'a' cannot be null update t1 set a=500 where b=14; select * from t1 order by b; a b diff --git a/mysql-test/r/bdb.result b/mysql-test/r/bdb.result index 5cdf9612300..ac14f891622 100644 --- a/mysql-test/r/bdb.result +++ b/mysql-test/r/bdb.result @@ -1891,3 +1891,17 @@ t1 CREATE TABLE `t1` ( ) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1 drop table t1; set storage_engine=MyISAM; +create table t1 (a varchar(255) character set utf8, +b varchar(255) character set utf8, +c varchar(255) character set utf8, +d varchar(255) character set utf8, +key (a,b,c,d)) engine=bdb; +drop table t1; +create table t1 (a varchar(255) character set utf8, +b varchar(255) character set utf8, +c varchar(255) character set utf8, +d varchar(255) character set utf8, +e varchar(255) character set utf8, +key (a,b,c,d,e)) engine=bdb; +ERROR 42000: Specified key was too long; max key length is 3072 bytes +End of 5.0 tests diff --git a/mysql-test/r/bigint.result b/mysql-test/r/bigint.result index ca9a2662f94..3c8a70b7bde 100644 --- a/mysql-test/r/bigint.result +++ b/mysql-test/r/bigint.result @@ -1,4 +1,4 @@ -drop table if exists t1; +drop table if exists t1, t2; select 0,256,00000000000000065536,2147483647,-2147483648,2147483648,+4294967296; 0 256 00000000000000065536 2147483647 -2147483648 2147483648 4294967296 0 256 65536 2147483647 -2147483648 2147483648 4294967296 @@ -47,7 +47,7 @@ drop table t1; create table t1 ( a int not null default 1, big bigint ); insert into t1 (big) values (-1),(12345678901234567),(9223372036854775807),(18446744073709551615); Warnings: -Warning 1264 Out of range value adjusted for column 'big' at row 4 +Warning 1264 Out of range value for column 'big' at row 4 select * from t1; a big 1 -1 @@ -62,7 +62,7 @@ min(big) max(big) max(big)-1 -1 9223372036854775807 9223372036854775806 alter table t1 modify big bigint unsigned not null; Warnings: -Warning 1264 Out of range value adjusted for column 'big' at row 1 +Warning 1264 Out of range value for column 'big' at row 1 select min(big),max(big),max(big)-1 from t1; min(big) max(big) max(big)-1 0 9223372036854775807 9223372036854775806 @@ -92,7 +92,7 @@ min(big) max(big) max(big)-1 0 18446744073709551615 18446744073709551614 alter table t1 modify big bigint not null; Warnings: -Warning 1264 Out of range value adjusted for column 'big' at row 5 +Warning 1264 Out of range value for column 'big' at row 5 select * from t1; a big 1 0 @@ -204,10 +204,10 @@ drop table t1; create table t1 ( quantity decimal(2) unsigned); insert into t1 values (500), (-500), (~0), (-1); Warnings: -Warning 1264 Out of range value adjusted for column 'quantity' at row 1 -Warning 1264 Out of range value adjusted for column 'quantity' at row 2 -Warning 1264 Out of range value adjusted for column 'quantity' at row 3 -Warning 1264 Out of range value adjusted for column 'quantity' at row 4 +Warning 1264 Out of range value for column 'quantity' at row 1 +Warning 1264 Out of range value for column 'quantity' at row 2 +Warning 1264 Out of range value for column 'quantity' at row 3 +Warning 1264 Out of range value for column 'quantity' at row 4 select * from t1; quantity 99 diff --git a/mysql-test/r/blackhole.result b/mysql-test/r/blackhole.result index 38e548490fe..7b6e61984ec 100644 --- a/mysql-test/r/blackhole.result +++ b/mysql-test/r/blackhole.result @@ -110,16 +110,41 @@ master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 master-bin.000001 # Query 1 # use `test`; drop table t1,t2 master-bin.000001 # Query 1 # use `test`; create table t1 (a int) engine=blackhole master-bin.000001 # Query 1 # use `test`; delete from t1 where a=10 +master-bin.000001 # Query 1 # use `test`; COMMIT master-bin.000001 # Query 1 # use `test`; update t1 set a=11 where a=15 +master-bin.000001 # Query 1 # use `test`; COMMIT master-bin.000001 # Query 1 # use `test`; insert into t1 values(1) +master-bin.000001 # Query 1 # use `test`; COMMIT master-bin.000001 # Query 1 # use `test`; insert ignore into t1 values(1) +master-bin.000001 # Query 1 # use `test`; COMMIT master-bin.000001 # Query 1 # use `test`; replace into t1 values(100) +master-bin.000001 # Query 1 # use `test`; COMMIT master-bin.000001 # Query 1 # use `test`; create table t2 (a varchar(200)) engine=blackhole master-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=581 master-bin.000001 # Execute_load_query 1 # use `test`; load data infile '../../std_data/words.dat' into table t2 ;file_id=1 +master-bin.000001 # Query 1 # use `test`; COMMIT master-bin.000001 # Query 1 # use `test`; alter table t1 add b int master-bin.000001 # Query 1 # use `test`; alter table t1 drop b master-bin.000001 # Query 1 # use `test`; create table t3 like t1 master-bin.000001 # Query 1 # use `test`; insert into t1 select * from t3 +master-bin.000001 # Query 1 # use `test`; COMMIT master-bin.000001 # Query 1 # use `test`; replace into t1 select * from t3 +master-bin.000001 # Query 1 # use `test`; COMMIT drop table t1,t2,t3; +reset master; +create table t1 (a int) engine=blackhole; +set autocommit=0; +start transaction; +insert into t1 values(1); +commit; +start transaction; +insert into t1 values(2); +rollback; +set autocommit=1; +show binlog events; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 +master-bin.000001 # Query 1 # use `test`; create table t1 (a int) engine=blackhole +master-bin.000001 # Query 1 # use `test`; BEGIN +master-bin.000001 # Query 1 # use `test`; insert into t1 values(1) +master-bin.000001 # Query 1 # use `test`; COMMIT diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result index 817be3a2e7c..8da18df1954 100644 --- a/mysql-test/r/cast.result +++ b/mysql-test/r/cast.result @@ -68,12 +68,12 @@ select CONVERT(DATE "2004-01-22 21:45:33",BINARY(4)); CONVERT(DATE "2004-01-22 21:45:33",BINARY(4)) 2004 Warnings: -Warning 1292 Truncated incorrect CHAR(4) value: '2004-01-22 21:45:33' +Warning 1292 Truncated incorrect BINARY(4) value: '2004-01-22 21:45:33' select CAST(DATE "2004-01-22 21:45:33" AS BINARY(4)); CAST(DATE "2004-01-22 21:45:33" AS BINARY(4)) 2004 Warnings: -Warning 1292 Truncated incorrect CHAR(4) value: '2004-01-22 21:45:33' +Warning 1292 Truncated incorrect BINARY(4) value: '2004-01-22 21:45:33' select CAST(0xb3 as signed); CAST(0xb3 as signed) 179 @@ -165,17 +165,17 @@ cast(_latin1'ab' AS char) as c1, cast(_latin1'a ' AS char) as c2, cast(_latin1'abc' AS char(2)) as c3, cast(_latin1'a ' AS char(2)) as c4, -cast(_latin1'a' AS char(2)) as c5; +hex(cast(_latin1'a' AS char(2))) as c5; c1 c2 c3 c4 c5 -ab a ab a a +ab a ab a 6100 Warnings: -Warning 1292 Truncated incorrect CHAR(2) value: 'abc' -Warning 1292 Truncated incorrect CHAR(2) value: 'a ' +Warning 1292 Truncated incorrect BINARY(2) value: 'abc' +Warning 1292 Truncated incorrect BINARY(2) value: 'a ' select cast(1000 as CHAR(3)); cast(1000 as CHAR(3)) 100 Warnings: -Warning 1292 Truncated incorrect CHAR(3) value: '1000' +Warning 1292 Truncated incorrect BINARY(3) value: '1000' create table t1 select cast(_latin1'ab' AS char) as c1, cast(_latin1'a ' AS char) as c2, @@ -183,11 +183,11 @@ cast(_latin1'abc' AS char(2)) as c3, cast(_latin1'a ' AS char(2)) as c4, cast(_latin1'a' AS char(2)) as c5; Warnings: -Warning 1292 Truncated incorrect CHAR(2) value: 'abc' -Warning 1292 Truncated incorrect CHAR(2) value: 'a ' -select * from t1; -c1 c2 c3 c4 c5 -ab a ab a a +Warning 1292 Truncated incorrect BINARY(2) value: 'abc' +Warning 1292 Truncated incorrect BINARY(2) value: 'a ' +select c1,c2,c3,c4,hex(c5) from t1; +c1 c2 c3 c4 hex(c5) +ab a ab a 6100 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -274,9 +274,9 @@ aac aac aab aab aaa aaa Warnings: -Warning 1292 Truncated incorrect CHAR(2) value: 'aaa' -Warning 1292 Truncated incorrect CHAR(2) value: 'aab' -Warning 1292 Truncated incorrect CHAR(2) value: 'aac' +Warning 1292 Truncated incorrect BINARY(2) value: 'aaa' +Warning 1292 Truncated incorrect BINARY(2) value: 'aab' +Warning 1292 Truncated incorrect BINARY(2) value: 'aac' SELECT a, CAST(a AS UNSIGNED) FROM t1 ORDER BY CAST(a AS CHAR) ; a CAST(a AS UNSIGNED) aaa 3 @@ -288,9 +288,9 @@ aaa aa aab aa aac aa Warnings: -Warning 1292 Truncated incorrect CHAR(2) value: 'aaa' -Warning 1292 Truncated incorrect CHAR(2) value: 'aab' -Warning 1292 Truncated incorrect CHAR(2) value: 'aac' +Warning 1292 Truncated incorrect BINARY(2) value: 'aaa' +Warning 1292 Truncated incorrect BINARY(2) value: 'aab' +Warning 1292 Truncated incorrect BINARY(2) value: 'aac' DROP TABLE t1; select date_add(cast('2004-12-30 12:00:00' as date), interval 0 hour); date_add(cast('2004-12-30 12:00:00' as date), interval 0 hour) diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 1f8c6cb464d..f73d891e7f0 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -1,4 +1,4 @@ -drop table if exists t1,t2,t3; +drop table if exists t1,t2,t3,t4,t5; drop database if exists mysqltest; create table t1 (b char(0)); insert into t1 values (""),(null); @@ -13,7 +13,7 @@ Warnings: Note 1050 Table 't1' already exists insert into t1 values (""),(null); Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'b' at row 2 +Warning 1048 Column 'b' cannot be null select * from t1; b @@ -654,3 +654,111 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; +CREATE TABLE t2 ( +a int(11) default NULL +); +insert into t2 values(111); +create table t1 ( +a varchar(12) charset utf8 collate utf8_bin not null, +b int not null, primary key (a) +) select a, 1 as b from t2 ; +Warnings: +Warning 1364 Field 'a' doesn't have a default value +Warning 1364 Field 'b' doesn't have a default value +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(12) character set utf8 collate utf8_bin NOT NULL, + `b` int(11) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 ( +a varchar(12) charset utf8 collate utf8_bin not null, +b int not null, primary key (a) +) select 'a' as a , 1 as b from t2 ; +Warnings: +Warning 1364 Field 'a' doesn't have a default value +Warning 1364 Field 'b' doesn't have a default value +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(12) character set utf8 collate utf8_bin NOT NULL, + `b` int(11) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 ( +a varchar(12) charset utf8 collate utf8_bin, +b int not null, primary key (a) +) select 'a' as a , 1 as b from t2 ; +Warnings: +Warning 1364 Field 'b' doesn't have a default value +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(12) character set utf8 collate utf8_bin NOT NULL default '', + `b` int(11) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 ( +a1 int not null, +a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int +); +insert into t1 values (1,1,1, 1,1,1, 1,1,1); +create table t2 ( +a1 varchar(12) charset utf8 collate utf8_bin not null, +a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, +primary key (a1) +) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1 ; +Warnings: +Warning 1364 Field 'a1' doesn't have a default value +drop table t2; +create table t2 ( +a1 varchar(12) charset utf8 collate utf8_bin, +a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int +) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1; +drop table t1, t2; +create table t1 ( +a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int +); +insert into t1 values (1,1,1, 1,1,1, 1,1,1); +create table t2 ( +a1 varchar(12) charset utf8 collate utf8_bin not null, +a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, +primary key (a1) +) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1 ; +Warnings: +Warning 1364 Field 'a1' doesn't have a default value +drop table t2; +create table t2 ( a int default 3, b int default 3) +select a1,a2 from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` int(11) default '3', + `b` int(11) default '3', + `a1` int(11) default NULL, + `a2` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (i int) engine=myisam max_rows=100000000000; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `i` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 MAX_ROWS=4294967295 +alter table t1 max_rows=100; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `i` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 MAX_ROWS=100 +alter table t1 max_rows=100000000000; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `i` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 MAX_ROWS=4294967295 +drop table t1; diff --git a/mysql-test/r/csv.result b/mysql-test/r/csv.result index ea0d34271b5..3c87c1f4b92 100644 --- a/mysql-test/r/csv.result +++ b/mysql-test/r/csv.result @@ -4929,3 +4929,74 @@ Warnings: Note 1051 Unknown table 't2' Note 1051 Unknown table 't3' Note 1051 Unknown table 't4' +DROP TABLE IF EXISTS bug13894; +CREATE TABLE bug13894 ( val integer ) ENGINE = CSV; +INSERT INTO bug13894 VALUES (5); +INSERT INTO bug13894 VALUES (10); +INSERT INTO bug13894 VALUES (11); +INSERT INTO bug13894 VALUES (10); +SELECT * FROM bug13894; +val +5 +10 +11 +10 +UPDATE bug13894 SET val=6 WHERE val=10; +SELECT * FROM bug13894; +val +5 +11 +6 +6 +DROP TABLE bug13894; +DROP TABLE IF EXISTS bug14672; +CREATE TABLE bug14672 (c1 integer) engine = CSV; +INSERT INTO bug14672 VALUES (1), (2), (3); +SELECT * FROM bug14672; +c1 +1 +2 +3 +DELETE FROM bug14672 WHERE c1 = 2; +SELECT * FROM bug14672; +c1 +1 +3 +INSERT INTO bug14672 VALUES (4); +SELECT * FROM bug14672; +c1 +1 +3 +4 +INSERT INTO bug14672 VALUES (5); +SELECT * FROM bug14672; +c1 +1 +3 +4 +5 +DROP TABLE bug14672; +create table t1 (a int) engine=csv; +insert t1 values (1); +delete from t1; +affected rows: 1 +delete from t1; +affected rows: 0 +insert t1 values (1),(2); +delete from t1; +affected rows: 2 +insert t1 values (1),(2),(3); +flush tables; +delete from t1; +affected rows: 3 +insert t1 values (1),(2),(3),(4); +flush tables; +select count(*) from t1; +count(*) +4 +delete from t1; +affected rows: 4 +insert t1 values (1),(2),(3),(4),(5); +truncate table t1; +affected rows: 0 +drop table t1; diff --git a/mysql-test/r/ctype_recoding.result b/mysql-test/r/ctype_recoding.result index da0007fdfbe..1b92da2a7a3 100644 --- a/mysql-test/r/ctype_recoding.result +++ b/mysql-test/r/ctype_recoding.result @@ -181,11 +181,18 @@ select * from t1 where a=_koi8r' a ×ÁÓÑ select * from t1 where a=concat(_koi8r'×ÁÓÑ'); -ERROR HY000: Illegal mix of collations (cp1251_general_ci,IMPLICIT) and (koi8r_general_ci,COERCIBLE) for operation '=' +a +×ÁÓÑ select * from t1 where a=_latin1'×ÁÓÑ'; ERROR HY000: Illegal mix of collations (cp1251_general_ci,IMPLICIT) and (latin1_swedish_ci,COERCIBLE) for operation '=' drop table t1; set names latin1; +create table t1 (a char(10) character set utf8 collate utf8_bin); +insert into t1 values (' xxx'); +select * from t1 where a=lpad('xxx',10,' '); +a + xxx +drop table t1; set names koi8r; create table t1 (c1 char(10) character set cp1251); insert into t1 values ('ß'); diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index 65b5a1cbba8..17f2afc13c9 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -671,7 +671,7 @@ DROP TABLE t1; CREATE TABLE t1 (Field1 int(10) unsigned default '0'); INSERT INTO t1 VALUES ('-1'); Warnings: -Warning 1264 Out of range value adjusted for column 'Field1' at row 1 +Warning 1264 Out of range value for column 'Field1' at row 1 DROP TABLE t1; SET NAMES latin1; CREATE TABLE t1 ( diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index 874983daff2..c57b06f4895 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -1095,6 +1095,11 @@ char(0xff,0x8f using utf8) ÿ Warnings: Warning 1300 Invalid utf8 character string: 'FF8F' +select convert(char(0xff,0x8f) using utf8); +convert(char(0xff,0x8f) using utf8) +ÿ +Warnings: +Warning 1300 Invalid utf8 character string: 'FF8F' set sql_mode=traditional; select char(0xff,0x8f using utf8); char(0xff,0x8f using utf8) @@ -1116,6 +1121,11 @@ char(2557 using utf8) NULL Warnings: Error 1300 Invalid utf8 character string: 'FD' +select convert(char(0xff,0x8f) using utf8); +convert(char(0xff,0x8f) using utf8) +NULL +Warnings: +Error 1300 Invalid utf8 character string: 'FF8F' select hex(convert(char(2557 using latin1) using utf8)); hex(convert(char(2557 using latin1) using utf8)) 09C3BD diff --git a/mysql-test/r/date_formats.result b/mysql-test/r/date_formats.result index f8189266e50..bc289f18169 100644 --- a/mysql-test/r/date_formats.result +++ b/mysql-test/r/date_formats.result @@ -401,14 +401,14 @@ date format str_to_date 2003-01-02 10:11:12 %Y-%m-%d %h:%i:%S 2003-01-02 10:11:12 03-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 0003-01-02 22:11:12 Warnings: -Warning 1292 Truncated incorrect datetime value: '10:20:10AM' +Warning 1292 Incorrect datetime value: '10:20:10AM' select date,format,concat(str_to_date(date, format),'') as con from t1; date format con 10:20:10AM %h:%i:%s 0000-00-00 10:20:10 2003-01-02 10:11:12 %Y-%m-%d %h:%i:%S 2003-01-02 10:11:12 03-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 0003-01-02 22:11:12 Warnings: -Warning 1292 Truncated incorrect datetime value: '10:20:10AM' +Warning 1292 Incorrect datetime value: '10:20:10AM' drop table t1; select get_format(DATE, 'USA') as a; a diff --git a/mysql-test/r/federated.result b/mysql-test/r/federated.result index 7f53bd884ef..f9b13beb6e5 100644 --- a/mysql-test/r/federated.result +++ b/mysql-test/r/federated.result @@ -40,14 +40,14 @@ CREATE TABLE federated.t1 ( ) ENGINE="FEDERATED" DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t3'; -ERROR HY000: Can't create federated table. Foreign data src error : ': 1146 : Table 'federated.t3' doesn't exist' +ERROR HY000: Can't create federated table. Foreign data src error: error: 1146 'Table 'federated.t3' doesn't exist' CREATE TABLE federated.t1 ( `id` int(20) NOT NULL, `name` varchar(32) NOT NULL default '' ) ENGINE="FEDERATED" DEFAULT CHARSET=latin1 CONNECTION='mysql://user:pass@127.0.0.1:SLAVE_PORT/federated/t1'; -ERROR HY000: Unable to connect to foreign data source - database ' database federated username user hostname 127.0.0.1'! +ERROR HY000: Unable to connect to foreign data source: database: 'federated' username: 'user' hostname: '127.0.0.1' DROP TABLE IF EXISTS federated.t1; Warnings: Note 1051 Unknown table 't1' diff --git a/mysql-test/r/federated_transactions.result b/mysql-test/r/federated_transactions.result new file mode 100644 index 00000000000..403b65b5484 --- /dev/null +++ b/mysql-test/r/federated_transactions.result @@ -0,0 +1,49 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +stop slave; +DROP DATABASE IF EXISTS federated; +CREATE DATABASE federated; +DROP DATABASE IF EXISTS federated; +CREATE DATABASE federated; +DROP TABLE IF EXISTS federated.t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE federated.t1 ( +`id` int(20) NOT NULL, +`name` varchar(32) NOT NULL default '' + ) +DEFAULT CHARSET=latin1 ENGINE=BerkeleyDB; +DROP TABLE IF EXISTS federated.t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE federated.t1 ( +`id` int(20) NOT NULL, +`name` varchar(32) NOT NULL default '' + ) +ENGINE="FEDERATED" DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; +set autocommit=0; +INSERT INTO federated.t1 (id, name) VALUES (1, 'foo'); +INSERT INTO federated.t1 (id, name) VALUES (2, 'fee'); +COMMIT; +INSERT INTO federated.t1 (id, name) VALUES (3, 'fie'); +INSERT INTO federated.t1 (id, name) VALUES (4, 'fum'); +ROLLBACK; +set autocommit=1; +INSERT INTO federated.t1 (id, name) VALUES (5, 'foe'); +INSERT INTO federated.t1 (id, name) VALUES (6, 'fig'); +SELECT * FROM federated.t1; +id name +1 foo +2 fee +5 foe +6 fig +DELETE FROM federated.t1; +DROP TABLE IF EXISTS federated.t1; +DROP DATABASE IF EXISTS federated; +DROP TABLE IF EXISTS federated.t1; +DROP DATABASE IF EXISTS federated; diff --git a/mysql-test/r/flush_table.result b/mysql-test/r/flush_table.result index db54d2e53ef..b29c83eb574 100644 --- a/mysql-test/r/flush_table.result +++ b/mysql-test/r/flush_table.result @@ -6,6 +6,37 @@ flush table t1; check table t1; Table Op Msg_type Msg_text test.t1 check status OK +unlock tables; +lock table t1 read; +lock table t1 read; + flush table t1; +select * from t1; +a +1 +unlock tables; +select * from t1; +a +1 +unlock tables; +lock table t1 write; + lock table t1 read; +flush table t1; +select * from t1; +a +1 +unlock tables; +unlock tables; +lock table t1 read; + lock table t1 write; +flush table t1; +select * from t1; +a +1 +unlock tables; +unlock tables; +select * from t1; +a +1 drop table t1; create table t1(table_id char(20) primary key); create table t2(table_id char(20) primary key); diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result index ea0ffe9d7dd..7e2e0a56212 100644 --- a/mysql-test/r/fulltext.result +++ b/mysql-test/r/fulltext.result @@ -429,4 +429,11 @@ REPAIR TABLE t1; Table Op Msg_type Msg_text test.t1 repair status OK SET myisam_repair_threads=@@global.myisam_repair_threads; +INSERT INTO t1 VALUES('testword\'\''); +SELECT a FROM t1 WHERE MATCH a AGAINST('testword' IN BOOLEAN MODE); +a +testword'' +SELECT a FROM t1 WHERE MATCH a AGAINST('testword\'\'' IN BOOLEAN MODE); +a +testword'' DROP TABLE t1; diff --git a/mysql-test/r/func_equal.result b/mysql-test/r/func_equal.result index fe5e5b1b371..4750af6e8d8 100644 --- a/mysql-test/r/func_equal.result +++ b/mysql-test/r/func_equal.result @@ -33,3 +33,12 @@ id value select * from t1 where id <=> value or value<=>id; id value drop table t1,t2; +create table t1 (a bigint unsigned); +insert into t1 values (4828532208463511553); +select * from t1 where a = '4828532208463511553'; +a +4828532208463511553 +select * from t1 where a in ('4828532208463511553'); +a +4828532208463511553 +drop table t1; diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result index 90884dcc596..7987ceca712 100644 --- a/mysql-test/r/func_gconcat.result +++ b/mysql-test/r/func_gconcat.result @@ -596,3 +596,18 @@ GROUP_CONCAT(a ORDER BY a) ,x ,z DROP TABLE t1; +set names latin1; +create table t1 (a char, b char); +insert into t1 values ('a', 'a'), ('a', 'b'), ('b', 'a'), ('b', 'b'); +create table t2 select group_concat(b) as a from t1 where a = 'a'; +create table t3 (select group_concat(a) as a from t1 where a = 'a') union +(select group_concat(b) as a from t1 where a = 'b'); +select charset(a) from t2; +charset(a) +latin1 +select charset(a) from t3; +charset(a) +latin1 +latin1 +drop table t1, t2, t3; +set names default; diff --git a/mysql-test/r/func_sapdb.result b/mysql-test/r/func_sapdb.result index d984eee80fa..0be9ea9cf86 100644 --- a/mysql-test/r/func_sapdb.result +++ b/mysql-test/r/func_sapdb.result @@ -68,7 +68,7 @@ select datediff("1997-11-31 23:59:59.000001","1997-12-31"); datediff("1997-11-31 23:59:59.000001","1997-12-31") NULL Warnings: -Warning 1292 Truncated incorrect datetime value: '1997-11-31 23:59:59.000001' +Warning 1292 Incorrect datetime value: '1997-11-31 23:59:59.000001' select datediff("1997-11-30 23:59:59.000001",null); datediff("1997-11-30 23:59:59.000001",null) NULL @@ -133,7 +133,7 @@ select timestamp("2001-13-01", "01:01:01.000001"); timestamp("2001-13-01", "01:01:01.000001") NULL Warnings: -Warning 1292 Truncated incorrect datetime value: '2001-13-01' +Warning 1292 Incorrect datetime value: '2001-13-01' select timestamp("2001-12-01", "25:01:01"); timestamp("2001-12-01", "25:01:01") 2001-12-02 01:01:01 @@ -153,7 +153,7 @@ select date("1997-13-31 23:59:59.000001"); date("1997-13-31 23:59:59.000001") NULL Warnings: -Warning 1292 Truncated incorrect datetime value: '1997-13-31 23:59:59.000001' +Warning 1292 Incorrect datetime value: '1997-13-31 23:59:59.000001' select time("1997-12-31 23:59:59.000001"); time("1997-12-31 23:59:59.000001") 23:59:59.000001 diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index a305bf20bff..806ccf96537 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -837,16 +837,16 @@ drop table t1, t2; create table t1 (c1 INT, c2 INT UNSIGNED); insert into t1 values ('21474836461','21474836461'); Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 insert into t1 values ('-21474836461','-21474836461'); Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 show warnings; Level Code Message -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 select * from t1; c1 c2 2147483647 4294967295 diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 64dafa132b4..19e68128e74 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -311,7 +311,7 @@ select date_sub("0000-00-00 00:00:00",INTERVAL 1 SECOND); date_sub("0000-00-00 00:00:00",INTERVAL 1 SECOND) NULL Warnings: -Warning 1292 Truncated incorrect datetime value: '0000-00-00 00:00:00' +Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00' select date_add('1998-01-30',Interval 1 month); date_add('1998-01-30',Interval 1 month) 1998-02-28 @@ -428,12 +428,12 @@ SELECT month(updated) from t1; month(updated) NULL Warnings: -Warning 1292 Truncated incorrect datetime value: '' +Warning 1292 Incorrect datetime value: '' SELECT year(updated) from t1; year(updated) NULL Warnings: -Warning 1292 Truncated incorrect datetime value: '' +Warning 1292 Incorrect datetime value: '' drop table t1; create table t1 (d date, dt datetime, t timestamp, c char(10)); insert into t1 values ("0000-00-00", "0000-00-00", "0000-00-00", "0000-00-00"); @@ -441,8 +441,8 @@ select dayofyear("0000-00-00"),dayofyear(d),dayofyear(dt),dayofyear(t),dayofyear dayofyear("0000-00-00") dayofyear(d) dayofyear(dt) dayofyear(t) dayofyear(c) NULL NULL NULL NULL NULL Warnings: -Warning 1292 Truncated incorrect datetime value: '0000-00-00' -Warning 1292 Truncated incorrect datetime value: '0000-00-00' +Warning 1292 Incorrect datetime value: '0000-00-00' +Warning 1292 Incorrect datetime value: '0000-00-00' select dayofmonth("0000-00-00"),dayofmonth(d),dayofmonth(dt),dayofmonth(t),dayofmonth(c) from t1; dayofmonth("0000-00-00") dayofmonth(d) dayofmonth(dt) dayofmonth(t) dayofmonth(c) 0 0 0 0 0 @@ -456,8 +456,8 @@ select week("0000-00-00"),week(d),week(dt),week(t),week(c) from t1; week("0000-00-00") week(d) week(dt) week(t) week(c) NULL NULL NULL NULL NULL Warnings: -Warning 1292 Truncated incorrect datetime value: '0000-00-00' -Warning 1292 Truncated incorrect datetime value: '0000-00-00' +Warning 1292 Incorrect datetime value: '0000-00-00' +Warning 1292 Incorrect datetime value: '0000-00-00' select year("0000-00-00"),year(d),year(dt),year(t),year(c) from t1; year("0000-00-00") year(d) year(dt) year(t) year(c) 0 0 0 0 0 @@ -465,14 +465,14 @@ select yearweek("0000-00-00"),yearweek(d),yearweek(dt),yearweek(t),yearweek(c) f yearweek("0000-00-00") yearweek(d) yearweek(dt) yearweek(t) yearweek(c) NULL NULL NULL NULL NULL Warnings: -Warning 1292 Truncated incorrect datetime value: '0000-00-00' -Warning 1292 Truncated incorrect datetime value: '0000-00-00' +Warning 1292 Incorrect datetime value: '0000-00-00' +Warning 1292 Incorrect datetime value: '0000-00-00' select to_days("0000-00-00"),to_days(d),to_days(dt),to_days(t),to_days(c) from t1; to_days("0000-00-00") to_days(d) to_days(dt) to_days(t) to_days(c) NULL NULL NULL NULL NULL Warnings: -Warning 1292 Truncated incorrect datetime value: '0000-00-00' -Warning 1292 Truncated incorrect datetime value: '0000-00-00' +Warning 1292 Incorrect datetime value: '0000-00-00' +Warning 1292 Incorrect datetime value: '0000-00-00' select extract(MONTH FROM "0000-00-00"),extract(MONTH FROM d),extract(MONTH FROM dt),extract(MONTH FROM t),extract(MONTH FROM c) from t1; extract(MONTH FROM "0000-00-00") extract(MONTH FROM d) extract(MONTH FROM dt) extract(MONTH FROM t) extract(MONTH FROM c) 0 0 0 0 0 @@ -628,7 +628,7 @@ select date_add(time,INTERVAL 1 SECOND) from t1; date_add(time,INTERVAL 1 SECOND) NULL Warnings: -Warning 1264 Out of range value adjusted for column 'time' at row 1 +Warning 1264 Out of range value for column 'time' at row 1 drop table t1; select last_day('2000-02-05') as f1, last_day('2002-12-31') as f2, last_day('2003-03-32') as f3, last_day('2003-04-01') as f4, @@ -637,7 +637,7 @@ last_day('2001-02-12'); f1 f2 f3 f4 f5 last_day(NULL) last_day('2001-02-12') 2000-02-29 2002-12-31 NULL 2003-04-30 2001-01-31 NULL 2001-02-28 Warnings: -Warning 1292 Truncated incorrect datetime value: '2003-03-32' +Warning 1292 Incorrect datetime value: '2003-03-32' create table t1 select last_day('2000-02-05') as a, from_days(to_days("960101")) as b; describe t1; @@ -706,17 +706,17 @@ select last_day('2005-00-00'); last_day('2005-00-00') NULL Warnings: -Warning 1292 Truncated incorrect datetime value: '2005-00-00' +Warning 1292 Incorrect datetime value: '2005-00-00' select last_day('2005-00-01'); last_day('2005-00-01') NULL Warnings: -Warning 1292 Truncated incorrect datetime value: '2005-00-01' +Warning 1292 Incorrect datetime value: '2005-00-01' select last_day('2005-01-00'); last_day('2005-01-00') NULL Warnings: -Warning 1292 Truncated incorrect datetime value: '2005-01-00' +Warning 1292 Incorrect datetime value: '2005-01-00' select time_format('100:00:00', '%H %k %h %I %l'); time_format('100:00:00', '%H %k %h %I %l') 100 100 04 04 4 diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result index 14393be1cc8..448847bc919 100644 --- a/mysql-test/r/grant.result +++ b/mysql-test/r/grant.result @@ -238,7 +238,7 @@ Grants for drop_user@localhost GRANT USAGE ON *.* TO 'drop_user'@'localhost' drop user drop_user@localhost; revoke all privileges, grant option from drop_user@localhost; -ERROR HY000: Can't revoke all privileges, grant for one or more of the requested users +ERROR HY000: Can't revoke all privileges for one or more of the requested users grant select(a) on test.t1 to drop_user1@localhost; grant select on test.t1 to drop_user2@localhost; grant select on test.* to drop_user3@localhost; @@ -247,7 +247,7 @@ drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost, drop_user4@localhost; revoke all privileges, grant option from drop_user1@localhost, drop_user2@localhost, drop_user3@localhost, drop_user4@localhost; -ERROR HY000: Can't revoke all privileges, grant for one or more of the requested users +ERROR HY000: Can't revoke all privileges for one or more of the requested users drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost, drop_user4@localhost; ERROR HY000: Operation DROP USER failed for 'drop_user1'@'localhost','drop_user2'@'localhost','drop_user3'@'localhost','drop_user4'@'localhost' @@ -594,3 +594,24 @@ flush privileges; set @user123="non-existent"; select * from mysql.db where user=@user123; Host Db User Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Grant_priv References_priv Index_priv Alter_priv Create_tmp_table_priv Lock_tables_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Execute_priv +set names koi8r; +create database ÂÄ; +grant select on ÂÄ.* to root@localhost; +select hex(Db) from mysql.db where Db='ÂÄ'; +hex(Db) +D0B1D0B4 +show grants for root@localhost; +Grants for root@localhost +GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION +GRANT SELECT ON `ÂÄ`.* TO 'root'@'localhost' +flush privileges; +show grants for root@localhost; +Grants for root@localhost +GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION +GRANT SELECT ON `ÂÄ`.* TO 'root'@'localhost' +drop database ÂÄ; +revoke all privileges on ÂÄ.* from root@localhost; +show grants for root@localhost; +Grants for root@localhost +GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION +set names latin1; diff --git a/mysql-test/r/grant2.result b/mysql-test/r/grant2.result index ca375ef5057..9c744396403 100644 --- a/mysql-test/r/grant2.result +++ b/mysql-test/r/grant2.result @@ -191,7 +191,7 @@ flush privileges; show grants for 'mysqltest_1'; ERROR 42000: There is no such grant defined for user 'mysqltest_1' on host '%' revoke all privileges, grant option from 'mysqltest_1'; -ERROR HY000: Can't revoke all privileges, grant for one or more of the requested users +ERROR HY000: Can't revoke all privileges for one or more of the requested users drop user 'mysqltest_1'; select host,db,user from mysql.db where user = 'mysqltest_1' order by host,db,user; host db user diff --git a/mysql-test/r/group_min_max.result b/mysql-test/r/group_min_max.result index 038d0c75f74..91579a7ea42 100644 --- a/mysql-test/r/group_min_max.result +++ b/mysql-test/r/group_min_max.result @@ -2002,3 +2002,44 @@ a count(a) 1 1 NULL 1 drop table t1; +create table t1 (f1 int, f2 char(1), primary key(f1,f2)) engine=innodb; +insert into t1 values ( 1,"e"),(2,"a"),( 3,"c"),(4,"d"); +alter table t1 drop primary key, add primary key (f2, f1); +explain select distinct f1 a, f1 b from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL PRIMARY 5 NULL 4 Using index; Using temporary +explain select distinct f1, f2 from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range NULL PRIMARY 5 NULL 3 Using index for group-by; Using temporary +drop table t1; +create table t1 (c1 int not null,c2 int not null, primary key(c1,c2)); +insert into t1 (c1,c2) values +(10,1),(10,2),(10,3),(20,4),(20,5),(20,6),(30,7),(30,8),(30,9); +select distinct c1, c2 from t1 order by c2; +c1 c2 +10 1 +10 2 +10 3 +20 4 +20 5 +20 6 +30 7 +30 8 +30 9 +select c1,min(c2) as c2 from t1 group by c1 order by c2; +c1 c2 +10 1 +20 4 +30 7 +select c1,c2 from t1 group by c1,c2 order by c2; +c1 c2 +10 1 +10 2 +10 3 +20 4 +20 5 +20 6 +30 7 +30 8 +30 9 +drop table t1; diff --git a/mysql-test/r/handler.result b/mysql-test/r/handler.result index 072d4582cbc..133683fb273 100644 --- a/mysql-test/r/handler.result +++ b/mysql-test/r/handler.result @@ -445,3 +445,40 @@ drop table t2; drop table t3; drop table t4; drop table t5; +create table t1 (c1 int); +insert into t1 values (1); +handler t1 open; +handler t1 read first; +c1 +1 +send the below to another connection, do not wait for the result + optimize table t1; +proceed with the normal connection +handler t1 read next; +c1 +1 +handler t1 close; +read the result from the other connection +Table Op Msg_type Msg_text +test.t1 optimize status OK +proceed with the normal connection +drop table t1; +create table t1 (c1 int); +insert into t1 values (14397); +flush tables with read lock; +drop table t1; +ERROR HY000: Can't execute the query because you have a conflicting read lock +send the below to another connection, do not wait for the result + drop table t1; +proceed with the normal connection +select * from t1; +c1 +14397 +unlock tables; +read the result from the other connection +proceed with the normal connection +select * from t1; +ERROR 42S02: Table 'test.t1' doesn't exist +drop table if exists t1; +Warnings: +Note 1051 Unknown table 't1' diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index d013de58a88..c7c3de9451a 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -486,7 +486,6 @@ select s1 from t1 where s1 in (select version from information_schema.tables) union select version from information_schema.tables; s1 -0 10 drop table t1; SHOW CREATE TABLE INFORMATION_SCHEMA.character_sets; @@ -648,12 +647,16 @@ drop function sub1; select table_name from information_schema.views where table_schema='test'; table_name +v2 +v3 Warnings: Warning 1356 View 'test.v2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them Warning 1356 View 'test.v3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them select table_name from information_schema.views where table_schema='test'; table_name +v2 +v3 Warnings: Warning 1356 View 'test.v2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them Warning 1356 View 'test.v3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them @@ -670,6 +673,16 @@ f1_key select constraint_name from information_schema.table_constraints where table_schema='test'; constraint_name +show create view v2; +View Create View +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `test`.`t1`.`f1` AS `c` from `t1` +Warnings: +Warning 1356 View 'test.v2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +show create table v3; +View Create View +v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select sql_no_cache `test`.`sub1`(1) AS `c` +Warnings: +Warning 1356 View 'test.v3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them drop view v2; drop view v3; drop table t4; @@ -723,6 +736,7 @@ information_schema ROUTINES SQL_MODE information_schema TRIGGERS ACTION_CONDITION information_schema TRIGGERS ACTION_STATEMENT information_schema TRIGGERS SQL_MODE +information_schema TRIGGERS DEFINER information_schema VIEWS VIEW_DEFINITION select table_name, column_name, data_type from information_schema.columns where data_type = 'datetime'; @@ -801,45 +815,45 @@ set @fired:= "Yes"; end if; end| show triggers; -Trigger Event Table Statement Timing Created sql_mode +Trigger Event Table Statement Timing Created sql_mode Definer trg1 INSERT t1 begin if new.j > 10 then set new.j := 10; end if; -end BEFORE NULL +end BEFORE NULL root@localhost trg2 UPDATE t1 begin if old.i % 2 = 0 then set new.j := -1; end if; -end BEFORE NULL +end BEFORE NULL root@localhost trg3 UPDATE t1 begin if new.j = -1 then set @fired:= "Yes"; end if; -end AFTER NULL +end AFTER NULL root@localhost select * from information_schema.triggers; -TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER NULL test trg1 INSERT NULL test t1 0 NULL begin if new.j > 10 then set new.j := 10; end if; -end ROW BEFORE NULL NULL OLD NEW NULL +end ROW BEFORE NULL NULL OLD NEW NULL root@localhost NULL test trg2 UPDATE NULL test t1 0 NULL begin if old.i % 2 = 0 then set new.j := -1; end if; -end ROW BEFORE NULL NULL OLD NEW NULL +end ROW BEFORE NULL NULL OLD NEW NULL root@localhost NULL test trg3 UPDATE NULL test t1 0 NULL begin if new.j = -1 then set @fired:= "Yes"; end if; -end ROW AFTER NULL NULL OLD NEW NULL +end ROW AFTER NULL NULL OLD NEW NULL root@localhost drop trigger trg1; drop trigger trg2; drop trigger trg3; @@ -1034,3 +1048,11 @@ blob 65535 65535 text 65535 65535 text 65535 32767 drop table t1; +create table t1 (f1 int(11)); +create view v1 as select * from t1; +drop table t1; +select table_type from information_schema.tables +where table_name="v1"; +table_type +VIEW +drop view v1; diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index dc4893c3bfa..74f40b5ad80 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -1615,7 +1615,7 @@ t2 CREATE TABLE `t2` ( ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t2; create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb; -ERROR HY000: Can't create table './test/t2' (errno: 150) +ERROR HY000: Can't create table 'test.t2' (errno: 150) create table t2 (a int auto_increment primary key, b int, index(b), foreign key (b) references t1(id), unique(b)) engine=innodb; show create table t2; Table Create Table @@ -2437,7 +2437,7 @@ a b 20 NULL drop table t1; create table t1 (v varchar(65530), key(v)); -ERROR HY000: Can't create table './test/t1' (errno: 139) +ERROR HY000: Can't create table 'test.t1' (errno: 139) create table t1 (v varchar(65536)); Warnings: Note 1246 Converting column 'v' from VARCHAR to TEXT @@ -2580,19 +2580,19 @@ character set = latin1 engine = innodb; drop table t1, t2, t3, t4, t5, t6, t7, t8, t9; create table t1 (col1 varchar(768), index (col1)) character set = latin1 engine = innodb; -ERROR HY000: Can't create table './test/t1.frm' (errno: 139) +ERROR HY000: Can't create table 'test.t1' (errno: 139) create table t2 (col1 varchar(768) primary key) character set = latin1 engine = innodb; -ERROR HY000: Can't create table './test/t2.frm' (errno: 139) +ERROR HY000: Can't create table 'test.t2' (errno: 139) create table t3 (col1 varbinary(768) primary key) character set = latin1 engine = innodb; -ERROR HY000: Can't create table './test/t3.frm' (errno: 139) +ERROR HY000: Can't create table 'test.t3' (errno: 139) create table t4 (col1 text, index(col1(768))) character set = latin1 engine = innodb; -ERROR HY000: Can't create table './test/t4.frm' (errno: 139) +ERROR HY000: Can't create table 'test.t4' (errno: 139) create table t5 (col1 blob, index(col1(768))) character set = latin1 engine = innodb; -ERROR HY000: Can't create table './test/t5.frm' (errno: 139) +ERROR HY000: Can't create table 'test.t5' (errno: 139) CREATE TABLE t1 ( id INT PRIMARY KEY @@ -2772,3 +2772,17 @@ insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken'); drop table t1; drop table t2; commit; +create table t1 (a varchar(255) character set utf8, +b varchar(255) character set utf8, +c varchar(255) character set utf8, +d varchar(255) character set utf8, +key (a,b,c,d)) engine=innodb; +drop table t1; +create table t1 (a varchar(255) character set utf8, +b varchar(255) character set utf8, +c varchar(255) character set utf8, +d varchar(255) character set utf8, +e varchar(255) character set utf8, +key (a,b,c,d,e)) engine=innodb; +ERROR 42000: Specified key was too long; max key length is 3072 bytes +End of 5.0 tests diff --git a/mysql-test/r/insert.result b/mysql-test/r/insert.result index f788576f824..5e9ab480558 100644 --- a/mysql-test/r/insert.result +++ b/mysql-test/r/insert.result @@ -63,7 +63,7 @@ insert into t1 values(NULL); ERROR 23000: Column 'id' cannot be null insert into t1 values (1), (NULL), (2); Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'id' at row 2 +Warning 1048 Column 'id' cannot be null select * from t1; id 1 @@ -157,20 +157,20 @@ f_float_3_1_u 0.0 set @value= "1e+1111111111a"; insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); Warnings: -Warning 1264 Out of range value adjusted for column 'f_double' at row 1 -Warning 1264 Out of range value adjusted for column 'f_float' at row 1 -Warning 1264 Out of range value adjusted for column 'f_float' at row 1 -Warning 1264 Out of range value adjusted for column 'f_double_7_2' at row 1 -Warning 1264 Out of range value adjusted for column 'f_double_7_2' at row 1 -Warning 1264 Out of range value adjusted for column 'f_float_4_3' at row 1 -Warning 1264 Out of range value adjusted for column 'f_float_4_3' at row 1 -Warning 1264 Out of range value adjusted for column 'f_double_u' at row 1 -Warning 1264 Out of range value adjusted for column 'f_float_u' at row 1 -Warning 1264 Out of range value adjusted for column 'f_float_u' at row 1 -Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1 -Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1 -Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1 -Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1 +Warning 1264 Out of range value for column 'f_double' at row 1 +Warning 1264 Out of range value for column 'f_float' at row 1 +Warning 1264 Out of range value for column 'f_float' at row 1 +Warning 1264 Out of range value for column 'f_double_7_2' at row 1 +Warning 1264 Out of range value for column 'f_double_7_2' at row 1 +Warning 1264 Out of range value for column 'f_float_4_3' at row 1 +Warning 1264 Out of range value for column 'f_float_4_3' at row 1 +Warning 1264 Out of range value for column 'f_double_u' at row 1 +Warning 1264 Out of range value for column 'f_float_u' at row 1 +Warning 1264 Out of range value for column 'f_float_u' at row 1 +Warning 1264 Out of range value for column 'f_double_15_1_u' at row 1 +Warning 1264 Out of range value for column 'f_double_15_1_u' at row 1 +Warning 1264 Out of range value for column 'f_float_3_1_u' at row 1 +Warning 1264 Out of range value for column 'f_float_3_1_u' at row 1 select * from t1 where number =last_insert_id(); number 4 original_value 1e+1111111111a @@ -185,21 +185,21 @@ f_float_3_1_u 99.9 set @value= "-1e+1111111111a"; insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); Warnings: -Warning 1264 Out of range value adjusted for column 'f_double' at row 1 -Warning 1264 Out of range value adjusted for column 'f_float' at row 1 -Warning 1264 Out of range value adjusted for column 'f_float' at row 1 -Warning 1264 Out of range value adjusted for column 'f_double_7_2' at row 1 -Warning 1264 Out of range value adjusted for column 'f_double_7_2' at row 1 -Warning 1264 Out of range value adjusted for column 'f_float_4_3' at row 1 -Warning 1264 Out of range value adjusted for column 'f_float_4_3' at row 1 -Warning 1264 Out of range value adjusted for column 'f_double_u' at row 1 -Warning 1264 Out of range value adjusted for column 'f_double_u' at row 1 -Warning 1264 Out of range value adjusted for column 'f_float_u' at row 1 -Warning 1264 Out of range value adjusted for column 'f_float_u' at row 1 -Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1 -Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1 -Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1 -Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1 +Warning 1264 Out of range value for column 'f_double' at row 1 +Warning 1264 Out of range value for column 'f_float' at row 1 +Warning 1264 Out of range value for column 'f_float' at row 1 +Warning 1264 Out of range value for column 'f_double_7_2' at row 1 +Warning 1264 Out of range value for column 'f_double_7_2' at row 1 +Warning 1264 Out of range value for column 'f_float_4_3' at row 1 +Warning 1264 Out of range value for column 'f_float_4_3' at row 1 +Warning 1264 Out of range value for column 'f_double_u' at row 1 +Warning 1264 Out of range value for column 'f_double_u' at row 1 +Warning 1264 Out of range value for column 'f_float_u' at row 1 +Warning 1264 Out of range value for column 'f_float_u' at row 1 +Warning 1264 Out of range value for column 'f_double_15_1_u' at row 1 +Warning 1264 Out of range value for column 'f_double_15_1_u' at row 1 +Warning 1264 Out of range value for column 'f_float_3_1_u' at row 1 +Warning 1264 Out of range value for column 'f_float_3_1_u' at row 1 select * from t1 where number =last_insert_id(); number 5 original_value -1e+1111111111a @@ -218,12 +218,12 @@ ERROR 22007: Illegal double '1e+1111111111' value found during parsing set @value= 1e+111; insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); Warnings: -Warning 1264 Out of range value adjusted for column 'f_float' at row 1 -Warning 1264 Out of range value adjusted for column 'f_double_7_2' at row 1 -Warning 1264 Out of range value adjusted for column 'f_float_4_3' at row 1 -Warning 1264 Out of range value adjusted for column 'f_float_u' at row 1 -Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1 -Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1 +Warning 1264 Out of range value for column 'f_float' at row 1 +Warning 1264 Out of range value for column 'f_double_7_2' at row 1 +Warning 1264 Out of range value for column 'f_float_4_3' at row 1 +Warning 1264 Out of range value for column 'f_float_u' at row 1 +Warning 1264 Out of range value for column 'f_double_15_1_u' at row 1 +Warning 1264 Out of range value for column 'f_float_3_1_u' at row 1 select * from t1 where number =last_insert_id(); number 6 original_value 1e+111 @@ -238,13 +238,13 @@ f_float_3_1_u 99.9 set @value= -1e+111; insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); Warnings: -Warning 1264 Out of range value adjusted for column 'f_float' at row 1 -Warning 1264 Out of range value adjusted for column 'f_double_7_2' at row 1 -Warning 1264 Out of range value adjusted for column 'f_float_4_3' at row 1 -Warning 1264 Out of range value adjusted for column 'f_double_u' at row 1 -Warning 1264 Out of range value adjusted for column 'f_float_u' at row 1 -Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1 -Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1 +Warning 1264 Out of range value for column 'f_float' at row 1 +Warning 1264 Out of range value for column 'f_double_7_2' at row 1 +Warning 1264 Out of range value for column 'f_float_4_3' at row 1 +Warning 1264 Out of range value for column 'f_double_u' at row 1 +Warning 1264 Out of range value for column 'f_float_u' at row 1 +Warning 1264 Out of range value for column 'f_double_15_1_u' at row 1 +Warning 1264 Out of range value for column 'f_float_3_1_u' at row 1 select * from t1 where number =last_insert_id(); number 7 original_value -1e+111 @@ -272,10 +272,10 @@ f_float_3_1_u 1.0 set @value= -1; insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); Warnings: -Warning 1264 Out of range value adjusted for column 'f_double_u' at row 1 -Warning 1264 Out of range value adjusted for column 'f_float_u' at row 1 -Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1 -Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1 +Warning 1264 Out of range value for column 'f_double_u' at row 1 +Warning 1264 Out of range value for column 'f_float_u' at row 1 +Warning 1264 Out of range value for column 'f_double_15_1_u' at row 1 +Warning 1264 Out of range value for column 'f_float_3_1_u' at row 1 select * from t1 where number =last_insert_id(); number 9 original_value -1 diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result index 434dddb3049..fa8c3f8a2b8 100644 --- a/mysql-test/r/insert_select.result +++ b/mysql-test/r/insert_select.result @@ -606,8 +606,8 @@ NULL 2 100 create table t2(No int not null, Field int not null, Count int not null); insert into t2 Select null, Field, Count From t1 Where Month=20030901 and Type=2; Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'No' at row 1 -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'No' at row 2 +Warning 1048 Column 'No' cannot be null +Warning 1048 Column 'No' cannot be null select * from t2; No Field Count 0 1 100 diff --git a/mysql-test/r/is_debug_build.require b/mysql-test/r/is_debug_build.require new file mode 100644 index 00000000000..4d77bcdc1ed --- /dev/null +++ b/mysql-test/r/is_debug_build.require @@ -0,0 +1,2 @@ +instr(version(), "debug") > 0 +1 diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result index c887dc9d6a7..724d1b1e39f 100644 --- a/mysql-test/r/join.result +++ b/mysql-test/r/join.result @@ -391,3 +391,304 @@ i i i 2 NULL 4 2 2 2 drop table t1,t2,t3; +create table t1 (c int, b int); +create table t2 (a int, b int); +create table t3 (b int, c int); +create table t4 (y int, c int); +create table t5 (y int, z int); +create table t6 (a int, c int); +insert into t1 values (10,1); +insert into t1 values (3 ,1); +insert into t1 values (3 ,2); +insert into t2 values (2, 1); +insert into t3 values (1, 3); +insert into t3 values (1,10); +insert into t4 values (11,3); +insert into t4 values (2, 3); +insert into t5 values (11,4); +insert into t6 values (2, 3); +create algorithm=merge view v1a as +select * from t1 natural join t2; +create algorithm=merge view v1b(a,b,c) as +select * from t1 natural join t2; +create algorithm=merge view v1c as +select b as a, c as b, a as c from t1 natural join t2; +create algorithm=merge view v1d(b, a, c) as +select a as c, c as b, b as a from t1 natural join t2; +create algorithm=merge view v2a as +select t1.c, t1.b, t2.a from t1 join (t2 join t4 on b + 1 = y) on t1.c = t4.c; +create algorithm=merge view v2b as +select t1.c as b, t1.b as a, t2.a as c +from t1 join (t2 join t4 on b + 1 = y) on t1.c = t4.c; +create algorithm=merge view v3a as +select * from t1 natural join t2 natural join t3; +create algorithm=merge view v3b as +select * from t1 natural join (t2 natural join t3); +create algorithm=merge view v4 as +select * from v2a natural join v3a; +select * from (t1 natural join t2) natural join (t3 natural join t4); +b c a y +1 3 2 11 +1 3 2 2 +select * from (t1 natural join t2) natural left join (t3 natural join t4); +b c a y +1 10 2 NULL +1 3 2 11 +1 3 2 2 +select * from (t3 natural join t4) natural right join (t1 natural join t2); +b c a y +1 10 2 NULL +1 3 2 11 +1 3 2 2 +select * from (t1 natural left join t2) natural left join (t3 natural left join t4); +b c a y +1 10 2 NULL +1 3 2 11 +1 3 2 2 +2 3 NULL NULL +select * from (t4 natural right join t3) natural right join (t2 natural right join t1); +b c a y +1 10 2 NULL +1 3 2 11 +1 3 2 2 +2 3 NULL NULL +select * from t1 natural join t2 natural join t3 natural join t4; +c b a y +3 1 2 11 +3 1 2 2 +select * from ((t1 natural join t2) natural join t3) natural join t4; +c b a y +3 1 2 11 +3 1 2 2 +select * from t1 natural join (t2 natural join (t3 natural join t4)); +c b a y +3 1 2 11 +3 1 2 2 +select * from t5 natural right join (t4 natural right join ((t2 natural right join t1) natural right join t3)); +y c b a z +11 3 1 2 4 +2 3 1 2 NULL +NULL 10 1 2 NULL +select * from (t1 natural join t2), (t3 natural join t4); +b c a c b y +1 10 2 3 1 11 +1 10 2 3 1 2 +1 3 2 3 1 11 +1 3 2 3 1 2 +select * from (t1 join t2 using (b)) join (t3 join t4 using (c)) using (c); +c b a b y +3 1 2 1 11 +3 1 2 1 2 +select * from (t1 join t2 using (b)) natural join (t3 join t4 using (c)); +b c a y +1 3 2 11 +1 3 2 2 +select a,b,c from (t1 natural join t2) natural join (t3 natural join t4) +where b + 1 = y or b + 10 = y group by b,c,a having min(b) < max(y) order by a; +a b c +2 1 3 +select * from (t1 natural join t2) natural left join (t3 natural join t4) +where b + 1 = y or b + 10 = y group by b,c,a,y having min(b) < max(y) order by a, y; +b c a y +1 3 2 2 +1 3 2 11 +select * from (t3 natural join t4) natural right join (t1 natural join t2) +where b + 1 = y or b + 10 = y group by b,c,a,y having min(b) < max(y) order by a, y; +b c a y +1 3 2 2 +1 3 2 11 +select * from t1 natural join t2 where t1.c > t2.a; +b c a +1 10 2 +1 3 2 +select * from t1 natural join t2 where t1.b > t2.b; +b c a +select * from t1 natural left join (t4 natural join t5) where t5.z is not NULL; +c b y z +3 1 11 4 +3 2 11 4 +select * from t1 join (t2 join t4 on b + 1 = y) on t1.c = t4.c; +c b a b y c +3 1 2 1 2 3 +3 2 2 1 2 3 +select * from (t2 join t4 on b + 1 = y) join t1 on t1.c = t4.c; +a b y c c b +2 1 2 3 3 1 +2 1 2 3 3 2 +select * from t1 natural join (t2 join t4 on b + 1 = y); +c b a y +3 1 2 2 +select * from (t1 cross join t2) join (t3 cross join t4) on (a < y and t2.b < t3.c); +c b a b b c y c +10 1 2 1 1 3 11 3 +10 1 2 1 1 10 11 3 +3 1 2 1 1 3 11 3 +3 1 2 1 1 10 11 3 +3 2 2 1 1 3 11 3 +3 2 2 1 1 10 11 3 +select * from (t1, t2) join (t3, t4) on (a < y and t2.b < t3.c); +c b a b b c y c +10 1 2 1 1 3 11 3 +10 1 2 1 1 10 11 3 +3 1 2 1 1 3 11 3 +3 1 2 1 1 10 11 3 +3 2 2 1 1 3 11 3 +3 2 2 1 1 10 11 3 +select * from (t1 natural join t2) join (t3 natural join t4) on a = y; +b c a c b y +1 10 2 3 1 2 +1 3 2 3 1 2 +select * from ((t3 join (t1 join t2 on c > a) on t3.b < t2.a) join t4 on y > t1.c) join t5 on z = t1.b + 3; +b c c b a b y c y z +1 3 10 1 2 1 11 3 11 4 +1 10 10 1 2 1 11 3 11 4 +1 3 3 1 2 1 11 3 11 4 +1 10 3 1 2 1 11 3 11 4 +select * from t1 natural join t2 where t1.b > 0; +b c a +1 10 2 +1 3 2 +select * from t1 natural join (t4 natural join t5) where t4.y > 7; +c b y z +3 1 11 4 +3 2 11 4 +select * from (t4 natural join t5) natural join t1 where t4.y > 7; +c y z b +3 11 4 1 +3 11 4 2 +select * from t1 natural left join (t4 natural join t5) where t4.y > 7; +c b y z +3 1 11 4 +3 2 11 4 +select * from (t4 natural join t5) natural right join t1 where t4.y > 7; +c b y z +3 1 11 4 +3 2 11 4 +select * from (t1 natural join t2) join (t3 natural join t4) on t1.b = t3.b; +b c a c b y +1 10 2 3 1 11 +1 10 2 3 1 2 +1 3 2 3 1 11 +1 3 2 3 1 2 +select t1.*, t2.* from t1 natural join t2; +c b a b +10 1 2 1 +3 1 2 1 +select t1.*, t2.*, t3.*, t4.* from (t1 natural join t2) natural join (t3 natural join t4); +c b a b b c y c +3 1 2 1 1 3 11 3 +3 1 2 1 1 3 2 3 +select * from (select * from t1 natural join t2) as t12 +natural join +(select * from t3 natural join t4) as t34; +b c a y +1 3 2 11 +1 3 2 2 +select * from (select * from t1 natural join t2) as t12 +natural left join +(select * from t3 natural join t4) as t34; +b c a y +1 10 2 NULL +1 3 2 11 +1 3 2 2 +select * from (select * from t3 natural join t4) as t34 +natural right join +(select * from t1 natural join t2) as t12; +b c a y +1 10 2 NULL +1 3 2 11 +1 3 2 2 +select * from v1a; +b c a +1 10 2 +1 3 2 +select * from v1b; +a b c +1 10 2 +1 3 2 +select * from v1c; +a b c +1 10 2 +1 3 2 +select * from v1d; +b a c +2 10 1 +2 3 1 +select * from v2a; +c b a +3 1 2 +3 2 2 +select * from v2b; +b a c +3 1 2 +3 2 2 +select * from v3a; +b c a +1 10 2 +1 3 2 +select * from v3b; +c b a +10 1 2 +3 1 2 +select * from v4; +c b a +3 1 2 +select * from v1a natural join v2a; +b c a +1 3 2 +select v2a.* from v1a natural join v2a; +c b a +3 1 2 +select * from v1b join v2a on v1b.b = v2a.c; +a b c c b a +1 3 2 3 1 2 +1 3 2 3 2 2 +select * from v1c join v2a on v1c.b = v2a.c; +a b c c b a +1 3 2 3 1 2 +1 3 2 3 2 2 +select * from v1d join v2a on v1d.a = v2a.c; +b a c c b a +2 3 1 3 1 2 +2 3 1 3 2 2 +select * from v1a join (t3 natural join t4) on a = y; +b c a c b y +1 10 2 3 1 2 +1 3 2 3 1 2 +select * from t1 natural join (t3 cross join t4); +ERROR 23000: Column 'c' in from clause is ambiguous +select * from (t3 cross join t4) natural join t1; +ERROR 23000: Column 'c' in from clause is ambiguous +select * from t1 join (t2, t3) using (b); +ERROR 23000: Column 'b' in from clause is ambiguous +select * from ((t1 natural join t2), (t3 natural join t4)) natural join t6; +ERROR 23000: Column 'c' in from clause is ambiguous +select * from ((t1 natural join t2), (t3 natural join t4)) natural join t6; +ERROR 23000: Column 'c' in from clause is ambiguous +select * from (t1 join t2 on t1.b=t2.b) natural join (t3 natural join t4); +ERROR 23000: Column 'b' in from clause is ambiguous +select * from (t3 natural join t4) natural join (t1 join t2 on t1.b=t2.b); +ERROR 23000: Column 'b' in from clause is ambiguous +select * from (t3 join (t4 natural join t5) on (b < z)) +natural join +(t1 natural join t2); +ERROR 23000: Column 'c' in from clause is ambiguous +select t1.b from v1a; +ERROR 42S22: Unknown column 't1.b' in 'field list' +select * from v1a join v1b on t1.b = t2.b; +ERROR 42S22: Unknown column 't1.b' in 'on clause' +drop table t1; +drop table t2; +drop table t3; +drop table t4; +drop table t5; +drop table t6; +drop view v1a; +drop view v1b; +drop view v1c; +drop view v1d; +drop view v2a; +drop view v2b; +drop view v3a; +drop view v3b; +drop view v4; diff --git a/mysql-test/r/join_nested.result b/mysql-test/r/join_nested.result index 9d514be76e8..6b7293d46bc 100644 --- a/mysql-test/r/join_nested.result +++ b/mysql-test/r/join_nested.result @@ -1403,3 +1403,67 @@ SELECT v2.x FROM v2 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d); ERROR 42S22: Unknown column 'v2.x' in 'field list' DROP VIEW v1, v2; DROP TABLE t1, t2, t3, t4, t5, t6; +create table t1 (id1 int(11) not null); +insert into t1 values (1),(2); +create table t2 (id2 int(11) not null); +insert into t2 values (1),(2),(3),(4); +create table t3 (id3 char(16) not null); +insert into t3 values ('100'); +create table t4 (id2 int(11) not null, id3 char(16)); +create table t5 (id1 int(11) not null, key (id1)); +insert into t5 values (1),(2),(1); +create view v1 as +select t4.id3 from t4 join t2 on t4.id2 = t2.id2; +select t1.id1 from t1 inner join (t3 left join v1 on t3.id3 = v1.id3); +id1 +1 +2 +drop view v1; +drop table t1, t2, t3, t4, t5; +create table t0 (a int); +insert into t0 values (0),(1),(2),(3); +create table t1(a int); +insert into t1 select A.a + 10*(B.a) from t0 A, t0 B; +create table t2 (a int, b int); +insert into t2 values (1,1), (2,2), (3,3); +create table t3(a int, b int, filler char(200), key(a)); +insert into t3 select a,a,'filler' from t1; +insert into t3 select a,a,'filler' from t1; +create table t4 like t3; +insert into t4 select * from t3; +insert into t4 select * from t3; +create table t5 like t4; +insert into t5 select * from t4; +insert into t5 select * from t4; +create table t6 like t5; +insert into t6 select * from t5; +insert into t6 select * from t5; +create table t7 like t6; +insert into t7 select * from t6; +insert into t7 select * from t6; +explain select * from t4 join +t2 left join (t3 join t5 on t5.a=t3.b) on t3.a=t2.b where t4.a<=>t3.b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL X +1 SIMPLE t3 ref a a 5 test.t2.b X +1 SIMPLE t5 ref a a 5 test.t3.b X +1 SIMPLE t4 ref a a 5 test.t3.b X Using where +explain select * from (t4 join t6 on t6.a=t4.b) right join t3 on t4.a=t3.b +join t2 left join (t5 join t7 on t7.a=t5.b) on t5.a=t2.b where t3.a<=>t2.b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL X +1 SIMPLE t3 ref a a 5 test.t2.b X Using where +1 SIMPLE t4 ref a a 5 test.t3.b X +1 SIMPLE t6 ref a a 5 test.t4.b X +1 SIMPLE t5 ref a a 5 test.t2.b X +1 SIMPLE t7 ref a a 5 test.t5.b X +explain select * from t2 left join +(t3 left join (t4 join t6 on t6.a=t4.b) on t4.a=t3.b +join t5 on t5.a=t3.b) on t3.a=t2.b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL X +1 SIMPLE t3 ref a a 5 test.t2.b X +1 SIMPLE t4 ref a a 5 test.t3.b X +1 SIMPLE t6 ref a a 5 test.t4.b X +1 SIMPLE t5 ref a a 5 test.t3.b X +drop table t0, t1, t2, t3, t4, t5, t6, t7; diff --git a/mysql-test/r/key.result b/mysql-test/r/key.result index bc9d3935bc4..095c8798b29 100644 --- a/mysql-test/r/key.result +++ b/mysql-test/r/key.result @@ -159,8 +159,8 @@ CREATE TABLE t1 (c CHAR(10) NOT NULL,i INT NOT NULL AUTO_INCREMENT, UNIQUE (c,i)); INSERT INTO t1 (c) VALUES (NULL),(NULL); Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 1 -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 2 +Warning 1048 Column 'c' cannot be null +Warning 1048 Column 'c' cannot be null SELECT * FROM t1; c i 1 diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result index 4e47ce6f82c..a52952ffdb5 100644 --- a/mysql-test/r/loaddata.result +++ b/mysql-test/r/loaddata.result @@ -43,9 +43,9 @@ drop table t1; create table t1 (a int, b char(10)); load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines; Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 3 +Warning 1264 Out of range value for column 'a' at row 3 Warning 1262 Row 3 was truncated; it contained more data than there were input columns -Warning 1264 Out of range value adjusted for column 'a' at row 5 +Warning 1264 Out of range value for column 'a' at row 5 Warning 1262 Row 5 was truncated; it contained more data than there were input columns select * from t1; a b @@ -57,7 +57,7 @@ a b truncate table t1; load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines; Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 4 +Warning 1264 Out of range value for column 'a' at row 4 Warning 1261 Row 4 doesn't contain data for all columns select * from t1; a b diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result index e028e58acf5..786c61401b2 100644 --- a/mysql-test/r/merge.result +++ b/mysql-test/r/merge.result @@ -181,6 +181,9 @@ select * from t4; ERROR HY000: All tables in the MERGE table are not identically defined alter table t4 add column c int; ERROR HY000: All tables in the MERGE table are not identically defined +flush tables; +select * from t4; +ERROR HY000: All tables in the MERGE table are not identically defined create database mysqltest; create table mysqltest.t6 (a int not null primary key auto_increment, message char(20)); create table t5 (a int not null, b char(20), key(a)) engine=MERGE UNION=(test.t1,mysqltest.t6); diff --git a/mysql-test/r/mix_innodb_myisam_binlog.result b/mysql-test/r/mix_innodb_myisam_binlog.result index e4528450b31..c84bd65e748 100644 --- a/mysql-test/r/mix_innodb_myisam_binlog.result +++ b/mysql-test/r/mix_innodb_myisam_binlog.result @@ -205,3 +205,54 @@ select (@after-@before) >= 2; (@after-@before) >= 2 1 drop table t1,t2; +commit; +begin; +create temporary table ti (a int) engine=innodb; +rollback; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +insert into ti values(1); +set autocommit=0; +create temporary table t1 (a int) engine=myisam; +commit; +insert t1 values (1); +rollback; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +create table t0 (n int); +insert t0 select * from t1; +set autocommit=1; +insert into t0 select GET_LOCK("lock1",null); +set autocommit=0; +create table t2 (n int) engine=innodb; +insert into t2 values (3); +select get_lock("lock1",60); +get_lock("lock1",60) +1 +show binlog events from 98; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 98 Query 1 # use `test`; BEGIN +master-bin.000001 166 Query 1 # use `test`; insert into t1 values(16) +master-bin.000001 254 Query 1 # use `test`; insert into t1 values(18) +master-bin.000001 342 Xid 1 # COMMIT /* xid=105 */ +master-bin.000001 369 Query 1 # use `test`; delete from t1 +master-bin.000001 446 Xid 1 # COMMIT /* xid=114 */ +master-bin.000001 473 Query 1 # use `test`; delete from t2 +master-bin.000001 550 Xid 1 # COMMIT /* xid=115 */ +master-bin.000001 577 Query 1 # use `test`; alter table t2 type=MyISAM +master-bin.000001 666 Query 1 # use `test`; insert into t1 values (1) +master-bin.000001 754 Xid 1 # COMMIT /* xid=117 */ +master-bin.000001 781 Query 1 # use `test`; insert into t2 values (20) +master-bin.000001 870 Query 1 # use `test`; drop table t1,t2 +master-bin.000001 949 Query 1 # use `test`; create temporary table ti (a int) engine=innodb +master-bin.000001 1059 Query 1 # use `test`; insert into ti values(1) +master-bin.000001 1146 Xid 1 # COMMIT /* xid=132 */ +master-bin.000001 1173 Query 1 # use `test`; create temporary table t1 (a int) engine=myisam +master-bin.000001 1283 Query 1 # use `test`; insert t1 values (1) +master-bin.000001 1366 Query 1 # use `test`; create table t0 (n int) +master-bin.000001 1452 Query 1 # use `test`; insert t0 select * from t1 +master-bin.000001 1541 Query 1 # use `test`; insert into t0 select GET_LOCK("lock1",null) +master-bin.000001 1648 Query 1 # use `test`; create table t2 (n int) engine=innodb +master-bin.000001 1748 Query 1 # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `test`.`t1`,`test`.`ti` +do release_lock("lock1"); +drop table t0,t2; diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index b4265a99604..e000cfd9c11 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -505,6 +505,16 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 system NULL NULL NULL NULL 1 Using temporary 1 SIMPLE t2 index NULL PRIMARY 4 NULL 2 Using index; Distinct drop table t1,t2; +create table t1 ( +c1 varchar(32), +key (c1) +) engine=myisam; +alter table t1 disable keys; +insert into t1 values ('a'), ('b'); +select c1 from t1 order by c1 limit 1; +c1 +a +drop table t1; CREATE TABLE t1 (`a` int(11) NOT NULL default '0', `b` int(11) NOT NULL default '0', UNIQUE KEY `a` USING RTREE (`a`,`b`)) ENGINE=MyISAM; Got one of the listed errors create table t1 (a int, b varchar(200), c text not null) checksum=1; @@ -701,6 +711,24 @@ t1 1 a 2 b A 0 NULL NULL YES BTREE t1 1 a 3 c A 0 NULL NULL YES BTREE t1 1 a 4 d A 0 NULL NULL YES BTREE set myisam_stats_method=DEFAULT; +drop table t1; +create table t1( +cip INT NOT NULL, +time TIME NOT NULL, +score INT NOT NULL DEFAULT 0, +bob TINYBLOB +); +insert into t1 (cip, time) VALUES (1, '00:01'), (2, '00:02'), (3,'00:03'); +insert into t1 (cip, bob, time) VALUES (4, 'a', '00:04'), (5, 'b', '00:05'), +(6, 'c', '00:06'); +select * from t1 where bob is null and cip=1; +cip time score bob +1 00:01:00 0 NULL +create index bug on t1 (bob(22), cip, time); +select * from t1 where bob is null and cip=1; +cip time score bob +1 00:01:00 0 NULL +drop table t1; set storage_engine=MyISAM; drop table if exists t1,t2,t3; --- Testing varchar --- diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index 82a761252b5..e3182d81d46 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -33,7 +33,7 @@ DROP TABLE t1; CREATE TABLE t1 (a double); INSERT INTO t1 VALUES ('-9e999999'); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 1 CREATE TABLE `t1` ( `a` double default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; @@ -1614,6 +1614,16 @@ mysqldump: Couldn't find table: "t\1" mysqldump: Couldn't find table: "t/1" +mysqldump: Couldn't find table: "T_1" + +mysqldump: Couldn't find table: "T%1" + +mysqldump: Couldn't find table: "T'1" + +mysqldump: Couldn't find table: "T_1" + +mysqldump: Couldn't find table: "T_" + test_sequence ------ Testing with illegal database names ------ mysqldump: Got error: 1049: Unknown database 'mysqldump_test_d' when selecting the database @@ -1686,6 +1696,75 @@ test.t1: Records: 1 Deleted: 0 Skipped: 0 Warnings: 0 select * from t1; a b Osnabrück Köln +drop table t1; +create table t1 (a binary(1), b blob); +insert into t1 values ('',''); + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +CREATE TABLE `t1` ( + `a` binary(1) default NULL, + `b` blob +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + + +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +LOCK TABLES `t1` WRITE; +INSERT INTO `t1` VALUES (0x00,''); +UNLOCK TABLES; +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +CREATE TABLE `t1` ( + `a` binary(1) default NULL, + `b` blob +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + + +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +LOCK TABLES `t1` WRITE; +INSERT INTO `t1` VALUES (0x00,''); +UNLOCK TABLES; +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + drop table t1; create table t1(a int); create view v1 as select * from t1; @@ -1926,23 +2005,23 @@ end if; end| set sql_mode=default| show triggers like "t1"; -Trigger Event Table Statement Timing Created sql_mode +Trigger Event Table Statement Timing Created sql_mode Definer trg1 INSERT t1 begin if new.a > 10 then set new.a := 10; set new.a := 11; end if; -end BEFORE 0000-00-00 00:00:00 +end BEFORE 0000-00-00 00:00:00 root@localhost trg2 UPDATE t1 begin if old.a % 2 = 0 then set new.b := 12; end if; -end BEFORE 0000-00-00 00:00:00 +end BEFORE 0000-00-00 00:00:00 root@localhost trg3 UPDATE t1 begin if new.a = -1 then set @fired:= "Yes"; end if; -end AFTER 0000-00-00 00:00:00 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER +end AFTER 0000-00-00 00:00:00 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER root@localhost INSERT INTO t1 (a) VALUES (1),(2),(3),(22); update t1 set a = 4 where a=3; @@ -2085,29 +2164,29 @@ Tables_in_test t1 t2 show triggers; -Trigger Event Table Statement Timing Created sql_mode +Trigger Event Table Statement Timing Created sql_mode Definer trg1 INSERT t1 begin if new.a > 10 then set new.a := 10; set new.a := 11; end if; -end BEFORE # +end BEFORE # root@localhost trg2 UPDATE t1 begin if old.a % 2 = 0 then set new.b := 12; end if; -end BEFORE # +end BEFORE # root@localhost trg3 UPDATE t1 begin if new.a = -1 then set @fired:= "Yes"; end if; -end AFTER # STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER +end AFTER # STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER root@localhost trg4 INSERT t2 begin if new.a > 10 then set @fired:= "No"; end if; -end BEFORE # STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER +end BEFORE # STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER root@localhost DROP TABLE t1, t2; --port=1234 --port=1234 @@ -2130,9 +2209,9 @@ SELECT * FROM `test2`; a2 1 SHOW TRIGGERS; -Trigger Event Table Statement Timing Created sql_mode +Trigger Event Table Statement Timing Created sql_mode Definer testref INSERT test1 BEGIN -INSERT INTO test2 SET a2 = NEW.a1; END BEFORE NULL +INSERT INTO test2 SET a2 = NEW.a1; END BEFORE NULL root@localhost SELECT * FROM `test1`; a1 1 @@ -2147,6 +2226,7 @@ DROP FUNCTION IF EXISTS bug9056_func1; DROP FUNCTION IF EXISTS bug9056_func2; DROP PROCEDURE IF EXISTS bug9056_proc1; DROP PROCEDURE IF EXISTS bug9056_proc2; +DROP PROCEDURE IF EXISTS `a'b`; CREATE TABLE t1 (id int); INSERT INTO t1 VALUES(1), (2), (3), (4), (5); CREATE FUNCTION `bug9056_func1`(a INT, b INT) RETURNS int(11) RETURN a+b // @@ -2483,3 +2563,98 @@ drop view v2; drop view v0; drop view v1; drop table t1; +drop table if exists t1; +CREATE TABLE t1(a int, b int); +INSERT INTO t1 VALUES (1,1); +INSERT INTO t1 VALUES (2,3); +INSERT INTO t1 VALUES (3,4), (4,5); + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +CREATE TABLE `t1` ( + `a` int(11) default NULL, + `b` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + + +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +LOCK TABLES `t1` WRITE; +REPLACE INTO `t1` VALUES (1,1),(2,3),(3,4),(4,5); +UNLOCK TABLES; +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +DROP TABLE t1; +SET @old_sql_mode = @@SQL_MODE; +SET SQL_MODE = IGNORE_SPACE; +CREATE TABLE t1 (a INT); +CREATE TRIGGER tr1 BEFORE INSERT ON t1 +FOR EACH ROW +BEGIN +SET new.a = 0; +END| +SET SQL_MODE = @old_sql_mode; + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `test`; +DROP TABLE IF EXISTS `t1`; +CREATE TABLE `t1` ( + `a` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + + +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +LOCK TABLES `t1` WRITE; +UNLOCK TABLES; +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; + +/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/; +DELIMITER ;; +/*!50003 SET SESSION SQL_MODE="IGNORE_SPACE" */;; +/*!50003 CREATE TRIGGER `tr1` BEFORE INSERT ON `t1` FOR EACH ROW BEGIN +SET new.a = 0; +END */;; + +DELIMITER ; +/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +DROP TRIGGER tr1; +DROP TABLE t1; diff --git a/mysql-test/r/ndb_alter_table.result b/mysql-test/r/ndb_alter_table.result index 84dbe975a59..7526e7348d6 100644 --- a/mysql-test/r/ndb_alter_table.result +++ b/mysql-test/r/ndb_alter_table.result @@ -179,8 +179,7 @@ a b c 2 two two alter table t1 drop index c; select * from t1 where b = 'two'; -a b c -2 two two +ERROR HY000: Can't lock file (errno: 159) select * from t1 where b = 'two'; a b c 2 two two diff --git a/mysql-test/r/ndb_basic.result b/mysql-test/r/ndb_basic.result index 23022378d60..993afcc5860 100644 --- a/mysql-test/r/ndb_basic.result +++ b/mysql-test/r/ndb_basic.result @@ -667,13 +667,13 @@ counter datavalue 57 newval 58 newval drop table t1; +CREATE TABLE t1 ( b INT ) PACK_KEYS = 0 ENGINE = ndb; +select * from t1; +b +drop table t1; create table atablewithareallylongandirritatingname (a int); insert into atablewithareallylongandirritatingname values (2); select * from atablewithareallylongandirritatingname; a 2 drop table atablewithareallylongandirritatingname; -CREATE TABLE t1 ( b INT ) PACK_KEYS = 0 ENGINE = ndb; -select * from t1; -b -drop table t1; diff --git a/mysql-test/r/ndb_bitfield.result b/mysql-test/r/ndb_bitfield.result index 839cfe587e4..77473c41ecd 100644 --- a/mysql-test/r/ndb_bitfield.result +++ b/mysql-test/r/ndb_bitfield.result @@ -201,18 +201,18 @@ create table t1 ( pk1 bit(9) not null primary key, b int ) engine=ndbcluster; -ERROR HY000: Can't create table './test/t1.frm' (errno: 140) +ERROR HY000: Can't create table 'test.t1' (errno: 140) show warnings; Level Code Message Error 1296 Got error 739 'Unsupported primary key length' from NDB -Error 1005 Can't create table './test/t1.frm' (errno: 140) +Error 1005 Can't create table 'test.t1' (errno: 140) create table t1 ( pk1 int not null primary key, b bit(9), key(b) ) engine=ndbcluster; -ERROR HY000: Can't create table './test/t1.frm' (errno: 140) +ERROR HY000: Can't create table 'test.t1' (errno: 140) show warnings; Level Code Message Error 1296 Got error 743 'Unsupported character set in table or index' from NDB -Error 1005 Can't create table './test/t1.frm' (errno: 140) +Error 1005 Can't create table 'test.t1' (errno: 140) diff --git a/mysql-test/r/ndb_charset.result b/mysql-test/r/ndb_charset.result index 32843fd7731..b1f8190f0ca 100644 --- a/mysql-test/r/ndb_charset.result +++ b/mysql-test/r/ndb_charset.result @@ -306,11 +306,21 @@ count(*) drop table t1; create table t1 ( a char(10) primary key -) engine=ndb; -insert into t1 values ('jonas % '); -replace into t1 values ('jonas % '); -replace into t1 values ('jonas % '); +) engine=ndbcluster default charset=latin1; +insert into t1 values ('aaabb'); select * from t1; a -jonas % +aaabb +replace into t1 set a = 'AAABB'; +select * from t1; +a +AAABB +replace into t1 set a = 'aAaBb'; +select * from t1; +a +aAaBb +replace into t1 set a = 'aaabb'; +select * from t1; +a +aaabb drop table t1; diff --git a/mysql-test/r/ndb_config.result b/mysql-test/r/ndb_config.result index ef5c924a398..82d760c6cfc 100644 --- a/mysql-test/r/ndb_config.result +++ b/mysql-test/r/ndb_config.result @@ -1,9 +1,9 @@ -ndbd,1,localhost ndbd,2,localhost ndb_mgmd,3,localhost mysqld,4, mysqld,5, mysqld,6, mysqld,7, -1,localhost,41943040,12582912 2,localhost,41943040,12582912 -1 localhost 41943040 12582912 -2 localhost 41943040 12582912 +ndbd,1,localhost ndbd,2,localhost ndb_mgmd,3,localhost mysqld,4, mysqld,5, mysqld,6, mysqld,7, mysqld,8, mysqld,9, mysqld,10, mysqld,11, +1,localhost,10485760,1048576 2,localhost,10485760,1048576 +1 localhost 10485760 1048576 +2 localhost 10485760 1048576 1 2 -ndbd,1,localhost ndbd,2,localhost ndb_mgmd,3,localhost mysqld,4, mysqld,5, mysqld,6, mysqld,7, +ndbd,1,localhost ndbd,2,localhost ndb_mgmd,3,localhost mysqld,4, mysqld,5, mysqld,6, mysqld,7, mysqld,8, mysqld,9, mysqld,10, mysqld,11, ndbd,1,localhost,52428800,26214400 ndbd,2,localhost,52428800,36700160 ndbd,3,localhost,52428800,52428800 ndbd,4,localhost,52428800,52428800 ndb_mgmd,5,localhost,, mysqld,6,localhost,, ndbd,1,localhost ndbd,2,localhost ndbd,3,localhost ndbd,4,localhost ndb_mgmd,5,localhost mysqld,6, mysqld,7, mysqld,8, mysqld,9, mysqld,10, ndbd,2,localhost ndbd,3,localhost ndbd,4,localhost ndbd,5,localhost ndb_mgmd,6,localhost mysqld,1, mysqld,7, mysqld,8, mysqld,9, mysqld,10, diff --git a/mysql-test/r/ndb_partition_error.result b/mysql-test/r/ndb_partition_error.result index 29a593a96aa..3fd111a7c0f 100644 --- a/mysql-test/r/ndb_partition_error.result +++ b/mysql-test/r/ndb_partition_error.result @@ -11,11 +11,11 @@ partitions 3 (partition x1 values less than (5) nodegroup 12, partition x2 values less than (10) nodegroup 13, partition x3 values less than (20) nodegroup 14); -ERROR HY000: Can't create table './test/t1.frm' (errno: 140) +ERROR HY000: Can't create table 'test.t1' (errno: 140) show warnings; Level Code Message Error 1296 Got error 771 'Given NODEGROUP doesn't exist in this cluster' from NDB -Error 1005 Can't create table './test/t1.frm' (errno: 140) +Error 1005 Can't create table 'test.t1' (errno: 140) CREATE TABLE t1 ( a int not null, b int not null, diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result index 1425b2a7f89..35c8abf07a4 100644 --- a/mysql-test/r/null.result +++ b/mysql-test/r/null.result @@ -97,39 +97,39 @@ Warnings: Warning 1265 Data truncated for column 'd' at row 1 UPDATE t1 SET d=NULL; Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'd' at row 1 +Warning 1048 Column 'd' cannot be null INSERT INTO t1 (a) values (null); ERROR 23000: Column 'a' cannot be null INSERT INTO t1 (a) values (1/null); ERROR 23000: Column 'a' cannot be null INSERT INTO t1 (a) values (null),(null); Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 1 -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 2 +Warning 1048 Column 'a' cannot be null +Warning 1048 Column 'a' cannot be null INSERT INTO t1 (b) values (null); ERROR 23000: Column 'b' cannot be null INSERT INTO t1 (b) values (1/null); ERROR 23000: Column 'b' cannot be null INSERT INTO t1 (b) values (null),(null); Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'b' at row 1 -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'b' at row 2 +Warning 1048 Column 'b' cannot be null +Warning 1048 Column 'b' cannot be null INSERT INTO t1 (c) values (null); ERROR 23000: Column 'c' cannot be null INSERT INTO t1 (c) values (1/null); ERROR 23000: Column 'c' cannot be null INSERT INTO t1 (c) values (null),(null); Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 1 -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 2 +Warning 1048 Column 'c' cannot be null +Warning 1048 Column 'c' cannot be null INSERT INTO t1 (d) values (null); ERROR 23000: Column 'd' cannot be null INSERT INTO t1 (d) values (1/null); ERROR 23000: Column 'd' cannot be null INSERT INTO t1 (d) values (null),(null); Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'd' at row 1 -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'd' at row 2 +Warning 1048 Column 'd' cannot be null +Warning 1048 Column 'd' cannot be null select * from t1; a b c d 0 0000-00-00 00:00:00 0 diff --git a/mysql-test/r/null_key.result b/mysql-test/r/null_key.result index 7f746a3dbd8..15ca73dd7c9 100644 --- a/mysql-test/r/null_key.result +++ b/mysql-test/r/null_key.result @@ -342,7 +342,7 @@ index (id2) ); insert into t1 values(null,null),(1,1); Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'id2' at row 1 +Warning 1048 Column 'id2' cannot be null select * from t1; id id2 NULL 0 diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index eefa45a9e0c..f0500c639a3 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -108,3 +108,9 @@ insert into t1 values (3); insert into t1 values (4); UNLOCK TABLES; drop table t1; +CREATE TABLE `t1` ( +`id` int(11) default NULL +) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 PARTITION BY HASH (id) ; +SELECT * FROM t1; +id +drop table t1; diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index f1c3672083d..bc3d2a6108c 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -337,7 +337,7 @@ set @precision=10000000000; select rand(), cast(rand(10)*@precision as unsigned integer) from t1; rand() cast(rand(10)*@precision as unsigned integer) -- 6570515219 +- 6570515220 - 1282061302 - 6698761160 - 9647622201 @@ -348,23 +348,23 @@ prepare stmt from set @var=1; execute stmt using @var; rand() cast(rand(10)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer) -- 6570515219 - +- 6570515220 - - 1282061302 - - 6698761160 - - 9647622201 - set @var=2; execute stmt using @var; rand() cast(rand(10)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer) -- 6570515219 6555866465 -- 1282061302 1223466192 -- 6698761160 6449731873 +- 6570515220 6555866465 +- 1282061302 1223466193 +- 6698761160 6449731874 - 9647622201 8578261098 set @var=3; execute stmt using @var; rand() cast(rand(10)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer) -- 6570515219 9057697559 +- 6570515220 9057697560 - 1282061302 3730790581 -- 6698761160 1480860534 +- 6698761160 1480860535 - 9647622201 6211931236 drop table t1; deallocate prepare stmt; @@ -806,3 +806,29 @@ execute stmt; @@tx_isolation REPEATABLE-READ deallocate prepare stmt; +prepare stmt from "create temporary table t1 (letter enum('','a','b','c') +not null)"; +execute stmt; +drop table t1; +execute stmt; +drop table t1; +execute stmt; +drop table t1; +set names latin1; +prepare stmt from "create table t1 (a enum('test') default 'test') + character set utf8"; +execute stmt; +drop table t1; +execute stmt; +drop table t1; +execute stmt; +drop table t1; +set names default; +deallocate prepare stmt; +create table t1 (id int); +prepare ins_call from "insert into t1 (id) values (1)"; +execute ins_call; +select row_count(); +row_count() +1 +drop table t1; diff --git a/mysql-test/r/ps_2myisam.result b/mysql-test/r/ps_2myisam.result index c839c8a65b9..e2a224d17c6 100644 --- a/mysql-test/r/ps_2myisam.result +++ b/mysql-test/r/ps_2myisam.result @@ -1302,7 +1302,7 @@ set @arg00=NULL; set @arg01=2; execute stmt1 using @arg00, @arg01; Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 1 +Warning 1048 Column 'a' cannot be null select a,b from t1 order by a; a b 0 two @@ -2570,12 +2570,12 @@ set @arg00= 9223372036854775807 ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 127 c2 32767 @@ -2593,12 +2593,12 @@ set @arg00= '9223372036854775807' ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 127 c2 32767 @@ -2616,12 +2616,12 @@ set @arg00= -9223372036854775808 ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 -128 c2 -32768 @@ -2639,12 +2639,12 @@ set @arg00= '-9223372036854775808' ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 -128 c2 -32768 @@ -2662,14 +2662,14 @@ set @arg00= 1.11111111111111111111e+50 ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c6' at row 1 -Warning 1264 Out of range value adjusted for column 'c7' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c6' at row 1 +Warning 1264 Out of range value for column 'c7' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 127 c2 32767 @@ -2693,8 +2693,8 @@ Warning 1265 Data truncated for column 'c3' at row 1 Warning 1265 Data truncated for column 'c4' at row 1 Warning 1265 Data truncated for column 'c5' at row 1 Warning 1265 Data truncated for column 'c6' at row 1 -Warning 1264 Out of range value adjusted for column 'c7' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c7' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 1 c2 1 @@ -2712,14 +2712,14 @@ set @arg00= -1.11111111111111111111e+50 ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c6' at row 1 -Warning 1264 Out of range value adjusted for column 'c7' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c6' at row 1 +Warning 1264 Out of range value for column 'c7' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 -128 c2 -32768 @@ -2743,8 +2743,8 @@ Warning 1265 Data truncated for column 'c3' at row 1 Warning 1265 Data truncated for column 'c4' at row 1 Warning 1265 Data truncated for column 'c5' at row 1 Warning 1265 Data truncated for column 'c6' at row 1 -Warning 1264 Out of range value adjusted for column 'c7' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c7' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 -1 c2 -1 @@ -2975,45 +2975,45 @@ Warning 1265 Data truncated for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c17' at row 1 Warnings: -Warning 1264 Out of range value adjusted for column 'c13' at row 1 -Warning 1264 Out of range value adjusted for column 'c14' at row 1 +Warning 1264 Out of range value for column 'c13' at row 1 +Warning 1264 Out of range value for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: -Warning 1264 Out of range value adjusted for column 'c13' at row 1 -Warning 1264 Out of range value adjusted for column 'c14' at row 1 +Warning 1264 Out of range value for column 'c13' at row 1 +Warning 1264 Out of range value for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: -Warning 1264 Out of range value adjusted for column 'c13' at row 1 -Warning 1264 Out of range value adjusted for column 'c14' at row 1 +Warning 1264 Out of range value for column 'c13' at row 1 +Warning 1264 Out of range value for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: -Warning 1264 Out of range value adjusted for column 'c13' at row 1 -Warning 1264 Out of range value adjusted for column 'c14' at row 1 +Warning 1264 Out of range value for column 'c13' at row 1 +Warning 1264 Out of range value for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 select c1, c13, c14, c15, c16, c17 from t9 order by c1 ; c1 c13 c14 c15 c16 c17 20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 diff --git a/mysql-test/r/ps_3innodb.result b/mysql-test/r/ps_3innodb.result index 81d6180e41f..469d22d1c8b 100644 --- a/mysql-test/r/ps_3innodb.result +++ b/mysql-test/r/ps_3innodb.result @@ -1285,7 +1285,7 @@ set @arg00=NULL; set @arg01=2; execute stmt1 using @arg00, @arg01; Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 1 +Warning 1048 Column 'a' cannot be null select a,b from t1 order by a; a b 0 two @@ -2553,12 +2553,12 @@ set @arg00= 9223372036854775807 ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 127 c2 32767 @@ -2576,12 +2576,12 @@ set @arg00= '9223372036854775807' ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 127 c2 32767 @@ -2599,12 +2599,12 @@ set @arg00= -9223372036854775808 ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 -128 c2 -32768 @@ -2622,12 +2622,12 @@ set @arg00= '-9223372036854775808' ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 -128 c2 -32768 @@ -2645,14 +2645,14 @@ set @arg00= 1.11111111111111111111e+50 ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c6' at row 1 -Warning 1264 Out of range value adjusted for column 'c7' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c6' at row 1 +Warning 1264 Out of range value for column 'c7' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 127 c2 32767 @@ -2676,8 +2676,8 @@ Warning 1265 Data truncated for column 'c3' at row 1 Warning 1265 Data truncated for column 'c4' at row 1 Warning 1265 Data truncated for column 'c5' at row 1 Warning 1265 Data truncated for column 'c6' at row 1 -Warning 1264 Out of range value adjusted for column 'c7' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c7' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 1 c2 1 @@ -2695,14 +2695,14 @@ set @arg00= -1.11111111111111111111e+50 ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c6' at row 1 -Warning 1264 Out of range value adjusted for column 'c7' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c6' at row 1 +Warning 1264 Out of range value for column 'c7' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 -128 c2 -32768 @@ -2726,8 +2726,8 @@ Warning 1265 Data truncated for column 'c3' at row 1 Warning 1265 Data truncated for column 'c4' at row 1 Warning 1265 Data truncated for column 'c5' at row 1 Warning 1265 Data truncated for column 'c6' at row 1 -Warning 1264 Out of range value adjusted for column 'c7' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c7' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 -1 c2 -1 @@ -2958,45 +2958,45 @@ Warning 1265 Data truncated for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c17' at row 1 Warnings: -Warning 1264 Out of range value adjusted for column 'c13' at row 1 -Warning 1264 Out of range value adjusted for column 'c14' at row 1 +Warning 1264 Out of range value for column 'c13' at row 1 +Warning 1264 Out of range value for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: -Warning 1264 Out of range value adjusted for column 'c13' at row 1 -Warning 1264 Out of range value adjusted for column 'c14' at row 1 +Warning 1264 Out of range value for column 'c13' at row 1 +Warning 1264 Out of range value for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: -Warning 1264 Out of range value adjusted for column 'c13' at row 1 -Warning 1264 Out of range value adjusted for column 'c14' at row 1 +Warning 1264 Out of range value for column 'c13' at row 1 +Warning 1264 Out of range value for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: -Warning 1264 Out of range value adjusted for column 'c13' at row 1 -Warning 1264 Out of range value adjusted for column 'c14' at row 1 +Warning 1264 Out of range value for column 'c13' at row 1 +Warning 1264 Out of range value for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 select c1, c13, c14, c15, c16, c17 from t9 order by c1 ; c1 c13 c14 c15 c16 c17 20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 diff --git a/mysql-test/r/ps_4heap.result b/mysql-test/r/ps_4heap.result index 931e6b7c86c..8616fa0ddf4 100644 --- a/mysql-test/r/ps_4heap.result +++ b/mysql-test/r/ps_4heap.result @@ -1286,7 +1286,7 @@ set @arg00=NULL; set @arg01=2; execute stmt1 using @arg00, @arg01; Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 1 +Warning 1048 Column 'a' cannot be null select a,b from t1 order by a; a b 0 two @@ -2554,12 +2554,12 @@ set @arg00= 9223372036854775807 ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 127 c2 32767 @@ -2577,12 +2577,12 @@ set @arg00= '9223372036854775807' ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 127 c2 32767 @@ -2600,12 +2600,12 @@ set @arg00= -9223372036854775808 ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 -128 c2 -32768 @@ -2623,12 +2623,12 @@ set @arg00= '-9223372036854775808' ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 -128 c2 -32768 @@ -2646,14 +2646,14 @@ set @arg00= 1.11111111111111111111e+50 ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c6' at row 1 -Warning 1264 Out of range value adjusted for column 'c7' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c6' at row 1 +Warning 1264 Out of range value for column 'c7' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 127 c2 32767 @@ -2677,8 +2677,8 @@ Warning 1265 Data truncated for column 'c3' at row 1 Warning 1265 Data truncated for column 'c4' at row 1 Warning 1265 Data truncated for column 'c5' at row 1 Warning 1265 Data truncated for column 'c6' at row 1 -Warning 1264 Out of range value adjusted for column 'c7' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c7' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 1 c2 1 @@ -2696,14 +2696,14 @@ set @arg00= -1.11111111111111111111e+50 ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c6' at row 1 -Warning 1264 Out of range value adjusted for column 'c7' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c6' at row 1 +Warning 1264 Out of range value for column 'c7' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 -128 c2 -32768 @@ -2727,8 +2727,8 @@ Warning 1265 Data truncated for column 'c3' at row 1 Warning 1265 Data truncated for column 'c4' at row 1 Warning 1265 Data truncated for column 'c5' at row 1 Warning 1265 Data truncated for column 'c6' at row 1 -Warning 1264 Out of range value adjusted for column 'c7' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c7' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 -1 c2 -1 @@ -2959,45 +2959,45 @@ Warning 1265 Data truncated for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c17' at row 1 Warnings: -Warning 1264 Out of range value adjusted for column 'c13' at row 1 -Warning 1264 Out of range value adjusted for column 'c14' at row 1 +Warning 1264 Out of range value for column 'c13' at row 1 +Warning 1264 Out of range value for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: -Warning 1264 Out of range value adjusted for column 'c13' at row 1 -Warning 1264 Out of range value adjusted for column 'c14' at row 1 +Warning 1264 Out of range value for column 'c13' at row 1 +Warning 1264 Out of range value for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: -Warning 1264 Out of range value adjusted for column 'c13' at row 1 -Warning 1264 Out of range value adjusted for column 'c14' at row 1 +Warning 1264 Out of range value for column 'c13' at row 1 +Warning 1264 Out of range value for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: -Warning 1264 Out of range value adjusted for column 'c13' at row 1 -Warning 1264 Out of range value adjusted for column 'c14' at row 1 +Warning 1264 Out of range value for column 'c13' at row 1 +Warning 1264 Out of range value for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 select c1, c13, c14, c15, c16, c17 from t9 order by c1 ; c1 c13 c14 c15 c16 c17 20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 diff --git a/mysql-test/r/ps_5merge.result b/mysql-test/r/ps_5merge.result index 3b9244c251f..2d697f7236d 100644 --- a/mysql-test/r/ps_5merge.result +++ b/mysql-test/r/ps_5merge.result @@ -1328,7 +1328,7 @@ set @arg00=NULL; set @arg01=2; execute stmt1 using @arg00, @arg01; Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 1 +Warning 1048 Column 'a' cannot be null select a,b from t1 order by a; a b 0 two @@ -2490,12 +2490,12 @@ set @arg00= 9223372036854775807 ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 127 c2 32767 @@ -2513,12 +2513,12 @@ set @arg00= '9223372036854775807' ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 127 c2 32767 @@ -2536,12 +2536,12 @@ set @arg00= -9223372036854775808 ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 -128 c2 -32768 @@ -2559,12 +2559,12 @@ set @arg00= '-9223372036854775808' ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 -128 c2 -32768 @@ -2582,14 +2582,14 @@ set @arg00= 1.11111111111111111111e+50 ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c6' at row 1 -Warning 1264 Out of range value adjusted for column 'c7' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c6' at row 1 +Warning 1264 Out of range value for column 'c7' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 127 c2 32767 @@ -2613,8 +2613,8 @@ Warning 1265 Data truncated for column 'c3' at row 1 Warning 1265 Data truncated for column 'c4' at row 1 Warning 1265 Data truncated for column 'c5' at row 1 Warning 1265 Data truncated for column 'c6' at row 1 -Warning 1264 Out of range value adjusted for column 'c7' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c7' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 1 c2 1 @@ -2632,14 +2632,14 @@ set @arg00= -1.11111111111111111111e+50 ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c6' at row 1 -Warning 1264 Out of range value adjusted for column 'c7' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c6' at row 1 +Warning 1264 Out of range value for column 'c7' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 -128 c2 -32768 @@ -2663,8 +2663,8 @@ Warning 1265 Data truncated for column 'c3' at row 1 Warning 1265 Data truncated for column 'c4' at row 1 Warning 1265 Data truncated for column 'c5' at row 1 Warning 1265 Data truncated for column 'c6' at row 1 -Warning 1264 Out of range value adjusted for column 'c7' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c7' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 -1 c2 -1 @@ -2895,45 +2895,45 @@ Warning 1265 Data truncated for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c17' at row 1 Warnings: -Warning 1264 Out of range value adjusted for column 'c13' at row 1 -Warning 1264 Out of range value adjusted for column 'c14' at row 1 +Warning 1264 Out of range value for column 'c13' at row 1 +Warning 1264 Out of range value for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: -Warning 1264 Out of range value adjusted for column 'c13' at row 1 -Warning 1264 Out of range value adjusted for column 'c14' at row 1 +Warning 1264 Out of range value for column 'c13' at row 1 +Warning 1264 Out of range value for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: -Warning 1264 Out of range value adjusted for column 'c13' at row 1 -Warning 1264 Out of range value adjusted for column 'c14' at row 1 +Warning 1264 Out of range value for column 'c13' at row 1 +Warning 1264 Out of range value for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: -Warning 1264 Out of range value adjusted for column 'c13' at row 1 -Warning 1264 Out of range value adjusted for column 'c14' at row 1 +Warning 1264 Out of range value for column 'c13' at row 1 +Warning 1264 Out of range value for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 select c1, c13, c14, c15, c16, c17 from t9 order by c1 ; c1 c13 c14 c15 c16 c17 20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 @@ -4340,7 +4340,7 @@ set @arg00=NULL; set @arg01=2; execute stmt1 using @arg00, @arg01; Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 1 +Warning 1048 Column 'a' cannot be null select a,b from t1 order by a; a b 0 two @@ -5502,12 +5502,12 @@ set @arg00= 9223372036854775807 ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 127 c2 32767 @@ -5525,12 +5525,12 @@ set @arg00= '9223372036854775807' ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 127 c2 32767 @@ -5548,12 +5548,12 @@ set @arg00= -9223372036854775808 ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 -128 c2 -32768 @@ -5571,12 +5571,12 @@ set @arg00= '-9223372036854775808' ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 -128 c2 -32768 @@ -5594,14 +5594,14 @@ set @arg00= 1.11111111111111111111e+50 ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c6' at row 1 -Warning 1264 Out of range value adjusted for column 'c7' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c6' at row 1 +Warning 1264 Out of range value for column 'c7' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 127 c2 32767 @@ -5625,8 +5625,8 @@ Warning 1265 Data truncated for column 'c3' at row 1 Warning 1265 Data truncated for column 'c4' at row 1 Warning 1265 Data truncated for column 'c5' at row 1 Warning 1265 Data truncated for column 'c6' at row 1 -Warning 1264 Out of range value adjusted for column 'c7' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c7' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 1 c2 1 @@ -5644,14 +5644,14 @@ set @arg00= -1.11111111111111111111e+50 ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c6' at row 1 -Warning 1264 Out of range value adjusted for column 'c7' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c6' at row 1 +Warning 1264 Out of range value for column 'c7' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 -128 c2 -32768 @@ -5675,8 +5675,8 @@ Warning 1265 Data truncated for column 'c3' at row 1 Warning 1265 Data truncated for column 'c4' at row 1 Warning 1265 Data truncated for column 'c5' at row 1 Warning 1265 Data truncated for column 'c6' at row 1 -Warning 1264 Out of range value adjusted for column 'c7' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c7' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 -1 c2 -1 @@ -5907,45 +5907,45 @@ Warning 1265 Data truncated for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c17' at row 1 Warnings: -Warning 1264 Out of range value adjusted for column 'c13' at row 1 -Warning 1264 Out of range value adjusted for column 'c14' at row 1 +Warning 1264 Out of range value for column 'c13' at row 1 +Warning 1264 Out of range value for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: -Warning 1264 Out of range value adjusted for column 'c13' at row 1 -Warning 1264 Out of range value adjusted for column 'c14' at row 1 +Warning 1264 Out of range value for column 'c13' at row 1 +Warning 1264 Out of range value for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: -Warning 1264 Out of range value adjusted for column 'c13' at row 1 -Warning 1264 Out of range value adjusted for column 'c14' at row 1 +Warning 1264 Out of range value for column 'c13' at row 1 +Warning 1264 Out of range value for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: -Warning 1264 Out of range value adjusted for column 'c13' at row 1 -Warning 1264 Out of range value adjusted for column 'c14' at row 1 +Warning 1264 Out of range value for column 'c13' at row 1 +Warning 1264 Out of range value for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 select c1, c13, c14, c15, c16, c17 from t9 order by c1 ; c1 c13 c14 c15 c16 c17 20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 diff --git a/mysql-test/r/ps_6bdb.result b/mysql-test/r/ps_6bdb.result index 643e12f7e2d..48e672d57d5 100644 --- a/mysql-test/r/ps_6bdb.result +++ b/mysql-test/r/ps_6bdb.result @@ -1285,7 +1285,7 @@ set @arg00=NULL; set @arg01=2; execute stmt1 using @arg00, @arg01; Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 1 +Warning 1048 Column 'a' cannot be null select a,b from t1 order by a; a b 0 two @@ -2553,12 +2553,12 @@ set @arg00= 9223372036854775807 ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 127 c2 32767 @@ -2576,12 +2576,12 @@ set @arg00= '9223372036854775807' ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 127 c2 32767 @@ -2599,12 +2599,12 @@ set @arg00= -9223372036854775808 ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 -128 c2 -32768 @@ -2622,12 +2622,12 @@ set @arg00= '-9223372036854775808' ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 -128 c2 -32768 @@ -2645,14 +2645,14 @@ set @arg00= 1.11111111111111111111e+50 ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c6' at row 1 -Warning 1264 Out of range value adjusted for column 'c7' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c6' at row 1 +Warning 1264 Out of range value for column 'c7' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 127 c2 32767 @@ -2676,8 +2676,8 @@ Warning 1265 Data truncated for column 'c3' at row 1 Warning 1265 Data truncated for column 'c4' at row 1 Warning 1265 Data truncated for column 'c5' at row 1 Warning 1265 Data truncated for column 'c6' at row 1 -Warning 1264 Out of range value adjusted for column 'c7' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c7' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 1 c2 1 @@ -2695,14 +2695,14 @@ set @arg00= -1.11111111111111111111e+50 ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c6' at row 1 -Warning 1264 Out of range value adjusted for column 'c7' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c6' at row 1 +Warning 1264 Out of range value for column 'c7' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 -128 c2 -32768 @@ -2726,8 +2726,8 @@ Warning 1265 Data truncated for column 'c3' at row 1 Warning 1265 Data truncated for column 'c4' at row 1 Warning 1265 Data truncated for column 'c5' at row 1 Warning 1265 Data truncated for column 'c6' at row 1 -Warning 1264 Out of range value adjusted for column 'c7' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c7' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 -1 c2 -1 @@ -2958,45 +2958,45 @@ Warning 1265 Data truncated for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c17' at row 1 Warnings: -Warning 1264 Out of range value adjusted for column 'c13' at row 1 -Warning 1264 Out of range value adjusted for column 'c14' at row 1 +Warning 1264 Out of range value for column 'c13' at row 1 +Warning 1264 Out of range value for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: -Warning 1264 Out of range value adjusted for column 'c13' at row 1 -Warning 1264 Out of range value adjusted for column 'c14' at row 1 +Warning 1264 Out of range value for column 'c13' at row 1 +Warning 1264 Out of range value for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: -Warning 1264 Out of range value adjusted for column 'c13' at row 1 -Warning 1264 Out of range value adjusted for column 'c14' at row 1 +Warning 1264 Out of range value for column 'c13' at row 1 +Warning 1264 Out of range value for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: -Warning 1264 Out of range value adjusted for column 'c13' at row 1 -Warning 1264 Out of range value adjusted for column 'c14' at row 1 +Warning 1264 Out of range value for column 'c13' at row 1 +Warning 1264 Out of range value for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 select c1, c13, c14, c15, c16, c17 from t9 order by c1 ; c1 c13 c14 c15 c16 c17 20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 diff --git a/mysql-test/r/ps_7ndb.result b/mysql-test/r/ps_7ndb.result index 9fbe67f581b..e8a9f772605 100644 --- a/mysql-test/r/ps_7ndb.result +++ b/mysql-test/r/ps_7ndb.result @@ -1285,7 +1285,7 @@ set @arg00=NULL; set @arg01=2; execute stmt1 using @arg00, @arg01; Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 1 +Warning 1048 Column 'a' cannot be null select a,b from t1 order by a; a b 0 two @@ -2553,12 +2553,12 @@ set @arg00= 9223372036854775807 ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 127 c2 32767 @@ -2576,12 +2576,12 @@ set @arg00= '9223372036854775807' ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 127 c2 32767 @@ -2599,12 +2599,12 @@ set @arg00= -9223372036854775808 ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 -128 c2 -32768 @@ -2622,12 +2622,12 @@ set @arg00= '-9223372036854775808' ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 -128 c2 -32768 @@ -2645,14 +2645,14 @@ set @arg00= 1.11111111111111111111e+50 ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c6' at row 1 -Warning 1264 Out of range value adjusted for column 'c7' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c6' at row 1 +Warning 1264 Out of range value for column 'c7' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 127 c2 32767 @@ -2676,8 +2676,8 @@ Warning 1265 Data truncated for column 'c3' at row 1 Warning 1265 Data truncated for column 'c4' at row 1 Warning 1265 Data truncated for column 'c5' at row 1 Warning 1265 Data truncated for column 'c6' at row 1 -Warning 1264 Out of range value adjusted for column 'c7' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c7' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 1 c2 1 @@ -2695,14 +2695,14 @@ set @arg00= -1.11111111111111111111e+50 ; execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 -Warning 1264 Out of range value adjusted for column 'c2' at row 1 -Warning 1264 Out of range value adjusted for column 'c3' at row 1 -Warning 1264 Out of range value adjusted for column 'c4' at row 1 -Warning 1264 Out of range value adjusted for column 'c5' at row 1 -Warning 1264 Out of range value adjusted for column 'c6' at row 1 -Warning 1264 Out of range value adjusted for column 'c7' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c3' at row 1 +Warning 1264 Out of range value for column 'c4' at row 1 +Warning 1264 Out of range value for column 'c5' at row 1 +Warning 1264 Out of range value for column 'c6' at row 1 +Warning 1264 Out of range value for column 'c7' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 -128 c2 -32768 @@ -2726,8 +2726,8 @@ Warning 1265 Data truncated for column 'c3' at row 1 Warning 1265 Data truncated for column 'c4' at row 1 Warning 1265 Data truncated for column 'c5' at row 1 Warning 1265 Data truncated for column 'c6' at row 1 -Warning 1264 Out of range value adjusted for column 'c7' at row 1 -Warning 1264 Out of range value adjusted for column 'c12' at row 1 +Warning 1264 Out of range value for column 'c7' at row 1 +Warning 1264 Out of range value for column 'c12' at row 1 execute my_select ; c1 -1 c2 -1 @@ -2958,45 +2958,45 @@ Warning 1265 Data truncated for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c17' at row 1 Warnings: -Warning 1264 Out of range value adjusted for column 'c13' at row 1 -Warning 1264 Out of range value adjusted for column 'c14' at row 1 +Warning 1264 Out of range value for column 'c13' at row 1 +Warning 1264 Out of range value for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: -Warning 1264 Out of range value adjusted for column 'c13' at row 1 -Warning 1264 Out of range value adjusted for column 'c14' at row 1 +Warning 1264 Out of range value for column 'c13' at row 1 +Warning 1264 Out of range value for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: -Warning 1264 Out of range value adjusted for column 'c13' at row 1 -Warning 1264 Out of range value adjusted for column 'c14' at row 1 +Warning 1264 Out of range value for column 'c13' at row 1 +Warning 1264 Out of range value for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: -Warning 1264 Out of range value adjusted for column 'c13' at row 1 -Warning 1264 Out of range value adjusted for column 'c14' at row 1 +Warning 1264 Out of range value for column 'c13' at row 1 +Warning 1264 Out of range value for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value adjusted for column 'c16' at row 1 -Warning 1264 Out of range value adjusted for column 'c17' at row 1 +Warning 1264 Out of range value for column 'c16' at row 1 +Warning 1264 Out of range value for column 'c17' at row 1 select c1, c13, c14, c15, c16, c17 from t9 order by c1 ; c1 c13 c14 c15 c16 c17 20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result index 97d14b2be3a..e790c8589d0 100644 --- a/mysql-test/r/query_cache.result +++ b/mysql-test/r/query_cache.result @@ -5,6 +5,8 @@ reset query cache; flush status; drop table if exists t1,t2,t3,t4,t11,t21; drop database if exists mysqltest; +drop table if exists ```a`; +drop view if exists v1; create table t1 (a int not null); insert into t1 values (1),(2),(3); select * from t1; @@ -1022,6 +1024,31 @@ Variable_name Value Qcache_hits 1 drop table t1; create table t1 (a int); +flush status; +(select a from t1) union (select a from t1); +a +show status like "Qcache_queries_in_cache"; +Variable_name Value +Qcache_queries_in_cache 1 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 1 +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 0 +(select a from t1) union (select a from t1); +a +show status like "Qcache_queries_in_cache"; +Variable_name Value +Qcache_queries_in_cache 1 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 1 +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 1 +drop table t1; +create table t1 (a int); insert into t1 values (1),(2); CREATE PROCEDURE `p1`() begin diff --git a/mysql-test/r/read_only.result b/mysql-test/r/read_only.result new file mode 100644 index 00000000000..55a14bcaec8 --- /dev/null +++ b/mysql-test/r/read_only.result @@ -0,0 +1,43 @@ +DROP TABLE IF EXISTS t1,t2,t3; +grant CREATE, SELECT, DROP on *.* to test@localhost; +set global read_only=0; +create table t1 (a int); +insert into t1 values(1); +create table t2 select * from t1; +set global read_only=1; +create table t3 (a int); +drop table t3; +select @@global.read_only; +@@global.read_only +1 +create table t3 (a int); +ERROR HY000: The MySQL server is running with the --read-only option so it cannot execute this statement +insert into t1 values(1); +ERROR HY000: The MySQL server is running with the --read-only option so it cannot execute this statement +update t1 set a=1 where 1=0; +ERROR HY000: The MySQL server is running with the --read-only option so it cannot execute this statement +update t1,t2 set t1.a=t2.a+1 where t1.a=t2.a; +ERROR HY000: The MySQL server is running with the --read-only option so it cannot execute this statement +delete t1,t2 from t1,t2 where t1.a=t2.a; +ERROR HY000: The MySQL server is running with the --read-only option so it cannot execute this statement +create temporary table t3 (a int); +create temporary table t4 (a int) select * from t3; +insert into t3 values(1); +insert into t4 select * from t3; +update t1,t3 set t1.a=t3.a+1 where t1.a=t3.a; +ERROR HY000: The MySQL server is running with the --read-only option so it cannot execute this statement +update t1,t3 set t3.a=t1.a+1 where t1.a=t3.a; +update t4,t3 set t4.a=t3.a+1 where t4.a=t3.a; +delete t1 from t1,t3 where t1.a=t3.a; +ERROR HY000: The MySQL server is running with the --read-only option so it cannot execute this statement +delete t3 from t1,t3 where t1.a=t3.a; +delete t4 from t3,t4 where t4.a=t3.a; +create temporary table t1 (a int); +insert into t1 values(1); +update t1,t3 set t1.a=t3.a+1 where t1.a=t3.a; +delete t1 from t1,t3 where t1.a=t3.a; +drop table t1; +insert into t1 values(1); +ERROR HY000: The MySQL server is running with the --read-only option so it cannot execute this statement +drop table t1,t2; +drop user test@localhost; diff --git a/mysql-test/r/rpl_ddl.result b/mysql-test/r/rpl_ddl.result index 2a97da63c64..4d8f2f11d4a 100644 --- a/mysql-test/r/rpl_ddl.result +++ b/mysql-test/r/rpl_ddl.result @@ -1465,13 +1465,13 @@ flush logs; -------- switch to master ------- SHOW TRIGGERS; -Trigger Event Table Statement Timing Created sql_mode -trg1 INSERT t1 SET @a:=1 BEFORE NULL +Trigger Event Table Statement Timing Created sql_mode Definer +trg1 INSERT t1 SET @a:=1 BEFORE NULL root@localhost -------- switch to slave ------- SHOW TRIGGERS; -Trigger Event Table Statement Timing Created sql_mode -trg1 INSERT t1 SET @a:=1 BEFORE NULL +Trigger Event Table Statement Timing Created sql_mode Definer +trg1 INSERT t1 SET @a:=1 BEFORE NULL root@localhost ######## DROP TRIGGER trg1 ######## @@ -1520,11 +1520,11 @@ flush logs; -------- switch to master ------- SHOW TRIGGERS; -Trigger Event Table Statement Timing Created sql_mode +Trigger Event Table Statement Timing Created sql_mode Definer -------- switch to slave ------- SHOW TRIGGERS; -Trigger Event Table Statement Timing Created sql_mode +Trigger Event Table Statement Timing Created sql_mode Definer ######## CREATE USER user1@localhost ######## diff --git a/mysql-test/r/rpl_rewrite_db.result b/mysql-test/r/rpl_rewrite_db.result index d4a24626cc3..6c72e982e3e 100644 --- a/mysql-test/r/rpl_rewrite_db.result +++ b/mysql-test/r/rpl_rewrite_db.result @@ -67,9 +67,9 @@ drop table t1; create table t1 (a int, b char(10)); load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines; Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 3 +Warning 1264 Out of range value for column 'a' at row 3 Warning 1262 Row 3 was truncated; it contained more data than there were input columns -Warning 1264 Out of range value adjusted for column 'a' at row 5 +Warning 1264 Out of range value for column 'a' at row 5 Warning 1262 Row 5 was truncated; it contained more data than there were input columns select * from rewrite.t1; a b @@ -81,7 +81,7 @@ a b truncate table t1; load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines; Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 4 +Warning 1264 Out of range value for column 'a' at row 4 Warning 1261 Row 4 doesn't contain data for all columns select * from rewrite.t1; a b diff --git a/mysql-test/r/rpl_sp.result b/mysql-test/r/rpl_sp.result index 5f1c3afd14d..41bcfc7d72c 100644 --- a/mysql-test/r/rpl_sp.result +++ b/mysql-test/r/rpl_sp.result @@ -4,16 +4,11 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -create database if not exists mysqltest1; +drop database if exists mysqltest1; +create database mysqltest1; use mysqltest1; create table t1 (a varchar(100)); use mysqltest1; -drop procedure if exists foo; -drop procedure if exists foo2; -drop procedure if exists foo3; -drop procedure if exists foo4; -drop procedure if exists bar; -drop function if exists fn1; create procedure foo() begin declare b int; @@ -21,21 +16,9 @@ set b = 8; insert into t1 values (b); insert into t1 values (unix_timestamp()); end| -ERROR HY000: This routine has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_routine_creators variable) -show binlog events from 98| -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # create database if not exists mysqltest1 -master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a varchar(100)) -create procedure foo() deterministic -begin -declare b int; -set b = 8; -insert into t1 values (b); -insert into t1 values (unix_timestamp()); -end| select * from mysql.proc where name='foo' and db='mysqltest1'; db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment -mysqltest1 foo PROCEDURE foo SQL CONTAINS_SQL YES DEFINER begin +mysqltest1 foo PROCEDURE foo SQL CONTAINS_SQL NO DEFINER begin declare b int; set b = 8; insert into t1 values (b); @@ -43,7 +26,7 @@ insert into t1 values (unix_timestamp()); end root@localhost # # select * from mysql.proc where name='foo' and db='mysqltest1'; db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment -mysqltest1 foo PROCEDURE foo SQL CONTAINS_SQL YES DEFINER begin +mysqltest1 foo PROCEDURE foo SQL CONTAINS_SQL NO DEFINER begin declare b int; set b = 8; insert into t1 values (b); @@ -51,17 +34,6 @@ insert into t1 values (unix_timestamp()); end @ # # set timestamp=1000000000; call foo(); -show binlog events from 308; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `mysqltest1`; create procedure foo() deterministic -begin -declare b int; -set b = 8; -insert into t1 values (b); -insert into t1 values (unix_timestamp()); -end -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values ( NAME_CONST('b',8)) -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (unix_timestamp()) select * from t1; a 8 @@ -72,22 +44,10 @@ a 1000000000 delete from t1; create procedure foo2() -not deterministic -reads sql data select * from mysqltest1.t1; call foo2(); a -show binlog events from 518; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values ( NAME_CONST('b',8)) -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (unix_timestamp()) -master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1 -master-bin.000001 # Query 1 # use `mysqltest1`; create procedure foo2() -not deterministic -reads sql data -select * from mysqltest1.t1 alter procedure foo2 contains sql; -ERROR HY000: This routine has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_routine_creators variable) drop table t1; create table t1 (a int); create table t2 like t1; @@ -99,80 +59,62 @@ grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1; grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1; create procedure foo4() deterministic -insert into t1 values (10); -ERROR HY000: You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_routine_creators variable) -set global log_bin_trust_routine_creators=1; -create procedure foo4() -deterministic begin insert into t2 values(3); insert into t1 values (5); end| call foo4(); Got one of the listed errors -show warnings; -Level Code Message -Error 1142 INSERT command denied to user 'zedjzlcsjhd'@'localhost' for table 't1' -Warning 1417 A routine failed and has neither NO SQL nor READS SQL DATA in its declaration and binary logging is enabled; if non-transactional tables were updated, the binary log will miss their changes call foo3(); show warnings; Level Code Message call foo4(); Got one of the listed errors -show warnings; -Level Code Message -Error 1142 INSERT command denied to user 'zedjzlcsjhd'@'127.0.0.1' for table 't1' -Warning 1417 A routine failed and has neither NO SQL nor READS SQL DATA in its declaration and binary logging is enabled; if non-transactional tables were updated, the binary log will miss their changes alter procedure foo4 sql security invoker; call foo4(); show warnings; Level Code Message -show binlog events from 990; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `mysqltest1`; drop table t1 -master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a int) -master-bin.000001 # Query 1 # use `mysqltest1`; create table t2 like t1 -master-bin.000001 # Query 1 # use `mysqltest1`; create procedure foo3() -deterministic -insert into t1 values (15) -master-bin.000001 # Query 1 # use `mysqltest1`; grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1 -master-bin.000001 # Query 1 # use `mysqltest1`; grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1 -master-bin.000001 # Query 1 # use `mysqltest1`; grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1 -master-bin.000001 # Query 1 # use `mysqltest1`; create procedure foo4() +select * from t1; +a +15 +5 +select * from t2; +a +3 +3 +3 +select * from t1; +a +15 +5 +select * from t2; +a +3 +3 +3 +delete from t2; +alter table t2 add unique (a); +drop procedure foo4; +create procedure foo4() deterministic begin -insert into t2 values(3); -insert into t1 values (5); -end -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(3) -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (15) -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(3) -master-bin.000001 # Query 1 # use `mysqltest1`; alter procedure foo4 sql security invoker -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(3) -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (5) -select * from t1; -a -15 -5 +insert into t2 values(20),(20); +end| +call foo4(); +ERROR 23000: Duplicate entry '20' for key 1 +show warnings; +Level Code Message +Error 1062 Duplicate entry '20' for key 1 select * from t2; a -3 -3 -3 -select * from t1; -a -15 -5 +20 select * from t2; a -3 -3 -3 +20 select * from mysql.proc where name="foo4" and db='mysqltest1'; db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment -mysqltest1 foo4 PROCEDURE foo4 SQL CONTAINS_SQL YES INVOKER begin -insert into t2 values(3); -insert into t1 values (5); +mysqltest1 foo4 PROCEDURE foo4 SQL CONTAINS_SQL YES DEFINER begin +insert into t2 values(20),(20); end @ # # drop procedure foo4; select * from mysql.proc where name="foo4" and db='mysqltest1'; @@ -184,6 +126,13 @@ drop procedure foo2; drop procedure foo3; create function fn1(x int) returns int +begin +insert into t1 values (x); +return x+2; +end| +ERROR HY000: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable) +create function fn1(x int) +returns int deterministic begin insert into t1 values (x); @@ -211,18 +160,55 @@ a drop function fn1; create function fn1() returns int -deterministic +no sql begin return unix_timestamp(); end| +alter function fn1 contains sql; +ERROR HY000: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable) delete from t1; set timestamp=1000000000; insert into t1 values(fn1()); +create function fn2() +returns int +no sql +begin +return unix_timestamp(); +end| +ERROR HY000: You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable) +set global log_bin_trust_routine_creators=1; +Warnings: +Warning 1287 'log_bin_trust_routine_creators' is deprecated; use 'log_bin_trust_function_creators' instead +set global log_bin_trust_function_creators=0; +set global log_bin_trust_function_creators=1; +set global log_bin_trust_function_creators=1; +create function fn2() +returns int +no sql +begin +return unix_timestamp(); +end| +create function fn3() +returns int +not deterministic +reads sql data +begin +return 0; +end| +select fn3(); +fn3() +0 select * from mysql.proc where db='mysqltest1'; db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment -mysqltest1 fn1 FUNCTION fn1 SQL CONTAINS_SQL YES DEFINER int(11) begin +mysqltest1 fn1 FUNCTION fn1 SQL NO_SQL NO DEFINER int(11) begin return unix_timestamp(); end root@localhost # # +mysqltest1 fn2 FUNCTION fn2 SQL NO_SQL NO DEFINER int(11) begin +return unix_timestamp(); +end zedjzlcsjhd@localhost # # +mysqltest1 fn3 FUNCTION fn3 SQL READS_SQL_DATA NO DEFINER int(11) begin +return 0; +end root@localhost # # select * from t1; a 1000000000 @@ -232,12 +218,34 @@ a 1000000000 select * from mysql.proc where db='mysqltest1'; db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment -mysqltest1 fn1 FUNCTION fn1 SQL CONTAINS_SQL YES DEFINER int(11) begin +mysqltest1 fn1 FUNCTION fn1 SQL NO_SQL NO DEFINER int(11) begin return unix_timestamp(); end @ # # +mysqltest1 fn2 FUNCTION fn2 SQL NO_SQL NO DEFINER int(11) begin +return unix_timestamp(); +end @ # # +mysqltest1 fn3 FUNCTION fn3 SQL READS_SQL_DATA NO DEFINER int(11) begin +return 0; +end @ # # +delete from t2; +alter table t2 add unique (a); +drop function fn1; +create function fn1() +returns int +begin +insert into t2 values(20),(20); +return 10; +end| +select fn1(); +ERROR 23000: Duplicate entry '20' for key 1 +select * from t2; +a +20 +select * from t2; +a +20 create trigger trg before insert on t1 for each row set new.a= 10; ERROR 42000: Access denied; you need the SUPER privilege for this operation -flush logs; delete from t1; create trigger trg before insert on t1 for each row set new.a= 10; insert into t1 values (1); @@ -253,14 +261,106 @@ insert into t1 values (1); select * from t1; a 1 -show binlog events in 'master-bin.000002' from 98; +show binlog events in 'master-bin.000001' from 98; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000002 # Query 1 # use `mysqltest1`; delete from t1 -master-bin.000002 # Query 1 # use `mysqltest1`; create trigger trg before insert on t1 for each row set new.a= 10 -master-bin.000002 # Query 1 # use `mysqltest1`; insert into t1 values (1) -master-bin.000002 # Query 1 # use `mysqltest1`; delete from t1 -master-bin.000002 # Query 1 # use `mysqltest1`; drop trigger trg -master-bin.000002 # Query 1 # use `mysqltest1`; insert into t1 values (1) +master-bin.000001 # Query 1 # drop database if exists mysqltest1 +master-bin.000001 # Query 1 # create database mysqltest1 +master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a varchar(100)) +master-bin.000001 # Query 1 # use `mysqltest1`; create procedure foo() +begin +declare b int; +set b = 8; +insert into t1 values (b); +insert into t1 values (unix_timestamp()); +end +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values ( NAME_CONST('b',8)) +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (unix_timestamp()) +master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1 +master-bin.000001 # Query 1 # use `mysqltest1`; create procedure foo2() +select * from mysqltest1.t1 +master-bin.000001 # Query 1 # use `mysqltest1`; alter procedure foo2 contains sql +master-bin.000001 # Query 1 # use `mysqltest1`; drop table t1 +master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a int) +master-bin.000001 # Query 1 # use `mysqltest1`; create table t2 like t1 +master-bin.000001 # Query 1 # use `mysqltest1`; create procedure foo3() +deterministic +insert into t1 values (15) +master-bin.000001 # Query 1 # use `mysqltest1`; grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1 +master-bin.000001 # Query 1 # use `mysqltest1`; grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1 +master-bin.000001 # Query 1 # use `mysqltest1`; grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1 +master-bin.000001 # Query 1 # use `mysqltest1`; create procedure foo4() +deterministic +begin +insert into t2 values(3); +insert into t1 values (5); +end +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(3) +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (15) +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(3) +master-bin.000001 # Query 1 # use `mysqltest1`; alter procedure foo4 sql security invoker +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(3) +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (5) +master-bin.000001 # Query 1 # use `mysqltest1`; delete from t2 +master-bin.000001 # Query 1 # use `mysqltest1`; alter table t2 add unique (a) +master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo4 +master-bin.000001 # Query 1 # use `mysqltest1`; create procedure foo4() +deterministic +begin +insert into t2 values(20),(20); +end +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(20),(20) +master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo4 +master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo +master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo2 +master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo3 +master-bin.000001 # Query 1 # use `mysqltest1`; create function fn1(x int) +returns int +deterministic +begin +insert into t1 values (x); +return x+2; +end +master-bin.000001 # Query 1 # use `mysqltest1`; delete t1,t2 from t1,t2 +master-bin.000001 # Query 1 # use `mysqltest1`; DO `fn1`(20) +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(fn1(21)) +master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1 +master-bin.000001 # Query 1 # use `mysqltest1`; create function fn1() +returns int +no sql +begin +return unix_timestamp(); +end +master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1 +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values(fn1()) +master-bin.000001 # Query 1 # use `mysqltest1`; create function fn2() +returns int +no sql +begin +return unix_timestamp(); +end +master-bin.000001 # Query 1 # use `mysqltest1`; create function fn3() +returns int +not deterministic +reads sql data +begin +return 0; +end +master-bin.000001 # Query 1 # use `mysqltest1`; delete from t2 +master-bin.000001 # Query 1 # use `mysqltest1`; alter table t2 add unique (a) +master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1 +master-bin.000001 # Query 1 # use `mysqltest1`; create function fn1() +returns int +begin +insert into t2 values(20),(20); +return 10; +end +master-bin.000001 # Query 1 # use `mysqltest1`; DO `fn1`() +master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1 +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger trg before insert on t1 for each row set new.a= 10 +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (1) +master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1 +master-bin.000001 # Query 1 # use `mysqltest1`; drop trigger trg +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (1) select * from t1; a 1 @@ -275,3 +375,28 @@ drop procedure foo; drop function fn1; drop database mysqltest1; drop user "zedjzlcsjhd"@127.0.0.1; +use test; +use test; +drop function if exists f1; +create function f1() returns int reads sql data +begin +declare var integer; +declare c cursor for select a from v1; +open c; +fetch c into var; +close c; +return var; +end| +create view v1 as select 1 as a; +create table t1 (a int); +insert into t1 (a) values (f1()); +select * from t1; +a +1 +drop view v1; +drop function f1; +select * from t1; +a +1 +drop table t1; +reset master; diff --git a/mysql-test/r/rpl_trigger.result b/mysql-test/r/rpl_trigger.result index db824c9c423..999af131b8b 100644 --- a/mysql-test/r/rpl_trigger.result +++ b/mysql-test/r/rpl_trigger.result @@ -89,8 +89,24 @@ insert into t1 set a = now(); select a=b && a=c from t1; a=b && a=c 1 +SELECT routine_name, definer +FROM information_schema.routines; +routine_name definer +bug12480 root@localhost +SELECT trigger_name, definer +FROM information_schema.triggers; +trigger_name definer +t1_first root@localhost --- On slave -- +SELECT routine_name, definer +FROM information_schema.routines; +routine_name definer +bug12480 @ +SELECT trigger_name, definer +FROM information_schema.triggers; +trigger_name definer +t1_first root@localhost select a=b && a=c from t1; a=b && a=c 1 diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 318cf8e7b65..598ea2b10d1 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -2708,6 +2708,14 @@ select distinct count(f2) >0 from t1 left join t2 on f1=f3 group by f1; count(f2) >0 1 drop table t1,t2; +create table t1 (f1 int,f2 int); +insert into t1 values(1,1); +create table t2 (f3 int, f4 int, primary key(f3,f4)); +insert into t2 values(1,1); +select * from t1 where f1 in (select f3 from t2 where (f3,f4)= (select f3,f4 from t2)); +f1 f2 +1 1 +drop table t1,t2; CREATE TABLE t1 ( city char(30) ); INSERT INTO t1 VALUES ('London'); INSERT INTO t1 VALUES ('Paris'); @@ -3241,3 +3249,91 @@ f1 f2 Warnings: Warning 1292 Incorrect date value: '2005-09-3a' for column 'f2' at row 1 drop table t1; +create table t1 (f1 int, f2 int); +insert into t1 values (1, 30), (2, 20), (3, 10); +create algorithm=merge view v1 as select f1, f2 from t1; +create algorithm=merge view v2 (f2, f1) as select f1, f2 from t1; +create algorithm=merge view v3 as select t1.f1 as f2, t1.f2 as f1 from t1; +select t1.f1 as x1, f1 from t1 order by t1.f1; +x1 f1 +1 1 +2 2 +3 3 +select v1.f1 as x1, f1 from v1 order by v1.f1; +x1 f1 +1 1 +2 2 +3 3 +select v2.f1 as x1, f1 from v2 order by v2.f1; +x1 f1 +10 10 +20 20 +30 30 +select v3.f1 as x1, f1 from v3 order by v3.f1; +x1 f1 +10 10 +20 20 +30 30 +select f1, f2, v1.f1 as x1 from v1 order by v1.f1; +f1 f2 x1 +1 30 1 +2 20 2 +3 10 3 +select f1, f2, v2.f1 as x1 from v2 order by v2.f1; +f1 f2 x1 +10 3 10 +20 2 20 +30 1 30 +select f1, f2, v3.f1 as x1 from v3 order by v3.f1; +f1 f2 x1 +10 3 10 +20 2 20 +30 1 30 +drop table t1; +drop view v1, v2, v3; +CREATE TABLE t1(key_a int4 NOT NULL, optimus varchar(32), PRIMARY KEY(key_a)); +CREATE TABLE t2(key_a int4 NOT NULL, prime varchar(32), PRIMARY KEY(key_a)); +CREATE table t3(key_a int4 NOT NULL, key_b int4 NOT NULL, foo varchar(32), +PRIMARY KEY(key_a,key_b)); +INSERT INTO t1 VALUES (0,''); +INSERT INTO t1 VALUES (1,'i'); +INSERT INTO t1 VALUES (2,'j'); +INSERT INTO t1 VALUES (3,'k'); +INSERT INTO t2 VALUES (1,'r'); +INSERT INTO t2 VALUES (2,'s'); +INSERT INTO t2 VALUES (3,'t'); +INSERT INTO t3 VALUES (1,5,'x'); +INSERT INTO t3 VALUES (1,6,'y'); +INSERT INTO t3 VALUES (2,5,'xx'); +INSERT INTO t3 VALUES (2,6,'yy'); +INSERT INTO t3 VALUES (2,7,'zz'); +INSERT INTO t3 VALUES (3,5,'xxx'); +SELECT t2.key_a,foo +FROM t1 INNER JOIN t2 ON t1.key_a = t2.key_a +INNER JOIN t3 ON t1.key_a = t3.key_a +WHERE t2.key_a=2 and key_b=5; +key_a foo +2 xx +EXPLAIN SELECT t2.key_a,foo +FROM t1 INNER JOIN t2 ON t1.key_a = t2.key_a +INNER JOIN t3 ON t1.key_a = t3.key_a +WHERE t2.key_a=2 and key_b=5; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index +1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 Using index +1 SIMPLE t3 const PRIMARY PRIMARY 8 const,const 1 +SELECT t2.key_a,foo +FROM t1 INNER JOIN t2 ON t2.key_a = t1.key_a +INNER JOIN t3 ON t1.key_a = t3.key_a +WHERE t2.key_a=2 and key_b=5; +key_a foo +2 xx +EXPLAIN SELECT t2.key_a,foo +FROM t1 INNER JOIN t2 ON t2.key_a = t1.key_a +INNER JOIN t3 ON t1.key_a = t3.key_a +WHERE t2.key_a=2 and key_b=5; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index +1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 Using index +1 SIMPLE t3 const PRIMARY PRIMARY 8 const,const 1 +DROP TABLE t1,t2,t3; diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index 98be82fbf38..ce710eebbd3 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -397,7 +397,8 @@ ERROR 42000: Access denied for user 'mysqltest_2'@'localhost' to database 'mysql select * from mysqltest.t1; ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table 't1' show create database mysqltest; -ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysqltest' +Database Create Database +mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 */ drop table mysqltest.t1; drop database mysqltest; set names binary; @@ -564,3 +565,20 @@ DROP TABLE tyt2; DROP TABLE urkunde; SHOW TABLES FROM non_existing_database; ERROR 42000: Unknown database 'non_existing_database' +SHOW AUTHORS; +create database mysqltest; +show create database mysqltest; +Database Create Database +mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 */ +create table mysqltest.t1(a int); +insert into mysqltest.t1 values(1); +grant select on `mysqltest`.`t1` to mysqltest_4@localhost; +show create database mysqltest; +Database Create Database +mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 */ +delete from mysql.user where user='mysqltest_4'; +delete from mysql.db where user='mysqltest_4'; +delete from mysql.tables_priv where user='mysqltest_4'; +flush privileges; +drop database mysqltest; +End of 5.1 tests diff --git a/mysql-test/r/skip_grants.result b/mysql-test/r/skip_grants.result index 4d723f8e12a..5dc770a7363 100644 --- a/mysql-test/r/skip_grants.result +++ b/mysql-test/r/skip_grants.result @@ -4,7 +4,7 @@ drop procedure if exists f1; use test; create table t1 (field1 INT); CREATE VIEW v1 AS SELECT field1 FROM t1; -ERROR HY000: View definer is not fully qualified +ERROR HY000: Definer is not fully qualified drop table t1; create procedure f1() select 1; drop procedure f1; diff --git a/mysql-test/r/sp-code.result b/mysql-test/r/sp-code.result new file mode 100644 index 00000000000..e6c4ffe1731 --- /dev/null +++ b/mysql-test/r/sp-code.result @@ -0,0 +1,62 @@ +create procedure empty() +begin +end; +show procedure code empty; +Pos Instruction +drop procedure empty; +create function almost_empty() +returns int +return 0; +show function code almost_empty; +Pos Instruction +0 freturn 3 0 +drop function almost_empty; +create procedure code_sample(x int, out err int, out nulls int) +begin +declare count int default 0; +set nulls = 0; +begin +declare c cursor for select name from t1; +declare exit handler for not found close c; +open c; +loop +begin +declare n varchar(20); +declare continue handler for sqlexception set err=1; +fetch c into n; +if isnull(n) then +set nulls = nulls + 1; +else +set count = count + 1; +update t2 set idx = count where name=n; +end if; +end; +end loop; +end; +select t.name, t.idx from t2 t order by idx asc; +end// +show procedure code code_sample; +Pos Instruction +0 set count@3 0 +1 set nulls@2 0 +2 cpush c@0 +3 hpush_jump 6 4 EXIT +4 cclose c@0 +5 hreturn 0 19 +6 copen c@0 +7 set n@4 NULL +8 hpush_jump 11 5 CONTINUE +9 set err@1 1 +10 hreturn 5 +11 cfetch c@0 n@4 +12 jump_if_not 15 isnull(n@4) +13 set nulls@2 (nulls@2 + 1) +14 jump 17 +15 set count@3 (count@3 + 1) +16 stmt 4 "update t2 set idx = count where name=n" +17 hpop 1 +18 jump 7 +19 hpop 1 +20 cpop 1 +21 stmt 0 "select t.name, t.idx from t2 t order ..." +drop procedure code_sample; diff --git a/mysql-test/r/sp-dynamic.result b/mysql-test/r/sp-dynamic.result index 8fe469431cc..cf07f540608 100644 --- a/mysql-test/r/sp-dynamic.result +++ b/mysql-test/r/sp-dynamic.result @@ -33,6 +33,8 @@ begin execute stmt; end| prepare stmt from "call p1()"| +set @SAVE_SP_RECURSION_LEVELS=@@max_sp_recursion_depth| +set @@max_sp_recursion_depth=100| execute stmt| ERROR HY000: The prepared statement contains a stored routine call that refers to that same statement. It's not allowed to execute a prepared statement in such a recursive manner execute stmt| @@ -40,11 +42,18 @@ ERROR HY000: The prepared statement contains a stored routine call that refers t execute stmt| ERROR HY000: The prepared statement contains a stored routine call that refers to that same statement. It's not allowed to execute a prepared statement in such a recursive manner call p1()| -ERROR HY000: Recursive stored routines are not allowed. +ERROR HY000: The prepared statement contains a stored routine call that refers to that same statement. It's not allowed to execute a prepared statement in such a recursive manner call p1()| -ERROR HY000: Recursive stored routines are not allowed. +ERROR HY000: The prepared statement contains a stored routine call that refers to that same statement. It's not allowed to execute a prepared statement in such a recursive manner call p1()| -ERROR HY000: Recursive stored routines are not allowed. +ERROR HY000: The prepared statement contains a stored routine call that refers to that same statement. It's not allowed to execute a prepared statement in such a recursive manner +set @@max_sp_recursion_depth=@SAVE_SP_RECURSION_LEVELS| +call p1()| +ERROR HY000: Recursive limit 0 (as set by the max_sp_recursion_depth variable) was exceeded for routine p1 +call p1()| +ERROR HY000: Recursive limit 0 (as set by the max_sp_recursion_depth variable) was exceeded for routine p1 +call p1()| +ERROR HY000: Recursive limit 0 (as set by the max_sp_recursion_depth variable) was exceeded for routine p1 drop procedure p1| create procedure p1() begin diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result index 50ff7ea264a..963f14820be 100644 --- a/mysql-test/r/sp-error.result +++ b/mysql-test/r/sp-error.result @@ -708,7 +708,7 @@ return (i in (100, 200, bug11394(i-1), 400)); end if; end| select bug11394(2)| -ERROR HY000: Recursive stored routines are not allowed. +ERROR HY000: Recursive stored functions and triggers are not allowed. drop function bug11394| create function bug11394_1(i int) returns int begin @@ -719,7 +719,7 @@ return (select bug11394_1(i-1)); end if; end| select bug11394_1(2)| -ERROR HY000: Recursive stored routines are not allowed. +ERROR HY000: Recursive stored functions and triggers are not allowed. drop function bug11394_1| create function bug11394_2(i int) returns int return i| select bug11394_2(bug11394_2(10))| @@ -733,7 +733,10 @@ call bug11394(i - 1,(select 1)); end if; end| call bug11394(2, 1)| -ERROR HY000: Recursive stored routines are not allowed. +ERROR HY000: Recursive limit 0 (as set by the max_sp_recursion_depth variable) was exceeded for routine bug11394 +set @@max_sp_recursion_depth=10| +call bug11394(2, 1)| +set @@max_sp_recursion_depth=default| drop procedure bug11394| CREATE PROCEDURE BUG_12490() HELP CONTENTS; ERROR 0A000: HELP is not allowed in stored procedures @@ -845,6 +848,8 @@ set password = 'foo1'; select password; end| ERROR 42000: Variable 'password' must be quoted with `...`, or renamed +set names='foo2'| +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 create procedure bug13510_2() begin declare names varchar(10); @@ -872,6 +877,127 @@ names foo4 drop procedure bug13510_3| drop procedure bug13510_4| +drop function if exists bug_13627_f| +CREATE TABLE t1 (a int)| +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN DROP TRIGGER test1; END | +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +CREATE FUNCTION bug_13627_f() returns int BEGIN DROP TRIGGER test1; return 1; END | +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN load table t1 from master; END | +ERROR 0A000: LOAD TABLE is not allowed in stored procedures +CREATE FUNCTION bug_13627_f() returns int BEGIN load table t1 from master; return 1; END | +ERROR 0A000: LOAD TABLE is not allowed in stored procedures +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create table t2 (a int); END | +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +CREATE FUNCTION bug_13627_f() returns int BEGIN create table t2 (a int); return 1; END | +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create index t1_i on t1 (a); END | +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +CREATE FUNCTION bug_13627_f() returns int BEGIN create index t1_i on t1 (a); return 1; END | +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN alter table t1 add column b int; END | +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +CREATE FUNCTION bug_13627_f() returns int BEGIN alter table t1 add column b int; return 1; END | +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN rename table t1 to t2; END | +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +CREATE FUNCTION bug_13627_f() returns int BEGIN rename table t1 to t2; return 1; END | +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN truncate table t1; END | +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +CREATE FUNCTION bug_13627_f() returns int BEGIN truncate table t1; return 1; END | +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop table t1; END | +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +CREATE FUNCTION bug_13627_f() returns int BEGIN drop table t1; return 1; END | +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop index t1_i on t1; END | +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +CREATE FUNCTION bug_13627_f() returns int BEGIN drop index t1_i on t1; return 1; END | +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN unlock tables; END | +ERROR 0A000: UNLOCK is not allowed in stored procedures +CREATE FUNCTION bug_13627_f() returns int BEGIN unlock tables; return 1; END | +ERROR 0A000: UNLOCK is not allowed in stored procedures +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN LOCK TABLE t1 READ; END | +ERROR 0A000: LOCK is not allowed in stored procedures +CREATE FUNCTION bug_13627_f() returns int BEGIN LOCK TABLE t1 READ; return 1; END | +ERROR 0A000: LOCK is not allowed in stored procedures +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create database mysqltest; END | +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +CREATE FUNCTION bug_13627_f() returns int BEGIN create database mysqltest; return 1; END | +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop database mysqltest; END | +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +CREATE FUNCTION bug_13627_f() returns int BEGIN drop database mysqltest; return 1; END | +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create user 'mysqltest_1'; END | +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +CREATE FUNCTION bug_13627_f() returns int BEGIN create user 'mysqltest_1'; return 1; END | +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop user 'mysqltest_1'; END | +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +CREATE FUNCTION bug_13627_f() returns int BEGIN drop user 'mysqltest_1'; return 1; END | +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN rename user 'mysqltest_2' to 'mysqltest_1'; END | +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +CREATE FUNCTION bug_13627_f() returns int BEGIN rename user 'mysqltest_2' to 'mysqltest_1'; return 1; END | +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create view v1 as select 1; END | +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +CREATE FUNCTION bug_13627_f() returns int BEGIN create view v1 as select 1; return 1; END | +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN alter view v1 as select 1; END | +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +CREATE FUNCTION bug_13627_f() returns int BEGIN alter view v1 as select 1; return 1; END | +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop view v1; END | +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +CREATE FUNCTION bug_13627_f() returns int BEGIN drop view v1; return 1; END | +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create trigger tr2 before insert on t1 for each row do select 1; END | +ERROR 2F003: Can't create a TRIGGER from within another stored routine +CREATE FUNCTION bug_13627_f() returns int BEGIN create trigger tr2 before insert on t1 for each row do select 1; return 1; END | +ERROR 2F003: Can't create a TRIGGER from within another stored routine +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop function bug_13627_f; END | +ERROR HY000: Can't drop or alter a FUNCTION from within another stored routine +CREATE FUNCTION bug_13627_f() returns int BEGIN drop function bug_13627_f; return 1; END | +ERROR HY000: Can't drop or alter a FUNCTION from within another stored routine +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create function f2 () returns int return 1; END | +ERROR 2F003: Can't create a FUNCTION from within another stored routine +CREATE FUNCTION bug_13627_f() returns int BEGIN create function f2 () returns int return 1; return 1; END | +ERROR 2F003: Can't create a FUNCTION from within another stored routine +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +CREATE TEMPORARY TABLE t2 (a int); +DROP TEMPORARY TABLE t2; +END | +CREATE FUNCTION bug_13627_f() returns int +BEGIN +CREATE TEMPORARY TABLE t2 (a int); +DROP TEMPORARY TABLE t2; +return 1; +END | +drop table t1| +drop function bug_13627_f| +drop function if exists bug12329; +create table t1 as select 1 a; +create table t2 as select 1 a; +create function bug12329() returns int return (select a from t1); +prepare stmt1 from 'select bug12329()'; +execute stmt1; +bug12329() +1 +drop function bug12329; +create function bug12329() returns int return (select a+100 from t2); +select bug12329(); +bug12329() +101 +execute stmt1; +ERROR HY000: Table 't2' was not locked with LOCK TABLES +deallocate prepare stmt1; +drop function bug12329; +drop table t1, t2; create database mysqltest1; use mysqltest1; drop database mysqltest1; @@ -916,3 +1042,16 @@ ERROR 42S22: Unknown column 'bug13037_foo' in 'field list' DROP PROCEDURE bug13037_p1; DROP PROCEDURE bug13037_p2; DROP PROCEDURE bug13037_p3; +create database mysqltest1; +create database mysqltest2; +use mysqltest1; +drop database mysqltest1; +create procedure mysqltest2.p1() select version(); +create procedure p2() select version(); +ERROR 3D000: No database selected +use mysqltest2; +show procedure status; +Db Name Type Definer Modified Created Security_type Comment +mysqltest2 p1 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER +drop database mysqltest2; +use test; diff --git a/mysql-test/r/sp-prelocking.result b/mysql-test/r/sp-prelocking.result index 32d6d4e6264..0ba31155790 100644 --- a/mysql-test/r/sp-prelocking.result +++ b/mysql-test/r/sp-prelocking.result @@ -213,3 +213,4 @@ drop function f1; drop function f2; drop function f3; drop procedure sp1; +drop view v1; diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index d50e6dd3751..651bc5368fe 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -988,6 +988,10 @@ end| select f5(1)| f5(1) 1 +select f5(2)| +ERROR HY000: Recursive stored functions and triggers are not allowed. +select f5(3)| +ERROR HY000: Recursive stored functions and triggers are not allowed. create function f6() returns int begin declare n int; @@ -1035,6 +1039,12 @@ select * from v1| ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them create function f1() returns int return (select sum(data) from t1) + (select sum(data) from v1)| +select f1()| +ERROR HY000: Recursive stored functions and triggers are not allowed. +select * from v1| +ERROR HY000: Recursive stored functions and triggers are not allowed. +select * from v2| +ERROR HY000: Recursive stored functions and triggers are not allowed. drop function f1| create function f1() returns int return (select sum(data) from t1)| @@ -1053,7 +1063,7 @@ f0() select *, f0() from v0| f0() f0() 100 100 -lock tables t1 read, t1 as t11 read, mysql.proc read| +lock tables t1 read, t1 as t11 read| select f3()| f3() 1 @@ -1251,6 +1261,62 @@ drop procedure opp| drop procedure ip| show procedure status like '%p%'| Db Name Type Definer Modified Created Security_type Comment +drop table if exists fib| +create table fib ( f bigint unsigned not null )| +drop procedure if exists fib| +create procedure fib(n int unsigned) +begin +if n > 1 then +begin +declare x, y bigint unsigned; +declare c cursor for select f from fib order by f desc limit 2; +open c; +fetch c into y; +fetch c into x; +close c; +insert into fib values (x+y); +call fib(n-1); +end; +end if; +end| +set @@max_sp_recursion_depth= 20| +insert into fib values (0), (1)| +call fib(3)| +select * from fib order by f asc| +f +0 +1 +1 +2 +delete from fib| +insert into fib values (0), (1)| +call fib(20)| +select * from fib order by f asc| +f +0 +1 +1 +2 +3 +5 +8 +13 +21 +34 +55 +89 +144 +233 +377 +610 +987 +1597 +2584 +4181 +6765 +drop table fib| +drop procedure fib| +set @@max_sp_recursion_depth= 0| drop procedure if exists bar| create procedure bar(x char(16), y int) comment "111111111111" sql security invoker @@ -1479,6 +1545,52 @@ select @x2| @x2 2 drop procedure bug2260| +drop procedure if exists bug2267_1| +create procedure bug2267_1() +begin +show procedure status; +end| +drop procedure if exists bug2267_2| +create procedure bug2267_2() +begin +show function status; +end| +drop procedure if exists bug2267_3| +create procedure bug2267_3() +begin +show create procedure bug2267_1; +end| +drop procedure if exists bug2267_4| +drop function if exists bug2267_4| +create procedure bug2267_4() +begin +show create function bug2267_4; +end| +create function bug2267_4() returns int return 100| +call bug2267_1()| +Db Name Type Definer Modified Created Security_type Comment +test bug2267_1 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER +test bug2267_2 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER +test bug2267_3 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER +test bug2267_4 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER +call bug2267_2()| +Db Name Type Definer Modified Created Security_type Comment +test bug2267_4 FUNCTION root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER +call bug2267_3()| +Procedure sql_mode Create Procedure +bug2267_1 CREATE PROCEDURE `bug2267_1`() +begin +show procedure status; +end +call bug2267_4()| +Function sql_mode Create Function +bug2267_4 CREATE FUNCTION `bug2267_4`() RETURNS int(11) +return 100 +drop procedure bug2267_1| +drop procedure bug2267_2| +drop procedure bug2267_3| +drop procedure bug2267_4| +drop function bug2267_4| drop procedure if exists bug2227| create procedure bug2227(x int) begin @@ -1490,6 +1602,18 @@ call bug2227(9)| 1.3 x y 42 z 1.3 9 2.6 42 zzz drop procedure bug2227| +drop procedure if exists bug2614| +create procedure bug2614() +begin +drop table if exists t3; +create table t3 (id int default '0' not null); +insert into t3 select 12; +insert into t3 select * from t3; +end| +call bug2614()| +call bug2614()| +drop table t3| +drop procedure bug2614| drop function if exists bug2674| create function bug2674() returns int return @@sort_buffer_size| @@ -1550,7 +1674,7 @@ drop procedure bug2776_2| create table t3 (s1 smallint)| insert into t3 values (123456789012)| Warnings: -Warning 1264 Out of range value adjusted for column 's1' at row 1 +Warning 1264 Out of range value for column 's1' at row 1 drop procedure if exists bug2780| create procedure bug2780() begin @@ -3417,6 +3541,9 @@ Table Create Table tm1 CREATE TEMPORARY TABLE `tm1` ( `spv1` decimal(6,3) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop procedure bug12589_1| +drop procedure bug12589_2| +drop procedure bug12589_3| drop table if exists t3| drop procedure if exists bug7049_1| drop procedure if exists bug7049_2| @@ -3617,4 +3744,359 @@ count(*) drop table t3, t4| drop procedure bug14210| set @@session.max_heap_table_size=default| +drop function if exists bug14723| +drop procedure if exists bug14723| +/*!50003 create function bug14723() +returns bigint(20) +main_loop: begin +return 42; +end */;; +show create function bug14723;; +Function sql_mode Create Function +bug14723 CREATE FUNCTION `bug14723`() RETURNS bigint(20) +main_loop: begin +return 42; +end +select bug14723();; +bug14723() +42 +/*!50003 create procedure bug14723() +main_loop: begin +select 42; +end */;; +show create procedure bug14723;; +Procedure sql_mode Create Procedure +bug14723 CREATE PROCEDURE `bug14723`() +main_loop: begin +select 42; +end +call bug14723();; +42 +42 +drop function bug14723| +drop procedure bug14723| +create procedure bug14845() +begin +declare a char(255); +declare done int default 0; +declare c cursor for select count(*) from t1 where 1 = 0; +declare continue handler for sqlstate '02000' set done = 1; +open c; +repeat +fetch c into a; +if not done then +select a; +end if; +until done end repeat; +close c; +end| +call bug14845()| +a +0 +drop procedure bug14845| +drop procedure if exists bug13549_1| +drop procedure if exists bug13549_2| +CREATE PROCEDURE `bug13549_2`() +begin +call bug13549_1(); +end| +CREATE PROCEDURE `bug13549_1`() +begin +declare done int default 0; +set done= not done; +end| +CALL bug13549_2()| +drop procedure bug13549_2| +drop procedure bug13549_1| +drop function if exists bug10100f| +drop procedure if exists bug10100p| +drop procedure if exists bug10100t| +drop procedure if exists bug10100pt| +drop procedure if exists bug10100pv| +drop procedure if exists bug10100pd| +drop procedure if exists bug10100pc| +create function bug10100f(prm int) returns int +begin +if prm > 1 then +return prm * bug10100f(prm - 1); +end if; +return 1; +end| +create procedure bug10100p(prm int, inout res int) +begin +set res = res * prm; +if prm > 1 then +call bug10100p(prm - 1, res); +end if; +end| +create procedure bug10100t(prm int) +begin +declare res int; +set res = 1; +call bug10100p(prm, res); +select res; +end| +create table t3 (a int)| +insert into t3 values (0)| +create view v1 as select a from t3; +create procedure bug10100pt(level int, lim int) +begin +if level < lim then +update t3 set a=level; +FLUSH TABLES; +call bug10100pt(level+1, lim); +else +select * from t3; +end if; +end| +create procedure bug10100pv(level int, lim int) +begin +if level < lim then +update v1 set a=level; +FLUSH TABLES; +call bug10100pv(level+1, lim); +else +select * from v1; +end if; +end| +prepare stmt2 from "select * from t3;"; +create procedure bug10100pd(level int, lim int) +begin +if level < lim then +select level; +prepare stmt1 from "update t3 set a=a+2"; +execute stmt1; +FLUSH TABLES; +execute stmt1; +FLUSH TABLES; +execute stmt1; +FLUSH TABLES; +deallocate prepare stmt1; +execute stmt2; +select * from t3; +call bug10100pd(level+1, lim); +else +execute stmt2; +end if; +end| +create procedure bug10100pc(level int, lim int) +begin +declare lv int; +declare c cursor for select a from t3; +open c; +if level < lim then +select level; +fetch c into lv; +select lv; +update t3 set a=level+lv; +FLUSH TABLES; +call bug10100pc(level+1, lim); +else +select * from t3; +end if; +close c; +end| +set @@max_sp_recursion_depth=4| +select @@max_sp_recursion_depth| +@@max_sp_recursion_depth +4 +select bug10100f(3)| +ERROR HY000: Recursive stored functions and triggers are not allowed. +select bug10100f(6)| +ERROR HY000: Recursive stored functions and triggers are not allowed. +call bug10100t(5)| +res +120 +call bug10100pt(1,5)| +a +4 +call bug10100pv(1,5)| +a +4 +update t3 set a=1| +call bug10100pd(1,5)| +level +1 +a +7 +a +7 +level +2 +a +13 +a +13 +level +3 +a +19 +a +19 +level +4 +a +25 +a +25 +a +25 +select * from t3| +a +25 +update t3 set a=1| +call bug10100pc(1,5)| +level +1 +lv +1 +level +2 +lv +2 +level +3 +lv +4 +level +4 +lv +7 +a +11 +select * from t3| +a +11 +set @@max_sp_recursion_depth=0| +select @@max_sp_recursion_depth| +@@max_sp_recursion_depth +0 +select bug10100f(5)| +ERROR HY000: Recursive stored functions and triggers are not allowed. +call bug10100t(5)| +ERROR HY000: Recursive limit 0 (as set by the max_sp_recursion_depth variable) was exceeded for routine bug10100p +set @@max_sp_recursion_depth=255| +set @var=1| +call bug10100p(255, @var)| +call bug10100pt(1,255)| +call bug10100pv(1,255)| +call bug10100pd(1,255)| +call bug10100pc(1,255)| +set @@max_sp_recursion_depth=0| +deallocate prepare stmt2| +drop function bug10100f| +drop procedure bug10100p| +drop procedure bug10100t| +drop procedure bug10100pt| +drop procedure bug10100pv| +drop procedure bug10100pd| +drop procedure bug10100pc| +drop view v1| +drop procedure if exists bug13729| +drop table if exists t3| +create table t3 (s1 int, primary key (s1))| +insert into t3 values (1),(2)| +create procedure bug13729() +begin +declare continue handler for sqlexception select 55; +update t3 set s1 = 1; +end| +call bug13729()| +55 +55 +select * from t3| +s1 +1 +2 +drop procedure bug13729| +drop table t3| +drop procedure if exists bug14643_1| +drop procedure if exists bug14643_2| +create procedure bug14643_1() +begin +declare continue handler for sqlexception select 'boo' as 'Handler'; +begin +declare v int default x; +if v = 1 then +select 1; +else +select 2; +end if; +end; +end| +create procedure bug14643_2() +begin +declare continue handler for sqlexception select 'boo' as 'Handler'; +case x +when 1 then +select 1; +else +select 2; +end case; +end| +call bug14643_1()| +Handler +boo +2 +2 +call bug14643_2()| +Handler +boo +2 +2 +drop procedure bug14643_1| +drop procedure bug14643_2| +drop procedure if exists bug14304| +drop table if exists t3, t4| +create table t3(a int primary key auto_increment)| +create table t4(a int primary key auto_increment)| +create procedure bug14304() +begin +insert into t3 set a=null; +insert into t4 set a=null; +insert into t4 set a=null; +insert into t4 set a=null; +insert into t4 set a=null; +insert into t4 set a=null; +insert into t4 select null as a; +insert into t3 set a=null; +insert into t3 set a=null; +select * from t3; +end| +call bug14304()| +a +1 +2 +3 +drop procedure bug14304| +drop table t3, t4| +drop procedure if exists bug14376| +create procedure bug14376() +begin +declare x int default x; +end| +call bug14376()| +ERROR 42S22: Unknown column 'x' in 'field list' +drop procedure bug14376| +create procedure bug14376() +begin +declare x int default 42; +begin +declare x int default x; +select x; +end; +end| +call bug14376()| +x +42 +drop procedure bug14376| +create procedure bug14376(x int) +begin +declare x int default x; +select x; +end| +call bug14376(4711)| +x +4711 +drop procedure bug14376| drop table t1,t2; diff --git a/mysql-test/r/sp_trans.result b/mysql-test/r/sp_trans.result index 6077087ab87..8f2bd9985fc 100644 --- a/mysql-test/r/sp_trans.result +++ b/mysql-test/r/sp_trans.result @@ -174,3 +174,254 @@ ERROR HY000: Explicit or implicit commit is not allowed in stored function or tr drop procedure bug10015_8| drop function bug10015_7| drop table t1, t2| +drop function if exists bug13825_0| +drop function if exists bug13825_1| +drop function if exists bug13825_2| +drop function if exists bug13825_3| +drop function if exists bug13825_4| +drop function if exists bug13825_5| +drop procedure if exists bug13825_0| +drop procedure if exists bug13825_1| +drop procedure if exists bug13825_2| +drop table if exists t1| +create table t1 (i int) engine=innodb| +create table t2 (i int) engine=innodb| +create function bug13825_0() returns int +begin +rollback to savepoint x; +return 1; +end| +create function bug13825_1() returns int +begin +release savepoint x; +return 1; +end| +create function bug13825_2() returns int +begin +insert into t1 values (2); +savepoint x; +insert into t1 values (3); +rollback to savepoint x; +insert into t1 values (4); +return 1; +end| +create procedure bug13825_0() +begin +rollback to savepoint x; +end| +create procedure bug13825_1() +begin +release savepoint x; +end| +create procedure bug13825_2() +begin +savepoint x; +end| +insert into t2 values (1)| +create trigger t2_bi before insert on t2 for each row +rollback to savepoint x| +create trigger t2_bu before update on t2 for each row +release savepoint x| +create trigger t2_bd before delete on t2 for each row +begin +insert into t1 values (2); +savepoint x; +insert into t1 values (3); +rollback to savepoint x; +insert into t1 values (4); +end| +create function bug13825_3(rb int) returns int +begin +insert into t1 values(1); +savepoint x; +insert into t1 values(2); +if rb then +rollback to savepoint x; +end if; +insert into t1 values(3); +return rb; +end| +create function bug13825_4() returns int +begin +savepoint x; +insert into t1 values(2); +rollback to savepoint x; +return 0; +end| +create function bug13825_5(p int) returns int +begin +savepoint x; +insert into t2 values(p); +rollback to savepoint x; +insert into t2 values(p+1); +return p; +end| +set autocommit= 0| +begin | +insert into t1 values (1)| +savepoint x| +set @a:= bug13825_0()| +ERROR 42000: SAVEPOINT x does not exist +insert into t2 values (2)| +ERROR 42000: SAVEPOINT x does not exist +set @a:= bug13825_1()| +ERROR 42000: SAVEPOINT x does not exist +update t2 set i = 2| +ERROR 42000: SAVEPOINT x does not exist +set @a:= bug13825_2()| +select * from t1| +i +1 +2 +4 +rollback to savepoint x| +select * from t1| +i +1 +delete from t2| +select * from t1| +i +1 +2 +4 +rollback to savepoint x| +select * from t1| +i +1 +release savepoint x| +set @a:= bug13825_2()| +select * from t1| +i +1 +2 +4 +rollback to savepoint x| +ERROR 42000: SAVEPOINT x does not exist +delete from t1| +commit| +begin| +insert into t1 values (5)| +savepoint x| +insert into t1 values (6)| +call bug13825_0()| +select * from t1| +i +5 +call bug13825_1()| +rollback to savepoint x| +ERROR 42000: SAVEPOINT x does not exist +savepoint x| +insert into t1 values (7)| +call bug13825_2()| +rollback to savepoint x| +select * from t1| +i +5 +7 +delete from t1| +commit| +set autocommit= 1| +select bug13825_3(0)| +bug13825_3(0) +0 +select * from t1| +i +1 +2 +3 +delete from t1| +select bug13825_3(1)| +bug13825_3(1) +1 +select * from t1| +i +1 +3 +delete from t1| +set autocommit= 0| +begin| +insert into t1 values (1)| +set @a:= bug13825_4()| +select * from t1| +i +1 +delete from t1| +commit| +set autocommit= 1| +drop table t2| +create table t2 (i int) engine=innodb| +insert into t1 values (1), (bug13825_5(2)), (3)| +select * from t1| +i +1 +2 +3 +select * from t2| +i +3 +drop function bug13825_0| +drop function bug13825_1| +drop function bug13825_2| +drop function bug13825_3| +drop function bug13825_4| +drop function bug13825_5| +drop procedure bug13825_0| +drop procedure bug13825_1| +drop procedure bug13825_2| +drop table t1, t2| +drop table if exists t3| +drop procedure if exists bug14840_1| +drop procedure if exists bug14840_2| +create table t3 +( +x int, +y int, +primary key (x) +) engine=InnoDB| +create procedure bug14840_1() +begin +declare err int default 0; +declare continue handler for sqlexception +set err = err + 1; +start transaction; +update t3 set x = 1, y = 42 where x = 2; +insert into t3 values (3, 4711); +if err > 0 then +rollback; +else +commit; +end if; +select * from t3; +end| +create procedure bug14840_2() +begin +declare err int default 0; +declare continue handler for sqlexception +begin +set err = err + 1; +select err as 'Ping'; +end; +update t3 set x = 1, y = 42 where x = 2; +update t3 set x = 1, y = 42 where x = 2; +insert into t3 values (3, 4711); +select * from t3; +end| +insert into t3 values (1, 3), (2, 5)| +call bug14840_1()| +x y +1 3 +2 5 +delete from t3| +insert into t3 values (1, 3), (2, 5)| +call bug14840_2()| +Ping +1 +Ping +2 +x y +1 3 +2 5 +3 4711 +drop procedure bug14840_1| +drop procedure bug14840_2| +drop table t3| diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result index 2b1a47ed337..cf7f7fcfa23 100644 --- a/mysql-test/r/strict.result +++ b/mysql-test/r/strict.result @@ -260,14 +260,14 @@ ERROR 22007: Incorrect date value: '2004-10-00' for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES(CAST('2004-0-10' AS DATE)); ERROR 22007: Incorrect date value: '2004-00-10' for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES(CAST('0000-00-00' AS DATE)); -ERROR 22007: Truncated incorrect datetime value: '0000-00-00' +ERROR 22007: Incorrect datetime value: '0000-00-00' INSERT INTO t1 (col2) VALUES(CAST('0000-10-31 15:30' AS DATETIME)); INSERT INTO t1 (col2) VALUES(CAST('2004-10-0 15:30' AS DATETIME)); ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col2' at row 1 INSERT INTO t1 (col2) VALUES(CAST('2004-0-10 15:30' AS DATETIME)); ERROR 22007: Incorrect datetime value: '2004-00-10 15:30:00' for column 'col2' at row 1 INSERT INTO t1 (col2) VALUES(CAST('0000-00-00' AS DATETIME)); -ERROR 22007: Truncated incorrect datetime value: '0000-00-00' +ERROR 22007: Incorrect datetime value: '0000-00-00' INSERT INTO t1 (col3) VALUES(CAST('0000-10-31 15:30' AS DATETIME)); ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col3' at row 1 INSERT INTO t1 (col3) VALUES(CAST('2004-10-0 15:30' AS DATETIME)); @@ -275,7 +275,7 @@ ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col3' a INSERT INTO t1 (col3) VALUES(CAST('2004-0-10 15:30' AS DATETIME)); ERROR 22007: Incorrect datetime value: '2004-00-10 15:30:00' for column 'col3' at row 1 INSERT INTO t1 (col3) VALUES(CAST('0000-00-00' AS DATETIME)); -ERROR 22007: Truncated incorrect datetime value: '0000-00-00' +ERROR 22007: Incorrect datetime value: '0000-00-00' drop table t1; CREATE TABLE t1 (col1 date, col2 datetime, col3 timestamp); INSERT INTO t1 (col1) VALUES (CONVERT('2004-10-15',DATE)); @@ -287,14 +287,14 @@ ERROR 22007: Incorrect date value: '2004-10-00' for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES(CONVERT('2004-0-10' , DATE)); ERROR 22007: Incorrect date value: '2004-00-10' for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES(CONVERT('0000-00-00',DATE)); -ERROR 22007: Truncated incorrect datetime value: '0000-00-00' +ERROR 22007: Incorrect datetime value: '0000-00-00' INSERT INTO t1 (col2) VALUES(CONVERT('0000-10-31 15:30',DATETIME)); INSERT INTO t1 (col2) VALUES(CONVERT('2004-10-0 15:30',DATETIME)); ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col2' at row 1 INSERT INTO t1 (col2) VALUES(CONVERT('2004-0-10 15:30',DATETIME)); ERROR 22007: Incorrect datetime value: '2004-00-10 15:30:00' for column 'col2' at row 1 INSERT INTO t1 (col2) VALUES(CONVERT('0000-00-00',DATETIME)); -ERROR 22007: Truncated incorrect datetime value: '0000-00-00' +ERROR 22007: Incorrect datetime value: '0000-00-00' INSERT INTO t1 (col3) VALUES(CONVERT('0000-10-31 15:30',DATETIME)); ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col3' at row 1 INSERT INTO t1 (col3) VALUES(CONVERT('2004-10-0 15:30',DATETIME)); @@ -302,7 +302,7 @@ ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col3' a INSERT INTO t1 (col3) VALUES(CONVERT('2004-0-10 15:30',DATETIME)); ERROR 22007: Incorrect datetime value: '2004-00-10 15:30:00' for column 'col3' at row 1 INSERT INTO t1 (col3) VALUES(CONVERT('0000-00-00',DATETIME)); -ERROR 22007: Truncated incorrect datetime value: '0000-00-00' +ERROR 22007: Incorrect datetime value: '0000-00-00' drop table t1; CREATE TABLE t1(col1 TINYINT, col2 TINYINT UNSIGNED); INSERT INTO t1 VALUES(-128,0),(0,0),(127,255),('-128','0'),('0','0'),('127','255'),(-128.0,0.0),(0.0,0.0),(127.0,255.0); @@ -314,36 +314,36 @@ Warnings: Error 1365 Division by 0 Error 1365 Division by 0 INSERT INTO t1 (col1) VALUES(-129); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES(128); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 (col2) VALUES(-1); -ERROR 22003: Out of range value adjusted for column 'col2' at row 1 +ERROR 22003: Out of range value for column 'col2' at row 1 INSERT INTO t1 (col2) VALUES(256); -ERROR 22003: Out of range value adjusted for column 'col2' at row 1 +ERROR 22003: Out of range value for column 'col2' at row 1 INSERT INTO t1 (col1) VALUES('-129'); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES('128'); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 (col2) VALUES('-1'); -ERROR 22003: Out of range value adjusted for column 'col2' at row 1 +ERROR 22003: Out of range value for column 'col2' at row 1 INSERT INTO t1 (col2) VALUES('256'); -ERROR 22003: Out of range value adjusted for column 'col2' at row 1 +ERROR 22003: Out of range value for column 'col2' at row 1 INSERT INTO t1 (col1) VALUES(128.0); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 (col2) VALUES(-1.0); -ERROR 22003: Out of range value adjusted for column 'col2' at row 1 +ERROR 22003: Out of range value for column 'col2' at row 1 INSERT INTO t1 (col2) VALUES(256.0); -ERROR 22003: Out of range value adjusted for column 'col2' at row 1 +ERROR 22003: Out of range value for column 'col2' at row 1 SELECT MOD(col1,0) FROM t1 WHERE col1 > 0 LIMIT 1; MOD(col1,0) NULL Warnings: Error 1365 Division by 0 UPDATE t1 SET col1 = col1 - 50 WHERE col1 < 0; -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 UPDATE t1 SET col2=col2 + 50 WHERE col2 > 0; -ERROR 22003: Out of range value adjusted for column 'col2' at row 3 +ERROR 22003: Out of range value for column 'col2' at row 3 UPDATE t1 SET col1=col1 / 0 WHERE col1 > 0; ERROR 22012: Division by 0 set @@sql_mode='ERROR_FOR_DIVISION_BY_ZERO'; @@ -377,16 +377,16 @@ INSERT INTO t1 values (1/0,1/0); set @@sql_mode='ansi,traditional'; INSERT IGNORE INTO t1 VALUES('-129','-1'),('128','256'); Warnings: -Warning 1264 Out of range value adjusted for column 'col1' at row 1 -Warning 1264 Out of range value adjusted for column 'col2' at row 1 -Warning 1264 Out of range value adjusted for column 'col1' at row 2 -Warning 1264 Out of range value adjusted for column 'col2' at row 2 +Warning 1264 Out of range value for column 'col1' at row 1 +Warning 1264 Out of range value for column 'col2' at row 1 +Warning 1264 Out of range value for column 'col1' at row 2 +Warning 1264 Out of range value for column 'col2' at row 2 INSERT IGNORE INTO t1 VALUES(-129.0,-1.0),(128.0,256.0); Warnings: -Warning 1264 Out of range value adjusted for column 'col1' at row 1 -Warning 1264 Out of range value adjusted for column 'col2' at row 1 -Warning 1264 Out of range value adjusted for column 'col1' at row 2 -Warning 1264 Out of range value adjusted for column 'col2' at row 2 +Warning 1264 Out of range value for column 'col1' at row 1 +Warning 1264 Out of range value for column 'col2' at row 1 +Warning 1264 Out of range value for column 'col1' at row 2 +Warning 1264 Out of range value for column 'col2' at row 2 UPDATE IGNORE t1 SET col2=1/NULL where col1=0; SELECT * FROM t1; col1 col2 @@ -411,33 +411,33 @@ DROP TABLE t1; CREATE TABLE t1(col1 SMALLINT, col2 SMALLINT UNSIGNED); INSERT INTO t1 VALUES(-32768,0),(0,0),(32767,65535),('-32768','0'),('32767','65535'),(-32768.0,0.0),(32767.0,65535.0); INSERT INTO t1 (col1) VALUES(-32769); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES(32768); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 (col2) VALUES(-1); -ERROR 22003: Out of range value adjusted for column 'col2' at row 1 +ERROR 22003: Out of range value for column 'col2' at row 1 INSERT INTO t1 (col2) VALUES(65536); -ERROR 22003: Out of range value adjusted for column 'col2' at row 1 +ERROR 22003: Out of range value for column 'col2' at row 1 INSERT INTO t1 (col1) VALUES('-32769'); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES('32768'); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 (col2) VALUES('-1'); -ERROR 22003: Out of range value adjusted for column 'col2' at row 1 +ERROR 22003: Out of range value for column 'col2' at row 1 INSERT INTO t1 (col2) VALUES('65536'); -ERROR 22003: Out of range value adjusted for column 'col2' at row 1 +ERROR 22003: Out of range value for column 'col2' at row 1 INSERT INTO t1 (col1) VALUES(-32769.0); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES(32768.0); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 (col2) VALUES(-1.0); -ERROR 22003: Out of range value adjusted for column 'col2' at row 1 +ERROR 22003: Out of range value for column 'col2' at row 1 INSERT INTO t1 (col2) VALUES(65536.0); -ERROR 22003: Out of range value adjusted for column 'col2' at row 1 +ERROR 22003: Out of range value for column 'col2' at row 1 UPDATE t1 SET col1 = col1 - 50 WHERE col1 < 0; -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 UPDATE t1 SET col2 = col2 + 50 WHERE col2 > 0; -ERROR 22003: Out of range value adjusted for column 'col2' at row 3 +ERROR 22003: Out of range value for column 'col2' at row 3 UPDATE t1 SET col1 = col1 / 0 WHERE col1 > 0; ERROR 22012: Division by 0 UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0; @@ -457,22 +457,22 @@ Error 1365 Division by 0 Error 1365 Division by 0 INSERT IGNORE INTO t1 VALUES(-32769,-1),(32768,65536); Warnings: -Warning 1264 Out of range value adjusted for column 'col1' at row 1 -Warning 1264 Out of range value adjusted for column 'col2' at row 1 -Warning 1264 Out of range value adjusted for column 'col1' at row 2 -Warning 1264 Out of range value adjusted for column 'col2' at row 2 +Warning 1264 Out of range value for column 'col1' at row 1 +Warning 1264 Out of range value for column 'col2' at row 1 +Warning 1264 Out of range value for column 'col1' at row 2 +Warning 1264 Out of range value for column 'col2' at row 2 INSERT IGNORE INTO t1 VALUES('-32769','-1'),('32768','65536'); Warnings: -Warning 1264 Out of range value adjusted for column 'col1' at row 1 -Warning 1264 Out of range value adjusted for column 'col2' at row 1 -Warning 1264 Out of range value adjusted for column 'col1' at row 2 -Warning 1264 Out of range value adjusted for column 'col2' at row 2 +Warning 1264 Out of range value for column 'col1' at row 1 +Warning 1264 Out of range value for column 'col2' at row 1 +Warning 1264 Out of range value for column 'col1' at row 2 +Warning 1264 Out of range value for column 'col2' at row 2 INSERT IGNORE INTO t1 VALUES(-32769,-1.0),(32768.0,65536.0); Warnings: -Warning 1264 Out of range value adjusted for column 'col1' at row 1 -Warning 1264 Out of range value adjusted for column 'col2' at row 1 -Warning 1264 Out of range value adjusted for column 'col1' at row 2 -Warning 1264 Out of range value adjusted for column 'col2' at row 2 +Warning 1264 Out of range value for column 'col1' at row 1 +Warning 1264 Out of range value for column 'col2' at row 1 +Warning 1264 Out of range value for column 'col1' at row 2 +Warning 1264 Out of range value for column 'col2' at row 2 UPDATE IGNORE t1 SET col2=1/NULL where col1=0; SELECT * FROM t1; col1 col2 @@ -495,33 +495,33 @@ DROP TABLE t1; CREATE TABLE t1 (col1 MEDIUMINT, col2 MEDIUMINT UNSIGNED); INSERT INTO t1 VALUES(-8388608,0),(0,0),(8388607,16777215),('-8388608','0'),('8388607','16777215'),(-8388608.0,0.0),(8388607.0,16777215.0); INSERT INTO t1 (col1) VALUES(-8388609); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES(8388608); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 (col2) VALUES(-1); -ERROR 22003: Out of range value adjusted for column 'col2' at row 1 +ERROR 22003: Out of range value for column 'col2' at row 1 INSERT INTO t1 (col2) VALUES(16777216); -ERROR 22003: Out of range value adjusted for column 'col2' at row 1 +ERROR 22003: Out of range value for column 'col2' at row 1 INSERT INTO t1 (col1) VALUES('-8388609'); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES('8388608'); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 (col2) VALUES('-1'); -ERROR 22003: Out of range value adjusted for column 'col2' at row 1 +ERROR 22003: Out of range value for column 'col2' at row 1 INSERT INTO t1 (col2) VALUES('16777216'); -ERROR 22003: Out of range value adjusted for column 'col2' at row 1 +ERROR 22003: Out of range value for column 'col2' at row 1 INSERT INTO t1 (col1) VALUES(-8388609.0); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES(8388608.0); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 (col2) VALUES(-1.0); -ERROR 22003: Out of range value adjusted for column 'col2' at row 1 +ERROR 22003: Out of range value for column 'col2' at row 1 INSERT INTO t1 (col2) VALUES(16777216.0); -ERROR 22003: Out of range value adjusted for column 'col2' at row 1 +ERROR 22003: Out of range value for column 'col2' at row 1 UPDATE t1 SET col1 = col1 - 50 WHERE col1 < 0; -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 UPDATE t1 SET col2 = col2 + 50 WHERE col2 > 0; -ERROR 22003: Out of range value adjusted for column 'col2' at row 3 +ERROR 22003: Out of range value for column 'col2' at row 3 UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0; ERROR 22012: Division by 0 UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0; @@ -541,22 +541,22 @@ Error 1365 Division by 0 Error 1365 Division by 0 INSERT IGNORE INTO t1 VALUES(-8388609,-1),(8388608,16777216); Warnings: -Warning 1264 Out of range value adjusted for column 'col1' at row 1 -Warning 1264 Out of range value adjusted for column 'col2' at row 1 -Warning 1264 Out of range value adjusted for column 'col1' at row 2 -Warning 1264 Out of range value adjusted for column 'col2' at row 2 +Warning 1264 Out of range value for column 'col1' at row 1 +Warning 1264 Out of range value for column 'col2' at row 1 +Warning 1264 Out of range value for column 'col1' at row 2 +Warning 1264 Out of range value for column 'col2' at row 2 INSERT IGNORE INTO t1 VALUES('-8388609','-1'),('8388608','16777216'); Warnings: -Warning 1264 Out of range value adjusted for column 'col1' at row 1 -Warning 1264 Out of range value adjusted for column 'col2' at row 1 -Warning 1264 Out of range value adjusted for column 'col1' at row 2 -Warning 1264 Out of range value adjusted for column 'col2' at row 2 +Warning 1264 Out of range value for column 'col1' at row 1 +Warning 1264 Out of range value for column 'col2' at row 1 +Warning 1264 Out of range value for column 'col1' at row 2 +Warning 1264 Out of range value for column 'col2' at row 2 INSERT IGNORE INTO t1 VALUES(-8388609.0,-1.0),(8388608.0,16777216.0); Warnings: -Warning 1264 Out of range value adjusted for column 'col1' at row 1 -Warning 1264 Out of range value adjusted for column 'col2' at row 1 -Warning 1264 Out of range value adjusted for column 'col1' at row 2 -Warning 1264 Out of range value adjusted for column 'col2' at row 2 +Warning 1264 Out of range value for column 'col1' at row 1 +Warning 1264 Out of range value for column 'col2' at row 1 +Warning 1264 Out of range value for column 'col1' at row 2 +Warning 1264 Out of range value for column 'col2' at row 2 UPDATE IGNORE t1 SET col2=1/NULL where col1=0; SELECT * FROM t1; col1 col2 @@ -579,41 +579,41 @@ DROP TABLE t1; CREATE TABLE t1 (col1 INT, col2 INT UNSIGNED); INSERT INTO t1 VALUES(-2147483648,0),(0,0),(2147483647,4294967295),('-2147483648','0'),('2147483647','4294967295'),(-2147483648.0,0.0),(2147483647.0,4294967295.0); INSERT INTO t1 (col1) VALUES(-2147483649); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES(2147643648); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 (col2) VALUES(-1); -ERROR 22003: Out of range value adjusted for column 'col2' at row 1 +ERROR 22003: Out of range value for column 'col2' at row 1 INSERT INTO t1 (col2) VALUES(4294967296); -ERROR 22003: Out of range value adjusted for column 'col2' at row 1 +ERROR 22003: Out of range value for column 'col2' at row 1 INSERT INTO t1 (col1) VALUES('-2147483649'); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES('2147643648'); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 (col2) VALUES('-1'); -ERROR 22003: Out of range value adjusted for column 'col2' at row 1 +ERROR 22003: Out of range value for column 'col2' at row 1 INSERT INTO t1 (col2) VALUES('4294967296'); -ERROR 22003: Out of range value adjusted for column 'col2' at row 1 +ERROR 22003: Out of range value for column 'col2' at row 1 INSERT INTO t1 (col1) VALUES(-2147483649.0); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES(2147643648.0); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 (col2) VALUES(-1.0); -ERROR 22003: Out of range value adjusted for column 'col2' at row 1 +ERROR 22003: Out of range value for column 'col2' at row 1 INSERT INTO t1 (col2) VALUES(4294967296.0); -ERROR 22003: Out of range value adjusted for column 'col2' at row 1 +ERROR 22003: Out of range value for column 'col2' at row 1 UPDATE t1 SET col1 = col1 - 50 WHERE col1 < 0; -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 UPDATE t1 SET col2 =col2 + 50 WHERE col2 > 0; -ERROR 22003: Out of range value adjusted for column 'col2' at row 3 +ERROR 22003: Out of range value for column 'col2' at row 3 UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0; ERROR 22012: Division by 0 UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0; ERROR 22012: Division by 0 INSERT INTO t1 (col1) VALUES (''); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES ('a59b'); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES ('1a'); ERROR 01000: Data truncated for column 'col1' at row 1 INSERT IGNORE INTO t1 (col1) VALUES ('2a'); @@ -625,22 +625,22 @@ Error 1365 Division by 0 Error 1365 Division by 0 INSERT IGNORE INTO t1 values (-2147483649, -1),(2147643648,4294967296); Warnings: -Warning 1264 Out of range value adjusted for column 'col1' at row 1 -Warning 1264 Out of range value adjusted for column 'col2' at row 1 -Warning 1264 Out of range value adjusted for column 'col1' at row 2 -Warning 1264 Out of range value adjusted for column 'col2' at row 2 +Warning 1264 Out of range value for column 'col1' at row 1 +Warning 1264 Out of range value for column 'col2' at row 1 +Warning 1264 Out of range value for column 'col1' at row 2 +Warning 1264 Out of range value for column 'col2' at row 2 INSERT IGNORE INTO t1 values ('-2147483649', '-1'),('2147643648','4294967296'); Warnings: -Warning 1264 Out of range value adjusted for column 'col1' at row 1 -Warning 1264 Out of range value adjusted for column 'col2' at row 1 -Warning 1264 Out of range value adjusted for column 'col1' at row 2 -Warning 1264 Out of range value adjusted for column 'col2' at row 2 +Warning 1264 Out of range value for column 'col1' at row 1 +Warning 1264 Out of range value for column 'col2' at row 1 +Warning 1264 Out of range value for column 'col1' at row 2 +Warning 1264 Out of range value for column 'col2' at row 2 INSERT IGNORE INTO t1 values (-2147483649.0, -1.0),(2147643648.0,4294967296.0); Warnings: -Warning 1264 Out of range value adjusted for column 'col1' at row 1 -Warning 1264 Out of range value adjusted for column 'col2' at row 1 -Warning 1264 Out of range value adjusted for column 'col1' at row 2 -Warning 1264 Out of range value adjusted for column 'col2' at row 2 +Warning 1264 Out of range value for column 'col1' at row 1 +Warning 1264 Out of range value for column 'col2' at row 1 +Warning 1264 Out of range value for column 'col1' at row 2 +Warning 1264 Out of range value for column 'col2' at row 2 UPDATE IGNORE t1 SET col2=1/NULL where col1=0; SELECT * FROM t1; col1 col2 @@ -665,37 +665,37 @@ INSERT INTO t1 VALUES(-9223372036854775808,0),(0,0),(9223372036854775807,1844674 INSERT INTO t1 VALUES('-9223372036854775808','0'),('9223372036854775807','18446744073709551615'); INSERT INTO t1 VALUES(-9223372036854774000.0,0.0),(9223372036854775700.0,1844674407370954000.0); INSERT INTO t1 (col1) VALUES(-9223372036854775809); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES(9223372036854775808); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 (col2) VALUES(-1); -ERROR 22003: Out of range value adjusted for column 'col2' at row 1 +ERROR 22003: Out of range value for column 'col2' at row 1 INSERT INTO t1 (col2) VALUES(18446744073709551616); -ERROR 22003: Out of range value adjusted for column 'col2' at row 1 +ERROR 22003: Out of range value for column 'col2' at row 1 INSERT INTO t1 (col1) VALUES('-9223372036854775809'); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES('9223372036854775808'); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 (col2) VALUES('-1'); -ERROR 22003: Out of range value adjusted for column 'col2' at row 1 +ERROR 22003: Out of range value for column 'col2' at row 1 INSERT INTO t1 (col2) VALUES('18446744073709551616'); -ERROR 22003: Out of range value adjusted for column 'col2' at row 1 +ERROR 22003: Out of range value for column 'col2' at row 1 INSERT INTO t1 (col1) VALUES(-9223372036854785809.0); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES(9223372036854785808.0); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 (col2) VALUES(-1.0); -ERROR 22003: Out of range value adjusted for column 'col2' at row 1 +ERROR 22003: Out of range value for column 'col2' at row 1 INSERT INTO t1 (col2) VALUES(18446744073709551616.0); -ERROR 22003: Out of range value adjusted for column 'col2' at row 1 +ERROR 22003: Out of range value for column 'col2' at row 1 UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0; ERROR 22012: Division by 0 UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0; ERROR 22012: Division by 0 INSERT INTO t1 (col1) VALUES (''); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES ('a59b'); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES ('1a'); ERROR 01000: Data truncated for column 'col1' at row 1 INSERT IGNORE INTO t1 (col1) VALUES ('2a'); @@ -707,22 +707,22 @@ Error 1365 Division by 0 Error 1365 Division by 0 INSERT IGNORE INTO t1 VALUES(-9223372036854775809,-1),(9223372036854775808,18446744073709551616); Warnings: -Warning 1264 Out of range value adjusted for column 'col1' at row 1 -Warning 1264 Out of range value adjusted for column 'col2' at row 1 -Warning 1264 Out of range value adjusted for column 'col1' at row 2 -Warning 1264 Out of range value adjusted for column 'col2' at row 2 +Warning 1264 Out of range value for column 'col1' at row 1 +Warning 1264 Out of range value for column 'col2' at row 1 +Warning 1264 Out of range value for column 'col1' at row 2 +Warning 1264 Out of range value for column 'col2' at row 2 INSERT IGNORE INTO t1 VALUES('-9223372036854775809','-1'),('9223372036854775808','18446744073709551616'); Warnings: -Warning 1264 Out of range value adjusted for column 'col1' at row 1 -Warning 1264 Out of range value adjusted for column 'col2' at row 1 -Warning 1264 Out of range value adjusted for column 'col1' at row 2 -Warning 1264 Out of range value adjusted for column 'col2' at row 2 +Warning 1264 Out of range value for column 'col1' at row 1 +Warning 1264 Out of range value for column 'col2' at row 1 +Warning 1264 Out of range value for column 'col1' at row 2 +Warning 1264 Out of range value for column 'col2' at row 2 INSERT IGNORE INTO t1 VALUES(-9223372036854785809.0,-1.0),(9223372036854785808.0,18446744073709551616.0); Warnings: -Warning 1264 Out of range value adjusted for column 'col1' at row 1 -Warning 1264 Out of range value adjusted for column 'col2' at row 1 -Warning 1264 Out of range value adjusted for column 'col1' at row 2 -Warning 1264 Out of range value adjusted for column 'col2' at row 2 +Warning 1264 Out of range value for column 'col1' at row 1 +Warning 1264 Out of range value for column 'col2' at row 1 +Warning 1264 Out of range value for column 'col1' at row 2 +Warning 1264 Out of range value for column 'col2' at row 2 UPDATE IGNORE t1 SET col2=1/NULL where col1=0; SELECT * FROM t1; col1 col2 @@ -752,29 +752,29 @@ Warnings: Note 1265 Data truncated for column 'col1' at row 2 Note 1265 Data truncated for column 'col1' at row 4 INSERT INTO t1 VALUES (101.55); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 VALUES (101); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 VALUES (-101.55); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 VALUES (1010.55); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 VALUES (1010); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 VALUES ('101.55'); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 VALUES ('101'); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 VALUES ('-101.55'); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 VALUES ('-1010.55'); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 VALUES ('-100E+1'); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 VALUES ('-100E'); ERROR HY000: Incorrect decimal value: '-100E' for column 'col1' at row 1 UPDATE t1 SET col1 =col1 * 50000 WHERE col1 =11; -ERROR 22003: Out of range value adjusted for column 'col1' at row 6 +ERROR 22003: Out of range value for column 'col1' at row 6 UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0; ERROR 22012: Division by 0 UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0; @@ -793,16 +793,16 @@ Warnings: Error 1365 Division by 0 INSERT IGNORE INTO t1 VALUES(1000),(-1000); Warnings: -Warning 1264 Out of range value adjusted for column 'col1' at row 1 -Warning 1264 Out of range value adjusted for column 'col1' at row 2 +Warning 1264 Out of range value for column 'col1' at row 1 +Warning 1264 Out of range value for column 'col1' at row 2 INSERT IGNORE INTO t1 VALUES('1000'),('-1000'); Warnings: -Warning 1264 Out of range value adjusted for column 'col1' at row 1 -Warning 1264 Out of range value adjusted for column 'col1' at row 2 +Warning 1264 Out of range value for column 'col1' at row 1 +Warning 1264 Out of range value for column 'col1' at row 2 INSERT IGNORE INTO t1 VALUES(1000.0),(-1000.0); Warnings: -Warning 1264 Out of range value adjusted for column 'col1' at row 1 -Warning 1264 Out of range value adjusted for column 'col1' at row 2 +Warning 1264 Out of range value for column 'col1' at row 1 +Warning 1264 Out of range value for column 'col1' at row 2 UPDATE IGNORE t1 SET col1=1/NULL where col1=0; SELECT * FROM t1; col1 @@ -833,15 +833,15 @@ INSERT INTO t1 VALUES (-1.1E-37,0),(+3.4E+38,+3.4E+38); INSERT INTO t1 VALUES ('-1.1E-37',0),('+3.4E+38','+3.4E+38'); INSERT INTO t1 (col1) VALUES (3E-46); INSERT INTO t1 (col1) VALUES (+3.4E+39); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 (col2) VALUES (-1.1E-3); -ERROR 22003: Out of range value adjusted for column 'col2' at row 1 +ERROR 22003: Out of range value for column 'col2' at row 1 INSERT INTO t1 (col1) VALUES ('+3.4E+39'); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 (col2) VALUES ('-1.1E-3'); -ERROR 22003: Out of range value adjusted for column 'col2' at row 1 +ERROR 22003: Out of range value for column 'col2' at row 1 UPDATE t1 SET col1 =col1 * 5000 WHERE col1 > 0; -ERROR 22003: Out of range value adjusted for column 'col1' at row 2 +ERROR 22003: Out of range value for column 'col1' at row 2 UPDATE t1 SET col2 =col2 / 0 WHERE col2 > 0; ERROR 22012: Division by 0 UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0; @@ -860,12 +860,12 @@ Warnings: Error 1365 Division by 0 INSERT IGNORE INTO t1 VALUES (+3.4E+39,-3.4E+39); Warnings: -Warning 1264 Out of range value adjusted for column 'col1' at row 1 -Warning 1264 Out of range value adjusted for column 'col2' at row 1 +Warning 1264 Out of range value for column 'col1' at row 1 +Warning 1264 Out of range value for column 'col2' at row 1 INSERT IGNORE INTO t1 VALUES ('+3.4E+39','-3.4E+39'); Warnings: -Warning 1264 Out of range value adjusted for column 'col1' at row 1 -Warning 1264 Out of range value adjusted for column 'col2' at row 1 +Warning 1264 Out of range value for column 'col1' at row 1 +Warning 1264 Out of range value for column 'col2' at row 1 SELECT * FROM t1; col1 col2 -1.1e-37 0 @@ -885,13 +885,13 @@ INSERT INTO t1 (col1) VALUES (-2.2E-330); INSERT INTO t1 (col1) VALUES (+1.7E+309); Got one of the listed errors INSERT INTO t1 (col2) VALUES (-1.1E-3); -ERROR 22003: Out of range value adjusted for column 'col2' at row 1 +ERROR 22003: Out of range value for column 'col2' at row 1 INSERT INTO t1 (col1) VALUES ('+1.8E+309'); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 (col2) VALUES ('-1.2E-3'); -ERROR 22003: Out of range value adjusted for column 'col2' at row 1 +ERROR 22003: Out of range value for column 'col2' at row 1 UPDATE t1 SET col1 =col1 * 5000 WHERE col1 > 0; -ERROR 22003: Out of range value adjusted for column 'col1' at row 3 +ERROR 22003: Out of range value for column 'col1' at row 3 UPDATE t1 SET col2 =col2 / 0 WHERE col2 > 0; ERROR 22012: Division by 0 UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0; @@ -912,9 +912,9 @@ INSERT IGNORE INTO t1 VALUES (+1.9E+309,-1.9E+309); ERROR 22007: Illegal double '1.9E+309' value found during parsing INSERT IGNORE INTO t1 VALUES ('+2.0E+309','-2.0E+309'); Warnings: -Warning 1264 Out of range value adjusted for column 'col1' at row 1 -Warning 1264 Out of range value adjusted for column 'col2' at row 1 -Warning 1264 Out of range value adjusted for column 'col2' at row 1 +Warning 1264 Out of range value for column 'col1' at row 1 +Warning 1264 Out of range value for column 'col2' at row 1 +Warning 1264 Out of range value for column 'col2' at row 1 SELECT * FROM t1; col1 col2 0 0 @@ -989,16 +989,16 @@ ERROR 23000: Column 'col2' cannot be null INSERT INTO t1 VALUES (103,'',NULL); ERROR 23000: Column 'col3' cannot be null UPDATE t1 SET col1=NULL WHERE col1 =100; -ERROR 22004: Column set to default value; NULL supplied to NOT NULL column 'col1' at row 1 +ERROR 23000: Column 'col1' cannot be null UPDATE t1 SET col2 =NULL WHERE col2 ='hello'; -ERROR 22004: Column set to default value; NULL supplied to NOT NULL column 'col2' at row 1 +ERROR 23000: Column 'col2' cannot be null UPDATE t1 SET col2 =NULL where col3 IS NOT NULL; -ERROR 22004: Column set to default value; NULL supplied to NOT NULL column 'col2' at row 1 +ERROR 23000: Column 'col2' cannot be null INSERT IGNORE INTO t1 values (NULL,NULL,NULL); Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'col1' at row 1 -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'col2' at row 1 -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'col3' at row 1 +Warning 1048 Column 'col1' cannot be null +Warning 1048 Column 'col2' cannot be null +Warning 1048 Column 'col3' cannot be null SELECT * FROM t1; col1 col2 col3 100 hello 2004-08-20 @@ -1023,11 +1023,11 @@ ERROR HY000: Field 'col2' doesn't have a default value INSERT INTO t1 (col1) SELECT 1; ERROR HY000: Field 'col2' doesn't have a default value INSERT INTO t1 SELECT 1,NULL; -ERROR 22004: Column set to default value; NULL supplied to NOT NULL column 'col2' at row 1 +ERROR 23000: Column 'col2' cannot be null INSERT IGNORE INTO t1 values (NULL,NULL); Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'col1' at row 1 -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'col2' at row 1 +Warning 1048 Column 'col1' cannot be null +Warning 1048 Column 'col2' cannot be null INSERT IGNORE INTO t1 (col1) values (3); Warnings: Warning 1364 Field 'col2' doesn't have a default value @@ -1133,19 +1133,19 @@ ERROR 22007: Incorrect date value: '0' for column 'col1' at row 1 insert into t1 values (0.0,0.0,0.0); ERROR 22007: Incorrect date value: '0' for column 'col1' at row 1 insert into t1 (col1) values (convert('0000-00-00',date)); -ERROR 22007: Truncated incorrect datetime value: '0000-00-00' +ERROR 22007: Incorrect datetime value: '0000-00-00' insert into t1 (col1) values (cast('0000-00-00' as date)); -ERROR 22007: Truncated incorrect datetime value: '0000-00-00' +ERROR 22007: Incorrect datetime value: '0000-00-00' set sql_mode='no_zero_date'; insert into t1 values (0,0,0); Warnings: -Warning 1264 Out of range value adjusted for column 'col1' at row 1 -Warning 1264 Out of range value adjusted for column 'col2' at row 1 +Warning 1264 Out of range value for column 'col1' at row 1 +Warning 1264 Out of range value for column 'col2' at row 1 Warning 1265 Data truncated for column 'col3' at row 1 insert into t1 values (0.0,0.0,0.0); Warnings: -Warning 1264 Out of range value adjusted for column 'col1' at row 1 -Warning 1264 Out of range value adjusted for column 'col2' at row 1 +Warning 1264 Out of range value for column 'col1' at row 1 +Warning 1264 Out of range value for column 'col2' at row 1 Warning 1265 Data truncated for column 'col3' at row 1 drop table t1; set sql_mode='traditional'; @@ -1160,15 +1160,15 @@ Warnings: Warning 1265 Data truncated for column 'col1' at row 1 insert ignore into t1 (col1) values (cast('0000-00-00' as date)); Warnings: -Warning 1292 Truncated incorrect datetime value: '0000-00-00' +Warning 1292 Incorrect datetime value: '0000-00-00' insert into t1 select * from t1; ERROR 22007: Incorrect date value: '0000-00-00' for column 'col1' at row 1 alter table t1 modify col1 datetime; ERROR 22007: Incorrect datetime value: '0000-00-00' for column 'col1' at row 1 alter ignore table t1 modify col1 datetime; Warnings: -Warning 1264 Out of range value adjusted for column 'col1' at row 1 -Warning 1264 Out of range value adjusted for column 'col1' at row 2 +Warning 1264 Out of range value for column 'col1' at row 1 +Warning 1264 Out of range value for column 'col1' at row 2 insert into t1 select * from t1; ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'col1' at row 1 select * from t1; diff --git a/mysql-test/r/subselect_innodb.result b/mysql-test/r/subselect_innodb.result index a23b584e510..4dec7882d58 100644 --- a/mysql-test/r/subselect_innodb.result +++ b/mysql-test/r/subselect_innodb.result @@ -172,3 +172,75 @@ group by country; countrycount smcnt country total_funds 1 1200 USA 1200 drop table t1; +CREATE TABLE `t1` ( +`t3_id` int NOT NULL, +`t1_id` int NOT NULL, +PRIMARY KEY (`t1_id`) +); +CREATE TABLE `t2` ( +`t2_id` int NOT NULL, +`t1_id` int NOT NULL, +`b` int NOT NULL, +PRIMARY KEY (`t2_id`), +UNIQUE KEY `idx_t2_t1_b` (`t1_id`,`b`) +) ENGINE=InnoDB; +CREATE TABLE `t3` ( +`t3_id` int NOT NULL +); +INSERT INTO `t3` VALUES (3); +select +(SELECT rs.t2_id +FROM t2 rs +WHERE rs.t1_id= +(SELECT lt.t1_id +FROM t1 lt +WHERE lt.t3_id=a.t3_id) +ORDER BY b DESC LIMIT 1) +from t3 AS a; +(SELECT rs.t2_id +FROM t2 rs +WHERE rs.t1_id= +(SELECT lt.t1_id +FROM t1 lt +WHERE lt.t3_id=a.t3_id) +ORDER BY b DESC LIMIT 1) +NULL +DROP PROCEDURE IF EXISTS p1; +create procedure p1() +begin +declare done int default 3; +repeat +select +(SELECT rs.t2_id +FROM t2 rs +WHERE rs.t1_id= +(SELECT lt.t1_id +FROM t1 lt +WHERE lt.t3_id=a.t3_id) +ORDER BY b DESC LIMIT 1) as x +from t3 AS a; +set done= done-1; +until done <= 0 end repeat; +end// +call p1(); +x +NULL +x +NULL +x +NULL +call p1(); +x +NULL +x +NULL +x +NULL +call p1(); +x +NULL +x +NULL +x +NULL +drop tables t1,t2,t3; diff --git a/mysql-test/r/temp_table.result b/mysql-test/r/temp_table.result index 82479504b10..ca5e6e1a32f 100644 --- a/mysql-test/r/temp_table.result +++ b/mysql-test/r/temp_table.result @@ -135,3 +135,14 @@ d c bar 2 foo 1 drop table t1, t2; +create temporary table t1 (a int); +insert into t1 values (4711); +select * from t1; +a +4711 +truncate t1; +insert into t1 values (42); +select * from t1; +a +42 +drop table t1; diff --git a/mysql-test/r/timezone2.result b/mysql-test/r/timezone2.result index df51a6aac9b..5cc4150e374 100644 --- a/mysql-test/r/timezone2.result +++ b/mysql-test/r/timezone2.result @@ -117,9 +117,9 @@ insert into t1 values ('0000-00-00 00:00:00'),('1969-12-31 23:59:59'), ('1970-01-01 00:00:00'),('1970-01-01 00:00:01'), ('2037-12-31 23:59:59'),('2038-01-01 00:00:00'); Warnings: -Warning 1264 Out of range value adjusted for column 'ts' at row 2 -Warning 1264 Out of range value adjusted for column 'ts' at row 3 -Warning 1264 Out of range value adjusted for column 'ts' at row 6 +Warning 1264 Out of range value for column 'ts' at row 2 +Warning 1264 Out of range value for column 'ts' at row 3 +Warning 1264 Out of range value for column 'ts' at row 6 select * from t1; ts 0000-00-00 00:00:00 @@ -134,9 +134,9 @@ insert into t1 values ('0000-00-00 00:00:00'),('1970-01-01 00:30:00'), ('1970-01-01 01:00:00'),('1970-01-01 01:00:01'), ('2038-01-01 00:59:59'),('2038-01-01 01:00:00'); Warnings: -Warning 1264 Out of range value adjusted for column 'ts' at row 2 -Warning 1264 Out of range value adjusted for column 'ts' at row 3 -Warning 1264 Out of range value adjusted for column 'ts' at row 6 +Warning 1264 Out of range value for column 'ts' at row 2 +Warning 1264 Out of range value for column 'ts' at row 3 +Warning 1264 Out of range value for column 'ts' at row 6 select * from t1; ts 0000-00-00 00:00:00 @@ -151,9 +151,9 @@ insert into t1 values ('0000-00-00 00:00:00'),('1970-01-01 01:00:00'), ('1970-01-01 01:30:00'),('1970-01-01 01:30:01'), ('2038-01-01 01:29:59'),('2038-01-01 01:30:00'); Warnings: -Warning 1264 Out of range value adjusted for column 'ts' at row 2 -Warning 1264 Out of range value adjusted for column 'ts' at row 3 -Warning 1264 Out of range value adjusted for column 'ts' at row 6 +Warning 1264 Out of range value for column 'ts' at row 2 +Warning 1264 Out of range value for column 'ts' at row 3 +Warning 1264 Out of range value for column 'ts' at row 6 select * from t1; ts 0000-00-00 00:00:00 diff --git a/mysql-test/r/timezone_grant.result b/mysql-test/r/timezone_grant.result index 3758f3c2645..77cfe1c151e 100644 --- a/mysql-test/r/timezone_grant.result +++ b/mysql-test/r/timezone_grant.result @@ -38,7 +38,7 @@ select convert_tz('2004-11-31 12:00:00', 'Europe/Moscow', 'UTC'); convert_tz('2004-11-31 12:00:00', 'Europe/Moscow', 'UTC') NULL Warnings: -Warning 1292 Truncated incorrect datetime value: '2004-11-31 12:00:00' +Warning 1292 Incorrect datetime value: '2004-11-31 12:00:00' select convert_tz(b, 'Europe/Moscow', 'UTC') from t1; convert_tz(b, 'Europe/Moscow', 'UTC') update t1, t2 set t1.b = convert_tz('2004-11-30 12:00:00', 'Europe/Moscow', 'UTC') diff --git a/mysql-test/r/trigger-compat.result b/mysql-test/r/trigger-compat.result new file mode 100644 index 00000000000..5c104a2d2d5 --- /dev/null +++ b/mysql-test/r/trigger-compat.result @@ -0,0 +1,40 @@ +DELETE FROM mysql.user WHERE User LIKE 'mysqltest_%'; +DELETE FROM mysql.db WHERE User LIKE 'mysqltest_%'; +DELETE FROM mysql.tables_priv WHERE User LIKE 'mysqltest_%'; +DELETE FROM mysql.columns_priv WHERE User LIKE 'mysqltest_%'; +FLUSH PRIVILEGES; +DROP DATABASE IF EXISTS mysqltest_db1; +CREATE DATABASE mysqltest_db1; +CREATE USER mysqltest_dfn@localhost; +CREATE USER mysqltest_inv@localhost; +GRANT SUPER ON *.* TO mysqltest_dfn@localhost; +GRANT CREATE ON mysqltest_db1.* TO mysqltest_dfn@localhost; + +---> connection: wl2818_definer_con +CREATE TABLE t1(num_value INT); +CREATE TABLE t2(user_str TEXT); +CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1 +FOR EACH ROW +INSERT INTO t2 VALUES(CURRENT_USER()); + +---> patching t1.TRG... + +CREATE TRIGGER wl2818_trg2 AFTER INSERT ON t1 +FOR EACH ROW +INSERT INTO t2 VALUES(CURRENT_USER()); +Warnings: +Warning 1454 No definer attribute for trigger 'mysqltest_db1'.'wl2818_trg1'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger. + +SELECT trigger_name, definer FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name; +trigger_name definer +wl2818_trg1 +wl2818_trg2 mysqltest_dfn@localhost +Warnings: +Warning 1454 No definer attribute for trigger 'mysqltest_db1'.'wl2818_trg1'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger. + +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name; +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER +NULL mysqltest_db1 wl2818_trg1 INSERT NULL mysqltest_db1 t1 0 NULL +INSERT INTO t2 VALUES(CURRENT_USER()) ROW BEFORE NULL NULL OLD NEW NULL +NULL mysqltest_db1 wl2818_trg2 INSERT NULL mysqltest_db1 t1 0 NULL +INSERT INTO t2 VALUES(CURRENT_USER()) ROW AFTER NULL NULL OLD NEW NULL mysqltest_dfn@localhost diff --git a/mysql-test/r/trigger-grant.result b/mysql-test/r/trigger-grant.result new file mode 100644 index 00000000000..eda1adfdf65 --- /dev/null +++ b/mysql-test/r/trigger-grant.result @@ -0,0 +1,238 @@ +DELETE FROM mysql.user WHERE User LIKE 'mysqltest_%'; +DELETE FROM mysql.db WHERE User LIKE 'mysqltest_%'; +DELETE FROM mysql.tables_priv WHERE User LIKE 'mysqltest_%'; +DELETE FROM mysql.columns_priv WHERE User LIKE 'mysqltest_%'; +FLUSH PRIVILEGES; +DROP DATABASE IF EXISTS mysqltest_db1; +CREATE DATABASE mysqltest_db1; +CREATE USER mysqltest_dfn@localhost; +CREATE USER mysqltest_inv@localhost; +GRANT SUPER ON *.* TO mysqltest_dfn@localhost; +GRANT CREATE ON mysqltest_db1.* TO mysqltest_dfn@localhost; + +---> connection: wl2818_definer_con +CREATE TABLE t1(num_value INT); +CREATE TABLE t2(user_str TEXT); +CREATE TRIGGER trg1 AFTER INSERT ON t1 +FOR EACH ROW +INSERT INTO t2 VALUES(CURRENT_USER()); + +---> connection: default +GRANT ALL PRIVILEGES ON mysqltest_db1.t1 TO mysqltest_dfn@localhost; +GRANT ALL PRIVILEGES ON mysqltest_db1.t2 TO mysqltest_dfn@localhost; +GRANT ALL PRIVILEGES ON mysqltest_db1.t1 +TO 'mysqltest_inv'@localhost; +GRANT SELECT ON mysqltest_db1.t2 +TO 'mysqltest_inv'@localhost; + +---> connection: wl2818_definer_con +use mysqltest_db1; +INSERT INTO t1 VALUES(1); +SELECT * FROM t1; +num_value +1 +SELECT * FROM t2; +user_str +mysqltest_dfn@localhost + +---> connection: wl2818_invoker_con +use mysqltest_db1; +INSERT INTO t1 VALUES(2); +SELECT * FROM t1; +num_value +1 +2 +SELECT * FROM t2; +user_str +mysqltest_dfn@localhost +mysqltest_dfn@localhost + +---> connection: default +use mysqltest_db1; +REVOKE INSERT ON mysqltest_db1.t2 FROM mysqltest_dfn@localhost; + +---> connection: wl2818_invoker_con +use mysqltest_db1; +INSERT INTO t1 VALUES(3); +ERROR 42000: INSERT command denied to user 'mysqltest_dfn'@'localhost' for table 't2' +SELECT * FROM t1; +num_value +1 +2 +3 +SELECT * FROM t2; +user_str +mysqltest_dfn@localhost +mysqltest_dfn@localhost + +---> connection: default +use mysqltest_db1; +REVOKE SELECT ON mysqltest_db1.t1 FROM mysqltest_dfn@localhost; + +---> connection: wl2818_definer_con +use mysqltest_db1; +DROP TRIGGER trg1; +SET @new_sum = 0; +SET @old_sum = 0; +---> INSERT INTO statement; BEFORE timing +CREATE TRIGGER trg1 BEFORE INSERT ON t1 +FOR EACH ROW +SET @new_sum = @new_sum + NEW.num_value; +INSERT INTO t1 VALUES(4); +ERROR 42000: SELECT command denied to user 'mysqltest_dfn'@'localhost' for table 't1' +---> INSERT INTO statement; AFTER timing +DROP TRIGGER trg1; +CREATE TRIGGER trg1 AFTER INSERT ON t1 +FOR EACH ROW +SET @new_sum = @new_sum + NEW.num_value; +INSERT INTO t1 VALUES(5); +ERROR 42000: SELECT command denied to user 'mysqltest_dfn'@'localhost' for table 't1' +---> UPDATE statement; BEFORE timing +DROP TRIGGER trg1; +CREATE TRIGGER trg1 BEFORE UPDATE ON t1 +FOR EACH ROW +SET @old_sum = @old_sum + OLD.num_value; +UPDATE t1 SET num_value = 10; +ERROR 42000: SELECT command denied to user 'mysqltest_dfn'@'localhost' for table 't1' +---> UPDATE statement; AFTER timing +DROP TRIGGER trg1; +CREATE TRIGGER trg1 AFTER UPDATE ON t1 +FOR EACH ROW +SET @new_sum = @new_sum + NEW.num_value; +UPDATE t1 SET num_value = 20; +ERROR 42000: SELECT command denied to user 'mysqltest_dfn'@'localhost' for table 't1' +---> DELETE statement; BEFORE timing +DROP TRIGGER trg1; +CREATE TRIGGER trg1 BEFORE DELETE ON t1 +FOR EACH ROW +SET @old_sum = @old_sum + OLD.num_value; +DELETE FROM t1; +ERROR 42000: SELECT command denied to user 'mysqltest_dfn'@'localhost' for table 't1' +---> DELETE statement; AFTER timing +DROP TRIGGER trg1; +CREATE TRIGGER trg1 AFTER DELETE ON t1 +FOR EACH ROW +SET @old_sum = @old_sum + OLD.num_value; +DELETE FROM t1; +ERROR 42000: SELECT command denied to user 'mysqltest_dfn'@'localhost' for table 't1' + +---> connection: default +use mysqltest_db1; +GRANT SELECT ON mysqltest_db1.t1 TO mysqltest_dfn@localhost; +REVOKE UPDATE ON mysqltest_db1.t1 FROM mysqltest_dfn@localhost; + +---> connection: wl2818_definer_con +use mysqltest_db1; +DROP TRIGGER trg1; +SET @new_sum = 0; +SET @old_sum = 0; +---> INSERT INTO statement; BEFORE timing +CREATE TRIGGER trg1 BEFORE INSERT ON t1 +FOR EACH ROW +SET @new_sum = @new_sum + NEW.num_value; +INSERT INTO t1 VALUES(4); +ERROR 42000: UPDATE command denied to user 'mysqltest_dfn'@'localhost' for table 't1' +---> INSERT INTO statement; AFTER timing +DROP TRIGGER trg1; +CREATE TRIGGER trg1 AFTER INSERT ON t1 +FOR EACH ROW +SET @new_sum = @new_sum + NEW.num_value; +INSERT INTO t1 VALUES(5); +ERROR 42000: UPDATE command denied to user 'mysqltest_dfn'@'localhost' for table 't1' +---> UPDATE statement; BEFORE timing +DROP TRIGGER trg1; +CREATE TRIGGER trg1 BEFORE UPDATE ON t1 +FOR EACH ROW +SET @old_sum = @old_sum + OLD.num_value; +UPDATE t1 SET num_value = 10; +ERROR 42000: UPDATE command denied to user 'mysqltest_dfn'@'localhost' for table 't1' +---> UPDATE statement; AFTER timing +DROP TRIGGER trg1; +CREATE TRIGGER trg1 AFTER UPDATE ON t1 +FOR EACH ROW +SET @new_sum = @new_sum + NEW.num_value; +UPDATE t1 SET num_value = 20; +ERROR 42000: UPDATE command denied to user 'mysqltest_dfn'@'localhost' for table 't1' +---> DELETE statement; BEFORE timing +DROP TRIGGER trg1; +CREATE TRIGGER trg1 BEFORE DELETE ON t1 +FOR EACH ROW +SET @old_sum = @old_sum + OLD.num_value; +DELETE FROM t1; +ERROR 42000: UPDATE command denied to user 'mysqltest_dfn'@'localhost' for table 't1' +---> DELETE statement; AFTER timing +DROP TRIGGER trg1; +CREATE TRIGGER trg1 AFTER DELETE ON t1 +FOR EACH ROW +SET @old_sum = @old_sum + OLD.num_value; +DELETE FROM t1; +ERROR 42000: UPDATE command denied to user 'mysqltest_dfn'@'localhost' for table 't1' + +---> connection: wl2818_definer_con +use mysqltest_db1; +DROP TRIGGER trg1; +CREATE DEFINER='mysqltest_inv'@'localhost' + TRIGGER trg1 BEFORE INSERT ON t1 +FOR EACH ROW +SET @new_sum = 0; +CREATE DEFINER='mysqltest_nonexs'@'localhost' + TRIGGER trg2 AFTER INSERT ON t1 +FOR EACH ROW +SET @new_sum = 0; +Warnings: +Note 1449 There is no 'mysqltest_nonexs'@'localhost' registered +INSERT INTO t1 VALUES(6); +ERROR 42000: Access denied; you need the SUPER privilege for this operation +SHOW TRIGGERS; +Trigger Event Table Statement Timing Created sql_mode Definer +trg1 INSERT t1 +SET @new_sum = 0 BEFORE NULL mysqltest_inv@localhost +trg2 INSERT t1 +SET @new_sum = 0 AFTER NULL mysqltest_nonexs@localhost +DROP TRIGGER trg1; +DROP TRIGGER trg2; +CREATE TRIGGER trg1 BEFORE INSERT ON t1 +FOR EACH ROW +SET @a = 1; +CREATE TRIGGER trg2 AFTER INSERT ON t1 +FOR EACH ROW +SET @a = 2; +CREATE TRIGGER trg3 BEFORE UPDATE ON t1 +FOR EACH ROW +SET @a = 3; +CREATE TRIGGER trg4 AFTER UPDATE ON t1 +FOR EACH ROW +SET @a = 4; +CREATE TRIGGER trg5 BEFORE DELETE ON t1 +FOR EACH ROW +SET @a = 5; + +SELECT trigger_name, definer FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name; +trigger_name definer +trg1 +trg2 @ +trg3 @abc@def@@ +trg4 @hostname +trg5 @abcdef@@@hostname +Warnings: +Warning 1454 No definer attribute for trigger 'mysqltest_db1'.'trg1'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger. + +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name; +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER +NULL mysqltest_db1 trg1 INSERT NULL mysqltest_db1 t1 0 NULL +SET @a = 1 ROW BEFORE NULL NULL OLD NEW NULL +NULL mysqltest_db1 trg2 INSERT NULL mysqltest_db1 t1 0 NULL +SET @a = 2 ROW AFTER NULL NULL OLD NEW NULL @ +NULL mysqltest_db1 trg3 UPDATE NULL mysqltest_db1 t1 0 NULL +SET @a = 3 ROW BEFORE NULL NULL OLD NEW NULL @abc@def@@ +NULL mysqltest_db1 trg4 UPDATE NULL mysqltest_db1 t1 0 NULL +SET @a = 4 ROW AFTER NULL NULL OLD NEW NULL @hostname +NULL mysqltest_db1 trg5 DELETE NULL mysqltest_db1 t1 0 NULL +SET @a = 5 ROW BEFORE NULL NULL OLD NEW NULL @abcdef@@@hostname + +---> connection: default +DROP USER mysqltest_dfn@localhost; +DROP USER mysqltest_inv@localhost; +DROP DATABASE mysqltest_db1; +Warnings: +Warning 1454 No definer attribute for trigger 'mysqltest_db1'.'trg1'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger. diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result index b305691fa18..ff92fc543d4 100644 --- a/mysql-test/r/trigger.result +++ b/mysql-test/r/trigger.result @@ -611,9 +611,9 @@ select @a; @a 10 show triggers; -Trigger Event Table Statement Timing Created sql_mode -t1_bi INSERT t1 set new."t1 column" = 5 BEFORE # REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI -t1_af INSERT t1 set @a=10 AFTER # +Trigger Event Table Statement Timing Created sql_mode Definer +t1_bi INSERT t1 set new."t1 column" = 5 BEFORE # REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI root@localhost +t1_af INSERT t1 set @a=10 AFTER # root@localhost drop table t1; set sql_mode="traditional"; create table t1 (a date); @@ -633,8 +633,8 @@ t1 CREATE TABLE `t1` ( `a` date default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 show triggers; -Trigger Event Table Statement Timing Created sql_mode -t1_bi INSERT t1 set new.a = '2004-01-00' BEFORE # +Trigger Event Table Statement Timing Created sql_mode Definer +t1_bi INSERT t1 set new.a = '2004-01-00' BEFORE # root@localhost drop table t1; create table t1 (id int); create trigger t1_ai after insert on t1 for each row flush tables; @@ -703,8 +703,11 @@ create trigger t1_ai after insert on t1 for each row insert into t2 values (new.f1+1); create trigger t2_ai after insert on t2 for each row insert into t1 values (new.f2+1); +set @SAVE_SP_RECURSION_LEVELS=@@max_sp_recursion_depth; +set @@max_sp_recursion_depth=100; insert into t1 values (1); ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger. +set @@max_sp_recursion_depth=@SAVE_SP_RECURSION_LEVELS; select * from t1; f1 1 @@ -738,3 +741,42 @@ f1 1 drop trigger t1_bi; drop tables t1, t2; +create table t1 (id int); +create table t2 (id int); +create trigger t1_bi before insert on t1 for each row insert into t2 values (new.id); +prepare stmt1 from "insert into t1 values (10)"; +create procedure p1() insert into t1 values (10); +call p1(); +drop trigger t1_bi; +execute stmt1; +call p1(); +deallocate prepare stmt1; +drop procedure p1; +create table t3 (id int); +create trigger t1_bi after insert on t1 for each row insert into t2 values (new.id); +prepare stmt1 from "insert into t1 values (10)"; +create procedure p1() insert into t1 values (10); +call p1(); +drop trigger t1_bi; +create trigger t1_bi after insert on t1 for each row insert into t3 values (new.id); +execute stmt1; +ERROR HY000: Table 't3' was not locked with LOCK TABLES +call p1(); +ERROR HY000: Table 't3' was not locked with LOCK TABLES +deallocate prepare stmt1; +drop procedure p1; +drop table t1, t2, t3; +create table t1 (a int); +drop procedure if exists p2; +CREATE PROCEDURE `p2`() +begin +insert into t1 values (1); +end// +create trigger trg before insert on t1 for each row +begin +declare done int default 0; +set done= not done; +end// +CALL p2(); +drop procedure p2; +drop table t1; diff --git a/mysql-test/r/type_binary.result b/mysql-test/r/type_binary.result index 49fd7ba5633..1c60bf46608 100644 --- a/mysql-test/r/type_binary.result +++ b/mysql-test/r/type_binary.result @@ -111,3 +111,6 @@ select count(distinct s1) from t1; count(distinct s1) 3 drop table t1; +select hex(cast(0x10 as binary(2))); +hex(cast(0x10 as binary(2))) +1000 diff --git a/mysql-test/r/type_bit.result b/mysql-test/r/type_bit.result index 0213dbaffde..942e165649e 100644 --- a/mysql-test/r/type_bit.result +++ b/mysql-test/r/type_bit.result @@ -62,7 +62,7 @@ drop table t1; create table t1 (a bit); insert into t1 values (b'0'), (b'1'), (b'000'), (b'100'), (b'001'); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 4 +Warning 1264 Out of range value for column 'a' at row 4 select hex(a) from t1; hex(a) 0 @@ -76,7 +76,7 @@ drop table t1; create table t1 (a bit(2)); insert into t1 values (b'00'), (b'01'), (b'10'), (b'100'); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 4 +Warning 1264 Out of range value for column 'a' at row 4 select a+0 from t1; a+0 0 @@ -461,7 +461,7 @@ drop table t1; create table t1 (a bit(8)) engine=heap; insert into t1 values ('1111100000'); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 1 select a+0 from t1; a+0 255 diff --git a/mysql-test/r/type_bit_innodb.result b/mysql-test/r/type_bit_innodb.result index 8d9c9756a33..20eadd94342 100644 --- a/mysql-test/r/type_bit_innodb.result +++ b/mysql-test/r/type_bit_innodb.result @@ -62,7 +62,7 @@ drop table t1; create table t1 (a bit) engine=innodb; insert into t1 values (b'0'), (b'1'), (b'000'), (b'100'), (b'001'); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 4 +Warning 1264 Out of range value for column 'a' at row 4 select hex(a) from t1; hex(a) 0 @@ -76,7 +76,7 @@ drop table t1; create table t1 (a bit(2)) engine=innodb; insert into t1 values (b'00'), (b'01'), (b'10'), (b'100'); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 4 +Warning 1264 Out of range value for column 'a' at row 4 select a+0 from t1; a+0 0 diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result index e88eebffb55..3f0b9f4c13c 100644 --- a/mysql-test/r/type_date.result +++ b/mysql-test/r/type_date.result @@ -99,7 +99,7 @@ DROP TABLE t1, t2, t3; CREATE TABLE t1 (y YEAR); INSERT INTO t1 VALUES ('abc'); Warnings: -Warning 1264 Out of range value adjusted for column 'y' at row 1 +Warning 1264 Out of range value for column 'y' at row 1 SELECT * FROM t1; y 0000 diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result index 85f899be5d8..5eba97a9eda 100644 --- a/mysql-test/r/type_datetime.result +++ b/mysql-test/r/type_datetime.result @@ -52,7 +52,7 @@ t truncate table t1; insert into t1 values("2003-0303 12:13:14"); Warnings: -Warning 1264 Out of range value adjusted for column 't' at row 1 +Warning 1264 Out of range value for column 't' at row 1 select * from t1; t 0000-00-00 00:00:00 @@ -113,12 +113,12 @@ create table t1 (t datetime); insert into t1 values (20030102030460),(20030102036301),(20030102240401), (20030132030401),(20031302030401),(100001202030401); Warnings: -Warning 1264 Out of range value adjusted for column 't' at row 1 -Warning 1264 Out of range value adjusted for column 't' at row 2 -Warning 1264 Out of range value adjusted for column 't' at row 3 -Warning 1264 Out of range value adjusted for column 't' at row 4 -Warning 1264 Out of range value adjusted for column 't' at row 5 -Warning 1264 Out of range value adjusted for column 't' at row 6 +Warning 1264 Out of range value for column 't' at row 1 +Warning 1264 Out of range value for column 't' at row 2 +Warning 1264 Out of range value for column 't' at row 3 +Warning 1264 Out of range value for column 't' at row 4 +Warning 1264 Out of range value for column 't' at row 5 +Warning 1264 Out of range value for column 't' at row 6 select * from t1; t 0000-00-00 00:00:00 @@ -132,12 +132,12 @@ insert into t1 values ("2003-01-02 03:04:60"),("2003-01-02 03:63:01"),("2003-01-02 24:04:01"), ("2003-01-32 03:04:01"),("2003-13-02 03:04:01"), ("10000-12-02 03:04:00"); Warnings: -Warning 1264 Out of range value adjusted for column 't' at row 1 -Warning 1264 Out of range value adjusted for column 't' at row 2 -Warning 1264 Out of range value adjusted for column 't' at row 3 -Warning 1264 Out of range value adjusted for column 't' at row 4 -Warning 1264 Out of range value adjusted for column 't' at row 5 -Warning 1264 Out of range value adjusted for column 't' at row 6 +Warning 1264 Out of range value for column 't' at row 1 +Warning 1264 Out of range value for column 't' at row 2 +Warning 1264 Out of range value for column 't' at row 3 +Warning 1264 Out of range value for column 't' at row 4 +Warning 1264 Out of range value for column 't' at row 5 +Warning 1264 Out of range value for column 't' at row 6 select * from t1; t 0000-00-00 00:00:00 @@ -149,8 +149,8 @@ t delete from t1; insert into t1 values ("0000-00-00 00:00:00 some trailer"),("2003-01-01 00:00:00 some trailer"); Warnings: -Warning 1264 Out of range value adjusted for column 't' at row 1 -Warning 1264 Out of range value adjusted for column 't' at row 2 +Warning 1264 Out of range value for column 't' at row 1 +Warning 1264 Out of range value for column 't' at row 2 select * from t1; t 0000-00-00 00:00:00 diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result index d7f5f9fa328..4ca1a3bc186 100644 --- a/mysql-test/r/type_decimal.result +++ b/mysql-test/r/type_decimal.result @@ -157,25 +157,25 @@ insert into t1 values ("-.1"),("+.1"),(".1"); insert into t1 values ("00000000000001"),("+0000000000001"),("-0000000000001"); insert into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11"); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 -Warning 1264 Out of range value adjusted for column 'a' at row 2 +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 2 insert into t1 values ("-111111111.11"),("+1111111111.11"),("1111111111.11"); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 -Warning 1264 Out of range value adjusted for column 'a' at row 2 -Warning 1264 Out of range value adjusted for column 'a' at row 3 +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 2 +Warning 1264 Out of range value for column 'a' at row 3 insert into t1 values ("1e+1000"),("1e-1000"),("-1e+1000"); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 1 Note 1265 Data truncated for column 'a' at row 2 -Warning 1264 Out of range value adjusted for column 'a' at row 3 +Warning 1264 Out of range value for column 'a' at row 3 insert into t1 values ("1e+4294967296"),("1e-4294967296"); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 1 Note 1265 Data truncated for column 'a' at row 2 insert into t1 values ("1e+18446744073709551615"),("1e+18446744073709551616"),("1e-9223372036854775807"),("1e-9223372036854775809"); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 1 Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column 'a' at row 2 Note 1265 Data truncated for column 'a' at row 3 Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column 'a' at row 4 @@ -221,29 +221,29 @@ drop table t1; create table t1 (a decimal(10,2) unsigned); insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0"); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 2 -Warning 1264 Out of range value adjusted for column 'a' at row 6 +Warning 1264 Out of range value for column 'a' at row 2 +Warning 1264 Out of range value for column 'a' at row 6 insert into t1 values ("-.1"),("+.1"),(".1"); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 1 insert into t1 values ("00000000000001"),("+0000000000001"),("-0000000000001"); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 3 +Warning 1264 Out of range value for column 'a' at row 3 insert into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11"); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 -Warning 1264 Out of range value adjusted for column 'a' at row 2 -Warning 1264 Out of range value adjusted for column 'a' at row 3 +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 2 +Warning 1264 Out of range value for column 'a' at row 3 insert into t1 values ("-111111111.11"),("+1111111111.11"),("1111111111.11"); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 -Warning 1264 Out of range value adjusted for column 'a' at row 2 -Warning 1264 Out of range value adjusted for column 'a' at row 3 +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 2 +Warning 1264 Out of range value for column 'a' at row 3 insert into t1 values ("1e+1000"),("1e-1000"),("-1e+1000"); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 1 Note 1265 Data truncated for column 'a' at row 2 -Warning 1264 Out of range value adjusted for column 'a' at row 3 +Warning 1264 Out of range value for column 'a' at row 3 insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0"); Warnings: Note 1265 Data truncated for column 'a' at row 1 @@ -280,29 +280,29 @@ drop table t1; create table t1 (a decimal(10,2) zerofill); insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0"); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 2 -Warning 1264 Out of range value adjusted for column 'a' at row 6 +Warning 1264 Out of range value for column 'a' at row 2 +Warning 1264 Out of range value for column 'a' at row 6 insert into t1 values ("-.1"),("+.1"),(".1"); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 1 insert into t1 values ("00000000000001"),("+0000000000001"),("-0000000000001"); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 3 +Warning 1264 Out of range value for column 'a' at row 3 insert into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11"); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 -Warning 1264 Out of range value adjusted for column 'a' at row 2 -Warning 1264 Out of range value adjusted for column 'a' at row 3 +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 2 +Warning 1264 Out of range value for column 'a' at row 3 insert into t1 values ("-111111111.11"),("+1111111111.11"),("1111111111.11"); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 -Warning 1264 Out of range value adjusted for column 'a' at row 2 -Warning 1264 Out of range value adjusted for column 'a' at row 3 +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 2 +Warning 1264 Out of range value for column 'a' at row 3 insert into t1 values ("1e+1000"),("1e-1000"),("-1e+1000"); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 1 Note 1265 Data truncated for column 'a' at row 2 -Warning 1264 Out of range value adjusted for column 'a' at row 3 +Warning 1264 Out of range value for column 'a' at row 3 insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0"); Warnings: Note 1265 Data truncated for column 'a' at row 1 @@ -342,18 +342,18 @@ insert into t1 values (-.1),(+.1),(.1); insert into t1 values (00000000000001),(+0000000000001),(-0000000000001); insert into t1 values (+111111111.11),(111111111.11),(-11111111.11); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 -Warning 1264 Out of range value adjusted for column 'a' at row 2 +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 2 insert into t1 values (-111111111.11),(+1111111111.11),(1111111111.11); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 -Warning 1264 Out of range value adjusted for column 'a' at row 2 -Warning 1264 Out of range value adjusted for column 'a' at row 3 +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 2 +Warning 1264 Out of range value for column 'a' at row 3 insert into t1 values (1e+100),(1e-100),(-1e+100); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 1 Note 1265 Data truncated for column 'a' at row 2 -Warning 1264 Out of range value adjusted for column 'a' at row 3 +Warning 1264 Out of range value for column 'a' at row 3 insert into t1 values (123.4e0),(123.4e+2),(123.4e-2),(123e1),(123e+0); Warnings: Note 1265 Data truncated for column 'a' at row 3 @@ -393,9 +393,9 @@ drop table t1; create table t1 (a decimal); insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+12345678901'),(99999999999999); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 -Warning 1264 Out of range value adjusted for column 'a' at row 6 -Warning 1264 Out of range value adjusted for column 'a' at row 7 +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 6 +Warning 1264 Out of range value for column 'a' at row 7 select * from t1; a -9999999999 @@ -409,9 +409,9 @@ drop table t1; create table t1 (a decimal unsigned); insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 -Warning 1264 Out of range value adjusted for column 'a' at row 2 -Warning 1264 Out of range value adjusted for column 'a' at row 7 +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 2 +Warning 1264 Out of range value for column 'a' at row 7 select * from t1; a 0 @@ -425,9 +425,9 @@ drop table t1; create table t1 (a decimal zerofill); insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 -Warning 1264 Out of range value adjusted for column 'a' at row 2 -Warning 1264 Out of range value adjusted for column 'a' at row 7 +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 2 +Warning 1264 Out of range value for column 'a' at row 7 select * from t1; a 0000000000 @@ -441,9 +441,9 @@ drop table t1; create table t1 (a decimal unsigned zerofill); insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 -Warning 1264 Out of range value adjusted for column 'a' at row 2 -Warning 1264 Out of range value adjusted for column 'a' at row 7 +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 2 +Warning 1264 Out of range value for column 'a' at row 7 select * from t1; a 0000000000 @@ -457,14 +457,14 @@ drop table t1; create table t1(a decimal(10,0)); insert into t1 values ("1e4294967295"); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 1 select * from t1; a 9999999999 delete from t1; insert into t1 values("1e4294967297"); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 1 select * from t1; a 9999999999 diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result index c10cb7d71f7..352dd55653b 100644 --- a/mysql-test/r/type_float.result +++ b/mysql-test/r/type_float.result @@ -24,8 +24,8 @@ f1 float NULL YES NULL # f2 double NULL YES NULL # insert into t1 values(10,10),(1e+5,1e+5),(1234567890,1234567890),(1e+10,1e+10),(1e+15,1e+15),(1e+20,1e+20),(1e+50,1e+50),(1e+150,1e+150); Warnings: -Warning 1264 Out of range value adjusted for column 'f1' at row 7 -Warning 1264 Out of range value adjusted for column 'f1' at row 8 +Warning 1264 Out of range value for column 'f1' at row 7 +Warning 1264 Out of range value for column 'f1' at row 8 insert into t1 values(-10,-10),(1e-5,1e-5),(1e-10,1e-10),(1e-15,1e-15),(1e-20,1e-20),(1e-50,1e-50),(1e-150,1e-150); select * from t1; f1 f2 @@ -149,7 +149,7 @@ create table t1 (d1 double, d2 double unsigned); insert into t1 set d1 = -1.0; update t1 set d2 = d1; Warnings: -Warning 1264 Out of range value adjusted for column 'd2' at row 1 +Warning 1264 Out of range value for column 'd2' at row 1 select * from t1; d1 d2 -1 0 @@ -157,12 +157,12 @@ drop table t1; create table t1 (f float(4,3)); insert into t1 values (-11.0),(-11),("-11"),(11.0),(11),("11"); Warnings: -Warning 1264 Out of range value adjusted for column 'f' at row 1 -Warning 1264 Out of range value adjusted for column 'f' at row 2 -Warning 1264 Out of range value adjusted for column 'f' at row 3 -Warning 1264 Out of range value adjusted for column 'f' at row 4 -Warning 1264 Out of range value adjusted for column 'f' at row 5 -Warning 1264 Out of range value adjusted for column 'f' at row 6 +Warning 1264 Out of range value for column 'f' at row 1 +Warning 1264 Out of range value for column 'f' at row 2 +Warning 1264 Out of range value for column 'f' at row 3 +Warning 1264 Out of range value for column 'f' at row 4 +Warning 1264 Out of range value for column 'f' at row 5 +Warning 1264 Out of range value for column 'f' at row 6 select * from t1; f -9.999 @@ -175,12 +175,12 @@ drop table if exists t1; create table t1 (f double(4,3)); insert into t1 values (-11.0),(-11),("-11"),(11.0),(11),("11"); Warnings: -Warning 1264 Out of range value adjusted for column 'f' at row 1 -Warning 1264 Out of range value adjusted for column 'f' at row 2 -Warning 1264 Out of range value adjusted for column 'f' at row 3 -Warning 1264 Out of range value adjusted for column 'f' at row 4 -Warning 1264 Out of range value adjusted for column 'f' at row 5 -Warning 1264 Out of range value adjusted for column 'f' at row 6 +Warning 1264 Out of range value for column 'f' at row 1 +Warning 1264 Out of range value for column 'f' at row 2 +Warning 1264 Out of range value for column 'f' at row 3 +Warning 1264 Out of range value for column 'f' at row 4 +Warning 1264 Out of range value for column 'f' at row 5 +Warning 1264 Out of range value for column 'f' at row 6 select * from t1; f -9.999 diff --git a/mysql-test/r/type_newdecimal-big.result b/mysql-test/r/type_newdecimal-big.result new file mode 100644 index 00000000000..e95f2f3f781 --- /dev/null +++ b/mysql-test/r/type_newdecimal-big.result @@ -0,0 +1,11 @@ +drop procedure if exists sp1; +create procedure sp1 () begin +declare v1, v2, v3, v4 decimal(16,12); declare v5 int; +set v1 = 1; set v2 = 2; set v3 = 1000000000000; set v4 = 2000000000000; set v5 = 0; +while v5 < 100000 do +set v1 = v1 + 0.000000000001; set v2 = v2 - 0.000000000001; set v3 = v3 + 1; set v4 = v4 - 1; set v5 = v5 + 1; +end while; select v1, v2, v3 * 0.000000000001, v4 * 0.000000000001; end;// +call sp1()// +v1 v2 v3 * 0.000000000001 v4 * 0.000000000001 +1.000000100000 1.999999900000 1.000000100000 1.999999900000 +drop procedure sp1; diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result index 1ed4135d52b..430bf30b900 100644 --- a/mysql-test/r/type_newdecimal.result +++ b/mysql-test/r/type_newdecimal.result @@ -79,16 +79,16 @@ drop table t1; create table t1 (a decimal(4,2)); insert into t1 value (10000), (1.1e10), ("11111"), (100000.1); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 -Warning 1264 Out of range value adjusted for column 'a' at row 2 -Warning 1264 Out of range value adjusted for column 'a' at row 3 -Warning 1264 Out of range value adjusted for column 'a' at row 4 +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 2 +Warning 1264 Out of range value for column 'a' at row 3 +Warning 1264 Out of range value for column 'a' at row 4 insert into t1 value (-10000), (-1.1e10), ("-11111"), (-100000.1); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 -Warning 1264 Out of range value adjusted for column 'a' at row 2 -Warning 1264 Out of range value adjusted for column 'a' at row 3 -Warning 1264 Out of range value adjusted for column 'a' at row 4 +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 2 +Warning 1264 Out of range value for column 'a' at row 3 +Warning 1264 Out of range value for column 'a' at row 4 select a from t1; a 99.99 @@ -103,16 +103,16 @@ drop table t1; create table t1 (a decimal(4,2) unsigned); insert into t1 value (10000), (1.1e10), ("11111"), (100000.1); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 -Warning 1264 Out of range value adjusted for column 'a' at row 2 -Warning 1264 Out of range value adjusted for column 'a' at row 3 -Warning 1264 Out of range value adjusted for column 'a' at row 4 +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 2 +Warning 1264 Out of range value for column 'a' at row 3 +Warning 1264 Out of range value for column 'a' at row 4 insert into t1 value (-10000), (-1.1e10), ("-11111"), (-100000.1); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 -Warning 1264 Out of range value adjusted for column 'a' at row 2 -Warning 1264 Out of range value adjusted for column 'a' at row 3 -Warning 1264 Out of range value adjusted for column 'a' at row 4 +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 2 +Warning 1264 Out of range value for column 'a' at row 3 +Warning 1264 Out of range value for column 'a' at row 4 select a from t1; a 99.99 @@ -127,13 +127,13 @@ drop table t1; create table t1 (a bigint); insert into t1 values (18446744073709551615.0); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 1 insert into t1 values (9223372036854775808.0); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 1 insert into t1 values (-18446744073709551615.0); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 1 select * from t1; a 9223372036854775807 @@ -145,10 +145,10 @@ insert into t1 values (18446744073709551615.0); insert into t1 values (9223372036854775808.0); insert into t1 values (9999999999999999999999999.000); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 1 insert into t1 values (-1.0); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 1 select * from t1; a 18446744073709551615 @@ -159,12 +159,12 @@ drop table t1; create table t1 (a tinyint); insert into t1 values (18446744073709551615.0); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 -Warning 1264 Out of range value adjusted for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 1 insert into t1 values (9223372036854775808.0); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 -Warning 1264 Out of range value adjusted for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 1 select * from t1; a 127 @@ -678,16 +678,6 @@ select -18.3=18.3; select 0.8 = 0.7 + 0.1; 0.8 = 0.7 + 0.1 1 -create procedure p1 () begin -declare v1, v2, v3, v4 decimal(16,12); declare v5 int; -set v1 = 1; set v2 = 2; set v3 = 1000000000000; set v4 = 2000000000000; set v5 = 0; -while v5 < 100000 do -set v1 = v1 + 0.000000000001; set v2 = v2 - 0.000000000001; set v3 = v3 + 1; set v4 = v4 - 1; set v5 = v5 + 1; -end while; select v1, v2, v3 * 0.000000000001, v4 * 0.000000000001; end;// -call p1()// -v1 v2 v3 * 0.000000000001 v4 * 0.000000000001 -1.000000100000 1.999999900000 1.000000100000 1.999999900000 -drop procedure p1; drop table if exists t1; Warnings: Note 1051 Unknown table 't1' @@ -816,9 +806,9 @@ Warnings: Note 1265 Data truncated for column 'col1' at row 1 INSERT INTO Sow6_2f VALUES (11); INSERT INTO Sow6_2f VALUES (101.55); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 UPDATE Sow6_2f SET col1 = col1 * 50 WHERE col1 = 11; -ERROR 22003: Out of range value adjusted for column 'col1' at row 5 +ERROR 22003: Out of range value for column 'col1' at row 5 UPDATE Sow6_2f SET col1 = col1 / 0 WHERE col1 > 0; ERROR 22012: Division by 0 SELECT MOD(col1,0) FROM Sow6_2f; @@ -882,13 +872,13 @@ NULL set @@sql_mode='traditional'; create table t1( d1 decimal(18) unsigned, d2 decimal(20) unsigned, d3 decimal (22) unsigned); insert into t1 values(1,-1,-1); -ERROR 22003: Out of range value adjusted for column 'd2' at row 1 +ERROR 22003: Out of range value for column 'd2' at row 1 drop table t1; create table t1 (col1 decimal(5,2), col2 numeric(5,2)); insert into t1 values (999.999,999.999); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 insert into t1 values (-999.999,-999.999); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +ERROR 22003: Out of range value for column 'col1' at row 1 select * from t1; col1 col2 drop table t1; @@ -1020,12 +1010,376 @@ cast(@non_existing_user_var/2 as DECIMAL) NULL create table t (d decimal(0,10)); ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 'd'). +CREATE TABLE t1 ( +my_float FLOAT, +my_double DOUBLE, +my_varchar VARCHAR(50), +my_decimal DECIMAL(65,30) +); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `my_float` float default NULL, + `my_double` double default NULL, + `my_varchar` varchar(50) default NULL, + `my_decimal` decimal(65,30) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 SET my_float = 1.175494345e-32, +my_double = 1.175494345e-32, +my_varchar = '1.175494345e-32'; +INSERT INTO t1 SET my_float = 1.175494345e-31, +my_double = 1.175494345e-31, +my_varchar = '1.175494345e-31'; +INSERT INTO t1 SET my_float = 1.175494345e-30, +my_double = 1.175494345e-30, +my_varchar = '1.175494345e-30'; +INSERT INTO t1 SET my_float = 1.175494345e-29, +my_double = 1.175494345e-29, +my_varchar = '1.175494345e-29'; +INSERT INTO t1 SET my_float = 1.175494345e-28, +my_double = 1.175494345e-28, +my_varchar = '1.175494345e-28'; +INSERT INTO t1 SET my_float = 1.175494345e-27, +my_double = 1.175494345e-27, +my_varchar = '1.175494345e-27'; +INSERT INTO t1 SET my_float = 1.175494345e-26, +my_double = 1.175494345e-26, +my_varchar = '1.175494345e-26'; +INSERT INTO t1 SET my_float = 1.175494345e-25, +my_double = 1.175494345e-25, +my_varchar = '1.175494345e-25'; +INSERT INTO t1 SET my_float = 1.175494345e-24, +my_double = 1.175494345e-24, +my_varchar = '1.175494345e-24'; +INSERT INTO t1 SET my_float = 1.175494345e-23, +my_double = 1.175494345e-23, +my_varchar = '1.175494345e-23'; +INSERT INTO t1 SET my_float = 1.175494345e-22, +my_double = 1.175494345e-22, +my_varchar = '1.175494345e-22'; +INSERT INTO t1 SET my_float = 1.175494345e-21, +my_double = 1.175494345e-21, +my_varchar = '1.175494345e-21'; +INSERT INTO t1 SET my_float = 1.175494345e-20, +my_double = 1.175494345e-20, +my_varchar = '1.175494345e-20'; +INSERT INTO t1 SET my_float = 1.175494345e-19, +my_double = 1.175494345e-19, +my_varchar = '1.175494345e-19'; +INSERT INTO t1 SET my_float = 1.175494345e-18, +my_double = 1.175494345e-18, +my_varchar = '1.175494345e-18'; +INSERT INTO t1 SET my_float = 1.175494345e-17, +my_double = 1.175494345e-17, +my_varchar = '1.175494345e-17'; +INSERT INTO t1 SET my_float = 1.175494345e-16, +my_double = 1.175494345e-16, +my_varchar = '1.175494345e-16'; +INSERT INTO t1 SET my_float = 1.175494345e-15, +my_double = 1.175494345e-15, +my_varchar = '1.175494345e-15'; +INSERT INTO t1 SET my_float = 1.175494345e-14, +my_double = 1.175494345e-14, +my_varchar = '1.175494345e-14'; +INSERT INTO t1 SET my_float = 1.175494345e-13, +my_double = 1.175494345e-13, +my_varchar = '1.175494345e-13'; +INSERT INTO t1 SET my_float = 1.175494345e-12, +my_double = 1.175494345e-12, +my_varchar = '1.175494345e-12'; +INSERT INTO t1 SET my_float = 1.175494345e-11, +my_double = 1.175494345e-11, +my_varchar = '1.175494345e-11'; +INSERT INTO t1 SET my_float = 1.175494345e-10, +my_double = 1.175494345e-10, +my_varchar = '1.175494345e-10'; +INSERT INTO t1 SET my_float = 1.175494345e-9, +my_double = 1.175494345e-9, +my_varchar = '1.175494345e-9'; +INSERT INTO t1 SET my_float = 1.175494345e-8, +my_double = 1.175494345e-8, +my_varchar = '1.175494345e-8'; +INSERT INTO t1 SET my_float = 1.175494345e-7, +my_double = 1.175494345e-7, +my_varchar = '1.175494345e-7'; +INSERT INTO t1 SET my_float = 1.175494345e-6, +my_double = 1.175494345e-6, +my_varchar = '1.175494345e-6'; +INSERT INTO t1 SET my_float = 1.175494345e-5, +my_double = 1.175494345e-5, +my_varchar = '1.175494345e-5'; +INSERT INTO t1 SET my_float = 1.175494345e-4, +my_double = 1.175494345e-4, +my_varchar = '1.175494345e-4'; +INSERT INTO t1 SET my_float = 1.175494345e-3, +my_double = 1.175494345e-3, +my_varchar = '1.175494345e-3'; +INSERT INTO t1 SET my_float = 1.175494345e-2, +my_double = 1.175494345e-2, +my_varchar = '1.175494345e-2'; +INSERT INTO t1 SET my_float = 1.175494345e-1, +my_double = 1.175494345e-1, +my_varchar = '1.175494345e-1'; +SELECT my_float, my_double, my_varchar FROM t1; +my_float my_double my_varchar +1.17549e-32 1.175494345e-32 1.175494345e-32 +1.17549e-31 1.175494345e-31 1.175494345e-31 +1.17549e-30 1.175494345e-30 1.175494345e-30 +1.17549e-29 1.175494345e-29 1.175494345e-29 +1.17549e-28 1.175494345e-28 1.175494345e-28 +1.17549e-27 1.175494345e-27 1.175494345e-27 +1.17549e-26 1.175494345e-26 1.175494345e-26 +1.17549e-25 1.175494345e-25 1.175494345e-25 +1.17549e-24 1.175494345e-24 1.175494345e-24 +1.17549e-23 1.175494345e-23 1.175494345e-23 +1.17549e-22 1.175494345e-22 1.175494345e-22 +1.17549e-21 1.175494345e-21 1.175494345e-21 +1.17549e-20 1.175494345e-20 1.175494345e-20 +1.17549e-19 1.175494345e-19 1.175494345e-19 +1.17549e-18 1.175494345e-18 1.175494345e-18 +1.17549e-17 1.175494345e-17 1.175494345e-17 +1.17549e-16 1.175494345e-16 1.175494345e-16 +1.17549e-15 1.175494345e-15 1.175494345e-15 +1.17549e-14 1.175494345e-14 1.175494345e-14 +1.17549e-13 1.175494345e-13 1.175494345e-13 +1.17549e-12 1.175494345e-12 1.175494345e-12 +1.17549e-11 1.175494345e-11 1.175494345e-11 +1.17549e-10 1.175494345e-10 1.175494345e-10 +1.17549e-09 1.175494345e-09 1.175494345e-9 +1.17549e-08 1.175494345e-08 1.175494345e-8 +1.17549e-07 1.175494345e-07 1.175494345e-7 +1.17549e-06 1.175494345e-06 1.175494345e-6 +1.17549e-05 1.175494345e-05 1.175494345e-5 +0.000117549 0.0001175494345 1.175494345e-4 +0.00117549 0.001175494345 1.175494345e-3 +0.0117549 0.01175494345 1.175494345e-2 +0.117549 0.1175494345 1.175494345e-1 +SELECT CAST(my_float AS DECIMAL(65,30)), my_float FROM t1; +CAST(my_float AS DECIMAL(65,30)) my_float +0.000000000000000000000000000000 1.17549e-32 +0.000000000000000000000000000000 1.17549e-31 +0.000000000000000000000000000001 1.17549e-30 +0.000000000000000000000000000012 1.17549e-29 +0.000000000000000000000000000118 1.17549e-28 +0.000000000000000000000000001175 1.17549e-27 +0.000000000000000000000000011755 1.17549e-26 +0.000000000000000000000000117549 1.17549e-25 +0.000000000000000000000001175494 1.17549e-24 +0.000000000000000000000011754943 1.17549e-23 +0.000000000000000000000117549438 1.17549e-22 +0.000000000000000000001175494332 1.17549e-21 +0.000000000000000000011754943324 1.17549e-20 +0.000000000000000000117549434853 1.17549e-19 +0.000000000000000001175494374380 1.17549e-18 +0.000000000000000011754943743802 1.17549e-17 +0.000000000000000117549432474939 1.17549e-16 +0.000000000000001175494324749389 1.17549e-15 +0.000000000000011754943671010360 1.17549e-14 +0.000000000000117549429933840000 1.17549e-13 +0.000000000001175494380653563000 1.17549e-12 +0.000000000011754943372854760000 1.17549e-11 +0.000000000117549428524377200000 1.17549e-10 +0.000000001175494368510499000000 1.17549e-09 +0.000000011754943685104990000000 1.17549e-08 +0.000000117549433298336200000000 1.17549e-07 +0.000001175494389826781000000000 1.17549e-06 +0.000011754943443520460000000000 1.17549e-05 +0.000117549432616215200000000000 0.000117549 +0.001175494398921728000000000000 0.00117549 +0.011754943057894710000000000000 0.0117549 +0.117549434304237400000000000000 0.117549 +SELECT CAST(my_double AS DECIMAL(65,30)), my_double FROM t1; +CAST(my_double AS DECIMAL(65,30)) my_double +0.000000000000000000000000000000 1.175494345e-32 +0.000000000000000000000000000000 1.175494345e-31 +0.000000000000000000000000000001 1.175494345e-30 +0.000000000000000000000000000012 1.175494345e-29 +0.000000000000000000000000000118 1.175494345e-28 +0.000000000000000000000000001175 1.175494345e-27 +0.000000000000000000000000011755 1.175494345e-26 +0.000000000000000000000000117549 1.175494345e-25 +0.000000000000000000000001175494 1.175494345e-24 +0.000000000000000000000011754943 1.175494345e-23 +0.000000000000000000000117549435 1.175494345e-22 +0.000000000000000000001175494345 1.175494345e-21 +0.000000000000000000011754943450 1.175494345e-20 +0.000000000000000000117549434500 1.175494345e-19 +0.000000000000000001175494345000 1.175494345e-18 +0.000000000000000011754943450000 1.175494345e-17 +0.000000000000000117549434500000 1.175494345e-16 +0.000000000000001175494345000000 1.175494345e-15 +0.000000000000011754943450000000 1.175494345e-14 +0.000000000000117549434500000000 1.175494345e-13 +0.000000000001175494345000000000 1.175494345e-12 +0.000000000011754943450000000000 1.175494345e-11 +0.000000000117549434500000000000 1.175494345e-10 +0.000000001175494345000000000000 1.175494345e-09 +0.000000011754943450000000000000 1.175494345e-08 +0.000000117549434500000000000000 1.175494345e-07 +0.000001175494345000000000000000 1.175494345e-06 +0.000011754943450000000000000000 1.175494345e-05 +0.000117549434500000000000000000 0.0001175494345 +0.001175494345000000000000000000 0.001175494345 +0.011754943450000000000000000000 0.01175494345 +0.117549434500000000000000000000 0.1175494345 +SELECT CAST(my_varchar AS DECIMAL(65,30)), my_varchar FROM t1; +CAST(my_varchar AS DECIMAL(65,30)) my_varchar +0.000000000000000000000000000000 1.175494345e-32 +0.000000000000000000000000000000 1.175494345e-31 +0.000000000000000000000000000001 1.175494345e-30 +0.000000000000000000000000000012 1.175494345e-29 +0.000000000000000000000000000118 1.175494345e-28 +0.000000000000000000000000001175 1.175494345e-27 +0.000000000000000000000000011755 1.175494345e-26 +0.000000000000000000000000117549 1.175494345e-25 +0.000000000000000000000001175494 1.175494345e-24 +0.000000000000000000000011754943 1.175494345e-23 +0.000000000000000000000117549435 1.175494345e-22 +0.000000000000000000001175494345 1.175494345e-21 +0.000000000000000000011754943450 1.175494345e-20 +0.000000000000000000117549434500 1.175494345e-19 +0.000000000000000001175494345000 1.175494345e-18 +0.000000000000000011754943450000 1.175494345e-17 +0.000000000000000117549434500000 1.175494345e-16 +0.000000000000001175494345000000 1.175494345e-15 +0.000000000000011754943450000000 1.175494345e-14 +0.000000000000117549434500000000 1.175494345e-13 +0.000000000001175494345000000000 1.175494345e-12 +0.000000000011754943450000000000 1.175494345e-11 +0.000000000117549434500000000000 1.175494345e-10 +0.000000001175494345000000000000 1.175494345e-9 +0.000000011754943450000000000000 1.175494345e-8 +0.000000117549434500000000000000 1.175494345e-7 +0.000001175494345000000000000000 1.175494345e-6 +0.000011754943450000000000000000 1.175494345e-5 +0.000117549434500000000000000000 1.175494345e-4 +0.001175494345000000000000000000 1.175494345e-3 +0.011754943450000000000000000000 1.175494345e-2 +0.117549434500000000000000000000 1.175494345e-1 +UPDATE t1 SET my_decimal = my_float; +SELECT my_decimal, my_float FROM t1; +my_decimal my_float +0.000000000000000000000000000000 1.17549e-32 +0.000000000000000000000000000000 1.17549e-31 +0.000000000000000000000000000001 1.17549e-30 +0.000000000000000000000000000012 1.17549e-29 +0.000000000000000000000000000118 1.17549e-28 +0.000000000000000000000000001175 1.17549e-27 +0.000000000000000000000000011755 1.17549e-26 +0.000000000000000000000000117549 1.17549e-25 +0.000000000000000000000001175494 1.17549e-24 +0.000000000000000000000011754943 1.17549e-23 +0.000000000000000000000117549438 1.17549e-22 +0.000000000000000000001175494332 1.17549e-21 +0.000000000000000000011754943324 1.17549e-20 +0.000000000000000000117549434853 1.17549e-19 +0.000000000000000001175494374380 1.17549e-18 +0.000000000000000011754943743802 1.17549e-17 +0.000000000000000117549432474939 1.17549e-16 +0.000000000000001175494324749389 1.17549e-15 +0.000000000000011754943671010360 1.17549e-14 +0.000000000000117549429933840000 1.17549e-13 +0.000000000001175494380653563000 1.17549e-12 +0.000000000011754943372854760000 1.17549e-11 +0.000000000117549428524377200000 1.17549e-10 +0.000000001175494368510499000000 1.17549e-09 +0.000000011754943685104990000000 1.17549e-08 +0.000000117549433298336200000000 1.17549e-07 +0.000001175494389826781000000000 1.17549e-06 +0.000011754943443520460000000000 1.17549e-05 +0.000117549432616215200000000000 0.000117549 +0.001175494398921728000000000000 0.00117549 +0.011754943057894710000000000000 0.0117549 +0.117549434304237400000000000000 0.117549 +UPDATE t1 SET my_decimal = my_double; +SELECT my_decimal, my_double FROM t1; +my_decimal my_double +0.000000000000000000000000000000 1.175494345e-32 +0.000000000000000000000000000000 1.175494345e-31 +0.000000000000000000000000000001 1.175494345e-30 +0.000000000000000000000000000012 1.175494345e-29 +0.000000000000000000000000000118 1.175494345e-28 +0.000000000000000000000000001175 1.175494345e-27 +0.000000000000000000000000011755 1.175494345e-26 +0.000000000000000000000000117549 1.175494345e-25 +0.000000000000000000000001175494 1.175494345e-24 +0.000000000000000000000011754943 1.175494345e-23 +0.000000000000000000000117549435 1.175494345e-22 +0.000000000000000000001175494345 1.175494345e-21 +0.000000000000000000011754943450 1.175494345e-20 +0.000000000000000000117549434500 1.175494345e-19 +0.000000000000000001175494345000 1.175494345e-18 +0.000000000000000011754943450000 1.175494345e-17 +0.000000000000000117549434500000 1.175494345e-16 +0.000000000000001175494345000000 1.175494345e-15 +0.000000000000011754943450000000 1.175494345e-14 +0.000000000000117549434500000000 1.175494345e-13 +0.000000000001175494345000000000 1.175494345e-12 +0.000000000011754943450000000000 1.175494345e-11 +0.000000000117549434500000000000 1.175494345e-10 +0.000000001175494345000000000000 1.175494345e-09 +0.000000011754943450000000000000 1.175494345e-08 +0.000000117549434500000000000000 1.175494345e-07 +0.000001175494345000000000000000 1.175494345e-06 +0.000011754943450000000000000000 1.175494345e-05 +0.000117549434500000000000000000 0.0001175494345 +0.001175494345000000000000000000 0.001175494345 +0.011754943450000000000000000000 0.01175494345 +0.117549434500000000000000000000 0.1175494345 +UPDATE t1 SET my_decimal = my_varchar; +Warnings: +Note 1265 Data truncated for column 'my_decimal' at row 1 +Note 1265 Data truncated for column 'my_decimal' at row 2 +Note 1265 Data truncated for column 'my_decimal' at row 3 +Note 1265 Data truncated for column 'my_decimal' at row 4 +Note 1265 Data truncated for column 'my_decimal' at row 5 +Note 1265 Data truncated for column 'my_decimal' at row 6 +Note 1265 Data truncated for column 'my_decimal' at row 7 +Note 1265 Data truncated for column 'my_decimal' at row 8 +Note 1265 Data truncated for column 'my_decimal' at row 9 +Note 1265 Data truncated for column 'my_decimal' at row 10 +Note 1265 Data truncated for column 'my_decimal' at row 11 +SELECT my_decimal, my_varchar FROM t1; +my_decimal my_varchar +0.000000000000000000000000000000 1.175494345e-32 +0.000000000000000000000000000000 1.175494345e-31 +0.000000000000000000000000000001 1.175494345e-30 +0.000000000000000000000000000012 1.175494345e-29 +0.000000000000000000000000000118 1.175494345e-28 +0.000000000000000000000000001175 1.175494345e-27 +0.000000000000000000000000011755 1.175494345e-26 +0.000000000000000000000000117549 1.175494345e-25 +0.000000000000000000000001175494 1.175494345e-24 +0.000000000000000000000011754943 1.175494345e-23 +0.000000000000000000000117549435 1.175494345e-22 +0.000000000000000000001175494345 1.175494345e-21 +0.000000000000000000011754943450 1.175494345e-20 +0.000000000000000000117549434500 1.175494345e-19 +0.000000000000000001175494345000 1.175494345e-18 +0.000000000000000011754943450000 1.175494345e-17 +0.000000000000000117549434500000 1.175494345e-16 +0.000000000000001175494345000000 1.175494345e-15 +0.000000000000011754943450000000 1.175494345e-14 +0.000000000000117549434500000000 1.175494345e-13 +0.000000000001175494345000000000 1.175494345e-12 +0.000000000011754943450000000000 1.175494345e-11 +0.000000000117549434500000000000 1.175494345e-10 +0.000000001175494345000000000000 1.175494345e-9 +0.000000011754943450000000000000 1.175494345e-8 +0.000000117549434500000000000000 1.175494345e-7 +0.000001175494345000000000000000 1.175494345e-6 +0.000011754943450000000000000000 1.175494345e-5 +0.000117549434500000000000000000 1.175494345e-4 +0.001175494345000000000000000000 1.175494345e-3 +0.011754943450000000000000000000 1.175494345e-2 +0.117549434500000000000000000000 1.175494345e-1 +DROP TABLE t1; create table t1 (c1 decimal(64)); insert into t1 values( 89000000000000000000000000000000000000000000000000000000000000000000000000000000000000000); Warnings: Error 1292 Truncated incorrect DECIMAL value: '' -Warning 1264 Out of range value adjusted for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 insert into t1 values( 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 * 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999); @@ -1033,10 +1387,10 @@ Warnings: Error 1292 Truncated incorrect DECIMAL value: '' Error 1292 Truncated incorrect DECIMAL value: '' Error 1292 Truncated incorrect DECIMAL value: '' -Warning 1264 Out of range value adjusted for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 insert into t1 values(1e100); Warnings: -Warning 1264 Out of range value adjusted for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c1' at row 1 select * from t1; c1 9999999999999999999999999999999999999999999999999999999999999999 diff --git a/mysql-test/r/type_ranges.result b/mysql-test/r/type_ranges.result index ff07dcca106..0ba8916f5b1 100644 --- a/mysql-test/r/type_ranges.result +++ b/mysql-test/r/type_ranges.result @@ -91,35 +91,35 @@ Warnings: Warning 1265 Data truncated for column 'string' at row 1 insert into t1 values (0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,NULL,19970807,080706,19970403090807,-1,-1,-1,'-1',-1,-1); Warnings: -Warning 1264 Out of range value adjusted for column 'utiny' at row 1 -Warning 1264 Out of range value adjusted for column 'ushort' at row 1 -Warning 1264 Out of range value adjusted for column 'umedium' at row 1 -Warning 1264 Out of range value adjusted for column 'ulong' at row 1 -Warning 1264 Out of range value adjusted for column 'ulonglong' at row 1 +Warning 1264 Out of range value for column 'utiny' at row 1 +Warning 1264 Out of range value for column 'ushort' at row 1 +Warning 1264 Out of range value for column 'umedium' at row 1 +Warning 1264 Out of range value for column 'ulong' at row 1 +Warning 1264 Out of range value for column 'ulonglong' at row 1 Warning 1265 Data truncated for column 'options' at row 1 Warning 1265 Data truncated for column 'flags' at row 1 insert into t1 values (0,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,NULL,0,0,0,-4294967295,-4294967295,-4294967295,'-4294967295',0,"one,two,tree"); Warnings: Warning 1265 Data truncated for column 'string' at row 1 -Warning 1264 Out of range value adjusted for column 'tiny' at row 1 -Warning 1264 Out of range value adjusted for column 'short' at row 1 -Warning 1264 Out of range value adjusted for column 'medium' at row 1 -Warning 1264 Out of range value adjusted for column 'long_int' at row 1 -Warning 1264 Out of range value adjusted for column 'utiny' at row 1 -Warning 1264 Out of range value adjusted for column 'ushort' at row 1 -Warning 1264 Out of range value adjusted for column 'umedium' at row 1 -Warning 1264 Out of range value adjusted for column 'ulong' at row 1 -Warning 1264 Out of range value adjusted for column 'ulonglong' at row 1 +Warning 1264 Out of range value for column 'tiny' at row 1 +Warning 1264 Out of range value for column 'short' at row 1 +Warning 1264 Out of range value for column 'medium' at row 1 +Warning 1264 Out of range value for column 'long_int' at row 1 +Warning 1264 Out of range value for column 'utiny' at row 1 +Warning 1264 Out of range value for column 'ushort' at row 1 +Warning 1264 Out of range value for column 'umedium' at row 1 +Warning 1264 Out of range value for column 'ulong' at row 1 +Warning 1264 Out of range value for column 'ulonglong' at row 1 Warning 1265 Data truncated for column 'options' at row 1 insert into t1 values (0,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,NULL,0,0,0,4294967295,4294967295,4294967295,'4294967295',0,0); Warnings: -Warning 1264 Out of range value adjusted for column 'tiny' at row 1 -Warning 1264 Out of range value adjusted for column 'short' at row 1 -Warning 1264 Out of range value adjusted for column 'medium' at row 1 -Warning 1264 Out of range value adjusted for column 'long_int' at row 1 -Warning 1264 Out of range value adjusted for column 'utiny' at row 1 -Warning 1264 Out of range value adjusted for column 'ushort' at row 1 -Warning 1264 Out of range value adjusted for column 'umedium' at row 1 +Warning 1264 Out of range value for column 'tiny' at row 1 +Warning 1264 Out of range value for column 'short' at row 1 +Warning 1264 Out of range value for column 'medium' at row 1 +Warning 1264 Out of range value for column 'long_int' at row 1 +Warning 1264 Out of range value for column 'utiny' at row 1 +Warning 1264 Out of range value for column 'ushort' at row 1 +Warning 1264 Out of range value for column 'umedium' at row 1 Warning 1265 Data truncated for column 'options' at row 1 insert into t1 (tiny) values (1); select auto,string,tiny,short,medium,long_int,longlong,real_float,real_double,utiny,ushort,umedium,ulong,ulonglong,mod(floor(time_stamp/1000000),1000000)-mod(curdate(),1000000),date_field,time_field,date_time,blob_col,tinyblob_col,mediumblob_col,longblob_col from t1; @@ -215,7 +215,7 @@ Field Type Collation Null Key Default Extra Privileges Comment auto int(5) unsigned NULL NO MUL NULL auto_increment # string char(10) latin1_swedish_ci YES newdefault # tiny tinyint(4) NULL NO MUL 0 # -short smallint(6) NULL NO MUL 0 # +short smallint(6) NULL NO MUL # medium mediumint(8) NULL NO MUL 0 # long_int int(11) NULL NO 0 # longlong bigint(13) NULL NO MUL 0 # diff --git a/mysql-test/r/type_time.result b/mysql-test/r/type_time.result index 442435b0459..ce820c0cb8e 100644 --- a/mysql-test/r/type_time.result +++ b/mysql-test/r/type_time.result @@ -26,9 +26,9 @@ t insert into t1 values("10.22.22"),(1234567),(123456789),(123456789.10),("10 22:22"),("12.45a"); Warnings: Warning 1265 Data truncated for column 't' at row 1 -Warning 1264 Out of range value adjusted for column 't' at row 2 -Warning 1264 Out of range value adjusted for column 't' at row 3 -Warning 1264 Out of range value adjusted for column 't' at row 4 +Warning 1264 Out of range value for column 't' at row 2 +Warning 1264 Out of range value for column 't' at row 3 +Warning 1264 Out of range value for column 't' at row 4 Warning 1265 Data truncated for column 't' at row 6 select * from t1; t diff --git a/mysql-test/r/type_uint.result b/mysql-test/r/type_uint.result index 0474f3a24f4..e08605fb237 100644 --- a/mysql-test/r/type_uint.result +++ b/mysql-test/r/type_uint.result @@ -4,10 +4,10 @@ create table t1 (this int unsigned); insert into t1 values (1); insert into t1 values (-1); Warnings: -Warning 1264 Out of range value adjusted for column 'this' at row 1 +Warning 1264 Out of range value for column 'this' at row 1 insert into t1 values ('5000000000'); Warnings: -Warning 1264 Out of range value adjusted for column 'this' at row 1 +Warning 1264 Out of range value for column 'this' at row 1 select * from t1; this 1 diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index 042dfb5ad8d..f2708a50c77 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -1220,6 +1220,32 @@ show columns from t2; Field Type Null Key Default Extra a varchar(3) YES NULL drop table t2, t1; +create table t1 (f1 decimal(60,25), f2 decimal(60,25)); +insert into t1 values (0.0,0.0); +select f1 from t1 union all select f2 from t1; +f1 +0.0000000000000000000000000 +0.0000000000000000000000000 +select 'XXXXXXXXXXXXXXXXXXXX' as description, f1 from t1 +union all +select 'YYYYYYYYYYYYYYYYYYYY' as description, f2 from t1; +description f1 +XXXXXXXXXXXXXXXXXXXX 0.0000000000000000000000000 +YYYYYYYYYYYYYYYYYYYY 0.0000000000000000000000000 +drop table t1; +create table t1 (f1 decimal(60,24), f2 decimal(60,24)); +insert into t1 values (0.0,0.0); +select f1 from t1 union all select f2 from t1; +f1 +0.000000000000000000000000 +0.000000000000000000000000 +select 'XXXXXXXXXXXXXXXXXXXX' as description, f1 from t1 +union all +select 'YYYYYYYYYYYYYYYYYYYY' as description, f2 from t1; +description f1 +XXXXXXXXXXXXXXXXXXXX 0.000000000000000000000000 +YYYYYYYYYYYYYYYYYYYY 0.000000000000000000000000 +drop table t1; create table t1 (a varchar(5)); create table t2 select * from t1 union select 'abcdefghijkl'; show create table t2; diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result index aeb44fa4e6c..abeade5df0c 100644 --- a/mysql-test/r/update.result +++ b/mysql-test/r/update.result @@ -345,3 +345,16 @@ f1 2000-01-01 2002-02-02 drop table t1; +create table t1 (f1 int); +create table t2 (f2 int); +insert into t1 values(1),(2); +insert into t2 values(1),(1); +update t1,t2 set f1=3,f2=3 where f1=f2 and f1=1; +affected rows: 3 +info: Rows matched: 3 Changed: 3 Warnings: 0 +update t2 set f2=1; +update t1 set f1=1 where f1=3; +update t2,t1 set f1=3,f2=3 where f1=f2 and f1=1; +affected rows: 3 +info: Rows matched: 3 Changed: 3 Warnings: 0 +drop table t1,t2; diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index 3ecc48620b1..d192ee6fe1c 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -351,6 +351,14 @@ set global rpl_recovery_rank=100; set global server_id=100; set global slow_launch_time=100; set sort_buffer_size=100; +set @@max_sp_recursion_depth=10; +select @@max_sp_recursion_depth; +@@max_sp_recursion_depth +10 +set @@max_sp_recursion_depth=0; +select @@max_sp_recursion_depth; +@@max_sp_recursion_depth +0 set sql_auto_is_null=1; select @@sql_auto_is_null; @@sql_auto_is_null @@ -376,7 +384,7 @@ set sql_quote_show_create=1; set sql_safe_updates=1; set sql_select_limit=1; set sql_warnings=1; -set global table_cache=100; +set global table_open_cache=100; set storage_engine=myisam; set global thread_cache_size=100; set timestamp=1, timestamp=default; @@ -508,11 +516,11 @@ SET GLOBAL MYISAM_DATA_POINTER_SIZE= 7; SHOW VARIABLES LIKE 'MYISAM_DATA_POINTER_SIZE'; Variable_name Value myisam_data_pointer_size 7 -SET GLOBAL table_cache=-1; -SHOW VARIABLES LIKE 'table_cache'; +SET GLOBAL table_open_cache=-1; +SHOW VARIABLES LIKE 'table_open_cache'; Variable_name Value -table_cache 1 -SET GLOBAL table_cache=DEFAULT; +table_open_cache 1 +SET GLOBAL table_open_cache=DEFAULT; set character_set_results=NULL; select ifnull(@@character_set_results,"really null"); ifnull(@@character_set_results,"really null") diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index a74feb4de17..731584c11cb 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -1,4 +1,4 @@ -drop table if exists t1,t2,t9,`t1a``b`,v1,v2,v3,v4,v5,v6; +drop table if exists t1,t2,t3,t4,t9,`t1a``b`,v1,v2,v3,v4,v5,v6; drop view if exists t1,t2,`t1a``b`,v1,v2,v3,v4,v5,v6; drop database if exists mysqltest; use test; @@ -204,6 +204,21 @@ create table t1 (a int); insert into t1 values (1), (2), (3); create view v1 (a) as select a+1 from t1; create view v2 (a) as select a-1 from t1; +select * from t1 natural left join v1; +a +1 +2 +3 +select * from v2 natural left join t1; +a +0 +1 +2 +select * from v2 natural left join v1; +a +0 +1 +2 drop view v1, v2; drop table t1; create table t1 (a int); @@ -1291,9 +1306,9 @@ a b delete from t1; load data infile '../../std_data/loaddata3.dat' ignore into table v1 fields terminated by '' enclosed by '' ignore 1 lines; Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 3 +Warning 1264 Out of range value for column 'a' at row 3 Error 1369 CHECK OPTION failed 'test.v1' -Warning 1264 Out of range value adjusted for column 'a' at row 4 +Warning 1264 Out of range value for column 'a' at row 4 Error 1369 CHECK OPTION failed 'test.v1' select * from t1; a b @@ -1480,7 +1495,7 @@ insert into v3(b) values (10); insert into v3(a) select a from t2; insert into v3(b) select b from t2; Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 2 +Warning 1048 Column 'a' cannot be null insert into v3(a) values (1) on duplicate key update a=a+10000+VALUES(a); select * from t1; a b @@ -2199,10 +2214,10 @@ r_object_id users_names drop view v1, v2; drop table t1, t2; create definer=some_user@`` sql security invoker view v1 as select 1; -ERROR HY000: View definer is not fully qualified +ERROR HY000: Definer is not fully qualified create definer=some_user@localhost sql security invoker view v1 as select 1; Warnings: -Note 1449 There is not some_user@localhost registered +Note 1449 There is no 'some_user'@'localhost' registered show create view v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`some_user`@`localhost` SQL SECURITY INVOKER VIEW `v1` AS select 1 AS `1` @@ -2323,6 +2338,14 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where DROP VIEW v1,v2; DROP TABLE t1,t2,t3; +create table t1 (f1 int); +create view v1 as select t1.f1 as '123 +456' from t1; +select * from v1; +123 +456 +drop view v1; +drop table t1; create table t1 (f1 int, f2 int); insert into t1 values(1,1),(1,2),(1,3); create view v1 as select f1 ,group_concat(f2 order by f2 asc) from t1 group by f1; @@ -2335,3 +2358,69 @@ f1 group_concat(f2 order by f2 desc) 1 3,2,1 drop view v1,v2; drop table t1; +create table t1 (x int, y int); +create table t2 (x int, y int, z int); +create table t3 (x int, y int, z int); +create table t4 (x int, y int, z int); +create view v1 as +select t1.x +from ( +(t1 join t2 on ((t1.y = t2.y))) +join +(t3 left join t4 on (t3.y = t4.y) and (t3.z = t4.z)) +); +prepare stmt1 from "select count(*) from v1 where x = ?"; +set @parm1=1; +execute stmt1 using @parm1; +count(*) +0 +execute stmt1 using @parm1; +count(*) +0 +drop view v1; +drop table t1,t2,t3,t4; +CREATE TABLE t1(id INT); +CREATE VIEW v1 AS SELECT id FROM t1; +OPTIMIZE TABLE v1; +Table Op Msg_type Msg_text +test.v1 optimize note Unknown table 'test.v1' +ANALYZE TABLE v1; +Table Op Msg_type Msg_text +test.v1 analyze note Unknown table 'test.v1' +REPAIR TABLE v1; +Table Op Msg_type Msg_text +test.v1 repair note Unknown table 'test.v1' +DROP TABLE t1; +OPTIMIZE TABLE v1; +Table Op Msg_type Msg_text +test.v1 optimize note Unknown table 'test.v1' +Warnings: +Error 1146 Table 'test.t1' doesn't exist +Error 1356 View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +DROP VIEW v1; +create definer = current_user() sql security invoker view v1 as select 1; +show create view v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `v1` AS select 1 AS `1` +drop view v1; +create definer = current_user sql security invoker view v1 as select 1; +show create view v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `v1` AS select 1 AS `1` +drop view v1; +create table t1 (id INT, primary key(id)); +insert into t1 values (1),(2); +create view v1 as select * from t1; +explain select id from v1 order by id; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 index NULL PRIMARY 4 NULL 2 Using index +drop view v1; +drop table t1; +create table t1(f1 int, f2 int); +insert into t1 values (null, 10), (null,2); +create view v1 as select * from t1; +select f1, sum(f2) from v1 group by f1; +f1 sum(f2) +NULL 12 +drop view v1; +drop table t1; diff --git a/mysql-test/r/view_grant.result b/mysql-test/r/view_grant.result index 43df5c29f92..cb1ac88ea8e 100644 --- a/mysql-test/r/view_grant.result +++ b/mysql-test/r/view_grant.result @@ -1,3 +1,5 @@ +drop database if exists mysqltest; +drop view if exists v1; grant create view on test.* to test@localhost; show grants for test@localhost; Grants for test@localhost @@ -13,7 +15,7 @@ create table mysqltest.t2 (a int, b int); grant select on mysqltest.t1 to mysqltest_1@localhost; grant create view,select on test.* to mysqltest_1@localhost; create definer=root@localhost view v1 as select * from mysqltest.t1; -ERROR HY000: You need the SUPER privilege for creation view with root@localhost definer +ERROR 42000: Access denied; you need the SUPER privilege for this operation create view v1 as select * from mysqltest.t1; alter view v1 as select * from mysqltest.t1; ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table 'v1' @@ -501,3 +503,20 @@ drop user test14256; insert into mysql.user select * from t1; flush privileges; drop table t1; +create database mysqltest; +use mysqltest; +CREATE TABLE t1 (i INT); +CREATE VIEW v1 AS SELECT * FROM t1; +SHOW CREATE VIEW v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i` from `t1` +GRANT SELECT, LOCK TABLES ON mysqltest.* TO mysqltest_1@localhost; +use mysqltest; +LOCK TABLES v1 READ; +SHOW CREATE TABLE v1; +ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v1' +UNLOCK TABLES; +use test; +use test; +drop user mysqltest_1@localhost; +drop database mysqltest; diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result index 46f05399ba9..0d3fed4cd4d 100644 --- a/mysql-test/r/warnings.result +++ b/mysql-test/r/warnings.result @@ -31,19 +31,19 @@ Error 1064 You have an error in your SQL syntax; check the manual that correspon insert into t1 values (1); insert into t1 values ("hej"); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 1 insert into t1 values ("hej"),("då"); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 -Warning 1264 Out of range value adjusted for column 'a' at row 2 +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 2 set SQL_WARNINGS=1; insert into t1 values ("hej"); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 1 insert into t1 values ("hej"),("då"); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 -Warning 1264 Out of range value adjusted for column 'a' at row 2 +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 2 drop table t1; set SQL_WARNINGS=0; drop temporary table if exists not_exists; @@ -78,7 +78,7 @@ Warning 1265 Data truncated for column 'c' at row 4 Warning 1261 Row 5 doesn't contain data for all columns Warning 1265 Data truncated for column 'b' at row 6 Warning 1262 Row 7 was truncated; it contained more data than there were input columns -Warning 1264 Out of range value adjusted for column 'a' at row 8 +Warning 1264 Out of range value for column 'a' at row 8 select @@warning_count; @@warning_count 7 @@ -86,11 +86,11 @@ drop table t1; create table t1(a tinyint NOT NULL, b tinyint unsigned, c char(5)); insert into t1 values(NULL,100,'mysql'),(10,-1,'mysql ab'),(500,256,'open source'),(20,NULL,'test'); Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 1 -Warning 1264 Out of range value adjusted for column 'b' at row 2 +Warning 1048 Column 'a' cannot be null +Warning 1264 Out of range value for column 'b' at row 2 Warning 1265 Data truncated for column 'c' at row 2 -Warning 1264 Out of range value adjusted for column 'a' at row 3 -Warning 1264 Out of range value adjusted for column 'b' at row 3 +Warning 1264 Out of range value for column 'a' at row 3 +Warning 1264 Out of range value for column 'b' at row 3 Warning 1265 Data truncated for column 'c' at row 3 alter table t1 modify c char(4); Warnings: @@ -99,7 +99,7 @@ Warning 1265 Data truncated for column 'c' at row 2 alter table t1 add d char(2); update t1 set a=NULL where a=10; Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 2 +Warning 1048 Column 'a' cannot be null update t1 set c='mysql ab' where c='test'; Warnings: Warning 1265 Data truncated for column 'c' at row 4 @@ -115,7 +115,7 @@ Warnings: Warning 1265 Data truncated for column 'b' at row 1 Warning 1265 Data truncated for column 'b' at row 2 Warning 1265 Data truncated for column 'b' at row 3 -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 4 +Warning 1048 Column 'a' cannot be null Warning 1265 Data truncated for column 'b' at row 4 insert into t2(b) values('mysqlab'); Warnings: @@ -180,44 +180,44 @@ create table t1 (a int); insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); update t1 set a='abc'; Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 -Warning 1264 Out of range value adjusted for column 'a' at row 2 -Warning 1264 Out of range value adjusted for column 'a' at row 3 -Warning 1264 Out of range value adjusted for column 'a' at row 4 -Warning 1264 Out of range value adjusted for column 'a' at row 5 -Warning 1264 Out of range value adjusted for column 'a' at row 6 -Warning 1264 Out of range value adjusted for column 'a' at row 7 -Warning 1264 Out of range value adjusted for column 'a' at row 8 -Warning 1264 Out of range value adjusted for column 'a' at row 9 -Warning 1264 Out of range value adjusted for column 'a' at row 10 +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 2 +Warning 1264 Out of range value for column 'a' at row 3 +Warning 1264 Out of range value for column 'a' at row 4 +Warning 1264 Out of range value for column 'a' at row 5 +Warning 1264 Out of range value for column 'a' at row 6 +Warning 1264 Out of range value for column 'a' at row 7 +Warning 1264 Out of range value for column 'a' at row 8 +Warning 1264 Out of range value for column 'a' at row 9 +Warning 1264 Out of range value for column 'a' at row 10 show warnings limit 2, 1; Level Code Message -Warning 1264 Out of range value adjusted for column 'a' at row 3 +Warning 1264 Out of range value for column 'a' at row 3 show warnings limit 0, 10; Level Code Message -Warning 1264 Out of range value adjusted for column 'a' at row 1 -Warning 1264 Out of range value adjusted for column 'a' at row 2 -Warning 1264 Out of range value adjusted for column 'a' at row 3 -Warning 1264 Out of range value adjusted for column 'a' at row 4 -Warning 1264 Out of range value adjusted for column 'a' at row 5 -Warning 1264 Out of range value adjusted for column 'a' at row 6 -Warning 1264 Out of range value adjusted for column 'a' at row 7 -Warning 1264 Out of range value adjusted for column 'a' at row 8 -Warning 1264 Out of range value adjusted for column 'a' at row 9 -Warning 1264 Out of range value adjusted for column 'a' at row 10 +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 2 +Warning 1264 Out of range value for column 'a' at row 3 +Warning 1264 Out of range value for column 'a' at row 4 +Warning 1264 Out of range value for column 'a' at row 5 +Warning 1264 Out of range value for column 'a' at row 6 +Warning 1264 Out of range value for column 'a' at row 7 +Warning 1264 Out of range value for column 'a' at row 8 +Warning 1264 Out of range value for column 'a' at row 9 +Warning 1264 Out of range value for column 'a' at row 10 show warnings limit 9, 1; Level Code Message -Warning 1264 Out of range value adjusted for column 'a' at row 10 +Warning 1264 Out of range value for column 'a' at row 10 show warnings limit 10, 1; Level Code Message show warnings limit 9, 2; Level Code Message -Warning 1264 Out of range value adjusted for column 'a' at row 10 +Warning 1264 Out of range value for column 'a' at row 10 show warnings limit 0, 0; Level Code Message show warnings limit 1; Level Code Message -Warning 1264 Out of range value adjusted for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 1 show warnings limit 0; Level Code Message show warnings limit 1, 0; diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test index fdc835e1852..90109c17b62 100644 --- a/mysql-test/t/alter_table.test +++ b/mysql-test/t/alter_table.test @@ -340,7 +340,9 @@ drop table t1; # # BUG 12207 alter table ... discard table space on MyISAM table causes ERROR 2013 (HY000) # +# Some platforms (Mac OS X, Windows) will send the error message using small letters. CREATE TABLE T12207(a int) ENGINE=MYISAM; +--replace_result t12207 T12207 --error 1031 ALTER TABLE T12207 DISCARD TABLESPACE; DROP TABLE T12207; @@ -403,9 +405,17 @@ drop table t1; # End of 4.1 tests # -# Some additional tests for new, faster alter table. -# Note that most of the whole alter table code is being -# tested all around the test suite already. +# Bug #14693 (ALTER SET DEFAULT doesn't work) +# + +create table t1 (mycol int(10) not null); +alter table t1 alter column mycol set default 0; +desc t1; +drop table t1; + +# +# Some additional tests for new, faster alter table. Note that most of the +# whole alter table code is being tested all around the test suite already. # create table t1 (v varchar(32)); diff --git a/mysql-test/t/analyze.test b/mysql-test/t/analyze.test index 3c3b3933bc3..656ff752c9b 100644 --- a/mysql-test/t/analyze.test +++ b/mysql-test/t/analyze.test @@ -39,4 +39,27 @@ check table t1; drop table t1; +# Bug #14902 ANALYZE TABLE fails to recognize up-to-date tables +# minimal test case to get an error. +# The problem is happening when analysing table with FT index that +# contains stopwords only. The first execution of analyze table should +# mark index statistics as up to date so that next execution of this +# statement will end up with Table is up to date status. +create table t1 (a mediumtext, fulltext key key1(a)) charset utf8 collate utf8_general_ci engine myisam; +insert into t1 values ('hello'); + +analyze table t1; +analyze table t1; + +drop table t1; + +# +# procedure in PS BUG#13673 +# +CREATE TABLE t1 (a int); +prepare stmt1 from "SELECT * FROM t1 PROCEDURE ANALYSE()"; +execute stmt1; +execute stmt1; +deallocate prepare stmt1; + # End of 4.1 tests diff --git a/mysql-test/t/bdb.test b/mysql-test/t/bdb.test index 97d8f28cd3f..72b3ee89ed5 100644 --- a/mysql-test/t/bdb.test +++ b/mysql-test/t/bdb.test @@ -974,3 +974,22 @@ drop table t1; # End varchar test eval set storage_engine=$default; + +# +# Test that we can create a large key +# +create table t1 (a varchar(255) character set utf8, + b varchar(255) character set utf8, + c varchar(255) character set utf8, + d varchar(255) character set utf8, + key (a,b,c,d)) engine=bdb; +drop table t1; +--error ER_TOO_LONG_KEY +create table t1 (a varchar(255) character set utf8, + b varchar(255) character set utf8, + c varchar(255) character set utf8, + d varchar(255) character set utf8, + e varchar(255) character set utf8, + key (a,b,c,d,e)) engine=bdb; + +--echo End of 5.0 tests diff --git a/mysql-test/t/bigint.test b/mysql-test/t/bigint.test index d9c1abd9ba9..7871b3647e3 100644 --- a/mysql-test/t/bigint.test +++ b/mysql-test/t/bigint.test @@ -2,7 +2,7 @@ # Initialize --disable_warnings -drop table if exists t1; +drop table if exists t1, t2; --enable_warnings # diff --git a/mysql-test/t/blackhole.test b/mysql-test/t/blackhole.test index 257770d311c..1b5a9beb887 100644 --- a/mysql-test/t/blackhole.test +++ b/mysql-test/t/blackhole.test @@ -127,3 +127,20 @@ show binlog events; drop table t1,t2,t3; # End of 4.1 tests + +# Test that a transaction which is rolled back does not go into binlog +# and that a transaction which is committed does + +reset master; +create table t1 (a int) engine=blackhole; +set autocommit=0; +start transaction; +insert into t1 values(1); +commit; +start transaction; +insert into t1 values(2); +rollback; +set autocommit=1; +--replace_result $VERSION VERSION +--replace_column 2 # 5 # +show binlog events; diff --git a/mysql-test/t/cast.test b/mysql-test/t/cast.test index 70eb87131df..dc7f695e38e 100644 --- a/mysql-test/t/cast.test +++ b/mysql-test/t/cast.test @@ -64,7 +64,7 @@ select cast(_latin1'a ' AS char) as c2, cast(_latin1'abc' AS char(2)) as c3, cast(_latin1'a ' AS char(2)) as c4, - cast(_latin1'a' AS char(2)) as c5; + hex(cast(_latin1'a' AS char(2))) as c5; select cast(1000 as CHAR(3)); create table t1 select @@ -73,7 +73,7 @@ create table t1 select cast(_latin1'abc' AS char(2)) as c3, cast(_latin1'a ' AS char(2)) as c4, cast(_latin1'a' AS char(2)) as c5; -select * from t1; +select c1,c2,c3,c4,hex(c5) from t1; show create table t1; drop table t1; diff --git a/mysql-test/t/count_distinct3.test b/mysql-test/t/count_distinct3.test index 52a4f271dac..f817b2c635d 100644 --- a/mysql-test/t/count_distinct3.test +++ b/mysql-test/t/count_distinct3.test @@ -17,7 +17,7 @@ while ($1) SET @rnd= RAND(); SET @id = CAST(@rnd * @rnd_max AS UNSIGNED); SET @id_rev= @rnd_max - @id; - SET @grp= CAST(128.0 * @rnd AS UNSIGNED); + SET @grp= CAST(127.0 * @rnd AS UNSIGNED); INSERT INTO t1 (id, grp, id_rev) VALUES (@id, @grp, @id_rev); dec $1; } diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index 67ad3058153..6f3bc67cb30 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -3,7 +3,7 @@ # --disable_warnings -drop table if exists t1,t2,t3; +drop table if exists t1,t2,t3,t4,t5; drop database if exists mysqltest; --enable_warnings @@ -554,4 +554,94 @@ create table t1 ( show create table t1; drop table t1; +# +# BUG#14480: assert failure in CREATE ... SELECT because of wrong +# calculation of number of NULLs. +# +CREATE TABLE t2 ( + a int(11) default NULL +); +insert into t2 values(111); + +--warning 1364 +create table t1 ( + a varchar(12) charset utf8 collate utf8_bin not null, + b int not null, primary key (a) +) select a, 1 as b from t2 ; +show create table t1; +drop table t1; + +--warning 1364 +create table t1 ( + a varchar(12) charset utf8 collate utf8_bin not null, + b int not null, primary key (a) +) select 'a' as a , 1 as b from t2 ; +show create table t1; +drop table t1; + +--warning 1364 +create table t1 ( + a varchar(12) charset utf8 collate utf8_bin, + b int not null, primary key (a) +) select 'a' as a , 1 as b from t2 ; +show create table t1; +drop table t1, t2; + +create table t1 ( + a1 int not null, + a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int +); +insert into t1 values (1,1,1, 1,1,1, 1,1,1); + +--warning 1364 +create table t2 ( + a1 varchar(12) charset utf8 collate utf8_bin not null, + a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, + primary key (a1) +) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1 ; +drop table t2; + +--warning 1364 +create table t2 ( + a1 varchar(12) charset utf8 collate utf8_bin, + a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int +) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1; + +drop table t1, t2; +--warning 1364 +create table t1 ( + a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int +); +insert into t1 values (1,1,1, 1,1,1, 1,1,1); + +--warning 1364 +create table t2 ( + a1 varchar(12) charset utf8 collate utf8_bin not null, + a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, + primary key (a1) +) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1 ; + +# Test the default value +drop table t2; + +create table t2 ( a int default 3, b int default 3) + select a1,a2 from t1; +show create table t2; + +drop table t1, t2; + # End of 4.1 tests + +# +# Bug #14155: Maximum value of MAX_ROWS handled incorrectly on 64-bit +# platforms +# +create table t1 (i int) engine=myisam max_rows=100000000000; +show create table t1; +alter table t1 max_rows=100; +show create table t1; +alter table t1 max_rows=100000000000; +show create table t1; +drop table t1; + +# End of 5.0 tests diff --git a/mysql-test/t/csv.test b/mysql-test/t/csv.test index 2ac46d75f9a..a028f6ced6d 100644 --- a/mysql-test/t/csv.test +++ b/mysql-test/t/csv.test @@ -1314,4 +1314,73 @@ select period from t1; drop table if exists t1,t2,t3,t4; +# +# Bug #13894 Server crashes on update of CSV table +# + +--disable_warnings +DROP TABLE IF EXISTS bug13894; +--enable_warnings + +CREATE TABLE bug13894 ( val integer ) ENGINE = CSV; +INSERT INTO bug13894 VALUES (5); +INSERT INTO bug13894 VALUES (10); +INSERT INTO bug13894 VALUES (11); +INSERT INTO bug13894 VALUES (10); +SELECT * FROM bug13894; +UPDATE bug13894 SET val=6 WHERE val=10; +SELECT * FROM bug13894; +DROP TABLE bug13894; + +# +# Bug #14672 Bug in deletion +# + +--disable_warnings +DROP TABLE IF EXISTS bug14672; +--enable_warnings + +CREATE TABLE bug14672 (c1 integer) engine = CSV; +INSERT INTO bug14672 VALUES (1), (2), (3); +SELECT * FROM bug14672; +DELETE FROM bug14672 WHERE c1 = 2; +SELECT * FROM bug14672; +INSERT INTO bug14672 VALUES (4); +SELECT * FROM bug14672; +INSERT INTO bug14672 VALUES (5); +SELECT * FROM bug14672; +DROP TABLE bug14672; + # End of 4.1 tests + +# +# BUG#13406 - incorrect amount of "records deleted" +# + +create table t1 (a int) engine=csv; +insert t1 values (1); +--enable_info +delete from t1; -- delete_row +delete from t1; -- delete_all_rows +--disable_info +insert t1 values (1),(2); +--enable_info +delete from t1; -- delete_all_rows +--disable_info +insert t1 values (1),(2),(3); +flush tables; +--enable_info +delete from t1; -- delete_row +--disable_info +insert t1 values (1),(2),(3),(4); +flush tables; +select count(*) from t1; +--enable_info +delete from t1; -- delete_all_rows +--disable_info +insert t1 values (1),(2),(3),(4),(5); +--enable_info +truncate table t1; -- truncate +--disable_info +drop table t1; + diff --git a/mysql-test/t/ctype_recoding.test b/mysql-test/t/ctype_recoding.test index 9949ef88da4..5648cea7fd3 100644 --- a/mysql-test/t/ctype_recoding.test +++ b/mysql-test/t/ctype_recoding.test @@ -144,8 +144,7 @@ create table t1 (a char(10) character set cp1251); insert into t1 values (_koi8r'×ÁÓÑ'); # this is possible: select * from t1 where a=_koi8r'×ÁÓÑ'; -# this is not possible, because we have a function, not just a constant: ---error 1267 +# this is possible, because we have a function with constant arguments: select * from t1 where a=concat(_koi8r'×ÁÓÑ'); # this is not posible, cannot convert _latin1'×ÁÓÑ' into cp1251: --error 1267 @@ -153,6 +152,14 @@ select * from t1 where a=_latin1' drop table t1; set names latin1; +# +# Bug#10446 Illegal mix of collations +# +create table t1 (a char(10) character set utf8 collate utf8_bin); +insert into t1 values (' xxx'); +select * from t1 where a=lpad('xxx',10,' '); +drop table t1; + # # Check more automatic conversion # diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index 5670e9efbf9..a96564f4e76 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -884,7 +884,9 @@ SELECT DISTINCT id FROM t1 ORDER BY id; DROP TABLE t1; # -# Bugs#10504: Character set does not support traditional mode +# Bug#10504: Character set does not support traditional mode +# Bug#14146: CHAR(...USING ...) and CONVERT(CHAR(...) USING...) +# produce different results # set names utf8; # correct value @@ -894,12 +896,14 @@ select char(0xd18f using utf8); select char(53647 using utf8); # incorrect value: return with warning select char(0xff,0x8f using utf8); +select convert(char(0xff,0x8f) using utf8); # incorrect value in strict mode: return NULL with "Error" level warning set sql_mode=traditional; select char(0xff,0x8f using utf8); select char(195 using utf8); select char(196 using utf8); select char(2557 using utf8); +select convert(char(0xff,0x8f) using utf8); # # Check convert + char + using diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 2a4a7b356e7..b440d1c40fa 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -1,6 +1,6 @@ ############################################################################## # -# List the test cases that are to be disabled temporarely. +# List the test cases that are to be disabled temporarily. # # Separate the test case name and the comment with ':'. # @@ -15,5 +15,8 @@ rpl_relayrotate : Unstable test case, bug#12429 rpl_until : Unstable test case, bug#12429 rpl_deadlock : Unstable test case, bug#12429 kill : Unstable test case, bug#9712 -archive_gis : The test fails on 32bit Linux -compress : Magnus will fix +ndb_cache2 : Bug #15004 +ndb_cache_multi2: Bug #15004 +func_group : Bug #15448 +func_math : Bug #15448 +group_min_max : Bug #15448 diff --git a/mysql-test/t/federated_transactions.test b/mysql-test/t/federated_transactions.test new file mode 100644 index 00000000000..46359b8e024 --- /dev/null +++ b/mysql-test/t/federated_transactions.test @@ -0,0 +1,37 @@ +source include/federated.inc; + +connection slave; +DROP TABLE IF EXISTS federated.t1; +#SHOW ENGINES; +CREATE TABLE federated.t1 ( + `id` int(20) NOT NULL, + `name` varchar(32) NOT NULL default '' + ) + DEFAULT CHARSET=latin1 ENGINE=BerkeleyDB; + +connection master; +DROP TABLE IF EXISTS federated.t1; +# # correct connection, same named tables +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.t1 ( + `id` int(20) NOT NULL, + `name` varchar(32) NOT NULL default '' + ) + ENGINE="FEDERATED" DEFAULT CHARSET=latin1 + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; + +set autocommit=0; +INSERT INTO federated.t1 (id, name) VALUES (1, 'foo'); +INSERT INTO federated.t1 (id, name) VALUES (2, 'fee'); +COMMIT; +INSERT INTO federated.t1 (id, name) VALUES (3, 'fie'); +INSERT INTO federated.t1 (id, name) VALUES (4, 'fum'); +ROLLBACK; +set autocommit=1; +INSERT INTO federated.t1 (id, name) VALUES (5, 'foe'); +INSERT INTO federated.t1 (id, name) VALUES (6, 'fig'); + +SELECT * FROM federated.t1; +DELETE FROM federated.t1; + +source include/federated_cleanup.inc; diff --git a/mysql-test/t/flush_table.test b/mysql-test/t/flush_table.test index e46b67ad3d0..0ea0ac0840a 100644 --- a/mysql-test/t/flush_table.test +++ b/mysql-test/t/flush_table.test @@ -9,10 +9,63 @@ drop table if exists t1,t2; --enable_warnings create table t1 (a int not null auto_increment primary key); insert into t1 values(0); + +# Test for with read lock + flush + lock table t1 read; flush table t1; check table t1; +unlock tables; + +# Test for with 2 read lock in different thread + flush + +lock table t1 read; +connect (locker,localhost,root,,test); +connection locker; +lock table t1 read; +connection default; +send flush table t1; +connection locker; +--sleep 2 +select * from t1; +unlock tables; +connection default; +reap; +select * from t1; +unlock tables; + +# Test for with a write lock and a waiting read lock + flush + +lock table t1 write; +connection locker; +send lock table t1 read; +connection default; +sleep 2; +flush table t1; +select * from t1; +unlock tables; +connection locker; +reap; +unlock tables; +connection default; + +# Test for with a read lock and a waiting write lock + flush + +lock table t1 read; +connection locker; +send lock table t1 write; +connection default; +sleep 2; +flush table t1; +select * from t1; +unlock tables; +connection locker; +reap; +unlock tables; +select * from t1; +connection default; drop table t1; +disconnect locker; # # In the following test FLUSH TABLES produces a deadlock diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test index 08648f4e0a6..ea92ec944ed 100644 --- a/mysql-test/t/fulltext.test +++ b/mysql-test/t/fulltext.test @@ -348,6 +348,13 @@ INSERT INTO t1 VALUES('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'); SET myisam_repair_threads=2; REPAIR TABLE t1; SET myisam_repair_threads=@@global.myisam_repair_threads; + +# +# BUG#5686 - #1034 - Incorrect key file for table - only utf8 +# +INSERT INTO t1 VALUES('testword\'\''); +SELECT a FROM t1 WHERE MATCH a AGAINST('testword' IN BOOLEAN MODE); +SELECT a FROM t1 WHERE MATCH a AGAINST('testword\'\'' IN BOOLEAN MODE); DROP TABLE t1; # End of 4.1 tests diff --git a/mysql-test/t/func_equal.test b/mysql-test/t/func_equal.test index 4c88ed170a1..1c219af0254 100644 --- a/mysql-test/t/func_equal.test +++ b/mysql-test/t/func_equal.test @@ -34,4 +34,13 @@ select * from t1 where value <=> value; select * from t1 where id <=> value or value<=>id; drop table t1,t2; +# +# Bug #12612: quoted bigint unsigned value and the use of "in" in where clause +# +create table t1 (a bigint unsigned); +insert into t1 values (4828532208463511553); +select * from t1 where a = '4828532208463511553'; +select * from t1 where a in ('4828532208463511553'); +drop table t1; + # End of 4.1 tests diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test index a519d51e0b5..cd686585dd8 100644 --- a/mysql-test/t/func_gconcat.test +++ b/mysql-test/t/func_gconcat.test @@ -390,3 +390,19 @@ SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY id; DROP TABLE t1; # End of 4.1 tests + +# +# Bug#8568 "GROUP_CONCAT returns string, unless in a UNION in which case +# returns BLOB": add a test case, the bug can not be repeated any more. +# + +set names latin1; +create table t1 (a char, b char); +insert into t1 values ('a', 'a'), ('a', 'b'), ('b', 'a'), ('b', 'b'); +create table t2 select group_concat(b) as a from t1 where a = 'a'; +create table t3 (select group_concat(a) as a from t1 where a = 'a') union + (select group_concat(b) as a from t1 where a = 'b'); +select charset(a) from t2; +select charset(a) from t3; +drop table t1, t2, t3; +set names default; diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test index 9237205eeb5..c667f90940c 100644 --- a/mysql-test/t/func_group.test +++ b/mysql-test/t/func_group.test @@ -2,8 +2,6 @@ # simple test of all group functions # ---source include/have_innodb.inc - --disable_warnings drop table if exists t1,t2; --enable_warnings @@ -545,10 +543,12 @@ DROP TABLE t1; # Bug #12882 min/max inconsistent on empty table # +--disable_warnings create table t1m (a int) engine=myisam; create table t1i (a int) engine=innodb; create table t2m (a int) engine=myisam; create table t2i (a int) engine=innodb; +--enable_warnings insert into t2m values (5); insert into t2i values (5); diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test index 635c7a3f4e7..e806df5e91c 100644 --- a/mysql-test/t/grant.test +++ b/mysql-test/t/grant.test @@ -487,4 +487,16 @@ flush privileges; set @user123="non-existent"; select * from mysql.db where user=@user123; +set names koi8r; +create database ÂÄ; +grant select on ÂÄ.* to root@localhost; +select hex(Db) from mysql.db where Db='ÂÄ'; +show grants for root@localhost; +flush privileges; +show grants for root@localhost; +drop database ÂÄ; +revoke all privileges on ÂÄ.* from root@localhost; +show grants for root@localhost; +set names latin1; + # End of 4.1 tests diff --git a/mysql-test/t/group_min_max.test b/mysql-test/t/group_min_max.test index 3d751f4a571..e15ef92116c 100644 --- a/mysql-test/t/group_min_max.test +++ b/mysql-test/t/group_min_max.test @@ -693,3 +693,25 @@ create table t1(a int, key(a)) engine=innodb; insert into t1 values(1); select a, count(a) from t1 group by a with rollup; drop table t1; + +# +# Bug #13293 Wrongly used index results in endless loop. +# +create table t1 (f1 int, f2 char(1), primary key(f1,f2)) engine=innodb; +insert into t1 values ( 1,"e"),(2,"a"),( 3,"c"),(4,"d"); +alter table t1 drop primary key, add primary key (f2, f1); +explain select distinct f1 a, f1 b from t1; +explain select distinct f1, f2 from t1; +drop table t1; + +# +# Bug #14920 Ordering aggregated result sets with composite primary keys +# corrupts resultset +# +create table t1 (c1 int not null,c2 int not null, primary key(c1,c2)); +insert into t1 (c1,c2) values +(10,1),(10,2),(10,3),(20,4),(20,5),(20,6),(30,7),(30,8),(30,9); +select distinct c1, c2 from t1 order by c2; +select c1,min(c2) as c2 from t1 group by c1 order by c2; +select c1,c2 from t1 group by c1,c2 order by c2; +drop table t1; diff --git a/mysql-test/t/handler.test b/mysql-test/t/handler.test index 1bb9b1d3504..f3e14c3cd2b 100644 --- a/mysql-test/t/handler.test +++ b/mysql-test/t/handler.test @@ -347,4 +347,79 @@ drop table t3; drop table t4; drop table t5; +# +# Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash +# +create table t1 (c1 int); +insert into t1 values (1); +# client 1 +handler t1 open; +handler t1 read first; +# client 2 +connect (con2,localhost,root,,); +connection con2; +--exec echo send the below to another connection, do not wait for the result +send optimize table t1; +--sleep 1 +# client 1 +--exec echo proceed with the normal connection +connection default; +handler t1 read next; +handler t1 close; +# client 2 +--exec echo read the result from the other connection +connection con2; +reap; +# client 1 +--exec echo proceed with the normal connection +connection default; +drop table t1; + # End of 4.1 tests + +# +# Addendum to Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash +# Show that DROP TABLE can no longer deadlock against +# FLUSH TABLES WITH READ LOCK. This is a 5.0 issue. +# +create table t1 (c1 int); +insert into t1 values (14397); +flush tables with read lock; +# The thread with the global read lock cannot drop the table itself: +--error 1223 +drop table t1; +# +# client 2 +# We need a second connection to try the drop. +# The drop waits for the global read lock to go away. +# Without the addendum fix it locked LOCK_open before entering the wait loop. +connection con2; +--exec echo send the below to another connection, do not wait for the result +send drop table t1; +--sleep 1 +# +# client 1 +# Now we need something that wants LOCK_open. A simple table access which +# opens the table does the trick. +--exec echo proceed with the normal connection +connection default; +# This would hang on LOCK_open without the 5.0 addendum fix. +select * from t1; +# Release the read lock. This should make the DROP go through. +unlock tables; +# +# client 2 +# Read the result of the drop command. +connection con2; +--exec echo read the result from the other connection +reap; +# +# client 1 +# Now back to normal operation. The table should not exist any more. +--exec echo proceed with the normal connection +connection default; +--error 1146 +select * from t1; +# Just to be sure and not confuse the next test case writer. +drop table if exists t1; + diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index 8a28e8bbf02..acbc62f1364 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -379,6 +379,8 @@ where table_schema='test'; select index_name from information_schema.statistics where table_schema='test'; select constraint_name from information_schema.table_constraints where table_schema='test'; +show create view v2; +show create table v3; drop view v2; drop view v3; drop table t4; @@ -736,3 +738,13 @@ create table t1(a blob, b text charset utf8, c text charset ucs2); select data_type, character_octet_length, character_maximum_length from information_schema.columns where table_name='t1'; drop table t1; + +# +# Bug#14476 `information_schema`.`TABLES`.`TABLE_TYPE` with empty value +# +create table t1 (f1 int(11)); +create view v1 as select * from t1; +drop table t1; +select table_type from information_schema.tables +where table_name="v1"; +drop view v1; diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index cf0e08e2e66..a73ecf7c3eb 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -1751,3 +1751,22 @@ insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken'); drop table t1; drop table t2; commit; + +# +# Test that we can create a large (>1K) key +# +create table t1 (a varchar(255) character set utf8, + b varchar(255) character set utf8, + c varchar(255) character set utf8, + d varchar(255) character set utf8, + key (a,b,c,d)) engine=innodb; +drop table t1; +--error ER_TOO_LONG_KEY +create table t1 (a varchar(255) character set utf8, + b varchar(255) character set utf8, + c varchar(255) character set utf8, + d varchar(255) character set utf8, + e varchar(255) character set utf8, + key (a,b,c,d,e)) engine=innodb; + +--echo End of 5.0 tests diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test index bb82a93c6c4..553aaf987bb 100644 --- a/mysql-test/t/join.test +++ b/mysql-test/t/join.test @@ -334,3 +334,210 @@ select t1.i,t2.i,t3.i from t2 right join t3 on (t2.i=t3.i),t1 order by t1.i,t2.i drop table t1,t2,t3; # End of 4.1 tests + +# +# Tests for WL#2486 Natural/using join according to SQL:2003. +# +# NOTICE: +# - The tests are designed so that all statements, except MySQL +# extensions run on any SQL server. Please do no change. +# - Tests marked with TODO will be submitted as bugs. +# + +create table t1 (c int, b int); +create table t2 (a int, b int); +create table t3 (b int, c int); +create table t4 (y int, c int); +create table t5 (y int, z int); +create table t6 (a int, c int); + +insert into t1 values (10,1); +insert into t1 values (3 ,1); +insert into t1 values (3 ,2); +insert into t2 values (2, 1); +insert into t3 values (1, 3); +insert into t3 values (1,10); +insert into t4 values (11,3); +insert into t4 values (2, 3); +insert into t5 values (11,4); +insert into t6 values (2, 3); + +-- Views with simple natural join. +create algorithm=merge view v1a as +select * from t1 natural join t2; +-- as above, but column names are cross-renamed: a->c, c->b, b->a +create algorithm=merge view v1b(a,b,c) as +select * from t1 natural join t2; +-- as above, but column names are aliased: a->c, c->b, b->a +create algorithm=merge view v1c as +select b as a, c as b, a as c from t1 natural join t2; +-- as above, but column names are cross-renamed, and aliased +-- a->c->b, c->b->a, b->a->c +create algorithm=merge view v1d(b, a, c) as +select a as c, c as b, b as a from t1 natural join t2; + +-- Views with JOIN ... ON +create algorithm=merge view v2a as +select t1.c, t1.b, t2.a from t1 join (t2 join t4 on b + 1 = y) on t1.c = t4.c; +create algorithm=merge view v2b as +select t1.c as b, t1.b as a, t2.a as c +from t1 join (t2 join t4 on b + 1 = y) on t1.c = t4.c; + +-- Views with bigger natural join +create algorithm=merge view v3a as +select * from t1 natural join t2 natural join t3; +create algorithm=merge view v3b as +select * from t1 natural join (t2 natural join t3); + +-- View over views with mixed natural join and join ... on +create algorithm=merge view v4 as +select * from v2a natural join v3a; + +-- Nested natural/using joins. +select * from (t1 natural join t2) natural join (t3 natural join t4); +select * from (t1 natural join t2) natural left join (t3 natural join t4); +select * from (t3 natural join t4) natural right join (t1 natural join t2); +select * from (t1 natural left join t2) natural left join (t3 natural left join t4); +select * from (t4 natural right join t3) natural right join (t2 natural right join t1); +select * from t1 natural join t2 natural join t3 natural join t4; +select * from ((t1 natural join t2) natural join t3) natural join t4; +select * from t1 natural join (t2 natural join (t3 natural join t4)); +-- BUG#15355: this query fails in 'prepared statements' mode +-- select * from ((t3 natural join (t1 natural join t2)) natural join t4) natural join t5; +-- select * from ((t3 natural left join (t1 natural left join t2)) natural left join t4) natural left join t5; +select * from t5 natural right join (t4 natural right join ((t2 natural right join t1) natural right join t3)); +select * from (t1 natural join t2), (t3 natural join t4); +-- MySQL extension - nested comma ',' operator instead of cross join. +-- BUG#15357 - natural join with nested cross-join results in incorrect columns +-- select * from t5 natural join ((t1 natural join t2), (t3 natural join t4)); +-- select * from ((t1 natural join t2), (t3 natural join t4)) natural join t5; +-- select * from t5 natural join ((t1 natural join t2) cross join (t3 natural join t4)); +-- select * from ((t1 natural join t2) cross join (t3 natural join t4)) natural join t5; + +select * from (t1 join t2 using (b)) join (t3 join t4 using (c)) using (c); +select * from (t1 join t2 using (b)) natural join (t3 join t4 using (c)); + + +-- Other clauses refer to NJ columns. +select a,b,c from (t1 natural join t2) natural join (t3 natural join t4) +where b + 1 = y or b + 10 = y group by b,c,a having min(b) < max(y) order by a; +select * from (t1 natural join t2) natural left join (t3 natural join t4) +where b + 1 = y or b + 10 = y group by b,c,a,y having min(b) < max(y) order by a, y; +select * from (t3 natural join t4) natural right join (t1 natural join t2) +where b + 1 = y or b + 10 = y group by b,c,a,y having min(b) < max(y) order by a, y; + +-- Qualified column references to NJ columns. +select * from t1 natural join t2 where t1.c > t2.a; +select * from t1 natural join t2 where t1.b > t2.b; +select * from t1 natural left join (t4 natural join t5) where t5.z is not NULL; + +-- Nested 'join ... on' - name resolution of ON conditions +select * from t1 join (t2 join t4 on b + 1 = y) on t1.c = t4.c; +select * from (t2 join t4 on b + 1 = y) join t1 on t1.c = t4.c; +select * from t1 natural join (t2 join t4 on b + 1 = y); +select * from (t1 cross join t2) join (t3 cross join t4) on (a < y and t2.b < t3.c); + +-- MySQL extension - 'join ... on' over nested comma operator +select * from (t1, t2) join (t3, t4) on (a < y and t2.b < t3.c); +select * from (t1 natural join t2) join (t3 natural join t4) on a = y; +select * from ((t3 join (t1 join t2 on c > a) on t3.b < t2.a) join t4 on y > t1.c) join t5 on z = t1.b + 3; + +-- MySQL extension - refererence qualified coalesced columns +select * from t1 natural join t2 where t1.b > 0; +select * from t1 natural join (t4 natural join t5) where t4.y > 7; +select * from (t4 natural join t5) natural join t1 where t4.y > 7; +select * from t1 natural left join (t4 natural join t5) where t4.y > 7; +select * from (t4 natural join t5) natural right join t1 where t4.y > 7; +select * from (t1 natural join t2) join (t3 natural join t4) on t1.b = t3.b; + +-- MySQL extension - select qualified columns of NJ columns +select t1.*, t2.* from t1 natural join t2; +select t1.*, t2.*, t3.*, t4.* from (t1 natural join t2) natural join (t3 natural join t4); + +-- Queries over subselects in the FROM clause +select * from (select * from t1 natural join t2) as t12 + natural join + (select * from t3 natural join t4) as t34; +select * from (select * from t1 natural join t2) as t12 + natural left join + (select * from t3 natural join t4) as t34; +select * from (select * from t3 natural join t4) as t34 + natural right join + (select * from t1 natural join t2) as t12; + +-- Queries over views +select * from v1a; +select * from v1b; +select * from v1c; +select * from v1d; +select * from v2a; +select * from v2b; +select * from v3a; +select * from v3b; +select * from v4; +select * from v1a natural join v2a; +select v2a.* from v1a natural join v2a; +select * from v1b join v2a on v1b.b = v2a.c; +select * from v1c join v2a on v1c.b = v2a.c; +select * from v1d join v2a on v1d.a = v2a.c; +select * from v1a join (t3 natural join t4) on a = y; + +-- TODO: add tests with correlated subqueries for natural join/join on. +-- related to BUG#15269 + + +---------------------------------------------------------------------- +-- Negative tests (tests for errors) +---------------------------------------------------------------------- +-- error 1052 +select * from t1 natural join (t3 cross join t4); -- works in Oracle - bug +-- error 1052 +select * from (t3 cross join t4) natural join t1; -- works in Oracle - bug +-- error 1052 +select * from t1 join (t2, t3) using (b); +-- error 1052 +select * from ((t1 natural join t2), (t3 natural join t4)) natural join t6; +-- error 1052 +select * from ((t1 natural join t2), (t3 natural join t4)) natural join t6; +-- error 1052 +-- BUG#15357: doesn't detect non-unique column 'c', as in the above query. +-- select * from t6 natural join ((t1 natural join t2), (t3 natural join t4)); +-- error 1052 +select * from (t1 join t2 on t1.b=t2.b) natural join (t3 natural join t4); +-- error 1052 +select * from (t3 natural join t4) natural join (t1 join t2 on t1.b=t2.b); +-- this one is OK, the next equivalent one is incorrect (bug in Oracle) +-- error 1052 +select * from (t3 join (t4 natural join t5) on (b < z)) + natural join + (t1 natural join t2); +-- error 1052 +-- BUG#15357: this query should return an ambiguous column error +-- Expected result: the query must return error with duplicate column 'c' +--select * from (t1 natural join t2) +-- natural join +-- (t3 join (t4 natural join t5) on (b < z)); + +-- error 1054 +select t1.b from v1a; +-- error 1054 +select * from v1a join v1b on t1.b = t2.b; + +drop table t1; +drop table t2; +drop table t3; +drop table t4; +drop table t5; +drop table t6; + +drop view v1a; +drop view v1b; +drop view v1c; +drop view v1d; +drop view v2a; +drop view v2b; +drop view v3a; +drop view v3b; +drop view v4; + +# End of tests for WL#2486 - natural/using join diff --git a/mysql-test/t/join_nested.test b/mysql-test/t/join_nested.test index 0592ec3152f..9f23e2d0e2f 100644 --- a/mysql-test/t/join_nested.test +++ b/mysql-test/t/join_nested.test @@ -832,3 +832,71 @@ SELECT v2.x FROM v2 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d); DROP VIEW v1, v2; DROP TABLE t1, t2, t3, t4, t5, t6; + +# +# BUG#13126 -test case from bug report +# +create table t1 (id1 int(11) not null); +insert into t1 values (1),(2); + +create table t2 (id2 int(11) not null); +insert into t2 values (1),(2),(3),(4); + +create table t3 (id3 char(16) not null); +insert into t3 values ('100'); + +create table t4 (id2 int(11) not null, id3 char(16)); + +create table t5 (id1 int(11) not null, key (id1)); +insert into t5 values (1),(2),(1); + +create view v1 as + select t4.id3 from t4 join t2 on t4.id2 = t2.id2; + +select t1.id1 from t1 inner join (t3 left join v1 on t3.id3 = v1.id3); + +drop view v1; +drop table t1, t2, t3, t4, t5; + +create table t0 (a int); +insert into t0 values (0),(1),(2),(3); +create table t1(a int); +insert into t1 select A.a + 10*(B.a) from t0 A, t0 B; + +create table t2 (a int, b int); +insert into t2 values (1,1), (2,2), (3,3); + +create table t3(a int, b int, filler char(200), key(a)); +insert into t3 select a,a,'filler' from t1; +insert into t3 select a,a,'filler' from t1; + +create table t4 like t3; +insert into t4 select * from t3; +insert into t4 select * from t3; + +create table t5 like t4; +insert into t5 select * from t4; +insert into t5 select * from t4; + +create table t6 like t5; +insert into t6 select * from t5; +insert into t6 select * from t5; + +create table t7 like t6; +insert into t7 select * from t6; +insert into t7 select * from t6; + +--replace_column 9 X +explain select * from t4 join + t2 left join (t3 join t5 on t5.a=t3.b) on t3.a=t2.b where t4.a<=>t3.b; + +--replace_column 9 X +explain select * from (t4 join t6 on t6.a=t4.b) right join t3 on t4.a=t3.b + join t2 left join (t5 join t7 on t7.a=t5.b) on t5.a=t2.b where t3.a<=>t2.b; + +--replace_column 9 X +explain select * from t2 left join + (t3 left join (t4 join t6 on t6.a=t4.b) on t4.a=t3.b + join t5 on t5.a=t3.b) on t3.a=t2.b; + +drop table t0, t1, t2, t3, t4, t5, t6, t7; diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test index ff05867b7c1..520bacd8f17 100644 --- a/mysql-test/t/merge.test +++ b/mysql-test/t/merge.test @@ -51,6 +51,9 @@ create table t4 (a int not null, b char(10), key(a)) engine=MERGE UNION=(t1,t2); select * from t4; --error 1168 alter table t4 add column c int; +flush tables; +--error 1168 +select * from t4; # # Test tables in different databases diff --git a/mysql-test/t/mix_innodb_myisam_binlog.test b/mysql-test/t/mix_innodb_myisam_binlog.test index 2e804f4c986..658584b625e 100644 --- a/mysql-test/t/mix_innodb_myisam_binlog.test +++ b/mysql-test/t/mix_innodb_myisam_binlog.test @@ -227,7 +227,37 @@ select (@after:=unix_timestamp())*0; # always give repeatable output # the bug, the reap would return immediately after the insert into t2. select (@after-@before) >= 2; -# cleanup drop table t1,t2; +commit; + +# test for BUG#7947 - DO RELEASE_LOCK() not written to binlog on rollback in the middle +# of a transaction + +connection con2; +begin; +create temporary table ti (a int) engine=innodb; +rollback; +insert into ti values(1); +set autocommit=0; +create temporary table t1 (a int) engine=myisam; +commit; +insert t1 values (1); +rollback; +create table t0 (n int); +insert t0 select * from t1; +set autocommit=1; +insert into t0 select GET_LOCK("lock1",null); +set autocommit=0; +create table t2 (n int) engine=innodb; +insert into t2 values (3); +disconnect con2; +connection con3; +select get_lock("lock1",60); +--replace_column 5 # +--replace_result "xid=208" "xid=105" "xid=227" "xid=114" "xid=230" "xid=115" "xid=234" "xid=117" "xid=261" "xid=132" +show binlog events from 98; +do release_lock("lock1"); +drop table t0,t2; + # End of 4.1 tests diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test index 5e3be6d45eb..acc816ae921 100644 --- a/mysql-test/t/multi_update.test +++ b/mysql-test/t/multi_update.test @@ -495,6 +495,11 @@ delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b; drop table t1,t2; +# +# Test alter table and a concurrent multi update +# (This will force update to reopen tables) +# + create table t1 (a int, b int); insert into t1 values (1, 2), (2, 3), (3, 4); create table t2 (a int); @@ -511,6 +516,7 @@ send alter table t1 add column c int default 100 after a; connect (updater,localhost,root,,test); connection updater; +sleep 2; send update t1, v1 set t1.b=t1.a+t1.b+v1.b where t1.a=v1.a; connection locker; diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index f15b4d54275..fb90c16bb86 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -476,6 +476,18 @@ explain select sql_big_result distinct t1.a from t1,t2 order by t2.a; explain select distinct t1.a from t1,t2 order by t2.a; drop table t1,t2; +# +# Bug#14616 - Freshly imported table returns error 124 when using LIMIT +# +create table t1 ( + c1 varchar(32), + key (c1) +) engine=myisam; +alter table t1 disable keys; +insert into t1 values ('a'), ('b'); +select c1 from t1 order by c1 limit 1; +drop table t1; + # # Test RTREE index # @@ -648,6 +660,24 @@ analyze table t1; show index from t1; set myisam_stats_method=DEFAULT; +drop table t1; + +# BUG#13814 - key value packed incorrectly for TINYBLOBs + +create table t1( + cip INT NOT NULL, + time TIME NOT NULL, + score INT NOT NULL DEFAULT 0, + bob TINYBLOB +); + +insert into t1 (cip, time) VALUES (1, '00:01'), (2, '00:02'), (3,'00:03'); +insert into t1 (cip, bob, time) VALUES (4, 'a', '00:04'), (5, 'b', '00:05'), + (6, 'c', '00:06'); +select * from t1 where bob is null and cip=1; +create index bug on t1 (bob(22), cip, time); +select * from t1 where bob is null and cip=1; +drop table t1; # End of 4.1 tests # diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index 91a87e2c774..e688e89ad05 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -605,6 +605,7 @@ select * from t2 order by a; drop table t1, t2; drop database db1; + # # Bug #9558 mysqldump --no-data db t1 t2 format still dumps data # @@ -644,7 +645,7 @@ select '------ Testing with illegal table names ------' as test_sequence ; --error 6 --exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "\\t1" 2>&1 - + --error 6 --exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "\\\\t1" 2>&1 @@ -658,19 +659,19 @@ select '------ Testing with illegal table names ------' as test_sequence ; --exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "t/1" 2>&1 --error 6 ---exec $MYSQL_DUMP --compact --skip-comments "mysqldump_test_db" "T_1" +--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "T_1" 2>&1 --error 6 ---exec $MYSQL_DUMP --compact --skip-comments "mysqldump_test_db" "T%1" +--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "T%1" 2>&1 --error 6 ---exec $MYSQL_DUMP --compact --skip-comments "mysqldump_test_db" "T'1" +--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "T'1" 2>&1 --error 6 ---exec $MYSQL_DUMP --compact --skip-comments "mysqldump_test_db" "T_1" +--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "T_1" 2>&1 --error 6 ---exec $MYSQL_DUMP --compact --skip-comments "mysqldump_test_db" "T_" +--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "T_" 2>&1 --disable_query_log select '------ Testing with illegal database names ------' as test_sequence ; @@ -685,6 +686,7 @@ drop table t1, t2, t3; drop database mysqldump_test_db; use test; + # # Bug #9657 mysqldump xml ( -x ) does not format NULL fields correctly # @@ -709,6 +711,16 @@ select * from t1; select * from t1; drop table t1; + +# +# Bug #13318: Bad result with empty field and --hex-blob +# +create table t1 (a binary(1), b blob); +insert into t1 values ('',''); +--exec $MYSQL_DUMP --skip-comments --skip-extended-insert --hex-blob test t1 +--exec $MYSQL_DUMP --skip-comments --hex-blob test t1 +drop table t1; + # End of 4.1 tests # @@ -882,6 +894,7 @@ DROP FUNCTION IF EXISTS bug9056_func1; DROP FUNCTION IF EXISTS bug9056_func2; DROP PROCEDURE IF EXISTS bug9056_proc1; DROP PROCEDURE IF EXISTS bug9056_proc2; +DROP PROCEDURE IF EXISTS `a'b`; --enable_warnings CREATE TABLE t1 (id int); @@ -993,8 +1006,45 @@ create view v2 as select * from v0; select * from v2; --exec $MYSQL_DUMP -x --skip-comments --databases test - drop view v2; drop view v0; drop view v1; drop table t1; + +# Check new --replace option + +--disable_warnings +drop table if exists t1; +--enable_warnings + +CREATE TABLE t1(a int, b int); +INSERT INTO t1 VALUES (1,1); +INSERT INTO t1 VALUES (2,3); +INSERT INTO t1 VALUES (3,4), (4,5); +--exec $MYSQL_DUMP --replace --skip-comments test t1 +DROP TABLE t1; + + +# +# BUG#14554 - mysqldump does not separate words "ROW" and "BEGIN" +# for tables with trigger created in the IGNORE_SPACE sql mode. +# + +SET @old_sql_mode = @@SQL_MODE; +SET SQL_MODE = IGNORE_SPACE; + +CREATE TABLE t1 (a INT); +DELIMITER |; +CREATE TRIGGER tr1 BEFORE INSERT ON t1 + FOR EACH ROW + BEGIN + SET new.a = 0; + END| +DELIMITER ;| + +SET SQL_MODE = @old_sql_mode; + +--exec $MYSQL_DUMP --skip-comments --databases test + +DROP TRIGGER tr1; +DROP TABLE t1; diff --git a/mysql-test/t/ndb_alter_table.test b/mysql-test/t/ndb_alter_table.test index 75ab245a352..77ec6c5e066 100644 --- a/mysql-test/t/ndb_alter_table.test +++ b/mysql-test/t/ndb_alter_table.test @@ -142,6 +142,7 @@ INSERT INTO t1 VALUES (1,2,0),(18,19,4),(20,21,0); select c from t1 order by c; drop table t1; +--disable_ps_protocol create table t1 ( a int primary key, b varchar(10), c varchar(10), index (b) ) engine=ndb; insert into t1 values (1,'one','one'), (2,'two','two'), (3,'three','three'); @@ -151,10 +152,13 @@ select * from t1 where b = 'two'; connection server1; alter table t1 drop index c; connection server2; +# This should fail since index information is not automatically refreshed +--error 1015 select * from t1 where b = 'two'; select * from t1 where b = 'two'; connection server1; drop table t1; +--enable_ps_protocol #--disable_warnings #DROP TABLE IF EXISTS t2; diff --git a/mysql-test/t/ndb_basic.test b/mysql-test/t/ndb_basic.test index 1a351018b8d..0510651a417 100644 --- a/mysql-test/t/ndb_basic.test +++ b/mysql-test/t/ndb_basic.test @@ -606,6 +606,14 @@ select * from t1 order by counter; drop table t1; +# +# BUG#14514 Creating table with packed key fails silently +# + +CREATE TABLE t1 ( b INT ) PACK_KEYS = 0 ENGINE = ndb; +select * from t1; +drop table t1; + # End of 4.1 tests # @@ -615,12 +623,3 @@ create table atablewithareallylongandirritatingname (a int); insert into atablewithareallylongandirritatingname values (2); select * from atablewithareallylongandirritatingname; drop table atablewithareallylongandirritatingname; - - -# -# BUG#14514 -# - -CREATE TABLE t1 ( b INT ) PACK_KEYS = 0 ENGINE = ndb; -select * from t1; -drop table t1; diff --git a/mysql-test/t/ndb_charset.test b/mysql-test/t/ndb_charset.test index fb43e1831f3..5941e5750db 100644 --- a/mysql-test/t/ndb_charset.test +++ b/mysql-test/t/ndb_charset.test @@ -237,13 +237,18 @@ drop table t1; #select a,b,length(a),length(b) from t1 where a='c' and b='c'; #drop table t1; -# bug +# bug#14007 create table t1 ( a char(10) primary key -) engine=ndb; -insert into t1 values ('jonas % '); -replace into t1 values ('jonas % '); -replace into t1 values ('jonas % '); +) engine=ndbcluster default charset=latin1; + +insert into t1 values ('aaabb'); +select * from t1; +replace into t1 set a = 'AAABB'; +select * from t1; +replace into t1 set a = 'aAaBb'; +select * from t1; +replace into t1 set a = 'aaabb'; select * from t1; drop table t1; diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index 21b24dfe4f2..8f20f7be536 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -162,3 +162,13 @@ UNLOCK TABLES; drop table t1; +# +# BUG 14524 +# +CREATE TABLE `t1` ( + `id` int(11) default NULL +) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 PARTITION BY HASH (id) ; +SELECT * FROM t1; + +drop table t1; + diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index 94ee2b1ca39..22d0abf645e 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -842,4 +842,44 @@ set @@tx_isolation=default; execute stmt; deallocate prepare stmt; +# +# Bug#14410 "Crash in Enum or Set type in CREATE TABLE and PS/SP" +# +# Part I. Make sure the typelib for ENUM is created in the statement memory +# root. +prepare stmt from "create temporary table t1 (letter enum('','a','b','c') +not null)"; +execute stmt; +drop table t1; +execute stmt; +drop table t1; +execute stmt; +drop table t1; +# Part II. Make sure that when the default value is converted to UTF-8, +# the new item is # created in the statement memory root. +set names latin1; +prepare stmt from "create table t1 (a enum('test') default 'test') + character set utf8"; +execute stmt; +drop table t1; +execute stmt; +drop table t1; +execute stmt; +drop table t1; +# Cleanup +set names default; +deallocate prepare stmt; + # End of 4.1 tests + +# +# Bug #14956: ROW_COUNT() returns incorrect result after EXECUTE of prepared +# statement +# +create table t1 (id int); +prepare ins_call from "insert into t1 (id) values (1)"; +execute ins_call; +select row_count(); +drop table t1; + +# End of 5.0 tests diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test index 646151a5aae..44ece1be64d 100644 --- a/mysql-test/t/query_cache.test +++ b/mysql-test/t/query_cache.test @@ -14,6 +14,10 @@ flush status; --disable_warnings drop table if exists t1,t2,t3,t4,t11,t21; drop database if exists mysqltest; + +# Fix possible left overs from other tests +drop table if exists ```a`; +drop view if exists v1; --enable_warnings # @@ -743,6 +747,20 @@ show status like "Qcache_hits"; drop table t1; # +# BUG#14652: Queries with leading '(' characters. +# +create table t1 (a int); +flush status; +(select a from t1) union (select a from t1); +show status like "Qcache_queries_in_cache"; +show status like "Qcache_inserts"; +show status like "Qcache_hits"; +(select a from t1) union (select a from t1); +show status like "Qcache_queries_in_cache"; +show status like "Qcache_inserts"; +show status like "Qcache_hits"; +drop table t1; + # SP cursors and selects with query cache (BUG#9715) # create table t1 (a int); diff --git a/mysql-test/t/read_only.test b/mysql-test/t/read_only.test new file mode 100644 index 00000000000..0861951a6a1 --- /dev/null +++ b/mysql-test/t/read_only.test @@ -0,0 +1,103 @@ +# Test of the READ_ONLY global variable: +# check that it blocks updates unless they are only on temporary tables. + +--disable_warnings +DROP TABLE IF EXISTS t1,t2,t3; +--enable_warnings + +# READ_ONLY does nothing to SUPER users +# so we use a non-SUPER one: + +grant CREATE, SELECT, DROP on *.* to test@localhost; + +connect (con1,localhost,test,,test); + +connection default; + +set global read_only=0; + +connection con1; + +create table t1 (a int); + +insert into t1 values(1); + +create table t2 select * from t1; + +connection default; + +set global read_only=1; + +# We check that SUPER can: + +create table t3 (a int); +drop table t3; + +connection con1; + +select @@global.read_only; + +--error 1290 +create table t3 (a int); + +--error 1290 +insert into t1 values(1); + +# if a statement, after parse stage, looks like it will update a +# non-temp table, it will be rejected, even if at execution it would +# have turned out that 0 rows would be updated +--error 1290 +update t1 set a=1 where 1=0; + +# multi-update is special (see sql_parse.cc) so we test it +--error 1290 +update t1,t2 set t1.a=t2.a+1 where t1.a=t2.a; + +# check multi-delete to be sure +--error 1290 +delete t1,t2 from t1,t2 where t1.a=t2.a; + +# With temp tables updates should be accepted: + +create temporary table t3 (a int); + +create temporary table t4 (a int) select * from t3; + +insert into t3 values(1); + +insert into t4 select * from t3; + +# a non-temp table updated: +--error 1290 +update t1,t3 set t1.a=t3.a+1 where t1.a=t3.a; + +# no non-temp table updated (just swapped): +update t1,t3 set t3.a=t1.a+1 where t1.a=t3.a; + +update t4,t3 set t4.a=t3.a+1 where t4.a=t3.a; + +--error 1290 +delete t1 from t1,t3 where t1.a=t3.a; + +delete t3 from t1,t3 where t1.a=t3.a; + +delete t4 from t3,t4 where t4.a=t3.a; + +# and even homonymous ones + +create temporary table t1 (a int); + +insert into t1 values(1); + +update t1,t3 set t1.a=t3.a+1 where t1.a=t3.a; + +delete t1 from t1,t3 where t1.a=t3.a; + +drop table t1; + +--error 1290 +insert into t1 values(1); + +connection default; +drop table t1,t2; +drop user test@localhost; diff --git a/mysql-test/t/rpl_drop_db.test b/mysql-test/t/rpl_drop_db.test index 61354198c83..98afc6e3d02 100644 --- a/mysql-test/t/rpl_drop_db.test +++ b/mysql-test/t/rpl_drop_db.test @@ -13,6 +13,7 @@ insert into mysqltest1.t1 values (1); select * from mysqltest1.t1 into outfile 'mysqltest1/f1.txt'; create table mysqltest1.t2 (n int); create table mysqltest1.t3 (n int); +--replace_result \\ / --error 1010 drop database mysqltest1; use mysqltest1; @@ -29,6 +30,7 @@ while ($1) } --enable_query_log +--replace_result \\ / --error 1010 drop database mysqltest1; use mysqltest1; diff --git a/mysql-test/t/rpl_sp-slave.opt b/mysql-test/t/rpl_sp-slave.opt index 709a224fd92..611ee1f33be 100644 --- a/mysql-test/t/rpl_sp-slave.opt +++ b/mysql-test/t/rpl_sp-slave.opt @@ -1 +1 @@ ---log_bin_trust_routine_creators=0 +--log_bin_trust_routine_creators=0 --slave-skip-errors=1062 diff --git a/mysql-test/t/rpl_sp.test b/mysql-test/t/rpl_sp.test index e62a6c73c0a..386582f8f1b 100644 --- a/mysql-test/t/rpl_sp.test +++ b/mysql-test/t/rpl_sp.test @@ -1,10 +1,18 @@ # Test of replication of stored procedures (WL#2146 for MySQL 5.0) +# Modified by WL#2971. + +# Note that in the .opt files we still use the old variable name +# log-bin-trust-routine-creators so that this test checks that it's +# still accepted (this test also checks that the new name is +# accepted). The old name could be removed in 5.1 or 6.0. source include/master-slave.inc; -# First let's test replication of current_user() (that's a related thing) # we need a db != test, where we don't have automatic grants -create database if not exists mysqltest1; +--disable_warnings +drop database if exists mysqltest1; +--enable_warnings +create database mysqltest1; use mysqltest1; create table t1 (a varchar(100)); sync_slave_with_master; @@ -16,18 +24,14 @@ use mysqltest1; # (same definer, same properties...) connection master; -# cleanup ---disable_warnings -drop procedure if exists foo; -drop procedure if exists foo2; -drop procedure if exists foo3; -drop procedure if exists foo4; -drop procedure if exists bar; -drop function if exists fn1; ---enable_warnings delimiter |; ---error 1418 # not deterministic + +# Stored procedures don't have the limitations that functions have +# regarding binlogging: it's ok to create a procedure as not +# deterministic and updating data, while it's not ok to create such a +# function. We test this. + create procedure foo() begin declare b int; @@ -35,17 +39,6 @@ begin insert into t1 values (b); insert into t1 values (unix_timestamp()); end| - ---replace_column 2 # 5 # -show binlog events from 98| # check that not there - -create procedure foo() deterministic -begin - declare b int; - set b = 8; - insert into t1 values (b); - insert into t1 values (unix_timestamp()); -end| delimiter ;| # we replace columns having times @@ -54,38 +47,29 @@ delimiter ;| --replace_column 13 # 14 # select * from mysql.proc where name='foo' and db='mysqltest1'; sync_slave_with_master; +# You will notice in the result that the definer does not match what +# it is on master, it is a known bug on which Alik is working --replace_result localhost.localdomain localhost 127.0.0.1 localhost --replace_column 13 # 14 # select * from mysql.proc where name='foo' and db='mysqltest1'; -# Now when we call it, does the CALL() get into binlog, -# or the substatements? connection master; # see if timestamp used in SP on slave is same as on master set timestamp=1000000000; call foo(); ---replace_column 2 # 5 # -show binlog events from 308; select * from t1; sync_slave_with_master; select * from t1; -# Now a SP which is supposed to not update tables (CALL should not be -# binlogged) as it's "read sql data", so should not give error even if -# non-deterministic. +# Now a SP which is not updating tables connection master; delete from t1; create procedure foo2() - not deterministic - reads sql data select * from mysqltest1.t1; call foo2(); -# verify CALL is not in binlog ---replace_column 2 # 5 # -show binlog events from 518; ---error 1418 +# check that this is allowed (it's not for functions): alter procedure foo2 contains sql; # SP with definer's right @@ -106,15 +90,7 @@ grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1; connect (con1,127.0.0.1,zedjzlcsjhd,,mysqltest1,$MASTER_MYPORT,); connection con1; ---error 1419 # only full-global-privs user can create a routine -create procedure foo4() - deterministic - insert into t1 values (10); - -connection master; -set global log_bin_trust_routine_creators=1; -connection con1; - +# this routine will fail in the second INSERT because of privileges delimiter |; create procedure foo4() deterministic @@ -128,29 +104,22 @@ delimiter ;| # I add ,0 so that it does not print the error in the test output, # because this error is hostname-dependent --error 1142,0 -call foo4(); # invoker has no INSERT grant on table => failure -show warnings; +call foo4(); # invoker has no INSERT grant on table t1 => failure connection master; call foo3(); # success (definer == root) show warnings; ---replace_result localhost.localdomain localhost 127.0.0.1 localhost --error 1142,0 call foo4(); # definer's rights => failure -show warnings; # we test replication of ALTER PROCEDURE alter procedure foo4 sql security invoker; call foo4(); # invoker's rights => success show warnings; -# Check that only successful CALLs are in binlog ---replace_column 2 # 5 # -show binlog events from 990; - -# Note that half-failed CALLs are not in binlog, which is a known -# bug. If we compare t2 on master and slave we see they differ: +# Note that half-failed procedure calls are ok with binlogging; +# if we compare t2 on master and slave we see they are identical: select * from t1; select * from t2; @@ -158,6 +127,30 @@ sync_slave_with_master; select * from t1; select * from t2; +# Let's check another failing-in-the-middle procedure +connection master; +delete from t2; +alter table t2 add unique (a); + +drop procedure foo4; +delimiter |; +create procedure foo4() + deterministic + begin + insert into t2 values(20),(20); + end| + +delimiter ;| + +--error 1062 +call foo4(); +show warnings; + +select * from t2; +sync_slave_with_master; +# check that this failed-in-the-middle replicated right: +select * from t2; + # Test of DROP PROCEDURE --replace_result localhost.localdomain localhost 127.0.0.1 localhost @@ -177,6 +170,14 @@ drop procedure foo2; drop procedure foo3; delimiter |; +# check that needs "deterministic" +--error 1418 +create function fn1(x int) + returns int +begin + insert into t1 values (x); + return x+2; +end| create function fn1(x int) returns int deterministic @@ -202,15 +203,69 @@ drop function fn1; create function fn1() returns int - deterministic + no sql begin return unix_timestamp(); end| + delimiter ;| +# check that needs "deterministic" +--error 1418 +alter function fn1 contains sql; + delete from t1; set timestamp=1000000000; insert into t1 values(fn1()); +connection con1; + +delimiter |; +--error 1419 # only full-global-privs user can create a function +create function fn2() + returns int + no sql +begin + return unix_timestamp(); +end| +delimiter ;| +connection master; +# test old variable name: +set global log_bin_trust_routine_creators=1; +# now use new name: +set global log_bin_trust_function_creators=0; +set global log_bin_trust_function_creators=1; +# slave needs it too otherwise will not execute what master allowed: +connection slave; +set global log_bin_trust_function_creators=1; + +connection con1; + +delimiter |; +create function fn2() + returns int + no sql +begin + return unix_timestamp(); +end| +delimiter ;| + +connection master; + +# Now a function which is supposed to not update tables +# as it's "reads sql data", so should not give error even if +# non-deterministic. + +delimiter |; +create function fn3() + returns int + not deterministic + reads sql data +begin + return 0; +end| +delimiter ;| + +select fn3(); --replace_result localhost.localdomain localhost 127.0.0.1 localhost --replace_column 13 # 14 # select * from mysql.proc where db='mysqltest1'; @@ -223,18 +278,43 @@ select * from t1; --replace_column 13 # 14 # select * from mysql.proc where db='mysqltest1'; -# And now triggers +# Let's check a failing-in-the-middle function +connection master; +delete from t2; +alter table t2 add unique (a); + +drop function fn1; + +delimiter |; +create function fn1() + returns int +begin + insert into t2 values(20),(20); + return 10; +end| + +delimiter ;| + +# Because of BUG#14769 the following statement requires that we start +# slave with --slave-skip-errors=1062. When that bug is fixed, that +# option can be removed. + +--error 1062 +select fn1(); + +select * from t2; +sync_slave_with_master; + +# check that this failed-in-the-middle replicated right: +select * from t2; + +# ********************** PART 3 : TRIGGERS *************** connection con1; --error 1227 create trigger trg before insert on t1 for each row set new.a= 10; connection master; -# fn1() above uses timestamps, so in !ps-protocol, the timezone will be -# binlogged, but in --ps-protocol it will not be (BUG#9359) so -# the binlog offsets get shifted which spoils SHOW BINLOG EVENTS. -# To be immune, we take a new binlog. -flush logs; delete from t1; # TODO: when triggers can contain an update, test that this update # does not go into binlog. @@ -253,7 +333,7 @@ drop trigger trg; insert into t1 values (1); select * from t1; --replace_column 2 # 5 # -show binlog events in 'master-bin.000002' from 98; +show binlog events in 'master-bin.000001' from 98; sync_slave_with_master; select * from t1; @@ -280,4 +360,40 @@ connection master; drop function fn1; drop database mysqltest1; drop user "zedjzlcsjhd"@127.0.0.1; +use test; sync_slave_with_master; +use test; + +# +# Bug#14077 "Failure to replicate a stored function with a cursor": +# verify that stored routines with cursors work on slave. +# +connection master; +--disable_warnings +drop function if exists f1; +--enable_warnings +delimiter |; +create function f1() returns int reads sql data +begin + declare var integer; + declare c cursor for select a from v1; + open c; + fetch c into var; + close c; + return var; +end| +delimiter ;| +create view v1 as select 1 as a; +create table t1 (a int); +insert into t1 (a) values (f1()); +select * from t1; +drop view v1; +drop function f1; +sync_slave_with_master; +connection slave; +select * from t1; + +# cleanup +connection master; +drop table t1; +reset master; diff --git a/mysql-test/t/rpl_trigger.test b/mysql-test/t/rpl_trigger.test index 715222f0314..bf2836b6049 100644 --- a/mysql-test/t/rpl_trigger.test +++ b/mysql-test/t/rpl_trigger.test @@ -87,12 +87,35 @@ insert into t1 set a = now(); select a=b && a=c from t1; let $time=`select a from t1`; +# Check that definer attribute is replicated properly: +# - dump definers on the master; +# - wait for the slave to synchronize with the master; +# - dump definers on the slave; + +SELECT routine_name, definer +FROM information_schema.routines; + +SELECT trigger_name, definer +FROM information_schema.triggers; + save_master_pos; connection slave; sync_with_master; --disable_query_log select "--- On slave --" as ""; --enable_query_log + +# XXX: Definers of stored procedures and functions are not replicated. WL#2897 +# (Complete definer support in the stored routines) addresses this issue. So, +# the result file is expected to be changed after implementation of this WL +# item. + +SELECT routine_name, definer +FROM information_schema.routines; + +SELECT trigger_name, definer +FROM information_schema.triggers; + select a=b && a=c from t1; --disable_query_log eval select a='$time' as 'test' from t1; diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index e7e6d899a66..a73d08f5f18 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -2253,6 +2253,17 @@ insert into t1 values (1,1); insert into t2 values (1,1),(1,2); select distinct count(f2) >0 from t1 left join t2 on f1=f3 group by f1; drop table t1,t2; + +# +# Bug #14482 Server crash when subselecting from the same table +# +create table t1 (f1 int,f2 int); +insert into t1 values(1,1); +create table t2 (f3 int, f4 int, primary key(f3,f4)); +insert into t2 values(1,1); +select * from t1 where f1 in (select f3 from t2 where (f3,f4)= (select f3,f4 from t2)); +drop table t1,t2; + # End of 4.1 tests # @@ -2729,3 +2740,68 @@ select * from t1 where f2 >= '2005-09-3a'; select * from t1 where f2 <= '2005-09-31'; select * from t1 where f2 <= '2005-09-3a'; drop table t1; + +# +# Bug ##14662 ORDER BY on column of a view, with an alias of the same +# column causes ambiguous +# + +create table t1 (f1 int, f2 int); +insert into t1 values (1, 30), (2, 20), (3, 10); +create algorithm=merge view v1 as select f1, f2 from t1; +create algorithm=merge view v2 (f2, f1) as select f1, f2 from t1; +create algorithm=merge view v3 as select t1.f1 as f2, t1.f2 as f1 from t1; +select t1.f1 as x1, f1 from t1 order by t1.f1; +select v1.f1 as x1, f1 from v1 order by v1.f1; +select v2.f1 as x1, f1 from v2 order by v2.f1; +select v3.f1 as x1, f1 from v3 order by v3.f1; +select f1, f2, v1.f1 as x1 from v1 order by v1.f1; +select f1, f2, v2.f1 as x1 from v2 order by v2.f1; +select f1, f2, v3.f1 as x1 from v3 order by v3.f1; +drop table t1; +drop view v1, v2, v3; + +# +# Bug #15106: lost equality predicate of the form field=const in a join query +# + +CREATE TABLE t1(key_a int4 NOT NULL, optimus varchar(32), PRIMARY KEY(key_a)); +CREATE TABLE t2(key_a int4 NOT NULL, prime varchar(32), PRIMARY KEY(key_a)); +CREATE table t3(key_a int4 NOT NULL, key_b int4 NOT NULL, foo varchar(32), + PRIMARY KEY(key_a,key_b)); + +INSERT INTO t1 VALUES (0,''); +INSERT INTO t1 VALUES (1,'i'); +INSERT INTO t1 VALUES (2,'j'); +INSERT INTO t1 VALUES (3,'k'); + +INSERT INTO t2 VALUES (1,'r'); +INSERT INTO t2 VALUES (2,'s'); +INSERT INTO t2 VALUES (3,'t'); + +INSERT INTO t3 VALUES (1,5,'x'); +INSERT INTO t3 VALUES (1,6,'y'); +INSERT INTO t3 VALUES (2,5,'xx'); +INSERT INTO t3 VALUES (2,6,'yy'); +INSERT INTO t3 VALUES (2,7,'zz'); +INSERT INTO t3 VALUES (3,5,'xxx'); + +SELECT t2.key_a,foo + FROM t1 INNER JOIN t2 ON t1.key_a = t2.key_a + INNER JOIN t3 ON t1.key_a = t3.key_a + WHERE t2.key_a=2 and key_b=5; +EXPLAIN SELECT t2.key_a,foo + FROM t1 INNER JOIN t2 ON t1.key_a = t2.key_a + INNER JOIN t3 ON t1.key_a = t3.key_a + WHERE t2.key_a=2 and key_b=5; + +SELECT t2.key_a,foo + FROM t1 INNER JOIN t2 ON t2.key_a = t1.key_a + INNER JOIN t3 ON t1.key_a = t3.key_a + WHERE t2.key_a=2 and key_b=5; +EXPLAIN SELECT t2.key_a,foo + FROM t1 INNER JOIN t2 ON t2.key_a = t1.key_a + INNER JOIN t3 ON t1.key_a = t3.key_a + WHERE t2.key_a=2 and key_b=5; + +DROP TABLE t1,t2,t3; diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test index 1b6a1158dac..b0d2b43204c 100644 --- a/mysql-test/t/show_check.test +++ b/mysql-test/t/show_check.test @@ -312,7 +312,6 @@ connect (con3,localhost,mysqltest_3,,test); connection con3; --error 1142 select * from mysqltest.t1; ---error 1044 show create database mysqltest; drop table mysqltest.t1; drop database mysqltest; @@ -424,3 +423,29 @@ DROP TABLE urkunde; # --error 1049 SHOW TABLES FROM non_existing_database; + +# End of 4.1 tests + +--disable_result_log +SHOW AUTHORS; +--enable_result_log + +# +# Test for bug #9785 SELECT privilege for the whole database is needed to do SHOW CREATE DATABASE +# +create database mysqltest; +show create database mysqltest; +create table mysqltest.t1(a int); +insert into mysqltest.t1 values(1); +grant select on `mysqltest`.`t1` to mysqltest_4@localhost; +connect (con4,localhost,mysqltest_4,,mysqltest); +connection con4; +show create database mysqltest; +connection default; +delete from mysql.user where user='mysqltest_4'; +delete from mysql.db where user='mysqltest_4'; +delete from mysql.tables_priv where user='mysqltest_4'; +flush privileges; +drop database mysqltest; + +--echo End of 5.1 tests diff --git a/mysql-test/t/skip_grants.test b/mysql-test/t/skip_grants.test index 7a729f98661..16b0fbc4d25 100644 --- a/mysql-test/t/skip_grants.test +++ b/mysql-test/t/skip_grants.test @@ -9,7 +9,7 @@ use test; # test that we can create VIEW if privileges check switched off # create table t1 (field1 INT); --- error ER_NO_VIEW_USER +-- error ER_MALFORMED_DEFINER CREATE VIEW v1 AS SELECT field1 FROM t1; drop table t1; diff --git a/mysql-test/t/sp-code.test b/mysql-test/t/sp-code.test new file mode 100644 index 00000000000..6644bc3ab43 --- /dev/null +++ b/mysql-test/t/sp-code.test @@ -0,0 +1,49 @@ +# +# Test the debugging feature "show procedure/function code " +# + +-- source include/is_debug_build.inc + +create procedure empty() +begin +end; +show procedure code empty; +drop procedure empty; + +create function almost_empty() + returns int + return 0; +show function code almost_empty; +drop function almost_empty; + +delimiter //; +create procedure code_sample(x int, out err int, out nulls int) +begin + declare count int default 0; + + set nulls = 0; + begin + declare c cursor for select name from t1; + declare exit handler for not found close c; + + open c; + loop + begin + declare n varchar(20); + declare continue handler for sqlexception set err=1; + + fetch c into n; + if isnull(n) then + set nulls = nulls + 1; + else + set count = count + 1; + update t2 set idx = count where name=n; + end if; + end; + end loop; + end; + select t.name, t.idx from t2 t order by idx asc; +end// +delimiter ;// +show procedure code code_sample; +drop procedure code_sample; diff --git a/mysql-test/t/sp-dynamic.test b/mysql-test/t/sp-dynamic.test index e9816ee3ef0..5416f5931ff 100644 --- a/mysql-test/t/sp-dynamic.test +++ b/mysql-test/t/sp-dynamic.test @@ -26,18 +26,29 @@ begin execute stmt; end| prepare stmt from "call p1()"| +# Allow SP resursion to be show that it has not influence here +set @SAVE_SP_RECURSION_LEVELS=@@max_sp_recursion_depth| +set @@max_sp_recursion_depth=100| --error ER_PS_NO_RECURSION execute stmt| --error ER_PS_NO_RECURSION execute stmt| --error ER_PS_NO_RECURSION execute stmt| ---error ER_SP_NO_RECURSION +--error ER_PS_NO_RECURSION call p1()| ---error ER_SP_NO_RECURSION +--error ER_PS_NO_RECURSION call p1()| ---error ER_SP_NO_RECURSION +--error ER_PS_NO_RECURSION call p1()| +set @@max_sp_recursion_depth=@SAVE_SP_RECURSION_LEVELS| +--error ER_SP_RECURSION_LIMIT +call p1()| +--error ER_SP_RECURSION_LIMIT +call p1()| +--error ER_SP_RECURSION_LIMIT +call p1()| + drop procedure p1| # # C. Create/drop a stored procedure in Dynamic SQL. diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test index e2343cd905c..69e5f73817b 100644 --- a/mysql-test/t/sp-error.test +++ b/mysql-test/t/sp-error.test @@ -1044,10 +1044,11 @@ begin call bug11394(i - 1,(select 1)); end if; end| -# Again if we allow recursion for stored procedures (without -# additional efforts) the following statement will crash the server. ---error 1424 +--error ER_SP_RECURSION_LIMIT call bug11394(2, 1)| +set @@max_sp_recursion_depth=10| +call bug11394(2, 1)| +set @@max_sp_recursion_depth=default| drop procedure bug11394| delimiter ;| @@ -1233,6 +1234,10 @@ begin select password; end| +# Check that an error message is sent +--error ER_PARSE_ERROR +set names='foo2'| + --error ER_SP_BAD_VAR_SHADOW create procedure bug13510_2() begin @@ -1263,8 +1268,168 @@ call bug13510_4()| drop procedure bug13510_3| drop procedure bug13510_4| + + +# +# Test that statements which implicitly commit transaction are prohibited +# in stored function and triggers. Attempt to create function or trigger +# containing such statement should produce error (includes test for +# bug #13627). +# +--disable_warnings +drop function if exists bug_13627_f| +--enable_warnings + +CREATE TABLE t1 (a int)| +-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN DROP TRIGGER test1; END | +-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +CREATE FUNCTION bug_13627_f() returns int BEGIN DROP TRIGGER test1; return 1; END | + +-- error ER_SP_BADSTATEMENT +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN load table t1 from master; END | +-- error ER_SP_BADSTATEMENT +CREATE FUNCTION bug_13627_f() returns int BEGIN load table t1 from master; return 1; END | + +-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create table t2 (a int); END | +-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +CREATE FUNCTION bug_13627_f() returns int BEGIN create table t2 (a int); return 1; END | + +-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create index t1_i on t1 (a); END | +-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +CREATE FUNCTION bug_13627_f() returns int BEGIN create index t1_i on t1 (a); return 1; END | + +-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN alter table t1 add column b int; END | +-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +CREATE FUNCTION bug_13627_f() returns int BEGIN alter table t1 add column b int; return 1; END | + +-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN rename table t1 to t2; END | +-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +CREATE FUNCTION bug_13627_f() returns int BEGIN rename table t1 to t2; return 1; END | + +-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN truncate table t1; END | +-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +CREATE FUNCTION bug_13627_f() returns int BEGIN truncate table t1; return 1; END | + +-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop table t1; END | +-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +CREATE FUNCTION bug_13627_f() returns int BEGIN drop table t1; return 1; END | + +-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop index t1_i on t1; END | +-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +CREATE FUNCTION bug_13627_f() returns int BEGIN drop index t1_i on t1; return 1; END | + +-- error ER_SP_BADSTATEMENT +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN unlock tables; END | +-- error ER_SP_BADSTATEMENT +CREATE FUNCTION bug_13627_f() returns int BEGIN unlock tables; return 1; END | + +-- error ER_SP_BADSTATEMENT +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN LOCK TABLE t1 READ; END | +-- error ER_SP_BADSTATEMENT +CREATE FUNCTION bug_13627_f() returns int BEGIN LOCK TABLE t1 READ; return 1; END | + +-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create database mysqltest; END | +-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +CREATE FUNCTION bug_13627_f() returns int BEGIN create database mysqltest; return 1; END | + +-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop database mysqltest; END | +-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +CREATE FUNCTION bug_13627_f() returns int BEGIN drop database mysqltest; return 1; END | + +-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create user 'mysqltest_1'; END | +-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +CREATE FUNCTION bug_13627_f() returns int BEGIN create user 'mysqltest_1'; return 1; END | + +-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop user 'mysqltest_1'; END | +-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +CREATE FUNCTION bug_13627_f() returns int BEGIN drop user 'mysqltest_1'; return 1; END | + +-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN rename user 'mysqltest_2' to 'mysqltest_1'; END | +-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +CREATE FUNCTION bug_13627_f() returns int BEGIN rename user 'mysqltest_2' to 'mysqltest_1'; return 1; END | + +-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create view v1 as select 1; END | +-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +CREATE FUNCTION bug_13627_f() returns int BEGIN create view v1 as select 1; return 1; END | + +-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN alter view v1 as select 1; END | +-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +CREATE FUNCTION bug_13627_f() returns int BEGIN alter view v1 as select 1; return 1; END | + +-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop view v1; END | +-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +CREATE FUNCTION bug_13627_f() returns int BEGIN drop view v1; return 1; END | + +-- error ER_SP_NO_RECURSIVE_CREATE +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create trigger tr2 before insert on t1 for each row do select 1; END | +-- error ER_SP_NO_RECURSIVE_CREATE +CREATE FUNCTION bug_13627_f() returns int BEGIN create trigger tr2 before insert on t1 for each row do select 1; return 1; END | + +-- error ER_SP_NO_DROP_SP +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop function bug_13627_f; END | +-- error ER_SP_NO_DROP_SP +CREATE FUNCTION bug_13627_f() returns int BEGIN drop function bug_13627_f; return 1; END | + +-- error ER_SP_NO_RECURSIVE_CREATE +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create function f2 () returns int return 1; END | +-- error ER_SP_NO_RECURSIVE_CREATE +CREATE FUNCTION bug_13627_f() returns int BEGIN create function f2 () returns int return 1; return 1; END | + +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW + BEGIN + CREATE TEMPORARY TABLE t2 (a int); + DROP TEMPORARY TABLE t2; + END | +CREATE FUNCTION bug_13627_f() returns int + BEGIN + CREATE TEMPORARY TABLE t2 (a int); + DROP TEMPORARY TABLE t2; + return 1; + END | + +drop table t1| +drop function bug_13627_f| + delimiter ;| +# BUG#12329: "Bogus error msg when executing PS with stored procedure after +# SP was re-created". See also test for related bug#13399 in trigger.test +--disable_warnings +drop function if exists bug12329; +--enable_warnings +create table t1 as select 1 a; +create table t2 as select 1 a; +create function bug12329() returns int return (select a from t1); +prepare stmt1 from 'select bug12329()'; +execute stmt1; +drop function bug12329; +create function bug12329() returns int return (select a+100 from t2); +select bug12329(); +# Until we implement proper mechanism for invalidation of PS/SP when table +# or SP's are changed the following statement will fail with 'Table ... was +# not locked' error (this mechanism should be based on the new TDC). +--error 1100 +execute stmt1; +deallocate prepare stmt1; +drop function bug12329; +drop table t1, t2; + # # Bug#13514 "server crash when create a stored procedure before choose a # database" and @@ -1337,6 +1502,22 @@ DROP PROCEDURE bug13037_p1; DROP PROCEDURE bug13037_p2; DROP PROCEDURE bug13037_p3; +# +# Bug#14569 "editing a stored procedure kills mysqld-nt" +# +create database mysqltest1; +create database mysqltest2; +use mysqltest1; +drop database mysqltest1; +create procedure mysqltest2.p1() select version(); +--error ER_NO_DB_ERROR +create procedure p2() select version(); +use mysqltest2; +--replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00' +show procedure status; +drop database mysqltest2; +use test; + # BUG#NNNN: New bug synopsis # diff --git a/mysql-test/t/sp-prelocking.test b/mysql-test/t/sp-prelocking.test index e5f35b19fa7..bae144f51ac 100644 --- a/mysql-test/t/sp-prelocking.test +++ b/mysql-test/t/sp-prelocking.test @@ -239,4 +239,4 @@ drop function f1; drop function f2; drop function f3; drop procedure sp1; - +drop view v1; diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index eaf69c0ab03..0563835de09 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -1211,15 +1211,13 @@ begin end if; end| select f5(1)| -# This should generate an error about insuficient number of tables locked -# Now this crash server ---disable_parsing # until bug#11394 fix ---error 1100 +# Since currently recursive functions are disallowed ER_SP_NO_RECURSION +# error will be returned, once we will allow them error about +# insufficient number of locked tables will be returned instead. +--error ER_SP_NO_RECURSION select f5(2)| -# But now it simply miserably fails because we are trying to use the same -# lex on the next iteration :/ It should generate some error too... +--error ER_SP_NO_RECURSION select f5(3)| ---enable_parsing # OTOH this should work create function f6() returns int @@ -1265,13 +1263,12 @@ select * from v1| # views and functions ? create function f1() returns int return (select sum(data) from t1) + (select sum(data) from v1)| -# This queries will crash server because we can't use LEX in -# reenterable fashion yet. Patch disabling recursion will heal this. ---disable_parsing +--error ER_SP_NO_RECURSION select f1()| +--error ER_SP_NO_RECURSION select * from v1| +--error ER_SP_NO_RECURSION select * from v2| ---enable_parsing # Back to the normal cases drop function f1| create function f1() returns int @@ -1289,9 +1286,7 @@ select *, f0() from v0| # # Let us test how well prelocking works with explicit LOCK TABLES. # -# Nowdays we have to lock mysql.proc to be able to read SP definitions. -# But Monty was going to fix this. -lock tables t1 read, t1 as t11 read, mysql.proc read| +lock tables t1 read, t1 as t11 read| # These should work well select f3()| select id, f3() from t1 as t11| @@ -1481,9 +1476,6 @@ show procedure status like '%p%'| # Fibonacci, for recursion test. (Yet Another Numerical series :) # -# This part of test is disabled until we implement support for -# recursive stored procedures. ---disable_parsing --disable_warnings drop table if exists fib| --enable_warnings @@ -1512,6 +1504,9 @@ begin end if; end| +# Enable recursion +set @@max_sp_recursion_depth= 20| + # Minimum test: recursion of 3 levels insert into fib values (0), (1)| @@ -1531,7 +1526,7 @@ call fib(20)| select * from fib order by f asc| drop table fib| drop procedure fib| ---enable_parsing +set @@max_sp_recursion_depth= 0| # # Comment & suid @@ -1800,16 +1795,8 @@ select @x2| drop procedure bug2260| # -# BUG#2267 +# BUG#2267 "Lost connect if stored procedure has SHOW FUNCTION STATUS" # -# NOTE: This test case will be fixed as soon as Monty -# will allow to open mysql.proc table under LOCK TABLES -# without mentioning in lock list. -# -# FIXME: Other solution would be to use preopened proc table -# instead of opening it anew. -# ---disable_parsing --disable_warnings drop procedure if exists bug2267_1| --enable_warnings @@ -1836,11 +1823,13 @@ end| --disable_warnings drop procedure if exists bug2267_4| +drop function if exists bug2267_4| --enable_warnings create procedure bug2267_4() begin - show create function fac; + show create function bug2267_4; end| +create function bug2267_4() returns int return 100| --replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00' call bug2267_1()| @@ -1853,7 +1842,7 @@ drop procedure bug2267_1| drop procedure bug2267_2| drop procedure bug2267_3| drop procedure bug2267_4| ---enable_parsing +drop function bug2267_4| # # BUG#2227 @@ -1873,23 +1862,16 @@ call bug2227(9)| drop procedure bug2227| # -# BUG#2614 +# BUG#2614 "Stored procedure with INSERT ... SELECT that does not +# contain any tables crashes server" # -# QQ The second insert doesn't work with temporary tables (it was an -# QQ ordinary table before we changed the locking scheme). It results -# QQ in an error: 1137: Can't reopen table: 't3' -# QQ which is a known limit with temporary tables. -# QQ For this reason we can't run this test any more (i.e., if we modify -# QQ it, it's no longer a test case for the bug), but we keep it here -# QQ anyway, for tracability. ---disable_parsing --disable_warnings drop procedure if exists bug2614| --enable_warnings create procedure bug2614() begin - drop temporary table if exists t3; - create temporary table t3 (id int default '0' not null); + drop table if exists t3; + create table t3 (id int default '0' not null); insert into t3 select 12; insert into t3 select * from t3; end| @@ -1898,9 +1880,8 @@ end| call bug2614()| --enable_warnings call bug2614()| -drop temporary table t3| +drop table t3| drop procedure bug2614| ---enable_parsing # # BUG#2674 @@ -4291,6 +4272,9 @@ call bug12589_1()| # No warnings here call bug12589_2()| call bug12589_3()| +drop procedure bug12589_1| +drop procedure bug12589_2| +drop procedure bug12589_3| # # BUG#7049: Stored procedure CALL errors are ignored @@ -4541,6 +4525,381 @@ drop table t3, t4| drop procedure bug14210| set @@session.max_heap_table_size=default| + +# +# BUG#1473: Dumping of stored functions seems to cause corruption in +# the function body +# +--disable_warnings +drop function if exists bug14723| +drop procedure if exists bug14723| +--enable_warnings + +delimiter ;;| +/*!50003 create function bug14723() + returns bigint(20) +main_loop: begin + return 42; +end */;; +show create function bug14723;; +select bug14723();; + +/*!50003 create procedure bug14723() +main_loop: begin + select 42; +end */;; +show create procedure bug14723;; +call bug14723();; + +delimiter |;; + +drop function bug14723| +drop procedure bug14723| + +# +# Bug#14845 "mysql_stmt_fetch returns MYSQL_NO_DATA when COUNT(*) is 0" +# Check that when fetching from a cursor, COUNT(*) works properly. +# +create procedure bug14845() +begin + declare a char(255); + declare done int default 0; + declare c cursor for select count(*) from t1 where 1 = 0; + declare continue handler for sqlstate '02000' set done = 1; + open c; + repeat + fetch c into a; + if not done then + select a; + end if; + until done end repeat; + close c; +end| +call bug14845()| +drop procedure bug14845| + +# +# BUG#13549 "Server crash with nested stored procedures". +# Server should not crash when during execution of stored procedure +# we have to parse trigger/function definition and this new trigger/ +# function has more local variables declared than invoking stored +# procedure and last of these variables is used in argument of NOT +# operator. +# +--disable_warnings +drop procedure if exists bug13549_1| +drop procedure if exists bug13549_2| +--enable_warnings +CREATE PROCEDURE `bug13549_2`() +begin + call bug13549_1(); +end| +CREATE PROCEDURE `bug13549_1`() +begin + declare done int default 0; + set done= not done; +end| +CALL bug13549_2()| +drop procedure bug13549_2| +drop procedure bug13549_1| + +# +# BUG#10100: function (and stored procedure?) recursivity problem +# +--disable_warnings +drop function if exists bug10100f| +drop procedure if exists bug10100p| +drop procedure if exists bug10100t| +drop procedure if exists bug10100pt| +drop procedure if exists bug10100pv| +drop procedure if exists bug10100pd| +drop procedure if exists bug10100pc| +--enable_warnings +# routines with simple recursion +create function bug10100f(prm int) returns int +begin + if prm > 1 then + return prm * bug10100f(prm - 1); + end if; + return 1; +end| +create procedure bug10100p(prm int, inout res int) +begin + set res = res * prm; + if prm > 1 then + call bug10100p(prm - 1, res); + end if; +end| +create procedure bug10100t(prm int) +begin + declare res int; + set res = 1; + call bug10100p(prm, res); + select res; +end| + +# a procedure which use tables and recursion +create table t3 (a int)| +insert into t3 values (0)| +create view v1 as select a from t3; +create procedure bug10100pt(level int, lim int) +begin + if level < lim then + update t3 set a=level; + FLUSH TABLES; + call bug10100pt(level+1, lim); + else + select * from t3; + end if; +end| +# view & recursion +create procedure bug10100pv(level int, lim int) +begin + if level < lim then + update v1 set a=level; + FLUSH TABLES; + call bug10100pv(level+1, lim); + else + select * from v1; + end if; +end| +# dynamic sql & recursion +prepare stmt2 from "select * from t3;"; +create procedure bug10100pd(level int, lim int) +begin + if level < lim then + select level; + prepare stmt1 from "update t3 set a=a+2"; + execute stmt1; + FLUSH TABLES; + execute stmt1; + FLUSH TABLES; + execute stmt1; + FLUSH TABLES; + deallocate prepare stmt1; + execute stmt2; + select * from t3; + call bug10100pd(level+1, lim); + else + execute stmt2; + end if; +end| +# cursor & recursion +create procedure bug10100pc(level int, lim int) +begin + declare lv int; + declare c cursor for select a from t3; + open c; + if level < lim then + select level; + fetch c into lv; + select lv; + update t3 set a=level+lv; + FLUSH TABLES; + call bug10100pc(level+1, lim); + else + select * from t3; + end if; + close c; +end| + +set @@max_sp_recursion_depth=4| +select @@max_sp_recursion_depth| +-- error ER_SP_NO_RECURSION +select bug10100f(3)| +-- error ER_SP_NO_RECURSION +select bug10100f(6)| +call bug10100t(5)| +call bug10100pt(1,5)| +call bug10100pv(1,5)| +update t3 set a=1| +call bug10100pd(1,5)| +select * from t3| +update t3 set a=1| +call bug10100pc(1,5)| +select * from t3| +set @@max_sp_recursion_depth=0| +select @@max_sp_recursion_depth| +-- error ER_SP_NO_RECURSION +select bug10100f(5)| +-- error ER_SP_RECURSION_LIMIT +call bug10100t(5)| + +#end of the stack checking +set @@max_sp_recursion_depth=255| +set @var=1| +#disable log because error about stack overrun contains numbers which +#depend on a system +-- disable_result_log +-- error ER_STACK_OVERRUN_NEED_MORE +call bug10100p(255, @var)| +-- error ER_STACK_OVERRUN_NEED_MORE +call bug10100pt(1,255)| +-- error ER_STACK_OVERRUN_NEED_MORE +call bug10100pv(1,255)| +-- error ER_STACK_OVERRUN_NEED_MORE +call bug10100pd(1,255)| +-- error ER_STACK_OVERRUN_NEED_MORE +call bug10100pc(1,255)| +-- enable_result_log +set @@max_sp_recursion_depth=0| + +deallocate prepare stmt2| + +drop function bug10100f| +drop procedure bug10100p| +drop procedure bug10100t| +drop procedure bug10100pt| +drop procedure bug10100pv| +drop procedure bug10100pd| +drop procedure bug10100pc| +drop view v1| + +# +# BUG#13729: Stored procedures: packet error after exception handled +# +--disable_warnings +drop procedure if exists bug13729| +drop table if exists t3| +--enable_warnings + +create table t3 (s1 int, primary key (s1))| + +insert into t3 values (1),(2)| + +create procedure bug13729() +begin + declare continue handler for sqlexception select 55; + + update t3 set s1 = 1; +end| + +call bug13729()| +# Used to cause Packets out of order +select * from t3| + +drop procedure bug13729| +drop table t3| + +# +# BUG#14643: Stored Procedure: Continuing after failed var. initialization +# crashes server. +# +--disable_warnings +drop procedure if exists bug14643_1| +drop procedure if exists bug14643_2| +--enable_warnings + +create procedure bug14643_1() +begin + declare continue handler for sqlexception select 'boo' as 'Handler'; + + begin + declare v int default x; + + if v = 1 then + select 1; + else + select 2; + end if; + end; +end| + +create procedure bug14643_2() +begin + declare continue handler for sqlexception select 'boo' as 'Handler'; + + case x + when 1 then + select 1; + else + select 2; + end case; +end| + +call bug14643_1()| +call bug14643_2()| + +drop procedure bug14643_1| +drop procedure bug14643_2| + +# +# BUG#14304: auto_increment field incorrect set in SP +# +--disable_warnings +drop procedure if exists bug14304| +drop table if exists t3, t4| +--enable_warnings + +create table t3(a int primary key auto_increment)| +create table t4(a int primary key auto_increment)| + +create procedure bug14304() +begin + insert into t3 set a=null; + insert into t4 set a=null; + insert into t4 set a=null; + insert into t4 set a=null; + insert into t4 set a=null; + insert into t4 set a=null; + insert into t4 select null as a; + + insert into t3 set a=null; + insert into t3 set a=null; + + select * from t3; +end| + +call bug14304()| + +drop procedure bug14304| +drop table t3, t4| + +# +# BUG#14376: MySQL crash on scoped variable (re)initialization +# +--disable_warnings +drop procedure if exists bug14376| +--enable_warnings + +create procedure bug14376() +begin + declare x int default x; +end| + +# Not the error we want, but that's what we got for now... +--error ER_BAD_FIELD_ERROR +call bug14376()| +drop procedure bug14376| + +create procedure bug14376() +begin + declare x int default 42; + + begin + declare x int default x; + + select x; + end; +end| + +call bug14376()| + +drop procedure bug14376| + +create procedure bug14376(x int) +begin + declare x int default x; + + select x; +end| + +call bug14376(4711)| + +drop procedure bug14376| + + + # # BUG#NNNN: New bug synopsis # diff --git a/mysql-test/t/sp_trans.test b/mysql-test/t/sp_trans.test index 82e1cd2f1c9..308d4ad5c33 100644 --- a/mysql-test/t/sp_trans.test +++ b/mysql-test/t/sp_trans.test @@ -175,6 +175,250 @@ drop function bug10015_7| drop table t1, t2| +# +# BUG#13825 "Triggers: crash if release savepoint". +# Also general test for handling of savepoints in stored routines. +# +# According to SQL standard we should establish new savepoint +# level before executing stored function/trigger and destroy +# this savepoint level after execution. Stored procedures by +# default should be executed using the same savepoint level +# as their caller (to execute stored procedure using new +# savepoint level one should explicitly specify NEW SAVEPOINT +# LEVEL clause in procedure creation statement which MySQL +# does not support yet). +--disable_warnings +drop function if exists bug13825_0| +drop function if exists bug13825_1| +drop function if exists bug13825_2| +drop function if exists bug13825_3| +drop function if exists bug13825_4| +drop function if exists bug13825_5| +drop procedure if exists bug13825_0| +drop procedure if exists bug13825_1| +drop procedure if exists bug13825_2| +drop table if exists t1| +--enable_warnings +create table t1 (i int) engine=innodb| +create table t2 (i int) engine=innodb| +create function bug13825_0() returns int +begin + rollback to savepoint x; + return 1; +end| +create function bug13825_1() returns int +begin + release savepoint x; + return 1; +end| +create function bug13825_2() returns int +begin + insert into t1 values (2); + savepoint x; + insert into t1 values (3); + rollback to savepoint x; + insert into t1 values (4); + return 1; +end| +create procedure bug13825_0() +begin + rollback to savepoint x; +end| +create procedure bug13825_1() +begin + release savepoint x; +end| +create procedure bug13825_2() +begin + savepoint x; +end| +insert into t2 values (1)| +create trigger t2_bi before insert on t2 for each row + rollback to savepoint x| +create trigger t2_bu before update on t2 for each row + release savepoint x| +create trigger t2_bd before delete on t2 for each row +begin + insert into t1 values (2); + savepoint x; + insert into t1 values (3); + rollback to savepoint x; + insert into t1 values (4); +end| +create function bug13825_3(rb int) returns int +begin + insert into t1 values(1); + savepoint x; + insert into t1 values(2); + if rb then + rollback to savepoint x; + end if; + insert into t1 values(3); + return rb; +end| +create function bug13825_4() returns int +begin + savepoint x; + insert into t1 values(2); + rollback to savepoint x; + return 0; +end| +create function bug13825_5(p int) returns int +begin + savepoint x; + insert into t2 values(p); + rollback to savepoint x; + insert into t2 values(p+1); + return p; +end| +set autocommit= 0| +# Test of savepoint level handling for stored functions and triggers +begin | +insert into t1 values (1)| +savepoint x| +--error ER_SP_DOES_NOT_EXIST +set @a:= bug13825_0()| +--error ER_SP_DOES_NOT_EXIST +insert into t2 values (2)| +--error ER_SP_DOES_NOT_EXIST +set @a:= bug13825_1()| +--error ER_SP_DOES_NOT_EXIST +update t2 set i = 2| +set @a:= bug13825_2()| +select * from t1| +rollback to savepoint x| +select * from t1| +delete from t2| +select * from t1| +rollback to savepoint x| +select * from t1| +# Of course savepoints set in function should not be visible from its caller +release savepoint x| +set @a:= bug13825_2()| +select * from t1| +--error ER_SP_DOES_NOT_EXIST +rollback to savepoint x| +delete from t1| +commit| +# Test of savepoint level handling for stored procedures +begin| +insert into t1 values (5)| +savepoint x| +insert into t1 values (6)| +call bug13825_0()| +select * from t1| +call bug13825_1()| +--error ER_SP_DOES_NOT_EXIST +rollback to savepoint x| +savepoint x| +insert into t1 values (7)| +call bug13825_2()| +rollback to savepoint x| +select * from t1| +delete from t1| +commit| +set autocommit= 1| +# Let us test that savepoints work inside of functions +# even in auto-commit mode +select bug13825_3(0)| +select * from t1| +delete from t1| +select bug13825_3(1)| +select * from t1| +delete from t1| +# Curious case: rolling back to savepoint which is set by first +# statement in function should not rollback whole transaction. +set autocommit= 0| +begin| +insert into t1 values (1)| +set @a:= bug13825_4()| +select * from t1| +delete from t1| +commit| +set autocommit= 1| +# Other curious case: savepoint in the middle of statement +drop table t2| +create table t2 (i int) engine=innodb| +insert into t1 values (1), (bug13825_5(2)), (3)| +select * from t1| +select * from t2| +# Cleanup +drop function bug13825_0| +drop function bug13825_1| +drop function bug13825_2| +drop function bug13825_3| +drop function bug13825_4| +drop function bug13825_5| +drop procedure bug13825_0| +drop procedure bug13825_1| +drop procedure bug13825_2| +drop table t1, t2| + + +# +# BUG#14840: CONTINUE handler problem +# +--disable_warnings +drop table if exists t3| +drop procedure if exists bug14840_1| +drop procedure if exists bug14840_2| +--enable_warnings + +create table t3 +( + x int, + y int, + primary key (x) +) engine=InnoDB| + +# This used to hang the client since the insert returned with an +# error status (left over from the update) even though it succeeded, +# which caused the execution to end at that point. +create procedure bug14840_1() +begin + declare err int default 0; + declare continue handler for sqlexception + set err = err + 1; + + start transaction; + update t3 set x = 1, y = 42 where x = 2; + insert into t3 values (3, 4711); + if err > 0 then + rollback; + else + commit; + end if; + select * from t3; +end| + +# A simpler (non-transactional) case: insert at select should be done +create procedure bug14840_2() +begin + declare err int default 0; + declare continue handler for sqlexception + begin + set err = err + 1; + select err as 'Ping'; + end; + + update t3 set x = 1, y = 42 where x = 2; + update t3 set x = 1, y = 42 where x = 2; + insert into t3 values (3, 4711); + select * from t3; +end| + +insert into t3 values (1, 3), (2, 5)| +call bug14840_1()| + +delete from t3| +insert into t3 values (1, 3), (2, 5)| +call bug14840_2()| + +drop procedure bug14840_1| +drop procedure bug14840_2| +drop table t3| + + # # BUG#NNNN: New bug synopsis # diff --git a/mysql-test/t/strict.test b/mysql-test/t/strict.test index d3b36cbc2a8..54260b09331 100644 --- a/mysql-test/t/strict.test +++ b/mysql-test/t/strict.test @@ -884,11 +884,11 @@ INSERT INTO t1 (col1,col2,col3) VALUES (NULL, '', '2004-01-01'); INSERT INTO t1 (col1,col2,col3) VALUES (102, NULL, '2004-01-01'); --error 1048 INSERT INTO t1 VALUES (103,'',NULL); ---error 1263 +--error 1048 UPDATE t1 SET col1=NULL WHERE col1 =100; ---error 1263 +--error 1048 UPDATE t1 SET col2 =NULL WHERE col2 ='hello'; ---error 1263 +--error 1048 UPDATE t1 SET col2 =NULL where col3 IS NOT NULL; INSERT IGNORE INTO t1 values (NULL,NULL,NULL); SELECT * FROM t1; @@ -908,7 +908,7 @@ INSERT INTO t1 (col1) VALUES (2); INSERT INTO t1 VALUES(default(col1),default(col2)); --error 1364 INSERT INTO t1 (col1) SELECT 1; ---error 1263 +--error 1048 INSERT INTO t1 SELECT 1,NULL; INSERT IGNORE INTO t1 values (NULL,NULL); INSERT IGNORE INTO t1 (col1) values (3); diff --git a/mysql-test/t/subselect_innodb.test b/mysql-test/t/subselect_innodb.test index a07cc93ad68..4bfc4d17588 100644 --- a/mysql-test/t/subselect_innodb.test +++ b/mysql-test/t/subselect_innodb.test @@ -183,3 +183,57 @@ group by country; drop table t1; +# +# BUG#14342: wrong placement of subquery internals in complex queries +# +CREATE TABLE `t1` ( + `t3_id` int NOT NULL, + `t1_id` int NOT NULL, + PRIMARY KEY (`t1_id`) +); +CREATE TABLE `t2` ( + `t2_id` int NOT NULL, + `t1_id` int NOT NULL, + `b` int NOT NULL, + PRIMARY KEY (`t2_id`), + UNIQUE KEY `idx_t2_t1_b` (`t1_id`,`b`) +) ENGINE=InnoDB; +CREATE TABLE `t3` ( + `t3_id` int NOT NULL +); +INSERT INTO `t3` VALUES (3); +select + (SELECT rs.t2_id + FROM t2 rs + WHERE rs.t1_id= + (SELECT lt.t1_id + FROM t1 lt + WHERE lt.t3_id=a.t3_id) + ORDER BY b DESC LIMIT 1) +from t3 AS a; +# repeat above query in SP +--disable_warnings +DROP PROCEDURE IF EXISTS p1; +--enable_warnings +delimiter //; +create procedure p1() +begin + declare done int default 3; + repeat + select + (SELECT rs.t2_id + FROM t2 rs + WHERE rs.t1_id= + (SELECT lt.t1_id + FROM t1 lt + WHERE lt.t3_id=a.t3_id) + ORDER BY b DESC LIMIT 1) as x + from t3 AS a; + set done= done-1; + until done <= 0 end repeat; +end// +delimiter ;// +call p1(); +call p1(); +call p1(); +drop tables t1,t2,t3; diff --git a/mysql-test/t/temp_table.test b/mysql-test/t/temp_table.test index 6b3991c9c78..2d505fdfece 100644 --- a/mysql-test/t/temp_table.test +++ b/mysql-test/t/temp_table.test @@ -115,3 +115,15 @@ select d, c from t1 left join t2 on b = c where a = 3 order by d; drop table t1, t2; # End of 4.1 tests + +# +# Test truncate with temporary tables +# + +create temporary table t1 (a int); +insert into t1 values (4711); +select * from t1; +truncate t1; +insert into t1 values (42); +select * from t1; +drop table t1; diff --git a/mysql-test/t/trigger-compat.test b/mysql-test/t/trigger-compat.test new file mode 100644 index 00000000000..c2acc235135 --- /dev/null +++ b/mysql-test/t/trigger-compat.test @@ -0,0 +1,83 @@ +# Test case(s) in this file contain(s) GRANT/REVOKE statements, which are not +# supported in embedded server. So, this test should not be run on embedded +# server. + +-- source include/not_embedded.inc + +########################################################################### +# +# Tests for WL#2818: +# - Check that triggers created w/o DEFINER information work well: +# - create the first trigger; +# - manually remove definer information from corresponding TRG file; +# - create the second trigger (the first trigger will be reloaded; check +# that we receive a warning); +# - check that the triggers loaded correctly; +# +########################################################################### + +# +# Prepare environment. +# + +DELETE FROM mysql.user WHERE User LIKE 'mysqltest_%'; +DELETE FROM mysql.db WHERE User LIKE 'mysqltest_%'; +DELETE FROM mysql.tables_priv WHERE User LIKE 'mysqltest_%'; +DELETE FROM mysql.columns_priv WHERE User LIKE 'mysqltest_%'; +FLUSH PRIVILEGES; + +--disable_warnings +DROP DATABASE IF EXISTS mysqltest_db1; +--enable_warnings + +CREATE DATABASE mysqltest_db1; + +CREATE USER mysqltest_dfn@localhost; +CREATE USER mysqltest_inv@localhost; + +GRANT SUPER ON *.* TO mysqltest_dfn@localhost; +GRANT CREATE ON mysqltest_db1.* TO mysqltest_dfn@localhost; + +# +# Create a table and the first trigger. +# + +--connect (wl2818_definer_con,localhost,mysqltest_dfn,,mysqltest_db1) +--connection wl2818_definer_con +--echo +--echo ---> connection: wl2818_definer_con + +CREATE TABLE t1(num_value INT); +CREATE TABLE t2(user_str TEXT); + +CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1 + FOR EACH ROW + INSERT INTO t2 VALUES(CURRENT_USER()); + +# +# Remove definers from TRG file. +# + +--echo +--echo ---> patching t1.TRG... + +--exec grep -v 'definers=' $MYSQL_TEST_DIR/var/master-data/mysqltest_db1/t1.TRG > $MYSQL_TEST_DIR/var/tmp/t1.TRG +--exec mv $MYSQL_TEST_DIR/var/tmp/t1.TRG $MYSQL_TEST_DIR/var/master-data/mysqltest_db1/t1.TRG + +# +# Create a new trigger. +# + +--echo + +CREATE TRIGGER wl2818_trg2 AFTER INSERT ON t1 + FOR EACH ROW + INSERT INTO t2 VALUES(CURRENT_USER()); + +--echo + +SELECT trigger_name, definer FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name; + +--echo + +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name; diff --git a/mysql-test/t/trigger-grant.test b/mysql-test/t/trigger-grant.test new file mode 100644 index 00000000000..deeaeacbccc --- /dev/null +++ b/mysql-test/t/trigger-grant.test @@ -0,0 +1,475 @@ +# Test case(s) in this file contain(s) GRANT/REVOKE statements, which are not +# supported in embedded server. So, this test should not be run on embedded +# server. + +-- source include/not_embedded.inc + +########################################################################### +# +# Tests for WL#2818: +# - Check that triggers are executed under the authorization of the definer. +# - Check that if trigger contains NEW/OLD variables, the definer must have +# SELECT privilege on the subject table. +# - Check DEFINER clause of CREATE TRIGGER statement; +# - Check that SUPER privilege required to create a trigger with different +# definer. +# - Check that if the user specified as DEFINER does not exist, a warning +# is emitted. +# - Check that the definer of a trigger does not exist, the trigger will +# not be activated. +# - Check that SHOW TRIGGERS statement provides "Definer" column. +# +# Let's also check that user name part of definer can contain '@' symbol (to +# check that triggers are not affected by BUG#13310 "incorrect user parsing +# by SP"). +# +########################################################################### + +# +# Prepare environment. +# + +DELETE FROM mysql.user WHERE User LIKE 'mysqltest_%'; +DELETE FROM mysql.db WHERE User LIKE 'mysqltest_%'; +DELETE FROM mysql.tables_priv WHERE User LIKE 'mysqltest_%'; +DELETE FROM mysql.columns_priv WHERE User LIKE 'mysqltest_%'; +FLUSH PRIVILEGES; + +--disable_warnings +DROP DATABASE IF EXISTS mysqltest_db1; +--enable_warnings + +CREATE DATABASE mysqltest_db1; + +CREATE USER mysqltest_dfn@localhost; +CREATE USER mysqltest_inv@localhost; + +GRANT SUPER ON *.* TO mysqltest_dfn@localhost; +GRANT CREATE ON mysqltest_db1.* TO mysqltest_dfn@localhost; + +# +# Check that triggers are executed under the authorization of the definer: +# - create two tables under "definer"; +# - grant all privileges on the test db to "definer"; +# - grant all privileges on the first table to "invoker"; +# - grant only select privilege on the second table to "invoker"; +# - create a trigger, which inserts a row into the second table after +# inserting into the first table. +# - insert a row into the first table under "invoker". A row also should be +# inserted into the second table. +# + +--connect (wl2818_definer_con,localhost,mysqltest_dfn,,mysqltest_db1) +--connection wl2818_definer_con +--echo +--echo ---> connection: wl2818_definer_con + +CREATE TABLE t1(num_value INT); +CREATE TABLE t2(user_str TEXT); + +CREATE TRIGGER trg1 AFTER INSERT ON t1 + FOR EACH ROW + INSERT INTO t2 VALUES(CURRENT_USER()); + +--connection default +--echo +--echo ---> connection: default + +# Setup definer's privileges. + +GRANT ALL PRIVILEGES ON mysqltest_db1.t1 TO mysqltest_dfn@localhost; +GRANT ALL PRIVILEGES ON mysqltest_db1.t2 TO mysqltest_dfn@localhost; + +# Setup invoker's privileges. + +GRANT ALL PRIVILEGES ON mysqltest_db1.t1 + TO 'mysqltest_inv'@localhost; + +GRANT SELECT ON mysqltest_db1.t2 + TO 'mysqltest_inv'@localhost; + +--connection wl2818_definer_con +--echo +--echo ---> connection: wl2818_definer_con + +use mysqltest_db1; + +INSERT INTO t1 VALUES(1); + +SELECT * FROM t1; +SELECT * FROM t2; + +--connect (wl2818_invoker_con,localhost,mysqltest_inv,,mysqltest_db1) +--connection wl2818_invoker_con +--echo +--echo ---> connection: wl2818_invoker_con + +use mysqltest_db1; + +INSERT INTO t1 VALUES(2); + +SELECT * FROM t1; +SELECT * FROM t2; + +# +# Check that if definer lost some privilege required to execute (activate) a +# trigger, the trigger will not be activated: +# - create a trigger on insert into the first table, which will insert a row +# into the second table; +# - revoke INSERT privilege on the second table from the definer; +# - insert a row into the first table; +# - check that an error has been risen; +# - check that no row has been inserted into the second table; +# + +--connection default +--echo +--echo ---> connection: default + +use mysqltest_db1; + +REVOKE INSERT ON mysqltest_db1.t2 FROM mysqltest_dfn@localhost; + +--connection wl2818_invoker_con +--echo +--echo ---> connection: wl2818_invoker_con + +use mysqltest_db1; + +--error ER_TABLEACCESS_DENIED_ERROR +INSERT INTO t1 VALUES(3); + +SELECT * FROM t1; +SELECT * FROM t2; + +# +# Check that if trigger contains NEW/OLD variables, the definer must have +# SELECT/UPDATE privilege on the subject table: +# - drop the trigger; +# - create a new trigger, which will use NEW variable; +# - create another new trigger, which will use OLD variable; +# - revoke SELECT/UPDATE privilege on the first table from "definer"; +# - insert a row into the first table; +# - analyze error code; +# + +# +# SELECT privilege. +# + +--connection default +--echo +--echo ---> connection: default + +use mysqltest_db1; + +REVOKE SELECT ON mysqltest_db1.t1 FROM mysqltest_dfn@localhost; + +--connection wl2818_definer_con +--echo +--echo ---> connection: wl2818_definer_con + +use mysqltest_db1; + +DROP TRIGGER trg1; + +SET @new_sum = 0; +SET @old_sum = 0; + +# INSERT INTO statement; BEFORE timing + +--echo ---> INSERT INTO statement; BEFORE timing + +CREATE TRIGGER trg1 BEFORE INSERT ON t1 + FOR EACH ROW + SET @new_sum = @new_sum + NEW.num_value; + +--error ER_TABLEACCESS_DENIED_ERROR +INSERT INTO t1 VALUES(4); + +# INSERT INTO statement; AFTER timing + +--echo ---> INSERT INTO statement; AFTER timing + +DROP TRIGGER trg1; + +CREATE TRIGGER trg1 AFTER INSERT ON t1 + FOR EACH ROW + SET @new_sum = @new_sum + NEW.num_value; + +--error ER_TABLEACCESS_DENIED_ERROR +INSERT INTO t1 VALUES(5); + +# UPDATE statement; BEFORE timing + +--echo ---> UPDATE statement; BEFORE timing + +DROP TRIGGER trg1; + +CREATE TRIGGER trg1 BEFORE UPDATE ON t1 + FOR EACH ROW + SET @old_sum = @old_sum + OLD.num_value; + +--error ER_TABLEACCESS_DENIED_ERROR +UPDATE t1 SET num_value = 10; + +# UPDATE statement; AFTER timing + +--echo ---> UPDATE statement; AFTER timing + +DROP TRIGGER trg1; + +CREATE TRIGGER trg1 AFTER UPDATE ON t1 + FOR EACH ROW + SET @new_sum = @new_sum + NEW.num_value; + +--error ER_TABLEACCESS_DENIED_ERROR +UPDATE t1 SET num_value = 20; + +# DELETE statement; BEFORE timing + +--echo ---> DELETE statement; BEFORE timing + +DROP TRIGGER trg1; + +CREATE TRIGGER trg1 BEFORE DELETE ON t1 + FOR EACH ROW + SET @old_sum = @old_sum + OLD.num_value; + +--error ER_TABLEACCESS_DENIED_ERROR +DELETE FROM t1; + +# DELETE statement; AFTER timing + +--echo ---> DELETE statement; AFTER timing + +DROP TRIGGER trg1; + +CREATE TRIGGER trg1 AFTER DELETE ON t1 + FOR EACH ROW + SET @old_sum = @old_sum + OLD.num_value; + +--error ER_TABLEACCESS_DENIED_ERROR +DELETE FROM t1; + +# +# UPDATE privilege +# +# NOTE: At the moment, UPDATE privilege is required if the trigger contains +# NEW/OLD variables, whenever the trigger modifies them or not. Moreover, +# UPDATE privilege is checked for whole table, not for individual columns. +# +# The following test cases should be changed when full support of UPDATE +# privilege will be done. +# + +--connection default +--echo +--echo ---> connection: default + +use mysqltest_db1; + +GRANT SELECT ON mysqltest_db1.t1 TO mysqltest_dfn@localhost; +REVOKE UPDATE ON mysqltest_db1.t1 FROM mysqltest_dfn@localhost; + +--connection wl2818_definer_con +--echo +--echo ---> connection: wl2818_definer_con + +use mysqltest_db1; + +DROP TRIGGER trg1; + +SET @new_sum = 0; +SET @old_sum = 0; + +# INSERT INTO statement; BEFORE timing + +--echo ---> INSERT INTO statement; BEFORE timing + +CREATE TRIGGER trg1 BEFORE INSERT ON t1 + FOR EACH ROW + SET @new_sum = @new_sum + NEW.num_value; + +--error ER_TABLEACCESS_DENIED_ERROR +INSERT INTO t1 VALUES(4); + +# INSERT INTO statement; AFTER timing + +--echo ---> INSERT INTO statement; AFTER timing + +DROP TRIGGER trg1; + +CREATE TRIGGER trg1 AFTER INSERT ON t1 + FOR EACH ROW + SET @new_sum = @new_sum + NEW.num_value; + +--error ER_TABLEACCESS_DENIED_ERROR +INSERT INTO t1 VALUES(5); + +# UPDATE statement; BEFORE timing + +--echo ---> UPDATE statement; BEFORE timing + +DROP TRIGGER trg1; + +CREATE TRIGGER trg1 BEFORE UPDATE ON t1 + FOR EACH ROW + SET @old_sum = @old_sum + OLD.num_value; + +--error ER_TABLEACCESS_DENIED_ERROR +UPDATE t1 SET num_value = 10; + +# UPDATE statement; AFTER timing + +--echo ---> UPDATE statement; AFTER timing + +DROP TRIGGER trg1; + +CREATE TRIGGER trg1 AFTER UPDATE ON t1 + FOR EACH ROW + SET @new_sum = @new_sum + NEW.num_value; + +--error ER_TABLEACCESS_DENIED_ERROR +UPDATE t1 SET num_value = 20; + +# DELETE statement; BEFORE timing + +--echo ---> DELETE statement; BEFORE timing + +DROP TRIGGER trg1; + +CREATE TRIGGER trg1 BEFORE DELETE ON t1 + FOR EACH ROW + SET @old_sum = @old_sum + OLD.num_value; + +--error ER_TABLEACCESS_DENIED_ERROR +DELETE FROM t1; + +# DELETE statement; AFTER timing + +--echo ---> DELETE statement; AFTER timing + +DROP TRIGGER trg1; + +CREATE TRIGGER trg1 AFTER DELETE ON t1 + FOR EACH ROW + SET @old_sum = @old_sum + OLD.num_value; + +--error ER_TABLEACCESS_DENIED_ERROR +DELETE FROM t1; + +# +# Check DEFINER clause of CREATE TRIGGER statement. +# +# NOTE: there is no dedicated TRIGGER privilege for CREATE TRIGGER statement. +# SUPER privilege is used instead. I.e., if one invokes CREATE TRIGGER, it should +# have SUPER privilege, so this test is meaningless right now. +# +# - Check that SUPER privilege required to create a trigger with different +# definer: +# - try to create a trigger with DEFINER="definer@localhost" under +# "invoker"; +# - analyze error code; +# - Check that if the user specified as DEFINER does not exist, a warning is +# emitted: +# - create a trigger with DEFINER="non_existent_user@localhost" from +# "definer"; +# - check that a warning emitted; +# - Check that the definer of a trigger does not exist, the trigger will not +# be activated: +# - activate just created trigger; +# - check error code; +# + +--connection wl2818_definer_con +--echo +--echo ---> connection: wl2818_definer_con + +use mysqltest_db1; + +DROP TRIGGER trg1; + +# Check that SUPER is required to specify different DEFINER. +# NOTE: meaningless at the moment + +CREATE DEFINER='mysqltest_inv'@'localhost' + TRIGGER trg1 BEFORE INSERT ON t1 + FOR EACH ROW + SET @new_sum = 0; + +# Create with non-existent user. + +CREATE DEFINER='mysqltest_nonexs'@'localhost' + TRIGGER trg2 AFTER INSERT ON t1 + FOR EACH ROW + SET @new_sum = 0; + +# Check that trg2 will not be activated. + +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +INSERT INTO t1 VALUES(6); + +# +# Check that SHOW TRIGGERS statement provides "Definer" column. +# + +SHOW TRIGGERS; + +# +# Check that weird definer values do not break functionality. I.e. check the +# following definer values: +# - ''; +# - '@'; +# - '@abc@def@@'; +# - '@hostname'; +# - '@abc@def@@@hostname'; +# + +DROP TRIGGER trg1; +DROP TRIGGER trg2; + +CREATE TRIGGER trg1 BEFORE INSERT ON t1 + FOR EACH ROW + SET @a = 1; + +CREATE TRIGGER trg2 AFTER INSERT ON t1 + FOR EACH ROW + SET @a = 2; + +CREATE TRIGGER trg3 BEFORE UPDATE ON t1 + FOR EACH ROW + SET @a = 3; + +CREATE TRIGGER trg4 AFTER UPDATE ON t1 + FOR EACH ROW + SET @a = 4; + +CREATE TRIGGER trg5 BEFORE DELETE ON t1 + FOR EACH ROW + SET @a = 5; + +--exec egrep -v '^definers=' $MYSQL_TEST_DIR/var/master-data/mysqltest_db1/t1.TRG > $MYSQL_TEST_DIR/var/tmp/t1.TRG +--exec echo "definers='' '@' '@abc@def@@' '@hostname' '@abcdef@@@hostname'" >> $MYSQL_TEST_DIR/var/tmp/t1.TRG +--exec mv $MYSQL_TEST_DIR/var/tmp/t1.TRG $MYSQL_TEST_DIR/var/master-data/mysqltest_db1/t1.TRG + +--echo + +SELECT trigger_name, definer FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name; + +--echo + +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name; + +# +# Cleanup +# + +--connection default +--echo +--echo ---> connection: default + +DROP USER mysqltest_dfn@localhost; +DROP USER mysqltest_inv@localhost; + +DROP DATABASE mysqltest_db1; diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test index cd79eb82ace..d4fa5268762 100644 --- a/mysql-test/t/trigger.test +++ b/mysql-test/t/trigger.test @@ -743,8 +743,12 @@ create trigger t1_ai after insert on t1 for each row insert into t2 values (new.f1+1); create trigger t2_ai after insert on t2 for each row insert into t1 values (new.f2+1); +# Allow SP resursion to be show that it has not influence here +set @SAVE_SP_RECURSION_LEVELS=@@max_sp_recursion_depth; +set @@max_sp_recursion_depth=100; --error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG insert into t1 values (1); +set @@max_sp_recursion_depth=@SAVE_SP_RECURSION_LEVELS; select * from t1; select * from t2; drop trigger t1_ai; @@ -875,3 +879,70 @@ drop function f1; drop view v1; drop table t1, t2, t3; --enable_parsing + +# +# Test for bug #13399 "Crash when executing PS/SP which should activate +# trigger which is now dropped". See also test for similar bug for stored +# routines in sp-error.test (#12329). +create table t1 (id int); +create table t2 (id int); +create trigger t1_bi before insert on t1 for each row insert into t2 values (new.id); +prepare stmt1 from "insert into t1 values (10)"; +create procedure p1() insert into t1 values (10); +call p1(); +# Actually it is enough to do FLUSH TABLES instead of DROP TRIGGER +drop trigger t1_bi; +# Server should not crash on these two statements +execute stmt1; +call p1(); +deallocate prepare stmt1; +drop procedure p1; + +# Let us test more complex situation when we alter trigger in such way that +# it uses different set of tables (or simply add new trigger). +create table t3 (id int); +create trigger t1_bi after insert on t1 for each row insert into t2 values (new.id); +prepare stmt1 from "insert into t1 values (10)"; +create procedure p1() insert into t1 values (10); +call p1(); +# Altering trigger forcing it use different set of tables +drop trigger t1_bi; +create trigger t1_bi after insert on t1 for each row insert into t3 values (new.id); +# Until we implement proper mechanism for invalidation of PS/SP when table +# or SP's are changed these two statements will fail with 'Table ... was +# not locked' error (this mechanism should be based on the new TDC). +--error 1100 +execute stmt1; +--error 1100 +call p1(); +deallocate prepare stmt1; +drop procedure p1; +drop table t1, t2, t3; + +# +# BUG#13549 "Server crash with nested stored procedures". +# Server should not crash when during execution of stored procedure +# we have to parse trigger/function definition and this new trigger/ +# function has more local variables declared than invoking stored +# procedure and last of these variables is used in argument of NOT +# operator. +# +create table t1 (a int); +--disable_warnings +drop procedure if exists p2; +--enable_warnings +DELIMITER //; +CREATE PROCEDURE `p2`() +begin + insert into t1 values (1); +end// +create trigger trg before insert on t1 for each row +begin + declare done int default 0; + set done= not done; +end// +DELIMITER ;// +CALL p2(); +drop procedure p2; +drop table t1; + diff --git a/mysql-test/t/type_binary.test b/mysql-test/t/type_binary.test index b5928cb14c4..451363c1ae4 100644 --- a/mysql-test/t/type_binary.test +++ b/mysql-test/t/type_binary.test @@ -65,3 +65,6 @@ select hex(s1) from t1 where s1=0x0120; select hex(s1) from t1 where s1=0x0100; select count(distinct s1) from t1; drop table t1; + +# check that cast appends trailing zeros +select hex(cast(0x10 as binary(2))); diff --git a/mysql-test/t/type_newdecimal-big.test b/mysql-test/t/type_newdecimal-big.test new file mode 100644 index 00000000000..e200017f2ba --- /dev/null +++ b/mysql-test/t/type_newdecimal-big.test @@ -0,0 +1,31 @@ +--source include/big_test.inc + +--disable_warnings +drop procedure if exists sp1; +--enable_warnings + +# +#-- 2. Adding (one millionth) one million times should be the same as +#-- adding 1. So a stored procedure with many iterations will show if +#-- small errors accumulate. +# + +delimiter //; +# +create procedure sp1 () begin + declare v1, v2, v3, v4 decimal(16,12); declare v5 int; + set v1 = 1; set v2 = 2; set v3 = 1000000000000; set v4 = 2000000000000; set v5 = 0; + while v5 < 100000 do + set v1 = v1 + 0.000000000001; set v2 = v2 - 0.000000000001; set v3 = v3 + 1; set v4 = v4 - 1; set v5 = v5 + 1; + end while; select v1, v2, v3 * 0.000000000001, v4 * 0.000000000001; end;// +# +call sp1()// +#-- should return +# -- v1=1.0000001 +# -- v2=1.999999900000 +# -- v3=1.0000001 +# -- v4=1.999999900000 +# +delimiter ;// +# +drop procedure sp1; diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test index 93a1a1afa45..e2fe9767432 100644 --- a/mysql-test/t/type_newdecimal.test +++ b/mysql-test/t/type_newdecimal.test @@ -473,7 +473,7 @@ drop table wl1612_4; # #-- Additional tests for WL#1612 Precision math # -#-- 1. Comparisons should show that a number is +#-- Comparisons should show that a number is #-- exactly equal to its value as displayed. # set sql_mode=''; @@ -487,34 +487,9 @@ select 18.3=18.3; select -18.3=18.3; # select 0.8 = 0.7 + 0.1; + # -#-- 2. Adding (one millionth) one million times should be the same as -#-- adding 1. So a stored procedure with many iterations will show if -#-- small errors accumulate. -# -#drop procedure p1; -# -delimiter //; -# -create procedure p1 () begin - declare v1, v2, v3, v4 decimal(16,12); declare v5 int; - set v1 = 1; set v2 = 2; set v3 = 1000000000000; set v4 = 2000000000000; set v5 = 0; - while v5 < 100000 do - set v1 = v1 + 0.000000000001; set v2 = v2 - 0.000000000001; set v3 = v3 + 1; set v4 = v4 - 1; set v5 = v5 + 1; - end while; select v1, v2, v3 * 0.000000000001, v4 * 0.000000000001; end;// -# -call p1()// -#-- should return -# -- v1=1.0000001 -# -- v2=1.999999900000 -# -- v3=1.0000001 -# -- v4=1.999999900000 -# -delimiter ;// -# -drop procedure p1; -# -#-- 3. It should be possible to define a column +#-- It should be possible to define a column #-- with up to 38 digits precision either before #-- or after the decimal point. Any number which #-- is inserted, if it's within the range, should @@ -565,7 +540,7 @@ select * from t1; # drop table t1; # -#-- 4. The usual arithmetic operators / * + - should work. +#-- The usual arithmetic operators / * + - should work. # #select 77777777777777777777777777777777777777 / 7777777777777777777777777777777777777 = 10; #-- should return 0 (false). @@ -668,7 +643,7 @@ select truncate(99999999999999999999999999999999999999,-31); #drop procedure p1; #drop table t1; # -#-- 7. When I say DECIMAL(x) I should be able to store x digits. +#-- When I say DECIMAL(x) I should be able to store x digits. #-- If I can't, there should be an error at CREATE time. # #drop table if exists t1; @@ -676,7 +651,8 @@ select truncate(99999999999999999999999999999999999999,-31); #create table t1 (col1 decimal(254)); #-- should return SQLSTATE 22003 numeric value out of range # -#-- 8. When I say DECIMAL(x,y) there should be no silent change of precision or scale. +#-- When I say DECIMAL(x,y) there should be no silent change of precision or +#-- scale. # #drop table if exists t1; # @@ -694,7 +670,7 @@ select truncate(99999999999999999999999999999999999999,-31); # #drop table t1; # -#-- 9. From WL#1612 "The future" point 2.: +#-- From WL#1612 "The future" point 2.: #-- The standard requires that we treat numbers like "0.5" as #-- DECIMAL or NUMERIC, not as floating-point. # @@ -715,7 +691,7 @@ show create table t1; # drop table t1; # -#-- 10. From WL#1612, "The future", point 3.: We have to start rounding correctly. +#-- From WL#1612, "The future", point 3.: We have to start rounding correctly. # select round(1.5),round(2.5); #-- should return: @@ -725,13 +701,13 @@ select round(1.5),round(2.5); #| 2 | 3 | #+------------+------------+ # -#-- 11. From WL#1612, "The future", point 4.: "select 0.07 * 0.07;" should return 0.0049, not 0.00. +#-- From WL#1612, "The future", point 4.: "select 0.07 * 0.07;" should return 0.0049, not 0.00. #-- If operand#1 has scale X and operand#2 has scale Y, then result should have scale (X+Y). # select 0.07 * 0.07; #-- should return 0.0049 # -#-- 12. From WL#1612, "The future", point 5.: Division by zero is an error. +#-- From WL#1612, "The future", point 5.: Division by zero is an error. # set sql_mode='traditional'; # @@ -752,7 +728,7 @@ select 1 / 0; #+-------+ #1 row in set, 1 warning (0.00 sec) # -#-- 13. From WL#1612 "The future" point 6.: Overflow is an error. +#-- From WL#1612 "The future" point 6.: Overflow is an error. # #set sql_mode=''; # @@ -793,7 +769,8 @@ select 1 / 0; #drop table t2; #drop table t1; # -#-- 15. From WL#1612 "The future" point 8.: Stop storing leading "+" signs and leading "0"s. +#-- From WL#1612 "The future" point 8.: Stop storing leading "+" signs and +# leading "0"s. # #drop table if exists t1; # @@ -805,7 +782,7 @@ select 1 / 0; # #drop table t1; # -#-- 16. From WL#1612, The future" point 9.: +#-- From WL#1612, The future" point 9.: #-- Accept the data type and precision and scale as the user #-- asks, or return an error, but don't change to something else. # @@ -817,7 +794,7 @@ select 1 / 0; # #drop table t1; # -#-- 17. The scripts in the following bugs should work: +#-- The scripts in the following bugs should work: # #BUG#559 Maximum precision for DECIMAL column ... @@ -833,7 +810,7 @@ select 1 / 0; #BUG#6048 Stored procedure causes operating system reboot #BUG#6053 DOUBLE PRECISION literal --- 18. Tests from 'traditional' mode tests +-- Tests from 'traditional' mode tests # set sql_mode='ansi,traditional'; # @@ -1051,6 +1028,48 @@ select cast(@non_existing_user_var/2 as DECIMAL); --error 1427 create table t (d decimal(0,10)); +# +# Bug #14268 (bad FLOAT->DECIMAL conversion) +# + +CREATE TABLE t1 ( + my_float FLOAT, + my_double DOUBLE, + my_varchar VARCHAR(50), + my_decimal DECIMAL(65,30) +); +SHOW CREATE TABLE t1; + +let $max_power= 32; +while ($max_power) +{ + eval INSERT INTO t1 SET my_float = 1.175494345e-$max_power, + my_double = 1.175494345e-$max_power, + my_varchar = '1.175494345e-$max_power'; + dec $max_power; +} +SELECT my_float, my_double, my_varchar FROM t1; + +SELECT CAST(my_float AS DECIMAL(65,30)), my_float FROM t1; +SELECT CAST(my_double AS DECIMAL(65,30)), my_double FROM t1; +SELECT CAST(my_varchar AS DECIMAL(65,30)), my_varchar FROM t1; + +# We have to disable warnings here as the test in +# Field_new_decimal::store(double): +# if (nr2 != nr) +# fails randomly depending on compiler options + +--disable_warnings +UPDATE t1 SET my_decimal = my_float; +SELECT my_decimal, my_float FROM t1; +UPDATE t1 SET my_decimal = my_double; +SELECT my_decimal, my_double FROM t1; +--enable_warnings +UPDATE t1 SET my_decimal = my_varchar; +SELECT my_decimal, my_varchar FROM t1; + +DROP TABLE t1; + # # Bug #13573 (Wrong data inserted for too big values) # diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test index daa83ef0fa4..6de90dd446d 100644 --- a/mysql-test/t/union.test +++ b/mysql-test/t/union.test @@ -753,6 +753,24 @@ create table t2 select a from t1 union select b from t1; show columns from t2; drop table t2, t1; +# +# Bug #14216: UNION + DECIMAL wrong values in result +# +create table t1 (f1 decimal(60,25), f2 decimal(60,25)); +insert into t1 values (0.0,0.0); +select f1 from t1 union all select f2 from t1; +select 'XXXXXXXXXXXXXXXXXXXX' as description, f1 from t1 +union all +select 'YYYYYYYYYYYYYYYYYYYY' as description, f2 from t1; +drop table t1; +create table t1 (f1 decimal(60,24), f2 decimal(60,24)); +insert into t1 values (0.0,0.0); +select f1 from t1 union all select f2 from t1; +select 'XXXXXXXXXXXXXXXXXXXX' as description, f1 from t1 +union all +select 'YYYYYYYYYYYYYYYYYYYY' as description, f2 from t1; +drop table t1; + # # Test that union with VARCHAR produces dynamic row tables # diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test index 2a151f0dd38..d0496b48c7a 100644 --- a/mysql-test/t/update.test +++ b/mysql-test/t/update.test @@ -270,4 +270,21 @@ insert into t1 values('2000-01-01'),('0000-00-00'); update t1 set f1='2002-02-02' where f1 is null; select * from t1; drop table t1; + +# +# Bug#15028 Multitable update returns different numbers of matched rows +# depending on table order +create table t1 (f1 int); +create table t2 (f2 int); +insert into t1 values(1),(2); +insert into t2 values(1),(1); +--enable_info +update t1,t2 set f1=3,f2=3 where f1=f2 and f1=1; +--disable_info +update t2 set f2=1; +update t1 set f1=1 where f1=3; +--enable_info +update t2,t1 set f1=3,f2=3 where f1=f2 and f1=1; +--disable_info +drop table t1,t2; # End of 4.1 tests diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index f23cc0152c1..76761f9177d 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -237,6 +237,10 @@ set global rpl_recovery_rank=100; set global server_id=100; set global slow_launch_time=100; set sort_buffer_size=100; +set @@max_sp_recursion_depth=10; +select @@max_sp_recursion_depth; +set @@max_sp_recursion_depth=0; +select @@max_sp_recursion_depth; set sql_auto_is_null=1; select @@sql_auto_is_null; set @@sql_auto_is_null=0; @@ -254,7 +258,7 @@ set sql_quote_show_create=1; set sql_safe_updates=1; set sql_select_limit=1; set sql_warnings=1; -set global table_cache=100; +set global table_open_cache=100; set storage_engine=myisam; set global thread_cache_size=100; set timestamp=1, timestamp=default; @@ -386,9 +390,9 @@ SHOW VARIABLES LIKE 'MYISAM_DATA_POINTER_SIZE'; # Bug #6958: negative arguments to integer options wrap around # -SET GLOBAL table_cache=-1; -SHOW VARIABLES LIKE 'table_cache'; -SET GLOBAL table_cache=DEFAULT; +SET GLOBAL table_open_cache=-1; +SHOW VARIABLES LIKE 'table_open_cache'; +SET GLOBAL table_open_cache=DEFAULT; # # Bugs12363: character_set_results is nullable, diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 4338d0f8f9a..cdf99da7205 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -1,5 +1,5 @@ --disable_warnings -drop table if exists t1,t2,t9,`t1a``b`,v1,v2,v3,v4,v5,v6; +drop table if exists t1,t2,t3,t4,t9,`t1a``b`,v1,v2,v3,v4,v5,v6; drop view if exists t1,t2,`t1a``b`,v1,v2,v3,v4,v5,v6; drop database if exists mysqltest; --enable_warnings @@ -147,11 +147,9 @@ insert into t1 values (1), (2), (3); create view v1 (a) as select a+1 from t1; create view v2 (a) as select a-1 from t1; ---disable_parsing # WL #2486 should enable these tests select * from t1 natural left join v1; select * from v2 natural left join t1; select * from v2 natural left join v1; ---enable_parsing drop view v1, v2; drop table t1; @@ -2085,7 +2083,7 @@ drop table t1, t2; # # DEFINER information check # --- error ER_NO_VIEW_USER +-- error ER_MALFORMED_DEFINER create definer=some_user@`` sql security invoker view v1 as select 1; create definer=some_user@localhost sql security invoker view v1 as select 1; show create view v1; @@ -2194,6 +2192,15 @@ DROP VIEW v1,v2; DROP TABLE t1,t2,t3; # +# Bug #13622 Wrong view .frm created if some field's alias contain \n +# +create table t1 (f1 int); +create view v1 as select t1.f1 as '123 +456' from t1; +select * from v1; +drop view v1; +drop table t1; + # Bug #14466 lost sort order in GROUP_CONCAT() in a view # create table t1 (f1 int, f2 int); @@ -2204,3 +2211,76 @@ select * from v1; select * from v2; drop view v1,v2; drop table t1; + +# +# BUG#14026 Crash on second PS execution when using views +# +create table t1 (x int, y int); +create table t2 (x int, y int, z int); +create table t3 (x int, y int, z int); +create table t4 (x int, y int, z int); + +create view v1 as +select t1.x +from ( + (t1 join t2 on ((t1.y = t2.y))) + join + (t3 left join t4 on (t3.y = t4.y) and (t3.z = t4.z)) +); + +prepare stmt1 from "select count(*) from v1 where x = ?"; +set @parm1=1; + +execute stmt1 using @parm1; +execute stmt1 using @parm1; +drop view v1; +drop table t1,t2,t3,t4; + +# +# Bug #14540: OPTIMIZE, ANALYZE, REPAIR applied to not a view +# + +CREATE TABLE t1(id INT); +CREATE VIEW v1 AS SELECT id FROM t1; + +OPTIMIZE TABLE v1; +ANALYZE TABLE v1; +REPAIR TABLE v1; + +DROP TABLE t1; +OPTIMIZE TABLE v1; + +DROP VIEW v1; + + +# +# BUG#14719: Views DEFINER grammar is incorrect +# + +create definer = current_user() sql security invoker view v1 as select 1; +show create view v1; +drop view v1; + +create definer = current_user sql security invoker view v1 as select 1; +show create view v1; +drop view v1; + +# +# Bug #14816 test_if_order_by_key() expected only Item_fields. +# +create table t1 (id INT, primary key(id)); +insert into t1 values (1),(2); +create view v1 as select * from t1; +explain select id from v1 order by id; +drop view v1; +drop table t1; + +# +# Bug #14850 Item_ref's values wasn't updated +# +create table t1(f1 int, f2 int); +insert into t1 values (null, 10), (null,2); +create view v1 as select * from t1; +select f1, sum(f2) from v1 group by f1; +drop view v1; +drop table t1; diff --git a/mysql-test/t/view_grant.test b/mysql-test/t/view_grant.test index 7f0cb6d9406..559b5247406 100644 --- a/mysql-test/t/view_grant.test +++ b/mysql-test/t/view_grant.test @@ -1,6 +1,12 @@ # Can't test with embedded server -- source include/not_embedded.inc +--disable_warnings +drop database if exists mysqltest; +drop view if exists v1; +--enable_warnings + + # simple test of grants grant create view on test.* to test@localhost; show grants for test@localhost; @@ -24,7 +30,7 @@ grant create view,select on test.* to mysqltest_1@localhost; connect (user1,localhost,mysqltest_1,,test); connection user1; --- error ER_VIEW_OTHER_USER +-- error ER_SPECIFIC_ACCESS_DENIED create definer=root@localhost view v1 as select * from mysqltest.t1; create view v1 as select * from mysqltest.t1; # try to modify view without DROP privilege on it @@ -664,3 +670,39 @@ insert into mysql.user select * from t1; flush privileges; drop table t1; + +# +# BUG#14726: freeing stack variable in case of an error of opening +# a view when we have locked tables with LOCK TABLES statement. +# +connection root; +--disable_warnings +create database mysqltest; +--enable_warnings + +use mysqltest; +CREATE TABLE t1 (i INT); +CREATE VIEW v1 AS SELECT * FROM t1; +SHOW CREATE VIEW v1; +GRANT SELECT, LOCK TABLES ON mysqltest.* TO mysqltest_1@localhost; + +connection user1; + +use mysqltest; +LOCK TABLES v1 READ; +-- error ER_TABLEACCESS_DENIED_ERROR +SHOW CREATE TABLE v1; +UNLOCK TABLES; +use test; + +connection root; +use test; +drop user mysqltest_1@localhost; +drop database mysqltest; + +# +# switch to default connaction +# +disconnect user1; +disconnect root; +connection default; diff --git a/mysql-test/valgrind.supp b/mysql-test/valgrind.supp index 7737810653d..bcca7c252ab 100644 --- a/mysql-test/valgrind.supp +++ b/mysql-test/valgrind.supp @@ -152,3 +152,15 @@ obj:*/libz.so.* fun:gzflush } + +# +# Warning from my_thread_init becasue mysqld dies before kill thread exists +# + +{ + my_thread_init kill thread memory loss second + Memcheck:Leak + fun:calloc + fun:my_thread_init + fun:kill_server_thread +} diff --git a/mysys/hash.c b/mysys/hash.c index 45cf7d5ff1d..d9084ed4fd3 100644 --- a/mysys/hash.c +++ b/mysys/hash.c @@ -109,7 +109,7 @@ static inline void hash_free_elements(HASH *hash) void hash_free(HASH *hash) { DBUG_ENTER("hash_free"); - DBUG_PRINT("enter",("hash: 0x%lxd",hash)); + DBUG_PRINT("enter",("hash: 0x%lx", hash)); hash_free_elements(hash); hash->free= 0; diff --git a/mysys/mf_dirname.c b/mysys/mf_dirname.c index 45bf4d56c31..98da72a206c 100644 --- a/mysys/mf_dirname.c +++ b/mysys/mf_dirname.c @@ -73,7 +73,7 @@ uint dirname_part(my_string to, const char *name) SYNPOSIS convert_dirname() to Store result here - from Original filename + from Original filename. May be == to from_end Pointer at end of filename (normally end \0) IMPLEMENTATION @@ -101,6 +101,7 @@ char *convert_dirname(char *to, const char *from, const char *from_end) #ifdef BACKSLASH_MBTAIL CHARSET_INFO *fs= fs_character_set(); #endif + DBUG_ENTER("convert_dirname"); /* We use -2 here, becasue we need place for the last FN_LIBCHAR */ if (!from_end || (from_end - from) > FN_REFLEN-2) @@ -149,5 +150,5 @@ char *convert_dirname(char *to, const char *from, const char *from_end) *to++=FN_LIBCHAR; *to=0; } - return to; /* Pointer to end of dir */ + DBUG_RETURN(to); /* Pointer to end of dir */ } /* convert_dirname */ diff --git a/mysys/mf_pack.c b/mysys/mf_pack.c index 049aa59a578..9dd2a6a8276 100644 --- a/mysys/mf_pack.c +++ b/mysys/mf_pack.c @@ -107,16 +107,27 @@ void pack_dirname(my_string to, const char *from) } /* pack_dirname */ - /* remove unwanted chars from dirname */ - /* if "/../" removes prev dir; "/~/" removes all before ~ */ - /* "//" is same as "/", except on Win32 at start of a file */ - /* "/./" is removed */ - /* Unpacks home_dir if "~/.." used */ - /* Unpacks current dir if if "./.." used */ +/* + remove unwanted chars from dirname + + SYNOPSIS + cleanup_dirname() + to Store result here + from Dirname to fix. May be same as to + + IMPLEMENTATION + "/../" removes prev dir + "/~/" removes all before ~ + //" is same as "/", except on Win32 at start of a file + "/./" is removed + Unpacks home_dir if "~/.." used + Unpacks current dir if if "./.." used + + RETURN + # length of new name +*/ uint cleanup_dirname(register my_string to, const char *from) - /* to may be == from */ - { reg5 uint length; reg2 my_string pos; diff --git a/mysys/mf_tempdir.c b/mysys/mf_tempdir.c index 4d244aa7d74..0a3d41efdc5 100644 --- a/mysys/mf_tempdir.c +++ b/mysys/mf_tempdir.c @@ -28,9 +28,12 @@ my_bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist) char *end, *copy; char buff[FN_REFLEN]; DYNAMIC_ARRAY t_arr; + DBUG_ENTER("init_tmpdir"); + DBUG_PRINT("enter", ("pathlist: %s", pathlist ? pathlist : "NULL")); + pthread_mutex_init(&tmpdir->mutex, MY_MUTEX_INIT_FAST); if (my_init_dynamic_array(&t_arr, sizeof(char*), 1, 5)) - return TRUE; + goto err; if (!pathlist || !pathlist[0]) { /* Get default temporary directory */ @@ -46,12 +49,13 @@ my_bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist) } do { + uint length; end=strcend(pathlist, DELIM); - convert_dirname(buff, pathlist, end); - if (!(copy=my_strdup(buff, MYF(MY_WME)))) - return TRUE; - if (insert_dynamic(&t_arr, (gptr)©)) - return TRUE; + strmake(buff, pathlist, (uint) (end-pathlist)); + length= cleanup_dirname(buff, buff); + if (!(copy= my_strdup_with_length(buff, length, MYF(MY_WME))) || + insert_dynamic(&t_arr, (gptr) ©)) + DBUG_RETURN(TRUE); pathlist=end+1; } while (*end); @@ -59,12 +63,20 @@ my_bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist) tmpdir->list=(char **)t_arr.buffer; tmpdir->max=t_arr.elements-1; tmpdir->cur=0; - return FALSE; + DBUG_RETURN(FALSE); + +err: + delete_dynamic(&t_arr); /* Safe to free */ + pthread_mutex_destroy(&tmpdir->mutex); + DBUG_RETURN(TRUE); } + char *my_tmpdir(MY_TMPDIR *tmpdir) { char *dir; + if (!tmpdir->max) + return tmpdir->list[0]; pthread_mutex_lock(&tmpdir->mutex); dir=tmpdir->list[tmpdir->cur]; tmpdir->cur= (tmpdir->cur == tmpdir->max) ? 0 : tmpdir->cur+1; diff --git a/mysys/my_alloc.c b/mysys/my_alloc.c index d5346d530c3..9f3676618eb 100644 --- a/mysys/my_alloc.c +++ b/mysys/my_alloc.c @@ -396,6 +396,7 @@ char *strdup_root(MEM_ROOT *root,const char *str) return strmake_root(root, str, (uint) strlen(str)); } + char *strmake_root(MEM_ROOT *root,const char *str, uint len) { char *pos; diff --git a/mysys/my_create.c b/mysys/my_create.c index 5fa97a9ca78..a85417c7701 100644 --- a/mysys/my_create.c +++ b/mysys/my_create.c @@ -47,13 +47,16 @@ File my_create(const char *FileName, int CreateFlags, int access_flags, #elif defined(VMS) fd = open((my_string) FileName, access_flags | O_CREAT, 0, "ctx=stm","ctx=bin"); -#elif defined(MSDOS) || defined(__WIN__) || defined(__EMX__) || defined(OS2) +#elif defined(MSDOS) || defined(__EMX__) || defined(OS2) if (access_flags & O_SHARE) fd = sopen((my_string) FileName, access_flags | O_CREAT | O_BINARY, SH_DENYNO, MY_S_IREAD | MY_S_IWRITE); else fd = open((my_string) FileName, access_flags | O_CREAT | O_BINARY, MY_S_IREAD | MY_S_IWRITE); +#elif defined(__WIN__) + fd= my_sopen((my_string) FileName, access_flags | O_CREAT | O_BINARY, + SH_DENYNO, MY_S_IREAD | MY_S_IWRITE); #else fd = open(FileName, access_flags); #endif diff --git a/mysys/my_open.c b/mysys/my_open.c index 69d63c49554..6ed3cb5becf 100644 --- a/mysys/my_open.c +++ b/mysys/my_open.c @@ -56,12 +56,18 @@ File my_open(const char *FileName, int Flags, myf MyFlags) DBUG_RETURN(my_register_filename(-1, FileName, FILE_BY_OPEN, EE_FILENOTFOUND, MyFlags)); } +#ifndef __WIN__ if (Flags & O_SHARE) fd = sopen((my_string) FileName, (Flags & ~O_SHARE) | O_BINARY, SH_DENYNO, MY_S_IREAD | MY_S_IWRITE); else fd = open((my_string) FileName, Flags | O_BINARY, MY_S_IREAD | MY_S_IWRITE); +#else + fd= my_sopen((my_string) FileName, (Flags & ~O_SHARE) | O_BINARY, SH_DENYNO, + MY_S_IREAD | MY_S_IWRITE); +#endif + #elif !defined(NO_OPEN_3) fd = open(FileName, Flags, my_umask); /* Normal unix */ #else @@ -167,3 +173,181 @@ File my_register_filename(File fd, const char *FileName, enum file_type FileName, my_errno); return(fd); } + +#ifdef __WIN__ + +extern void __cdecl _dosmaperr(unsigned long); + +/* + Open a file with sharing. Similar to _sopen() from libc, but allows managing + share delete on win32 + + SYNOPSIS + my_sopen() + path fully qualified file name + oflag operation flags + shflag share flag + pmode permission flags + + RETURN VALUE + File descriptor of opened file if success + -1 and sets errno if fails. +*/ + +File my_sopen(const char *path, int oflag, int shflag, int pmode) +{ + int fh; /* handle of opened file */ + int mask; + HANDLE osfh; /* OS handle of opened file */ + DWORD fileaccess; /* OS file access (requested) */ + DWORD fileshare; /* OS file sharing mode */ + DWORD filecreate; /* OS method of opening/creating */ + DWORD fileattrib; /* OS file attribute flags */ + SECURITY_ATTRIBUTES SecurityAttributes; + + SecurityAttributes.nLength= sizeof(SecurityAttributes); + SecurityAttributes.lpSecurityDescriptor= NULL; + SecurityAttributes.bInheritHandle= !(oflag & _O_NOINHERIT); + + /* + * decode the access flags + */ + switch (oflag & (_O_RDONLY | _O_WRONLY | _O_RDWR)) { + case _O_RDONLY: /* read access */ + fileaccess= GENERIC_READ; + break; + case _O_WRONLY: /* write access */ + fileaccess= GENERIC_WRITE; + break; + case _O_RDWR: /* read and write access */ + fileaccess= GENERIC_READ | GENERIC_WRITE; + break; + default: /* error, bad oflag */ + errno= EINVAL; + _doserrno= 0L; /* not an OS error */ + return -1; + } + + /* + * decode sharing flags + */ + switch (shflag) { + case _SH_DENYRW: /* exclusive access except delete */ + fileshare= FILE_SHARE_DELETE; + break; + case _SH_DENYWR: /* share read and delete access */ + fileshare= FILE_SHARE_READ | FILE_SHARE_DELETE; + break; + case _SH_DENYRD: /* share write and delete access */ + fileshare= FILE_SHARE_WRITE | FILE_SHARE_DELETE; + break; + case _SH_DENYNO: /* share read, write and delete access */ + fileshare= FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE; + break; + case _SH_DENYRWD: /* exclusive access */ + fileshare= 0L; + break; + case _SH_DENYWRD: /* share read access */ + fileshare= FILE_SHARE_READ; + break; + case _SH_DENYRDD: /* share write access */ + fileshare= FILE_SHARE_WRITE; + break; + case _SH_DENYDEL: /* share read and write access */ + fileshare= FILE_SHARE_READ | FILE_SHARE_WRITE; + break; + default: /* error, bad shflag */ + errno= EINVAL; + _doserrno= 0L; /* not an OS error */ + return -1; + } + + /* + * decode open/create method flags + */ + switch (oflag & (_O_CREAT | _O_EXCL | _O_TRUNC)) { + case 0: + case _O_EXCL: /* ignore EXCL w/o CREAT */ + filecreate= OPEN_EXISTING; + break; + + case _O_CREAT: + filecreate= OPEN_ALWAYS; + break; + + case _O_CREAT | _O_EXCL: + case _O_CREAT | _O_TRUNC | _O_EXCL: + filecreate= CREATE_NEW; + break; + + case _O_TRUNC: + case _O_TRUNC | _O_EXCL: /* ignore EXCL w/o CREAT */ + filecreate= TRUNCATE_EXISTING; + break; + + case _O_CREAT | _O_TRUNC: + filecreate= CREATE_ALWAYS; + break; + + default: + /* this can't happen ... all cases are covered */ + errno= EINVAL; + _doserrno= 0L; + return -1; + } + + /* + * decode file attribute flags if _O_CREAT was specified + */ + fileattrib= FILE_ATTRIBUTE_NORMAL; /* default */ + if (oflag & _O_CREAT) + { + _umask((mask= _umask(0))); + + if (!((pmode & ~mask) & _S_IWRITE)) + fileattrib= FILE_ATTRIBUTE_READONLY; + } + + /* + * Set temporary file (delete-on-close) attribute if requested. + */ + if (oflag & _O_TEMPORARY) + { + fileattrib|= FILE_FLAG_DELETE_ON_CLOSE; + fileaccess|= DELETE; + } + + /* + * Set temporary file (delay-flush-to-disk) attribute if requested. + */ + if (oflag & _O_SHORT_LIVED) + fileattrib|= FILE_ATTRIBUTE_TEMPORARY; + + /* + * Set sequential or random access attribute if requested. + */ + if (oflag & _O_SEQUENTIAL) + fileattrib|= FILE_FLAG_SEQUENTIAL_SCAN; + else if (oflag & _O_RANDOM) + fileattrib|= FILE_FLAG_RANDOM_ACCESS; + + /* + * try to open/create the file + */ + if ((osfh= CreateFile(path, fileaccess, fileshare, &SecurityAttributes, + filecreate, fileattrib, NULL)) == (HANDLE)0xffffffff) + { + /* + * OS call to open/create file failed! map the error, release + * the lock, and return -1. note that it's not necessary to + * call _free_osfhnd (it hasn't been used yet). + */ + _dosmaperr(GetLastError()); /* map error */ + return -1; /* return error to caller */ + } + + fh= _open_osfhandle((long)osfh, oflag & (_O_APPEND | _O_RDONLY | _O_TEXT)); + + return fh; /* return handle */ +} +#endif /* __WIN__ */ diff --git a/netware/Makefile.am b/netware/Makefile.am index be59efd1deb..ab88d97f9bc 100644 --- a/netware/Makefile.am +++ b/netware/Makefile.am @@ -40,10 +40,10 @@ netware_build_files = client/mysql.def client/mysqladmin.def \ link_sources: set -x; \ for f in $(netware_build_files); do \ - rm -f $(srcdir)/../$$f; \ + rm -f ../$$f; \ org=`echo $$f | sed -e 's/.*\/\(.*\)/\1/g'`; \ - @LN_CP_F@ $(srcdir)/$$org $(srcdir)/../$$f; \ - done; + @LN_CP_F@ $(srcdir)/$$org ../$$f; \ + done else EXTRA_DIST= comp_err.def init_db.sql install_test_db.ncf \ libmysql.def libmysql.imp \ diff --git a/netware/mysql_test_run.c b/netware/mysql_test_run.c index 92ed89b4770..98b7ab7fd8c 100644 --- a/netware/mysql_test_run.c +++ b/netware/mysql_test_run.c @@ -1173,6 +1173,9 @@ void setup(char *file) setenv("MYSQL",file_path,1); snprintf(file_path, PATH_MAX*2, "%s/mysqlshow --no-defaults --user=root --port=%u", bin_dir, master_port); setenv("MYSQL_SHOW",file_path,1); + snprintf(file_path, PATH_MAX*2, "%s/mysqlcheck --no-defaults -uroot --port=%u", bin_dir, master_port); + setenv("MYSQL_CHECK",file_path,1); + } /****************************************************************************** diff --git a/pstack/Makefile.am b/pstack/Makefile.am index 77f84d212cd..20d5d8314ce 100644 --- a/pstack/Makefile.am +++ b/pstack/Makefile.am @@ -20,7 +20,7 @@ # SUBDIRS = aout -INCLUDES = -I$(top_srcdir)/include +INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include noinst_HEADERS = bucomm.h debug.h ieee.h budbg.h demangle.h \ linuxthreads.h pstack.h pstacktrace.h SRC= bucomm.c filemode.c linuxthreads.c rddbg.c \ diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 2d7f18b676b..56a2d4a7bc6 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -83,9 +83,10 @@ CLEANFILES = @server_scripts@ \ mysql_find_rows \ mysqlhotcopy \ mysqldumpslow \ + mysql_explain_log \ + mysql_tableinfo \ mysqld_multi \ make_win_src_distribution \ - make_win_binary_distribution \ mysql_create_system_tables DISTCLEANFILES = mysqlbug diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh index 5767728fe4f..ea78133cc5e 100644 --- a/scripts/make_binary_distribution.sh +++ b/scripts/make_binary_distribution.sh @@ -308,7 +308,7 @@ fi # NDB Cluster if [ x$NDBCLUSTER = x1 ]; then - ( cd ndb ; @MAKE@ DESTDIR=$BASE/ndb-stage install ) + ( cd storage/ndb ; @MAKE@ DESTDIR=$BASE/ndb-stage install ) ( cd mysql-test/ndb ; @MAKE@ DESTDIR=$BASE/ndb-stage install ) $CP $BASE/ndb-stage@bindir@/* $BASE/bin/. $CP $BASE/ndb-stage@libexecdir@/* $BASE/bin/. diff --git a/scripts/mysql_fix_privilege_tables.sql b/scripts/mysql_fix_privilege_tables.sql index bc20e698376..f8f10438505 100644 --- a/scripts/mysql_fix_privilege_tables.sql +++ b/scripts/mysql_fix_privilege_tables.sql @@ -35,7 +35,7 @@ ALTER TABLE user add Grant_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,a ALTER TABLE host add Grant_priv enum('N','Y') NOT NULL,add References_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Index_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Alter_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL; ALTER TABLE db add Grant_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add References_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Index_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Alter_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL; ---- Fix privileges for old tables +-- Fix privileges for old tables UPDATE user SET Grant_priv=File_priv,References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE @hadGrantPriv = 0; UPDATE db SET References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE @hadGrantPriv = 0; UPDATE host SET References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE @hadGrantPriv = 0; diff --git a/scripts/mysqlhotcopy.sh b/scripts/mysqlhotcopy.sh index 1c5cd6a4faf..bf53aa78e15 100644 --- a/scripts/mysqlhotcopy.sh +++ b/scripts/mysqlhotcopy.sh @@ -252,6 +252,7 @@ if ( defined $opt{regexp} ) { my $sth_dbs = $dbh->prepare("show databases"); $sth_dbs->execute; while ( my ($db_name) = $sth_dbs->fetchrow_array ) { + next if $db_name =~ m/^information_schema$/i; push @db_desc, { 'src' => $db_name, 't_regex' => $t_regex } if ( $db_name =~ m/$opt{regexp}/o ); } } diff --git a/server-tools/instance-manager/Makefile.am b/server-tools/instance-manager/Makefile.am index 4fa2a0da405..7449735f0bf 100644 --- a/server-tools/instance-manager/Makefile.am +++ b/server-tools/instance-manager/Makefile.am @@ -53,12 +53,12 @@ libnet_a_LIBADD= $(top_builddir)/sql/password.$(OBJEXT) \ CLEANFILES= net_serv.cc client_settings.h net_serv.cc: - rm -f $(srcdir)/net_serv.cc - @LN_CP_F@ $(top_srcdir)/sql/net_serv.cc $(srcdir)/net_serv.cc + rm -f net_serv.cc + @LN_CP_F@ $(top_srcdir)/sql/net_serv.cc net_serv.cc client_settings.h: - rm -f $(srcdir)/client_settings.h - @LN_CP_F@ $(top_srcdir)/sql/client_settings.h $(srcdir)/client_settings.h + rm -f client_settings.h + @LN_CP_F@ $(top_srcdir)/sql/client_settings.h client_settings.h libexec_PROGRAMS= mysqlmanager diff --git a/server-tools/instance-manager/priv.cc b/server-tools/instance-manager/priv.cc index a5040aa2e83..e39c12f4ebb 100644 --- a/server-tools/instance-manager/priv.cc +++ b/server-tools/instance-manager/priv.cc @@ -76,6 +76,9 @@ int set_stacksize_n_create_thread(pthread_t *thread, pthread_attr_t *attr, int rc= 0; #ifndef __WIN__ +#ifndef PTHREAD_STACK_MIN +#define PTHREAD_STACK_MIN 32768 +#endif /* Set stack size to be safe on the platforms with too small default thread stack. diff --git a/sql-bench/Makefile.am b/sql-bench/Makefile.am index 579a2a9f7fe..12f3d5550b3 100644 --- a/sql-bench/Makefile.am +++ b/sql-bench/Makefile.am @@ -60,6 +60,8 @@ install-data-local: for i in $(srcdir)/limits/*.* ; do $(INSTALL_DATA) $$i $(DESTDIR)$(benchdir)/limits; done for i in $(srcdir)/Comments/*.* ; do $(INSTALL_DATA) $$i $(DESTDIR)$(benchdir)/Comments; done +uninstall-local: + @RM@ -f -r $(DESTDIR)$(benchdir) SUFFIXES = .sh diff --git a/sql-common/client.c b/sql-common/client.c index cc90b2a105a..976d59d83a4 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1495,12 +1495,17 @@ mysql_ssl_set(MYSQL *mysql __attribute__((unused)) , static void mysql_ssl_free(MYSQL *mysql __attribute__((unused))) { + struct st_VioSSLConnectorFd *st= + (struct st_VioSSLConnectorFd*) mysql->connector_fd; DBUG_ENTER("mysql_ssl_free"); + my_free(mysql->options.ssl_key, MYF(MY_ALLOW_ZERO_PTR)); my_free(mysql->options.ssl_cert, MYF(MY_ALLOW_ZERO_PTR)); my_free(mysql->options.ssl_ca, MYF(MY_ALLOW_ZERO_PTR)); my_free(mysql->options.ssl_capath, MYF(MY_ALLOW_ZERO_PTR)); - my_free(mysql->options.ssl_cipher, MYF(MY_ALLOW_ZERO_PTR)); + my_free(mysql->options.ssl_cipher, MYF(MY_ALLOW_ZERO_PTR)); + if (st) + SSL_CTX_free(st->ssl_context); my_free(mysql->connector_fd,MYF(MY_ALLOW_ZERO_PTR)); mysql->options.ssl_key = 0; mysql->options.ssl_cert = 0; diff --git a/sql/Makefile.am b/sql/Makefile.am index 1ce8379b64a..1090c6d48c7 100644 --- a/sql/Makefile.am +++ b/sql/Makefile.am @@ -62,7 +62,7 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \ sp_head.h sp_pcontext.h sp_rcontext.h sp.h sp_cache.h \ parse_file.h sql_view.h sql_trigger.h \ sql_array.h sql_cursor.h \ - sql_plugin.h + sql_plugin.h authors.h mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \ item.cc item_sum.cc item_buff.cc item_func.cc \ item_cmpfunc.cc item_strfunc.cc item_timefunc.cc \ @@ -98,9 +98,12 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \ sql_plugin.cc\ handlerton.cc EXTRA_mysqld_SOURCES = ha_innodb.cc ha_berkeley.cc ha_archive.cc \ + ha_innodb.h ha_berkeley.h ha_archive.h \ ha_blackhole.cc ha_federated.cc ha_ndbcluster.cc \ - ha_partition.cc \ - examples/ha_tina.cc examples/ha_example.cc + ha_blackhole.h ha_federated.h ha_ndbcluster.h \ + ha_partition.cc ha_partition.h \ + examples/ha_tina.cc examples/ha_example.cc \ + examples/ha_tina.h examples/ha_example.h mysqld_DEPENDENCIES = @mysql_se_objs@ gen_lex_hash_SOURCES = gen_lex_hash.cc gen_lex_hash_LDADD = $(LDADD) $(CXXLDFLAGS) @@ -115,23 +118,23 @@ DEFS = -DMYSQL_SERVER \ @DEFS@ BUILT_SOURCES = sql_yacc.cc sql_yacc.h lex_hash.h -EXTRA_DIST = udf_example.cc $(BUILT_SOURCES) +EXTRA_DIST = udf_example.cc handlerton-win.cc $(BUILT_SOURCES) DISTCLEANFILES = lex_hash.h AM_YFLAGS = -d mysql_tzinfo_to_sql.cc: rm -f mysql_tzinfo_to_sql.cc - @LN_CP_F@ tztime.cc mysql_tzinfo_to_sql.cc + @LN_CP_F@ $(srcdir)/tztime.cc mysql_tzinfo_to_sql.cc link_sources: mysql_tzinfo_to_sql.cc rm -f mini_client_errors.c - @LN_CP_F@ ../libmysql/errmsg.c mini_client_errors.c + @LN_CP_F@ $(top_srcdir)/libmysql/errmsg.c mini_client_errors.c rm -f pack.c - @LN_CP_F@ ../sql-common/pack.c pack.c + @LN_CP_F@ $(top_srcdir)/sql-common/pack.c pack.c rm -f client.c - @LN_CP_F@ ../sql-common/client.c client.c + @LN_CP_F@ $(top_srcdir)/sql-common/client.c client.c rm -f my_time.c - @LN_CP_F@ ../sql-common/my_time.c my_time.c + @LN_CP_F@ $(top_srcdir)/sql-common/my_time.c my_time.c mysql_tzinfo_to_sql.o: $(mysql_tzinfo_to_sql_SOURCES) $(CXXCOMPILE) -c $(INCLUDES) -DTZINFO2SQL $< diff --git a/sql/authors.h b/sql/authors.h new file mode 100644 index 00000000000..1c6e1d468c4 --- /dev/null +++ b/sql/authors.h @@ -0,0 +1,145 @@ +/* Copyright (C) 2005 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 */ + +/* Structure of the name list */ + +struct show_table_authors_st { + const char *name; + const char *location; + const char *comment; +}; + +/* + Output from "SHOW AUTHORS" + + If you can update it, you get to be in it :) + + Don't be offended if your name is not in here, just add it! + + IMPORTANT: Names should be added in alphabetical order (by last name). + + Names should be encoded using UTF-8. +*/ + +struct show_table_authors_st show_table_authors[]= { + { "Brian (Krow) Aker", "Seattle, WA, USA", + "Architecture, archive, federated, bunch of little stuff :)" }, + { "Venu Anuganti", "", "Client/server protocol (4.1)" }, + { "David Axmark", "Uppsala, Sweden", + "Small stuff long time ago, Monty ripped it out!" }, + { "Alexander (Bar) Barkov", "Izhevsk, Russia", + "Unicode and character sets (4.1)" }, + { "Omer BarNir", "Sunnyvale, CA, USA", + "Testing (sometimes) and general QA stuff" }, + { "Guilhem Bichot", "Bordeaux, France", "Replication (since 4.0)" }, + { "John Birrell", "", "Emulation of pthread_mutex() for OS/2" }, + { "Andreas F. Bobak", "", "AGGREGATE extension to user-defined functions" }, + { "Alexey Botchkov (Holyfoot)", "Izhevsk, Russia", + "GIS extensions (4.1), embedded server (4.1), precision math (5.0)"}, + { "Reggie Burnett", "Nashville, TN, USA", "Windows development, Connectors" }, + { "Oleksandr Byelkin", "Lugansk, Ukraine", + "Query Cache (4.0), Subqueries (4.1), Views (5.0)" }, + { "Kent Boortz", "Orebro, Sweden", "Test platform, and general build stuff" }, + { "Tim Bunce", "", "mysqlhotcopy" }, + { "Yves Carlier", "", "mysqlaccess" }, + { "Joshua Chamas", "Cupertino, CA, USA", + "Concurrent insert, extended date syntax" }, + { "Petr Chardin", "Moscow, Russia", "Instance Manager (5.0)" }, + { "Wei-Jou Chen", "", "Chinese (Big5) character set" }, + { "Albert Chin-A-Young", "", + "Tru64 port, large file support, better TCP wrappers support" }, + { "Jorge del Conde", "Mexico City, Mexico", "Windows development" }, + { "Antony T. Curtis", "Norwalk, CA, USA", "Parser, port to OS/2" }, + { "Yuri Dario", "", "OS/2 port" }, + { "Sergei Golubchik", "Kerpen, Germany", + "Full-text search, precision math" }, + { "Lenz Grimmer", "Hamburg, Germany", + "Production (build and release) engineering" }, + { "Nikolay Grishakin", "Austin, TX, USA", "Testing - Server" }, + { "Wei He", "", "Chinese (GBK) character set" }, + { "Eric Herman", "Amsterdam, Netherlands", "Bug fixing - federated" }, + { "Alexander (Alexi) Ivanov", "St. Petersburg, Russia", "Replication" }, + { "Alexander (Salle) Keremidarski", "Sofia, Bulgaria", + "Bug fixing" }, + { "Mats Kindahl", "Storvreta, Sweden", "Replication" }, + { "Serge Kozlov", "Velikie Luki, Russia", "Testing - Cluster" }, + { "Greg (Groggy) Lehey", "Uchunga, SA, Australia", "Backup" }, + { "Matthias Leich", "Berlin, Germany", "Testing - Server" }, + { "Dmitri Lenev", "Moscow, Russia", + "Time zones support (4.1), Triggers (5.0)" }, + { "Marc Liyanage", "", "Created Mac OS X packages" }, + { "Zarko Mocnik", "", "Sorting for Slovenian language" }, + { "Per-Erik Martin", "Uppsala, Sweden", "Stored Procedures (5.0)" }, + { "Alexis Mikhailov", "", "User-defined functions" }, + { "Sinisa Milivojevic", "Larnaca, Cyprus", + "UNION (4.0), Subqueries in FROM clause (4.1), many other features" }, + { "Jonathan (Jeb) Miller", "Kyle, TX, USA", + "Testing - Cluster, Replication" }, + { "Elliot Murphy", "Cocoa, FL, USA", "Replication and backup" }, + { "Kristian Nielsen", "Copenhagen, Denmark", + "General build stuff" }, + { "Pekka Nouisiainen", "Stockholm, Sweden", + "NDB Cluster: BLOB support, character set support, ordered indexes" }, + { "Alexander Nozdrin", "Moscow, Russia", + "Bug fixing (Stored Procedures, 5.0)" }, + { "Per Eric Olsson", "", "Testing of dynamic record format" }, + { "Jonas Oreland", "Stockholm, Sweden", + "NDB Cluster, Online Backup, lots of other things" }, + { "Konstantin Osipov", "Moscow, Russia", + "Prepared statements (4.1), Cursors (5.0)" }, + { "Alexander (Sasha) Pachev", "Provo, UT, USA", + "Statement-based replication, SHOW CREATE TABLE, mysql-bench" }, + { "Irena Pancirov", "", "Port to Windows with Borland compiler" }, + { "Jan Pazdziora", "", "Czech sorting order" }, + { "Benjamin Pflugmann", "", + "Extended MERGE storage engine to handle INSERT" }, + { "Igor Romanenko", "", + "mysqldump" }, + { "Mikael Ronström", "Stockholm, Sweden", + "NDB Cluster, Partitioning (5.1), Optimizations" }, + { "Tõnu Samuel", "", + "VIO interface, other miscellaneous features" }, + { "Carsten Segieth (Pino)", "Fredersdorf, Germany", "Testing - Server"}, + { "Martin Sköld", "Stockholm, Sweden", + "NDB Cluster: Unique indexes, integration into MySQL" }, + { "Timothy Smith", "Auckland, New Zealand", + "Dynamic character sets, parts of the build system, libmysqld"}, + { "Miguel Solorzano", "Florianopolis, Santa Catarina, Brazil", + "Windows development, Windows NT service"}, + { "Punita Srivastava", "Austin, TX, USA", "Testing - Merlin"}, + { "Alexey Stroganov (Ranger)", "Lugansk, Ukraine", "Testing - Benchmarks"}, + { "Ingo Strüwing", "Berlin, Germany", "Bug fixing" }, + { "Magnus Svensson", "Öregrund, Sweden", + "NDB Cluster: Integration into MySQL, test framework" }, + { "Zeev Suraski", "", "FROM_UNIXTIME(), ENCRYPT()" }, + { "TAMITO", "", + "The _MB character set macros and UJIS and SJIS character sets" }, + { "Jani Tolonen", "Helsinki, Finland", + "mysqlimport, extensions to command-line clients, PROCEDURE ANALYSE()" }, + { "Lars Thalmann", "Stockholm, Sweden", + "Replication and cluster development" }, + { "Tomas Ulin", "Stockholm, Sweden", + "NDB Cluster: Configuration, installation" }, + { "Gianmassimo Vigazzola", "", "Initial Windows port" }, + { "Sergey Vojtovich", "Izhevsk, Russia", "Plugins infrastructure (5.1)" }, + { "Matt Wagner", "Northfield, MN, USA", "Bug fixing" }, + { "Jim Winstead Jr.", "Los Angeles, CA, USA", "Bug fixing" }, + { "Michael (Monty) Widenius", "Tusby, Finland", + "Lead developer and main author" }, + { "Peter Zaitsev", "Tacoma, WA, USA", + "SHA1(), AES_ENCRYPT(), AES_DECRYPT(), bug fixing" }, + {NULL, NULL, NULL} +}; diff --git a/sql/examples/ha_example.cc b/sql/examples/ha_example.cc index 68aed7c6483..5b32b549e8d 100644 --- a/sql/examples/ha_example.cc +++ b/sql/examples/ha_example.cc @@ -71,7 +71,7 @@ #include "ha_example.h" -static handler* example_create_handler(TABLE *table); +static handler* example_create_handler(TABLE_SHARE *table); handlerton example_hton= { "EXAMPLE", @@ -213,13 +213,13 @@ static int free_share(EXAMPLE_SHARE *share) } -static handler* example_create_handler(TABLE *table) +static handler* example_create_handler(TABLE_SHARE *table) { return new ha_example(table); } -ha_example::ha_example(TABLE *table_arg) +ha_example::ha_example(TABLE_SHARE *table_arg) :handler(&example_hton, table_arg) {} @@ -495,6 +495,8 @@ int ha_example::rnd_pos(byte * buf, byte *pos) /* ::info() is used to return information to the optimizer. + see my_base.h for the complete description + Currently this table handler doesn't implement most of the fields really needed. SHOW also makes use of this data Another note, you will probably want to have the following in your diff --git a/sql/examples/ha_example.h b/sql/examples/ha_example.h index d2ec83a5837..139a50a3281 100644 --- a/sql/examples/ha_example.h +++ b/sql/examples/ha_example.h @@ -45,7 +45,7 @@ class ha_example: public handler EXAMPLE_SHARE *share; /* Shared lock info */ public: - ha_example(TABLE *table_arg); + ha_example(TABLE_SHARE *table_arg); ~ha_example() { } diff --git a/sql/examples/ha_tina.cc b/sql/examples/ha_tina.cc index 46636b93d21..4f2dc0b5cac 100644 --- a/sql/examples/ha_tina.cc +++ b/sql/examples/ha_tina.cc @@ -55,7 +55,7 @@ TODO: pthread_mutex_t tina_mutex; static HASH tina_open_tables; static int tina_init= 0; -static handler* tina_create_handler(TABLE *table); +static handler *tina_create_handler(TABLE_SHARE *table); handlerton tina_hton= { "CSV", @@ -95,11 +95,15 @@ handlerton tina_hton= { *****************************************************************************/ /* - Used for sorting chains. + Used for sorting chains with qsort(). */ int sort_set (tina_set *a, tina_set *b) { - return ( a->begin > b->begin ? 1 : ( a->begin < b->begin ? -1 : 0 ) ); + /* + We assume that intervals do not intersect. So, it is enought to compare + any two points. Here we take start of intervals for comparison. + */ + return ( a->begin > b->begin ? -1 : ( a->begin < b->begin ? 1 : 0 ) ); } static byte* tina_get_key(TINA_SHARE *share,uint *length, @@ -200,7 +204,8 @@ static TINA_SHARE *get_share(const char *table_name, TABLE *table) thr_lock_init(&share->lock); pthread_mutex_init(&share->mutex,MY_MUTEX_INIT_FAST); - if ((share->data_file= my_open(data_file_name, O_RDWR, MYF(0))) == -1) + if ((share->data_file= my_open(data_file_name, O_RDWR|O_APPEND, + MYF(0))) == -1) goto error2; /* @@ -280,20 +285,20 @@ byte * find_eoln(byte *data, off_t begin, off_t end) } -static handler* tina_create_handler(TABLE *table) +static handler *tina_create_handler(TABLE_SHARE *table) { return new ha_tina(table); } -ha_tina::ha_tina(TABLE *table_arg) +ha_tina::ha_tina(TABLE_SHARE *table_arg) :handler(&tina_hton, table_arg), /* - These definitions are found in hanler.h - These are not probably completely right. + These definitions are found in handler.h + They are not probably completely right. */ current_position(0), next_position(0), chain_alloced(0), - chain_size(DEFAULT_CHAIN_LENGTH) + chain_size(DEFAULT_CHAIN_LENGTH), records_is_known(0) { /* Set our original buffers from pre-allocated memory */ buffer.set(byte_buffer, IO_SIZE, system_charset_info); @@ -303,6 +308,7 @@ ha_tina::ha_tina(TABLE *table_arg) /* Encode a buffer into the quoted format. */ + int ha_tina::encode_quote(byte *buf) { char attribute_buffer[1024]; @@ -529,6 +535,7 @@ int ha_tina::write_row(byte * buf) */ if (get_mmap(share, 0) > 0) DBUG_RETURN(-1); + records++; DBUG_RETURN(0); } @@ -695,6 +702,7 @@ int ha_tina::rnd_init(bool scan) current_position= next_position= 0; records= 0; + records_is_known= 0; chain_ptr= chain; #ifdef HAVE_MADVISE if (scan) @@ -776,7 +784,7 @@ void ha_tina::info(uint flag) { DBUG_ENTER("ha_tina::info"); /* This is a lie, but you don't want the optimizer to see zero or 1 */ - if (records < 2) + if (!records_is_known && records < 2) records= 2; DBUG_VOID_RETURN; } @@ -813,6 +821,8 @@ int ha_tina::rnd_end() { DBUG_ENTER("ha_tina::rnd_end"); + records_is_known= 1; + /* First position will be truncate position, second will be increment */ if ((chain_ptr - chain) > 0) { @@ -836,14 +846,8 @@ int ha_tina::rnd_end() (qsort_cmp)sort_set); for (ptr= chain; ptr < chain_ptr; ptr++) { - /* We peek a head to see if this is the last chain */ - if (ptr+1 == chain_ptr) - memmove(share->mapped_file + ptr->begin, share->mapped_file + ptr->end, - length - (size_t)ptr->end); - else - memmove((caddr_t)share->mapped_file + ptr->begin, - (caddr_t)share->mapped_file + ptr->end, - (size_t)((ptr++)->begin - ptr->end)); + memmove(share->mapped_file + ptr->begin, share->mapped_file + ptr->end, + length - (size_t)ptr->end); length= length - (size_t)(ptr->end - ptr->begin); } @@ -863,18 +867,24 @@ int ha_tina::rnd_end() DBUG_RETURN(0); } -/* - Truncate table and others of its ilk call this. + +/* + DELETE without WHERE calls this */ + int ha_tina::delete_all_rows() { DBUG_ENTER("ha_tina::delete_all_rows"); + if (!records_is_known) + return (my_errno=HA_ERR_WRONG_COMMAND); + int rc= my_chsize(share->data_file, 0, 0, MYF(MY_WME)); if (get_mmap(share, 0) > 0) DBUG_RETURN(-1); + records=0; DBUG_RETURN(rc); } diff --git a/sql/examples/ha_tina.h b/sql/examples/ha_tina.h index 2de6d8c8257..c46750fb703 100644 --- a/sql/examples/ha_tina.h +++ b/sql/examples/ha_tina.h @@ -53,9 +53,10 @@ class ha_tina: public handler tina_set *chain_ptr; byte chain_alloced; uint32 chain_size; + bool records_is_known; public: - ha_tina(TABLE *table_arg); + ha_tina(TABLE_SHARE *table_arg); ~ha_tina() { if (chain_alloced) diff --git a/sql/field.cc b/sql/field.cc index ef4d9429bda..8c2b3b75573 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -1024,10 +1024,9 @@ bool Field::type_can_have_key_part(enum enum_field_types type) Field_num::Field_num(char *ptr_arg,uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, utype unireg_check_arg, const char *field_name_arg, - struct st_table *table_arg, uint8 dec_arg, bool zero_arg, bool unsigned_arg) :Field(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, table_arg), + unireg_check_arg, field_name_arg), dec(dec_arg),zerofill(zero_arg),unsigned_flag(unsigned_arg) { if (zerofill) @@ -1216,16 +1215,11 @@ String *Field::val_int_as_str(String *val_buffer, my_bool unsigned_val) } -/* This is used as a table name when the table structure is not set up */ -const char *unknown_table_name= 0; - Field::Field(char *ptr_arg,uint32 length_arg,uchar *null_ptr_arg, uchar null_bit_arg, - utype unireg_check_arg, const char *field_name_arg, - struct st_table *table_arg) + utype unireg_check_arg, const char *field_name_arg) :ptr(ptr_arg),null_ptr(null_ptr_arg), - table(table_arg),orig_table(table_arg), - table_name(table_arg ? &table_arg->alias : &unknown_table_name), + table(0), orig_table(0), table_name(0), field_name(field_name_arg), query_id(0), key_start(0), part_of_key(0), part_of_sortkey(0), unireg_check(unireg_check_arg), @@ -1274,18 +1268,18 @@ my_decimal *Field::val_decimal(my_decimal *decimal) void Field_num::add_zerofill_and_unsigned(String &res) const { if (unsigned_flag) - res.append(" unsigned"); + res.append(STRING_WITH_LEN(" unsigned")); if (zerofill) - res.append(" zerofill"); + res.append(STRING_WITH_LEN(" zerofill")); } void Field::make_field(Send_field *field) { - if (orig_table->s->table_cache_key && *(orig_table->s->table_cache_key)) + if (orig_table->s->db.str && *orig_table->s->db.str) { - field->org_table_name= orig_table->s->table_name; - field->db_name= orig_table->s->table_cache_key; + field->db_name= orig_table->s->db.str; + field->org_table_name= orig_table->s->table_name.str; } else field->org_table_name= field->db_name= ""; @@ -1393,10 +1387,9 @@ my_decimal* Field_num::val_decimal(my_decimal *decimal_value) Field_str::Field_str(char *ptr_arg,uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, utype unireg_check_arg, - const char *field_name_arg, - struct st_table *table_arg,CHARSET_INFO *charset) + const char *field_name_arg, CHARSET_INFO *charset) :Field(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, table_arg) + unireg_check_arg, field_name_arg) { field_charset=charset; if (charset->state & MY_CS_BINSORT) @@ -1529,7 +1522,7 @@ Field *Field::new_field(MEM_ROOT *root, struct st_table *new_table) tmp->key_start.init(0); tmp->part_of_key.init(0); tmp->part_of_sortkey.init(0); - tmp->unireg_check=Field::NONE; + tmp->unireg_check= Field::NONE; tmp->flags&= (NOT_NULL_FLAG | BLOB_FLAG | UNSIGNED_FLAG | ZEROFILL_FLAG | BINARY_FLAG | ENUM_FLAG | SET_FLAG); tmp->reset_fields(); @@ -1651,13 +1644,28 @@ bool Field::needs_quotes(void) } +/* This is used to generate a field in TABLE from TABLE_SHARE */ + +Field *Field::clone(MEM_ROOT *root, struct st_table *new_table) +{ + Field *tmp; + if ((tmp= (Field*) memdup_root(root,(char*) this,size_of()))) + { + tmp->init(new_table); + tmp->move_field_offset((my_ptrdiff_t) (new_table->record[0] - + new_table->s->default_values)); + } + return tmp; +} + + /**************************************************************************** Field_null, a field that always return NULL ****************************************************************************/ void Field_null::sql_type(String &res) const { - res.set_ascii("null", 4); + res.set_ascii(STRING_WITH_LEN("null")); } @@ -1669,7 +1677,7 @@ void Field_null::sql_type(String &res) const void Field_decimal::reset(void) { - Field_decimal::store("0",1,&my_charset_bin); + Field_decimal::store(STRING_WITH_LEN("0"),&my_charset_bin); } void Field_decimal::overflow(bool negative) @@ -2280,13 +2288,10 @@ Field_new_decimal::Field_new_decimal(char *ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, - struct st_table *table_arg, uint8 dec_arg,bool zero_arg, bool unsigned_arg) - :Field_num(ptr_arg, len_arg, - null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, table_arg, - dec_arg, zero_arg, unsigned_arg) + :Field_num(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, + unireg_check_arg, field_name_arg, dec_arg, zero_arg, unsigned_arg) { precision= my_decimal_length_to_precision(len_arg, dec_arg, unsigned_arg); DBUG_ASSERT((precision <= DECIMAL_MAX_PRECISION) && @@ -2298,14 +2303,11 @@ Field_new_decimal::Field_new_decimal(char *ptr_arg, Field_new_decimal::Field_new_decimal(uint32 len_arg, bool maybe_null, const char *name, - struct st_table *t_arg, uint8 dec_arg, bool unsigned_arg) :Field_num((char*) 0, len_arg, maybe_null ? (uchar*) "": 0, 0, - NONE, name, t_arg, - dec_arg, - 0, unsigned_arg) + NONE, name, dec_arg, 0, unsigned_arg) { precision= my_decimal_length_to_precision(len_arg, dec_arg, unsigned_arg); DBUG_ASSERT((precision <= DECIMAL_MAX_PRECISION) && @@ -2384,7 +2386,7 @@ bool Field_new_decimal::store_value(const my_decimal *decimal_value) #ifndef DBUG_OFF { char dbug_buff[DECIMAL_MAX_STR_LENGTH+1]; - DBUG_PRINT("info", ("saving with precision %d, scale: %d, value %s", + DBUG_PRINT("info", ("saving with precision %d scale: %d value %s", (int)precision, (int)dec, dbug_decimal_as_string(dbug_buff, decimal_value))); } @@ -2399,7 +2401,8 @@ bool Field_new_decimal::store_value(const my_decimal *decimal_value) my_decimal2binary(E_DEC_FATAL_ERROR, &buff, ptr, precision, dec); error= 1; } - DBUG_EXECUTE("info", print_decimal_buff(decimal_value, (byte *) ptr, bin_size);); + DBUG_EXECUTE("info", print_decimal_buff(decimal_value, (byte *) ptr, + bin_size);); DBUG_RETURN(error); } @@ -3955,7 +3958,7 @@ longlong Field_float::val_int(void) else #endif memcpy_fixed((byte*) &j,ptr,sizeof(j)); - return ((longlong) j); + return (longlong) rint(j); } @@ -4115,7 +4118,7 @@ void Field_float::sql_type(String &res) const { if (dec == NOT_FIXED_DEC) { - res.set_ascii("float", 5); + res.set_ascii(STRING_WITH_LEN("float")); } else { @@ -4243,7 +4246,7 @@ longlong Field_double::val_int(void) else #endif doubleget(j,ptr); - return ((longlong) j); + return (longlong) rint(j); } @@ -4386,7 +4389,7 @@ void Field_double::sql_type(String &res) const CHARSET_INFO *cs=res.charset(); if (dec == NOT_FIXED_DEC) { - res.set_ascii("double",6); + res.set_ascii(STRING_WITH_LEN("double")); } else { @@ -4446,19 +4449,18 @@ Field_timestamp::Field_timestamp(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, - struct st_table *table_arg, + TABLE_SHARE *share, CHARSET_INFO *cs) :Field_str(ptr_arg, 19, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, table_arg, cs) + unireg_check_arg, field_name_arg, cs) { /* For 4.0 MYD and 4.0 InnoDB compatibility */ flags|= ZEROFILL_FLAG | UNSIGNED_FLAG; - if (table && !table->timestamp_field && - unireg_check != NONE) + if (!share->timestamp_field && unireg_check != NONE) { /* This timestamp has auto-update */ - table->timestamp_field= this; - flags|=TIMESTAMP_FLAG; + share->timestamp_field= this; + flags|= TIMESTAMP_FLAG; } } @@ -4675,7 +4677,7 @@ String *Field_timestamp::val_str(String *val_buffer, String *val_ptr) if (temp == 0L) { /* Zero time is "000000" */ - val_ptr->set("0000-00-00 00:00:00", 19, &my_charset_bin); + val_ptr->set(STRING_WITH_LEN("0000-00-00 00:00:00"), &my_charset_bin); return val_ptr; } val_buffer->set_charset(&my_charset_bin); // Safety @@ -4807,7 +4809,7 @@ void Field_timestamp::sort_string(char *to,uint length __attribute__((unused))) void Field_timestamp::sql_type(String &res) const { - res.set_ascii("timestamp", 9); + res.set_ascii(STRING_WITH_LEN("timestamp")); } @@ -5076,7 +5078,7 @@ void Field_time::sort_string(char *to,uint length __attribute__((unused))) void Field_time::sql_type(String &res) const { - res.set_ascii("time", 4); + res.set_ascii(STRING_WITH_LEN("time")); } /**************************************************************************** @@ -5383,7 +5385,7 @@ void Field_date::sort_string(char *to,uint length __attribute__((unused))) void Field_date::sql_type(String &res) const { - res.set_ascii("date", 4); + res.set_ascii(STRING_WITH_LEN("date")); } @@ -5566,7 +5568,7 @@ void Field_newdate::sort_string(char *to,uint length __attribute__((unused))) void Field_newdate::sql_type(String &res) const { - res.set_ascii("date", 4); + res.set_ascii(STRING_WITH_LEN("date")); } @@ -5840,7 +5842,7 @@ void Field_datetime::sort_string(char *to,uint length __attribute__((unused))) void Field_datetime::sql_type(String &res) const { - res.set_ascii("datetime", 8); + res.set_ascii(STRING_WITH_LEN("datetime")); } /**************************************************************************** @@ -6083,7 +6085,7 @@ void Field_string::sql_type(String &res) const res.length(length); if ((thd->variables.sql_mode & (MODE_MYSQL323 | MODE_MYSQL40)) && has_charset() && (charset()->state & MY_CS_BINSORT)) - res.append(" binary"); + res.append(STRING_WITH_LEN(" binary")); } @@ -6216,6 +6218,7 @@ uint Field_string::max_packed_col_length(uint max_length) Field *Field_string::new_field(MEM_ROOT *root, struct st_table *new_table) { + Field *field; if (type() != MYSQL_TYPE_VAR_STRING || table == new_table) return Field::new_field(root, new_table); @@ -6224,11 +6227,23 @@ Field *Field_string::new_field(MEM_ROOT *root, struct st_table *new_table) This is done to ensure that ALTER TABLE will convert old VARCHAR fields to now VARCHAR fields. */ - return new Field_varstring(field_length, maybe_null(), - field_name, new_table, - charset()); + if ((field= new Field_varstring(field_length, maybe_null(), field_name, + new_table->s, charset()))) + { + field->init(new_table); + /* + delayed_insert::get_local_table() needs a ptr copied from old table. + This is what other new_field() methods do too. The above method of + Field_varstring sets ptr to NULL. + */ + field->ptr= ptr; + field->null_ptr= null_ptr; + field->null_bit= null_bit; + } + return field; } + /**************************************************************************** VARCHAR type Data in field->ptr is stored as: @@ -6472,7 +6487,7 @@ void Field_varstring::sql_type(String &res) const res.length(length); if ((thd->variables.sql_mode & (MODE_MYSQL323 | MODE_MYSQL40)) && has_charset() && (charset()->state & MY_CS_BINSORT)) - res.append(" binary"); + res.append(STRING_WITH_LEN(" binary")); } @@ -6770,16 +6785,15 @@ uint Field_varstring::is_equal(create_field *new_field) Field_blob::Field_blob(char *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, - struct st_table *table_arg,uint blob_pack_length, + TABLE_SHARE *share, uint blob_pack_length, CHARSET_INFO *cs) :Field_longstr(ptr_arg, BLOB_PACK_LENGTH_TO_MAX_LENGH(blob_pack_length), - null_ptr_arg, null_bit_arg, unireg_check_arg, field_name_arg, - table_arg, cs), + null_ptr_arg, null_bit_arg, unireg_check_arg, field_name_arg, + cs), packlength(blob_pack_length) { flags|= BLOB_FLAG; - if (table) - table->s->blob_fields++; + share->blob_fields++; } @@ -7211,10 +7225,10 @@ void Field_blob::sql_type(String &res) const } res.set_ascii(str,length); if (charset() == &my_charset_bin) - res.append("blob"); + res.append(STRING_WITH_LEN("blob")); else { - res.append("text"); + res.append(STRING_WITH_LEN("text")); } } @@ -7434,28 +7448,28 @@ void Field_geom::sql_type(String &res) const switch (geom_type) { case GEOM_POINT: - res.set("point", 5, cs); + res.set(STRING_WITH_LEN("point"), cs); break; case GEOM_LINESTRING: - res.set("linestring", 10, cs); + res.set(STRING_WITH_LEN("linestring"), cs); break; case GEOM_POLYGON: - res.set("polygon", 7, cs); + res.set(STRING_WITH_LEN("polygon"), cs); break; case GEOM_MULTIPOINT: - res.set("multipoint", 10, cs); + res.set(STRING_WITH_LEN("multipoint"), cs); break; case GEOM_MULTILINESTRING: - res.set("multilinestring", 15, cs); + res.set(STRING_WITH_LEN("multilinestring"), cs); break; case GEOM_MULTIPOLYGON: - res.set("multipolygon", 12, cs); + res.set(STRING_WITH_LEN("multipolygon"), cs); break; case GEOM_GEOMETRYCOLLECTION: - res.set("geometrycollection", 18, cs); + res.set(STRING_WITH_LEN("geometrycollection"), cs); break; default: - res.set("geometry", 8, cs); + res.set(STRING_WITH_LEN("geometry"), cs); } } @@ -7732,7 +7746,7 @@ void Field_enum::sql_type(String &res) const String enum_item(buffer, sizeof(buffer), res.charset()); res.length(0); - res.append("enum("); + res.append(STRING_WITH_LEN("enum(")); bool flag=0; uint *len= typelib->type_lengths; @@ -7846,7 +7860,7 @@ void Field_set::sql_type(String &res) const String set_item(buffer, sizeof(buffer), res.charset()); res.length(0); - res.append("set("); + res.append(STRING_WITH_LEN("set(")); bool flag=0; uint *len= typelib->type_lengths; @@ -7947,10 +7961,9 @@ uint Field_num::is_equal(create_field *new_field) Field_bit::Field_bit(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, uchar *bit_ptr_arg, uchar bit_ofs_arg, - enum utype unireg_check_arg, const char *field_name_arg, - struct st_table *table_arg) + enum utype unireg_check_arg, const char *field_name_arg) : Field(ptr_arg, len_arg >> 3, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, table_arg), + unireg_check_arg, field_name_arg), bit_ptr(bit_ptr_arg), bit_ofs(bit_ofs_arg), bit_len(len_arg & 7) { /* @@ -7986,7 +7999,7 @@ int Field_bit::store(const char *from, uint length, CHARSET_INFO *cs) { int delta; - for (; !*from && length; from++, length--); // skip left 0's + for (; length && !*from; from++, length--); // skip left 0's delta= field_length - length; if (delta < -1 || @@ -8217,11 +8230,10 @@ Field_bit_as_char::Field_bit_as_char(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, uchar *bit_ptr_arg, uchar bit_ofs_arg, enum utype unireg_check_arg, - const char *field_name_arg, - struct st_table *table_arg) - : Field_bit(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, bit_ptr_arg, - bit_ofs_arg, unireg_check_arg, field_name_arg, table_arg), - create_length(len_arg) + const char *field_name_arg) + :Field_bit(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, bit_ptr_arg, + bit_ofs_arg, unireg_check_arg, field_name_arg), + create_length(len_arg) { bit_ptr= 0; bit_ofs= 0; @@ -8235,7 +8247,7 @@ int Field_bit_as_char::store(const char *from, uint length, CHARSET_INFO *cs) int delta; uchar bits= create_length & 7; - for (; !*from && length; from++, length--); // skip left 0's + for (; length && !*from; from++, length--); // skip left 0's delta= field_length - length; if (delta < 0 || @@ -8415,7 +8427,7 @@ uint pack_length_to_packflag(uint type) } -Field *make_field(char *ptr, uint32 field_length, +Field *make_field(TABLE_SHARE *share, char *ptr, uint32 field_length, uchar *null_pos, uchar null_bit, uint pack_flag, enum_field_types field_type, @@ -8423,8 +8435,7 @@ Field *make_field(char *ptr, uint32 field_length, Field::geometry_type geom_type, Field::utype unireg_check, TYPELIB *interval, - const char *field_name, - struct st_table *table) + const char *field_name) { uchar *bit_ptr; uchar bit_offset; @@ -8470,13 +8481,14 @@ Field *make_field(char *ptr, uint32 field_length, field_type == FIELD_TYPE_DECIMAL || // 3.23 or 4.0 string field_type == MYSQL_TYPE_VAR_STRING) return new Field_string(ptr,field_length,null_pos,null_bit, - unireg_check, field_name, table, + unireg_check, field_name, field_charset); if (field_type == MYSQL_TYPE_VARCHAR) return new Field_varstring(ptr,field_length, HA_VARCHAR_PACKLENGTH(field_length), null_pos,null_bit, - unireg_check, field_name, table, + unireg_check, field_name, + share, field_charset); return 0; // Error } @@ -8488,22 +8500,22 @@ Field *make_field(char *ptr, uint32 field_length, #ifdef HAVE_SPATIAL if (f_is_geom(pack_flag)) return new Field_geom(ptr,null_pos,null_bit, - unireg_check, field_name, table, + unireg_check, field_name, share, pack_length, geom_type); #endif if (f_is_blob(pack_flag)) return new Field_blob(ptr,null_pos,null_bit, - unireg_check, field_name, table, + unireg_check, field_name, share, pack_length, field_charset); if (interval) { if (f_is_enum(pack_flag)) return new Field_enum(ptr,field_length,null_pos,null_bit, - unireg_check, field_name, table, + unireg_check, field_name, pack_length, interval, field_charset); else return new Field_set(ptr,field_length,null_pos,null_bit, - unireg_check, field_name, table, + unireg_check, field_name, pack_length, interval, field_charset); } } @@ -8511,80 +8523,82 @@ Field *make_field(char *ptr, uint32 field_length, switch (field_type) { case FIELD_TYPE_DECIMAL: return new Field_decimal(ptr,field_length,null_pos,null_bit, - unireg_check, field_name, table, + unireg_check, field_name, f_decimals(pack_flag), f_is_zerofill(pack_flag) != 0, f_is_dec(pack_flag) == 0); case FIELD_TYPE_NEWDECIMAL: return new Field_new_decimal(ptr,field_length,null_pos,null_bit, - unireg_check, field_name, table, + unireg_check, field_name, f_decimals(pack_flag), f_is_zerofill(pack_flag) != 0, f_is_dec(pack_flag) == 0); case FIELD_TYPE_FLOAT: return new Field_float(ptr,field_length,null_pos,null_bit, - unireg_check, field_name, table, + unireg_check, field_name, f_decimals(pack_flag), f_is_zerofill(pack_flag) != 0, f_is_dec(pack_flag)== 0); case FIELD_TYPE_DOUBLE: return new Field_double(ptr,field_length,null_pos,null_bit, - unireg_check, field_name, table, + unireg_check, field_name, f_decimals(pack_flag), f_is_zerofill(pack_flag) != 0, f_is_dec(pack_flag)== 0); case FIELD_TYPE_TINY: return new Field_tiny(ptr,field_length,null_pos,null_bit, - unireg_check, field_name, table, + unireg_check, field_name, f_is_zerofill(pack_flag) != 0, f_is_dec(pack_flag) == 0); case FIELD_TYPE_SHORT: return new Field_short(ptr,field_length,null_pos,null_bit, - unireg_check, field_name, table, + unireg_check, field_name, f_is_zerofill(pack_flag) != 0, f_is_dec(pack_flag) == 0); case FIELD_TYPE_INT24: return new Field_medium(ptr,field_length,null_pos,null_bit, - unireg_check, field_name, table, + unireg_check, field_name, f_is_zerofill(pack_flag) != 0, f_is_dec(pack_flag) == 0); case FIELD_TYPE_LONG: return new Field_long(ptr,field_length,null_pos,null_bit, - unireg_check, field_name, table, + unireg_check, field_name, f_is_zerofill(pack_flag) != 0, f_is_dec(pack_flag) == 0); case FIELD_TYPE_LONGLONG: return new Field_longlong(ptr,field_length,null_pos,null_bit, - unireg_check, field_name, table, + unireg_check, field_name, f_is_zerofill(pack_flag) != 0, f_is_dec(pack_flag) == 0); case FIELD_TYPE_TIMESTAMP: return new Field_timestamp(ptr,field_length, null_pos, null_bit, - unireg_check, field_name, table, + unireg_check, field_name, share, field_charset); case FIELD_TYPE_YEAR: return new Field_year(ptr,field_length,null_pos,null_bit, - unireg_check, field_name, table); + unireg_check, field_name); case FIELD_TYPE_DATE: return new Field_date(ptr,null_pos,null_bit, - unireg_check, field_name, table, field_charset); + unireg_check, field_name, field_charset); case FIELD_TYPE_NEWDATE: return new Field_newdate(ptr,null_pos,null_bit, - unireg_check, field_name, table, field_charset); + unireg_check, field_name, field_charset); case FIELD_TYPE_TIME: return new Field_time(ptr,null_pos,null_bit, - unireg_check, field_name, table, field_charset); + unireg_check, field_name, field_charset); case FIELD_TYPE_DATETIME: return new Field_datetime(ptr,null_pos,null_bit, - unireg_check, field_name, table, field_charset); + unireg_check, field_name, field_charset); case FIELD_TYPE_NULL: - return new Field_null(ptr,field_length,unireg_check,field_name,table, field_charset); + return new Field_null(ptr, field_length, unireg_check, field_name, + field_charset); case FIELD_TYPE_BIT: return f_bit_as_char(pack_flag) ? - new Field_bit_as_char(ptr, field_length, null_pos, null_bit, bit_ptr, - bit_offset, unireg_check, field_name, table) : - new Field_bit(ptr, field_length, null_pos, null_bit, bit_ptr, - bit_offset, unireg_check, field_name, table); + new Field_bit_as_char(ptr, field_length, null_pos, null_bit, + bit_ptr, bit_offset, unireg_check, field_name) : + new Field_bit(ptr, field_length, null_pos, null_bit, bit_ptr, + bit_offset, unireg_check, field_name); + default: // Impossible (Wrong version) break; } @@ -8666,14 +8680,15 @@ create_field::create_field(Field *old_field,Field *orig_field) char buff[MAX_FIELD_WIDTH],*pos; String tmp(buff,sizeof(buff), charset), *res; my_ptrdiff_t diff; + bool is_null; /* Get the value from default_values */ diff= (my_ptrdiff_t) (orig_field->table->s->default_values- orig_field->table->record[0]); - orig_field->move_field(diff); // Points now at default_values - bool is_null=orig_field->is_real_null(); + orig_field->move_field_offset(diff); // Points now at default_values + is_null= orig_field->is_real_null(); res= orig_field->val_str(&tmp); - orig_field->move_field(-diff); // Back to record[0] + orig_field->move_field_offset(-diff); // Back to record[0] if (!is_null) { pos= (char*) sql_strmake(res->ptr(), res->length()); diff --git a/sql/field.h b/sql/field.h index 77d00b671f6..9c4b5281cf4 100644 --- a/sql/field.h +++ b/sql/field.h @@ -96,8 +96,7 @@ public: uchar null_bit; // Bit used to test null bit Field(char *ptr_arg,uint32 length_arg,uchar *null_ptr_arg,uchar null_bit_arg, - utype unireg_check_arg, const char *field_name_arg, - struct st_table *table_arg); + utype unireg_check_arg, const char *field_name_arg); virtual ~Field() {} /* Store functions returns 1 on overflow and -1 on fatal error */ virtual int store(const char *to,uint length,CHARSET_INFO *cs)=0; @@ -215,12 +214,13 @@ public: virtual Field *new_key_field(MEM_ROOT *root, struct st_table *new_table, char *new_ptr, uchar *new_null_ptr, uint new_null_bit); + Field *clone(MEM_ROOT *mem_root, struct st_table *new_table); inline void move_field(char *ptr_arg,uchar *null_ptr_arg,uchar null_bit_arg) { ptr=ptr_arg; null_ptr=null_ptr_arg; null_bit=null_bit_arg; } inline void move_field(char *ptr_arg) { ptr=ptr_arg; } - inline void move_field(my_ptrdiff_t ptr_diff) + virtual void move_field_offset(my_ptrdiff_t ptr_diff) { ptr=ADD_TO_PTR(ptr,ptr_diff,char*); if (null_ptr) @@ -315,6 +315,12 @@ public: return (op_result == E_DEC_OVERFLOW); } int warn_if_overflow(int op_result); + void init(TABLE *table_arg) + { + orig_table= table= table_arg; + table_name= &table_arg->alias; + } + /* maximum possible display length */ virtual uint32 max_length()= 0; @@ -347,7 +353,6 @@ public: Field_num(char *ptr_arg,uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, utype unireg_check_arg, const char *field_name_arg, - struct st_table *table_arg, uint8 dec_arg, bool zero_arg, bool unsigned_arg); Item_result result_type () const { return REAL_RESULT; } void prepend_zeros(String *value); @@ -369,8 +374,7 @@ protected: public: Field_str(char *ptr_arg,uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, utype unireg_check_arg, - const char *field_name_arg, - struct st_table *table_arg, CHARSET_INFO *charset); + const char *field_name_arg, CHARSET_INFO *charset); Item_result result_type () const { return STRING_RESULT; } uint decimals() const { return NOT_FIXED_DEC; } int store(double nr); @@ -395,10 +399,9 @@ class Field_longstr :public Field_str public: Field_longstr(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, utype unireg_check_arg, - const char *field_name_arg, - struct st_table *table_arg,CHARSET_INFO *charset) + const char *field_name_arg, CHARSET_INFO *charset) :Field_str(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, unireg_check_arg, - field_name_arg, table_arg, charset) + field_name_arg, charset) {} int store_decimal(const my_decimal *d); @@ -407,17 +410,13 @@ public: /* base class for float and double and decimal (old one) */ class Field_real :public Field_num { public: - Field_real(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, utype unireg_check_arg, const char *field_name_arg, - struct st_table *table_arg, uint8 dec_arg, bool zero_arg, bool unsigned_arg) :Field_num(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, unireg_check_arg, - field_name_arg, table_arg, dec_arg, zero_arg, unsigned_arg) + field_name_arg, dec_arg, zero_arg, unsigned_arg) {} - - int store_decimal(const my_decimal *); my_decimal *val_decimal(my_decimal *); }; @@ -428,10 +427,9 @@ public: Field_decimal(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, - struct st_table *table_arg, uint8 dec_arg,bool zero_arg,bool unsigned_arg) :Field_real(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, table_arg, + unireg_check_arg, field_name_arg, dec_arg, zero_arg, unsigned_arg) {} enum_field_types type() const { return FIELD_TYPE_DECIMAL;} @@ -468,11 +466,9 @@ public: Field_new_decimal(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, - struct st_table *table_arg, uint8 dec_arg, bool zero_arg, bool unsigned_arg); Field_new_decimal(uint32 len_arg, bool maybe_null_arg, - const char *field_name_arg, - struct st_table *table_arg, uint8 dec_arg, + const char *field_name_arg, uint8 dec_arg, bool unsigned_arg); enum_field_types type() const { return FIELD_TYPE_NEWDECIMAL;} enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; } @@ -503,10 +499,9 @@ public: Field_tiny(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, - struct st_table *table_arg, bool zero_arg, bool unsigned_arg) :Field_num(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, table_arg, + unireg_check_arg, field_name_arg, 0, zero_arg,unsigned_arg) {} enum Item_result result_type () const { return INT_RESULT; } @@ -534,16 +529,15 @@ public: Field_short(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, - struct st_table *table_arg, bool zero_arg, bool unsigned_arg) :Field_num(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, table_arg, + unireg_check_arg, field_name_arg, 0, zero_arg,unsigned_arg) {} Field_short(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg, - struct st_table *table_arg,bool unsigned_arg) + bool unsigned_arg) :Field_num((char*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0,0, - NONE, field_name_arg, table_arg,0,0,unsigned_arg) + NONE, field_name_arg, 0, 0, unsigned_arg) {} enum Item_result result_type () const { return INT_RESULT; } enum_field_types type() const { return FIELD_TYPE_SHORT;} @@ -570,10 +564,9 @@ public: Field_medium(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, - struct st_table *table_arg, bool zero_arg, bool unsigned_arg) :Field_num(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, table_arg, + unireg_check_arg, field_name_arg, 0, zero_arg,unsigned_arg) {} enum Item_result result_type () const { return INT_RESULT; } @@ -601,16 +594,15 @@ public: Field_long(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, - struct st_table *table_arg, bool zero_arg, bool unsigned_arg) :Field_num(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, table_arg, + unireg_check_arg, field_name_arg, 0, zero_arg,unsigned_arg) {} Field_long(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg, - struct st_table *table_arg,bool unsigned_arg) + bool unsigned_arg) :Field_num((char*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0,0, - NONE, field_name_arg, table_arg,0,0,unsigned_arg) + NONE, field_name_arg,0,0,unsigned_arg) {} enum Item_result result_type () const { return INT_RESULT; } enum_field_types type() const { return FIELD_TYPE_LONG;} @@ -638,17 +630,16 @@ public: Field_longlong(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, - struct st_table *table_arg, bool zero_arg, bool unsigned_arg) :Field_num(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, table_arg, + unireg_check_arg, field_name_arg, 0, zero_arg,unsigned_arg) {} Field_longlong(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg, - struct st_table *table_arg, bool unsigned_arg) + bool unsigned_arg) :Field_num((char*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0,0, - NONE, field_name_arg, table_arg,0,0,unsigned_arg) + NONE, field_name_arg,0,0,unsigned_arg) {} enum Item_result result_type () const { return INT_RESULT; } enum_field_types type() const { return FIELD_TYPE_LONGLONG;} @@ -677,16 +668,15 @@ public: Field_float(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, - struct st_table *table_arg, uint8 dec_arg,bool zero_arg,bool unsigned_arg) :Field_real(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, table_arg, + unireg_check_arg, field_name_arg, dec_arg, zero_arg, unsigned_arg) {} Field_float(uint32 len_arg, bool maybe_null_arg, const char *field_name_arg, - struct st_table *table_arg, uint8 dec_arg) + uint8 dec_arg) :Field_real((char*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0, (uint) 0, - NONE, field_name_arg, table_arg, dec_arg, 0, 0) + NONE, field_name_arg, dec_arg, 0, 0) {} enum_field_types type() const { return FIELD_TYPE_FLOAT;} enum ha_base_keytype key_type() const { return HA_KEYTYPE_FLOAT; } @@ -711,16 +701,15 @@ public: Field_double(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, - struct st_table *table_arg, uint8 dec_arg,bool zero_arg,bool unsigned_arg) :Field_real(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, table_arg, + unireg_check_arg, field_name_arg, dec_arg, zero_arg, unsigned_arg) {} Field_double(uint32 len_arg, bool maybe_null_arg, const char *field_name_arg, - struct st_table *table_arg, uint8 dec_arg) + uint8 dec_arg) :Field_real((char*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0, (uint) 0, - NONE, field_name_arg, table_arg, dec_arg, 0, 0) + NONE, field_name_arg, dec_arg, 0, 0) {} enum_field_types type() const { return FIELD_TYPE_DOUBLE;} enum ha_base_keytype key_type() const { return HA_KEYTYPE_DOUBLE; } @@ -747,9 +736,9 @@ class Field_null :public Field_str { public: Field_null(char *ptr_arg, uint32 len_arg, enum utype unireg_check_arg, const char *field_name_arg, - struct st_table *table_arg, CHARSET_INFO *cs) + CHARSET_INFO *cs) :Field_str(ptr_arg, len_arg, null, 1, - unireg_check_arg, field_name_arg, table_arg, cs) + unireg_check_arg, field_name_arg, cs) {} enum_field_types type() const { return FIELD_TYPE_NULL;} int store(const char *to, uint length, CHARSET_INFO *cs) @@ -777,8 +766,7 @@ public: Field_timestamp(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, - struct st_table *table_arg, - CHARSET_INFO *cs); + TABLE_SHARE *share, CHARSET_INFO *cs); enum_field_types type() const { return FIELD_TYPE_TIMESTAMP;} enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; } enum Item_result cmp_type () const { return INT_RESULT; } @@ -828,10 +816,9 @@ class Field_year :public Field_tiny { public: Field_year(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, - enum utype unireg_check_arg, const char *field_name_arg, - struct st_table *table_arg) + enum utype unireg_check_arg, const char *field_name_arg) :Field_tiny(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, table_arg, 1, 1) + unireg_check_arg, field_name_arg, 1, 1) {} enum_field_types type() const { return FIELD_TYPE_YEAR;} int store(const char *to,uint length,CHARSET_INFO *charset); @@ -850,14 +837,14 @@ class Field_date :public Field_str { public: Field_date(char *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, - struct st_table *table_arg, CHARSET_INFO *cs) + CHARSET_INFO *cs) :Field_str(ptr_arg, 10, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, table_arg, cs) + unireg_check_arg, field_name_arg, cs) {} Field_date(bool maybe_null_arg, const char *field_name_arg, - struct st_table *table_arg, CHARSET_INFO *cs) + CHARSET_INFO *cs) :Field_str((char*) 0,10, maybe_null_arg ? (uchar*) "": 0,0, - NONE, field_name_arg, table_arg, cs) {} + NONE, field_name_arg, cs) {} enum_field_types type() const { return FIELD_TYPE_DATE;} enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; } enum Item_result cmp_type () const { return INT_RESULT; } @@ -877,13 +864,14 @@ public: bool zero_pack() const { return 1; } }; + class Field_newdate :public Field_str { public: Field_newdate(char *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, - struct st_table *table_arg, CHARSET_INFO *cs) + CHARSET_INFO *cs) :Field_str(ptr_arg, 10, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, table_arg, cs) + unireg_check_arg, field_name_arg, cs) {} enum_field_types type() const { return FIELD_TYPE_DATE;} enum_field_types real_type() const { return FIELD_TYPE_NEWDATE; } @@ -913,14 +901,14 @@ class Field_time :public Field_str { public: Field_time(char *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, - struct st_table *table_arg, CHARSET_INFO *cs) + CHARSET_INFO *cs) :Field_str(ptr_arg, 8, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, table_arg, cs) + unireg_check_arg, field_name_arg, cs) {} Field_time(bool maybe_null_arg, const char *field_name_arg, - struct st_table *table_arg, CHARSET_INFO *cs) + CHARSET_INFO *cs) :Field_str((char*) 0,8, maybe_null_arg ? (uchar*) "": 0,0, - NONE, field_name_arg, table_arg, cs) {} + NONE, field_name_arg, cs) {} enum_field_types type() const { return FIELD_TYPE_TIME;} enum ha_base_keytype key_type() const { return HA_KEYTYPE_INT24; } enum Item_result cmp_type () const { return INT_RESULT; } @@ -948,14 +936,14 @@ class Field_datetime :public Field_str { public: Field_datetime(char *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, - struct st_table *table_arg, CHARSET_INFO *cs) + CHARSET_INFO *cs) :Field_str(ptr_arg, 19, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, table_arg, cs) + unireg_check_arg, field_name_arg, cs) {} Field_datetime(bool maybe_null_arg, const char *field_name_arg, - struct st_table *table_arg, CHARSET_INFO *cs) + CHARSET_INFO *cs) :Field_str((char*) 0,19, maybe_null_arg ? (uchar*) "": 0,0, - NONE, field_name_arg, table_arg, cs) {} + NONE, field_name_arg, cs) {} enum_field_types type() const { return FIELD_TYPE_DATETIME;} #ifdef HAVE_LONG_LONG enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONGLONG; } @@ -987,13 +975,13 @@ public: Field_string(char *ptr_arg, uint32 len_arg,uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, - struct st_table *table_arg, CHARSET_INFO *cs) + CHARSET_INFO *cs) :Field_longstr(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, table_arg, cs) {}; + unireg_check_arg, field_name_arg, cs) {}; Field_string(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg, - struct st_table *table_arg, CHARSET_INFO *cs) + CHARSET_INFO *cs) :Field_longstr((char*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0, 0, - NONE, field_name_arg, table_arg, cs) {}; + NONE, field_name_arg, cs) {}; enum_field_types type() const { @@ -1038,26 +1026,23 @@ public: uint32 length_bytes; Field_varstring(char *ptr_arg, uint32 len_arg, uint length_bytes_arg, - uchar *null_ptr_arg, - uchar null_bit_arg, + uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, - struct st_table *table_arg, CHARSET_INFO *cs) + TABLE_SHARE *share, CHARSET_INFO *cs) :Field_longstr(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, table_arg, cs), + unireg_check_arg, field_name_arg, cs), length_bytes(length_bytes_arg) { - if (table) - table->s->varchar_fields++; + share->varchar_fields++; } Field_varstring(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg, - struct st_table *table_arg, CHARSET_INFO *cs) + TABLE_SHARE *share, CHARSET_INFO *cs) :Field_longstr((char*) 0,len_arg, maybe_null_arg ? (uchar*) "": 0, 0, - NONE, field_name_arg, table_arg, cs), + NONE, field_name_arg, cs), length_bytes(len_arg < 256 ? 1 :2) { - if (table) - table->s->varchar_fields++; + share->varchar_fields++; } enum_field_types type() const { return MYSQL_TYPE_VARCHAR; } @@ -1081,7 +1066,7 @@ public: int cmp_max(const char *, const char *, uint max_length); int cmp(const char *a,const char*b) { - return cmp_max(a, b, ~0); + return cmp_max(a, b, ~0L); } void sort_string(char *buff,uint length); void get_key_image(char *buff,uint length, imagetype type); @@ -1119,12 +1104,11 @@ protected: public: Field_blob(char *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, - struct st_table *table_arg,uint blob_pack_length, - CHARSET_INFO *cs); + TABLE_SHARE *share, uint blob_pack_length, CHARSET_INFO *cs); Field_blob(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg, - struct st_table *table_arg, CHARSET_INFO *cs) - :Field_longstr((char*) 0,len_arg, maybe_null_arg ? (uchar*) "": 0, 0, - NONE, field_name_arg, table_arg, cs), + CHARSET_INFO *cs) + :Field_longstr((char*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0, 0, + NONE, field_name_arg, cs), packlength(4) { flags|= BLOB_FLAG; @@ -1141,7 +1125,7 @@ public: my_decimal *val_decimal(my_decimal *); int cmp_max(const char *, const char *, uint max_length); int cmp(const char *a,const char*b) - { return cmp_max(a, b, ~0); } + { return cmp_max(a, b, ~0L); } int cmp(const char *a, uint32 a_length, const char *b, uint32 b_length); int cmp_binary(const char *a,const char *b, uint32 max_length=~0L); int key_cmp(const byte *,const byte*); @@ -1221,15 +1205,14 @@ public: Field_geom(char *ptr_arg, uchar *null_ptr_arg, uint null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, - struct st_table *table_arg,uint blob_pack_length, + TABLE_SHARE *share, uint blob_pack_length, enum geometry_type geom_type_arg) :Field_blob(ptr_arg, null_ptr_arg, null_bit_arg, unireg_check_arg, - field_name_arg, table_arg, blob_pack_length,&my_charset_bin) + field_name_arg, share, blob_pack_length, &my_charset_bin) { geom_type= geom_type_arg; } Field_geom(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg, - struct st_table *table_arg, enum geometry_type geom_type_arg) - :Field_blob(len_arg, maybe_null_arg, field_name_arg, - table_arg, &my_charset_bin) + TABLE_SHARE *share, enum geometry_type geom_type_arg) + :Field_blob(len_arg, maybe_null_arg, field_name_arg, &my_charset_bin) { geom_type= geom_type_arg; } enum ha_base_keytype key_type() const { return HA_KEYTYPE_VARBINARY2; } enum_field_types type() const { return FIELD_TYPE_GEOMETRY; } @@ -1250,13 +1233,13 @@ protected: public: TYPELIB *typelib; Field_enum(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, - uchar null_bit_arg, - enum utype unireg_check_arg, const char *field_name_arg, - struct st_table *table_arg,uint packlength_arg, - TYPELIB *typelib_arg, - CHARSET_INFO *charset_arg) + uchar null_bit_arg, + enum utype unireg_check_arg, const char *field_name_arg, + uint packlength_arg, + TYPELIB *typelib_arg, + CHARSET_INFO *charset_arg) :Field_str(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, table_arg, charset_arg), + unireg_check_arg, field_name_arg, charset_arg), packlength(packlength_arg),typelib(typelib_arg) { flags|=ENUM_FLAG; @@ -1293,12 +1276,12 @@ public: Field_set(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, - struct st_table *table_arg,uint32 packlength_arg, + uint32 packlength_arg, TYPELIB *typelib_arg, CHARSET_INFO *charset_arg) :Field_enum(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, unireg_check_arg, field_name_arg, - table_arg, packlength_arg, - typelib_arg,charset_arg) + packlength_arg, + typelib_arg,charset_arg) { flags=(flags & ~ENUM_FLAG) | SET_FLAG; } @@ -1320,8 +1303,7 @@ public: uint bit_len; // number of 'uneven' high bits Field_bit(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, uchar *bit_ptr_arg, uchar bit_ofs_arg, - enum utype unireg_check_arg, const char *field_name_arg, - struct st_table *table_arg); + enum utype unireg_check_arg, const char *field_name_arg); enum_field_types type() const { return FIELD_TYPE_BIT; } enum ha_base_keytype key_type() const { return HA_KEYTYPE_BIT; } uint32 key_length() const { return (uint32) field_length + (bit_len > 0); } @@ -1363,6 +1345,11 @@ public: bit_ptr= bit_ptr_arg; bit_ofs= bit_ofs_arg; } + void move_field_offset(my_ptrdiff_t ptr_diff) + { + Field::move_field_offset(ptr_diff); + bit_ptr= ADD_TO_PTR(bit_ptr, ptr_diff, uchar*); + } }; @@ -1371,8 +1358,7 @@ public: uchar create_length; Field_bit_as_char(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, uchar *bit_ptr_arg, uchar bit_ofs_arg, - enum utype unireg_check_arg, const char *field_name_arg, - struct st_table *table_arg); + enum utype unireg_check_arg, const char *field_name_arg); enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; } uint32 max_length() { return (uint32) create_length; } uint size_of() const { return sizeof(*this); } @@ -1467,14 +1453,13 @@ public: }; -Field *make_field(char *ptr, uint32 field_length, +Field *make_field(TABLE_SHARE *share, char *ptr, uint32 field_length, uchar *null_pos, uchar null_bit, uint pack_flag, enum_field_types field_type, CHARSET_INFO *cs, Field::geometry_type geom_type, Field::utype unireg_check, - TYPELIB *interval, const char *field_name, - struct st_table *table); + TYPELIB *interval, const char *field_name); uint pack_length_to_packflag(uint type); enum_field_types get_blob_type_from_length(ulong length); uint32 calc_pack_length(enum_field_types type,uint32 length); diff --git a/sql/field_conv.cc b/sql/field_conv.cc index bbe2dbe5e9f..d46a3aa8be3 100644 --- a/sql/field_conv.cc +++ b/sql/field_conv.cc @@ -178,8 +178,7 @@ set_field_to_null_with_conversions(Field *field, bool no_conversions) } if (current_thd->count_cuted_fields == CHECK_FIELD_WARN) { - field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, - ER_WARN_NULL_TO_NOTNULL, 1); + field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_BAD_NULL_ERROR, 1); return 0; } if (!current_thd->no_errors) diff --git a/sql/ha_archive.cc b/sql/ha_archive.cc index 39f4c6667a0..b5c2f2a6555 100644 --- a/sql/ha_archive.cc +++ b/sql/ha_archive.cc @@ -135,7 +135,7 @@ static HASH archive_open_tables; #define ARCHIVE_CHECK_HEADER 254 // The number we use to determine corruption /* Static declarations for handerton */ -static handler *archive_create_handler(TABLE *table); +static handler *archive_create_handler(TABLE_SHARE *table); /* dummy handlerton - only to have something to return from archive_db_init */ @@ -172,7 +172,7 @@ handlerton archive_hton = { HTON_NO_FLAGS }; -static handler *archive_create_handler(TABLE *table) +static handler *archive_create_handler(TABLE_SHARE *table) { return new ha_archive(table); } @@ -242,14 +242,15 @@ int archive_db_end(ha_panic_function type) return 0; } -ha_archive::ha_archive(TABLE *table_arg) +ha_archive::ha_archive(TABLE_SHARE *table_arg) :handler(&archive_hton, table_arg), delayed_insert(0), bulk_insert(0) { /* Set our original buffer from pre-allocated memory */ buffer.set((char *)byte_buffer, IO_SIZE, system_charset_info); /* The size of the offset value we will use for position() */ - ref_length = sizeof(z_off_t); + ref_length = 2 << ((zlibCompileFlags() >> 6) & 3); + DBUG_ASSERT(ref_length <= sizeof(z_off_t)); } /* diff --git a/sql/ha_archive.h b/sql/ha_archive.h index 6d7a8c05ac9..ccfe1a85728 100644 --- a/sql/ha_archive.h +++ b/sql/ha_archive.h @@ -58,7 +58,7 @@ class ha_archive: public handler bool bulk_insert; /* If we are performing a bulk insert */ public: - ha_archive(TABLE *table_arg); + ha_archive(TABLE_SHARE *table_arg); ~ha_archive() { } diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc index 0c28b43dafb..ea9557d0c1d 100644 --- a/sql/ha_berkeley.cc +++ b/sql/ha_berkeley.cc @@ -79,9 +79,11 @@ bool berkeley_shared_data=0; u_int32_t berkeley_init_flags= DB_PRIVATE | DB_RECOVER, berkeley_env_flags= DB_LOG_AUTOREMOVE, berkeley_lock_type= DB_LOCK_DEFAULT; -ulong berkeley_cache_size, berkeley_log_buffer_size, berkeley_log_file_size=0; +ulong berkeley_log_buffer_size=0 , berkeley_log_file_size=0; +ulonglong berkeley_cache_size= 0; char *berkeley_home, *berkeley_tmpdir, *berkeley_logdir; long berkeley_lock_scan_time=0; +ulong berkeley_region_size=0, berkeley_cache_parts=1; ulong berkeley_trans_retry=1; ulong berkeley_max_lock; pthread_mutex_t bdb_mutex; @@ -90,9 +92,12 @@ static DB_ENV *db_env; static HASH bdb_open_tables; const char *berkeley_lock_names[] = -{ "DEFAULT", "OLDEST","RANDOM","YOUNGEST",0 }; +{ "DEFAULT", "OLDEST", "RANDOM", "YOUNGEST", "EXPIRE", "MAXLOCKS", + "MAXWRITE", "MINLOCKS", "MINWRITE", 0 }; u_int32_t berkeley_lock_types[]= -{ DB_LOCK_DEFAULT, DB_LOCK_OLDEST, DB_LOCK_RANDOM }; +{ DB_LOCK_DEFAULT, DB_LOCK_OLDEST, DB_LOCK_RANDOM, DB_LOCK_YOUNGEST, + DB_LOCK_EXPIRE, DB_LOCK_MAXLOCKS, DB_LOCK_MAXWRITE, DB_LOCK_MINLOCKS, + DB_LOCK_MINWRITE }; TYPELIB berkeley_lock_typelib= {array_elements(berkeley_lock_names)-1,"", berkeley_lock_names, NULL}; @@ -109,7 +114,7 @@ static void update_status(BDB_SHARE *share, TABLE *table); static int berkeley_close_connection(THD *thd); static int berkeley_commit(THD *thd, bool all); static int berkeley_rollback(THD *thd, bool all); -static handler *berkeley_create_handler(TABLE *table); +static handler *berkeley_create_handler(TABLE_SHARE *table); handlerton berkeley_hton = { "BerkeleyDB", @@ -144,7 +149,7 @@ handlerton berkeley_hton = { HTON_CLOSE_CURSORS_AT_COMMIT | HTON_FLUSH_AFTER_RENAME }; -handler *berkeley_create_handler(TABLE *table) +handler *berkeley_create_handler(TABLE_SHARE *table) { return new ha_berkeley(table); } @@ -203,10 +208,17 @@ bool berkeley_init(void) DB_VERB_DEADLOCK | DB_VERB_RECOVERY, 1); - db_env->set_cachesize(db_env, 0, berkeley_cache_size, 0); + if (berkeley_cache_size > (uint) ~0) + db_env->set_cachesize(db_env, berkeley_cache_size / (1024*1024L*1024L), + berkeley_cache_size % (1024L*1024L*1024L), + berkeley_cache_parts); + else + db_env->set_cachesize(db_env, 0, berkeley_cache_size, berkeley_cache_parts); + db_env->set_lg_max(db_env, berkeley_log_file_size); db_env->set_lg_bsize(db_env, berkeley_log_buffer_size); db_env->set_lk_detect(db_env, berkeley_lock_type); + db_env->set_lg_regionmax(db_env, berkeley_region_size); if (berkeley_max_lock) db_env->set_lk_max(db_env, berkeley_max_lock); @@ -401,7 +413,7 @@ void berkeley_cleanup_log_files(void) ** Berkeley DB tables *****************************************************************************/ -ha_berkeley::ha_berkeley(TABLE *table_arg) +ha_berkeley::ha_berkeley(TABLE_SHARE *table_arg) :handler(&berkeley_hton, table_arg), alloc_ptr(0), rec_buff(0), file(0), int_table_flags(HA_REC_NOT_IN_SEQ | HA_FAST_KEY_READ | HA_NULL_IN_KEY | HA_CAN_INDEX_BLOBS | HA_NOT_EXACT_COUNT | @@ -428,13 +440,14 @@ ulong ha_berkeley::index_flags(uint idx, uint part, bool all_parts) const | HA_READ_RANGE); for (uint i= all_parts ? 0 : part ; i <= part ; i++) { - if (table->key_info[idx].key_part[i].field->type() == FIELD_TYPE_BLOB) + KEY_PART_INFO *key_part= table_share->key_info[idx].key_part+i; + if (key_part->field->type() == FIELD_TYPE_BLOB) { /* We can't use BLOBS to shortcut sorts */ flags&= ~(HA_READ_ORDER | HA_KEYREAD_ONLY | HA_READ_RANGE); break; } - switch (table->key_info[idx].key_part[i].field->key_type()) { + switch (key_part->field->key_type()) { case HA_KEYTYPE_TEXT: case HA_KEYTYPE_VARTEXT1: case HA_KEYTYPE_VARTEXT2: @@ -442,8 +455,7 @@ ulong ha_berkeley::index_flags(uint idx, uint part, bool all_parts) const As BDB stores only one copy of equal strings, we can't use key read on these. Binary collations do support key read though. */ - if (!(table->key_info[idx].key_part[i].field->charset()->state - & MY_CS_BINSORT)) + if (!(key_part->field->charset()->state & MY_CS_BINSORT)) flags&= ~HA_KEYREAD_ONLY; break; default: // Keep compiler happy @@ -572,7 +584,6 @@ int ha_berkeley::open(const char *name, int mode, uint test_if_locked) uint open_mode=(mode == O_RDONLY ? DB_RDONLY : 0) | DB_THREAD; uint max_key_length; int error; - TABLE_SHARE *table_share= table->s; DBUG_ENTER("ha_berkeley::open"); /* Open primary key */ @@ -594,7 +605,7 @@ int ha_berkeley::open(const char *name, int mode, uint test_if_locked) &key_buff2, max_key_length, &primary_key_buff, (hidden_primary_key ? 0 : - table->key_info[table_share->primary_key].key_length), + table_share->key_info[table_share->primary_key].key_length), NullS))) DBUG_RETURN(1); /* purecov: inspected */ if (!(rec_buff= (byte*) my_malloc((alloced_rec_buff_length= @@ -751,9 +762,9 @@ bool ha_berkeley::fix_rec_buff_for_blob(ulong length) ulong ha_berkeley::max_row_length(const byte *buf) { - ulong length= table->s->reclength + table->s->fields*2; + ulong length= table_share->reclength + table_share->fields*2; uint *ptr, *end; - for (ptr= table->s->blob_field, end=ptr + table->s->blob_fields ; + for (ptr= table_share->blob_field, end=ptr + table_share->blob_fields ; ptr != end ; ptr++) { @@ -780,25 +791,26 @@ int ha_berkeley::pack_row(DBT *row, const byte *record, bool new_row) if (share->fixed_length_row) { row->data=(void*) record; - row->size= table->s->reclength+hidden_primary_key; + row->size= table_share->reclength+hidden_primary_key; if (hidden_primary_key) { if (new_row) get_auto_primary_key(current_ident); - memcpy_fixed((char*) record+table->s->reclength, (char*) current_ident, + memcpy_fixed((char*) record+table_share->reclength, + (char*) current_ident, BDB_HIDDEN_PRIMARY_KEY_LENGTH); } return 0; } - if (table->s->blob_fields) + if (table_share->blob_fields) { if (fix_rec_buff_for_blob(max_row_length(record))) return HA_ERR_OUT_OF_MEM; /* purecov: inspected */ } /* Copy null bits */ - memcpy(rec_buff, record, table->s->null_bytes); - ptr= rec_buff + table->s->null_bytes; + memcpy(rec_buff, record, table_share->null_bytes); + ptr= rec_buff + table_share->null_bytes; for (Field **field=table->field ; *field ; field++) ptr=(byte*) (*field)->pack((char*) ptr, @@ -821,13 +833,13 @@ int ha_berkeley::pack_row(DBT *row, const byte *record, bool new_row) void ha_berkeley::unpack_row(char *record, DBT *row) { if (share->fixed_length_row) - memcpy(record,(char*) row->data,table->s->reclength+hidden_primary_key); + memcpy(record,(char*) row->data,table_share->reclength+hidden_primary_key); else { /* Copy null bits */ const char *ptr= (const char*) row->data; - memcpy(record, ptr, table->s->null_bytes); - ptr+= table->s->null_bytes; + memcpy(record, ptr, table_share->null_bytes); + ptr+= table_share->null_bytes; for (Field **field=table->field ; *field ; field++) ptr= (*field)->unpack(record + (*field)->offset(), ptr); } @@ -973,7 +985,7 @@ int ha_berkeley::write_row(byte * record) DBUG_RETURN(error); /* purecov: inspected */ table->insert_or_update= 1; // For handling of VARCHAR - if (table->s->keys + test(hidden_primary_key) == 1) + if (table_share->keys + test(hidden_primary_key) == 1) { error=file->put(file, transaction, create_key(&prim_key, primary_key, key_buff, record), @@ -992,7 +1004,7 @@ int ha_berkeley::write_row(byte * record) &row, key_type[primary_key]))) { changed_keys.set_bit(primary_key); - for (uint keynr=0 ; keynr < table->s->keys ; keynr++) + for (uint keynr=0 ; keynr < table_share->keys ; keynr++) { if (keynr == primary_key) continue; @@ -1020,7 +1032,7 @@ int ha_berkeley::write_row(byte * record) { new_error = 0; for (uint keynr=0; - keynr < table->s->keys+test(hidden_primary_key); + keynr < table_share->keys+test(hidden_primary_key); keynr++) { if (changed_keys.is_set(keynr)) @@ -1163,7 +1175,7 @@ int ha_berkeley::restore_keys(DB_TXN *trans, key_map *changed_keys, that one just put back the old value. */ if (!changed_keys->is_clear_all()) { - for (keynr=0 ; keynr < table->s->keys+test(hidden_primary_key) ; keynr++) + for (keynr=0 ; keynr < table_share->keys+test(hidden_primary_key) ; keynr++) { if (changed_keys->is_set(keynr)) { @@ -1228,7 +1240,7 @@ int ha_berkeley::update_row(const byte * old_row, byte * new_row) using_ignore))) { // Update all other keys - for (uint keynr=0 ; keynr < table->s->keys ; keynr++) + for (uint keynr=0 ; keynr < table_share->keys ; keynr++) { if (keynr == primary_key) continue; @@ -1340,7 +1352,7 @@ int ha_berkeley::remove_keys(DB_TXN *trans, const byte *record, { int result = 0; for (uint keynr=0; - keynr < table->s->keys+test(hidden_primary_key); + keynr < table_share->keys+test(hidden_primary_key); keynr++) { if (keys->is_set(keynr)) @@ -1361,7 +1373,7 @@ int ha_berkeley::delete_row(const byte * record) { int error; DBT row, prim_key; - key_map keys= table->s->keys_in_use; + key_map keys= table_share->keys_in_use; DBUG_ENTER("delete_row"); statistic_increment(table->in_use->status_var.ha_delete_count,&LOCK_status); @@ -1397,7 +1409,8 @@ int ha_berkeley::index_init(uint keynr, bool sorted) { int error; DBUG_ENTER("ha_berkeley::index_init"); - DBUG_PRINT("enter",("table: '%s' key: %d", table->s->table_name, keynr)); + DBUG_PRINT("enter",("table: '%s' key: %d", table_share->table_name.str, + keynr)); /* Under some very rare conditions (like full joins) we may already have @@ -1424,7 +1437,7 @@ int ha_berkeley::index_end() DBUG_ENTER("ha_berkely::index_end"); if (cursor) { - DBUG_PRINT("enter",("table: '%s'", table->s->table_name)); + DBUG_PRINT("enter",("table: '%s'", table_share->table_name.str)); error=cursor->c_close(cursor); cursor=0; } @@ -1779,14 +1792,14 @@ void ha_berkeley::info(uint flag) if ((flag & HA_STATUS_CONST) || version != share->version) { version=share->version; - for (uint i=0 ; i < table->s->keys ; i++) + for (uint i=0 ; i < table_share->keys ; i++) { table->key_info[i].rec_per_key[table->key_info[i].key_parts-1]= share->rec_per_key[i]; } } /* Don't return key if we got an error for the internal primary key */ - if (flag & HA_STATUS_ERRKEY && last_dup_key < table->s->keys) + if (flag & HA_STATUS_ERRKEY && last_dup_key < table_share->keys) errkey= last_dup_key; DBUG_VOID_RETURN; } @@ -2035,7 +2048,7 @@ int ha_berkeley::create(const char *name, register TABLE *form, if ((error= create_sub_table(name_buff,"main",DB_BTREE,0))) DBUG_RETURN(error); /* purecov: inspected */ - primary_key= table->s->primary_key; + primary_key= form->s->primary_key; /* Create the keys */ for (uint i=0; i < form->s->keys; i++) { @@ -2043,7 +2056,7 @@ int ha_berkeley::create(const char *name, register TABLE *form, { sprintf(part,"key%02d",index++); if ((error= create_sub_table(name_buff, part, DB_BTREE, - (table->key_info[i].flags & HA_NOSAME) ? 0 : + (form->key_info[i].flags & HA_NOSAME) ? 0 : DB_DUP))) DBUG_RETURN(error); /* purecov: inspected */ } @@ -2059,7 +2072,7 @@ int ha_berkeley::create(const char *name, register TABLE *form, "status", DB_BTREE, DB_CREATE, 0)))) { char rec_buff[4+MAX_KEY*4]; - uint length= 4+ table->s->keys*4; + uint length= 4+ form->s->keys*4; bzero(rec_buff, length); error= write_status(status_block, rec_buff, length); status_block->close(status_block,0); @@ -2179,9 +2192,9 @@ ulonglong ha_berkeley::get_auto_increment() (void) ha_berkeley::extra(HA_EXTRA_KEYREAD); /* Set 'active_index' */ - ha_berkeley::index_init(table->s->next_number_index, 0); + ha_berkeley::index_init(table_share->next_number_index, 0); - if (!table->s->next_number_key_offset) + if (!table_share->next_number_key_offset) { // Autoincrement at key-start error=ha_berkeley::index_last(table->record[1]); } @@ -2194,7 +2207,7 @@ ulonglong ha_berkeley::get_auto_increment() /* Reading next available number for a sub key */ ha_berkeley::create_key(&last_key, active_index, key_buff, table->record[0], - table->s->next_number_key_offset); + table_share->next_number_key_offset); /* Store for compare */ memcpy(old_key.data=key_buff2, key_buff, (old_key.size=last_key.size)); old_key.app_private=(void*) key_info; @@ -2224,7 +2237,7 @@ ulonglong ha_berkeley::get_auto_increment() } if (!error) nr= (ulonglong) - table->next_number_field->val_int_offset(table->s->rec_buff_length)+1; + table->next_number_field->val_int_offset(table_share->rec_buff_length)+1; ha_berkeley::index_end(); (void) ha_berkeley::extra(HA_EXTRA_NO_KEYREAD); return nr; @@ -2308,7 +2321,7 @@ int ha_berkeley::analyze(THD* thd, HA_CHECK_OPT* check_opt) free(txn_stat_ptr); } - for (i=0 ; i < table->s->keys ; i++) + for (i=0 ; i < table_share->keys ; i++) { if (stat) { @@ -2383,7 +2396,7 @@ int ha_berkeley::check(THD* thd, HA_CHECK_OPT* check_opt) (hidden_primary_key ? berkeley_cmp_hidden_key : berkeley_cmp_packed_key)); tmp_file->app_private= (void*) (table->key_info+table->primary_key); - fn_format(name_buff,share->table_name,"", ha_berkeley_ext, 2 | 4); + fn_format(name_buff,share->table_name.str,"", ha_berkeley_ext, 2 | 4); if ((error=tmp_file->verify(tmp_file, name_buff, NullS, (FILE*) 0, hidden_primary_key ? 0 : DB_NOORDERCHK))) { @@ -2457,7 +2470,7 @@ static BDB_SHARE *get_share(const char *table_name, TABLE *table) share->rec_per_key = rec_per_key; share->table_name = tmp_name; share->table_name_length=length; - strmov(share->table_name,table_name); + strmov(share->table_name, table_name); share->key_file = key_file; share->key_type = key_type; if (my_hash_insert(&bdb_open_tables, (byte*) share)) @@ -2529,7 +2542,7 @@ void ha_berkeley::get_status() char name_buff[FN_REFLEN]; uint open_mode= (((table->db_stat & HA_READ_ONLY) ? DB_RDONLY : 0) | DB_THREAD); - fn_format(name_buff, share->table_name,"", ha_berkeley_ext, 2 | 4); + fn_format(name_buff, share->table_name, "", ha_berkeley_ext, 2 | 4); if (!db_create(&share->status_block, db_env, 0)) { if (share->status_block->open(share->status_block, NULL, name_buff, @@ -2543,7 +2556,7 @@ void ha_berkeley::get_status() if (!(share->status & STATUS_ROW_COUNT_INIT) && share->status_block) { share->org_rows= share->rows= - table->s->max_rows ? table->s->max_rows : HA_BERKELEY_MAX_ROWS; + table_share->max_rows ? table_share->max_rows : HA_BERKELEY_MAX_ROWS; if (!share->status_block->cursor(share->status_block, 0, &cursor, 0)) { DBT row; @@ -2558,7 +2571,7 @@ void ha_berkeley::get_status() uint i; uchar *pos=(uchar*) row.data; share->org_rows=share->rows=uint4korr(pos); pos+=4; - for (i=0 ; i < table->s->keys ; i++) + for (i=0 ; i < table_share->keys ; i++) { share->rec_per_key[i]=uint4korr(pos); pos+=4; @@ -2610,8 +2623,8 @@ static void update_status(BDB_SHARE *share, TABLE *table) goto end; /* purecov: inspected */ share->status_block->set_flags(share->status_block,0); /* purecov: inspected */ if (share->status_block->open(share->status_block, NULL, - fn_format(name_buff,share->table_name,"", - ha_berkeley_ext,2 | 4), + fn_format(name_buff,share->table_name, + "", ha_berkeley_ext,2 | 4), "status", DB_BTREE, DB_THREAD | DB_CREATE, my_umask)) /* purecov: inspected */ goto end; /* purecov: inspected */ @@ -2623,7 +2636,7 @@ static void update_status(BDB_SHARE *share, TABLE *table) { int4store(pos,share->rec_per_key[i]); pos+=4; } - DBUG_PRINT("info",("updating status for %s",share->table_name)); + DBUG_PRINT("info",("updating status for %s", share->table_name)); (void) write_status(share->status_block, rec_buff, (uint) (pos-rec_buff)); share->status&= ~STATUS_BDB_ANALYZE; @@ -2653,7 +2666,7 @@ int ha_berkeley::cmp_ref(const byte *ref1, const byte *ref2) int result; Field *field; - KEY *key_info=table->key_info+table->s->primary_key; + KEY *key_info=table->key_info+table_share->primary_key; KEY_PART_INFO *key_part=key_info->key_part; KEY_PART_INFO *end=key_part+key_info->key_parts; diff --git a/sql/ha_berkeley.h b/sql/ha_berkeley.h index 9de56e6bf96..f4787ab8e84 100644 --- a/sql/ha_berkeley.h +++ b/sql/ha_berkeley.h @@ -84,7 +84,7 @@ class ha_berkeley: public handler DBT *get_pos(DBT *to, byte *pos); public: - ha_berkeley(TABLE *table_arg); + ha_berkeley(TABLE_SHARE *table_arg); ~ha_berkeley() {} const char *table_type() const { return "BerkeleyDB"; } ulong index_flags(uint idx, uint part, bool all_parts) const; @@ -163,7 +163,9 @@ extern const u_int32_t bdb_DB_PRIVATE; extern bool berkeley_shared_data; extern u_int32_t berkeley_init_flags,berkeley_env_flags, berkeley_lock_type, berkeley_lock_types[]; -extern ulong berkeley_cache_size, berkeley_max_lock, berkeley_log_buffer_size; +extern ulong berkeley_max_lock, berkeley_log_buffer_size; +extern ulonglong berkeley_cache_size; +extern ulong berkeley_region_size, berkeley_cache_parts; extern char *berkeley_home, *berkeley_tmpdir, *berkeley_logdir; extern long berkeley_lock_scan_time; extern TYPELIB berkeley_lock_typelib; diff --git a/sql/ha_blackhole.cc b/sql/ha_blackhole.cc index 3503f5bec1b..e2b0fc29d86 100644 --- a/sql/ha_blackhole.cc +++ b/sql/ha_blackhole.cc @@ -24,7 +24,7 @@ /* Static declarations for handlerton */ -static handler *blackhole_create_handler(TABLE *table); +static handler *blackhole_create_handler(TABLE_SHARE *table); /* Blackhole storage engine handlerton */ @@ -63,7 +63,7 @@ handlerton blackhole_hton= { }; -static handler *blackhole_create_handler(TABLE *table) +static handler *blackhole_create_handler(TABLE_SHARE *table) { return new ha_blackhole(table); } @@ -73,7 +73,7 @@ static handler *blackhole_create_handler(TABLE *table) ** BLACKHOLE tables *****************************************************************************/ -ha_blackhole::ha_blackhole(TABLE *table_arg) +ha_blackhole::ha_blackhole(TABLE_SHARE *table_arg) :handler(&blackhole_hton, table_arg) {} @@ -112,13 +112,12 @@ int ha_blackhole::create(const char *name, TABLE *table_arg, const char *ha_blackhole::index_type(uint key_number) { DBUG_ENTER("ha_blackhole::index_type"); - DBUG_RETURN((table->key_info[key_number].flags & HA_FULLTEXT) ? + DBUG_RETURN((table_share->key_info[key_number].flags & HA_FULLTEXT) ? "FULLTEXT" : - (table->key_info[key_number].flags & HA_SPATIAL) ? + (table_share->key_info[key_number].flags & HA_SPATIAL) ? "SPATIAL" : - (table->key_info[key_number].algorithm == HA_KEY_ALG_RTREE) ? - "RTREE" : - "BTREE"); + (table_share->key_info[key_number].algorithm == + HA_KEY_ALG_RTREE) ? "RTREE" : "BTREE"); } int ha_blackhole::write_row(byte * buf) diff --git a/sql/ha_blackhole.h b/sql/ha_blackhole.h index 7238147a06a..15e12659aa0 100644 --- a/sql/ha_blackhole.h +++ b/sql/ha_blackhole.h @@ -28,7 +28,7 @@ class ha_blackhole: public handler THR_LOCK thr_lock; public: - ha_blackhole(TABLE *table_arg); + ha_blackhole(TABLE_SHARE *table_arg); ~ha_blackhole() { } @@ -49,7 +49,7 @@ public: } ulong index_flags(uint inx, uint part, bool all_parts) const { - return ((table->key_info[inx].algorithm == HA_KEY_ALG_FULLTEXT) ? + return ((table_share->key_info[inx].algorithm == HA_KEY_ALG_FULLTEXT) ? 0 : HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE | HA_READ_ORDER | HA_KEYREAD_ONLY); } @@ -84,4 +84,5 @@ public: THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, enum thr_lock_type lock_type); + bool has_transactions() { return 1; } }; diff --git a/sql/ha_federated.cc b/sql/ha_federated.cc index 8a26b9d8fb3..e0f0b6ee35a 100644 --- a/sql/ha_federated.cc +++ b/sql/ha_federated.cc @@ -355,17 +355,14 @@ #include "m_string.h" /* Variables for federated share methods */ -static HASH federated_open_tables; // Hash used to track open - // tables -pthread_mutex_t federated_mutex; // This is the mutex we use to - // init the hash -static int federated_init= FALSE; // Variable for checking the - // init state of hash +static HASH federated_open_tables; // To track open tables +pthread_mutex_t federated_mutex; // To init the hash +static int federated_init= FALSE; // Checking the state of hash /* Static declaration for handerton */ - -static handler *federated_create_handler(TABLE *table); - +static handler *federated_create_handler(TABLE_SHARE *table); +static int federated_commit(THD *thd, bool all); +static int federated_rollback(THD *thd, bool all); /* Federated storage engine handlerton */ @@ -381,8 +378,8 @@ handlerton federated_hton= { NULL, /* savepoint */ NULL, /* rollback to savepoint */ NULL, /* release savepoint */ - NULL, /* commit */ - NULL, /* rollback */ + federated_commit, /* commit */ + federated_rollback, /* rollback */ NULL, /* prepare */ NULL, /* recover */ NULL, /* commit_by_xid */ @@ -403,13 +400,13 @@ handlerton federated_hton= { }; -static handler *federated_create_handler(TABLE *table) +static handler *federated_create_handler(TABLE_SHARE *table) { return new ha_federated(table); } -/* Function we use in the creation of our hash to get key. */ +/* Function we use in the creation of our hash to get key */ static byte *federated_get_key(FEDERATED_SHARE *share, uint *length, my_bool not_used __attribute__ ((unused))) @@ -437,14 +434,12 @@ bool federated_db_init() goto error; if (hash_init(&federated_open_tables, system_charset_info, 32, 0, 0, (hash_get_key) federated_get_key, 0, 0)) - { - VOID(pthread_mutex_destroy(&federated_mutex)); - } - else { federated_init= TRUE; DBUG_RETURN(FALSE); } + + VOID(pthread_mutex_destroy(&federated_mutex)); error: have_federated_db= SHOW_OPTION_DISABLED; // If we couldn't use handler DBUG_RETURN(TRUE); @@ -456,7 +451,6 @@ error: SYNOPSIS federated_db_end() - void RETURN FALSE OK @@ -473,6 +467,7 @@ int federated_db_end(ha_panic_function type) return 0; } + /* Check (in create) whether the tables exists, and that it can be connected to @@ -488,8 +483,7 @@ int federated_db_end(ha_panic_function type) table, and if so, does the foreign table exist. */ -static int check_foreign_data_source( - FEDERATED_SHARE *share, +static int check_foreign_data_source(FEDERATED_SHARE *share, bool table_create_flag) { char escaped_table_name[NAME_LEN*2]; @@ -515,15 +509,17 @@ static int check_foreign_data_source( share->port, share->socket, 0)) { - /* - we want the correct error message, but it to return - ER_CANT_CREATE_FEDERATED_TABLE if called by ::create - */ - error_code= table_create_flag? - ER_CANT_CREATE_FEDERATED_TABLE : ER_CONNECT_TO_FOREIGN_DATA_SOURCE; + /* + we want the correct error message, but it to return + ER_CANT_CREATE_FEDERATED_TABLE if called by ::create + */ + error_code= (table_create_flag ? + ER_CANT_CREATE_FEDERATED_TABLE : + ER_CONNECT_TO_FOREIGN_DATA_SOURCE); my_sprintf(error_buffer, - (error_buffer, " database %s username %s hostname %s", + (error_buffer, + "database: '%s' username: '%s' hostname: '%s'", share->database, share->username, share->hostname)); my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), error_buffer); @@ -564,8 +560,8 @@ static int check_foreign_data_source( { error_code= table_create_flag ? ER_CANT_CREATE_FEDERATED_TABLE : ER_FOREIGN_DATA_SOURCE_DOESNT_EXIST; - my_sprintf(error_buffer, (error_buffer, ": %d : %s", - mysql_errno(mysql), mysql_error(mysql))); + my_sprintf(error_buffer, (error_buffer, "error: %d '%s'", + mysql_errno(mysql), mysql_error(mysql))); my_error(error_code, MYF(0), error_buffer); goto error; @@ -605,12 +601,12 @@ static int parse_url_error(FEDERATED_SHARE *share, TABLE *table, int error_num) SYNOPSIS parse_url() - share pointer to FEDERATED share - table pointer to current TABLE class - table_create_flag determines what error to throw + share pointer to FEDERATED share + table pointer to current TABLE class + table_create_flag determines what error to throw DESCRIPTION - populates the share with information about the connection + Populates the share with information about the connection to the foreign database that will serve as the data source. This string must be specified (currently) in the "comment" field, listed in the CREATE TABLE statement. @@ -629,7 +625,7 @@ static int parse_url_error(FEDERATED_SHARE *share, TABLE *table, int error_num) ***IMPORTANT*** Currently, only "mysql://" is supported. - 'password' and 'port' are both optional. + 'password' and 'port' are both optional. RETURN VALUE 0 success @@ -647,8 +643,8 @@ static int parse_url(FEDERATED_SHARE *share, TABLE *table, share->port= 0; share->socket= 0; - DBUG_PRINT("info", ("Length %d \n", table->s->connect_string.length)); - DBUG_PRINT("info", ("String %.*s \n", table->s->connect_string.length, + DBUG_PRINT("info", ("Length: %d", table->s->connect_string.length)); + DBUG_PRINT("info", ("String: '%.*s'", table->s->connect_string.length, table->s->connect_string.str)); share->scheme= my_strdup_with_length((const byte*)table->s-> connect_string.str, @@ -739,8 +735,8 @@ static int parse_url(FEDERATED_SHARE *share, TABLE *table, } DBUG_PRINT("info", - ("scheme %s username %s password %s \ - hostname %s port %d database %s tablename %s\n", + ("scheme: %s username: %s password: %s \ + hostname: %s port: %d database: %s tablename: %s", share->scheme, share->username, share->password, share->hostname, share->port, share->database, share->table_name)); @@ -756,11 +752,13 @@ error: ** FEDERATED tables *****************************************************************************/ -ha_federated::ha_federated(TABLE *table_arg) +ha_federated::ha_federated(TABLE_SHARE *table_arg) :handler(&federated_hton, table_arg), mysql(0), stored_result(0), scan_flag(0), ref_length(sizeof(MYSQL_ROW_OFFSET)), current_position(0) -{} +{ + trx_next= 0; +} /* @@ -768,8 +766,8 @@ ha_federated::ha_federated(TABLE *table_arg) SYNOPSIS convert_row_to_internal_format() - record Byte pointer to record - row MySQL result set row from fetchrow() + record Byte pointer to record + row MySQL result set row from fetchrow() DESCRIPTION This method simply iterates through a row returned via fetchrow with @@ -780,7 +778,7 @@ ha_federated::ha_federated(TABLE *table_arg) RETURN VALUE 0 After fields have had field values stored from record - */ +*/ uint ha_federated::convert_row_to_internal_format(byte *record, MYSQL_ROW row) { @@ -791,24 +789,23 @@ uint ha_federated::convert_row_to_internal_format(byte *record, MYSQL_ROW row) lengths= mysql_fetch_lengths(stored_result); memset(record, 0, table->s->null_bytes); - for (field= table->field; *field; field++) + for (field= table->field; *field; field++, row++, lengths++) { /* index variable to move us through the row at the same iterative step as the field */ - int x= field - table->field; my_ptrdiff_t old_ptr; old_ptr= (my_ptrdiff_t) (record - table->record[0]); - (*field)->move_field(old_ptr); - if (!row[x]) + (*field)->move_field_offset(old_ptr); + if (!*row) (*field)->set_null(); else { (*field)->set_notnull(); - (*field)->store(row[x], lengths[x], &my_charset_bin); + (*field)->store(*row, *lengths, &my_charset_bin); } - (*field)->move_field(-old_ptr); + (*field)->move_field_offset(-old_ptr); } DBUG_RETURN(0); @@ -1213,8 +1210,8 @@ bool ha_federated::create_where_from_key(String *to, DBUG_RETURN(1); } else - /* LIKE */ { + /* LIKE */ if (emit_key_part_name(&tmp, key_part) || tmp.append(FEDERATED_LIKE) || emit_key_part_element(&tmp, key_part, needs_quotes, 1, ptr, @@ -1326,16 +1323,16 @@ static FEDERATED_SHARE *get_share(const char *table_name, TABLE *table) /* In order to use this string, we must first zero it's length, or it will contain garbage - */ + */ query.length(0); pthread_mutex_lock(&federated_mutex); - tmp_table_name= (char *)table->s->table_name; - tmp_table_name_length= (uint) strlen(tmp_table_name); + tmp_table_name= table->s->table_name.str; + tmp_table_name_length= table->s->table_name.length; if (!(share= (FEDERATED_SHARE *) hash_search(&federated_open_tables, (byte*) table_name, - strlen(table_name)))) + tmp_table_name_length))) { query.set_charset(system_charset_info); query.append(FEDERATED_SELECT); @@ -1346,7 +1343,7 @@ static FEDERATED_SHARE *get_share(const char *table_name, TABLE *table) query.append(FEDERATED_BTICK); query.append(FEDERATED_COMMA); } - query.length(query.length()- strlen(FEDERATED_COMMA)); + query.length(query.length()- FEDERATED_COMMA_LEN); query.append(FEDERATED_FROM); query.append(FEDERATED_BTICK); @@ -1370,7 +1367,6 @@ static FEDERATED_SHARE *get_share(const char *table_name, TABLE *table) share->select_query= select_query; strmov(share->select_query, query.ptr()); share->use_count= 0; - share->table_name_length= strlen(share->table_name); DBUG_PRINT("info", ("share->select_query %s", share->select_query)); @@ -1484,10 +1480,11 @@ int ha_federated::open(const char *name, int mode, uint test_if_locked) } /* Since we do not support transactions at this version, we can let the client - API silently reconnect. For future versions, we will need more logic to deal - with transactions + API silently reconnect. For future versions, we will need more logic to + deal with transactions */ mysql->reconnect= 1; + DBUG_RETURN(0); } @@ -1560,6 +1557,7 @@ inline uint field_in_record_is_null(TABLE *table, DBUG_RETURN(0); } + /* write_row() inserts a row. No extra() hint is given currently if a bulk load is happeneding. buf() is a byte array of data. You can use the field @@ -1816,15 +1814,15 @@ int ha_federated::update_row(const byte *old_data, byte *new_data) update_string.append(FEDERATED_BTICK); update_string.append(FEDERATED_SET); -/* - In this loop, we want to match column names to values being inserted - (while building INSERT statement). + /* + In this loop, we want to match column names to values being inserted + (while building INSERT statement). - Iterate through table->field (new data) and share->old_filed (old_data) - using the same index to created an SQL UPDATE statement, new data is - used to create SET field=value and old data is used to create WHERE - field=oldvalue - */ + Iterate through table->field (new data) and share->old_filed (old_data) + using the same index to created an SQL UPDATE statement, new data is + used to create SET field=value and old data is used to create WHERE + field=oldvalue + */ for (Field **field= table->field; *field; field++) { @@ -2029,7 +2027,7 @@ int ha_federated::index_read_idx(byte *buf, uint index, const byte *key, } if (mysql_real_query(mysql, sql_query.ptr(), sql_query.length())) { - my_sprintf(error_buffer, (error_buffer, ": %d : %s", + my_sprintf(error_buffer, (error_buffer, "error: %d '%s'", mysql_errno(mysql), mysql_error(mysql))); retval= ER_QUERY_ON_FOREIGN_DATA_SOURCE; goto error; @@ -2045,7 +2043,7 @@ int ha_federated::index_read_idx(byte *buf, uint index, const byte *key, This basically says that the record in table->record[0] is legal, and that it is ok to use this record, for whatever reason, such as with a join (without it, joins will not work) - */ + */ table->status= 0; retval= rnd_next(buf); @@ -2067,7 +2065,7 @@ int ha_federated::index_init(uint keynr, bool sorted) { DBUG_ENTER("ha_federated::index_init"); DBUG_PRINT("info", - ("table: '%s' key: %d", table->s->table_name, keynr)); + ("table: '%s' key: %d", table->s->table_name.str, keynr)); active_index= keynr; DBUG_RETURN(0); } @@ -2248,6 +2246,7 @@ int ha_federated::rnd_end() DBUG_RETURN(retval); } + int ha_federated::index_end(void) { DBUG_ENTER("ha_federated::index_end"); @@ -2255,6 +2254,7 @@ int ha_federated::index_end(void) DBUG_RETURN(0); } + /* This is called for each row of the table scan. When you run out of records you should return HA_ERR_END_OF_FILE. Fill buff up with the row information. @@ -2609,7 +2609,7 @@ int ha_federated::stash_remote_error() { DBUG_ENTER("ha_federated::stash_remote_error()"); remote_error_number= mysql_errno(mysql); - my_snprintf(remote_error_buf, FEDERATED_QUERY_BUFFER_SIZE, + my_snprintf(remote_error_buf, sizeof(remote_error_buf), "%s", mysql_error(mysql)); DBUG_RETURN(HA_FEDERATED_ERROR_WITH_REMOTE_SYSTEM); } @@ -2621,10 +2621,10 @@ bool ha_federated::get_error_message(int error, String* buf) DBUG_PRINT("enter", ("error: %d", error)); if (error == HA_FEDERATED_ERROR_WITH_REMOTE_SYSTEM) { - buf->append("Error on remote system: "); + buf->append(STRING_WITH_LEN("Error on remote system: ")); buf->qs_append(remote_error_number); - buf->append(": "); - buf->append(remote_error_buf, FEDERATED_QUERY_BUFFER_SIZE); + buf->append(STRING_WITH_LEN(": ")); + buf->append(remote_error_buf); remote_error_number= 0; remote_error_buf[0]= '\0'; @@ -2633,3 +2633,151 @@ bool ha_federated::get_error_message(int error, String* buf) DBUG_RETURN(FALSE); } +int ha_federated::external_lock(THD *thd, int lock_type) +{ + int error= 0; + ha_federated *trx= (ha_federated *)thd->ha_data[federated_hton.slot]; + DBUG_ENTER("ha_federated::external_lock"); + + if (lock_type != F_UNLCK) + { + DBUG_PRINT("info",("federated not lock F_UNLCK")); + if (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) + { + DBUG_PRINT("info",("federated autocommit")); + /* + This means we are doing an autocommit + */ + error= connection_autocommit(TRUE); + if (error) + { + DBUG_PRINT("info", ("error setting autocommit TRUE: %d", error)); + DBUG_RETURN(error); + } + trans_register_ha(thd, FALSE, &federated_hton); + } + else + { + DBUG_PRINT("info",("not autocommit")); + if (!trx) + { + /* + This is where a transaction gets its start + */ + error= connection_autocommit(FALSE); + if (error) + { + DBUG_PRINT("info", ("error setting autocommit FALSE: %d", error)); + DBUG_RETURN(error); + } + thd->ha_data[federated_hton.slot]= this; + trans_register_ha(thd, TRUE, &federated_hton); + /* + Send a lock table to the remote end. + We do not support this at the moment + */ + if (thd->options & (OPTION_TABLE_LOCK)) + { + DBUG_PRINT("info", ("We do not support lock table yet")); + } + } + else + { + ha_federated *ptr; + for (ptr= trx; ptr; ptr= ptr->trx_next) + if (ptr == this) + break; + else if (!ptr->trx_next) + ptr->trx_next= this; + } + } + } + DBUG_RETURN(0); +} + + +static int federated_commit(THD *thd, bool all) +{ + int return_val= 0; + ha_federated *trx= (ha_federated *)thd->ha_data[federated_hton.slot]; + DBUG_ENTER("federated_commit"); + + if (all) + { + int error= 0; + ha_federated *ptr, *old= NULL; + for (ptr= trx; ptr; old= ptr, ptr= ptr->trx_next) + { + if (old) + old->trx_next= NULL; + error= ptr->connection_commit(); + if (error && !return_val); + return_val= error; + } + thd->ha_data[federated_hton.slot]= NULL; + } + + DBUG_PRINT("info", ("error val: %d", return_val)); + DBUG_RETURN(return_val); +} + + +static int federated_rollback(THD *thd, bool all) +{ + int return_val= 0; + ha_federated *trx= (ha_federated *)thd->ha_data[federated_hton.slot]; + DBUG_ENTER("federated_rollback"); + + if (all) + { + int error= 0; + ha_federated *ptr, *old= NULL; + for (ptr= trx; ptr; old= ptr, ptr= ptr->trx_next) + { + if (old) + old->trx_next= NULL; + error= ptr->connection_rollback(); + if (error && !return_val) + return_val= error; + } + thd->ha_data[federated_hton.slot]= NULL; + } + + DBUG_PRINT("info", ("error val: %d", return_val)); + DBUG_RETURN(return_val); +} + +int ha_federated::connection_commit() +{ + DBUG_ENTER("ha_federated::connection_commit"); + DBUG_RETURN(execute_simple_query("COMMIT", 6)); +} + + +int ha_federated::connection_rollback() +{ + DBUG_ENTER("ha_federated::connection_rollback"); + DBUG_RETURN(execute_simple_query("ROLLBACK", 8)); +} + + +int ha_federated::connection_autocommit(bool state) +{ + const char *text; + DBUG_ENTER("ha_federated::connection_autocommit"); + text= (state == true) ? "SET AUTOCOMMIT=1" : "SET AUTOCOMMIT=0"; + DBUG_RETURN(execute_simple_query(text, 16)); +} + + +int ha_federated::execute_simple_query(const char *query, int len) +{ + DBUG_ENTER("ha_federated::execute_simple_query"); + + if (mysql_real_query(mysql, query, len)) + { + DBUG_RETURN(stash_remote_error()); + } + DBUG_RETURN(0); +} + diff --git a/sql/ha_federated.h b/sql/ha_federated.h index 52f4fad9a27..c596f066098 100644 --- a/sql/ha_federated.h +++ b/sql/ha_federated.h @@ -173,12 +173,14 @@ private: int stash_remote_error(); public: - ha_federated(TABLE *table_arg); - ~ha_federated() - { - } + ha_federated(TABLE_SHARE *table_arg); + ~ha_federated() {} /* The name that will be used for display purposes */ const char *table_type() const { return "FEDERATED"; } + /* + Next pointer used in transaction + */ + ha_federated *trx_next; /* The name of the index type that will be used for display don't implement this method unless you really have indexes @@ -230,8 +232,7 @@ public: */ double scan_time() { - DBUG_PRINT("info", - ("records %d", records)); + DBUG_PRINT("info", ("records %lu", (ulong) records)); return (double)(records*1000); } /* @@ -298,7 +299,14 @@ public: THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, enum thr_lock_type lock_type); //required virtual bool get_error_message(int error, String *buf); + int external_lock(THD *thd, int lock_type); + int connection_commit(); + int connection_rollback(); + bool has_transactions() { return 1; } + int connection_autocommit(bool state); + int execute_simple_query(const char *query, int len); }; bool federated_db_init(void); int federated_db_end(ha_panic_function type); + diff --git a/sql/ha_heap.cc b/sql/ha_heap.cc index 0b91a57b889..ddc6c1bfb8f 100644 --- a/sql/ha_heap.cc +++ b/sql/ha_heap.cc @@ -24,7 +24,7 @@ #include "ha_heap.h" -static handler *heap_create_handler(TABLE *table); +static handler *heap_create_handler(TABLE_SHARE *table); handlerton heap_hton= { "MEMORY", @@ -59,7 +59,7 @@ handlerton heap_hton= { HTON_CAN_RECREATE }; -static handler *heap_create_handler(TABLE *table) +static handler *heap_create_handler(TABLE_SHARE *table) { return new ha_heap(table); } @@ -69,7 +69,7 @@ static handler *heap_create_handler(TABLE *table) ** HEAP tables *****************************************************************************/ -ha_heap::ha_heap(TABLE *table_arg) +ha_heap::ha_heap(TABLE_SHARE *table_arg) :handler(&heap_hton, table_arg), file(0), records_changed(0), key_stats_ok(0) {} @@ -490,8 +490,7 @@ THR_LOCK_DATA **ha_heap::store_lock(THD *thd, int ha_heap::delete_table(const char *name) { char buff[FN_REFLEN]; - int error= heap_delete_table(fn_format(buff,name,"","", - MY_REPLACE_EXT|MY_UNPACK_FILENAME)); + int error= heap_delete_table(name); return error == ENOENT ? 0 : error; } @@ -537,7 +536,6 @@ int ha_heap::create(const char *name, TABLE *table_arg, ha_rows max_rows; HP_KEYDEF *keydef; HA_KEYSEG *seg; - char buff[FN_REFLEN]; int error; TABLE_SHARE *share= table_arg->s; bool found_real_auto_increment= 0; @@ -618,7 +616,7 @@ int ha_heap::create(const char *name, TABLE *table_arg, } } mem_per_row+= MY_ALIGN(share->reclength + 1, sizeof(char*)); - max_rows = (ha_rows) (table->in_use->variables.max_heap_table_size / + max_rows = (ha_rows) (table_arg->in_use->variables.max_heap_table_size / mem_per_row); if (table_arg->found_next_number_field) { @@ -633,8 +631,7 @@ int ha_heap::create(const char *name, TABLE *table_arg, hp_create_info.max_table_size=current_thd->variables.max_heap_table_size; hp_create_info.with_auto_increment= found_real_auto_increment; max_rows = (ha_rows) (hp_create_info.max_table_size / mem_per_row); - error= heap_create(fn_format(buff,name,"","", - MY_REPLACE_EXT|MY_UNPACK_FILENAME), + error= heap_create(name, keys, keydef, share->reclength, (ulong) ((share->max_rows < max_rows && share->max_rows) ? diff --git a/sql/ha_heap.h b/sql/ha_heap.h index 9b93936b573..909b36f975b 100644 --- a/sql/ha_heap.h +++ b/sql/ha_heap.h @@ -31,7 +31,7 @@ class ha_heap: public handler uint records_changed; bool key_stats_ok; public: - ha_heap(TABLE *table); + ha_heap(TABLE_SHARE *table); ~ha_heap() {} const char *table_type() const { @@ -40,7 +40,7 @@ public: } const char *index_type(uint inx) { - return ((table->key_info[inx].algorithm == HA_KEY_ALG_BTREE) ? + return ((table_share->key_info[inx].algorithm == HA_KEY_ALG_BTREE) ? "BTREE" : "HASH"); } /* Rows also use a fixed-size format */ @@ -54,7 +54,7 @@ public: } ulong index_flags(uint inx, uint part, bool all_parts) const { - return ((table->key_info[inx].algorithm == HA_KEY_ALG_BTREE) ? + return ((table_share->key_info[inx].algorithm == HA_KEY_ALG_BTREE) ? HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER | HA_READ_RANGE : HA_ONLY_WHOLE_INDEX); } diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index ef1de2cf337..1562803aed7 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -141,15 +141,16 @@ uint innobase_init_flags = 0; ulong innobase_cache_size = 0; ulong innobase_large_page_size = 0; -/* The default values for the following, type long, start-up parameters -are declared in mysqld.cc: */ +/* The default values for the following, type long or longlong, start-up +parameters are declared in mysqld.cc: */ long innobase_mirrored_log_groups, innobase_log_files_in_group, - innobase_log_file_size, innobase_log_buffer_size, - innobase_buffer_pool_awe_mem_mb, - innobase_buffer_pool_size, innobase_additional_mem_pool_size, - innobase_file_io_threads, innobase_lock_wait_timeout, - innobase_force_recovery, innobase_open_files; + innobase_log_buffer_size, innobase_buffer_pool_awe_mem_mb, + innobase_additional_mem_pool_size, innobase_file_io_threads, + innobase_lock_wait_timeout, innobase_force_recovery, + innobase_open_files; + +longlong innobase_buffer_pool_size, innobase_log_file_size; /* The default values for the following char* start-up parameters are determined in innobase_init below: */ @@ -204,7 +205,7 @@ static int innobase_rollback(THD* thd, bool all); static int innobase_rollback_to_savepoint(THD* thd, void *savepoint); static int innobase_savepoint(THD* thd, void *savepoint); static int innobase_release_savepoint(THD* thd, void *savepoint); -static handler *innobase_create_handler(TABLE *table); +static handler *innobase_create_handler(TABLE_SHARE *table); handlerton innobase_hton = { "InnoDB", @@ -244,7 +245,7 @@ handlerton innobase_hton = { }; -static handler *innobase_create_handler(TABLE *table) +static handler *innobase_create_handler(TABLE_SHARE *table) { return new ha_innobase(table); } @@ -825,7 +826,7 @@ check_trx_exists( /************************************************************************* Construct ha_innobase handler. */ -ha_innobase::ha_innobase(TABLE *table_arg) +ha_innobase::ha_innobase(TABLE_SHARE *table_arg) :handler(&innobase_hton, table_arg), int_table_flags(HA_REC_NOT_IN_SEQ | HA_NULL_IN_KEY | @@ -1231,6 +1232,25 @@ innobase_init(void) ut_a(DATA_MYSQL_TRUE_VARCHAR == (ulint)MYSQL_TYPE_VARCHAR); + /* Check that values don't overflow on 32-bit systems. */ + if (sizeof(ulint) == 4) { + if (innobase_buffer_pool_size > UINT_MAX32) { + sql_print_error( + "innobase_buffer_pool_size can't be over 4GB" + " on 32-bit systems"); + + DBUG_RETURN(0); + } + + if (innobase_log_file_size > UINT_MAX32) { + sql_print_error( + "innobase_log_file_size can't be over 4GB" + " on 32-bit systems"); + + DBUG_RETURN(0); + } + } + os_innodb_umask = (ulint)my_umask; /* First calculate the default path for innodb_data_home_dir etc., @@ -2199,11 +2219,13 @@ innobase_savepoint( DBUG_ENTER("innobase_savepoint"); - if (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) { - /* In the autocommit state there is no sense to set a - savepoint: we return immediate success */ - DBUG_RETURN(0); - } + /* + In the autocommit mode there is no sense to set a savepoint + (unless we are in sub-statement), so SQL layer ensures that + this method is never called in such situation. + */ + DBUG_ASSERT(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN) || + thd->in_sub_stmt); trx = check_trx_exists(thd); @@ -3030,8 +3052,8 @@ ha_innobase::store_key_val_for_row( if (key_part->length > 0 && cs->mbmaxlen > 1) { len = (ulint) cs->cset->well_formed_len(cs, - (const char*)src_start, - (const char*)(src_start + key_part->length), + (const char *) src_start, + (const char *) src_start + key_part->length, key_part->length / cs->mbmaxlen, &error); } else { @@ -4798,8 +4820,8 @@ ha_innobase::create( /* Look for a primary key */ - primary_key_no= (table->s->primary_key != MAX_KEY ? - (int) table->s->primary_key : + primary_key_no= (form->s->primary_key != MAX_KEY ? + (int) form->s->primary_key : -1); /* Our function row_get_mysql_key_number_for_index assumes diff --git a/sql/ha_innodb.h b/sql/ha_innodb.h index 32de25c78c6..9e701e8826b 100644 --- a/sql/ha_innodb.h +++ b/sql/ha_innodb.h @@ -81,7 +81,7 @@ class ha_innobase: public handler /* Init values for the class: */ public: - ha_innobase(TABLE *table_arg); + ha_innobase(TABLE_SHARE *table_arg); ~ha_innobase() {} /* Get the row type from the storage engine. If this method returns @@ -218,8 +218,9 @@ extern ulong innobase_large_page_size; extern char *innobase_home, *innobase_tmpdir, *innobase_logdir; extern long innobase_lock_scan_time; extern long innobase_mirrored_log_groups, innobase_log_files_in_group; -extern long innobase_log_file_size, innobase_log_buffer_size; -extern long innobase_buffer_pool_size, innobase_additional_mem_pool_size; +extern longlong innobase_buffer_pool_size, innobase_log_file_size; +extern long innobase_log_buffer_size; +extern long innobase_additional_mem_pool_size; extern long innobase_buffer_pool_awe_mem_mb; extern long innobase_file_io_threads, innobase_lock_wait_timeout; extern long innobase_force_recovery; diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index f03434c74e6..dfd8fb23cf4 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -50,7 +50,7 @@ TYPELIB myisam_stats_method_typelib= { ** MyISAM tables *****************************************************************************/ -static handler *myisam_create_handler(TABLE *table); +static handler *myisam_create_handler(TABLE_SHARE *table); /* MyISAM handlerton */ @@ -92,7 +92,7 @@ handlerton myisam_hton= { }; -static handler *myisam_create_handler(TABLE *table) +static handler *myisam_create_handler(TABLE_SHARE *table) { return new ha_myisam(table); } @@ -178,7 +178,7 @@ void mi_check_print_warning(MI_CHECK *param, const char *fmt,...) } -ha_myisam::ha_myisam(TABLE *table_arg) +ha_myisam::ha_myisam(TABLE_SHARE *table_arg) :handler(&myisam_hton, table_arg), file(0), int_table_flags(HA_NULL_IN_KEY | HA_CAN_FULLTEXT | HA_CAN_SQL_HANDLER | HA_DUPP_POS | HA_CAN_INDEX_BLOBS | HA_AUTO_PART_KEY | @@ -304,6 +304,10 @@ int ha_myisam::open(const char *name, int mode, uint test_if_locked) if (test_if_locked & (HA_OPEN_IGNORE_IF_LOCKED | HA_OPEN_TMP_TABLE)) VOID(mi_extra(file, HA_EXTRA_NO_WAIT_LOCK, 0)); + + if (!(test_if_locked & HA_OPEN_TMP_TABLE) && opt_myisam_use_mmap) + VOID(mi_extra(file, HA_EXTRA_MMAP, 0)); + info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST); if (!(test_if_locked & HA_OPEN_WAIT_IF_LOCKED)) VOID(mi_extra(file, HA_EXTRA_WAIT_LOCK, 0)); @@ -358,7 +362,7 @@ int ha_myisam::check(THD* thd, HA_CHECK_OPT* check_opt) myisamchk_init(¶m); param.thd = thd; param.op_name = "check"; - param.db_name= table->s->db; + param.db_name= table->s->db.str; param.table_name= table->alias; param.testflag = check_opt->flags | T_CHECK | T_SILENT; param.stats_method= (enum_mi_stats_method)thd->variables.myisam_stats_method; @@ -446,7 +450,7 @@ int ha_myisam::analyze(THD *thd, HA_CHECK_OPT* check_opt) myisamchk_init(¶m); param.thd = thd; param.op_name= "analyze"; - param.db_name= table->s->db; + param.db_name= table->s->db.str; param.table_name= table->alias; param.testflag= (T_FAST | T_CHECK | T_SILENT | T_STATISTICS | T_DONT_CHECK_CHECKSUM); @@ -474,7 +478,7 @@ int ha_myisam::restore(THD* thd, HA_CHECK_OPT *check_opt) HA_CHECK_OPT tmp_check_opt; char *backup_dir= thd->lex->backup_dir; char src_path[FN_REFLEN], dst_path[FN_REFLEN]; - const char *table_name= table->s->table_name; + const char *table_name= table->s->table_name.str; int error; const char* errmsg; DBUG_ENTER("restore"); @@ -483,8 +487,8 @@ int ha_myisam::restore(THD* thd, HA_CHECK_OPT *check_opt) MI_NAME_DEXT)) DBUG_RETURN(HA_ADMIN_INVALID); - if (my_copy(src_path, fn_format(dst_path, table->s->path, "", - MI_NAME_DEXT, 4), MYF(MY_WME))) + strxmov(dst_path, table->s->normalized_path.str, MI_NAME_DEXT, NullS); + if (my_copy(src_path, dst_path, MYF(MY_WME))) { error= HA_ADMIN_FAILED; errmsg= "Failed in my_copy (Error %d)"; @@ -501,8 +505,8 @@ int ha_myisam::restore(THD* thd, HA_CHECK_OPT *check_opt) myisamchk_init(¶m); param.thd= thd; param.op_name= "restore"; - param.db_name= table->s->db; - param.table_name= table->s->table_name; + param.db_name= table->s->db.str; + param.table_name= table->s->table_name.str; param.testflag= 0; mi_check_print_error(¶m, errmsg, my_errno); DBUG_RETURN(error); @@ -514,7 +518,7 @@ int ha_myisam::backup(THD* thd, HA_CHECK_OPT *check_opt) { char *backup_dir= thd->lex->backup_dir; char src_path[FN_REFLEN], dst_path[FN_REFLEN]; - const char *table_name= table->s->table_name; + const char *table_name= table->s->table_name.str; int error; const char *errmsg; DBUG_ENTER("ha_myisam::backup"); @@ -527,9 +531,8 @@ int ha_myisam::backup(THD* thd, HA_CHECK_OPT *check_opt) goto err; } - if (my_copy(fn_format(src_path, table->s->path, "", reg_ext, - MY_UNPACK_FILENAME), - dst_path, + strxmov(src_path, table->s->normalized_path.str, reg_ext, NullS); + if (my_copy(src_path, dst_path, MYF(MY_WME | MY_HOLD_ORIGINAL_MODES | MY_DONT_OVERWRITE_FILE))) { error = HA_ADMIN_FAILED; @@ -546,9 +549,8 @@ int ha_myisam::backup(THD* thd, HA_CHECK_OPT *check_opt) goto err; } - if (my_copy(fn_format(src_path, table->s->path, "", MI_NAME_DEXT, - MY_UNPACK_FILENAME), - dst_path, + strxmov(src_path, table->s->normalized_path.str, MI_NAME_DEXT, NullS); + if (my_copy(src_path, dst_path, MYF(MY_WME | MY_HOLD_ORIGINAL_MODES | MY_DONT_OVERWRITE_FILE))) { errmsg = "Failed copying .MYD file (errno: %d)"; @@ -563,8 +565,8 @@ int ha_myisam::backup(THD* thd, HA_CHECK_OPT *check_opt) myisamchk_init(¶m); param.thd= thd; param.op_name= "backup"; - param.db_name= table->s->db; - param.table_name= table->s->table_name; + param.db_name= table->s->db.str; + param.table_name= table->s->table_name.str; param.testflag = 0; mi_check_print_error(¶m,errmsg, my_errno); DBUG_RETURN(error); @@ -655,7 +657,7 @@ int ha_myisam::repair(THD *thd, MI_CHECK ¶m, bool optimize) ha_rows rows= file->state->records; DBUG_ENTER("ha_myisam::repair"); - param.db_name= table->s->db; + param.db_name= table->s->db.str; param.table_name= table->alias; param.tmpfile_createflag = O_RDWR | O_TRUNC; param.using_global_keycache = 1; @@ -826,8 +828,8 @@ int ha_myisam::assign_to_keycache(THD* thd, HA_CHECK_OPT *check_opt) myisamchk_init(¶m); param.thd= thd; param.op_name= "assign_to_keycache"; - param.db_name= table->s->db; - param.table_name= table->s->table_name; + param.db_name= table->s->db.str; + param.table_name= table->s->table_name.str; param.testflag= 0; mi_check_print_error(¶m, errmsg); } @@ -894,8 +896,8 @@ int ha_myisam::preload_keys(THD* thd, HA_CHECK_OPT *check_opt) myisamchk_init(¶m); param.thd= thd; param.op_name= "preload_keys"; - param.db_name= table->s->db; - param.table_name= table->s->table_name; + param.db_name= table->s->db.str; + param.table_name= table->s->table_name.str; param.testflag= 0; mi_check_print_error(¶m, errmsg); DBUG_RETURN(error); @@ -1149,8 +1151,8 @@ bool ha_myisam::check_and_repair(THD *thd) old_query= thd->query; old_query_length= thd->query_length; pthread_mutex_lock(&LOCK_thread_count); - thd->query= (char*) table->s->table_name; - thd->query_length= (uint32) strlen(table->s->table_name); + thd->query= table->s->table_name.str; + thd->query_length= table->s->table_name.length; pthread_mutex_unlock(&LOCK_thread_count); if ((marked_crashed= mi_is_crashed(file)) || check(thd, &check_opt)) @@ -1337,6 +1339,10 @@ void ha_myisam::info(uint flag) ref_length= info.reflength; share->db_options_in_use= info.options; block_size= myisam_block_size; + + /* Update share */ + if (share->tmp_table == NO_TMP_TABLE) + pthread_mutex_lock(&share->mutex); share->keys_in_use.set_prefix(share->keys); share->keys_in_use.intersect_extended(info.key_map); share->keys_for_keyread.intersect(share->keys_in_use); @@ -1345,6 +1351,9 @@ void ha_myisam::info(uint flag) memcpy((char*) table->key_info[0].rec_per_key, (char*) info.rec_per_key, sizeof(table->key_info[0].rec_per_key)*share->key_parts); + if (share->tmp_table == NO_TMP_TABLE) + pthread_mutex_unlock(&share->mutex); + raid_type= info.raid_type; raid_chunks= info.raid_chunks; raid_chunksize= info.raid_chunksize; @@ -1353,7 +1362,7 @@ void ha_myisam::info(uint flag) Set data_file_name and index_file_name to point at the symlink value if table is symlinked (Ie; Real name is not same as generated name) */ - data_file_name=index_file_name=0; + data_file_name= index_file_name= 0; fn_format(name_buff, file->filename, "", MI_NAME_DEXT, 2); if (strcmp(name_buff, info.data_file_name)) data_file_name=info.data_file_name; @@ -1448,7 +1457,7 @@ int ha_myisam::create(const char *name, register TABLE *table_arg, MI_KEYDEF *keydef; MI_COLUMNDEF *recinfo,*recinfo_pos; HA_KEYSEG *keyseg; - TABLE_SHARE *share= table->s; + TABLE_SHARE *share= table_arg->s; uint options= share->db_options_in_use; DBUG_ENTER("ha_myisam::create"); diff --git a/sql/ha_myisam.h b/sql/ha_myisam.h index 79036893faf..eb3ac9db7e4 100644 --- a/sql/ha_myisam.h +++ b/sql/ha_myisam.h @@ -43,7 +43,7 @@ class ha_myisam: public handler int repair(THD *thd, MI_CHECK ¶m, bool optimize); public: - ha_myisam(TABLE *table_arg); + ha_myisam(TABLE_SHARE *table_arg); ~ha_myisam() {} const char *table_type() const { return "MyISAM"; } const char *index_type(uint key_number); @@ -51,7 +51,7 @@ class ha_myisam: public handler ulong table_flags() const { return int_table_flags; } ulong index_flags(uint inx, uint part, bool all_parts) const { - return ((table->key_info[inx].algorithm == HA_KEY_ALG_FULLTEXT) ? + return ((table_share->key_info[inx].algorithm == HA_KEY_ALG_FULLTEXT) ? 0 : HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE | HA_READ_ORDER | HA_KEYREAD_ONLY); } diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc index 61dbc315185..37dfe34b40c 100644 --- a/sql/ha_myisammrg.cc +++ b/sql/ha_myisammrg.cc @@ -32,7 +32,7 @@ ** MyISAM MERGE tables *****************************************************************************/ -static handler *myisammrg_create_handler(TABLE *table); +static handler *myisammrg_create_handler(TABLE_SHARE *table); /* MyISAM MERGE handlerton */ @@ -69,13 +69,13 @@ handlerton myisammrg_hton= { HTON_CAN_RECREATE }; -static handler *myisammrg_create_handler(TABLE *table) +static handler *myisammrg_create_handler(TABLE_SHARE *table) { return new ha_myisammrg(table); } -ha_myisammrg::ha_myisammrg(TABLE *table_arg) +ha_myisammrg::ha_myisammrg(TABLE_SHARE *table_arg) :handler(&myisammrg_hton, table_arg), file(0) {} @@ -302,7 +302,6 @@ void ha_myisammrg::info(uint flag) errkey = info.errkey; table->s->keys_in_use.set_prefix(table->s->keys); table->s->db_options_in_use= info.options; - table->s->is_view= 1; mean_rec_length= info.reclength; block_size=0; update_time=0; @@ -456,9 +455,9 @@ int ha_myisammrg::create(const char *name, register TABLE *form, for (pos= table_names; tables; tables= tables->next_local) { const char *table_name; - TABLE **tbl= 0; + TABLE *tbl= 0; if (create_info->options & HA_LEX_CREATE_TMP_TABLE) - tbl= find_temporary_table(thd, tables->db, tables->table_name); + tbl= find_temporary_table(thd, tables); if (!tbl) { /* @@ -487,7 +486,7 @@ int ha_myisammrg::create(const char *name, register TABLE *form, DBUG_RETURN(HA_ERR_OUT_OF_MEM); } else - table_name= (*tbl)->s->path; + table_name= tbl->s->path.str; *pos++= table_name; } *pos=0; @@ -503,17 +502,17 @@ void ha_myisammrg::append_create_info(String *packet) const char *current_db; uint db_length; THD *thd= current_thd; + MYRG_TABLE *open_table, *first; if (file->merge_insert_method != MERGE_INSERT_DISABLED) { - packet->append(" INSERT_METHOD=",15); + packet->append(STRING_WITH_LEN(" INSERT_METHOD=")); packet->append(get_type(&merge_insert_method,file->merge_insert_method-1)); } - packet->append(" UNION=(",8); - MYRG_TABLE *open_table,*first; + packet->append(STRING_WITH_LEN(" UNION=(")); - current_db= table->s->db; - db_length= (uint) strlen(current_db); + current_db= table->s->db.str; + db_length= table->s->db.length; for (first=open_table=file->open_tables ; open_table != file->end_table ; diff --git a/sql/ha_myisammrg.h b/sql/ha_myisammrg.h index 45cf93a7e63..4327b1c17b9 100644 --- a/sql/ha_myisammrg.h +++ b/sql/ha_myisammrg.h @@ -28,7 +28,7 @@ class ha_myisammrg: public handler MYRG_INFO *file; public: - ha_myisammrg(TABLE *table_arg); + ha_myisammrg(TABLE_SHARE *table_arg); ~ha_myisammrg() {} const char *table_type() const { return "MRG_MyISAM"; } const char **bas_ext() const; @@ -37,11 +37,12 @@ class ha_myisammrg: public handler { return (HA_REC_NOT_IN_SEQ | HA_AUTO_PART_KEY | HA_READ_RND_SAME | HA_NULL_IN_KEY | HA_CAN_INDEX_BLOBS | HA_FILE_BASED | - HA_CAN_INSERT_DELAYED | HA_ANY_INDEX_MAY_BE_UNIQUE); + HA_CAN_INSERT_DELAYED | HA_ANY_INDEX_MAY_BE_UNIQUE | + HA_NO_COPY_ON_ALTER); } ulong index_flags(uint inx, uint part, bool all_parts) const { - return ((table->key_info[inx].algorithm == HA_KEY_ALG_FULLTEXT) ? + return ((table_share->key_info[inx].algorithm == HA_KEY_ALG_FULLTEXT) ? 0 : HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE | HA_READ_ORDER | HA_KEYREAD_ONLY); } diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 89cf020262d..75ee136c916 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -56,7 +56,7 @@ static const char share_prefix[]= "./"; static int ndbcluster_close_connection(THD *thd); static int ndbcluster_commit(THD *thd, bool all); static int ndbcluster_rollback(THD *thd, bool all); -static handler* ndbcluster_create_handler(TABLE *table); +static handler* ndbcluster_create_handler(TABLE_SHARE *table); handlerton ndbcluster_hton = { "ndbcluster", @@ -91,7 +91,7 @@ handlerton ndbcluster_hton = { HTON_NO_FLAGS }; -static handler *ndbcluster_create_handler(TABLE *table) +static handler *ndbcluster_create_handler(TABLE_SHARE *table) { return new ha_ndbcluster(table); } @@ -101,6 +101,8 @@ static handler *ndbcluster_create_handler(TABLE *table) #define NDB_FAILED_AUTO_INCREMENT ~(Uint64)0 #define NDB_AUTO_INCREMENT_RETRIES 10 +#define NDB_INVALID_SCHEMA_OBJECT 241 + #define ERR_PRINT(err) \ DBUG_PRINT("error", ("%d message: %s", err.code, err.message)) @@ -368,7 +370,21 @@ Thd_ndb::Thd_ndb() Thd_ndb::~Thd_ndb() { if (ndb) + { +#ifndef DBUG_OFF + Ndb::Free_list_usage tmp; tmp.m_name= 0; + while (ndb->get_free_list_usage(&tmp)) + { + uint leaked= (uint) tmp.m_created - tmp.m_free; + if (leaked) + fprintf(stderr, "NDB: Found %u %s%s that %s not been released\n", + leaked, tmp.m_name, + (leaked == 1)?"":"'s", + (leaked == 1)?"has":"have"); + } +#endif delete ndb; + } ndb= NULL; changed_tables.empty(); } @@ -969,6 +985,10 @@ bool ha_ndbcluster::uses_blob_value() IMPLEMENTATION - check that frm-file on disk is equal to frm-file of table accessed in NDB + + RETURN + 0 ok + -2 Meta data has changed; Re-read data and try again */ static int cmp_frm(const NDBTAB *ndbtab, const void *pack_data, @@ -991,7 +1011,6 @@ int ha_ndbcluster::get_metadata(const char *path) const NDBTAB *tab; int error; bool invalidating_ndb_table= FALSE; - DBUG_ENTER("get_metadata"); DBUG_PRINT("enter", ("m_tabname: %s, path: %s", m_tabname, path)); @@ -1037,7 +1056,7 @@ int ha_ndbcluster::get_metadata(const char *path) memcmp(pack_data, tab->getFrmData(), pack_length))); DBUG_DUMP("pack_data", (char*)pack_data, pack_length); DBUG_DUMP("frm", (char*)tab->getFrmData(), tab->getFrmLength()); - error= 3; + error= HA_ERR_TABLE_DEF_CHANGED; invalidating_ndb_table= FALSE; } } @@ -1113,7 +1132,7 @@ int ha_ndbcluster::build_index_list(Ndb *ndb, TABLE *tab, enum ILBP phase) m_index[i].type= idx_type; if (idx_type == UNIQUE_ORDERED_INDEX || idx_type == UNIQUE_INDEX) { - strxnmov(unique_index_name, FN_LEN, index_name, unique_suffix, NullS); + strxnmov(unique_index_name, FN_LEN-1, index_name, unique_suffix, NullS); DBUG_PRINT("info", ("Created unique index name \'%s\' for index %d", unique_index_name, i)); } @@ -1147,7 +1166,7 @@ int ha_ndbcluster::build_index_list(Ndb *ndb, TABLE *tab, enum ILBP phase) if (error) { DBUG_PRINT("error", ("Failed to create index %u", i)); - drop_table(); + intern_drop_table(); break; } } @@ -1199,11 +1218,12 @@ int ha_ndbcluster::build_index_list(Ndb *ndb, TABLE *tab, enum ILBP phase) */ NDB_INDEX_TYPE ha_ndbcluster::get_index_type_from_table(uint inx) const { - bool is_hash_index= (table->key_info[inx].algorithm == HA_KEY_ALG_HASH); - if (inx == table->s->primary_key) + bool is_hash_index= (table_share->key_info[inx].algorithm == + HA_KEY_ALG_HASH); + if (inx == table_share->primary_key) return is_hash_index ? PRIMARY_KEY_INDEX : PRIMARY_KEY_ORDERED_INDEX; - return ((table->key_info[inx].flags & HA_NOSAME) ? + return ((table_share->key_info[inx].flags & HA_NOSAME) ? (is_hash_index ? UNIQUE_INDEX : UNIQUE_ORDERED_INDEX) : ORDERED_INDEX); } @@ -1322,7 +1342,7 @@ inline ulong ha_ndbcluster::index_flags(uint idx_no, uint part, bool all_parts) const { DBUG_ENTER("ha_ndbcluster::index_flags"); - DBUG_PRINT("info", ("idx_no: %d", idx_no)); + DBUG_PRINT("enter", ("idx_no: %u", idx_no)); DBUG_ASSERT(get_index_type_from_table(idx_no) < index_flags_size); DBUG_RETURN(index_type_flags[get_index_type_from_table(idx_no)] | HA_KEY_SCAN_NOT_ROR); @@ -3415,14 +3435,20 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type) DBUG_PRINT("info", ("Table schema version: %d", tab->getObjectVersion())); } - if (m_table != (void *)tab || m_table_version < tab->getObjectVersion()) + if (m_table_version < tab->getObjectVersion()) { /* - The table has been altered, refresh the index list + The table has been altered, caller has to retry */ - build_index_list(ndb, table, ILBP_OPEN); + NdbError err= ndb->getNdbError(NDB_INVALID_SCHEMA_OBJECT); + DBUG_RETURN(ndb_to_mysql_error(&err)); + } + if (m_table != (void *)tab) + { m_table= (void *)tab; m_table_version = tab->getObjectVersion(); + if (!(my_errno= build_index_list(ndb, table, ILBP_OPEN))) + DBUG_RETURN(my_errno); } m_table_info= tab_info; } @@ -3913,15 +3939,16 @@ int ha_ndbcluster::create(const char *name, uint pack_length, length, i, pk_length= 0; const void *data, *pack_data; char name2[FN_HEADLEN]; - bool create_from_engine= test(info->table_options & - HA_OPTION_CREATE_FROM_ENGINE); - + bool create_from_engine= (info->table_options & HA_OPTION_CREATE_FROM_ENGINE); + DBUG_ENTER("ha_ndbcluster::create"); DBUG_PRINT("enter", ("name: %s", name)); + fn_format(name2, name, "", "",2); // Remove the .frm extension set_dbname(name2); set_tabname(name2); + table= form; if (create_from_engine) { /* @@ -4039,7 +4066,7 @@ int ha_ndbcluster::create(const char *name, } // Check partition info - partition_info *part_info= form->s->part_info; + partition_info *part_info= form->part_info; if (part_info) { int error; @@ -4236,7 +4263,7 @@ ha_ndbcluster::delete_table(ha_ndbcluster *h, Ndb *ndb, int res; if (h) { - res= h->drop_table(); + res= h->intern_drop_table(); } else { @@ -4273,12 +4300,12 @@ int ha_ndbcluster::delete_table(const char *name) Drop table in NDB Cluster */ -int ha_ndbcluster::drop_table() +int ha_ndbcluster::intern_drop_table() { Ndb *ndb= get_ndb(); NdbDictionary::Dictionary *dict= ndb->getDictionary(); - DBUG_ENTER("drop_table"); + DBUG_ENTER("intern_drop_table"); DBUG_PRINT("enter", ("Deleting %s", m_tabname)); release_metadata(); if (dict->dropTable(m_tabname)) @@ -4339,7 +4366,7 @@ ulonglong ha_ndbcluster::get_auto_increment() HA_CAN_GEOMETRY | \ HA_CAN_BIT_FIELD -ha_ndbcluster::ha_ndbcluster(TABLE *table_arg): +ha_ndbcluster::ha_ndbcluster(TABLE_SHARE *table_arg): handler(&ndbcluster_hton, table_arg), m_active_trans(NULL), m_active_cursor(NULL), @@ -4436,18 +4463,24 @@ ha_ndbcluster::~ha_ndbcluster() Open a table for further use - fetch metadata for this table from NDB - check that table exists + + RETURN + 0 ok + < 0 Table has changed */ int ha_ndbcluster::open(const char *name, int mode, uint test_if_locked) { int res; KEY *key; - DBUG_ENTER("open"); - DBUG_PRINT("enter", ("this: %d name: %s mode: %d test_if_locked: %d", - this, name, mode, test_if_locked)); + DBUG_ENTER("ha_ndbcluster::open"); + DBUG_PRINT("enter", ("name: %s mode: %d test_if_locked: %d", + name, mode, test_if_locked)); - // Setup ref_length to make room for the whole - // primary key to be written in the ref variable + /* + Setup ref_length to make room for the whole + primary key to be written in the ref variable + */ if (table->s->primary_key != MAX_KEY) { @@ -4473,18 +4506,18 @@ int ha_ndbcluster::open(const char *name, int mode, uint test_if_locked) if (!res) info(HA_STATUS_VARIABLE | HA_STATUS_CONST); - if (table->s->part_info) - { - m_part_info= table->s->part_info; - if (!(m_part_info->part_type == HASH_PARTITION && - m_part_info->list_of_part_fields && - !is_sub_partitioned(m_part_info))) - m_use_partition_function= TRUE; - } DBUG_RETURN(res); } +void ha_ndbcluster::set_part_info(partition_info *part_info) +{ + m_part_info= part_info; + if (!(m_part_info->part_type == HASH_PARTITION && + m_part_info->list_of_part_fields && + !is_sub_partitioned(m_part_info))) + m_use_partition_function= TRUE; +} /* Close the table @@ -4710,12 +4743,13 @@ int ndbcluster_drop_database_impl(const char *path) } // Drop any tables belonging to database char full_path[FN_REFLEN]; - char *tmp= strxnmov(full_path, FN_REFLEN, share_prefix, dbname, "/", NullS); + char *tmp= strxnmov(full_path, FN_REFLEN-1, share_prefix, dbname, "/", + NullS); ndb->setDatabaseName(dbname); List_iterator_fast it(drop_list); while ((tabname=it++)) { - strxnmov(tmp, FN_REFLEN - (tmp - full_path), tabname, NullS); + strxnmov(tmp, FN_REFLEN - (tmp - full_path)-1, tabname, NullS); if (ha_ndbcluster::delete_table(0, ndb, full_path, dbname, tabname)) { const NdbError err= dict->getNdbError(); @@ -4782,7 +4816,7 @@ static int ndbcluster_find_all_files(THD *thd) if (ndbtab->getFrmLength() == 0) continue; - strxnmov(key, FN_LEN, mysql_data_home, "/", + strxnmov(key, FN_LEN-1, mysql_data_home, "/", elmt.database, "/", elmt.name, NullS); const void *data= 0, *pack_data= 0; uint length, pack_length; @@ -4898,7 +4932,7 @@ int ndbcluster_find_files(THD *thd,const char *db,const char *path, } // File is not in NDB, check for .ndb file with this name - (void)strxnmov(name, FN_REFLEN, + (void)strxnmov(name, FN_REFLEN-1, mysql_data_home,"/",db,"/",file_name,ha_ndb_ext,NullS); DBUG_PRINT("info", ("Check access for %s", name)); if (access(name, F_OK)) @@ -4928,7 +4962,7 @@ int ndbcluster_find_files(THD *thd,const char *db,const char *path, file_name= hash_element(&ndb_tables, i); if (!hash_search(&ok_tables, file_name, strlen(file_name))) { - strxnmov(name, sizeof(name), + strxnmov(name, sizeof(name)-1, mysql_data_home, "/", db, "/", file_name, reg_ext, NullS); if (access(name, F_OK)) { @@ -4974,7 +5008,7 @@ int ndbcluster_find_files(THD *thd,const char *db,const char *path, files->push_back(thd->strdup(file_name)); } - pthread_mutex_unlock(&LOCK_open); + pthread_mutex_unlock(&LOCK_open); hash_free(&ok_tables); hash_free(&ndb_tables); @@ -5118,7 +5152,21 @@ int ndbcluster_end(ha_panic_function type) (void) pthread_mutex_unlock(&LOCK_ndb_util_thread); if (g_ndb) + { +#ifndef DBUG_OFF + Ndb::Free_list_usage tmp; tmp.m_name= 0; + while (g_ndb->get_free_list_usage(&tmp)) + { + uint leaked= (uint) tmp.m_created - tmp.m_free; + if (leaked) + fprintf(stderr, "NDB: Found %u %s%s that %s not been released\n", + leaked, tmp.m_name, + (leaked == 1)?"":"'s", + (leaked == 1)?"has":"have"); + } +#endif delete g_ndb; + } g_ndb= NULL; if (g_ndb_cluster_connection) delete g_ndb_cluster_connection; @@ -5142,11 +5190,13 @@ int ndbcluster_end(ha_panic_function type) void ndbcluster_print_error(int error, const NdbOperation *error_op) { DBUG_ENTER("ndbcluster_print_error"); - TABLE tab; + TABLE_SHARE share; const char *tab_name= (error_op) ? error_op->getTableName() : ""; - tab.alias= (char *) tab_name; - ha_ndbcluster error_handler(&tab); - tab.file= &error_handler; + share.db.str= (char*) ""; + share.db.length= 0; + share.table_name.str= (char *) tab_name; + share.table_name.length= strlen(tab_name); + ha_ndbcluster error_handler(&share); error_handler.print_error(error, MYF(0)); DBUG_VOID_RETURN; } @@ -5398,11 +5448,11 @@ uint8 ha_ndbcluster::table_cache_type() uint ndb_get_commitcount(THD *thd, char *dbname, char *tabname, Uint64 *commit_count) { - DBUG_ENTER("ndb_get_commitcount"); - char name[FN_REFLEN]; NDB_SHARE *share; - (void)strxnmov(name, FN_REFLEN, share_prefix, dbname, "/", tabname, NullS); + DBUG_ENTER("ndb_get_commitcount"); + + (void)strxnmov(name, FN_REFLEN-1, share_prefix, dbname, "/", tabname, NullS); DBUG_PRINT("enter", ("name: %s", name)); pthread_mutex_lock(&ndbcluster_mutex); if (!(share=(NDB_SHARE*) hash_search(&ndbcluster_open_tables, @@ -6038,7 +6088,7 @@ int ha_ndbcluster::write_ndb_file() DBUG_ENTER("write_ndb_file"); DBUG_PRINT("enter", ("db: %s, name: %s", m_dbname, m_tabname)); - (void)strxnmov(path, FN_REFLEN, + (void)strxnmov(path, FN_REFLEN-1, mysql_data_home,"/",m_dbname,"/",m_tabname,ha_ndb_ext,NullS); if ((file=my_create(path, CREATE_MODE,O_RDWR | O_TRUNC,MYF(MY_WME))) >= 0) @@ -7040,9 +7090,9 @@ void ndb_serialize_cond(const Item *item, void *arg) } else { - DBUG_PRINT("info", ("Was not expecting field from table %s(%s)", - context->table->s->table_name, - field->table->s->table_name)); + DBUG_PRINT("info", ("Was not expecting field from table %s (%s)", + context->table->s->table_name.str, + field->table->s->table_name.str)); context->supported= FALSE; } break; diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h index 40c9450809c..fb506375797 100644 --- a/sql/ha_ndbcluster.h +++ b/sql/ha_ndbcluster.h @@ -478,7 +478,7 @@ class Thd_ndb class ha_ndbcluster: public handler { public: - ha_ndbcluster(TABLE *table); + ha_ndbcluster(TABLE_SHARE *table); ~ha_ndbcluster(); int open(const char *name, int mode, uint test_if_locked); @@ -534,6 +534,7 @@ class ha_ndbcluster: public handler return (HA_CAN_PARTITION | HA_CAN_UPDATE_PARTITION_KEY | HA_CAN_PARTITION_UNIQUE); } + void set_part_info(partition_info *part_info); ulong index_flags(uint idx, uint part, bool all_parts) const; uint max_supported_record_length() const; uint max_supported_keys() const; @@ -620,7 +621,7 @@ private: const char *path, const char *db, const char *table_name); - int drop_table(); + int intern_drop_table(); int create_index(const char *name, KEY *key_info, bool unique); int create_ordered_index(const char *name, KEY *key_info); int create_unique_index(const char *name, KEY *key_info); diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 7a0678d6f84..650830832cb 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* - This handler was developed by Mikael Ronström for version 5.1 of MySQL. + This handler was developed by Mikael Ronstrom for version 5.1 of MySQL. It is an abstraction layer on top of other handlers such as MyISAM, InnoDB, Federated, Berkeley DB and so forth. Partitioned tables can also be handled by a storage engine. The current example of this is NDB @@ -52,7 +52,7 @@ #pragma implementation // gcc: Class implementation #endif -#include +#include "mysql_priv.h" #include "ha_partition.h" @@ -66,7 +66,7 @@ static PARTITION_SHARE *get_share(const char *table_name, TABLE * table); MODULE create/delete handler object ****************************************************************************/ -static handler* partition_create_handler(TABLE *table); +static handler *partition_create_handler(TABLE_SHARE *share); handlerton partition_hton = { "partition", @@ -101,31 +101,25 @@ handlerton partition_hton = { HTON_NOT_USER_SELECTABLE }; -static handler* partition_create_handler(TABLE *table) +static handler *partition_create_handler(TABLE_SHARE *share) { - return new ha_partition(table); + return new ha_partition(share); } -ha_partition::ha_partition(TABLE *table) - :handler(&partition_hton, table), m_part_info(NULL), m_create_handler(FALSE), + +ha_partition::ha_partition(TABLE_SHARE *share) + :handler(&partition_hton, share), m_part_info(NULL), m_create_handler(FALSE), m_is_sub_partitioned(0) { DBUG_ENTER("ha_partition::ha_partition(table)"); init_handler_variables(); - if (table) - { - if (table->s->part_info) - { - m_part_info= table->s->part_info; - m_is_sub_partitioned= is_sub_partitioned(m_part_info); - } - } DBUG_VOID_RETURN; } ha_partition::ha_partition(partition_info *part_info) - :handler(&partition_hton, NULL), m_part_info(part_info), m_create_handler(TRUE), + :handler(&partition_hton, NULL), m_part_info(part_info), + m_create_handler(TRUE), m_is_sub_partitioned(is_sub_partitioned(m_part_info)) { @@ -167,6 +161,10 @@ void ha_partition::init_handler_variables() m_last_part= 0; m_rec0= 0; m_curr_key_info= 0; + /* + this allows blackhole to work properly + */ + m_no_locks= 0; #ifdef DONT_HAVE_TO_BE_INITALIZED m_start_key.flag= 0; @@ -226,64 +224,64 @@ ha_partition::~ha_partition() int ha_partition::ha_initialise() { handler **file_array, *file; - DBUG_ENTER("ha_partition::set_up_constants"); + DBUG_ENTER("ha_partition::ha_initialise"); - if (m_part_info) + if (m_create_handler) { m_tot_parts= get_tot_partitions(m_part_info); DBUG_ASSERT(m_tot_parts > 0); - if (m_create_handler) + if (new_handlers_from_part_info()) + DBUG_RETURN(1); + } + else if (!table_share || !table_share->normalized_path.str) + { + /* + Called with dummy table share (delete, rename and alter table) + Don't need to set-up table flags other than + HA_FILE_BASED here + */ + m_table_flags|= HA_FILE_BASED | HA_REC_NOT_IN_SEQ; + DBUG_RETURN(0); + } + else if (get_from_handler_file(table_share->normalized_path.str)) + { + my_error(ER_OUTOFMEMORY, MYF(0), 129); //Temporary fix TODO print_error + DBUG_RETURN(1); + } + /* + We create all underlying table handlers here. We do it in this special + method to be able to report allocation errors. + + Set up table_flags, low_byte_first, primary_key_is_clustered and + has_transactions since they are called often in all kinds of places, + other parameters are calculated on demand. + HA_FILE_BASED is always set for partition handler since we use a + special file for handling names of partitions, engine types. + HA_CAN_GEOMETRY, HA_CAN_FULLTEXT, HA_CAN_SQL_HANDLER, + HA_CAN_INSERT_DELAYED is disabled until further investigated. + */ + m_table_flags= m_file[0]->table_flags(); + m_low_byte_first= m_file[0]->low_byte_first(); + m_has_transactions= TRUE; + m_pkey_is_clustered= TRUE; + file_array= m_file; + do + { + file= *file_array; + if (m_low_byte_first != file->low_byte_first()) { - if (new_handlers_from_part_info()) - DBUG_RETURN(1); - } - else if (get_from_handler_file(table->s->path)) - { - my_error(ER_OUTOFMEMORY, MYF(0), 129); //Temporary fix TODO print_error + // Cannot have handlers with different endian + my_error(ER_MIX_HANDLER_ERROR, MYF(0)); DBUG_RETURN(1); } - /* - We create all underlying table handlers here. We only do it if we have - access to the partition info. We do it in this special method to be - able to report allocation errors. - */ - /* - Set up table_flags, low_byte_first, primary_key_is_clustered and - has_transactions since they are called often in all kinds of places, - other parameters are calculated on demand. - HA_FILE_BASED is always set for partition handler since we use a - special file for handling names of partitions, engine types. - HA_CAN_GEOMETRY, HA_CAN_FULLTEXT, HA_CAN_SQL_HANDLER, - HA_CAN_INSERT_DELAYED is disabled until further investigated. - */ - m_table_flags= m_file[0]->table_flags(); - m_low_byte_first= m_file[0]->low_byte_first(); - m_has_transactions= TRUE; - m_pkey_is_clustered= TRUE; - file_array= m_file; - do - { - file= *file_array; - if (m_low_byte_first != file->low_byte_first()) - { - // Cannot have handlers with different endian - my_error(ER_MIX_HANDLER_ERROR, MYF(0)); - DBUG_RETURN(1); - } - if (!file->has_transactions()) - m_has_transactions= FALSE; - if (!file->primary_key_is_clustered()) - m_pkey_is_clustered= FALSE; - m_table_flags&= file->table_flags(); - } while (*(++file_array)); - m_table_flags&= ~(HA_CAN_GEOMETRY & HA_CAN_FULLTEXT & - HA_CAN_SQL_HANDLER & HA_CAN_INSERT_DELAYED); - /* - TODO RONM: - Make sure that the tree works without partition defined, compiles - and goes through mysql-test-run. - */ - } + if (!file->has_transactions()) + m_has_transactions= FALSE; + if (!file->primary_key_is_clustered()) + m_pkey_is_clustered= FALSE; + m_table_flags&= file->table_flags(); + } while (*(++file_array)); + m_table_flags&= ~(HA_CAN_GEOMETRY & HA_CAN_FULLTEXT & + HA_CAN_SQL_HANDLER & HA_CAN_INSERT_DELAYED); m_table_flags|= HA_FILE_BASED | HA_REC_NOT_IN_SEQ; DBUG_RETURN(0); } @@ -716,7 +714,7 @@ bool ha_partition::create_handlers() bzero(m_file, alloc_len); for (i= 0; i < m_tot_parts; i++) { - if (!(m_file[i]= get_new_handler(table, current_thd->mem_root, + if (!(m_file[i]= get_new_handler(table_share, current_thd->mem_root, (enum db_type) m_engine_array[i]))) DBUG_RETURN(TRUE); DBUG_PRINT("info", ("engine_type: %u", m_engine_array[i])); @@ -760,7 +758,7 @@ bool ha_partition::new_handlers_from_part_info() do { part_elem= part_it++; - if (!(m_file[i]= get_new_handler(table, thd->mem_root, + if (!(m_file[i]= get_new_handler(table_share, thd->mem_root, part_elem->engine_type))) goto error; DBUG_PRINT("info", ("engine_type: %u", (uint) part_elem->engine_type)); @@ -768,7 +766,7 @@ bool ha_partition::new_handlers_from_part_info() { for (j= 0; j < m_part_info->no_subparts; j++) { - if (!(m_file[i]= get_new_handler(table, thd->mem_root, + if (!(m_file[i]= get_new_handler(table_share, thd->mem_root, part_elem->engine_type))) goto error; DBUG_PRINT("info", ("engine_type: %u", (uint) part_elem->engine_type)); @@ -909,9 +907,10 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked) do { create_partition_name(name_buff, name, name_buffer_ptr); - if ((error= (*file)->ha_open((const char*) name_buff, mode, + if ((error= (*file)->ha_open(table, (const char*) name_buff, mode, test_if_locked))) goto err_handler; + m_no_locks+= (*file)->lock_count(); name_buffer_ptr+= strlen(name_buffer_ptr) + 1; set_if_bigger(ref_length, ((*file)->ref_length)); } while (*(++file)); @@ -1098,7 +1097,7 @@ int ha_partition::start_stmt(THD *thd, thr_lock_type lock_type) uint ha_partition::lock_count() const { DBUG_ENTER("ha_partition::lock_count"); - DBUG_RETURN(m_tot_parts); + DBUG_RETURN(m_no_locks); } @@ -1143,7 +1142,7 @@ void ha_partition::unlock_row() ADDITIONAL INFO: Most handlers set timestamp when calling write row if any such fields - exists. Since we are calling an underlying handler we assume the´ + exists. Since we are calling an underlying handler we assume the underlying handler will assume this responsibility. Underlying handlers will also call update_auto_increment to calculate diff --git a/sql/ha_partition.h b/sql/ha_partition.h index 841719bddf4..a727a278103 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -67,6 +67,7 @@ private: u_long m_low_byte_first; uint m_tot_parts; // Total number of partitions; + uint m_no_locks; // For engines like ha_blackhole, which needs no locks uint m_last_part; // Last file that we update,write int m_lock_type; // Remembers type of last // external_lock @@ -121,6 +122,11 @@ private: PARTITION_SHARE *share; /* Shared lock info */ public: + virtual void set_part_info(partition_info *part_info) + { + m_part_info= part_info; + m_is_sub_partitioned= is_sub_partitioned(part_info); + } /* ------------------------------------------------------------------------- MODULE create/delete handler object @@ -132,7 +138,7 @@ public: partition handler. ------------------------------------------------------------------------- */ - ha_partition(TABLE * table); + ha_partition(TABLE_SHARE * table); ha_partition(partition_info * part_info); ~ha_partition(); /* diff --git a/sql/handler.cc b/sql/handler.cc index 3db2f76aef8..7f825ffda35 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -189,7 +189,8 @@ enum db_type ha_checktype(THD *thd, enum db_type database_type, } /* ha_checktype */ -handler *get_new_handler(TABLE *table, MEM_ROOT *alloc, enum db_type db_type) +handler *get_new_handler(TABLE_SHARE *share, MEM_ROOT *alloc, + enum db_type db_type) { handler *file= NULL; handlerton **types; @@ -205,7 +206,7 @@ handler *get_new_handler(TABLE *table, MEM_ROOT *alloc, enum db_type db_type) if (db_type == (*types)->db_type && (*types)->create) { file= ((*types)->state == SHOW_OPTION_YES) ? - (*types)->create(table) : NULL; + (*types)->create(share) : NULL; break; } } @@ -216,7 +217,7 @@ handler *get_new_handler(TABLE *table, MEM_ROOT *alloc, enum db_type db_type) enum db_type def=(enum db_type) current_thd->variables.table_type; /* Try first with 'default table type' */ if (db_type != def) - return get_new_handler(table, alloc, def); + return get_new_handler(share, alloc, def); } if (file) { @@ -1026,10 +1027,10 @@ int ha_update_statistics() int ha_rollback_to_savepoint(THD *thd, SAVEPOINT *sv) { int error=0; - THD_TRANS *trans=&thd->transaction.all; + THD_TRANS *trans= (thd->in_sub_stmt ? &thd->transaction.stmt : + &thd->transaction.all); handlerton **ht=trans->ht, **end_ht; DBUG_ENTER("ha_rollback_to_savepoint"); - DBUG_ASSERT(thd->transaction.stmt.ht[0] == 0); trans->nht=sv->nht; trans->no_2pc=0; @@ -1047,7 +1048,8 @@ int ha_rollback_to_savepoint(THD *thd, SAVEPOINT *sv) my_error(ER_ERROR_DURING_ROLLBACK, MYF(0), err); error=1; } - statistic_increment(thd->status_var.ha_savepoint_rollback_count,&LOCK_status); + statistic_increment(thd->status_var.ha_savepoint_rollback_count, + &LOCK_status); trans->no_2pc|=(*ht)->prepare == 0; } /* @@ -1057,7 +1059,7 @@ int ha_rollback_to_savepoint(THD *thd, SAVEPOINT *sv) for (; *ht ; ht++) { int err; - if ((err= (*(*ht)->rollback)(thd, 1))) + if ((err= (*(*ht)->rollback)(thd, !thd->in_sub_stmt))) { // cannot happen my_error(ER_ERROR_DURING_ROLLBACK, MYF(0), err); error=1; @@ -1077,10 +1079,10 @@ int ha_rollback_to_savepoint(THD *thd, SAVEPOINT *sv) int ha_savepoint(THD *thd, SAVEPOINT *sv) { int error=0; - THD_TRANS *trans=&thd->transaction.all; + THD_TRANS *trans= (thd->in_sub_stmt ? &thd->transaction.stmt : + &thd->transaction.all); handlerton **ht=trans->ht; DBUG_ENTER("ha_savepoint"); - DBUG_ASSERT(thd->transaction.stmt.ht[0] == 0); #ifdef USING_TRANSACTIONS for (; *ht; ht++) { @@ -1106,9 +1108,10 @@ int ha_savepoint(THD *thd, SAVEPOINT *sv) int ha_release_savepoint(THD *thd, SAVEPOINT *sv) { int error=0; - handlerton **ht=thd->transaction.all.ht, **end_ht; + THD_TRANS *trans= (thd->in_sub_stmt ? &thd->transaction.stmt : + &thd->transaction.all); + handlerton **ht=trans->ht, **end_ht; DBUG_ENTER("ha_release_savepoint"); - DBUG_ASSERT(thd->transaction.stmt.ht[0] == 0); end_ht=ht+sv->nht; for (; ht < end_ht; ht++) @@ -1176,7 +1179,7 @@ bool ha_flush_logs(enum db_type db_type) */ int ha_delete_table(THD *thd, enum db_type table_type, const char *path, - const char *alias, bool generate_warning) + const char *db, const char *alias, bool generate_warning) { handler *file; char tmp_path[FN_REFLEN]; @@ -1191,7 +1194,7 @@ int ha_delete_table(THD *thd, enum db_type table_type, const char *path, /* DB_TYPE_UNKNOWN is used in ALTER TABLE when renaming only .frm files */ if (table_type == DB_TYPE_UNKNOWN || - ! (file=get_new_handler(&dummy_table, thd->mem_root, table_type))) + ! (file=get_new_handler(&dummy_share, thd->mem_root, table_type))) DBUG_RETURN(ENOENT); if (lower_case_table_names == 2 && !(file->table_flags() & HA_FILE_BASED)) @@ -1224,7 +1227,12 @@ int ha_delete_table(THD *thd, enum db_type table_type, const char *path, thd->net.last_error[0]= 0; /* Fill up strucutures that print_error may need */ - dummy_table.s->path= path; + dummy_share.path.str= (char*) path; + dummy_share.path.length= strlen(path); + dummy_share.db.str= (char*) db; + dummy_share.db.length= strlen(db); + dummy_share.table_name.str= (char*) alias; + dummy_share.table_name.length= strlen(alias); dummy_table.alias= alias; file->print_error(error, 0); @@ -1246,16 +1254,26 @@ int ha_delete_table(THD *thd, enum db_type table_type, const char *path, ** General handler functions ****************************************************************************/ - /* Open database-handler. Try O_RDONLY if can't open as O_RDWR */ - /* Don't wait for locks if not HA_OPEN_WAIT_IF_LOCKED is set */ +/* + Open database-handler. -int handler::ha_open(const char *name, int mode, int test_if_locked) + IMPLEMENTATION + Try O_RDONLY if cannot open as O_RDWR + Don't wait for locks if not HA_OPEN_WAIT_IF_LOCKED is set +*/ + +int handler::ha_open(TABLE *table_arg, const char *name, int mode, + int test_if_locked) { int error; DBUG_ENTER("handler::ha_open"); - DBUG_PRINT("enter",("name: %s db_type: %d db_stat: %d mode: %d lock_test: %d", - name, table->s->db_type, table->db_stat, mode, - test_if_locked)); + DBUG_PRINT("enter", + ("name: %s db_type: %d db_stat: %d mode: %d lock_test: %d", + name, table_share->db_type, table_arg->db_stat, mode, + test_if_locked)); + + table= table_arg; + DBUG_ASSERT(table->s == table_share); if ((error=open(name,mode,test_if_locked))) { @@ -1268,7 +1286,7 @@ int handler::ha_open(const char *name, int mode, int test_if_locked) } if (error) { - my_errno=error; /* Safeguard */ + my_errno= error; /* Safeguard */ DBUG_PRINT("error",("error: %d errno: %d",error,errno)); } else @@ -1286,74 +1304,51 @@ int handler::ha_open(const char *name, int mode, int test_if_locked) } else dupp_ref=ref+ALIGN_SIZE(ref_length); + + if (ha_allocate_read_write_set(table->s->fields)) + error= 1; } DBUG_RETURN(error); } + int handler::ha_initialise() { DBUG_ENTER("ha_initialise"); - if (table && table->s->fields && - ha_allocate_read_write_set(table->s->fields)) - { - DBUG_RETURN(TRUE); - } DBUG_RETURN(FALSE); } + +/* + Initalize bit maps for used fields + + Called from open_table_from_share() +*/ + int handler::ha_allocate_read_write_set(ulong no_fields) { - uint bitmap_size= 4*(((no_fields+1)+31)/32); + uint bitmap_size= bitmap_buffer_size(no_fields+1); uint32 *read_buf, *write_buf; -#ifndef DEBUG_OFF - my_bool r; -#endif DBUG_ENTER("ha_allocate_read_write_set"); DBUG_PRINT("enter", ("no_fields = %d", no_fields)); - if (table) + if (!multi_alloc_root(&table->mem_root, + &read_set, sizeof(MY_BITMAP), + &write_set, sizeof(MY_BITMAP), + &read_buf, bitmap_size, + &write_buf, bitmap_size, + NullS)) { - if (table->read_set == NULL) - { - read_set= (MY_BITMAP*)sql_alloc(sizeof(MY_BITMAP)); - write_set= (MY_BITMAP*)sql_alloc(sizeof(MY_BITMAP)); - read_buf= (uint32*)sql_alloc(bitmap_size); - write_buf= (uint32*)sql_alloc(bitmap_size); - if (!read_set || !write_set || !read_buf || !write_buf) - { - ha_deallocate_read_write_set(); - DBUG_RETURN(TRUE); - } -#ifndef DEBUG_OFF - r = -#endif - bitmap_init(read_set, read_buf, no_fields+1, FALSE); - DBUG_ASSERT(!r /*bitmap_init(read_set...)*/); -#ifndef DEBUG_OFF - r = -#endif - bitmap_init(write_set, write_buf, no_fields+1, FALSE); - DBUG_ASSERT(!r /*bitmap_init(write_set...)*/); - table->read_set= read_set; - table->write_set= write_set; - ha_clear_all_set(); - } - else - { - read_set= table->read_set; - write_set= table->write_set; - } + DBUG_RETURN(TRUE); } + bitmap_init(read_set, read_buf, no_fields+1, FALSE); + bitmap_init(write_set, write_buf, no_fields+1, FALSE); + table->read_set= read_set; + table->write_set= write_set; + ha_clear_all_set(); DBUG_RETURN(FALSE); } -void handler::ha_deallocate_read_write_set() -{ - DBUG_ENTER("ha_deallocate_read_write_set"); - read_set=write_set=0; - DBUG_VOID_RETURN; -} - void handler::ha_clear_all_set() { DBUG_ENTER("ha_clear_all_set"); @@ -1395,6 +1390,7 @@ void handler::ha_set_primary_key_in_read_set() } + /* Read first row (only) from a table This is never called for InnoDB or BDB tables, as these table types @@ -1406,7 +1402,8 @@ int handler::read_first_row(byte * buf, uint primary_key) register int error; DBUG_ENTER("handler::read_first_row"); - statistic_increment(current_thd->status_var.ha_read_first_count,&LOCK_status); + statistic_increment(table->in_use->status_var.ha_read_first_count, + &LOCK_status); /* If there is very few deleted rows in the table, find the first row by @@ -1672,15 +1669,16 @@ void handler::print_error(int error, myf errflag) uint key_nr=get_dup_key(error); if ((int) key_nr >= 0) { - /* Write the dupplicated key in the error message */ + /* Write the duplicated key in the error message */ char key[MAX_KEY_LENGTH]; String str(key,sizeof(key),system_charset_info); + /* Table is opened and defined at this point */ key_unpack(&str,table,(uint) key_nr); uint max_length=MYSQL_ERRMSG_SIZE-(uint) strlen(ER(ER_DUP_ENTRY)); if (str.length() >= max_length) { str.length(max_length-4); - str.append("..."); + str.append(STRING_WITH_LEN("...")); } my_error(ER_DUP_ENTRY, MYF(0), str.c_ptr(), key_nr+1); DBUG_VOID_RETURN; @@ -1761,20 +1759,9 @@ void handler::print_error(int error, myf errflag) textno=ER_TABLE_DEF_CHANGED; break; case HA_ERR_NO_SUCH_TABLE: - { - /* - We have to use path to find database name instead of using - table->table_cache_key because if the table didn't exist, then - table_cache_key was not set up - */ - char *db; - char buff[FN_REFLEN]; - uint length= dirname_part(buff,table->s->path); - buff[length-1]=0; - db=buff+dirname_length(buff); - my_error(ER_NO_SUCH_TABLE, MYF(0), db, table->alias); + my_error(ER_NO_SUCH_TABLE, MYF(0), table_share->db.str, + table_share->table_name.str); break; - } default: { /* The error was "unknown" to this function. @@ -1795,7 +1782,7 @@ void handler::print_error(int error, myf errflag) DBUG_VOID_RETURN; } } - my_error(textno, errflag, table->alias, error); + my_error(textno, errflag, table_share->table_name.str, error); DBUG_VOID_RETURN; } @@ -1940,23 +1927,37 @@ int handler::index_next_same(byte *buf, const byte *key, uint keylen) /* Initiates table-file and calls apropriate database-creator - Returns 1 if something got wrong + + NOTES + We must have a write lock on LOCK_open to be sure no other thread + interfers with table + + RETURN + 0 ok + 1 error */ -int ha_create_table(const char *name, HA_CREATE_INFO *create_info, +int ha_create_table(THD *thd, const char *path, + const char *db, const char *table_name, + HA_CREATE_INFO *create_info, bool update_create_info) { - int error; + int error= 1; TABLE table; char name_buff[FN_REFLEN]; + const char *name; + TABLE_SHARE share; DBUG_ENTER("ha_create_table"); + + init_tmp_table_share(&share, db, 0, table_name, path); + if (open_table_def(thd, &share, 0) || + open_table_from_share(thd, &share, "", 0, (uint) READ_ALL, 0, &table)) + goto err; - if (openfrm(current_thd, name,"",0,(uint) READ_ALL, 0, &table)) - DBUG_RETURN(1); if (update_create_info) - { update_create_info_from_table(create_info, &table); - } + + name= share.path.str; if (lower_case_table_names == 2 && !(table.file->table_flags() & HA_FILE_BASED)) { @@ -1966,27 +1967,32 @@ int ha_create_table(const char *name, HA_CREATE_INFO *create_info, name= name_buff; } - error=table.file->create(name,&table,create_info); - VOID(closefrm(&table)); + error= table.file->create(name, &table, create_info); + VOID(closefrm(&table, 0)); if (error) - my_error(ER_CANT_CREATE_TABLE, MYF(ME_BELL+ME_WAITTANG), name,error); + { + strxmov(name_buff, db, ".", table_name, NullS); + my_error(ER_CANT_CREATE_TABLE, MYF(ME_BELL+ME_WAITTANG), name_buff, error); + } +err: + free_table_share(&share); DBUG_RETURN(error != 0); } /* - Try to discover table from engine and - if found, write the frm file to disk. + Try to discover table from engine + + NOTES + If found, write the frm file to disk. RETURN VALUES: - -1 : Table did not exists - 0 : Table created ok - > 0 : Error, table existed but could not be created + -1 Table did not exists + 0 Table created ok + > 0 Error, table existed but could not be created */ -int ha_create_table_from_engine(THD* thd, - const char *db, - const char *name) +int ha_create_table_from_engine(THD* thd, const char *db, const char *name) { int error; const void *frmblob; @@ -1994,6 +2000,7 @@ int ha_create_table_from_engine(THD* thd, char path[FN_REFLEN]; HA_CREATE_INFO create_info; TABLE table; + TABLE_SHARE share; DBUG_ENTER("ha_create_table_from_engine"); DBUG_PRINT("enter", ("name '%s'.'%s'", db, name)); @@ -2009,15 +2016,23 @@ int ha_create_table_from_engine(THD* thd, frmblob and frmlen are set, write the frm to disk */ - (void)strxnmov(path,FN_REFLEN,mysql_data_home,"/",db,"/",name,NullS); + (void)strxnmov(path,FN_REFLEN-1,mysql_data_home,"/",db,"/",name,NullS); // Save the frm file error= writefrm(path, frmblob, frmlen); my_free((char*) frmblob, MYF(0)); if (error) DBUG_RETURN(2); - if (openfrm(thd, path,"",0,(uint) READ_ALL, 0, &table)) + init_tmp_table_share(&share, db, 0, name, path); + if (open_table_def(thd, &share, 0)) + { DBUG_RETURN(3); + } + if (open_table_from_share(thd, &share, "" ,0, 0, 0, &table)) + { + free_table_share(&share); + DBUG_RETURN(3); + } update_create_info_from_table(&create_info, &table); create_info.table_options|= HA_OPTION_CREATE_FROM_ENGINE; @@ -2029,7 +2044,7 @@ int ha_create_table_from_engine(THD* thd, my_casedn_str(files_charset_info, path); } error=table.file->create(path,&table,&create_info); - VOID(closefrm(&table)); + VOID(closefrm(&table, 1)); DBUG_RETURN(error != 0); } @@ -2488,7 +2503,7 @@ TYPELIB *ha_known_exts(void) { if ((*types)->state == SHOW_OPTION_YES) { - handler *file= get_new_handler(0, mem_root, + handler *file= get_new_handler((TABLE_SHARE*) 0, mem_root, (enum db_type) (*types)->db_type); for (ext= file->bas_ext(); *ext; ext++) { diff --git a/sql/handler.h b/sql/handler.h index 3b903b1ce2a..b4b90cbfaa8 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -42,6 +42,7 @@ #define HA_ADMIN_REJECT -6 #define HA_ADMIN_TRY_ALTER -7 #define HA_ADMIN_WRONG_CHECKSUM -8 +#define HA_ADMIN_NOT_BASE_TABLE -9 /* Bits in table_flags() to show what database can do */ @@ -85,6 +86,7 @@ #define HA_CAN_BIT_FIELD (1 << 28) /* supports bit fields */ #define HA_NEED_READ_RANGE_BUFFER (1 << 29) /* for read_multi_range */ #define HA_ANY_INDEX_MAY_BE_UNIQUE (1 << 30) +#define HA_NO_COPY_ON_ALTER (1 << 31) /* Flags for partition handlers */ #define HA_CAN_PARTITION (1 << 0) /* Partition support */ @@ -310,6 +312,7 @@ typedef struct xid_t XID; struct st_table; typedef struct st_table TABLE; +typedef struct st_table_share TABLE_SHARE; struct st_foreign_key_info; typedef struct st_foreign_key_info FOREIGN_KEY_INFO; typedef bool (stat_print_fn)(THD *thd, const char *type, const char *file, @@ -410,7 +413,7 @@ typedef struct void *(*create_cursor_read_view)(); void (*set_cursor_read_view)(void *); void (*close_cursor_read_view)(void *); - handler *(*create)(TABLE *table); + handler *(*create)(TABLE_SHARE *table); void (*drop_database)(char* path); int (*panic)(enum ha_panic_function flag); int (*release_temporary_latches)(THD *thd); @@ -431,10 +434,11 @@ struct show_table_alias_st { /* Possible flags of a handlerton */ #define HTON_NO_FLAGS 0 #define HTON_CLOSE_CURSORS_AT_COMMIT (1 << 0) -#define HTON_ALTER_NOT_SUPPORTED (1 << 1) -#define HTON_CAN_RECREATE (1 << 2) -#define HTON_FLUSH_AFTER_RENAME (1 << 3) -#define HTON_NOT_USER_SELECTABLE (1 << 4) +#define HTON_ALTER_NOT_SUPPORTED (1 << 1) //Engine does not support alter +#define HTON_CAN_RECREATE (1 << 2) //Delete all is used fro truncate +#define HTON_HIDDEN (1 << 3) //Engine does not appear in lists +#define HTON_FLUSH_AFTER_RENAME (1 << 4) +#define HTON_NOT_USER_SELECTABLE (1 << 5) typedef struct st_thd_trans { @@ -737,8 +741,9 @@ void get_full_part_id_from_key(const TABLE *table, byte *buf, KEY *key_info, const key_range *key_spec, part_id_range *part_spec); -bool mysql_unpack_partition(THD *thd, uchar *part_buf, uint part_info_len, - TABLE* table, enum db_type default_db_type); +bool mysql_unpack_partition(THD *thd, const uchar *part_buf, + uint part_info_len, TABLE *table, + enum db_type default_db_type); #endif @@ -763,7 +768,8 @@ class handler :public Sql_alloc friend class ha_partition; #endif protected: - struct st_table *table; /* The table definition */ + struct st_table_share *table_share; /* The table definition */ + struct st_table *table; /* The current open table */ virtual int index_init(uint idx, bool sorted) { active_index=idx; return 0; } virtual int index_end() { active_index=MAX_KEY; return 0; } @@ -824,8 +830,8 @@ public: MY_BITMAP *read_set; MY_BITMAP *write_set; - handler(const handlerton *ht_arg, TABLE *table_arg) :table(table_arg), - ht(ht_arg), + handler(const handlerton *ht_arg, TABLE_SHARE *share_arg) + :table_share(share_arg), ht(ht_arg), ref(0), data_file_length(0), max_data_file_length(0), index_file_length(0), delete_length(0), auto_increment_value(0), records(0), deleted(0), mean_rec_length(0), @@ -837,16 +843,19 @@ public: {} virtual ~handler(void) { - ha_deallocate_read_write_set(); /* TODO: DBUG_ASSERT(inited == NONE); */ } virtual int ha_initialise(); - int ha_open(const char *name, int mode, int test_if_locked); + int ha_open(TABLE *table, const char *name, int mode, int test_if_locked); bool update_auto_increment(); virtual void print_error(int error, myf errflag); virtual bool get_error_message(int error, String *buf); uint get_dup_key(int error); - void change_table_ptr(TABLE *table_arg) { table=table_arg; } + void change_table_ptr(TABLE *table_arg, TABLE_SHARE *share) + { + table= table_arg; + table_share= share; + } virtual double scan_time() { return ulonglong2double(data_file_length) / IO_SIZE + 2; } virtual double read_time(uint index, uint ranges, ha_rows rows) @@ -1032,7 +1041,6 @@ public: } void ha_set_primary_key_in_read_set(); int ha_allocate_read_write_set(ulong no_fields); - void ha_deallocate_read_write_set(); void ha_clear_all_set(); uint get_index(void) const { return active_index; } virtual int open(const char *name, int mode, uint test_if_locked)=0; @@ -1166,7 +1174,7 @@ public: key_range *max_key) { return (ha_rows) 10; } virtual void position(const byte *record)=0; - virtual void info(uint)=0; + virtual void info(uint)=0; // see my_base.h for full description virtual int extra(enum ha_extra_function operation) { return 0; } virtual int extra_opt(enum ha_extra_function operation, ulong cache_size) @@ -1265,6 +1273,7 @@ public: #ifdef WITH_PARTITION_STORAGE_ENGINE virtual ulong partition_flags(void) const { return 0;} virtual int get_default_no_partitions(ulonglong max_rows) { return 1;} + virtual void set_part_info(partition_info *part_info) { return; } #endif virtual ulong index_flags(uint idx, uint part, bool all_parts) const =0; virtual ulong index_ddl_flags(KEY *wanted_index) const @@ -1406,7 +1415,8 @@ extern ulong total_ha, total_ha_2pc; /* lookups */ enum db_type ha_resolve_by_name(const char *name, uint namelen); const char *ha_get_storage_engine(enum db_type db_type); -handler *get_new_handler(TABLE *table, MEM_ROOT *alloc, enum db_type db_type); +handler *get_new_handler(TABLE_SHARE *share, MEM_ROOT *alloc, + enum db_type db_type); enum db_type ha_checktype(THD *thd, enum db_type database_type, bool no_substitute, bool report_error); bool ha_check_storage_engine_flag(enum db_type db_type, uint32 flag); @@ -1420,10 +1430,12 @@ void ha_close_connection(THD* thd); my_bool ha_storage_engine_is_enabled(enum db_type database_type); bool ha_flush_logs(enum db_type db_type=DB_TYPE_DEFAULT); void ha_drop_database(char* path); -int ha_create_table(const char *name, HA_CREATE_INFO *create_info, +int ha_create_table(THD *thd, const char *path, + const char *db, const char *table_name, + HA_CREATE_INFO *create_info, bool update_create_info); int ha_delete_table(THD *thd, enum db_type db_type, const char *path, - const char *alias, bool generate_warning); + const char *db, const char *alias, bool generate_warning); /* statistics and info */ bool ha_show_status(THD *thd, enum db_type db_type, enum ha_stat_type stat); diff --git a/sql/handlerton-win.cc b/sql/handlerton-win.cc new file mode 100644 index 00000000000..9ce4eab2444 --- /dev/null +++ b/sql/handlerton-win.cc @@ -0,0 +1,72 @@ +#include "mysql_priv.h" + +extern handlerton heap_hton; +extern handlerton myisam_hton; +extern handlerton myisammrg_hton; +extern handlerton binlog_hton; +#ifdef WITH_INNOBASE_STORAGE_ENGINE +extern handlerton innobase_hton; +#endif +#ifdef WITH_BERKELEY_STORAGE_ENGINE +extern handlerton berkeley_hton; +#endif +#ifdef WITH_EXAMPLE_STORAGE_ENGINE +extern handlerton example_hton; +#endif +#ifdef WITH_ARCHIVE_STORAGE_ENGINE +extern handlerton archive_hton; +#endif +#ifdef WITH_CSV_STORAGE_ENGINE +extern handlerton tina_hton; +#endif +#ifdef WITH_BLACKHOLE_STORAGE_ENGINE +extern handlerton blackhole_hton; +#endif +#ifdef WITH_FEDERATED_STORAGE_ENGINE +extern handlerton federated_hton; +#endif +#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE +extern handlerton ndbcluster_hton; +#endif +#ifdef WITH_PARTITION_STORAGE_ENGINE +extern handlerton partition_hton; +#endif + +/* + This array is used for processing compiled in engines. +*/ +handlerton *sys_table_types[]= +{ + &heap_hton, + &myisam_hton, +#ifdef WITH_INNOBASE_STORAGE_ENGINE + &innobase_hton, +#endif +#ifdef WITH_BERKELEY_STORAGE_ENGINE + &berkeley_hton, +#endif +#ifdef WITH_EXAMPLE_STORAGE_ENGINE + &example_hton, +#endif +#ifdef WITH_ARCHIVE_STORAGE_ENGINE + &archive_hton, +#endif +#ifdef WITH_CSV_STORAGE_ENGINE + &tina_hton, +#endif +#ifdef WITH_BLACKHOLE_STORAGE_ENGINE + &blackhole_hton, +#endif +#ifdef WITH_FEDERATED_STORAGE_ENGINE + &federated_hton, +#endif +#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE + &ndbcluster_hton, +#endif +#ifdef WITH_PARTITION_STORAGE_ENGINE + &partition_hton, +#endif + &myisammrg_hton, + &binlog_hton, + NULL +}; diff --git a/sql/item.cc b/sql/item.cc index 9a64b02f80b..39ba3ed6895 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -383,7 +383,7 @@ void Item::print_item_w_name(String *str) if (name) { THD *thd= current_thd; - str->append(" AS ", 4); + str->append(STRING_WITH_LEN(" AS ")); append_identifier(thd, str, name, (uint) strlen(name)); } } @@ -601,16 +601,8 @@ bool Item::eq(const Item *item, bool binary_cmp) const Item *Item::safe_charset_converter(CHARSET_INFO *tocs) { - /* - Allow conversion from and to "binary". - Don't allow automatic conversion to non-Unicode charsets, - as it potentially loses data. - */ - if (collation.collation != &my_charset_bin && - tocs != &my_charset_bin && - !(tocs->state & MY_CS_UNICODE)) - return NULL; // safe conversion is not possible - return new Item_func_conv_charset(this, tocs); + Item_func_conv_charset *conv= new Item_func_conv_charset(this, tocs, 1); + return conv->safe ? conv : NULL; } @@ -700,23 +692,15 @@ Item *Item_param::safe_charset_converter(CHARSET_INFO *tocs) { if (const_item()) { - Item_string *conv; uint cnv_errors; - char buf[MAX_FIELD_WIDTH]; - String tmp(buf, sizeof(buf), &my_charset_bin); - String cstr, *ostr= val_str(&tmp); - /* - As safe_charset_converter is not executed for - a parameter bound to NULL, ostr should never be 0. - */ - cstr.copy(ostr->ptr(), ostr->length(), ostr->charset(), tocs, &cnv_errors); - if (cnv_errors || !(conv= new Item_string(cstr.ptr(), cstr.length(), - cstr.charset(), - collation.derivation))) - return NULL; - conv->str_value.copy(); - conv->str_value.mark_as_const(); - return conv; + String *ostr= val_str(&cnvstr); + cnvitem->str_value.copy(ostr->ptr(), ostr->length(), + ostr->charset(), tocs, &cnv_errors); + if (cnv_errors) + return NULL; + cnvitem->str_value.mark_as_const(); + cnvitem->max_length= cnvitem->str_value.numchars() * tocs->mbmaxlen; + return cnvitem; } return NULL; } @@ -894,6 +878,7 @@ bool Item_splocal::is_null() Item * Item_splocal::this_item() { + DBUG_ASSERT(owner == thd->spcont->owner); return thd->spcont->get_item(m_offset); } @@ -901,12 +886,14 @@ Item_splocal::this_item() Item ** Item_splocal::this_item_addr(THD *thd, Item **addr) { + DBUG_ASSERT(owner == thd->spcont->owner); return thd->spcont->get_item_addr(m_offset); } Item * Item_splocal::this_const_item() const { + DBUG_ASSERT(owner == thd->spcont->owner); return thd->spcont->get_item(m_offset); } @@ -914,7 +901,10 @@ Item::Type Item_splocal::type() const { if (thd && thd->spcont) + { + DBUG_ASSERT(owner == thd->spcont->owner); return thd->spcont->get_item(m_offset)->type(); + } return NULL_ITEM; // Anything but SUBSELECT_ITEM } @@ -1031,7 +1021,7 @@ void Item_name_const::cleanup() void Item_name_const::print(String *str) { - str->append("NAME_CONST("); + str->append(STRING_WITH_LEN("NAME_CONST(")); name_item->print(str); str->append(','); value_item->print(str); @@ -1400,20 +1390,21 @@ bool agg_item_charsets(DTCollation &coll, const char *fname, Item_field::Item_field(Field *f) :Item_ident(0, NullS, *f->table_name, f->field_name), - item_equal(0), no_const_subst(0), + item_equal(0), no_const_subst(0), have_privileges(0), any_privileges(0) { set_field(f); /* - field_name and talbe_name should not point to garbage + field_name and table_name should not point to garbage if this item is to be reused */ orig_table_name= orig_field_name= ""; } + Item_field::Item_field(THD *thd, Name_resolution_context *context_arg, Field *f) - :Item_ident(context_arg, f->table->s->db, *f->table_name, f->field_name), + :Item_ident(context_arg, f->table->s->db.str, *f->table_name, f->field_name), item_equal(0), no_const_subst(0), have_privileges(0), any_privileges(0) { @@ -1480,7 +1471,7 @@ void Item_field::set_field(Field *field_par) max_length= field_par->max_length(); table_name= *field_par->table_name; field_name= field_par->field_name; - db_name= field_par->table->s->db; + db_name= field_par->table->s->db.str; alias_name_used= field_par->table->alias_name_used; unsigned_flag=test(field_par->flags & UNSIGNED_FLAG); collation.set(field_par->charset(), DERIVATION_IMPLICIT); @@ -2098,6 +2089,8 @@ Item_param::Item_param(unsigned pos_in_query_arg) : value is set. */ maybe_null= 1; + cnvitem= new Item_string("", 0, &my_charset_bin, DERIVATION_COERCIBLE); + cnvstr.set(cnvbuf, sizeof(cnvbuf), &my_charset_bin); } @@ -2467,7 +2460,7 @@ longlong Item_param::val_int() { switch (state) { case REAL_VALUE: - return (longlong) (value.real + (value.real > 0 ? 0.5 : -0.5)); + return (longlong) rint(value.real); case INT_VALUE: return value.integer; case DECIMAL_VALUE: @@ -3723,15 +3716,20 @@ enum_field_types Item::field_type() const Field *Item::make_string_field(TABLE *table) { + Field *field; DBUG_ASSERT(collation.collation); if (max_length/collation.collation->mbmaxlen > CONVERT_IF_BIGGER_TO_BLOB) - return new Field_blob(max_length, maybe_null, name, table, + field= new Field_blob(max_length, maybe_null, name, collation.collation); - if (max_length > 0) - return new Field_varstring(max_length, maybe_null, name, table, + else if (max_length > 0) + field= new Field_varstring(max_length, maybe_null, name, table->s, collation.collation); - return new Field_string(max_length, maybe_null, name, table, - collation.collation); + else + field= new Field_string(max_length, maybe_null, name, + collation.collation); + if (field) + field->init(table); + return field; } @@ -3739,73 +3737,95 @@ Field *Item::make_string_field(TABLE *table) Create a field based on field_type of argument For now, this is only used to create a field for - IFNULL(x,something) + IFNULL(x,something) and time functions RETURN 0 error # Created field */ -Field *Item::tmp_table_field_from_field_type(TABLE *table) +Field *Item::tmp_table_field_from_field_type(TABLE *table, bool fixed_length) { /* The field functions defines a field to be not null if null_ptr is not 0 */ uchar *null_ptr= maybe_null ? (uchar*) "" : 0; + Field *field; switch (field_type()) { case MYSQL_TYPE_DECIMAL: case MYSQL_TYPE_NEWDECIMAL: - return new Field_new_decimal((char*) 0, max_length, null_ptr, 0, - Field::NONE, name, table, decimals, 0, + field= new Field_new_decimal((char*) 0, max_length, null_ptr, 0, + Field::NONE, name, decimals, 0, unsigned_flag); + break; case MYSQL_TYPE_TINY: - return new Field_tiny((char*) 0, max_length, null_ptr, 0, Field::NONE, - name, table, 0, unsigned_flag); + field= new Field_tiny((char*) 0, max_length, null_ptr, 0, Field::NONE, + name, 0, unsigned_flag); + break; case MYSQL_TYPE_SHORT: - return new Field_short((char*) 0, max_length, null_ptr, 0, Field::NONE, - name, table, 0, unsigned_flag); + field= new Field_short((char*) 0, max_length, null_ptr, 0, Field::NONE, + name, 0, unsigned_flag); + break; case MYSQL_TYPE_LONG: - return new Field_long((char*) 0, max_length, null_ptr, 0, Field::NONE, - name, table, 0, unsigned_flag); + field= new Field_long((char*) 0, max_length, null_ptr, 0, Field::NONE, + name, 0, unsigned_flag); + break; #ifdef HAVE_LONG_LONG case MYSQL_TYPE_LONGLONG: - return new Field_longlong((char*) 0, max_length, null_ptr, 0, Field::NONE, - name, table, 0, unsigned_flag); + field= new Field_longlong((char*) 0, max_length, null_ptr, 0, Field::NONE, + name, 0, unsigned_flag); + break; #endif case MYSQL_TYPE_FLOAT: - return new Field_float((char*) 0, max_length, null_ptr, 0, Field::NONE, - name, table, decimals, 0, unsigned_flag); + field= new Field_float((char*) 0, max_length, null_ptr, 0, Field::NONE, + name, decimals, 0, unsigned_flag); + break; case MYSQL_TYPE_DOUBLE: - return new Field_double((char*) 0, max_length, null_ptr, 0, Field::NONE, - name, table, decimals, 0, unsigned_flag); + field= new Field_double((char*) 0, max_length, null_ptr, 0, Field::NONE, + name, decimals, 0, unsigned_flag); + break; case MYSQL_TYPE_NULL: - return new Field_null((char*) 0, max_length, Field::NONE, - name, table, &my_charset_bin); + field= new Field_null((char*) 0, max_length, Field::NONE, + name, &my_charset_bin); + break; case MYSQL_TYPE_INT24: - return new Field_medium((char*) 0, max_length, null_ptr, 0, Field::NONE, - name, table, 0, unsigned_flag); + field= new Field_medium((char*) 0, max_length, null_ptr, 0, Field::NONE, + name, 0, unsigned_flag); + break; case MYSQL_TYPE_NEWDATE: case MYSQL_TYPE_DATE: - return new Field_date(maybe_null, name, table, &my_charset_bin); + field= new Field_date(maybe_null, name, &my_charset_bin); + break; case MYSQL_TYPE_TIME: - return new Field_time(maybe_null, name, table, &my_charset_bin); + field= new Field_time(maybe_null, name, &my_charset_bin); + break; case MYSQL_TYPE_TIMESTAMP: case MYSQL_TYPE_DATETIME: - return new Field_datetime(maybe_null, name, table, &my_charset_bin); + field= new Field_datetime(maybe_null, name, &my_charset_bin); + break; case MYSQL_TYPE_YEAR: - return new Field_year((char*) 0, max_length, null_ptr, 0, Field::NONE, - name, table); + field= new Field_year((char*) 0, max_length, null_ptr, 0, Field::NONE, + name); + break; case MYSQL_TYPE_BIT: - return new Field_bit_as_char(NULL, max_length, null_ptr, 0, NULL, 0, - Field::NONE, name, table); + field= new Field_bit_as_char(NULL, max_length, null_ptr, 0, NULL, 0, + Field::NONE, name); + break; default: /* This case should never be chosen */ DBUG_ASSERT(0); /* If something goes awfully wrong, it's better to get a string than die */ + case MYSQL_TYPE_STRING: + if (fixed_length && max_length < CONVERT_IF_BIGGER_TO_BLOB) + { + field= new Field_string(max_length, maybe_null, name, + collation.collation); + break; + } + /* Fall through to make_string_field() */ case MYSQL_TYPE_ENUM: case MYSQL_TYPE_SET: - case MYSQL_TYPE_STRING: case MYSQL_TYPE_VAR_STRING: case MYSQL_TYPE_VARCHAR: return make_string_field(table); @@ -3814,10 +3834,12 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table) case MYSQL_TYPE_LONG_BLOB: case MYSQL_TYPE_BLOB: case MYSQL_TYPE_GEOMETRY: - return new Field_blob(max_length, maybe_null, name, table, - collation.collation); + field= new Field_blob(max_length, maybe_null, name, collation.collation); break; // Blob handled outside of case } + if (field) + field->init(table); + return field; } @@ -4857,7 +4879,7 @@ void Item_ref::make_field(Send_field *field) void Item_ref_null_helper::print(String *str) { - str->append("(", 18); + str->append(STRING_WITH_LEN("(")); if (ref) (*ref)->print(str); else @@ -4943,8 +4965,7 @@ bool Item_direct_view_ref::fix_fields(THD *thd, Item **reference) } /* - Compare view field's name with item's name before call to referenced - item's eq() + Compare two view column references for equality. SYNOPSIS Item_direct_view_ref::eq() @@ -4952,12 +4973,13 @@ bool Item_direct_view_ref::fix_fields(THD *thd, Item **reference) binary_cmp make binary comparison DESCRIPTION - Consider queries: - create view v1 as select t1.f1 as f2, t1.f2 as f1 from t1; - select * from v1 order by f1; - In order to choose right field for sorting we need to compare - given item's name (f1) to view field's name prior to calling - referenced item's eq(). + A view column reference is considered equal to another column + reference if the second one is a view column and if both column + references point to the same field. For views 'same field' means + the same Item_field object in the view translation table, where + the view translation table contains all result columns of the + view. This definition ensures that view columns are resolved + in the same manner as table columns. RETURN TRUE Referenced item is equal to given item @@ -4967,14 +4989,23 @@ bool Item_direct_view_ref::fix_fields(THD *thd, Item **reference) bool Item_direct_view_ref::eq(const Item *item, bool binary_cmp) const { - Item *it= ((Item *) item)->real_item(); - return (!it->name || !my_strcasecmp(system_charset_info, it->name, - field_name)) && ref && (*ref)->real_item()->eq(it, binary_cmp); + if (item->type() == REF_ITEM) + { + Item_ref *item_ref= (Item_ref*) item; + if (item_ref->ref_type() == VIEW_REF) + { + Item *item_ref_ref= *(item_ref->ref); + DBUG_ASSERT((*ref)->type() == FIELD_ITEM && + (item_ref_ref->type() == FIELD_ITEM)); + return (*ref == item_ref_ref); + } + } + return FALSE; } void Item_null_helper::print(String *str) { - str->append("(", 14); + str->append(STRING_WITH_LEN("(")); store->print(str); str->append(')'); } @@ -5019,8 +5050,9 @@ bool Item_default_value::fix_fields(THD *thd, Item **items) if (!(def_field= (Field*) sql_alloc(field_arg->field->size_of()))) goto error; memcpy(def_field, field_arg->field, field_arg->field->size_of()); - def_field->move_field(def_field->table->s->default_values - - def_field->table->record[0]); + def_field->move_field_offset((my_ptrdiff_t) + (def_field->table->s->default_values - + def_field->table->record[0])); set_field(def_field); return FALSE; @@ -5034,10 +5066,10 @@ void Item_default_value::print(String *str) { if (!arg) { - str->append("default", 7); + str->append(STRING_WITH_LEN("default")); return; } - str->append("default(", 8); + str->append(STRING_WITH_LEN("default(")); arg->print(str); str->append(')'); } @@ -5115,23 +5147,29 @@ bool Item_insert_value::fix_fields(THD *thd, Item **items) if (!def_field) return TRUE; memcpy(def_field, field_arg->field, field_arg->field->size_of()); - def_field->move_field(def_field->table->insert_values - - def_field->table->record[0]); + def_field->move_field_offset((my_ptrdiff_t) + (def_field->table->insert_values - + def_field->table->record[0])); set_field(def_field); } else { Field *tmp_field= field_arg->field; /* charset doesn't matter here, it's to avoid sigsegv only */ - set_field(new Field_null(0, 0, Field::NONE, tmp_field->field_name, - tmp_field->table, &my_charset_bin)); + tmp_field= new Field_null(0, 0, Field::NONE, field_arg->field->field_name, + &my_charset_bin); + if (tmp_field) + { + tmp_field->init(field_arg->field->table); + set_field(tmp_field); + } } return FALSE; } void Item_insert_value::print(String *str) { - str->append("values(", 7); + str->append(STRING_WITH_LEN("values(")); arg->print(str); str->append(')'); } @@ -5250,7 +5288,7 @@ Item_result item_cmp_type(Item_result a,Item_result b) void resolve_const_item(THD *thd, Item **ref, Item *comp_item) { Item *item= *ref; - Item *new_item; + Item *new_item= NULL; if (item->basic_const_item()) return; // Can't be better Item_result res_type=item_cmp_type(comp_item->result_type(), @@ -5283,7 +5321,16 @@ void resolve_const_item(THD *thd, Item **ref, Item *comp_item) break; } case ROW_RESULT: + if (item->type() == Item::ROW_ITEM && comp_item->type() == Item::ROW_ITEM) { + /* + Substitute constants only in Item_rows. Don't affect other Items + with ROW_RESULT (eg Item_singlerow_subselect). + + For such Items more optimal is to detect if it is constant and replace + it with Item_row. This would optimize queries like this: + SELECT * FROM t1 WHERE (a,b) = (SELECT a,b FROM t2 LIMIT 1); + */ Item_row *item_row= (Item_row*) item; Item_row *comp_item_row= (Item_row*) comp_item; uint col; @@ -5301,6 +5348,7 @@ void resolve_const_item(THD *thd, Item **ref, Item *comp_item) resolve_const_item(thd, item_row->addr(col), comp_item_row->el(col)); break; } + /* Fallthrough */ case REAL_RESULT: { // It must REAL_RESULT double result= item->val_real(); @@ -5392,7 +5440,7 @@ Item_cache* Item_cache::get_cache(Item_result type) void Item_cache::print(String *str) { - str->append("(", 8); + str->append(STRING_WITH_LEN("(")); if (example) example->print(str); else @@ -5435,7 +5483,7 @@ void Item_cache_real::store(Item *item) longlong Item_cache_real::val_int() { DBUG_ASSERT(fixed == 1); - return (longlong) (value+(value > 0 ? 0.5 : -0.5)); + return (longlong) rint(value); } @@ -5806,8 +5854,11 @@ bool Item_type_holder::join_types(THD *thd, Item *item) { int delta1= max_length_orig - decimals_orig; int delta2= item->max_length - item->decimals; - max_length= min(max(delta1, delta2) + decimals, - (fld_type == MYSQL_TYPE_FLOAT) ? FLT_DIG+6 : DBL_DIG+7); + if (fld_type == MYSQL_TYPE_DECIMAL) + max_length= max(delta1, delta2) + decimals; + else + max_length= min(max(delta1, delta2) + decimals, + (fld_type == MYSQL_TYPE_FLOAT) ? FLT_DIG+6 : DBL_DIG+7); } else max_length= (fld_type == MYSQL_TYPE_FLOAT) ? FLT_DIG+6 : DBL_DIG+7; @@ -5904,24 +5955,31 @@ Field *Item_type_holder::make_field_by_type(TABLE *table) The field functions defines a field to be not null if null_ptr is not 0 */ uchar *null_ptr= maybe_null ? (uchar*) "" : 0; - switch (fld_type) - { + Field *field; + + switch (fld_type) { case MYSQL_TYPE_ENUM: DBUG_ASSERT(enum_set_typelib); - return new Field_enum((char *) 0, max_length, null_ptr, 0, + field= new Field_enum((char *) 0, max_length, null_ptr, 0, Field::NONE, name, - table, get_enum_pack_length(enum_set_typelib->count), + get_enum_pack_length(enum_set_typelib->count), enum_set_typelib, collation.collation); + if (field) + field->init(table); + return field; case MYSQL_TYPE_SET: DBUG_ASSERT(enum_set_typelib); - return new Field_set((char *) 0, max_length, null_ptr, 0, + field= new Field_set((char *) 0, max_length, null_ptr, 0, Field::NONE, name, - table, get_set_pack_length(enum_set_typelib->count), + get_set_pack_length(enum_set_typelib->count), enum_set_typelib, collation.collation); + if (field) + field->init(table); + return field; default: break; } - return tmp_table_field_from_field_type(table); + return tmp_table_field_from_field_type(table, 0); } diff --git a/sql/item.h b/sql/item.h index 8bc659c3060..efc4e1c9ba1 100644 --- a/sql/item.h +++ b/sql/item.h @@ -159,7 +159,7 @@ struct Hybrid_type_traits { val->real/= ulonglong2double(u); } virtual longlong val_int(Hybrid_type *val, bool unsigned_flag) const - { return (longlong) val->real; } + { return (longlong) rint(val->real); } virtual double val_real(Hybrid_type *val) const { return val->real; } virtual my_decimal *val_decimal(Hybrid_type *val, my_decimal *buf) const; virtual String *val_str(Hybrid_type *val, String *buf, uint8 decimals) const; @@ -689,7 +689,7 @@ public: // used in row subselects to get value of elements virtual void bring_value() {} - Field *tmp_table_field_from_field_type(TABLE *table); + Field *tmp_table_field_from_field_type(TABLE *table, bool fixed_length); virtual Item_field *filed_for_view_update() { return 0; } virtual Item *neg_transformer(THD *thd) { return NULL; } @@ -704,6 +704,8 @@ public: }; +class sp_head; + /* A reference to local SP variable (incl. reference to SP parameter), used in runtime. @@ -721,6 +723,13 @@ class Item_splocal : public Item uint m_offset; public: +#ifndef DBUG_OFF + /* + Routine to which this Item_splocal belongs. Used for checking if correct + runtime context is used for variable handling. + */ + sp_head *owner; +#endif LEX_STRING m_name; THD *thd; @@ -1055,7 +1064,7 @@ public: bool basic_const_item() const { return 1; } Item *new_item() { return new Item_null(name); } bool is_null() { return 1; } - void print(String *str) { str->append("NULL", 4); } + void print(String *str) { str->append(STRING_WITH_LEN("NULL")); } Item *safe_charset_converter(CHARSET_INFO *tocs); }; @@ -1075,7 +1084,11 @@ public: class Item_param :public Item { + char cnvbuf[MAX_FIELD_WIDTH]; + String cnvstr; + Item *cnvitem; public: + enum enum_item_param_state { NO_VALUE, NULL_VALUE, INT_VALUE, REAL_VALUE, @@ -1341,7 +1354,7 @@ public: { return LONGLONG_MAX; } - return (longlong) (value+(value > 0 ? 0.5 : -0.5)); + return (longlong) rint(value); } String *val_str(String*); my_decimal *val_decimal(my_decimal *); @@ -1603,7 +1616,11 @@ public: void make_field(Send_field *field); bool fix_fields(THD *, Item **); int save_in_field(Field *field, bool no_conversions); - void save_org_in_field(Field *field) { (*ref)->save_org_in_field(field); } + void save_org_in_field(Field *field) + { + (*ref)->save_org_in_field(field); + null_value= (*ref)->null_value; + } enum Item_result result_type () const { return (*ref)->result_type(); } enum_field_types field_type() const { return (*ref)->field_type(); } Field *get_tmp_table_field() diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 06cb83a7101..8158419162f 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -25,6 +25,8 @@ #include #include "sql_select.h" +static bool convert_constant_item(THD *thd, Field *field, Item **item); + static Item_result item_store_type(Item_result a,Item_result b) { if (a == STRING_RESULT || b == STRING_RESULT) @@ -45,14 +47,37 @@ static void agg_result_type(Item_result *type, Item **items, uint nitems) type[0]= item_store_type(type[0], items[i]->result_type()); } -static void agg_cmp_type(Item_result *type, Item **items, uint nitems) + +static void agg_cmp_type(THD *thd, Item_result *type, Item **items, uint nitems) { uint i; + Field *field= NULL; + bool all_constant= TRUE; + + /* If the first argument is a FIELD_ITEM, pull out the field. */ + if (items[0]->type() == Item::FIELD_ITEM) + field=((Item_field *)items[0])->field; + /* But if it can't be compared as a longlong, we don't really care. */ + if (field && !field->can_be_compared_as_longlong()) + field= NULL; + type[0]= items[0]->result_type(); - for (i=1 ; i < nitems ; i++) + for (i= 1; i < nitems; i++) + { type[0]= item_cmp_type(type[0], items[i]->result_type()); + if (field && !convert_constant_item(thd, field, &items[i])) + all_constant= FALSE; + } + + /* + If we had a field that can be compared as a longlong, and all constant + items, then the aggregate result will be an INT_RESULT. + */ + if (field && all_constant) + type[0]= INT_RESULT; } + static void my_coll_agg_error(DTCollation &c1, DTCollation &c2, const char *fname) { @@ -1051,32 +1076,11 @@ void Item_func_between::fix_length_and_dec() */ if (!args[0] || !args[1] || !args[2]) return; - agg_cmp_type(&cmp_type, args, 3); + agg_cmp_type(thd, &cmp_type, args, 3); + if (cmp_type == STRING_RESULT && agg_arg_charsets(cmp_collation, args, 3, MY_COLL_CMP_CONV)) return; - - /* - Make a special ease of compare with date/time and longlong fields. - They are compared as integers, so for const item this time-consuming - conversion can be done only once, not for every single comparison - */ - if (args[0]->type() == FIELD_ITEM) - { - Field *field=((Item_field*) args[0])->field; - if (!thd->is_context_analysis_only() && - field->can_be_compared_as_longlong()) - { - /* - The following can't be recoded with || as convert_constant_item - changes the argument - */ - if (convert_constant_item(thd, field,&args[1])) - cmp_type=INT_RESULT; // Works for all types. - if (convert_constant_item(thd, field,&args[2])) - cmp_type=INT_RESULT; // Works for all types. - } - } } @@ -1175,10 +1179,10 @@ void Item_func_between::print(String *str) str->append('('); args[0]->print(str); if (negated) - str->append(" not", 4); - str->append(" between ", 9); + str->append(STRING_WITH_LEN(" not")); + str->append(STRING_WITH_LEN(" between ")); args[1]->print(str); - str->append(" and ", 5); + str->append(STRING_WITH_LEN(" and ")); args[2]->print(str); str->append(')'); } @@ -1228,7 +1232,7 @@ enum_field_types Item_func_ifnull::field_type() const Field *Item_func_ifnull::tmp_table_field(TABLE *table) { - return tmp_table_field_from_field_type(table); + return tmp_table_field_from_field_type(table, 0); } double @@ -1722,6 +1726,7 @@ void Item_func_case::fix_length_and_dec() { Item **agg; uint nagg; + THD *thd= current_thd; if (!(agg= (Item**) sql_alloc(sizeof(Item*)*(ncases+1)))) return; @@ -1753,7 +1758,7 @@ void Item_func_case::fix_length_and_dec() for (nagg= 0; nagg < ncases/2 ; nagg++) agg[nagg+1]= args[nagg*2]; nagg++; - agg_cmp_type(&cmp_type, agg, nagg); + agg_cmp_type(thd, &cmp_type, agg, nagg); if ((cmp_type == STRING_RESULT) && agg_arg_charsets(cmp_collation, agg, nagg, MY_COLL_CMP_CONV)) return; @@ -1793,7 +1798,7 @@ uint Item_func_case::decimal_precision() const void Item_func_case::print(String *str) { - str->append("(case ", 6); + str->append(STRING_WITH_LEN("(case ")); if (first_expr_num != -1) { args[first_expr_num]->print(str); @@ -1801,19 +1806,19 @@ void Item_func_case::print(String *str) } for (uint i=0 ; i < ncases ; i+=2) { - str->append("when ", 5); + str->append(STRING_WITH_LEN("when ")); args[i]->print(str); - str->append(" then ", 6); + str->append(STRING_WITH_LEN(" then ")); args[i+1]->print(str); str->append(' '); } if (else_expr_num != -1) { - str->append("else ", 5); + str->append(STRING_WITH_LEN("else ")); args[else_expr_num]->print(str); str->append(' '); } - str->append("end)", 4); + str->append(STRING_WITH_LEN("end)")); } /* @@ -2346,7 +2351,7 @@ void Item_func_in::fix_length_and_dec() uint const_itm= 1; THD *thd= current_thd; - agg_cmp_type(&cmp_type, args, arg_count); + agg_cmp_type(thd, &cmp_type, args, arg_count); if (cmp_type == STRING_RESULT && agg_arg_charsets(cmp_collation, args, arg_count, MY_COLL_CMP_CONV)) @@ -2419,10 +2424,10 @@ void Item_func_in::print(String *str) str->append('('); args[0]->print(str); if (negated) - str->append(" not", 4); - str->append(" in (", 5); + str->append(STRING_WITH_LEN(" not")); + str->append(STRING_WITH_LEN(" in (")); print_args(str, 1); - str->append("))", 2); + str->append(STRING_WITH_LEN("))")); } @@ -2894,7 +2899,7 @@ void Item_func_isnotnull::print(String *str) { str->append('('); args[0]->print(str); - str->append(" is not null)", 13); + str->append(STRING_WITH_LEN(" is not null)")); } @@ -3662,7 +3667,7 @@ void Item_equal::merge(Item_equal *item) the multiple equality already contains a constant and its value is not equal to the value of c. */ - add(const_item); + add(c); } cond_false|= item->cond_false; } diff --git a/sql/item_create.cc b/sql/item_create.cc index 342ef245a76..e8435be2614 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -462,7 +462,6 @@ Item *create_func_cast(Item *a, Cast_target cast_type, int len, int dec, CHARSET_INFO *cs) { Item *res; - LINT_INIT(res); switch (cast_type) { case ITEM_CAST_BINARY: res= new Item_func_binary(a); break; @@ -478,6 +477,10 @@ Item *create_func_cast(Item *a, Cast_target cast_type, int len, int dec, res= new Item_char_typecast(a, len, cs ? cs : current_thd->variables.collation_connection); break; + default: + DBUG_ASSERT(0); + res= 0; + break; } return res; } diff --git a/sql/item_func.cc b/sql/item_func.cc index f467981540b..f8f81b65e76 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -362,41 +362,43 @@ bool Item_func::eq(const Item *item, bool binary_cmp) const } -Field *Item_func::tmp_table_field(TABLE *t_arg) +Field *Item_func::tmp_table_field(TABLE *table) { - Field *res; - LINT_INIT(res); + Field *field; + LINT_INIT(field); switch (result_type()) { case INT_RESULT: if (max_length > 11) - res= new Field_longlong(max_length, maybe_null, name, t_arg, - unsigned_flag); + field= new Field_longlong(max_length, maybe_null, name, unsigned_flag); else - res= new Field_long(max_length, maybe_null, name, t_arg, - unsigned_flag); + field= new Field_long(max_length, maybe_null, name, unsigned_flag); break; case REAL_RESULT: - res= new Field_double(max_length, maybe_null, name, t_arg, decimals); + field= new Field_double(max_length, maybe_null, name, decimals); break; case STRING_RESULT: - res= make_string_field(t_arg); + return make_string_field(table); break; case DECIMAL_RESULT: - res= new Field_new_decimal(my_decimal_precision_to_length(decimal_precision(), - decimals, - unsigned_flag), - maybe_null, name, t_arg, decimals, unsigned_flag); + field= new Field_new_decimal(my_decimal_precision_to_length(decimal_precision(), + decimals, + unsigned_flag), + maybe_null, name, decimals, unsigned_flag); break; case ROW_RESULT: default: // This case should never be chosen DBUG_ASSERT(0); + field= 0; break; } - return res; + if (field) + field->init(table); + return field; } + my_decimal *Item_func::val_decimal(my_decimal *decimal_value) { DBUG_ASSERT(fixed); @@ -735,7 +737,7 @@ longlong Item_func_numhybrid::val_int() case INT_RESULT: return int_op(); case REAL_RESULT: - return (longlong)real_op(); + return (longlong) rint(real_op()); case STRING_RESULT: { int err_not_used; @@ -794,9 +796,9 @@ my_decimal *Item_func_numhybrid::val_decimal(my_decimal *decimal_value) void Item_func_signed::print(String *str) { - str->append("cast(", 5); + str->append(STRING_WITH_LEN("cast(")); args[0]->print(str); - str->append(" as signed)", 11); + str->append(STRING_WITH_LEN(" as signed)")); } @@ -855,9 +857,9 @@ longlong Item_func_signed::val_int() void Item_func_unsigned::print(String *str) { - str->append("cast(", 5); + str->append(STRING_WITH_LEN("cast(")); args[0]->print(str); - str->append(" as unsigned)", 13); + str->append(STRING_WITH_LEN(" as unsigned)")); } @@ -927,9 +929,9 @@ my_decimal *Item_decimal_typecast::val_decimal(my_decimal *dec) void Item_decimal_typecast::print(String *str) { - str->append("cast(", 5); + str->append(STRING_WITH_LEN("cast(")); args[0]->print(str); - str->append(" as decimal)", 12); + str->append(STRING_WITH_LEN(" as decimal)")); } @@ -2234,7 +2236,7 @@ longlong Item_func_locate::val_int() void Item_func_locate::print(String *str) { - str->append("locate(", 7); + str->append(STRING_WITH_LEN("locate(")); args[1]->print(str); str->append(','); args[0]->print(str); @@ -3297,7 +3299,7 @@ longlong Item_func_benchmark::val_int() void Item_func_benchmark::print(String *str) { - str->append("benchmark(", 10); + str->append(STRING_WITH_LEN("benchmark(")); char buffer[20]; // my_charset_bin is good enough for numbers String st(buffer, sizeof(buffer), &my_charset_bin); @@ -3811,9 +3813,9 @@ my_decimal *Item_func_set_user_var::val_decimal(my_decimal *val) void Item_func_set_user_var::print(String *str) { - str->append("(@", 2); + str->append(STRING_WITH_LEN("(@")); str->append(name.str, name.length); - str->append(":=", 2); + str->append(STRING_WITH_LEN(":=")); args[0]->print(str); str->append(')'); } @@ -3821,9 +3823,9 @@ void Item_func_set_user_var::print(String *str) void Item_func_set_user_var::print_as_stmt(String *str) { - str->append("set @", 5); + str->append(STRING_WITH_LEN("set @")); str->append(name.str, name.length); - str->append(":=", 2); + str->append(STRING_WITH_LEN(":=")); args[0]->print(str); str->append(')'); } @@ -4054,7 +4056,7 @@ enum Item_result Item_func_get_user_var::result_type() const void Item_func_get_user_var::print(String *str) { - str->append("(@", 2); + str->append(STRING_WITH_LEN("(@")); str->append(name.str,name.length); str->append(')'); } @@ -4479,15 +4481,15 @@ double Item_func_match::val_real() void Item_func_match::print(String *str) { - str->append("(match ", 7); + str->append(STRING_WITH_LEN("(match ")); print_args(str, 1); - str->append(" against (", 10); + str->append(STRING_WITH_LEN(" against (")); args[0]->print(str); if (flags & FT_BOOL) - str->append(" in boolean mode", 16); + str->append(STRING_WITH_LEN(" in boolean mode")); else if (flags & FT_EXPAND) - str->append(" with query expansion", 21); - str->append("))", 2); + str->append(STRING_WITH_LEN(" with query expansion")); + str->append(STRING_WITH_LEN("))")); } longlong Item_func_bit_xor::val_int() @@ -4637,7 +4639,8 @@ Item_func_sp::Item_func_sp(Name_resolution_context *context_arg, sp_name *name) { maybe_null= 1; m_name->init_qname(current_thd); - dummy_table= (TABLE*) sql_calloc(sizeof(TABLE)); + dummy_table= (TABLE*) sql_calloc(sizeof(TABLE)+ sizeof(TABLE_SHARE)); + dummy_table->s= (TABLE_SHARE*) (dummy_table+1); } @@ -4648,9 +4651,11 @@ Item_func_sp::Item_func_sp(Name_resolution_context *context_arg, { maybe_null= 1; m_name->init_qname(current_thd); - dummy_table= (TABLE*) sql_calloc(sizeof(TABLE)); + dummy_table= (TABLE*) sql_calloc(sizeof(TABLE)+ sizeof(TABLE_SHARE)); + dummy_table->s= (TABLE_SHARE*) (dummy_table+1); } + void Item_func_sp::cleanup() { @@ -4690,25 +4695,30 @@ Item_func_sp::sp_result_field(void) const { Field *field; DBUG_ENTER("Item_func_sp::sp_result_field"); + DBUG_PRINT("info", ("sp: %s, flags: %x, level: %lu", + (m_sp ? "YES" : "NO"), + (m_sp ? m_sp->m_flags : (uint)0), + (m_sp ? m_sp->m_recursion_level : (ulong)0))); if (!m_sp) { - if (!(m_sp= sp_find_function(current_thd, m_name, TRUE))) + THD *thd= current_thd; + if (!(m_sp= sp_find_routine(thd, TYPE_ENUM_FUNCTION, m_name, + &thd->sp_func_cache, TRUE))) { my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", m_name->m_qname.str); DBUG_RETURN(0); } } - if (!dummy_table->s) + if (!dummy_table->alias) { char *empty_name= (char *) ""; - TABLE_SHARE *share; - dummy_table->s= share= &dummy_table->share_not_to_be_used; - dummy_table->alias = empty_name; - dummy_table->maybe_null = maybe_null; + dummy_table->alias= empty_name; + dummy_table->maybe_null= maybe_null; dummy_table->in_use= current_thd; - share->table_cache_key = empty_name; - share->table_name = empty_name; + dummy_table->s->table_cache_key.str = empty_name; + dummy_table->s->table_name.str= empty_name; + dummy_table->s->db.str= empty_name; } field= m_sp->make_field(max_length, name, dummy_table); DBUG_RETURN(field); @@ -4775,12 +4785,6 @@ Item_func_sp::execute(Item **itp) res= m_sp->execute_function(thd, args, arg_count, itp); thd->restore_sub_statement_state(&statement_state); - if (res && mysql_bin_log.is_open() && - (m_sp->m_chistics->daccess == SP_CONTAINS_SQL || - m_sp->m_chistics->daccess == SP_MODIFIES_SQL_DATA)) - push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_FAILED_ROUTINE_BREAK_BINLOG, - ER(ER_FAILED_ROUTINE_BREAK_BINLOG)); #ifndef NO_EMBEDDED_ACCESS_CHECKS sp_restore_security_context(thd, save_ctx_func); error: @@ -4894,7 +4898,7 @@ Item_func_sp::tmp_table_field(TABLE *t_arg) /* - Find the function and chack access rigths to the function + Find the function and check access rights to the function SYNOPSIS find_and_check_access() @@ -4925,7 +4929,8 @@ Item_func_sp::find_and_check_access(THD *thd, ulong want_access, bool res= TRUE; *save= 0; // Safety if error - if (! m_sp && ! (m_sp= sp_find_function(thd, m_name, TRUE))) + if (! m_sp && ! (m_sp= sp_find_routine(thd, TYPE_ENUM_FUNCTION, m_name, + &thd->sp_func_cache, TRUE))) { my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", m_name->m_qname.str); goto error; diff --git a/sql/item_func.h b/sql/item_func.h index 223144a5d51..76647fd5cb2 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -199,7 +199,7 @@ public: String *val_str(String*str); my_decimal *val_decimal(my_decimal *decimal_value); longlong val_int() - { DBUG_ASSERT(fixed == 1); return (longlong) val_real(); } + { DBUG_ASSERT(fixed == 1); return (longlong) rint(val_real()); } enum Item_result result_type () const { return REAL_RESULT; } void fix_length_and_dec() { decimals= NOT_FIXED_DEC; max_length= float_length(decimals); } @@ -943,7 +943,7 @@ class Item_func_udf_float :public Item_udf_func longlong val_int() { DBUG_ASSERT(fixed == 1); - return (longlong) Item_func_udf_float::val_real(); + return (longlong) rint(Item_func_udf_float::val_real()); } my_decimal *val_decimal(my_decimal *dec_buf) { @@ -1129,7 +1129,6 @@ class user_var_entry; class Item_func_set_user_var :public Item_func { enum Item_result cached_result_type; - LEX_STRING name; user_var_entry *entry; char buffer[MAX_FIELD_WIDTH]; String value; @@ -1146,6 +1145,7 @@ class Item_func_set_user_var :public Item_func public: + LEX_STRING name; // keep it public Item_func_set_user_var(LEX_STRING a,Item *b) :Item_func(b), cached_result_type(INT_RESULT), name(a) {} @@ -1168,10 +1168,10 @@ public: class Item_func_get_user_var :public Item_func { - LEX_STRING name; user_var_entry *var_entry; public: + LEX_STRING name; // keep it public Item_func_get_user_var(LEX_STRING a): Item_func(), name(a) {} enum Functype functype() const { return GUSERVAR_FUNC; } diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 1e8fe2e695f..8c0dea4efb2 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -48,6 +48,38 @@ static void my_coll_agg_error(DTCollation &c1, DTCollation &c2, } +String *Item_str_func::check_well_formed_result(String *str) +{ + /* Check whether we got a well-formed string */ + CHARSET_INFO *cs= str->charset(); + int well_formed_error; + uint wlen= cs->cset->well_formed_len(cs, + str->ptr(), str->ptr() + str->length(), + str->length(), &well_formed_error); + if (wlen < str->length()) + { + THD *thd= current_thd; + char hexbuf[7]; + enum MYSQL_ERROR::enum_warning_level level; + uint diff= str->length() - wlen; + set_if_smaller(diff, 3); + octet2hex(hexbuf, str->ptr() + wlen, diff); + if (thd->variables.sql_mode & + (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES)) + { + level= MYSQL_ERROR::WARN_LEVEL_ERROR; + null_value= 1; + str= 0; + } + else + level= MYSQL_ERROR::WARN_LEVEL_WARN; + push_warning_printf(thd, level, ER_INVALID_CHARACTER_STRING, + ER(ER_INVALID_CHARACTER_STRING), cs->csname, hexbuf); + } + return str; +} + + double Item_str_func::val_real() { DBUG_ASSERT(fixed == 1); @@ -1790,7 +1822,7 @@ String *Item_func_format::val_str(String *str) void Item_func_format::print(String *str) { - str->append("format(", 7); + str->append(STRING_WITH_LEN("format(")); args[0]->print(str); str->append(','); // my_charset_bin is good enough for numbers @@ -1950,7 +1982,7 @@ String *Item_func_make_set::val_str(String *str) void Item_func_make_set::print(String *str) { - str->append("make_set(", 9); + str->append(STRING_WITH_LEN("make_set(")); item->print(str); if (arg_count) { @@ -1984,34 +2016,7 @@ String *Item_func_char::val_str(String *str) } str->set_charset(collation.collation); str->realloc(str->length()); // Add end 0 (for Purify) - - /* Check whether we got a well-formed string */ - CHARSET_INFO *cs= collation.collation; - int well_formed_error; - uint wlen= cs->cset->well_formed_len(cs, - str->ptr(), str->ptr() + str->length(), - str->length(), &well_formed_error); - if (wlen < str->length()) - { - THD *thd= current_thd; - char hexbuf[7]; - enum MYSQL_ERROR::enum_warning_level level; - uint diff= str->length() - wlen; - set_if_smaller(diff, 3); - octet2hex(hexbuf, str->ptr() + wlen, diff); - if (thd->variables.sql_mode & - (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES)) - { - level= MYSQL_ERROR::WARN_LEVEL_ERROR; - null_value= 1; - str= 0; - } - else - level= MYSQL_ERROR::WARN_LEVEL_WARN; - push_warning_printf(thd, level, ER_INVALID_CHARACTER_STRING, - ER(ER_INVALID_CHARACTER_STRING), cs->csname, hexbuf); - } - return str; + return check_well_formed_result(str); } @@ -2311,6 +2316,8 @@ String *Item_func_conv::val_str(String *str) String *Item_func_conv_charset::val_str(String *str) { DBUG_ASSERT(fixed == 1); + if (use_cached_value) + return null_value ? 0 : &str_value; String *arg= args[0]->val_str(str); uint dummy_errors; if (!arg) @@ -2320,7 +2327,7 @@ String *Item_func_conv_charset::val_str(String *str) } null_value= str_value.copy(arg->ptr(),arg->length(),arg->charset(), conv_charset, &dummy_errors); - return null_value ? 0 : &str_value; + return null_value ? 0 : check_well_formed_result(&str_value); } void Item_func_conv_charset::fix_length_and_dec() @@ -2331,9 +2338,9 @@ void Item_func_conv_charset::fix_length_and_dec() void Item_func_conv_charset::print(String *str) { - str->append("convert(", 8); + str->append(STRING_WITH_LEN("convert(")); args[0]->print(str); - str->append(" using ", 7); + str->append(STRING_WITH_LEN(" using ")); str->append(conv_charset->csname); str->append(')'); } @@ -2403,7 +2410,7 @@ void Item_func_set_collation::print(String *str) { str->append('('); args[0]->print(str); - str->append(" collate ", 9); + str->append(STRING_WITH_LEN(" collate ")); DBUG_ASSERT(args[1]->basic_const_item() && args[1]->type() == Item::STRING_ITEM); args[1]->str_value.print(str); @@ -2523,9 +2530,9 @@ String *Item_func_unhex::val_str(String *str) void Item_func_binary::print(String *str) { - str->append("cast(", 5); + str->append(STRING_WITH_LEN("cast(")); args[0]->print(str); - str->append(" as binary)", 11); + str->append(STRING_WITH_LEN(" as binary)")); } @@ -2630,7 +2637,7 @@ String* Item_func_export_set::val_str(String* str) } break; case 3: - sep_buf.set(",", 1, default_charset()); + sep_buf.set(STRING_WITH_LEN(","), default_charset()); sep = &sep_buf; break; default: @@ -2745,7 +2752,8 @@ String *Item_func_quote::val_str(String *str) uint arg_length, new_length; if (!arg) // Null argument { - str->copy("NULL", 4, collation.collation); // Return the string 'NULL' + /* Return the string 'NULL' */ + str->copy(STRING_WITH_LEN("NULL"), collation.collation); null_value= 0; return str; } diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index 5889821293d..50ec0b36ce8 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -35,6 +35,7 @@ public: double val_real(); enum Item_result result_type () const { return STRING_RESULT; } void left_right_max_length(); + String *check_well_formed_result(String *str); }; class Item_func_md5 :public Item_str_func @@ -651,10 +652,40 @@ public: class Item_func_conv_charset :public Item_str_func { - CHARSET_INFO *conv_charset; + bool use_cached_value; public: - Item_func_conv_charset(Item *a, CHARSET_INFO *cs) :Item_str_func(a) - { conv_charset=cs; } + bool safe; + CHARSET_INFO *conv_charset; // keep it public + Item_func_conv_charset(Item *a, CHARSET_INFO *cs) :Item_str_func(a) + { conv_charset= cs; use_cached_value= 0; safe= 0; } + Item_func_conv_charset(Item *a, CHARSET_INFO *cs, bool cache_if_const) + :Item_str_func(a) + { + DBUG_ASSERT(args[0]->fixed); + conv_charset= cs; + if (cache_if_const && args[0]->const_item()) + { + uint errors= 0; + String tmp, *str= args[0]->val_str(&tmp); + if (!str || str_value.copy(str->ptr(), str->length(), + str->charset(), conv_charset, &errors)) + null_value= 1; + use_cached_value= 1; + safe= (errors == 0); + } + else + { + use_cached_value= 0; + /* + Conversion from and to "binary" is safe. + Conversion to Unicode is safe. + Other kind of conversions are potentially lossy. + */ + safe= (args[0]->collation.collation == &my_charset_bin || + cs == &my_charset_bin || + (cs->state & MY_CS_UNICODE)); + } + } String *val_str(String *); void fix_length_and_dec(); const char *func_name() const { return "convert"; } diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index a32b0d1dbbf..3f87af4038d 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -133,6 +133,7 @@ Item_subselect::select_transformer(JOIN *join) bool Item_subselect::fix_fields(THD *thd_param, Item **ref) { char const *save_where= thd_param->where; + uint8 uncacheable; bool res; DBUG_ASSERT(fixed == 0); @@ -178,15 +179,17 @@ bool Item_subselect::fix_fields(THD *thd_param, Item **ref) fix_length_and_dec(); } else - return 1; - uint8 uncacheable= engine->uncacheable(); - if (uncacheable) + goto err; + + if ((uncacheable= engine->uncacheable())) { const_item_cache= 0; if (uncacheable & UNCACHEABLE_RAND) used_tables_cache|= RAND_TABLE_BIT; } fixed= 1; + +err: thd->where= save_where; return res; } @@ -533,7 +536,7 @@ Item_exists_subselect::Item_exists_subselect(st_select_lex *select_lex): void Item_exists_subselect::print(String *str) { - str->append("exists", 6); + str->append(STRING_WITH_LEN("exists")); Item_subselect::print(str); } @@ -1339,11 +1342,11 @@ err: void Item_in_subselect::print(String *str) { if (transformed) - str->append("", 8); + str->append(STRING_WITH_LEN("")); else { left_expr->print(str); - str->append(" in ", 4); + str->append(STRING_WITH_LEN(" in ")); } Item_subselect::print(str); } @@ -1362,7 +1365,7 @@ Item_allany_subselect::select_transformer(JOIN *join) void Item_allany_subselect::print(String *str) { if (transformed) - str->append("", 8); + str->append(STRING_WITH_LEN("")); else { left_expr->print(str); @@ -1794,16 +1797,16 @@ void subselect_union_engine::print(String *str) void subselect_uniquesubquery_engine::print(String *str) { - str->append("(", 23); + str->append(STRING_WITH_LEN("(")); tab->ref.items[0]->print(str); - str->append(" in ", 4); - str->append(tab->table->s->table_name); + str->append(STRING_WITH_LEN(" in ")); + str->append(tab->table->s->table_name.str, tab->table->s->table_name.length); KEY *key_info= tab->table->key_info+ tab->ref.key; - str->append(" on ", 4); + str->append(STRING_WITH_LEN(" on ")); str->append(key_info->name); if (cond) { - str->append(" where ", 7); + str->append(STRING_WITH_LEN(" where ")); cond->print(str); } str->append(')'); @@ -1812,18 +1815,18 @@ void subselect_uniquesubquery_engine::print(String *str) void subselect_indexsubquery_engine::print(String *str) { - str->append("(", 15); + str->append(STRING_WITH_LEN("(")); tab->ref.items[0]->print(str); - str->append(" in ", 4); - str->append(tab->table->s->table_name); + str->append(STRING_WITH_LEN(" in ")); + str->append(tab->table->s->table_name.str, tab->table->s->table_name.length); KEY *key_info= tab->table->key_info+ tab->ref.key; - str->append(" on ", 4); + str->append(STRING_WITH_LEN(" on ")); str->append(key_info->name); if (check_null) - str->append(" checking NULL", 14); + str->append(STRING_WITH_LEN(" checking NULL")); if (cond) { - str->append(" where ", 7); + str->append(STRING_WITH_LEN(" where ")); cond->print(str); } str->append(')'); diff --git a/sql/item_sum.cc b/sql/item_sum.cc index b2eaf39d624..0f6713e3e7e 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -143,26 +143,33 @@ bool Item_sum::walk (Item_processor processor, byte *argument) Field *Item_sum::create_tmp_field(bool group, TABLE *table, uint convert_blob_length) { + Field *field; switch (result_type()) { case REAL_RESULT: - return new Field_double(max_length,maybe_null,name,table,decimals); + field= new Field_double(max_length, maybe_null, name, decimals); + break; case INT_RESULT: - return new Field_longlong(max_length,maybe_null,name,table,unsigned_flag); + field= new Field_longlong(max_length, maybe_null, name, unsigned_flag); + break; case STRING_RESULT: - if (max_length > 255 && convert_blob_length) - return new Field_varstring(convert_blob_length, maybe_null, - name, table, - collation.collation); - return make_string_field(table); + if (max_length <= 255 || !convert_blob_length) + return make_string_field(table); + field= new Field_varstring(convert_blob_length, maybe_null, + name, table->s, collation.collation); + break; case DECIMAL_RESULT: - return new Field_new_decimal(max_length, maybe_null, name, table, + field= new Field_new_decimal(max_length, maybe_null, name, decimals, unsigned_flag); + break; case ROW_RESULT: default: // This case should never be choosen DBUG_ASSERT(0); return 0; } + if (field) + field->init(table); + return field; } @@ -312,9 +319,10 @@ Item_sum_hybrid::fix_fields(THD *thd, Item **ref) Field *Item_sum_hybrid::create_tmp_field(bool group, TABLE *table, uint convert_blob_length) { + Field *field; if (args[0]->type() == Item::FIELD_ITEM) { - Field *field= ((Item_field*) args[0])->field; + field= ((Item_field*) args[0])->field; if ((field= create_tmp_field_from_field(current_thd, field, name, table, NULL, convert_blob_length))) @@ -328,16 +336,21 @@ Field *Item_sum_hybrid::create_tmp_field(bool group, TABLE *table, */ switch (args[0]->field_type()) { case MYSQL_TYPE_DATE: - return new Field_date(maybe_null, name, table, collation.collation); + field= new Field_date(maybe_null, name, collation.collation); + break; case MYSQL_TYPE_TIME: - return new Field_time(maybe_null, name, table, collation.collation); + field= new Field_time(maybe_null, name, collation.collation); + break; case MYSQL_TYPE_TIMESTAMP: case MYSQL_TYPE_DATETIME: - return new Field_datetime(maybe_null, name, table, collation.collation); - default: + field= new Field_datetime(maybe_null, name, collation.collation); break; + default: + return Item_sum::create_tmp_field(group, table, convert_blob_length); } - return Item_sum::create_tmp_field(group, table, convert_blob_length); + if (field) + field->init(table); + return field; } @@ -452,7 +465,7 @@ longlong Item_sum_sum::val_int() &result); return result; } - return (longlong) val_real(); + return (longlong) rint(val_real()); } @@ -839,6 +852,7 @@ Item *Item_sum_avg::copy_or_same(THD* thd) Field *Item_sum_avg::create_tmp_field(bool group, TABLE *table, uint convert_blob_len) { + Field *field; if (group) { /* @@ -846,14 +860,18 @@ Field *Item_sum_avg::create_tmp_field(bool group, TABLE *table, The easyest way is to do this is to store both value in a string and unpack on access. */ - return new Field_string(((hybrid_type == DECIMAL_RESULT) ? + field= new Field_string(((hybrid_type == DECIMAL_RESULT) ? dec_bin_size : sizeof(double)) + sizeof(longlong), - 0, name, table, &my_charset_bin); + 0, name, &my_charset_bin); } - if (hybrid_type == DECIMAL_RESULT) - return new Field_new_decimal(max_length, maybe_null, name, table, + else if (hybrid_type == DECIMAL_RESULT) + field= new Field_new_decimal(max_length, maybe_null, name, decimals, unsigned_flag); - return new Field_double(max_length, maybe_null, name, table, decimals); + else + field= new Field_double(max_length, maybe_null, name, decimals); + if (field) + field->init(table); + return field; } @@ -1018,6 +1036,7 @@ Item *Item_sum_variance::copy_or_same(THD* thd) Field *Item_sum_variance::create_tmp_field(bool group, TABLE *table, uint convert_blob_len) { + Field *field; if (group) { /* @@ -1025,15 +1044,19 @@ Field *Item_sum_variance::create_tmp_field(bool group, TABLE *table, The easyest way is to do this is to store both value in a string and unpack on access. */ - return new Field_string(((hybrid_type == DECIMAL_RESULT) ? + field= new Field_string(((hybrid_type == DECIMAL_RESULT) ? dec_bin_size0 + dec_bin_size1 : sizeof(double)*2) + sizeof(longlong), - 0, name, table, &my_charset_bin); + 0, name, &my_charset_bin); } - if (hybrid_type == DECIMAL_RESULT) - return new Field_new_decimal(max_length, maybe_null, name, table, + else if (hybrid_type == DECIMAL_RESULT) + field= new Field_new_decimal(max_length, maybe_null, name, decimals, unsigned_flag); - return new Field_double(max_length, maybe_null,name,table,decimals); + else + field= new Field_double(max_length, maybe_null, name, decimals); + if (field) + field->init(table); + return field; } @@ -1285,7 +1308,7 @@ longlong Item_sum_hybrid::val_int() return sum_int; } default: - return (longlong) Item_sum_hybrid::val_real(); + return (longlong) rint(Item_sum_hybrid::val_real()); } } @@ -2001,7 +2024,7 @@ double Item_avg_field::val_real() longlong Item_avg_field::val_int() { - return (longlong) val_real(); + return (longlong) rint(val_real()); } @@ -3156,9 +3179,9 @@ String* Item_func_group_concat::val_str(String* str) void Item_func_group_concat::print(String *str) { - str->append("group_concat(", 13); + str->append(STRING_WITH_LEN("group_concat(")); if (distinct) - str->append("distinct ", 9); + str->append(STRING_WITH_LEN("distinct ")); for (uint i= 0; i < arg_count_field; i++) { if (i) @@ -3167,19 +3190,19 @@ void Item_func_group_concat::print(String *str) } if (arg_count_order) { - str->append(" order by ", 10); + str->append(STRING_WITH_LEN(" order by ")); for (uint i= 0 ; i < arg_count_order ; i++) { if (i) str->append(','); (*order[i]->item)->print(str); if (order[i]->asc) - str->append(" ASC"); + str->append(STRING_WITH_LEN(" ASC")); else - str->append(" DESC"); + str->append(STRING_WITH_LEN(" DESC")); } } - str->append(" separator \'", 12); + str->append(STRING_WITH_LEN(" separator \'")); str->append(*separator); - str->append("\')", 2); + str->append(STRING_WITH_LEN("\')")); } diff --git a/sql/item_sum.h b/sql/item_sum.h index 87cc248e5e4..2c2bcedab9b 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -126,7 +126,7 @@ public: longlong val_int() { DBUG_ASSERT(fixed == 1); - return (longlong) val_real(); /* Real as default */ + return (longlong) rint(val_real()); /* Real as default */ } String *val_str(String*str); my_decimal *val_decimal(my_decimal *); @@ -392,7 +392,7 @@ public: bool add(); double val_real(); // In SPs we might force the "wrong" type with select into a declare variable - longlong val_int() { return (longlong)val_real(); } + longlong val_int() { return (longlong) rint(val_real()); } my_decimal *val_decimal(my_decimal *); String *val_str(String *str); void reset_field(); @@ -421,7 +421,7 @@ public: enum Type type() const {return FIELD_VARIANCE_ITEM; } double val_real(); longlong val_int() - { /* can't be fix_fields()ed */ return (longlong) val_real(); } + { /* can't be fix_fields()ed */ return (longlong) rint(val_real()); } String *val_str(String*); my_decimal *val_decimal(my_decimal *); bool is_null() { (void) val_int(); return null_value; } @@ -699,7 +699,7 @@ class Item_sum_udf_float :public Item_udf_sum longlong val_int() { DBUG_ASSERT(fixed == 1); - return (longlong) Item_sum_udf_float::val_real(); + return (longlong) rint(Item_sum_udf_float::val_real()); } double val_real(); String *val_str(String*str); diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 2b0314bb287..f62ad42bb95 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -506,7 +506,7 @@ bool make_date_time(DATE_TIME_FORMAT *format, TIME *l_time, str->set_charset(&my_charset_bin); if (l_time->neg) - str->append("-", 1); + str->append('-'); end= (ptr= format->format.str) + format->format.length; for (; ptr != end ; ptr++) @@ -546,21 +546,21 @@ bool make_date_time(DATE_TIME_FORMAT *format, TIME *l_time, length= int10_to_str(l_time->day, intbuff, 10) - intbuff; str->append_with_prefill(intbuff, length, 1, '0'); if (l_time->day >= 10 && l_time->day <= 19) - str->append("th", 2); + str->append(STRING_WITH_LEN("th")); else { switch (l_time->day %10) { case 1: - str->append("st",2); + str->append(STRING_WITH_LEN("st")); break; case 2: - str->append("nd",2); + str->append(STRING_WITH_LEN("nd")); break; case 3: - str->append("rd",2); + str->append(STRING_WITH_LEN("rd")); break; default: - str->append("th",2); + str->append(STRING_WITH_LEN("th")); break; } } @@ -2142,9 +2142,9 @@ void Item_date_add_interval::print(String *str) void Item_extract::print(String *str) { - str->append("extract(", 8); + str->append(STRING_WITH_LEN("extract(")); str->append(interval_names[int_type]); - str->append(" from ", 6); + str->append(STRING_WITH_LEN(" from ")); args[0]->print(str); str->append(')'); } @@ -2286,9 +2286,9 @@ bool Item_char_typecast::eq(const Item *item, bool binary_cmp) const void Item_typecast::print(String *str) { - str->append("cast(", 5); + str->append(STRING_WITH_LEN("cast(")); args[0]->print(str); - str->append(" as ", 4); + str->append(STRING_WITH_LEN(" as ")); str->append(cast_type()); str->append(')'); } @@ -2296,9 +2296,9 @@ void Item_typecast::print(String *str) void Item_char_typecast::print(String *str) { - str->append("cast(", 5); + str->append(STRING_WITH_LEN("cast(")); args[0]->print(str); - str->append(" as char", 8); + str->append(STRING_WITH_LEN(" as char")); if (cast_length >= 0) { str->append('('); @@ -2311,7 +2311,7 @@ void Item_char_typecast::print(String *str) } if (cast_cs) { - str->append(" charset ", 9); + str->append(STRING_WITH_LEN(" charset ")); str->append(cast_cs->csname); } str->append(')'); @@ -2352,22 +2352,37 @@ String *Item_char_typecast::val_str(String *str) and the result is longer than cast length, e.g. CAST('string' AS CHAR(1)) */ - if (cast_length >= 0 && - (res->length() > (length= (uint32) res->charpos(cast_length)))) - { // Safe even if const arg - char char_type[40]; - my_snprintf(char_type, sizeof(char_type), "CHAR(%lu)", length); + if (cast_length >= 0) + { + if (res->length() > (length= (uint32) res->charpos(cast_length))) + { // Safe even if const arg + char char_type[40]; + my_snprintf(char_type, sizeof(char_type), "%s(%lu)", + cast_cs == &my_charset_bin ? "BINARY" : "CHAR", length); - if (!res->alloced_length()) - { // Don't change const str - str_value= *res; // Not malloced string - res= &str_value; + if (!res->alloced_length()) + { // Don't change const str + str_value= *res; // Not malloced string + res= &str_value; + } + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_TRUNCATED_WRONG_VALUE, + ER(ER_TRUNCATED_WRONG_VALUE), char_type, + res->c_ptr_safe()); + res->length((uint) length); + } + else if (cast_cs == &my_charset_bin && res->length() < (uint) cast_length) + { + if (res->alloced_length() < (uint) cast_length) + { + str->alloc(cast_length); + str->copy(*res); + res= str; + } + bzero((char*) res->ptr() + res->length(), + (uint) cast_length - res->length()); + res->length(cast_length); } - push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_TRUNCATED_WRONG_VALUE, - ER(ER_TRUNCATED_WRONG_VALUE), char_type, - res->c_ptr_safe()); - res->length((uint) length); } null_value= 0; return res; @@ -2609,14 +2624,14 @@ void Item_func_add_time::print(String *str) if (is_date) { DBUG_ASSERT(sign > 0); - str->append("timestamp(", 10); + str->append(STRING_WITH_LEN("timestamp(")); } else { if (sign > 0) - str->append("addtime(", 8); + str->append(STRING_WITH_LEN("addtime(")); else - str->append("subtime(", 8); + str->append(STRING_WITH_LEN("subtime(")); } args[0]->print(str); str->append(','); @@ -2825,31 +2840,31 @@ void Item_func_timestamp_diff::print(String *str) switch (int_type) { case INTERVAL_YEAR: - str->append("YEAR"); + str->append(STRING_WITH_LEN("YEAR")); break; case INTERVAL_QUARTER: - str->append("QUARTER"); + str->append(STRING_WITH_LEN("QUARTER")); break; case INTERVAL_MONTH: - str->append("MONTH"); + str->append(STRING_WITH_LEN("MONTH")); break; case INTERVAL_WEEK: - str->append("WEEK"); + str->append(STRING_WITH_LEN("WEEK")); break; case INTERVAL_DAY: - str->append("DAY"); + str->append(STRING_WITH_LEN("DAY")); break; case INTERVAL_HOUR: - str->append("HOUR"); + str->append(STRING_WITH_LEN("HOUR")); break; case INTERVAL_MINUTE: - str->append("MINUTE"); + str->append(STRING_WITH_LEN("MINUTE")); break; case INTERVAL_SECOND: - str->append("SECOND"); + str->append(STRING_WITH_LEN("SECOND")); break; case INTERVAL_MICROSECOND: - str->append("SECOND_FRAC"); + str->append(STRING_WITH_LEN("SECOND_FRAC")); break; default: break; @@ -2905,13 +2920,13 @@ void Item_func_get_format::print(String *str) switch (type) { case MYSQL_TIMESTAMP_DATE: - str->append("DATE, "); + str->append(STRING_WITH_LEN("DATE, ")); break; case MYSQL_TIMESTAMP_DATETIME: - str->append("DATETIME, "); + str->append(STRING_WITH_LEN("DATETIME, ")); break; case MYSQL_TIMESTAMP_TIME: - str->append("TIME, "); + str->append(STRING_WITH_LEN("TIME, ")); break; default: DBUG_ASSERT(0); @@ -2987,18 +3002,6 @@ get_date_time_result_type(const char *format, uint length) } -Field *Item_func_str_to_date::tmp_table_field(TABLE *t_arg) -{ - if (cached_field_type == MYSQL_TYPE_TIME) - return (new Field_time(maybe_null, name, t_arg, &my_charset_bin)); - if (cached_field_type == MYSQL_TYPE_DATE) - return (new Field_date(maybe_null, name, t_arg, &my_charset_bin)); - if (cached_field_type == MYSQL_TYPE_DATETIME) - return (new Field_datetime(maybe_null, name, t_arg, &my_charset_bin)); - return (new Field_string(max_length, maybe_null, name, t_arg, &my_charset_bin)); -} - - void Item_func_str_to_date::fix_length_and_dec() { char format_buff[64]; diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index b2352e728c5..46079ac0342 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -340,10 +340,10 @@ public: max_length=MAX_DATE_WIDTH*MY_CHARSET_BIN_MB_MAXLEN; } int save_in_field(Field *to, bool no_conversions); - Field *tmp_table_field(TABLE *t_arg) + Field *tmp_table_field(TABLE *table) { - return (new Field_date(maybe_null, name, t_arg, &my_charset_bin)); - } + return tmp_table_field_from_field_type(table, 0); + } }; @@ -355,9 +355,9 @@ public: Item_date_func(Item *a,Item *b) :Item_str_func(a,b) {} Item_date_func(Item *a,Item *b, Item *c) :Item_str_func(a,b,c) {} enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; } - Field *tmp_table_field(TABLE *t_arg) + Field *tmp_table_field(TABLE *table) { - return (new Field_datetime(maybe_null, name, t_arg, &my_charset_bin)); + return tmp_table_field_from_field_type(table, 0); } }; @@ -378,9 +378,9 @@ public: longlong val_int() { DBUG_ASSERT(fixed == 1); return value; } String *val_str(String *str); void fix_length_and_dec(); - Field *tmp_table_field(TABLE *t_arg) + Field *tmp_table_field(TABLE *table) { - return (new Field_time(maybe_null, name, t_arg, &my_charset_bin)); + return tmp_table_field_from_field_type(table, 0); } /* Abstract method that defines which time zone is used for conversion. @@ -618,9 +618,9 @@ public: } enum_field_types field_type() const { return MYSQL_TYPE_TIME; } const char *func_name() const { return "sec_to_time"; } - Field *tmp_table_field(TABLE *t_arg) + Field *tmp_table_field(TABLE *table) { - return (new Field_time(maybe_null, name, t_arg, &my_charset_bin)); + return tmp_table_field_from_field_type(table, 0); } }; @@ -641,12 +641,12 @@ enum interval_type class Item_date_add_interval :public Item_date_func { - const interval_type int_type; String value; - const bool date_sub_interval; enum_field_types cached_field_type; public: + const interval_type int_type; // keep it public + const bool date_sub_interval; // keep it public Item_date_add_interval(Item *a,Item *b,interval_type type_arg,bool neg_arg) :Item_date_func(a,b),int_type(type_arg), date_sub_interval(neg_arg) {} String *val_str(String *); @@ -662,10 +662,10 @@ public: class Item_extract :public Item_int_func { - const interval_type int_type; String value; bool date_value; public: + const interval_type int_type; // keep it public Item_extract(interval_type type_arg, Item *a) :Item_int_func(a), int_type(type_arg) {} longlong val_int(); @@ -741,9 +741,9 @@ public: bool get_date(TIME *ltime, uint fuzzy_date); const char *cast_type() const { return "date"; } enum_field_types field_type() const { return MYSQL_TYPE_DATE; } - Field *tmp_table_field(TABLE *t_arg) + Field *tmp_table_field(TABLE *table) { - return (new Field_date(maybe_null, name, t_arg, &my_charset_bin)); + return tmp_table_field_from_field_type(table, 0); } void fix_length_and_dec() { @@ -763,9 +763,9 @@ public: bool get_time(TIME *ltime); const char *cast_type() const { return "time"; } enum_field_types field_type() const { return MYSQL_TYPE_TIME; } - Field *tmp_table_field(TABLE *t_arg) + Field *tmp_table_field(TABLE *table) { - return (new Field_time(maybe_null, name, t_arg, &my_charset_bin)); + return tmp_table_field_from_field_type(table, 0); } }; @@ -778,9 +778,9 @@ public: String *val_str(String *str); const char *cast_type() const { return "datetime"; } enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; } - Field *tmp_table_field(TABLE *t_arg) + Field *tmp_table_field(TABLE *table) { - return (new Field_datetime(maybe_null, name, t_arg, &my_charset_bin)); + return tmp_table_field_from_field_type(table, 0); } }; @@ -796,9 +796,9 @@ public: decimals=0; max_length=MAX_DATE_WIDTH*MY_CHARSET_BIN_MB_MAXLEN; } - Field *tmp_table_field(TABLE *t_arg) + Field *tmp_table_field(TABLE *table) { - return (new Field_date(maybe_null, name, t_arg, &my_charset_bin)); + return tmp_table_field_from_field_type(table, 0); } }; @@ -816,18 +816,9 @@ public: enum_field_types field_type() const { return cached_field_type; } void fix_length_and_dec(); -/* - TODO: - Change this when we support - microseconds in TIME/DATETIME -*/ - Field *tmp_table_field(TABLE *t_arg) + Field *tmp_table_field(TABLE *table) { - if (cached_field_type == MYSQL_TYPE_TIME) - return (new Field_time(maybe_null, name, t_arg, &my_charset_bin)); - else if (cached_field_type == MYSQL_TYPE_DATETIME) - return (new Field_datetime(maybe_null, name, t_arg, &my_charset_bin)); - return (new Field_string(max_length, maybe_null, name, t_arg, &my_charset_bin)); + return tmp_table_field_from_field_type(table, 0); } void print(String *str); const char *func_name() const { return "add_time"; } @@ -847,9 +838,9 @@ public: max_length=MAX_TIME_WIDTH*MY_CHARSET_BIN_MB_MAXLEN; maybe_null= 1; } - Field *tmp_table_field(TABLE *t_arg) + Field *tmp_table_field(TABLE *table) { - return (new Field_time(maybe_null, name, t_arg, &my_charset_bin)); + return tmp_table_field_from_field_type(table, 0); } }; @@ -866,9 +857,9 @@ public: decimals=0; max_length=MAX_TIME_WIDTH*MY_CHARSET_BIN_MB_MAXLEN; } - Field *tmp_table_field(TABLE *t_arg) + Field *tmp_table_field(TABLE *table) { - return (new Field_time(maybe_null, name, t_arg, &my_charset_bin)); + return tmp_table_field_from_field_type(table, 0); } }; @@ -910,8 +901,8 @@ enum date_time_format class Item_func_get_format :public Item_str_func { - const timestamp_type type; public: + const timestamp_type type; // keep it public Item_func_get_format(timestamp_type type_arg, Item *a) :Item_str_func(a), type(type_arg) {} @@ -942,7 +933,10 @@ public: const char *func_name() const { return "str_to_date"; } enum_field_types field_type() const { return cached_field_type; } void fix_length_and_dec(); - Field *tmp_table_field(TABLE *t_arg); + Field *tmp_table_field(TABLE *table) + { + return tmp_table_field_from_field_type(table, 1); + } }; diff --git a/sql/item_uniq.cc b/sql/item_uniq.cc index 79b2ca68f4f..9db8228b345 100644 --- a/sql/item_uniq.cc +++ b/sql/item_uniq.cc @@ -25,5 +25,8 @@ Field *Item_sum_unique_users::create_tmp_field(bool group, TABLE *table, uint convert_blob_length) { - return new Field_long(9,maybe_null,name,table,1); + Field *field= new Field_long(9, maybe_null, name, 1); + if (field) + field->init(table); + return field; } diff --git a/sql/item_uniq.h b/sql/item_uniq.h index c884c454dac..a0aa0b96cc6 100644 --- a/sql/item_uniq.h +++ b/sql/item_uniq.h @@ -29,7 +29,7 @@ public: :Item_real_func(list) {} double val_real() { DBUG_ASSERT(fixed == 1); return 0.0; } void fix_length_and_dec() { decimals=0; max_length=6; } - void print(String *str) { str->append("0.0", 3); } + void print(String *str) { str->append(STRING_WITH_LEN("0.0")); } const char *func_name() const { return "unique_users"; } }; @@ -57,7 +57,7 @@ public: { return new Item_sum_unique_users(thd, this); } - void print(String *str) { str->append("0.0", 3); } + void print(String *str) { str->append(STRING_WITH_LEN("0.0")); } Field *create_tmp_field(bool group, TABLE *table, uint convert_blob_length); const char *func_name() const { return "sum_unique_users"; } }; diff --git a/sql/key.cc b/sql/key.cc index 4af88f218ee..4001c6177a1 100644 --- a/sql/key.cc +++ b/sql/key.cc @@ -28,7 +28,7 @@ ** Used when calculating key for NEXT_NUMBER */ -int find_ref_key(TABLE *table,Field *field, uint *key_length) +int find_ref_key(KEY *key, uint key_count, Field *field, uint *key_length) { reg2 int i; reg3 KEY *key_info; @@ -38,8 +38,8 @@ int find_ref_key(TABLE *table,Field *field, uint *key_length) /* Test if some key starts as fieldpos */ - for (i= 0, key_info= table->key_info ; - i < (int) table->s->keys ; + for (i= 0, key_info= key ; + i < (int) key_count ; i++, key_info++) { if (key_info->key_part[0].offset == fieldpos) @@ -50,8 +50,8 @@ int find_ref_key(TABLE *table,Field *field, uint *key_length) } /* Test if some key contains fieldpos */ - for (i= 0, key_info= table->key_info ; - i < (int) table->s->keys ; + for (i= 0, key_info= key; + i < (int) key_count ; i++, key_info++) { uint j; @@ -322,7 +322,7 @@ void key_unpack(String *to,TABLE *table,uint idx) { if (table->record[0][key_part->null_offset] & key_part->null_bit) { - to->append("NULL", 4); + to->append(STRING_WITH_LEN("NULL")); continue; } } @@ -334,7 +334,7 @@ void key_unpack(String *to,TABLE *table,uint idx) to->append(tmp); } else - to->append("???", 3); + to->append(STRING_WITH_LEN("???")); } DBUG_VOID_RETURN; } diff --git a/sql/lex.h b/sql/lex.h index cfafd98fe20..e3cbebf4629 100644 --- a/sql/lex.h +++ b/sql/lex.h @@ -74,6 +74,7 @@ static SYMBOL symbols[] = { { "ASC", SYM(ASC)}, { "ASCII", SYM(ASCII_SYM)}, { "ASENSITIVE", SYM(ASENSITIVE_SYM)}, + { "AUTHORS", SYM(AUTHORS_SYM)}, { "AUTO_INCREMENT", SYM(AUTO_INC)}, { "AVG", SYM(AVG_SYM)}, { "AVG_ROW_LENGTH", SYM(AVG_ROW_LENGTH)}, @@ -111,6 +112,7 @@ static SYMBOL symbols[] = { { "CLIENT", SYM(CLIENT_SYM)}, { "CLOSE", SYM(CLOSE_SYM)}, { "COALESCE", SYM(COALESCE)}, + { "CODE", SYM(CODE_SYM)}, { "COLLATE", SYM(COLLATE_SYM)}, { "COLLATION", SYM(COLLATION_SYM)}, { "COLUMN", SYM(COLUMN_SYM)}, diff --git a/sql/lock.cc b/sql/lock.cc index 0af22cac399..288adc19032 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -146,6 +146,7 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count, } thd->proc_info="System lock"; + DBUG_PRINT("info", ("thd->proc_info %s", thd->proc_info)); if (lock_external(thd, tables, count)) { my_free((gptr) sql_lock,MYF(0)); @@ -153,6 +154,7 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count, break; } thd->proc_info="Table lock"; + DBUG_PRINT("info", ("thd->proc_info %s", thd->proc_info)); thd->locked=1; rc= thr_lock_errno_to_mysql[(int) thr_multi_lock(sql_lock->locks, sql_lock->lock_count, @@ -218,6 +220,7 @@ static int lock_external(THD *thd, TABLE **tables, uint count) int lock_type,error; DBUG_ENTER("lock_external"); + DBUG_PRINT("info", ("count %d", count)); for (i=1 ; i <= count ; i++, tables++) { DBUG_ASSERT((*tables)->reginfo.lock_type >= TL_READ); @@ -354,12 +357,15 @@ void mysql_lock_abort(THD *thd, TABLE *table) { MYSQL_LOCK *locked; TABLE *write_lock_used; + DBUG_ENTER("mysql_lock_abort"); + if ((locked = get_lock_data(thd,&table,1,1,&write_lock_used))) { for (uint i=0; i < locked->lock_count; i++) thr_abort_locks(locked->locks[i]->lock); my_free((gptr) locked,MYF(0)); } + DBUG_VOID_RETURN; } @@ -460,6 +466,8 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count, THR_LOCK_DATA **locks; TABLE **to; + DBUG_ENTER("get_lock_data"); + DBUG_PRINT("info", ("count %d", count)); *write_lock_used=0; for (i=tables=lock_count=0 ; i < count ; i++) { @@ -477,9 +485,9 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count, table_ptr[i]->reginfo.lock_type >= TL_WRITE_ALLOW_WRITE && count != 1) { - my_error(ER_WRONG_LOCK_OF_SYSTEM_TABLE, MYF(0), table_ptr[i]->s->db, - table_ptr[i]->s->table_name); - return 0; + my_error(ER_WRONG_LOCK_OF_SYSTEM_TABLE, MYF(0), table_ptr[i]->s->db.str, + table_ptr[i]->s->table_name.str); + DBUG_RETURN(0); } } @@ -487,11 +495,13 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count, my_malloc(sizeof(*sql_lock)+ sizeof(THR_LOCK_DATA*)*tables+sizeof(table_ptr)*lock_count, MYF(0)))) - return 0; + DBUG_RETURN(0); locks=sql_lock->locks=(THR_LOCK_DATA**) (sql_lock+1); to=sql_lock->table=(TABLE**) (locks+tables); sql_lock->table_count=lock_count; sql_lock->lock_count=tables; + DBUG_PRINT("info", ("sql_lock->table_count %d sql_lock->lock_count %d", + sql_lock->table_count, sql_lock->lock_count)); for (i=0 ; i < count ; i++) { @@ -507,7 +517,7 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count, { my_error(ER_OPEN_AS_READONLY, MYF(0), table->alias); my_free((gptr) sql_lock,MYF(0)); - return 0; + DBUG_RETURN(0); } } THR_LOCK_DATA **org_locks = locks; @@ -517,7 +527,7 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count, for ( ; org_locks != locks ; org_locks++) (*org_locks)->debug_print_param= (void *) table; } - return sql_lock; + DBUG_RETURN(sql_lock); } @@ -603,32 +613,35 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list) DBUG_ENTER("lock_table_name"); DBUG_PRINT("enter",("db: %s name: %s", db, table_list->table_name)); - safe_mutex_assert_owner(&LOCK_open); - - key_length=(uint) (strmov(strmov(key,db)+1,table_list->table_name) - -key)+ 1; - + key_length= create_table_def_key(thd, key, table_list, 0); /* Only insert the table if we haven't insert it already */ for (table=(TABLE*) hash_search(&open_cache,(byte*) key,key_length) ; table ; table = (TABLE*) hash_next(&open_cache,(byte*) key,key_length)) + { if (table->in_use == thd) + { + DBUG_PRINT("info", ("Table is in use")); + table->s->version= 0; // Ensure no one can use this + table->locked_by_name= 1; DBUG_RETURN(0); - + } + } /* Create a table entry with the right key and with an old refresh version Note that we must use my_malloc() here as this is freed by the table cache */ - if (!(table= (TABLE*) my_malloc(sizeof(*table)+key_length, - MYF(MY_WME | MY_ZEROFILL)))) + if (!(table= (TABLE*) my_malloc(sizeof(*table)+ sizeof(TABLE_SHARE)+ + key_length, MYF(MY_WME | MY_ZEROFILL)))) DBUG_RETURN(-1); - table->s= &table->share_not_to_be_used; - memcpy((table->s->table_cache_key= (char*) (table+1)), key, key_length); - table->s->db= table->s->table_cache_key; - table->s->key_length=key_length; - table->in_use=thd; + table->s= (TABLE_SHARE*) (table+1); + memcpy((table->s->table_cache_key.str= (char*) (table->s+1)), key, + key_length); + table->s->table_cache_key.length= key_length; + table->s->tmp_table= INTERNAL_TMP_TABLE; // for intern_close_table + table->in_use= thd; table->locked_by_name=1; table_list->table=table; @@ -658,8 +671,17 @@ static bool locked_named_table(THD *thd, TABLE_LIST *table_list) { for (; table_list ; table_list=table_list->next_local) { - if (table_list->table && table_is_used(table_list->table,0)) - return 1; + TABLE *table= table_list->table; + if (table) + { + TABLE *save_next= table->next; + bool result; + table->next= 0; + result= table_is_used(table_list->table, 0); + table->next= save_next; + if (result) + return 1; + } } return 0; // All tables are locked } @@ -669,6 +691,7 @@ bool wait_for_locked_table_names(THD *thd, TABLE_LIST *table_list) { bool result=0; DBUG_ENTER("wait_for_locked_table_names"); + safe_mutex_assert_owner(&LOCK_open); while (locked_named_table(thd,table_list)) @@ -678,7 +701,7 @@ bool wait_for_locked_table_names(THD *thd, TABLE_LIST *table_list) result=1; break; } - wait_for_refresh(thd); + wait_for_condition(thd, &LOCK_open, &COND_refresh); pthread_mutex_lock(&LOCK_open); } DBUG_RETURN(result); @@ -814,10 +837,13 @@ static void print_lock_error(int error, const char *table) access to them is protected with a mutex LOCK_global_read_lock - (XXX: one should never take LOCK_open if LOCK_global_read_lock is taken, - otherwise a deadlock may occur - see mysql_rm_table. Other mutexes could - be a problem too - grep the code for global_read_lock if you want to use - any other mutex here) + (XXX: one should never take LOCK_open if LOCK_global_read_lock is + taken, otherwise a deadlock may occur. Other mutexes could be a + problem too - grep the code for global_read_lock if you want to use + any other mutex here) Also one must not hold LOCK_open when calling + wait_if_global_read_lock(). When the thread with the global read lock + tries to close its tables, it needs to take LOCK_open in + close_thread_table(). How blocking of threads by global read lock is achieved: that's advisory. Any piece of code which should be blocked by global read lock must @@ -936,6 +962,13 @@ bool wait_if_global_read_lock(THD *thd, bool abort_on_refresh, DBUG_ENTER("wait_if_global_read_lock"); LINT_INIT(old_message); + /* + Assert that we do not own LOCK_open. If we would own it, other + threads could not close their tables. This would make a pretty + deadlock. + */ + safe_mutex_assert_not_owner(&LOCK_open); + (void) pthread_mutex_lock(&LOCK_global_read_lock); if ((need_exit_cond= must_wait)) { @@ -1020,5 +1053,3 @@ bool make_global_read_lock_block_commit(THD *thd) thd->exit_cond(old_message); // this unlocks LOCK_global_read_lock DBUG_RETURN(error); } - - diff --git a/sql/log.cc b/sql/log.cc index c958196c466..1fc7ba1f1fd 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -77,7 +77,7 @@ handlerton binlog_hton = { NULL, /* Flush logs */ NULL, /* Show status */ NULL, /* Replication Report Sent Binlog */ - HTON_NOT_USER_SELECTABLE + HTON_NOT_USER_SELECTABLE | HTON_HIDDEN }; @@ -142,7 +142,7 @@ static int binlog_commit(THD *thd, bool all) // we're here because trans_log was flushed in MYSQL_LOG::log() DBUG_RETURN(0); } - Query_log_event qev(thd, "COMMIT", 6, TRUE, FALSE); + Query_log_event qev(thd, STRING_WITH_LEN("COMMIT"), TRUE, FALSE); DBUG_RETURN(binlog_end_trans(thd, trans_log, &qev)); } @@ -166,7 +166,7 @@ static int binlog_rollback(THD *thd, bool all) */ if (unlikely(thd->options & OPTION_STATUS_NO_TRANS_UPDATE)) { - Query_log_event qev(thd, "ROLLBACK", 8, TRUE, FALSE); + Query_log_event qev(thd, STRING_WITH_LEN("ROLLBACK"), TRUE, FALSE); error= binlog_end_trans(thd, trans_log, &qev); } else @@ -368,8 +368,7 @@ static int find_uniq_filename(char *name) MYSQL_LOG::MYSQL_LOG() :bytes_written(0), last_time(0), query_start(0), name(0), prepared_xids(0), log_type(LOG_CLOSED), file_id(1), open_count(1), - readers_count(0), reset_pending(FALSE), write_error(FALSE), inited(FALSE), - need_start_event(TRUE), + write_error(FALSE), inited(FALSE), need_start_event(TRUE), description_event_for_exec(0), description_event_for_queue(0) { /* @@ -396,9 +395,7 @@ void MYSQL_LOG::cleanup() delete description_event_for_exec; (void) pthread_mutex_destroy(&LOCK_log); (void) pthread_mutex_destroy(&LOCK_index); - (void) pthread_mutex_destroy(&LOCK_readers); (void) pthread_cond_destroy(&update_cond); - (void) pthread_cond_destroy(&reset_cond); } DBUG_VOID_RETURN; } @@ -443,9 +440,7 @@ void MYSQL_LOG::init_pthread_objects() inited= 1; (void) pthread_mutex_init(&LOCK_log,MY_MUTEX_INIT_SLOW); (void) pthread_mutex_init(&LOCK_index, MY_MUTEX_INIT_SLOW); - (void) pthread_mutex_init(&LOCK_readers, MY_MUTEX_INIT_SLOW); (void) pthread_cond_init(&update_cond, 0); - (void) pthread_cond_init(&reset_cond, 0); } const char *MYSQL_LOG::generate_name(const char *log_name, @@ -949,12 +944,6 @@ bool MYSQL_LOG::reset_logs(THD* thd) pthread_mutex_lock(&LOCK_log); pthread_mutex_lock(&LOCK_index); - /* - we need one more lock to block attempts to open a log while - we are waiting untill all log files will be closed - */ - pthread_mutex_lock(&LOCK_readers); - /* The following mutex is needed to ensure that no threads call 'delete thd' as we would then risk missing a 'rollback' from this @@ -977,19 +966,6 @@ bool MYSQL_LOG::reset_logs(THD* thd) goto err; } - reset_pending= TRUE; - /* - send update signal just in case so that all reader threads waiting - for log update will leave wait condition - */ - signal_update(); - /* - if there are active readers wait until all of them will - release opened files - */ - while (readers_count) - pthread_cond_wait(&reset_cond, &LOCK_log); - for (;;) { my_delete(linfo.log_file_name, MYF(MY_WME)); @@ -1008,10 +984,7 @@ bool MYSQL_LOG::reset_logs(THD* thd) my_free((gptr) save_name, MYF(0)); err: - reset_pending= FALSE; - (void) pthread_mutex_unlock(&LOCK_thread_count); - pthread_mutex_unlock(&LOCK_readers); pthread_mutex_unlock(&LOCK_index); pthread_mutex_unlock(&LOCK_log); DBUG_RETURN(error); @@ -1860,7 +1833,7 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache, Log_event *commit_event) */ if (thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) { - Query_log_event qinfo(thd, "BEGIN", 5, TRUE, FALSE); + Query_log_event qinfo(thd, STRING_WITH_LEN("BEGIN"), TRUE, FALSE); /* Imagine this is rollback due to net timeout, after all statements of the transaction succeeded. Then we want a zero-error code in BEGIN. @@ -2085,12 +2058,6 @@ void MYSQL_LOG::wait_for_update(THD* thd, bool is_slave) { const char *old_msg; DBUG_ENTER("wait_for_update"); - - if (reset_pending) - { - pthread_mutex_unlock(&LOCK_log); - DBUG_VOID_RETURN; - } old_msg= thd->enter_cond(&update_cond, &LOCK_log, is_slave ? @@ -2342,33 +2309,6 @@ void MYSQL_LOG::signal_update() DBUG_VOID_RETURN; } -void MYSQL_LOG::readers_addref() -{ - /* - There is no necessity for reference counting on *nix, since it allows to - delete opened files, however it is more clean way to wait - untill all files will be closed on *nix as well. - */ - DBUG_ENTER("MYSQL_LOG::reader_addref"); - pthread_mutex_lock(&LOCK_log); - pthread_mutex_lock(&LOCK_readers); - readers_count++; - pthread_mutex_unlock(&LOCK_readers); - pthread_mutex_unlock(&LOCK_log); - DBUG_VOID_RETURN; -} - -void MYSQL_LOG::readers_release() -{ - DBUG_ENTER("MYSQL_LOG::reader_release"); - pthread_mutex_lock(&LOCK_log); - readers_count--; - if (!readers_count) - pthread_cond_broadcast(&reset_cond); - pthread_mutex_unlock(&LOCK_log); - DBUG_VOID_RETURN; -} - #ifdef __NT__ void print_buffer_to_nt_eventlog(enum loglevel level, char *buff, uint length, int buffLen) diff --git a/sql/log_event.cc b/sql/log_event.cc index 081b498f01e..c8f8ff40700 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -161,7 +161,7 @@ static void cleanup_load_tmpdir() we cannot meet Start_log event in the middle of events from one LOAD DATA. */ - p= strmake(prefbuf,"SQL_LOAD-",9); + p= strmake(prefbuf, STRING_WITH_LEN("SQL_LOAD-")); p= int10_to_str(::server_id, p, 10); *(p++)= '-'; *p= 0; @@ -902,14 +902,16 @@ void Log_event::print_header(FILE* file, PRINT_EVENT_INFO* print_event_info) /* Pretty-print event common header if header is exactly 19 bytes */ if (print_event_info->common_header_len == LOG_EVENT_MINIMAL_HEADER_LEN) { + DBUG_ASSERT(hexdump_from == (unsigned long) hexdump_from); fprintf(file, "# Position Timestamp Type Master ID " "Size Master Pos Flags \n"); fprintf(file, "# %8.8lx %02x %02x %02x %02x %02x " "%02x %02x %02x %02x %02x %02x %02x %02x " "%02x %02x %02x %02x %02x %02x\n", - hexdump_from, ptr[0], ptr[1], ptr[2], ptr[3], ptr[4], - ptr[5], ptr[6], ptr[7], ptr[8], ptr[9], ptr[10], ptr[11], - ptr[12], ptr[13], ptr[14], ptr[15], ptr[16], ptr[17], ptr[18]); + (unsigned long) hexdump_from, + ptr[0], ptr[1], ptr[2], ptr[3], ptr[4], ptr[5], ptr[6], + ptr[7], ptr[8], ptr[9], ptr[10], ptr[11], ptr[12], ptr[13], + ptr[14], ptr[15], ptr[16], ptr[17], ptr[18]); ptr += LOG_EVENT_MINIMAL_HEADER_LEN; hexdump_from += LOG_EVENT_MINIMAL_HEADER_LEN; } @@ -926,8 +928,10 @@ void Log_event::print_header(FILE* file, PRINT_EVENT_INFO* print_event_info) if (i % 16 == 15) { + DBUG_ASSERT(hexdump_from == (unsigned long) hexdump_from); fprintf(file, "# %8.8lx %-48.48s |%16s|\n", - hexdump_from + (i & 0xfffffff0), hex_string, char_string); + (unsigned long) (hexdump_from + (i & 0xfffffff0)), + hex_string, char_string); hex_string[0]= 0; char_string[0]= 0; c= char_string; @@ -939,8 +943,10 @@ void Log_event::print_header(FILE* file, PRINT_EVENT_INFO* print_event_info) /* Non-full last line */ if (hex_string[0]) { - printf("# %8.8lx %-48.48s |%s|\n# ", - hexdump_from + (i & 0xfffffff0), hex_string, char_string); + DBUG_ASSERT(hexdump_from == (unsigned long) hexdump_from); + fprintf(file, "# %8.8lx %-48.48s |%s|\n# ", + (unsigned long) (hexdump_from + (i & 0xfffffff0)), + hex_string, char_string); } } } @@ -2992,7 +2998,7 @@ void Rotate_log_event::pack_info(Protocol *protocol) String tmp(buf1, sizeof(buf1), log_cs); tmp.length(0); tmp.append(new_log_ident, ident_len); - tmp.append(";pos="); + tmp.append(STRING_WITH_LEN(";pos=")); tmp.append(llstr(pos,buf)); protocol->store(tmp.ptr(), tmp.length(), &my_charset_bin); } @@ -4164,7 +4170,7 @@ int Create_file_log_event::exec_event(struct st_relay_log_info* rli) bzero((char*)&file, sizeof(file)); p = slave_load_file_stem(fname_buf, file_id, server_id); strmov(p, ".info"); // strmov takes less code than memcpy - strnmov(proc_info, "Making temp file ", 17); // no end 0 + strnmov(proc_info, STRING_WITH_LEN("Making temp file ")); // no end 0 thd->proc_info= proc_info; my_delete(fname_buf, MYF(0)); // old copy may exist already if ((fd= my_create(fname_buf, CREATE_MODE, @@ -4333,7 +4339,7 @@ int Append_block_log_event::exec_event(struct st_relay_log_info* rli) DBUG_ENTER("Append_block_log_event::exec_event"); memcpy(p, ".data", 6); - strnmov(proc_info, "Making temp file ", 17); // no end 0 + strnmov(proc_info, STRING_WITH_LEN("Making temp file ")); // no end 0 thd->proc_info= proc_info; if (get_create_or_append()) { @@ -4817,23 +4823,23 @@ Execute_load_query_log_event::exec_event(struct st_relay_log_info* rli) p= buf; memcpy(p, query, fn_pos_start); p+= fn_pos_start; - fname= (p= strmake(p, " INFILE \'", 9)); + fname= (p= strmake(p, STRING_WITH_LEN(" INFILE \'"))); p= slave_load_file_stem(p, file_id, server_id); - fname_end= (p= strmake(p, ".data", 5)); + fname_end= (p= strmake(p, STRING_WITH_LEN(".data"))); *(p++)='\''; switch (dup_handling) { case LOAD_DUP_IGNORE: - p= strmake(p, " IGNORE", 7); + p= strmake(p, STRING_WITH_LEN(" IGNORE")); break; case LOAD_DUP_REPLACE: - p= strmake(p, " REPLACE", 8); + p= strmake(p, STRING_WITH_LEN(" REPLACE")); break; default: /* Ordinary load data */ break; } - p= strmake(p, " INTO", 5); + p= strmake(p, STRING_WITH_LEN(" INTO")); p= strmake(p, query+fn_pos_end, q_len-fn_pos_end); error= Query_log_event::exec_event(rli, buf, p-buf); diff --git a/sql/my_decimal.cc b/sql/my_decimal.cc index 1bd16940b47..89607129026 100644 --- a/sql/my_decimal.cc +++ b/sql/my_decimal.cc @@ -193,16 +193,23 @@ int str2my_decimal(uint mask, const char *from, uint length, #ifndef DBUG_OFF /* routines for debugging print */ +#define DIG_PER_DEC1 9 +#define ROUND_UP(X) (((X)+DIG_PER_DEC1-1)/DIG_PER_DEC1) + /* print decimal */ void print_decimal(const my_decimal *dec) { - fprintf(DBUG_FILE, - "\nDecimal: sign: %d intg: %d frac: %d \n\ -%09d,%09d,%09d,%09d,%09d,%09d,%09d,%09d\n", - dec->sign(), dec->intg, dec->frac, - dec->buf[0], dec->buf[1], dec->buf[2], dec->buf[3], - dec->buf[4], dec->buf[5], dec->buf[6], dec->buf[7]); + int i, end; + char buff[512], *pos; + pos= buff; + pos+= my_sprintf(buff, (buff, "Decimal: sign: %d intg: %d frac: %d { ", + dec->sign(), dec->intg, dec->frac)); + end= ROUND_UP(dec->frac)+ROUND_UP(dec->intg)-1; + for (i=0; i < end; i++) + pos+= my_sprintf(pos, (pos, "%09d, ", dec->buf[i])); + pos+= my_sprintf(pos, (pos, "%09d }\n", dec->buf[i])); + fputs(buff, DBUG_FILE); } diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 90c4f52e51d..9c18fb1b8ac 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -44,6 +44,12 @@ typedef ulonglong table_map; /* Used for table bits in join */ typedef Bitmap<64> key_map; /* Used for finding keys */ typedef ulong key_part_map; /* Used for finding key parts */ +/* + Used to identify NESTED_JOIN structures within a join (applicable only to + structures that have not been simplified away and embed more the one + element) +*/ +typedef ulonglong nested_join_map; /* query_id */ typedef ulonglong query_id_t; @@ -95,6 +101,7 @@ extern CHARSET_INFO *national_charset_info, *table_alias_charset; #define MAX_FIELDS_BEFORE_HASH 32 #define USER_VARS_HASH_SIZE 16 #define STACK_MIN_SIZE 8192 // Abort if less stack during eval. +#define STACK_MIN_SIZE_FOR_OPEN 1024*80 #define STACK_BUFF_ALLOC 256 // For stack overrun checks #ifndef MYSQLD_NET_RETRY_COUNT #define MYSQLD_NET_RETRY_COUNT 10 // Abort read after this many int. @@ -519,8 +526,9 @@ bool delete_precheck(THD *thd, TABLE_LIST *tables); bool insert_precheck(THD *thd, TABLE_LIST *tables); bool create_table_precheck(THD *thd, TABLE_LIST *tables, TABLE_LIST *create_table); -bool default_view_definer(Security_context *sctx, st_lex_user *definer); +bool get_default_definer(THD *thd, LEX_USER *definer); +LEX_USER *create_definer(THD *thd, LEX_STRING *user_name, LEX_STRING *host_name); enum enum_mysql_completiontype { ROLLBACK_RELEASE=-2, ROLLBACK=1, ROLLBACK_AND_CHAIN=7, @@ -594,8 +602,8 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, int mysql_rm_table_part2_with_lock(THD *thd, TABLE_LIST *tables, bool if_exists, bool drop_temporary, bool log_query); -int quick_rm_table(enum db_type base,const char *db, - const char *table_name); +bool quick_rm_table(enum db_type base,const char *db, + const char *table_name); void close_cached_table(THD *thd, TABLE *table); bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list); bool mysql_change_db(THD *thd,const char *name,bool no_access_check); @@ -626,7 +634,10 @@ bool check_dup(const char *db, const char *name, TABLE_LIST *tables); bool table_cache_init(void); void table_cache_free(void); -uint cached_tables(void); +bool table_def_init(void); +void table_def_free(void); +uint cached_open_tables(void); +uint cached_table_definitions(void); void kill_mysql(void); void close_connection(THD *thd, uint errcode, bool lock); bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables, @@ -773,15 +784,18 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, bool reset_auto_increment); bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok); bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create); +uint create_table_def_key(THD *thd, char *key, TABLE_LIST *table_list, + bool tmp_table); +TABLE_SHARE *get_table_share(THD *thd, TABLE_LIST *table_list, char *key, + uint key_length, uint db_flags, int *error); +void release_table_share(TABLE_SHARE *share, enum release_type type); +TABLE_SHARE *get_cached_table_share(const char *db, const char *table_name); TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type update); TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT* mem, bool *refresh, uint flags); bool reopen_name_locked_table(THD* thd, TABLE_LIST* table); TABLE *find_locked_table(THD *thd, const char *db,const char *table_name); -bool reopen_table(TABLE *table,bool locked); bool reopen_tables(THD *thd,bool get_locks,bool in_refresh); -void close_old_data_files(THD *thd, TABLE *table, bool abort_locks, - bool send_refresh); bool close_data_tables(THD *thd,const char *db, const char *table_name); bool wait_for_tables(THD *thd); bool table_is_used(TABLE *table, bool wait_for_name_lock); @@ -857,11 +871,16 @@ int mysqld_show_variables(THD *thd,const char *wild); int mysql_find_files(THD *thd,List *files, const char *db, const char *path, const char *wild, bool dir); bool mysqld_show_storage_engines(THD *thd); +bool mysqld_show_authors(THD *thd); bool mysqld_show_privileges(THD *thd); bool mysqld_show_column_types(THD *thd); bool mysqld_help (THD *thd, const char *text); void calc_sum_of_all_status(STATUS_VAR *to); +void append_definer(THD *thd, String *buffer, const LEX_STRING *definer_user, + const LEX_STRING *definer_host); + + /* information schema */ extern LEX_STRING information_schema_name; LEX_STRING *make_lex_string(THD *thd, LEX_STRING *lex_str, @@ -900,7 +919,8 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen); bool mysql_ha_close(THD *thd, TABLE_LIST *tables); bool mysql_ha_read(THD *, TABLE_LIST *,enum enum_ha_read_modes,char *, List *,enum ha_rkey_function,Item *,ha_rows,ha_rows); -int mysql_ha_flush(THD *thd, TABLE_LIST *tables, uint mode_flags); +int mysql_ha_flush(THD *thd, TABLE_LIST *tables, uint mode_flags, + bool is_locked); /* mysql_ha_flush mode_flags bits */ #define MYSQL_HA_CLOSE_FINAL 0x00 #define MYSQL_HA_REOPEN_ON_USAGE 0x01 @@ -972,7 +992,8 @@ int setup_conds(THD *thd, TABLE_LIST *tables, TABLE_LIST *leaves, COND **conds); int setup_ftfuncs(SELECT_LEX* select); int init_ftfuncs(THD *thd, SELECT_LEX* select, bool no_order); -void wait_for_refresh(THD *thd); +void wait_for_condition(THD *thd, pthread_mutex_t *mutex, + pthread_cond_t *cond); int open_tables(THD *thd, TABLE_LIST **tables, uint *counter, uint flags); int simple_open_n_lock_tables(THD *thd,TABLE_LIST *tables); bool open_and_lock_tables(THD *thd,TABLE_LIST *tables); @@ -991,9 +1012,12 @@ TABLE_LIST *find_table_in_list(TABLE_LIST *table, const char *db_name, const char *table_name); TABLE_LIST *unique_table(TABLE_LIST *table, TABLE_LIST *table_list); -TABLE **find_temporary_table(THD *thd, const char *db, const char *table_name); -bool close_temporary_table(THD *thd, const char *db, const char *table_name); -void close_temporary(TABLE *table, bool delete_table); +TABLE *find_temporary_table(THD *thd, const char *db, const char *table_name); +TABLE *find_temporary_table(THD *thd, TABLE_LIST *table_list); +bool close_temporary_table(THD *thd, TABLE_LIST *table_list); +void close_temporary_table(THD *thd, TABLE *table, bool free_share, + bool delete_table); +void close_temporary(TABLE *table, bool free_share, bool delete_table); bool rename_temporary_table(THD* thd, TABLE *table, const char *new_db, const char *table_name); void remove_db_from_cache(const char *db); @@ -1072,7 +1096,7 @@ void print_plan(JOIN* join, double read_time, double record_count, #endif void mysql_print_status(); /* key.cc */ -int find_ref_key(TABLE *form,Field *field, uint *offset); +int find_ref_key(KEY *key, uint key_count, Field *field, uint *key_length); void key_copy(byte *to_key, byte *from_record, KEY *key_info, uint key_length); void key_restore(byte *to_record, byte *from_key, KEY *key_info, uint key_length); @@ -1162,7 +1186,7 @@ extern ulong delayed_rows_in_use,delayed_insert_errors; extern ulong slave_open_temp_tables; extern ulong query_cache_size, query_cache_min_res_unit; extern ulong slow_launch_threads, slow_launch_time; -extern ulong table_cache_size; +extern ulong table_cache_size, table_def_size; extern ulong max_connections,max_connect_errors, connect_timeout; extern ulong slave_net_timeout, slave_trans_retries; extern uint max_user_connections; @@ -1191,14 +1215,14 @@ extern bool volatile abort_loop, shutdown_in_progress, grant_option; extern bool mysql_proc_table_exists; extern uint volatile thread_count, thread_running, global_read_lock; extern my_bool opt_sql_bin_update, opt_safe_user_create, opt_no_mix_types; -extern my_bool opt_safe_show_db, opt_local_infile; +extern my_bool opt_safe_show_db, opt_local_infile, opt_myisam_use_mmap; extern my_bool opt_slave_compressed_protocol, use_temp_pool; extern my_bool opt_readonly, lower_case_file_system; extern my_bool opt_enable_named_pipe, opt_sync_frm, opt_allow_suspicious_udfs; extern my_bool opt_secure_auth; extern my_bool opt_log_slow_admin_statements; extern my_bool sp_automatic_privileges, opt_noacl; -extern my_bool opt_old_style_user_limits, trust_routine_creators; +extern my_bool opt_old_style_user_limits, trust_function_creators; extern uint opt_crash_binlog_innodb; extern char *shared_memory_base_name, *mysqld_unix_port; extern my_bool opt_enable_shared_memory; @@ -1357,23 +1381,36 @@ void unlock_table_names(THD *thd, TABLE_LIST *table_list, void unireg_init(ulong options); void unireg_end(void); -bool mysql_create_frm(THD *thd, my_string file_name, +bool mysql_create_frm(THD *thd, const char *file_name, const char *db, const char *table, HA_CREATE_INFO *create_info, List &create_field, uint key_count,KEY *key_info,handler *db_type); -int rea_create_table(THD *thd, my_string file_name, - const char *db, const char *table, +int rea_create_table(THD *thd, const char *path, + const char *db, const char *table_name, HA_CREATE_INFO *create_info, - List &create_field, - uint key_count,KEY *key_info, handler *file); + List &create_field, + uint key_count,KEY *key_info, + handler *file); int format_number(uint inputflag,uint max_length,my_string pos,uint length, my_string *errpos); + +/* table.cc */ +TABLE_SHARE *alloc_table_share(TABLE_LIST *table_list, char *key, + uint key_length); +void init_tmp_table_share(TABLE_SHARE *share, const char *key, uint key_length, + const char *table_name, const char *path); +void free_table_share(TABLE_SHARE *share); +int open_table_def(THD *thd, TABLE_SHARE *share, uint db_flags); +void open_table_error(TABLE_SHARE *share, int error, int db_errno, int errarg); +int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias, + uint db_stat, uint prgflag, uint ha_open_flags, + TABLE *outparam); int openfrm(THD *thd, const char *name,const char *alias,uint filestat, uint prgflag, uint ha_open_flags, TABLE *outparam); int readfrm(const char *name, const void** data, uint* length); int writefrm(const char* name, const void* data, uint len); -int closefrm(TABLE *table); +int closefrm(TABLE *table, bool free_share); int read_string(File file, gptr *to, uint length); void free_blobs(TABLE *table); int set_zone(int nr,int min_zone,int max_zone); @@ -1426,14 +1463,14 @@ int calc_weekday(long daynr,bool sunday_first_day_of_week); uint calc_week(TIME *l_time, uint week_behaviour, uint *year); void find_date(char *pos,uint *vek,uint flag); TYPELIB *convert_strings_to_array_type(my_string *typelibs, my_string *end); -TYPELIB *typelib(List &strings); +TYPELIB *typelib(MEM_ROOT *mem_root, List &strings); ulong get_form_pos(File file, uchar *head, TYPELIB *save_names); ulong make_new_entry(File file,uchar *fileinfo,TYPELIB *formnames, const char *newname); ulong next_io_size(ulong pos); void append_unescaped(String *res, const char *pos, uint length); -int create_frm(THD *thd, char *name, const char *db, const char *table, - uint reclength,uchar *fileinfo, +int create_frm(THD *thd, const char *name, const char *db, const char *table, + uint reclength, uchar *fileinfo, HA_CREATE_INFO *create_info, uint keys); void update_create_info_from_table(HA_CREATE_INFO *info, TABLE *form); int rename_file_ext(const char * from,const char * to,const char * ext); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index b039ce9c3d9..fe72341b254 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -356,8 +356,10 @@ extern ulong innobase_large_page_size; extern char *innobase_home, *innobase_tmpdir, *innobase_logdir; extern long innobase_lock_scan_time; extern long innobase_mirrored_log_groups, innobase_log_files_in_group; -extern long innobase_log_file_size, innobase_log_buffer_size; -extern long innobase_buffer_pool_size, innobase_additional_mem_pool_size; +extern longlong innobase_log_file_size; +extern long innobase_log_buffer_size; +extern longlong innobase_buffer_pool_size; +extern long innobase_additional_mem_pool_size; extern long innobase_buffer_pool_awe_mem_mb; extern long innobase_file_io_threads, innobase_lock_wait_timeout; extern long innobase_force_recovery; @@ -390,11 +392,16 @@ extern ulong srv_commit_concurrency; } #endif #ifdef WITH_BERKELEY_STORAGE_ENGINE +#ifndef HAVE_U_INT32_T +typedef unsigned int u_int32_t; +#endif extern const u_int32_t bdb_DB_TXN_NOSYNC, bdb_DB_RECOVER, bdb_DB_PRIVATE; extern bool berkeley_shared_data; extern u_int32_t berkeley_init_flags,berkeley_env_flags, berkeley_lock_type, berkeley_lock_types[]; -extern ulong berkeley_cache_size, berkeley_max_lock, berkeley_log_buffer_size; +extern ulong berkeley_max_lock, berkeley_log_buffer_size; +extern ulonglong berkeley_cache_size; +extern ulong berkeley_region_size, berkeley_cache_parts; extern char *berkeley_home, *berkeley_tmpdir, *berkeley_logdir; extern long berkeley_lock_scan_time; extern TYPELIB berkeley_lock_typelib; @@ -421,8 +428,9 @@ my_bool opt_secure_auth= 0; my_bool opt_log_slow_admin_statements= 0; my_bool lower_case_file_system= 0; my_bool opt_large_pages= 0; +my_bool opt_myisam_use_mmap= 0; uint opt_large_page_size= 0; -my_bool opt_old_style_user_limits= 0, trust_routine_creators= 0; +my_bool opt_old_style_user_limits= 0, trust_function_creators= 0; /* True if there is at least one per-hour limit for some user, so we should check them before each query (and possibly reset counters when hour is @@ -442,7 +450,8 @@ uint tc_heuristic_recover= 0; uint volatile thread_count, thread_running; ulonglong thd_startup_options; ulong back_log, connect_timeout, concurrency, server_id; -ulong table_cache_size, thread_stack, what_to_log; +ulong table_cache_size, table_def_size; +ulong thread_stack, what_to_log; ulong query_buff_size, slow_launch_time, slave_open_temp_tables; ulong open_files_limit, max_binlog_size, max_relay_log_size; ulong slave_net_timeout, slave_trans_retries; @@ -545,6 +554,8 @@ pthread_cond_t COND_server_started; int mysqld_server_started= 0; +File_parser_dummy_hook file_parser_dummy_hook; + /* replication parameters, if master_host is not NULL, we are a slave */ uint master_port= MYSQL_PORT, master_connect_retry = 60; uint report_port= MYSQL_PORT; @@ -613,7 +624,7 @@ bool mysqld_embedded=1; static const char* default_dbug_option; #endif #ifdef HAVE_LIBWRAP -char *libwrapName= NULL; +const char *libwrapName= NULL; #endif #ifdef HAVE_QUERY_CACHE static ulong query_cache_limit= 0; @@ -1106,6 +1117,7 @@ void clean_up(bool print_message) #endif query_cache_destroy(); table_cache_free(); + table_def_free(); hostname_cache_free(); item_user_lock_free(); lex_free(); /* Free some memory */ @@ -1404,7 +1416,7 @@ static void network_init(void) struct sockaddr_un UNIXaddr; #endif int arg=1; - DBUG_ENTER("server_init"); + DBUG_ENTER("network_init"); set_ports(); @@ -1636,6 +1648,7 @@ void end_thread(THD *thd, bool put_in_cache) wake_thread--; thd=thread_cache.get(); thd->real_id=pthread_self(); + thd->thread_stack= (char *) &thd; (void) thd->store_globals(); thd->thr_create_time= time(NULL); threads.append(thd); @@ -2768,7 +2781,7 @@ static int init_thread_environment() { (void) pthread_mutex_init(&LOCK_mysql_create_db,MY_MUTEX_INIT_SLOW); (void) pthread_mutex_init(&LOCK_Acl,MY_MUTEX_INIT_SLOW); - (void) pthread_mutex_init(&LOCK_open,MY_MUTEX_INIT_FAST); + (void) pthread_mutex_init(&LOCK_open, NULL); (void) pthread_mutex_init(&LOCK_thread_count,MY_MUTEX_INIT_FAST); (void) pthread_mutex_init(&LOCK_mapped_file,MY_MUTEX_INIT_SLOW); (void) pthread_mutex_init(&LOCK_status,MY_MUTEX_INIT_FAST); @@ -2930,7 +2943,11 @@ static void init_ssl() static int init_server_components() { DBUG_ENTER("init_server_components"); - if (table_cache_init() || hostname_cache_init()) + /* + We need to call each of these following functions to ensure that + all things are initialized so that unireg_abort() doesn't fail + */ + if (table_cache_init() | table_def_init() | hostname_cache_init()) unireg_abort(1); query_cache_result_size_limit(query_cache_limit); @@ -3372,9 +3389,7 @@ int main(int argc, char **argv) */ check_data_home(mysql_real_data_home); if (my_setwd(mysql_real_data_home,MYF(MY_WME))) - { unireg_abort(1); /* purecov: inspected */ - } mysql_data_home= mysql_data_home_buff; mysql_data_home[0]=FN_CURLIB; // all paths are relative from here mysql_data_home[1]=0; @@ -3389,7 +3404,6 @@ int main(int argc, char **argv) set_user(mysqld_user, user_info); } - if (opt_bin_log && !server_id) { server_id= !master_host ? 1 : 2; @@ -3411,7 +3425,7 @@ we force server id to 2, but this MySQL server will not act as a slave."); } if (init_server_components()) - exit(1); + unireg_abort(1); network_init(); @@ -3587,8 +3601,8 @@ static char *add_quoted_string(char *to, const char *from, char *to_end) uint length= (uint) (to_end-to); if (!strchr(from, ' ')) - return strnmov(to, from, length); - return strxnmov(to, length, "\"", from, "\"", NullS); + return strmake(to, from, length-1); + return strxnmov(to, length-1, "\"", from, "\"", NullS); } @@ -4499,7 +4513,7 @@ enum options_mysqld OPT_INNODB_FAST_SHUTDOWN, OPT_INNODB_FILE_PER_TABLE, OPT_CRASH_BINLOG_INNODB, OPT_INNODB_LOCKS_UNSAFE_FOR_BINLOG, - OPT_LOG_BIN_TRUST_ROUTINE_CREATORS, + OPT_LOG_BIN_TRUST_FUNCTION_CREATORS, OPT_SAFE_SHOW_DB, OPT_INNODB_SAFE_BINLOG, OPT_INNODB, OPT_ISAM, OPT_ENGINE_CONDITION_PUSHDOWN, @@ -4545,6 +4559,7 @@ enum options_mysqld OPT_MAX_ERROR_COUNT, OPT_MULTI_RANGE_COUNT, OPT_MYISAM_DATA_POINTER_SIZE, OPT_MYISAM_BLOCK_SIZE, OPT_MYISAM_MAX_EXTRA_SORT_FILE_SIZE, OPT_MYISAM_MAX_SORT_FILE_SIZE, OPT_MYISAM_SORT_BUFFER_SIZE, + OPT_MYISAM_USE_MMAP, OPT_MYISAM_STATS_METHOD, OPT_NET_BUFFER_LENGTH, OPT_NET_RETRY_COUNT, OPT_NET_READ_TIMEOUT, OPT_NET_WRITE_TIMEOUT, @@ -4556,7 +4571,7 @@ enum options_mysqld OPT_RELAY_LOG_PURGE, OPT_SLAVE_NET_TIMEOUT, OPT_SLAVE_COMPRESSED_PROTOCOL, OPT_SLOW_LAUNCH_TIME, OPT_SLAVE_TRANS_RETRIES, OPT_READONLY, OPT_DEBUGGING, - OPT_SORT_BUFFER, OPT_TABLE_CACHE, + OPT_SORT_BUFFER, OPT_TABLE_OPEN_CACHE, OPT_TABLE_DEF_CACHE, OPT_THREAD_CONCURRENCY, OPT_THREAD_CACHE_SIZE, OPT_TMP_TABLE_SIZE, OPT_THREAD_STACK, OPT_WAIT_TIMEOUT, OPT_MYISAM_REPAIR_THREADS, @@ -4582,8 +4597,10 @@ enum options_mysqld OPT_INNODB_CONCURRENCY_TICKETS, OPT_INNODB_THREAD_SLEEP_DELAY, OPT_BDB_CACHE_SIZE, + OPT_BDB_CACHE_PARTS, OPT_BDB_LOG_BUFFER_SIZE, OPT_BDB_MAX_LOCK, + OPT_BDB_REGION_SIZE, OPT_ERROR_LOG_FILE, OPT_DEFAULT_WEEK_FORMAT, OPT_RANGE_ALLOC_BLOCK_SIZE, OPT_ALLOW_SUSPICIOUS_UDFS, @@ -4614,6 +4631,7 @@ enum options_mysqld OPT_OPTIMIZER_PRUNE_LEVEL, OPT_UPDATABLE_VIEWS_WITH_LIMIT, OPT_SP_AUTOMATIC_PRIVILEGES, + OPT_MAX_SP_RECURSION_DEPTH, OPT_AUTO_INCREMENT, OPT_AUTO_INCREMENT_OFFSET, OPT_ENABLE_LARGE_PAGES, OPT_TIMED_MUTEXES, @@ -4929,16 +4947,27 @@ Disable with --skip-innodb-doublewrite.", (gptr*) &innobase_use_doublewrite, "File that holds the names for last binary log files.", (gptr*) &opt_binlog_index_name, (gptr*) &opt_binlog_index_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, +#ifndef TO_BE_REMOVED_IN_5_1_OR_6_0 + /* + In 5.0.6 we introduced the below option, then in 5.0.16 we renamed it to + log-bin-trust-function-creators but kept also the old name for + compatibility; the behaviour was also changed to apply only to functions + (and triggers). In a future release this old name could be removed. + */ + {"log-bin-trust-routine-creators", OPT_LOG_BIN_TRUST_FUNCTION_CREATORS, + "(deprecated) Use log-bin-trust-function-creators.", + (gptr*) &trust_function_creators, (gptr*) &trust_function_creators, 0, + GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, +#endif /* This option starts with "log-bin" to emphasize that it is specific of - binary logging. Hopefully in 5.1 nobody will need it anymore, when we have - row-level binlog. + binary logging. */ - {"log-bin-trust-routine-creators", OPT_LOG_BIN_TRUST_ROUTINE_CREATORS, + {"log-bin-trust-function-creators", OPT_LOG_BIN_TRUST_FUNCTION_CREATORS, "If equal to 0 (the default), then when --log-bin is used, creation of " - "a routine is allowed only to users having the SUPER privilege and only" - "if this routine may not break binary logging", - (gptr*) &trust_routine_creators, (gptr*) &trust_routine_creators, 0, + "a function is allowed only to users having the SUPER privilege and only " + "if this function may not break binary logging.", + (gptr*) &trust_function_creators, (gptr*) &trust_function_creators, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"log-error", OPT_ERROR_LOG_FILE, "Error log file.", (gptr*) &log_error_file_ptr, (gptr*) &log_error_file_ptr, 0, GET_STR, @@ -5085,7 +5114,7 @@ Disable with --skip-ndbcluster (will save memory).", (gptr*) &global_system_variables.ndb_autoincrement_prefetch_sz, (gptr*) &global_system_variables.ndb_autoincrement_prefetch_sz, 0, GET_ULONG, REQUIRED_ARG, 32, 1, 256, 0, 0, 0}, - {"ndb-distibution", OPT_NDB_DISTRIBUTION, + {"ndb-distribution", OPT_NDB_DISTRIBUTION, "Default distribution for new tables in ndb", (gptr*) &opt_ndb_distribution, (gptr*) &opt_ndb_distribution, @@ -5396,10 +5425,14 @@ log and this option does nothing anymore.", (gptr*) &back_log, (gptr*) &back_log, 0, GET_ULONG, REQUIRED_ARG, 50, 1, 65535, 0, 1, 0 }, #ifdef WITH_BERKELEY_STORAGE_ENGINE + { "bdb_cache_parts", OPT_BDB_CACHE_PARTS, + "Number of parts to use for BDB cache.", + (gptr*) &berkeley_cache_parts, (gptr*) &berkeley_cache_parts, 0, GET_ULONG, + REQUIRED_ARG, 1, 1, 1024, 0, 1, 0}, { "bdb_cache_size", OPT_BDB_CACHE_SIZE, "The buffer that is allocated to cache index and rows for BDB tables.", - (gptr*) &berkeley_cache_size, (gptr*) &berkeley_cache_size, 0, GET_ULONG, - REQUIRED_ARG, KEY_CACHE_SIZE, 20*1024, (long) ~0, 0, IO_SIZE, 0}, + (gptr*) &berkeley_cache_size, (gptr*) &berkeley_cache_size, 0, GET_ULL, + REQUIRED_ARG, KEY_CACHE_SIZE, 20*1024, (ulonglong) ~0, 0, IO_SIZE, 0}, /* QQ: The following should be removed soon! (bdb_max_lock preferred) */ {"bdb_lock_max", OPT_BDB_MAX_LOCK, "Synonym for bdb_max_lock.", (gptr*) &berkeley_max_lock, (gptr*) &berkeley_max_lock, 0, GET_ULONG, @@ -5412,6 +5445,10 @@ log and this option does nothing anymore.", "The maximum number of locks you can have active on a BDB table.", (gptr*) &berkeley_max_lock, (gptr*) &berkeley_max_lock, 0, GET_ULONG, REQUIRED_ARG, 10000, 0, (long) ~0, 0, 1, 0}, + {"bdb_region_size", OPT_BDB_REGION_SIZE, + "The size of the underlying logging area of the Berkeley DB environment.", + (gptr*) &berkeley_region_size, (gptr*) &berkeley_region_size, 0, GET_ULONG, + OPT_ARG, 60*1024L, 60*1024L, (long) ~0, 0, 1, 0}, #endif /* WITH_BERKELEY_STORAGE_ENGINE */ {"binlog_cache_size", OPT_BINLOG_CACHE_SIZE, "The size of the cache to hold the SQL statements for the binary log during a transaction. If you often use big, multi-statement transactions you can increase this to get more performance.", @@ -5506,7 +5543,8 @@ log and this option does nothing anymore.", {"innodb_buffer_pool_size", OPT_INNODB_BUFFER_POOL_SIZE, "The size of the memory buffer InnoDB uses to cache data and indexes of its tables.", (gptr*) &innobase_buffer_pool_size, (gptr*) &innobase_buffer_pool_size, 0, - GET_LONG, REQUIRED_ARG, 8*1024*1024L, 1024*1024L, ~0L, 0, 1024*1024L, 0}, + GET_LL, REQUIRED_ARG, 8*1024*1024L, 1024*1024L, LONGLONG_MAX, 0, + 1024*1024L, 0}, {"innodb_concurrency_tickets", OPT_INNODB_CONCURRENCY_TICKETS, "Number of times a thread is allowed to enter InnoDB within the same \ SQL query after it has once got the ticket", @@ -5530,9 +5568,10 @@ log and this option does nothing anymore.", (gptr*) &innobase_log_buffer_size, (gptr*) &innobase_log_buffer_size, 0, GET_LONG, REQUIRED_ARG, 1024*1024L, 256*1024L, ~0L, 0, 1024, 0}, {"innodb_log_file_size", OPT_INNODB_LOG_FILE_SIZE, - "Size of each log file in a log group in megabytes.", + "Size of each log file in a log group.", (gptr*) &innobase_log_file_size, (gptr*) &innobase_log_file_size, 0, - GET_LONG, REQUIRED_ARG, 5*1024*1024L, 1*1024*1024L, ~0L, 0, 1024*1024L, 0}, + GET_LL, REQUIRED_ARG, 5*1024*1024L, 1*1024*1024L, LONGLONG_MAX, 0, + 1024*1024L, 0}, {"innodb_log_files_in_group", OPT_INNODB_LOG_FILES_IN_GROUP, "Number of log files in the log group. InnoDB writes to the files in a circular fashion. Value 3 is recommended here.", (gptr*) &innobase_log_files_in_group, (gptr*) &innobase_log_files_in_group, @@ -5730,6 +5769,11 @@ The minimum value for this variable is 4096.", (gptr*) &global_system_variables.myisam_sort_buff_size, (gptr*) &max_system_variables.myisam_sort_buff_size, 0, GET_ULONG, REQUIRED_ARG, 8192*1024, 4, ~0L, 0, 1, 0}, + {"myisam_use_mmap", OPT_MYISAM_USE_MMAP, + "Use memory mapping for reading and writing MyISAM tables", + (gptr*) &opt_myisam_use_mmap, + (gptr*) &opt_myisam_use_mmap, 0, GET_BOOL, NO_ARG, 0, + 0, 0, 0, 0, 0}, {"myisam_stats_method", OPT_MYISAM_STATS_METHOD, "Specifies how MyISAM index statistics collection code should threat NULLs. " "Possible values of name are \"nulls_unequal\" (default behavior for 4.1/5.0), " @@ -5828,7 +5872,7 @@ The minimum value for this variable is 4096.", (gptr*) &max_system_variables.read_buff_size,0, GET_ULONG, REQUIRED_ARG, 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ~0L, MALLOC_OVERHEAD, IO_SIZE, 0}, {"read_only", OPT_READONLY, - "Make all tables readonly, with the exception for replication (slave) threads and users with the SUPER privilege", + "Make all non-temporary tables read-only, with the exception for replication (slave) threads and users with the SUPER privilege", (gptr*) &opt_readonly, (gptr*) &opt_readonly, 0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0}, @@ -5848,6 +5892,11 @@ The minimum value for this variable is 4096.", (gptr*) &global_system_variables.read_buff_size, (gptr*) &max_system_variables.read_buff_size,0, GET_ULONG, REQUIRED_ARG, 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ~0L, MALLOC_OVERHEAD, IO_SIZE, 0}, + {"max_sp_recursion_depth", OPT_MAX_SP_RECURSION_DEPTH, + "Maximum stored procedure recursion depth. (discussed with docs).", + (gptr*) &global_system_variables.max_sp_recursion_depth, + (gptr*) &max_system_variables.max_sp_recursion_depth, 0, GET_ULONG, + OPT_ARG, 0, 0, 255, 0, 1, 0 }, #ifdef HAVE_REPLICATION {"relay_log_purge", OPT_RELAY_LOG_PURGE, "0 = do not purge relay logs. 1 = purge them as soon as they are no more needed.", @@ -5916,13 +5965,21 @@ The minimum value for this variable is 4096.", (gptr*) &global_system_variables.sync_replication_timeout, 0, GET_ULONG, REQUIRED_ARG, 10, 0, ~0L, 0, 1, 0}, #endif /* HAVE_REPLICATION */ - {"table_cache", OPT_TABLE_CACHE, - "The number of open tables for all threads.", (gptr*) &table_cache_size, - (gptr*) &table_cache_size, 0, GET_ULONG, REQUIRED_ARG, 64, 1, 512*1024L, - 0, 1, 0}, - {"table_lock_wait_timeout", OPT_TABLE_LOCK_WAIT_TIMEOUT, "Timeout in " - "seconds to wait for a table level lock before returning an error. Used" - " only if the connection has active cursors.", + {"table_cache", OPT_TABLE_OPEN_CACHE, + "Deprecated; use --table_open_cache instead.", + (gptr*) &table_cache_size, (gptr*) &table_cache_size, 0, GET_ULONG, + REQUIRED_ARG, 64, 1, 512*1024L, 0, 1, 0}, + {"table_definition_cache", OPT_TABLE_DEF_CACHE, + "The number of cached table definitions.", + (gptr*) &table_def_size, (gptr*) &table_def_size, + 0, GET_ULONG, REQUIRED_ARG, 128, 1, 512*1024L, 0, 1, 0}, + {"table_open_cache", OPT_TABLE_OPEN_CACHE, + "The number of cached open tables.", + (gptr*) &table_cache_size, (gptr*) &table_cache_size, + 0, GET_ULONG, REQUIRED_ARG, 64, 1, 512*1024L, 0, 1, 0}, + {"table_lock_wait_timeout", OPT_TABLE_LOCK_WAIT_TIMEOUT, + "Timeout in seconds to wait for a table level lock before returning an " + "error. Used only if the connection has active cursors.", (gptr*) &table_lock_wait_timeout, (gptr*) &table_lock_wait_timeout, 0, GET_ULONG, REQUIRED_ARG, 50, 1, 1024 * 1024 * 1024, 0, 1, 0}, {"thread_cache_size", OPT_THREAD_CACHE_SIZE, @@ -6122,7 +6179,8 @@ struct show_var_st status_vars[]= { {"Not_flushed_delayed_rows", (char*) &delayed_rows_in_use, SHOW_LONG_CONST}, {"Open_files", (char*) &my_file_opened, SHOW_LONG_CONST}, {"Open_streams", (char*) &my_stream_opened, SHOW_LONG_CONST}, - {"Open_tables", (char*) 0, SHOW_OPENTABLES}, + {"Open_table_definitions", (char*) 0, SHOW_TABLE_DEFINITIONS}, + {"Open_tables", (char*) 0, SHOW_OPEN_TABLES}, {"Opened_tables", (char*) offsetof(STATUS_VAR, opened_tables), SHOW_LONG_STATUS}, #ifdef HAVE_QUERY_CACHE {"Qcache_free_blocks", (char*) &query_cache.free_memory_blocks, SHOW_LONG_CONST}, @@ -6953,8 +7011,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), case OPT_MYISAM_STATS_METHOD: { ulong method_conv; - myisam_stats_method_str= argument; int method; + LINT_INIT(method_conv); + + myisam_stats_method_str= argument; if ((method=find_type(argument, &myisam_stats_method_typelib, 2)) <= 0) { fprintf(stderr, "Invalid value of myisam_stats_method: %s.\n", argument); @@ -7410,7 +7470,9 @@ SHOW_COMP_OPTION have_blackhole_db= SHOW_OPTION_NO; #ifndef WITH_BERKELEY_STORAGE_ENGINE bool berkeley_shared_data; -ulong berkeley_cache_size, berkeley_max_lock, berkeley_log_buffer_size; +ulong berkeley_max_lock, berkeley_log_buffer_size; +ulonglong berkeley_cache_size; +ulong berkeley_region_size, berkeley_cache_parts; char *berkeley_home, *berkeley_tmpdir, *berkeley_logdir; #endif @@ -7418,8 +7480,10 @@ char *berkeley_home, *berkeley_tmpdir, *berkeley_logdir; uint innobase_flush_log_at_trx_commit; ulong innobase_fast_shutdown; long innobase_mirrored_log_groups, innobase_log_files_in_group; -long innobase_log_file_size, innobase_log_buffer_size; -long innobase_buffer_pool_size, innobase_additional_mem_pool_size; +longlong innobase_log_file_size; +long innobase_log_buffer_size; +longlong innobase_buffer_pool_size; +long innobase_additional_mem_pool_size; long innobase_buffer_pool_awe_mem_mb; long innobase_file_io_threads, innobase_lock_wait_timeout; long innobase_force_recovery; diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 2400672a3f9..625a956eea2 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -910,6 +910,7 @@ int QUICK_ROR_INTERSECT_SELECT::init() int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler) { handler *save_file= file; + THD *thd; DBUG_ENTER("QUICK_RANGE_SELECT::init_ror_merged_scan"); if (reuse_handler) @@ -931,11 +932,12 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler) DBUG_RETURN(0); } - THD *thd= current_thd; - if (!(file= get_new_handler(head, thd->mem_root, head->s->db_type))) + thd= head->in_use; + if (!(file= get_new_handler(head->s, thd->mem_root, head->s->db_type))) goto failure; DBUG_PRINT("info", ("Allocated new handler %p", file)); - if (file->ha_open(head->s->path, head->db_stat, HA_OPEN_IGNORE_IF_LOCKED)) + if (file->ha_open(head, head->s->normalized_path.str, head->db_stat, + HA_OPEN_IGNORE_IF_LOCKED)) { /* Caller will free the memory */ goto failure; @@ -1652,11 +1654,10 @@ public: static int fill_used_fields_bitmap(PARAM *param) { TABLE *table= param->table; - param->fields_bitmap_size= (table->s->fields/8 + 1); + param->fields_bitmap_size= bitmap_buffer_size(table->s->fields+1); uint32 *tmp; uint pk; - if (!(tmp= (uint32*)alloc_root(param->mem_root, - bytes_word_aligned(param->fields_bitmap_size))) || + if (!(tmp= (uint32*) alloc_root(param->mem_root,param->fields_bitmap_size)) || bitmap_init(¶m->needed_fields, tmp, param->fields_bitmap_size*8, FALSE)) return 1; @@ -2415,7 +2416,7 @@ ROR_SCAN_INFO *make_ror_scan(const PARAM *param, int idx, SEL_ARG *sel_arg) ror_scan->records= param->table->quick_rows[keynr]; if (!(bitmap_buf= (uint32*)alloc_root(param->mem_root, - bytes_word_aligned(param->fields_bitmap_size)))) + param->fields_bitmap_size))) DBUG_RETURN(NULL); if (bitmap_init(&ror_scan->covered_fields, bitmap_buf, @@ -2535,7 +2536,7 @@ ROR_INTERSECT_INFO* ror_intersect_init(const PARAM *param) return NULL; info->param= param; if (!(buf= (uint32*)alloc_root(param->mem_root, - bytes_word_aligned(param->fields_bitmap_size)))) + param->fields_bitmap_size))) return NULL; if (bitmap_init(&info->covered_fields, buf, param->fields_bitmap_size*8, FALSE)) @@ -3141,10 +3142,10 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param, /* F=F-covered by first(I) */ bitmap_union(&covered_fields, &(*ror_scan_mark)->covered_fields); all_covered= bitmap_is_subset(¶m->needed_fields, &covered_fields); - } while (!all_covered && (++ror_scan_mark < ror_scans_end)); - - if (!all_covered) - DBUG_RETURN(NULL); /* should not happen actually */ + } while ((++ror_scan_mark < ror_scans_end) && !all_covered); + + if (!all_covered || (ror_scan_mark - tree->ror_scans) == 1) + DBUG_RETURN(NULL); /* Ok, [tree->ror_scans .. ror_scan) holds covering index_intersection with @@ -5764,10 +5765,17 @@ QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table, MEM_ROOT *old_root= thd->mem_root; /* The following call may change thd->mem_root */ QUICK_RANGE_SELECT *quick= new QUICK_RANGE_SELECT(thd, table, ref->key, 0); + /* save mem_root set by QUICK_RANGE_SELECT constructor */ + MEM_ROOT *alloc= thd->mem_root; KEY *key_info = &table->key_info[ref->key]; KEY_PART *key_part; QUICK_RANGE *range; uint part; + /* + return back default mem_root (thd->mem_root) changed by + QUICK_RANGE_SELECT constructor + */ + thd->mem_root= old_root; if (!quick) return 0; /* no ranges found */ @@ -5779,7 +5787,7 @@ QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table, quick->records= records; if (cp_buffer_from_ref(thd,ref) && thd->is_fatal_error || - !(range= new QUICK_RANGE())) + !(range= new(alloc) QUICK_RANGE())) goto err; // out of memory range->min_key=range->max_key=(char*) ref->key_buff; @@ -5814,20 +5822,20 @@ QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table, QUICK_RANGE *null_range; *ref->null_ref_key= 1; // Set null byte then create a range - if (!(null_range= new QUICK_RANGE((char*)ref->key_buff, ref->key_length, - (char*)ref->key_buff, ref->key_length, - EQ_RANGE))) + if (!(null_range= new (alloc) QUICK_RANGE((char*)ref->key_buff, + ref->key_length, + (char*)ref->key_buff, + ref->key_length, + EQ_RANGE))) goto err; *ref->null_ref_key= 0; // Clear null byte if (insert_dynamic(&quick->ranges,(gptr)&null_range)) goto err; } - thd->mem_root= old_root; return quick; err: - thd->mem_root= old_root; delete quick; return 0; } @@ -6195,6 +6203,14 @@ int QUICK_RANGE_SELECT::reset() multi_range_buff->buffer= mrange_buff; multi_range_buff->buffer_end= mrange_buff + mrange_bufsiz; multi_range_buff->end_of_used_area= mrange_buff; +#ifdef HAVE_purify + /* + We need this until ndb will use the buffer efficiently + (Now ndb stores complete row in here, instead of only the used fields + which gives us valgrind warnings in compare_record[]) + */ + bzero((char*) mrange_buff, mrange_bufsiz); +#endif } DBUG_RETURN(0); } @@ -6689,7 +6705,7 @@ void QUICK_INDEX_MERGE_SELECT::add_info_string(String *str) QUICK_RANGE_SELECT *quick; bool first= TRUE; List_iterator_fast it(quick_selects); - str->append("sort_union("); + str->append(STRING_WITH_LEN("sort_union(")); while ((quick= it++)) { if (!first) @@ -6711,7 +6727,7 @@ void QUICK_ROR_INTERSECT_SELECT::add_info_string(String *str) bool first= TRUE; QUICK_RANGE_SELECT *quick; List_iterator_fast it(quick_selects); - str->append("intersect("); + str->append(STRING_WITH_LEN("intersect(")); while ((quick= it++)) { KEY *key_info= head->key_info + quick->index; @@ -6735,7 +6751,7 @@ void QUICK_ROR_UNION_SELECT::add_info_string(String *str) bool first= TRUE; QUICK_SELECT_I *quick; List_iterator_fast it(quick_selects); - str->append("union("); + str->append(STRING_WITH_LEN("union(")); while ((quick= it++)) { if (!first) @@ -7195,6 +7211,7 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree) { select_items_it.rewind(); cur_used_key_parts.clear_all(); + uint max_key_part= 0; while ((item= select_items_it++)) { item_field= (Item_field*) item; /* (SA5) already checked above. */ @@ -7212,7 +7229,19 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree) cur_group_prefix_len+= cur_part->store_length; cur_used_key_parts.set_bit(key_part_nr); ++cur_group_key_parts; + max_key_part= max(max_key_part,key_part_nr); } + /* + Check that used key parts forms a prefix of the index. + To check this we compare bits in all_parts and cur_parts. + all_parts have all bits set from 0 to (max_key_part-1). + cur_parts have bits set for only used keyparts. + */ + ulonglong all_parts, cur_parts; + all_parts= (1<> 1; + if (all_parts != cur_parts) + goto next_index; } else DBUG_ASSERT(FALSE); @@ -8875,7 +8904,7 @@ static void print_sel_tree(PARAM *param, SEL_TREE *tree, key_map *tree_map, } } if (!tmp.length()) - tmp.append("(empty)"); + tmp.append(STRING_WITH_LEN("(empty)")); DBUG_PRINT("info", ("SEL_TREE %p (%s) scans:%s", tree, msg, tmp.ptr())); @@ -8901,7 +8930,7 @@ static void print_ror_scans_arr(TABLE *table, const char *msg, tmp.append(table->key_info[(*start)->keynr].name); } if (!tmp.length()) - tmp.append("(empty)"); + tmp.append(STRING_WITH_LEN("(empty)")); DBUG_PRINT("info", ("ROR key scans (%s): %s", msg, tmp.ptr())); DBUG_VOID_RETURN; } diff --git a/sql/parse_file.cc b/sql/parse_file.cc index d3e5645bafc..fe82054c528 100644 --- a/sql/parse_file.cc +++ b/sql/parse_file.cc @@ -50,23 +50,23 @@ write_escaped_string(IO_CACHE *file, LEX_STRING *val_s) */ switch(*ptr) { case '\\': // escape character - if (my_b_append(file, (const byte *)"\\\\", 2)) + if (my_b_append(file, (const byte *)STRING_WITH_LEN("\\\\"))) return TRUE; break; case '\n': // parameter value delimiter - if (my_b_append(file, (const byte *)"\\n", 2)) + if (my_b_append(file, (const byte *)STRING_WITH_LEN("\\n"))) return TRUE; break; case '\0': // problem for some string processing utilities - if (my_b_append(file, (const byte *)"\\0", 2)) + if (my_b_append(file, (const byte *)STRING_WITH_LEN("\\0"))) return TRUE; break; case 26: // problem for windows utilities (Ctrl-Z) - if (my_b_append(file, (const byte *)"\\z", 2)) + if (my_b_append(file, (const byte *)STRING_WITH_LEN("\\z"))) return TRUE; break; case '\'': // list of string delimiter - if (my_b_append(file, (const byte *)"\\\'", 2)) + if (my_b_append(file, (const byte *)STRING_WITH_LEN("\\\'"))) return TRUE; break; default: @@ -155,10 +155,10 @@ write_parameter(IO_CACHE *file, gptr base, File_option *parameter, while ((str= it++)) { // We need ' ' after string to detect list continuation - if ((!first && my_b_append(file, (const byte *)" ", 1)) || - my_b_append(file, (const byte *)"\'", 1) || + if ((!first && my_b_append(file, (const byte *)STRING_WITH_LEN(" "))) || + my_b_append(file, (const byte *)STRING_WITH_LEN("\'")) || write_escaped_string(file, str) || - my_b_append(file, (const byte *)"\'", 1)) + my_b_append(file, (const byte *)STRING_WITH_LEN("\'"))) { DBUG_RETURN(TRUE); } @@ -176,7 +176,7 @@ write_parameter(IO_CACHE *file, gptr base, File_option *parameter, { num.set(*val, &my_charset_bin); // We need ' ' after string to detect list continuation - if ((!first && my_b_append(file, (const byte *)" ", 1)) || + if ((!first && my_b_append(file, (const byte *)STRING_WITH_LEN(" "))) || my_b_append(file, (const byte *)num.ptr(), num.length())) { DBUG_RETURN(TRUE); @@ -242,9 +242,9 @@ sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name, goto err_w_file; // write header (file signature) - if (my_b_append(&file, (const byte *)"TYPE=", 5) || + if (my_b_append(&file, (const byte *)STRING_WITH_LEN("TYPE=")) || my_b_append(&file, (const byte *)type->str, type->length) || - my_b_append(&file, (const byte *)"\n", 1)) + my_b_append(&file, (const byte *)STRING_WITH_LEN("\n"))) goto err_w_file; // write parameters to temporary file @@ -252,9 +252,9 @@ sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name, { if (my_b_append(&file, (const byte *)param->name.str, param->name.length) || - my_b_append(&file, (const byte *)"=", 1) || + my_b_append(&file, (const byte *)STRING_WITH_LEN("=")) || write_parameter(&file, base, param, &old_version) || - my_b_append(&file, (const byte *)"\n", 1)) + my_b_append(&file, (const byte *)STRING_WITH_LEN("\n"))) goto err_w_cache; } @@ -355,11 +355,11 @@ my_bool rename_in_schema_file(const char *schema, const char *old_name, { char old_path[FN_REFLEN], new_path[FN_REFLEN], arc_path[FN_REFLEN]; - strxnmov(old_path, FN_REFLEN, mysql_data_home, "/", schema, "/", + strxnmov(old_path, FN_REFLEN-1, mysql_data_home, "/", schema, "/", old_name, reg_ext, NullS); (void) unpack_filename(old_path, old_path); - strxnmov(new_path, FN_REFLEN, mysql_data_home, "/", schema, "/", + strxnmov(new_path, FN_REFLEN-1, mysql_data_home, "/", schema, "/", new_name, reg_ext, NullS); (void) unpack_filename(new_path, new_path); @@ -367,7 +367,7 @@ my_bool rename_in_schema_file(const char *schema, const char *old_name, return 1; /* check if arc_dir exists */ - strxnmov(arc_path, FN_REFLEN, mysql_data_home, "/", schema, "/arc", NullS); + strxnmov(arc_path, FN_REFLEN-1, mysql_data_home, "/", schema, "/arc", NullS); (void) unpack_filename(arc_path, arc_path); if (revision > 0 && !access(arc_path, F_OK)) @@ -414,7 +414,7 @@ sql_parse_prepare(const LEX_STRING *file_name, MEM_ROOT *mem_root, char *end, *sign; File_parser *parser; File file; - DBUG_ENTER("sql__parse_prepare"); + DBUG_ENTER("sql_parse_prepare"); if (!my_stat(file_name->str, &stat_info, MYF(MY_WME))) { @@ -663,6 +663,61 @@ parse_quoted_escaped_string(char *ptr, char *end, } +/* + Parser for FILE_OPTIONS_ULLLIST type value. + + SYNOPSIS + get_file_options_ulllist() + ptr [in/out] pointer to parameter + end [in] end of the configuration + line [in] pointer to the line begining + base [in] base address for parameter writing (structure + like TABLE) + parameter [in] description + mem_root [in] MEM_ROOT for parameters allocation +*/ + +bool get_file_options_ulllist(char *&ptr, char *end, char *line, + gptr base, File_option *parameter, + MEM_ROOT *mem_root) +{ + List *nlist= (List*)(base + parameter->offset); + ulonglong *num; + nlist->empty(); + // list parsing + while (ptr < end) + { + int not_used; + char *num_end= end; + if (!(num= (ulonglong*)alloc_root(mem_root, sizeof(ulonglong))) || + nlist->push_back(num, mem_root)) + goto nlist_err; + *num= my_strtoll10(ptr, &num_end, ¬_used); + ptr= num_end; + switch (*ptr) { + case '\n': + goto end_of_nlist; + case ' ': + // we cant go over buffer bounds, because we have \0 at the end + ptr++; + break; + default: + goto nlist_err_w_message; + } + } + +end_of_nlist: + if (*(ptr++) != '\n') + goto nlist_err; + return FALSE; + +nlist_err_w_message: + my_error(ER_FPARSER_ERROR_IN_PARAMETER, MYF(0), parameter->name.str, line); +nlist_err: + return TRUE; +} + + /* parse parameters @@ -673,6 +728,8 @@ parse_quoted_escaped_string(char *ptr, char *end, mem_root MEM_ROOT for parameters allocation parameters parameters description required number of required parameters in above list + hook hook called for unknown keys + hook_data some data specific for the hook RETURN FALSE - OK @@ -681,15 +738,15 @@ parse_quoted_escaped_string(char *ptr, char *end, my_bool File_parser::parse(gptr base, MEM_ROOT *mem_root, - struct File_option *parameters, uint required) + struct File_option *parameters, uint required, + Unknown_key_hook *hook) { uint first_param= 0, found= 0; - register char *ptr= start; + char *ptr= start; char *eol; LEX_STRING *str; List *list; ulonglong *num; - List *nlist; DBUG_ENTER("File_parser::parse"); while (ptr < end && found < required) @@ -829,58 +886,64 @@ list_err: DBUG_RETURN(TRUE); } case FILE_OPTIONS_ULLLIST: - { - nlist= (List*)(base + parameter->offset); - nlist->empty(); - // list parsing - while (ptr < end) - { - int not_used; - char *num_end= end; - if (!(num= (ulonglong*)alloc_root(mem_root, sizeof(ulonglong))) || - nlist->push_back(num, mem_root)) - goto nlist_err; - *num= my_strtoll10(ptr, &num_end, ¬_used); - ptr= num_end; - switch (*ptr) { - case '\n': - goto end_of_nlist; - case ' ': - // we cant go over buffer bounds, because we have \0 at the end - ptr++; - break; - default: - goto nlist_err_w_message; - } - } - -end_of_nlist: - if (*(ptr++) != '\n') - goto nlist_err; + if (get_file_options_ulllist(ptr, end, line, base, + parameter, mem_root)) + DBUG_RETURN(TRUE); break; - -nlist_err_w_message: - my_error(ER_FPARSER_ERROR_IN_PARAMETER, MYF(0), - parameter->name.str, line); -nlist_err: - DBUG_RETURN(TRUE); - - } default: DBUG_ASSERT(0); // never should happened } } else { - // skip unknown parameter - if (!(ptr= strchr(ptr, '\n'))) - { - my_error(ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER, MYF(0), line); - DBUG_RETURN(TRUE); - } - ptr++; + ptr= line; + if (hook->process_unknown_string(ptr, base, mem_root, end)) + { + DBUG_RETURN(TRUE); + } + // skip unknown parameter + if (!(ptr= strchr(ptr, '\n'))) + { + my_error(ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER, MYF(0), line); + DBUG_RETURN(TRUE); + } + ptr++; } } } DBUG_RETURN(FALSE); } + + +/* + Dummy unknown key hook + + SYNOPSIS + File_parser_dummy_hook::process_unknown_string() + unknown_key [in/out] reference on the line with unknown + parameter and the parsing point + base [in] base address for parameter writing (structure like + TABLE) + mem_root [in] MEM_ROOT for parameters allocation + end [in] the end of the configuration + + NOTE + This hook used to catch no longer supported keys and process them for + backward compatibility, but it will not slow down processing of modern + format files. + This hook does nothing except debug output. + + RETURN + FALSE OK + TRUE Error +*/ + +bool +File_parser_dummy_hook::process_unknown_string(char *&unknown_key, + gptr base, MEM_ROOT *mem_root, + char *end) +{ + DBUG_ENTER("file_parser_dummy_hook::process_unknown_string"); + DBUG_PRINT("info", ("unknown key:%60s", unknown_key)); + DBUG_RETURN(FALSE); +} diff --git a/sql/parse_file.h b/sql/parse_file.h index b4199e4fbf1..afa88da2ead 100644 --- a/sql/parse_file.h +++ b/sql/parse_file.h @@ -40,6 +40,35 @@ struct File_option file_opt_type type; /* Option type */ }; + +/* + This hook used to catch no longer supported keys and process them for + backward compatibility. +*/ + +class Unknown_key_hook +{ +public: + virtual bool process_unknown_string(char *&unknown_key, gptr base, + MEM_ROOT *mem_root, char *end)= 0; +}; + + +/* Dummy hook for parsers which do not need hook for unknown keys */ + +class File_parser_dummy_hook: public Unknown_key_hook +{ +public: + virtual bool process_unknown_string(char *&unknown_key, gptr base, + MEM_ROOT *mem_root, char *end); +}; + +extern File_parser_dummy_hook file_parser_dummy_hook; + +bool get_file_options_ulllist(char *&ptr, char *end, char *line, + gptr base, File_option *parameter, + MEM_ROOT *mem_root); + class File_parser; File_parser *sql_parse_prepare(const LEX_STRING *file_name, MEM_ROOT *mem_root, bool bad_format_errors); @@ -64,7 +93,8 @@ public: my_bool ok() { return content_ok; } LEX_STRING *type() { return &file_type; } my_bool parse(gptr base, MEM_ROOT *mem_root, - struct File_option *parameters, uint required); + struct File_option *parameters, uint required, + Unknown_key_hook *hook); friend File_parser *sql_parse_prepare(const LEX_STRING *file_name, MEM_ROOT *mem_root, diff --git a/sql/protocol.cc b/sql/protocol.cc index 8c3e5a62820..0a1b42f5236 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -498,7 +498,7 @@ void Protocol::init(THD *thd_arg) thd=thd_arg; packet= &thd->packet; convert= &thd->convert_buffer; -#ifndef DEBUG_OFF +#ifndef DBUG_OFF field_types= 0; #endif } @@ -551,7 +551,7 @@ bool Protocol::send_fields(List *list, uint flags) (void) my_net_write(&thd->net, buff,(uint) (pos-buff)); } -#ifndef DEBUG_OFF +#ifndef DBUG_OFF field_types= (enum_field_types*) thd->alloc(sizeof(field_types) * list->elements); uint count= 0; @@ -572,7 +572,7 @@ bool Protocol::send_fields(List *list, uint flags) if (thd->client_capabilities & CLIENT_PROTOCOL_41) { - if (prot.store("def", 3, cs, thd_charset) || + if (prot.store(STRING_WITH_LEN("def"), cs, thd_charset) || prot.store(field.db_name, (uint) strlen(field.db_name), cs, thd_charset) || prot.store(field.table_name, (uint) strlen(field.table_name), @@ -648,7 +648,7 @@ bool Protocol::send_fields(List *list, uint flags) item->send(&prot, &tmp); // Send default value if (prot.write()) break; /* purecov: inspected */ -#ifndef DEBUG_OFF +#ifndef DBUG_OFF field_types[count++]= field.type; #endif } @@ -732,14 +732,14 @@ bool Protocol::store(I_List* str_list) void Protocol_simple::prepare_for_resend() { packet->length(0); -#ifndef DEBUG_OFF +#ifndef DBUG_OFF field_pos= 0; #endif } bool Protocol_simple::store_null() { -#ifndef DEBUG_OFF +#ifndef DBUG_OFF field_pos++; #endif char buff[1]; @@ -773,7 +773,7 @@ bool Protocol::store_string_aux(const char *from, uint length, bool Protocol_simple::store(const char *from, uint length, CHARSET_INFO *fromcs, CHARSET_INFO *tocs) { -#ifndef DEBUG_OFF +#ifndef DBUG_OFF DBUG_ASSERT(field_types == 0 || field_types[field_pos] == MYSQL_TYPE_DECIMAL || field_types[field_pos] == MYSQL_TYPE_BIT || @@ -790,7 +790,7 @@ bool Protocol_simple::store(const char *from, uint length, CHARSET_INFO *fromcs) { CHARSET_INFO *tocs= this->thd->variables.character_set_results; -#ifndef DEBUG_OFF +#ifndef DBUG_OFF DBUG_ASSERT(field_types == 0 || field_types[field_pos] == MYSQL_TYPE_DECIMAL || field_types[field_pos] == MYSQL_TYPE_BIT || @@ -805,7 +805,7 @@ bool Protocol_simple::store(const char *from, uint length, bool Protocol_simple::store_tiny(longlong from) { -#ifndef DEBUG_OFF +#ifndef DBUG_OFF DBUG_ASSERT(field_types == 0 || field_types[field_pos] == MYSQL_TYPE_TINY); field_pos++; #endif @@ -817,7 +817,7 @@ bool Protocol_simple::store_tiny(longlong from) bool Protocol_simple::store_short(longlong from) { -#ifndef DEBUG_OFF +#ifndef DBUG_OFF DBUG_ASSERT(field_types == 0 || field_types[field_pos] == MYSQL_TYPE_YEAR || field_types[field_pos] == MYSQL_TYPE_SHORT); @@ -831,7 +831,7 @@ bool Protocol_simple::store_short(longlong from) bool Protocol_simple::store_long(longlong from) { -#ifndef DEBUG_OFF +#ifndef DBUG_OFF DBUG_ASSERT(field_types == 0 || field_types[field_pos] == MYSQL_TYPE_INT24 || field_types[field_pos] == MYSQL_TYPE_LONG); @@ -845,7 +845,7 @@ bool Protocol_simple::store_long(longlong from) bool Protocol_simple::store_longlong(longlong from, bool unsigned_flag) { -#ifndef DEBUG_OFF +#ifndef DBUG_OFF DBUG_ASSERT(field_types == 0 || field_types[field_pos] == MYSQL_TYPE_LONGLONG); field_pos++; @@ -860,7 +860,7 @@ bool Protocol_simple::store_longlong(longlong from, bool unsigned_flag) bool Protocol_simple::store_decimal(const my_decimal *d) { -#ifndef DEBUG_OFF +#ifndef DBUG_OFF DBUG_ASSERT(field_types == 0 || field_types[field_pos] == MYSQL_TYPE_NEWDECIMAL); field_pos++; @@ -874,7 +874,7 @@ bool Protocol_simple::store_decimal(const my_decimal *d) bool Protocol_simple::store(float from, uint32 decimals, String *buffer) { -#ifndef DEBUG_OFF +#ifndef DBUG_OFF DBUG_ASSERT(field_types == 0 || field_types[field_pos] == MYSQL_TYPE_FLOAT); field_pos++; @@ -886,7 +886,7 @@ bool Protocol_simple::store(float from, uint32 decimals, String *buffer) bool Protocol_simple::store(double from, uint32 decimals, String *buffer) { -#ifndef DEBUG_OFF +#ifndef DBUG_OFF DBUG_ASSERT(field_types == 0 || field_types[field_pos] == MYSQL_TYPE_DOUBLE); field_pos++; @@ -900,7 +900,7 @@ bool Protocol_simple::store(Field *field) { if (field->is_null()) return store_null(); -#ifndef DEBUG_OFF +#ifndef DBUG_OFF field_pos++; #endif char buff[MAX_FIELD_WIDTH]; @@ -921,7 +921,7 @@ bool Protocol_simple::store(Field *field) bool Protocol_simple::store(TIME *tm) { -#ifndef DEBUG_OFF +#ifndef DBUG_OFF DBUG_ASSERT(field_types == 0 || field_types[field_pos] == MYSQL_TYPE_DATETIME || field_types[field_pos] == MYSQL_TYPE_TIMESTAMP); @@ -944,7 +944,7 @@ bool Protocol_simple::store(TIME *tm) bool Protocol_simple::store_date(TIME *tm) { -#ifndef DEBUG_OFF +#ifndef DBUG_OFF DBUG_ASSERT(field_types == 0 || field_types[field_pos] == MYSQL_TYPE_DATE); field_pos++; @@ -963,7 +963,7 @@ bool Protocol_simple::store_date(TIME *tm) bool Protocol_simple::store_time(TIME *tm) { -#ifndef DEBUG_OFF +#ifndef DBUG_OFF DBUG_ASSERT(field_types == 0 || field_types[field_pos] == MYSQL_TYPE_TIME); field_pos++; @@ -1088,7 +1088,7 @@ bool Protocol_prep::store_longlong(longlong from, bool unsigned_flag) bool Protocol_prep::store_decimal(const my_decimal *d) { -#ifndef DEBUG_OFF +#ifndef DBUG_OFF DBUG_ASSERT(field_types == 0 || field_types[field_pos] == MYSQL_TYPE_NEWDECIMAL); field_pos++; diff --git a/sql/protocol.h b/sql/protocol.h index c00bbba4cc9..8d9da5774b2 100644 --- a/sql/protocol.h +++ b/sql/protocol.h @@ -31,7 +31,7 @@ protected: String *packet; String *convert; uint field_pos; -#ifndef DEBUG_OFF +#ifndef DBUG_OFF enum enum_field_types *field_types; #endif uint field_count; diff --git a/sql/records.cc b/sql/records.cc index ff0185195b0..5cb9b1e5c47 100644 --- a/sql/records.cc +++ b/sql/records.cc @@ -153,6 +153,10 @@ void init_read_record(READ_RECORD *info,THD *thd, TABLE *table, info->table=table; info->file= table->file; info->forms= &info->table; /* Only one table */ + + if (table->s->tmp_table == TMP_TABLE && !table->sort.addon_field) + VOID(table->file->extra(HA_EXTRA_MMAP)); + if (table->sort.addon_field) { info->rec_buf= table->sort.addon_buf; diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc index 823930121fe..960e0ac86cc 100644 --- a/sql/repl_failsafe.cc +++ b/sql/repl_failsafe.cc @@ -503,7 +503,7 @@ int update_slave_list(MYSQL* mysql, MASTER_INFO* mi) int port_ind; DBUG_ENTER("update_slave_list"); - if (mysql_real_query(mysql,"SHOW SLAVE HOSTS",16) || + if (mysql_real_query(mysql, STRING_WITH_LEN("SHOW SLAVE HOSTS")) || !(res = mysql_store_result(mysql))) { error= mysql_error(mysql); @@ -796,7 +796,7 @@ bool load_master_data(THD* thd) MYSQL_RES *db_res, **table_res, **table_res_end, **cur_table_res; uint num_dbs; - if (mysql_real_query(&mysql, "SHOW DATABASES", 14) || + if (mysql_real_query(&mysql, STRING_WITH_LEN("SHOW DATABASES")) || !(db_res = mysql_store_result(&mysql))) { my_error(error= ER_QUERY_ON_MASTER, MYF(0), mysql_error(&mysql)); @@ -822,8 +822,9 @@ bool load_master_data(THD* thd) we wait to issue FLUSH TABLES WITH READ LOCK for as long as we can to minimize the lock time. */ - if (mysql_real_query(&mysql, "FLUSH TABLES WITH READ LOCK", 27) || - mysql_real_query(&mysql, "SHOW MASTER STATUS",18) || + if (mysql_real_query(&mysql, + STRING_WITH_LEN("FLUSH TABLES WITH READ LOCK")) || + mysql_real_query(&mysql, STRING_WITH_LEN("SHOW MASTER STATUS")) || !(master_status_res = mysql_store_result(&mysql))) { my_error(error= ER_QUERY_ON_MASTER, MYF(0), mysql_error(&mysql)); @@ -876,7 +877,7 @@ bool load_master_data(THD* thd) } if (mysql_select_db(&mysql, db) || - mysql_real_query(&mysql, "SHOW TABLES", 11) || + mysql_real_query(&mysql, STRING_WITH_LEN("SHOW TABLES")) || !(*cur_table_res = mysql_store_result(&mysql))) { my_error(error= ER_QUERY_ON_MASTER, MYF(0), mysql_error(&mysql)); @@ -934,7 +935,7 @@ bool load_master_data(THD* thd) mysql_free_result(master_status_res); } - if (mysql_real_query(&mysql, "UNLOCK TABLES", 13)) + if (mysql_real_query(&mysql, STRING_WITH_LEN("UNLOCK TABLES"))) { my_error(error= ER_QUERY_ON_MASTER, MYF(0), mysql_error(&mysql)); goto err; diff --git a/sql/rpl_filter.cc b/sql/rpl_filter.cc index f9f8a3e98a7..143cd027b5f 100644 --- a/sql/rpl_filter.cc +++ b/sql/rpl_filter.cc @@ -449,30 +449,37 @@ Rpl_filter::free_string_array(DYNAMIC_ARRAY *a) */ void -Rpl_filter::table_rule_ent_hash_to_str(String* s, HASH* h) +Rpl_filter::table_rule_ent_hash_to_str(String* s, HASH* h, bool inited) { s->length(0); - for (uint i= 0; i < h->records; i++) + if (inited) { - TABLE_RULE_ENT* e= (TABLE_RULE_ENT*) hash_element(h, i); - if (s->length()) - s->append(','); - s->append(e->db,e->key_len); + for (uint i= 0; i < h->records; i++) + { + TABLE_RULE_ENT* e= (TABLE_RULE_ENT*) hash_element(h, i); + if (s->length()) + s->append(','); + s->append(e->db,e->key_len); + } } } void -Rpl_filter::table_rule_ent_dynamic_array_to_str(String* s, DYNAMIC_ARRAY* a) +Rpl_filter::table_rule_ent_dynamic_array_to_str(String* s, DYNAMIC_ARRAY* a, + bool inited) { s->length(0); - for (uint i= 0; i < a->elements; i++) + if (inited) { - TABLE_RULE_ENT* e; - get_dynamic(a, (gptr)&e, i); - if (s->length()) - s->append(','); - s->append(e->db,e->key_len); + for (uint i= 0; i < a->elements; i++) + { + TABLE_RULE_ENT* e; + get_dynamic(a, (gptr)&e, i); + if (s->length()) + s->append(','); + s->append(e->db,e->key_len); + } } } @@ -480,28 +487,28 @@ Rpl_filter::table_rule_ent_dynamic_array_to_str(String* s, DYNAMIC_ARRAY* a) void Rpl_filter::get_do_table(String* str) { - table_rule_ent_hash_to_str(str, &do_table); + table_rule_ent_hash_to_str(str, &do_table, do_table_inited); } void Rpl_filter::get_ignore_table(String* str) { - table_rule_ent_hash_to_str(str, &ignore_table); + table_rule_ent_hash_to_str(str, &ignore_table, ignore_table_inited); } void Rpl_filter::get_wild_do_table(String* str) { - table_rule_ent_dynamic_array_to_str(str, &wild_do_table); + table_rule_ent_dynamic_array_to_str(str, &wild_do_table, wild_do_table_inited); } void Rpl_filter::get_wild_ignore_table(String* str) { - table_rule_ent_dynamic_array_to_str(str, &wild_ignore_table); + table_rule_ent_dynamic_array_to_str(str, &wild_ignore_table, wild_ignore_table_inited); } diff --git a/sql/rpl_filter.h b/sql/rpl_filter.h index cfcb3b43607..5a766424d19 100644 --- a/sql/rpl_filter.h +++ b/sql/rpl_filter.h @@ -87,10 +87,15 @@ private: void free_string_array(DYNAMIC_ARRAY *a); - void table_rule_ent_hash_to_str(String* s, HASH* h); - void table_rule_ent_dynamic_array_to_str(String* s, DYNAMIC_ARRAY* a); + void table_rule_ent_hash_to_str(String* s, HASH* h, bool inited); + void table_rule_ent_dynamic_array_to_str(String* s, DYNAMIC_ARRAY* a, + bool inited); TABLE_RULE_ENT* find_wild(DYNAMIC_ARRAY *a, const char* key, int len); + /* + Those 4 structures below are uninitialized memory unless the + corresponding *_inited variables are "true". + */ HASH do_table; HASH ignore_table; DYNAMIC_ARRAY wild_do_table; diff --git a/sql/set_var.cc b/sql/set_var.cc index 48a3d8fb945..9d5fb2940cf 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -61,15 +61,19 @@ /* WITH_BERKELEY_STORAGE_ENGINE */ extern bool berkeley_shared_data; -extern ulong berkeley_cache_size, berkeley_max_lock, berkeley_log_buffer_size; +extern ulong berkeley_max_lock, berkeley_log_buffer_size; +extern ulonglong berkeley_cache_size; +extern ulong berkeley_region_size, berkeley_cache_parts; extern char *berkeley_home, *berkeley_tmpdir, *berkeley_logdir; /* WITH_INNOBASE_STORAGE_ENGINE */ extern uint innobase_flush_log_at_trx_commit; extern ulong innobase_fast_shutdown; extern long innobase_mirrored_log_groups, innobase_log_files_in_group; -extern long innobase_log_file_size, innobase_log_buffer_size; -extern long innobase_buffer_pool_size, innobase_additional_mem_pool_size; +extern longlong innobase_log_file_size; +extern long innobase_log_buffer_size; +extern longlong innobase_buffer_pool_size; +extern long innobase_additional_mem_pool_size; extern long innobase_buffer_pool_awe_mem_mb; extern long innobase_file_io_threads, innobase_lock_wait_timeout; extern long innobase_force_recovery; @@ -235,9 +239,12 @@ sys_var_key_cache_long sys_key_cache_age_threshold("key_cache_age_threshold", param_age_threshold)); sys_var_bool_ptr sys_local_infile("local_infile", &opt_local_infile); -sys_var_bool_ptr +sys_var_trust_routine_creators sys_trust_routine_creators("log_bin_trust_routine_creators", - &trust_routine_creators); + &trust_function_creators); +sys_var_bool_ptr +sys_trust_function_creators("log_bin_trust_function_creators", + &trust_function_creators); sys_var_thd_ulong sys_log_warnings("log_warnings", &SV::log_warnings); sys_var_thd_ulong sys_long_query_time("long_query_time", &SV::long_query_time); @@ -293,6 +300,8 @@ sys_var_long_ptr sys_max_relay_log_size("max_relay_log_size", fix_max_relay_log_size); sys_var_thd_ulong sys_max_sort_length("max_sort_length", &SV::max_sort_length); +sys_var_thd_ulong sys_max_sp_recursion_depth("max_sp_recursion_depth", + &SV::max_sp_recursion_depth); sys_var_max_user_conn sys_max_user_connections("max_user_connections"); sys_var_thd_ulong sys_max_tmp_tables("max_tmp_tables", &SV::max_tmp_tables); @@ -305,6 +314,8 @@ sys_var_long_ptr sys_myisam_data_pointer_size("myisam_data_pointer_size", sys_var_thd_ulonglong sys_myisam_max_sort_file_size("myisam_max_sort_file_size", &SV::myisam_max_sort_file_size, fix_myisam_max_sort_file_size, 1); sys_var_thd_ulong sys_myisam_repair_threads("myisam_repair_threads", &SV::myisam_repair_threads); sys_var_thd_ulong sys_myisam_sort_buffer_size("myisam_sort_buffer_size", &SV::myisam_sort_buff_size); +sys_var_bool_ptr sys_myisam_use_mmap("myisam_use_mmap", + &opt_myisam_use_mmap); sys_var_thd_enum sys_myisam_stats_method("myisam_stats_method", &SV::myisam_stats_method, @@ -414,7 +425,9 @@ sys_var_thd_ulong sys_sync_replication_timeout( &SV::sync_replication_timeout); #endif sys_var_bool_ptr sys_sync_frm("sync_frm", &opt_sync_frm); -sys_var_long_ptr sys_table_cache_size("table_cache", +sys_var_long_ptr sys_table_def_size("table_definition_cache", + &table_def_size); +sys_var_long_ptr sys_table_cache_size("table_open_cache", &table_cache_size); sys_var_long_ptr sys_table_lock_wait_timeout("table_lock_wait_timeout", &table_lock_wait_timeout); @@ -583,7 +596,6 @@ sys_var_thd_time_zone sys_time_zone("time_zone"); /* Read only variables */ sys_var_const_str sys_os("version_compile_os", SYSTEM_TYPE); - sys_var_have_variable sys_have_archive_db("have_archive", &have_archive_db); sys_var_have_variable sys_have_berkeley_db("have_bdb", &have_berkeley_db); sys_var_have_variable sys_have_blackhole_db("have_blackhole_engine", @@ -607,7 +619,6 @@ sys_var_have_variable sys_have_query_cache("have_query_cache", sys_var_have_variable sys_have_raid("have_raid", &have_raid); sys_var_have_variable sys_have_rtree_keys("have_rtree_keys", &have_rtree_keys); sys_var_have_variable sys_have_symlink("have_symlink", &have_symlink); - /* Global read-only variable describing server license */ sys_var_const_str sys_license("license", STRINGIFY_ARG(LICENSE)); @@ -622,11 +633,13 @@ struct show_var_st init_vars[]= { {sys_automatic_sp_privileges.name,(char*) &sys_automatic_sp_privileges, SHOW_SYS}, {"back_log", (char*) &back_log, SHOW_LONG}, {"basedir", mysql_home, SHOW_CHAR}, - {"bdb_cache_size", (char*) &berkeley_cache_size, SHOW_LONG}, + {"bdb_cache_parts", (char*) &berkeley_cache_parts, SHOW_LONG}, + {"bdb_cache_size", (char*) &berkeley_cache_size, SHOW_LONGLONG}, {"bdb_home", (char*) &berkeley_home, SHOW_CHAR_PTR}, {"bdb_log_buffer_size", (char*) &berkeley_log_buffer_size, SHOW_LONG}, {"bdb_logdir", (char*) &berkeley_logdir, SHOW_CHAR_PTR}, {"bdb_max_lock", (char*) &berkeley_max_lock, SHOW_LONG}, + {"bdb_region_size", (char*) &berkeley_region_size, SHOW_LONG}, {"bdb_shared_data", (char*) &berkeley_shared_data, SHOW_BOOL}, {"bdb_tmpdir", (char*) &berkeley_tmpdir, SHOW_CHAR_PTR}, {sys_binlog_cache_size.name,(char*) &sys_binlog_cache_size, SHOW_SYS}, @@ -688,7 +701,7 @@ struct show_var_st init_vars[]= { {"innodb_additional_mem_pool_size", (char*) &innobase_additional_mem_pool_size, SHOW_LONG }, {sys_innodb_autoextend_increment.name, (char*) &sys_innodb_autoextend_increment, SHOW_SYS}, {"innodb_buffer_pool_awe_mem_mb", (char*) &innobase_buffer_pool_awe_mem_mb, SHOW_LONG }, - {"innodb_buffer_pool_size", (char*) &innobase_buffer_pool_size, SHOW_LONG }, + {"innodb_buffer_pool_size", (char*) &innobase_buffer_pool_size, SHOW_LONGLONG }, {"innodb_checksums", (char*) &innobase_use_checksums, SHOW_MY_BOOL}, {sys_innodb_commit_concurrency.name, (char*) &sys_innodb_commit_concurrency, SHOW_SYS}, {sys_innodb_concurrency_tickets.name, (char*) &sys_innodb_concurrency_tickets, SHOW_SYS}, @@ -706,7 +719,7 @@ struct show_var_st init_vars[]= { {"innodb_log_arch_dir", (char*) &innobase_log_arch_dir, SHOW_CHAR_PTR}, {"innodb_log_archive", (char*) &innobase_log_archive, SHOW_MY_BOOL}, {"innodb_log_buffer_size", (char*) &innobase_log_buffer_size, SHOW_LONG }, - {"innodb_log_file_size", (char*) &innobase_log_file_size, SHOW_LONG}, + {"innodb_log_file_size", (char*) &innobase_log_file_size, SHOW_LONGLONG}, {"innodb_log_files_in_group", (char*) &innobase_log_files_in_group, SHOW_LONG}, {"innodb_log_group_home_dir", (char*) &innobase_log_group_home_dir, SHOW_CHAR_PTR}, {sys_innodb_max_dirty_pages_pct.name, (char*) &sys_innodb_max_dirty_pages_pct, SHOW_SYS}, @@ -738,7 +751,7 @@ struct show_var_st init_vars[]= { #endif {"log", (char*) &opt_log, SHOW_BOOL}, {"log_bin", (char*) &opt_bin_log, SHOW_BOOL}, - {sys_trust_routine_creators.name,(char*) &sys_trust_routine_creators, SHOW_SYS}, + {sys_trust_function_creators.name,(char*) &sys_trust_function_creators, SHOW_SYS}, {"log_error", (char*) log_error_file, SHOW_CHAR}, #ifdef HAVE_REPLICATION {"log_slave_updates", (char*) &opt_log_slave_updates, SHOW_MY_BOOL}, @@ -765,6 +778,8 @@ struct show_var_st init_vars[]= { {sys_max_relay_log_size.name, (char*) &sys_max_relay_log_size, SHOW_SYS}, {sys_max_seeks_for_key.name, (char*) &sys_max_seeks_for_key, SHOW_SYS}, {sys_max_sort_length.name, (char*) &sys_max_sort_length, SHOW_SYS}, + {sys_max_sp_recursion_depth.name, + (char*) &sys_max_sp_recursion_depth, SHOW_SYS}, {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}, @@ -776,6 +791,7 @@ struct show_var_st init_vars[]= { {sys_myisam_repair_threads.name, (char*) &sys_myisam_repair_threads, SHOW_SYS}, {sys_myisam_sort_buffer_size.name, (char*) &sys_myisam_sort_buffer_size, SHOW_SYS}, + {sys_myisam_use_mmap.name, (char*) &sys_myisam_use_mmap, SHOW_SYS}, {sys_myisam_stats_method.name, (char*) &sys_myisam_stats_method, SHOW_SYS}, @@ -868,7 +884,8 @@ struct show_var_st init_vars[]= { #ifdef HAVE_TZNAME {"system_time_zone", system_time_zone, SHOW_CHAR}, #endif - {"table_cache", (char*) &table_cache_size, SHOW_LONG}, + {"table_definition_cache", (char*) &table_def_size, SHOW_LONG}, + {"table_open_cache", (char*) &table_cache_size, SHOW_LONG}, {"table_lock_wait_timeout", (char*) &table_lock_wait_timeout, SHOW_LONG }, {sys_table_type.name, (char*) &sys_table_type, SHOW_SYS}, {sys_thread_cache_size.name,(char*) &sys_thread_cache_size, SHOW_SYS}, @@ -3328,6 +3345,26 @@ bool process_key_caches(int (* func) (const char *name, KEY_CACHE *)) } +void sys_var_trust_routine_creators::warn_deprecated(THD *thd) +{ + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_WARN_DEPRECATED_SYNTAX, + ER(ER_WARN_DEPRECATED_SYNTAX), "log_bin_trust_routine_creators", + "log_bin_trust_function_creators"); +} + +void sys_var_trust_routine_creators::set_default(THD *thd, enum_var_type type) +{ + warn_deprecated(thd); + sys_var_bool_ptr::set_default(thd, type); +} + +bool sys_var_trust_routine_creators::update(THD *thd, set_var *var) +{ + warn_deprecated(thd); + return sys_var_bool_ptr::update(thd, var); +} + /**************************************************************************** Used templates ****************************************************************************/ diff --git a/sql/set_var.h b/sql/set_var.h index c1d91bb1973..14059f7e9b7 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -771,6 +771,17 @@ public: byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); }; +class sys_var_trust_routine_creators :public sys_var_bool_ptr +{ + /* We need a derived class only to have a warn_deprecated() */ +public: + sys_var_trust_routine_creators(const char *name_arg, my_bool *value_arg) : + sys_var_bool_ptr(name_arg, value_arg) {}; + void warn_deprecated(THD *thd); + void set_default(THD *thd, enum_var_type type); + bool update(THD *thd, set_var *var); +}; + /**************************************************************************** Classes for parsing of the SET command ****************************************************************************/ diff --git a/sql/share/Makefile.am b/sql/share/Makefile.am index 2e23027f1f5..6d905ba35dc 100644 --- a/sql/share/Makefile.am +++ b/sql/share/Makefile.am @@ -49,5 +49,15 @@ install-data-local: $(INSTALL_DATA) $(srcdir)/charsets/README $(DESTDIR)$(pkgdatadir)/charsets/README $(INSTALL_DATA) $(srcdir)/charsets/*.xml $(DESTDIR)$(pkgdatadir)/charsets +# FIXME maybe shouldn't remove, could be needed by other installation? +uninstall-local: + @RM@ -f -r $(DESTDIR)$(pkgdatadir) + +distclean-local: + @RM@ -f */errmsg.sys + +# Do nothing +link_sources: + # Don't update the files from bitkeeper %::SCCS/s.% diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt index c9504ba980f..0b9a46d9753 100644 --- a/sql/share/errmsg.txt +++ b/sql/share/errmsg.txt @@ -132,7 +132,7 @@ ER_DB_CREATE_EXISTS jps "'%-.64s' ƒf[ƒ^ƒx[ƒX‚ªì‚ê‚Ü‚¹‚ñ.Šù‚É‚»‚̃f[ƒ^ƒx[ƒX‚ª‘¶Ý‚µ‚Ü‚·", est "Ei suuda luua andmebaasi '%-.64s': andmebaas juba eksisteerib" fre "Ne peut créer la base '%-.64s'; elle existe déjà" - ger "Kann Datenbank '%-.64s' nicht erzeugen. Datenbank '%-.64s' existiert bereits" + ger "Kann Datenbank '%-.64s' nicht erzeugen. Datenbank existiert bereits" greek "Áäýíáôç ç äçìéïõñãßá ôçò âÜóçò äåäïìÝíùí '%-.64s'; Ç âÜóç äåäïìÝíùí õðÜñ÷åé Þäç" hun "Az '%-.64s' adatbazis nem hozhato letre Az adatbazis mar letezik" ita "Impossibile creare il database '%-.64s'; il database esiste" @@ -157,7 +157,7 @@ ER_DB_DROP_EXISTS jps "'%-.64s' ƒf[ƒ^ƒx[ƒX‚ð”jŠü‚Å‚«‚Ü‚¹‚ñ. ‚»‚̃f[ƒ^ƒx[ƒX‚ª‚È‚¢‚̂ł·.", est "Ei suuda kustutada andmebaasi '%-.64s': andmebaasi ei eksisteeri" fre "Ne peut effacer la base '%-.64s'; elle n'existe pas" - ger "Kann Datenbank '%-.64s' nicht löschen. Keine Datenbank '%-.64s' vorhanden" + ger "Kann Datenbank '%-.64s' nicht löschen; Datenbank nicht vorhanden" greek "Áäýíáôç ç äéáãñáöÞ ôçò âÜóçò äåäïìÝíùí '%-.64s'. Ç âÜóç äåäïìÝíùí äåí õðÜñ÷åé" hun "A(z) '%-.64s' adatbazis nem szuntetheto meg. Az adatbazis nem letezik" ita "Impossibile cancellare '%-.64s'; il database non esiste" @@ -182,7 +182,7 @@ ER_DB_DROP_DELETE jps "ƒf[ƒ^ƒx[ƒX”jŠüƒGƒ‰[ ('%-.64s' ‚ð휂ł«‚Ü‚¹‚ñ, errno: %d)", est "Viga andmebaasi kustutamisel (ei suuda kustutada faili '%-.64s', veakood: %d)" fre "Ne peut effacer la base '%-.64s' (erreur %d)" - ger "Fehler beim Löschen der Datenbank ('%-.64s' kann nicht gelöscht werden, Fehlernuumer: %d)" + ger "Fehler beim Löschen der Datenbank ('%-.64s' kann nicht gelöscht werden, Fehler: %d)" greek "ÐáñïõóéÜóôçêå ðñüâëçìá êáôÜ ôç äéáãñáöÞ ôçò âÜóçò äåäïìÝíùí (áäýíáôç ç äéáãñáöÞ '%-.64s', êùäéêüò ëÜèïõò: %d)" hun "Adatbazis megszuntetesi hiba ('%-.64s' nem torolheto, hibakod: %d)" ita "Errore durante la cancellazione del database (impossibile cancellare '%-.64s', errno: %d)" @@ -207,7 +207,7 @@ ER_DB_DROP_RMDIR jps "ƒf[ƒ^ƒx[ƒX”jŠüƒGƒ‰[ ('%-.64s' ‚ð rmdir ‚Å‚«‚Ü‚¹‚ñ, errno: %d)", est "Viga andmebaasi kustutamisel (ei suuda kustutada kataloogi '%-.64s', veakood: %d)" fre "Erreur en effaçant la base (rmdir '%-.64s', erreur %d)" - ger "Fehler beim Löschen der Datenbank (Verzeichnis '%-.64s' kann nicht gelöscht werden, Fehlernummer: %d)" + ger "Fehler beim Löschen der Datenbank (Verzeichnis '%-.64s' kann nicht gelöscht werden, Fehler: %d)" greek "ÐáñïõóéÜóôçêå ðñüâëçìá êáôÜ ôç äéáãñáöÞ ôçò âÜóçò äåäïìÝíùí (áäýíáôç ç äéáãñáöÞ ôïõ öáêÝëëïõ '%-.64s', êùäéêüò ëÜèïõò: %d)" hun "Adatbazis megszuntetesi hiba ('%-.64s' nem szuntetheto meg, hibakod: %d)" ita "Errore durante la cancellazione del database (impossibile rmdir '%-.64s', errno: %d)" @@ -357,7 +357,7 @@ ER_CANT_OPEN_FILE jps "'%-.64s' ƒtƒ@ƒCƒ‹‚ðŠJ‚­Ž–‚ª‚Å‚«‚Ü‚¹‚ñ (errno: %d)", est "Ei suuda avada faili '%-.64s' (veakood: %d)" fre "Ne peut ouvrir le fichier: '%-.64s' (Errcode: %d)" - ger "Datei '%-.64s' nicht öffnen (Fehler: %d)" + ger "Kann Datei '%-.64s' nicht öffnen (Fehler: %d)" greek "Äåí åßíáé äõíáôü íá áíïé÷ôåß ôï áñ÷åßï: '%-.64s' (êùäéêüò ëÜèïõò: %d)" hun "A '%-.64s' file nem nyithato meg (hibakod: %d)" ita "Impossibile aprire il file: '%-.64s' (errno: %d)" @@ -702,7 +702,7 @@ ER_GET_ERRNO eng "Got error %d from storage engine" est "Tabeli handler tagastas vea %d" fre "Reçu l'erreur %d du handler de la table" - ger "Fehler %d (Tabellenhandler)" + ger "Fehler %d (Speicher-Engine)" greek "ÅëÞöèç ìÞíõìá ëÜèïõò %d áðü ôïí ÷åéñéóôÞ ðßíáêá (table handler)" hun "%d hibajelzes a tablakezelotol" ita "Rilevato l'errore %d dal gestore delle tabelle" @@ -726,7 +726,7 @@ ER_ILLEGAL_HA eng "Table storage engine for '%-.64s' doesn't have this option" est "Tabeli '%-.64s' handler ei toeta antud operatsiooni" fre "Le handler de la table '%-.64s' n'a pas cette option" - ger "Diese Option gibt es nicht (Tabellenhandler)" + ger "Diese Option gibt es nicht (Speicher-Engine für '%-.64s')" greek "Ï ÷åéñéóôÞò ðßíáêá (table handler) ãéá '%-.64s' äåí äéáèÝôåé áõôÞ ôçí åðéëïãÞ" hun "A(z) '%-.64s' tablakezelonek nincs ilyen opcioja" ita "Il gestore delle tabelle per '%-.64s' non ha questa opzione" @@ -751,7 +751,7 @@ ER_KEY_NOT_FOUND jps "'%-.64s'‚̂Ȃ©‚ɃŒƒR[ƒh‚ªŒ©•t‚©‚è‚Ü‚¹‚ñ", est "Ei suuda leida kirjet '%-.64s'-s" fre "Ne peut trouver l'enregistrement dans '%-.64s'" - ger "Kann Datensatz nicht finden" + ger "Kann Datensatz in '%-.64s' nicht finden" greek "Áäýíáôç ç áíåýñåóç åããñáöÞò óôï '%-.64s'" hun "Nem talalhato a rekord '%-.64s'-ben" ita "Impossibile trovare il record in '%-.64s'" @@ -801,7 +801,7 @@ ER_NOT_KEYFILE jps "'%-.64s' ƒe[ƒuƒ‹‚Ì key file ‚ªŠÔˆá‚Á‚Ä‚¢‚邿‚¤‚Å‚·. C•œ‚ð‚µ‚Ä‚­‚¾‚³‚¢", est "Tabeli '%-.64s' võtmefail on vigane; proovi seda parandada" fre "Index corrompu dans la table: '%-.64s'; essayez de le réparer" - ger "Falsche Schlüssel-Datei für Tabelle '%-.64s'. versuche zu reparieren" + ger "Fehlerhafte Index-Datei für Tabelle '%-.64s'; versuche zu reparieren" greek "ËÜèïò áñ÷åßï ôáîéíüìéóçò (key file) ãéá ôïí ðßíáêá: '%-.64s'; Ðáñáêáëþ, äéïñèþóôå ôï!" hun "Ervenytelen kulcsfile a tablahoz: '%-.64s'; probalja kijavitani!" ita "File chiave errato per la tabella : '%-.64s'; prova a riparalo" @@ -826,7 +826,7 @@ ER_OLD_KEYFILE jps "'%-.64s' ƒe[ƒuƒ‹‚͌¢Œ`Ž®‚Ì key file ‚̂悤‚Å‚·; C•œ‚ð‚µ‚Ä‚­‚¾‚³‚¢", est "Tabeli '%-.64s' võtmefail on aegunud; paranda see!" fre "Vieux fichier d'index pour la table '%-.64s'; réparez le!" - ger "Alte Schlüssel-Datei für Tabelle '%-.64s'. Bitte reparieren" + ger "Alte Index-Datei für Tabelle '%-.64s'. Bitte reparieren" greek "Ðáëáéü áñ÷åßï ôáîéíüìéóçò (key file) ãéá ôïí ðßíáêá '%-.64s'; Ðáñáêáëþ, äéïñèþóôå ôï!" hun "Regi kulcsfile a '%-.64s'tablahoz; probalja kijavitani!" ita "File chiave vecchio per la tabella '%-.64s'; riparalo!" @@ -851,7 +851,7 @@ ER_OPEN_AS_READONLY jps "'%-.64s' ‚͓ǂݞ‚Ýê—p‚Å‚·", est "Tabel '%-.64s' on ainult lugemiseks" fre "'%-.64s' est en lecture seulement" - ger "'%-.64s' ist nur lesbar" + ger "Tabelle '%-.64s' ist nur lesbar" greek "'%-.64s' åðéôñÝðåôáé ìüíï ç áíÜãíùóç" hun "'%-.64s' irasvedett" ita "'%-.64s' e` di sola lettura" @@ -901,7 +901,7 @@ ER_OUT_OF_SORTMEMORY HY001 S1001 jps "Out of sort memory. sort buffer size ‚ª‘«‚è‚È‚¢‚悤‚Å‚·.", est "Mälu sai sorteerimisel otsa. Suurenda MySQL-i sorteerimispuhvrit" fre "Manque de mémoire pour le tri. Augmentez-la." - ger "Kein Speicher zum Sortieren vorhanden. sort_buffer_size sollte erhöht werden" + ger "Kein Speicher zum Sortieren vorhanden. sort_buffer_size sollte im Server erhöht werden" greek "Äåí õðÜñ÷åé äéáèÝóéìç ìíÞìç ãéá ôáîéíüìéóç. ÁõîÞóôå ôï sort buffer size ãéá ôç äéáäéêáóßá (demon)" hun "Nincs eleg memoria a rendezeshez. Novelje a rendezo demon puffermeretet" ita "Memoria per gli ordinamenti esaurita. Incrementare il 'sort_buffer' al demone" @@ -976,7 +976,7 @@ ER_OUT_OF_RESOURCES jps "Out of memory; mysqld ‚©‚»‚Ì‘¼‚̃vƒƒZƒX‚ªƒƒ‚ƒŠ[‚ð‘S‚ÄŽg‚Á‚Ä‚¢‚é‚©Šm”F‚µ‚Ä‚­‚¾‚³‚¢. ƒƒ‚ƒŠ[‚ðŽg‚¢Ø‚Á‚Ä‚¢‚È‚¢ê‡A'ulimit' ‚ðݒ肵‚Ä mysqld ‚̃ƒ‚ƒŠ[Žg—pŒÀŠE—ʂ𑽂­‚·‚é‚©Aswap space ‚ð‘‚₵‚Ă݂Ă­‚¾‚³‚¢", est "Mälu sai otsa. Võimalik, et aitab swap-i lisamine või käsu 'ulimit' abil MySQL-le rohkema mälu kasutamise lubamine" fre "Manque de 'threads'/mémoire" - ger "Kein Speicher mehr vorhanden. Prüfen Sie, ob mysqld oder ein anderer Prozess allen Speicher verbraucht. Wenn nicht, sollten Sie mit 'ulimit' dafür sorgen, dass mysqld mehr Speicher benutzen darf, oder mehr Swap-Speicher einrichten" + ger "Kein Speicher mehr vorhanden. Prüfen Sie, ob mysqld oder ein anderer Prozess den gesamten Speicher verbraucht. Wenn nicht, sollten Sie mit 'ulimit' dafür sorgen, dass mysqld mehr Speicher benutzen darf, oder mehr Swap-Speicher einrichten" greek "Ðñüâëçìá ìå ôç äéáèÝóéìç ìíÞìç (Out of thread space/memory)" hun "Elfogyott a thread-memoria" ita "Fine dello spazio/memoria per i thread" @@ -1025,7 +1025,7 @@ ER_HANDSHAKE_ERROR 08S01 eng "Bad handshake" est "Väär handshake" fre "Mauvais 'handshake'" - ger "Schlechter Handshake" + ger "Ungültiger Handshake" greek "Ç áíáãíþñéóç (handshake) äåí Ýãéíå óùóôÜ" hun "A kapcsolatfelvetel nem sikerult (Bad handshake)" ita "Negoziazione impossibile" @@ -1245,7 +1245,7 @@ ER_NON_UNIQ_ERROR 23000 eng "Column '%-.64s' in %-.64s is ambiguous" est "Väli '%-.64s' %-.64s-s ei ole ühene" fre "Champ: '%-.64s' dans %s est ambigu" - ger "Spalte '%-.64s' in %-.64s ist nicht eindeutig" + ger "Feld '%-.64s' in %-.64s ist nicht eindeutig" greek "Ôï ðåäßï: '%-.64s' óå %-.64s äåí Ý÷åé êáèïñéóôåß" hun "A(z) '%-.64s' oszlop %-.64s-ben ketertelmu" ita "Colonna: '%-.64s' di %-.64s e` ambigua" @@ -1411,7 +1411,7 @@ ER_TOO_LONG_IDENT 42000 S1009 jps "Identifier name '%-.100s' ‚Í’·‚·‚¬‚Ü‚·", est "Identifikaatori '%-.100s' nimi on liiga pikk" fre "Le nom de l'identificateur '%-.64s' est trop long" - ger "Name des Bezeichners '%-.64s' ist zu lang" + ger "Name des Bezeichners '%-.100s' ist zu lang" greek "Ôï identifier name '%-.100s' åßíáé ðïëý ìåãÜëï" hun "A(z) '%-.100s' azonositonev tul hosszu." ita "Il nome dell'identificatore '%-.100s' e` troppo lungo" @@ -1436,7 +1436,7 @@ ER_DUP_FIELDNAME 42S21 S1009 jps "'%-.64s' ‚Æ‚¢‚¤ column –¼‚Íd•¡‚µ‚Ă܂·", est "Kattuv tulba nimi '%-.64s'" fre "Nom du champ '%-.64s' déjà utilisé" - ger "Doppelter Spaltenname vorhanden: '%-.64s'" + ger "Doppelter Spaltenname: '%-.64s'" greek "ÅðáíÜëçøç column name '%-.64s'" hun "Duplikalt oszlopazonosito: '%-.64s'" ita "Nome colonna duplicato '%-.64s'" @@ -1461,7 +1461,7 @@ ER_DUP_KEYNAME 42000 S1009 jps "'%-.64s' ‚Æ‚¢‚¤ key ‚Ì–¼‘O‚Íd•¡‚µ‚Ä‚¢‚Ü‚·", est "Kattuv võtme nimi '%-.64s'" fre "Nom de clef '%-.64s' déjà utilisé" - ger "Doppelter Name für Schlüssel (Key) vorhanden: '%-.64s'" + ger "Doppelter Name für Schlüssel vorhanden: '%-.64s'" greek "ÅðáíÜëçøç key name '%-.64s'" hun "Duplikalt kulcsazonosito: '%-.64s'" ita "Nome chiave duplicato '%-.64s'" @@ -1510,7 +1510,7 @@ ER_WRONG_FIELD_SPEC 42000 S1009 eng "Incorrect column specifier for column '%-.64s'" est "Vigane tulba kirjeldus tulbale '%-.64s'" fre "Mauvais paramètre de champ pour le champ '%-.64s'" - ger "Falsche Spaltenangaben für Spalte '%-.64s'" + ger "Falsche Spezifikation für Feld '%-.64s'" greek "ÅóöáëìÝíï column specifier ãéá ôï ðåäßï '%-.64s'" hun "Rossz oszlopazonosito: '%-.64s'" ita "Specifica errata per la colonna '%-.64s'" @@ -1608,7 +1608,7 @@ ER_INVALID_DEFAULT 42000 S1009 eng "Invalid default value for '%-.64s'" est "Vigane vaikeväärtus '%-.64s' jaoks" fre "Valeur par défaut invalide pour '%-.64s'" - ger "Fehlerhafter Vorgabewert (DEFAULT): '%-.64s'" + ger "Fehlerhafter Vorgabewert (DEFAULT) für '%-.64s'" greek "ÅóöáëìÝíç ðñïêáèïñéóìÝíç ôéìÞ (default value) ãéá '%-.64s'" hun "Ervenytelen ertek: '%-.64s'" ita "Valore di default non valido per '%-.64s'" @@ -1632,7 +1632,7 @@ ER_MULTIPLE_PRI_KEY 42000 S1009 jps "•¡”‚Ì primary key ‚ª’è‹`‚³‚ê‚Ü‚µ‚½", est "Mitut primaarset võtit ei saa olla" fre "Plusieurs clefs primaires définies" - ger "Mehrfacher Primärschlüssel (PRIMARY KEY) definiert" + ger "Mehrere Primärschlüssel (PRIMARY KEY) definiert" greek "Ðåñéóóüôåñá áðü Ýíá primary key ïñßóôçêáí" hun "Tobbszoros elsodleges kulcs definialas." ita "Definite piu` chiave primarie" @@ -1681,7 +1681,7 @@ ER_TOO_MANY_KEY_PARTS 42000 S1009 eng "Too many key parts specified; max %d parts allowed" est "Võti koosneb liiga paljudest osadest. Maksimaalselt võib olla %d osa" fre "Trop de parties specifiées dans la clef. Maximum de %d parties" - ger "Zu viele Teilschlüssel definiert. Maximal sind %d Teilschlüssel erlaubt" + ger "Zu viele Teilschlüssel definiert. Maximal %d Teilschlüssel erlaubt" greek "ÐÜñá ðïëëÜ key parts ïñßóèçêáí. Ôï ðïëý %d åðéôñÝðïíôáé" hun "Tul sok kulcsdarabot definialt. Maximum %d resz engedelyezett" ita "Troppe parti di chiave specificate. Sono ammesse max %d parti" @@ -1730,7 +1730,7 @@ ER_KEY_COLUMN_DOES_NOT_EXITS 42000 S1009 jps "Key column '%-.64s' ‚ªƒe[ƒuƒ‹‚É‚ ‚è‚Ü‚¹‚ñ.", est "Võtme tulp '%-.64s' puudub tabelis" fre "La clé '%-.64s' n'existe pas dans la table" - ger "In der Tabelle gibt es keine Schlüsselspalte '%-.64s'" + ger "In der Tabelle gibt es kein Schlüsselfeld '%-.64s'" greek "Ôï ðåäßï êëåéäß '%-.64s' äåí õðÜñ÷åé óôïí ðßíáêá" hun "A(z) '%-.64s'kulcsoszlop nem letezik a tablaban" ita "La colonna chiave '%-.64s' non esiste nella tabella" @@ -1778,7 +1778,7 @@ ER_TOO_BIG_FIELDLENGTH 42000 S1009 jps "column '%-.64s' ‚Í,Šm•Û‚·‚é column ‚̑傫‚³‚ª‘½‚·‚¬‚Ü‚·. (Å‘å %d ‚Ü‚Å). BLOB ‚ð‚©‚í‚è‚ÉŽg—p‚µ‚Ä‚­‚¾‚³‚¢.", est "Tulba '%-.64s' pikkus on liiga pikk (maksimaalne pikkus: %d). Kasuta BLOB väljatüüpi" fre "Champ '%-.64s' trop long (max = %d). Utilisez un BLOB" - ger "Feldlänge für Feld '%-.64s' zu groß (maximal %d). BLOB-Feld verwenden!" + ger "Feldlänge für Feld '%-.64s' zu groß (maximal %d). BLOB- oder TEXT-Spaltentyp verwenden!" greek "Ðïëý ìåãÜëï ìÞêïò ãéá ôï ðåäßï '%-.64s' (max = %d). Ðáñáêáëþ ÷ñçóéìïðïéåßóôå ôïí ôýðï BLOB" hun "A(z) '%-.64s' oszlop tul hosszu. (maximum = %d). Hasznaljon BLOB tipust inkabb." ita "La colonna '%-.64s' e` troppo grande (max=%d). Utilizza un BLOB." @@ -1803,7 +1803,7 @@ ER_WRONG_AUTO_KEY 42000 S1009 jps "ƒe[ƒuƒ‹‚Ì’è‹`‚ªˆá‚¢‚Ü‚·; there can be only one auto column and it must be defined as a key", est "Vigane tabelikirjeldus; Tabelis tohib olla üks auto_increment tüüpi tulp ning see peab olema defineeritud võtmena" fre "Un seul champ automatique est permis et il doit être indexé" - ger "Falsche Tabellendefinition. Es darf nur ein Auto-Feld geben und dieses muss als Schlüssel definiert werden" + ger "Falsche Tabellendefinition. Es darf nur eine AUTO_INCREMENT-Spalte geben, und diese muss als Schlüssel definiert werden" greek "Ìðïñåß íá õðÜñ÷åé ìüíï Ýíá auto field êáé ðñÝðåé íá Ý÷åé ïñéóèåß óáí key" hun "Csak egy auto mezo lehetseges, es azt kulcskent kell definialni." ita "Puo` esserci solo un campo AUTO e deve essere definito come chiave" @@ -1828,7 +1828,7 @@ ER_READY jps "%s: €”õŠ®—¹", est "%s: ootab ühendusi" fre "%s: Prêt pour des connections" - ger "%-.64s: Bereit für Verbindungen" + ger "%-.64s: Bereit für Verbindungen.\nVersion: '%2' Socket: '%s' Port: %d" greek "%s: óå áíáìïíÞ óõíäÝóåùí" hun "%s: kapcsolatra kesz" ita "%s: Pronto per le connessioni\n" @@ -1901,7 +1901,7 @@ ER_SHUTDOWN_COMPLETE jps "%s: Shutdown Š®—¹\n", est "%s: Lõpp\n" fre "%s: Arrêt du serveur terminé\n" - ger "%-.64s: Heruntergefahren (shutdown)\n" + ger "%-.64s: Herunterfahren beendet\n" greek "%s: Ç äéáäéêáóßá Shutdown ïëïêëçñþèçêå\n" hun "%s: A leallitas kesz\n" ita "%s: Shutdown completato\n" @@ -1976,7 +1976,7 @@ ER_NO_SUCH_INDEX 42S12 S1009 jps "Table '%-.64s' ‚Í‚»‚̂悤‚È index ‚ðŽ‚Á‚Ä‚¢‚Ü‚¹‚ñ(CREATE INDEX ŽÀsŽž‚ÉŽw’肳‚ê‚Ä‚¢‚Ü‚¹‚ñ). ƒe[ƒuƒ‹‚ðì‚è’¼‚µ‚Ä‚­‚¾‚³‚¢", est "Tabelil '%-.64s' puuduvad võtmed. Loo tabel uuesti" fre "La table '%-.64s' n'a pas d'index comme celle utilisée dans CREATE INDEX. Recréez la table" - ger "Tabelle '%-.64s' besitzt keinen wie den in CREATE INDEX verwendeten Index. Index neu anlegen" + ger "Tabelle '%-.64s' besitzt keinen wie den in CREATE INDEX verwendeten Index. Tabelle neu anlegen" greek "Ï ðßíáêáò '%-.64s' äåí Ý÷åé åõñåôÞñéï (index) óáí áõôü ðïõ ÷ñçóéìïðïéåßôå óôçí CREATE INDEX. Ðáñáêáëþ, îáíáäçìéïõñãÞóôå ôïí ðßíáêá" hun "A(z) '%-.64s' tablahoz nincs meg a CREATE INDEX altal hasznalt index. Alakitsa at a tablat" ita "La tabella '%-.64s' non ha nessun indice come quello specificatato dalla CREATE INDEX. Ricrea la tabella" @@ -2048,7 +2048,7 @@ ER_TEXTFILE_NOT_READABLE jps "ƒtƒ@ƒCƒ‹ '%-.64s' ‚Í databse ‚Ì directory ‚É‚ ‚é‚©‘S‚Ẵ†[ƒU[‚ª“Ç‚ß‚é‚æ‚¤‚É‹–‰Â‚³‚ê‚Ä‚¢‚È‚¯‚ê‚΂Ȃè‚Ü‚¹‚ñ.", est "Fail '%-.64s' peab asuma andmebaasi kataloogis või olema kõigile loetav" fre "Le fichier '%-.64s' doit être dans le répertoire de la base et lisible par tous" - ger "Datei '%-.64s' muss im Datenbank-Verzeichnis vorhanden und lesbar für alle sein" + ger "Datei '%-.64s' muss im Datenbank-Verzeichnis vorhanden oder lesbar für alle sein" greek "Ôï áñ÷åßï '%-.64s' ðñÝðåé íá õðÜñ÷åé óôï database directory Þ íá ìðïñåß íá äéáâáóôåß áðü üëïõò" hun "A(z) '%-.64s'-nak az adatbazis konyvtarban kell lennie, vagy mindenki szamara olvashatonak" ita "Il file '%-.64s' deve essere nella directory del database e deve essere leggibile da tutti" @@ -2073,7 +2073,7 @@ ER_FILE_EXISTS_ERROR jps "File '%-.64s' ‚ÍŠù‚É‘¶Ý‚µ‚Ü‚·", est "Fail '%-.80s' juba eksisteerib" fre "Le fichier '%-.64s' existe déjà" - ger "Datei '%-.64s' bereits vorhanden" + ger "Datei '%-.80s' bereits vorhanden" greek "Ôï áñ÷åßï '%-.64s' õðÜñ÷åé Þäç" hun "A '%-.64s' file mar letezik." ita "Il file '%-.64s' esiste gia`" @@ -2147,7 +2147,7 @@ ER_WRONG_SUB_KEY eng "Incorrect sub part key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique sub keys" est "Vigane võtme osa. Kasutatud võtmeosa ei ole string tüüpi, määratud pikkus on pikem kui võtmeosa või tabelihandler ei toeta seda tüüpi võtmeid" fre "Mauvaise sous-clef. Ce n'est pas un 'string' ou la longueur dépasse celle définie dans la clef" - ger "Falscher Unterteilschlüssel. Der verwendete Schlüsselteil ist entweder kein String, die verwendete Länge ist länger als der Teilschlüssel oder der Tabellenhandler unterstützt keine Unterteilschlüssel" + ger "Falscher Unterteilschlüssel. Der verwendete Schlüsselteil ist entweder kein String, die verwendete Länge ist länger als der Teilschlüssel oder die Speicher-Engine unterstützt keine Unterteilschlüssel" greek "ÅóöáëìÝíï sub part key. Ôï ÷ñçóéìïðïéïýìåíï key part äåí åßíáé string Þ ôï ìÞêïò ôïõ åßíáé ìåãáëýôåñï" hun "Rossz alkulcs. A hasznalt kulcsresz nem karaktersorozat vagy hosszabb, mint a kulcsresz" ita "Sotto-parte della chiave errata. La parte di chiave utilizzata non e` una stringa o la lunghezza e` maggiore della parte di chiave." @@ -2197,7 +2197,7 @@ ER_CANT_DROP_FIELD_OR_KEY 42000 jps "'%-.64s' ‚ð”jŠü‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½; check that column/key exists", est "Ei suuda kustutada '%-.64s'. Kontrolli kas tulp/võti eksisteerib" fre "Ne peut effacer (DROP) '%-.64s'. Vérifiez s'il existe" - ger "Kann '%-.64s' nicht löschen. Existiert das Feld / der Schlüssel?" + ger "Kann '%-.64s' nicht löschen. Existiert die Spalte oder der Schlüssel?" greek "Áäýíáôç ç äéáãñáöÞ (DROP) '%-.64s'. Ðáñáêáëþ åëÝãîôå áí ôï ðåäßï/êëåéäß õðÜñ÷åé" hun "A DROP '%-.64s' nem lehetseges. Ellenorizze, hogy a mezo/kulcs letezik-e" ita "Impossibile cancellare '%-.64s'. Controllare che il campo chiave esista" @@ -2325,7 +2325,7 @@ ER_TOO_BIG_SET eng "Too many strings for column %-.64s and SET" est "Liiga palju string tulbale %-.64s tüübile SET" fre "Trop de chaînes dans la colonne %s avec SET" - ger "Zu viele Strings für SET-Spalte %-.64s angegeben" + ger "Zu viele Strings für Feld %-.64s und SET angegeben" greek "ÐÜñá ðïëëÜ strings ãéá ôï ðåäßï %-.64s êáé SET" hun "Tul sok karakter: %-.64s es SET" ita "Troppe stringhe per la colonna %-.64s e la SET" @@ -2348,7 +2348,7 @@ ER_NO_UNIQUE_LOGFILE eng "Can't generate a unique log-filename %-.64s.(1-999)\n" est "Ei suuda luua unikaalset logifaili nime %-.64s.(1-999)\n" fre "Ne peut générer un unique nom de journal %s.(1-999)\n" - ger "Kann keinen eindeutigen Dateinamen für die Logdatei %-.64s erzeugen (1-999)\n" + ger "Kann keinen eindeutigen Dateinamen für die Logdatei %-.64s(1-999) erzeugen\n" greek "Áäýíáôç ç äçìéïõñãßá unique log-filename %-.64s.(1-999)\n" hun "Egyedi log-filenev nem generalhato: %-.64s.(1-999)\n" ita "Impossibile generare un nome del file log unico %-.64s.(1-999)\n" @@ -2421,7 +2421,7 @@ ER_BLOB_CANT_HAVE_DEFAULT 42000 eng "BLOB/TEXT column '%-.64s' can't have a default value" est "BLOB-tüüpi tulp '%-.64s' ei saa omada vaikeväärtust" fre "BLOB '%-.64s' ne peut avoir de valeur par défaut" - ger "BLOB-Feld '%-.64s' darf keinen Vorgabewert (DEFAULT) haben" + ger "BLOB/TEXT-Feld '%-.64s' darf keinen Vorgabewert (DEFAULT) haben" greek "Ôá Blob ðåäßá '%-.64s' äåí ìðïñïýí íá Ý÷ïõí ðñïêáèïñéóìÝíåò ôéìÝò (default value)" hun "A(z) '%-.64s' blob objektumnak nem lehet alapertelmezett erteke" ita "Il campo BLOB '%-.64s' non puo` avere un valore di default" @@ -2446,7 +2446,7 @@ ER_WRONG_DB_NAME 42000 jps "Žw’肵‚½ database –¼ '%-.100s' ‚ªŠÔˆá‚Á‚Ä‚¢‚Ü‚·", est "Vigane andmebaasi nimi '%-.100s'" fre "Nom de base de donnée illégal: '%-.64s'" - ger "Unerlaubter Datenbankname '%-.64s'" + ger "Unerlaubter Datenbankname '%-.100s'" greek "ËÜèïò üíïìá âÜóçò äåäïìÝíùí '%-.100s'" hun "Hibas adatbazisnev: '%-.100s'" ita "Nome database errato '%-.100s'" @@ -2471,7 +2471,7 @@ ER_WRONG_TABLE_NAME 42000 jps "Žw’肵‚½ table –¼ '%-.100s' ‚͂܂¿‚ª‚Á‚Ä‚¢‚Ü‚·", est "Vigane tabeli nimi '%-.100s'" fre "Nom de table illégal: '%-.64s'" - ger "Unerlaubter Tabellenname '%-.64s'" + ger "Unerlaubter Tabellenname '%-.100s'" greek "ËÜèïò üíïìá ðßíáêá '%-.100s'" hun "Hibas tablanev: '%-.100s'" ita "Nome tabella errato '%-.100s'" @@ -2495,7 +2495,7 @@ ER_TOO_BIG_SELECT 42000 eng "The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay" est "SELECT lause peab läbi vaatama suure hulga kirjeid ja võtaks tõenäoliselt liiga kaua aega. Tasub kontrollida WHERE klauslit ja vajadusel kasutada käsku SET SQL_BIG_SELECTS=1" fre "SELECT va devoir examiner beaucoup d'enregistrements ce qui va prendre du temps. Vérifiez la clause WHERE et utilisez SET SQL_BIG_SELECTS=1 si SELECT se passe bien" - ger "Die Ausführung des SELECT würde zu viele Datensätze untersuchen und wahrscheinlich sehr lange dauern. Bitte WHERE-Klausel überprüfen oder gegebenenfalls SET SQL_BIG_SELECTS=1 oder SET SQL_MAX_JOIN_SIZE=# verwenden" + ger "Die Ausführung des SELECT würde zu viele Datensätze untersuchen und wahrscheinlich sehr lange dauern. Bitte WHERE-Klausel überprüfen und gegebenenfalls SET SQL_BIG_SELECTS=1 oder SET SQL_MAX_JOIN_SIZE=# verwenden" greek "Ôï SELECT èá åîåôÜóåé ìåãÜëï áñéèìü åããñáöþí êáé ðéèáíþò èá êáèõóôåñÞóåé. Ðáñáêáëþ åîåôÜóôå ôéò ðáñáìÝôñïõò ôïõ WHERE êáé ÷ñçóéìïðïéåßóôå SET SQL_BIG_SELECTS=1 áí ôï SELECT åßíáé óùóôü" hun "A SELECT tul sok rekordot fog megvizsgalni es nagyon sokaig fog tartani. Ellenorizze a WHERE-t es hasznalja a SET SQL_BIG_SELECTS=1 beallitast, ha a SELECT okay" ita "La SELECT dovrebbe esaminare troppi record e usare troppo tempo. Controllare la WHERE e usa SET SQL_BIG_SELECTS=1 se e` tutto a posto." @@ -2676,7 +2676,7 @@ ER_UNSUPPORTED_EXTENSION 42000 eng "Table '%-.64s' uses an extension that doesn't exist in this MySQL version" est "Tabel '%-.64s' kasutab laiendust, mis ei eksisteeri antud MySQL versioonis" fre "Table '%-.64s' : utilise une extension invalide pour cette version de MySQL" - ger "Tabelle '%-.64s' verwendet eine Extension, die in dieser MySQL-Version nicht verfügbar ist" + ger "Tabelle '%-.64s' verwendet eine Erweiterung, die in dieser MySQL-Version nicht verfügbar ist" greek "Ï ðßíáêò '%-.64s' ÷ñçóéìïðïéåß êÜðïéï extension ðïõ äåí õðÜñ÷åé óôçí Ýêäïóç áõôÞ ôçò MySQL" hun "A(z) '%-.64s' tabla olyan bovitest hasznal, amely nem letezik ebben a MySQL versioban." ita "La tabella '%-.64s' usa un'estensione che non esiste in questa versione di MySQL" @@ -2700,7 +2700,7 @@ ER_TABLE_MUST_HAVE_COLUMNS 42000 jps "ƒe[ƒuƒ‹‚ÍÅ’á 1 ŒÂ‚Ì column ‚ª•K—v‚Å‚·", est "Tabelis peab olema vähemalt üks tulp" fre "Une table doit comporter au moins une colonne" - ger "Eine Tabelle muß mindestens 1 Spalte besitzen" + ger "Eine Tabelle muss mindestens eine Spalte besitzen" greek "Åíáò ðßíáêáò ðñÝðåé íá Ý÷åé ôïõëÜ÷éóôïí Ýíá ðåäßï" hun "A tablanak legalabb egy oszlopot tartalmazni kell" ita "Una tabella deve avere almeno 1 colonna" @@ -2788,7 +2788,7 @@ ER_TOO_MANY_FIELDS jps "column ‚ª‘½‚·‚¬‚Ü‚·", est "Liiga palju tulpasid" fre "Trop de champs" - ger "Zu viele Spalten" + ger "Zu viele Felder" greek "Ðïëý ìåãÜëïò áñéèìüò ðåäßùí" hun "Tul sok mezo" ita "Troppi campi" @@ -2810,7 +2810,7 @@ ER_TOO_BIG_ROWSIZE 42000 jps "row size ‚ª‘å‚«‚·‚¬‚Ü‚·. BLOB ‚ðŠÜ‚܂Ȃ¢ê‡‚Ì row size ‚ÌÅ‘å‚Í %d ‚Å‚·. ‚¢‚­‚‚©‚Ì field ‚ð BLOB ‚ɕς¦‚Ä‚­‚¾‚³‚¢.", est "Liiga pikk kirje. Kirje maksimumpikkus arvestamata BLOB-tüüpi välju on %d. Muuda mõned väljad BLOB-tüüpi väljadeks" fre "Ligne trop grande. Le taille maximale d'une ligne, sauf les BLOBs, est %d. Changez le type de quelques colonnes en BLOB" - ger "Zeilenlänge zu groß. Die maximale Spaltenlänge für den verwendeten Tabellentyp (ohne BLOB-Felder) beträgt %d. Einige Felder müssen in BLOB oder TEXT umgewandelt werden" + ger "Zeilenlänge zu groß. Die maximale Zeilenlänge für den verwendeten Tabellentyp (ohne BLOB-Felder) beträgt %ld. Einige Felder müssen in BLOB oder TEXT umgewandelt werden" greek "Ðïëý ìåãÜëï ìÝãåèïò åããñáöÞò. Ôï ìÝãéóôï ìÝãåèïò åããñáöÞò, ÷ùñßò íá õðïëïãßæïíôáé ôá blobs, åßíáé %d. ÐñÝðåé íá ïñßóåôå êÜðïéá ðåäßá óáí blobs" hun "Tul nagy sormeret. A maximalis sormeret (nem szamolva a blob objektumokat) %d. Nehany mezot meg kell valtoztatnia" ita "Riga troppo grande. La massima grandezza di una riga, non contando i BLOB, e` %d. Devi cambiare alcuni campi in BLOB" @@ -2831,7 +2831,7 @@ ER_STACK_OVERRUN eng "Thread stack overrun: Used: %ld of a %ld stack. Use 'mysqld -O thread_stack=#' to specify a bigger stack if needed" jps "Thread stack overrun: Used: %ld of a %ld stack. ƒXƒ^ƒbƒN—̈æ‚𑽂­‚Ƃ肽‚¢ê‡A'mysqld -O thread_stack=#' ‚ÆŽw’肵‚Ä‚­‚¾‚³‚¢", fre "Débordement de la pile des tâches (Thread stack). Utilisées: %ld pour une pile de %ld. Essayez 'mysqld -O thread_stack=#' pour indiquer une plus grande valeur" - ger "Thread-Stack-Überlauf. Benutzt: %ld von %ld Stack. 'mysqld -O thread_stack=#' verwenen, um notfalls einen größeren Stack anzulegen" + ger "Thread-Stack-Überlauf. Benutzt: %ld von %ld Stack. 'mysqld -O thread_stack=#' verwenden, um bei Bedarf einen größeren Stack anzulegen" greek "Stack overrun óôï thread: Used: %ld of a %ld stack. Ðáñáêáëþ ÷ñçóéìïðïéåßóôå 'mysqld -O thread_stack=#' ãéá íá ïñßóåôå Ýíá ìåãáëýôåñï stack áí ÷ñåéÜæåôáé" hun "Thread verem tullepes: Used: %ld of a %ld stack. Hasznalja a 'mysqld -O thread_stack=#' nagyobb verem definialasahoz" ita "Thread stack overrun: Usati: %ld di uno stack di %ld. Usa 'mysqld -O thread_stack=#' per specificare uno stack piu` grande." @@ -3003,15 +3003,15 @@ ER_CANT_OPEN_LIBRARY swe "Kan inte öppna det dynamiska biblioteket '%-.64s' (Felkod: %d %s)" ukr "îÅ ÍÏÖÕ ×¦ÄËÒÉÔÉ ÒÏÚĦÌÀ×ÁÎÕ Â¦Â̦ÏÔÅËÕ '%-.64s' (ÐÏÍÉÌËÁ: %d %-.64s)" ER_CANT_FIND_DL_ENTRY - cze "Nemohu naj-Bít funkci '%-.64s' v knihovnì'" - dan "Kan ikke finde funktionen '%-.64s' i bibliotek'" + cze "Nemohu naj-Bít funkci '%-.64s' v knihovnì" + dan "Kan ikke finde funktionen '%-.64s' i bibliotek" nla "Kan functie '%-.64s' niet in library vinden" - eng "Can't find symbol '%-.64s' in library'" + eng "Can't find symbol '%-.64s' in library" jps "function '%-.64s' ‚ðƒ‰ƒCƒuƒ‰ƒŠ[’†‚ÉŒ©•t‚¯‚鎖‚ª‚Å‚«‚Ü‚¹‚ñ", est "Ei leia funktsiooni '%-.64s' antud teegis" - fre "Impossible de trouver la fonction '%-.64s' dans la bibliothèque'" + fre "Impossible de trouver la fonction '%-.64s' dans la bibliothèque" ger "Kann Funktion '%-.64s' in der Library nicht finden" - greek "Äåí åßíáé äõíáôÞ ç áíåýñåóç ôçò óõíÜñôçóçò '%-.64s' óôçí âéâëéïèÞêç'" + greek "Äåí åßíáé äõíáôÞ ç áíåýñåóç ôçò óõíÜñôçóçò '%-.64s' óôçí âéâëéïèÞêç" hun "A(z) '%-.64s' fuggveny nem talalhato a konyvtarban" ita "Impossibile trovare la funzione '%-.64s' nella libreria" jpn "function '%-.64s' ¤ò¥é¥¤¥Ö¥é¥ê¡¼Ãæ¤Ë¸«ÉÕ¤±¤ë»ö¤¬¤Ç¤­¤Þ¤»¤ó" @@ -3020,10 +3020,10 @@ ER_CANT_FIND_DL_ENTRY rum "Nu pot gasi functia '%-.64s' in libraria" rus "îÅ×ÏÚÍÏÖÎÏ ÏÔÙÓËÁÔØ ÓÉÍ×ÏÌ '%-.64s' × ÂÉÂÌÉÏÔÅËÅ" serbian "Ne mogu da pronadjem funkciju '%-.64s' u biblioteci" - slo "Nemô¾em nájs» funkciu '%-.64s' v kni¾nici'" - spa "No puedo encontrar función '%-.64s' en libraria'" + slo "Nemô¾em nájs» funkciu '%-.64s' v kni¾nici" + spa "No puedo encontrar función '%-.64s' en libraria" swe "Hittar inte funktionen '%-.64s' in det dynamiska biblioteket" - ukr "îÅ ÍÏÖÕ ÚÎÁÊÔÉ ÆÕÎËæÀ '%-.64s' Õ Â¦Â̦ÏÔÅæ'" + ukr "îÅ ÍÏÖÕ ÚÎÁÊÔÉ ÆÕÎËæÀ '%-.64s' Õ Â¦Â̦ÏÔÅæ" ER_FUNCTION_NOT_DEFINED cze "Funkce '%-.64s' nen-Bí definována" dan "Funktionen '%-.64s' er ikke defineret" @@ -3198,7 +3198,7 @@ ER_WRONG_VALUE_COUNT_ON_ROW 21S01 nla "Kolom aantal komt niet overeen met waarde aantal in rij %ld" eng "Column count doesn't match value count at row %ld" est "Tulpade hulk erineb väärtuste hulgast real %ld" - ger "Anzahl der Spalten stimmt nicht mit der Anzahl der Werte in Zeile %ld überein" + ger "Anzahl der Felder stimmt nicht mit der Anzahl der Werte in Zeile %ld überein" hun "Az oszlopban talalhato ertek nem egyezik meg a %ld sorban szamitott ertekkel" ita "Il numero delle colonne non corrisponde al conteggio alla riga %ld" kor "Row %ld¿¡¼­ Ä®·³ Ä«¿îÆ®¿Í value Ä«¿îÅÍ¿Í ÀÏÄ¡ÇÏÁö ¾Ê½À´Ï´Ù." @@ -3276,7 +3276,7 @@ ER_MIX_OF_GROUP_FUNC_AND_FIELDS 42000 eng "Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause" est "GROUP tulpade (MIN(),MAX(),COUNT()...) kooskasutamine tavaliste tulpadega ilma GROUP BY klauslita ei ole lubatud" fre "Mélanger les colonnes GROUP (MIN(),MAX(),COUNT()...) avec des colonnes normales est interdit s'il n'y a pas de clause GROUP BY" - ger "Das Vermischen von GROUP-Spalten (MIN(),MAX(),COUNT()...) mit Nicht-GROUP-Spalten ist nicht zulässig, wenn keine GROUP BY-Klausel vorhanden ist" + ger "Das Vermischen von GROUP-Feldern (MIN(),MAX(),COUNT()...) mit Nicht-GROUP-Feldern ist nicht zulässig, wenn keine GROUP-BY-Klausel vorhanden ist" hun "A GROUP mezok (MIN(),MAX(),COUNT()...) kevert hasznalata nem lehetseges GROUP BY hivatkozas nelkul" ita "Il mescolare funzioni di aggregazione (MIN(),MAX(),COUNT()...) e non e` illegale se non c'e` una clausula GROUP BY" kor "Mixing of GROUP Ä®·³s (MIN(),MAX(),COUNT(),...) with no GROUP Ä®·³s is illegal if there is no GROUP BY clause" @@ -3315,7 +3315,7 @@ ER_TABLEACCESS_DENIED_ERROR 42000 jps "ƒRƒ}ƒ“ƒh %-.16s ‚Í ƒ†[ƒU[ '%-.32s'@'%-.64s' ,ƒe[ƒuƒ‹ '%-.64s' ‚ɑ΂µ‚Ä‹–‰Â‚³‚ê‚Ä‚¢‚Ü‚¹‚ñ", est "%-.16s käsk ei ole lubatud kasutajale '%-.32s'@'%-.64s' tabelis '%-.64s'" fre "La commande '%-.16s' est interdite à l'utilisateur: '%-.32s'@'@%-.64s' sur la table '%-.64s'" - ger "%-.16s Befehl nicht erlaubt für Benutzer '%-.32s'@'%-.64s' und für Tabelle '%-.64s'" + ger "%-.16s Befehl nicht erlaubt für Benutzer '%-.32s'@'%-.64s' auf Tabelle '%-.64s'" hun "%-.16s parancs a '%-.32s'@'%-.64s' felhasznalo szamara nem engedelyezett a '%-.64s' tablaban" ita "Comando %-.16s negato per l'utente: '%-.32s'@'%-.64s' sulla tabella '%-.64s'" jpn "¥³¥Þ¥ó¥É %-.16s ¤Ï ¥æ¡¼¥¶¡¼ '%-.32s'@'%-.64s' ,¥Æ¡¼¥Ö¥ë '%-.64s' ¤ËÂФ·¤Æµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" @@ -3335,7 +3335,7 @@ ER_COLUMNACCESS_DENIED_ERROR 42000 jps "ƒRƒ}ƒ“ƒh %-.16s ‚Í ƒ†[ƒU[ '%-.32s'@'%-.64s'\n ƒJƒ‰ƒ€ '%-.64s' ƒe[ƒuƒ‹ '%-.64s' ‚ɑ΂µ‚Ä‹–‰Â‚³‚ê‚Ä‚¢‚Ü‚¹‚ñ", est "%-.16s käsk ei ole lubatud kasutajale '%-.32s'@'%-.64s' tulbale '%-.64s' tabelis '%-.64s'" fre "La commande '%-.16s' est interdite à l'utilisateur: '%-.32s'@'@%-.64s' sur la colonne '%-.64s' de la table '%-.64s'" - ger "%-.16s Befehl nicht erlaubt für Benutzer '%-.32s'@'%-.64s' und Spalte '%-.64s' in Tabelle '%-.64s'" + ger "%-.16s Befehl nicht erlaubt für Benutzer '%-.32s'@'%-.64s' und Feld '%-.64s' in Tabelle '%-.64s'" hun "%-.16s parancs a '%-.32s'@'%-.64s' felhasznalo szamara nem engedelyezett a '%-.64s' mezo eseten a '%-.64s' tablaban" ita "Comando %-.16s negato per l'utente: '%-.32s'@'%-.64s' sulla colonna '%-.64s' della tabella '%-.64s'" jpn "¥³¥Þ¥ó¥É %-.16s ¤Ï ¥æ¡¼¥¶¡¼ '%-.32s'@'%-.64s'\n ¥«¥é¥à '%-.64s' ¥Æ¡¼¥Ö¥ë '%-.64s' ¤ËÂФ·¤Æµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" @@ -3419,7 +3419,7 @@ ER_NONEXISTING_TABLE_GRANT 42000 eng "There is no such grant defined for user '%-.32s' on host '%-.64s' on table '%-.64s'" est "Sellist õigust ei ole defineeritud kasutajale '%-.32s' masinast '%-.64s' tabelile '%-.64s'" fre "Un tel droit n'est pas défini pour l'utilisateur '%-.32s' sur l'hôte '%-.64s' sur la table '%-.64s'" - ger "Keine solche Berechtigung für User '%-.32s' auf Host '%-.64s' an Tabelle '%-.64s'" + ger "Eine solche Berechtigung ist für User '%-.32s' auf Host '%-.64s' an Tabelle '%-.64s' nicht definiert" hun "A '%-.32s' felhasznalo szamara a '%-.64s' host '%-.64s' tablajaban ez a parancs nem engedelyezett" ita "GRANT non definita per l'utente '%-.32s' dalla macchina '%-.64s' sulla tabella '%-.64s'" kor "»ç¿ëÀÚ '%-.32s'(È£½ºÆ® '%-.64s')´Â Å×À̺í '%-.64s'¸¦ »ç¿ëÇϱâ À§ÇÏ¿© Á¤ÀÇµÈ ½ÂÀÎÀº ¾ø½À´Ï´Ù. " @@ -3455,7 +3455,7 @@ ER_SYNTAX_ERROR 42000 eng "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use" est "Viga SQL süntaksis" fre "Erreur de syntaxe" - ger "Fehler in der SQL-Syntax. Bitte die korrekte Syntax im Handbuch nachschlagen (diese kann für verschiedene Server-Versionen unterschiedlich sein)" + ger "Fehler in der SQL-Syntax. Bitte die korrekte Syntax im Handbuch nachschlagen" greek "You have an error in your SQL syntax" hun "Szintaktikai hiba" ita "Errore di sintassi nella query SQL" @@ -3538,7 +3538,7 @@ ER_NET_PACKET_TOO_LARGE 08S01 eng "Got a packet bigger than 'max_allowed_packet' bytes" est "Saabus suurem pakett kui lubatud 'max_allowed_packet' muutujaga" fre "Paquet plus grand que 'max_allowed_packet' reçu" - ger "Empfangenes Paket ist größer als 'max_allowed_packet'" + ger "Empfangenes Paket ist größer als 'max_allowed_packet' Bytes" hun "A kapott csomag nagyobb, mint a maximalisan engedelyezett: 'max_allowed_packet'" ita "Ricevuto un pacchetto piu` grande di 'max_allowed_packet'" kor "'max_allowed_packet'º¸´Ù ´õÅ« ÆÐŶÀ» ¹Þ¾Ò½À´Ï´Ù." @@ -3556,7 +3556,7 @@ ER_NET_READ_ERROR_FROM_PIPE 08S01 eng "Got a read error from the connection pipe" est "Viga ühendustoru lugemisel" fre "Erreur de lecture reçue du pipe de connection" - ger "Lese-Fehler bei einer Kommunikations-Pipe" + ger "Lese-Fehler bei einer Verbindungs-Pipe" hun "Olvasasi hiba a kapcsolat soran" ita "Rilevato un errore di lettura dalla pipe di connessione" kor "¿¬°á ÆÄÀÌÇÁ·ÎºÎÅÍ ¿¡·¯°¡ ¹ß»ýÇÏ¿´½À´Ï´Ù." @@ -3700,7 +3700,7 @@ ER_TOO_LONG_STRING 42000 eng "Result string is longer than 'max_allowed_packet' bytes" est "Tulemus on pikem kui lubatud 'max_allowed_packet' muutujaga" fre "La chaîne résultat est plus grande que 'max_allowed_packet'" - ger "Ergebnis ist länger als 'max_allowed_packet'" + ger "Ergebnis-String ist länger als 'max_allowed_packet' Bytes" hun "Ez eredmeny sztring nagyobb, mint a lehetseges maximum: 'max_allowed_packet'" ita "La stringa di risposta e` piu` lunga di 'max_allowed_packet'" por "'String' resultante é mais longa do que 'max_allowed_packet'" @@ -3717,7 +3717,7 @@ ER_TABLE_CANT_HANDLE_BLOB 42000 eng "The used table type doesn't support BLOB/TEXT columns" est "Valitud tabelitüüp ei toeta BLOB/TEXT tüüpi välju" fre "Ce type de table ne supporte pas les colonnes BLOB/TEXT" - ger "Der verwendete Tabellentyp unterstützt keine BLOB- und TEXT-Spalten" + ger "Der verwendete Tabellentyp unterstützt keine BLOB- und TEXT-Felder" hun "A hasznalt tabla tipus nem tamogatja a BLOB/TEXT mezoket" ita "Il tipo di tabella usata non supporta colonne di tipo BLOB/TEXT" por "Tipo de tabela usado não permite colunas BLOB/TEXT" @@ -3734,7 +3734,7 @@ ER_TABLE_CANT_HANDLE_AUTO_INCREMENT 42000 eng "The used table type doesn't support AUTO_INCREMENT columns" est "Valitud tabelitüüp ei toeta AUTO_INCREMENT tüüpi välju" fre "Ce type de table ne supporte pas les colonnes AUTO_INCREMENT" - ger "Der verwendete Tabellentyp unterstützt keine AUTO_INCREMENT-Spalten" + ger "Der verwendete Tabellentyp unterstützt keine AUTO_INCREMENT-Felder" hun "A hasznalt tabla tipus nem tamogatja az AUTO_INCREMENT tipusu mezoket" ita "Il tipo di tabella usata non supporta colonne di tipo AUTO_INCREMENT" por "Tipo de tabela usado não permite colunas AUTO_INCREMENT" @@ -3751,7 +3751,7 @@ ER_DELAYED_INSERT_TABLE_LOCKED eng "INSERT DELAYED can't be used with table '%-.64s' because it is locked with LOCK TABLES" est "INSERT DELAYED ei saa kasutada tabeli '%-.64s' peal, kuna see on lukustatud LOCK TABLES käsuga" fre "INSERT DELAYED ne peut être utilisé avec la table '%-.64s', car elle est verrouée avec LOCK TABLES" - ger "INSERT DELAYED kann nicht auf Tabelle '%-.64s' angewendet werden, da diese mit LOCK TABLES gesperrt ist" + ger "INSERT DELAYED kann für Tabelle '%-.64s' nicht verwendet werden, da sie mit LOCK TABLES gesperrt ist" greek "INSERT DELAYED can't be used with table '%-.64s', because it is locked with LOCK TABLES" hun "Az INSERT DELAYED nem hasznalhato a '%-.64s' tablahoz, mert a tabla zarolt (LOCK TABLES)" ita "L'inserimento ritardato (INSERT DELAYED) non puo` essere usato con la tabella '%-.64s', perche` soggetta a lock da 'LOCK TABLES'" @@ -3792,7 +3792,7 @@ ER_WRONG_KEY_COLUMN 42000 eng "The used storage engine can't index column '%-.64s'" est "Tabelihandler ei oska indekseerida tulpa '%-.64s'" fre "Le handler de la table ne peut indexé la colonne '%-.64s'" - ger "Der verwendete Tabellen-Handler kann die Spalte '%-.64s' nicht indizieren" + ger "Die verwendete Speicher-Engine kann die Spalte '%-.64s' nicht indizieren" greek "The used table handler can't index column '%-.64s'" hun "A hasznalt tablakezelo nem tudja a '%-.64s' mezot indexelni" ita "Il gestore delle tabelle non puo` indicizzare la colonna '%-.64s'" @@ -3839,7 +3839,7 @@ ER_DUP_UNIQUE 23000 eng "Can't write, because of unique constraint, to table '%-.64s'" est "Ei suuda kirjutada tabelisse '%-.64s', kuna see rikub ühesuse kitsendust" fre "Écriture impossible à cause d'un index UNIQUE sur la table '%-.64s'" - ger "Schreiben in Tabelle '%-.64s' nicht möglich wegen einer eindeutigen Beschränkung (unique constraint)" + ger "Schreiben in Tabelle '%-.64s' nicht möglich wegen einer Eindeutigkeitsbeschränkung (unique constraint)" hun "A '%-.64s' nem irhato, az egyedi mezok miatt" ita "Impossibile scrivere nella tabella '%-.64s' per limitazione di unicita`" por "Não pode gravar, devido à restrição UNIQUE, na tabela '%-.64s'" @@ -3880,7 +3880,7 @@ ER_PRIMARY_CANT_HAVE_NULL 42000 eng "All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead" est "Kõik PRIMARY KEY peavad olema määratletud NOT NULL piiranguga; vajadusel kasuta UNIQUE tüüpi võtit" fre "Toutes les parties d'un index PRIMARY KEY doivent être NOT NULL; Si vous avez besoin d'un NULL dans l'index, utilisez un index UNIQUE" - ger "Alle Teile eines PRIMARY KEY müssen als NOT NULL definiert sein. Wenn NULL in einem Schlüssel verwendet wird, muss ein UNIQUE-Schlüssel verwendet werden" + ger "Alle Teile eines PRIMARY KEY müssen als NOT NULL definiert sein. Wenn NULL in einem Schlüssel benötigt wird, muss ein UNIQUE-Schlüssel verwendet werden" hun "Az elsodleges kulcs teljes egeszeben csak NOT NULL tipusu lehet; Ha NULL mezot szeretne a kulcskent, hasznalja inkabb a UNIQUE-ot" ita "Tutte le parti di una chiave primaria devono essere dichiarate NOT NULL; se necessitano valori NULL nelle chiavi utilizzare UNIQUE" por "Todas as partes de uma chave primária devem ser não-nulas. Se você precisou usar um valor nulo (NULL) em uma chave, use a cláusula UNIQUE em seu lugar" @@ -3914,7 +3914,7 @@ ER_REQUIRES_PRIMARY_KEY 42000 eng "This table type requires a primary key" est "Antud tabelitüüp nõuab primaarset võtit" fre "Ce type de table nécessite une clé primaire (PRIMARY KEY)" - ger "Dieser Tabellentyp benötigt einen PRIMARY KEY" + ger "Dieser Tabellentyp benötigt einen Primärschlüssel (PRIMARY KEY)" hun "Az adott tablatipushoz elsodleges kulcs hasznalata kotelezo" ita "Questo tipo di tabella richiede una chiave primaria" por "Este tipo de tabela requer uma chave primária" @@ -3948,7 +3948,7 @@ ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE eng "You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column" est "Katse muuta tabelit turvalises rezhiimis ilma WHERE klauslita" fre "Vous êtes en mode 'safe update' et vous essayez de faire un UPDATE sans clause WHERE utilisant un index" - ger "MySQL läuft im sicheren Aktualisierungsmodus (safe update mode). Sie haben versucht, eine Tabelle zu aktualisieren, ohne in der WHERE-Klausel eine KEY-Spalte anzugeben" + ger "MySQL läuft im sicheren Aktualisierungsmodus (safe update mode). Sie haben versucht, eine Tabelle zu aktualisieren, ohne in der WHERE-Klausel ein KEY-Feld anzugeben" hun "On a biztonsagos update modot hasznalja, es WHERE that uses a KEY column" ita "In modalita` 'safe update' si e` cercato di aggiornare una tabella senza clausola WHERE su una chiave" por "Você está usando modo de atualização seguro e tentou atualizar uma tabela sem uma cláusula WHERE que use uma coluna chave" @@ -4100,7 +4100,7 @@ ER_NEW_ABORTING_CONNECTION 08S01 eng "Aborted connection %ld to db: '%-.64s' user: '%-.32s' host: '%-.64s' (%-.64s)" est "Ühendus katkestatud %ld andmebaas: '%-.64s' kasutaja: '%-.32s' masin: '%-.64s' (%-.64s)" fre "Connection %ld avortée vers la bd: '%-.64s' utilisateur: '%-.32s' hôte: '%-.64s' (%-.64s)" - ger "Verbindungsabbruch %ld zur Datenbank '%-.64s'. Benutzer: '%-.32s', Host: '%-.64s' (%-.64s)" + ger "Abbruch der Verbindung %ld zur Datenbank '%-.64s'. Benutzer: '%-.32s', Host: '%-.64s' (%-.64s)" ita "Interrotta la connessione %ld al db: ''%-.64s' utente: '%-.32s' host: '%-.64s' (%-.64s)" por "Conexão %ld abortada para banco de dados '%-.64s' - usuário '%-.32s' - 'host' '%-.64s' ('%-.64s')" rus "ðÒÅÒ×ÁÎÏ ÓÏÅÄÉÎÅÎÉÅ %ld Ë ÂÁÚÅ ÄÁÎÎÙÈ '%-.64s' ÐÏÌØÚÏ×ÁÔÅÌÑ '%-.32s' Ó ÈÏÓÔÁ '%-.64s' (%-.64s)" @@ -4137,7 +4137,7 @@ ER_INDEX_REBUILD nla "Gefaald tijdens heropbouw index van gedumpte tabel '%-.64s'" eng "Failed rebuilding the index of dumped table '%-.64s'" fre "La reconstruction de l'index de la table copiée '%-.64s' a échoué" - ger "Neuerstellung des Indizes der Dump-Tabelle '%-.64s' fehlgeschlagen" + ger "Neuerstellung des Index der Dump-Tabelle '%-.64s' fehlgeschlagen" greek "Failed rebuilding the index of dumped table '%-.64s'" hun "Failed rebuilding the index of dumped table '%-.64s'" ita "Fallita la ricostruzione dell'indice della tabella copiata '%-.64s'" @@ -4195,7 +4195,7 @@ ER_FT_MATCHING_KEY_NOT_FOUND eng "Can't find FULLTEXT index matching the column list" est "Ei suutnud leida FULLTEXT indeksit, mis kattuks kasutatud tulpadega" fre "Impossible de trouver un index FULLTEXT correspondant à cette liste de colonnes" - ger "Kann keinen FULLTEXT-Index finden, der der Spaltenliste entspricht" + ger "Kann keinen FULLTEXT-Index finden, der der Feldliste entspricht" ita "Impossibile trovare un indice FULLTEXT che corrisponda all'elenco delle colonne" por "Não pode encontrar um índice para o texto todo que combine com a lista de colunas" rus "îÅ×ÏÚÍÏÖÎÏ ÏÔÙÓËÁÔØ ÐÏÌÎÏÔÅËÓÔÏ×ÙÊ (FULLTEXT) ÉÎÄÅËÓ, ÓÏÏÔ×ÅÔÓÔ×ÕÀÝÉÊ ÓÐÉÓËÕ ÓÔÏÌÂÃÏ×" @@ -4283,7 +4283,7 @@ ER_TRANS_CACHE_FULL eng "Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mysqld variable and try again" est "Mitme lausendiga transaktsioon nõudis rohkem ruumi kui lubatud 'max_binlog_cache_size' muutujaga. Suurenda muutuja väärtust ja proovi uuesti" fre "Cette transaction à commandes multiples nécessite plus de 'max_binlog_cache_size' octets de stockage, augmentez cette variable de mysqld et réessayez" - ger "Transaktionen, die aus mehreren Befehlen bestehen, benötigen mehr als 'max_binlog_cache_size' Bytes an Speicher. Diese mysqld-Variable bitte vergrössern und erneut versuchen" + ger "Transaktionen, die aus mehreren Befehlen bestehen, benötigten mehr als 'max_binlog_cache_size' Bytes an Speicher. Btte vergrössern Sie diese Server-Variable versuchen Sie es noch einmal" ita "La transazione a comandi multipli (multi-statement) ha richiesto piu` di 'max_binlog_cache_size' bytes di disco: aumentare questa variabile di mysqld e riprovare" por "Transações multi-declaradas (multi-statement transactions) requeriram mais do que o valor limite (max_binlog_cache_size) de bytes para armazenagem. Aumente o valor desta variável do mysqld e tente novamente" rus "ôÒÁÎÚÁËÃÉÉ, ×ËÌÀÞÁÀÝÅÊ ÂÏÌØÛÏÅ ËÏÌÉÞÅÓÔ×Ï ËÏÍÁÎÄ, ÐÏÔÒÅÂÏ×ÁÌÏÓØ ÂÏÌÅÅ ÞÅÍ 'max_binlog_cache_size' ÂÁÊÔ. õ×ÅÌÉÞØÔÅ ÜÔÕ ÐÅÒÅÍÅÎÎÕÀ ÓÅÒ×ÅÒÁ mysqld É ÐÏÐÒÏÂÕÊÔÅ ÅÝÅ ÒÁÚ" @@ -4295,7 +4295,7 @@ ER_SLAVE_MUST_STOP nla "Deze operatie kan niet worden uitgevoerd met een actieve slave, doe eerst STOP SLAVE" eng "This operation cannot be performed with a running slave; run STOP SLAVE first" fre "Cette opération ne peut être réalisée avec un esclave actif, faites STOP SLAVE d'abord" - ger "Diese Operation kann nicht bei einem aktiven Slave durchgeführt werden. Bitte zuerst STOP SLAVE ausführen" + ger "Diese Operation kann bei einem aktiven Slave nicht durchgeführt werden. Bitte zuerst STOP SLAVE ausführen" ita "Questa operazione non puo' essere eseguita con un database 'slave' che gira, lanciare prima STOP SLAVE" por "Esta operação não pode ser realizada com um 'slave' em execução. Execute STOP SLAVE primeiro" rus "üÔÕ ÏÐÅÒÁÃÉÀ ÎÅ×ÏÚÍÏÖÎÏ ×ÙÐÏÌÎÉÔØ ÐÒÉ ÒÁÂÏÔÁÀÝÅÍ ÐÏÔÏËÅ ÐÏÄÞÉÎÅÎÎÏÇÏ ÓÅÒ×ÅÒÁ. óÎÁÞÁÌÁ ×ÙÐÏÌÎÉÔÅ STOP SLAVE" @@ -4332,6 +4332,7 @@ ER_BAD_SLAVE ER_MASTER_INFO eng "Could not initialize master info structure; more error messages can be found in the MySQL error log" fre "Impossible d'initialiser les structures d'information de maître, vous trouverez des messages d'erreur supplémentaires dans le journal des erreurs de MySQL" + ger "Konnte Master-Info-Struktur nicht initialisieren. Weitere Fehlermeldungen können im MySQL-Error-Log eingesehen werden" serbian "Nisam mogao da inicijalizujem informacionu strukturu glavnog servera, proverite da li imam privilegije potrebne za pristup file-u 'master.info'" swe "Kunde inte initialisera replikationsstrukturerna. See MySQL fel fil för mera information" ER_SLAVE_THREAD @@ -4339,7 +4340,7 @@ ER_SLAVE_THREAD nla "Kon slave thread niet aanmaken, controleer systeem resources" eng "Could not create slave thread; check system resources" fre "Impossible de créer une tâche esclave, vérifiez les ressources système" - ger "Konnte keinen Slave-Thread starten. Bitte System-Ressourcen überprüfen" + ger "Konnte Slave-Thread nicht starten. Bitte System-Ressourcen überprüfen" ita "Impossibile creare il thread 'slave', controllare le risorse di sistema" por "Não conseguiu criar 'thread' de 'slave'. Verifique os recursos do sistema" rus "îÅ×ÏÚÍÏÖÎÏ ÓÏÚÄÁÔØ ÐÏÔÏË ÐÏÄÞÉÎÅÎÎÏÇÏ ÓÅÒ×ÅÒÁ. ðÒÏ×ÅÒØÔÅ ÓÉÓÔÅÍÎÙÅ ÒÅÓÕÒÓÙ" @@ -4353,7 +4354,7 @@ ER_TOO_MANY_USER_CONNECTIONS 42000 eng "User %-.64s already has more than 'max_user_connections' active connections" est "Kasutajal %-.64s on juba rohkem ühendusi kui lubatud 'max_user_connections' muutujaga" fre "L'utilisateur %-.64s possède déjà plus de 'max_user_connections' connections actives" - ger "Benutzer '%-.64s' hat mehr als max_user_connections aktive Verbindungen" + ger "Benutzer '%-.64s' hat mehr als 'max_user_connections' aktive Verbindungen" ita "L'utente %-.64s ha gia' piu' di 'max_user_connections' connessioni attive" por "Usuário '%-.64s' já possui mais que o valor máximo de conexões (max_user_connections) ativas" rus "õ ÐÏÌØÚÏ×ÁÔÅÌÑ %-.64s ÕÖÅ ÂÏÌØÛÅ ÞÅÍ 'max_user_connections' ÁËÔÉ×ÎÙÈ ÓÏÅÄÉÎÅÎÉÊ" @@ -4409,7 +4410,7 @@ ER_READ_ONLY_TRANSACTION 25000 eng "Update locks cannot be acquired during a READ UNCOMMITTED transaction" est "Uuenduslukke ei saa kasutada READ UNCOMMITTED transaktsiooni käigus" fre "Un verrou en update ne peut être acquit pendant une transaction READ UNCOMMITTED" - ger "Während einer READ UNCOMMITED-Transaktion können keine UPDATE-Sperren angefordert werden" + ger "Während einer READ-UNCOMMITTED-Transaktion können keine UPDATE-Sperren angefordert werden" ita "I lock di aggiornamento non possono essere acquisiti durante una transazione 'READ UNCOMMITTED'" por "Travamentos de atualização não podem ser obtidos durante uma transação de tipo READ UNCOMMITTED" rus "âÌÏËÉÒÏ×ËÉ ÏÂÎÏ×ÌÅÎÉÊ ÎÅÌØÚÑ ÐÏÌÕÞÉÔØ × ÐÒÏÃÅÓÓÅ ÞÔÅÎÉÑ ÎÅ ÐÒÉÎÑÔÏÊ (× ÒÅÖÉÍÅ READ UNCOMMITTED) ÔÒÁÎÚÁËÃÉÉ" @@ -4463,7 +4464,7 @@ ER_NO_PERMISSION_TO_CREATE_USER 42000 eng "'%-.32s'@'%-.64s' is not allowed to create new users" est "Kasutajal '%-.32s'@'%-.64s' ei ole lubatud luua uusi kasutajaid" fre "'%-.32s'@'%-.64s' n'est pas autorisé à créer de nouveaux utilisateurs" - ger "'%-.32s'@'%-.64s' is nicht berechtigt, neue Benutzer hinzuzufügen" + ger "'%-.32s'@'%-.64s' ist nicht berechtigt, neue Benutzer hinzuzufügen" ita "A '%-.32s'@'%-.64s' non e' permesso creare nuovi utenti" por "Não é permitido a '%-.32s'@'%-.64s' criar novos usuários" rus "'%-.32s'@'%-.64s' ÎÅ ÒÁÚÒÅÛÁÅÔÓÑ ÓÏÚÄÁ×ÁÔØ ÎÏ×ÙÈ ÐÏÌØÚÏ×ÁÔÅÌÅÊ" @@ -4488,7 +4489,7 @@ ER_LOCK_DEADLOCK 40001 eng "Deadlock found when trying to get lock; try restarting transaction" est "Lukustamisel tekkis tupik (deadlock); alusta transaktsiooni otsast" fre "Deadlock découvert en essayant d'obtenir les verrous : essayez de redémarrer la transaction" - ger "Beim Versuch, eine Sperre anzufordern, ist ein Deadlock aufgetreten. Versuchen Sie, die Transaktion erneut zu starten" + ger "Beim Versuch, eine Sperre anzufordern, ist ein Deadlock aufgetreten. Versuchen Sie, die Transaktion neu zu starten" ita "Trovato deadlock durante il lock; Provare a far ripartire la transazione" por "Encontrado um travamento fatal (deadlock) quando tentava obter uma trava. Tente reiniciar a transação." rus "÷ÏÚÎÉËÌÁ ÔÕÐÉËÏ×ÁÑ ÓÉÔÕÁÃÉÑ × ÐÒÏÃÅÓÓÅ ÐÏÌÕÞÅÎÉÑ ÂÌÏËÉÒÏ×ËÉ; ðÏÐÒÏÂÕÊÔÅ ÐÅÒÅÚÁÐÕÓÔÉÔØ ÔÒÁÎÚÁËÃÉÀ" @@ -4512,7 +4513,7 @@ ER_CANNOT_ADD_FOREIGN nla "Kan foreign key beperking niet toevoegen" eng "Cannot add foreign key constraint" fre "Impossible d'ajouter des contraintes d'index externe" - ger "Fremdschlüssel-Beschränkung konnte nicht hinzugefügt werden" + ger "Fremdschlüssel-Beschränkung kann nicht hinzugefügt werden" ita "Impossibile aggiungere il vincolo di integrita' referenziale (foreign key constraint)" por "Não pode acrescentar uma restrição de chave estrangeira" rus "îÅ×ÏÚÍÏÖÎÏ ÄÏÂÁ×ÉÔØ ÏÇÒÁÎÉÞÅÎÉÑ ×ÎÅÛÎÅÇÏ ËÌÀÞÁ" @@ -4523,7 +4524,7 @@ ER_NO_REFERENCED_ROW 23000 nla "Kan onderliggende rij niet toevoegen: foreign key beperking gefaald" eng "Cannot add or update a child row: a foreign key constraint fails" fre "Impossible d'ajouter un enregistrement fils : une constrainte externe l'empèche" - ger "Hinzufügen eines Kind-Datensatzes schlug aufgrund einer Fremdschlüssel-Beschränkung fehl" + ger "Hinzufügen oder Aktualisieren eines Kind-Datensatzes schlug aufgrund einer Fremdschlüssel-Beschränkung fehl" greek "Cannot add a child row: a foreign key constraint fails" hun "Cannot add a child row: a foreign key constraint fails" ita "Impossibile aggiungere la riga: un vincolo d'integrita' referenziale non e' soddisfatto" @@ -4535,7 +4536,7 @@ ER_NO_REFERENCED_ROW 23000 ER_ROW_IS_REFERENCED 23000 eng "Cannot delete or update a parent row: a foreign key constraint fails" fre "Impossible de supprimer un enregistrement père : une constrainte externe l'empèche" - ger "Löschen eines Eltern-Datensatzes schlug aufgrund einer Fremdschlüssel-Beschränkung fehl" + ger "Löschen oder Aktualisieren eines Eltern-Datensatzes schlug aufgrund einer Fremdschlüssel-Beschränkung fehl" greek "Cannot delete a parent row: a foreign key constraint fails" hun "Cannot delete a parent row: a foreign key constraint fails" ita "Impossibile cancellare la riga: un vincolo d'integrita' referenziale non e' soddisfatto" @@ -4589,7 +4590,7 @@ ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT 21000 nla "De gebruikte SELECT commando's hebben een verschillend aantal kolommen" eng "The used SELECT statements have a different number of columns" est "Tulpade arv kasutatud SELECT lausetes ei kattu" - ger "Die verwendeten SELECT-Befehle liefern eine unterschiedliche Anzahl von Spalten zurück" + ger "Die verwendeten SELECT-Befehle liefern eine unterschiedliche Anzahl von Feldern zurück" ita "La SELECT utilizzata ha un numero di colonne differente" por "Os comandos SELECT usados têm diferente número de colunas" rus "éÓÐÏÌØÚÏ×ÁÎÎÙÅ ÏÐÅÒÁÔÏÒÙ ×ÙÂÏÒËÉ (SELECT) ÄÁÀÔ ÒÁÚÎÏÅ ËÏÌÉÞÅÓÔ×Ï ÓÔÏÌÂÃÏ×" @@ -4600,7 +4601,7 @@ ER_CANT_UPDATE_WITH_READLOCK nla "Kan de query niet uitvoeren vanwege een conflicterende read lock" eng "Can't execute the query because you have a conflicting read lock" est "Ei suuda täita päringut konfliktse luku tõttu" - ger "Augrund eines READ LOCK-Konflikts kann die Abfrage nicht ausgeführt werden" + ger "Augrund eines READ-LOCK-Konflikts kann die Abfrage nicht ausgeführt werden" ita "Impossibile eseguire la query perche' c'e' un conflitto con in lock di lettura" por "Não posso executar a consulta porque você tem um conflito de travamento de leitura" rus "îÅ×ÏÚÍÏÖÎÏ ÉÓÐÏÌÎÉÔØ ÚÁÐÒÏÓ, ÐÏÓËÏÌØËÕ Õ ×ÁÓ ÕÓÔÁÎÏ×ÌÅÎÙ ËÏÎÆÌÉËÔÕÀÝÉÅ ÂÌÏËÉÒÏ×ËÉ ÞÔÅÎÉÑ" @@ -4640,7 +4641,7 @@ ER_USER_LIMIT_REACHED 42000 ER_SPECIFIC_ACCESS_DENIED_ERROR 42000 nla "Toegang geweigerd. U moet het %-.128s privilege hebben voor deze operatie" eng "Access denied; you need the %-.128s privilege for this operation" - ger "Befehl nicht zulässig. Hierfür wird die Berechtigung %-.128s benötigt" + ger "Kein Zugriff. Hierfür wird die Berechtigung %-.128s benötigt" ita "Accesso non consentito. Serve il privilegio %-.128s per questa operazione" por "Acesso negado. Você precisa o privilégio %-.128s para essa operação" rus "÷ ÄÏÓÔÕÐÅ ÏÔËÁÚÁÎÏ. ÷ÁÍ ÎÕÖÎÙ ÐÒÉ×ÉÌÅÇÉÉ %-.128s ÄÌÑ ÜÔÏÊ ÏÐÅÒÁÃÉÉ" @@ -4722,7 +4723,7 @@ ER_NOT_SUPPORTED_YET 42000 ER_MASTER_FATAL_ERROR_READING_BINLOG nla "Kreeg fatale fout %d: '%-.128s' van master tijdens lezen van data uit binaire log" eng "Got fatal error %d: '%-.128s' from master when reading data from binary log" - ger "Schwerer Fehler %d: '%-.128s vom Master beim Lesen des binären Logs aufgetreten" + ger "Schwerer Fehler %d: '%-.128s vom Master beim Lesen des binären Logs" ita "Errore fatale %d: '%-.128s' dal master leggendo i dati dal log binario" por "Obteve fatal erro %d: '%-.128s' do master quando lendo dados do binary log" rus "ðÏÌÕÞÅÎÁ ÎÅÉÓÐÒÁ×ÉÍÁÑ ÏÛÉÂËÁ %d: '%-.128s' ÏÔ ÇÏÌÏ×ÎÏÇÏ ÓÅÒ×ÅÒÁ × ÐÒÏÃÅÓÓÅ ×ÙÂÏÒËÉ ÄÁÎÎÙÈ ÉÚ Ä×ÏÉÞÎÏÇÏ ÖÕÒÎÁÌÁ" @@ -4737,11 +4738,12 @@ ER_SLAVE_IGNORED_TABLE ER_INCORRECT_GLOBAL_LOCAL_VAR eng "Variable '%-.64s' is a %s variable" serbian "Incorrect foreign key definition for '%-.64s': %s" + ger "Variable '%-.64s' ist eine %s-Variable" spa "Variable '%-.64s' es una %s variable" swe "Variabel '%-.64s' är av typ %s" ER_WRONG_FK_DEF 42000 eng "Incorrect foreign key definition for '%-.64s': %s" - ger "Falsche Fremdschlüssel-Definition für '%-64s': %s" + ger "Falsche Fremdschlüssel-Definition für '%-.64s': %s" por "Definição errada da chave estrangeira para '%-.64s': %s" spa "Equivocada definición de llave extranjera para '%-.64s': %s" swe "Felaktig FOREIGN KEY-definition för '%-.64s': %s" @@ -4753,7 +4755,7 @@ ER_KEY_REF_DO_NOT_MATCH_TABLE_REF swe "Nyckelreferensen och tabellreferensen stämmer inte överens" ER_OPERAND_COLUMNS 21000 eng "Operand should contain %d column(s)" - ger "Operand solle %d Spalte(n) enthalten" + ger "Operand sollte %d Spalte(n) enthalten" rus "ïÐÅÒÁÎÄ ÄÏÌÖÅÎ ÓÏÄÅÒÖÁÔØ %d ËÏÌÏÎÏË" spa "Operando debe tener %d columna(s)" ukr "ïÐÅÒÁÎÄ ÍÁ¤ ÓËÌÁÄÁÔÉÓÑ Ú %d ÓÔÏ×Âæ×" @@ -4789,7 +4791,7 @@ ER_CYCLIC_REFERENCE ukr "ãÉË̦ÞÎÅ ÐÏÓÉÌÁÎÎÑ ÎÁ ЦÄÚÁÐÉÔ" ER_AUTO_CONVERT eng "Converting column '%s' from %s to %s" - ger "Spalte '%s' wird von %s nach %s umgewandelt" + ger "Feld '%s' wird von %s nach %s umgewandelt" por "Convertendo coluna '%s' de %s para %s" rus "ðÒÅÏÂÒÁÚÏ×ÁÎÉÅ ÐÏÌÑ '%s' ÉÚ %s × %s" spa "Convirtiendo columna '%s' de %s para %s" @@ -4831,7 +4833,7 @@ ER_NOT_SUPPORTED_AUTH_MODE 08004 swe "Klienten stöder inte autentiseringsprotokollet som begärts av servern; överväg uppgradering av klientprogrammet." ER_SPATIAL_CANT_HAVE_NULL 42000 eng "All parts of a SPATIAL index must be NOT NULL" - ger "Alle Teile eines SPATIAL index müssen als NOT NULL deklariert sein" + ger "Alle Teile eines SPATIAL-Index müssen als NOT NULL deklariert sein" por "Todas as partes de uma SPATIAL index devem ser NOT NULL" spa "Todas las partes de una SPATIAL index deben ser NOT NULL" swe "Alla delar av en SPATIAL index måste vara NOT NULL" @@ -4855,12 +4857,12 @@ ER_SLAVE_WAS_NOT_RUNNING swe "Slaven har redan stoppat" ER_TOO_BIG_FOR_UNCOMPRESS eng "Uncompressed data size too large; the maximum size is %d (probably, length of uncompressed data was corrupted)" - ger "Unkomprimierte Daten sind zu groß. Die maximale Größe beträgt %d" + ger "Unkomprimierte Daten sind zu groß. Die maximale Größe beträgt %d (wahrscheinlich wurde die Länge der unkomprimierten Daten beschädigt)" por "Tamanho muito grande dos dados des comprimidos. O máximo tamanho é %d. (provavelmente, o comprimento dos dados descomprimidos está corrupto)" spa "Tamaño demasiado grande para datos descomprimidos. El máximo tamaño es %d. (probablemente, extensión de datos descomprimidos fué corrompida)" ER_ZLIB_Z_MEM_ERROR eng "ZLIB: Not enough memory" - ger "ZLIB: Steht nicht genug Speicher zur Verfügung" + ger "ZLIB: Nicht genug Speicher" por "ZLIB: Não suficiente memória disponível" spa "Z_MEM_ERROR: No suficiente memoria para zlib" ER_ZLIB_Z_BUF_ERROR @@ -4882,27 +4884,24 @@ ER_CUT_VALUE_GROUP_CONCAT ukr "%d line(s) was(were) cut by group_concat()" ER_WARN_TOO_FEW_RECORDS 01000 eng "Row %ld doesn't contain data for all columns" - ger "Anzahl der Datensätze in Zeile %ld geringer als Anzahl der Spalten" + ger "Zeile %ld enthält nicht für alle Felder Daten" por "Conta de registro é menor que a conta de coluna na linha %ld" spa "Línea %ld no contiene datos para todas las columnas" ER_WARN_TOO_MANY_RECORDS 01000 eng "Row %ld was truncated; it contained more data than there were input columns" - ger "Anzahl der Datensätze in Zeile %ld größer als Anzahl der Spalten" + ger "Zeile %ld gekürzt, die Zeile enthielt mehr Daten, als es Eingabefelder gibt" por "Conta de registro é maior que a conta de coluna na linha %ld" spa "Línea %ld fué truncada; La misma contine mas datos que las que existen en las columnas de entrada" ER_WARN_NULL_TO_NOTNULL 22004 eng "Column set to default value; NULL supplied to NOT NULL column '%s' at row %ld" - ger "Daten abgeschnitten, NULL für NOT NULL-Spalte '%s' in Zeile %ld angegeben" + ger "Feld auf Vorgabewert gesetzt, da NULL für NOT-NULL-Feld '%s' in Zeile %ld angegeben" por "Dado truncado, NULL fornecido para NOT NULL coluna '%s' na linha %ld" spa "Datos truncado, NULL suministrado para NOT NULL columna '%s' en la línea %ld" ER_WARN_DATA_OUT_OF_RANGE 22003 - eng "Out of range value adjusted for column '%s' at row %ld" - ger "Daten abgeschnitten, außerhalb des Wertebereichs für Spalte '%s' in Zeile %ld" - por "Dado truncado, fora de alcance para coluna '%s' na linha %ld" - spa "Datos truncados, fuera de gama para columna '%s' en la línea %ld" + eng "Out of range value for column '%s' at row %ld" WARN_DATA_TRUNCATED 01000 eng "Data truncated for column '%s' at row %ld" - ger "Daten abgeschnitten für Spalte '%s' in Zeile %ld" + ger "Daten abgeschnitten für Feld '%s' in Zeile %ld" por "Dado truncado para coluna '%s' na linha %ld" spa "Datos truncados para columna '%s' en la línea %ld" ER_WARN_USING_OTHER_HANDLER @@ -4913,40 +4912,40 @@ ER_WARN_USING_OTHER_HANDLER swe "Använder handler %s för tabell '%s'" ER_CANT_AGGREGATE_2COLLATIONS eng "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'" - ger "Unerlaubte Vermischung der Kollationen (%s,%s) und (%s,%s) für die Operation '%s'" + ger "Unerlaubte Mischung von Sortierreihenfolgen (%s, %s) und (%s, %s) für Operation '%s'" por "Combinação ilegal de collations (%s,%s) e (%s,%s) para operação '%s'" spa "Ilegal mezcla de collations (%s,%s) y (%s,%s) para operación '%s'" ER_DROP_USER eng "Cannot drop one or more of the requested users" ger "Kann einen oder mehrere der angegebenen Benutzer nicht löschen" ER_REVOKE_GRANTS - eng "Can't revoke all privileges, grant for one or more of the requested users" - ger "Kann nicht alle Berechtigungen widerrufen, grant for one or more of the requested users" + eng "Can't revoke all privileges for one or more of the requested users" + ger "Kann nicht alle Berechtigungen widerrufen, die für einen oder mehrere Benutzer gewährt wurden" por "Não pode revocar todos os privilégios, grant para um ou mais dos usuários pedidos" spa "No puede revocar todos los privilegios, derecho para uno o mas de los usuarios solicitados" ER_CANT_AGGREGATE_3COLLATIONS eng "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'" - ger "Unerlaubte Vermischung der Kollationen (%s,%s), (%s,%s), (%s,%s) für die Operation '%s'" + ger "Unerlaubte Mischung von Sortierreihenfolgen (%s, %s), (%s, %s), (%s, %s) für Operation '%s'" por "Ilegal combinação de collations (%s,%s), (%s,%s), (%s,%s) para operação '%s'" spa "Ilegal mezcla de collations (%s,%s), (%s,%s), (%s,%s) para operación '%s'" ER_CANT_AGGREGATE_NCOLLATIONS eng "Illegal mix of collations for operation '%s'" - ger "Unerlaubte Vermischung der Kollationen für die Operation '%s'" + ger "Unerlaubte Mischung von Sortierreihenfolgen für Operation '%s'" por "Ilegal combinação de collations para operação '%s'" spa "Ilegal mezcla de collations para operación '%s'" ER_VARIABLE_IS_NOT_STRUCT eng "Variable '%-.64s' is not a variable component (can't be used as XXXX.variable_name)" - ger "Variable '%-.64s' ist keine Variablen-Komponenten (kann nicht als XXXX.variablen_name verwendet werden)" + ger "Variable '%-.64s' ist keine Variablen-Komponente (kann nicht als XXXX.variablen_name verwendet werden)" por "Variável '%-.64s' não é uma variável componente (Não pode ser usada como XXXX.variável_nome)" spa "Variable '%-.64s' no es una variable componente (No puede ser usada como XXXX.variable_name)" ER_UNKNOWN_COLLATION eng "Unknown collation: '%-.64s'" - ger "Unbekannte Kollation: '%-.64s'" + ger "Unbekannte Sortierreihenfolge: '%-.64s'" por "Collation desconhecida: '%-.64s'" spa "Collation desconocida: '%-.64s'" ER_SLAVE_IGNORED_SSL_PARAMS eng "SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support; they can be used later if MySQL slave with SSL is started" - ger "SSL-Parameter in CHANGE MASTER werden ignoriert, weil dieser MySQL-Slave ohne SSL-Unterstützung kompiliert wurde. Sie können aber später verwendet werden, wenn der MySQL-Slave mit SSL gestartet wird" + ger "SSL-Parameter in CHANGE MASTER werden ignoriert, weil dieser MySQL-Slave ohne SSL-Unterstützung kompiliert wurde. Sie können aber später verwendet werden, wenn ein MySQL-Slave mit SSL gestartet wird" por "SSL parâmetros em CHANGE MASTER são ignorados porque este escravo MySQL foi compilado sem o SSL suporte. Os mesmos podem ser usados mais tarde quando o escravo MySQL com SSL seja iniciado." spa "Parametros SSL en CHANGE MASTER son ignorados porque este slave MySQL fue compilado sin soporte SSL; pueden ser usados despues cuando el slave MySQL con SSL sea inicializado" ER_SERVER_IS_IN_SECURE_AUTH_MODE @@ -4969,7 +4968,7 @@ ER_BAD_SLAVE_UNTIL_COND spa "Parametro equivocado o combinación de parametros para START SLAVE UNTIL" ER_MISSING_SKIP_SLAVE eng "It is recommended to use --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL; otherwise, you will get problems if you get an unexpected slave's mysqld restart" - ger "Es wird empfohlen, mit --skip-slave-start zu starten, wenn mit START SLAVE UNTIL eine Schritt-für-Schritt-Replikation ausgeführt wird. Ansonsten gibt es Probleme, wenn der Slave-Server unerwartet neu startet" + ger "Es wird empfohlen, mit --skip-slave-start zu starten, wenn mit START SLAVE UNTIL eine Schritt-für-Schritt-Replikation ausgeführt wird. Ansonsten gibt es Probleme, wenn ein Slave-Server unerwartet neu startet" por "É recomendado para rodar com --skip-slave-start quando fazendo replicação passo-por-passo com START SLAVE UNTIL, de outra forma você não está seguro em caso de inesperada reinicialição do mysqld escravo" spa "Es recomendado rodar con --skip-slave-start cuando haciendo replicación step-by-step con START SLAVE UNTIL, a menos que usted no esté seguro en caso de inesperada reinicialización del mysqld slave" ER_UNTIL_COND_IGNORED @@ -4979,16 +4978,19 @@ ER_UNTIL_COND_IGNORED spa "SQL thread no es inicializado tal que opciones UNTIL son ignoradas" ER_WRONG_NAME_FOR_INDEX 42000 eng "Incorrect index name '%-.100s'" + ger "Falscher Indexname '%-.100s'" por "Incorreto nome de índice '%-.100s'" spa "Nombre de índice incorrecto '%-.100s'" swe "Felaktigt index namn '%-.100s'" ER_WRONG_NAME_FOR_CATALOG 42000 eng "Incorrect catalog name '%-.100s'" + ger "Falscher Katalogname '%-.100s'" por "Incorreto nome de catálogo '%-.100s'" spa "Nombre de catalog incorrecto '%-.100s'" swe "Felaktigt katalog namn '%-.100s'" ER_WARN_QC_RESIZE eng "Query cache failed to set size %lu; new query cache size is %lu" + ger "Änderung der Query-Cache-Größe auf %lu fehlgeschlagen; neue Query-Cache-Größe ist %lu" por "Falha em Query cache para configurar tamanho %lu, novo tamanho de query cache é %lu" rus "ëÅÛ ÚÁÐÒÏÓÏ× ÎÅ ÍÏÖÅÔ ÕÓÔÁÎÏ×ÉÔØ ÒÁÚÍÅÒ %lu, ÎÏ×ÙÊ ÒÁÚÍÅÒ ËÅÛÁ ÚÐÒÏÓÏ× - %lu" spa "Query cache fallada para configurar tamaño %lu, nuevo tamaño de query cache es %lu" @@ -4996,28 +4998,34 @@ ER_WARN_QC_RESIZE ukr "ëÅÛ ÚÁÐÉÔ¦× ÎÅÓÐÒÏÍÏÖÅÎ ×ÓÔÁÎÏ×ÉÔÉ ÒÏÚÍ¦Ò %lu, ÎÏ×ÉÊ ÒÏÚÍ¦Ò ËÅÛÁ ÚÁÐÉÔ¦× - %lu" ER_BAD_FT_COLUMN eng "Column '%-.64s' cannot be part of FULLTEXT index" + ger "Feld '%-.64s' kann nicht Teil eines FULLTEXT-Index sein" por "Coluna '%-.64s' não pode ser parte de índice FULLTEXT" spa "Columna '%-.64s' no puede ser parte de FULLTEXT index" swe "Kolumn '%-.64s' kan inte vara del av ett FULLTEXT index" ER_UNKNOWN_KEY_CACHE eng "Unknown key cache '%-.100s'" + ger "Unbekannter Schlüssel-Cache '%-.100s'" por "Key cache desconhecida '%-.100s'" spa "Desconocida key cache '%-.100s'" swe "Okänd nyckel cache '%-.100s'" ER_WARN_HOSTNAME_WONT_WORK eng "MySQL is started in --skip-name-resolve mode; you must restart it without this switch for this grant to work" + ger "MySQL wurde mit --skip-name-resolve gestartet. Diese Option darf nicht verwendet werden, damit diese Rechtevergabe möglich ist" por "MySQL foi inicializado em modo --skip-name-resolve. Você necesita reincializá-lo sem esta opção para este grant funcionar" spa "MySQL esta inicializado en modo --skip-name-resolve. Usted necesita reinicializarlo sin esta opción para este derecho funcionar" ER_UNKNOWN_STORAGE_ENGINE 42000 eng "Unknown table engine '%s'" + ger "Unbekannte Speicher-Engine '%s'" por "Motor de tabela desconhecido '%s'" spa "Desconocido motor de tabla '%s'" ER_WARN_DEPRECATED_SYNTAX eng "'%s' is deprecated; use '%s' instead" + ger "'%s' ist veraltet. Bitte benutzen Sie '%s'" por "'%s' é desatualizado. Use '%s' em seu lugar" spa "'%s' está desaprobado, use '%s' en su lugar" ER_NON_UPDATABLE_TABLE eng "The target table %-.100s of the %s is not updatable" + ger "Die Zieltabelle %-.100s von %s ist nicht aktualisierbar" por "A tabela destino %-.100s do %s não é atualizável" rus "ôÁÂÌÉÃÁ %-.100s × %s ÎÅ ÍÏÖÅÔ ÉÚÍÅÎÑÔÓÑ" spa "La tabla destino %-.100s del %s no es actualizable" @@ -5025,402 +5033,570 @@ ER_NON_UPDATABLE_TABLE ukr "ôÁÂÌÉÃÑ %-.100s Õ %s ÎÅ ÍÏÖÅ ÏÎÏ×ÌÀ×ÁÔÉÓØ" ER_FEATURE_DISABLED eng "The '%s' feature is disabled; you need MySQL built with '%s' to have it working" + ger "Das Feature '%s' ist ausgeschaltet, Sie müssen MySQL mit '%s' übersetzen, damit es verfügbar ist" por "O recurso '%s' foi desativado; você necessita MySQL construído com '%s' para ter isto funcionando" spa "El recurso '%s' fue deshabilitado; usted necesita construir MySQL con '%s' para tener eso funcionando" swe "'%s' är inte aktiverad; För att aktivera detta måste du bygga om MySQL med '%s' definerad" ER_OPTION_PREVENTS_STATEMENT eng "The MySQL server is running with the %s option so it cannot execute this statement" + ger "Der MySQL-Server läuft mit der Option %s und kann diese Anweisung deswegen nicht ausführen" por "O servidor MySQL está rodando com a opção %s razão pela qual não pode executar esse commando" spa "El servidor MySQL está rodando con la opción %s tal que no puede ejecutar este comando" swe "MySQL är startad med --skip-grant-tables. Pga av detta kan du inte använda detta kommando" ER_DUPLICATED_VALUE_IN_TYPE eng "Column '%-.100s' has duplicated value '%-.64s' in %s" + ger "Feld '%-.100s' hat doppelten Wert '%-.64s' in %s" por "Coluna '%-.100s' tem valor duplicado '%-.64s' em %s" spa "Columna '%-.100s' tiene valor doblado '%-.64s' en %s" ER_TRUNCATED_WRONG_VALUE 22007 eng "Truncated incorrect %-.32s value: '%-.128s'" + ger "Falscher %-.32s-Wert gekürzt: '%-.128s'" por "Truncado errado %-.32s valor: '%-.128s'" spa "Equivocado truncado %-.32s valor: '%-.128s'" ER_TOO_MUCH_AUTO_TIMESTAMP_COLS eng "Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause" + ger "Fehlerhafte Tabellendefinition. Es kann nur eine einzige TIMESTAMP-Spalte mit CURRENT_TIMESTAMP als DEFAULT oder in einer ON-UPDATE-Klausel geben" por "Incorreta definição de tabela; Pode ter somente uma coluna TIMESTAMP com CURRENT_TIMESTAMP em DEFAULT ou ON UPDATE cláusula" spa "Incorrecta definición de tabla; Solamente debe haber una columna TIMESTAMP con CURRENT_TIMESTAMP en DEFAULT o ON UPDATE cláusula" ER_INVALID_ON_UPDATE eng "Invalid ON UPDATE clause for '%-.64s' column" + ger "Ungültige ON-UPDATE-Klausel für Spalte '%-.64s'" por "Inválida cláusula ON UPDATE para campo '%-.64s'" spa "Inválido ON UPDATE cláusula para campo '%-.64s'" ER_UNSUPPORTED_PS eng "This command is not supported in the prepared statement protocol yet" + ger "Dieser Befehl wird im Protokoll für vorbereitete Anweisungen noch nicht unterstützt" ER_GET_ERRMSG dan "Modtog fejl %d '%-.100s' fra %s" eng "Got error %d '%-.100s' from %s" + ger "Fehler %d '%-.100s' von %s" nor "Mottok feil %d '%-.100s' fa %s" norwegian-ny "Mottok feil %d '%-.100s' fra %s" ER_GET_TEMPORARY_ERRMSG dan "Modtog temporary fejl %d '%-.100s' fra %s" eng "Got temporary error %d '%-.100s' from %s" + ger "Temporärer Fehler %d '%-.100s' von %s" nor "Mottok temporary feil %d '%-.100s' fra %s" norwegian-ny "Mottok temporary feil %d '%-.100s' fra %s" ER_UNKNOWN_TIME_ZONE eng "Unknown or incorrect time zone: '%-.64s'" + ger "Unbekannte oder falsche Zeitzone: '%-.64s'" ER_WARN_INVALID_TIMESTAMP eng "Invalid TIMESTAMP value in column '%s' at row %ld" + ger "Ungültiger TIMESTAMP-Wert in Feld '%s', Zeile %ld" ER_INVALID_CHARACTER_STRING eng "Invalid %s character string: '%.64s'" + ger "Ungültiger %s-Zeichen-String: '%.64s'" ER_WARN_ALLOWED_PACKET_OVERFLOWED eng "Result of %s() was larger than max_allowed_packet (%ld) - truncated" + ger "Ergebnis von %s() war größer als max_allowed_packet (%ld) Bytes und wurde deshalb gekürzt" ER_CONFLICTING_DECLARATIONS eng "Conflicting declarations: '%s%s' and '%s%s'" + ger "Widersprüchliche Deklarationen: '%s%s' und '%s%s'" ER_SP_NO_RECURSIVE_CREATE 2F003 eng "Can't create a %s from within another stored routine" + ger "Kann kein %s innerhalb einer anderen gespeicherten Routine erzeugen" ER_SP_ALREADY_EXISTS 42000 eng "%s %s already exists" + ger "%s %s existiert bereits" ER_SP_DOES_NOT_EXIST 42000 eng "%s %s does not exist" + ger "%s %s existiert nicht" ER_SP_DROP_FAILED eng "Failed to DROP %s %s" + ger "DROP %s %s ist fehlgeschlagen" ER_SP_STORE_FAILED eng "Failed to CREATE %s %s" + ger "CREATE %s %s ist fehlgeschlagen" ER_SP_LILABEL_MISMATCH 42000 eng "%s with no matching label: %s" + ger "%s ohne passende Marke: %s" ER_SP_LABEL_REDEFINE 42000 eng "Redefining label %s" + ger "Neudefinition der Marke %s" ER_SP_LABEL_MISMATCH 42000 eng "End-label %s without match" + ger "Ende-Marke %s ohne zugehörigen Anfang" ER_SP_UNINIT_VAR 01000 eng "Referring to uninitialized variable %s" + ger "Zugriff auf nichtinitialisierte Variable %s" ER_SP_BADSELECT 0A000 eng "PROCEDURE %s can't return a result set in the given context" + ger "PROCEDURE %s kann im gegebenen Kontext keine Ergebnismenge zurückgeben" ER_SP_BADRETURN 42000 eng "RETURN is only allowed in a FUNCTION" + ger "RETURN ist nur innerhalb einer FUNCTION erlaubt" ER_SP_BADSTATEMENT 0A000 eng "%s is not allowed in stored procedures" + ger "%s ist in gespeicherten Prozeduren nicht erlaubt" ER_UPDATE_LOG_DEPRECATED_IGNORED 42000 eng "The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been ignored" + ger "Das Update-Log ist veraltet und wurde durch das Binär-Log ersetzt. SET SQL_LOG_UPDATE wird ignoriert" ER_UPDATE_LOG_DEPRECATED_TRANSLATED 42000 eng "The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN" + ger "Das Update-Log ist veraltet und wurde durch das Binär-Log ersetzt. SET SQL_LOG_UPDATE wurde in SET SQL_LOG_BIN übersetzt" ER_QUERY_INTERRUPTED 70100 eng "Query execution was interrupted" + ger "Ausführung der Abfrage wurde unterbrochen" ER_SP_WRONG_NO_OF_ARGS 42000 eng "Incorrect number of arguments for %s %s; expected %u, got %u" + ger "Falsche Anzahl von Argumenten für %s %s; erwarte %u, erhalte %u" ER_SP_COND_MISMATCH 42000 eng "Undefined CONDITION: %s" + ger "Undefinierte CONDITION: %s" ER_SP_NORETURN 42000 eng "No RETURN found in FUNCTION %s" + ger "Kein RETURN in FUNCTION %s gefunden" ER_SP_NORETURNEND 2F005 eng "FUNCTION %s ended without RETURN" + ger "FUNCTION %s endete ohne RETURN" ER_SP_BAD_CURSOR_QUERY 42000 eng "Cursor statement must be a SELECT" + ger "Cursor-Anweisung muss ein SELECT sein" ER_SP_BAD_CURSOR_SELECT 42000 eng "Cursor SELECT must not have INTO" + ger "Cursor-SELECT darf kein INTO haben" ER_SP_CURSOR_MISMATCH 42000 eng "Undefined CURSOR: %s" + ger "Undefinierter CURSOR: %s" ER_SP_CURSOR_ALREADY_OPEN 24000 eng "Cursor is already open" + ger "Cursor ist schon geöffnet" ER_SP_CURSOR_NOT_OPEN 24000 eng "Cursor is not open" + ger "Cursor ist nicht geöffnet" ER_SP_UNDECLARED_VAR 42000 eng "Undeclared variable: %s" + ger "Nicht deklarierte Variable: %s" ER_SP_WRONG_NO_OF_FETCH_ARGS eng "Incorrect number of FETCH variables" + ger "Falsche Anzahl von FETCH-Variablen" ER_SP_FETCH_NO_DATA 02000 eng "No data to FETCH" + ger "Keine Daten mit FETCH abzuholen" ER_SP_DUP_PARAM 42000 eng "Duplicate parameter: %s" + ger "Doppelter Parameter: %s" ER_SP_DUP_VAR 42000 eng "Duplicate variable: %s" + ger "Doppelte Variable: %s" ER_SP_DUP_COND 42000 eng "Duplicate condition: %s" + ger "Doppelte Bedingung: %s" ER_SP_DUP_CURS 42000 eng "Duplicate cursor: %s" + ger "Doppelter Cursor: %s" ER_SP_CANT_ALTER eng "Failed to ALTER %s %s" + ger "ALTER %s %s fehlgeschlagen" ER_SP_SUBSELECT_NYI 0A000 eng "Subselect value not supported" + ger "Subselect-Wert wird nicht unterstützt" ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG 0A000 eng "%s is not allowed in stored function or trigger" + ger "%s ist in gespeicherten Funktionen und in Triggern nicht erlaubt" ER_SP_VARCOND_AFTER_CURSHNDLR 42000 eng "Variable or condition declaration after cursor or handler declaration" + ger "Deklaration einer Variablen oder einer Bedingung nach der Deklaration eines Cursors oder eines Handlers" ER_SP_CURSOR_AFTER_HANDLER 42000 eng "Cursor declaration after handler declaration" + ger "Deklaration eines Cursors nach der Deklaration eines Handlers" ER_SP_CASE_NOT_FOUND 20000 eng "Case not found for CASE statement" + ger "Fall für CASE-Anweisung nicht gefunden" ER_FPARSER_TOO_BIG_FILE eng "Configuration file '%-.64s' is too big" + ger "Konfigurationsdatei '%-.64s' ist zu groß" rus "óÌÉÛËÏÍ ÂÏÌØÛÏÊ ËÏÎÆÉÇÕÒÁÃÉÏÎÎÙÊ ÆÁÊÌ '%-.64s'" ukr "úÁÎÁÄÔÏ ×ÅÌÉËÉÊ ËÏÎÆ¦ÇÕÒÁæÊÎÉÊ ÆÁÊÌ '%-.64s'" ER_FPARSER_BAD_HEADER eng "Malformed file type header in file '%-.64s'" + ger "Nicht wohlgeformter Dateityp-Header in Datei '%-.64s'" rus "îÅ×ÅÒÎÙÊ ÚÁÇÏÌÏ×ÏË ÔÉÐÁ ÆÁÊÌÁ '%-.64s'" ukr "îÅצÒÎÉÊ ÚÁÇÏÌÏ×ÏË ÔÉÐÕ Õ ÆÁÊ̦ '%-.64s'" ER_FPARSER_EOF_IN_COMMENT eng "Unexpected end of file while parsing comment '%-.64s'" + ger "Unerwartetes Dateiende beim Parsen des Kommentars '%-.64s'" rus "îÅÏÖÉÄÁÎÎÙÊ ËÏÎÅà ÆÁÊÌÁ × ËÏÍÅÎÔÁÒÉÉ '%-.64s'" ukr "îÅÓÐÏĦ×ÁÎÎÉÊ Ë¦ÎÅÃØ ÆÁÊÌÕ Õ ËÏÍÅÎÔÁÒ¦ '%-.64s'" ER_FPARSER_ERROR_IN_PARAMETER eng "Error while parsing parameter '%-.64s' (line: '%-.64s')" + ger "Fehler beim Parsen des Parameters '%-.64s' (Zeile: '%-.64s')" rus "ïÛÉÂËÁ ÐÒÉ ÒÁÓÐÏÚÎÁ×ÁÎÉÉ ÐÁÒÁÍÅÔÒÁ '%-.64s' (ÓÔÒÏËÁ: '%-.64s')" ukr "ðÏÍÉÌËÁ × ÒÏÓЦÚÎÁ×ÁÎΦ ÐÁÒÁÍÅÔÒÕ '%-.64s' (ÒÑÄÏË: '%-.64s')" ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER eng "Unexpected end of file while skipping unknown parameter '%-.64s'" + ger "Unerwartetes Dateiende beim Überspringen des unbekannten Parameters '%-.64s'" rus "îÅÏÖÉÄÁÎÎÙÊ ËÏÎÅà ÆÁÊÌÁ ÐÒÉ ÐÒÏÐÕÓËÅ ÎÅÉÚ×ÅÓÔÎÏÇÏ ÐÁÒÁÍÅÔÒÁ '%-.64s'" ukr "îÅÓÐÏĦ×ÁÎÎÉÊ Ë¦ÎÅÃØ ÆÁÊÌÕ Õ ÓÐÒϦ ÐÒÏÍÉÎÕÔÉ ÎÅצÄÏÍÉÊ ÐÁÒÁÍÅÔÒ '%-.64s'" ER_VIEW_NO_EXPLAIN eng "EXPLAIN/SHOW can not be issued; lacking privileges for underlying table" + ger "EXPLAIN/SHOW kann nicht verlangt werden. Rechte für zugrunde liegende Tabelle fehlen" rus "EXPLAIN/SHOW ÎÅ ÍÏÖÅÔ ÂÙÔØ ×ÙÐÏÌÎÅÎÎÏ; ÎÅÄÏÓÔÁÔÏÞÎÏ ÐÒÁ× ÎÁ ÔÁËÂÌÉÃÙ ÚÁÐÒÏÓÁ" ukr "EXPLAIN/SHOW ÎÅ ÍÏÖÅ ÂÕÔÉ ×¦ËÏÎÁÎÏ; ÎÅÍÁ¤ ÐÒÁ× ÎÁ ÔÉÂÌÉæ ÚÁÐÉÔÕ" ER_FRM_UNKNOWN_TYPE eng "File '%-.64s' has unknown type '%-.64s' in its header" + ger "Datei '%-.64s' hat unbekannten Typ '%-.64s' im Header" rus "æÁÊÌ '%-.64s' ÓÏÄÅÒÖÉÔ ÎÅÉÚ×ÅÓÔÎÙÊ ÔÉÐ '%-.64s' × ÚÁÇÏÌÏ×ËÅ" ukr "æÁÊÌ '%-.64s' ÍÁ¤ ÎÅצÄÏÍÉÊ ÔÉÐ '%-.64s' Õ ÚÁÇÏÌÏ×ËÕ" ER_WRONG_OBJECT eng "'%-.64s.%-.64s' is not %s" + ger "'%-.64s.%-.64s' ist nicht %s" rus "'%-.64s.%-.64s' - ÎÅ %s" ukr "'%-.64s.%-.64s' ÎÅ ¤ %s" ER_NONUPDATEABLE_COLUMN eng "Column '%-.64s' is not updatable" + ger "Feld '%-.64s' ist nicht aktualisierbar" rus "óÔÏÌÂÅà '%-.64s' ÎÅ ÏÂÎÏ×ÌÑÅÍÙÊ" ukr "óÔÏ×ÂÅÃØ '%-.64s' ÎÅ ÍÏÖÅ ÂÕÔÉ ÚÍÉÎÅÎÉÊ" ER_VIEW_SELECT_DERIVED eng "View's SELECT contains a subquery in the FROM clause" + ger "SELECT der View enthält eine Subquery in der FROM-Klausel" rus "View SELECT ÓÏÄÅÒÖÉÔ ÐÏÄÚÁÐÒÏÓ × ËÏÎÓÔÒÕËÃÉÉ FROM" ukr "View SELECT ÍÁ¤ ЦÄÚÁÐÉÔ Õ ËÏÎÓÔÒÕËæ§ FROM" ER_VIEW_SELECT_CLAUSE eng "View's SELECT contains a '%s' clause" + ger "SELECT der View enthält eine '%s'-Klausel" rus "View SELECT ÓÏÄÅÒÖÉÔ ËÏÎÓÔÒÕËÃÉÀ '%s'" ukr "View SELECT ÍÁ¤ ËÏÎÓÔÒÕËæÀ '%s'" ER_VIEW_SELECT_VARIABLE eng "View's SELECT contains a variable or parameter" + ger "SELECT der View enthält eine Variable oder einen Parameter" rus "View SELECT ÓÏÄÅÒÖÉÔ ÐÅÒÅÍÅÎÎÕÀ ÉÌÉ ÐÁÒÁÍÅÔÒ" ukr "View SELECT ÍÁ¤ ÚÍÉÎÎÕ ÁÂÏ ÐÁÒÁÍÅÔÅÒ" ER_VIEW_SELECT_TMPTABLE eng "View's SELECT refers to a temporary table '%-.64s'" + ger "SELECT der View verweist auf eine temporäre Tabelle '%-.64s'" rus "View SELECT ÓÏÄÅÒÖÉÔ ÓÓÙÌËÕ ÎÁ ×ÒÅÍÅÎÎÕÀ ÔÁÂÌÉÃÕ '%-.64s'" ukr "View SELECT ×ÉËÏÒÉÓÔÏ×Õ¤ ÔÉÍÞÁÓÏ×Õ ÔÁÂÌÉÃÀ '%-.64s'" ER_VIEW_WRONG_LIST eng "View's SELECT and view's field list have different column counts" + ger "SELECT- und Feldliste der Views haben eine unterschiedliche Anzahl von Spalten" rus "View SELECT É ÓÐÉÓÏË ÐÏÌÅÊ view ÉÍÅÀÔ ÒÁÚÎÏÅ ËÏÌÉÞÅÓÔ×Ï ÓÔÏÌÂÃÏ×" ukr "View SELECT ¦ ÐÅÒÅÌ¦Ë ÓÔÏ×ÂÃ¦× view ÍÁÀÔØ Ò¦ÚÎÕ Ë¦ÌØË¦ÓÔØ ÓËÏ×Âæ×" ER_WARN_VIEW_MERGE eng "View merge algorithm can't be used here for now (assumed undefined algorithm)" + ger "View-Merge-Algorithmus kann hier momentan nicht verwendet werden (undefinierter Algorithmus wird angenommen)" rus "áÌÇÏÒÉÔÍ ÓÌÉÑÎÉÑ view ÎÅ ÍÏÖÅÔ ÂÙÔØ ÉÓÐÏÌØÚÏ×ÁÎ ÓÅÊÞÁÓ (ÁÌÇÏÒÉÔÍ ÂÕÄÅÔ ÎÅÏÐÅÒÅÄÅÌÅÎÎÙÍ)" ukr "áÌÇÏÒÉÔÍ ÚÌÉ×ÁÎÎÑ view ÎÅ ÍÏÖÅ ÂÕÔÉ ×ÉËÏÒÉÓÔÁÎÉÊ ÚÁÒÁÚ (ÁÌÇÏÒÉÔÍ ÂÕÄÅ ÎÅ×ÉÚÎÁÞÅÎÉÊ)" ER_WARN_VIEW_WITHOUT_KEY eng "View being updated does not have complete key of underlying table in it" + ger "Die aktualisierte View enthält nicht den vollständigen Schlüssel der zugrunde liegenden Tabelle" rus "ïÂÎÏ×ÌÑÅÍÙÊ view ÎÅ ÓÏÄÅÒÖÉÔ ËÌÀÞÁ ÉÓÐÏÌØÚÏ×ÁÎÎÙÈ(ÏÊ) × ÎÅÍ ÔÁÂÌÉÃ(Ù)" ukr "View, ÝÏ ÏÎÏ×ÌÀÅÔØÓÑ, ΊͦÓÔÉÔØ ÐÏ×ÎÏÇÏ ËÌÀÞÁ ÔÁÂÌÉæ(Ø), ÝÏ ×ÉËÏÒ¦ÓÔÁÎÁ × ÎØÀÏÍÕ" ER_VIEW_INVALID eng "View '%-.64s.%-.64s' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them" ER_SP_NO_DROP_SP eng "Can't drop or alter a %s from within another stored routine" + ger "Kann eine %s nicht von innerhalb einer anderen gespeicherten Routine löschen oder ändern" ER_SP_GOTO_IN_HNDLR eng "GOTO is not allowed in a stored procedure handler" + ger "GOTO ist im Handler einer gespeicherten Prozedur nicht erlaubt" ER_TRG_ALREADY_EXISTS eng "Trigger already exists" + ger "Trigger existiert bereits" ER_TRG_DOES_NOT_EXIST eng "Trigger does not exist" + ger "Trigger existiert nicht" ER_TRG_ON_VIEW_OR_TEMP_TABLE eng "Trigger's '%-.64s' is view or temporary table" + ger "'%-.64s' des Triggers ist View oder temporäre Tabelle" ER_TRG_CANT_CHANGE_ROW eng "Updating of %s row is not allowed in %strigger" + ger "Aktualisieren einer %s-Zeile ist in einem %-Trigger nicht erlaubt" ER_TRG_NO_SUCH_ROW_IN_TRG eng "There is no %s row in %s trigger" + ger "Es gibt keine %s-Zeile im %s-Trigger" ER_NO_DEFAULT_FOR_FIELD eng "Field '%-.64s' doesn't have a default value" + ger "Feld '%-.64s' hat keinen Vorgabewert" ER_DIVISION_BY_ZERO 22012 eng "Division by 0" + ger "Division durch 0" ER_TRUNCATED_WRONG_VALUE_FOR_FIELD eng "Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld" + ger "Falscher %-.32s-Wert: '%-.128s' für Feld '%.64s' in Zeile %ld" ER_ILLEGAL_VALUE_FOR_TYPE 22007 eng "Illegal %s '%-.64s' value found during parsing" + ger "Nicht zulässiger %s-Wert '%-.64s' beim Parsen gefunden" ER_VIEW_NONUPD_CHECK eng "CHECK OPTION on non-updatable view '%-.64s.%-.64s'" + ger "CHECK OPTION auf nicht-aktualisierbarem View '%-.64s.%-.64s'" rus "CHECK OPTION ÄÌÑ ÎÅÏÂÎÏ×ÌÑÅÍÏÇÏ VIEW '%-.64s.%-.64s'" ukr "CHECK OPTION ÄÌÑ VIEW '%-.64s.%-.64s' ÝÏ ÎÅ ÍÏÖÅ ÂÕÔÉ ÏÎÏ×ÌÅÎÎÉÍ" ER_VIEW_CHECK_FAILED eng "CHECK OPTION failed '%-.64s.%-.64s'" + ger "CHECK OPTION fehlgeschlagen: '%-.64s.%-.64s'" rus "ÐÒÏ×ÅÒËÁ CHECK OPTION ÄÌÑ VIEW '%-.64s.%-.64s' ÐÒÏ×ÁÌÉÌÁÓØ" ukr "ðÅÒÅצÒËÁ CHECK OPTION ÄÌÑ VIEW '%-.64s.%-.64s' ÎÅ ÐÒÏÊÛÌÁ" ER_PROCACCESS_DENIED_ERROR 42000 eng "%-.16s command denied to user '%-.32s'@'%-.64s' for routine '%-.64s'" + ger "Befehl %-.16s nicht zulässig für Benutzer '%-.32s'@'%-.64s' in Routine '%-.64s'" ER_RELAY_LOG_FAIL eng "Failed purging old relay logs: %s" + ger "Bereinigen alter Relais-Logs fehlgeschlagen: %s" ER_PASSWD_LENGTH eng "Password hash should be a %d-digit hexadecimal number" + ger "Passwort-Hash sollte eine Hexdaezimalzahl mit %d Stellen sein" ER_UNKNOWN_TARGET_BINLOG eng "Target log not found in binlog index" + ger "Ziel-Log im Binlog-Index nicht gefunden" ER_IO_ERR_LOG_INDEX_READ eng "I/O error reading log index file" + ger "Fehler beim Lesen der Log-Index-Datei" ER_BINLOG_PURGE_PROHIBITED eng "Server configuration does not permit binlog purge" + ger "Server-Konfiguration erlaubt keine Binlog-Bereinigung" ER_FSEEK_FAIL eng "Failed on fseek()" + ger "fseek() fehlgeschlagen" ER_BINLOG_PURGE_FATAL_ERR eng "Fatal error during log purge" + ger "Schwerwiegender Fehler bei der Log-Bereinigung" ER_LOG_IN_USE eng "A purgeable log is in use, will not purge" + ger "Ein zu bereinigendes Log wird gerade benutzt, daher keine Bereinigung" ER_LOG_PURGE_UNKNOWN_ERR eng "Unknown error during log purge" + ger "Unbekannter Fehler bei Log-Bereinigung" ER_RELAY_LOG_INIT eng "Failed initializing relay log position: %s" + ger "Initialisierung der Relais-Log-Position fehlgeschlagen: %s" ER_NO_BINARY_LOGGING eng "You are not using binary logging" + ger "Sie verwenden keine Binärlogs" ER_RESERVED_SYNTAX eng "The '%-.64s' syntax is reserved for purposes internal to the MySQL server" + ger "Die Schreibweise '%-.64s' ist für interne Zwecke des MySQL-Servers reserviert" ER_WSAS_FAILED eng "WSAStartup Failed" + ger "WSAStartup fehlgeschlagen" ER_DIFF_GROUPS_PROC eng "Can't handle procedures with differents groups yet" + ger "Kann Prozeduren mit unterschiedlichen Gruppen noch nicht verarbeiten" ER_NO_GROUP_FOR_PROC eng "Select must have a group with this procedure" + ger "SELECT muss bei dieser Prozedur ein GROUP BY haben" ER_ORDER_WITH_PROC eng "Can't use ORDER clause with this procedure" + ger "Kann bei dieser Prozedur keine ORDER-BY-Klausel verwenden" ER_LOGGING_PROHIBIT_CHANGING_OF eng "Binary logging and replication forbid changing the global server %s" + ger "Binärlogs und Replikation verhindern Wechsel des globalen Servers %s" ER_NO_FILE_MAPPING eng "Can't map file: %-.64s, errno: %d" + ger "Kann Datei nicht abbilden: %-.64s, Fehler: %d" ER_WRONG_MAGIC eng "Wrong magic in %-.64s" + ger "Falsche magische Zahlen in %-.64s" ER_PS_MANY_PARAM eng "Prepared statement contains too many placeholders" + ger "Vorbereitete Anweisung enthält zu viele Platzhalter" ER_KEY_PART_0 eng "Key part '%-.64s' length cannot be 0" + ger "Länge des Schlüsselteils '%-.64s' kann nicht 0 sein" ER_VIEW_CHECKSUM eng "View text checksum failed" + ger "View-Text-Prüfsumme fehlgeschlagen" rus "ðÒÏ×ÅÒËÁ ËÏÎÔÒÏÌØÎÏÊ ÓÕÍÍÙ ÔÅËÓÔÁ VIEW ÐÒÏ×ÁÌÉÌÁÓØ" ukr "ðÅÒÅצÒËÁ ËÏÎÔÒÏÌØÎϧ ÓÕÍÉ ÔÅËÓÔÕ VIEW ÎÅ ÐÒÏÊÛÌÁ" ER_VIEW_MULTIUPDATE eng "Can not modify more than one base table through a join view '%-.64s.%-.64s'" + ger "Kann nicht mehr als eine Basistabelle über Join-View '%-.64s.%-.64s' ändern" rus "îÅÌØÚÑ ÉÚÍÅÎÉÔØ ÂÏÌØÛÅ ÞÅÍ ÏÄÎÕ ÂÁÚÏ×ÕÀ ÔÁÂÌÉÃÕ ÉÓÐÏÌØÚÕÑ ÍÎÏÇÏÔÁÂÌÉÞÎÙÊ VIEW '%-.64s.%-.64s'" ukr "îÅÍÏÖÌÉ×Ï ÏÎÏ×ÉÔÉ Â¦ÌØÛ ÎÉÖ ÏÄÎÕ ÂÁÚÏ×Õ ÔÁÂÌÉÃÀ ×ÙËÏÒÉÓÔÏ×ÕÀÞÉ VIEW '%-.64s.%-.64s', ÝÏ Í¦ÓÔ¦ÔØ ÄÅË¦ÌØËÁ ÔÁÂÌÉÃØ" ER_VIEW_NO_INSERT_FIELD_LIST eng "Can not insert into join view '%-.64s.%-.64s' without fields list" + ger "Kann nicht ohne Feldliste in Join-View '%-.64s.%-.64s' einfügen" rus "îÅÌØÚÑ ×ÓÔÁ×ÌÑÔØ ÚÁÐÉÓÉ × ÍÎÏÇÏÔÁÂÌÉÞÎÙÊ VIEW '%-.64s.%-.64s' ÂÅÚ ÓÐÉÓËÁ ÐÏÌÅÊ" ukr "îÅÍÏÖÌÉ×Ï ÕÓÔÁ×ÉÔÉ ÒÑÄËÉ Õ VIEW '%-.64s.%-.64s', ÝÏ Í¦ÓÔÉÔØ ÄÅË¦ÌØËÁ ÔÁÂÌÉÃØ, ÂÅÚ ÓÐÉÓËÕ ÓÔÏ×Âæ×" ER_VIEW_DELETE_MERGE_VIEW eng "Can not delete from join view '%-.64s.%-.64s'" + ger "Kann nicht aus Join-View '%-.64s.%-.64s' löschen" rus "îÅÌØÚÑ ÕÄÁÌÑÔØ ÉÚ ÍÎÏÇÏÔÁÂÌÉÞÎÏÇÏ VIEW '%-.64s.%-.64s'" ukr "îÅÍÏÖÌÉ×Ï ×ÉÄÁÌÉÔÉ ÒÑÄËÉ Õ VIEW '%-.64s.%-.64s', ÝÏ Í¦ÓÔÉÔØ ÄÅË¦ÌØËÁ ÔÁÂÌÉÃØ" ER_CANNOT_USER eng "Operation %s failed for %.256s" - ger "Das Kommando %s scheiterte für %.256s" + ger "Operation %s schlug fehl für %.256s" norwegian-ny "Operation %s failed for '%.256s'" ER_XAER_NOTA XAE04 eng "XAER_NOTA: Unknown XID" + ger "XAER_NOTA: Unbekannte XID" ER_XAER_INVAL XAE05 eng "XAER_INVAL: Invalid arguments (or unsupported command)" + ger "XAER_INVAL: Ungültige Argumente (oder nicht unterstützter Befehl)" ER_XAER_RMFAIL XAE07 eng "XAER_RMFAIL: The command cannot be executed when global transaction is in the %.64s state" + ger "XAER_RMFAIL: DEr Befehl kann nicht ausgeführt werden, wenn die globale Transaktion im Zustand %.64s ist" rus "XAER_RMFAIL: ÜÔÕ ËÏÍÁÎÄÕ ÎÅÌØÚÑ ×ÙÐÏÌÎÑÔØ ËÏÇÄÁ ÇÌÏÂÁÌØÎÁÑ ÔÒÁÎÚÁËÃÉÑ ÎÁÈÏÄÉÔÓÑ × ÓÏÓÔÏÑÎÉÉ '%.64s'" ER_XAER_OUTSIDE XAE09 eng "XAER_OUTSIDE: Some work is done outside global transaction" + ger "XAER_OUTSIDE: Einige Arbeiten werden außerhalb der globalen Transaktion verrichtet" ER_XAER_RMERR XAE03 eng "XAER_RMERR: Fatal error occurred in the transaction branch - check your data for consistency" + ger "XAER_RMERR: Schwerwiegender Fehler im Transaktionszweig - prüfen Sie Ihre Daten auf Konsistenz" ER_XA_RBROLLBACK XA100 eng "XA_RBROLLBACK: Transaction branch was rolled back" + ger "XA_RBROLLBACK: Transaktionszweig wurde zurückgerollt" ER_NONEXISTING_PROC_GRANT 42000 eng "There is no such grant defined for user '%-.32s' on host '%-.64s' on routine '%-.64s'" + ger "Es gibt diese Berechtigung für Benutzer '%-.32s' auf Host '%-.64s' für Routine '%-.64s' nicht" ER_PROC_AUTO_GRANT_FAIL eng "Failed to grant EXECUTE and ALTER ROUTINE privileges" + ger "Gewährung von EXECUTE- und ALTER-ROUTINE-Rechten fehlgeschlagen" ER_PROC_AUTO_REVOKE_FAIL eng "Failed to revoke all privileges to dropped routine" + ger "Rücknahme aller Rechte für die gelöschte Routine fehlgeschlagen" ER_DATA_TOO_LONG 22001 eng "Data too long for column '%s' at row %ld" + ger "Daten zu lang für Feld '%s' in Zeile %ld" ER_SP_BAD_SQLSTATE 42000 eng "Bad SQLSTATE: '%s'" + ger "Ungültiger SQLSTATE: '%s'" ER_STARTUP eng "%s: ready for connections.\nVersion: '%s' socket: '%s' port: %d %s" + ger "%s: bereit für Verbindungen.\nVersion: '%s' Socket: '%s' Port: %d %s" ER_LOAD_FROM_FIXED_SIZE_ROWS_TO_VAR eng "Can't load value from file with fixed size rows to variable" + ger "Kann Wert aus Datei mit Zeilen fester Größe nicht in Variable laden" ER_CANT_CREATE_USER_WITH_GRANT 42000 eng "You are not allowed to create a user with GRANT" + ger "Sie dürfen keinen Benutzer mit GRANT anlegen" ER_WRONG_VALUE_FOR_TYPE eng "Incorrect %-.32s value: '%-.128s' for function %-.32s" + ger "Falscher %-.32s-Wert: '%-.128s' für Funktion %-.32s" ER_TABLE_DEF_CHANGED eng "Table definition has changed, please retry transaction" + ger "Tabellendefinition wurde geändert, bitte starten Sie die Transaktion neu" ER_SP_DUP_HANDLER 42000 eng "Duplicate handler declared in the same block" + ger "Doppelter Handler im selben Block deklariert" ER_SP_NOT_VAR_ARG 42000 eng "OUT or INOUT argument %d for routine %s is not a variable" + ger "OUT- oder INOUT-Argument %d für Routine %s ist keine Variable" ER_SP_NO_RETSET 0A000 eng "Not allowed to return a result set from a %s" + ger "Rückgabe einer Ergebnismenge aus einer %s ist nicht erlaubt" ER_CANT_CREATE_GEOMETRY_OBJECT 22003 eng "Cannot get geometry object from data you send to the GEOMETRY field" + ger "Kann kein Geometrieobjekt aus den Daten machen, die Sie dem GEOMETRY-Feld übergeben haben" ER_FAILED_ROUTINE_BREAK_BINLOG eng "A routine failed and has neither NO SQL nor READS SQL DATA in its declaration and binary logging is enabled; if non-transactional tables were updated, the binary log will miss their changes" + ger "Eine Routine, die weder NO SQL noch READS SQL DATA in der Deklaration hat, schlug fehl und Binärlogging ist aktiv. Wenn Nicht-Transaktions-Tabellen atualisiert wurden, enthält das Binärlog ihre Änderungen nicht" ER_BINLOG_UNSAFE_ROUTINE - eng "This routine has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_routine_creators variable)" + eng "This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)" + ger "Diese Routine hat weder DETERMINISTIC, NO SQL noch READS SQL DATA in der Deklaration und Binärlogging ist aktiv (*vielleicht* sollten Sie die weniger sichere Variable log_bin_trust_routine_creators verwenden)" ER_BINLOG_CREATE_ROUTINE_NEED_SUPER - eng "You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_routine_creators variable)" + eng "You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)" + ger "Sie haben keine SUPER-Berechtigung und Binärlogging ist aktiv (*vielleicht* sollten Sie die weniger sichere Variable log_bin_trust_routine_creators verwenden)" ER_EXEC_STMT_WITH_OPEN_CURSOR eng "You can't execute a prepared statement which has an open cursor associated with it. Reset the statement to re-execute it." + ger "Sie können keine vorbereitete Anweisung ausführen, die mit einem geöffneten Cursor verknüpft ist. Setzen Sie die Anweisung zurück, um sie neu auszuführen" ER_STMT_HAS_NO_OPEN_CURSOR eng "The statement (%lu) has no open cursor." + ger "Die Anweisung (%lu) hat keinen geöffneten Cursor" ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG eng "Explicit or implicit commit is not allowed in stored function or trigger." + ger "Explizites oder implizites Commit ist in gespeicherten Funktionen und in Triggern nicht erlaubt" ER_NO_DEFAULT_FOR_VIEW_FIELD eng "Field of view '%-.64s.%-.64s' underlying table doesn't have a default value" + ger "Ein Feld der dem View '%-.64s.%-.64s' zugrundeliegenden Tabelle hat keinen Vorgabewert" ER_SP_NO_RECURSION - eng "Recursive stored routines are not allowed." + eng "Recursive stored functions and triggers are not allowed." + ger "Rekursive gespeicherte Routinen und Triggers sind nicht erlaubt" ER_TOO_BIG_SCALE 42000 S1009 eng "Too big scale %d specified for column '%-.64s'. Maximum is %d." + ger "Zu großer Skalierungsfaktor %d für Feld '%-.64s' angegeben. Maximum ist %d" ER_TOO_BIG_PRECISION 42000 S1009 eng "Too big precision %d specified for column '%-.64s'. Maximum is %d." + ger "Zu große Genauigkeit %d für Feld '%-.64s' angegeben. Maximum ist %d" ER_M_BIGGER_THAN_D 42000 S1009 eng "For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '%-.64s')." + ger "Für FLOAT(M,D), DOUBLE(M,D) oder DECIMAL(M,D) muss M >= D sein (Feld '%-.64s')" ER_WRONG_LOCK_OF_SYSTEM_TABLE eng "You can't combine write-locking of system '%-.64s.%-.64s' table with other tables" + ger "Sie können Schreibsperren auf der Systemtabelle '%-.64s.%-.64s' nicht mit anderen Tabellen kombinieren" ER_CONNECT_TO_FOREIGN_DATA_SOURCE - eng "Unable to connect to foreign data source - database '%.64s'!" + eng "Unable to connect to foreign data source: %.64s" + ger "Kann nicht mit Fremddatenquelle verbinden: %.64s" ER_QUERY_ON_FOREIGN_DATA_SOURCE - eng "There was a problem processing the query on the foreign data source. Data source error: '%-.64s'" + eng "There was a problem processing the query on the foreign data source. Data source error: %-.64" + ger "Bei der Verarbeitung der Abfrage ist in der Fremddatenquelle ein Problem aufgetreten. Datenquellenfehlermeldung: %-.64s" ER_FOREIGN_DATA_SOURCE_DOESNT_EXIST - eng "The foreign data source you are trying to reference does not exist. Data source error : '%-.64s'" + eng "The foreign data source you are trying to reference does not exist. Data source error: %-.64s" + ger "Die Fremddatenquelle, auf die Sie zugreifen wollen, existiert nicht. Datenquellenfehlermeldung: %-.64s" ER_FOREIGN_DATA_STRING_INVALID_CANT_CREATE eng "Can't create federated table. The data source connection string '%-.64s' is not in the correct format" + ger "Kann föderierte Tabelle nicht erzeugen. Der Datenquellen-Verbindungsstring '%-.64s' hat kein korrektes Format" ER_FOREIGN_DATA_STRING_INVALID eng "The data source connection string '%-.64s' is not in the correct format" + ger "Der Datenquellen-Verbindungsstring '%-.64s' hat kein korrektes Format" ER_CANT_CREATE_FEDERATED_TABLE - eng "Can't create federated table. Foreign data src error : '%-.64s'" + eng "Can't create federated table. Foreign data src error: %-.64s" + ger "Kann föderierte Tabelle nicht erzeugen. Fremddatenquellenfehlermeldung: %-.64s" ER_TRG_IN_WRONG_SCHEMA eng "Trigger in wrong schema" + ger "Trigger im falschen Schema" ER_STACK_OVERRUN_NEED_MORE eng "Thread stack overrun: %ld bytes used of a %ld byte stack, and %ld bytes needed. Use 'mysqld -O thread_stack=#' to specify a bigger stack." + ger "Thread-Stack-Überlauf: %ld Bytes eines %ld-Byte-Stacks in Verwendung, und %ld Bytes benötigt. Verwenden Sie 'mysqld -O thread_stack=#', um einen größeren Stack anzugeben" ER_TOO_LONG_BODY 42000 S1009 eng "Routine body for '%-.100s' is too long" + ger "Routinen-Body für '%-.100s' ist zu lang" ER_WARN_CANT_DROP_DEFAULT_KEYCACHE eng "Cannot drop default keycache" - ger "Der Default-Keycache kann nicht gelöscht werden" + ger "Der vorgabemäßige Schlüssel-Cache kann nicht gelöscht werden" ER_TOO_BIG_DISPLAYWIDTH 42000 S1009 eng "Display width out of range for column '%-.64s' (max = %d)" + ger "Anzeigebreite außerhalb des zulässigen Bereichs für Spalte '%-.64s' (Maximum: %d)" ER_XAER_DUPID XAE08 eng "XAER_DUPID: The XID already exists" + ger "XAER_DUPID: Die XID existiert bereits" ER_DATETIME_FUNCTION_OVERFLOW 22008 eng "Datetime function: %-.32s field overflow" + ger "Datetime-Funktion: %-.32s Feldüberlauf" ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG eng "Can't update table '%-.64s' in stored function/trigger because it is already used by statement which invoked this stored function/trigger." + ger "Kann Tabelle '%-.64s' in gespeicherter Funktion oder Trigger nicht aktualisieren, weil sie bereits von der Anweisung verwendet wird, die diese gespeicherte Funktion oder den Trigger aufrief" ER_VIEW_PREVENT_UPDATE eng "The definition of table '%-.64s' prevents operation %.64s on table '%-.64s'." + ger "Die Definition der Tabelle '%-.64s' verhindert die Operation %.64s auf Tabelle '%-.64s'" ER_PS_NO_RECURSION eng "The prepared statement contains a stored routine call that refers to that same statement. It's not allowed to execute a prepared statement in such a recursive manner" + ger "Die vorbereitete Anweisung enthält einen Aufruf einer gespeicherten Routine, die auf eben dieselbe Anweisung verweist. Es ist nicht erlaubt, eine vorbereitete Anweisung in solch rekursiver Weise auszuführen" ER_SP_CANT_SET_AUTOCOMMIT eng "Not allowed to set autocommit from a stored function or trigger" -ER_NO_VIEW_USER - eng "View definer is not fully qualified" + ger "Es ist nicht erlaubt, innerhalb einer gespeicherten Funktion oder eines Triggers AUTOCOMMIT zu setzen" +ER_MALFORMED_DEFINER + eng "Definer is not fully qualified" + ger "Definierer des View ist nicht vollständig spezifiziert" ER_VIEW_FRM_NO_USER - eng "View %-.64s.%-.64s has not definer information (old table format). Current user is used as definer. Please recreate view!" + eng "View '%-.64s'.'%-.64s' has no definer information (old table format). Current user is used as definer. Please recreate the view!" + ger "View '%-.64s'.'%-.64s' hat keine Definierer-Information (altes Tabellenformat). Der aktuelle Benutzer wird als Definierer verwendet. Bitte erstellen Sie den View neu" ER_VIEW_OTHER_USER - eng "You need the SUPER privilege for creation view with %-.64s@%-.64s definer" + eng "You need the SUPER privilege for creation view with '%-.64s'@'%-.64s' definer" + ger "Sie brauchen die SUPER-Berechtigung, um einen View mit dem Definierer '%-.64s'@'%-.64s' zu erzeugen" ER_NO_SUCH_USER - eng "There is not %-.64s@%-.64s registered" + eng "There is no '%-.64s'@'%-.64s' registered" + ger "'%-.64s'@'%-.64s' ist nicht registriert" ER_FORBID_SCHEMA_CHANGE eng "Changing schema from '%-.64s' to '%-.64s' is not allowed." + ger "Wechsel des Schemas von '%-.64s' auf '%-.64s' ist nicht erlaubt" ER_ROW_IS_REFERENCED_2 23000 eng "Cannot delete or update a parent row: a foreign key constraint fails (%.192s)" + ger "Kann Eltern-Zeile nicht löschen oder aktualisieren: eine Fremdschlüsselbedingung schlägt fehl (%.192s)" ER_NO_REFERENCED_ROW_2 23000 eng "Cannot add or update a child row: a foreign key constraint fails (%.192s)" + ger "Kann Kind-Zeile nicht hinzufügen oder aktualisieren: eine Fremdschlüsselbedingung schlägt fehl (%.192s)" ER_SP_BAD_VAR_SHADOW 42000 - eng "Variable '%-.64s' must be quoted with `...`, or renamed" + eng "Variable '%-.64s' must be quoted with `...`, or renamed" + ger "Variable '%-.64s' muss mit `...` geschützt oder aber umbenannt werden" +ER_TRG_NO_DEFINER + eng "No definer attribute for trigger '%-.64s'.'%-.64s'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger." +ER_OLD_FILE_FORMAT + eng "'%-.64s' has an old format, you should re-create the '%s' object(s)" +ER_SP_RECURSION_LIMIT + eng "Recursive limit %d (as set by the max_sp_recursion_depth variable) was exceeded for routine %.64s" ER_PARTITION_REQUIRES_VALUES_ERROR eng "%s PARTITIONING requires definition of VALUES %s for each partition" swe "%s PARTITIONering kräver definition av VALUES %s för varje partition" @@ -5542,3 +5718,5 @@ ER_DROP_PARTITION_WHEN_FK_DEFINED swe "Kan inte ta bort en partition när en främmande nyckel är definierad på tabellen" ER_PLUGIN_IS_NOT_LOADED eng "Plugin '%-.64s' is not loaded" +ER_WRONG_VALUE + eng "Incorrect %-.32s value: '%-.128s'" diff --git a/sql/slave.cc b/sql/slave.cc index 2ae51e37930..6c9cfc250c5 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -513,7 +513,7 @@ void st_relay_log_info::close_temporary_tables() Don't ask for disk deletion. For now, anyway they will be deleted when slave restarts, but it is a better intention to not delete them. */ - close_temporary(table, 0); + close_temporary(table, 1, 0); } save_temporary_tables= 0; slave_open_temp_tables= 0; @@ -1068,7 +1068,7 @@ static int get_master_version_and_clock(MYSQL* mysql, MASTER_INFO* mi) MYSQL_RES *master_res= 0; MYSQL_ROW master_row; - if (!mysql_real_query(mysql, "SELECT UNIX_TIMESTAMP()", 23) && + if (!mysql_real_query(mysql, STRING_WITH_LEN("SELECT UNIX_TIMESTAMP()")) && (master_res= mysql_store_result(mysql)) && (master_row= mysql_fetch_row(master_res))) { @@ -1094,7 +1094,8 @@ do not trust column Seconds_Behind_Master of SHOW SLAVE STATUS"); Note: we could have put a @@SERVER_ID in the previous SELECT UNIX_TIMESTAMP() instead, but this would not have worked on 3.23 masters. */ - if (!mysql_real_query(mysql, "SHOW VARIABLES LIKE 'SERVER_ID'", 31) && + if (!mysql_real_query(mysql, + STRING_WITH_LEN("SHOW VARIABLES LIKE 'SERVER_ID'")) && (master_res= mysql_store_result(mysql))) { if ((master_row= mysql_fetch_row(master_res)) && @@ -1129,7 +1130,8 @@ not always make sense; please check the manual before using it)."; goto err; if ((*mysql->server_version == '4') && - !mysql_real_query(mysql, "SELECT @@GLOBAL.COLLATION_SERVER", 32) && + !mysql_real_query(mysql, + STRING_WITH_LEN("SELECT @@GLOBAL.COLLATION_SERVER")) && (master_res= mysql_store_result(mysql))) { if ((master_row= mysql_fetch_row(master_res)) && @@ -1156,7 +1158,7 @@ be equal for replication to work"; those were alpha). */ if ((*mysql->server_version == '4') && - !mysql_real_query(mysql, "SELECT @@GLOBAL.TIME_ZONE", 25) && + !mysql_real_query(mysql, STRING_WITH_LEN("SELECT @@GLOBAL.TIME_ZONE")) && (master_res= mysql_store_result(mysql))) { if ((master_row= mysql_fetch_row(master_res)) && @@ -1294,7 +1296,7 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db, error=file->repair(thd,&check_opt) != 0; thd->net.vio = save_vio; if (error) - my_error(ER_INDEX_REBUILD, MYF(0), tables.table->s->table_name); + my_error(ER_INDEX_REBUILD, MYF(0), tables.table->s->table_name.str); err: close_thread_tables(thd); @@ -3068,6 +3070,7 @@ slave_begin: THD_CHECK_SENTRY(thd); pthread_detach_this_thread(); + thd->thread_stack= (char*) &thd; // remember where our stack is if (init_slave_thread(thd, SLAVE_THD_IO)) { pthread_cond_broadcast(&mi->start_cond); @@ -3076,7 +3079,6 @@ slave_begin: goto err; } mi->io_thd = thd; - thd->thread_stack = (char*)&thd; // remember where our stack is pthread_mutex_lock(&LOCK_thread_count); threads.append(thd); pthread_mutex_unlock(&LOCK_thread_count); diff --git a/sql/sp.cc b/sql/sp.cc index b385c6457a5..e9deb9b73c4 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -14,7 +14,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "mysql_priv.h" #include "sp.h" #include "sp_head.h" @@ -29,6 +28,11 @@ create_string(THD *thd, String *buf, const char *returns, ulong returnslen, const char *body, ulong bodylen, st_sp_chistics *chistics); +static int +db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp, + ulong sql_mode, const char *params, const char *returns, + const char *body, st_sp_chistics &chistics, + const char *definer, longlong created, longlong modified); /* * @@ -377,79 +381,10 @@ db_find_routine(THD *thd, int type, sp_name *name, sp_head **sphp) close_proc_table(thd, &open_tables_state_backup); table= 0; - { - String defstr; - LEX *oldlex= thd->lex; - char olddb[128]; - bool dbchanged; - enum enum_sql_command oldcmd= thd->lex->sql_command; - ulong old_sql_mode= thd->variables.sql_mode; - ha_rows select_limit= thd->variables.select_limit; - - thd->variables.sql_mode= sql_mode; - thd->variables.select_limit= HA_POS_ERROR; - - defstr.set_charset(system_charset_info); - if (!create_string(thd, &defstr, - type, - name, - params, strlen(params), - returns, strlen(returns), - body, strlen(body), - &chistics)) - { - ret= SP_INTERNAL_ERROR; - goto done; - } - - dbchanged= FALSE; - if ((ret= sp_use_new_db(thd, name->m_db.str, olddb, sizeof(olddb), - 1, &dbchanged))) - goto done; - - { - /* This is something of a kludge. We need to initialize some fields - * in thd->lex (the unit and master stuff), and the easiest way to - * do it is, is to call mysql_init_query(), but this unfortunately - * resets teh value_list where we keep the CALL parameters. So we - * copy the list and then restore it. (... and found_semicolon too). - */ - List tmpvals= thd->lex->value_list; - char *tmpfsc= thd->lex->found_semicolon; - - lex_start(thd, (uchar*)defstr.c_ptr(), defstr.length()); - thd->lex->value_list= tmpvals; - thd->lex->found_semicolon= tmpfsc; - } - - if (yyparse(thd) || thd->is_fatal_error || thd->lex->sphead == NULL) - { - LEX *newlex= thd->lex; - sp_head *sp= newlex->sphead; - - if (dbchanged && (ret= mysql_change_db(thd, olddb, 1))) - goto done; - if (sp) - { - delete sp; - newlex->sphead= NULL; - } - ret= SP_PARSE_ERROR; - } - else - { - if (dbchanged && (ret= mysql_change_db(thd, olddb, 1))) - goto done; - *sphp= thd->lex->sphead; - (*sphp)->set_info((char *)definer, (uint)strlen(definer), - created, modified, &chistics, sql_mode); - (*sphp)->optimize(); - } - thd->lex->sql_command= oldcmd; - thd->variables.sql_mode= old_sql_mode; - thd->variables.select_limit= select_limit; - } - + ret= db_load_routine(thd, type, name, sphp, + sql_mode, params, returns, body, chistics, + definer, created, modified); + done: if (table) close_proc_table(thd, &open_tables_state_backup); @@ -457,14 +392,82 @@ db_find_routine(THD *thd, int type, sp_name *name, sp_head **sphp) } +static int +db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp, + ulong sql_mode, const char *params, const char *returns, + const char *body, st_sp_chistics &chistics, + const char *definer, longlong created, longlong modified) +{ + LEX *oldlex= thd->lex, newlex; + sp_rcontext *save_spcont= thd->spcont; + String defstr; + char olddb[128]; + bool dbchanged; + ulong old_sql_mode= thd->variables.sql_mode; + ha_rows select_limit= thd->variables.select_limit; + int ret= SP_INTERNAL_ERROR; + + thd->variables.sql_mode= sql_mode; + thd->variables.select_limit= HA_POS_ERROR; + + thd->lex= &newlex; + newlex.current_select= NULL; + + defstr.set_charset(system_charset_info); + if (!create_string(thd, &defstr, + type, + name, + params, strlen(params), + returns, strlen(returns), + body, strlen(body), + &chistics)) + goto end; + + dbchanged= FALSE; + if ((ret= sp_use_new_db(thd, name->m_db.str, olddb, sizeof(olddb), + 1, &dbchanged))) + goto end; + + lex_start(thd, (uchar*)defstr.c_ptr(), defstr.length()); + + thd->spcont= 0; + if (yyparse(thd) || thd->is_fatal_error || newlex.sphead == NULL) + { + sp_head *sp= newlex.sphead; + + if (dbchanged && (ret= mysql_change_db(thd, olddb, 1))) + goto end; + delete sp; + ret= SP_PARSE_ERROR; + } + else + { + if (dbchanged && (ret= mysql_change_db(thd, olddb, 1))) + goto end; + *sphp= newlex.sphead; + (*sphp)->set_definer((char*) definer, (uint) strlen(definer)); + (*sphp)->set_info(created, modified, &chistics, sql_mode); + (*sphp)->optimize(); + } +end: + thd->spcont= save_spcont; + thd->variables.sql_mode= old_sql_mode; + thd->variables.select_limit= select_limit; + thd->lex= oldlex; + return ret; +} + + static void sp_returns_type(THD *thd, String &result, sp_head *sp) { TABLE table; + TABLE_SHARE share; Field *field; - bzero(&table, sizeof(table)); + bzero((char*) &table, sizeof(table)); + bzero((char*) &share, sizeof(share)); table.in_use= thd; - table.s = &table.share_not_to_be_used; + table.s = &share; field= sp->make_field(0, 0, &table); field->sql_type(result); delete field; @@ -551,12 +554,13 @@ db_create_routine(THD *thd, int type, sp_head *sp) store(sp->m_chistics->comment.str, sp->m_chistics->comment.length, system_charset_info); - if (!trust_routine_creators && mysql_bin_log.is_open()) + if ((sp->m_type == TYPE_ENUM_FUNCTION) && + !trust_function_creators && mysql_bin_log.is_open()) { if (!sp->m_chistics->detistic) { /* - Note that for a _function_ this test is not enough; one could use + Note that this test is not perfect; one could use a non-deterministic read-only function in an update statement. */ enum enum_sp_data_access access= @@ -898,45 +902,106 @@ err: ******************************************************************************/ /* - Obtain object representing stored procedure by its name from + Obtain object representing stored procedure/function by its name from stored procedures cache and looking into mysql.proc if needed. SYNOPSIS - sp_find_procedure() + sp_find_routine() thd - thread context + type - type of object (TYPE_ENUM_FUNCTION or TYPE_ENUM_PROCEDURE) name - name of procedure + cp - hash to look routine in cache_only - if true perform cache-only lookup (Don't look in mysql.proc). - TODO - We should consider merging of sp_find_procedure() and - sp_find_function() into one sp_find_routine() function - (the same applies to other similarly paired functions). - RETURN VALUE Non-0 pointer to sp_head object for the procedure, or 0 - in case of error. */ sp_head * -sp_find_procedure(THD *thd, sp_name *name, bool cache_only) +sp_find_routine(THD *thd, int type, sp_name *name, sp_cache **cp, + bool cache_only) { sp_head *sp; - DBUG_ENTER("sp_find_procedure"); - DBUG_PRINT("enter", ("name: %.*s.%.*s", - name->m_db.length, name->m_db.str, - name->m_name.length, name->m_name.str)); + ulong depth= (type == TYPE_ENUM_PROCEDURE ? + thd->variables.max_sp_recursion_depth : + 0); - if (!(sp= sp_cache_lookup(&thd->sp_proc_cache, name)) && !cache_only) + DBUG_ENTER("sp_find_routine"); + DBUG_PRINT("enter", ("name: %.*s.%.*s, type: %d, cache only %d", + name->m_db.length, name->m_db.str, + name->m_name.length, name->m_name.str, + type, cache_only)); + + if ((sp= sp_cache_lookup(cp, name))) { - if (db_find_routine(thd, TYPE_ENUM_PROCEDURE, name, &sp) == SP_OK) - sp_cache_insert(&thd->sp_proc_cache, sp); + ulong level; + DBUG_PRINT("info", ("found: 0x%lx", (ulong)sp)); + if (sp->m_first_free_instance) + { + DBUG_PRINT("info", ("first free: 0x%lx, level: %lu, flags %x", + (ulong)sp->m_first_free_instance, + sp->m_first_free_instance->m_recursion_level, + sp->m_first_free_instance->m_flags)); + DBUG_ASSERT(!(sp->m_first_free_instance->m_flags & sp_head::IS_INVOKED)); + if (sp->m_first_free_instance->m_recursion_level > depth) + { + sp->recursion_level_error(); + DBUG_RETURN(0); + } + DBUG_RETURN(sp->m_first_free_instance); + } + level= sp->m_last_cached_sp->m_recursion_level + 1; + if (level > depth) + { + sp->recursion_level_error(); + DBUG_RETURN(0); + } + { + sp_head *new_sp; + const char *returns= ""; + char definer[HOSTNAME_LENGTH+USERNAME_LENGTH+2]; + String retstr(64); + strxmov(definer, sp->m_definer_user.str, "@", + sp->m_definer_host.str, NullS); + if (type == TYPE_ENUM_FUNCTION) + { + sp_returns_type(thd, retstr, sp); + returns= retstr.ptr(); + } + if (db_load_routine(thd, type, name, &new_sp, + sp->m_sql_mode, sp->m_params.str, returns, + sp->m_body.str, *sp->m_chistics, definer, + sp->m_created, sp->m_modified) == SP_OK) + { + sp->m_last_cached_sp->m_next_cached_sp= new_sp; + new_sp->m_recursion_level= level; + new_sp->m_first_instance= sp; + sp->m_last_cached_sp= sp->m_first_free_instance= new_sp; + DBUG_PRINT("info", ("added level: 0x%lx, level: %lu, flags %x", + (ulong)new_sp, new_sp->m_recursion_level, + new_sp->m_flags)); + DBUG_RETURN(new_sp); + } + DBUG_RETURN(0); + } + } + if (!cache_only) + { + if (db_find_routine(thd, type, name, &sp) == SP_OK) + { + sp_cache_insert(cp, sp); + DBUG_PRINT("info", ("added new: 0x%lx, level: %lu, flags %x", + (ulong)sp, sp->m_recursion_level, + sp->m_flags)); + } } - DBUG_RETURN(sp); } + int sp_exists_routine(THD *thd, TABLE_LIST *tables, bool any, bool no_error) { @@ -954,8 +1019,10 @@ sp_exists_routine(THD *thd, TABLE_LIST *tables, bool any, bool no_error) lex_name.str= thd->strmake(table->table_name, lex_name.length); name= new sp_name(lex_db, lex_name); name->init_qname(thd); - if (sp_find_procedure(thd, name) != NULL || - sp_find_function(thd, name) != NULL) + if (sp_find_routine(thd, TYPE_ENUM_PROCEDURE, name, + &thd->sp_proc_cache, FALSE) != NULL || + sp_find_routine(thd, TYPE_ENUM_FUNCTION, name, + &thd->sp_func_cache, FALSE) != NULL) { if (any) DBUG_RETURN(1); @@ -1023,7 +1090,8 @@ sp_show_create_procedure(THD *thd, sp_name *name) DBUG_ENTER("sp_show_create_procedure"); DBUG_PRINT("enter", ("name: %.*s", name->m_name.length, name->m_name.str)); - if ((sp= sp_find_procedure(thd, name))) + if ((sp= sp_find_routine(thd, TYPE_ENUM_PROCEDURE, name, + &thd->sp_proc_cache, FALSE))) { int ret= sp->show_create_procedure(thd); @@ -1049,42 +1117,6 @@ sp_show_status_procedure(THD *thd, const char *wild) FUNCTION ******************************************************************************/ -/* - Obtain object representing stored function by its name from - stored functions cache and looking into mysql.proc if needed. - - SYNOPSIS - sp_find_function() - thd - thread context - name - name of function - cache_only - if true perform cache-only lookup - (Don't look in mysql.proc). - - NOTE - See TODO section for sp_find_procedure(). - - RETURN VALUE - Non-0 pointer to sp_head object for the function, or - 0 - in case of error. -*/ - -sp_head * -sp_find_function(THD *thd, sp_name *name, bool cache_only) -{ - sp_head *sp; - DBUG_ENTER("sp_find_function"); - DBUG_PRINT("enter", ("name: %.*s", name->m_name.length, name->m_name.str)); - - if (!(sp= sp_cache_lookup(&thd->sp_func_cache, name)) && - !cache_only) - { - if (db_find_routine(thd, TYPE_ENUM_FUNCTION, name, &sp) == SP_OK) - sp_cache_insert(&thd->sp_func_cache, sp); - } - DBUG_RETURN(sp); -} - - int sp_create_function(THD *thd, sp_head *sp) { @@ -1132,7 +1164,8 @@ sp_show_create_function(THD *thd, sp_name *name) DBUG_ENTER("sp_show_create_function"); DBUG_PRINT("enter", ("name: %.*s", name->m_name.length, name->m_name.str)); - if ((sp= sp_find_function(thd, name))) + if ((sp= sp_find_routine(thd, TYPE_ENUM_FUNCTION, name, + &thd->sp_func_cache, FALSE))) { int ret= sp->show_create_function(thd); @@ -1442,10 +1475,6 @@ sp_cache_routines_and_add_tables_aux(THD *thd, LEX *lex, &thd->sp_func_cache : &thd->sp_proc_cache), &name))) { - LEX *oldlex= thd->lex; - LEX *newlex= new st_lex; - thd->lex= newlex; - newlex->current_select= NULL; name.m_name.str= strchr(name.m_qname.str, '.'); name.m_db.length= name.m_name.str - name.m_qname.str; name.m_db.str= strmake_root(thd->mem_root, name.m_qname.str, @@ -1460,8 +1489,6 @@ sp_cache_routines_and_add_tables_aux(THD *thd, LEX *lex, else sp_cache_insert(&thd->sp_proc_cache, sp); } - delete newlex; - thd->lex= oldlex; } if (sp) { @@ -1584,30 +1611,30 @@ create_string(THD *thd, String *buf, chistics->comment.length)) return FALSE; - buf->append("CREATE ", 7); + buf->append(STRING_WITH_LEN("CREATE ")); if (type == TYPE_ENUM_FUNCTION) - buf->append("FUNCTION ", 9); + buf->append(STRING_WITH_LEN("FUNCTION ")); else - buf->append("PROCEDURE ", 10); + buf->append(STRING_WITH_LEN("PROCEDURE ")); append_identifier(thd, buf, name->m_name.str, name->m_name.length); buf->append('('); buf->append(params, paramslen); buf->append(')'); if (type == TYPE_ENUM_FUNCTION) { - buf->append(" RETURNS ", 9); + buf->append(STRING_WITH_LEN(" RETURNS ")); buf->append(returns, returnslen); } buf->append('\n'); switch (chistics->daccess) { case SP_NO_SQL: - buf->append(" NO SQL\n"); + buf->append(STRING_WITH_LEN(" NO SQL\n")); break; case SP_READS_SQL_DATA: - buf->append(" READS SQL DATA\n"); + buf->append(STRING_WITH_LEN(" READS SQL DATA\n")); break; case SP_MODIFIES_SQL_DATA: - buf->append(" MODIFIES SQL DATA\n"); + buf->append(STRING_WITH_LEN(" MODIFIES SQL DATA\n")); break; case SP_DEFAULT_ACCESS: case SP_CONTAINS_SQL: @@ -1615,12 +1642,12 @@ create_string(THD *thd, String *buf, break; } if (chistics->detistic) - buf->append(" DETERMINISTIC\n", 18); + buf->append(STRING_WITH_LEN(" DETERMINISTIC\n")); if (chistics->suid == SP_IS_NOT_SUID) - buf->append(" SQL SECURITY INVOKER\n", 25); + buf->append(STRING_WITH_LEN(" SQL SECURITY INVOKER\n")); if (chistics->comment.length) { - buf->append(" COMMENT "); + buf->append(STRING_WITH_LEN(" COMMENT ")); append_unescaped(buf, chistics->comment.str, chistics->comment.length); buf->append('\n'); } diff --git a/sql/sp.h b/sql/sp.h index 933e5793e4c..7f314b8903e 100644 --- a/sql/sp.h +++ b/sql/sp.h @@ -36,7 +36,8 @@ int sp_drop_db_routines(THD *thd, char *db); sp_head * -sp_find_procedure(THD *thd, sp_name *name, bool cache_only = 0); +sp_find_routine(THD *thd, int type, sp_name *name, + sp_cache **cp, bool cache_only); int sp_exists_routine(THD *thd, TABLE_LIST *procs, bool any, bool no_error); @@ -57,9 +58,6 @@ sp_show_create_procedure(THD *thd, sp_name *name); int sp_show_status_procedure(THD *thd, const char *wild); -sp_head * -sp_find_function(THD *thd, sp_name *name, bool cache_only = 0); - int sp_create_function(THD *thd, sp_head *sp); diff --git a/sql/sp_head.cc b/sql/sp_head.cc index fe3bac83eda..90d1ec38e64 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -105,6 +105,8 @@ sp_get_flags_for_command(LEX *lex) case SQLCOM_SHOW_TABLES: case SQLCOM_SHOW_VARIABLES: case SQLCOM_SHOW_WARNS: + case SQLCOM_SHOW_PROC_CODE: + case SQLCOM_SHOW_FUNC_CODE: flags= sp_head::MULTI_RESULTS; break; /* @@ -120,6 +122,45 @@ sp_get_flags_for_command(LEX *lex) case SQLCOM_DEALLOCATE_PREPARE: flags= sp_head::CONTAINS_DYNAMIC_SQL; break; + case SQLCOM_CREATE_TABLE: + if (lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) + flags= 0; + else + flags= sp_head::HAS_COMMIT_OR_ROLLBACK; + break; + case SQLCOM_DROP_TABLE: + if (lex->drop_temporary) + flags= 0; + else + flags= sp_head::HAS_COMMIT_OR_ROLLBACK; + break; + case SQLCOM_CREATE_INDEX: + case SQLCOM_CREATE_DB: + case SQLCOM_CREATE_VIEW: + case SQLCOM_CREATE_TRIGGER: + case SQLCOM_CREATE_USER: + case SQLCOM_ALTER_TABLE: + case SQLCOM_BEGIN: + case SQLCOM_RENAME_TABLE: + case SQLCOM_RENAME_USER: + case SQLCOM_DROP_INDEX: + case SQLCOM_DROP_DB: + case SQLCOM_DROP_USER: + case SQLCOM_DROP_VIEW: + case SQLCOM_DROP_TRIGGER: + case SQLCOM_TRUNCATE: + case SQLCOM_COMMIT: + case SQLCOM_ROLLBACK: + case SQLCOM_LOAD_MASTER_DATA: + case SQLCOM_LOCK_TABLES: + case SQLCOM_CREATE_PROCEDURE: + case SQLCOM_CREATE_SPFUNCTION: + case SQLCOM_ALTER_PROCEDURE: + case SQLCOM_ALTER_FUNCTION: + case SQLCOM_DROP_PROCEDURE: + case SQLCOM_DROP_FUNCTION: + flags= sp_head::HAS_COMMIT_OR_ROLLBACK; + break; default: flags= 0; break; @@ -202,6 +243,10 @@ sp_eval_func_item(THD *thd, Item **it_addr, enum enum_field_types type, Item *old_item_next, *old_free_list, **p_free_list; DBUG_PRINT("info", ("type: %d", type)); + LINT_INIT(old_item_next); + LINT_INIT(old_free_list); + LINT_INIT(p_free_list); + if (!it) DBUG_RETURN(NULL); @@ -437,7 +482,8 @@ sp_head::operator delete(void *ptr, size_t size) sp_head::sp_head() :Query_arena(&main_mem_root, INITIALIZED_FOR_SP), - m_flags(0), m_returns_cs(NULL) + m_flags(0), m_returns_cs(NULL), m_recursion_level(0), m_next_cached_sp(0), + m_first_instance(this), m_first_free_instance(this), m_last_cached_sp(this) { extern byte * sp_table_key(const byte *ptr, uint *plen, my_bool first); @@ -476,7 +522,7 @@ void sp_head::init_strings(THD *thd, LEX *lex, sp_name *name) { DBUG_ENTER("sp_head::init_strings"); - uint n; /* Counter for nul trimming */ + const uchar *endp; /* Used to trim the end */ /* During parsing, we must use thd->mem_root */ MEM_ROOT *root= thd->mem_root; @@ -509,17 +555,20 @@ sp_head::init_strings(THD *thd, LEX *lex, sp_name *name) (char *)m_param_begin, m_params.length); } - m_body.length= lex->ptr - m_body_begin; - /* Trim nuls at the end */ - n= 0; - while (m_body.length && m_body_begin[m_body.length-1] == '\0') - { - m_body.length-= 1; - n+= 1; - } + /* If ptr has overrun end_of_query then end_of_query is the end */ + endp= (lex->ptr > lex->end_of_query ? lex->end_of_query : lex->ptr); + /* + Trim "garbage" at the end. This is sometimes needed with the + "/ * ! VERSION... * /" wrapper in dump files. + */ + while (m_body_begin < endp && + (endp[-1] <= ' ' || endp[-1] == '*' || + endp[-1] == '/' || endp[-1] == ';')) + endp-= 1; + + m_body.length= endp - m_body_begin; m_body.str= strmake_root(root, (char *)m_body_begin, m_body.length); - m_defstr.length= lex->ptr - lex->buf; - m_defstr.length-= n; + m_defstr.length= endp - lex->buf; m_defstr.str= strmake_root(root, (char *)lex->buf, m_defstr.length); DBUG_VOID_RETURN; } @@ -615,6 +664,7 @@ sp_head::create(THD *thd) sp_head::~sp_head() { destroy(); + delete m_next_cached_sp; if (m_thd) restore_thd_mem_root(m_thd); } @@ -665,12 +715,14 @@ sp_head::make_field(uint max_length, const char *name, TABLE *dummy) Field *field; DBUG_ENTER("sp_head::make_field"); - field= ::make_field((char *)0, - !m_returns_len ? max_length : m_returns_len, - (uchar *)"", 0, m_returns_pack, m_returns, m_returns_cs, - m_geom_returns, Field::NONE, - m_returns_typelib, - name ? name : (const char *)m_name.str, dummy); + field= ::make_field(dummy->s, (char *)0, + !m_returns_len ? max_length : m_returns_len, + (uchar *)"", 0, m_returns_pack, m_returns, m_returns_cs, + m_geom_returns, Field::NONE, + m_returns_typelib, + name ? name : (const char *)m_name.str); + if (field) + field->init(dummy); DBUG_RETURN(field); } @@ -816,9 +868,9 @@ static bool subst_spvars(THD *thd, sp_instr *instr, LEX_STRING *query_str) prev_pos= (*splocal)->pos_in_query + (*splocal)->m_name.length; /* append the spvar substitute */ - res|= qbuf.append(" NAME_CONST('"); + res|= qbuf.append(STRING_WITH_LEN(" NAME_CONST('")); res|= qbuf.append((*splocal)->m_name.str, (*splocal)->m_name.length); - res|= qbuf.append("',"); + res|= qbuf.append(STRING_WITH_LEN("',")); val= (*splocal)->this_item(); DBUG_PRINT("info", ("print %p", val)); val->print(&qbuf); @@ -840,6 +892,31 @@ static bool subst_spvars(THD *thd, sp_instr *instr, LEX_STRING *query_str) } +/* + Return appropriate error about recursion limit reaching + + SYNOPSIS + sp_head::recursion_level_error() + + NOTE + For functions and triggers we return error about prohibited recursion. + For stored procedures we return about reaching recursion limit. +*/ + +void sp_head::recursion_level_error() +{ + if (m_type == TYPE_ENUM_PROCEDURE) + { + THD *thd= current_thd; + my_error(ER_SP_RECURSION_LIMIT, MYF(0), + thd->variables.max_sp_recursion_depth, + m_name); + } + else + my_error(ER_SP_NO_RECURSION, MYF(0)); +} + + /* Execute the routine. The main instruction jump loop is there Assume the parameters already set. @@ -869,37 +946,31 @@ int sp_head::execute(THD *thd) Item_change_list old_change_list; String old_packet; + /* Use some extra margin for possible SP recursion and functions */ + if (check_stack_overrun(thd, 8 * STACK_MIN_SIZE, (char*)&old_packet)) + { + DBUG_RETURN(-1); + } + /* init per-instruction memroot */ init_alloc_root(&execute_mem_root, MEM_ROOT_BLOCK_SIZE, 0); - - /* Use some extra margin for possible SP recursion and functions */ - if (check_stack_overrun(thd, 4*STACK_MIN_SIZE, olddb)) - { - DBUG_RETURN(-1); - } - - if (m_flags & IS_INVOKED) - { - /* - We have to disable recursion for stored routines since in - many cases LEX structure and many Item's can't be used in - reentrant way now. - - TODO: We can circumvent this problem by using separate - sp_head instances for each recursive invocation. - - NOTE: Theoretically arguments of procedure can be evaluated - before its invocation so there should be no problem with - recursion. But since we perform cleanup for CALL statement - as for any other statement only after its execution, its LEX - structure is not reusable for recursive calls. Thus we have - to prohibit recursion for stored procedures too. - */ - my_error(ER_SP_NO_RECURSION, MYF(0)); - DBUG_RETURN(-1); - } + DBUG_ASSERT(!(m_flags & IS_INVOKED)); m_flags|= IS_INVOKED; + m_first_instance->m_first_free_instance= m_next_cached_sp; + DBUG_PRINT("info", ("first free for 0x%lx ++: 0x%lx->0x%lx, level: %lu, flags %x", + (ulong)m_first_instance, this, m_next_cached_sp, + m_next_cached_sp->m_recursion_level, + m_next_cached_sp->m_flags)); + /* + Check that if there are not any instances after this one then + pointer to the last instance points on this instance or if there are + some instances after this one then recursion level of next instance + greater then recursion level of current instance on 1 + */ + DBUG_ASSERT((m_next_cached_sp == 0 && + m_first_instance->m_last_cached_sp == this) || + (m_recursion_level + 1 == m_next_cached_sp->m_recursion_level)); dbchanged= FALSE; if (m_db.length && @@ -1004,7 +1075,7 @@ int sp_head::execute(THD *thd) } /* we should cleanup free_list and memroot, used by instruction */ - thd->free_items(); + thd->cleanup_after_query(); free_root(&execute_mem_root, MYF(0)); /* @@ -1074,6 +1145,29 @@ int sp_head::execute(THD *thd) ret= mysql_change_db(thd, olddb, 1); } m_flags&= ~IS_INVOKED; + DBUG_PRINT("info", ("first free for 0x%lx --: 0x%lx->0x%lx, level: %lu, flags %x", + (ulong)m_first_instance, + m_first_instance->m_first_free_instance, this, + m_recursion_level, m_flags)); + /* + Check that we have one of following: + + 1) there are not free instances which means that this instance is last + in the list of instances (pointer to the last instance point on it and + ther are not other instances after this one in the list) + + 2) There are some free instances which mean that first free instance + should go just after this one and recursion level of that free instance + should be on 1 more then recursion leven of this instance. + */ + DBUG_ASSERT((m_first_instance->m_first_free_instance == 0 && + this == m_first_instance->m_last_cached_sp && + m_next_cached_sp == 0) || + (m_first_instance->m_first_free_instance != 0 && + m_first_instance->m_first_free_instance == m_next_cached_sp && + m_first_instance->m_first_free_instance->m_recursion_level == + m_recursion_level + 1)); + m_first_instance->m_first_free_instance= this; DBUG_RETURN(ret); } @@ -1131,6 +1225,9 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount, Item **resp) // QQ Should have some error checking here? (types, etc...) if (!(nctx= new sp_rcontext(octx, csize, hmax, cmax))) goto end; +#ifndef DBUG_OFF + nctx->owner= this; +#endif for (i= 0 ; i < argcount ; i++) { sp_pvar_t *pvar = m_pcont->find_pvar(i); @@ -1173,7 +1270,7 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount, Item **resp) char buf[256]; String bufstr(buf, sizeof(buf), &my_charset_bin); bufstr.length(0); - bufstr.append("DO ", 3); + bufstr.append(STRING_WITH_LEN("DO ")); append_identifier(thd, &bufstr, m_name.str, m_name.length); bufstr.append('('); for (uint i=0; i < argcount; i++) @@ -1275,6 +1372,9 @@ int sp_head::execute_procedure(THD *thd, List *args) { // Create a temporary old context if (!(octx= new sp_rcontext(octx, csize, hmax, cmax))) DBUG_RETURN(-1); +#ifndef DBUG_OFF + octx->owner= 0; +#endif thd->spcont= octx; /* set callers_arena to thd, for upper-level function to work */ @@ -1286,6 +1386,9 @@ int sp_head::execute_procedure(THD *thd, List *args) thd->spcont= save_spcont; DBUG_RETURN(-1); } +#ifndef DBUG_OFF + nctx->owner= this; +#endif if (csize > 0 || hmax > 0 || cmax > 0) { @@ -1569,21 +1672,9 @@ sp_head::check_backpatch(THD *thd) } void -sp_head::set_info(char *definer, uint definerlen, - longlong created, longlong modified, +sp_head::set_info(longlong created, longlong modified, st_sp_chistics *chistics, ulong sql_mode) { - char *p= strchr(definer, '@'); - uint len; - - if (! p) - p= definer; // Weird... - len= p-definer; - m_definer_user.str= strmake_root(mem_root, definer, len); - m_definer_user.length= len; - len= definerlen-len-1; - m_definer_host.str= strmake_root(mem_root, p+1, len); - m_definer_host.length= len; m_created= created; m_modified= modified; m_chistics= (st_sp_chistics *) memdup_root(mem_root, (char*) chistics, @@ -1597,6 +1688,34 @@ sp_head::set_info(char *definer, uint definerlen, m_sql_mode= sql_mode; } + +void +sp_head::set_definer(char *definer, uint definerlen) +{ + char *p= strrchr(definer, '@'); + + if (!p) + { + m_definer_user.str= strmake_root(mem_root, "", 0); + m_definer_user.length= 0; + + m_definer_host.str= strmake_root(mem_root, "", 0); + m_definer_host.length= 0; + } + else + { + const uint user_name_len= p - definer; + const uint host_name_len= definerlen - user_name_len - 1; + + m_definer_user.str= strmake_root(mem_root, definer, user_name_len); + m_definer_user.length= user_name_len; + + m_definer_host.str= strmake_root(mem_root, p + 1, host_name_len); + m_definer_host.length= host_name_len; + } +} + + void sp_head::reset_thd_mem_root(THD *thd) { @@ -1682,7 +1801,7 @@ sp_head::show_create_procedure(THD *thd) LINT_INIT(sql_mode_len); if (check_show_routine_access(thd, this, &full_access)) - return 1; + DBUG_RETURN(1); sql_mode_str= sys_var_thd_sql_mode::symbolic_mode_representation(thd, @@ -1695,10 +1814,7 @@ sp_head::show_create_procedure(THD *thd) max(buffer.length(), 1024))); if (protocol->send_fields(&field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) - { - res= 1; - goto done; - } + DBUG_RETURN(1); protocol->prepare_for_resend(); protocol->store(m_name.str, m_name.length, system_charset_info); protocol->store((char*) sql_mode_str, sql_mode_len, system_charset_info); @@ -1707,7 +1823,6 @@ sp_head::show_create_procedure(THD *thd) res= protocol->write(); send_eof(thd); - done: DBUG_RETURN(res); } @@ -1752,7 +1867,7 @@ sp_head::show_create_function(THD *thd) LINT_INIT(sql_mode_len); if (check_show_routine_access(thd, this, &full_access)) - return 1; + DBUG_RETURN(1); sql_mode_str= sys_var_thd_sql_mode::symbolic_mode_representation(thd, @@ -1764,10 +1879,7 @@ sp_head::show_create_function(THD *thd) max(buffer.length(),1024))); if (protocol->send_fields(&field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) - { - res= 1; - goto done; - } + DBUG_RETURN(1); protocol->prepare_for_resend(); protocol->store(m_name.str, m_name.length, system_charset_info); protocol->store((char*) sql_mode_str, sql_mode_len, system_charset_info); @@ -1776,7 +1888,6 @@ sp_head::show_create_function(THD *thd) res= protocol->write(); send_eof(thd); - done: DBUG_RETURN(res); } @@ -1836,6 +1947,50 @@ sp_head::opt_mark(uint ip) } +#ifndef DBUG_OFF +int +sp_head::show_routine_code(THD *thd) +{ + Protocol *protocol= thd->protocol; + char buff[2048]; + String buffer(buff, sizeof(buff), system_charset_info); + List field_list; + sp_instr *i; + bool full_access; + int res= 0; + uint ip; + DBUG_ENTER("sp_head::show_routine_code"); + DBUG_PRINT("info", ("procedure: %s", m_name.str)); + + if (check_show_routine_access(thd, this, &full_access) || !full_access) + DBUG_RETURN(1); + + field_list.push_back(new Item_uint("Pos", 9)); + // 1024 is for not to confuse old clients + field_list.push_back(new Item_empty_string("Instruction", + max(buffer.length(), 1024))); + if (protocol->send_fields(&field_list, Protocol::SEND_NUM_ROWS | + Protocol::SEND_EOF)) + DBUG_RETURN(1); + + for (ip= 0; (i = get_instr(ip)) ; ip++) + { + protocol->prepare_for_resend(); + protocol->store((longlong)ip); + + buffer.set("", 0, system_charset_info); + i->print(&buffer); + protocol->store(buffer.ptr(), buffer.length(), system_charset_info); + if ((res= protocol->write())) + break; + } + send_eof(thd); + + DBUG_RETURN(res); +} +#endif // ifndef DBUG_OFF + + /* Prepare LEX and thread for execution of instruction, if requested open and lock LEX's tables, execute instruction's core function, perform @@ -1994,14 +2149,43 @@ sp_instr_stmt::execute(THD *thd, uint *nextp) DBUG_RETURN(res); } +/* + Sufficient max length of printed destinations and frame offsets (all uints). +*/ +#define SP_INSTR_UINT_MAXLEN 8 + +#define SP_STMT_PRINT_MAXLEN 40 void sp_instr_stmt::print(String *str) { - str->reserve(12); - str->append("stmt "); - str->qs_append((uint)m_lex_keeper.sql_command()); -} + uint i, len; + /* stmt CMD "..." */ + if (str->reserve(SP_STMT_PRINT_MAXLEN+SP_INSTR_UINT_MAXLEN+8)) + return; + str->qs_append(STRING_WITH_LEN("stmt ")); + str->qs_append((uint)m_lex_keeper.sql_command()); + str->qs_append(STRING_WITH_LEN(" \"")); + len= m_query.length; + /* + Print the query string (but not too much of it), just to indicate which + statement it is. + */ + if (len > SP_STMT_PRINT_MAXLEN) + len= SP_STMT_PRINT_MAXLEN-3; + /* Copy the query string and replace '\n' with ' ' in the process */ + for (i= 0 ; i < len ; i++) + { + if (m_query.str[i] == '\n') + str->qs_append(' '); + else + str->qs_append(m_query.str[i]); + } + if (m_query.length > SP_STMT_PRINT_MAXLEN) + str->qs_append(STRING_WITH_LEN("...")); /* Indicate truncated string */ + str->qs_append('"'); +} +#undef SP_STMT_PRINT_MAXLEN int sp_instr_stmt::exec_core(THD *thd, uint *nextp) @@ -2031,6 +2215,26 @@ sp_instr_set::exec_core(THD *thd, uint *nextp) { int res= thd->spcont->set_item_eval(thd, m_offset, &m_value, m_type); + if (res < 0 && + thd->spcont->get_item(m_offset) == NULL && + thd->spcont->found_handler_here()) + { + /* + Failed to evaluate the value, the variable is still not initialized, + and a handler has been found. Set to null so we can continue. + */ + Item *it= new Item_null(); + + if (!it || thd->spcont->set_item_eval(thd, m_offset, &it, m_type) < 0) + { /* If this also failed, we have to abort */ + sp_rcontext *spcont= thd->spcont; + + thd->spcont= 0; /* Avoid handlers */ + my_error(ER_OUT_OF_RESOURCES, MYF(0)); + spcont->clear_handler(); + thd->spcont= spcont; + } + } *nextp = m_ip+1; return res; } @@ -2038,10 +2242,23 @@ sp_instr_set::exec_core(THD *thd, uint *nextp) void sp_instr_set::print(String *str) { - str->reserve(12); - str->append("set "); + /* set name@offset ... */ + int rsrv = SP_INSTR_UINT_MAXLEN+6; + sp_pvar_t *var = m_ctx->find_pvar(m_offset); + + /* 'var' should always be non-null, but just in case... */ + if (var) + rsrv+= var->name.length; + if (str->reserve(rsrv)) + return; + str->qs_append(STRING_WITH_LEN("set ")); + if (var) + { + str->qs_append(var->name.str, var->name.length); + str->qs_append('@'); + } str->qs_append(m_offset); - str->append(' '); + str->qs_append(' '); m_value->print(str); } @@ -2074,9 +2291,9 @@ sp_instr_set_trigger_field::exec_core(THD *thd, uint *nextp) void sp_instr_set_trigger_field::print(String *str) { - str->append("set ", 4); + str->append(STRING_WITH_LEN("set_trigger_field ")); trigger_field->print(str); - str->append(":=", 2); + str->append(STRING_WITH_LEN(":=")); value->print(str); } @@ -2098,8 +2315,10 @@ sp_instr_jump::execute(THD *thd, uint *nextp) void sp_instr_jump::print(String *str) { - str->reserve(12); - str->append("jump "); + /* jump dest */ + if (str->reserve(SP_INSTR_UINT_MAXLEN+5)) + return; + str->qs_append(STRING_WITH_LEN("jump ")); str->qs_append(m_dest); } @@ -2180,10 +2399,12 @@ sp_instr_jump_if::exec_core(THD *thd, uint *nextp) void sp_instr_jump_if::print(String *str) { - str->reserve(12); - str->append("jump_if "); + /* jump_if dest ... */ + if (str->reserve(SP_INSTR_UINT_MAXLEN+8+32)) // Add some for the expr. too + return; + str->qs_append(STRING_WITH_LEN("jump_if ")); str->qs_append(m_dest); - str->append(' '); + str->qs_append(' '); m_expr->print(str); } @@ -2241,10 +2462,12 @@ sp_instr_jump_if_not::exec_core(THD *thd, uint *nextp) void sp_instr_jump_if_not::print(String *str) { - str->reserve(16); - str->append("jump_if_not "); + /* jump_if_not dest ... */ + if (str->reserve(SP_INSTR_UINT_MAXLEN+12+32)) // Add some for the expr. too + return; + str->qs_append(STRING_WITH_LEN("jump_if_not ")); str->qs_append(m_dest); - str->append(' '); + str->qs_append(' '); m_expr->print(str); } @@ -2299,10 +2522,12 @@ sp_instr_freturn::exec_core(THD *thd, uint *nextp) void sp_instr_freturn::print(String *str) { - str->reserve(12); - str->append("freturn "); + /* freturn type expr... */ + if (str->reserve(UINT_MAX+8+32)) // Add some for the expr. too + return; + str->qs_append(STRING_WITH_LEN("freturn ")); str->qs_append((uint)m_type); - str->append(' '); + str->qs_append(' '); m_value->print(str); } @@ -2327,15 +2552,31 @@ sp_instr_hpush_jump::execute(THD *thd, uint *nextp) void sp_instr_hpush_jump::print(String *str) { - str->reserve(32); - str->append("hpush_jump "); + /* hpush_jump dest fsize type */ + if (str->reserve(SP_INSTR_UINT_MAXLEN*2 + 21)) + return; + str->qs_append(STRING_WITH_LEN("hpush_jump ")); str->qs_append(m_dest); - str->append(" t="); - str->qs_append(m_type); - str->append(" f="); + str->qs_append(' '); str->qs_append(m_frame); - str->append(" h="); - str->qs_append(m_ip+1); + switch (m_type) + { + case SP_HANDLER_NONE: + str->qs_append(STRING_WITH_LEN(" NONE")); // This would be a bug + break; + case SP_HANDLER_EXIT: + str->qs_append(STRING_WITH_LEN(" EXIT")); + break; + case SP_HANDLER_CONTINUE: + str->qs_append(STRING_WITH_LEN(" CONTINUE")); + break; + case SP_HANDLER_UNDO: + str->qs_append(STRING_WITH_LEN(" UNDO")); + break; + default: + str->qs_append(STRING_WITH_LEN(" UNKNOWN:")); // This would be a bug as well + str->qs_append(m_type); + } } uint @@ -2370,8 +2611,10 @@ sp_instr_hpop::execute(THD *thd, uint *nextp) void sp_instr_hpop::print(String *str) { - str->reserve(12); - str->append("hpop "); + /* hpop count */ + if (str->reserve(SP_INSTR_UINT_MAXLEN+5)) + return; + str->qs_append(STRING_WITH_LEN("hpop ")); str->qs_append(m_count); } @@ -2405,12 +2648,14 @@ sp_instr_hreturn::execute(THD *thd, uint *nextp) void sp_instr_hreturn::print(String *str) { - str->reserve(16); - str->append("hreturn "); + /* hreturn framesize dest */ + if (str->reserve(SP_INSTR_UINT_MAXLEN*2 + 9)) + return; + str->qs_append(STRING_WITH_LEN("hreturn ")); str->qs_append(m_frame); if (m_dest) { - str->append(' '); + str->qs_append(' '); str->qs_append(m_dest); } } @@ -2458,7 +2703,22 @@ sp_instr_cpush::execute(THD *thd, uint *nextp) void sp_instr_cpush::print(String *str) { - str->append("cpush"); + LEX_STRING n; + my_bool found= m_ctx->find_cursor(m_cursor, &n); + /* cpush name@offset */ + uint rsrv= SP_INSTR_UINT_MAXLEN+7; + + if (found) + rsrv+= n.length; + if (str->reserve(rsrv)) + return; + str->qs_append(STRING_WITH_LEN("cpush ")); + if (found) + { + str->qs_append(n.str, n.length); + str->qs_append('@'); + } + str->qs_append(m_cursor); } @@ -2479,8 +2739,10 @@ sp_instr_cpop::execute(THD *thd, uint *nextp) void sp_instr_cpop::print(String *str) { - str->reserve(12); - str->append("cpop "); + /* cpop count */ + if (str->reserve(SP_INSTR_UINT_MAXLEN+5)) + return; + str->qs_append(STRING_WITH_LEN("cpop ")); str->qs_append(m_count); } @@ -2554,8 +2816,21 @@ sp_instr_copen::exec_core(THD *thd, uint *nextp) void sp_instr_copen::print(String *str) { - str->reserve(12); - str->append("copen "); + LEX_STRING n; + my_bool found= m_ctx->find_cursor(m_cursor, &n); + /* copen name@offset */ + uint rsrv= SP_INSTR_UINT_MAXLEN+7; + + if (found) + rsrv+= n.length; + if (str->reserve(rsrv)) + return; + str->qs_append(STRING_WITH_LEN("copen ")); + if (found) + { + str->qs_append(n.str, n.length); + str->qs_append('@'); + } str->qs_append(m_cursor); } @@ -2583,8 +2858,21 @@ sp_instr_cclose::execute(THD *thd, uint *nextp) void sp_instr_cclose::print(String *str) { - str->reserve(12); - str->append("cclose "); + LEX_STRING n; + my_bool found= m_ctx->find_cursor(m_cursor, &n); + /* cclose name@offset */ + uint rsrv= SP_INSTR_UINT_MAXLEN+8; + + if (found) + rsrv+= n.length; + if (str->reserve(rsrv)) + return; + str->qs_append(STRING_WITH_LEN("cclose ")); + if (found) + { + str->qs_append(n.str, n.length); + str->qs_append('@'); + } str->qs_append(m_cursor); } @@ -2613,14 +2901,29 @@ sp_instr_cfetch::print(String *str) { List_iterator_fast li(m_varlist); sp_pvar_t *pv; + LEX_STRING n; + my_bool found= m_ctx->find_cursor(m_cursor, &n); + /* cfetch name@offset vars... */ + uint rsrv= SP_INSTR_UINT_MAXLEN+8; - str->reserve(12); - str->append("cfetch "); + if (found) + rsrv+= n.length; + if (str->reserve(rsrv)) + return; + str->qs_append(STRING_WITH_LEN("cfetch ")); + if (found) + { + str->qs_append(n.str, n.length); + str->qs_append('@'); + } str->qs_append(m_cursor); while ((pv= li++)) { - str->reserve(8); - str->append(' '); + if (str->reserve(pv->name.length+SP_INSTR_UINT_MAXLEN+2)) + return; + str->qs_append(' '); + str->qs_append(pv->name.str, pv->name.length); + str->qs_append('@'); str->qs_append(pv->offset); } } @@ -2644,8 +2947,10 @@ sp_instr_error::execute(THD *thd, uint *nextp) void sp_instr_error::print(String *str) { - str->reserve(12); - str->append("error "); + /* error code */ + if (str->reserve(SP_INSTR_UINT_MAXLEN+6)) + return; + str->qs_append(STRING_WITH_LEN("error ")); str->qs_append(m_errcode); } @@ -2848,33 +3153,34 @@ sp_head::add_used_tables_to_table_list(THD *thd, DBUG_ENTER("sp_head::add_used_tables_to_table_list"); /* - Use persistent arena for table list allocation to be PS friendly. + Use persistent arena for table list allocation to be PS/SP friendly. + Note that we also have to copy database/table names and alias to PS/SP + memory since current instance of sp_head object can pass away before + next execution of PS/SP for which tables are added to prelocking list. + This will be fixed by introducing of proper invalidation mechanism + once new TDC is ready. */ arena= thd->activate_stmt_arena_if_needed(&backup); for (i=0 ; i < m_sptabs.records ; i++) { - char *tab_buff; + char *tab_buff, *key_buff; TABLE_LIST *table; SP_TABLE *stab= (SP_TABLE *)hash_element(&m_sptabs, i); if (stab->temp) continue; if (!(tab_buff= (char *)thd->calloc(ALIGN_SIZE(sizeof(TABLE_LIST)) * - stab->lock_count))) + stab->lock_count)) || + !(key_buff= (char*)thd->memdup(stab->qname.str, + stab->qname.length + 1))) DBUG_RETURN(FALSE); for (uint j= 0; j < stab->lock_count; j++) { table= (TABLE_LIST *)tab_buff; - /* - It's enough to just copy the pointers as the data will not change - during the lifetime of the SP. If the SP is used by PS, we assume - that the PS will be invalidated if the functions is deleted or - changed. - */ - table->db= stab->qname.str; + table->db= key_buff; table->db_length= stab->db_length; table->table_name= table->db + table->db_length + 1; table->table_name_length= stab->table_name_length; diff --git a/sql/sp_head.h b/sql/sp_head.h index ed0f3987e01..90ce53db9db 100644 --- a/sql/sp_head.h +++ b/sql/sp_head.h @@ -115,10 +115,13 @@ public: MULTI_RESULTS= 8, // Is set if a procedure with SELECT(s) CONTAINS_DYNAMIC_SQL= 16, // Is set if a procedure with PREPARE/EXECUTE IS_INVOKED= 32, // Is set if this sp_head is being used - HAS_SET_AUTOCOMMIT_STMT = 64 // Is set if a procedure with 'set autocommit' + HAS_SET_AUTOCOMMIT_STMT= 64,// Is set if a procedure with 'set autocommit' + /* Is set if a procedure with COMMIT (implicit or explicit) | ROLLBACK */ + HAS_COMMIT_OR_ROLLBACK= 128 }; - int m_type; // TYPE_ENUM_FUNCTION or TYPE_ENUM_PROCEDURE + /* TYPE_ENUM_FUNCTION, TYPE_ENUM_PROCEDURE or TYPE_ENUM_TRIGGER */ + int m_type; uint m_flags; // Boolean attributes of a stored routine enum enum_field_types m_returns; // For FUNCTIONs only Field::geometry_type m_geom_returns; @@ -126,7 +129,7 @@ public: TYPELIB *m_returns_typelib; // For FUNCTIONs only uint m_returns_len; // For FUNCTIONs only uint m_returns_pack; // For FUNCTIONs only - uchar *m_tmp_query; // Temporary pointer to sub query string + const uchar *m_tmp_query; // Temporary pointer to sub query string uint m_old_cmq; // Old CLIENT_MULTI_QUERIES value st_sp_chistics *m_chistics; ulong m_sql_mode; // For SHOW CREATE and execution @@ -140,6 +143,32 @@ public: LEX_STRING m_definer_host; longlong m_created; longlong m_modified; + /* Recursion level of the current SP instance. The levels are numbered from 0 */ + ulong m_recursion_level; + /* + A list of diferent recursion level instances for the same procedure. + For every recursion level we have a sp_head instance. This instances + connected in the list. The list ordered by increasing recursion level + (m_recursion_level). + */ + sp_head *m_next_cached_sp; + /* + Pointer to the first element of the above list + */ + sp_head *m_first_instance; + /* + Pointer to the first free (non-INVOKED) routine in the list of + cached instances for this SP. This pointer is set only for the first + SP in the list of instences (see above m_first_cached_sp pointer). + The pointer equal to 0 if we have no free instances. + For non-first instance value of this pointer meanless (point to itself); + */ + sp_head *m_first_free_instance; + /* + Pointer to the last element in the list of instances of the SP. + For non-first instance value of this pointer meanless (point to itself); + */ + sp_head *m_last_cached_sp; /* Set containing names of stored routines used by this routine. Note that unlike elements of similar set for statement elements of this @@ -149,7 +178,7 @@ public: */ HASH m_sroutines; // Pointers set during parsing - uchar *m_param_begin, *m_param_end, *m_body_begin; + const uchar *m_param_begin, *m_param_end, *m_body_begin; /* Security context for stored routine which should be run under @@ -251,10 +280,11 @@ public: Field *make_field(uint max_length, const char *name, TABLE *dummy); - void set_info(char *definer, uint definerlen, - longlong created, longlong modified, + void set_info(longlong created, longlong modified, st_sp_chistics *chistics, ulong sql_mode); + void set_definer(char *definer, uint definerlen); + void reset_thd_mem_root(THD *thd); void restore_thd_mem_root(THD *thd); @@ -262,6 +292,8 @@ public: void optimize(); void opt_mark(uint ip); + void recursion_level_error(); + inline sp_instr * get_instr(uint i) { @@ -291,9 +323,21 @@ public: my_error(ER_SP_NO_RETSET, MYF(0), where); else if (m_flags & HAS_SET_AUTOCOMMIT_STMT) my_error(ER_SP_CANT_SET_AUTOCOMMIT, MYF(0)); + else if (m_type != TYPE_ENUM_PROCEDURE && + (m_flags & sp_head::HAS_COMMIT_OR_ROLLBACK)) + { + my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0)); + return TRUE; + } return test(m_flags & (CONTAINS_DYNAMIC_SQL|MULTI_RESULTS|HAS_SET_AUTOCOMMIT_STMT)); } + +#ifndef DBUG_OFF + int show_routine_code(THD *thd); +#endif + + private: MEM_ROOT *m_thd_root; // Temp. store for thd's mem_root @@ -855,8 +899,8 @@ class sp_instr_cpush : public sp_instr public: - sp_instr_cpush(uint ip, sp_pcontext *ctx, LEX *lex) - : sp_instr(ip, ctx), m_lex_keeper(lex, TRUE) + sp_instr_cpush(uint ip, sp_pcontext *ctx, LEX *lex, uint offset) + : sp_instr(ip, ctx), m_lex_keeper(lex, TRUE), m_cursor(offset) {} virtual ~sp_instr_cpush() @@ -875,6 +919,7 @@ public: private: sp_lex_keeper m_lex_keeper; + uint m_cursor; /* Frame offset (for debugging) */ }; // class sp_instr_cpush : public sp_instr diff --git a/sql/sp_pcontext.cc b/sql/sp_pcontext.cc index f873b676925..6f3a9cb04aa 100644 --- a/sql/sp_pcontext.cc +++ b/sql/sp_pcontext.cc @@ -52,7 +52,7 @@ sp_cond_check(LEX_STRING *sqlstate) sp_pcontext::sp_pcontext(sp_pcontext *prev) : Sql_alloc(), m_psubsize(0), m_csubsize(0), m_hsubsize(0), - m_handlers(0), m_parent(prev) + m_handlers(0), m_parent(prev), m_pboundary(0) { VOID(my_init_dynamic_array(&m_pvar, sizeof(sp_pvar_t *), 16, 8)); VOID(my_init_dynamic_array(&m_cond, sizeof(sp_cond_type_t *), 16, 8)); @@ -150,7 +150,7 @@ sp_pcontext::diff_cursors(sp_pcontext *ctx) sp_pvar_t * sp_pcontext::find_pvar(LEX_STRING *name, my_bool scoped) { - uint i= m_pvar.elements; + uint i= m_pvar.elements - m_pboundary; while (i--) { @@ -169,6 +169,28 @@ sp_pcontext::find_pvar(LEX_STRING *name, my_bool scoped) return NULL; } +/* + Find a variable by offset from the top. + This used for two things: + - When evaluating parameters at the beginning, and setting out parameters + at the end, of invokation. (Top frame only, so no recursion then.) + - For printing of sp_instr_set. (Debug mode only.) + */ +sp_pvar_t * +sp_pcontext::find_pvar(uint offset) +{ + if (m_poffset <= offset && offset < m_poffset + m_pvar.elements) + { // This frame + sp_pvar_t *p; + + get_dynamic(&m_pvar, (gptr)&p, offset - m_poffset); + return p; + } + if (m_parent) + return m_parent->find_pvar(offset); // Some previous frame + return NULL; // index out of bounds +} + void sp_pcontext::push_pvar(LEX_STRING *name, enum enum_field_types type, sp_param_mode_t mode) @@ -331,3 +353,21 @@ sp_pcontext::find_cursor(LEX_STRING *name, uint *poff, my_bool scoped) return m_parent->find_cursor(name, poff, scoped); return FALSE; } + +/* + Find a cursor by offset from the top. + This is only used for debugging. + */ +my_bool +sp_pcontext::find_cursor(uint offset, LEX_STRING *n) +{ + if (m_coffset <= offset && offset < m_coffset + m_cursor.elements) + { // This frame + get_dynamic(&m_cursor, (gptr)n, offset - m_coffset); + return TRUE; + } + if (m_parent) + return m_parent->find_cursor(offset, n); // Some previous frame + return FALSE; // index out of bounds +} + diff --git a/sql/sp_pcontext.h b/sql/sp_pcontext.h index bd2259cb6fb..5c5890f82cd 100644 --- a/sql/sp_pcontext.h +++ b/sql/sp_pcontext.h @@ -170,17 +170,18 @@ class sp_pcontext : public Sql_alloc sp_pvar_t * find_pvar(LEX_STRING *name, my_bool scoped=0); - // Find by index + // Find by offset sp_pvar_t * - find_pvar(uint i) - { - sp_pvar_t *p; + find_pvar(uint offset); - if (i < m_pvar.elements) - get_dynamic(&m_pvar, (gptr)&p, i); - else - p= NULL; - return p; + /* + Set the current scope boundary (for default values) + The argument is the number of variables to skip. + */ + inline void + declare_var_boundary(uint n) + { + m_pboundary= n; } // @@ -261,6 +262,10 @@ class sp_pcontext : public Sql_alloc my_bool find_cursor(LEX_STRING *name, uint *poff, my_bool scoped=0); + /* Find by offset (for debugging only) */ + my_bool + find_cursor(uint offset, LEX_STRING *n); + inline uint max_cursors() { @@ -287,6 +292,13 @@ private: uint m_poffset; // Variable offset for this context uint m_coffset; // Cursor offset for this context + /* + Boundary for finding variables in this context. This is the number + of variables currently "invisible" to default clauses. + This is normally 0, but will be larger during parsing of + DECLARE ... DEFAULT, to get the scope right for DEFAULT values. + */ + uint m_pboundary; DYNAMIC_ARRAY m_pvar; // Parameters/variables DYNAMIC_ARRAY m_cond; // Conditions diff --git a/sql/sp_rcontext.h b/sql/sp_rcontext.h index cae5c5467c9..d54188aa96f 100644 --- a/sql/sp_rcontext.h +++ b/sql/sp_rcontext.h @@ -66,6 +66,14 @@ class sp_rcontext : public Sql_alloc */ Query_arena *callers_arena; +#ifndef DBUG_OFF + /* + Routine to which this Item_splocal belongs. Used for checking if correct + runtime context is used for variable handling. + */ + sp_head *owner; +#endif + sp_rcontext(sp_rcontext *prev, uint fsize, uint hmax, uint cmax); ~sp_rcontext() diff --git a/sql/spatial.cc b/sql/spatial.cc index 5af1bec45ca..e91653f79d5 100644 --- a/sql/spatial.cc +++ b/sql/spatial.cc @@ -178,7 +178,9 @@ static double wkb_get_double(const char *ptr, Geometry::wkbByteOrder bo) { double res; if (bo != Geometry::wkb_xdr) + { float8get(res, ptr); + } else { char inv_array[8]; @@ -1791,7 +1793,7 @@ bool Gis_geometry_collection::get_data_as_wkt(String *txt, geom->set_data_ptr(data, (uint) (m_data_end - data)); if (geom->as_wkt(txt, &data)) return 1; - if (txt->append(",", 1, 512)) + if (txt->append(STRING_WITH_LEN(","), 512)) return 1; } txt->length(txt->length() - 1); diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index c47507bdd27..59f1e91e2e5 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -157,6 +157,7 @@ my_bool acl_init(bool dont_read_acl_tables) */ if (!(thd=new THD)) DBUG_RETURN(1); /* purecov: inspected */ + thd->thread_stack= (char*) &thd; thd->store_globals(); /* It is safe to call acl_reload() since acl_* arrays and hashes which @@ -1427,7 +1428,7 @@ bool change_password(THD *thd, const char *host, const char *user, */ tables.updating= 1; /* Thanks to bzero, tables.next==0 */ - if (!thd->spcont || rpl_filter->tables_ok(0, &tables)) + if (!(thd->spcont || rpl_filter->tables_ok(0, &tables))) DBUG_RETURN(0); } #endif @@ -1810,19 +1811,22 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo, /* We write down SSL related ACL stuff */ switch (lex->ssl_type) { case SSL_TYPE_ANY: - table->field[next_field]->store("ANY", 3, &my_charset_latin1); + table->field[next_field]->store(STRING_WITH_LEN("ANY"), + &my_charset_latin1); table->field[next_field+1]->store("", 0, &my_charset_latin1); table->field[next_field+2]->store("", 0, &my_charset_latin1); table->field[next_field+3]->store("", 0, &my_charset_latin1); break; case SSL_TYPE_X509: - table->field[next_field]->store("X509", 4, &my_charset_latin1); + table->field[next_field]->store(STRING_WITH_LEN("X509"), + &my_charset_latin1); table->field[next_field+1]->store("", 0, &my_charset_latin1); table->field[next_field+2]->store("", 0, &my_charset_latin1); table->field[next_field+3]->store("", 0, &my_charset_latin1); break; case SSL_TYPE_SPECIFIED: - table->field[next_field]->store("SPECIFIED", 9, &my_charset_latin1); + table->field[next_field]->store(STRING_WITH_LEN("SPECIFIED"), + &my_charset_latin1); table->field[next_field+1]->store("", 0, &my_charset_latin1); table->field[next_field+2]->store("", 0, &my_charset_latin1); table->field[next_field+3]->store("", 0, &my_charset_latin1); @@ -2216,10 +2220,10 @@ void free_grant_table(GRANT_TABLE *grant_table) /* Search after a matching grant. Prefer exact grants before not exact ones */ static GRANT_NAME *name_hash_search(HASH *name_hash, - const char *host,const char* ip, - const char *db, - const char *user, const char *tname, - bool exact) + const char *host,const char* ip, + const char *db, + const char *user, const char *tname, + bool exact) { char helping [NAME_LEN*2+USERNAME_LENGTH+3]; uint len; @@ -3260,6 +3264,7 @@ my_bool grant_init() if (!(thd= new THD)) DBUG_RETURN(1); /* purecov: deadcode */ + thd->thread_stack= (char*) &thd; thd->store_globals(); return_val= grant_reload(thd); delete thd; @@ -3532,7 +3537,7 @@ bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables, of other queries). For simple queries first_not_own_table is 0. */ for (i= 0, table= tables; - table != first_not_own_table && i < number; + table && table != first_not_own_table && i < number; table= table->next_global, i++) { /* Remove SHOW_VIEW_ACL, because it will be checked during making view */ @@ -4056,13 +4061,13 @@ bool mysql_show_grants(THD *thd,LEX_USER *lex_user) { String global(buff,sizeof(buff),system_charset_info); global.length(0); - global.append("GRANT ",6); + global.append(STRING_WITH_LEN("GRANT ")); want_access= acl_user->access; if (test_all_bits(want_access, (GLOBAL_ACLS & ~ GRANT_ACL))) - global.append("ALL PRIVILEGES",14); + global.append(STRING_WITH_LEN("ALL PRIVILEGES")); else if (!(want_access & ~GRANT_ACL)) - global.append("USAGE",5); + global.append(STRING_WITH_LEN("USAGE")); else { bool found=0; @@ -4072,16 +4077,16 @@ bool mysql_show_grants(THD *thd,LEX_USER *lex_user) if (test_access & j) { if (found) - global.append(", ",2); + global.append(STRING_WITH_LEN(", ")); found=1; global.append(command_array[counter],command_lengths[counter]); } } } - global.append (" ON *.* TO '",12); + global.append (STRING_WITH_LEN(" ON *.* TO '")); global.append(lex_user->user.str, lex_user->user.length, system_charset_info); - global.append ("'@'",3); + global.append (STRING_WITH_LEN("'@'")); global.append(lex_user->host.str,lex_user->host.length, system_charset_info); global.append ('\''); @@ -4092,23 +4097,23 @@ bool mysql_show_grants(THD *thd,LEX_USER *lex_user) make_password_from_salt(passwd_buff, acl_user->salt); else make_password_from_salt_323(passwd_buff, (ulong *) acl_user->salt); - global.append(" IDENTIFIED BY PASSWORD '",25); + global.append(STRING_WITH_LEN(" IDENTIFIED BY PASSWORD '")); global.append(passwd_buff); global.append('\''); } /* "show grants" SSL related stuff */ if (acl_user->ssl_type == SSL_TYPE_ANY) - global.append(" REQUIRE SSL",12); + global.append(STRING_WITH_LEN(" REQUIRE SSL")); else if (acl_user->ssl_type == SSL_TYPE_X509) - global.append(" REQUIRE X509",13); + global.append(STRING_WITH_LEN(" REQUIRE X509")); else if (acl_user->ssl_type == SSL_TYPE_SPECIFIED) { int ssl_options = 0; - global.append(" REQUIRE ",9); + global.append(STRING_WITH_LEN(" REQUIRE ")); if (acl_user->x509_issuer) { ssl_options++; - global.append("ISSUER \'",8); + global.append(STRING_WITH_LEN("ISSUER \'")); global.append(acl_user->x509_issuer,strlen(acl_user->x509_issuer)); global.append('\''); } @@ -4116,7 +4121,7 @@ bool mysql_show_grants(THD *thd,LEX_USER *lex_user) { if (ssl_options++) global.append(' '); - global.append("SUBJECT \'",9); + global.append(STRING_WITH_LEN("SUBJECT \'")); global.append(acl_user->x509_subject,strlen(acl_user->x509_subject), system_charset_info); global.append('\''); @@ -4125,7 +4130,7 @@ bool mysql_show_grants(THD *thd,LEX_USER *lex_user) { if (ssl_options++) global.append(' '); - global.append("CIPHER '",8); + global.append(STRING_WITH_LEN("CIPHER '")); global.append(acl_user->ssl_cipher,strlen(acl_user->ssl_cipher), system_charset_info); global.append('\''); @@ -4137,9 +4142,9 @@ bool mysql_show_grants(THD *thd,LEX_USER *lex_user) acl_user->user_resource.conn_per_hour || acl_user->user_resource.user_conn)) { - global.append(" WITH",5); + global.append(STRING_WITH_LEN(" WITH")); if (want_access & GRANT_ACL) - global.append(" GRANT OPTION",13); + global.append(STRING_WITH_LEN(" GRANT OPTION")); add_user_option(&global, acl_user->user_resource.questions, "MAX_QUERIES_PER_HOUR"); add_user_option(&global, acl_user->user_resource.updates, @@ -4177,12 +4182,12 @@ bool mysql_show_grants(THD *thd,LEX_USER *lex_user) { String db(buff,sizeof(buff),system_charset_info); db.length(0); - db.append("GRANT ",6); + db.append(STRING_WITH_LEN("GRANT ")); if (test_all_bits(want_access,(DB_ACLS & ~GRANT_ACL))) - db.append("ALL PRIVILEGES",14); + db.append(STRING_WITH_LEN("ALL PRIVILEGES")); else if (!(want_access & ~GRANT_ACL)) - db.append("USAGE",5); + db.append(STRING_WITH_LEN("USAGE")); else { int found=0, cnt; @@ -4192,23 +4197,23 @@ bool mysql_show_grants(THD *thd,LEX_USER *lex_user) if (test_access & j) { if (found) - db.append(", ",2); + db.append(STRING_WITH_LEN(", ")); found = 1; db.append(command_array[cnt],command_lengths[cnt]); } } } - db.append (" ON ",4); + db.append (STRING_WITH_LEN(" ON ")); append_identifier(thd, &db, acl_db->db, strlen(acl_db->db)); - db.append (".* TO '",7); + db.append (STRING_WITH_LEN(".* TO '")); db.append(lex_user->user.str, lex_user->user.length, system_charset_info); - db.append ("'@'",3); + db.append (STRING_WITH_LEN("'@'")); db.append(lex_user->host.str, lex_user->host.length, system_charset_info); db.append ('\''); if (want_access & GRANT_ACL) - db.append(" WITH GRANT OPTION",18); + db.append(STRING_WITH_LEN(" WITH GRANT OPTION")); protocol->prepare_for_resend(); protocol->store(db.ptr(),db.length(),db.charset()); if (protocol->write()) @@ -4241,12 +4246,12 @@ bool mysql_show_grants(THD *thd,LEX_USER *lex_user) ulong test_access= (table_access | grant_table->cols) & ~GRANT_ACL; global.length(0); - global.append("GRANT ",6); + global.append(STRING_WITH_LEN("GRANT ")); if (test_all_bits(table_access, (TABLE_ACLS & ~GRANT_ACL))) - global.append("ALL PRIVILEGES",14); + global.append(STRING_WITH_LEN("ALL PRIVILEGES")); else if (!test_access) - global.append("USAGE",5); + global.append(STRING_WITH_LEN("USAGE")); else { /* Add specific column access */ @@ -4258,7 +4263,7 @@ bool mysql_show_grants(THD *thd,LEX_USER *lex_user) if (test_access & j) { if (found) - global.append(", ",2); + global.append(STRING_WITH_LEN(", ")); found= 1; global.append(command_array[counter],command_lengths[counter]); @@ -4282,14 +4287,14 @@ bool mysql_show_grants(THD *thd,LEX_USER *lex_user) */ if (table_access & j) { - global.append(", ", 2); + global.append(STRING_WITH_LEN(", ")); global.append(command_array[counter], command_lengths[counter]); } - global.append(" (",2); + global.append(STRING_WITH_LEN(" (")); } else - global.append(", ",2); + global.append(STRING_WITH_LEN(", ")); global.append(grant_column->column, grant_column->key_length, system_charset_info); @@ -4301,21 +4306,21 @@ bool mysql_show_grants(THD *thd,LEX_USER *lex_user) } } } - global.append(" ON ",4); + global.append(STRING_WITH_LEN(" ON ")); append_identifier(thd, &global, grant_table->db, strlen(grant_table->db)); global.append('.'); append_identifier(thd, &global, grant_table->tname, strlen(grant_table->tname)); - global.append(" TO '",5); + global.append(STRING_WITH_LEN(" TO '")); global.append(lex_user->user.str, lex_user->user.length, system_charset_info); - global.append("'@'",3); + global.append(STRING_WITH_LEN("'@'")); global.append(lex_user->host.str,lex_user->host.length, system_charset_info); global.append('\''); if (table_access & GRANT_ACL) - global.append(" WITH GRANT OPTION",18); + global.append(STRING_WITH_LEN(" WITH GRANT OPTION")); protocol->prepare_for_resend(); protocol->store(global.ptr(),global.length(),global.charset()); if (protocol->write()) @@ -4328,14 +4333,14 @@ bool mysql_show_grants(THD *thd,LEX_USER *lex_user) } if (show_routine_grants(thd, lex_user, &proc_priv_hash, - "PROCEDURE", 9, buff, sizeof(buff))) + STRING_WITH_LEN("PROCEDURE"), buff, sizeof(buff))) { error= -1; goto end; } if (show_routine_grants(thd, lex_user, &func_priv_hash, - "FUNCTION", 8, buff, sizeof(buff))) + STRING_WITH_LEN("FUNCTION"), buff, sizeof(buff))) { error= -1; goto end; @@ -4376,10 +4381,10 @@ static int show_routine_grants(THD* thd, LEX_USER *lex_user, HASH *hash, ulong test_access= proc_access & ~GRANT_ACL; global.length(0); - global.append("GRANT ",6); + global.append(STRING_WITH_LEN("GRANT ")); if (!test_access) - global.append("USAGE",5); + global.append(STRING_WITH_LEN("USAGE")); else { /* Add specific procedure access */ @@ -4391,13 +4396,13 @@ static int show_routine_grants(THD* thd, LEX_USER *lex_user, HASH *hash, if (test_access & j) { if (found) - global.append(", ",2); + global.append(STRING_WITH_LEN(", ")); found= 1; global.append(command_array[counter],command_lengths[counter]); } } } - global.append(" ON ",4); + global.append(STRING_WITH_LEN(" ON ")); global.append(type,typelen); global.append(' '); append_identifier(thd, &global, grant_proc->db, @@ -4405,15 +4410,15 @@ static int show_routine_grants(THD* thd, LEX_USER *lex_user, HASH *hash, global.append('.'); append_identifier(thd, &global, grant_proc->tname, strlen(grant_proc->tname)); - global.append(" TO '",5); + global.append(STRING_WITH_LEN(" TO '")); global.append(lex_user->user.str, lex_user->user.length, system_charset_info); - global.append("'@'",3); + global.append(STRING_WITH_LEN("'@'")); global.append(lex_user->host.str,lex_user->host.length, system_charset_info); global.append('\''); if (proc_access & GRANT_ACL) - global.append(" WITH GRANT OPTION",18); + global.append(STRING_WITH_LEN(" WITH GRANT OPTION")); protocol->prepare_for_resend(); protocol->store(global.ptr(),global.length(),global.charset()); if (protocol->write()) @@ -4675,7 +4680,7 @@ static int handle_grant_table(TABLE_LIST *tables, uint table_no, bool drop, by the searched record, if it exists. */ DBUG_PRINT("info",("read table: '%s' search: '%s'@'%s'", - table->s->table_name, user_str, host_str)); + table->s->table_name.str, user_str, host_str)); host_field->store(host_str, user_from->host.length, system_charset_info); user_field->store(user_str, user_from->user.length, system_charset_info); @@ -4718,7 +4723,7 @@ static int handle_grant_table(TABLE_LIST *tables, uint table_no, bool drop, { #ifdef EXTRA_DEBUG DBUG_PRINT("info",("scan table: '%s' search: '%s'@'%s'", - table->s->table_name, user_str, host_str)); + table->s->table_name.str, user_str, host_str)); #endif while ((error= table->file->rnd_next(table->record[0])) != HA_ERR_END_OF_FILE) @@ -5068,7 +5073,7 @@ static void append_user(String *str, LEX_USER *user) str->append(','); str->append('\''); str->append(user->user.str); - str->append("'@'"); + str->append(STRING_WITH_LEN("'@'")); str->append(user->host.str); str->append('\''); } @@ -5650,7 +5655,8 @@ int fill_schema_user_privileges(THD *thd, TABLE_LIST *tables, COND *cond) strxmov(buff,"'",user,"'@'",host,"'",NullS); if (!(want_access & ~GRANT_ACL)) - update_schema_privilege(table, buff, 0, 0, 0, 0, "USAGE", 5, is_grantable); + update_schema_privilege(table, buff, 0, 0, 0, 0, + STRING_WITH_LEN("USAGE"), is_grantable); else { uint priv_id; @@ -5708,7 +5714,7 @@ int fill_schema_schema_privileges(THD *thd, TABLE_LIST *tables, COND *cond) strxmov(buff,"'",user,"'@'",host,"'",NullS); if (!(want_access & ~GRANT_ACL)) update_schema_privilege(table, buff, acl_db->db, 0, 0, - 0, "USAGE", 5, is_grantable); + 0, STRING_WITH_LEN("USAGE"), is_grantable); else { int cnt; @@ -5768,7 +5774,7 @@ int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond) strxmov(buff,"'",user,"'@'",grant_table->host.hostname,"'",NullS); if (!test_access) update_schema_privilege(table, buff, grant_table->db, grant_table->tname, - 0, 0, "USAGE", 5, is_grantable); + 0, 0, STRING_WITH_LEN("USAGE"), is_grantable); else { ulong j; diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc index e1f4b8f6076..0e4198a5114 100644 --- a/sql/sql_analyse.cc +++ b/sql/sql_analyse.cc @@ -733,13 +733,13 @@ bool analyse::end_of_records() tree_info.found = 0; tree_info.item = (*f)->item; - tmp_str.set("ENUM(", 5,&my_charset_bin); + tmp_str.set(STRING_WITH_LEN("ENUM("),&my_charset_bin); tree_walk(&(*f)->tree, (*f)->collect_enum(), (char*) &tree_info, left_root_right); tmp_str.append(')'); if (!(*f)->nulls) - tmp_str.append(" NOT NULL"); + tmp_str.append(STRING_WITH_LEN(" NOT NULL")); output_str_length = tmp_str.length(); func_items[9]->set(tmp_str.ptr(), tmp_str.length(), tmp_str.charset()); if (result->send_data(result_fields)) @@ -749,35 +749,35 @@ bool analyse::end_of_records() ans.length(0); if (!(*f)->treemem && !(*f)->tree_elements) - ans.append("CHAR(0)", 7); + ans.append(STRING_WITH_LEN("CHAR(0)")); else if ((*f)->item->type() == Item::FIELD_ITEM) { switch (((Item_field*) (*f)->item)->field->real_type()) { case FIELD_TYPE_TIMESTAMP: - ans.append("TIMESTAMP", 9); + ans.append(STRING_WITH_LEN("TIMESTAMP")); break; case FIELD_TYPE_DATETIME: - ans.append("DATETIME", 8); + ans.append(STRING_WITH_LEN("DATETIME")); break; case FIELD_TYPE_DATE: case FIELD_TYPE_NEWDATE: - ans.append("DATE", 4); + ans.append(STRING_WITH_LEN("DATE")); break; case FIELD_TYPE_SET: - ans.append("SET", 3); + ans.append(STRING_WITH_LEN("SET")); break; case FIELD_TYPE_YEAR: - ans.append("YEAR", 4); + ans.append(STRING_WITH_LEN("YEAR")); break; case FIELD_TYPE_TIME: - ans.append("TIME", 4); + ans.append(STRING_WITH_LEN("TIME")); break; case FIELD_TYPE_DECIMAL: - ans.append("DECIMAL", 7); + ans.append(STRING_WITH_LEN("DECIMAL")); // if item is FIELD_ITEM, it _must_be_ Field_num in this case if (((Field_num*) ((Item_field*) (*f)->item)->field)->zerofill) - ans.append(" ZEROFILL"); + ans.append(STRING_WITH_LEN(" ZEROFILL")); break; default: (*f)->get_opt_type(&ans, rows); @@ -785,7 +785,7 @@ bool analyse::end_of_records() } } if (!(*f)->nulls) - ans.append(" NOT NULL"); + ans.append(STRING_WITH_LEN(" NOT NULL")); func_items[9]->set(ans.ptr(), ans.length(), ans.charset()); if (result->send_data(result_fields)) return -1; @@ -829,18 +829,18 @@ void field_str::get_opt_type(String *answer, ha_rows total_rows) sprintf(buff, "BIGINT(%d)", num_info.integers); answer->append(buff, (uint) strlen(buff)); if (ev_num_info.llval >= 0 && ev_num_info.min_dval >= 0) - answer->append(" UNSIGNED"); + answer->append(STRING_WITH_LEN(" UNSIGNED")); if (num_info.zerofill) - answer->append(" ZEROFILL"); + answer->append(STRING_WITH_LEN(" ZEROFILL")); } else if (max_length < 256) { if (must_be_blob) { if (item->collation.collation == &my_charset_bin) - answer->append("TINYBLOB", 8); + answer->append(STRING_WITH_LEN("TINYBLOB")); else - answer->append("TINYTEXT", 8); + answer->append(STRING_WITH_LEN("TINYTEXT")); } else if ((max_length * (total_rows - nulls)) < (sum + total_rows)) { @@ -856,23 +856,23 @@ void field_str::get_opt_type(String *answer, ha_rows total_rows) else if (max_length < (1L << 16)) { if (item->collation.collation == &my_charset_bin) - answer->append("BLOB", 4); + answer->append(STRING_WITH_LEN("BLOB")); else - answer->append("TEXT", 4); + answer->append(STRING_WITH_LEN("TEXT")); } else if (max_length < (1L << 24)) { if (item->collation.collation == &my_charset_bin) - answer->append("MEDIUMBLOB", 10); + answer->append(STRING_WITH_LEN("MEDIUMBLOB")); else - answer->append("MEDIUMTEXT", 10); + answer->append(STRING_WITH_LEN("MEDIUMTEXT")); } else { if (item->collation.collation == &my_charset_bin) - answer->append("LONGBLOB", 8); + answer->append(STRING_WITH_LEN("LONGBLOB")); else - answer->append("LONGTEXT", 8); + answer->append(STRING_WITH_LEN("LONGTEXT")); } } // field_str::get_opt_type @@ -902,14 +902,14 @@ void field_real::get_opt_type(String *answer, sprintf(buff, "BIGINT(%d)", len); answer->append(buff, (uint) strlen(buff)); if (min_arg >= 0) - answer->append(" UNSIGNED"); + answer->append(STRING_WITH_LEN(" UNSIGNED")); } else if (item->decimals == NOT_FIXED_DEC) { if (min_arg >= -FLT_MAX && max_arg <= FLT_MAX) - answer->append("FLOAT", 5); + answer->append(STRING_WITH_LEN("FLOAT")); else - answer->append("DOUBLE", 6); + answer->append(STRING_WITH_LEN("DOUBLE")); } else { @@ -926,7 +926,7 @@ void field_real::get_opt_type(String *answer, // a single number shouldn't be zerofill (max_length - (item->decimals + 1)) != 1 && ((Field_num*) ((Item_field*) item)->field)->zerofill) - answer->append(" ZEROFILL"); + answer->append(STRING_WITH_LEN(" ZEROFILL")); } // field_real::get_opt_type @@ -950,14 +950,14 @@ void field_longlong::get_opt_type(String *answer, sprintf(buff, "BIGINT(%d)", (int) max_length); answer->append(buff, (uint) strlen(buff)); if (min_arg >= 0) - answer->append(" UNSIGNED"); + answer->append(STRING_WITH_LEN(" UNSIGNED")); // if item is FIELD_ITEM, it _must_be_ Field_num in this class if ((item->type() == Item::FIELD_ITEM) && // a single number shouldn't be zerofill max_length != 1 && ((Field_num*) ((Item_field*) item)->field)->zerofill) - answer->append(" ZEROFILL"); + answer->append(STRING_WITH_LEN(" ZEROFILL")); } // field_longlong::get_opt_type @@ -982,7 +982,7 @@ void field_ulonglong::get_opt_type(String *answer, // a single number shouldn't be zerofill max_length != 1 && ((Field_num*) ((Item_field*) item)->field)->zerofill) - answer->append(" ZEROFILL"); + answer->append(STRING_WITH_LEN(" ZEROFILL")); } //field_ulonglong::get_opt_type diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 30dec528845..4ced556fd11 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -31,26 +31,35 @@ TABLE *unused_tables; /* Used by mysql_test */ HASH open_cache; /* Used by mysql_test */ +static HASH table_def_cache; +static TABLE_SHARE *oldest_unused_share, end_of_unused_share; +static pthread_mutex_t LOCK_table_share; +static bool table_def_inited= 0; -static int open_unireg_entry(THD *thd, TABLE *entry, const char *db, - const char *name, const char *alias, - TABLE_LIST *table_list, MEM_ROOT *mem_root); +static int open_unireg_entry(THD *thd, TABLE *entry, TABLE_LIST *table_list, + const char *alias, + char *cache_key, uint cache_key_length, + MEM_ROOT *mem_root); static void free_cache_entry(TABLE *entry); static void mysql_rm_tmp_tables(void); -static bool open_new_frm(THD *thd, const char *path, const char *alias, - const char *db, const char *table_name, +static bool open_new_frm(THD *thd, TABLE_SHARE *share, const char *alias, uint db_stat, uint prgflag, uint ha_open_flags, TABLE *outparam, TABLE_LIST *table_desc, MEM_ROOT *mem_root); +static void close_old_data_files(THD *thd, TABLE *table, bool abort_locks, + bool send_refresh); +static bool reopen_table(TABLE *table); + extern "C" byte *table_cache_key(const byte *record,uint *length, my_bool not_used __attribute__((unused))) { TABLE *entry=(TABLE*) record; - *length= entry->s->key_length; - return (byte*) entry->s->table_cache_key; + *length= entry->s->table_cache_key.length; + return (byte*) entry->s->table_cache_key.str; } + bool table_cache_init(void) { mysql_rm_tmp_tables(); @@ -62,21 +71,25 @@ bool table_cache_init(void) void table_cache_free(void) { DBUG_ENTER("table_cache_free"); - close_cached_tables((THD*) 0,0,(TABLE_LIST*) 0); - if (!open_cache.records) // Safety first - hash_free(&open_cache); + if (table_def_inited) + { + close_cached_tables((THD*) 0,0,(TABLE_LIST*) 0); + if (!open_cache.records) // Safety first + hash_free(&open_cache); + } DBUG_VOID_RETURN; } -uint cached_tables(void) +uint cached_open_tables(void) { return open_cache.records; } + #ifdef EXTRA_DEBUG static void check_unused(void) { - uint count=0,idx=0; + uint count= 0, open_files= 0, idx= 0; TABLE *cur_link,*start_link; if ((start_link=cur_link=unused_tables)) @@ -100,17 +113,544 @@ static void check_unused(void) TABLE *entry=(TABLE*) hash_element(&open_cache,idx); if (!entry->in_use) count--; + if (entry->file) + open_files++; } if (count != 0) { DBUG_PRINT("error",("Unused_links doesn't match open_cache: diff: %d", /* purecov: inspected */ count)); /* purecov: inspected */ } + +#ifdef NOT_SAFE_FOR_REPAIR + /* + check that open cache and table definition cache has same number of + aktive tables + */ + count= 0; + for (idx=0 ; idx < table_def_cache.records ; idx++) + { + TABLE_SHARE *entry= (TABLE_SHARE*) hash_element(&table_def_cache,idx); + count+= entry->ref_count; + } + if (count != open_files) + { + DBUG_PRINT("error", ("table_def ref_count: %u open_cache: %u", + count, open_files)); + DBUG_ASSERT(count == open_files); + } +#endif } #else #define check_unused() #endif + +/* + Create a table cache key + + SYNOPSIS + create_table_def_key() + thd Thread handler + key Create key here (must be of size MAX_DBKEY_LENGTH) + table_list Table definition + tmp_table Set if table is a tmp table + + IMPLEMENTATION + The table cache_key is created from: + db_name + \0 + table_name + \0 + + if the table is a tmp table, we add the following to make each tmp table + unique on the slave: + + 4 bytes for master thread id + 4 bytes pseudo thread id + + RETURN + Length of key +*/ + +uint create_table_def_key(THD *thd, char *key, TABLE_LIST *table_list, + bool tmp_table) +{ + uint key_length= (uint) (strmov(strmov(key, table_list->db)+1, + table_list->table_name)-key)+1; + if (tmp_table) + { + int4store(key + key_length, thd->server_id); + int4store(key + key_length + 4, thd->variables.pseudo_thread_id); + key_length+= TMP_TABLE_KEY_EXTRA; + } + return key_length; +} + + + +/***************************************************************************** + Functions to handle table definition cach (TABLE_SHARE) +*****************************************************************************/ + +extern "C" byte *table_def_key(const byte *record, uint *length, + my_bool not_used __attribute__((unused))) +{ + TABLE_SHARE *entry=(TABLE_SHARE*) record; + *length= entry->table_cache_key.length; + return (byte*) entry->table_cache_key.str; +} + + +static void table_def_free_entry(TABLE_SHARE *share) +{ + DBUG_ENTER("table_def_free_entry"); + if (share->prev) + { + /* remove from old_unused_share list */ + pthread_mutex_lock(&LOCK_table_share); + *share->prev= share->next; + share->next->prev= share->prev; + pthread_mutex_unlock(&LOCK_table_share); + } + free_table_share(share); + DBUG_VOID_RETURN; +} + + +bool table_def_init(void) +{ + table_def_inited= 1; + pthread_mutex_init(&LOCK_table_share, MY_MUTEX_INIT_FAST); + oldest_unused_share= &end_of_unused_share; + end_of_unused_share.prev= &oldest_unused_share; + + return hash_init(&table_def_cache, &my_charset_bin, table_def_size, + 0, 0, table_def_key, + (hash_free_key) table_def_free_entry, 0) != 0; +} + + +void table_def_free(void) +{ + DBUG_ENTER("table_def_free"); + if (table_def_inited) + { + table_def_inited= 0; + pthread_mutex_destroy(&LOCK_table_share); + hash_free(&table_def_cache); + } + DBUG_VOID_RETURN; +} + + +uint cached_table_definitions(void) +{ + return table_def_cache.records; +} + + +/* + Get TABLE_SHARE for a table. + + get_table_share() + thd Table share + table_list Table that should be opened + key Table cache key + key_length Length of key + db_flags Flags to open_table_def(): + OPEN_VIEW + error out: Error code from open_table_def() + + IMPLEMENTATION + Get a table definition from the table definition cache. + If it doesn't exist, create a new from the table definition file. + + NOTES + We must have wrlock on LOCK_open when we come here + (To be changed later) + + RETURN + 0 Error + # Share for table +*/ + +TABLE_SHARE *get_table_share(THD *thd, TABLE_LIST *table_list, char *key, + uint key_length, uint db_flags, int *error) +{ + TABLE_SHARE *share; + DBUG_ENTER("get_table_share"); + + *error= 0; + + /* Read table definition from cache */ + if ((share= (TABLE_SHARE*) hash_search(&table_def_cache,(byte*) key, + key_length))) + goto found; + + if (!(share= alloc_table_share(table_list, key, key_length))) + { +#ifdef NOT_YET + pthread_mutex_unlock(&LOCK_open); +#endif + DBUG_RETURN(0); + } + +#ifdef NOT_YET + // We need a write lock to be able to add a new entry + pthread_mutex_unlock(&LOCK_open); + pthread_mutex_lock(&LOCK_open); + /* Check that another thread didn't insert the same table in between */ + if ((old_share= hash_search(&table_def_cache, (byte*) key, key_length))) + { + (void) pthread_mutex_lock(&share->mutex); + free_table_share(share); + share= old_share; + goto found; + } +#endif + + /* + Lock mutex to be able to read table definition from file without + conflicts + */ + (void) pthread_mutex_lock(&share->mutex); + if (my_hash_insert(&table_def_cache, (byte*) share)) + { +#ifdef NOT_YET + pthread_mutex_unlock(&LOCK_open); + (void) pthread_mutex_unlock(&share->mutex); +#endif + free_table_share(share); + DBUG_RETURN(0); // return error + } +#ifdef NOT_YET + pthread_mutex_unlock(&LOCK_open); +#endif + if (open_table_def(thd, share, db_flags)) + { +#ifdef NOT_YET + /* + No such table or wrong table definition file + Lock first the table cache and then the mutex. + This will ensure that no other thread is using the share + structure. + */ + (void) pthread_mutex_unlock(&share->mutex); + (void) pthread_mutex_lock(&LOCK_open); + (void) pthread_mutex_lock(&share->mutex); +#endif + *error= share->error; + (void) hash_delete(&table_def_cache, (byte*) share); + DBUG_RETURN(0); + } + share->ref_count++; // Mark in use + DBUG_PRINT("exit", ("share: 0x%lx ref_count: %u", + (ulong) share, share->ref_count)); + (void) pthread_mutex_unlock(&share->mutex); + DBUG_RETURN(share); + +found: + /* + We found an existing table definition. Return it if we didn't get + an error when reading the table definition from file. + */ + + /* We must do a lock to ensure that the structure is initialized */ + (void) pthread_mutex_lock(&share->mutex); +#ifdef NOT_YET + pthread_mutex_unlock(&LOCK_open); +#endif + if (share->error) + { + /* Table definition contained an error */ + open_table_error(share, share->error, share->open_errno, share->errarg); + (void) pthread_mutex_unlock(&share->mutex); + DBUG_RETURN(0); + } + if (share->is_view && !(db_flags & OPEN_VIEW)) + { + open_table_error(share, 1, ENOENT, 0); + (void) pthread_mutex_unlock(&share->mutex); + DBUG_RETURN(0); + } + + if (!share->ref_count++ && share->prev) + { + /* + Share was not used before and it was in the old_unused_share list + Unlink share from this list + */ + DBUG_PRINT("info", ("Unlinking from not used list")); + pthread_mutex_lock(&LOCK_table_share); + *share->prev= share->next; + share->next->prev= share->prev; + share->next= 0; + share->prev= 0; + pthread_mutex_unlock(&LOCK_table_share); + } + (void) pthread_mutex_unlock(&share->mutex); + + /* Free cache if too big */ + while (table_def_cache.records > table_def_size && + oldest_unused_share->next) + { + pthread_mutex_lock(&oldest_unused_share->mutex); + VOID(hash_delete(&table_def_cache, (byte*) oldest_unused_share)); + } + + DBUG_PRINT("exit", ("share: 0x%lx ref_count: %u", + (ulong) share, share->ref_count)); + DBUG_RETURN(share); +} + + +/* + Get a table share. If it didn't exist, try creating it from engine + + For arguments and return values, see get_table_from_share() +*/ + +static TABLE_SHARE +*get_table_share_with_create(THD *thd, TABLE_LIST *table_list, + char *key, uint key_length, + uint db_flags, int *error) +{ + TABLE_SHARE *share; + int tmp; + DBUG_ENTER("get_table_share_with_create"); + + if ((share= get_table_share(thd, table_list, key, key_length, + db_flags, error)) || + thd->net.last_errno != ER_NO_SUCH_TABLE) + DBUG_RETURN(share); + + /* Table didn't exist. Check if some engine can provide it */ + if ((tmp= ha_create_table_from_engine(thd, table_list->db, + table_list->table_name)) < 0) + { + /* + No such table in any engine. + Hide "Table doesn't exist" errors if table belong to view + */ + if (table_list->belong_to_view) + { + TABLE_LIST *view= table_list->belong_to_view; + thd->clear_error(); + my_error(ER_VIEW_INVALID, MYF(0), + view->view_db.str, view->view_name.str); + } + DBUG_RETURN(0); + } + if (tmp) + { + /* Give right error message */ + thd->clear_error(); + DBUG_PRINT("error", ("Discovery of %s/%s failed", table_list->db, + table_list->table_name)); + my_printf_error(ER_UNKNOWN_ERROR, + "Failed to open '%-.64s', error while " + "unpacking from engine", + MYF(0), table_list->table_name); + DBUG_RETURN(0); + } + /* Table existed in engine. Let's open it */ + mysql_reset_errors(thd, 1); // Clear warnings + thd->clear_error(); // Clear error message + DBUG_RETURN(get_table_share(thd, table_list, key, key_length, + db_flags, error)); +} + + +/* + Mark that we are not using table share anymore. + + SYNOPSIS + release_table_share() + share Table share + release_type How the release should be done: + RELEASE_NORMAL + - Release without checking + RELEASE_WAIT_FOR_DROP + - Don't return until we get a signal that the + table is deleted or the thread is killed. + + IMPLEMENTATION + If ref_count goes to zero and (we have done a refresh or if we have + already too many open table shares) then delete the definition. + + If type == RELEASE_WAIT_FOR_DROP then don't return until we get a signal + that the table is deleted or the thread is killed. +*/ + +void release_table_share(TABLE_SHARE *share, enum release_type type) +{ + bool to_be_deleted= 0; + DBUG_ENTER("release_table_share"); + DBUG_PRINT("enter", + ("share: 0x%lx table: %s.%s ref_count: %u version: %lu", + (ulong) share, share->db.str, share->table_name.str, + share->ref_count, share->version)); + + safe_mutex_assert_owner(&LOCK_open); + + pthread_mutex_lock(&share->mutex); + if (!--share->ref_count) + { + if (share->version != refresh_version) + to_be_deleted=1; + else + { + /* Link share last in used_table_share list */ + DBUG_PRINT("info",("moving share to unused list")); + + DBUG_ASSERT(share->next == 0); + pthread_mutex_lock(&LOCK_table_share); + share->prev= end_of_unused_share.prev; + *end_of_unused_share.prev= share; + end_of_unused_share.prev= &share->next; + share->next= &end_of_unused_share; + pthread_mutex_unlock(&LOCK_table_share); + + to_be_deleted= (table_def_cache.records > table_def_size); + } + } + + if (to_be_deleted) + { + DBUG_PRINT("info", ("Deleting share")); + hash_delete(&table_def_cache, (byte*) share); + DBUG_VOID_RETURN; + } + pthread_mutex_unlock(&share->mutex); + DBUG_VOID_RETURN; + + +#ifdef NOT_YET + if (to_be_deleted) + { + /* + We must try again with new locks as we must get LOCK_open + before share->mutex + */ + pthread_mutex_unlock(&share->mutex); + pthread_mutex_lock(&LOCK_open); + pthread_mutex_lock(&share->mutex); + if (!share->ref_count) + { // No one is using this now + TABLE_SHARE *name_lock; + if (share->replace_with_name_lock && (name_lock=get_name_lock(share))) + { + /* + This code is execured when someone does FLUSH TABLES while on has + locked tables. + */ + (void) hash_search(&def_cache,(byte*) key,key_length); + hash_replace(&def_cache, def_cache.current_record,(byte*) name_lock); + } + else + { + /* Remove table definition */ + hash_delete(&def_cache,(byte*) share); + } + pthread_mutex_unlock(&LOCK_open); + free_table_share(share); + } + else + { + pthread_mutex_unlock(&LOCK_open); + if (type == RELEASE_WAIT_FOR_DROP) + wait_for_table(share, "Waiting for close"); + else + pthread_mutex_unlock(&share->mutex); + } + } + else if (type == RELEASE_WAIT_FOR_DROP) + wait_for_table(share, "Waiting for close"); + else + pthread_mutex_unlock(&share->mutex); +#endif +} + + +/* + Check if table definition exits in cache + + SYNOPSIS + get_cached_table_share() + db Database name + table_name Table name + + RETURN + 0 Not cached + # TABLE_SHARE for table +*/ + +TABLE_SHARE *get_cached_table_share(const char *db, const char *table_name) +{ + char key[NAME_LEN*2+2]; + TABLE_LIST table_list; + uint key_length; + safe_mutex_assert_owner(&LOCK_open); + + table_list.db= (char*) db; + table_list.table_name= (char*) table_name; + key_length= create_table_def_key((THD*) 0, key, &table_list, 0); + return (TABLE_SHARE*) hash_search(&table_def_cache,(byte*) key, key_length); +} + + +/* + Close file handle, but leave the table in the table cache + + SYNOPSIS + close_handle_and_leave_table_as_lock() + table Table handler + + NOTES + By leaving the table in the table cache, it disallows any other thread + to open the table + + thd->killed will be set if we run out of memory +*/ + + +static void close_handle_and_leave_table_as_lock(TABLE *table) +{ + TABLE_SHARE *share, *old_share= table->s; + MEM_ROOT *mem_root= &table->mem_root; + DBUG_ENTER("close_handle_and_leave_table_as_lock"); + + /* + Make a local copy of the table share and free the current one. + This has to be done to ensure that the table share is removed from + the table defintion cache as soon as the last instance is removed + */ + if ((share= (TABLE_SHARE*) alloc_root(mem_root, sizeof(*share)))) + { + bzero((char*) share, sizeof(*share)); + share->db.str= memdup_root(mem_root, old_share->db.str, + old_share->db.length+1); + share->db.length= old_share->db.length; + share->table_name.str= memdup_root(mem_root, + old_share->table_name.str, + old_share->table_name.length+1); + share->table_name.length= old_share->table_name.length; + share->table_cache_key.str= memdup_root(mem_root, + old_share->table_cache_key.str, + old_share->table_cache_key.length); + share->table_cache_key.length= old_share->table_cache_key.length; + share->tmp_table= INTERNAL_TMP_TABLE; // for intern_close_table() + } + + table->file->close(); + table->db_stat= 0; // Mark file closed + release_table_share(table->s, RELEASE_NORMAL); + table->s= share; + + DBUG_VOID_RETURN; +} + + + /* Create a list for all open tables matching SQL expression @@ -147,17 +687,14 @@ OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *db, const char *wild) TABLE *entry=(TABLE*) hash_element(&open_cache,idx); TABLE_SHARE *share= entry->s; - DBUG_ASSERT(share->table_name != 0); - if ((!share->table_name)) // To be removed - continue; // Shouldn't happen - if (db && my_strcasecmp(system_charset_info, db, share->db)) + if (db && my_strcasecmp(system_charset_info, db, share->db.str)) continue; - if (wild && wild_compare(share->table_name,wild,0)) + if (wild && wild_compare(share->table_name.str, wild, 0)) continue; /* Check if user has SELECT privilege for any column in the table */ - table_list.db= (char*) share->db; - table_list.table_name= (char*) share->table_name; + table_list.db= share->db.str; + table_list.table_name= share->table_name.str; table_list.grant.privilege=0; if (check_table_access(thd,SELECT_ACL | EXTRA_ACL,&table_list,1)) @@ -165,8 +702,8 @@ OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *db, const char *wild) /* need to check if we haven't already listed it */ for (table= open_list ; table ; table=table->next) { - if (!strcmp(table->table,share->table_name) && - !strcmp(table->db,entry->s->db)) + if (!strcmp(table->table, share->table_name.str) && + !strcmp(table->db, share->db.str)) { if (entry->in_use) table->in_use++; @@ -178,15 +715,15 @@ OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *db, const char *wild) if (table) continue; if (!(*start_list = (OPEN_TABLE_LIST *) - sql_alloc(sizeof(**start_list)+share->key_length))) + sql_alloc(sizeof(**start_list)+share->table_cache_key.length))) { open_list=0; // Out of memory break; } strmov((*start_list)->table= strmov(((*start_list)->db= (char*) ((*start_list)+1)), - entry->s->db)+1, - entry->s->table_name); + share->db.str)+1, + share->table_name.str); (*start_list)->in_use= entry->in_use ? 1 : 0; (*start_list)->locked= entry->locked_by_name ? 1 : 0; start_list= &(*start_list)->next; @@ -203,10 +740,13 @@ OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *db, const char *wild) void intern_close_table(TABLE *table) { // Free all structures + DBUG_ENTER("intern_close_table"); + free_io_cache(table); delete table->triggers; - if (table->file) - VOID(closefrm(table)); // close file + if (table->file) // Not true if name lock + VOID(closefrm(table, 1)); // close file + DBUG_VOID_RETURN; } /* @@ -223,7 +763,6 @@ void intern_close_table(TABLE *table) static void free_cache_entry(TABLE *table) { DBUG_ENTER("free_cache_entry"); - safe_mutex_assert_owner(&LOCK_open); intern_close_table(table); if (!table->in_use) @@ -273,6 +812,7 @@ bool close_cached_tables(THD *thd, bool if_wait_for_refresh, VOID(pthread_mutex_lock(&LOCK_open)); if (!tables) { + refresh_version++; // Force close of open tables while (unused_tables) { #ifdef EXTRA_DEBUG @@ -282,7 +822,12 @@ bool close_cached_tables(THD *thd, bool if_wait_for_refresh, VOID(hash_delete(&open_cache,(byte*) unused_tables)); #endif } - refresh_version++; // Force close of open tables + /* Free table shares */ + while (oldest_unused_share->next) + { + pthread_mutex_lock(&oldest_unused_share->mutex); + VOID(hash_delete(&table_def_cache, (byte*) oldest_unused_share)); + } } else { @@ -311,7 +856,8 @@ bool close_cached_tables(THD *thd, bool if_wait_for_refresh, thd->proc_info="Flushing tables"; close_old_data_files(thd,thd->open_tables,1,1); - mysql_ha_flush(thd, tables, MYSQL_HA_REOPEN_ON_USAGE | MYSQL_HA_FLUSH_ALL); + mysql_ha_flush(thd, tables, MYSQL_HA_REOPEN_ON_USAGE | MYSQL_HA_FLUSH_ALL, + TRUE); bool found=1; /* Wait until all threads has closed all the tables we had locked */ DBUG_PRINT("info", @@ -503,11 +1049,10 @@ void close_thread_tables(THD *thd, bool lock_in_use, bool skip_derived) /* VOID(pthread_sigmask(SIG_SETMASK,&thd->block_signals,NULL)); */ if (!lock_in_use) VOID(pthread_mutex_lock(&LOCK_open)); - safe_mutex_assert_owner(&LOCK_open); DBUG_PRINT("info", ("thd->open_tables: %p", thd->open_tables)); - found_old_table= 0; + found_old_table= 0; while (thd->open_tables) found_old_table|=close_thread_table(thd, &thd->open_tables); thd->some_tables_deleted=0; @@ -581,22 +1126,10 @@ bool close_thread_table(THD *thd, TABLE **table_ptr) DBUG_RETURN(found_old_table); } - /* Close and delete temporary tables */ - -void close_temporary(TABLE *table,bool delete_table) -{ - DBUG_ENTER("close_temporary"); - char path[FN_REFLEN]; - db_type table_type=table->s->db_type; - strmov(path,table->s->path); - free_io_cache(table); - closefrm(table); - my_free((char*) table,MYF(0)); - if (delete_table) - rm_temporary_table(table_type, path); - DBUG_VOID_RETURN; -} +/* + Close all temporary tables created by 'CREATE TEMPORARY TABLE' for thread +*/ void close_temporary_tables(THD *thd) { @@ -612,12 +1145,14 @@ void close_temporary_tables(THD *thd) query_buf_size= 50; // Enough for DROP ... TABLE IF EXISTS for (table=thd->temporary_tables ; table ; table=table->next) + { /* We are going to add 4 ` around the db/table names, so 1 does not look - enough; indeed it is enough, because table->key_length is greater (by 8, - because of server_id and thread_id) than db||table. + enough; indeed it is enough, because table->table_cache_key.length is + greater (by 8, because of server_id and thread_id) than db||table. */ - query_buf_size+= table->s->key_length+1; + query_buf_size+= table->s->table_cache_key.length+1; + } if ((query = alloc_root(thd->mem_root, query_buf_size))) // Better add "if exists", in case a RESET MASTER has been done @@ -628,13 +1163,13 @@ void close_temporary_tables(THD *thd) if (query) // we might be out of memory, but this is not fatal { // skip temporary tables not created directly by the user - if (table->s->table_name[0] != '#') + if (table->s->table_name.str[0] != '#') found_user_tables = 1; - end = strxmov(end,"`",table->s->db,"`.`", - table->s->table_name,"`,", NullS); + end= strxmov(end, "`",table->s->db.str, "`.`", + table->s->table_name.str, "`,", NullS); } next=table->next; - close_temporary(table, 1); + close_temporary(table, 1, 1); } if (query && found_user_tables && mysql_bin_log.is_open()) { @@ -643,8 +1178,8 @@ void close_temporary_tables(THD *thd) Query_log_event qinfo(thd, query, (ulong)(end-query)-1, 0, FALSE); /* Imagine the thread had created a temp table, then was doing a SELECT, and - the SELECT was killed. Then it's not clever to mark the statement above as - "killed", because it's not really a statement updating data, and there + the SELECT was killed. Then it's not clever to mark the statement above + as "killed", because it's not really a statement updating data, and there are 99.99% chances it will succeed on slave. If a real update (one updating a persistent table) was killed on the master, then this real update will be logged with error_code=killed, @@ -828,42 +1363,92 @@ void update_non_unique_table_error(TABLE_LIST *update, } -TABLE **find_temporary_table(THD *thd, const char *db, const char *table_name) +TABLE *find_temporary_table(THD *thd, const char *db, const char *table_name) { char key[MAX_DBKEY_LENGTH]; - uint key_length= (uint) (strmov(strmov(key,db)+1,table_name)-key)+1; - TABLE *table,**prev; + uint key_length; + TABLE_LIST table_list; + TABLE *table; - int4store(key+key_length,thd->server_id); - key_length += 4; - int4store(key+key_length,thd->variables.pseudo_thread_id); - key_length += 4; + table_list.db= (char*) db; + table_list.table_name= (char*) table_name; + return find_temporary_table(thd, &table_list); +} - prev= &thd->temporary_tables; - for (table=thd->temporary_tables ; table ; table=table->next) + +TABLE *find_temporary_table(THD *thd, TABLE_LIST *table_list) +{ + char key[MAX_DBKEY_LENGTH]; + uint key_length; + TABLE *table; + + key_length= create_table_def_key(thd, key, table_list, 1); + for (table=thd->temporary_tables ; table ; table= table->next) { - if (table->s->key_length == key_length && - !memcmp(table->s->table_cache_key,key,key_length)) - return prev; - prev= &table->next; + if (table->s->table_cache_key.length == key_length && + !memcmp(table->s->table_cache_key.str, key, key_length)) + return table; } return 0; // Not a temporary table } -bool close_temporary_table(THD *thd, const char *db, const char *table_name) -{ - TABLE *table,**prev; - if (!(prev=find_temporary_table(thd,db,table_name))) +/* + Close temporary table and unlink from thd->temporary tables +*/ + +bool close_temporary_table(THD *thd, TABLE_LIST *table_list) +{ + TABLE *table; + + if (!(table= find_temporary_table(thd, table_list))) return 1; - table= *prev; - *prev= table->next; - close_temporary(table, 1); - if (thd->slave_thread) - --slave_open_temp_tables; + close_temporary_table(thd, table, 1, 1); return 0; } +/* + Close temporary table and unlink from thd->temporary tables +*/ + +void close_temporary_table(THD *thd, TABLE *table, + bool free_share, bool delete_table) +{ + TABLE **prev= table->open_prev; + if ((*table->open_prev= table->next)) + table->next->open_prev= prev; + if (thd->slave_thread) + slave_open_temp_tables--; + close_temporary(table, free_share, delete_table); +} + + +/* + Close and delete a temporary table + + NOTE + This dosn't unlink table from thd->temporary + If this is needed, use close_temporary_table() +*/ + +void close_temporary(TABLE *table, bool free_share, bool delete_table) +{ + db_type table_type= table->s->db_type; + DBUG_ENTER("close_temporary"); + + free_io_cache(table); + closefrm(table, 0); + if (delete_table) + rm_temporary_table(table_type, table->s->path.str); + if (free_share) + { + free_table_share(table->s); + my_free((char*) table,MYF(0)); + } + DBUG_VOID_RETURN; +} + + /* Used by ALTER TABLE when the table is a temporary one. It changes something only if the ALTER contained a RENAME clause (otherwise, table_name is the old @@ -877,21 +1462,28 @@ bool rename_temporary_table(THD* thd, TABLE *table, const char *db, { char *key; TABLE_SHARE *share= table->s; + TABLE_LIST table_list; + uint db_length, table_length; + DBUG_ENTER("rename_temporary_table"); - if (!(key=(char*) alloc_root(&table->mem_root, - (uint) strlen(db)+ - (uint) strlen(table_name)+6+4))) - return 1; /* purecov: inspected */ - share->key_length= (uint) - (strmov((char*) (share->table_name= strmov(share->table_cache_key= key, - db)+1), - table_name) - share->table_cache_key)+1; - share->db= share->table_cache_key; - int4store(key+share->key_length, thd->server_id); - share->key_length+= 4; - int4store(key+share->key_length, thd->variables.pseudo_thread_id); - share->key_length+= 4; - return 0; + if (!(key=(char*) alloc_root(&share->mem_root, + (uint) (db_length= strlen(db))+ + (uint) (table_length= strlen(table_name))+6+4))) + DBUG_RETURN(1); /* purecov: inspected */ + + table_list.db= (char*) db; + table_list.table_name= (char*) table_name; + share->db.str= share->table_cache_key.str= key; + share->db.length= db_length; + share->table_cache_key.length= create_table_def_key(thd, key, + &table_list, 1); + /* + Here we use the fact that table_name is stored as the second component + in the 'key' (after db_name), where components are separated with \0 + */ + share->table_name.str= key+db_length+1; + share->table_name.length= table_length; + DBUG_RETURN(0); } @@ -921,16 +1513,16 @@ static void relink_unused(TABLE *table) TABLE *unlink_open_table(THD *thd, TABLE *list, TABLE *find) { char key[MAX_DBKEY_LENGTH]; - uint key_length= find->s->key_length; + uint key_length= find->s->table_cache_key.length; TABLE *start=list,**prev,*next; prev= &start; - memcpy(key, find->s->table_cache_key, key_length); + memcpy(key, find->s->table_cache_key.str, key_length); for (; list ; list=next) { next=list->next; - if (list->s->key_length == key_length && - !memcmp(list->s->table_cache_key, key, key_length)) + if (list->s->table_cache_key.length == key_length && + !memcmp(list->s->table_cache_key.str, key, key_length)) { if (thd->locked_tables) mysql_lock_remove(thd, thd->locked_tables,list); @@ -950,24 +1542,39 @@ TABLE *unlink_open_table(THD *thd, TABLE *list, TABLE *find) /* - When we call the following function we must have a lock on - LOCK_open ; This lock will be unlocked on return. + Wait for condition but allow the user to send a kill to mysqld + + SYNOPSIS + wait_for_condition() + thd Thread handler + mutex mutex that is currently hold that is associated with condition + Will be unlocked on return + cond Condition to wait for */ -void wait_for_refresh(THD *thd) +void wait_for_condition(THD *thd, pthread_mutex_t *mutex, pthread_cond_t *cond) { - safe_mutex_assert_owner(&LOCK_open); - /* Wait until the current table is up to date */ const char *proc_info; - thd->mysys_var->current_mutex= &LOCK_open; - thd->mysys_var->current_cond= &COND_refresh; + thd->mysys_var->current_mutex= mutex; + thd->mysys_var->current_cond= cond; proc_info=thd->proc_info; thd->proc_info="Waiting for table"; if (!thd->killed) - (void) pthread_cond_wait(&COND_refresh,&LOCK_open); + (void) pthread_cond_wait(cond, mutex); - pthread_mutex_unlock(&LOCK_open); // Must be unlocked first + /* + We must unlock mutex first to avoid deadlock becasue conditions are + sent to this thread by doing locks in the following order: + lock(mysys_var->mutex) + lock(mysys_var->current_mutex) + + One by effect of this that one can only use wait_for_condition with + condition variables that are guranteed to not disapper (freed) even if this + mutex is unlocked + */ + + pthread_mutex_unlock(mutex); pthread_mutex_lock(&thd->mysys_var->mutex); thd->mysys_var->current_mutex= 0; thd->mysys_var->current_cond= 0; @@ -1013,10 +1620,9 @@ bool reopen_name_locked_table(THD* thd, TABLE_LIST* table_list) orig_table= *table; key_length=(uint) (strmov(strmov(key,db)+1,table_name)-key)+1; - if (open_unireg_entry(thd, table, db, table_name, table_name, 0, - thd->mem_root) || - !(table->s->table_cache_key= memdup_root(&table->mem_root, (char*) key, - key_length))) + if (open_unireg_entry(thd, table, table_list, table_name, + table->s->table_cache_key.str, + table->s->table_cache_key.length, thd->mem_root)) { intern_close_table(table); /* @@ -1030,8 +1636,6 @@ bool reopen_name_locked_table(THD* thd, TABLE_LIST* table_list) } share= table->s; - share->db= share->table_cache_key; - share->key_length=key_length; share->version=0; share->flush_version=0; table->in_use = thd; @@ -1087,19 +1691,24 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, /* find a unused table in the open table cache */ if (refresh) *refresh=0; + + /* an open table operation needs a lot of the stack space */ + if (check_stack_overrun(thd, STACK_MIN_SIZE_FOR_OPEN, (char *)&alias)) + return 0; + if (thd->killed) DBUG_RETURN(0); - key_length= (uint) (strmov(strmov(key, table_list->db)+1, - table_list->table_name)-key)+1; - int4store(key + key_length, thd->server_id); - int4store(key + key_length + 4, thd->variables.pseudo_thread_id); + + key_length= (create_table_def_key(thd, key, table_list, 1) - + TMP_TABLE_KEY_EXTRA); if (!table_list->skip_temporary) { for (table= thd->temporary_tables; table ; table=table->next) { - if (table->s->key_length == key_length + TMP_TABLE_KEY_EXTRA && - !memcmp(table->s->table_cache_key, key, + if (table->s->table_cache_key.length == key_length + + TMP_TABLE_KEY_EXTRA && + !memcmp(table->s->table_cache_key.str, key, key_length + TMP_TABLE_KEY_EXTRA)) { if (table->query_id == thd->query_id || @@ -1126,8 +1735,8 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, (int) TL_WRITE_ALLOW_WRITE); for (table=thd->open_tables; table ; table=table->next) { - if (table->s->key_length == key_length && - !memcmp(table->s->table_cache_key, key, key_length)) + if (table->s->table_cache_key.length == key_length && + !memcmp(table->s->table_cache_key.str, key, key_length)) { if (check_if_used && table->query_id && table->query_id != thd->query_id) @@ -1139,7 +1748,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, is not already open by some calling stamement. */ my_error(ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG, MYF(0), - table->s->table_name); + table->s->table_name.str); DBUG_RETURN(0); } if (!my_strcasecmp(system_charset_info, table->alias, alias) && @@ -1194,22 +1803,20 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, { char path[FN_REFLEN]; db_type not_used; - strxnmov(path, FN_REFLEN, mysql_data_home, "/", table_list->db, "/", + strxnmov(path, FN_REFLEN-1, mysql_data_home, "/", table_list->db, "/", table_list->table_name, reg_ext, NullS); (void) unpack_filename(path, path); if (mysql_frm_type(thd, path, ¬_used) == FRMTYPE_VIEW) { - TABLE tab;// will not be used (because it's VIEW) but have to be passed + /* + Will not be used (because it's VIEW) but has to be passed. + Also we will not free it (because it is a stack variable). + */ + TABLE tab; table= &tab; VOID(pthread_mutex_lock(&LOCK_open)); - if (open_unireg_entry(thd, table, table_list->db, - table_list->table_name, - alias, table_list, mem_root)) - { - table->next=table->prev=table; - free_cache_entry(table); - } - else + if (!open_unireg_entry(thd, table, table_list, alias, + key, key_length, mem_root)) { DBUG_ASSERT(table_list->view != 0); VOID(pthread_mutex_unlock(&LOCK_open)); @@ -1238,7 +1845,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, /* close handler tables which are marked for flush */ if (thd->handler_tables) - mysql_ha_flush(thd, (TABLE_LIST*) NULL, MYSQL_HA_REOPEN_ON_USAGE); + mysql_ha_flush(thd, (TABLE_LIST*) NULL, MYSQL_HA_REOPEN_ON_USAGE, TRUE); for (table=(TABLE*) hash_search(&open_cache,(byte*) key,key_length) ; table && table->in_use ; @@ -1259,7 +1866,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, */ close_old_data_files(thd,thd->open_tables,0,0); if (table->in_use != thd) - wait_for_refresh(thd); + wait_for_condition(thd, &LOCK_open, &COND_refresh); else { VOID(pthread_mutex_unlock(&LOCK_open)); @@ -1294,15 +1901,11 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, VOID(pthread_mutex_unlock(&LOCK_open)); DBUG_RETURN(NULL); } - if (open_unireg_entry(thd, table, table_list->db, table_list->table_name, - alias, table_list, mem_root) || - (!table_list->view && - !(table->s->table_cache_key= memdup_root(&table->mem_root, - (char*) key, - key_length)))) + + if (open_unireg_entry(thd, table, table_list, alias, key, key_length, + mem_root)) { - table->next=table->prev=table; - free_cache_entry(table); + my_free((gptr)table, MYF(0)); VOID(pthread_mutex_unlock(&LOCK_open)); DBUG_RETURN(NULL); } @@ -1312,11 +1915,6 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, VOID(pthread_mutex_unlock(&LOCK_open)); DBUG_RETURN(0); // VIEW } - share= table->s; - share->db= share->table_cache_key; - share->key_length= key_length; - share->version= refresh_version; - share->flush_version= flush_version; DBUG_PRINT("info", ("inserting table %p into the cache", table)); VOID(my_hash_insert(&open_cache,(byte*) table)); } @@ -1332,9 +1930,11 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, table->reginfo.lock_type=TL_READ; /* Assume read */ reset: + DBUG_ASSERT(table->s->ref_count > 0 || table->s->tmp_table != NO_TMP_TABLE); + if (thd->lex->need_correct_ident()) table->alias_name_used= my_strcasecmp(table_alias_charset, - table->s->table_name, alias); + table->s->table_name.str, alias); /* Fix alias if table name changes */ if (strcmp(table->alias, alias)) { @@ -1369,53 +1969,64 @@ TABLE *find_locked_table(THD *thd, const char *db,const char *table_name) for (TABLE *table=thd->open_tables; table ; table=table->next) { - if (table->s->key_length == key_length && - !memcmp(table->s->table_cache_key,key,key_length)) + if (table->s->table_cache_key.length == key_length && + !memcmp(table->s->table_cache_key.str, key, key_length)) return table; } return(0); } -/**************************************************************************** -** Reopen an table because the definition has changed. The date file for the -** table is already closed. -** Returns 0 if ok. -** If table can't be reopened, the entry is unchanged. -****************************************************************************/ +/* + Reopen an table because the definition has changed. -bool reopen_table(TABLE *table,bool locked) + SYNOPSIS + reopen_table() + table Table object + + NOTES + The data file for the table is already closed and the share is released + The table has a 'dummy' share that mainly contains database and table name. + + RETURN + 0 ok + 1 error. The old table object is not changed. +*/ + +static bool reopen_table(TABLE *table) { TABLE tmp; - char *db= table->s->table_cache_key; - const char *table_name= table->s->table_name; bool error= 1; Field **field; uint key,part; + TABLE_LIST table_list; + THD *thd= table->in_use; DBUG_ENTER("reopen_table"); + DBUG_ASSERT(table->s->ref_count == 0); + DBUG_ASSERT(!table->sort.io_cache); + #ifdef EXTRA_DEBUG if (table->db_stat) sql_print_error("Table %s had a open data handler in reopen_table", table->alias); #endif - if (!locked) - VOID(pthread_mutex_lock(&LOCK_open)); - safe_mutex_assert_owner(&LOCK_open); - if (open_unireg_entry(table->in_use, &tmp, db, table_name, - table->alias, 0, table->in_use->mem_root)) - goto end; - free_io_cache(table); + table_list.db= table->s->db.str; + table_list.table_name= table->s->table_name.str; + table_list.table= table; + table_list.belong_to_view= 0; + table_list.next_local= 0; - if (!(tmp.s->table_cache_key= memdup_root(&tmp.mem_root,db, - table->s->key_length))) - { - delete tmp.triggers; - closefrm(&tmp); // End of memory + if (wait_for_locked_table_names(thd, &table_list)) + DBUG_RETURN(1); // Thread was killed + + if (open_unireg_entry(thd, &tmp, &table_list, + table->alias, + table->s->table_cache_key.str, + table->s->table_cache_key.length, + thd->mem_root)) goto end; - } - tmp.s->db= tmp.s->table_cache_key; /* This list copies variables set by open_table */ tmp.tablenr= table->tablenr; @@ -1428,11 +2039,8 @@ bool reopen_table(TABLE *table,bool locked) tmp.used_keys= tmp.s->keys_for_keyread; /* Get state */ - tmp.s->key_length= table->s->key_length; - tmp.in_use= table->in_use; + tmp.in_use= thd; tmp.reginfo.lock_type=table->reginfo.lock_type; - tmp.s->version= refresh_version; - tmp.s->tmp_table= table->s->tmp_table; tmp.grant= table->grant; /* Replace table in open list */ @@ -1441,11 +2049,10 @@ bool reopen_table(TABLE *table,bool locked) delete table->triggers; if (table->file) - VOID(closefrm(table)); // close file, free everything + VOID(closefrm(table, 1)); // close file, free everything *table= tmp; - table->s= &table->share_not_to_be_used; - table->file->change_table_ptr(table); + table->file->change_table_ptr(table, table->s); DBUG_ASSERT(table->alias != 0); for (field=table->field ; *field ; field++) @@ -1463,8 +2070,6 @@ bool reopen_table(TABLE *table,bool locked) error=0; end: - if (!locked) - VOID(pthread_mutex_unlock(&LOCK_open)); DBUG_RETURN(error); } @@ -1473,22 +2078,23 @@ bool reopen_table(TABLE *table,bool locked) Used with ALTER TABLE: Close all instanses of table when LOCK TABLES is in used; Close first all instances of table and then reopen them - */ +*/ bool close_data_tables(THD *thd,const char *db, const char *table_name) { TABLE *table; + DBUG_ENTER("close_data_tables"); + for (table=thd->open_tables; table ; table=table->next) { - if (!strcmp(table->s->table_name, table_name) && - !strcmp(table->s->db, db)) + if (!strcmp(table->s->table_name.str, table_name) && + !strcmp(table->s->db.str, db)) { mysql_lock_remove(thd, thd->locked_tables,table); - table->file->close(); - table->db_stat=0; + close_handle_and_leave_table_as_lock(table); } } - return 0; // For the future + DBUG_RETURN(0); // For the future } @@ -1499,20 +2105,21 @@ bool close_data_tables(THD *thd,const char *db, const char *table_name) bool reopen_tables(THD *thd,bool get_locks,bool in_refresh) { + TABLE *table,*next,**prev; + TABLE **tables,**tables_ptr; // For locks + bool error=0, not_used; DBUG_ENTER("reopen_tables"); - safe_mutex_assert_owner(&LOCK_open); if (!thd->open_tables) DBUG_RETURN(0); - TABLE *table,*next,**prev; - TABLE **tables,**tables_ptr; // For locks - bool error=0, not_used; + safe_mutex_assert_owner(&LOCK_open); if (get_locks) { /* The ptr is checked later */ uint opens=0; - for (table=thd->open_tables; table ; table=table->next) opens++; + for (table= thd->open_tables; table ; table=table->next) + opens++; tables= (TABLE**) my_alloca(sizeof(TABLE*)*opens); } else @@ -1524,7 +2131,7 @@ bool reopen_tables(THD *thd,bool get_locks,bool in_refresh) { uint db_stat=table->db_stat; next=table->next; - if (!tables || (!db_stat && reopen_table(table,1))) + if (!tables || (!db_stat && reopen_table(table))) { my_error(ER_CANT_REOPEN_TABLE, MYF(0), table->alias); VOID(hash_delete(&open_cache,(byte*) table)); @@ -1565,6 +2172,7 @@ bool reopen_tables(THD *thd,bool get_locks,bool in_refresh) DBUG_RETURN(error); } + /* Close handlers for tables in list, but leave the TABLE structure intact so that we can re-open these quickly @@ -1574,15 +2182,14 @@ bool reopen_tables(THD *thd,bool get_locks,bool in_refresh) void close_old_data_files(THD *thd, TABLE *table, bool abort_locks, bool send_refresh) { + bool found= send_refresh; DBUG_ENTER("close_old_data_files"); - bool found=send_refresh; + for (; table ; table=table->next) { if (table->s->version != refresh_version) { found=1; - if (!abort_locks) // If not from flush tables - table->s->version= refresh_version; // Let other threads use table if (table->db_stat) { if (abort_locks) @@ -1591,8 +2198,7 @@ void close_old_data_files(THD *thd, TABLE *table, bool abort_locks, mysql_lock_remove(thd, thd->locked_tables,table); table->locked_by_flush=1; // Will be reopened with locks } - table->file->close(); - table->db_stat=0; + close_handle_and_leave_table_as_lock(table); } } } @@ -1610,22 +2216,40 @@ void close_old_data_files(THD *thd, TABLE *table, bool abort_locks, bool table_is_used(TABLE *table, bool wait_for_name_lock) { + DBUG_ENTER("table_is_used"); do { - char *key= table->s->table_cache_key; - uint key_length= table->s->key_length; + char *key= table->s->table_cache_key.str; + uint key_length= table->s->table_cache_key.length; + + DBUG_PRINT("loop", ("table_name: %s", table->alias)); for (TABLE *search=(TABLE*) hash_search(&open_cache, (byte*) key,key_length) ; search ; search = (TABLE*) hash_next(&open_cache,(byte*) key,key_length)) { - if (search->locked_by_flush || - search->locked_by_name && wait_for_name_lock || - search->db_stat && search->s->version < refresh_version) - return 1; // Table is used + DBUG_PRINT("info", ("share: 0x%lx locked_by_flush: %d " + "locked_by_name: %d db_stat: %u version: %u", + (ulong) search->s, + search->locked_by_flush, search->locked_by_name, + search->db_stat, + search->s->version)); + if (search->in_use == table->in_use) + continue; // Name locked by this thread + /* + We can't use the table under any of the following conditions: + - There is an name lock on it (Table is to be deleted or altered) + - If we are in flush table and we didn't execute the flush + - If the table engine is open and it's an old version + (We must wait until all engines are shut down to use the table) + */ + if (search->locked_by_name && wait_for_name_lock || + search->locked_by_flush || + (search->db_stat && search->s->version < refresh_version)) + return 1; } } while ((table=table->next)); - return 0; + DBUG_RETURN(0); } @@ -1642,7 +2266,7 @@ bool wait_for_tables(THD *thd) { thd->some_tables_deleted=0; close_old_data_files(thd,thd->open_tables,0,dropping_tables != 0); - mysql_ha_flush(thd, (TABLE_LIST*) NULL, MYSQL_HA_REOPEN_ON_USAGE); + mysql_ha_flush(thd, (TABLE_LIST*) NULL, MYSQL_HA_REOPEN_ON_USAGE, TRUE); if (!table_is_used(thd->open_tables,1)) break; (void) pthread_cond_wait(&COND_refresh,&LOCK_open); @@ -1672,8 +2296,8 @@ bool drop_locked_tables(THD *thd,const char *db, const char *table_name) for (table= thd->open_tables; table ; table=next) { next=table->next; - if (!strcmp(table->s->table_name, table_name) && - !strcmp(table->s->db, db)) + if (!strcmp(table->s->table_name.str, table_name) && + !strcmp(table->s->db.str, db)) { mysql_lock_remove(thd, thd->locked_tables,table); VOID(hash_delete(&open_cache,(byte*) table)); @@ -1708,8 +2332,8 @@ void abort_locked_tables(THD *thd,const char *db, const char *table_name) TABLE *table; for (table= thd->open_tables; table ; table= table->next) { - if (!strcmp(table->s->table_name,table_name) && - !strcmp(table->s->db, db)) + if (!strcmp(table->s->table_name.str, table_name) && + !strcmp(table->s->db.str, db)) { mysql_lock_abort(thd,table); break; @@ -1725,135 +2349,154 @@ void abort_locked_tables(THD *thd,const char *db, const char *table_name) open_unireg_entry() thd Thread handle entry Store open table definition here - db Database name - name Table name + table_list TABLE_LIST with db, table_name & belong_to_view alias Alias name - table_desc TABLE_LIST descriptor (used with views) + cache_key Key for share_cache + cache_key_length length of cache_key mem_root temporary mem_root for parsing NOTES Extra argument for open is taken from thd->open_options + One must have a lock on LOCK_open when calling this function RETURN 0 ok # Error */ -static int open_unireg_entry(THD *thd, TABLE *entry, const char *db, - const char *name, const char *alias, - TABLE_LIST *table_desc, MEM_ROOT *mem_root) + +static int open_unireg_entry(THD *thd, TABLE *entry, TABLE_LIST *table_list, + const char *alias, + char *cache_key, uint cache_key_length, + MEM_ROOT *mem_root) { - char path[FN_REFLEN]; int error; + TABLE_SHARE *share; uint discover_retry_count= 0; DBUG_ENTER("open_unireg_entry"); - strxmov(path, mysql_data_home, "/", db, "/", name, NullS); - while ((error= openfrm(thd, path, alias, - (uint) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE | - HA_GET_INDEX | HA_TRY_READ_ONLY | - NO_ERR_ON_NEW_FRM), - READ_KEYINFO | COMPUTE_TYPES | EXTRA_RECORD, - thd->open_options, entry)) && - (error != 5 || - (fn_format(path, path, 0, reg_ext, MY_UNPACK_FILENAME), - open_new_frm(thd, path, alias, db, name, - (uint) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE | - HA_GET_INDEX | HA_TRY_READ_ONLY), - READ_KEYINFO | COMPUTE_TYPES | EXTRA_RECORD, - thd->open_options, entry, table_desc, mem_root)))) + safe_mutex_assert_owner(&LOCK_open); +retry: + if (!(share= get_table_share_with_create(thd, table_list, cache_key, + cache_key_length, + OPEN_VIEW, &error))) + DBUG_RETURN(1); + + if (share->is_view) { - if (!entry->s || !entry->s->crashed) - { - /* - Frm file could not be found on disk - Since it does not exist, no one can be using it - LOCK_open has been locked to protect from someone else - trying to discover the table at the same time. - */ - if (discover_retry_count++ != 0) - goto err; - if (ha_create_table_from_engine(thd, db, name) > 0) - { - /* Give right error message */ - thd->clear_error(); - DBUG_PRINT("error", ("Discovery of %s/%s failed", db, name)); - my_printf_error(ER_UNKNOWN_ERROR, - "Failed to open '%-.64s', error while " - "unpacking from engine", - MYF(0), name); - - goto err; - } - - mysql_reset_errors(thd, 1); // Clear warnings - thd->clear_error(); // Clear error message - continue; - } - - // Code below is for repairing a crashed file - TABLE_LIST table_list; - bzero((char*) &table_list, sizeof(table_list)); // just for safe - table_list.db=(char*) db; - table_list.table_name=(char*) name; - - safe_mutex_assert_owner(&LOCK_open); - - if ((error=lock_table_name(thd,&table_list))) - { - if (error < 0) - { - goto err; - } - if (wait_for_locked_table_names(thd,&table_list)) - { - unlock_table_name(thd,&table_list); - goto err; - } - } - pthread_mutex_unlock(&LOCK_open); - thd->clear_error(); // Clear error message - error= 0; - if (openfrm(thd, path, alias, - (uint) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE | HA_GET_INDEX | - HA_TRY_READ_ONLY), - READ_KEYINFO | COMPUTE_TYPES | EXTRA_RECORD, - ha_open_options | HA_OPEN_FOR_REPAIR, - entry) || ! entry->file || - (entry->file->is_crashed() && entry->file->check_and_repair(thd))) - { - /* Give right error message */ - thd->clear_error(); - my_error(ER_NOT_KEYFILE, MYF(0), name, my_errno); - sql_print_error("Couldn't repair table: %s.%s",db,name); - if (entry->file) - closefrm(entry); - error=1; - } - else - thd->clear_error(); // Clear error message - pthread_mutex_lock(&LOCK_open); - unlock_table_name(thd,&table_list); - + /* Open view */ + error= (int) open_new_frm(thd, share, alias, + (uint) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE | + HA_GET_INDEX | HA_TRY_READ_ONLY), + READ_KEYINFO | COMPUTE_TYPES | EXTRA_RECORD, + thd->open_options, entry, table_list, + mem_root); if (error) goto err; - break; + /* TODO: Don't free this */ + release_table_share(share, RELEASE_NORMAL); + DBUG_RETURN(0); } - if (error == 5) - DBUG_RETURN(0); // we have just opened VIEW + while ((error= open_table_from_share(thd, share, alias, + (uint) (HA_OPEN_KEYFILE | + HA_OPEN_RNDFILE | + HA_GET_INDEX | + HA_TRY_READ_ONLY), + (READ_KEYINFO | COMPUTE_TYPES | + EXTRA_RECORD), + thd->open_options, entry))) + { + if (error == 7) // Table def changed + { + share->version= 0; // Mark share as old + if (discover_retry_count++) // Retry once + goto err; - /* - We can't mark all tables in 'mysql' database as system since we don't - allow to lock such tables for writing with any other tables (even with - other system tables) and some privilege tables need this. - */ - if (!my_strcasecmp(system_charset_info, db, "mysql") && - !my_strcasecmp(system_charset_info, name, "proc")) - entry->s->system_table= 1; + /* + TODO: + Here we should wait until all threads has released the table. + For now we do one retry. This may cause a deadlock if there + is other threads waiting for other tables used by this thread. + + Proper fix would be to if the second retry failed: + - Mark that table def changed + - Return from open table + - Close all tables used by this thread + - Start waiting that the share is released + - Retry by opening all tables again + */ + if (ha_create_table_from_engine(thd, table_list->db, + table_list->table_name)) + goto err; + /* + TO BE FIXED + To avoid deadlock, only wait for release if no one else is + using the share. + */ + if (share->ref_count != 1) + goto err; + /* Free share and wait until it's released by all threads */ + release_table_share(share, RELEASE_WAIT_FOR_DROP); + if (!thd->killed) + { + mysql_reset_errors(thd, 1); // Clear warnings + thd->clear_error(); // Clear error message + goto retry; + } + DBUG_RETURN(1); + } + if (!entry->s || !entry->s->crashed) + goto err; - if (Table_triggers_list::check_n_load(thd, db, name, entry, 0)) + // Code below is for repairing a crashed file + if ((error= lock_table_name(thd, table_list))) + { + if (error < 0) + goto err; + if (wait_for_locked_table_names(thd, table_list)) + { + unlock_table_name(thd, table_list); + goto err; + } + } + pthread_mutex_unlock(&LOCK_open); + thd->clear_error(); // Clear error message + error= 0; + if (open_table_from_share(thd, share, alias, + (uint) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE | + HA_GET_INDEX | + HA_TRY_READ_ONLY), + READ_KEYINFO | COMPUTE_TYPES | EXTRA_RECORD, + ha_open_options | HA_OPEN_FOR_REPAIR, + entry) || ! entry->file || + (entry->file->is_crashed() && entry->file->check_and_repair(thd))) + { + /* Give right error message */ + thd->clear_error(); + my_error(ER_NOT_KEYFILE, MYF(0), share->table_name.str, my_errno); + sql_print_error("Couldn't repair table: %s.%s", share->db.str, + share->table_name.str); + if (entry->file) + closefrm(entry, 0); + error=1; + } + else + thd->clear_error(); // Clear error message + pthread_mutex_lock(&LOCK_open); + unlock_table_name(thd, table_list); + + if (error) + goto err; + break; + } + + if (Table_triggers_list::check_n_load(thd, share->db.str, + share->table_name.str, entry, 0)) + { + closefrm(entry, 0); goto err; + } /* If we are here, there was no fatal error (but error may be still @@ -1865,11 +2508,11 @@ static int open_unireg_entry(THD *thd, TABLE *entry, const char *db, if (mysql_bin_log.is_open()) { char *query, *end; - uint query_buf_size= 20 + 2*NAME_LEN + 1; - if ((query= (char*)my_malloc(query_buf_size,MYF(MY_WME)))) + uint query_buf_size= 20 + share->db.length + share->table_name.length +1; + if ((query= (char*) my_malloc(query_buf_size,MYF(MY_WME)))) { end = strxmov(strmov(query, "DELETE FROM `"), - db,"`.`",name,"`", NullS); + share->db.str,"`.`",share->table_name.str,"`", NullS); Query_log_event qinfo(thd, query, (ulong)(end-query), 0, FALSE); mysql_bin_log.write(&qinfo); my_free(query, MYF(0)); @@ -1881,25 +2524,19 @@ static int open_unireg_entry(THD *thd, TABLE *entry, const char *db, DBA on top of warning the client (which will automatically be done because of MYF(MY_WME) in my_malloc() above). */ - sql_print_error("When opening HEAP table, could not allocate \ -memory to write 'DELETE FROM `%s`.`%s`' to the binary log",db,name); + sql_print_error("When opening HEAP table, could not allocate memory " + "to write 'DELETE FROM `%s`.`%s`' to the binary log", + table_list->db, table_list->table_name); delete entry->triggers; - if (entry->file) - closefrm(entry); + closefrm(entry, 0); goto err; } } } DBUG_RETURN(0); + err: - /* Hide "Table doesn't exist" errors if table belong to view */ - if (thd->net.last_errno == ER_NO_SUCH_TABLE && - table_desc && table_desc->belong_to_view) - { - TABLE_LIST *view= table_desc->belong_to_view; - thd->clear_error(); - my_error(ER_VIEW_INVALID, MYF(0), view->view_db.str, view->view_name.str); - } + release_table_share(share, RELEASE_NORMAL); DBUG_RETURN(1); } @@ -2059,7 +2696,7 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags) for (TABLE_LIST *tmp= *start; tmp; tmp= tmp->next_global) { /* Close normal (not temporary) changed tables */ - if (tmp->table && ! tmp->table->s->tmp_table) + if (tmp->table && ! tmp->table->s->tmp_table != NO_TMP_TABLE) { if (tmp->table->s->version != refresh_version || ! tmp->table->db_stat) @@ -2564,8 +3201,22 @@ void close_tables_for_reopen(THD *thd, TABLE_LIST *tables) /* Open a single table without table caching and don't set it in open_list - Used by alter_table to open a temporary table and when creating - a temporary table with CREATE TEMPORARY ... + + SYNPOSIS + open_temporary_table() + thd Thread object + path Path (without .frm) + db database + table_name Table name + link_in_list 1 if table should be linked into thd->temporary_tables + + NOTES: + Used by alter_table to open a temporary table and when creating + a temporary table with CREATE TEMPORARY ... + + RETURN + 0 Error + # TABLE object */ TABLE *open_temporary_table(THD *thd, const char *path, const char *db, @@ -2573,51 +3224,53 @@ TABLE *open_temporary_table(THD *thd, const char *path, const char *db, { TABLE *tmp_table; TABLE_SHARE *share; + char cache_key[MAX_DBKEY_LENGTH], *saved_cache_key, *tmp_path; + uint key_length; + TABLE_LIST table_list; DBUG_ENTER("open_temporary_table"); - /* - The extra size in my_malloc() is for table_cache_key - 4 bytes for master thread id if we are in the slave - 1 byte to terminate db - 1 byte to terminate table_name - total of 6 extra bytes in my_malloc in addition to table/db stuff - */ - if (!(tmp_table=(TABLE*) my_malloc(sizeof(*tmp_table)+(uint) strlen(db)+ - (uint) strlen(table_name)+6+4, - MYF(MY_WME)))) + table_list.db= (char*) db; + table_list.table_name= (char*) table_name; + /* Create the cache_key for temporary tables */ + key_length= create_table_def_key(thd, cache_key, &table_list, 1); + + if (!(tmp_table= (TABLE*) my_malloc(sizeof(*tmp_table) + sizeof(*share) + + strlen(path)+1 + key_length, + MYF(MY_WME)))) DBUG_RETURN(0); /* purecov: inspected */ - if (openfrm(thd, path, table_name, - (uint) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE | HA_GET_INDEX), - READ_KEYINFO | COMPUTE_TYPES | EXTRA_RECORD, - ha_open_options, - tmp_table)) + share= (TABLE_SHARE*) (tmp_table+1); + tmp_path= (char*) (share+1); + saved_cache_key= strmov(tmp_path, path)+1; + memcpy(saved_cache_key, cache_key, key_length); + + init_tmp_table_share(share, saved_cache_key, key_length, + strend(saved_cache_key)+1, tmp_path); + + if (open_table_def(thd, share, 0) || + open_table_from_share(thd, share, table_name, + (uint) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE | + HA_GET_INDEX), + READ_KEYINFO | COMPUTE_TYPES | EXTRA_RECORD, + ha_open_options, + tmp_table)) { + /* No need to lock share->mutex as this is not needed for tmp tables */ + free_table_share(share); my_free((char*) tmp_table,MYF(0)); DBUG_RETURN(0); } - share= tmp_table->s; - tmp_table->reginfo.lock_type=TL_WRITE; // Simulate locked + tmp_table->reginfo.lock_type= TL_WRITE; // Simulate locked share->tmp_table= (tmp_table->file->has_transactions() ? TRANSACTIONAL_TMP_TABLE : TMP_TABLE); - share->table_cache_key= (char*) (tmp_table+1); - share->db= share->table_cache_key; - share->key_length= (uint) (strmov(((char*) (share->table_name= - strmov(share->table_cache_key, - db)+1)), - table_name) - - share->table_cache_key) +1; - int4store(share->table_cache_key + share->key_length, thd->server_id); - share->key_length+= 4; - int4store(share->table_cache_key + share->key_length, - thd->variables.pseudo_thread_id); - share->key_length+= 4; if (link_in_list) { - tmp_table->next=thd->temporary_tables; - thd->temporary_tables=tmp_table; + tmp_table->open_prev= &thd->temporary_tables; + if ((tmp_table->next= thd->temporary_tables)) + thd->temporary_tables->open_prev= &tmp_table->next; + thd->temporary_tables= tmp_table; if (thd->slave_thread) slave_open_temp_tables++; } @@ -2628,18 +3281,19 @@ TABLE *open_temporary_table(THD *thd, const char *path, const char *db, bool rm_temporary_table(enum db_type base, char *path) { bool error=0; + handler *file; + char *ext; DBUG_ENTER("rm_temporary_table"); - fn_format(path, path,"",reg_ext,4); - unpack_filename(path,path); + strmov(ext= strend(path), reg_ext); if (my_delete(path,MYF(0))) error=1; /* purecov: inspected */ - *fn_ext(path)='\0'; // remove extension - handler *file= get_new_handler((TABLE*) 0, current_thd->mem_root, base); + *ext= 0; // remove extension + file= get_new_handler((TABLE_SHARE*) 0, current_thd->mem_root, base); if (file && file->delete_table(path)) { error=1; - sql_print_warning("Could not remove tmp table: '%s', error: %d", + sql_print_warning("Could not remove temporary table: '%s', error: %d", path, my_errno); } delete file; @@ -2961,8 +3615,18 @@ find_field_in_table(THD *thd, TABLE *table, const char *name, uint length, table->field[cached_field_index]->field_name, name)) field_ptr= table->field + cached_field_index; else if (table->s->name_hash.records) + { field_ptr= (Field**) hash_search(&table->s->name_hash, (byte*) name, length); + if (field_ptr) + { + /* + field_ptr points to field in TABLE_SHARE. Convert it to the matching + field in table + */ + field_ptr= (table->field + (field_ptr - table->s->field)); + } + } else { if (!(field_ptr= table->field)) @@ -2981,15 +3645,16 @@ find_field_in_table(THD *thd, TABLE *table, const char *name, uint length, { if (!allow_rowid || my_strcasecmp(system_charset_info, name, "_rowid") || - !(field=table->rowid_field)) + table->s->rowid_field_offset == 0) DBUG_RETURN((Field*) 0); + field= table->field[table->s->rowid_field_offset-1]; } update_field_dependencies(thd, field, table); #ifndef NO_EMBEDDED_ACCESS_CHECKS if (check_grant_column_in_sctx(thd, &table->grant, - table->s->db, table->s->table_name, + table->s->db.str, table->s->table_name.str, name, length, check_grants, sctx)) field= WRONG_GRANT; @@ -4576,7 +5241,7 @@ bool get_key_map_from_key_list(key_map *map, TABLE *table, 0) { my_error(ER_KEY_COLUMN_DOES_NOT_EXITS, MYF(0), name->c_ptr(), - table->s->table_name); + table->s->table_name.str); map->set_all(); return 1; } @@ -5080,28 +5745,28 @@ static void mysql_rm_tmp_tables(void) for (i=0; i<=mysql_tmpdir_list.max; i++) { tmpdir=mysql_tmpdir_list.list[i]; - /* See if the directory exists */ + /* See if the directory exists */ if (!(dirp = my_dir(tmpdir,MYF(MY_WME | MY_DONT_SORT)))) continue; /* Remove all SQLxxx tables from directory */ - for (idx=0 ; idx < (uint) dirp->number_off_files ; idx++) - { - file=dirp->dir_entry+idx; - - /* skiping . and .. */ - if (file->name[0] == '.' && (!file->name[1] || - (file->name[1] == '.' && !file->name[2]))) - continue; - - if (!bcmp(file->name,tmp_file_prefix,tmp_file_prefix_length)) + for (idx=0 ; idx < (uint) dirp->number_off_files ; idx++) { + file=dirp->dir_entry+idx; + + /* skiping . and .. */ + if (file->name[0] == '.' && (!file->name[1] || + (file->name[1] == '.' && !file->name[2]))) + continue; + + if (!bcmp(file->name,tmp_file_prefix,tmp_file_prefix_length)) + { sprintf(filePath,"%s%s",tmpdir,file->name); VOID(my_delete(filePath,MYF(MY_WME))); + } } - } - my_dirend(dirp); + my_dirend(dirp); } DBUG_VOID_RETURN; } @@ -5130,7 +5795,7 @@ void remove_db_from_cache(const char *db) for (uint idx=0 ; idx < open_cache.records ; idx++) { TABLE *table=(TABLE*) hash_element(&open_cache,idx); - if (!strcmp(table->s->db, db)) + if (!strcmp(table->s->db.str, db)) { table->s->version= 0L; /* Free when thread is ready */ if (!table->in_use) @@ -5143,7 +5808,11 @@ void remove_db_from_cache(const char *db) /* -** free all unused tables + free all unused tables + + NOTE + This is called by 'handle_manager' when one wants to periodicly flush + all not used tables. */ void flush_tables() @@ -5176,10 +5845,10 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table_name, char key[MAX_DBKEY_LENGTH]; uint key_length; TABLE *table; - bool result=0, signalled= 0; + TABLE_SHARE *share; + bool result= 0, signalled= 0; DBUG_ENTER("remove_table_from_cache"); - key_length=(uint) (strmov(strmov(key,db)+1,table_name)-key)+1; for (;;) { @@ -5198,6 +5867,7 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table_name, } else if (in_use != thd) { + DBUG_PRINT("info", ("Table was in use by other thread")); in_use->some_tables_deleted=1; if (table->db_stat) result=1; @@ -5229,10 +5899,30 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table_name, } } else + { + DBUG_PRINT("info", ("Table was in use by current thread. db_stat: %u", + table->db_stat)); result= result || (flags & RTFC_OWNED_BY_THD_FLAG); + } } while (unused_tables && !unused_tables->s->version) VOID(hash_delete(&open_cache,(byte*) unused_tables)); + + DBUG_PRINT("info", ("Removing table from table_def_cache")); + /* Remove table from table definition cache if it's not in use */ + if ((share= (TABLE_SHARE*) hash_search(&table_def_cache,(byte*) key, + key_length))) + { + DBUG_PRINT("info", ("share version: %lu ref_count: %u", + share->version, share->ref_count)); + share->version= 0; // Mark for delete + if (share->ref_count == 0) + { + pthread_mutex_lock(&share->mutex); + VOID(hash_delete(&table_def_cache, (byte*) share)); + } + } + if (result && (flags & RTFC_WAIT_OTHER_THREAD_FLAG)) { if (!(flags & RTFC_CHECK_KILLED_FLAG) || !thd->killed) @@ -5265,6 +5955,7 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table_name, DBUG_RETURN(result); } + int setup_ftfuncs(SELECT_LEX *select_lex) { List_iterator li(*(select_lex->ftfunc_list)), @@ -5309,7 +6000,7 @@ int init_ftfuncs(THD *thd, SELECT_LEX *select_lex, bool no_order) SYNOPSIS open_new_frm() THD thread handler - path path to .frm + path path to .frm file (without extension) alias alias for table db database table_name name of table @@ -5323,18 +6014,20 @@ int init_ftfuncs(THD *thd, SELECT_LEX *select_lex, bool no_order) */ static bool -open_new_frm(THD *thd, const char *path, const char *alias, - const char *db, const char *table_name, +open_new_frm(THD *thd, TABLE_SHARE *share, const char *alias, uint db_stat, uint prgflag, uint ha_open_flags, TABLE *outparam, TABLE_LIST *table_desc, MEM_ROOT *mem_root) { LEX_STRING pathstr; File_parser *parser; + char path[FN_REFLEN]; DBUG_ENTER("open_new_frm"); - pathstr.str= (char*) path; - pathstr.length= strlen(path); + /* Create path with extension */ + pathstr.length= (uint) (strxmov(path, share->normalized_path.str, reg_ext, + NullS)- path); + pathstr.str= path; if ((parser= sql_parse_prepare(&pathstr, mem_root, 1))) { @@ -5342,7 +6035,8 @@ open_new_frm(THD *thd, const char *path, const char *alias, { if (table_desc == 0 || table_desc->required_type == FRMTYPE_TABLE) { - my_error(ER_WRONG_OBJECT, MYF(0), db, table_name, "BASE TABLE"); + my_error(ER_WRONG_OBJECT, MYF(0), share->db.str, share->table_name.str, + "BASE TABLE"); goto err; } if (mysql_make_view(thd, parser, table_desc)) @@ -5351,7 +6045,7 @@ open_new_frm(THD *thd, const char *path, const char *alias, else { /* only VIEWs are supported now */ - my_error(ER_FRM_UNKNOWN_TYPE, MYF(0), path, parser->type()->str); + my_error(ER_FRM_UNKNOWN_TYPE, MYF(0), share->path, parser->type()->str); goto err; } DBUG_RETURN(0); diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index c150489f311..61a45ebb4d6 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -850,7 +850,7 @@ sql mode: 0x%lx, sort len: %lu, conncat len: %lu", if (thd->db_length) { memcpy(thd->query+thd->query_length+1, thd->db, thd->db_length); - DBUG_PRINT("qcache", ("database : %s length %u", + DBUG_PRINT("qcache", ("database: %s length: %u", thd->db, thd->db_length)); } else @@ -977,21 +977,32 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length) goto err; } - /* - Test if the query is a SELECT - (pre-space is removed in dispatch_command). - - First '/' looks like comment before command it is not - frequently appeared in real lihe, consequently we can - check all such queries, too. - */ - if ((my_toupper(system_charset_info, sql[0]) != 'S' || - my_toupper(system_charset_info, sql[1]) != 'E' || - my_toupper(system_charset_info,sql[2]) !='L') && - sql[0] != '/') { - DBUG_PRINT("qcache", ("The statement is not a SELECT; Not cached")); - goto err; + uint i= 0; + /* + Skip '(' characters in queries like following: + (select a from t1) union (select a from t1); + */ + while (sql[i]=='(') + i++; + + + /* + Test if the query is a SELECT + (pre-space is removed in dispatch_command). + + First '/' looks like comment before command it is not + frequently appeared in real lihe, consequently we can + check all such queries, too. + */ + if ((my_toupper(system_charset_info, sql[i]) != 'S' || + my_toupper(system_charset_info, sql[i + 1]) != 'E' || + my_toupper(system_charset_info, sql[i + 2]) != 'L') && + sql[0] != '/') + { + DBUG_PRINT("qcache", ("The statement is not a SELECT; Not cached")); + goto err; + } } STRUCT_LOCK(&structure_guard_mutex); @@ -1006,7 +1017,7 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length) if (thd->db_length) { memcpy(sql+query_length+1, thd->db, thd->db_length); - DBUG_PRINT("qcache", ("database: '%s' length %u", + DBUG_PRINT("qcache", ("database: '%s' length: %u", thd->db, thd->db_length)); } else @@ -1103,9 +1114,9 @@ sql mode: 0x%lx, sort len: %lu, conncat len: %lu", */ for (tmptable= thd->temporary_tables; tmptable ; tmptable= tmptable->next) { - if (tmptable->s->key_length - TMP_TABLE_KEY_EXTRA == + if (tmptable->s->table_cache_key.length - TMP_TABLE_KEY_EXTRA == table->key_length() && - !memcmp(tmptable->s->table_cache_key, table->data(), + !memcmp(tmptable->s->table_cache_key.str, table->data(), table->key_length())) { DBUG_PRINT("qcache", @@ -1268,7 +1279,7 @@ void Query_cache::invalidate(CHANGED_TABLE_LIST *tables_used) for (; tables_used; tables_used= tables_used->next) { invalidate_table((byte*) tables_used->key, tables_used->key_length); - DBUG_PRINT("qcache", (" db %s, table %s", tables_used->key, + DBUG_PRINT("qcache", ("db: %s table: %s", tables_used->key, tables_used->key+ strlen(tables_used->key)+1)); } @@ -2135,7 +2146,8 @@ void Query_cache::invalidate_table(TABLE_LIST *table_list) void Query_cache::invalidate_table(TABLE *table) { - invalidate_table((byte*) table->s->table_cache_key, table->s->key_length); + invalidate_table((byte*) table->s->table_cache_key.str, + table->s->table_cache_key.length); } void Query_cache::invalidate_table(byte * key, uint32 key_length) @@ -2196,7 +2208,7 @@ Query_cache::register_tables_from_list(TABLE_LIST *tables_used, { char key[MAX_DBKEY_LENGTH]; uint key_length; - DBUG_PRINT("qcache", ("view %s, db %s", + DBUG_PRINT("qcache", ("view: %s db: %s", tables_used->view_name.str, tables_used->view_db.str)); key_length= (uint) (strmov(strmov(key, tables_used->view_db.str) + 1, @@ -2216,14 +2228,15 @@ Query_cache::register_tables_from_list(TABLE_LIST *tables_used, else { DBUG_PRINT("qcache", - ("table %s, db %s, openinfo at 0x%lx, keylen %u, key at 0x%lx", - tables_used->table->s->table_name, - tables_used->table->s->table_cache_key, + ("table: %s db: %s openinfo: 0x%lx keylen: %u key: 0x%lx", + tables_used->table->s->table_name.str, + tables_used->table->s->table_cache_key.str, (ulong) tables_used->table, - tables_used->table->s->key_length, - (ulong) tables_used->table->s->table_cache_key)); - if (!insert_table(tables_used->table->s->key_length, - tables_used->table->s->table_cache_key, block_table, + tables_used->table->s->table_cache_key.length, + (ulong) tables_used->table->s->table_cache_key.str)); + if (!insert_table(tables_used->table->s->table_cache_key.length, + tables_used->table->s->table_cache_key.str, + block_table, tables_used->db_length, tables_used->table->file->table_cache_type(), tables_used->callback_func, @@ -2823,16 +2836,16 @@ static TABLE_COUNTER_TYPE process_and_count_tables(TABLE_LIST *tables_used, table_count++; if (tables_used->view) { - DBUG_PRINT("qcache", ("view %s, db %s", + DBUG_PRINT("qcache", ("view: %s db: %s", tables_used->view_name.str, tables_used->view_db.str)); *tables_type|= HA_CACHE_TBL_NONTRANSACT; } else { - DBUG_PRINT("qcache", ("table %s, db %s, type %u", - tables_used->table->s->table_name, - tables_used->table->s->table_cache_key, + DBUG_PRINT("qcache", ("table: %s db: %s type: %u", + tables_used->table->s->table_name.str, + tables_used->table->s->db.str, tables_used->table->s->db_type)); if (tables_used->derived) { @@ -2850,12 +2863,12 @@ static TABLE_COUNTER_TYPE process_and_count_tables(TABLE_LIST *tables_used, (*tables_type & HA_CACHE_TBL_NOCACHE) || (tables_used->db_length == 5 && my_strnncoll(table_alias_charset, - (uchar*)tables_used->table->s->table_cache_key, 6, + (uchar*)tables_used->table->s->table_cache_key.str, 6, (uchar*)"mysql",6) == 0)) { DBUG_PRINT("qcache", - ("select not cacheable: temporary, system or \ - other non-cacheable table(s)")); + ("select not cacheable: temporary, system or " + "other non-cacheable table(s)")); DBUG_RETURN(0); } if (tables_used->table->s->db_type == DB_TYPE_MRG_MYISAM) @@ -2937,11 +2950,13 @@ my_bool Query_cache::ask_handler_allowance(THD *thd, for (; tables_used; tables_used= tables_used->next_global) { TABLE *table; + handler *handler; if (!(table= tables_used->table)) continue; - handler *handler= table->file; - if (!handler->register_query_cache_table(thd, table->s->table_cache_key, - table->s->key_length, + handler= table->file; + if (!handler->register_query_cache_table(thd, + table->s->table_cache_key.str, + table->s->table_cache_key.length, &tables_used->callback_func, &tables_used->engine_data)) { diff --git a/sql/sql_cache.h b/sql/sql_cache.h index 123d16b606d..b7531696150 100644 --- a/sql/sql_cache.h +++ b/sql/sql_cache.h @@ -215,6 +215,8 @@ struct Query_cache_memory_bin struct Query_cache_memory_bin_step { +public: + Query_cache_memory_bin_step() {} ulong size; ulong increment; uint idx; @@ -410,7 +412,7 @@ protected: /* The following functions are only used when debugging - We don't protect these with ifndef DEBUG_OFF to not have to recompile + We don't protect these with ifndef DBUG_OFF to not have to recompile everything if we want to add checks of the cache at some places. */ void wreck(uint line, const char *message); diff --git a/sql/sql_class.cc b/sql/sql_class.cc index de5be091968..623e6987094 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -183,6 +183,7 @@ THD::THD() spcont(NULL) { stmt_arena= this; + thread_stack= 0; db= 0; catalog= (char*)"std"; // the only catalog we have for now main_security_ctx.init(); @@ -376,7 +377,7 @@ void THD::cleanup(void) close_thread_tables(this); } mysql_ha_flush(this, (TABLE_LIST*) 0, - MYSQL_HA_CLOSE_FINAL | MYSQL_HA_FLUSH_ALL); + MYSQL_HA_CLOSE_FINAL | MYSQL_HA_FLUSH_ALL, FALSE); hash_free(&handler_tables_hash); delete_dynamic(&user_var_events); hash_free(&user_vars); @@ -517,6 +518,12 @@ void THD::awake(THD::killed_state state_to_set) bool THD::store_globals() { + /* + Assert that thread_stack is initialized: it's necessary to be able + to track stack overrun. + */ + DBUG_ASSERT(this->thread_stack); + if (my_pthread_setspecific_ptr(THR_THD, this) || my_pthread_setspecific_ptr(THR_MALLOC, &mem_root)) return 1; @@ -658,7 +665,8 @@ void THD::add_changed_table(TABLE *table) DBUG_ASSERT((options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) && table->file->has_transactions()); - add_changed_table(table->s->table_cache_key, table->s->key_length); + add_changed_table(table->s->table_cache_key.str, + table->s->table_cache_key.length); DBUG_VOID_RETURN; } @@ -1053,7 +1061,8 @@ static File create_file(THD *thd, char *path, sql_exchange *exchange, if (!dirname_length(exchange->file_name)) { - strxnmov(path, FN_REFLEN, mysql_real_data_home, thd->db ? thd->db : "", NullS); + strxnmov(path, FN_REFLEN-1, mysql_real_data_home, thd->db ? thd->db : "", + NullS); (void) fn_format(path, exchange->file_name, path, "", option); } else @@ -1495,7 +1504,13 @@ int select_dumpvar::prepare(List &list, SELECT_LEX_UNIT *u) { my_var *mv= gl++; if (mv->local) - (void)local_vars.push_back(new Item_splocal(mv->s, mv->offset)); + { + Item_splocal *var; + (void)local_vars.push_back(var= new Item_splocal(mv->s, mv->offset)); +#ifndef DBUG_OFF + var->owner= mv->owner; +#endif + } else { Item_func_set_user_var *var= new Item_func_set_user_var(mv->s, item); @@ -1802,6 +1817,7 @@ void TMP_TABLE_PARAM::init() group_parts= group_length= group_null_parts= 0; quick_group= 1; table_charset= 0; + precomputed_group_by= 0; } @@ -1916,6 +1932,7 @@ void THD::restore_backup_open_tables_state(Open_tables_state *backup) - Value for found_rows() is reset and restored - examined_row_count is added to the total - cuted_fields is added to the total + - new savepoint level is created and destroyed NOTES: Seed for random() is saved for the first! usage of RAND() @@ -1934,11 +1951,13 @@ void THD::reset_sub_statement_state(Sub_statement_state *backup, backup->last_insert_id= last_insert_id; backup->next_insert_id= next_insert_id; backup->insert_id_used= insert_id_used; + backup->clear_next_insert_id= clear_next_insert_id; backup->limit_found_rows= limit_found_rows; backup->examined_row_count= examined_row_count; backup->sent_row_count= sent_row_count; backup->cuted_fields= cuted_fields; backup->client_capabilities= client_capabilities; + backup->savepoints= transaction.savepoints; if (!lex->requires_prelocking() || is_update_query(lex->sql_command)) options&= ~OPTION_BIN_LOG; @@ -1951,6 +1970,7 @@ void THD::reset_sub_statement_state(Sub_statement_state *backup, examined_row_count= 0; sent_row_count= 0; cuted_fields= 0; + transaction.savepoints= 0; #ifndef EMBEDDED_LIBRARY /* Surpress OK packets in case if we will execute statements */ @@ -1961,6 +1981,21 @@ void THD::reset_sub_statement_state(Sub_statement_state *backup, void THD::restore_sub_statement_state(Sub_statement_state *backup) { + /* + To save resources we want to release savepoints which were created + during execution of function or trigger before leaving their savepoint + level. It is enough to release first savepoint set on this level since + all later savepoints will be released automatically. + */ + if (transaction.savepoints) + { + SAVEPOINT *sv; + for (sv= transaction.savepoints; sv->prev; sv= sv->prev) + {} + /* ha_release_savepoint() never returns error. */ + (void)ha_release_savepoint(this, sv); + } + transaction.savepoints= backup->savepoints; options= backup->options; in_sub_stmt= backup->in_sub_stmt; net.no_send_ok= backup->no_send_ok; @@ -1968,6 +2003,7 @@ void THD::restore_sub_statement_state(Sub_statement_state *backup) last_insert_id= backup->last_insert_id; next_insert_id= backup->next_insert_id; insert_id_used= backup->insert_id_used; + clear_next_insert_id= backup->clear_next_insert_id; limit_found_rows= backup->limit_found_rows; sent_row_count= backup->sent_row_count; client_capabilities= backup->client_capabilities; diff --git a/sql/sql_class.h b/sql/sql_class.h index 62e5620f609..fcc8409546f 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -189,11 +189,10 @@ class MYSQL_LOG: public TC_LOG { private: /* LOCK_log and LOCK_index are inited by init_pthread_objects() */ - pthread_mutex_t LOCK_log, LOCK_index, LOCK_readers; + pthread_mutex_t LOCK_log, LOCK_index; pthread_mutex_t LOCK_prep_xids; pthread_cond_t COND_prep_xids; pthread_cond_t update_cond; - pthread_cond_t reset_cond; ulonglong bytes_written; time_t last_time,query_start; IO_CACHE log_file; @@ -335,9 +334,6 @@ public: int purge_logs_before_date(time_t purge_time); int purge_first_log(struct st_relay_log_info* rli, bool included); bool reset_logs(THD* thd); - inline bool is_reset_pending() { return reset_pending; } - void readers_addref(); - void readers_release(); void close(uint exiting); // iterating through the log index file @@ -537,6 +533,7 @@ struct system_variables ulong completion_type; /* Determines which non-standard SQL behaviour should be enabled */ ulong sql_mode; + ulong max_sp_recursion_depth; /* check of key presence in updatable view */ ulong updatable_views_with_limit; ulong default_week_format; @@ -631,6 +628,7 @@ typedef struct system_status_var ulong net_big_packet_count; ulong opened_tables; + ulong opened_shares; ulong select_full_join_count; ulong select_full_range_join_count; ulong select_range_count; @@ -1103,8 +1101,9 @@ public: ha_rows cuted_fields, sent_row_count, examined_row_count; ulong client_capabilities; uint in_sub_stmt; - bool enable_slow_log, insert_id_used; + bool enable_slow_log, insert_id_used, clear_next_insert_id; my_bool no_send_ok; + SAVEPOINT *savepoints; }; @@ -1242,14 +1241,16 @@ public: free_root(&mem_root,MYF(MY_KEEP_PREALLOC)); #endif } -#ifdef USING_TRANSACTIONS st_transactions() { +#ifdef USING_TRANSACTIONS bzero((char*)this, sizeof(*this)); xid_state.xid.null(); init_sql_alloc(&mem_root, ALLOC_ROOT_MIN_BLOCK_SIZE, 0); - } +#else + xid_state.xa_state= XA_NOTR; #endif + } } transaction; Field *dupp_field; #ifndef __WIN__ @@ -1832,11 +1833,18 @@ public: uint convert_blob_length; CHARSET_INFO *table_charset; bool schema_table; + /* + True if GROUP BY and its aggregate functions are already computed + by a table access method (e.g. by loose index scan). In this case + query execution should not perform aggregation and should treat + aggregate functions as normal functions. + */ + bool precomputed_group_by; TMP_TABLE_PARAM() :copy_field(0), group_parts(0), group_length(0), group_null_parts(0), convert_blob_length(0), - schema_table(0) + schema_table(0), precomputed_group_by(0) {} ~TMP_TABLE_PARAM() { @@ -2098,6 +2106,13 @@ public: class my_var : public Sql_alloc { public: LEX_STRING s; +#ifndef DBUG_OFF + /* + Routine to which this Item_splocal belongs. Used for checking if correct + runtime context is used for variable handling. + */ + sp_head *owner; +#endif bool local; uint offset; enum_field_types type; diff --git a/sql/sql_cursor.cc b/sql/sql_cursor.cc index e8da691ea18..89c160cd70a 100644 --- a/sql/sql_cursor.cc +++ b/sql/sql_cursor.cc @@ -558,6 +558,25 @@ int Materialized_cursor::open(JOIN *join __attribute__((unused))) result->prepare(item_list, &fake_unit) || table->file->ha_rnd_init(TRUE)); thd->restore_active_arena(this, &backup_arena); + if (rc == 0) + { + /* + Now send the result set metadata to the client. We need to + do it here, as in Select_materialize::send_fields the items + for column types are not yet created (send_fields requires + a list of items). The new types may differ from the original + ones sent at prepare if some of them were altered by MySQL + HEAP tables mechanism -- used when create_tmp_field_from_item + may alter the original column type. + + We can't simply supply SEND_EOF flag to send_fields, because + send_fields doesn't flush the network buffer. + */ + rc= result->send_fields(item_list, Protocol::SEND_NUM_ROWS); + thd->server_status|= SERVER_STATUS_CURSOR_EXISTS; + result->send_eof(); + thd->server_status&= ~SERVER_STATUS_CURSOR_EXISTS; + } return rc; } @@ -642,19 +661,10 @@ Materialized_cursor::~Materialized_cursor() bool Select_materialize::send_fields(List &list, uint flags) { - bool rc; DBUG_ASSERT(table == 0); if (create_result_table(unit->thd, unit->get_unit_column_types(), FALSE, thd->options | TMP_TABLE_ALL_COLUMNS, "")) return TRUE; - /* - We can't simply supply SEND_EOF flag to send_fields, because send_fields - doesn't flush the network buffer. - */ - rc= result->send_fields(list, Protocol::SEND_NUM_ROWS); - thd->server_status|= SERVER_STATUS_CURSOR_EXISTS; - result->send_eof(); - thd->server_status&= ~SERVER_STATUS_CURSOR_EXISTS; - return rc; + return FALSE; } diff --git a/sql/sql_db.cc b/sql/sql_db.cc index a5dabc8140c..34ce1701424 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -272,7 +272,7 @@ static bool write_db_opt(THD *thd, const char *path, HA_CREATE_INFO *create) if ((file=my_create(path, CREATE_MODE,O_RDWR | O_TRUNC,MYF(MY_WME))) >= 0) { ulong length; - length= (ulong) (strxnmov(buf, sizeof(buf), "default-character-set=", + length= (ulong) (strxnmov(buf, sizeof(buf)-1, "default-character-set=", create->default_table_charset->csname, "\ndefault-collation=", create->default_table_charset->name, @@ -1163,8 +1163,17 @@ bool mysql_change_db(THD *thd, const char *name, bool no_access_check) } end: x_free(thd->db); - thd->db=dbname; // THD::~THD will free this - thd->db_length=db_length; + if (dbname && dbname[0] == 0) + { + x_free(dbname); + thd->db= NULL; + thd->db_length= 0; + } + else + { + thd->db= dbname; // THD::~THD will free this + thd->db_length= db_length; + } #ifndef NO_EMBEDDED_ACCESS_CHECKS if (!no_access_check) sctx->db_access= db_access; diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 816aba25218..d5543ac4e06 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -814,29 +814,31 @@ bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok) { HA_CREATE_INFO create_info; char path[FN_REFLEN]; - TABLE **table_ptr; + TABLE *table; bool error; DBUG_ENTER("mysql_truncate"); bzero((char*) &create_info,sizeof(create_info)); /* If it is a temporary table, close and regenerate it */ - if (!dont_send_ok && (table_ptr=find_temporary_table(thd,table_list->db, - table_list->table_name))) + if (!dont_send_ok && (table= find_temporary_table(thd, table_list))) { - TABLE *table= *table_ptr; - table->file->info(HA_STATUS_AUTO | HA_STATUS_NO_LOCK); db_type table_type= table->s->db_type; + TABLE_SHARE *share= table->s; if (!ha_check_storage_engine_flag(table_type, HTON_CAN_RECREATE)) goto trunc_by_del; - strmov(path, table->s->path); - *table_ptr= table->next; // Unlink table from list - close_temporary(table,0); - *fn_ext(path)=0; // Remove the .frm extension - ha_create_table(path, &create_info,1); + + table->file->info(HA_STATUS_AUTO | HA_STATUS_NO_LOCK); + + close_temporary_table(thd, table, 0, 0); // Don't free share + ha_create_table(thd, share->normalized_path.str, + share->db.str, share->table_name.str, &create_info, 1); // We don't need to call invalidate() because this table is not in cache - if ((error= (int) !(open_temporary_table(thd, path, table_list->db, - table_list->table_name, 1)))) + if ((error= (int) !(open_temporary_table(thd, share->path.str, + share->db.str, + share->table_name.str, 1)))) (void) rm_temporary_table(table_type, path); + free_table_share(share); + my_free((char*) table,MYF(0)); /* If we return here we will not have logged the truncation to the bin log and we will not send_ok() to the client. @@ -866,7 +868,8 @@ bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok) } *fn_ext(path)=0; // Remove the .frm extension - error= ha_create_table(path,&create_info,1); + error= ha_create_table(thd, path, table_list->db, table_list->table_name, + &create_info, 1); query_cache_invalidate3(thd, table_list, 0); end: @@ -895,7 +898,7 @@ end: } DBUG_RETURN(error); - trunc_by_del: +trunc_by_del: /* Probably InnoDB table */ ulong save_options= thd->options; table_list->lock_type= TL_WRITE; diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index e1817985cbd..5a9871c07c5 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -179,8 +179,8 @@ exit: } orig_table_list->derived_result= derived_result; orig_table_list->table= table; - orig_table_list->table_name= (char*) table->s->table_name; - orig_table_list->table_name_length= strlen((char*)table->s->table_name); + orig_table_list->table_name= table->s->table_name.str; + orig_table_list->table_name_length= table->s->table_name.length; table->derived_select_number= first_select->select_number; table->s->tmp_table= TMP_TABLE; #ifndef NO_EMBEDDED_ACCESS_CHECKS diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index 5f065e2a8b8..6418f844dbe 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -336,6 +336,7 @@ bool mysql_ha_read(THD *thd, TABLE_LIST *tables, ha_rows select_limit_cnt, ha_rows offset_limit_cnt) { TABLE_LIST *hash_tables; + TABLE **table_ptr; TABLE *table; MYSQL_LOCK *lock; List list; @@ -368,6 +369,28 @@ bool mysql_ha_read(THD *thd, TABLE_LIST *tables, DBUG_PRINT("info-in-hash",("'%s'.'%s' as '%s' tab %p", hash_tables->db, hash_tables->table_name, hash_tables->alias, table)); + /* Table might have been flushed. */ + if (table && (table->s->version != refresh_version)) + { + /* + We must follow the thd->handler_tables chain, as we need the + address of the 'next' pointer referencing this table + for close_thread_table(). + */ + for (table_ptr= &(thd->handler_tables); + *table_ptr && (*table_ptr != table); + table_ptr= &(*table_ptr)->next) + {} + (*table_ptr)->file->ha_index_or_rnd_end(); + VOID(pthread_mutex_lock(&LOCK_open)); + if (close_thread_table(thd, table_ptr)) + { + /* Tell threads waiting for refresh that something has happened */ + VOID(pthread_cond_broadcast(&COND_refresh)); + } + VOID(pthread_mutex_unlock(&LOCK_open)); + table= hash_tables->table= NULL; + } if (!table) { /* @@ -401,7 +424,8 @@ bool mysql_ha_read(THD *thd, TABLE_LIST *tables, #if MYSQL_VERSION_ID < 40100 char buff[MAX_DBKEY_LENGTH]; if (*tables->db) - strxnmov(buff, sizeof(buff), tables->db, ".", tables->table_name, NullS); + strxnmov(buff, sizeof(buff)-1, tables->db, ".", tables->table_name, + NullS); else strncpy(buff, tables->alias, sizeof(buff)); my_error(ER_UNKNOWN_TABLE, MYF(0), buff, "HANDLER"); @@ -594,6 +618,7 @@ err0: MYSQL_HA_REOPEN_ON_USAGE mark for reopen. MYSQL_HA_FLUSH_ALL flush all tables, not only those marked for flush. + is_locked If LOCK_open is locked. DESCRIPTION The list of HANDLER tables may be NULL, in which case all HANDLER @@ -601,7 +626,6 @@ err0: If 'tables' is NULL and MYSQL_HA_FLUSH_ALL is not set, all HANDLER tables marked for flush are closed. Broadcasts a COND_refresh condition, for every table closed. - The caller must lock LOCK_open. NOTE Since mysql_ha_flush() is called when the base table has to be closed, @@ -611,10 +635,12 @@ err0: 0 ok */ -int mysql_ha_flush(THD *thd, TABLE_LIST *tables, uint mode_flags) +int mysql_ha_flush(THD *thd, TABLE_LIST *tables, uint mode_flags, + bool is_locked) { TABLE_LIST *tmp_tables; TABLE **table_ptr; + bool did_lock= FALSE; DBUG_ENTER("mysql_ha_flush"); DBUG_PRINT("enter", ("tables: %p mode_flags: 0x%02x", tables, mode_flags)); @@ -631,15 +657,22 @@ int mysql_ha_flush(THD *thd, TABLE_LIST *tables, uint mode_flags) while (*table_ptr) { if ((!*tmp_tables->db || - !my_strcasecmp(&my_charset_latin1, (*table_ptr)->s->db, + !my_strcasecmp(&my_charset_latin1, (*table_ptr)->s->db.str, tmp_tables->db)) && - ! my_strcasecmp(&my_charset_latin1, (*table_ptr)->s->table_name, + ! my_strcasecmp(&my_charset_latin1, + (*table_ptr)->s->table_name.str, tmp_tables->table_name)) { DBUG_PRINT("info",("*table_ptr '%s'.'%s' as '%s'", - (*table_ptr)->s->db, - (*table_ptr)->s->table_name, + (*table_ptr)->s->db.str, + (*table_ptr)->s->table_name.str, (*table_ptr)->alias)); + /* The first time it is required, lock for close_thread_table(). */ + if (! did_lock && ! is_locked) + { + VOID(pthread_mutex_lock(&LOCK_open)); + did_lock= TRUE; + } mysql_ha_flush_table(thd, table_ptr, mode_flags); continue; } @@ -658,6 +691,12 @@ int mysql_ha_flush(THD *thd, TABLE_LIST *tables, uint mode_flags) if ((mode_flags & MYSQL_HA_FLUSH_ALL) || ((*table_ptr)->s->version != refresh_version)) { + /* The first time it is required, lock for close_thread_table(). */ + if (! did_lock && ! is_locked) + { + VOID(pthread_mutex_lock(&LOCK_open)); + did_lock= TRUE; + } mysql_ha_flush_table(thd, table_ptr, mode_flags); continue; } @@ -665,6 +704,10 @@ int mysql_ha_flush(THD *thd, TABLE_LIST *tables, uint mode_flags) } } + /* Release the lock if it was taken by this function. */ + if (did_lock) + VOID(pthread_mutex_unlock(&LOCK_open)); + DBUG_RETURN(0); } @@ -692,12 +735,12 @@ static int mysql_ha_flush_table(THD *thd, TABLE **table_ptr, uint mode_flags) TABLE *table= *table_ptr; DBUG_ENTER("mysql_ha_flush_table"); DBUG_PRINT("enter",("'%s'.'%s' as '%s' flags: 0x%02x", - table->s->db, table->s->table_name, + table->s->db.str, table->s->table_name.str, table->alias, mode_flags)); if ((hash_tables= (TABLE_LIST*) hash_search(&thd->handler_tables_hash, - (byte*) (*table_ptr)->alias, - strlen((*table_ptr)->alias) + 1))) + (byte*) table->alias, + strlen(table->alias) + 1))) { if (! (mode_flags & MYSQL_HA_REOPEN_ON_USAGE)) { @@ -711,7 +754,9 @@ static int mysql_ha_flush_table(THD *thd, TABLE **table_ptr, uint mode_flags) } } + safe_mutex_assert_owner(&LOCK_open); (*table_ptr)->file->ha_index_or_rnd_end(); + safe_mutex_assert_owner(&LOCK_open); if (close_thread_table(thd, table_ptr)) { /* Tell threads waiting for refresh that something has happened */ diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 8877cc17bf0..85c8fad40d4 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -96,7 +96,7 @@ static int check_insert_fields(THD *thd, TABLE_LIST *table_list, Field_iterator_table fields; fields.set_table(table); if (check_grant_all_columns(thd, INSERT_ACL, &table->grant, - table->s->db, table->s->table_name, + table->s->db.str, table->s->table_name.str, &fields)) return -1; } @@ -700,7 +700,7 @@ static bool check_view_insertability(THD * thd, TABLE_LIST *view) *trans_end= trans_start + num; Field_translator *trans; Field **field_ptr= table->field; - uint used_fields_buff_size= (table->s->fields + 7) / 8; + uint used_fields_buff_size= bitmap_buffer_size(table->s->fields); uint32 *used_fields_buff= (uint32*)thd->alloc(used_fields_buff_size); MY_BITMAP used_fields; DBUG_ENTER("check_key_in_view"); @@ -710,7 +710,7 @@ static bool check_view_insertability(THD * thd, TABLE_LIST *view) DBUG_ASSERT(view->table != 0 && view->field_translation != 0); - bitmap_init(&used_fields, used_fields_buff, used_fields_buff_size * 8, 0); + bitmap_init(&used_fields, used_fields_buff, table->s->fields, 0); bitmap_clear_all(&used_fields); view->contain_auto_increment= 0; @@ -1357,8 +1357,8 @@ delayed_insert *find_handler(THD *thd, TABLE_LIST *table_list) delayed_insert *tmp; while ((tmp=it++)) { - if (!strcmp(tmp->thd.db,table_list->db) && - !strcmp(table_list->table_name,tmp->table->s->table_name)) + if (!strcmp(tmp->thd.db, table_list->db) && + !strcmp(table_list->table_name, tmp->table->s->table_name.str)) { tmp->lock(); break; @@ -1511,6 +1511,7 @@ TABLE *delayed_insert::get_local_table(THD* client_thd) my_ptrdiff_t adjust_ptrs; Field **field,**org_field, *found_next_number_field; TABLE *copy; + TABLE_SHARE *share= table->s; /* First request insert thread to get a lock */ status=1; @@ -1536,19 +1537,16 @@ TABLE *delayed_insert::get_local_table(THD* client_thd) client_thd->proc_info="allocating local table"; copy= (TABLE*) client_thd->alloc(sizeof(*copy)+ - (table->s->fields+1)*sizeof(Field**)+ - table->s->reclength); + (share->fields+1)*sizeof(Field**)+ + share->reclength); if (!copy) goto error; *copy= *table; - copy->s= ©->share_not_to_be_used; - // No name hashing - bzero((char*) ©->s->name_hash,sizeof(copy->s->name_hash)); - /* We don't need to change the file handler here */ + /* We don't need to change the file handler here */ field=copy->field=(Field**) (copy+1); - copy->record[0]=(byte*) (field+table->s->fields+1); - memcpy((char*) copy->record[0],(char*) table->record[0],table->s->reclength); + copy->record[0]=(byte*) (field+share->fields+1); + memcpy((char*) copy->record[0],(char*) table->record[0],share->reclength); /* Make a copy of all fields */ @@ -1560,7 +1558,7 @@ TABLE *delayed_insert::get_local_table(THD* client_thd) if (!(*field= (*org_field)->new_field(client_thd->mem_root,copy))) return 0; (*field)->orig_table= copy; // Remove connection - (*field)->move_field(adjust_ptrs); // Point at copy->record[0] + (*field)->move_field_offset(adjust_ptrs); // Point at copy->record[0] if (*org_field == found_next_number_field) (*field)->table->found_next_number_field= *field; } @@ -1571,13 +1569,11 @@ TABLE *delayed_insert::get_local_table(THD* client_thd) { /* Restore offset as this may have been reset in handle_inserts */ copy->timestamp_field= - (Field_timestamp*) copy->field[table->s->timestamp_field_offset]; + (Field_timestamp*) copy->field[share->timestamp_field_offset]; copy->timestamp_field->unireg_check= table->timestamp_field->unireg_check; copy->timestamp_field_type= copy->timestamp_field->get_auto_set_type(); } - /* _rowid is not used with delayed insert */ - copy->rowid_field=0; /* Adjust in_use for pointing to client thread */ copy->in_use= client_thd; @@ -1595,8 +1591,9 @@ TABLE *delayed_insert::get_local_table(THD* client_thd) /* Put a question in queue */ -static int write_delayed(THD *thd,TABLE *table,enum_duplicates duplic, bool ignore, - char *query, uint query_length, bool log_on) +static int write_delayed(THD *thd,TABLE *table,enum_duplicates duplic, + bool ignore, char *query, uint query_length, + bool log_on) { delayed_row *row=0; delayed_insert *di=thd->di; @@ -1736,6 +1733,7 @@ pthread_handler_t handle_delayed_insert(void *arg) #endif DBUG_ENTER("handle_delayed_insert"); + thd->thread_stack= (char*) &thd; if (init_thr_lock() || thd->store_globals()) { thd->fatal_error(); @@ -1958,7 +1956,7 @@ bool delayed_insert::handle_inserts(void) if (thr_upgrade_write_delay_lock(*thd.lock->locks)) { /* This can only happen if thread is killed by shutdown */ - sql_print_error(ER(ER_DELAYED_CANT_CHANGE_LOCK),table->s->table_name); + sql_print_error(ER(ER_DELAYED_CANT_CHANGE_LOCK),table->s->table_name.str); goto err; } @@ -2051,7 +2049,8 @@ bool delayed_insert::handle_inserts(void) if (thr_reschedule_write_lock(*thd.lock->locks)) { /* This should never happen */ - sql_print_error(ER(ER_DELAYED_CANT_CHANGE_LOCK),table->s->table_name); + sql_print_error(ER(ER_DELAYED_CANT_CHANGE_LOCK), + table->s->table_name.str); } if (!using_bin_log) table->file->extra(HA_EXTRA_WRITE_CACHE); @@ -2590,6 +2589,7 @@ void select_create::abort() if (!table->s->tmp_table) { ulong version= table->s->version; + table->s->version= 0; hash_delete(&open_cache,(byte*) table); if (!create_info->table_existed) quick_rm_table(table_type, create_table->db, create_table->table_name); @@ -2598,8 +2598,8 @@ void select_create::abort() VOID(pthread_cond_broadcast(&COND_refresh)); } else if (!create_info->table_existed) - close_temporary_table(thd, create_table->db, create_table->table_name); - table=0; + close_temporary_table(thd, table, 1, 1); + table=0; // Safety } VOID(pthread_mutex_unlock(&LOCK_open)); } diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 7461d3af6be..4d32e26f1b7 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -110,7 +110,7 @@ void lex_free(void) (We already do too much here) */ -void lex_start(THD *thd, uchar *buf,uint length) +void lex_start(THD *thd, const uchar *buf, uint length) { LEX *lex= thd->lex; DBUG_ENTER("lex_start"); @@ -196,9 +196,9 @@ void lex_end(LEX *lex) static int find_keyword(LEX *lex, uint len, bool function) { - uchar *tok=lex->tok_start; + const uchar *tok=lex->tok_start; - SYMBOL *symbol = get_hash_symbol((const char *)tok,len,function); + SYMBOL *symbol= get_hash_symbol((const char *)tok,len,function); if (symbol) { lex->yylval->symbol.symbol=symbol; @@ -256,15 +256,16 @@ static LEX_STRING get_token(LEX *lex,uint length) static LEX_STRING get_quoted_token(LEX *lex,uint length, char quote) { LEX_STRING tmp; - byte *from, *to, *end; + const uchar *from, *end; + uchar *to; yyUnget(); // ptr points now after last token char tmp.length=lex->yytoklen=length; tmp.str=(char*) lex->thd->alloc(tmp.length+1); - for (from= (byte*) lex->tok_start, to= (byte*) tmp.str, end= to+length ; + for (from= lex->tok_start, to= (uchar*) tmp.str, end= to+length ; to != end ; ) { - if ((*to++= *from++) == quote) + if ((*to++= *from++) == (uchar) quote) from++; // Skip double quotes } *to= 0; // End null for safety @@ -284,7 +285,6 @@ static char *get_text(LEX *lex) CHARSET_INFO *cs= lex->thd->charset(); sep= yyGetLast(); // String should end with this - //lex->tok_start=lex->ptr-1; // Remember ' while (lex->ptr != lex->end_of_query) { c = yyGet(); @@ -328,7 +328,8 @@ static char *get_text(LEX *lex) yyUnget(); /* Found end. Unescape and return string */ - uchar *str,*end,*start; + const uchar *str, *end; + uchar *start; str=lex->tok_start+1; end=lex->ptr-1; @@ -612,7 +613,7 @@ int yylex(void *arg, void *yythd) break; } case MY_LEX_IDENT: - uchar *start; + const uchar *start; #if defined(USE_MB) && defined(USE_MB_IDENT) if (use_mb(cs)) { @@ -1528,9 +1529,9 @@ void st_select_lex_unit::print(String *str) { if (sl != first_select()) { - str->append(" union ", 7); + str->append(STRING_WITH_LEN(" union ")); if (union_all) - str->append("all ", 4); + str->append(STRING_WITH_LEN("all ")); else if (union_distinct == sl) union_all= TRUE; } @@ -1544,7 +1545,7 @@ void st_select_lex_unit::print(String *str) { if (fake_select_lex->order_list.elements) { - str->append(" order by ", 10); + str->append(STRING_WITH_LEN(" order by ")); fake_select_lex->print_order(str, (ORDER *) fake_select_lex-> order_list.first); @@ -1567,7 +1568,7 @@ void st_select_lex::print_order(String *str, ORDER *order) else (*order->item)->print(str); if (!order->asc) - str->append(" desc", 5); + str->append(STRING_WITH_LEN(" desc")); if (order->next) str->append(','); } @@ -1590,7 +1591,7 @@ void st_select_lex::print_limit(THD *thd, String *str) if (explicit_limit) { - str->append(" limit ", 7); + str->append(STRING_WITH_LEN(" limit ")); if (offset_limit) { offset_limit->print(str); @@ -2039,6 +2040,35 @@ void st_lex::cleanup_after_one_table_open() } +/* + Do end-of-prepare fixup for list of tables and their merge-VIEWed tables + + SYNOPSIS + fix_prepare_info_in_table_list() + thd Thread handle + tbl List of tables to process + + DESCRIPTION + Perform end-end-of prepare fixup for list of tables, if any of the tables + is a merge-algorithm VIEW, recursively fix up its underlying tables as + well. + +*/ + +static void fix_prepare_info_in_table_list(THD *thd, TABLE_LIST *tbl) +{ + for (; tbl; tbl= tbl->next_local) + { + if (tbl->on_expr) + { + tbl->prep_on_expr= tbl->on_expr; + tbl->on_expr= tbl->on_expr->copy_andor_structure(thd); + } + fix_prepare_info_in_table_list(thd, tbl->merge_underlying_list); + } +} + + /* fix some structures at the end of preparation @@ -2058,16 +2088,7 @@ void st_select_lex::fix_prepare_information(THD *thd, Item **conds) prep_where= *conds; *conds= where= prep_where->copy_andor_structure(thd); } - for (TABLE_LIST *tbl= (TABLE_LIST *)table_list.first; - tbl; - tbl= tbl->next_local) - { - if (tbl->on_expr) - { - tbl->prep_on_expr= tbl->on_expr; - tbl->on_expr= tbl->on_expr->copy_andor_structure(thd); - } - } + fix_prepare_info_in_table_list(thd, (TABLE_LIST *)table_list.first); } } diff --git a/sql/sql_lex.h b/sql/sql_lex.h index b82ac754e26..d7ad28a95f5 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -91,7 +91,9 @@ enum enum_sql_command { SQLCOM_CREATE_TRIGGER, SQLCOM_DROP_TRIGGER, SQLCOM_XA_START, SQLCOM_XA_END, SQLCOM_XA_PREPARE, SQLCOM_XA_COMMIT, SQLCOM_XA_ROLLBACK, SQLCOM_XA_RECOVER, + SQLCOM_SHOW_PROC_CODE, SQLCOM_SHOW_FUNC_CODE, SQLCOM_INSTALL_PLUGIN, SQLCOM_UNINSTALL_PLUGIN, + SQLCOM_SHOW_AUTHORS, /* This should be the last !!! */ SQLCOM_END @@ -457,7 +459,7 @@ public: void set_limit(st_select_lex *values); void set_thd(THD *thd_arg) { thd= thd_arg; } - friend void lex_start(THD *thd, uchar *buf, uint length); + friend void lex_start(THD *thd, const uchar *buf, uint length); friend int subselect_union_engine::exec(); List *get_unit_column_types(); @@ -624,7 +626,7 @@ public: void cut_subtree() { slave= 0; } bool test_limit(); - friend void lex_start(THD *thd, uchar *buf, uint length); + friend void lex_start(THD *thd, const uchar *buf, uint length); st_select_lex() {} void make_empty_select() { @@ -720,11 +722,11 @@ typedef struct st_lex SELECT_LEX *current_select; /* list of all SELECT_LEX */ SELECT_LEX *all_selects_list; - uchar *buf; /* The beginning of string, used by SPs */ - uchar *ptr,*tok_start,*tok_end,*end_of_query; + const uchar *buf; /* The beginning of string, used by SPs */ + const uchar *ptr,*tok_start,*tok_end,*end_of_query; /* The values of tok_start/tok_end as they were one call of yylex before */ - uchar *tok_start_prev, *tok_end_prev; + const uchar *tok_start_prev, *tok_end_prev; char *length,*dec,*change,*name; char *help_arg; @@ -752,12 +754,17 @@ typedef struct st_lex TABLE_LIST **query_tables_last; /* store original leaf_tables for INSERT SELECT and PS/SP */ TABLE_LIST *leaf_tables_insert; - st_lex_user *create_view_definer; char *create_view_start; char *create_view_select_start; /* Partition info structure filled in by PARTITION BY parse part */ partition_info *part_info; + /* + The definer of the object being created (view, trigger, stored routine). + I.e. the value of DEFINER clause. + */ + LEX_USER *definer; + List col_list; List ref_list; List interval_list; @@ -904,6 +911,14 @@ typedef struct st_lex */ SQL_LIST trg_table_fields; + /* + trigger_definition_begin points to the beginning of the word "TRIGGER" in + CREATE TRIGGER statement. This is used to add possibly omitted DEFINER + clause to the trigger definition statement before dumping it to the + binlog. + */ + const char *trigger_definition_begin; + /* If non-0 then indicates that query requires prelocking and points to next_global member of last own element in query table list (i.e. last @@ -916,7 +931,7 @@ typedef struct st_lex Pointers to part of LOAD DATA statement that should be rewritten during replication ("LOCAL 'filename' REPLACE INTO" part). */ - uchar *fname_start, *fname_end; + const uchar *fname_start, *fname_end; bool escape_used; @@ -1043,7 +1058,7 @@ struct st_lex_local: public st_lex extern void lex_init(void); extern void lex_free(void); -extern void lex_start(THD *thd, uchar *buf,uint length); +extern void lex_start(THD *thd, const uchar *buf, uint length); extern void lex_end(LEX *lex); extern int yylex(void *arg, void *yythd); diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 44ddf11757a..09bcb9cb9fe 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -286,7 +286,7 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, #endif if (!dirname_length(ex->file_name)) { - strxnmov(name, FN_REFLEN, mysql_real_data_home, tdb, NullS); + strxnmov(name, FN_REFLEN-1, mysql_real_data_home, tdb, NullS); (void) fn_format(name, ex->file_name, name, "", MY_RELATIVE_PATH | MY_UNPACK_FILENAME); } @@ -691,7 +691,8 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list, length=(uint) (read_info.row_end-pos); if (!read_info.enclosed && - (enclosed_length && length == 4 && !memcmp(pos,"NULL",4)) || + (enclosed_length && length == 4 && + !memcmp(pos, STRING_WITH_LEN("NULL"))) || (length == 1 && read_info.found_null)) { if (item->type() == Item::FIELD_ITEM) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 9b3b7ffad69..f6e94c118af 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -182,12 +182,24 @@ static bool begin_trans(THD *thd) */ inline bool all_tables_not_ok(THD *thd, TABLE_LIST *tables) { - return rpl_filter->is_on() && tables && + return rpl_filter->is_on() && tables && !thd->spcont && !rpl_filter->tables_ok(thd->db, tables); } #endif +static bool some_non_temp_table_to_be_updated(THD *thd, TABLE_LIST *tables) +{ + for (TABLE_LIST *table= tables; table; table= table->next_global) + { + DBUG_ASSERT(table->db && table->table_name); + if (table->updating && + !find_temporary_table(thd, table->db, table->table_name)) + return 1; + } + return 0; +} + static HASH hash_user_connections; static int get_or_create_user_conn(THD *thd, const char *user, @@ -1079,6 +1091,7 @@ pthread_handler_t handle_one_connection(void *arg) VOID(sigemptyset(&set)); // Get mask in use VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals)); #endif + thd->thread_stack= (char*) &thd; if (thd->store_globals()) { close_connection(thd, ER_OUT_OF_RESOURCES, 1); @@ -1092,7 +1105,6 @@ pthread_handler_t handle_one_connection(void *arg) int error; NET *net= &thd->net; Security_context *sctx= thd->security_ctx; - thd->thread_stack= (char*) &thd; net->no_send_error= 0; if ((error=check_connection(thd))) @@ -1164,6 +1176,7 @@ end_thread: or this thread has been schedule to handle the next query */ thd= current_thd; + thd->thread_stack= (char*) &thd; } while (!(test_flags & TEST_NO_THREADS)); /* The following is only executed if we are not using --one-thread */ return(0); /* purecov: deadcode */ @@ -1183,6 +1196,7 @@ pthread_handler_t handle_bootstrap(void *arg) char *buff; /* The following must be called before DBUG_ENTER */ + thd->thread_stack= (char*) &thd; if (my_thread_init() || thd->store_globals()) { #ifndef EMBEDDED_LIBRARY @@ -1966,7 +1980,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd, uptime, (int) thread_count, (ulong) thd->query_id, (ulong) thd->status_var.long_query_count, - thd->status_var.opened_tables, refresh_version, cached_tables(), + thd->status_var.opened_tables, refresh_version, + cached_open_tables(), (uptime ? (ulonglong2double(thd->query_id) / (double) uptime) : (double) 0)); #ifdef SAFEMALLOC @@ -2360,7 +2375,7 @@ mysql_execute_command(THD *thd) mysql_reset_errors(thd, 0); #ifdef HAVE_REPLICATION - if (thd->slave_thread) + if (unlikely(thd->slave_thread)) { /* Check if statment should be skipped because of slave filtering @@ -2386,29 +2401,21 @@ mysql_execute_command(THD *thd) reset_one_shot_variables(thd); DBUG_RETURN(0); } -#ifndef TO_BE_DELETED - /* - This is a workaround to deal with the shortcoming in 3.23.44-3.23.46 - masters in RELEASE_LOCK() logging. We re-write SELECT RELEASE_LOCK() - as DO RELEASE_LOCK() - */ - if (lex->sql_command == SQLCOM_SELECT) - { - lex->sql_command = SQLCOM_DO; - lex->insert_list = &select_lex->item_list; - } -#endif } + else #endif /* HAVE_REPLICATION */ /* - When option readonly is set deny operations which change tables. - Except for the replication thread and the 'super' users. + When option readonly is set deny operations which change non-temporary + tables. Except for the replication thread and the 'super' users. */ if (opt_readonly && - !(thd->slave_thread || - (thd->security_ctx->master_access & SUPER_ACL)) && - uc_update_queries[lex->sql_command]) + !(thd->security_ctx->master_access & SUPER_ACL) && + uc_update_queries[lex->sql_command] && + !((lex->sql_command == SQLCOM_CREATE_TABLE) && + (lex->create_info.options & HA_LEX_CREATE_TMP_TABLE)) && + ((lex->sql_command != SQLCOM_UPDATE_MULTI) && + some_non_temp_table_to_be_updated(thd, all_tables))) { my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--read-only"); DBUG_RETURN(-1); @@ -3198,13 +3205,24 @@ end_with_restore_list: #ifdef HAVE_REPLICATION /* Check slave filtering rules */ - if (thd->slave_thread && all_tables_not_ok(thd, all_tables)) + if (unlikely(thd->slave_thread)) { - /* we warn the slave SQL thread */ - my_error(ER_SLAVE_IGNORED_TABLE, MYF(0)); + if (all_tables_not_ok(thd, all_tables)) + { + /* we warn the slave SQL thread */ + my_error(ER_SLAVE_IGNORED_TABLE, MYF(0)); + break; + } + } + else +#endif /* HAVE_REPLICATION */ + if (opt_readonly && + !(thd->security_ctx->master_access & SUPER_ACL) && + some_non_temp_table_to_be_updated(thd, all_tables)) + { + my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--read-only"); break; } -#endif /* HAVE_REPLICATION */ res= mysql_multi_update(thd, all_tables, &select_lex->item_list, @@ -3409,6 +3427,9 @@ end_with_restore_list: case SQLCOM_SHOW_STORAGE_ENGINES: res= mysqld_show_storage_engines(thd); break; + case SQLCOM_SHOW_AUTHORS: + res= mysqld_show_authors(thd); + break; case SQLCOM_SHOW_PRIVILEGES: res= mysqld_show_privileges(thd); break; @@ -3643,8 +3664,6 @@ end_with_restore_list: my_error(ER_WRONG_DB_NAME, MYF(0), lex->name); break; } - if (check_access(thd,SELECT_ACL,lex->name,0,1,0,is_schema_db(lex->name))) - break; res=mysqld_show_create_db(thd,lex->name,&lex->create_info); break; } @@ -3653,7 +3672,8 @@ end_with_restore_list: if (check_access(thd,INSERT_ACL,"mysql",0,1,0,0)) break; #ifdef HAVE_DLOPEN - if (sp_find_function(thd, lex->spname)) + if (sp_find_routine(thd, TYPE_ENUM_FUNCTION, lex->spname, + &thd->sp_func_cache, FALSE)) { my_error(ER_UDF_EXISTS, MYF(0), lex->spname->m_name.str); goto error; @@ -4004,8 +4024,8 @@ end_with_restore_list: break; } case SQLCOM_SAVEPOINT: - if (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) || - !opt_using_transactions) + if (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN) || + thd->in_sub_stmt) || !opt_using_transactions) send_ok(thd); else { @@ -4058,7 +4078,7 @@ end_with_restore_list: if (!lex->sphead->m_db.str || !lex->sphead->m_db.str[0]) { - if (! thd->db) + if (!thd->db) { my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR), MYF(0)); delete lex->sphead; @@ -4187,7 +4207,8 @@ end_with_restore_list: By this moment all needed SPs should be in cache so no need to look into DB. */ - if (!(sp= sp_find_procedure(thd, lex->spname, TRUE))) + if (!(sp= sp_find_routine(thd, TYPE_ENUM_PROCEDURE, lex->spname, + &thd->sp_proc_cache, TRUE))) { my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "PROCEDURE", lex->spname->m_qname.str); @@ -4277,18 +4298,6 @@ end_with_restore_list: So just execute the statement. */ res= sp->execute_procedure(thd, &lex->value_list); - if (mysql_bin_log.is_open() && - (sp->m_chistics->daccess == SP_CONTAINS_SQL || - sp->m_chistics->daccess == SP_MODIFIES_SQL_DATA)) - { - if (res) - push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_FAILED_ROUTINE_BREAK_BINLOG, - ER(ER_FAILED_ROUTINE_BREAK_BINLOG)); - else - thd->clear_error(); - } - /* If warnings have been cleared, we have to clear total_warn_count too, otherwise the clients get confused. @@ -4323,9 +4332,11 @@ end_with_restore_list: memcpy(&chistics, &lex->sp_chistics, sizeof(chistics)); if (lex->sql_command == SQLCOM_ALTER_PROCEDURE) - sp= sp_find_procedure(thd, lex->spname); + sp= sp_find_routine(thd, TYPE_ENUM_PROCEDURE, lex->spname, + &thd->sp_proc_cache, FALSE); else - sp= sp_find_function(thd, lex->spname); + sp= sp_find_routine(thd, TYPE_ENUM_FUNCTION, lex->spname, + &thd->sp_func_cache, FALSE); mysql_reset_errors(thd, 0); if (! sp) { @@ -4347,7 +4358,8 @@ end_with_restore_list: if (end_active_trans(thd)) goto error; memcpy(&lex->sp_chistics, &chistics, sizeof(lex->sp_chistics)); - if (!trust_routine_creators && mysql_bin_log.is_open() && + if ((sp->m_type == TYPE_ENUM_FUNCTION) && + !trust_function_creators && mysql_bin_log.is_open() && !sp->m_chistics->detistic && (chistics.daccess == SP_CONTAINS_SQL || chistics.daccess == SP_MODIFIES_SQL_DATA)) @@ -4358,6 +4370,12 @@ end_with_restore_list: } else { + /* + Note that if you implement the capability of ALTER FUNCTION to + alter the body of the function, this command should be made to + follow the restrictions that log-bin-trust-function-creators=0 + already puts on CREATE FUNCTION. + */ if (lex->sql_command == SQLCOM_ALTER_PROCEDURE) result= sp_update_procedure(thd, lex->spname, &lex->sp_chistics); else @@ -4394,9 +4412,11 @@ end_with_restore_list: char *db, *name; if (lex->sql_command == SQLCOM_DROP_PROCEDURE) - sp= sp_find_procedure(thd, lex->spname); + sp= sp_find_routine(thd, TYPE_ENUM_PROCEDURE, lex->spname, + &thd->sp_proc_cache, FALSE); else - sp= sp_find_function(thd, lex->spname); + sp= sp_find_routine(thd, TYPE_ENUM_FUNCTION, lex->spname, + &thd->sp_func_cache, FALSE); mysql_reset_errors(thd, 0); if (sp) { @@ -4524,6 +4544,33 @@ end_with_restore_list: lex->wild->ptr() : NullS)); break; } +#ifndef DBUG_OFF + case SQLCOM_SHOW_PROC_CODE: + case SQLCOM_SHOW_FUNC_CODE: + { + sp_head *sp; + + if (lex->spname->m_name.length > NAME_LEN) + { + my_error(ER_TOO_LONG_IDENT, MYF(0), lex->spname->m_name.str); + goto error; + } + if (lex->sql_command == SQLCOM_SHOW_PROC_CODE) + sp= sp_find_routine(thd, TYPE_ENUM_PROCEDURE, lex->spname, + &thd->sp_proc_cache, FALSE); + else + sp= sp_find_routine(thd, TYPE_ENUM_FUNCTION, lex->spname, + &thd->sp_func_cache, FALSE); + if (!sp || !sp->show_routine_code(thd)) + { + /* We don't distinguish between errors for now */ + my_error(ER_SP_DOES_NOT_EXIST, MYF(0), + SP_COM_STRING(lex), lex->spname->m_name.str); + goto error; + } + break; + } +#endif // ifndef DBUG_OFF case SQLCOM_CREATE_VIEW: { if (end_active_trans(thd)) @@ -4542,7 +4589,7 @@ end_with_restore_list: buff.append(command[thd->lex->create_view_mode].str, command[thd->lex->create_view_mode].length); view_store_options(thd, first_table, &buff); - buff.append("VIEW ", 5); + buff.append(STRING_WITH_LEN("VIEW ")); /* Test if user supplied a db (ie: we did not use thd->db) */ if (first_table->db != thd->db && first_table->db[0]) { @@ -4552,7 +4599,7 @@ end_with_restore_list: } append_identifier(thd, &buff, first_table->table_name, first_table->table_name_length); - buff.append(" AS ", 4); + buff.append(STRING_WITH_LEN(" AS ")); buff.append(first_table->source.str, first_table->source.length); Query_log_event qinfo(thd, buff.ptr(), buff.length(), 0, FALSE); @@ -4795,11 +4842,15 @@ end_with_restore_list: /* - The return value for ROW_COUNT() is "implementation dependent" if - the statement is not DELETE, INSERT or UPDATE (or a CALL executing - such a statement), but -1 is what JDBC and ODBC wants. + The return value for ROW_COUNT() is "implementation dependent" if the + statement is not DELETE, INSERT or UPDATE, but -1 is what JDBC and ODBC + wants. + + We do not change the value for a CALL or EXECUTE statement, so the value + generated by the last called (or executed) statement is preserved. */ - if (lex->sql_command != SQLCOM_CALL && uc_update_queries[lex->sql_command]<2) + if (lex->sql_command != SQLCOM_CALL && lex->sql_command != SQLCOM_EXECUTE && + uc_update_queries[lex->sql_command]<2) thd->row_count_func= -1; goto cleanup; @@ -5030,7 +5081,7 @@ check_table_access(THD *thd, ulong want_access,TABLE_LIST *tables, the given table list refers to the list for prelocking (contains tables of other queries). For simple queries first_not_own_table is 0. */ - for (; tables != first_not_own_table; tables= tables->next_global) + for (; tables && tables != first_not_own_table; tables= tables->next_global) { if (tables->schema_table && (want_access & ~(SELECT_ACL | EXTRA_ACL | FILE_ACL))) @@ -5240,6 +5291,7 @@ bool check_stack_overrun(THD *thd, long margin, char *buf __attribute__((unused))) { long stack_used; + DBUG_ASSERT(thd == current_thd); if ((stack_used=used_stack(thd->thread_stack,(char*) &stack_used)) >= (long) (thread_stack - margin)) { @@ -6156,12 +6208,16 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, if (!table) DBUG_RETURN(0); // End of memory alias_str= alias ? alias->str : table->table.str; - if (check_table_name(table->table.str,table->table.length) || - table->db.str && check_db_name(table->db.str)) + if (check_table_name(table->table.str,table->table.length)) { my_error(ER_WRONG_TABLE_NAME, MYF(0), table->table.str); DBUG_RETURN(0); } + if (table->db.str && check_db_name(table->db.str)) + { + my_error(ER_WRONG_DB_NAME, MYF(0), table->db.str); + DBUG_RETURN(0); + } if (!alias) /* Alias is case sensitive */ { @@ -6689,7 +6745,10 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables, allocate temporary THD for execution of acl_reload()/grant_reload(). */ if (!thd && (thd= (tmp_thd= new THD))) + { + thd->thread_stack= (char*) &tmp_thd; thd->store_globals(); + } if (thd) { (void)acl_reload(thd); @@ -7434,32 +7493,81 @@ Item *negate_expression(THD *thd, Item *expr) return new Item_func_not(expr); } - /* - Assign as view definer current user - + Set the specified definer to the default value, which is the current user in + the thread. Also check that the current user satisfies to the definers + requirements. + SYNOPSIS - default_view_definer() - sctx current security context - definer structure where it should be assigned - + get_default_definer() + thd [in] thread handler + definer [out] definer + RETURN - FALSE OK - TRUE Error + error status, that is: + - FALSE -- on success; + - TRUE -- on error (current user can not be a definer). */ - -bool default_view_definer(Security_context *sctx, st_lex_user *definer) + +bool get_default_definer(THD *thd, LEX_USER *definer) { - definer->user.str= sctx->priv_user; - definer->user.length= strlen(sctx->priv_user); + /* Check that current user has non-empty host name. */ - if (!*sctx->priv_host) + const Security_context *sctx= thd->security_ctx; + + if (sctx->priv_host[0] == 0) { - my_error(ER_NO_VIEW_USER, MYF(0)); + my_error(ER_MALFORMED_DEFINER, MYF(0)); return TRUE; } - definer->host.str= sctx->priv_host; - definer->host.length= strlen(sctx->priv_host); + /* Fill in. */ + + definer->user.str= (char *) sctx->priv_user; + definer->user.length= strlen(definer->user.str); + + definer->host.str= (char *) sctx->priv_host; + definer->host.length= strlen(definer->host.str); + return FALSE; } + + +/* + Create definer with the given user and host names. Also check that the user + and host names satisfy definers requirements. + + SYNOPSIS + create_definer() + thd [in] thread handler + user_name [in] user name + host_name [in] host name + + RETURN + On success, return a valid pointer to the created and initialized + LEX_STRING, which contains definer information. + On error, return 0. +*/ + +LEX_USER *create_definer(THD *thd, LEX_STRING *user_name, LEX_STRING *host_name) +{ + LEX_USER *definer; + + /* Check that specified host name is valid. */ + + if (host_name->length == 0) + { + my_error(ER_MALFORMED_DEFINER, MYF(0)); + return 0; + } + + /* Create and initialize. */ + + if (! (definer= (LEX_USER*) thd->alloc(sizeof (LEX_USER)))) + return 0; + + definer->user= *user_name; + definer->host= *host_name; + + return definer; +} diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index e57753dd0bd..dd4f2d9246a 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -20,7 +20,7 @@ used by all handlers that support partitioning, which in the first version is the partitioning handler itself and the NDB handler. - The first version was written by Mikael Ronström. + The first version was written by Mikael Ronstrom. This version supports RANGE partitioning, LIST partitioning, HASH partitioning and composite partitioning (hereafter called subpartitioning) @@ -39,6 +39,7 @@ #include "md5.h" #ifdef WITH_PARTITION_STORAGE_ENGINE +#include "ha_partition.h" /* Partition related functions declarations and some static constants; */ @@ -901,7 +902,7 @@ static bool set_up_field_array(TABLE *table, { Field **ptr, *field, **field_array; uint no_fields= 0, size_field_array, i= 0; - partition_info *part_info= table->s->part_info; + partition_info *part_info= table->part_info; int result= FALSE; DBUG_ENTER("set_up_field_array"); @@ -1276,7 +1277,7 @@ static bool check_primary_key(TABLE *table) if (primary_key < MAX_KEY) { set_indicator_in_key_fields(table->key_info+primary_key); - check_fields_in_PF(table->s->part_info->full_part_field_array, + check_fields_in_PF(table->part_info->full_part_field_array, &all_fields, &some_fields); clear_indicator_in_key_fields(table->key_info+primary_key); if (unlikely(!all_fields)) @@ -1314,7 +1315,7 @@ static bool check_unique_keys(TABLE *table) if (table->key_info[i].flags & HA_NOSAME) //Unique index { set_indicator_in_key_fields(table->key_info+i); - check_fields_in_PF(table->s->part_info->full_part_field_array, + check_fields_in_PF(table->part_info->full_part_field_array, &all_fields, &some_fields); clear_indicator_in_key_fields(table->key_info+i); if (unlikely(!all_fields)) @@ -1596,26 +1597,32 @@ static uint32 get_part_id_from_linear_hash(longlong hash_value, uint mask, } /* - This function is called as part of opening the table by opening the .frm - file. It is a part of CREATE TABLE to do this so it is quite permissible - that errors due to erroneus syntax isn't found until we come here. - If the user has used a non-existing field in the table is one such example - of an error that is not discovered until here. + fix partition functions + SYNOPSIS fix_partition_func() thd The thread object name The name of the partitioned table table TABLE object for which partition fields are set-up + RETURN VALUE TRUE FALSE + DESCRIPTION The name parameter contains the full table name and is used to get the database name of the table which is used to set-up a correct TABLE_LIST object for use in fix_fields. + +NOTES + This function is called as part of opening the table by opening the .frm + file. It is a part of CREATE TABLE to do this so it is quite permissible + that errors due to erroneus syntax isn't found until we come here. + If the user has used a non-existing field in the table is one such example + of an error that is not discovered until here. */ -bool fix_partition_func(THD *thd, const char* name, TABLE *table) +bool fix_partition_func(THD *thd, const char *name, TABLE *table) { bool result= TRUE; uint dir_length, home_dir_length; @@ -1623,19 +1630,19 @@ bool fix_partition_func(THD *thd, const char* name, TABLE *table) TABLE_SHARE *share= table->s; char db_name_string[FN_REFLEN]; char* db_name; - partition_info *part_info= share->part_info; + partition_info *part_info= table->part_info; ulong save_set_query_id= thd->set_query_id; DBUG_ENTER("fix_partition_func"); thd->set_query_id= 0; /* - Set-up the TABLE_LIST object to be a list with a single table - Set the object to zero to create NULL pointers and set alias - and real name to table name and get database name from file name. + Set-up the TABLE_LIST object to be a list with a single table + Set the object to zero to create NULL pointers and set alias + and real name to table name and get database name from file name. */ bzero((void*)&tables, sizeof(TABLE_LIST)); - tables.alias= tables.table_name= (char*)share->table_name; + tables.alias= tables.table_name= (char*) share->table_name.str; tables.table= table; tables.next_local= 0; tables.next_name_resolution_table= 0; @@ -1650,8 +1657,8 @@ bool fix_partition_func(THD *thd, const char* name, TABLE *table) { DBUG_ASSERT(part_info->subpart_type == HASH_PARTITION); /* - Subpartition is defined. We need to verify that subpartitioning - function is correct. + Subpartition is defined. We need to verify that subpartitioning + function is correct. */ if (part_info->linear_hash_ind) set_linear_hash_mask(part_info, part_info->no_subparts); @@ -1664,7 +1671,8 @@ bool fix_partition_func(THD *thd, const char* name, TABLE *table) else { if (unlikely(fix_fields_part_func(thd, &tables, - part_info->subpart_expr, part_info, TRUE))) + part_info->subpart_expr, part_info, + TRUE))) goto end; if (unlikely(part_info->subpart_expr->result_type() != INT_RESULT)) { @@ -1676,8 +1684,8 @@ bool fix_partition_func(THD *thd, const char* name, TABLE *table) } DBUG_ASSERT(part_info->part_type != NOT_A_PARTITION); /* - Partition is defined. We need to verify that partitioning - function is correct. + Partition is defined. We need to verify that partitioning + function is correct. */ if (part_info->part_type == HASH_PARTITION) { @@ -1999,6 +2007,7 @@ char *generate_partition_syntax(partition_info *part_info, File fptr; char *buf= NULL; //Return buffer const char *file_name; + sprintf(path, "%s_%lx_%lx", "part_syntax", current_pid, current_thd->thread_id); fn_format(path,path,mysql_tmpdir,".psy", MY_REPLACE_EXT); @@ -2160,7 +2169,7 @@ close_file: bool partition_key_modified(TABLE *table, List &fields) { List_iterator_fast f(fields); - partition_info *part_info= table->s->part_info; + partition_info *part_info= table->part_info; Item_field *item_field; DBUG_ENTER("partition_key_modified"); if (!part_info) @@ -2770,7 +2779,7 @@ static uint32 get_sub_part_id_from_key(const TABLE *table,byte *buf, const key_range *key_spec) { byte *rec0= table->record[0]; - partition_info *part_info= table->s->part_info; + partition_info *part_info= table->part_info; uint32 part_id; DBUG_ENTER("get_sub_part_id_from_key"); @@ -2809,7 +2818,7 @@ bool get_part_id_from_key(const TABLE *table, byte *buf, KEY *key_info, { bool result; byte *rec0= table->record[0]; - partition_info *part_info= table->s->part_info; + partition_info *part_info= table->part_info; DBUG_ENTER("get_part_id_from_key"); key_restore(buf, (byte*)key_spec->key, key_info, key_spec->length); @@ -2849,7 +2858,7 @@ void get_full_part_id_from_key(const TABLE *table, byte *buf, part_id_range *part_spec) { bool result; - partition_info *part_info= table->s->part_info; + partition_info *part_info= table->part_info; byte *rec0= table->record[0]; DBUG_ENTER("get_full_part_id_from_key"); @@ -2894,7 +2903,7 @@ void get_full_part_id_from_key(const TABLE *table, byte *buf, void get_partition_set(const TABLE *table, byte *buf, const uint index, const key_range *key_spec, part_id_range *part_spec) { - partition_info *part_info= table->s->part_info; + partition_info *part_info= table->part_info; uint no_parts= get_tot_partitions(part_info), i, part_id; uint sub_part= no_parts; uint32 part_part= no_parts; @@ -3081,14 +3090,16 @@ void get_partition_set(const TABLE *table, byte *buf, const uint index, possible to retrace this given an item tree. */ -bool mysql_unpack_partition(THD *thd, uchar *part_buf, uint part_info_len, - TABLE* table, enum db_type default_db_type) +bool mysql_unpack_partition(THD *thd, const uchar *part_buf, + uint part_info_len, TABLE* table, + enum db_type default_db_type) { Item *thd_free_list= thd->free_list; bool result= TRUE; partition_info *part_info; LEX *old_lex= thd->lex, lex; DBUG_ENTER("mysql_unpack_partition"); + thd->lex= &lex; lex_start(thd, part_buf, part_info_len); /* @@ -3116,7 +3127,8 @@ bool mysql_unpack_partition(THD *thd, uchar *part_buf, uint part_info_len, goto end; } part_info= lex.part_info; - table->s->part_info= part_info; + table->part_info= part_info; + table->file->set_part_info(part_info); if (part_info->default_engine_type == DB_TYPE_UNKNOWN) part_info->default_engine_type= default_db_type; else @@ -3138,9 +3150,9 @@ bool mysql_unpack_partition(THD *thd, uchar *part_buf, uint part_info_len, uint part_func_len= part_info->part_func_len; uint subpart_func_len= part_info->subpart_func_len; char *part_func_string, *subpart_func_string= NULL; - if (!((part_func_string= sql_alloc(part_func_len))) || + if (!((part_func_string= thd->alloc(part_func_len))) || (subpart_func_len && - !((subpart_func_string= sql_alloc(subpart_func_len))))) + !((subpart_func_string= thd->alloc(subpart_func_len))))) { my_error(ER_OUTOFMEMORY, MYF(0), part_func_len); free_items(thd->free_list); @@ -3187,7 +3199,7 @@ void set_field_ptr(Field **ptr, const byte *new_buf, do { - (*ptr)->move_field(diff); + (*ptr)->move_field_offset(diff); } while (*(++ptr)); DBUG_VOID_RETURN; } @@ -3221,7 +3233,7 @@ void set_key_field_ptr(KEY *key_info, const byte *new_buf, do { - key_part->field->move_field(diff); + key_part->field->move_field_offset(diff); key_part++; } while (++i < key_parts); DBUG_VOID_RETURN; diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index efe8f256af5..7e78b58e6cf 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -208,14 +208,14 @@ static struct st_plugin_int *plugin_find_internal(LEX_STRING *name, int type) for (i= 0; i < MYSQL_MAX_PLUGIN_TYPE_NUM; i++) { struct st_plugin_int *plugin= (st_plugin_int *) - hash_search(&plugin_hash[i], name->str, name->length); + hash_search(&plugin_hash[i], (const byte *)name->str, name->length); if (plugin) DBUG_RETURN(plugin); } } else DBUG_RETURN((st_plugin_int *) - hash_search(&plugin_hash[type], name->str, name->length)); + hash_search(&plugin_hash[type], (const byte *)name->str, name->length)); DBUG_RETURN(0); } @@ -446,6 +446,7 @@ void plugin_init(void) } init_sql_alloc(&mem, 1024, 0); initialized= 1; + new_thd->thread_stack= (char*) &tables; new_thd->store_globals(); new_thd->db= my_strdup("mysql", MYF(0)); new_thd->db_length= 5; diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index fd03913a715..2f08583d974 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -1829,13 +1829,16 @@ static bool init_param_array(Prepared_statement *stmt) void mysql_stmt_prepare(THD *thd, const char *packet, uint packet_length) { - Prepared_statement *stmt= new Prepared_statement(thd, &thd->protocol_prep); + Prepared_statement *stmt; bool error; DBUG_ENTER("mysql_stmt_prepare"); DBUG_PRINT("prep_query", ("%s", packet)); - if (stmt == 0) + /* First of all clear possible warnings from the previous command */ + mysql_reset_thd_for_next_command(thd); + + if (! (stmt= new Prepared_statement(thd, &thd->protocol_prep))) DBUG_VOID_RETURN; /* out of memory: error is set in Sql_alloc */ if (thd->stmt_map.insert(stmt)) @@ -1844,7 +1847,6 @@ void mysql_stmt_prepare(THD *thd, const char *packet, uint packet_length) DBUG_VOID_RETURN; /* out of memory */ } - mysql_reset_thd_for_next_command(thd); /* Reset warnings from previous command */ mysql_reset_errors(thd, 0); sp_cache_flush_obsolete(&thd->sp_proc_cache); @@ -1929,7 +1931,7 @@ static const char *get_dynamic_sql_string(LEX *lex, uint *query_len) variable absent or equal to NULL, so we need to set variable to something reasonable to get a readable error message during parsing */ - str.set("NULL", 4, &my_charset_latin1); + str.set(STRING_WITH_LEN("NULL"), &my_charset_latin1); } needs_conversion= String::needs_conversion(var_value->length(), @@ -2111,8 +2113,6 @@ void reinit_stmt_before_use(THD *thd, LEX *lex) were closed in the end of previous prepare or execute call. */ tables->table= 0; - if (tables->nested_join) - tables->nested_join->counter= 0; if (tables->prep_on_expr) { @@ -2190,13 +2190,15 @@ void mysql_stmt_execute(THD *thd, char *packet_arg, uint packet_length) packet+= 9; /* stmt_id + 5 bytes of flags */ + /* First of all clear possible warnings from the previous command */ + mysql_reset_thd_for_next_command(thd); + if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_execute"))) DBUG_VOID_RETURN; DBUG_PRINT("exec_query", ("%s", stmt->query)); DBUG_PRINT("info",("stmt: %p", stmt)); - mysql_reset_thd_for_next_command(thd); sp_cache_flush_obsolete(&thd->sp_proc_cache); sp_cache_flush_obsolete(&thd->sp_func_cache); @@ -2316,6 +2318,8 @@ void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length) Server_side_cursor *cursor; DBUG_ENTER("mysql_stmt_fetch"); + /* First of all clear possible warnings from the previous command */ + mysql_reset_thd_for_next_command(thd); statistic_increment(thd->status_var.com_stmt_fetch, &LOCK_status); if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_fetch"))) DBUG_VOID_RETURN; @@ -2377,6 +2381,9 @@ void mysql_stmt_reset(THD *thd, char *packet) Prepared_statement *stmt; DBUG_ENTER("mysql_stmt_reset"); + /* First of all clear possible warnings from the previous command */ + mysql_reset_thd_for_next_command(thd); + statistic_increment(thd->status_var.com_stmt_reset, &LOCK_status); if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_reset"))) DBUG_VOID_RETURN; @@ -2391,7 +2398,6 @@ void mysql_stmt_reset(THD *thd, char *packet) stmt->state= Query_arena::PREPARED; - mysql_reset_thd_for_next_command(thd); send_ok(thd); DBUG_VOID_RETURN; diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index b5d12c0d2d2..dd70f90b3da 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -373,11 +373,6 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, goto err; } - /* - Call readers_addref before opening log to track count - of binlog readers - */ - mysql_bin_log.readers_addref(); if ((file=open_binlog(&log, log_file_name, &errmsg)) < 0) { my_errno= ER_MASTER_FATAL_ERROR_READING_BINLOG; @@ -575,8 +570,7 @@ impossible position"; goto err; if (!(flags & BINLOG_DUMP_NON_BLOCK) && - mysql_bin_log.is_active(log_file_name) && - !mysql_bin_log.is_reset_pending()) + mysql_bin_log.is_active(log_file_name)) { /* Block until there is more data in the log @@ -689,13 +683,7 @@ impossible position"; else { bool loop_breaker = 0; - // need this to break out of the for loop from switch - - // if we are going to switch log file anyway, close current log first - end_io_cache(&log); - (void) my_close(file, MYF(MY_WME)); - // decrease reference count of binlog readers - mysql_bin_log.readers_release(); + /* need this to break out of the for loop from switch */ thd->proc_info = "Finished reading one binlog; switching to next binlog"; switch (mysql_bin_log.find_next_log(&linfo, 1)) { @@ -705,25 +693,16 @@ impossible position"; case 0: break; default: - // need following call to do release on err label - mysql_bin_log.readers_addref(); errmsg = "could not find next log"; my_errno= ER_MASTER_FATAL_ERROR_READING_BINLOG; goto err; } - if (loop_breaker) - { - // need following call to do release on end label - mysql_bin_log.readers_addref(); - break; - } - - /* - Call readers_addref before opening log to track count - of binlog readers - */ - mysql_bin_log.readers_addref(); + if (loop_breaker) + break; + + end_io_cache(&log); + (void) my_close(file, MYF(MY_WME)); /* Call fake_rotate_event() in case the previous log (the one which @@ -756,8 +735,6 @@ end: end_io_cache(&log); (void)my_close(file, MYF(MY_WME)); - // decrease reference count of binlog readers - mysql_bin_log.readers_release(); send_eof(thd); thd->proc_info = "Waiting to finalize termination"; @@ -784,8 +761,6 @@ err: pthread_mutex_unlock(&LOCK_thread_count); if (file >= 0) (void) my_close(file, MYF(MY_WME)); - // decrease reference count of binlog readers - mysql_bin_log.readers_release(); my_message(my_errno, errmsg, MYF(0)); DBUG_VOID_RETURN; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 6552164a8e8..ea845c1de0f 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -98,6 +98,12 @@ static COND* substitute_for_best_equal_field(COND *cond, void *table_join_idx); static COND *simplify_joins(JOIN *join, List *join_list, COND *conds, bool top); +static bool check_interleaving_with_nj(JOIN_TAB *last, JOIN_TAB *next); +static void restore_prev_nj_state(JOIN_TAB *last); +static void reset_nj_counters(List *join_list); +static uint build_bitmap_for_nested_joins(List *join_list, + uint first_unused); + static COND *optimize_cond(JOIN *join, COND *conds, List *join_list, Item::cond_result *cond_value); @@ -520,12 +526,14 @@ bool JOIN::test_in_subselect(Item **where) return 0; } + /* global select optimisation. return 0 - success 1 - error error code saved in field 'error' */ + int JOIN::optimize() { @@ -588,6 +596,7 @@ JOIN::optimize() /* Convert all outer joins to inner joins if possible */ conds= simplify_joins(this, join_list, conds, TRUE); + build_bitmap_for_nested_joins(join_list, 0); sel->prep_where= conds ? conds->copy_andor_structure(thd) : 0; @@ -700,7 +709,8 @@ JOIN::optimize() DBUG_PRINT("error",("Error: make_select() failed")); DBUG_RETURN(1); } - + + reset_nj_counters(join_list); make_outerjoin_info(this); /* @@ -993,6 +1003,20 @@ JOIN::optimize() } having= 0; + /* + The loose index scan access method guarantees that all grouping or + duplicate row elimination (for distinct) is already performed + during data retrieval, and that all MIN/MAX functions are already + computed for each group. Thus all MIN/MAX functions should be + treated as regular functions, and there is no need to perform + grouping in the main execution loop. + Notice that currently loose index scan is applicable only for + single table queries, thus it is sufficient to test only the first + join_tab element of the plan for its access method. + */ + if (join_tab->is_using_loose_index_scan()) + tmp_table_param.precomputed_group_by= TRUE; + /* Create a tmp table if distinct or if the sort is too complicated */ if (need_tmp) { @@ -1399,6 +1423,15 @@ JOIN::exec() else { /* group data to new table */ + + /* + If the access method is loose index scan then all MIN/MAX + functions are precomputed, and should be treated as regular + functions. See extended comment in JOIN::exec. + */ + if (curr_join->join_tab->is_using_loose_index_scan()) + curr_join->tmp_table_param.precomputed_group_by= TRUE; + if (!(curr_tmp_table= exec_tmp_table2= create_tmp_table(thd, &curr_join->tmp_table_param, @@ -1980,14 +2013,19 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables, COND *conds, continue; } outer_join|= table->map; + s->embedding_map= 0; + for (;embedding; embedding= embedding->embedding) + s->embedding_map|= embedding->nested_join->nj_map; continue; } if (embedding) { /* s belongs to a nested join, maybe to several embedded joins */ + s->embedding_map= 0; do { NESTED_JOIN *nested_join= embedding->nested_join; + s->embedding_map|=nested_join->nj_map; s->dependent|= embedding->dep_tables; embedding= embedding->embedding; outer_join|= nested_join->used_tables; @@ -3561,6 +3599,8 @@ choose_plan(JOIN *join, table_map join_tables) bool straight_join= join->select_options & SELECT_STRAIGHT_JOIN; DBUG_ENTER("choose_plan"); + join->cur_embedding_map= 0; + reset_nj_counters(join->join_list); /* if (SELECT_STRAIGHT_JOIN option is set) reorder tables so dependent tables come after tables they depend @@ -4041,7 +4081,9 @@ best_extension_by_limited_search(JOIN *join, for (JOIN_TAB **pos= join->best_ref + idx ; (s= *pos) ; pos++) { table_map real_table_bit= s->table->map; - if ((remaining_tables & real_table_bit) && !(remaining_tables & s->dependent)) + if ((remaining_tables & real_table_bit) && + !(remaining_tables & s->dependent) && + (!idx || !check_interleaving_with_nj(join->positions[idx-1].table, s))) { double current_record_count, current_read_time; @@ -4057,6 +4099,7 @@ best_extension_by_limited_search(JOIN *join, { DBUG_EXECUTE("opt", print_plan(join, read_time, record_count, idx, "prune_by_cost");); + restore_prev_nj_state(s); continue; } @@ -4085,6 +4128,7 @@ best_extension_by_limited_search(JOIN *join, { DBUG_EXECUTE("opt", print_plan(join, read_time, record_count, idx, "pruned_by_heuristic");); + restore_prev_nj_state(s); continue; } } @@ -4119,9 +4163,11 @@ best_extension_by_limited_search(JOIN *join, sizeof(POSITION) * (idx + 1)); join->best_read= current_read_time - 0.001; } - DBUG_EXECUTE("opt", - print_plan(join, current_read_time, current_record_count, idx, "full_plan");); + DBUG_EXECUTE("opt", print_plan(join, current_read_time, + current_record_count, idx, + "full_plan");); } + restore_prev_nj_state(s); } } DBUG_VOID_RETURN; @@ -4166,7 +4212,8 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count, for (JOIN_TAB **pos=join->best_ref+idx ; (s=*pos) ; pos++) { table_map real_table_bit=s->table->map; - if ((rest_tables & real_table_bit) && !(rest_tables & s->dependent)) + if ((rest_tables & real_table_bit) && !(rest_tables & s->dependent) && + (!idx|| !check_interleaving_with_nj(join->positions[idx-1].table, s))) { double best,best_time,records; best=best_time=records=DBL_MAX; @@ -4504,10 +4551,10 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count, join->unit->select_limit_cnt >= records) join->sort_by_table= (TABLE*) 1; // Must use temporary table - /* + /* Go to the next level only if there hasn't been a better key on this level! This will cut down the search for a lot simple cases! - */ + */ double current_record_count=record_count*records; double current_read_time=read_time+best; if (best_record_count > current_record_count || @@ -4528,6 +4575,7 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count, return; swap_variables(JOIN_TAB*, join->best_ref[idx], *pos); } + restore_prev_nj_state(s); if (join->select_options & SELECT_STRAIGHT_JOIN) break; // Don't test all combinations } @@ -5038,7 +5086,7 @@ static void add_not_null_conds(JOIN *join) SYNOPSIS add_found_match_trig_cond() tab the first inner table for most nested outer join - cond the predicate to be guarded + cond the predicate to be guarded (must be set) root_tab the first inner table to stop DESCRIPTION @@ -5056,12 +5104,11 @@ static COND* add_found_match_trig_cond(JOIN_TAB *tab, COND *cond, JOIN_TAB *root_tab) { COND *tmp; - if (tab == root_tab || !cond) + DBUG_ASSERT(cond != 0); + if (tab == root_tab) return cond; if ((tmp= add_found_match_trig_cond(tab->first_upper, cond, root_tab))) - { tmp= new Item_func_trig_cond(tmp, &tab->found); - } if (tmp) { tmp->quick_fix_field(); @@ -5113,7 +5160,7 @@ add_found_match_trig_cond(JOIN_TAB *tab, COND *cond, JOIN_TAB *root_tab) This function can be called only after the execution plan has been chosen. */ - + static void make_outerjoin_info(JOIN *join) { @@ -5220,6 +5267,10 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) for (uint i=join->const_tables ; i < join->tables ; i++) { JOIN_TAB *tab=join->join_tab+i; + /* + first_inner is the X in queries like: + SELECT * FROM t1 LEFT OUTER JOIN (t2 JOIN t3) ON X + */ JOIN_TAB *first_inner_tab= tab->first_inner; table_map current_map= tab->table->map; bool use_quick_range=0; @@ -5270,15 +5321,15 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) */ DBUG_PRINT("info", ("Item_int")); tmp= new Item_int((longlong) 1,1); // Always true - DBUG_PRINT("info", ("Item_int 0x%lx", (ulong)tmp)); } } if (tmp || !cond) { DBUG_EXECUTE("where",print_where(tmp,tab->table->alias);); - SQL_SELECT *sel=tab->select=(SQL_SELECT*) - thd->memdup((gptr) select, sizeof(SQL_SELECT)); + SQL_SELECT *sel= tab->select= ((SQL_SELECT*) + thd->memdup((gptr) select, + sizeof(*select))); if (!sel) DBUG_RETURN(1); // End of memory /* @@ -7277,11 +7328,11 @@ propagate_cond_constants(THD *thd, I_List *save_list, ascent all attributes are calculated, all outer joins that can be converted are replaced and then all unnecessary braces are removed. As join list contains join tables in the reverse order sequential - elimination of outer joins does not requite extra recursive calls. + elimination of outer joins does not require extra recursive calls. EXAMPLES Here is an example of a join query with invalid cross references: - SELECT * FROM t1 LEFT JOIN t2 ON t2.a=t3.a LEFT JOIN ON t3.b=t1.b + SELECT * FROM t1 LEFT JOIN t2 ON t2.a=t3.a LEFT JOIN t3 ON t3.b=t1.b RETURN VALUE The new condition, if success @@ -7438,7 +7489,257 @@ simplify_joins(JOIN *join, List *join_list, COND *conds, bool top) } DBUG_RETURN(conds); } - + + +/* + Assign each nested join structure a bit in nested_join_map + + SYNOPSIS + build_bitmap_for_nested_joins() + join Join being processed + join_list List of tables + first_unused Number of first unused bit in nested_join_map before the + call + + DESCRIPTION + Assign each nested join structure (except "confluent" ones - those that + embed only one element) a bit in nested_join_map. + + NOTE + This function is called after simplify_joins(), when there are no + redundant nested joins, #non_confluent_nested_joins <= #tables_in_join so + we will not run out of bits in nested_join_map. + + RETURN + First unused bit in nested_join_map after the call. +*/ + +static uint build_bitmap_for_nested_joins(List *join_list, + uint first_unused) +{ + List_iterator li(*join_list); + TABLE_LIST *table; + DBUG_ENTER("build_bitmap_for_nested_joins"); + while ((table= li++)) + { + NESTED_JOIN *nested_join; + if ((nested_join= table->nested_join)) + { + /* + It is guaranteed by simplify_joins() function that a nested join + that has only one child represents a single table VIEW (and the child + is an underlying table). We don't assign bits to such nested join + structures because + 1. it is redundant (a "sequence" of one table cannot be interleaved + with anything) + 2. we could run out bits in nested_join_map otherwise. + */ + if (nested_join->join_list.elements != 1) + { + nested_join->nj_map= 1 << first_unused++; + first_unused= build_bitmap_for_nested_joins(&nested_join->join_list, + first_unused); + } + } + } + DBUG_RETURN(first_unused); +} + + +/* + Set NESTED_JOIN::counter=0 in all nested joins in passed list + + SYNOPSIS + reset_nj_counters() + join_list List of nested joins to process. It may also contain base + tables which will be ignored. + + DESCRIPTION + Recursively set NESTED_JOIN::counter=0 for all nested joins contained in + the passed join_list. +*/ + +static void reset_nj_counters(List *join_list) +{ + List_iterator li(*join_list); + TABLE_LIST *table; + DBUG_ENTER("reset_nj_counters"); + while ((table= li++)) + { + NESTED_JOIN *nested_join; + if ((nested_join= table->nested_join)) + { + nested_join->counter= 0; + reset_nj_counters(&nested_join->join_list); + } + } + DBUG_VOID_RETURN; +} + + +/* + Check interleaving with an inner tables of an outer join for extension table + + SYNOPSIS + check_interleaving_with_nj() + join Join being processed + last_tab Last table in current partial join order (this function is + not called for empty partial join orders) + next_tab Table we're going to extend the current partial join with + + DESCRIPTION + Check if table next_tab can be added to current partial join order, and + if yes, record that it has been added. + + The function assumes that both current partial join order and its + extension with next_tab are valid wrt table dependencies. + + IMPLEMENTATION + LIMITATIONS ON JOIN ORDER + The nested [outer] joins executioner algorithm imposes these limitations + on join order: + 1. "Outer tables first" - any "outer" table must be before any + corresponding "inner" table. + 2. "No interleaving" - tables inside a nested join must form a continuous + sequence in join order (i.e. the sequence must not be interrupted by + tables that are outside of this nested join). + + #1 is checked elsewhere, this function checks #2 provided that #1 has + been already checked. + + WHY NEED NON-INTERLEAVING + Consider an example: + + select * from t0 join t1 left join (t2 join t3) on cond1 + + The join order "t1 t2 t0 t3" is invalid: + + table t0 is outside of the nested join, so WHERE condition for t0 is + attached directly to t0 (without triggers, and it may be used to access + t0). Applying WHERE(t0) to (t2,t0,t3) record is invalid as we may miss + combinations of (t1, t2, t3) that satisfy condition cond1, and produce a + null-complemented (t1, t2.NULLs, t3.NULLs) row, which should not have + been produced. + + If table t0 is not between t2 and t3, the problem doesn't exist: + * If t0 is located after (t2,t3), WHERE(t0) is applied after nested join + processing has finished. + * If t0 is located before (t2,t3), predicates like WHERE_cond(t0, t2) are + wrapped into condition triggers, which takes care of correct nested + join processing. + + HOW IT IS IMPLEMENTED + The limitations on join order can be rephrased as follows: for valid + join order one must be able to: + 1. write down the used tables in the join order on one line. + 2. for each nested join, put one '(' and one ')' on the said line + 3. write "LEFT JOIN" and "ON (...)" where appropriate + 4. get a query equivalent to the query we're trying to execute. + + Calls to check_interleaving_with_nj() are equivalent to writing the + above described line from left to right. + A single check_interleaving_with_nj(A,B) call is equivalent to writing + table B and appropriate brackets on condition that table A and + appropriate brackets is the last what was written. Graphically the + transition is as follows: + + +---- current position + | + ... last_tab ))) | ( next_tab ) )..) | ... + X Y Z | + +- need to move to this + position. + + Notes about the position: + The caller guarantees that there is no more then one X-bracket by + checking "!(remaining_tables & s->dependent)" before calling this + function. X-bracket may have a pair in Y-bracket. + + When "writing" we store/update this auxilary info about the current + position: + 1. join->cur_embedding_map - bitmap of pairs of brackets (aka nested + joins) we've opened but didn't close. + 2. {each NESTED_JOIN structure not simplified away}->counter - number + of this nested join's children that have already been added to to + the partial join order. + + RETURN + FALSE Join order extended, nested joins info about current join order + (see NOTE section) updated. + TRUE Requested join order extension not allowed. +*/ + +static bool check_interleaving_with_nj(JOIN_TAB *last_tab, JOIN_TAB *next_tab) +{ + TABLE_LIST *next_emb= next_tab->table->pos_in_table_list->embedding; + JOIN *join= last_tab->join; + + if (join->cur_embedding_map & ~next_tab->embedding_map) + { + /* + next_tab is outside of the "pair of brackets" we're currently in. + Cannot add it. + */ + return TRUE; + } + + /* + Do update counters for "pairs of brackets" that we've left (marked as + X,Y,Z in the above picture) + */ + for (;next_emb; next_emb= next_emb->embedding) + { + next_emb->nested_join->counter++; + if (next_emb->nested_join->counter == 1) + { + /* + next_emb is the first table inside a nested join we've "entered". In + the picture above, we're looking at the 'X' bracket. Don't exit yet as + X bracket might have Y pair bracket. + */ + join->cur_embedding_map |= next_emb->nested_join->nj_map; + } + + if (next_emb->nested_join->join_list.elements != + next_emb->nested_join->counter) + break; + + /* + We're currently at Y or Z-bracket as depicted in the above picture. + Mark that we've left it and continue walking up the brackets hierarchy. + */ + join->cur_embedding_map &= ~next_emb->nested_join->nj_map; + } + return FALSE; +} + + +/* + Nested joins perspective: Remove the last table from the join order + + SYNOPSIS + restore_prev_nj_state() + last join table to remove, it is assumed to be the last in current + partial join order. + + DESCRIPTION + Remove the last table from the partial join order and update the nested + joins counters and join->cur_embedding_map. It is ok to call this + function for the first table in join order (for which + check_interleaving_with_nj has not been called) +*/ + +static void restore_prev_nj_state(JOIN_TAB *last) +{ + TABLE_LIST *last_emb= last->table->pos_in_table_list->embedding; + JOIN *join= last->join; + while (last_emb && !(--last_emb->nested_join->counter)) + { + join->cur_embedding_map &= last_emb->nested_join->nj_map; + last_emb= last_emb->embedding; + } +} + static COND * optimize_cond(JOIN *join, COND *conds, List *join_list, @@ -7719,7 +8020,7 @@ const_expression_in_where(COND *cond, Item *comp_item, Item **const_item) new_created field */ -Field* create_tmp_field_from_field(THD *thd, Field* org_field, +Field *create_tmp_field_from_field(THD *thd, Field *org_field, const char *name, TABLE *table, Item_field *item, uint convert_blob_length) { @@ -7728,12 +8029,14 @@ Field* create_tmp_field_from_field(THD *thd, Field* org_field, if (convert_blob_length && (org_field->flags & BLOB_FLAG)) new_field= new Field_varstring(convert_blob_length, org_field->maybe_null(), - org_field->field_name, table, + org_field->field_name, table->s, org_field->charset()); else new_field= org_field->new_field(thd->mem_root, table); if (new_field) { + new_field->init(table); + new_field->orig_table= org_field->orig_table; if (item) item->result_field= new_field; else @@ -7776,18 +8079,18 @@ static Field *create_tmp_field_from_item(THD *thd, Item *item, TABLE *table, Item ***copy_func, bool modify_item, uint convert_blob_length) { - bool maybe_null=item->maybe_null; + bool maybe_null= item->maybe_null; Field *new_field; LINT_INIT(new_field); switch (item->result_type()) { case REAL_RESULT: - new_field=new Field_double(item->max_length, maybe_null, - item->name, table, item->decimals); + new_field= new Field_double(item->max_length, maybe_null, + item->name, item->decimals); break; case INT_RESULT: - new_field=new Field_longlong(item->max_length, maybe_null, - item->name, table, item->unsigned_flag); + new_field= new Field_longlong(item->max_length, maybe_null, + item->name, item->unsigned_flag); break; case STRING_RESULT: DBUG_ASSERT(item->collation.collation); @@ -7799,26 +8102,29 @@ static Field *create_tmp_field_from_item(THD *thd, Item *item, TABLE *table, */ if ((type= item->field_type()) == MYSQL_TYPE_DATETIME || type == MYSQL_TYPE_TIME || type == MYSQL_TYPE_DATE) - new_field= item->tmp_table_field_from_field_type(table); + new_field= item->tmp_table_field_from_field_type(table, 1); else if (item->max_length/item->collation.collation->mbmaxlen > 255 && convert_blob_length) new_field= new Field_varstring(convert_blob_length, maybe_null, - item->name, table, + item->name, table->s, item->collation.collation); else new_field= item->make_string_field(table); break; case DECIMAL_RESULT: new_field= new Field_new_decimal(item->max_length, maybe_null, item->name, - table, item->decimals, item->unsigned_flag); + item->decimals, item->unsigned_flag); break; case ROW_RESULT: default: // This case should never be choosen DBUG_ASSERT(0); - new_field= 0; // to satisfy compiler (uninitialized variable) + new_field= 0; break; } + if (new_field) + new_field->init(table); + if (copy_func && item->is_result_field()) *((*copy_func)++) = item; // Save for copy_funcs if (modify_item) @@ -7845,14 +8151,20 @@ Field *create_tmp_field_for_schema(THD *thd, Item *item, TABLE *table) { if (item->field_type() == MYSQL_TYPE_VARCHAR) { + Field *field; if (item->max_length > MAX_FIELD_VARCHARLENGTH / item->collation.collation->mbmaxlen) - return new Field_blob(item->max_length, item->maybe_null, - item->name, table, item->collation.collation); - return new Field_varstring(item->max_length, item->maybe_null, item->name, - table, item->collation.collation); + field= new Field_blob(item->max_length, item->maybe_null, + item->name, item->collation.collation); + else + field= new Field_varstring(item->max_length, item->maybe_null, + item->name, + table->s, item->collation.collation); + if (field) + field->init(table); + return field; } - return item->tmp_table_field_from_field_type(table); + return item->tmp_table_field_from_field_type(table, 0); } @@ -7903,11 +8215,13 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type, item= item->real_item(); type= Item::FIELD_ITEM; } + switch (type) { case Item::SUM_FUNC_ITEM: { Item_sum *item_sum=(Item_sum*) item; - Field *result= item_sum->create_tmp_field(group, table, convert_blob_length); + Field *result= item_sum->create_tmp_field(group, table, + convert_blob_length); if (!result) thd->fatal_error(); return result; @@ -8018,7 +8332,9 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, { MEM_ROOT *mem_root_save, own_root; TABLE *table; + TABLE_SHARE *share; uint i,field_count,null_count,null_pack_length; + uint copy_func_count= param->func_count; uint hidden_null_count, hidden_null_pack_length, hidden_field_count; uint blob_count,group_null_items, string_count; uint temp_pool_slot=MY_BIT_NONE; @@ -8082,14 +8398,25 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, field_count=param->field_count+param->func_count+param->sum_func_count; hidden_field_count=param->hidden_field_count; + /* + When loose index scan is employed as access method, it already + computes all groups and the result of all aggregate functions. We + make space for the items of the aggregate function in the list of + functions TMP_TABLE_PARAM::items_to_copy, so that the values of + these items are stored in the temporary table. + */ + if (param->precomputed_group_by) + copy_func_count+= param->sum_func_count; + init_sql_alloc(&own_root, TABLE_ALLOC_BLOCK_SIZE, 0); if (!multi_alloc_root(&own_root, &table, sizeof(*table), + &share, sizeof(*share), ®_field, sizeof(Field*) * (field_count+1), &blob_field, sizeof(uint)*(field_count+1), &from_field, sizeof(Field*)*field_count, - ©_func, sizeof(*copy_func)*(param->func_count+1), + ©_func, sizeof(*copy_func)*(copy_func_count+1), ¶m->keyinfo, sizeof(*param->keyinfo), &key_part_info, sizeof(*key_part_info)*(param->group_parts+1), @@ -8134,20 +8461,17 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, table->used_keys.init(); table->keys_in_use_for_query.init(); - table->s= &table->share_not_to_be_used; - table->s->blob_field= blob_field; - table->s->table_name= table->s->path= tmpname; - table->s->db= ""; - table->s->blob_ptr_size= mi_portable_sizeof_char_ptr; - table->s->tmp_table= TMP_TABLE; - table->s->db_low_byte_first=1; // True for HEAP and MyISAM - table->s->table_charset= param->table_charset; - table->s->primary_key= MAX_KEY; //Indicate no primary key - table->s->keys_for_keyread.init(); - table->s->keys_in_use.init(); + table->s= share; + init_tmp_table_share(share, "", 0, tmpname, tmpname); + share->blob_field= blob_field; + share->blob_ptr_size= mi_portable_sizeof_char_ptr; + share->db_low_byte_first=1; // True for HEAP and MyISAM + share->table_charset= param->table_charset; + share->primary_key= MAX_KEY; // Indicate no primary key + share->keys_for_keyread.init(); + share->keys_in_use.init(); /* For easier error reporting */ - table->s->table_cache_key= (char*) (table->s->db= ""); - + share->table_cache_key= share->db; /* Calculate which type of fields we will store in the temporary table */ @@ -8291,15 +8615,15 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, DBUG_ASSERT(field_count >= (uint) (reg_field - table->field)); field_count= (uint) (reg_field - table->field); *blob_field= 0; // End marker - table->s->fields= field_count; + share->fields= field_count; /* If result table is small; use a heap */ if (blob_count || using_unique_constraint || (select_options & (OPTION_BIG_TABLES | SELECT_SMALL_RESULT)) == OPTION_BIG_TABLES || (select_options & TMP_TABLE_FORCE_MYISAM)) { - table->file= get_new_handler(table, &table->mem_root, - table->s->db_type= DB_TYPE_MYISAM); + table->file= get_new_handler(share, &table->mem_root, + share->db_type= DB_TYPE_MYISAM); if (group && (param->group_parts > table->file->max_key_parts() || param->group_length > table->file->max_key_length())) @@ -8307,18 +8631,16 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, } else { - table->file= get_new_handler(table, &table->mem_root, - table->s->db_type= DB_TYPE_HEAP); - } - if (table->s->fields) - { - table->file->ha_set_all_bits_in_read_set(); - table->file->ha_set_all_bits_in_write_set(); + table->file= get_new_handler(share, &table->mem_root, + share->db_type= DB_TYPE_HEAP); } + if (!table->file) + goto err; + if (!using_unique_constraint) reclength+= group_null_items; // null flag is stored separately - table->s->blob_fields= blob_count; + share->blob_fields= blob_count; if (blob_count == 0) { /* We need to ensure that first byte is not 0 for the delete link */ @@ -8340,15 +8662,15 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, string_total_length / string_count >= AVG_STRING_LENGTH_TO_PACK_ROWS)) use_packed_rows= 1; - table->s->reclength= reclength; + share->reclength= reclength; { uint alloc_length=ALIGN_SIZE(reclength+MI_UNIQUE_HASH_LENGTH+1); - table->s->rec_buff_length= alloc_length; + share->rec_buff_length= alloc_length; if (!(table->record[0]= (byte*) alloc_root(&table->mem_root, alloc_length*3))) goto err; table->record[1]= table->record[0]+alloc_length; - table->s->default_values= table->record[1]+alloc_length; + share->default_values= table->record[1]+alloc_length; } copy_func[0]=0; // End marker @@ -8364,8 +8686,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, bfill(null_flags,null_pack_length,255); // Set null fields table->null_flags= (uchar*) table->record[0]; - table->s->null_fields= null_count+ hidden_null_count; - table->s->null_bytes= null_pack_length; + share->null_fields= null_count+ hidden_null_count; + share->null_bytes= null_pack_length; } null_count= (blob_count == 0) ? 1 : 0; hidden_field_count=param->hidden_field_count; @@ -8438,13 +8760,13 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, store_record(table,s->default_values); // Make empty default record if (thd->variables.tmp_table_size == ~(ulong) 0) // No limit - table->s->max_rows= ~(ha_rows) 0; + share->max_rows= ~(ha_rows) 0; else - table->s->max_rows= (((table->s->db_type == DB_TYPE_HEAP) ? + share->max_rows= (((share->db_type == DB_TYPE_HEAP) ? min(thd->variables.tmp_table_size, thd->variables.max_heap_table_size) : - thd->variables.tmp_table_size)/ table->s->reclength); - set_if_bigger(table->s->max_rows,1); // For dummy start options + thd->variables.tmp_table_size)/ share->reclength); + set_if_bigger(share->max_rows,1); // For dummy start options keyinfo= param->keyinfo; if (group) @@ -8452,8 +8774,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, DBUG_PRINT("info",("Creating group key in temporary table")); table->group=group; /* Table is grouped by key */ param->group_buff=group_buff; - table->s->keys=1; - table->s->uniques= test(using_unique_constraint); + share->keys=1; + share->uniques= test(using_unique_constraint); table->key_info=keyinfo; keyinfo->key_part=key_part_info; keyinfo->flags=HA_NOSAME; @@ -8521,14 +8843,14 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, null_pack_length-=hidden_null_pack_length; keyinfo->key_parts= ((field_count-param->hidden_field_count)+ test(null_pack_length)); - set_if_smaller(table->s->max_rows, rows_limit); + set_if_smaller(share->max_rows, rows_limit); param->end_write_records= rows_limit; table->distinct= 1; - table->s->keys= 1; + share->keys= 1; if (blob_count) { using_unique_constraint=1; - table->s->uniques= 1; + share->uniques= 1; } if (!(key_part_info= (KEY_PART_INFO*) alloc_root(&table->mem_root, @@ -8547,12 +8869,15 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, key_part_info->null_bit=0; key_part_info->offset=hidden_null_pack_length; key_part_info->length=null_pack_length; - key_part_info->field=new Field_string((char*) table->record[0], - (uint32) key_part_info->length, - (uchar*) 0, - (uint) 0, - Field::NONE, - NullS, table, &my_charset_bin); + key_part_info->field= new Field_string((char*) table->record[0], + (uint32) key_part_info->length, + (uchar*) 0, + (uint) 0, + Field::NONE, + NullS, &my_charset_bin); + if (!key_part_info->field) + goto err; + key_part_info->field->init(table); key_part_info->key_type=FIELDFLAG_BINARY; key_part_info->type= HA_KEYTYPE_BINARY; key_part_info++; @@ -8576,8 +8901,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, } if (thd->is_fatal_error) // If end of memory goto err; /* purecov: inspected */ - table->s->db_record_offset= 1; - if (table->s->db_type == DB_TYPE_MYISAM) + share->db_record_offset= 1; + if (share->db_type == DB_TYPE_MYISAM) { if (create_myisam_tmp_table(table,param,select_options)) goto err; @@ -8585,6 +8910,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, if (open_tmp_table(table)) goto err; + table->file->ha_set_all_bits_in_read_set(); + table->file->ha_set_all_bits_in_write_set(); thd->mem_root= mem_root_save; DBUG_RETURN(table); @@ -8609,7 +8936,7 @@ err: field_list list of column definitions DESCRIPTION - The created table doesn't have a table handler assotiated with + The created table doesn't have a table handler associated with it, has no keys, no group/distinct, no copy_funcs array. The sole purpose of this TABLE object is to use the power of Field class to read/write data to/from table->record[0]. Then one can store @@ -8629,55 +8956,56 @@ TABLE *create_virtual_tmp_table(THD *thd, List &field_list) uint record_length= 0; uint null_count= 0; /* number of columns which may be null */ uint null_pack_length; /* NULL representation array length */ - TABLE_SHARE *s; + TABLE_SHARE *share; /* Create the table and list of all fields */ - TABLE *table= (TABLE*) thd->calloc(sizeof(*table)); + TABLE *table= (TABLE*) thd->calloc(sizeof(*table)+sizeof(*share)); field= (Field**) thd->alloc((field_count + 1) * sizeof(Field*)); if (!table || !field) return 0; table->field= field; - table->s= s= &table->share_not_to_be_used; - s->fields= field_count; + table->s= share= (TABLE_SHARE*) (table+1); + share->fields= field_count; /* Create all fields and calculate the total length of record */ List_iterator_fast it(field_list); while ((cdef= it++)) { - *field= make_field(0, cdef->length, + *field= make_field(share, 0, cdef->length, (uchar*) (f_maybe_null(cdef->pack_flag) ? "" : 0), f_maybe_null(cdef->pack_flag) ? 1 : 0, cdef->pack_flag, cdef->sql_type, cdef->charset, cdef->geom_type, cdef->unireg_check, - cdef->interval, cdef->field_name, table); + cdef->interval, cdef->field_name); if (!*field) goto error; - record_length+= (**field).pack_length(); - if (! ((**field).flags & NOT_NULL_FLAG)) - ++null_count; - ++field; + (*field)->init(table); + record_length+= (*field)->pack_length(); + if (! ((*field)->flags & NOT_NULL_FLAG)) + null_count++; + field++; } *field= NULL; /* mark the end of the list */ null_pack_length= (null_count + 7)/8; - s->reclength= record_length + null_pack_length; - s->rec_buff_length= ALIGN_SIZE(s->reclength + 1); - table->record[0]= (byte*) thd->alloc(s->rec_buff_length); + share->reclength= record_length + null_pack_length; + share->rec_buff_length= ALIGN_SIZE(share->reclength + 1); + table->record[0]= (byte*) thd->alloc(share->rec_buff_length); if (!table->record[0]) goto error; if (null_pack_length) { table->null_flags= (uchar*) table->record[0]; - s->null_fields= null_count; - s->null_bytes= null_pack_length; + share->null_fields= null_count; + share->null_bytes= null_pack_length; } table->in_use= thd; /* field->reset() may access table->in_use */ { /* Set up field pointers */ byte *null_pos= table->record[0]; - byte *field_pos= null_pos + s->null_bytes; + byte *field_pos= null_pos + share->null_bytes; uint null_bit= 1; for (field= table->field; *field; ++field) @@ -8711,7 +9039,7 @@ error: static bool open_tmp_table(TABLE *table) { int error; - if ((error=table->file->ha_open(table->s->table_name,O_RDWR, + if ((error=table->file->ha_open(table, table->s->table_name.str,O_RDWR, HA_OPEN_TMP_TABLE))) { table->file->print_error(error,MYF(0)); /* purecov: inspected */ @@ -8730,9 +9058,10 @@ static bool create_myisam_tmp_table(TABLE *table,TMP_TABLE_PARAM *param, MI_KEYDEF keydef; MI_UNIQUEDEF uniquedef; KEY *keyinfo=param->keyinfo; + TABLE_SHARE *share= table->s; DBUG_ENTER("create_myisam_tmp_table"); - if (table->s->keys) + if (share->keys) { // Get keys for ni_create bool using_unique_constraint=0; HA_KEYSEG *seg= (HA_KEYSEG*) alloc_root(&table->mem_root, @@ -8743,11 +9072,11 @@ static bool create_myisam_tmp_table(TABLE *table,TMP_TABLE_PARAM *param, bzero(seg, sizeof(*seg) * keyinfo->key_parts); if (keyinfo->key_length >= table->file->max_key_length() || keyinfo->key_parts > table->file->max_key_parts() || - table->s->uniques) + share->uniques) { /* Can't create a key; Make a unique constraint instead of a key */ - table->s->keys= 0; - table->s->uniques= 1; + share->keys= 0; + share->uniques= 1; using_unique_constraint=1; bzero((char*) &uniquedef,sizeof(uniquedef)); uniquedef.keysegs=keyinfo->key_parts; @@ -8759,7 +9088,7 @@ static bool create_myisam_tmp_table(TABLE *table,TMP_TABLE_PARAM *param, param->recinfo->type= FIELD_CHECK; param->recinfo->length=MI_UNIQUE_HASH_LENGTH; param->recinfo++; - table->s->reclength+=MI_UNIQUE_HASH_LENGTH; + share->reclength+=MI_UNIQUE_HASH_LENGTH; } else { @@ -8781,7 +9110,7 @@ static bool create_myisam_tmp_table(TABLE *table,TMP_TABLE_PARAM *param, seg->type= ((keyinfo->key_part[i].key_type & FIELDFLAG_BINARY) ? HA_KEYTYPE_VARBINARY2 : HA_KEYTYPE_VARTEXT2); - seg->bit_start= (uint8)(field->pack_length() - table->s->blob_ptr_size); + seg->bit_start= (uint8)(field->pack_length() - share->blob_ptr_size); seg->flag= HA_BLOB_PART; seg->length=0; // Whole blob in unique constraint } @@ -8814,10 +9143,10 @@ static bool create_myisam_tmp_table(TABLE *table,TMP_TABLE_PARAM *param, OPTION_BIG_TABLES) create_info.data_file_length= ~(ulonglong) 0; - if ((error=mi_create(table->s->table_name,table->s->keys,&keydef, + if ((error=mi_create(share->table_name.str, share->keys, &keydef, (uint) (param->recinfo-param->start_recinfo), param->start_recinfo, - table->s->uniques, &uniquedef, + share->uniques, &uniquedef, &create_info, HA_CREATE_TMP_TABLE))) { @@ -8827,7 +9156,7 @@ static bool create_myisam_tmp_table(TABLE *table,TMP_TABLE_PARAM *param, } statistic_increment(table->in_use->status_var.created_tmp_disk_tables, &LOCK_status); - table->s->db_record_offset= 1; + share->db_record_offset= 1; DBUG_RETURN(0); err: DBUG_RETURN(1); @@ -8848,9 +9177,9 @@ free_tmp_table(THD *thd, TABLE *entry) if (entry->file) { if (entry->db_stat) - entry->file->drop_table(entry->s->table_name); + entry->file->drop_table(entry->s->table_name.str); else - entry->file->delete_table(entry->s->table_name); + entry->file->delete_table(entry->s->table_name.str); delete entry->file; } @@ -8875,6 +9204,7 @@ bool create_myisam_from_heap(THD *thd, TABLE *table, TMP_TABLE_PARAM *param, int error, bool ignore_last_dupp_key_error) { TABLE new_table; + TABLE_SHARE share; const char *save_proc_info; int write_err; DBUG_ENTER("create_myisam_from_heap"); @@ -8885,16 +9215,17 @@ bool create_myisam_from_heap(THD *thd, TABLE *table, TMP_TABLE_PARAM *param, DBUG_RETURN(1); } new_table= *table; - new_table.s= &new_table.share_not_to_be_used; + share= *table->s; + new_table.s= &share; new_table.s->db_type= DB_TYPE_MYISAM; - if (!(new_table.file= get_new_handler(&new_table, &new_table.mem_root, + if (!(new_table.file= get_new_handler(&share, &new_table.mem_root, DB_TYPE_MYISAM))) DBUG_RETURN(1); // End of memory save_proc_info=thd->proc_info; thd->proc_info="converting HEAP to MyISAM"; - if (create_myisam_tmp_table(&new_table,param, + if (create_myisam_tmp_table(&new_table, param, thd->lex->select_lex.options | thd->options)) goto err2; if (open_tmp_table(&new_table)) @@ -8943,12 +9274,13 @@ bool create_myisam_from_heap(THD *thd, TABLE *table, TMP_TABLE_PARAM *param, /* remove heap table and change to use myisam table */ (void) table->file->ha_rnd_end(); (void) table->file->close(); - (void) table->file->delete_table(table->s->table_name); + (void) table->file->delete_table(table->s->table_name.str); delete table->file; table->file=0; + new_table.s= table->s; // Keep old share *table= new_table; - table->s= &table->share_not_to_be_used; - table->file->change_table_ptr(table); + *table->s= share; + table->file->change_table_ptr(table, table->s); if (save_proc_info) thd->proc_info= (!strcmp(save_proc_info,"Copying to tmp table") ? "Copying to tmp table on disk" : save_proc_info); @@ -8960,7 +9292,7 @@ bool create_myisam_from_heap(THD *thd, TABLE *table, TMP_TABLE_PARAM *param, (void) table->file->ha_rnd_end(); (void) new_table.file->close(); err1: - new_table.file->delete_table(new_table.s->table_name); + new_table.file->delete_table(new_table.s->table_name.str); err2: delete new_table.file; thd->proc_info=save_proc_info; @@ -8985,11 +9317,13 @@ bool create_myisam_from_heap(THD *thd, TABLE *table, TMP_TABLE_PARAM *param, Next_select_func setup_end_select_func(JOIN *join) { TABLE *table= join->tmp_table; + TMP_TABLE_PARAM *tmp_tbl= &join->tmp_table_param; Next_select_func end_select; + /* Set up select_end */ if (table) { - if (table->group && join->tmp_table_param.sum_func_count) + if (table->group && tmp_tbl->sum_func_count) { if (table->s->keys) { @@ -9002,7 +9336,7 @@ Next_select_func setup_end_select_func(JOIN *join) end_select=end_unique_update; } } - else if (join->sort_and_group) + else if (join->sort_and_group && !tmp_tbl->precomputed_group_by) { DBUG_PRINT("info",("Using end_write_group")); end_select=end_write_group; @@ -9011,19 +9345,27 @@ Next_select_func setup_end_select_func(JOIN *join) { DBUG_PRINT("info",("Using end_write")); end_select=end_write; + if (tmp_tbl->precomputed_group_by) + { + /* + A preceding call to create_tmp_table in the case when loose + index scan is used guarantees that + TMP_TABLE_PARAM::items_to_copy has enough space for the group + by functions. It is OK here to use memcpy since we copy + Item_sum pointers into an array of Item pointers. + */ + memcpy(tmp_tbl->items_to_copy + tmp_tbl->func_count, + join->sum_funcs, + sizeof(Item*)*tmp_tbl->sum_func_count); + tmp_tbl->items_to_copy[tmp_tbl->func_count+tmp_tbl->sum_func_count]= 0; + } } } else { - /* Test if data is accessed via QUICK_GROUP_MIN_MAX_SELECT. */ - bool is_using_quick_group_min_max_select= - (join->join_tab->select && join->join_tab->select->quick && - (join->join_tab->select->quick->get_type() == - QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX)); - if ((join->sort_and_group || (join->procedure && join->procedure->flags & PROC_GROUP)) && - !is_using_quick_group_min_max_select) + !tmp_tbl->precomputed_group_by) end_select= end_send_group; else end_select= end_send; @@ -9198,7 +9540,7 @@ sub_select_cache(JOIN *join,JOIN_TAB *join_tab,bool end_of_records) given the selected plan prescribes to nest retrievals of the joined tables in the following order: t1,t2,t3. A pushed down predicate are attached to the table which it pushed to, - at the field select_cond. + at the field join_tab->select_cond. When executing a nested loop of level k the function runs through the rows of 'join_tab' and for each row checks the pushed condition attached to the table. @@ -9237,7 +9579,7 @@ sub_select_cache(JOIN *join,JOIN_TAB *join_tab,bool end_of_records) is complemented by nulls for t2 and t3. Then the pushed down predicates are checked for the composed row almost in the same way as it had been done for the first row with a match. The only difference is - the predicates from on expressions are not checked. + the predicates from on expressions are not checked. IMPLEMENTATION The function forms output rows for a current partial join of k @@ -9246,7 +9588,7 @@ sub_select_cache(JOIN *join,JOIN_TAB *join_tab,bool end_of_records) join_tab it calls sub_select that builds all possible matching tails from the result set. To be able check predicates conditionally items of the class - Item_func_trig_cond are employed. + Item_func_trig_cond are employed. An object of this class is constructed from an item of class COND and a pointer to a guarding boolean variable. When the value of the guard variable is true the value of the object @@ -10301,7 +10643,6 @@ end_write(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), { copy_fields(&join->tmp_table_param); copy_funcs(join->tmp_table_param.items_to_copy); - #ifdef TO_BE_DELETED if (!table->uniques) // If not unique handling { @@ -10736,7 +11077,7 @@ static int test_if_order_by_key(ORDER *order, TABLE *table, uint idx, for (; order ; order=order->next, const_key_parts>>=1) { - Field *field=((Item_field*) (*order->item))->field; + Field *field=((Item_field*) (*order->item)->real_item())->field; int flag; /* @@ -10876,8 +11217,12 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, DBUG_ENTER("test_if_skip_sort_order"); LINT_INIT(ref_key_parts); - /* Check which keys can be used to resolve ORDER BY */ - usable_keys.set_all(); + /* + Check which keys can be used to resolve ORDER BY. + We must not try to use disabled keys. + */ + usable_keys= table->s->keys_in_use; + for (ORDER *tmp_order=order; tmp_order ; tmp_order=tmp_order->next) { Item *item= (*tmp_order->item)->real_item(); @@ -13420,7 +13765,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, { SELECT_LEX *sl= join->unit->first_select(); uint len= 6, lastop= 0; - memcpy(table_name_buffer, "next_select()) { len+= lastop; @@ -13429,7 +13774,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, } if (sl || len + lastop >= NAME_LEN) { - memcpy(table_name_buffer + len, "...>", 5); + memcpy(table_name_buffer + len, STRING_WITH_LEN("...>") + 1); len+= 4; } else @@ -13608,7 +13953,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, quick_type == QUICK_SELECT_I::QS_TYPE_ROR_INTERSECT || quick_type == QUICK_SELECT_I::QS_TYPE_INDEX_MERGE) { - extra.append("; Using "); + extra.append(STRING_WITH_LEN("; Using ")); tab->select->quick->add_info_string(&extra); } if (tab->select) @@ -13616,7 +13961,8 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, if (tab->use_quick == 2) { char buf[MAX_KEY/8+1]; - extra.append("; Range checked for each record (index map: 0x"); + extra.append(STRING_WITH_LEN("; Range checked for each " + "record (index map: 0x")); extra.append(tab->keys.print(buf)); extra.append(')'); } @@ -13626,38 +13972,39 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, if (thd->variables.engine_condition_pushdown && pushed_cond) { - extra.append("; Using where with pushed condition"); + extra.append(STRING_WITH_LEN("; Using where with pushed " + "condition")); if (thd->lex->describe & DESCRIBE_EXTENDED) { - extra.append(": "); + extra.append(STRING_WITH_LEN(": ")); ((COND *)pushed_cond)->print(&extra); } } else - extra.append("; Using where"); + extra.append(STRING_WITH_LEN("; Using where")); } } if (key_read) { if (quick_type == QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX) - extra.append("; Using index for group-by"); + extra.append(STRING_WITH_LEN("; Using index for group-by")); else - extra.append("; Using index"); + extra.append(STRING_WITH_LEN("; Using index")); } if (table->reginfo.not_exists_optimize) - extra.append("; Not exists"); + extra.append(STRING_WITH_LEN("; Not exists")); if (need_tmp_table) { need_tmp_table=0; - extra.append("; Using temporary"); + extra.append(STRING_WITH_LEN("; Using temporary")); } if (need_order) { need_order=0; - extra.append("; Using filesort"); + extra.append(STRING_WITH_LEN("; Using filesort")); } if (distinct & test_all_bits(used_tables,thd->used_tables)) - extra.append("; Distinct"); + extra.append(STRING_WITH_LEN("; Distinct")); /* Skip initial "; "*/ const char *str= extra.ptr(); @@ -13774,15 +14121,18 @@ static void print_join(THD *thd, String *str, List *tables) { TABLE_LIST *curr= *tbl; if (curr->outer_join) - str->append(" left join ", 11); // MySQL converts right to left joins + { + /* MySQL converts right to left joins */ + str->append(STRING_WITH_LEN(" left join ")); + } else if (curr->straight) - str->append(" straight_join ", 15); + str->append(STRING_WITH_LEN(" straight_join ")); else - str->append(" join ", 6); + str->append(STRING_WITH_LEN(" join ")); curr->print(thd, str); if (curr->on_expr) { - str->append(" on(", 4); + str->append(STRING_WITH_LEN(" on(")); curr->on_expr->print(str); str->append(')'); } @@ -13867,28 +14217,28 @@ void st_select_lex::print(THD *thd, String *str) if (!thd) thd= current_thd; - str->append("select ", 7); + str->append(STRING_WITH_LEN("select ")); /* First add options */ if (options & SELECT_STRAIGHT_JOIN) - str->append("straight_join ", 14); + str->append(STRING_WITH_LEN("straight_join ")); if ((thd->lex->lock_option == TL_READ_HIGH_PRIORITY) && (this == &thd->lex->select_lex)) - str->append("high_priority ", 14); + str->append(STRING_WITH_LEN("high_priority ")); if (options & SELECT_DISTINCT) - str->append("distinct ", 9); + str->append(STRING_WITH_LEN("distinct ")); if (options & SELECT_SMALL_RESULT) - str->append("sql_small_result ", 17); + str->append(STRING_WITH_LEN("sql_small_result ")); if (options & SELECT_BIG_RESULT) - str->append("sql_big_result ", 15); + str->append(STRING_WITH_LEN("sql_big_result ")); if (options & OPTION_BUFFER_RESULT) - str->append("sql_buffer_result ", 18); + str->append(STRING_WITH_LEN("sql_buffer_result ")); if (options & OPTION_FOUND_ROWS) - str->append("sql_calc_found_rows ", 20); + str->append(STRING_WITH_LEN("sql_calc_found_rows ")); if (!thd->lex->safe_to_cache_query) - str->append("sql_no_cache ", 13); + str->append(STRING_WITH_LEN("sql_no_cache ")); if (options & OPTION_TO_QUERY_CACHE) - str->append("sql_cache ", 10); + str->append(STRING_WITH_LEN("sql_cache ")); //Item List bool first= 1; @@ -13909,7 +14259,7 @@ void st_select_lex::print(THD *thd, String *str) */ if (table_list.elements) { - str->append(" from ", 6); + str->append(STRING_WITH_LEN(" from ")); /* go through join tree */ print_join(thd, str, &top_join_list); } @@ -13920,22 +14270,22 @@ void st_select_lex::print(THD *thd, String *str) cur_where= join->conds; if (cur_where) { - str->append(" where ", 7); + str->append(STRING_WITH_LEN(" where ")); cur_where->print(str); } // group by & olap if (group_list.elements) { - str->append(" group by ", 10); + str->append(STRING_WITH_LEN(" group by ")); print_order(str, (ORDER *) group_list.first); switch (olap) { case CUBE_TYPE: - str->append(" with cube", 10); + str->append(STRING_WITH_LEN(" with cube")); break; case ROLLUP_TYPE: - str->append(" with rollup", 12); + str->append(STRING_WITH_LEN(" with rollup")); break; default: ; //satisfy compiler @@ -13949,13 +14299,13 @@ void st_select_lex::print(THD *thd, String *str) if (cur_having) { - str->append(" having ", 8); + str->append(STRING_WITH_LEN(" having ")); cur_having->print(str); } if (order_list.elements) { - str->append(" order by ", 10); + str->append(STRING_WITH_LEN(" order by ")); print_order(str, (ORDER *) order_list.first); } diff --git a/sql/sql_select.h b/sql/sql_select.h index ec969e51c8d..aa50f691bce 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -137,8 +137,16 @@ typedef struct st_join_table { TABLE_REF ref; JOIN_CACHE cache; JOIN *join; - + /* Bitmap of nested joins this table is part of */ + nested_join_map embedding_map; + void cleanup(); + inline bool is_using_loose_index_scan() + { + return (select && select->quick && + (select->quick->get_type() == + QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX)); + } } JOIN_TAB; enum_nested_loop_state sub_select_cache(JOIN *join, JOIN_TAB *join_tab, bool @@ -194,6 +202,13 @@ class JOIN :public Sql_alloc */ ha_rows fetch_limit; POSITION positions[MAX_TABLES+1],best_positions[MAX_TABLES+1]; + + /* + Bitmap of nested joins embedding the position at the end of the current + partial join (valid only during join optimizer run). + */ + nested_join_map cur_embedding_map; + double best_read; List *fields; List group_fields, group_fields_cache; @@ -431,10 +446,11 @@ class store_key :public Sql_alloc { if (field_arg->type() == FIELD_TYPE_BLOB) { - /* Key segments are always packed with a 2 byte length prefix */ - to_field=new Field_varstring(ptr, length, 2, (uchar*) null, 1, - Field::NONE, field_arg->field_name, - field_arg->table, field_arg->charset()); + /* Key segments are always packed with a 2 byte length prefix */ + to_field= new Field_varstring(ptr, length, 2, (uchar*) null, 1, + Field::NONE, field_arg->field_name, + field_arg->table->s, field_arg->charset()); + to_field->init(field_arg->table); } else to_field=field_arg->new_key_field(thd->mem_root, field_arg->table, diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 2548e77449b..badc15f2ab5 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -23,6 +23,7 @@ #include "sp.h" #include "sp_head.h" #include "sql_trigger.h" +#include "authors.h" #include @@ -56,6 +57,9 @@ bool mysqld_show_storage_engines(THD *thd) field_list.push_back(new Item_empty_string("Engine",10)); field_list.push_back(new Item_empty_string("Support",10)); field_list.push_back(new Item_empty_string("Comment",80)); + field_list.push_back(new Item_empty_string("Transactions",3)); + field_list.push_back(new Item_empty_string("XA",3)); + field_list.push_back(new Item_empty_string("Savepoints",3)); if (protocol->send_fields(&field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) @@ -67,15 +71,54 @@ bool mysqld_show_storage_engines(THD *thd) handlerton **types; for (types= sys_table_types; *types; types++) { - protocol->prepare_for_resend(); - protocol->store((*types)->name, system_charset_info); - const char *option_name= show_comp_option_name[(int) (*types)->state]; + if (!((*types)->flags & HTON_HIDDEN)) + { + protocol->prepare_for_resend(); + protocol->store((*types)->name, system_charset_info); + const char *option_name= show_comp_option_name[(int) (*types)->state]; - if ((*types)->state == SHOW_OPTION_YES && - !my_strcasecmp(system_charset_info, default_type_name, (*types)->name)) - option_name= "DEFAULT"; - protocol->store(option_name, system_charset_info); - protocol->store((*types)->comment, system_charset_info); + if ((*types)->state == SHOW_OPTION_YES && + !my_strcasecmp(system_charset_info, default_type_name, (*types)->name)) + option_name= "DEFAULT"; + protocol->store(option_name, system_charset_info); + protocol->store((*types)->comment, system_charset_info); + protocol->store((*types)->commit ? "YES" : "NO", system_charset_info); + protocol->store((*types)->prepare ? "YES" : "NO", system_charset_info); + protocol->store((*types)->savepoint_set ? "YES" : "NO", system_charset_info); + if (protocol->write()) + DBUG_RETURN(TRUE); + } + } + send_eof(thd); + DBUG_RETURN(FALSE); +} + +/*************************************************************************** +** List all Authors. +** If you can update it, you get to be in it :) +***************************************************************************/ + +bool mysqld_show_authors(THD *thd) +{ + List field_list; + Protocol *protocol= thd->protocol; + DBUG_ENTER("mysqld_show_authors"); + + field_list.push_back(new Item_empty_string("Name",40)); + field_list.push_back(new Item_empty_string("Location",40)); + field_list.push_back(new Item_empty_string("Comment",80)); + + if (protocol->send_fields(&field_list, + Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) + DBUG_RETURN(TRUE); + + show_table_authors_st *authors; + for (authors= show_table_authors; authors->name; authors++) + { + protocol->prepare_for_resend(); + protocol->store(authors->name, system_charset_info); + protocol->store(authors->location, system_charset_info); + protocol->store(authors->comment, system_charset_info); if (protocol->write()) DBUG_RETURN(TRUE); } @@ -83,7 +126,6 @@ bool mysqld_show_storage_engines(THD *thd) DBUG_RETURN(FALSE); } - /*************************************************************************** List all privileges supported ***************************************************************************/ @@ -356,7 +398,21 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list) /* Only one table for now, but VIEW can involve several tables */ if (open_normal_and_derived_tables(thd, table_list, 0)) - DBUG_RETURN(TRUE); + { + if (!table_list->view || thd->net.last_errno != ER_VIEW_INVALID) + DBUG_RETURN(TRUE); + /* + Clear all messages with 'error' level status and + issue a warning with 'warning' level status in + case of invalid view and last error is ER_VIEW_INVALID + */ + mysql_reset_errors(thd, true); + push_warning_printf(thd,MYSQL_ERROR::WARN_LEVEL_WARN, + ER_VIEW_INVALID, + ER(ER_VIEW_INVALID), + table_list->view_db.str, + table_list->view_name.str); + } /* TODO: add environment variables show when it become possible */ if (thd->lex->only_view && !table_list->view) @@ -426,12 +482,6 @@ bool mysqld_show_create_db(THD *thd, char *dbname, Protocol *protocol=thd->protocol; DBUG_ENTER("mysql_show_create_db"); - if (check_db_name(dbname)) - { - my_error(ER_WRONG_DB_NAME, MYF(0), dbname); - DBUG_RETURN(TRUE); - } - #ifndef NO_EMBEDDED_ACCESS_CHECKS if (test_all_bits(sctx->master_access, DB_ACLS)) db_access=DB_ACLS; @@ -484,22 +534,22 @@ bool mysqld_show_create_db(THD *thd, char *dbname, protocol->prepare_for_resend(); protocol->store(dbname, strlen(dbname), system_charset_info); buffer.length(0); - buffer.append("CREATE DATABASE ", 16); + buffer.append(STRING_WITH_LEN("CREATE DATABASE ")); if (create_options & HA_LEX_CREATE_IF_NOT_EXISTS) - buffer.append("/*!32312 IF NOT EXISTS*/ ", 25); + buffer.append(STRING_WITH_LEN("/*!32312 IF NOT EXISTS*/ ")); append_identifier(thd, &buffer, dbname, strlen(dbname)); if (create.default_table_charset) { - buffer.append(" /*!40100", 9); - buffer.append(" DEFAULT CHARACTER SET ", 23); + buffer.append(STRING_WITH_LEN(" /*!40100")); + buffer.append(STRING_WITH_LEN(" DEFAULT CHARACTER SET ")); buffer.append(create.default_table_charset->csname); if (!(create.default_table_charset->state & MY_CS_PRIMARY)) { - buffer.append(" COLLATE ", 9); + buffer.append(STRING_WITH_LEN(" COLLATE ")); buffer.append(create.default_table_charset->name); } - buffer.append(" */", 3); + buffer.append(STRING_WITH_LEN(" */")); } protocol->store(buffer.ptr(), buffer.length(), buffer.charset()); @@ -551,7 +601,7 @@ mysqld_dump_create_info(THD *thd, TABLE_LIST *table_list, int fd) Protocol *protocol= thd->protocol; String *packet= protocol->storage_packet(); DBUG_ENTER("mysqld_dump_create_info"); - DBUG_PRINT("enter",("table: %s",table_list->table->s->table_name)); + DBUG_PRINT("enter",("table: %s",table_list->table->s->table_name.str)); protocol->prepare_for_resend(); if (store_create_info(thd, table_list, packet)) @@ -687,7 +737,7 @@ static void append_directory(THD *thd, String *packet, const char *dir_type, uint length= dirname_length(filename); packet->append(' '); packet->append(dir_type); - packet->append(" DIRECTORY='", 12); + packet->append(STRING_WITH_LEN(" DIRECTORY='")); #ifdef __WIN__ /* Convert \ to / to be able to create table on unix */ char *winfilename= (char*) thd->memdup(filename, length); @@ -731,21 +781,21 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet) (MODE_NO_FIELD_OPTIONS | MODE_MYSQL323 | MODE_MYSQL40)) != 0; DBUG_ENTER("store_create_info"); - DBUG_PRINT("enter",("table: %s", table->s->table_name)); + DBUG_PRINT("enter",("table: %s", table->s->table_name.str)); restore_record(table, s->default_values); // Get empty record if (share->tmp_table) - packet->append("CREATE TEMPORARY TABLE ", 23); + packet->append(STRING_WITH_LEN("CREATE TEMPORARY TABLE ")); else - packet->append("CREATE TABLE ", 13); + packet->append(STRING_WITH_LEN("CREATE TABLE ")); if (table_list->schema_table) alias= table_list->schema_table->table_name; else alias= (lower_case_table_names == 2 ? table->alias : - share->table_name); + share->table_name.str); append_identifier(thd, packet, alias, strlen(alias)); - packet->append(" (\n", 3); + packet->append(STRING_WITH_LEN(" (\n")); for (ptr=table->field ; (field= *ptr); ptr++) { @@ -754,9 +804,9 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet) uint flags = field->flags; if (ptr != table->field) - packet->append(",\n", 2); + packet->append(STRING_WITH_LEN(",\n")); - packet->append(" ", 2); + packet->append(STRING_WITH_LEN(" ")); append_identifier(thd,packet,field->field_name, strlen(field->field_name)); packet->append(' '); // check for surprises from the previous call to Field::sql_type() @@ -773,7 +823,7 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet) { if (field->charset() != share->table_charset) { - packet->append(" character set ", 15); + packet->append(STRING_WITH_LEN(" character set ")); packet->append(field->charset()->csname); } /* @@ -782,20 +832,20 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet) */ if (!(field->charset()->state & MY_CS_PRIMARY)) { - packet->append(" collate ", 9); + packet->append(STRING_WITH_LEN(" collate ")); packet->append(field->charset()->name); } } if (flags & NOT_NULL_FLAG) - packet->append(" NOT NULL", 9); + packet->append(STRING_WITH_LEN(" NOT NULL")); else if (field->type() == FIELD_TYPE_TIMESTAMP) { /* TIMESTAMP field require explicit NULL flag, because unlike all other fields they are treated as NOT NULL by default. */ - packet->append(" NULL", 5); + packet->append(STRING_WITH_LEN(" NULL")); } /* @@ -813,9 +863,9 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet) if (has_default) { - packet->append(" default ", 9); + packet->append(STRING_WITH_LEN(" default ")); if (has_now_default) - packet->append("CURRENT_TIMESTAMP",17); + packet->append(STRING_WITH_LEN("CURRENT_TIMESTAMP")); else if (!field->is_null()) { // Not null by default type.set(tmp, sizeof(tmp), field->charset()); @@ -830,10 +880,10 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet) append_unescaped(packet, def_val.ptr(), def_val.length()); } else - packet->append("''",2); + packet->append(STRING_WITH_LEN("''")); } else if (field->maybe_null()) - packet->append("NULL", 4); // Null as default + packet->append(STRING_WITH_LEN("NULL")); // Null as default else packet->append(tmp); } @@ -841,21 +891,20 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet) if (!(thd->variables.sql_mode & MODE_NO_FIELD_OPTIONS) && table->timestamp_field == field && field->unireg_check != Field::TIMESTAMP_DN_FIELD) - packet->append(" on update CURRENT_TIMESTAMP",28); + packet->append(STRING_WITH_LEN(" on update CURRENT_TIMESTAMP")); if (field->unireg_check == Field::NEXT_NUMBER && !(thd->variables.sql_mode & MODE_NO_FIELD_OPTIONS)) - packet->append(" auto_increment", 15 ); + packet->append(STRING_WITH_LEN(" auto_increment")); if (field->comment.length) { - packet->append(" COMMENT ",9); + packet->append(STRING_WITH_LEN(" COMMENT ")); append_unescaped(packet, field->comment.str, field->comment.length); } } key_info= table->key_info; - file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK | HA_STATUS_TIME); bzero((char*) &create_info, sizeof(create_info)); file->update_create_info(&create_info); primary_key= share->primary_key; @@ -864,20 +913,20 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet) { KEY_PART_INFO *key_part= key_info->key_part; bool found_primary=0; - packet->append(",\n ", 4); + packet->append(STRING_WITH_LEN(",\n ")); if (i == primary_key && !strcmp(key_info->name, primary_key_name)) { found_primary=1; - packet->append("PRIMARY ", 8); + packet->append(STRING_WITH_LEN("PRIMARY ")); } else if (key_info->flags & HA_NOSAME) - packet->append("UNIQUE ", 7); + packet->append(STRING_WITH_LEN("UNIQUE ")); else if (key_info->flags & HA_FULLTEXT) - packet->append("FULLTEXT ", 9); + packet->append(STRING_WITH_LEN("FULLTEXT ")); else if (key_info->flags & HA_SPATIAL) - packet->append("SPATIAL ", 8); - packet->append("KEY ", 4); + packet->append(STRING_WITH_LEN("SPATIAL ")); + packet->append(STRING_WITH_LEN("KEY ")); if (!found_primary) append_identifier(thd, packet, key_info->name, strlen(key_info->name)); @@ -886,19 +935,19 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet) !limited_mysql_mode && !foreign_db_mode) { if (key_info->algorithm == HA_KEY_ALG_BTREE) - packet->append(" USING BTREE", 12); + packet->append(STRING_WITH_LEN(" USING BTREE")); if (key_info->algorithm == HA_KEY_ALG_HASH) - packet->append(" USING HASH", 11); + packet->append(STRING_WITH_LEN(" USING HASH")); // +BAR: send USING only in non-default case: non-spatial rtree if ((key_info->algorithm == HA_KEY_ALG_RTREE) && !(key_info->flags & HA_SPATIAL)) - packet->append(" USING RTREE", 12); + packet->append(STRING_WITH_LEN(" USING RTREE")); // No need to send USING FULLTEXT, it is sent as FULLTEXT KEY } - packet->append(" (", 2); + packet->append(STRING_WITH_LEN(" (")); for (uint j=0 ; j < key_info->key_parts ; j++,key_part++) { @@ -941,17 +990,17 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet) file->free_foreign_key_create_info(for_str); } - packet->append("\n)", 2); + packet->append(STRING_WITH_LEN("\n)")); if (!(thd->variables.sql_mode & MODE_NO_TABLE_OPTIONS) && !foreign_db_mode) { if (thd->variables.sql_mode & (MODE_MYSQL323 | MODE_MYSQL40)) - packet->append(" TYPE=", 6); + packet->append(STRING_WITH_LEN(" TYPE=")); else - packet->append(" ENGINE=", 8); + packet->append(STRING_WITH_LEN(" ENGINE=")); #ifdef WITH_PARTITION_STORAGE_ENGINE - if (table->s->part_info) - packet->append(ha_get_storage_engine( - table->s->part_info->default_engine_type)); + if (table->part_info) + packet->append(ha_get_storage_engine(table->part_info-> + default_engine_type)); else packet->append(file->table_type()); #else @@ -962,58 +1011,58 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet) !(thd->variables.sql_mode & MODE_MYSQL323) && !(thd->variables.sql_mode & MODE_MYSQL40)) { - packet->append(" DEFAULT CHARSET=", 17); + packet->append(STRING_WITH_LEN(" DEFAULT CHARSET=")); packet->append(share->table_charset->csname); if (!(share->table_charset->state & MY_CS_PRIMARY)) { - packet->append(" COLLATE=", 9); + packet->append(STRING_WITH_LEN(" COLLATE=")); packet->append(table->s->table_charset->name); } } if (share->min_rows) { - packet->append(" MIN_ROWS=", 10); + packet->append(STRING_WITH_LEN(" MIN_ROWS=")); end= longlong10_to_str(share->min_rows, buff, 10); packet->append(buff, (uint) (end- buff)); } if (share->max_rows && !table_list->schema_table) { - packet->append(" MAX_ROWS=", 10); + packet->append(STRING_WITH_LEN(" MAX_ROWS=")); end= longlong10_to_str(share->max_rows, buff, 10); packet->append(buff, (uint) (end - buff)); } if (share->avg_row_length) { - packet->append(" AVG_ROW_LENGTH=", 16); + packet->append(STRING_WITH_LEN(" AVG_ROW_LENGTH=")); end= longlong10_to_str(share->avg_row_length, buff,10); packet->append(buff, (uint) (end - buff)); } if (share->db_create_options & HA_OPTION_PACK_KEYS) - packet->append(" PACK_KEYS=1", 12); + packet->append(STRING_WITH_LEN(" PACK_KEYS=1")); if (share->db_create_options & HA_OPTION_NO_PACK_KEYS) - packet->append(" PACK_KEYS=0", 12); + packet->append(STRING_WITH_LEN(" PACK_KEYS=0")); if (share->db_create_options & HA_OPTION_CHECKSUM) - packet->append(" CHECKSUM=1", 11); + packet->append(STRING_WITH_LEN(" CHECKSUM=1")); if (share->db_create_options & HA_OPTION_DELAY_KEY_WRITE) - packet->append(" DELAY_KEY_WRITE=1",18); + packet->append(STRING_WITH_LEN(" DELAY_KEY_WRITE=1")); if (share->row_type != ROW_TYPE_DEFAULT) { - packet->append(" ROW_FORMAT=",12); + packet->append(STRING_WITH_LEN(" ROW_FORMAT=")); packet->append(ha_row_type[(uint) share->row_type]); } table->file->append_create_info(packet); if (share->comment && share->comment[0]) { - packet->append(" COMMENT=", 9); + packet->append(STRING_WITH_LEN(" COMMENT=")); append_unescaped(packet, share->comment, strlen(share->comment)); } if (share->connect_string.length) { - packet->append(" CONNECTION=", 12); + packet->append(STRING_WITH_LEN(" CONNECTION=")); append_unescaped(packet, share->connect_string.str, share->connect_string.length); } if (file->raid_type) @@ -1035,10 +1084,10 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet) */ uint part_syntax_len; char *part_syntax; - if (table->s->part_info && - ((part_syntax= generate_partition_syntax(table->s->part_info, - &part_syntax_len, - FALSE,FALSE)))) + if (table->part_info && + ((part_syntax= generate_partition_syntax(table->part_info, + &part_syntax_len, + FALSE,FALSE)))) { packet->append(part_syntax, part_syntax_len); my_free(part_syntax, MYF(0)); @@ -1051,32 +1100,50 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet) void view_store_options(THD *thd, TABLE_LIST *table, String *buff) { - buff->append("ALGORITHM=", 10); + buff->append(STRING_WITH_LEN("ALGORITHM=")); switch ((int8)table->algorithm) { case VIEW_ALGORITHM_UNDEFINED: - buff->append("UNDEFINED ", 10); + buff->append(STRING_WITH_LEN("UNDEFINED ")); break; case VIEW_ALGORITHM_TMPTABLE: - buff->append("TEMPTABLE ", 10); + buff->append(STRING_WITH_LEN("TEMPTABLE ")); break; case VIEW_ALGORITHM_MERGE: - buff->append("MERGE ", 6); + buff->append(STRING_WITH_LEN("MERGE ")); break; default: DBUG_ASSERT(0); // never should happen } - buff->append("DEFINER=", 8); - append_identifier(thd, buff, - table->definer.user.str, table->definer.user.length); - buff->append('@'); - append_identifier(thd, buff, - table->definer.host.str, table->definer.host.length); + append_definer(thd, buff, &table->definer.user, &table->definer.host); if (table->view_suid) - buff->append(" SQL SECURITY DEFINER ", 22); + buff->append(STRING_WITH_LEN("SQL SECURITY DEFINER ")); else - buff->append(" SQL SECURITY INVOKER ", 22); + buff->append(STRING_WITH_LEN("SQL SECURITY INVOKER ")); } + +/* + Append DEFINER clause to the given buffer. + + SYNOPSIS + append_definer() + thd [in] thread handle + buffer [inout] buffer to hold DEFINER clause + definer_user [in] user name part of definer + definer_host [in] host name part of definer +*/ + +void append_definer(THD *thd, String *buffer, const LEX_STRING *definer_user, + const LEX_STRING *definer_host) +{ + buffer->append(STRING_WITH_LEN("DEFINER=")); + append_identifier(thd, buffer, definer_user->str, definer_user->length); + buffer->append('@'); + append_identifier(thd, buffer, definer_host->str, definer_host->length); + buffer->append(' '); +} + + static int view_store_create_info(THD *thd, TABLE_LIST *table, String *buff) { @@ -1109,19 +1176,19 @@ view_store_create_info(THD *thd, TABLE_LIST *table, String *buff) } } - buff->append("CREATE ", 7); + buff->append(STRING_WITH_LEN("CREATE ")); if (!foreign_db_mode) { view_store_options(thd, table, buff); } - buff->append("VIEW ", 5); + buff->append(STRING_WITH_LEN("VIEW ")); if (!table->compact_view_format) { append_identifier(thd, buff, table->view_db.str, table->view_db.length); buff->append('.'); } append_identifier(thd, buff, table->view_name.str, table->view_name.length); - buff->append(" AS ", 4); + buff->append(STRING_WITH_LEN(" AS ")); /* We can't just use table->query, because our SQL_MODE may trigger @@ -1132,9 +1199,9 @@ view_store_create_info(THD *thd, TABLE_LIST *table, String *buff) if (table->with_check != VIEW_CHECK_NONE) { if (table->with_check == VIEW_CHECK_LOCAL) - buff->append(" WITH LOCAL CHECK OPTION", 24); + buff->append(STRING_WITH_LEN(" WITH LOCAL CHECK OPTION")); else - buff->append(" WITH CASCADED CHECK OPTION", 27); + buff->append(STRING_WITH_LEN(" WITH CASCADED CHECK OPTION")); } return 0; } @@ -1396,7 +1463,7 @@ static bool show_status_array(THD *thd, const char *wild, case SHOW_SLAVE_RUNNING: { pthread_mutex_lock(&LOCK_active_mi); - end= strmov(buff, (active_mi->slave_running && + end= strmov(buff, (active_mi && active_mi->slave_running && active_mi->rli.slave_running) ? "ON" : "OFF"); pthread_mutex_unlock(&LOCK_active_mi); break; @@ -1407,12 +1474,15 @@ static bool show_status_array(THD *thd, const char *wild, TODO: in 5.1 with multimaster, have one such counter per line in SHOW SLAVE STATUS, and have the sum over all lines here. */ - pthread_mutex_lock(&LOCK_active_mi); - pthread_mutex_lock(&active_mi->rli.data_lock); - end= int10_to_str(active_mi->rli.retried_trans, buff, 10); - pthread_mutex_unlock(&active_mi->rli.data_lock); - pthread_mutex_unlock(&LOCK_active_mi); - break; + pthread_mutex_lock(&LOCK_active_mi); + if (active_mi) + { + pthread_mutex_lock(&active_mi->rli.data_lock); + end= int10_to_str(active_mi->rli.retried_trans, buff, 10); + pthread_mutex_unlock(&active_mi->rli.data_lock); + } + pthread_mutex_unlock(&LOCK_active_mi); + break; } case SHOW_SLAVE_SKIP_ERRORS: { @@ -1447,8 +1517,11 @@ static bool show_status_array(THD *thd, const char *wild, break; } #endif /* HAVE_REPLICATION */ - case SHOW_OPENTABLES: - end= int10_to_str((long) cached_tables(), buff, 10); + case SHOW_OPEN_TABLES: + end= int10_to_str((long) cached_open_tables(), buff, 10); + break; + case SHOW_TABLE_DEFINITIONS: + end= int10_to_str((long) cached_table_definitions(), buff, 10); break; case SHOW_CHAR_PTR: { @@ -2118,20 +2191,24 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) { if (with_i_schema) { - table->field[3]->store("SYSTEM VIEW", 11, system_charset_info); + table->field[3]->store(STRING_WITH_LEN("SYSTEM VIEW"), + system_charset_info); } else { my_snprintf(end, len, "/%s%s", file_name, reg_ext); switch (mysql_frm_type(thd, path, ¬_used)) { case FRMTYPE_ERROR: - table->field[3]->store("ERROR", 5, system_charset_info); + table->field[3]->store(STRING_WITH_LEN("ERROR"), + system_charset_info); break; case FRMTYPE_TABLE: - table->field[3]->store("BASE TABLE", 10, system_charset_info); + table->field[3]->store(STRING_WITH_LEN("BASE TABLE"), + system_charset_info); break; case FRMTYPE_VIEW: - table->field[3]->store("VIEW", 4, system_charset_info); + table->field[3]->store(STRING_WITH_LEN("VIEW"), + system_charset_info); break; default: DBUG_ASSERT(0); @@ -2279,13 +2356,19 @@ static int get_schema_tables_record(THD *thd, struct st_table_list *tables, there was errors during opening tables */ const char *error= thd->net.last_error; + if (tables->view) + table->field[3]->store(STRING_WITH_LEN("VIEW"), cs); + else if (tables->schema_table) + table->field[3]->store(STRING_WITH_LEN("SYSTEM VIEW"), cs); + else + table->field[3]->store(STRING_WITH_LEN("BASE TABLE"), cs); table->field[20]->store(error, strlen(error), cs); thd->clear_error(); } else if (tables->view) { - table->field[3]->store("VIEW", 4, cs); - table->field[20]->store("VIEW", 4, cs); + table->field[3]->store(STRING_WITH_LEN("VIEW"), cs); + table->field[20]->store(STRING_WITH_LEN("VIEW"), cs); } else { @@ -2296,11 +2379,11 @@ static int get_schema_tables_record(THD *thd, struct st_table_list *tables, file->info(HA_STATUS_VARIABLE | HA_STATUS_TIME | HA_STATUS_AUTO | HA_STATUS_NO_LOCK); if (share->tmp_table == SYSTEM_TMP_TABLE) - table->field[3]->store("SYSTEM VIEW", 11, cs); + table->field[3]->store(STRING_WITH_LEN("SYSTEM VIEW"), cs); else if (share->tmp_table) - table->field[3]->store("LOCAL TEMPORARY", 15, cs); + table->field[3]->store(STRING_WITH_LEN("LOCAL TEMPORARY"), cs); else - table->field[3]->store("BASE TABLE", 10, cs); + table->field[3]->store(STRING_WITH_LEN("BASE TABLE"), cs); for (int i= 4; i < 20; i++) { @@ -2536,7 +2619,7 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables, if (show_table->timestamp_field == field && field->unireg_check != Field::TIMESTAMP_UN_FIELD) { - table->field[5]->store("CURRENT_TIMESTAMP", 17, cs); + table->field[5]->store(STRING_WITH_LEN("CURRENT_TIMESTAMP"), cs); table->field[5]->set_notnull(); } else if (field->unireg_check != Field::NEXT_NUMBER && @@ -2798,8 +2881,8 @@ bool store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table, get_field(thd->mem_root, proc_table->field[10], &tmp_string); table->field[7]->store(tmp_string.ptr(), tmp_string.length(), cs); } - table->field[6]->store("SQL", 3, cs); - table->field[10]->store("SQL", 3, cs); + table->field[6]->store(STRING_WITH_LEN("SQL"), cs); + table->field[10]->store(STRING_WITH_LEN("SQL"), cs); get_field(thd->mem_root, proc_table->field[6], &tmp_string); table->field[11]->store(tmp_string.ptr(), tmp_string.length(), cs); table->field[12]->store(sp_data_access_name[enum_idx].str, @@ -2954,7 +3037,7 @@ static int get_schema_stat_record(THD *thd, struct st_table_list *tables, pos= show_table->file->index_type(i); table->field[13]->store(pos, strlen(pos), cs); if (!show_table->s->keys_in_use.is_set(i)) - table->field[14]->store("disabled", 8, cs); + table->field[14]->store(STRING_WITH_LEN("disabled"), cs); else table->field[14]->store("", 0, cs); table->field[14]->set_notnull(); @@ -2976,47 +3059,44 @@ static int get_schema_views_record(THD *thd, struct st_table_list *tables, DBUG_ENTER("get_schema_views_record"); char definer[HOSTNAME_LENGTH + USERNAME_LENGTH + 2]; uint definer_len; - if (!res) + + if (tables->view) { - if (tables->view) + restore_record(table, s->default_values); + table->field[1]->store(tables->view_db.str, tables->view_db.length, cs); + table->field[2]->store(tables->view_name.str, tables->view_name.length, + cs); + table->field[3]->store(tables->query.str, tables->query.length, cs); + + if (tables->with_check != VIEW_CHECK_NONE) { - restore_record(table, s->default_values); - table->field[1]->store(tables->view_db.str, tables->view_db.length, cs); - table->field[2]->store(tables->view_name.str, tables->view_name.length, - cs); - table->field[3]->store(tables->query.str, tables->query.length, cs); - - if (tables->with_check != VIEW_CHECK_NONE) - { - if (tables->with_check == VIEW_CHECK_LOCAL) - table->field[4]->store(STRING_WITH_LEN("LOCAL"), cs); - else - table->field[4]->store(STRING_WITH_LEN("CASCADED"), cs); - } + if (tables->with_check == VIEW_CHECK_LOCAL) + table->field[4]->store(STRING_WITH_LEN("LOCAL"), cs); else - table->field[4]->store(STRING_WITH_LEN("NONE"), cs); - - if (tables->updatable_view) - table->field[5]->store(STRING_WITH_LEN("YES"), cs); - else - table->field[5]->store(STRING_WITH_LEN("NO"), cs); - definer_len= (strxmov(definer, tables->definer.user.str, "@", - tables->definer.host.str, NullS) - definer); - table->field[6]->store(definer, definer_len, cs); - if (tables->view_suid) - table->field[7]->store(STRING_WITH_LEN("DEFINER"), cs); - else - table->field[7]->store(STRING_WITH_LEN("INVOKER"), cs); - DBUG_RETURN(schema_table_store_record(thd, table)); + table->field[4]->store(STRING_WITH_LEN("CASCADED"), cs); } - } - else - { - if (tables->view) + else + table->field[4]->store(STRING_WITH_LEN("NONE"), cs); + + if (tables->updatable_view) + table->field[5]->store(STRING_WITH_LEN("YES"), cs); + else + table->field[5]->store(STRING_WITH_LEN("NO"), cs); + definer_len= (strxmov(definer, tables->definer.user.str, "@", + tables->definer.host.str, NullS) - definer); + table->field[6]->store(definer, definer_len, cs); + if (tables->view_suid) + table->field[7]->store(STRING_WITH_LEN("DEFINER"), cs); + else + table->field[7]->store(STRING_WITH_LEN("INVOKER"), cs); + if (schema_table_store_record(thd, table)) + DBUG_RETURN(1); + if (res) push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, thd->net.last_errno, thd->net.last_error); - thd->clear_error(); } + if (res) + thd->clear_error(); DBUG_RETURN(0); } @@ -3067,13 +3147,15 @@ static int get_schema_constraints_record(THD *thd, struct st_table_list *tables, if (i == primary_key && !strcmp(key_info->name, primary_key_name)) { if (store_constraints(thd, table, base_name, file_name, key_info->name, - strlen(key_info->name), "PRIMARY KEY", 11)) + strlen(key_info->name), + STRING_WITH_LEN("PRIMARY KEY"))) DBUG_RETURN(1); } else if (key_info->flags & HA_NOSAME) { if (store_constraints(thd, table, base_name, file_name, key_info->name, - strlen(key_info->name), "UNIQUE", 6)) + strlen(key_info->name), + STRING_WITH_LEN("UNIQUE"))) DBUG_RETURN(1); } } @@ -3099,7 +3181,8 @@ static bool store_trigger(THD *thd, TABLE *table, const char *db, enum trg_event_type event, enum trg_action_time_type timing, LEX_STRING *trigger_stmt, - ulong sql_mode) + ulong sql_mode, + LEX_STRING *definer_buffer) { CHARSET_INFO *cs= system_charset_info; byte *sql_mode_str; @@ -3113,17 +3196,18 @@ static bool store_trigger(THD *thd, TABLE *table, const char *db, table->field[5]->store(db, strlen(db), cs); table->field[6]->store(tname, strlen(tname), cs); table->field[9]->store(trigger_stmt->str, trigger_stmt->length, cs); - table->field[10]->store("ROW", 3, cs); + table->field[10]->store(STRING_WITH_LEN("ROW"), cs); table->field[11]->store(trg_action_time_type_names[timing].str, trg_action_time_type_names[timing].length, cs); - table->field[14]->store("OLD", 3, cs); - table->field[15]->store("NEW", 3, cs); + table->field[14]->store(STRING_WITH_LEN("OLD"), cs); + table->field[15]->store(STRING_WITH_LEN("NEW"), cs); sql_mode_str= sys_var_thd_sql_mode::symbolic_mode_representation(thd, sql_mode, &sql_mode_len); table->field[17]->store((const char*)sql_mode_str, sql_mode_len, cs); + table->field[18]->store((const char *)definer_buffer->str, definer_buffer->length, cs); return schema_table_store_record(thd, table); } @@ -3157,15 +3241,21 @@ static int get_schema_triggers_record(THD *thd, struct st_table_list *tables, LEX_STRING trigger_name; LEX_STRING trigger_stmt; ulong sql_mode; + char definer_holder[HOSTNAME_LENGTH + USERNAME_LENGTH + 2]; + LEX_STRING definer_buffer; + definer_buffer.str= definer_holder; if (triggers->get_trigger_info(thd, (enum trg_event_type) event, (enum trg_action_time_type)timing, &trigger_name, &trigger_stmt, - &sql_mode)) + &sql_mode, + &definer_buffer)) continue; + if (store_trigger(thd, table, base_name, file_name, &trigger_name, (enum trg_event_type) event, (enum trg_action_time_type) timing, &trigger_stmt, - sql_mode)) + sql_mode, + &definer_buffer)) DBUG_RETURN(1); } } @@ -3501,9 +3591,9 @@ int make_schemata_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table) buffer.append(field_info->old_name); if (lex->wild && lex->wild->ptr()) { - buffer.append(" ("); + buffer.append(STRING_WITH_LEN(" (")); buffer.append(lex->wild->ptr()); - buffer.append(")"); + buffer.append(')'); } field->set_name(buffer.ptr(), buffer.length(), system_charset_info); } @@ -3524,9 +3614,9 @@ int make_table_names_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table) buffer.append(lex->select_lex.db); if (lex->wild && lex->wild->ptr()) { - buffer.append(" ("); + buffer.append(STRING_WITH_LEN(" (")); buffer.append(lex->wild->ptr()); - buffer.append(")"); + buffer.append(')'); } Item_field *field= new Item_field(context, NullS, NullS, field_info->field_name); @@ -3661,8 +3751,8 @@ int mysql_schema_table(THD *thd, LEX *lex, TABLE_LIST *table_list) 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_name_length= strlen(table->s->table_name); + table_list->table_name= table->s->table_name.str; + table_list->table_name_length= table->s->table_name.length; table_list->table= table; table->next= thd->derived_tables; thd->derived_tables= table; @@ -4069,6 +4159,7 @@ ST_FIELD_INFO triggers_fields_info[]= {"ACTION_REFERENCE_NEW_ROW", 3, MYSQL_TYPE_STRING, 0, 0, 0}, {"CREATED", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, "Created"}, {"SQL_MODE", 65535, MYSQL_TYPE_STRING, 0, 0, "sql_mode"}, + {"DEFINER", 65535, MYSQL_TYPE_STRING, 0, 0, "Definer"}, {0, 0, MYSQL_TYPE_STRING, 0, 0, 0} }; diff --git a/sql/sql_string.cc b/sql/sql_string.cc index 51f802e7465..fd7bca7ec21 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -848,22 +848,22 @@ void String::print(String *str) switch (c) { case '\\': - str->append("\\\\", 2); + str->append(STRING_WITH_LEN("\\\\")); break; case '\0': - str->append("\\0", 2); + str->append(STRING_WITH_LEN("\\0")); break; case '\'': - str->append("\\'", 2); + str->append(STRING_WITH_LEN("\\'")); break; case '\n': - str->append("\\n", 2); + str->append(STRING_WITH_LEN("\\n")); break; case '\r': - str->append("\\r", 2); + str->append(STRING_WITH_LEN("\\r")); break; case 26: //Ctrl-Z - str->append("\\z", 2); + str->append(STRING_WITH_LEN("\\z")); break; default: str->append(c); diff --git a/sql/sql_string.h b/sql/sql_string.h index ddae6368228..67c3e0c62f2 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -24,6 +24,8 @@ #define NOT_FIXED_DEC 31 #endif +#define STRING_WITH_LEN(X) ((char*) X), (sizeof(X)-1) + class String; int sortcmp(const String *a,const String *b, CHARSET_INFO *cs); String *copy_if_not_alloced(String *a,String *b,uint32 arg_length); diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 94590f6faf2..ff562cf2a39 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -159,23 +159,28 @@ bool mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists, /* mark for close and remove all cached entries */ - thd->mysys_var->current_mutex= &LOCK_open; - thd->mysys_var->current_cond= &COND_refresh; - VOID(pthread_mutex_lock(&LOCK_open)); - if (!drop_temporary) { if ((error= wait_if_global_read_lock(thd, 0, 1))) { my_error(ER_TABLE_NOT_LOCKED_FOR_WRITE, MYF(0), tables->table_name); - goto err; + DBUG_RETURN(TRUE); } else need_start_waiters= TRUE; } + + /* + Acquire LOCK_open after wait_if_global_read_lock(). If we would hold + LOCK_open during wait_if_global_read_lock(), other threads could not + close their tables. This would make a pretty deadlock. + */ + thd->mysys_var->current_mutex= &LOCK_open; + thd->mysys_var->current_cond= &COND_refresh; + VOID(pthread_mutex_lock(&LOCK_open)); + error= mysql_rm_table_part2(thd, tables, if_exists, drop_temporary, 0, 0); -err: pthread_mutex_unlock(&LOCK_open); pthread_mutex_lock(&thd->mysys_var->mutex); @@ -274,9 +279,22 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, String wrong_tables; int error; bool some_tables_deleted=0, tmp_table_deleted=0, foreign_key_error=0; - DBUG_ENTER("mysql_rm_table_part2"); + /* + If we have the table in the definition cache, we don't have to check the + .frm file to find if the table is a normal table (not view) and what + engine to use. + */ + + for (table= tables; table; table= table->next_local) + { + TABLE_SHARE *share; + table->db_type= DB_TYPE_UNKNOWN; + if ((share= get_cached_table_share(table->db, table->table_name))) + table->db_type= share->db_type; + } + if (lock_table_names(thd, tables)) DBUG_RETURN(1); @@ -286,16 +304,17 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, for (table= tables; table; table= table->next_local) { char *db=table->db; - db_type table_type= DB_TYPE_UNKNOWN; + db_type table_type; - mysql_ha_flush(thd, table, MYSQL_HA_CLOSE_FINAL); - if (!close_temporary_table(thd, db, table->table_name)) + mysql_ha_flush(thd, table, MYSQL_HA_CLOSE_FINAL, TRUE); + if (!close_temporary_table(thd, table)) { tmp_table_deleted=1; continue; // removed temporary table } error=0; + table_type= table->db_type; if (!drop_temporary) { abort_locked_tables(thd, db, table->table_name); @@ -309,14 +328,15 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, DBUG_RETURN(-1); } alias= (lower_case_table_names == 2) ? table->alias : table->table_name; - /* remove form file and isam files */ + /* remove .frm file and engine files */ build_table_path(path, sizeof(path), db, alias, reg_ext); } - if (drop_temporary || - (access(path,F_OK) && - ha_create_table_from_engine(thd,db,alias)) || - (!drop_view && - mysql_frm_type(thd, path, &table_type) != FRMTYPE_TABLE)) + if (table_type == DB_TYPE_UNKNOWN && + (drop_temporary || + (access(path, F_OK) && + ha_create_table_from_engine(thd, db, alias)) || + (!drop_view && + mysql_frm_type(thd, path, &table_type) != FRMTYPE_TABLE))) { // Table was not found on disk and table can't be created from engine if (if_exists) @@ -332,7 +352,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, if (table_type == DB_TYPE_UNKNOWN) mysql_frm_type(thd, path, &table_type); *(end=fn_ext(path))=0; // Remove extension for delete - error= ha_delete_table(thd, table_type, path, table->table_name, + error= ha_delete_table(thd, table_type, path, db, table->table_name, !dont_log_query); if ((error == ENOENT || error == HA_ERR_NO_SUCH_TABLE) && (if_exists || table_type == DB_TYPE_UNKNOWN)) @@ -393,16 +413,19 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, } -int quick_rm_table(enum db_type base,const char *db, +bool quick_rm_table(enum db_type base,const char *db, const char *table_name) { char path[FN_REFLEN]; - int error=0; + bool error= 0; + DBUG_ENTER("quick_rm_table"); + build_table_path(path, sizeof(path), db, table_name, reg_ext); if (my_delete(path,MYF(0))) - error=1; /* purecov: inspected */ + error= 1; /* purecov: inspected */ *fn_ext(path)= 0; // Remove reg_ext - return ha_delete_table(current_thd, base, path, table_name, 0) || error; + DBUG_RETURN(ha_delete_table(current_thd, base, path, db, table_name, 0) || + error); } /* @@ -756,7 +779,8 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, MY_CS_BINSORT,MYF(0)))) { char tmp[64]; - strmake(strmake(tmp, save_cs->csname, sizeof(tmp)-4), "_bin", 4); + strmake(strmake(tmp, save_cs->csname, sizeof(tmp)-4), + STRING_WITH_LEN("_bin")); my_error(ER_UNKNOWN_COLLATION, MYF(0), tmp); DBUG_RETURN(-1); } @@ -775,7 +799,14 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, */ if (!interval) { - interval= sql_field->interval= typelib(sql_field->interval_list); + /* + Create the typelib in prepared statement memory if we're + executing one. + */ + MEM_ROOT *stmt_root= thd->stmt_arena->mem_root; + + interval= sql_field->interval= typelib(stmt_root, + sql_field->interval_list); List_iterator it(sql_field->interval_list); String conv, *tmp; for (uint i= 0; (tmp= it++); i++) @@ -786,7 +817,7 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, { uint cnv_errs; conv.copy(tmp->ptr(), tmp->length(), tmp->charset(), cs, &cnv_errs); - interval->type_names[i]= strmake_root(thd->mem_root, conv.ptr(), + interval->type_names[i]= strmake_root(stmt_root, conv.ptr(), conv.length()); interval->type_lengths[i]= conv.length(); } @@ -806,8 +837,22 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, */ if (sql_field->def && cs != sql_field->def->collation.collation) { - if (!(sql_field->def= - sql_field->def->safe_charset_converter(cs))) + Query_arena backup_arena; + bool need_to_change_arena= !thd->stmt_arena->is_conventional(); + if (need_to_change_arena) + { + /* Asser that we don't do that at every PS execute */ + DBUG_ASSERT(thd->stmt_arena->is_first_stmt_execute() || + thd->stmt_arena->is_first_sp_execute()); + thd->set_n_backup_active_arena(thd->stmt_arena, &backup_arena); + } + + sql_field->def= sql_field->def->safe_charset_converter(cs); + + if (need_to_change_arena) + thd->restore_active_arena(thd->stmt_arena, &backup_arena); + + if (! sql_field->def) { /* Could not convert */ my_error(ER_INVALID_DEFAULT, MYF(0), sql_field->field_name); @@ -896,6 +941,7 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, else { /* Field redefined */ + sql_field->def= dup_field->def; sql_field->sql_type= dup_field->sql_type; sql_field->charset= (dup_field->charset ? dup_field->charset : @@ -905,8 +951,15 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, sql_field->key_length= dup_field->key_length; sql_field->create_length_to_internal_length(); sql_field->decimals= dup_field->decimals; - sql_field->flags= dup_field->flags; sql_field->unireg_check= dup_field->unireg_check; + /* + We're making one field from two, the result field will have + dup_field->flags as flags. If we've incremented null_fields + because of sql_field->flags, decrement it back. + */ + if (!(sql_field->flags & NOT_NULL_FLAG)) + null_fields--; + sql_field->flags= dup_field->flags; it2.remove(); // Remove first (create) definition select_field_pos--; break; @@ -1599,7 +1652,8 @@ bool mysql_create_table(THD *thd,const char *db, const char *table_name, if (create_info->row_type == ROW_TYPE_DYNAMIC) db_options|=HA_OPTION_PACK_RECORD; alias= table_case_name(create_info, table_name); - if (!(file=get_new_handler((TABLE*) 0, thd->mem_root, create_info->db_type))) + if (!(file=get_new_handler((TABLE_SHARE*) 0, thd->mem_root, + create_info->db_type))) { my_error(ER_OUTOFMEMORY, MYF(0), 128);//128 bytes invented DBUG_RETURN(TRUE); @@ -1704,8 +1758,8 @@ bool mysql_create_table(THD *thd,const char *db, const char *table_name, build_table_path(path, sizeof(path), db, alias, reg_ext); /* Check if table already exists */ - if ((create_info->options & HA_LEX_CREATE_TMP_TABLE) - && find_temporary_table(thd,db,table_name)) + if ((create_info->options & HA_LEX_CREATE_TMP_TABLE) && + find_temporary_table(thd, db, table_name)) { if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS) { @@ -1731,6 +1785,7 @@ bool mysql_create_table(THD *thd,const char *db, const char *table_name, my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name); goto unlock_and_end; } + DBUG_ASSERT(get_cached_table_share(db, alias) == 0); } /* @@ -1764,13 +1819,14 @@ bool mysql_create_table(THD *thd,const char *db, const char *table_name, create_info->data_file_name= create_info->index_file_name= 0; create_info->table_options=db_options; - if (rea_create_table(thd, path, db, table_name, - create_info, fields, key_count, - key_info_buffer, file)) + if (rea_create_table(thd, path, db, table_name, create_info, fields, + key_count, key_info_buffer, file)) goto unlock_and_end; + if (create_info->options & HA_LEX_CREATE_TMP_TABLE) { /* Open table and put in temporary table list */ + *fn_ext(path)= 0; if (!(open_temporary_table(thd, path, db, table_name, 1))) { (void) rm_temporary_table(create_info->db_type, path); @@ -1855,6 +1911,7 @@ TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info, MYSQL_LOCK **lock) { TABLE tmp_table; // Used during 'create_field()' + TABLE_SHARE share; TABLE *table= 0; uint select_field_count= items->elements; /* Add selected items to field list */ @@ -1866,7 +1923,9 @@ TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info, tmp_table.alias= 0; tmp_table.timestamp_field= 0; - tmp_table.s= &tmp_table.share_not_to_be_used; + tmp_table.s= &share; + init_tmp_table_share(&share, "", 0, "", ""); + tmp_table.s->db_create_options=0; tmp_table.s->blob_ptr_size= portable_sizeof_char_ptr; tmp_table.s->db_low_byte_first= test(create_info->db_type == DB_TYPE_MYISAM || @@ -1957,11 +2016,13 @@ mysql_rename_table(enum db_type base, char from[FN_REFLEN], to[FN_REFLEN], lc_from[FN_REFLEN], lc_to[FN_REFLEN]; char *from_base= from, *to_base= to; char tmp_name[NAME_LEN+1]; - handler *file= (base == DB_TYPE_UNKNOWN ? 0 : - get_new_handler((TABLE*) 0, thd->mem_root, base)); + handler *file; int error=0; DBUG_ENTER("mysql_rename_table"); + file= (base == DB_TYPE_UNKNOWN ? 0 : + get_new_handler((TABLE_SHARE*) 0, thd->mem_root, base)); + build_table_path(from, sizeof(from), old_db, old_name, ""); build_table_path(to, sizeof(to), new_db, new_name, ""); @@ -2022,17 +2083,19 @@ mysql_rename_table(enum db_type base, static void wait_while_table_is_used(THD *thd,TABLE *table, enum ha_extra_function function) { - DBUG_PRINT("enter",("table: %s", table->s->table_name)); DBUG_ENTER("wait_while_table_is_used"); - safe_mutex_assert_owner(&LOCK_open); + DBUG_PRINT("enter", ("table: '%s' share: 0x%lx db_stat: %u version: %u", + table->s->table_name.str, (ulong) table->s, + table->db_stat, table->s->version)); VOID(table->file->extra(function)); /* Mark all tables that are in use as 'old' */ mysql_lock_abort(thd, table); // end threads waiting on lock /* Wait until all there are no other threads that has this table open */ - remove_table_from_cache(thd, table->s->db, - table->s->table_name, RTFC_WAIT_OTHER_THREAD_FLAG); + remove_table_from_cache(thd, table->s->db.str, + table->s->table_name.str, + RTFC_WAIT_OTHER_THREAD_FLAG); DBUG_VOID_RETURN; } @@ -2080,7 +2143,7 @@ static int send_check_errmsg(THD *thd, TABLE_LIST* table, protocol->prepare_for_resend(); protocol->store(table->alias, system_charset_info); protocol->store((char*) operator_name, system_charset_info); - protocol->store("error", 5, system_charset_info); + protocol->store(STRING_WITH_LEN("error"), system_charset_info); protocol->store(errmsg, system_charset_info); thd->clear_error(); if (protocol->write()) @@ -2154,11 +2217,15 @@ static int prepare_for_restore(THD* thd, TABLE_LIST* table, } -static int prepare_for_repair(THD* thd, TABLE_LIST *table_list, +static int prepare_for_repair(THD *thd, TABLE_LIST *table_list, HA_CHECK_OPT *check_opt) { int error= 0; TABLE tmp_table, *table; + TABLE_SHARE *share; + char from[FN_REFLEN],tmp[FN_REFLEN+32]; + const char **ext; + MY_STAT stat_info; DBUG_ENTER("prepare_for_repair"); if (!(check_opt->sql_flags & TT_USEFRM)) @@ -2166,12 +2233,26 @@ static int prepare_for_repair(THD* thd, TABLE_LIST *table_list, if (!(table= table_list->table)) /* if open_ltable failed */ { - char name[FN_REFLEN]; - build_table_path(name, sizeof(name), table_list->db, - table_list->table_name, ""); - if (openfrm(thd, name, "", 0, 0, 0, &tmp_table)) + char key[MAX_DBKEY_LENGTH]; + uint key_length; + + key_length= create_table_def_key(thd, key, table_list, 0); + pthread_mutex_lock(&LOCK_open); + if (!(share= (get_table_share(thd, table_list, key, key_length, 0, + &error)))) + { + pthread_mutex_unlock(&LOCK_open); DBUG_RETURN(0); // Can't open frm file + } + + if (open_table_from_share(thd, share, "", 0, 0, 0, &tmp_table)) + { + release_table_share(share, RELEASE_NORMAL); + pthread_mutex_unlock(&LOCK_open); + DBUG_RETURN(0); // Out of memory + } table= &tmp_table; + pthread_mutex_unlock(&LOCK_open); } /* @@ -2184,18 +2265,16 @@ static int prepare_for_repair(THD* thd, TABLE_LIST *table_list, - Run a normal repair using the new index file and the old data file */ - char from[FN_REFLEN],tmp[FN_REFLEN+32]; - const char **ext= table->file->bas_ext(); - MY_STAT stat_info; - /* Check if this is a table type that stores index and data separately, like ISAM or MyISAM */ + ext= table->file->bas_ext(); if (!ext[0] || !ext[1]) goto end; // No data file - strxmov(from, table->s->path, ext[1], NullS); // Name of data file + // Name of data file + strxmov(from, table->s->normalized_path.str, ext[1], NullS); if (!my_stat(from, &stat_info, MYF(0))) goto end; // Can't use USE_FRM flag @@ -2259,7 +2338,11 @@ static int prepare_for_repair(THD* thd, TABLE_LIST *table_list, end: if (table == &tmp_table) - closefrm(table); // Free allocated memory + { + pthread_mutex_lock(&LOCK_open); + closefrm(table, 1); // Free allocated memory + pthread_mutex_unlock(&LOCK_open); + } DBUG_RETURN(error); } @@ -2305,7 +2388,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) DBUG_RETURN(TRUE); - mysql_ha_flush(thd, tables, MYSQL_HA_CLOSE_FINAL); + mysql_ha_flush(thd, tables, MYSQL_HA_CLOSE_FINAL, FALSE); for (table= tables; table; table= table->next_local) { char table_name[NAME_LEN*2+2]; @@ -2338,7 +2421,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, /* if view are unsupported */ if (table->view && view_operator_func == NULL) { - result_code= HA_ADMIN_NOT_IMPLEMENTED; + result_code= HA_ADMIN_NOT_BASE_TABLE; goto send_result; } thd->open_options&= ~extra_open_options; @@ -2371,7 +2454,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, protocol->prepare_for_resend(); protocol->store(table_name, system_charset_info); protocol->store(operator_name, system_charset_info); - protocol->store("error",5, system_charset_info); + protocol->store(STRING_WITH_LEN("error"), system_charset_info); if (!(err_msg=thd->net.last_error)) err_msg=ER(ER_CHECK_NO_SUCH_TABLE); /* if it was a view will check md5 sum */ @@ -2408,7 +2491,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, protocol->prepare_for_resend(); protocol->store(table_name, system_charset_info); protocol->store(operator_name, system_charset_info); - protocol->store("error", 5, system_charset_info); + protocol->store(STRING_WITH_LEN("error"), system_charset_info); length= my_snprintf(buff, sizeof(buff), ER(ER_OPEN_AS_READONLY), table_name); protocol->store(buff, length, system_charset_info); @@ -2426,8 +2509,8 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, const char *old_message=thd->enter_cond(&COND_refresh, &LOCK_open, "Waiting to get writelock"); mysql_lock_abort(thd,table->table); - remove_table_from_cache(thd, table->table->s->db, - table->table->s->table_name, + remove_table_from_cache(thd, table->table->s->db.str, + table->table->s->table_name.str, RTFC_WAIT_OTHER_THREAD_FLAG | RTFC_CHECK_KILLED_FLAG); thd->exit_cond(old_message); @@ -2443,8 +2526,9 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, protocol->prepare_for_resend(); protocol->store(table_name, system_charset_info); protocol->store(operator_name, system_charset_info); - protocol->store("warning", 7, system_charset_info); - protocol->store("Table is marked as crashed", 26, system_charset_info); + protocol->store(STRING_WITH_LEN("warning"), system_charset_info); + protocol->store(STRING_WITH_LEN("Table is marked as crashed"), + system_charset_info); if (protocol->write()) goto err; } @@ -2468,41 +2552,55 @@ send_result_message: char buf[ERRMSGSIZE+20]; uint length=my_snprintf(buf, ERRMSGSIZE, ER(ER_CHECK_NOT_IMPLEMENTED), operator_name); - protocol->store("note", 4, system_charset_info); + protocol->store(STRING_WITH_LEN("note"), system_charset_info); protocol->store(buf, length, system_charset_info); } break; + case HA_ADMIN_NOT_BASE_TABLE: + { + char buf[ERRMSGSIZE+20]; + uint length= my_snprintf(buf, ERRMSGSIZE, + ER(ER_BAD_TABLE_ERROR), table_name); + protocol->store(STRING_WITH_LEN("note"), system_charset_info); + protocol->store(buf, length, system_charset_info); + } + break; + case HA_ADMIN_OK: - protocol->store("status", 6, system_charset_info); - protocol->store("OK",2, system_charset_info); + protocol->store(STRING_WITH_LEN("status"), system_charset_info); + protocol->store(STRING_WITH_LEN("OK"), system_charset_info); break; case HA_ADMIN_FAILED: - protocol->store("status", 6, system_charset_info); - protocol->store("Operation failed",16, system_charset_info); + protocol->store(STRING_WITH_LEN("status"), system_charset_info); + protocol->store(STRING_WITH_LEN("Operation failed"), + system_charset_info); break; case HA_ADMIN_REJECT: - protocol->store("status", 6, system_charset_info); - protocol->store("Operation need committed state",30, system_charset_info); + protocol->store(STRING_WITH_LEN("status"), system_charset_info); + protocol->store(STRING_WITH_LEN("Operation need committed state"), + system_charset_info); open_for_modify= FALSE; break; case HA_ADMIN_ALREADY_DONE: - protocol->store("status", 6, system_charset_info); - protocol->store("Table is already up to date", 27, system_charset_info); + protocol->store(STRING_WITH_LEN("status"), system_charset_info); + protocol->store(STRING_WITH_LEN("Table is already up to date"), + system_charset_info); break; case HA_ADMIN_CORRUPT: - protocol->store("error", 5, system_charset_info); - protocol->store("Corrupt", 7, system_charset_info); + protocol->store(STRING_WITH_LEN("error"), system_charset_info); + protocol->store(STRING_WITH_LEN("Corrupt"), system_charset_info); fatal_error=1; break; case HA_ADMIN_INVALID: - protocol->store("error", 5, system_charset_info); - protocol->store("Invalid argument",16, system_charset_info); + protocol->store(STRING_WITH_LEN("error"), system_charset_info); + protocol->store(STRING_WITH_LEN("Invalid argument"), + system_charset_info); break; case HA_ADMIN_TRY_ALTER: @@ -2538,7 +2636,7 @@ send_result_message: else { /* Hijack the row already in-progress. */ - protocol->store("error", 5, system_charset_info); + protocol->store(STRING_WITH_LEN("error"), system_charset_info); protocol->store(err_msg, system_charset_info); (void)protocol->write(); /* Start off another row for HA_ADMIN_FAILED */ @@ -2555,7 +2653,7 @@ send_result_message: } case HA_ADMIN_WRONG_CHECKSUM: { - protocol->store("note", 4, system_charset_info); + protocol->store(STRING_WITH_LEN("note"), system_charset_info); protocol->store(ER(ER_VIEW_CHECKSUM), strlen(ER(ER_VIEW_CHECKSUM)), system_charset_info); break; @@ -2567,22 +2665,25 @@ send_result_message: uint length=my_snprintf(buf, ERRMSGSIZE, "Unknown - internal error %d during operation", result_code); - protocol->store("error", 5, system_charset_info); + protocol->store(STRING_WITH_LEN("error"), system_charset_info); protocol->store(buf, length, system_charset_info); fatal_error=1; break; } } - if (fatal_error) - table->table->s->version=0; // Force close of table - else if (open_for_modify) + if (table->table) { - pthread_mutex_lock(&LOCK_open); - remove_table_from_cache(thd, table->table->s->db, - table->table->s->table_name, RTFC_NO_FLAG); - pthread_mutex_unlock(&LOCK_open); - /* May be something modified consequently we have to invalidate cache */ - query_cache_invalidate3(thd, table->table, 0); + if (fatal_error) + table->table->s->version=0; // Force close of table + else if (open_for_modify) + { + pthread_mutex_lock(&LOCK_open); + remove_table_from_cache(thd, table->table->s->db.str, + table->table->s->table_name.str, RTFC_NO_FLAG); + pthread_mutex_unlock(&LOCK_open); + /* Something may be modified, that's why we have to invalidate cache */ + query_cache_invalidate3(thd, table->table, 0); + } } close_thread_tables(thd); table->table=0; // For query cache @@ -2756,7 +2857,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, HA_CREATE_INFO *create_info, Table_ident *table_ident) { - TABLE **tmp_table; + TABLE *tmp_table; char src_path[FN_REFLEN], dst_path[FN_REFLEN]; char *db= table->db; char *table_name= table->table_name; @@ -2794,13 +2895,13 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, goto err; if ((tmp_table= find_temporary_table(thd, src_db, src_table))) - strxmov(src_path, (*tmp_table)->s->path, reg_ext, NullS); + strxmov(src_path, tmp_table->s->path.str, reg_ext, NullS); else { strxmov(src_path, mysql_data_home, "/", src_db, "/", src_table, reg_ext, NullS); /* Resolve symlinks (for windows) */ - fn_format(src_path, src_path, "", "", MYF(MY_UNPACK_FILENAME)); + unpack_filename(src_path, src_path); if (lower_case_table_names) my_casedn_str(files_charset_info, src_path); if (access(src_path, F_OK)) @@ -2840,7 +2941,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, { strxmov(dst_path, mysql_data_home, "/", db, "/", table_name, reg_ext, NullS); - fn_format(dst_path, dst_path, "", "", MYF(MY_UNPACK_FILENAME)); + unpack_filename(dst_path, dst_path); if (!access(dst_path, F_OK)) goto table_exists; } @@ -2862,8 +2963,8 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, creation, instead create the table directly (for both normal and temporary tables). */ - *fn_ext(dst_path)= 0; - err= ha_create_table(dst_path, create_info, 1); + *fn_ext(dst_path)= 0; // Remove .frm + err= ha_create_table(thd, dst_path, db, table_name, create_info, 1); if (create_info->options & HA_LEX_CREATE_TMP_TABLE) { @@ -3405,8 +3506,9 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, if (!new_db || !my_strcasecmp(table_alias_charset, new_db, db)) new_db= db; used_fields=create_info->used_fields; + + mysql_ha_flush(thd, table_list, MYSQL_HA_CLOSE_FINAL, FALSE); - mysql_ha_flush(thd, table_list, MYSQL_HA_CLOSE_FINAL); /* DISCARD/IMPORT TABLESPACE is always alone in an ALTER TABLE */ if (alter_info->tablespace_op != NO_TABLESPACE_OP) DBUG_RETURN(mysql_discard_or_import_tablespace(thd,table_list, @@ -3439,7 +3541,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, } else { - if (table->s->tmp_table) + if (table->s->tmp_table != NO_TMP_TABLE) { if (find_temporary_table(thd,new_db,new_name_buff)) { @@ -3450,7 +3552,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, else { char dir_buff[FN_REFLEN]; - strxnmov(dir_buff, FN_REFLEN, mysql_real_data_home, new_db, NullS); + strxnmov(dir_buff, sizeof(dir_buff)-1, + mysql_real_data_home, new_db, NullS); if (!access(fn_format(new_name_buff,new_name_buff,dir_buff,reg_ext,0), F_OK)) { @@ -3483,7 +3586,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, ALTER_DROP_PARTITION + ALTER_COALESCE_PARTITION + ALTER_REORGANISE_PARTITION)) { - partition_info *tab_part_info= table->s->part_info; + partition_info *tab_part_info= table->part_info; if (!tab_part_info) { my_error(ER_PARTITION_MGMT_ON_NONPARTITIONED, MYF(0)); @@ -3859,11 +3962,11 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, There was no partitioning before and no partitioning defined. Obviously no work needed. */ - if (table->s->part_info) + if (table->part_info) { if (!thd->lex->part_info && create_info->db_type == old_db_type) - thd->lex->part_info= table->s->part_info; + thd->lex->part_info= table->part_info; } if (thd->lex->part_info) { @@ -3871,7 +3974,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, Need to cater for engine types that can handle partition without using the partition handler. */ - if (thd->lex->part_info != table->s->part_info) + if (thd->lex->part_info != table->part_info) partition_changed= TRUE; if (create_info->db_type != DB_TYPE_PARTITION_DB) thd->lex->part_info->default_engine_type= create_info->db_type; @@ -3913,6 +4016,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, else { *fn_ext(new_name)=0; + table->s->version= 0; // Force removal of table def close_cached_table(thd, table); if (mysql_rename_table(old_db_type,db,table_name,new_db,new_alias)) error= -1; @@ -4049,7 +4153,10 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, my_error(ER_BLOB_CANT_HAVE_DEFAULT, MYF(0), def->change); DBUG_RETURN(TRUE); } - def->def=alter->def; // Use new default + if ((def->def=alter->def)) // Use new default + def->flags&= ~NO_DEFAULT_VALUE_FLAG; + else + def->flags|= NO_DEFAULT_VALUE_FLAG; alter_it.remove(); } } @@ -4287,7 +4394,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, */ uint old_lock_type; - partition_info *part_info= table->s->part_info; + partition_info *part_info= table->part_info; char path[FN_REFLEN+1]; uint db_options= 0, key_count, syntax_len; KEY *key_info_buffer; @@ -4356,9 +4463,18 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, DBUG_RETURN(TRUE); } thd->proc_info="end"; - write_bin_log(thd, FALSE); - send_ok(thd); - DBUG_RETURN(FALSE); + query_cache_invalidate3(thd, table_list, 0); + error= ha_commit_stmt(thd); + if (ha_commit(thd)) + error= 1; + if (!error) + { + close_thread_tables(thd); + write_bin_log(thd, FALSE); + send_ok(thd); + DBUG_RETURN(FALSE); + } + DBUG_RETURN(error); } } #endif @@ -4427,15 +4543,17 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, bzero((void*) &tbl, sizeof(tbl)); tbl.db= new_db; tbl.table_name= tbl.alias= tmp_name; + /* Table is in thd->temporary_tables */ new_table= open_table(thd, &tbl, thd->mem_root, (bool*) 0, MYSQL_LOCK_IGNORE_FLUSH); } else { char path[FN_REFLEN]; - my_snprintf(path, sizeof(path), "%s/%s/%s", mysql_data_home, - new_db, tmp_name); - fn_format(path,path,"","",4); + /* table is a normal table: Create temporary table in same directory */ + strxnmov(path, sizeof(path)-1, mysql_data_home, "/",new_db, "/", + tmp_name, NullS); + unpack_filename(path, path); new_table=open_temporary_table(thd, path, new_db, tmp_name,0); } if (!new_table) @@ -4451,7 +4569,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, thd->proc_info="copy to tmp table"; next_insert_id=thd->next_insert_id; // Remember for logging copied=deleted=0; - if (new_table && !new_table->s->is_view) + if (new_table && !(new_table->file->table_flags() & HA_NO_COPY_ON_ALTER)) { new_table->timestamp_field_type= TIMESTAMP_NO_AUTO_SET; new_table->next_number_field=new_table->found_next_number_field; @@ -4462,7 +4580,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, thd->last_insert_id=next_insert_id; // Needed for correct log thd->count_cuted_fields= CHECK_FIELD_IGNORE; - if (table->s->tmp_table) + if (table->s->tmp_table != NO_TMP_TABLE) { /* We changed a temporary table */ if (error) @@ -4471,7 +4589,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, The following function call will free the new_table pointer, in close_temporary_table(), so we can safely directly jump to err */ - close_temporary_table(thd,new_db,tmp_name); + close_temporary_table(thd, new_table, 1, 1); goto err; } /* Close lock if this is a transactional table */ @@ -4481,11 +4599,11 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, thd->lock=0; } /* Remove link to old table and rename the new one */ - close_temporary_table(thd, table->s->db, table_name); + close_temporary_table(thd, table, 1, 1); /* Should pass the 'new_name' as we store table name in the cache */ if (rename_temporary_table(thd, new_table, new_db, new_name)) { // Fatal error - close_temporary_table(thd,new_db,tmp_name); + close_temporary_table(thd, new_table, 1, 1); my_free((gptr) new_table,MYF(0)); goto err; } @@ -4495,7 +4613,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, if (new_table) { - intern_close_table(new_table); /* close temporary table */ + /* close temporary table that will be the new table */ + intern_close_table(new_table); my_free((gptr) new_table,MYF(0)); } VOID(pthread_mutex_lock(&LOCK_open)); @@ -4538,6 +4657,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, close the original table at before doing the rename */ table_name=thd->strdup(table_name); // must be saved + table->s->version= 0; // Force removal of table def close_cached_table(thd, table); table=0; // Marker that table is closed } @@ -4570,18 +4690,24 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, closing the locked table. */ if (table) + { + table->s->version= 0; // Force removal of table def close_cached_table(thd,table); + } VOID(pthread_mutex_unlock(&LOCK_open)); goto err; } if (thd->lock || new_name != table_name) // True if WIN32 { /* - Not table locking or alter table with rename - free locks and remove old table + Not table locking or alter table with rename. + Free locks and remove old table */ if (table) + { + table->s->version= 0; // Force removal of table def close_cached_table(thd,table); + } VOID(quick_rm_table(old_db_type,db,old_name)); } else @@ -4604,7 +4730,10 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, reopen_tables(thd,1,0)) { // This shouldn't happen if (table) + { + table->s->version= 0; // Force removal of table def close_cached_table(thd,table); // Remove lock for table + } VOID(pthread_mutex_unlock(&LOCK_open)); goto err; } @@ -4748,8 +4877,8 @@ copy_data_between_tables(TABLE *from,TABLE *to, MYF(MY_FAE | MY_ZEROFILL)); bzero((char*) &tables,sizeof(tables)); tables.table= from; - tables.alias= tables.table_name= (char*) from->s->table_name; - tables.db= (char*) from->s->db; + tables.alias= tables.table_name= from->s->table_name.str; + tables.db= from->s->db.str; error=1; if (thd->lex->select_lex.setup_ref_array(thd, order_num) || diff --git a/sql/sql_test.cc b/sql/sql_test.cc index 1bd298dda04..c4448ff8abe 100644 --- a/sql/sql_test.cc +++ b/sql/sql_test.cc @@ -79,7 +79,7 @@ void print_cached_tables(void) { TABLE *entry=(TABLE*) hash_element(&open_cache,idx); printf("%-14.14s %-32s%6ld%8ld%10ld%6d %s\n", - entry->s->db, entry->s->table_name, entry->s->version, + entry->s->db.str, entry->s->table_name.str, entry->s->version, entry->in_use ? entry->in_use->thread_id : 0L, entry->in_use ? entry->in_use->dbug_thread_id : 0L, entry->db_stat ? 1 : 0, entry->in_use ? lock_descriptions[(int)entry->reginfo.lock_type] : "Not in use"); @@ -261,7 +261,7 @@ print_plan(JOIN* join, double read_time, double record_count, pos = join->positions[i]; table= pos.table->table; if (table) - fputs(table->s->table_name, DBUG_FILE); + fputs(table->s->table_name.str, DBUG_FILE); fputc(' ', DBUG_FILE); } fputc('\n', DBUG_FILE); @@ -278,7 +278,7 @@ print_plan(JOIN* join, double read_time, double record_count, pos= join->best_positions[i]; table= pos.table->table; if (table) - fputs(table->s->table_name, DBUG_FILE); + fputs(table->s->table_name.str, DBUG_FILE); fputc(' ', DBUG_FILE); } } @@ -289,7 +289,7 @@ print_plan(JOIN* join, double read_time, double record_count, for (plan_nodes= join->best_ref ; *plan_nodes ; plan_nodes++) { join_table= (*plan_nodes); - fputs(join_table->table->s->table_name, DBUG_FILE); + fputs(join_table->table->s->table_name.str, DBUG_FILE); fprintf(DBUG_FILE, "(%lu,%lu,%lu)", (ulong) join_table->found_records, (ulong) join_table->records, @@ -336,8 +336,8 @@ static void push_locks_into_array(DYNAMIC_ARRAY *ar, THR_LOCK_DATA *data, { TABLE_LOCK_INFO table_lock_info; table_lock_info.thread_id= table->in_use->thread_id; - memcpy(table_lock_info.table_name, table->s->table_cache_key, - table->s->key_length); + memcpy(table_lock_info.table_name, table->s->table_cache_key.str, + table->s->table_cache_key.length); table_lock_info.table_name[strlen(table_lock_info.table_name)]='.'; table_lock_info.waiting=wait; table_lock_info.lock_text=text; @@ -484,7 +484,7 @@ Open tables: %10lu\n\ Open files: %10lu\n\ Open streams: %10lu\n", tmp.opened_tables, - (ulong) cached_tables(), + (ulong) cached_open_tables(), (ulong) my_file_opened, (ulong) my_stream_opened); diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index dbad8dcffb5..8f8d292f2e2 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -20,7 +20,8 @@ #include "sql_trigger.h" #include "parse_file.h" -static const LEX_STRING triggers_file_type= {(char *)"TRIGGERS", 8}; +static const LEX_STRING triggers_file_type= + {STRING_WITH_LEN("TRIGGERS")}; const char * const triggers_file_ext= ".TRG"; @@ -32,15 +33,32 @@ const char * const triggers_file_ext= ".TRG"; */ static File_option triggers_file_parameters[]= { - {{(char*)"triggers", 8}, + { + {STRING_WITH_LEN("triggers") }, offsetof(class Table_triggers_list, definitions_list), - FILE_OPTIONS_STRLIST}, - {{(char*)"sql_modes", 13}, + FILE_OPTIONS_STRLIST + }, + { + {STRING_WITH_LEN("sql_modes") }, offsetof(class Table_triggers_list, definition_modes_list), - FILE_OPTIONS_ULLLIST}, - {{0, 0}, 0, FILE_OPTIONS_STRING} + FILE_OPTIONS_ULLLIST + }, + { + {STRING_WITH_LEN("definers") }, + offsetof(class Table_triggers_list, definers_list), + FILE_OPTIONS_STRLIST + }, + { { 0, 0 }, 0, FILE_OPTIONS_STRING } }; +/* + This must be kept up to date whenever a new option is added to the list + above, as it specifies the number of required parameters of the trigger in + .trg file. +*/ + +static const int TRG_NUM_REQUIRED_PARAMETERS= 4; +static const int TRG_MAX_VERSIONS= 3; /* Structure representing contents of .TRN file which are used to support @@ -52,15 +70,23 @@ struct st_trigname LEX_STRING trigger_table; }; -static const LEX_STRING trigname_file_type= {(char *)"TRIGGERNAME", 11}; +static const LEX_STRING trigname_file_type= + {STRING_WITH_LEN("TRIGGERNAME")}; const char * const trigname_file_ext= ".TRN"; static File_option trigname_file_parameters[]= { - {{(char*)"trigger_table", 15}, offsetof(struct st_trigname, trigger_table), - FILE_OPTIONS_ESTRING}, - {{0, 0}, 0, FILE_OPTIONS_STRING} + { + /* + FIXME: Length specified for "trigger_table" key is erroneous, problem + caused by this are reported as BUG#14090 and should be fixed ASAP. + */ + {STRING_WITH_LEN("trigger_table")}, + offsetof(struct st_trigname, trigger_table), + FILE_OPTIONS_ESTRING + }, + { { 0, 0 }, 0, FILE_OPTIONS_STRING } }; @@ -80,6 +106,21 @@ const LEX_STRING trg_event_type_names[]= static TABLE_LIST *add_table_for_trigger(THD *thd, sp_name *trig); +bool handle_old_incorrect_sql_modes(char *&unknown_key, gptr base, + MEM_ROOT *mem_root, + char *end, gptr hook_data); + +class Handle_old_incorrect_sql_modes_hook: public Unknown_key_hook +{ +private: + char *path; +public: + Handle_old_incorrect_sql_modes_hook(char *file_path) + :path(file_path) + {}; + virtual bool process_unknown_string(char *&unknown_key, gptr base, + MEM_ROOT *mem_root, char *end); +}; /* Create or drop trigger for table. @@ -104,6 +145,9 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create) { TABLE *table; bool result= TRUE; + LEX_STRING definer_user; + LEX_STRING definer_host; + DBUG_ENTER("mysql_create_or_drop_trigger"); /* @@ -131,9 +175,12 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create) But a trigger can in theory be used to do nasty things (if it supported DROP for example) so we do the check for privileges. For now there is already a stronger test right above; but when this stronger test will - be removed, the test below will hold. + be removed, the test below will hold. Because triggers have the same + nature as functions regarding binlogging: their body is implicitely + binlogged, so they share the same danger, so trust_function_creators + applies to them too. */ - if (!trust_routine_creators && mysql_bin_log.is_open() && + if (!trust_function_creators && mysql_bin_log.is_open() && !(thd->security_ctx->master_access & SUPER_ACL)) { my_error(ER_BINLOG_CREATE_ROUTINE_NEED_SUPER, MYF(0)); @@ -141,7 +188,7 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create) } /* We do not allow creation of triggers on temporary tables. */ - if (create && find_temporary_table(thd, tables->db, tables->table_name)) + if (create && find_temporary_table(thd, tables)) { my_error(ER_TRG_ON_VIEW_OR_TEMP_TABLE, MYF(0), tables->alias); DBUG_RETURN(TRUE); @@ -184,7 +231,7 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create) } result= (create ? - table->triggers->create_trigger(thd, tables): + table->triggers->create_trigger(thd, tables, &definer_user, &definer_host): table->triggers->drop_trigger(thd, tables)); end: @@ -192,17 +239,30 @@ end: start_waiting_global_read_lock(thd); if (!result) + { + if (mysql_bin_log.is_open()) { - if (mysql_bin_log.is_open()) + thd->clear_error(); + + String log_query(thd->query, thd->query_length, system_charset_info); + + if (create) { - thd->clear_error(); - /* Such a statement can always go directly to binlog, no trans cache */ - Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE); - mysql_bin_log.write(&qinfo); + log_query.set((char *) 0, 0, system_charset_info); /* reset log_query */ + + log_query.append(STRING_WITH_LEN("CREATE ")); + append_definer(thd, &log_query, &definer_user, &definer_host); + log_query.append(thd->lex->trigger_definition_begin); } - send_ok(thd); + + /* Such a statement can always go directly to binlog, no trans cache. */ + Query_log_event qinfo(thd, log_query.ptr(), log_query.length(), 0, FALSE); + mysql_bin_log.write(&qinfo); } + send_ok(thd); + } + DBUG_RETURN(result); } @@ -212,15 +272,26 @@ end: SYNOPSIS create_trigger() - thd - current thread context (including trigger definition in LEX) - tables - table list containing one open table for which trigger is - created. + thd - current thread context (including trigger definition in + LEX) + tables - table list containing one open table for which the + trigger is created. + definer_user - [out] after a call it points to 0-terminated string, + which contains user name part of the actual trigger + definer. The caller is responsible to provide memory for + storing LEX_STRING object. + definer_host - [out] after a call it points to 0-terminated string, + which contains host name part of the actual trigger + definer. The caller is responsible to provide memory for + storing LEX_STRING object. RETURN VALUE False - success True - error */ -bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables) +bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables, + LEX_STRING *definer_user, + LEX_STRING *definer_host) { LEX *lex= thd->lex; TABLE *table= tables->table; @@ -229,12 +300,14 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables) LEX_STRING dir, file, trigname_file; LEX_STRING *trg_def, *name; ulonglong *trg_sql_mode; + char trg_definer_holder[HOSTNAME_LENGTH + USERNAME_LENGTH + 2]; + LEX_STRING *trg_definer; Item_trigger_field *trg_field; struct st_trigname trigname; /* Trigger must be in the same schema as target table. */ - if (my_strcasecmp(table_alias_charset, table->s->db, + if (my_strcasecmp(table_alias_charset, table->s->db.str, lex->spname->m_db.str ? lex->spname->m_db.str : thd->db)) { @@ -249,6 +322,31 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables) return 1; } + /* + Definer attribute of the Lex instance is always set in sql_yacc.yy when + trigger is created. + */ + + DBUG_ASSERT(lex->definer); + + /* + If the specified definer differs from the current user, we should check + that the current user has SUPER privilege (in order to create trigger + under another user one must have SUPER privilege). + */ + + if (strcmp(lex->definer->user.str, thd->security_ctx->priv_user) || + my_strcasecmp(system_charset_info, + lex->definer->host.str, + thd->security_ctx->priv_host)) + { + if (check_global_access(thd, SUPER_ACL)) + { + my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), "SUPER"); + return TRUE; + } + } + /* Let us check if all references to fields in old/new versions of row in this trigger are ok. @@ -279,17 +377,17 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables) sql_create_definition_file() files handles renaming and backup of older versions */ - strxnmov(dir_buff, FN_REFLEN, mysql_data_home, "/", tables->db, "/", NullS); + strxnmov(dir_buff, FN_REFLEN-1, mysql_data_home, "/", tables->db, "/", NullS); dir.length= unpack_filename(dir_buff, dir_buff); dir.str= dir_buff; - file.length= strxnmov(file_buff, FN_REFLEN, tables->table_name, + file.length= strxnmov(file_buff, FN_REFLEN-1, tables->table_name, triggers_file_ext, NullS) - file_buff; file.str= file_buff; - trigname_file.length= strxnmov(trigname_buff, FN_REFLEN, + trigname_file.length= strxnmov(trigname_buff, FN_REFLEN-1, lex->spname->m_name.str, trigname_file_ext, NullS) - trigname_buff; trigname_file.str= trigname_buff; - strxnmov(trigname_path, FN_REFLEN, dir_buff, trigname_buff, NullS); + strxnmov(trigname_path, FN_REFLEN-1, dir_buff, trigname_buff, NullS); /* Use the filesystem to enforce trigger namespace constraints. */ if (!access(trigname_path, F_OK)) @@ -318,15 +416,39 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables) definitions_list.push_back(trg_def, &table->mem_root) || !(trg_sql_mode= (ulonglong*)alloc_root(&table->mem_root, sizeof(ulonglong))) || - definition_modes_list.push_back(trg_sql_mode, &table->mem_root)) + definition_modes_list.push_back(trg_sql_mode, &table->mem_root) || + !(trg_definer= (LEX_STRING*) alloc_root(&table->mem_root, + sizeof(LEX_STRING))) || + definers_list.push_back(trg_definer, &table->mem_root)) goto err_with_cleanup; trg_def->str= thd->query; trg_def->length= thd->query_length; *trg_sql_mode= thd->variables.sql_mode; +#ifndef NO_EMBEDDED_ACCESS_CHECKS + if (!is_acl_user(lex->definer->host.str, + lex->definer->user.str)) + { + push_warning_printf(thd, + MYSQL_ERROR::WARN_LEVEL_NOTE, + ER_NO_SUCH_USER, + ER(ER_NO_SUCH_USER), + lex->definer->user.str, + lex->definer->host.str); + } +#endif /* NO_EMBEDDED_ACCESS_CHECKS */ + + *definer_user= lex->definer->user; + *definer_host= lex->definer->host; + + trg_definer->str= trg_definer_holder; + trg_definer->length= strxmov(trg_definer->str, definer_user->str, "@", + definer_host->str, NullS) - trg_definer->str; + if (!sql_create_definition_file(&dir, &file, &triggers_file_type, - (gptr)this, triggers_file_parameters, 3)) + (gptr)this, triggers_file_parameters, + TRG_MAX_VERSIONS)) return 0; err_with_cleanup: @@ -352,7 +474,7 @@ err_with_cleanup: static bool rm_trigger_file(char *path, char *db, char *table_name) { - strxnmov(path, FN_REFLEN, mysql_data_home, "/", db, "/", table_name, + strxnmov(path, FN_REFLEN-1, mysql_data_home, "/", db, "/", table_name, triggers_file_ext, NullS); unpack_filename(path, path); return my_delete(path, MYF(MY_WME)); @@ -376,7 +498,7 @@ static bool rm_trigger_file(char *path, char *db, char *table_name) static bool rm_trigname_file(char *path, char *db, char *trigger_name) { - strxnmov(path, FN_REFLEN, mysql_data_home, "/", db, "/", trigger_name, + strxnmov(path, FN_REFLEN-1, mysql_data_home, "/", db, "/", trigger_name, trigname_file_ext, NullS); unpack_filename(path, path); return my_delete(path, MYF(MY_WME)); @@ -403,12 +525,14 @@ bool Table_triggers_list::drop_trigger(THD *thd, TABLE_LIST *tables) List_iterator_fast it_name(names_list); List_iterator it_def(definitions_list); List_iterator it_mod(definition_modes_list); + List_iterator it_definer(definers_list); char path[FN_REFLEN]; while ((name= it_name++)) { it_def++; it_mod++; + it_definer++; if (my_strcasecmp(table_alias_charset, lex->spname->m_name.str, name->str) == 0) @@ -419,6 +543,7 @@ bool Table_triggers_list::drop_trigger(THD *thd, TABLE_LIST *tables) */ it_def.remove(); it_mod.remove(); + it_definer.remove(); if (definitions_list.is_empty()) { @@ -436,17 +561,17 @@ bool Table_triggers_list::drop_trigger(THD *thd, TABLE_LIST *tables) char dir_buff[FN_REFLEN], file_buff[FN_REFLEN]; LEX_STRING dir, file; - strxnmov(dir_buff, FN_REFLEN, mysql_data_home, "/", tables->db, + strxnmov(dir_buff, FN_REFLEN-1, mysql_data_home, "/", tables->db, "/", NullS); dir.length= unpack_filename(dir_buff, dir_buff); dir.str= dir_buff; - file.length= strxnmov(file_buff, FN_REFLEN, tables->table_name, + file.length= strxnmov(file_buff, FN_REFLEN-1, tables->table_name, triggers_file_ext, NullS) - file_buff; file.str= file_buff; if (sql_create_definition_file(&dir, &file, &triggers_file_type, (gptr)this, triggers_file_parameters, - 3)) + TRG_MAX_VERSIONS)) return 1; } @@ -503,7 +628,7 @@ bool Table_triggers_list::prepare_record1_accessors(TABLE *table) */ if (!(*old_fld= (*fld)->new_field(&table->mem_root, table))) return 1; - (*old_fld)->move_field((my_ptrdiff_t)(table->record[1] - + (*old_fld)->move_field_offset((my_ptrdiff_t)(table->record[1] - table->record[0])); } *old_fld= 0; @@ -558,7 +683,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, DBUG_ENTER("Table_triggers_list::check_n_load"); - strxnmov(path_buff, FN_REFLEN, mysql_data_home, "/", db, "/", table_name, + strxnmov(path_buff, FN_REFLEN-1, mysql_data_home, "/", db, "/", table_name, triggers_file_ext, NullS); path.length= unpack_filename(path_buff, path_buff); path.str= path_buff; @@ -568,7 +693,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, DBUG_RETURN(0); /* - File exists so we got to load triggers + File exists so we got to load triggers. FIXME: A lot of things to do here e.g. how about other funcs and being more paranoical ? */ @@ -579,18 +704,24 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, { Table_triggers_list *triggers= new (&table->mem_root) Table_triggers_list(table); + Handle_old_incorrect_sql_modes_hook sql_modes_hook(path.str); if (!triggers) DBUG_RETURN(1); /* - We don't have sql_modes in old versions of .TRG file, so we should - initialize list for safety. + We don't have the following attributes in old versions of .TRG file, so + we should initialize the list for safety: + - sql_modes; + - definers; */ triggers->definition_modes_list.empty(); + triggers->definers_list.empty(); if (parser->parse((gptr)triggers, &table->mem_root, - triggers_file_parameters, 2)) + triggers_file_parameters, + TRG_NUM_REQUIRED_PARAMETERS, + &sql_modes_hook)) DBUG_RETURN(1); List_iterator_fast it(triggers->definitions_list); @@ -612,7 +743,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, DBUG_RETURN(1); // EOM } *trg_sql_mode= global_system_variables.sql_mode; - while ((trg_create_str= it++)) + while (it++) { if (triggers->definition_modes_list.push_back(trg_sql_mode, &table->mem_root)) @@ -623,8 +754,43 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, it.rewind(); } + if (triggers->definers_list.is_empty() && + !triggers->definitions_list.is_empty()) + { + /* + It is old file format => we should fill list of definers. + + If there is no definer information, we should not switch context to + definer when checking privileges. I.e. privileges for such triggers + are checked for "invoker" rather than for "definer". + */ + + LEX_STRING *trg_definer; + + if (! (trg_definer= (LEX_STRING*)alloc_root(&table->mem_root, + sizeof(LEX_STRING)))) + DBUG_RETURN(1); // EOM + + trg_definer->str= (char*) ""; + trg_definer->length= 0; + + while (it++) + { + if (triggers->definers_list.push_back(trg_definer, + &table->mem_root)) + { + DBUG_RETURN(1); // EOM + } + } + + it.rewind(); + } + DBUG_ASSERT(triggers->definition_modes_list.elements == triggers->definitions_list.elements); + DBUG_ASSERT(triggers->definers_list.elements == + triggers->definitions_list.elements); + table->triggers= triggers; /* @@ -647,7 +813,10 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, char *trg_name_buff; List_iterator_fast itm(triggers->definition_modes_list); + List_iterator_fast it_definer(triggers-> + definers_list); LEX *old_lex= thd->lex, lex; + sp_rcontext *save_spcont= thd->spcont; ulong save_sql_mode= thd->variables.sql_mode; thd->lex= &lex; @@ -659,22 +828,56 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, while ((trg_create_str= it++)) { trg_sql_mode= itm++; + LEX_STRING *trg_definer= it_definer++; thd->variables.sql_mode= (ulong)*trg_sql_mode; lex_start(thd, (uchar*)trg_create_str->str, trg_create_str->length); + thd->spcont= 0; if (yyparse((void *)thd) || thd->is_fatal_error) { /* - Free lex associated resources + Free lex associated resources. QQ: Do we really need all this stuff here ? */ delete lex.sphead; goto err_with_lex_cleanup; } - lex.sphead->m_sql_mode= *trg_sql_mode; + lex.sphead->set_info(0, 0, &lex.sp_chistics, *trg_sql_mode); + triggers->bodies[lex.trg_chistics.event] [lex.trg_chistics.action_time]= lex.sphead; + + if (!trg_definer->length) + { + /* + This trigger was created/imported from the previous version of + MySQL, which does not support triggers definers. We should emit + warning here. + */ + + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_TRG_NO_DEFINER, ER(ER_TRG_NO_DEFINER), + (const char*) db, + (const char*) lex.sphead->m_name.str); + + /* + Set definer to the '' to correct displaying in the information + schema. + */ + + lex.sphead->set_definer((char*) "", 0); + + /* + Triggers without definer information are executed under the + authorization of the invoker. + */ + + lex.sphead->m_chistics->suid= SP_IS_NOT_SUID; + } + else + lex.sphead->set_definer(trg_definer->str, trg_definer->length); + if (triggers->names_list.push_back(&lex.sphead->m_name, &table->mem_root)) goto err_with_lex_cleanup; @@ -701,11 +904,16 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, trg_field= trg_field->next_trg_field) trg_field->setup_field(thd, table); + triggers->m_spec_var_used[lex.trg_chistics.event] + [lex.trg_chistics.action_time]= + lex.trg_table_fields.first ? TRUE : FALSE; + lex_end(&lex); } thd->db= save_db.str; thd->db_length= save_db.length; thd->lex= old_lex; + thd->spcont= save_spcont; thd->variables.sql_mode= save_sql_mode; DBUG_RETURN(0); @@ -714,6 +922,7 @@ err_with_lex_cleanup: // QQ: anything else ? lex_end(&lex); thd->lex= old_lex; + thd->spcont= save_spcont; thd->variables.sql_mode= save_sql_mode; thd->db= save_db.str; thd->db_length= save_db.length; @@ -744,6 +953,9 @@ err_with_lex_cleanup: name - returns name of trigger stmt - returns statement of trigger sql_mode - returns sql_mode of trigger + definer_user - returns definer/creator of trigger. The caller is + responsible to allocate enough space for storing definer + information. RETURN VALUE False - success @@ -754,7 +966,8 @@ bool Table_triggers_list::get_trigger_info(THD *thd, trg_event_type event, trg_action_time_type time_type, LEX_STRING *trigger_name, LEX_STRING *trigger_stmt, - ulong *sql_mode) + ulong *sql_mode, + LEX_STRING *definer) { sp_head *body; DBUG_ENTER("get_trigger_info"); @@ -763,6 +976,18 @@ bool Table_triggers_list::get_trigger_info(THD *thd, trg_event_type event, *trigger_name= body->m_name; *trigger_stmt= body->m_body; *sql_mode= body->m_sql_mode; + + if (body->m_chistics->suid == SP_IS_NOT_SUID) + { + definer->str[0]= 0; + definer->length= 0; + } + else + { + definer->length= strxmov(definer->str, body->m_definer_user.str, "@", + body->m_definer_host.str, NullS) - definer->str; + } + DBUG_RETURN(0); } DBUG_RETURN(1); @@ -793,7 +1018,7 @@ static TABLE_LIST *add_table_for_trigger(THD *thd, sp_name *trig) struct st_trigname trigname; DBUG_ENTER("add_table_for_trigger"); - strxnmov(path_buff, FN_REFLEN, mysql_data_home, "/", db, "/", + strxnmov(path_buff, FN_REFLEN-1, mysql_data_home, "/", db, "/", trig->m_name.str, trigname_file_ext, NullS); path.length= unpack_filename(path_buff, path_buff); path.str= path_buff; @@ -815,7 +1040,8 @@ static TABLE_LIST *add_table_for_trigger(THD *thd, sp_name *trig) } if (parser->parse((gptr)&trigname, thd->mem_root, - trigname_file_parameters, 1)) + trigname_file_parameters, 1, + &file_parser_dummy_hook)) DBUG_RETURN(0); /* We need to reset statement table list to be PS/SP friendly. */ @@ -898,8 +1124,9 @@ bool Table_triggers_list::process_triggers(THD *thd, trg_event_type event, bool old_row_is_record1) { int res= 0; + sp_head *sp_trigger= bodies[event][time_type]; - if (bodies[event][time_type]) + if (sp_trigger) { Sub_statement_state statement_state; @@ -914,15 +1141,117 @@ bool Table_triggers_list::process_triggers(THD *thd, trg_event_type event, old_field= table->field; } +#ifndef NO_EMBEDDED_ACCESS_CHECKS + Security_context *save_ctx; + + if (sp_change_security_context(thd, sp_trigger, &save_ctx)) + return TRUE; + /* - FIXME: We should juggle with security context here (because trigger - should be invoked with creator rights). + NOTE: TRIGGER_ACL should be used below. */ + if (check_global_access(thd, SUPER_ACL)) + { + sp_restore_security_context(thd, save_ctx); + return TRUE; + } + + /* + If the trigger uses special variables (NEW/OLD), check that we have + SELECT and UPDATE privileges on the subject table. + */ + + if (is_special_var_used(event, time_type)) + { + TABLE_LIST table_list; + bzero((char *) &table_list, sizeof (table_list)); + table_list.db= (char *) table->s->db.str; + table_list.db_length= table->s->db.length; + table_list.table_name= table->s->table_name.str; + table_list.table_name_length= table->s->table_name.length; + table_list.alias= (char *) table->alias; + table_list.table= table; + + if (check_table_access(thd, SELECT_ACL | UPDATE_ACL, &table_list, 0)) + { + sp_restore_security_context(thd, save_ctx); + return TRUE; + } + } + +#endif // NO_EMBEDDED_ACCESS_CHECKS + thd->reset_sub_statement_state(&statement_state, SUB_STMT_TRIGGER); - res= bodies[event][time_type]->execute_function(thd, 0, 0, 0); + res= sp_trigger->execute_function(thd, 0, 0, 0); thd->restore_sub_statement_state(&statement_state); + +#ifndef NO_EMBEDDED_ACCESS_CHECKS + sp_restore_security_context(thd, save_ctx); +#endif // NO_EMBEDDED_ACCESS_CHECKS } return res; } + + +/* + Trigger BUG#14090 compatibility hook + + SYNOPSIS + Handle_old_incorrect_sql_modes_hook::process_unknown_string() + unknown_key [in/out] reference on the line with unknown + parameter and the parsing point + base [in] base address for parameter writing (structure + like TABLE) + mem_root [in] MEM_ROOT for parameters allocation + end [in] the end of the configuration + + NOTE: this hook process back compatibility for incorrectly written + sql_modes parameter (see BUG#14090). + + RETURN + FALSE OK + TRUE Error +*/ + +bool +Handle_old_incorrect_sql_modes_hook::process_unknown_string(char *&unknown_key, + gptr base, + MEM_ROOT *mem_root, + char *end) +{ +#define INVALID_SQL_MODES_LENGTH 13 + DBUG_ENTER("handle_old_incorrect_sql_modes"); + DBUG_PRINT("info", ("unknown key:%60s", unknown_key)); + if (unknown_key + INVALID_SQL_MODES_LENGTH + 1 < end && + unknown_key[INVALID_SQL_MODES_LENGTH] == '=' && + !memcmp(unknown_key, STRING_WITH_LEN("sql_modes"))) + { + DBUG_PRINT("info", ("sql_modes affected by BUG#14090 detected")); + push_warning_printf(current_thd, + MYSQL_ERROR::WARN_LEVEL_NOTE, + ER_OLD_FILE_FORMAT, + ER(ER_OLD_FILE_FORMAT), + (char *)path, "TRIGGER"); + File_option sql_modes_parameters= + { + {STRING_WITH_LEN("sql_modes") }, + offsetof(class Table_triggers_list, definition_modes_list), + FILE_OPTIONS_ULLLIST + }; + char *ptr= unknown_key + INVALID_SQL_MODES_LENGTH + 1; + if (get_file_options_ulllist(ptr, end, unknown_key, base, + &sql_modes_parameters, mem_root)) + { + DBUG_RETURN(TRUE); + } + /* + Set parsing pointer to the last symbol of string (\n) + 1) to avoid problem with \0 in the junk after sql_modes + 2) to speed up skipping this line by parser. + */ + unknown_key= ptr-1; + } + DBUG_RETURN(FALSE); +} diff --git a/sql/sql_trigger.h b/sql/sql_trigger.h index c1d1f8d0e9e..6be42d7b868 100644 --- a/sql/sql_trigger.h +++ b/sql/sql_trigger.h @@ -55,6 +55,12 @@ class Table_triggers_list: public Sql_alloc */ LEX_STRING sroutines_key; + /* + is_special_var_used specifies whether trigger body contains special + variables (NEW/OLD). + */ + bool m_spec_var_used[TRG_EVENT_MAX][TRG_ACTION_MAX]; + public: /* Field responsible for storing triggers definitions in file. @@ -66,6 +72,8 @@ public: */ List definition_modes_list; + List definers_list; + Table_triggers_list(TABLE *table_arg): record1_field(0), table(table_arg) { @@ -73,7 +81,9 @@ public: } ~Table_triggers_list(); - bool create_trigger(THD *thd, TABLE_LIST *table); + bool create_trigger(THD *thd, TABLE_LIST *table, + LEX_STRING *definer_user, + LEX_STRING *definer_host); bool drop_trigger(THD *thd, TABLE_LIST *table); bool process_triggers(THD *thd, trg_event_type event, trg_action_time_type time_type, @@ -81,7 +91,8 @@ public: bool get_trigger_info(THD *thd, trg_event_type event, trg_action_time_type time_type, LEX_STRING *trigger_name, LEX_STRING *trigger_stmt, - ulong *sql_mode); + ulong *sql_mode, + LEX_STRING *definer); static bool check_n_load(THD *thd, const char *db, const char *table_name, TABLE *table, bool names_only); @@ -98,6 +109,11 @@ public: return test(bodies[TRG_EVENT_UPDATE][TRG_ACTION_BEFORE]); } + inline bool is_special_var_used(int event, int action_time) const + { + return m_spec_var_used[event][action_time]; + } + void set_table(TABLE *new_table); friend class Item_trigger_field; diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc index 2067f042133..367803f4c86 100644 --- a/sql/sql_udf.cc +++ b/sql/sql_udf.cc @@ -133,6 +133,7 @@ void udf_init() DBUG_VOID_RETURN; } initialized = 1; + new_thd->thread_stack= (char*) &new_thd; new_thd->store_globals(); new_thd->db= my_strdup("mysql", MYF(0)); new_thd->db_length=5; diff --git a/sql/sql_update.cc b/sql/sql_update.cc index f6834117d24..359475827b1 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -516,7 +516,12 @@ int mysql_update(THD *thd, } else if (!ignore || error != HA_ERR_FOUND_DUPP_KEY) { - thd->fatal_error(); // Force error message + /* + If (ignore && error == HA_ERR_FOUND_DUPP_KEY) we don't have to + do anything; otherwise... + */ + if (error != HA_ERR_FOUND_DUPP_KEY) + thd->fatal_error(); /* Other handler errors are fatal */ table->file->print_error(error,MYF(0)); error= 1; break; @@ -1183,7 +1188,8 @@ multi_update::initialize_tables(JOIN *join) /* ok to be on stack as this is not referenced outside of this func */ Field_string offset(table->file->ref_length, 0, "offset", - table, &my_charset_bin); + &my_charset_bin); + offset.init(table); if (!(ifield= new Item_field(((Field *) &offset)))) DBUG_RETURN(1); ifield->maybe_null= 0; @@ -1364,7 +1370,12 @@ bool multi_update::send_data(List ¬_used_values) updated--; if (!ignore || error != HA_ERR_FOUND_DUPP_KEY) { - thd->fatal_error(); // Force error message + /* + If (ignore && error == HA_ERR_FOUND_DUPP_KEY) we don't have to + do anything; otherwise... + */ + if (error != HA_ERR_FOUND_DUPP_KEY) + thd->fatal_error(); /* Other handler errors are fatal */ table->file->print_error(error,MYF(0)); DBUG_RETURN(1); } @@ -1385,22 +1396,23 @@ bool multi_update::send_data(List ¬_used_values) int error; TABLE *tmp_table= tmp_tables[offset]; fill_record(thd, tmp_table->field+1, *values_for_table[offset], 1); - found++; /* Store pointer to row */ memcpy((char*) tmp_table->field[0]->ptr, (char*) table->file->ref, table->file->ref_length); /* Write row, ignoring duplicated updates to a row */ - if ((error= tmp_table->file->write_row(tmp_table->record[0])) && - (error != HA_ERR_FOUND_DUPP_KEY && - error != HA_ERR_FOUND_DUPP_UNIQUE)) + if (error= tmp_table->file->write_row(tmp_table->record[0])) { - if (create_myisam_from_heap(thd, tmp_table, tmp_table_param + offset, - error, 1)) + if (error != HA_ERR_FOUND_DUPP_KEY && + error != HA_ERR_FOUND_DUPP_UNIQUE && + create_myisam_from_heap(thd, tmp_table, + tmp_table_param + offset, error, 1)) { do_update=0; DBUG_RETURN(1); // Not a table_is_full error } } + else + found++; } } DBUG_RETURN(0); diff --git a/sql/sql_view.cc b/sql/sql_view.cc index 71c5d198b27..02bbe2bc3dc 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -214,29 +214,28 @@ bool mysql_create_view(THD *thd, - same as current user - current user has SUPER_ACL */ - if (strcmp(lex->create_view_definer->user.str, + if (strcmp(lex->definer->user.str, thd->security_ctx->priv_user) != 0 || my_strcasecmp(system_charset_info, - lex->create_view_definer->host.str, + lex->definer->host.str, thd->security_ctx->priv_host) != 0) { if (!(thd->security_ctx->master_access & SUPER_ACL)) { - my_error(ER_VIEW_OTHER_USER, MYF(0), lex->create_view_definer->user.str, - lex->create_view_definer->host.str); + my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), "SUPER"); res= TRUE; goto err; } else { - if (!is_acl_user(lex->create_view_definer->host.str, - lex->create_view_definer->user.str)) + if (!is_acl_user(lex->definer->host.str, + lex->definer->user.str)) { push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, ER_NO_SUCH_USER, ER(ER_NO_SUCH_USER), - lex->create_view_definer->user.str, - lex->create_view_definer->host.str); + lex->definer->user.str, + lex->definer->host.str); } } } @@ -496,7 +495,7 @@ static const int num_view_backups= 3; static File_option view_parameters[]= {{{(char*) STRING_WITH_LEN("query")}, offsetof(TABLE_LIST, query), - FILE_OPTIONS_STRING}, + FILE_OPTIONS_ESTRING}, {{(char*) STRING_WITH_LEN("md5")}, offsetof(TABLE_LIST, md5), FILE_OPTIONS_STRING}, @@ -583,7 +582,7 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view, dir.length= strlen(dir_buff); file.str= file_buff; - file.length= (strxnmov(file_buff, FN_REFLEN, view->table_name, reg_ext, + file.length= (strxnmov(file_buff, FN_REFLEN-1, view->table_name, reg_ext, NullS) - file_buff); /* init timestamp */ if (!view->timestamp.str) @@ -624,7 +623,8 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view, TODO: special cascade/restrict procedure for alter? */ if (parser->parse((gptr)view, thd->mem_root, - view_parameters + revision_number_position, 1)) + view_parameters + revision_number_position, 1, + &file_parser_dummy_hook)) { DBUG_RETURN(thd->net.report_error? -1 : 0); } @@ -658,8 +658,8 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view, lex->create_view_algorithm= VIEW_ALGORITHM_UNDEFINED; } view->algorithm= lex->create_view_algorithm; - view->definer.user= lex->create_view_definer->user; - view->definer.host= lex->create_view_definer->host; + view->definer.user= lex->definer->user; + view->definer.host= lex->definer->host; view->view_suid= lex->create_view_suid; view->with_check= lex->create_view_check; if ((view->updatable_view= (can_be_merged && @@ -793,7 +793,7 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table) be used here */ if (parser->parse((gptr)table, thd->mem_root, view_parameters, - required_view_parameters)) + required_view_parameters, &file_parser_dummy_hook)) goto err; /* @@ -807,7 +807,7 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table) push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_VIEW_FRM_NO_USER, ER(ER_VIEW_FRM_NO_USER), table->db, table->table_name); - if (default_view_definer(thd->security_ctx, &table->definer)) + if (get_default_definer(thd, &table->definer)) goto err; } @@ -1167,15 +1167,16 @@ err: bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode) { - DBUG_ENTER("mysql_drop_view"); char path[FN_REFLEN]; TABLE_LIST *view; - bool type= 0; db_type not_used; + DBUG_ENTER("mysql_drop_view"); for (view= views; view; view= view->next_local) { - strxnmov(path, FN_REFLEN, mysql_data_home, "/", view->db, "/", + TABLE_SHARE *share; + bool type= 0; + strxnmov(path, FN_REFLEN-1, mysql_data_home, "/", view->db, "/", view->table_name, reg_ext, NullS); (void) unpack_filename(path, path); VOID(pthread_mutex_lock(&LOCK_open)); @@ -1200,6 +1201,20 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode) } if (my_delete(path, MYF(MY_WME))) goto err; + + /* + For a view, there is only one table_share object which should never + be used outside of LOCK_open + */ + if ((share= get_cached_table_share(view->db, view->table_name))) + { + DBUG_ASSERT(share->ref_count == 0); + pthread_mutex_lock(&share->mutex); + share->ref_count++; + share->version= 0; + pthread_mutex_unlock(&share->mutex); + release_table_share(share, RELEASE_WAIT_FOR_DROP); + } query_cache_invalidate3(thd, view, 0); sp_cache_invalidate(); VOID(pthread_mutex_unlock(&LOCK_open)); @@ -1478,7 +1493,7 @@ mysql_rename_view(THD *thd, DBUG_ENTER("mysql_rename_view"); - strxnmov(view_path, FN_REFLEN, mysql_data_home, "/", view->db, "/", + strxnmov(view_path, FN_REFLEN-1, mysql_data_home, "/", view->db, "/", view->table_name, reg_ext, NullS); (void) unpack_filename(view_path, view_path); @@ -1503,7 +1518,8 @@ mysql_rename_view(THD *thd, /* get view definition and source */ if (parser->parse((gptr)&view_def, thd->mem_root, view_parameters, - array_elements(view_parameters)-1)) + array_elements(view_parameters)-1, + &file_parser_dummy_hook)) goto err; /* rename view and it's backups */ @@ -1511,7 +1527,8 @@ mysql_rename_view(THD *thd, view_def.revision - 1, num_view_backups)) goto err; - strxnmov(dir_buff, FN_REFLEN, mysql_data_home, "/", view->db, "/", NullS); + strxnmov(dir_buff, FN_REFLEN-1, mysql_data_home, "/", view->db, "/", + NullS); (void) unpack_filename(dir_buff, dir_buff); pathstr.str= (char*)dir_buff; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 7d670d8988c..a9b7a18b707 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -137,6 +137,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %token ASCII_SYM %token ASENSITIVE_SYM %token ATAN +%token AUTHORS_SYM %token AUTO_INC %token AVG_ROW_LENGTH %token AVG_SYM @@ -176,6 +177,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %token CLIENT_SYM %token CLOSE_SYM %token COALESCE +%token CODE_SYM %token COLLATE_SYM %token COLLATION_SYM %token COLUMNS @@ -794,7 +796,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %type FUNC_ARG0 FUNC_ARG1 FUNC_ARG2 FUNC_ARG3 keyword keyword_sp -%type user grant_user +%type user grant_user get_definer %type opt_collate @@ -845,11 +847,13 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); subselect_end select_var_list select_var_list_init help opt_len opt_extended_describe prepare prepare_src execute deallocate - statement sp_suid opt_view_list view_list or_replace algorithm + statement sp_suid sp_c_chistics sp_a_chistics sp_chistic sp_c_chistic xa load_data opt_field_or_var_spec fields_or_vars opt_load_data_set_spec - install uninstall view_user view_suid - partition_entry + definer view_replace_or_algorithm view_replace view_algorithm_opt + view_algorithm view_or_trigger_tail view_suid view_tail view_list_opt + view_list view_select view_check_option trigger_tail + install uninstall partition_entry END_OF_INPUT %type call sp_proc_stmts sp_proc_stmts1 sp_proc_stmt @@ -1179,11 +1183,6 @@ create: | CREATE opt_unique_or_fulltext INDEX_SYM ident key_alg ON table_ident { LEX *lex=Lex; - if (lex->sphead && lex->sphead->m_type != TYPE_ENUM_PROCEDURE) - { - my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0)); - YYABORT; - } lex->sql_command= SQLCOM_CREATE_INDEX; if (!lex->current_select->add_table_to_list(lex->thd, $7, NULL, TL_OPTION_UPDATING)) @@ -1284,80 +1283,14 @@ create: YYTHD->client_capabilities |= CLIENT_MULTI_QUERIES; sp->restore_thd_mem_root(YYTHD); } - | CREATE or_replace algorithm view_user view_suid VIEW_SYM table_ident + | CREATE { - THD *thd= YYTHD; - LEX *lex= thd->lex; - lex->sql_command= SQLCOM_CREATE_VIEW; - lex->create_view_start= thd->query; - /* first table in list is target VIEW name */ - if (!lex->select_lex.add_table_to_list(thd, $7, NULL, 0)) - YYABORT; + Lex->create_view_mode= VIEW_CREATE_NEW; + Lex->create_view_algorithm= VIEW_ALGORITHM_UNDEFINED; + Lex->create_view_suid= TRUE; } - opt_view_list AS select_view_init check_option + view_or_trigger {} - | CREATE TRIGGER_SYM sp_name trg_action_time trg_event - ON table_ident FOR_SYM EACH_SYM ROW_SYM - { - LEX *lex= Lex; - sp_head *sp; - - if (lex->sphead) - { - my_error(ER_SP_NO_RECURSIVE_CREATE, MYF(0), "TRIGGER"); - YYABORT; - } - - if (!(sp= new sp_head())) - YYABORT; - sp->reset_thd_mem_root(YYTHD); - sp->init(lex); - - sp->m_type= TYPE_ENUM_TRIGGER; - lex->sphead= sp; - lex->spname= $3; - /* - We have to turn of CLIENT_MULTI_QUERIES while parsing a - stored procedure, otherwise yylex will chop it into pieces - at each ';'. - */ - sp->m_old_cmq= YYTHD->client_capabilities & CLIENT_MULTI_QUERIES; - YYTHD->client_capabilities &= ~CLIENT_MULTI_QUERIES; - - bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics)); - lex->sphead->m_chistics= &lex->sp_chistics; - lex->sphead->m_body_begin= lex->ptr; - } - sp_proc_stmt - { - LEX *lex= Lex; - sp_head *sp= lex->sphead; - - lex->sql_command= SQLCOM_CREATE_TRIGGER; - sp->init_strings(YYTHD, lex, $3); - /* Restore flag if it was cleared above */ - if (sp->m_old_cmq) - YYTHD->client_capabilities |= CLIENT_MULTI_QUERIES; - sp->restore_thd_mem_root(YYTHD); - - if (sp->is_not_allowed_in_function("trigger")) - YYABORT; - - /* - We have to do it after parsing trigger body, because some of - sp_proc_stmt alternatives are not saving/restoring LEX, so - lex->query_tables can be wiped out. - - QQ: What are other consequences of this? - - QQ: Could we loosen lock type in certain cases ? - */ - if (!lex->select_lex.add_table_to_list(YYTHD, $7, - (LEX_STRING*) 0, - TL_OPTION_UPDATING, - TL_WRITE)) - YYABORT; - } | CREATE USER clear_privileges grant_list { Lex->sql_command = SQLCOM_CREATE_USER; @@ -1686,7 +1619,12 @@ sp_decls: sp_decl: DECLARE_SYM sp_decl_idents type - { Lex->sphead->reset_lex(YYTHD); } + { + LEX *lex= Lex; + + lex->sphead->reset_lex(YYTHD); + lex->spcont->declare_var_boundary($2); + } sp_opt_default { LEX *lex= Lex; @@ -1699,13 +1637,14 @@ sp_decl: for (uint i = max-$2 ; i < max ; i++) { sp_instr_set *in; + uint off= ctx->pvar_context2index(i); - ctx->set_type(i, type); + ctx->set_type(off, type); if (! has_default) it= new Item_null(); /* QQ Set to the type with null_value? */ in = new sp_instr_set(lex->sphead->instructions(), ctx, - ctx->pvar_context2index(i), + off, it, type, lex, (i == max - 1)); @@ -1714,8 +1653,9 @@ sp_decl: freeing LEX. */ lex->sphead->add_instr(in); - ctx->set_default(i, it); + ctx->set_default(off, it); } + ctx->declare_var_boundary(0); lex->sphead->restore_lex(YYTHD); $$.vars= $2; $$.conds= $$.hndlrs= $$.curs= 0; @@ -1788,7 +1728,8 @@ sp_decl: delete $5; YYABORT; } - i= new sp_instr_cpush(sp->instructions(), ctx, $5); + i= new sp_instr_cpush(sp->instructions(), ctx, $5, + ctx->current_cursors()); sp->add_instr(i); ctx->push_cursor(&$2); $$.vars= $$.conds= $$.hndlrs= 0; @@ -2378,8 +2319,12 @@ sp_case: ivar.str= (char *)"_tmp_"; ivar.length= 5; - Item *var= (Item*) new Item_splocal(ivar, - ctx->current_pvars()-1); + Item_splocal *var= new Item_splocal(ivar, + ctx->current_pvars()-1); +#ifndef DBUG_OFF + if (var) + var->owner= sp; +#endif Item *expr= new Item_func_eq(var, $2); i= new sp_instr_jump_if_not(ip, ctx, expr, lex); @@ -2597,7 +2542,7 @@ create3: /* This part of the parser is about handling of the partition information. - It's first version was written by Mikael Ronström with lots of answers to + It's first version was written by Mikael Ronström with lots of answers to questions provided by Antony Curtis. The partition grammar can be called from three places. @@ -3894,11 +3839,6 @@ alter: { THD *thd= YYTHD; LEX *lex= thd->lex; - if (lex->sphead && lex->sphead->m_type != TYPE_ENUM_PROCEDURE) - { - my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0)); - YYABORT; - } lex->sql_command= SQLCOM_ALTER_TABLE; lex->name= 0; lex->duplicates= DUP_ERROR; @@ -3966,7 +3906,8 @@ alter: lex->sql_command= SQLCOM_ALTER_FUNCTION; lex->spname= $3; } - | ALTER algorithm view_user view_suid VIEW_SYM table_ident + | ALTER view_algorithm_opt definer view_suid + VIEW_SYM table_ident { THD *thd= YYTHD; LEX *lex= thd->lex; @@ -3976,7 +3917,7 @@ alter: /* first table in list is target VIEW name */ lex->select_lex.add_table_to_list(thd, $6, NULL, 0); } - opt_view_list AS select_view_init check_option + view_list_opt AS view_select view_check_option {} ; @@ -3991,7 +3932,7 @@ alter_commands: opt_partitioning | partitioning /* - This part was added for release 5.1 by Mikael Ronström. + This part was added for release 5.1 by Mikael Ronström. From here we insert a number of commands to manage the partitions of a partitioned table such as adding partitions, dropping partitions, reorganising partitions in various manners. In future releases the list @@ -4299,11 +4240,6 @@ start: START_SYM TRANSACTION_SYM start_transaction_opts { LEX *lex= Lex; - if (lex->sphead && lex->sphead->m_type != TYPE_ENUM_PROCEDURE) - { - my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0)); - YYABORT; - } lex->sql_command= SQLCOM_BEGIN; lex->start_transaction_opt= $3; } @@ -4488,13 +4424,7 @@ opt_no_write_to_binlog: rename: RENAME table_or_tables { - LEX *lex= Lex; - if (lex->sphead && lex->sphead->m_type != TYPE_ENUM_PROCEDURE) - { - my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0)); - YYABORT; - } - lex->sql_command=SQLCOM_RENAME_TABLE; + Lex->sql_command= SQLCOM_RENAME_TABLE; } table_to_table_list {} @@ -4635,18 +4565,6 @@ select_init: | '(' select_paren ')' union_opt; -select_view_init: - SELECT_SYM remember_name select_init2 - { - Lex->create_view_select_start= $2; - } - | - '(' remember_name select_paren ')' union_opt - { - Lex->create_view_select_start= $2; - } - ; - select_paren: SELECT_SYM select_part2 { @@ -6583,7 +6501,13 @@ select_var_ident: YYABORT; else { - ((select_dumpvar *)lex->result)->var_list.push_back( new my_var($1,1,t->offset,t->type)); + my_var *var; + ((select_dumpvar *)lex->result)-> + var_list.push_back(var= new my_var($1,1,t->offset,t->type)); +#ifndef DBUG_OFF + if (var) + var->owner= lex->sphead; +#endif } } ; @@ -6643,21 +6567,10 @@ drop: lex->sql_command = SQLCOM_DROP_TABLE; lex->drop_temporary= $2; lex->drop_if_exists= $4; - if (!lex->drop_temporary && lex->sphead && - lex->sphead->m_type != TYPE_ENUM_PROCEDURE) - { - my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0)); - YYABORT; - } } | DROP INDEX_SYM ident ON table_ident {} { LEX *lex=Lex; - if (lex->sphead && lex->sphead->m_type != TYPE_ENUM_PROCEDURE) - { - my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0)); - YYABORT; - } lex->sql_command= SQLCOM_DROP_INDEX; lex->alter_info.drop_list.empty(); lex->alter_info.drop_list.push_back(new Alter_drop(Alter_drop::KEY, @@ -6703,13 +6616,7 @@ drop: } | DROP VIEW_SYM if_exists table_list opt_restrict { - THD *thd= YYTHD; - LEX *lex= thd->lex; - if (lex->sphead && lex->sphead->m_type != TYPE_ENUM_PROCEDURE) - { - my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0)); - YYABORT; - } + LEX *lex= Lex; lex->sql_command= SQLCOM_DROP_VIEW; lex->drop_if_exists= $3; } @@ -7174,6 +7081,11 @@ show_param: LEX *lex=Lex; lex->sql_command= SQLCOM_SHOW_STORAGE_ENGINES; } + | AUTHORS_SYM + { + LEX *lex=Lex; + lex->sql_command= SQLCOM_SHOW_AUTHORS; + } | PRIVILEGES { LEX *lex=Lex; @@ -7345,7 +7257,28 @@ show_param: YYABORT; if (prepare_schema_table(YYTHD, lex, 0, SCH_PROCEDURES)) YYABORT; - }; + } + | PROCEDURE CODE_SYM sp_name + { +#ifdef DBUG_OFF + yyerror(ER(ER_SYNTAX_ERROR)); + YYABORT; +#else + Lex->sql_command= SQLCOM_SHOW_PROC_CODE; + Lex->spname= $3; +#endif + } + | FUNCTION_SYM CODE_SYM sp_name + { +#ifdef DBUG_OFF + yyerror(ER(ER_SYNTAX_ERROR)); + YYABORT; +#else + Lex->sql_command= SQLCOM_SHOW_FUNC_CODE; + Lex->spname= $3; +#endif + } + ; show_engine_param: STATUS_SYM @@ -7886,6 +7819,10 @@ simple_ident: Item_splocal *splocal; splocal= new Item_splocal($1, spv->offset, lex->tok_start_prev - lex->sphead->m_tmp_query); +#ifndef DBUG_OFF + if (splocal) + splocal->owner= lex->sphead; +#endif $$ = (Item*) splocal; lex->variables_used= 1; lex->safe_to_cache_query=0; @@ -8171,6 +8108,7 @@ user: keyword: keyword_sp {} | ASCII_SYM {} + | AUTHORS_SYM {} | BACKUP_SYM {} | BEGIN_SYM {} | BYTE_SYM {} @@ -8242,6 +8180,7 @@ keyword_sp: | CIPHER_SYM {} | CLIENT_SYM {} | COALESCE {} + | CODE_SYM {} | COLLATION_SYM {} | COLUMNS {} | COMMITTED_SYM {} @@ -8680,6 +8619,9 @@ option_value: names.length= 5; if (spc && spc->find_pvar(&names)) my_error(ER_SP_BAD_VAR_SHADOW, MYF(0), names.str); + else + yyerror(ER(ER_SYNTAX_ERROR)); + YYABORT; } | NAMES_SYM charset_name_or_default opt_collate @@ -9369,11 +9311,6 @@ begin: BEGIN_SYM { LEX *lex=Lex; - if (lex->sphead && lex->sphead->m_type != TYPE_ENUM_PROCEDURE) - { - my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0)); - YYABORT; - } lex->sql_command = SQLCOM_BEGIN; lex->start_transaction_opt= 0; } @@ -9406,11 +9343,6 @@ commit: COMMIT_SYM opt_work opt_chain opt_release { LEX *lex=Lex; - if (lex->sphead && lex->sphead->m_type != TYPE_ENUM_PROCEDURE) - { - my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0)); - YYABORT; - } lex->sql_command= SQLCOM_COMMIT; lex->tx_chain= $3; lex->tx_release= $4; @@ -9421,11 +9353,6 @@ rollback: ROLLBACK_SYM opt_work opt_chain opt_release { LEX *lex=Lex; - if (lex->sphead && lex->sphead->m_type != TYPE_ENUM_PROCEDURE) - { - my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0)); - YYABORT; - } lex->sql_command= SQLCOM_ROLLBACK; lex->tx_chain= $3; lex->tx_release= $4; @@ -9605,8 +9532,119 @@ subselect_end: lex->current_select = lex->current_select->return_after_parsing(); }; -opt_view_list: - /* empty */ {} +definer: + get_definer + { + THD *thd= YYTHD; + + if (! (thd->lex->definer= create_definer(thd, &$1->user, &$1->host))) + YYABORT; + } + ; + +get_definer: + opt_current_definer + { + THD *thd= YYTHD; + + if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user)))) + YYABORT; + + if (get_default_definer(thd, $$)) + YYABORT; + } + | DEFINER_SYM EQ ident_or_text '@' ident_or_text + { + if (!($$=(LEX_USER*) YYTHD->alloc(sizeof(st_lex_user)))) + YYABORT; + + $$->user= $3; + $$->host= $5; + } + ; + +opt_current_definer: + /* empty */ + | DEFINER_SYM EQ CURRENT_USER optional_braces + ; + +/************************************************************************** + + CREATE VIEW statement options. + +**************************************************************************/ + +view_replace_or_algorithm: + view_replace + {} + | view_replace view_algorithm + {} + | view_algorithm + {} + ; + +view_replace: + OR_SYM REPLACE + { Lex->create_view_mode= VIEW_CREATE_OR_REPLACE; } + ; + +view_algorithm: + ALGORITHM_SYM EQ UNDEFINED_SYM + { Lex->create_view_algorithm= VIEW_ALGORITHM_UNDEFINED; } + | ALGORITHM_SYM EQ MERGE_SYM + { Lex->create_view_algorithm= VIEW_ALGORITHM_MERGE; } + | ALGORITHM_SYM EQ TEMPTABLE_SYM + { Lex->create_view_algorithm= VIEW_ALGORITHM_TMPTABLE; } + ; + +view_algorithm_opt: + /* empty */ + { Lex->create_view_algorithm= VIEW_ALGORITHM_UNDEFINED; } + | view_algorithm + {} + ; + +view_or_trigger: + definer view_or_trigger_tail + {} + | view_replace_or_algorithm definer view_tail + {} + ; + +view_or_trigger_tail: + view_tail + {} + | trigger_tail + {} + ; + +view_suid: + /* empty */ + { Lex->create_view_suid= TRUE; } + | SQL_SYM SECURITY_SYM DEFINER_SYM + { Lex->create_view_suid= TRUE; } + | SQL_SYM SECURITY_SYM INVOKER_SYM + { Lex->create_view_suid= FALSE; } + ; + +view_tail: + view_suid VIEW_SYM table_ident + { + THD *thd= YYTHD; + LEX *lex= thd->lex; + lex->sql_command= SQLCOM_CREATE_VIEW; + lex->create_view_start= thd->query; + /* first table in list is target VIEW name */ + if (!lex->select_lex.add_table_to_list(thd, $3, NULL, 0)) + YYABORT; + } + view_list_opt AS view_select view_check_option + {} + ; + +view_list_opt: + /* empty */ + {} | '(' view_list ')' ; @@ -9623,79 +9661,102 @@ view_list: } ; -or_replace: - /* empty */ { Lex->create_view_mode= VIEW_CREATE_NEW; } - | OR_SYM REPLACE { Lex->create_view_mode= VIEW_CREATE_OR_REPLACE; } +view_select: + SELECT_SYM remember_name select_init2 + { + Lex->create_view_select_start= $2; + } + | '(' remember_name select_paren ')' union_opt + { + Lex->create_view_select_start= $2; + } ; -algorithm: +view_check_option: /* empty */ - { Lex->create_view_algorithm= VIEW_ALGORITHM_UNDEFINED; } - | ALGORITHM_SYM EQ UNDEFINED_SYM - { Lex->create_view_algorithm= VIEW_ALGORITHM_UNDEFINED; } - | ALGORITHM_SYM EQ MERGE_SYM - { Lex->create_view_algorithm= VIEW_ALGORITHM_MERGE; } - | ALGORITHM_SYM EQ TEMPTABLE_SYM - { Lex->create_view_algorithm= VIEW_ALGORITHM_TMPTABLE; } + { Lex->create_view_check= VIEW_CHECK_NONE; } + | WITH CHECK_SYM OPTION + { Lex->create_view_check= VIEW_CHECK_CASCADED; } + | WITH CASCADED CHECK_SYM OPTION + { Lex->create_view_check= VIEW_CHECK_CASCADED; } + | WITH LOCAL_SYM CHECK_SYM OPTION + { Lex->create_view_check= VIEW_CHECK_LOCAL; } ; -view_user: - /* empty */ - { - THD *thd= YYTHD; - if (!(thd->lex->create_view_definer= - (LEX_USER*) thd->alloc(sizeof(st_lex_user)))) - YYABORT; - if (default_view_definer(thd->security_ctx, - thd->lex->create_view_definer)) - YYABORT; - } - | CURRENT_USER optional_braces - { - THD *thd= YYTHD; - if (!(thd->lex->create_view_definer= - (LEX_USER*) thd->alloc(sizeof(st_lex_user)))) - YYABORT; - if (default_view_definer(thd->security_ctx, - thd->lex->create_view_definer)) - YYABORT; - } - | DEFINER_SYM EQ ident_or_text '@' ident_or_text +/************************************************************************** + + CREATE TRIGGER statement parts. + +**************************************************************************/ + +trigger_tail: + TRIGGER_SYM remember_name sp_name trg_action_time trg_event + ON table_ident FOR_SYM EACH_SYM ROW_SYM + { + LEX *lex= Lex; + sp_head *sp; + + if (lex->sphead) { - THD *thd= YYTHD; - st_lex_user *view_user; - if (!(thd->lex->create_view_definer= view_user= - (LEX_USER*) thd->alloc(sizeof(st_lex_user)))) - YYABORT; - view_user->user = $3; view_user->host=$5; - if (view_user->host.length == 0) - { - my_error(ER_NO_VIEW_USER, MYF(0)); - YYABORT; - } + my_error(ER_SP_NO_RECURSIVE_CREATE, MYF(0), "TRIGGER"); + YYABORT; } - ; - -view_suid: - /* empty */ - { Lex->create_view_suid= TRUE; } - | - SQL_SYM SECURITY_SYM DEFINER_SYM - { Lex->create_view_suid= TRUE; } - | SQL_SYM SECURITY_SYM INVOKER_SYM - { Lex->create_view_suid= FALSE; } + + if (!(sp= new sp_head())) + YYABORT; + sp->reset_thd_mem_root(YYTHD); + sp->init(lex); + + lex->trigger_definition_begin= $2; + + sp->m_type= TYPE_ENUM_TRIGGER; + lex->sphead= sp; + lex->spname= $3; + /* + We have to turn of CLIENT_MULTI_QUERIES while parsing a + stored procedure, otherwise yylex will chop it into pieces + at each ';'. + */ + sp->m_old_cmq= YYTHD->client_capabilities & CLIENT_MULTI_QUERIES; + YYTHD->client_capabilities &= ~CLIENT_MULTI_QUERIES; + + bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics)); + lex->sphead->m_chistics= &lex->sp_chistics; + lex->sphead->m_body_begin= lex->ptr; + } + sp_proc_stmt + { + LEX *lex= Lex; + sp_head *sp= lex->sphead; + + lex->sql_command= SQLCOM_CREATE_TRIGGER; + sp->init_strings(YYTHD, lex, $3); + /* Restore flag if it was cleared above */ + if (sp->m_old_cmq) + YYTHD->client_capabilities |= CLIENT_MULTI_QUERIES; + sp->restore_thd_mem_root(YYTHD); + + if (sp->is_not_allowed_in_function("trigger")) + YYABORT; + + /* + We have to do it after parsing trigger body, because some of + sp_proc_stmt alternatives are not saving/restoring LEX, so + lex->query_tables can be wiped out. + + QQ: What are other consequences of this? + + QQ: Could we loosen lock type in certain cases ? + */ + if (!lex->select_lex.add_table_to_list(YYTHD, $7, + (LEX_STRING*) 0, + TL_OPTION_UPDATING, + TL_WRITE)) + YYABORT; + } ; -check_option: - /* empty */ - { Lex->create_view_check= VIEW_CHECK_NONE; } - | WITH CHECK_SYM OPTION - { Lex->create_view_check= VIEW_CHECK_CASCADED; } - | WITH CASCADED CHECK_SYM OPTION - { Lex->create_view_check= VIEW_CHECK_CASCADED; } - | WITH LOCAL_SYM CHECK_SYM OPTION - { Lex->create_view_check= VIEW_CHECK_LOCAL; } - ; +/*************************************************************************/ xa: XA_SYM begin_or_start xid opt_join_or_resume { diff --git a/sql/structs.h b/sql/structs.h index 77d0d435154..85af73794ae 100644 --- a/sql/structs.h +++ b/sql/structs.h @@ -20,8 +20,6 @@ struct st_table; class Field; -#define STRING_WITH_LEN(X) ((char*) X), (sizeof(X)-1) - typedef struct st_lex_string { char *str; @@ -176,8 +174,8 @@ enum SHOW_TYPE { SHOW_UNDEF, SHOW_LONG, SHOW_LONGLONG, SHOW_INT, SHOW_CHAR, SHOW_CHAR_PTR, - SHOW_DOUBLE_STATUS, - SHOW_BOOL, SHOW_MY_BOOL, SHOW_OPENTABLES, SHOW_STARTTIME, SHOW_QUESTION, + SHOW_DOUBLE_STATUS, SHOW_BOOL, SHOW_MY_BOOL, + SHOW_OPEN_TABLES, SHOW_TABLE_DEFINITIONS, SHOW_STARTTIME, SHOW_QUESTION, SHOW_LONG_CONST, SHOW_INT_CONST, SHOW_HAVE, SHOW_SYS, SHOW_HA_ROWS, SHOW_VARS, #ifdef HAVE_OPENSSL diff --git a/sql/table.cc b/sql/table.cc index ab80fd1f7fb..ff29a33ef03 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -24,135 +24,319 @@ /* Functions defined in this file */ -static void frm_error(int error,TABLE *form,const char *name, - int errortype, int errarg); +void open_table_error(TABLE_SHARE *share, int error, int db_errno, + myf errortype, int errarg); +static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, + File file); static void fix_type_pointers(const char ***array, TYPELIB *point_to_type, uint types, char **names); -static uint find_field(TABLE *form,uint start,uint length); +static uint find_field(Field **fields, uint start, uint length); -static byte* get_field_name(Field **buff,uint *length, +/* Get column name from column hash */ + +static byte *get_field_name(Field **buff, uint *length, my_bool not_used __attribute__((unused))) { *length= (uint) strlen((*buff)->field_name); return (byte*) (*buff)->field_name; } + /* - Open a .frm file + Allocate a setup TABLE_SHARE structure SYNOPSIS - openfrm() + alloc_table_share() + TABLE_LIST Take database and table name from there + key Table cache key (db \0 table_name \0...) + key_length Length of key - name path to table-file "db/name" - alias alias for table - db_stat open flags (for example HA_OPEN_KEYFILE|HA_OPEN_RNDFILE..) - can be 0 (example in ha_example_table) - prgflag READ_ALL etc.. - ha_open_flags HA_OPEN_ABORT_IF_LOCKED etc.. - outparam result table + RETURN + 0 Error (out of memory) + # Share +*/ + +TABLE_SHARE *alloc_table_share(TABLE_LIST *table_list, char *key, + uint key_length) +{ + MEM_ROOT mem_root; + TABLE_SHARE *share; + char path[FN_REFLEN], normalized_path[FN_REFLEN]; + uint path_length, normalized_length; + + path_length= (uint) (strxmov(path, mysql_data_home, "/", table_list->db, + "/", table_list->table_name, NullS) - path); + normalized_length= unpack_filename(normalized_path, path); + + init_sql_alloc(&mem_root, TABLE_ALLOC_BLOCK_SIZE, 0); + if ((share= (TABLE_SHARE*) alloc_root(&mem_root, + sizeof(*share) + key_length + + path_length + normalized_length +2))) + { + bzero((char*) share, sizeof(*share)); + share->table_cache_key.str= (char*) (share+1); + share->table_cache_key.length= key_length; + memcpy(share->table_cache_key.str, key, key_length); + + /* Use the fact the key is db/0/table_name/0 */ + share->db.str= share->table_cache_key.str; + share->db.length= strlen(share->db.str); + share->table_name.str= share->db.str + share->db.length + 1; + share->table_name.length= strlen(share->table_name.str); + + share->path.str= share->table_cache_key.str+ key_length; + share->path.length= path_length; + strmov(share->path.str, path); + share->normalized_path.str= share->path.str+ path_length+1; + share->normalized_path.length= normalized_length; + strmov(share->normalized_path.str, normalized_path); + + share->version= refresh_version; + share->flush_version= flush_version; + + memcpy((char*) &share->mem_root, (char*) &mem_root, sizeof(mem_root)); + pthread_mutex_init(&share->mutex, MY_MUTEX_INIT_FAST); + pthread_cond_init(&share->cond, NULL); + } + return share; +} + + +/* + Initialize share for temporary tables + + SYNOPSIS + init_tmp_table_share() + share Share to fill + key Table_cache_key, as generated from create_table_def_key. + must start with db name. + key_length Length of key + table_name Table name + path Path to file (possible in lower case) without .frm + + NOTES + This is different from alloc_table_share() because temporary tables + don't have to be shared between threads or put into the table def + cache, so we can do some things notable simpler and faster + + If table is not put in thd->temporary_tables (happens only when + one uses OPEN TEMPORARY) then one can specify 'db' as key and + use key_length= 0 as neither table_cache_key or key_length will be used). +*/ + +void init_tmp_table_share(TABLE_SHARE *share, const char *key, + uint key_length, const char *table_name, + const char *path) +{ + DBUG_ENTER("init_tmp_table_share"); + + bzero((char*) share, sizeof(*share)); + init_sql_alloc(&share->mem_root, TABLE_ALLOC_BLOCK_SIZE, 0); + share->tmp_table= INTERNAL_TMP_TABLE; + share->db.str= (char*) key; + share->db.length= strlen(key); + share->table_cache_key.str= (char*) key; + share->table_cache_key.length= key_length; + share->table_name.str= (char*) table_name; + share->table_name.length= strlen(table_name); + share->path.str= (char*) path; + share->normalized_path.str= (char*) path; + share->path.length= share->normalized_path.length= strlen(path); + share->frm_version= FRM_VER_TRUE_VARCHAR; + + DBUG_VOID_RETURN; +} + + +/* + Free table share and memory used by it + + SYNOPSIS + free_table_share() + share Table share + + NOTES + share->mutex must be locked when we come here if it's not a temp table +*/ + +void free_table_share(TABLE_SHARE *share) +{ + MEM_ROOT mem_root; + DBUG_ENTER("free_table_share"); + DBUG_PRINT("enter", ("table: %s.%s", share->db.str, share->table_name.str)); + DBUG_ASSERT(share->ref_count == 0); + + /* + If someone is waiting for this to be deleted, inform it about this. + Don't do a delete until we know that no one is refering to this anymore. + */ + if (share->tmp_table == NO_TMP_TABLE) + { + /* share->mutex is locked in release_table_share() */ + while (share->waiting_on_cond) + { + pthread_cond_broadcast(&share->cond); + pthread_cond_wait(&share->cond, &share->mutex); + } + /* No thread refers to this anymore */ + pthread_mutex_unlock(&share->mutex); + pthread_mutex_destroy(&share->mutex); + pthread_cond_destroy(&share->cond); + } + hash_free(&share->name_hash); + + /* We must copy mem_root from share because share is allocated through it */ + memcpy((char*) &mem_root, (char*) &share->mem_root, sizeof(mem_root)); + free_root(&mem_root, MYF(0)); // Free's share + DBUG_VOID_RETURN; +} + + +/* + Read table definition from a binary / text based .frm file + + SYNOPSIS + open_table_def() + thd Thread handler + share Fill this with table definition + db_flags Bit mask of the following flags: OPEN_VIEW + + NOTES + This function is called when the table definition is not cached in + table_def_cache + The data is returned in 'share', which is alloced by + alloc_table_share().. The code assumes that share is initialized. RETURN VALUES 0 ok - 1 Error (see frm_error) - 2 Error (see frm_error) + 1 Error (see open_table_error) + 2 Error (see open_table_error) 3 Wrong data in .frm file - 4 Error (see frm_error) - 5 Error (see frm_error: charset unavailable) + 4 Error (see open_table_error) + 5 Error (see open_table_error: charset unavailable) 6 Unknown .frm version */ -int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, - uint prgflag, uint ha_open_flags, TABLE *outparam) +int open_table_def(THD *thd, TABLE_SHARE *share, uint db_flags) { - reg1 uint i; - reg2 uchar *strpos; - int j,error, errarg= 0; - uint rec_buff_length,n_length,int_length,records,key_parts,keys, - interval_count,interval_parts,read_length,db_create_options; - uint key_info_length, com_length, part_info_len=0, extra_rec_buf_length; - ulong pos, record_offset; - char index_file[FN_REFLEN], *names, *keynames, *comment_pos; - uchar head[288],*disk_buff,new_field_pack_flag; - my_string record; - const char **int_array; - bool use_hash, null_field_first; - bool error_reported= FALSE; - File file; - Field **field_ptr,*reg_field; - KEY *keyinfo; - KEY_PART_INFO *key_part; - uchar *null_pos; - uint null_bit_pos, new_frm_ver, field_pack_length; - SQL_CRYPT *crypted=0; + int error, table_type; + bool error_given; + File file; + uchar head[288], *disk_buff; + char path[FN_REFLEN]; MEM_ROOT **root_ptr, *old_root; - TABLE_SHARE *share; - enum db_type default_part_db_type; - DBUG_ENTER("openfrm"); - DBUG_PRINT("enter",("name: '%s' form: 0x%lx",name,outparam)); + DBUG_ENTER("open_table_def"); + DBUG_PRINT("enter", ("name: '%s.%s'",share->db.str, share->table_name.str)); error= 1; + error_given= 0; disk_buff= NULL; - root_ptr= my_pthread_getspecific_ptr(MEM_ROOT**, THR_MALLOC); - old_root= *root_ptr; - bzero((char*) outparam,sizeof(*outparam)); - outparam->in_use= thd; - outparam->s= share= &outparam->share_not_to_be_used; - - if ((file=my_open(fn_format(index_file, name, "", reg_ext, - MY_UNPACK_FILENAME), - O_RDONLY | O_SHARE, - MYF(0))) - < 0) - goto err; + strxmov(path, share->normalized_path.str, reg_ext, NullS); + if ((file= my_open(path, O_RDONLY | O_SHARE, MYF(0))) < 0) + goto err_not_open; error= 4; - if (my_read(file,(byte*) head,64,MYF(MY_NABP))) + if (my_read(file,(byte*) head, 64, MYF(MY_NABP))) goto err; - if (memcmp(head, "TYPE=", 5) == 0) + if (head[0] == (uchar) 254 && head[1] == 1) { - // new .frm - my_close(file,MYF(MY_WME)); - - if (db_stat & NO_ERR_ON_NEW_FRM) - DBUG_RETURN(5); - file= -1; - // caller can't process new .frm + if (head[2] == FRM_VER || head[2] == FRM_VER+1 || + (head[2] >= FRM_VER+3 && head[2] <= FRM_VER+4)) + table_type= 1; + else + { + error= 6; // Unkown .frm version + goto err; + } + } + else if (memcmp(head, STRING_WITH_LEN("TYPE=")) == 0) + { + error= 5; + if (memcmp(head+5,"VIEW",4) == 0) + { + share->is_view= 1; + if (db_flags & OPEN_VIEW) + error= 0; + } goto err; } - - share->blob_ptr_size= sizeof(char*); - outparam->db_stat= db_stat; - init_sql_alloc(&outparam->mem_root, TABLE_ALLOC_BLOCK_SIZE, 0); - *root_ptr= &outparam->mem_root; - - share->table_name= strdup_root(&outparam->mem_root, - name+dirname_length(name)); - share->path= strdup_root(&outparam->mem_root, name); - outparam->alias= my_strdup(alias, MYF(MY_WME)); - if (!share->table_name || !share->path || !outparam->alias) + else goto err; - *fn_ext(share->table_name)='\0'; // Remove extension - *fn_ext(share->path)='\0'; // Remove extension - - if (head[0] != (uchar) 254 || head[1] != 1) - goto err; /* purecov: inspected */ - if (head[2] != FRM_VER && head[2] != FRM_VER+1 && - ! (head[2] >= FRM_VER+3 && head[2] <= FRM_VER+4)) + + /* No handling of text based files yet */ + if (table_type == 1) { - error= 6; - goto err; /* purecov: inspected */ + root_ptr= my_pthread_getspecific_ptr(MEM_ROOT**, THR_MALLOC); + old_root= *root_ptr; + *root_ptr= &share->mem_root; + error= open_binary_frm(thd, share, head, file); + *root_ptr= old_root; + + /* + We can't mark all tables in 'mysql' database as system since we don't + allow to lock such tables for writing with any other tables (even with + other system tables) and some privilege tables need this. + */ + if (share->db.length == 5 && + !my_strcasecmp(system_charset_info, share->db.str, "mysql") && + !my_strcasecmp(system_charset_info, share->table_name.str, "proc")) + share->system_table= 1; + error_given= 1; } - new_field_pack_flag=head[27]; + + if (!error) + thd->status_var.opened_shares++; + +err: + my_close(file, MYF(MY_WME)); + +err_not_open: + if (error && !error_given) + { + share->error= error; + open_table_error(share, error, (share->open_errno= my_errno), 0); + } + DBUG_RETURN(error); +} + + +/* + Read data from a binary .frm file from MySQL 3.23 - 5.0 into TABLE_SHARE +*/ + +static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, + File file) +{ + int error, errarg= 0; + uint new_frm_ver, field_pack_length, new_field_pack_flag; + uint interval_count, interval_parts, read_length, int_length; + uint db_create_options, keys, key_parts, n_length; + uint key_info_length, com_length, null_bit_pos; + uint extra_rec_buf_length; + uint i,j; + bool use_hash; + char *keynames, *record, *names, *comment_pos; + uchar *disk_buff, *strpos, *null_flags, *null_pos; + ulong pos, record_offset, *rec_per_key, rec_buff_length; + handler *handler_file= 0; + KEY *keyinfo; + KEY_PART_INFO *key_part; + SQL_CRYPT *crypted=0; + Field **field_ptr, *reg_field; + const char **interval_array; + DBUG_ENTER("open_binary_frm"); + + new_field_pack_flag= head[27]; new_frm_ver= (head[2] - FRM_VER); field_pack_length= new_frm_ver < 2 ? 11 : 17; + disk_buff= 0; - error=3; + error= 3; if (!(pos=get_form_pos(file,head,(TYPELIB*) 0))) goto err; /* purecov: inspected */ - *fn_ext(index_file)='\0'; // Remove .frm extension share->frm_version= head[2]; /* @@ -164,12 +348,16 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, if (share->frm_version == FRM_VER_TRUE_VARCHAR -1 && head[33] == 5) share->frm_version= FRM_VER_TRUE_VARCHAR; - default_part_db_type= ha_checktype(thd,(enum db_type) (uint) *(head+61),0,0); - share->db_type= ha_checktype(thd,(enum db_type) (uint) *(head+3),0,0); - share->db_create_options= db_create_options=uint2korr(head+30); +#ifdef WITH_PARTITION_STORAGE_ENGINE + share->default_part_db_type= ha_checktype(thd, + (enum db_type) (uint) *(head+61),0, + 0); +#endif + share->db_type= ha_checktype(thd, (enum db_type) (uint) *(head+3),0,0); + share->db_create_options= db_create_options= uint2korr(head+30); share->db_options_in_use= share->db_create_options; share->mysql_version= uint4korr(head+51); - null_field_first= 0; + share->null_field_first= 0; if (!head[32]) // New frm file in 3.23 { share->avg_row_length= uint4korr(head+34); @@ -178,7 +366,7 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, share->raid_chunks= head[42]; share->raid_chunksize= uint4korr(head+43); share->table_charset= get_charset((uint) head[38],MYF(0)); - null_field_first= 1; + share->null_field_first= 1; } if (!share->table_charset) { @@ -189,7 +377,7 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, sql_print_warning("'%s' had no or invalid character set, " "and default character set is multi-byte, " "so character column sizes may have changed", - name); + share->path); } share->table_charset= default_charset_info; } @@ -219,27 +407,23 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, } share->keys_for_keyread.init(0); share->keys_in_use.init(keys); - outparam->quick_keys.init(); - outparam->used_keys.init(); - outparam->keys_in_use_for_query.init(); n_length=keys*sizeof(KEY)+key_parts*sizeof(KEY_PART_INFO); - if (!(keyinfo = (KEY*) alloc_root(&outparam->mem_root, - n_length+uint2korr(disk_buff+4)))) + if (!(keyinfo = (KEY*) alloc_root(&share->mem_root, + n_length + uint2korr(disk_buff+4)))) goto err; /* purecov: inspected */ bzero((char*) keyinfo,n_length); - outparam->key_info=keyinfo; + share->key_info= keyinfo; key_part= my_reinterpret_cast(KEY_PART_INFO*) (keyinfo+keys); strpos=disk_buff+6; - ulong *rec_per_key; - if (!(rec_per_key= (ulong*) alloc_root(&outparam->mem_root, + if (!(rec_per_key= (ulong*) alloc_root(&share->mem_root, sizeof(ulong*)*key_parts))) goto err; for (i=0 ; i < keys ; i++, keyinfo++) { - keyinfo->table= outparam; + keyinfo->table= 0; // Updated in open_frm if (new_frm_ver >= 3) { keyinfo->flags= (uint) uint2korr(strpos) ^ HA_NOSAME; @@ -295,10 +479,8 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, #ifdef HAVE_CRYPTED_FRM else if (*(head+26) == 2) { - *root_ptr= old_root - crypted=get_crypt_for_frm(); - *root_ptr= &outparam->mem_root; - outparam->crypted=1; + crypted= get_crypt_for_frm(); + share->crypted= 1; } #endif @@ -320,10 +502,9 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, goto err; } share->connect_string.length= uint2korr(buff); - if (! (share->connect_string.str= strmake_root(&outparam->mem_root, + if (! (share->connect_string.str= strmake_root(&share->mem_root, next_chunk + 2, share->connect_string.length))) { - DBUG_PRINT("EDS", ("strmake_root failed for connect_string")); my_free(buff, MYF(0)); goto err; } @@ -358,27 +539,30 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, } if (next_chunk + 4 < buff_end) { - part_info_len= uint4korr(next_chunk); - if (part_info_len > 0) - { + uint32 partition_info_len = uint4korr(next_chunk); #ifdef WITH_PARTITION_STORAGE_ENGINE - if (mysql_unpack_partition(thd, (uchar *)(next_chunk + 4), - part_info_len, outparam, - default_part_db_type)) + if ((share->partition_info_len= partition_info_len)) + { + if (!(share->partition_info= + (uchar*) memdup_root(&share->mem_root, next_chunk + 4, + partition_info_len + 1))) { - DBUG_PRINT("info", ("mysql_unpack_partition failed")); my_free(buff, MYF(0)); goto err; } + next_chunk++; + } #else + if (partition_info_len) + { DBUG_PRINT("info", ("WITH_PARTITION_STORAGE_ENGINE is not defined")); my_free(buff, MYF(0)); goto err; -#endif } - next_chunk+= part_info_len + 5; +#endif + next_chunk+= 4 + partition_info_len; } - keyinfo= outparam->key_info; + keyinfo= share->key_info; for (i= 0; i < keys; i++, keyinfo++) { if (keyinfo->flags & HA_USES_PARSER) @@ -386,8 +570,8 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, LEX_STRING parser_name; if (next_chunk >= buff_end) { - DBUG_PRINT("EDS", - ("fulltext key uses parser that is not defined in .frm")); + DBUG_PRINT("error", + ("fulltext key uses parser that is not defined in .frm")); my_free(buff, MYF(0)); goto err; } @@ -396,10 +580,8 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, keyinfo->parser= plugin_lock(&parser_name, MYSQL_FTPARSER_PLUGIN); if (! keyinfo->parser) { - DBUG_PRINT("EDS", ("parser plugin is not loaded")); my_free(buff, MYF(0)); my_error(ER_PLUGIN_IS_NOT_LOADED, MYF(0), parser_name.str); - error_reported= 1; goto err; } } @@ -408,54 +590,17 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, } error=4; - outparam->reginfo.lock_type= TL_UNLOCK; - outparam->current_lock=F_UNLCK; - if ((db_stat & HA_OPEN_KEYFILE) || (prgflag & DELAYED_OPEN)) - records=2; - else - records=1; - if (prgflag & (READ_ALL+EXTRA_RECORD)) - records++; - /* QQ: TODO, remove the +1 from below */ extra_rec_buf_length= uint2korr(head+59); - rec_buff_length= ALIGN_SIZE(share->reclength + 1 + - extra_rec_buf_length); + rec_buff_length= ALIGN_SIZE(share->reclength + 1 + extra_rec_buf_length); share->rec_buff_length= rec_buff_length; - if (!(record= (char *) alloc_root(&outparam->mem_root, - rec_buff_length * records))) + if (!(record= (char *) alloc_root(&share->mem_root, + rec_buff_length))) goto err; /* purecov: inspected */ share->default_values= (byte *) record; - if (my_pread(file,(byte*) record, (uint) share->reclength, record_offset, MYF(MY_NABP))) - goto err; /* purecov: inspected */ + goto err; /* purecov: inspected */ - if (records == 1) - { - /* We are probably in hard repair, and the buffers should not be used */ - outparam->record[0]= outparam->record[1]= share->default_values; - } - else - { - outparam->record[0]= (byte *) record+ rec_buff_length; - if (records > 2) - outparam->record[1]= (byte *) record+ rec_buff_length*2; - else - outparam->record[1]= outparam->record[0]; // Safety - } - -#ifdef HAVE_purify - /* - We need this because when we read var-length rows, we are not updating - bytes after end of varchar - */ - if (records > 1) - { - memcpy(outparam->record[0], share->default_values, rec_buff_length); - if (records > 2) - memcpy(outparam->record[1], share->default_values, rec_buff_length); - } -#endif VOID(my_seek(file,pos,MY_SEEK_SET,MYF(0))); if (my_read(file,(byte*) head,288,MYF(MY_NABP))) goto err; @@ -476,12 +621,12 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, int_length= uint2korr(head+274); share->null_fields= uint2korr(head+282); com_length= uint2korr(head+284); - share->comment= strdup_root(&outparam->mem_root, (char*) head+47); + share->comment= strdup_root(&share->mem_root, (char*) head+47); DBUG_PRINT("info",("i_count: %d i_parts: %d index: %d n_length: %d int_length: %d com_length: %d", interval_count,interval_parts, share->keys,n_length,int_length, com_length)); if (!(field_ptr = (Field **) - alloc_root(&outparam->mem_root, + alloc_root(&share->mem_root, (uint) ((share->fields+1)*sizeof(Field*)+ interval_count*sizeof(TYPELIB)+ (share->fields+interval_parts+ @@ -489,7 +634,7 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, (n_length+int_length+com_length))))) goto err; /* purecov: inspected */ - outparam->field=field_ptr; + share->field= field_ptr; read_length=(uint) (share->fields * field_pack_length + pos+ (uint) (n_length+int_length+com_length)); if (read_string(file,(gptr*) &disk_buff,read_length)) @@ -505,8 +650,8 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, strpos= disk_buff+pos; share->intervals= (TYPELIB*) (field_ptr+share->fields+1); - int_array= (const char **) (share->intervals+interval_count); - names= (char*) (int_array+share->fields+interval_parts+keys+3); + interval_array= (const char **) (share->intervals+interval_count); + names= (char*) (interval_array+share->fields+interval_parts+keys+3); if (!interval_count) share->intervals= 0; // For better debugging memcpy((char*) names, strpos+(share->fields*field_pack_length), @@ -514,8 +659,8 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, comment_pos= names+(n_length+int_length); memcpy(comment_pos, disk_buff+read_length-com_length, com_length); - fix_type_pointers(&int_array, &share->fieldnames, 1, &names); - fix_type_pointers(&int_array, share->intervals, interval_count, + fix_type_pointers(&interval_array, &share->fieldnames, 1, &names); + fix_type_pointers(&interval_array, share->intervals, interval_count, &names); { @@ -526,7 +671,7 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, interval++) { uint count= (uint) (interval->count + 1) * sizeof(uint); - if (!(interval->type_lengths= (uint *) alloc_root(&outparam->mem_root, + if (!(interval->type_lengths= (uint *) alloc_root(&share->mem_root, count))) goto err; for (count= 0; count < interval->count; count++) @@ -536,20 +681,17 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, } if (keynames) - fix_type_pointers(&int_array, &share->keynames, 1, &keynames); + fix_type_pointers(&interval_array, &share->keynames, 1, &keynames); - VOID(my_close(file,MYF(MY_WME))); - file= -1; - - /* Allocate handler */ - if (!(outparam->file= get_new_handler(outparam, &outparam->mem_root, - share->db_type))) + /* Allocate handler */ + if (!(handler_file= get_new_handler(share, thd->mem_root, + share->db_type))) goto err; - record= (char*) outparam->record[0]-1; /* Fieldstart = 1 */ - if (null_field_first) + record= (char*) share->default_values-1; /* Fieldstart = 1 */ + if (share->null_field_first) { - outparam->null_flags=null_pos=(uchar*) record+1; + null_flags= null_pos= (uchar*) record+1; null_bit_pos= (db_create_options & HA_OPTION_PACK_RECORD) ? 0 : 1; /* null_bytes below is only correct under the condition that @@ -558,13 +700,15 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, */ share->null_bytes= (share->null_fields + null_bit_pos + 7) / 8; } +#ifndef WE_WANT_TO_SUPPORT_VERY_OLD_FRM_FILES else { share->null_bytes= (share->null_fields+7)/8; - outparam->null_flags= null_pos= - (uchar*) (record+1+share->reclength-share->null_bytes); + null_flags= null_pos= (uchar*) (record + 1 +share->reclength - + share->null_bytes); null_bit_pos= 0; } +#endif use_hash= share->fields >= MAX_FIELDS_BEFORE_HASH; if (use_hash) @@ -679,16 +823,23 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, field_length= my_decimal_precision_to_length(field_length, decimals, f_is_dec(pack_flag) == 0); - sql_print_error("Found incompatible DECIMAL field '%s' in %s; Please do \"ALTER TABLE '%s' FORCE\" to fix it!", share->fieldnames.type_names[i], name, share->table_name); + sql_print_error("Found incompatible DECIMAL field '%s' in %s; " + "Please do \"ALTER TABLE '%s' FORCE\" to fix it!", + share->fieldnames.type_names[i], share->table_name.str, + share->table_name.str); push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, ER_CRASHED_ON_USAGE, - "Found incompatible DECIMAL field '%s' in %s; Please do \"ALTER TABLE '%s' FORCE\" to fix it!", share->fieldnames.type_names[i], name, share->table_name); + "Found incompatible DECIMAL field '%s' in %s; " + "Please do \"ALTER TABLE '%s' FORCE\" to fix it!", + share->fieldnames.type_names[i], + share->table_name.str, + share->table_name.str); share->crashed= 1; // Marker for CHECK TABLE } #endif - *field_ptr=reg_field= - make_field(record+recpos, + *field_ptr= reg_field= + make_field(share, record+recpos, (uint32) field_length, null_pos, null_bit_pos, pack_flag, @@ -699,15 +850,14 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, (interval_nr ? share->intervals+interval_nr-1 : (TYPELIB*) 0), - share->fieldnames.type_names[i], - outparam); + share->fieldnames.type_names[i]); if (!reg_field) // Not supported field type { error= 4; goto err; /* purecov: inspected */ } - reg_field->fieldnr= i+1; //Set field number + reg_field->fieldnr= i+1; //Set field number reg_field->field_index= i; reg_field->comment=comment; if (field_type == FIELD_TYPE_BIT && !f_bit_as_char(pack_flag)) @@ -725,12 +875,15 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, } if (f_no_default(pack_flag)) reg_field->flags|= NO_DEFAULT_VALUE_FLAG; + if (reg_field->unireg_check == Field::NEXT_NUMBER) - outparam->found_next_number_field= reg_field; - if (outparam->timestamp_field == reg_field) + share->found_next_number_field= field_ptr; + if (share->timestamp_field == reg_field) share->timestamp_field_offset= i; + if (use_hash) - (void) my_hash_insert(&share->name_hash,(byte*) field_ptr); // never fail + (void) my_hash_insert(&share->name_hash, + (byte*) field_ptr); // never fail } *field_ptr=0; // End marker @@ -739,17 +892,17 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, { uint primary_key=(uint) (find_type((char*) primary_key_name, &share->keynames, 3) - 1); - uint ha_option=outparam->file->table_flags(); - keyinfo=outparam->key_info; - key_part=keyinfo->key_part; + uint ha_option= handler_file->table_flags(); + keyinfo= share->key_info; + key_part= keyinfo->key_part; for (uint key=0 ; key < share->keys ; key++,keyinfo++) { - uint usable_parts=0; + uint usable_parts= 0; keyinfo->name=(char*) share->keynames.type_names[key]; /* Fix fulltext keys for old .frm files */ - if (outparam->key_info[key].flags & HA_FULLTEXT) - outparam->key_info[key].algorithm= HA_KEY_ALG_FULLTEXT; + if (share->key_info[key].flags & HA_FULLTEXT) + share->key_info[key].algorithm= HA_KEY_ALG_FULLTEXT; if (primary_key >= MAX_KEY && (keyinfo->flags & HA_NOSAME)) { @@ -762,8 +915,8 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, { uint fieldnr= key_part[i].fieldnr; if (!fieldnr || - outparam->field[fieldnr-1]->null_ptr || - outparam->field[fieldnr-1]->key_length() != + share->field[fieldnr-1]->null_ptr || + share->field[fieldnr-1]->key_length() != key_part[i].length) { primary_key=MAX_KEY; // Can't be used @@ -774,129 +927,123 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, for (i=0 ; i < keyinfo->key_parts ; key_part++,i++) { + Field *field; if (new_field_pack_flag <= 1) - key_part->fieldnr=(uint16) find_field(outparam, - (uint) key_part->offset, - (uint) key_part->length); -#ifdef EXTRA_DEBUG - if (key_part->fieldnr > share->fields) - goto err; // sanity check -#endif - if (key_part->fieldnr) - { // Should always be true ! - Field *field=key_part->field=outparam->field[key_part->fieldnr-1]; - if (field->null_ptr) - { - key_part->null_offset=(uint) ((byte*) field->null_ptr - - outparam->record[0]); - key_part->null_bit= field->null_bit; - key_part->store_length+=HA_KEY_NULL_LENGTH; - keyinfo->flags|=HA_NULL_PART_KEY; - keyinfo->extra_length+= HA_KEY_NULL_LENGTH; - keyinfo->key_length+= HA_KEY_NULL_LENGTH; - } - if (field->type() == FIELD_TYPE_BLOB || - field->real_type() == MYSQL_TYPE_VARCHAR) - { - if (field->type() == FIELD_TYPE_BLOB) - key_part->key_part_flag|= HA_BLOB_PART; - else - key_part->key_part_flag|= HA_VAR_LENGTH_PART; - keyinfo->extra_length+=HA_KEY_BLOB_LENGTH; - key_part->store_length+=HA_KEY_BLOB_LENGTH; - keyinfo->key_length+= HA_KEY_BLOB_LENGTH; - /* - Mark that there may be many matching values for one key - combination ('a', 'a ', 'a '...) - */ - if (!(field->flags & BINARY_FLAG)) - keyinfo->flags|= HA_END_SPACE_KEY; - } - if (field->type() == MYSQL_TYPE_BIT) - key_part->key_part_flag|= HA_BIT_PART; + key_part->fieldnr= (uint16) find_field(share->field, + (uint) key_part->offset, + (uint) key_part->length); + if (!key_part->fieldnr) + { + error= 4; // Wrong file + goto err; + } + field= key_part->field= share->field[key_part->fieldnr-1]; + if (field->null_ptr) + { + key_part->null_offset=(uint) ((byte*) field->null_ptr - + share->default_values); + key_part->null_bit= field->null_bit; + key_part->store_length+=HA_KEY_NULL_LENGTH; + keyinfo->flags|=HA_NULL_PART_KEY; + keyinfo->extra_length+= HA_KEY_NULL_LENGTH; + keyinfo->key_length+= HA_KEY_NULL_LENGTH; + } + if (field->type() == FIELD_TYPE_BLOB || + field->real_type() == MYSQL_TYPE_VARCHAR) + { + if (field->type() == FIELD_TYPE_BLOB) + key_part->key_part_flag|= HA_BLOB_PART; + else + key_part->key_part_flag|= HA_VAR_LENGTH_PART; + keyinfo->extra_length+=HA_KEY_BLOB_LENGTH; + key_part->store_length+=HA_KEY_BLOB_LENGTH; + keyinfo->key_length+= HA_KEY_BLOB_LENGTH; + /* + Mark that there may be many matching values for one key + combination ('a', 'a ', 'a '...) + */ + if (!(field->flags & BINARY_FLAG)) + keyinfo->flags|= HA_END_SPACE_KEY; + } + if (field->type() == MYSQL_TYPE_BIT) + key_part->key_part_flag|= HA_BIT_PART; - if (i == 0 && key != primary_key) - field->flags |= ((keyinfo->flags & HA_NOSAME) && - (keyinfo->key_parts == 1)) ? - UNIQUE_KEY_FLAG : MULTIPLE_KEY_FLAG; - if (i == 0) - field->key_start.set_bit(key); - if (field->key_length() == key_part->length && - !(field->flags & BLOB_FLAG)) - { - if (outparam->file->index_flags(key, i, 0) & HA_KEYREAD_ONLY) - { - share->keys_for_keyread.set_bit(key); - field->part_of_key.set_bit(key); - } - if (outparam->file->index_flags(key, i, 1) & HA_READ_ORDER) - field->part_of_sortkey.set_bit(key); - } - if (!(key_part->key_part_flag & HA_REVERSE_SORT) && - usable_parts == i) - usable_parts++; // For FILESORT - field->flags|= PART_KEY_FLAG; - if (key == primary_key) - { - field->flags|= PRI_KEY_FLAG; - /* - If this field is part of the primary key and all keys contains - the primary key, then we can use any key to find this column - */ - if (ha_option & HA_PRIMARY_KEY_IN_READ_INDEX) - field->part_of_key= share->keys_in_use; - } - if (field->key_length() != key_part->length) - { + if (i == 0 && key != primary_key) + field->flags |= (((keyinfo->flags & HA_NOSAME) && + (keyinfo->key_parts == 1)) ? + UNIQUE_KEY_FLAG : MULTIPLE_KEY_FLAG); + if (i == 0) + field->key_start.set_bit(key); + if (field->key_length() == key_part->length && + !(field->flags & BLOB_FLAG)) + { + if (handler_file->index_flags(key, i, 0) & HA_KEYREAD_ONLY) + { + share->keys_for_keyread.set_bit(key); + field->part_of_key.set_bit(key); + } + if (handler_file->index_flags(key, i, 1) & HA_READ_ORDER) + field->part_of_sortkey.set_bit(key); + } + if (!(key_part->key_part_flag & HA_REVERSE_SORT) && + usable_parts == i) + usable_parts++; // For FILESORT + field->flags|= PART_KEY_FLAG; + if (key == primary_key) + { + field->flags|= PRI_KEY_FLAG; + /* + If this field is part of the primary key and all keys contains + the primary key, then we can use any key to find this column + */ + if (ha_option & HA_PRIMARY_KEY_IN_READ_INDEX) + field->part_of_key= share->keys_in_use; + } + if (field->key_length() != key_part->length) + { #ifndef TO_BE_DELETED_ON_PRODUCTION - if (field->type() == FIELD_TYPE_NEWDECIMAL) - { - /* - Fix a fatal error in decimal key handling that causes crashes - on Innodb. We fix it by reducing the key length so that - InnoDB never gets a too big key when searching. - This allows the end user to do an ALTER TABLE to fix the - error. - */ - keyinfo->key_length-= (key_part->length - field->key_length()); - key_part->store_length-= (uint16)(key_part->length - - field->key_length()); - key_part->length= (uint16)field->key_length(); - sql_print_error("Found wrong key definition in %s; Please do \"ALTER TABLE '%s' FORCE \" to fix it!", name, share->table_name); - push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, - ER_CRASHED_ON_USAGE, - "Found wrong key definition in %s; Please do \"ALTER TABLE '%s' FORCE\" to fix it!", name, share->table_name); - - share->crashed= 1; // Marker for CHECK TABLE - goto to_be_deleted; - } + if (field->type() == FIELD_TYPE_NEWDECIMAL) + { + /* + Fix a fatal error in decimal key handling that causes crashes + on Innodb. We fix it by reducing the key length so that + InnoDB never gets a too big key when searching. + This allows the end user to do an ALTER TABLE to fix the + error. + */ + keyinfo->key_length-= (key_part->length - field->key_length()); + key_part->store_length-= (uint16)(key_part->length - + field->key_length()); + key_part->length= (uint16)field->key_length(); + sql_print_error("Found wrong key definition in %s; " + "Please do \"ALTER TABLE '%s' FORCE \" to fix it!", + share->table_name.str, + share->table_name.str); + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, + ER_CRASHED_ON_USAGE, + "Found wrong key definition in %s; " + "Please do \"ALTER TABLE '%s' FORCE\" to fix " + "it!", + share->table_name.str, + share->table_name.str); + share->crashed= 1; // Marker for CHECK TABLE + goto to_be_deleted; + } #endif - key_part->key_part_flag|= HA_PART_KEY_SEG; - if (!(field->flags & BLOB_FLAG)) - { // Create a new field - field=key_part->field=field->new_field(&outparam->mem_root, - outparam); - field->field_length=key_part->length; - } - } + key_part->key_part_flag|= HA_PART_KEY_SEG; + } to_be_deleted: - /* - If the field can be NULL, don't optimize away the test - key_part_column = expression from the WHERE clause - as we need to test for NULL = NULL. - */ - if (field->real_maybe_null()) - key_part->key_part_flag|= HA_PART_KEY_SEG; - } - else - { // Error: shorten key - keyinfo->key_parts=usable_parts; - keyinfo->flags=0; - } + /* + If the field can be NULL, don't optimize away the test + key_part_column = expression from the WHERE clause + as we need to test for NULL = NULL. + */ + if (field->real_maybe_null()) + key_part->key_part_flag|= HA_PART_KEY_SEG; } - keyinfo->usable_key_parts=usable_parts; // Filesort + keyinfo->usable_key_parts= usable_parts; // Filesort set_if_bigger(share->max_key_length,keyinfo->key_length+ keyinfo->key_parts); @@ -917,11 +1064,15 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, If we are using an integer as the primary key then allow the user to refer to it as '_rowid' */ - if (outparam->key_info[primary_key].key_parts == 1) + if (share->key_info[primary_key].key_parts == 1) { - Field *field= outparam->key_info[primary_key].key_part[0].field; + Field *field= share->key_info[primary_key].key_part[0].field; if (field && field->result_type() == INT_RESULT) - outparam->rowid_field=field; + { + /* note that fieldnr here (and rowid_field_offset) starts from 1 */ + share->rowid_field_offset= (share->key_info[primary_key].key_part[0]. + fieldnr); + } } } else @@ -935,21 +1086,30 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, { /* Old file format with default as not null */ uint null_length= (share->null_fields+7)/8; - bfill(share->default_values + (outparam->null_flags - (uchar*) record), + bfill(share->default_values + (null_flags - (uchar*) record), null_length, 255); } - if ((reg_field=outparam->found_next_number_field)) + if (share->found_next_number_field) { + /* + We must have a table object for find_ref_key to calculate field offset + */ + TABLE tmp_table; + tmp_table.record[0]= share->default_values; + + reg_field= *share->found_next_number_field; + reg_field->table= &tmp_table; if ((int) (share->next_number_index= (uint) - find_ref_key(outparam,reg_field, + find_ref_key(share->key_info, share->keys, reg_field, &share->next_number_key_offset)) < 0) { - reg_field->unireg_check=Field::NONE; /* purecov: inspected */ - outparam->found_next_number_field=0; + reg_field->unireg_check= Field::NONE; /* purecov: inspected */ + share->found_next_number_field= 0; } else - reg_field->flags|=AUTO_INCREMENT_FLAG; + reg_field->flags |= AUTO_INCREMENT_FLAG; + reg_field->table= 0; } if (share->blob_fields) @@ -959,42 +1119,246 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, /* Store offsets to blob fields to find them fast */ if (!(share->blob_field= save= - (uint*) alloc_root(&outparam->mem_root, + (uint*) alloc_root(&share->mem_root, (uint) (share->blob_fields* sizeof(uint))))) goto err; - for (i=0, ptr= outparam->field ; *ptr ; ptr++, i++) + for (i=0, ptr= share->field ; *ptr ; ptr++, i++) { if ((*ptr)->flags & BLOB_FLAG) (*save++)= i; } } - if (outparam->file->ha_allocate_read_write_set(share->fields)) - goto err; - - /* Fix the partition functions and ensure they are not constant functions*/ - if (part_info_len > 0) -#ifdef WITH_PARTITION_STORAGE_ENGINE - if (fix_partition_func(thd,name,outparam)) -#endif - goto err; - /* the correct null_bytes can now be set, since bitfields have been taken into account */ - share->null_bytes= (null_pos - (uchar*) outparam->null_flags + + share->null_bytes= (null_pos - (uchar*) null_flags + (null_bit_pos + 7) / 8); share->last_null_bit_pos= null_bit_pos; + share->db_low_byte_first= handler_file->low_byte_first(); + delete handler_file; +#ifndef DBUG_OFF + if (use_hash) + (void) hash_check(&share->name_hash); +#endif + DBUG_RETURN (0); + + err: + share->error= error; + share->open_errno= my_errno; + share->errarg= errarg; + x_free((gptr) disk_buff); + delete crypted; + delete handler_file; + hash_free(&share->name_hash); + + open_table_error(share, error, share->open_errno, errarg); + DBUG_RETURN(error); +} /* open_binary_frm */ + + +/* + Open a table based on a TABLE_SHARE + + SYNOPSIS + open_table_from_share() + thd Thread handler + share Table definition + alias Alias for table + db_stat open flags (for example HA_OPEN_KEYFILE| + HA_OPEN_RNDFILE..) can be 0 (example in + ha_example_table) + prgflag READ_ALL etc.. + ha_open_flags HA_OPEN_ABORT_IF_LOCKED etc.. + outparam result table + + RETURN VALUES + 0 ok + 1 Error (see open_table_error) + 2 Error (see open_table_error) + 3 Wrong data in .frm file + 4 Error (see open_table_error) + 5 Error (see open_table_error: charset unavailable) + 7 Table definition has changed in engine +*/ + +int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias, + uint db_stat, uint prgflag, uint ha_open_flags, + TABLE *outparam) +{ + int error; + uint records, i; + bool error_reported= FALSE; + byte *record; + Field **field_ptr; + MEM_ROOT **root_ptr, *old_root; + DBUG_ENTER("open_table_from_share"); + DBUG_PRINT("enter",("name: '%s.%s' form: 0x%lx", share->db.str, + share->table_name.str, outparam)); + + error= 1; + root_ptr= my_pthread_getspecific_ptr(MEM_ROOT**, THR_MALLOC); + old_root= *root_ptr; + bzero((char*) outparam, sizeof(*outparam)); + outparam->in_use= thd; + outparam->s= share; + outparam->db_stat= db_stat; + + init_sql_alloc(&outparam->mem_root, TABLE_ALLOC_BLOCK_SIZE, 0); + *root_ptr= &outparam->mem_root; + + if (!(outparam->alias= my_strdup(alias, MYF(MY_WME)))) + goto err; + outparam->quick_keys.init(); + outparam->used_keys.init(); + outparam->keys_in_use_for_query.init(); + + /* Allocate handler */ + if (!(outparam->file= get_new_handler(share, &outparam->mem_root, + share->db_type))) + goto err; + + error= 4; + outparam->reginfo.lock_type= TL_UNLOCK; + outparam->current_lock= F_UNLCK; + records=0; + if ((db_stat & HA_OPEN_KEYFILE) || (prgflag & DELAYED_OPEN)) + records=1; + if (prgflag & (READ_ALL+EXTRA_RECORD)) + records++; + + if (!(record= (byte*) alloc_root(&outparam->mem_root, + share->rec_buff_length * records))) + goto err; /* purecov: inspected */ + + if (records == 0) + { + /* We are probably in hard repair, and the buffers should not be used */ + outparam->record[0]= outparam->record[1]= share->default_values; + } + else + { + outparam->record[0]= record; + if (records > 1) + outparam->record[1]= record+ share->rec_buff_length; + else + outparam->record[1]= outparam->record[0]; // Safety + } + +#ifdef HAVE_purify + /* + We need this because when we read var-length rows, we are not updating + bytes after end of varchar + */ + if (records > 1) + { + memcpy(outparam->record[0], share->default_values, share->rec_buff_length); + if (records > 2) + memcpy(outparam->record[1], share->default_values, + share->rec_buff_length); + } +#endif + + if (!(field_ptr = (Field **) alloc_root(&outparam->mem_root, + (uint) ((share->fields+1)* + sizeof(Field*))))) + goto err; /* purecov: inspected */ + + outparam->field= field_ptr; + + record= (byte*) outparam->record[0]-1; /* Fieldstart = 1 */ + if (share->null_field_first) + outparam->null_flags= (uchar*) record+1; + else + outparam->null_flags= (uchar*) (record+ 1+ share->reclength - + share->null_bytes); + + /* Setup copy of fields from share, but use the right alias and record */ + for (i=0 ; i < share->fields; i++, field_ptr++) + { + if (!((*field_ptr)= share->field[i]->clone(&outparam->mem_root, outparam))) + goto err; + } + (*field_ptr)= 0; // End marker + + if (share->found_next_number_field) + outparam->found_next_number_field= + outparam->field[(uint) (share->found_next_number_field - share->field)]; + if (share->timestamp_field) + outparam->timestamp_field= (Field_timestamp*) outparam->field[share->timestamp_field_offset]; + + + /* Fix key->name and key_part->field */ + if (share->key_parts) + { + KEY *key_info, *key_info_end; + KEY_PART_INFO *key_part; + uint n_length; + n_length= share->keys*sizeof(KEY) + share->key_parts*sizeof(KEY_PART_INFO); + if (!(key_info= (KEY*) alloc_root(&outparam->mem_root, n_length))) + goto err; + outparam->key_info= key_info; + key_part= (my_reinterpret_cast(KEY_PART_INFO*) (key_info+share->keys)); + + memcpy(key_info, share->key_info, sizeof(*key_info)*share->keys); + memcpy(key_part, share->key_info[0].key_part, (sizeof(*key_part) * + share->key_parts)); + + for (key_info_end= key_info + share->keys ; + key_info < key_info_end ; + key_info++) + { + KEY_PART_INFO *key_part_end; + + key_info->table= outparam; + key_info->key_part= key_part; + + for (key_part_end= key_part+ key_info->key_parts ; + key_part < key_part_end ; + key_part++) + { + Field *field= key_part->field= outparam->field[key_part->fieldnr-1]; + + if (field->key_length() != key_part->length && + !(field->flags & BLOB_FLAG)) + { + /* + We are using only a prefix of the column as a key: + Create a new field for the key part that matches the index + */ + field= key_part->field=field->new_field(&outparam->mem_root, + outparam); + field->field_length= key_part->length; + } + } + } + } + +#ifdef WITH_PARTITION_STORAGE_ENGINE + if (share->partition_info_len) + { + if (mysql_unpack_partition(thd, share->partition_info, + share->partition_info_len, + outparam, share->default_part_db_type)) + goto err; + /* + Fix the partition functions and ensure they are not constant + functions + */ + if (fix_partition_func(thd, share->normalized_path.str, outparam)) + goto err; + } +#endif + /* The table struct is now initialized; Open the table */ - error=2; + error= 2; if (db_stat) { int ha_err; - unpack_filename(index_file,index_file); if ((ha_err= (outparam->file-> - ha_open(index_file, + ha_open(outparam, share->normalized_path.str, (db_stat & HA_READ_ONLY ? O_RDONLY : O_RDWR), (db_stat & HA_OPEN_TEMPORARY ? HA_OPEN_TMP_TABLE : ((db_stat & HA_WAIT_IF_LOCKED) || @@ -1011,8 +1375,10 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, if (ha_err == HA_ERR_NO_SUCH_TABLE) { - /* The table did not exists in storage engine, use same error message - as if the .frm file didn't exist */ + /* + The table did not exists in storage engine, use same error message + as if the .frm file didn't exist + */ error= 1; my_errno= ENOENT; } @@ -1020,49 +1386,36 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, { outparam->file->print_error(ha_err, MYF(0)); error_reported= TRUE; + if (ha_err == HA_ERR_TABLE_DEF_CHANGED) + error= 7; } goto err; /* purecov: inspected */ } } - share->db_low_byte_first= outparam->file->low_byte_first(); *root_ptr= old_root; thd->status_var.opened_tables++; -#ifndef DBUG_OFF - if (use_hash) - (void) hash_check(&share->name_hash); -#endif DBUG_RETURN (0); err: - x_free((gptr) disk_buff); - if (file > 0) - VOID(my_close(file,MYF(MY_WME))); - - delete crypted; *root_ptr= old_root; if (! error_reported) - frm_error(error,outparam,name,ME_ERROR+ME_WAITTANG, errarg); + open_table_error(share, error, my_errno, 0); delete outparam->file; #ifdef WITH_PARTITION_STORAGE_ENGINE - if (outparam->s->part_info) - { - free_items(outparam->s->part_info->item_free_list); - outparam->s->part_info->item_free_list= 0; - } + if (outparam->part_info) + free_items(outparam->part_info->item_free_list); #endif - outparam->file=0; // For easier errorchecking + outparam->file= 0; // For easier error checking outparam->db_stat=0; - hash_free(&share->name_hash); free_root(&outparam->mem_root, MYF(0)); // Safe to call on bzero'd root my_free((char*) outparam->alias, MYF(MY_ALLOW_ZERO_PTR)); DBUG_RETURN (error); -} /* openfrm */ - +} /* close a .frm file and it's tables */ -int closefrm(register TABLE *table) +int closefrm(register TABLE *table, bool free_share) { int error=0; uint idx; @@ -1088,15 +1441,21 @@ int closefrm(register TABLE *table) table->field= 0; } delete table->file; + table->file= 0; /* For easier errorchecking */ #ifdef WITH_PARTITION_STORAGE_ENGINE - if (table->s->part_info) + if (table->part_info) { - free_items(table->s->part_info->item_free_list); - table->s->part_info->item_free_list= 0; + free_items(table->part_info->item_free_list); + table->part_info= 0; } #endif - table->file= 0; /* For easier errorchecking */ - hash_free(&table->s->name_hash); + if (free_share) + { + if (table->s->tmp_table == NO_TMP_TABLE) + release_table_share(table->s, RELEASE_NORMAL); + else + free_table_share(table->s); + } free_root(&table->mem_root, MYF(0)); DBUG_RETURN(error); } @@ -1252,37 +1611,43 @@ ulong make_new_entry(File file, uchar *fileinfo, TYPELIB *formnames, /* error message when opening a form file */ -static void frm_error(int error, TABLE *form, const char *name, - myf errortype, int errarg) +void open_table_error(TABLE_SHARE *share, int error, int db_errno, int errarg) { int err_no; char buff[FN_REFLEN]; - const char *form_dev="",*datext; - const char *real_name= (char*) name+dirname_length(name); - DBUG_ENTER("frm_error"); + myf errortype= ME_ERROR+ME_WAITTANG; + DBUG_ENTER("open_table_error"); switch (error) { + case 7: case 1: - if (my_errno == ENOENT) - { - char *db; - uint length=dirname_part(buff,name); - buff[length-1]=0; - db=buff+dirname_length(buff); - my_error(ER_NO_SUCH_TABLE, MYF(0), db, real_name); - } + if (db_errno == ENOENT) + my_error(ER_NO_SUCH_TABLE, MYF(0), share->db.str, share->table_name.str); else - my_error(ER_FILE_NOT_FOUND, errortype, - fn_format(buff, name, form_dev, reg_ext, 0), my_errno); + { + strxmov(buff, share->normalized_path.str, reg_ext, NullS); + my_error(ER_FILE_NOT_FOUND, errortype, buff, db_errno); + } break; case 2: { - datext= form->file ? *form->file->bas_ext() : ""; - datext= datext==NullS ? "" : datext; - err_no= (my_errno == ENOENT) ? ER_FILE_NOT_FOUND : (my_errno == EAGAIN) ? + handler *file= 0; + const char *datext= ""; + + if (share->db_type != DB_TYPE_UNKNOWN) + { + if ((file= get_new_handler(share, current_thd->mem_root, + share->db_type))) + { + if (!(datext= *file->bas_ext())) + datext= ""; + } + } + err_no= (db_errno == ENOENT) ? ER_FILE_NOT_FOUND : (db_errno == EAGAIN) ? ER_FILE_USED : ER_CANT_OPEN_FILE; - my_error(err_no,errortype, - fn_format(buff,real_name,form_dev,datext,2),my_errno); + strxmov(buff, share->normalized_path.str, datext, NullS); + my_error(err_no,errortype, buff, db_errno); + delete file; break; } case 5: @@ -1296,23 +1661,24 @@ static void frm_error(int error, TABLE *form, const char *name, } my_printf_error(ER_UNKNOWN_COLLATION, "Unknown collation '%s' in table '%-.64s' definition", - MYF(0), csname, real_name); + MYF(0), csname, share->table_name.str); break; } case 6: + strxmov(buff, share->normalized_path.str, reg_ext, NullS); my_printf_error(ER_NOT_FORM_FILE, "Table '%-.64s' was created with a different version " - "of MySQL and cannot be read", - MYF(0), name); + "of MySQL and cannot be read", + MYF(0), buff); break; default: /* Better wrong error than none */ case 4: - my_error(ER_NOT_FORM_FILE, errortype, - fn_format(buff, name, form_dev, reg_ext, 0)); + strxmov(buff, share->normalized_path.str, reg_ext, NullS); + my_error(ER_NOT_FORM_FILE, errortype, buff, 0); break; } DBUG_VOID_RETURN; -} /* frm_error */ +} /* open_table_error */ /* @@ -1355,15 +1721,15 @@ fix_type_pointers(const char ***array, TYPELIB *point_to_type, uint types, } /* fix_type_pointers */ -TYPELIB *typelib(List &strings) +TYPELIB *typelib(MEM_ROOT *mem_root, List &strings) { - TYPELIB *result=(TYPELIB*) sql_alloc(sizeof(TYPELIB)); + TYPELIB *result= (TYPELIB*) alloc_root(mem_root, sizeof(TYPELIB)); if (!result) return 0; result->count=strings.elements; result->name=""; uint nbytes= (sizeof(char*) + sizeof(uint)) * (result->count + 1); - if (!(result->type_names= (const char**) sql_alloc(nbytes))) + if (!(result->type_names= (const char**) alloc_root(mem_root, nbytes))) return 0; result->type_lengths= (uint*) (result->type_names + result->count + 1); List_iterator it(strings); @@ -1392,22 +1758,21 @@ TYPELIB *typelib(List &strings) # field number +1 */ -static uint find_field(TABLE *form,uint start,uint length) +static uint find_field(Field **fields, uint start, uint length) { Field **field; - uint i, pos, fields; + uint i, pos; - pos=0; - fields= form->s->fields; - for (field=form->field, i=1 ; i<= fields ; i++,field++) + pos= 0; + for (field= fields, i=1 ; *field ; i++,field++) { if ((*field)->offset() == start) { if ((*field)->key_length() == length) return (i); - if (!pos || form->field[pos-1]->pack_length() < + if (!pos || fields[pos-1]->pack_length() < (*field)->pack_length()) - pos=i; + pos= i; } } return (pos); @@ -1499,11 +1864,12 @@ void append_unescaped(String *res, const char *pos, uint length) /* Create a .frm file */ -File create_frm(THD *thd, my_string name, const char *db, +File create_frm(THD *thd, const char *name, const char *db, const char *table, uint reclength, uchar *fileinfo, - HA_CREATE_INFO *create_info, uint keys) + HA_CREATE_INFO *create_info, uint keys) { register File file; + uint key_length; ulong length; char fill[IO_SIZE]; int create_flags= O_RDWR | O_TRUNC; @@ -1513,10 +1879,10 @@ File create_frm(THD *thd, my_string name, const char *db, #if SIZEOF_OFF_T > 4 /* Fix this when we have new .frm files; Current limit is 4G rows (QQ) */ - if (create_info->max_rows > ~(ulong) 0) - create_info->max_rows= ~(ulong) 0; - if (create_info->min_rows > ~(ulong) 0) - create_info->min_rows= ~(ulong) 0; + if (create_info->max_rows > UINT_MAX32) + create_info->max_rows= UINT_MAX32; + if (create_info->min_rows > UINT_MAX32) + create_info->min_rows= UINT_MAX32; #endif /* Ensure that raid_chunks can't be larger than 255, as this would cause @@ -2701,7 +3067,7 @@ const char *Natural_join_column::db_name() return table_ref->view_db.str; DBUG_ASSERT(!strcmp(table_ref->db, - table_ref->table->s->db)); + table_ref->table->s->db.str)); return table_ref->db; } @@ -2755,8 +3121,8 @@ Natural_join_column::check_grants(THD *thd, const char *name, uint length) { DBUG_ASSERT(table_field && view_field == NULL); grant= &(table_ref->table->grant); - db_name= table_ref->table->s->db; - table_name= table_ref->table->s->table_name; + db_name= table_ref->table->s->db.str; + table_name= table_ref->table->s->table_name.str; } if (new_sctx) @@ -2951,7 +3317,7 @@ const char *Field_iterator_table_ref::table_name() return natural_join_it.column_ref()->table_name(); DBUG_ASSERT(!strcmp(table_ref->table_name, - table_ref->table->s->table_name)); + table_ref->table->s->table_name.str)); return table_ref->table_name; } @@ -2963,7 +3329,7 @@ const char *Field_iterator_table_ref::db_name() else if (table_ref->is_natural_join) return natural_join_it.column_ref()->db_name(); - DBUG_ASSERT(!strcmp(table_ref->db, table_ref->table->s->db)); + DBUG_ASSERT(!strcmp(table_ref->db, table_ref->table->s->db.str)); return table_ref->db; } diff --git a/sql/table.h b/sql/table.h index 401144e4687..81c13552a04 100644 --- a/sql/table.h +++ b/sql/table.h @@ -56,8 +56,11 @@ typedef struct st_grant_info ulong orig_want_privilege; } GRANT_INFO; -enum tmp_table_type {NO_TMP_TABLE=0, TMP_TABLE=1, TRANSACTIONAL_TMP_TABLE=2, - SYSTEM_TMP_TABLE=3}; +enum tmp_table_type +{ + NO_TMP_TABLE, TMP_TABLE, TRANSACTIONAL_TMP_TABLE, + INTERNAL_TMP_TABLE, SYSTEM_TMP_TABLE +}; enum frm_type_enum { @@ -66,6 +69,8 @@ enum frm_type_enum FRMTYPE_VIEW }; +enum release_type { RELEASE_NORMAL, RELEASE_WAIT_FOR_DROP }; + typedef struct st_filesort_info { IO_CACHE *io_cache; /* If sorted through filebyte */ @@ -107,52 +112,55 @@ class Table_triggers_list; typedef struct st_table_share { -#ifdef WITH_PARTITION_STORAGE_ENGINE - partition_info *part_info; /* Partition related information */ -#endif /* hash of field names (contains pointers to elements of field array) */ HASH name_hash; /* hash of field names */ MEM_ROOT mem_root; TYPELIB keynames; /* Pointers to keynames */ TYPELIB fieldnames; /* Pointer to fieldnames */ TYPELIB *intervals; /* pointer to interval info */ -#ifdef NOT_YET pthread_mutex_t mutex; /* For locking the share */ pthread_cond_t cond; /* To signal that share is ready */ + struct st_table_share *next, /* Link to unused shares */ + **prev; +#ifdef NOT_YET struct st_table *open_tables; /* link to open tables */ - struct st_table *used_next, /* Link to used tables */ - **used_prev; +#endif + /* The following is copied to each TABLE on OPEN */ Field **field; + Field **found_next_number_field; + Field *timestamp_field; /* Used only during open */ KEY *key_info; /* data of keys in database */ -#endif uint *blob_field; /* Index to blobs in Field arrray*/ + byte *default_values; /* row with default values */ char *comment; /* Comment about table */ CHARSET_INFO *table_charset; /* Default charset of string fields */ /* A pair "database_name\0table_name\0", widely used as simply a db name */ - char *table_cache_key; - const char *db; /* Pointer to db */ - const char *table_name; /* Table name (for open) */ - const char *path; /* Path to .frm file (from datadir) */ + LEX_STRING table_cache_key; + LEX_STRING db; /* Pointer to db */ + LEX_STRING table_name; /* Table name (for open) */ + LEX_STRING path; /* Path to .frm file (from datadir) */ + LEX_STRING normalized_path; /* unpack_filename(path) */ LEX_STRING connect_string; key_map keys_in_use; /* Keys in use for table */ key_map keys_for_keyread; + ha_rows min_rows, max_rows; /* create information */ ulong avg_row_length; /* create information */ ulong raid_chunksize; ulong version, flush_version, mysql_version; ulong timestamp_offset; /* Set to offset+1 of record */ ulong reclength; /* Recordlength */ - ha_rows min_rows, max_rows; /* create information */ enum db_type db_type; /* table_type for handler */ enum row_type row_type; /* How rows are stored */ enum tmp_table_type tmp_table; + uint ref_count; /* How many TABLE objects uses this */ + uint open_count; /* Number of tables in open list */ uint blob_ptr_size; /* 4 or 8 */ uint null_bytes, last_null_bit_pos; - uint key_length; /* Length of table_cache_key */ uint fields; /* Number of fields */ uint rec_buff_length; /* Size of table->record[] buffer */ uint keys, key_parts; @@ -160,31 +168,40 @@ typedef struct st_table_share uint uniques; /* Number of UNIQUE index */ uint null_fields; /* number of null fields */ uint blob_fields; /* number of blob fields */ + uint timestamp_field_offset; /* Field number for timestamp field */ uint varchar_fields; /* number of varchar fields */ uint db_create_options; /* Create options from database */ uint db_options_in_use; /* Options in use */ uint db_record_offset; /* if HA_REC_IN_SEQ */ uint raid_type, raid_chunks; - uint open_count; /* Number of tables in open list */ + uint rowid_field_offset; /* Field_nr +1 to rowid field */ /* Index of auto-updated TIMESTAMP field in field array */ uint primary_key; - uint timestamp_field_offset; uint next_number_index; uint next_number_key_offset; - uchar frm_version; - my_bool system; /* Set if system record */ - my_bool crypted; /* If .frm file is crypted */ - my_bool db_low_byte_first; /* Portable row format */ - my_bool crashed; - my_bool is_view; - my_bool name_lock, replace_with_name_lock; + uint error, open_errno, errarg; /* error from open_table_def() */ + uchar frm_version; + bool null_field_first; + bool system; /* Set if system table (one record) */ + bool crypted; /* If .frm file is crypted */ + bool db_low_byte_first; /* Portable row format */ + bool crashed; + bool is_view; + bool name_lock, replace_with_name_lock; + bool waiting_on_cond; /* Protection against free */ + /* TRUE if this is a system table like 'mysql.proc', which we want to be able to open and lock even when we already have some tables open and locked. To avoid deadlocks we have to put certain restrictions on locking of this table for writing. FALSE - otherwise. */ - my_bool system_table; + bool system_table; +#ifdef WITH_PARTITION_STORAGE_ENGINE + const uchar *partition_info; + uint partition_info_len; + enum db_type default_part_db_type; +#endif } TABLE_SHARE; @@ -195,8 +212,8 @@ struct st_table { handler *file; #ifdef NOT_YET struct st_table *used_next, **used_prev; /* Link to used tables */ - struct st_table *open_next, **open_prev; /* Link to open tables */ #endif + struct st_table *open_next, **open_prev; /* Link to open tables */ struct st_table *next, *prev; THD *in_use; /* Which thread uses this */ @@ -207,9 +224,8 @@ struct st_table { key_map quick_keys, used_keys, keys_in_use_for_query; KEY *key_info; /* data of keys in database */ - Field *next_number_field, /* Set if next_number is activated */ - *found_next_number_field, /* Set on open */ - *rowid_field; + Field *next_number_field; /* Set if next_number is activated */ + Field *found_next_number_field; /* Set on open */ Field_timestamp *timestamp_field; /* Table's triggers, 0 if there are no of them */ @@ -279,7 +295,9 @@ struct st_table { MEM_ROOT mem_root; GRANT_INFO grant; FILESORT_INFO sort; - TABLE_SHARE share_not_to_be_used; /* To be deleted when true shares */ +#ifdef WITH_PARTITION_STORAGE_ENGINE + partition_info *part_info; /* Partition related information */ +#endif bool fill_item_list(List *item_list) const; void reset_item_list(List *item_list) const; @@ -624,6 +642,7 @@ typedef struct st_table_list bool where_processed; /* FRMTYPE_ERROR if any type is acceptable */ enum frm_type_enum required_type; + enum db_type db_type; /* table_type for handler */ char timestamp_buffer[20]; /* buffer for timestamp (19+1) */ /* This TABLE_LIST object is just placeholder for prelocking, it will be @@ -802,7 +821,15 @@ typedef struct st_nested_join table_map used_tables; /* bitmap of tables in the nested join */ table_map not_null_tables; /* tables that rejects nulls */ struct st_join_table *first_nested;/* the first nested table in the plan */ - uint counter; /* to count tables in the nested join */ + /* + Used to count tables in the nested join in 2 isolated places: + 1. In make_outerjoin_info(). + 2. check_interleaving_with_nj/restore_prev_nj_state (these are called + by the join optimizer. + Before each use the counters are zeroed by reset_nj_counters. + */ + uint counter; + nested_join_map nj_map; /* Bit used to identify this nested join*/ } NESTED_JOIN; diff --git a/sql/time.cc b/sql/time.cc index 5069031081d..480cafaab34 100644 --- a/sql/time.cc +++ b/sql/time.cc @@ -711,9 +711,15 @@ void make_truncated_value_warning(THD *thd, const char *str_val, type_str, str.c_ptr(), field_name, (ulong) thd->row_count); else - cs->cset->snprintf(cs, warn_buff, sizeof(warn_buff), - ER(ER_TRUNCATED_WRONG_VALUE), - type_str, str.c_ptr()); + { + if (time_type > MYSQL_TIMESTAMP_ERROR) + cs->cset->snprintf(cs, warn_buff, sizeof(warn_buff), + ER(ER_TRUNCATED_WRONG_VALUE), + type_str, str.c_ptr()); + else + cs->cset->snprintf(cs, warn_buff, sizeof(warn_buff), + ER(ER_WRONG_VALUE), type_str, str.c_ptr()); + } push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_TRUNCATED_WRONG_VALUE, warn_buff); } diff --git a/sql/tztime.cc b/sql/tztime.cc index ccef8fe8d7a..eba2f8f4a7b 100644 --- a/sql/tztime.cc +++ b/sql/tztime.cc @@ -1532,6 +1532,7 @@ my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap) */ if (!(thd= new THD)) DBUG_RETURN(1); + thd->thread_stack= (char*) &thd; thd->store_globals(); /* Init all memory structures that require explicit destruction */ @@ -1558,7 +1559,7 @@ my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap) sql_print_error("Fatal error: OOM while initializing time zones"); goto end_with_cleanup; } - tmp_tzname->name.set("SYSTEM", 6, &my_charset_latin1); + tmp_tzname->name.set(STRING_WITH_LEN("SYSTEM"), &my_charset_latin1); tmp_tzname->tz= my_tz_SYSTEM; if (my_hash_insert(&tz_names, (const byte *)tmp_tzname)) { diff --git a/sql/unireg.cc b/sql/unireg.cc index a91be308cce..ebbf1177953 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -55,7 +55,7 @@ static bool make_empty_rec(THD *thd, int file, enum db_type table_type, SYNOPSIS mysql_create_frm() thd Thread handler - file_name Name of file (including database and .frm) + file_name Path for file (including database and .frm) db Name of database table Name of table create_info create info parameters @@ -69,7 +69,7 @@ static bool make_empty_rec(THD *thd, int file, enum db_type table_type, 1 error */ -bool mysql_create_frm(THD *thd, my_string file_name, +bool mysql_create_frm(THD *thd, const char *file_name, const char *db, const char *table, HA_CREATE_INFO *create_info, List &create_fields, @@ -286,37 +286,45 @@ err3: SYNOPSIS rea_create_table() thd Thread handler - file_name Name of file (including database and .frm) - db Name of database - table Name of table + path Name of file (including database and .frm) + db Data base name + table_name Table name create_info create info parameters create_fields Fields to create keys number of keys to create key_info Keys to create - file Handler to use. + file Handler to use + RETURN 0 ok 1 error */ -int rea_create_table(THD *thd, my_string file_name, - const char *db, const char *table, - HA_CREATE_INFO *create_info, - List &create_fields, - uint keys, KEY *key_info, handler *file) +int rea_create_table(THD *thd, const char *path, + const char *db, const char *table_name, + HA_CREATE_INFO *create_info, + List &create_fields, + uint keys, KEY *key_info, handler *file) { + char *ext; DBUG_ENTER("rea_create_table"); - if (mysql_create_frm(thd, file_name, db, table, create_info, + if (mysql_create_frm(thd, path, db, table_name, create_info, create_fields, keys, key_info, file)) DBUG_RETURN(1); - if (file->create_handler_files(file_name)) + if (file->create_handler_files(path)) goto err_handler; - if (!create_info->frm_only && ha_create_table(file_name,create_info,0)) + *(ext= fn_ext(path))= 0; // Remove .frm + if (!create_info->frm_only && ha_create_table(thd, path, db, table_name, + create_info,0)) + { + *ext= FN_EXTCHAR; // Add extension back goto err_handler; + } DBUG_RETURN(0); + err_handler: - my_delete(file_name, MYF(0)); + my_delete(path, MYF(0)); DBUG_RETURN(1); } /* rea_create_table */ @@ -738,18 +746,20 @@ static bool make_empty_rec(THD *thd, File file,enum db_type table_type, ulong data_offset, handler *handler) { - int error; + int error= 0; Field::utype type; uint null_count; uchar *buff,*null_pos; TABLE table; + TABLE_SHARE share; create_field *field; enum_check_fields old_count_cuted_fields= thd->count_cuted_fields; DBUG_ENTER("make_empty_rec"); /* We need a table to generate columns for default values */ - bzero((char*) &table,sizeof(table)); - table.s= &table.share_not_to_be_used; + bzero((char*) &table, sizeof(table)); + bzero((char*) &share, sizeof(share)); + table.s= &share; if (!(buff=(uchar*) my_malloc((uint) reclength,MYF(MY_WME | MY_ZEROFILL)))) { @@ -775,21 +785,24 @@ static bool make_empty_rec(THD *thd, File file,enum db_type table_type, /* regfield don't have to be deleted as it's allocated with sql_alloc() */ - Field *regfield=make_field((char*) buff+field->offset + data_offset, - field->length, - null_pos + null_count / 8, - null_count & 7, - field->pack_flag, - field->sql_type, - field->charset, - field->geom_type, - field->unireg_check, - field->interval, - field->field_name, - &table); + Field *regfield= make_field(&share, + (char*) buff+field->offset + data_offset, + field->length, + null_pos + null_count / 8, + null_count & 7, + field->pack_flag, + field->sql_type, + field->charset, + field->geom_type, + field->unireg_check, + field->interval, + field->field_name); if (!regfield) goto err; // End of memory + /* save_in_field() will access regfield->table->in_use */ + regfield->init(&table); + if (!(field->flags & NOT_NULL_FLAG)) { *regfield->null_ptr|= regfield->null_bit; diff --git a/sql/unireg.h b/sql/unireg.h index d613392f831..f6c4b5f3048 100644 --- a/sql/unireg.h +++ b/sql/unireg.h @@ -46,18 +46,14 @@ #define ERRMAPP 1 /* Errormap f|r my_error */ #define LIBLEN FN_REFLEN-FN_LEN /* Max l{ngd p} dev */ -#define MAX_DBKEY_LENGTH (FN_LEN*2+1+1+4+4) /* extra 4+4 bytes for slave tmp - * tables */ +/* extra 4+4 bytes for slave tmp tables */ +#define MAX_DBKEY_LENGTH (NAME_LEN*2+1+1+4+4) #define MAX_ALIAS_NAME 256 #define MAX_FIELD_NAME 34 /* Max colum name length +2 */ #define MAX_SYS_VAR_LENGTH 32 #define MAX_KEY 64 /* Max used keys */ #define MAX_REF_PARTS 16 /* Max parts used as ref */ -#if SIZEOF_CHARP > 4 -#define MAX_KEY_LENGTH 3072 /* max possible key, if 64 bits */ -#else -#define MAX_KEY_LENGTH 1024 /* max possible key, if 32 bits */ -#endif +#define MAX_KEY_LENGTH 3072 /* max possible key */ #if SIZEOF_OFF_T > 4 #define MAX_REFLENGTH 8 /* Max length for record ref */ #else @@ -154,13 +150,13 @@ #define DONT_GIVE_ERROR 256 /* Don't do frm_error on openfrm */ #define READ_SCREENS 1024 /* Read screens, info and helpfile */ #define DELAYED_OPEN 4096 /* Open table later */ -#define NO_ERR_ON_NEW_FRM 8192 /* stop error sending on new format */ +#define OPEN_VIEW 8192 /* Allow open on view */ #define SC_INFO_LENGTH 4 /* Form format constant */ #define TE_INFO_LENGTH 3 #define MTYP_NOEMPTY_BIT 128 -#define FRM_VER_TRUE_VARCHAR (FRM_VER+4) +#define FRM_VER_TRUE_VARCHAR (FRM_VER+4) /* 10 */ /* Minimum length pattern before Turbo Boyer-Moore is used for SELECT "text" LIKE "%pattern%", excluding the two diff --git a/storage/myisam/ft_parser.c b/storage/myisam/ft_parser.c index f21240bbfd9..fb2ace0fa07 100644 --- a/storage/myisam/ft_parser.c +++ b/storage/myisam/ft_parser.c @@ -160,8 +160,10 @@ byte ft_get_word(CHARSET_INFO *cs, byte **start, byte *end, for (word->pos=doc; docprev='A'; /* be sure *prev is true_word_char */ word->len= (uint)(doc-word->pos) - mwc; @@ -211,8 +213,10 @@ byte ft_simple_get_word(CHARSET_INFO *cs, byte **start, const byte *end, for (word->pos=doc; doclen= (uint)(doc-word->pos) - mwc; diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c index 6296193d6b0..9ce1dff51af 100644 --- a/storage/myisam/mi_check.c +++ b/storage/myisam/mi_check.c @@ -402,7 +402,7 @@ int chk_key(MI_CHECK *param, register MI_INFO *info) full_text_keys++; if (share->state.key_root[key] == HA_OFFSET_ERROR && (info->state->records == 0 || keyinfo->flag & HA_FULLTEXT)) - continue; + goto do_stat; if (!_mi_fetch_keypage(info,keyinfo,share->state.key_root[key], DFLT_INIT_HITS,info->buff,0)) { @@ -498,6 +498,7 @@ int chk_key(MI_CHECK *param, register MI_INFO *info) param->max_level); all_keydata+=param->keydata; all_totaldata+=param->totaldata; key_totlength+=length; +do_stat: if (param->testflag & T_STATISTICS) update_key_parts(keyinfo, rec_per_key_part, param->unique_count, param->stats_method == MI_STATS_METHOD_IGNORE_NULLS? diff --git a/storage/myisam/mi_close.c b/storage/myisam/mi_close.c index 62f5617de1a..39a91371323 100644 --- a/storage/myisam/mi_close.c +++ b/storage/myisam/mi_close.c @@ -96,6 +96,7 @@ int mi_close(register MI_INFO *info) { int i,keys; keys = share->state.header.keys; + VOID(rwlock_destroy(&share->mmap_lock)); for(i=0; ikey_root_lock[i])); } diff --git a/storage/myisam/mi_delete_all.c b/storage/myisam/mi_delete_all.c index a30abb95070..51f1e44d6d2 100644 --- a/storage/myisam/mi_delete_all.c +++ b/storage/myisam/mi_delete_all.c @@ -22,6 +22,7 @@ int mi_delete_all_rows(MI_INFO *info) { uint i; + char buf[22]; MYISAM_SHARE *share=info->s; MI_STATE_INFO *state=&share->state; DBUG_ENTER("mi_delete_all_rows"); @@ -58,6 +59,12 @@ int mi_delete_all_rows(MI_INFO *info) my_chsize(share->kfile, share->base.keystart, 0, MYF(MY_WME)) ) goto err; VOID(_mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE)); +#ifdef HAVE_MMAP + /* Resize mmaped area */ + rw_wrlock(&info->s->mmap_lock); + mi_remap_file(info, (my_off_t)0); + rw_unlock(&info->s->mmap_lock); +#endif allow_break(); /* Allow SIGHUP & SIGINT */ DBUG_RETURN(0); diff --git a/storage/myisam/mi_dynrec.c b/storage/myisam/mi_dynrec.c index 8de500a7351..cdcd7b95ce1 100644 --- a/storage/myisam/mi_dynrec.c +++ b/storage/myisam/mi_dynrec.c @@ -50,6 +50,174 @@ static int _mi_cmp_buffer(File file, const byte *buff, my_off_t filepos, /* Interface function from MI_INFO */ +#ifdef HAVE_MMAP + +/* + Create mmaped area for MyISAM handler + + SYNOPSIS + mi_dynmap_file() + info MyISAM handler + + RETURN + 0 ok + 1 error. +*/ + +my_bool mi_dynmap_file(MI_INFO *info, my_off_t size) +{ + DBUG_ENTER("mi_dynmap_file"); + info->s->file_map= (byte*) + my_mmap(0, (size_t)(size + MEMMAP_EXTRA_MARGIN), + info->s->mode==O_RDONLY ? PROT_READ : + PROT_READ | PROT_WRITE, + MAP_SHARED | MAP_NORESERVE, + info->dfile, 0L); + if (info->s->file_map == (byte*) MAP_FAILED) + { + info->s->file_map= NULL; + DBUG_RETURN(1); + } +#if defined(HAVE_MADVISE) + madvise(info->s->file_map, size, MADV_RANDOM); +#endif + info->s->mmaped_length= size; + DBUG_RETURN(0); +} + + +/* + Resize mmaped area for MyISAM handler + + SYNOPSIS + mi_remap_file() + info MyISAM handler + + RETURN +*/ + +void mi_remap_file(MI_INFO *info, my_off_t size) +{ + if (info->s->file_map) + { + VOID(my_munmap(info->s->file_map, + (size_t) info->s->mmaped_length + MEMMAP_EXTRA_MARGIN)); + mi_dynmap_file(info, size); + } +} +#endif + + +/* + Read bytes from MySAM handler, using mmap or pread + + SYNOPSIS + mi_mmap_pread() + info MyISAM handler + Buffer Input buffer + Count Count of bytes for read + offset Start position + MyFlags + + RETURN + 0 ok +*/ + +uint mi_mmap_pread(MI_INFO *info, byte *Buffer, + uint Count, my_off_t offset, myf MyFlags) +{ + DBUG_PRINT("info", ("mi_read with mmap %d\n", info->dfile)); + if (info->s->concurrent_insert) + rw_rdlock(&info->s->mmap_lock); + + /* + The following test may fail in the following cases: + - We failed to remap a memory area (fragmented memory?) + - This thread has done some writes, but not yet extended the + memory mapped area. + */ + + if (info->s->mmaped_length >= offset + Count) + { + memcpy(Buffer, info->s->file_map + offset, Count); + if (info->s->concurrent_insert) + rw_unlock(&info->s->mmap_lock); + return 0; + } + else + { + if (info->s->concurrent_insert) + rw_unlock(&info->s->mmap_lock); + return my_pread(info->dfile, Buffer, Count, offset, MyFlags); + } +} + + + /* wrapper for my_pread in case if mmap isn't used */ + +uint mi_nommap_pread(MI_INFO *info, byte *Buffer, + uint Count, my_off_t offset, myf MyFlags) +{ + return my_pread(info->dfile, Buffer, Count, offset, MyFlags); +} + + +/* + Write bytes to MySAM handler, using mmap or pwrite + + SYNOPSIS + mi_mmap_pwrite() + info MyISAM handler + Buffer Output buffer + Count Count of bytes for write + offset Start position + MyFlags + + RETURN + 0 ok + !=0 error. In this case return error from pwrite +*/ + +uint mi_mmap_pwrite(MI_INFO *info, byte *Buffer, + uint Count, my_off_t offset, myf MyFlags) +{ + DBUG_PRINT("info", ("mi_write with mmap %d\n", info->dfile)); + if (info->s->concurrent_insert) + rw_rdlock(&info->s->mmap_lock); + + /* + The following test may fail in the following cases: + - We failed to remap a memory area (fragmented memory?) + - This thread has done some writes, but not yet extended the + memory mapped area. + */ + + if (info->s->mmaped_length >= offset + Count) + { + memcpy(info->s->file_map + offset, Buffer, Count); + if (info->s->concurrent_insert) + rw_unlock(&info->s->mmap_lock); + return 0; + } + else + { + if (info->s->concurrent_insert) + rw_unlock(&info->s->mmap_lock); + return my_pwrite(info->dfile, Buffer, Count, offset, MyFlags); + } + +} + + + /* wrapper for my_pwrite in case if mmap isn't used */ + +uint mi_nommap_pwrite(MI_INFO *info, byte *Buffer, + uint Count, my_off_t offset, myf MyFlags) +{ + return my_pwrite(info->dfile, Buffer, Count, offset, MyFlags); +} + + int _mi_write_dynamic_record(MI_INFO *info, const byte *record) { ulong reclength=_mi_rec_pack(info,info->rec_buff,record); @@ -243,7 +411,7 @@ static bool unlink_deleted_block(MI_INFO *info, MI_BLOCK_INFO *block_info) & BLOCK_DELETED)) DBUG_RETURN(1); /* Something is wrong */ mi_sizestore(tmp.header+4,block_info->next_filepos); - if (my_pwrite(info->dfile,(char*) tmp.header+4,8, + if (info->s->file_write(info,(char*) tmp.header+4,8, block_info->prev_filepos+4, MYF(MY_NABP))) DBUG_RETURN(1); /* Unlink block from next block */ @@ -253,7 +421,7 @@ static bool unlink_deleted_block(MI_INFO *info, MI_BLOCK_INFO *block_info) & BLOCK_DELETED)) DBUG_RETURN(1); /* Something is wrong */ mi_sizestore(tmp.header+12,block_info->prev_filepos); - if (my_pwrite(info->dfile,(char*) tmp.header+12,8, + if (info->s->file_write(info,(char*) tmp.header+12,8, block_info->next_filepos+12, MYF(MY_NABP))) DBUG_RETURN(1); @@ -304,7 +472,7 @@ static int update_backward_delete_link(MI_INFO *info, my_off_t delete_block, { char buff[8]; mi_sizestore(buff,filepos); - if (my_pwrite(info->dfile,buff, 8, delete_block+12, MYF(MY_NABP))) + if (info->s->file_write(info,buff, 8, delete_block+12, MYF(MY_NABP))) DBUG_RETURN(1); /* Error on write */ } else @@ -362,7 +530,7 @@ static int delete_dynamic_record(MI_INFO *info, my_off_t filepos, bfill(block_info.header+12,8,255); else mi_sizestore(block_info.header+12,block_info.next_filepos); - if (my_pwrite(info->dfile,(byte*) block_info.header,20,filepos, + if (info->s->file_write(info,(byte*) block_info.header,20,filepos, MYF(MY_NABP))) DBUG_RETURN(1); info->s->state.dellink = filepos; @@ -545,7 +713,7 @@ int _mi_write_part_record(MI_INFO *info, else { info->rec_cache.seek_not_done=1; - if (my_pwrite(info->dfile,(byte*) *record-head_length,length+extra_length+ + if (info->s->file_write(info,(byte*) *record-head_length,length+extra_length+ del_length,filepos,info->s->write_flag)) goto err; } @@ -655,7 +823,7 @@ static int update_dynamic_record(MI_INFO *info, my_off_t filepos, byte *record, mi_int3store(del_block.header+1, rest_length); mi_sizestore(del_block.header+4,info->s->state.dellink); bfill(del_block.header+12,8,255); - if (my_pwrite(info->dfile,(byte*) del_block.header,20, next_pos, + if (info->s->file_write(info,(byte*) del_block.header,20, next_pos, MYF(MY_NABP))) DBUG_RETURN(1); info->s->state.dellink= next_pos; @@ -1182,7 +1350,7 @@ int _mi_read_dynamic_record(MI_INFO *info, my_off_t filepos, byte *buf) } if (left_length < block_info.data_len || ! block_info.data_len) goto panic; /* Wrong linked record */ - if (my_pread(file,(byte*) to,block_info.data_len,block_info.filepos, + if (info->s->file_read(info,(byte*) to,block_info.data_len,block_info.filepos, MYF(MY_NABP))) goto panic; left_length-=block_info.data_len; diff --git a/storage/myisam/mi_extra.c b/storage/myisam/mi_extra.c index 7c0dd13b870..04beb36bb47 100644 --- a/storage/myisam/mi_extra.c +++ b/storage/myisam/mi_extra.c @@ -93,6 +93,8 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg) my_errno=EACCES; break; } + if (info->s->file_map) /* Don't use cache if mmap */ + break; #if defined(HAVE_MMAP) && defined(HAVE_MADVISE) if ((share->options & HA_OPTION_COMPRESS_RECORD)) { @@ -150,6 +152,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg) error=1; /* Not possibly if not locked */ break; } + cache_size= (extra_arg ? *(ulong*) extra_arg : my_default_record_cache_size); if (!(info->opt_flag & @@ -367,6 +370,25 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg) case HA_EXTRA_CHANGE_KEY_TO_DUP: mi_extra_keyflag(info, function); break; + case HA_EXTRA_MMAP: +#ifdef HAVE_MMAP + pthread_mutex_lock(&share->intern_lock); + if (!share->file_map) + { + if (mi_dynmap_file(info, share->state.state.data_file_length)) + { + DBUG_PRINT("warning",("mmap failed: errno: %d",errno)); + error= my_errno= errno; + } + else + { + share->file_read= mi_mmap_pread; + share->file_write= mi_mmap_pwrite; + } + } + pthread_mutex_unlock(&share->intern_lock); +#endif + break; case HA_EXTRA_KEY_CACHE: case HA_EXTRA_NO_KEY_CACHE: default: diff --git a/storage/myisam/mi_locking.c b/storage/myisam/mi_locking.c index 8d48c5242e5..5d871aa1e38 100644 --- a/storage/myisam/mi_locking.c +++ b/storage/myisam/mi_locking.c @@ -38,7 +38,6 @@ int mi_lock_database(MI_INFO *info, int lock_type) share->w_locks, share->global_changed, share->state.open_count, share->index_file_name)); - if (share->options & HA_OPTION_READ_ONLY_DATA || info->lock_type == lock_type) DBUG_RETURN(0); @@ -84,6 +83,14 @@ int mi_lock_database(MI_INFO *info, int lock_type) (uint) share->changed, share->w_locks)); if (share->changed && !share->w_locks) { + if (info->s->mmaped_length != info->s->state.state.data_file_length) + { + if (info->s->concurrent_insert) + rw_wrlock(&info->s->mmap_lock); + mi_remap_file(info, info->s->state.state.data_file_length); + if (info->s->concurrent_insert) + rw_unlock(&info->s->mmap_lock); + } share->state.process= share->last_process=share->this_process; share->state.unique= info->last_unique= info->this_unique; share->state.update_count= info->last_loop= ++info->this_loop; @@ -215,6 +222,7 @@ int mi_lock_database(MI_INFO *info, int lock_type) } } VOID(_mi_test_if_changed(info)); + info->lock_type=lock_type; info->invalidator=info->s->invalidator; share->w_locks++; diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c index 91136bbeef5..a09e4514d63 100644 --- a/storage/myisam/mi_open.c +++ b/storage/myisam/mi_open.c @@ -288,6 +288,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) #ifdef THREAD &share->key_root_lock,sizeof(rw_lock_t)*keys, #endif + &share->mmap_lock,sizeof(rw_lock_t), NullS)) goto err; errpos=4; @@ -459,7 +460,6 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) (keys ? MI_INDEX_BLOCK_MARGIN * share->blocksize * keys : 0)); share->blocksize=min(IO_SIZE,myisam_block_size); - share->data_file_type=STATIC_RECORD; if (share->options & HA_OPTION_COMPRESS_RECORD) { @@ -482,6 +482,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) VOID(pthread_mutex_init(&share->intern_lock,MY_MUTEX_INIT_FAST)); for (i=0; ikey_root_lock[i], NULL)); + VOID(my_rwlock_init(&share->mmap_lock, NULL)); if (!thr_lock_inited) { /* Probably a single threaded program; Don't use concurrent inserts */ @@ -736,6 +737,8 @@ void mi_setup_functions(register MYISAM_SHARE *share) share->compare_unique=_mi_cmp_static_unique; share->calc_checksum= mi_static_checksum; } + share->file_read= mi_nommap_pread; + share->file_write= mi_nommap_pwrite; if (!(share->options & HA_OPTION_CHECKSUM)) share->calc_checksum=0; return; diff --git a/storage/myisam/mi_packrec.c b/storage/myisam/mi_packrec.c index e242e9d506d..6a1fca9ede9 100644 --- a/storage/myisam/mi_packrec.c +++ b/storage/myisam/mi_packrec.c @@ -1192,34 +1192,25 @@ my_bool _mi_memmap_file(MI_INFO *info) if (!info->s->file_map) { if (my_seek(info->dfile,0L,MY_SEEK_END,MYF(0)) < - share->state.state.data_file_length+MEMMAP_EXTRA_MARGIN) + share->state.state.data_file_length+MEMMAP_EXTRA_MARGIN) { DBUG_PRINT("warning",("File isn't extended for memmap")); DBUG_RETURN(0); } - file_map=(byte*) - my_mmap(0,(size_t)(share->state.state.data_file_length+MEMMAP_EXTRA_MARGIN),PROT_READ, - MAP_SHARED | MAP_NORESERVE,info->dfile,0L); - if (file_map == (byte*) MAP_FAILED) - { - DBUG_PRINT("warning",("mmap failed: errno: %d",errno)); - my_errno=errno; + if (mi_dynmap_file(info, share->state.state.data_file_length)) DBUG_RETURN(0); - } - info->s->file_map=file_map; } info->opt_flag|= MEMMAP_USED; - info->read_record=share->read_record=_mi_read_mempack_record; - share->read_rnd=_mi_read_rnd_mempack_record; + info->read_record= share->read_record= _mi_read_mempack_record; + share->read_rnd= _mi_read_rnd_mempack_record; DBUG_RETURN(1); } void _mi_unmap_file(MI_INFO *info) { - VOID(my_munmap(info->s->file_map, - (size_t) info->s->state.state.data_file_length+ - MEMMAP_EXTRA_MARGIN)); + VOID(my_munmap(info->s->file_map, + (size_t) info->s->mmaped_length + MEMMAP_EXTRA_MARGIN)); } diff --git a/storage/myisam/mi_statrec.c b/storage/myisam/mi_statrec.c index 42352f63c66..70e63ef8ce1 100644 --- a/storage/myisam/mi_statrec.c +++ b/storage/myisam/mi_statrec.c @@ -22,20 +22,19 @@ int _mi_write_static_record(MI_INFO *info, const byte *record) { uchar temp[8]; /* max pointer length */ - if (info->s->state.dellink != HA_OFFSET_ERROR && !info->append_insert_at_end) { my_off_t filepos=info->s->state.dellink; info->rec_cache.seek_not_done=1; /* We have done a seek */ - if (my_pread(info->dfile,(char*) &temp[0],info->s->base.rec_reflength, + if (info->s->file_read(info,(char*) &temp[0],info->s->base.rec_reflength, info->s->state.dellink+1, MYF(MY_NABP))) goto err; info->s->state.dellink= _mi_rec_pos(info->s,temp); info->state->del--; info->state->empty-=info->s->base.pack_reclength; - if (my_pwrite(info->dfile, (char*) record, info->s->base.reclength, + if (info->s->file_write(info, (char*) record, info->s->base.reclength, filepos, MYF(MY_NABP))) goto err; @@ -64,19 +63,19 @@ int _mi_write_static_record(MI_INFO *info, const byte *record) else { info->rec_cache.seek_not_done=1; /* We have done a seek */ - if (my_pwrite(info->dfile,(char*) record,info->s->base.reclength, + if (info->s->file_write(info,(char*) record,info->s->base.reclength, info->state->data_file_length, info->s->write_flag)) - goto err; + goto err; if (info->s->base.pack_reclength != info->s->base.reclength) { uint length=info->s->base.pack_reclength - info->s->base.reclength; bzero((char*) temp,length); - if (my_pwrite(info->dfile, (byte*) temp,length, + if (info->s->file_write(info, (byte*) temp,length, info->state->data_file_length+ info->s->base.reclength, info->s->write_flag)) - goto err; + goto err; } } info->state->data_file_length+=info->s->base.pack_reclength; @@ -90,7 +89,7 @@ int _mi_write_static_record(MI_INFO *info, const byte *record) int _mi_update_static_record(MI_INFO *info, my_off_t pos, const byte *record) { info->rec_cache.seek_not_done=1; /* We have done a seek */ - return (my_pwrite(info->dfile, + return (info->s->file_write(info, (char*) record,info->s->base.reclength, pos, MYF(MY_NABP)) != 0); @@ -107,7 +106,7 @@ int _mi_delete_static_record(MI_INFO *info) _mi_dpointer(info,temp+1,info->s->state.dellink); info->s->state.dellink = info->lastpos; info->rec_cache.seek_not_done=1; - return (my_pwrite(info->dfile,(byte*) temp, 1+info->s->rec_reflength, + return (info->s->file_write(info,(byte*) temp, 1+info->s->rec_reflength, info->lastpos, MYF(MY_NABP)) != 0); } @@ -131,7 +130,7 @@ int _mi_cmp_static_record(register MI_INFO *info, register const byte *old) if ((info->opt_flag & READ_CHECK_USED)) { /* If check isn't disabled */ info->rec_cache.seek_not_done=1; /* We have done a seek */ - if (my_pread(info->dfile, (char*) info->rec_buff, info->s->base.reclength, + if (info->s->file_read(info, (char*) info->rec_buff, info->s->base.reclength, info->lastpos, MYF(MY_NABP))) DBUG_RETURN(-1); @@ -154,7 +153,7 @@ int _mi_cmp_static_unique(MI_INFO *info, MI_UNIQUEDEF *def, DBUG_ENTER("_mi_cmp_static_unique"); info->rec_cache.seek_not_done=1; /* We have done a seek */ - if (my_pread(info->dfile, (char*) info->rec_buff, info->s->base.reclength, + if (info->s->file_read(info, (char*) info->rec_buff, info->s->base.reclength, pos, MYF(MY_NABP))) DBUG_RETURN(-1); DBUG_RETURN(mi_unique_comp(def, record, info->rec_buff, @@ -180,7 +179,7 @@ int _mi_read_static_record(register MI_INFO *info, register my_off_t pos, return(-1); info->rec_cache.seek_not_done=1; /* We have done a seek */ - error=my_pread(info->dfile,(char*) record,info->s->base.reclength, + error=info->s->file_read(info,(char*) record,info->s->base.reclength, pos,MYF(MY_NABP)) != 0; fast_mi_writeinfo(info); if (! error) diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c index b3d95d21eb7..e2c8b446322 100644 --- a/storage/myisam/myisamchk.c +++ b/storage/myisam/myisamchk.c @@ -165,7 +165,7 @@ static struct my_option my_long_options[] = "Analyze distribution of keys. Will make some joins in MySQL faster. You can check the calculated distribution.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #ifdef __NETWARE__ - {"auto-close", OPT_AUTO_CLOSE, "Auto close the screen on exit for Netware.", + {"autoclose", OPT_AUTO_CLOSE, "Auto close the screen on exit for Netware.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif {"block-search", 'b', diff --git a/storage/myisam/myisamdef.h b/storage/myisam/myisamdef.h index 6ccb52aff22..564acb82e69 100644 --- a/storage/myisam/myisamdef.h +++ b/storage/myisam/myisamdef.h @@ -179,6 +179,8 @@ typedef struct st_mi_isam_share { /* Shared between opens */ ha_checksum (*calc_checksum)(struct st_myisam_info*, const byte *); int (*compare_unique)(struct st_myisam_info*, MI_UNIQUEDEF *, const byte *record, my_off_t pos); + uint (*file_read)(MI_INFO *, byte *, uint, my_off_t, myf); + uint (*file_write)(MI_INFO *, byte *, uint, my_off_t, myf); invalidator_by_filename invalidator; /* query cache invalidator */ ulong this_process; /* processid */ ulong last_process; /* For table-change-check */ @@ -207,6 +209,8 @@ typedef struct st_mi_isam_share { /* Shared between opens */ pthread_mutex_t intern_lock; /* Locking for use with _locking */ rw_lock_t *key_root_lock; #endif + my_off_t mmaped_length; + rw_lock_t mmap_lock; } MYISAM_SHARE; @@ -685,6 +689,14 @@ extern void _mi_unmap_file(MI_INFO *info); extern uint save_pack_length(uint version, byte *block_buff, ulong length); extern uint read_pack_length(uint version, const uchar *buf, ulong *length); extern uint calc_pack_length(uint version, ulong length); +extern uint mi_mmap_pread(MI_INFO *info, byte *Buffer, + uint Count, my_off_t offset, myf MyFlags); +extern uint mi_mmap_pwrite(MI_INFO *info, byte *Buffer, + uint Count, my_off_t offset, myf MyFlags); +extern uint mi_nommap_pread(MI_INFO *info, byte *Buffer, + uint Count, my_off_t offset, myf MyFlags); +extern uint mi_nommap_pwrite(MI_INFO *info, byte *Buffer, + uint Count, my_off_t offset, myf MyFlags); uint mi_state_info_write(File file, MI_STATE_INFO *state, uint pWrite); uchar *mi_state_info_read(uchar *ptr, MI_STATE_INFO *state); diff --git a/storage/myisam/myisampack.c b/storage/myisam/myisampack.c index 114e80d8f1a..d691c24e890 100644 --- a/storage/myisam/myisampack.c +++ b/storage/myisam/myisampack.c @@ -254,7 +254,7 @@ enum options_mp {OPT_CHARSETS_DIR_MP=256, OPT_AUTO_CLOSE}; static struct my_option my_long_options[] = { #ifdef __NETWARE__ - {"auto-close", OPT_AUTO_CLOSE, "Auto close the screen on exit for Netware.", + {"autoclose", OPT_AUTO_CLOSE, "Auto close the screen on exit for Netware.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif {"backup", 'b', "Make a backup of the table as table_name.OLD.", diff --git a/storage/ndb/docs/Makefile.am b/storage/ndb/docs/Makefile.am index d10228d419d..d67db4a6392 100644 --- a/storage/ndb/docs/Makefile.am +++ b/storage/ndb/docs/Makefile.am @@ -1,7 +1,7 @@ DOXYDIR = doxygen noinst_HEADERS = $(DOXYDIR)/predoxy.pl $(DOXYDIR)/postdoxy.pl $(DOXYDIR)/Doxyfile.ndbapi $(DOXYDIR)/Doxyfile.mgmapi $(DOXYDIR)/header.ndbapi.tex $(DOXYDIR)/header.mgmapi.tex -all: do-check-html ndbapidoc-html mgmapidoc-html +all-local: do-check-html ndbapidoc-html mgmapidoc-html all-pdf: do-check-pdf ndbapidoc-pdf mgmapidoc-pdf DOXYTMP = .doxytmp diff --git a/storage/ndb/include/kernel/kernel_types.h b/storage/ndb/include/kernel/kernel_types.h index 3c6ba69494e..c43a292ee5b 100644 --- a/storage/ndb/include/kernel/kernel_types.h +++ b/storage/ndb/include/kernel/kernel_types.h @@ -59,7 +59,7 @@ struct Local_key Uint32 ref() const { return (m_page_no << MAX_TUPLES_BITS) | m_page_idx ;} - Local_key& operator= (Uint32 ref) { + Local_key& assref (Uint32 ref) { m_page_no =ref >> MAX_TUPLES_BITS; m_page_idx = ref & MAX_TUPLES_PER_PAGE; return *this; diff --git a/storage/ndb/include/kernel/trigger_definitions.h b/storage/ndb/include/kernel/trigger_definitions.h index 25ec9730c49..a006787dd46 100644 --- a/storage/ndb/include/kernel/trigger_definitions.h +++ b/storage/ndb/include/kernel/trigger_definitions.h @@ -21,14 +21,6 @@ #include "ndb_limits.h" #include -#ifndef MIN -#define MIN(x,y) (((x)<(y))?(x):(y)) -#endif - -#ifndef MAX -#define MAX(x,y) (((x)>(y))?(x):(y)) -#endif - #define ILLEGAL_TRIGGER_ID ((Uint32)(~0)) struct TriggerType { diff --git a/storage/ndb/include/ndb_global.h.in b/storage/ndb/include/ndb_global.h.in index 7d92ae76f83..15406ff4c3c 100644 --- a/storage/ndb/include/ndb_global.h.in +++ b/storage/ndb/include/ndb_global.h.in @@ -137,4 +137,12 @@ extern "C" { #endif /* SCO */ +#ifndef MIN +#define MIN(x,y) (((x)<(y))?(x):(y)) +#endif + +#ifndef MAX +#define MAX(x,y) (((x)>(y))?(x):(y)) +#endif + #endif diff --git a/storage/ndb/src/common/mgmcommon/ConfigRetriever.cpp b/storage/ndb/src/common/mgmcommon/ConfigRetriever.cpp index 1f23bd7543c..3b843b6708b 100644 --- a/storage/ndb/src/common/mgmcommon/ConfigRetriever.cpp +++ b/storage/ndb/src/common/mgmcommon/ConfigRetriever.cpp @@ -342,14 +342,21 @@ ConfigRetriever::setNodeId(Uint32 nodeid) Uint32 ConfigRetriever::allocNodeId(int no_retries, int retry_delay_in_seconds) { + int res; _ownNodeId= 0; if(m_handle != 0) { while (1) { - int res= ndb_mgm_alloc_nodeid(m_handle, m_version, m_node_type); + if(!ndb_mgm_is_connected(m_handle)) + if(!ndb_mgm_connect(m_handle, 0, 0, 0)) + goto next; + + res= ndb_mgm_alloc_nodeid(m_handle, m_version, m_node_type); if(res >= 0) return _ownNodeId= (Uint32)res; + + next: if (no_retries == 0) break; no_retries--; diff --git a/storage/ndb/src/common/portlib/NdbThread.c b/storage/ndb/src/common/portlib/NdbThread.c index d501ea2559a..b91e9c6a5b3 100644 --- a/storage/ndb/src/common/portlib/NdbThread.c +++ b/storage/ndb/src/common/portlib/NdbThread.c @@ -91,13 +91,15 @@ ndb_thread_wrapper(void* _ss){ struct NdbThread* NdbThread_Create(NDB_THREAD_FUNC *p_thread_func, NDB_THREAD_ARG *p_thread_arg, - const NDB_THREAD_STACKSIZE thread_stack_size, + const NDB_THREAD_STACKSIZE _thread_stack_size, const char* p_thread_name, NDB_THREAD_PRIO thread_prio) { struct NdbThread* tmpThread; int result; pthread_attr_t thread_attr; + NDB_THREAD_STACKSIZE thread_stack_size= _thread_stack_size * SIZEOF_CHARP/4; + DBUG_ENTER("NdbThread_Create"); (void)thread_prio; /* remove warning for unused parameter */ @@ -114,11 +116,11 @@ struct NdbThread* NdbThread_Create(NDB_THREAD_FUNC *p_thread_func, strnmov(tmpThread->thread_name,p_thread_name,sizeof(tmpThread->thread_name)); pthread_attr_init(&thread_attr); -#if (SIZEOF_CHARP == 8) - pthread_attr_setstacksize(&thread_attr, 2*thread_stack_size); -#else - pthread_attr_setstacksize(&thread_attr, thread_stack_size); +#ifdef PTHREAD_STACK_MIN + if (thread_stack_size < PTHREAD_STACK_MIN) + thread_stack_size = PTHREAD_STACK_MIN; #endif + pthread_attr_setstacksize(&thread_attr, thread_stack_size); #ifdef USE_PTHREAD_EXTRAS /* Guard stack overflow with a 2k databuffer */ pthread_attr_setguardsize(&thread_attr, 2048); @@ -133,7 +135,11 @@ struct NdbThread* NdbThread_Create(NDB_THREAD_FUNC *p_thread_func, &thread_attr, ndb_thread_wrapper, tmpThread); - assert(result==0); + if (result != 0) + { + NdbMem_Free((char *)tmpThread); + tmpThread = 0; + } pthread_attr_destroy(&thread_attr); DBUG_PRINT("exit",("ret: %lx", tmpThread)); diff --git a/storage/ndb/src/kernel/blocks/backup/Backup.cpp b/storage/ndb/src/kernel/blocks/backup/Backup.cpp index ac74b0aa40f..87b4bdb4a5d 100644 --- a/storage/ndb/src/kernel/blocks/backup/Backup.cpp +++ b/storage/ndb/src/kernel/blocks/backup/Backup.cpp @@ -802,13 +802,17 @@ Backup::checkNodeFail(Signal* signal, pos= &ref->nodeId - signal->getDataPtr(); break; } + case GSN_WAIT_GCP_REQ: + case GSN_DROP_TRIG_REQ: case GSN_CREATE_TRIG_REQ: case GSN_ALTER_TRIG_REQ: - case GSN_WAIT_GCP_REQ: + ptr.p->setErrorCode(AbortBackupOrd::BackupFailureDueToNodeFail); + return; case GSN_UTIL_SEQUENCE_REQ: case GSN_UTIL_LOCK_REQ: - case GSN_DROP_TRIG_REQ: return; + default: + ndbrequire(false); } for(Uint32 i = 0; (i = mask.find(i+1)) != NdbNodeBitmask::NotFound; ) @@ -1820,7 +1824,7 @@ Backup::execBACKUP_FRAGMENT_CONF(Signal* signal) const Uint32 nodeId = refToNode(signal->senderBlockRef()); const Uint32 noOfBytes = conf->noOfBytes; const Uint32 noOfRecords = conf->noOfRecords; - + BackupRecordPtr ptr; c_backupPool.getPtr(ptr, ptrI); @@ -1897,7 +1901,7 @@ Backup::execBACKUP_FRAGMENT_REF(Signal* signal) } } } - ndbrequire(false); + goto err; done: ptr.p->masterData.sendCounter--; @@ -1909,7 +1913,8 @@ done: masterAbort(signal, ptr); return; }//if - + +err: AbortBackupOrd *ord = (AbortBackupOrd*)signal->getDataPtrSend(); ord->backupId = ptr.p->backupId; ord->backupPtr = ptr.i; diff --git a/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp b/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp index 8a60c26b4ef..a9fef297bef 100644 --- a/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp +++ b/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp @@ -250,6 +250,7 @@ class Dbtup: public SimulatedBlock { friend class Suma; public: struct KeyReqStruct; +friend struct KeyReqStruct; // CC typedef bool (Dbtup::* ReadFunction)(Uint32*, KeyReqStruct*, AttributeHeader*, @@ -2345,14 +2346,15 @@ private: //--------------------------------------------------------------- // // Public methods - Uint32* alloc_var_rec(Fragrecord*, Tablerec*, Uint32, Local_key*, Uint32*, - Uint32 base); + Uint32* alloc_var_rec(Fragrecord*const, Tablerec*const, Uint32, Local_key*, + Uint32*, Uint32 base); void free_var_part(Fragrecord*, Tablerec*, Var_part_ref, Uint32 chain); void free_var_part(Fragrecord*, Tablerec*, Local_key*, Var_page*, Uint32 chain); void validate_page(Tablerec*, Var_page* page); - Uint32* alloc_fix_rec(Fragrecord*, Tablerec*, Local_key*, Uint32 *); + Uint32* alloc_fix_rec(Fragrecord*const, Tablerec*const, Local_key*, + Uint32*); void free_fix_rec(Fragrecord*, Tablerec*, Local_key*, Fix_page*); // Private methods diff --git a/storage/ndb/src/kernel/blocks/dbtup/DbtupAbort.cpp b/storage/ndb/src/kernel/blocks/dbtup/DbtupAbort.cpp index 2b1e43f80ec..bb6d171b202 100644 --- a/storage/ndb/src/kernel/blocks/dbtup/DbtupAbort.cpp +++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupAbort.cpp @@ -153,7 +153,7 @@ void Dbtup::execTUP_ABORTREQ(Signal* signal) Ptr vpage; Uint32 ref= * tuple_ptr->get_var_part_ptr(regTabPtr.p); Local_key tmp; - tmp=ref; + tmp.assref(ref); sz= 0; idx= tmp.m_page_idx; diff --git a/storage/ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp b/storage/ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp index b981d4d65c1..6646313eb80 100644 --- a/storage/ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp +++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp @@ -210,7 +210,7 @@ Dbtup::commit_operation(Signal* signal, Uint32 *ref= tuple_ptr->get_var_part_ptr(regTabPtr); memcpy(tuple_ptr, copy, 4*(Tuple_header::HeaderSize+fix_size)); - Local_key tmp; tmp= *ref; + Local_key tmp; tmp.assref(*ref); if(0) printf("%p %d %d (%d bytes) - ref: %x ", tuple_ptr, regOperPtr->m_tuple_location.m_page_no, regOperPtr->m_tuple_location.m_page_idx, diff --git a/storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp b/storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp index 972e6c6e399..ad7acbb0829 100644 --- a/storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp +++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp @@ -976,7 +976,7 @@ Dbtup::disk_page_undo_alloc(Page* page, const Local_key* key, Logfile_client::Change c[1] = {{ &alloc, sizeof(alloc) >> 2 } }; - Uint64 lsn= lsman.add_entry<1>(c); + Uint64 lsn= lsman.add_entry(c, 1); m_pgman.update_lsn(* key, lsn); return lsn; @@ -1005,7 +1005,7 @@ Dbtup::disk_page_undo_update(Page* page, const Local_key* key, ndbassert(4*(3 + sz + 1) == (sizeof(update) + 4*sz - 4)); - Uint64 lsn= lsman.add_entry<3>(c); + Uint64 lsn= lsman.add_entry(c, 3); m_pgman.update_lsn(* key, lsn); return lsn; @@ -1034,7 +1034,7 @@ Dbtup::disk_page_undo_free(Page* page, const Local_key* key, ndbassert(4*(3 + sz + 1) == (sizeof(free) + 4*sz - 4)); - Uint64 lsn= lsman.add_entry<3>(c); + Uint64 lsn= lsman.add_entry(c, 3); m_pgman.update_lsn(* key, lsn); return lsn; diff --git a/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp b/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp index 90054b54c75..62a8d8348f6 100644 --- a/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp +++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp @@ -2811,7 +2811,7 @@ Dbtup::validate_page(Tablerec* regTabPtr, Var_page* p) if(ptr->m_header_bits & Tuple_header::CHAINED_ROW) { assert(len == fix_sz + 1); - Local_key tmp; tmp= *part; + Local_key tmp; tmp.assref(*part); Ptr tmpPage; part= get_ptr(&tmpPage, *(Var_part_ref*)part); len= tmpPage.p->get_entry_len(tmp.m_page_idx); @@ -2896,7 +2896,7 @@ Dbtup::handle_size_change_after_update(KeyReqStruct* req_struct, else { Local_key tmp; - tmp= *org->get_var_part_ptr(regTabPtr); + tmp.assref(*org->get_var_part_ptr(regTabPtr)); idx= tmp.m_page_idx; alloc= pageP->get_entry_len(idx) & ~Var_page::CHAIN; if(!(pageP->get_entry_len(idx) & Var_page::CHAIN)) diff --git a/storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp b/storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp index 037ac101af7..9ccff146d17 100644 --- a/storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp +++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp @@ -604,7 +604,7 @@ Dbtup::undo_createtable_callback(Signal* signal, Uint32 opPtrI, Uint32 unused) Logfile_client::Change c[1] = {{ &create, sizeof(create) >> 2 } }; - Uint64 lsn= lsman.add_entry<1>(c); + Uint64 lsn= lsman.add_entry(c, 1); signal->theData[0] = fragOperPtr.p->lqhPtrFrag; signal->theData[1] = 1; diff --git a/storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp b/storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp index d44400222fb..cd9307321e1 100644 --- a/storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp +++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp @@ -113,22 +113,25 @@ Dbtup::setUpQueryRoutines(Tablerec* const regTabPtr) } if(AttributeDescriptor::getDiskBased(attrDescr)) { - ReadFunction r[] = { - &Dbtup::readDiskBitsNotNULL, - &Dbtup::readDiskBitsNULLable, - &Dbtup::readDiskFixedSizeNotNULL, - &Dbtup::readDiskFixedSizeNULLable, - &Dbtup::readDiskVarSizeNULLable, - &Dbtup::readDiskVarSizeNotNULL - }; - UpdateFunction u[] = { - &Dbtup::updateDiskBitsNotNULL, - &Dbtup::updateDiskBitsNULLable, - &Dbtup::updateDiskFixedSizeNotNULL, - &Dbtup::updateDiskFixedSizeNULLable, - &Dbtup::updateDiskVarSizeNULLable, - &Dbtup::updateDiskVarSizeNotNULL - }; + // array initializer crashes gcc-2.95.3 + ReadFunction r[6]; + { + r[0] = &Dbtup::readDiskBitsNotNULL; + r[1] = &Dbtup::readDiskBitsNULLable; + r[2] = &Dbtup::readDiskFixedSizeNotNULL; + r[3] = &Dbtup::readDiskFixedSizeNULLable; + r[4] = &Dbtup::readDiskVarSizeNULLable; + r[5] = &Dbtup::readDiskVarSizeNotNULL; + } + UpdateFunction u[6]; + { + u[0] = &Dbtup::updateDiskBitsNotNULL; + u[1] = &Dbtup::updateDiskBitsNULLable; + u[2] = &Dbtup::updateDiskFixedSizeNotNULL; + u[3] = &Dbtup::updateDiskFixedSizeNULLable; + u[4] = &Dbtup::updateDiskVarSizeNULLable; + u[5] = &Dbtup::updateDiskVarSizeNotNULL; + } Uint32 a= AttributeDescriptor::getArrayType(attrDescr) == NDB_ARRAYTYPE_FIXED ? 2 : 4; @@ -800,22 +803,37 @@ Dbtup::checkUpdateOfPrimaryKey(KeyReqStruct* req_struct, { Uint32 keyReadBuffer[MAX_KEY_SIZE_IN_WORDS]; Uint32 attributeHeader; - TableDescriptor* attr_descr= req_struct->attr_descr; - AttributeHeader* ahOut= (AttributeHeader*)&attributeHeader; + TableDescriptor* attr_descr = req_struct->attr_descr; + AttributeHeader* ahOut = (AttributeHeader*)&attributeHeader; AttributeHeader ahIn(*updateBuffer); - Uint32 attributeId= ahIn.getAttributeId(); - Uint32 attrDescriptorIndex= attributeId << ZAD_LOG_SIZE; - Uint32 attrDescriptor= attr_descr[attrDescriptorIndex].tabDescr; - Uint32 attributeOffset= attr_descr[attrDescriptorIndex + 1].tabDescr; - ReadFunction f= regTabPtr->readFunctionArray[attributeId]; + Uint32 attributeId = ahIn.getAttributeId(); + Uint32 attrDescriptorIndex = attributeId << ZAD_LOG_SIZE; + Uint32 attrDescriptor = attr_descr[attrDescriptorIndex].tabDescr; + Uint32 attributeOffset = attr_descr[attrDescriptorIndex + 1].tabDescr; + + Uint32 xfrmBuffer[1 + MAX_KEY_SIZE_IN_WORDS * MAX_XFRM_MULTIPLY]; + Uint32 charsetFlag = AttributeOffset::getCharsetFlag(attributeOffset); + if (charsetFlag) { + Uint32 csIndex = AttributeOffset::getCharsetPos(attributeOffset); + CHARSET_INFO* cs = regTabPtr->charsetArray[csIndex]; + Uint32 srcPos = 0; + Uint32 dstPos = 0; + xfrm_attr(attrDescriptor, cs, &updateBuffer[1], srcPos, + &xfrmBuffer[1], dstPos, MAX_KEY_SIZE_IN_WORDS * MAX_XFRM_MULTIPLY); + ahIn.setDataSize(dstPos); + xfrmBuffer[0] = ahIn.m_value; + updateBuffer = xfrmBuffer; + } + + ReadFunction f = regTabPtr->readFunctionArray[attributeId]; AttributeHeader::init(&attributeHeader, attributeId, 0); - req_struct->out_buf_index= 0; - req_struct->max_read= MAX_KEY_SIZE_IN_WORDS; - req_struct->attr_descriptor= attrDescriptor; + req_struct->out_buf_index = 0; + req_struct->max_read = MAX_KEY_SIZE_IN_WORDS; + req_struct->attr_descriptor = attrDescriptor; bool tmp = req_struct->xfrm_flag; - req_struct->xfrm_flag = false; + req_struct->xfrm_flag = true; ndbrequire((this->*f)(&keyReadBuffer[0], req_struct, ahOut, diff --git a/storage/ndb/src/kernel/blocks/dbtup/test_varpage.cpp b/storage/ndb/src/kernel/blocks/dbtup/test_varpage.cpp index 6f3586ddfd2..31811ecfafb 100644 --- a/storage/ndb/src/kernel/blocks/dbtup/test_varpage.cpp +++ b/storage/ndb/src/kernel/blocks/dbtup/test_varpage.cpp @@ -123,3 +123,7 @@ main(void) } template class Vector; + +// hp3750 +struct Signal { Signal(); int foo; }; +Signal::Signal(){} diff --git a/storage/ndb/src/kernel/blocks/lgman.cpp b/storage/ndb/src/kernel/blocks/lgman.cpp index 32a588caf35..66ef87ce4d6 100644 --- a/storage/ndb/src/kernel/blocks/lgman.cpp +++ b/storage/ndb/src/kernel/blocks/lgman.cpp @@ -1882,9 +1882,8 @@ Lgman::free_log_space(Uint32 ref, Uint32 words) return -1; } -template Uint64 -Logfile_client::add_entry(const Change* src) +Logfile_client::add_entry(const Change* src, Uint32 cnt) { Uint32 i, tot= 0; for(i= 0; i(const Change*); -template Uint64 Logfile_client::add_entry<3>(const Change*); - void Lgman::execSTART_RECREQ(Signal* signal) { diff --git a/storage/ndb/src/kernel/blocks/lgman.hpp b/storage/ndb/src/kernel/blocks/lgman.hpp index e89babf1d06..745a1bfa45a 100644 --- a/storage/ndb/src/kernel/blocks/lgman.hpp +++ b/storage/ndb/src/kernel/blocks/lgman.hpp @@ -320,7 +320,7 @@ public: }; Uint64 add_entry(const void*, Uint32 len); - template Uint64 add_entry(const Change*); + Uint64 add_entry(const Change*, Uint32 cnt); Uint64 add_entry(Local_key, void * base, Change*); Uint64 add_entry(Local_key, Uint32 off, Uint32 change); diff --git a/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp b/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp index 89fe83f6bf4..b6ca421064f 100644 --- a/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp +++ b/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp @@ -66,13 +66,13 @@ struct BlockInfo { }; static BlockInfo ALL_BLOCKS[] = { + { NDBFS_REF, 0 , 2000, 2999 }, { DBTC_REF, 1 , 8000, 8035 }, { DBDIH_REF, 1 , 7000, 7173 }, { DBLQH_REF, 1 , 5000, 5030 }, { DBACC_REF, 1 , 3000, 3999 }, { DBTUP_REF, 1 , 4000, 4007 }, { DBDICT_REF, 1 , 6000, 6003 }, - { NDBFS_REF, 0 , 2000, 2999 }, { NDBCNTR_REF, 0 , 1000, 1999 }, { QMGR_REF, 1 , 1, 999 }, { CMVMI_REF, 1 , 9000, 9999 }, diff --git a/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp b/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp index a9cbd558921..75ab83b2e98 100644 --- a/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp +++ b/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp @@ -122,6 +122,8 @@ AsyncFile::doStart() stackSize, (char*)&buf, NDB_THREAD_PRIO_MEAN); + if (theThreadPtr == 0) + ERROR_SET(fatal, NDBD_EXIT_MEMALLOC, "","Could not allocate file system thread"); NdbCondition_Wait(theStartConditionPtr, theStartMutexPtr); @@ -983,7 +985,7 @@ void AsyncFile::createDirectories() char* tmp; const char * name = theFileName.c_str(); const char * base = theFileName.get_base_name(); - while((tmp = strstr(base, DIR_SEPARATOR))) + while((tmp = (char *)strstr(base, DIR_SEPARATOR))) { char t = tmp[0]; tmp[0] = 0; diff --git a/storage/ndb/src/kernel/blocks/pgman.hpp b/storage/ndb/src/kernel/blocks/pgman.hpp index 276cc60ee4c..da59afa5794 100644 --- a/storage/ndb/src/kernel/blocks/pgman.hpp +++ b/storage/ndb/src/kernel/blocks/pgman.hpp @@ -243,6 +243,9 @@ public: private: friend class Page_cache_client; + struct Page_entry; // CC + friend struct Page_entry; + struct Page_request { enum Flags { OP_MASK = 0x000F // 4 bits for TUP operation diff --git a/storage/ndb/src/kernel/blocks/print_file.cpp b/storage/ndb/src/kernel/blocks/print_file.cpp index 2cbf0824831..14b83cccaee 100644 --- a/storage/ndb/src/kernel/blocks/print_file.cpp +++ b/storage/ndb/src/kernel/blocks/print_file.cpp @@ -83,11 +83,11 @@ int main(int argc, char ** argv) } Uint32 sz; - Uint32 i = 0; + Uint32 j = 0; do { buffer.grow(g_page_size); sz = fread(buffer.get_data(), 1, g_page_size, f); - if((* g_print_page)(i++, buffer.get_data(), sz)) + if((* g_print_page)(j++, buffer.get_data(), sz)) break; } while(sz == g_page_size); @@ -368,3 +368,6 @@ print_undo_page(int count, void* ptr, Uint32 sz){ return 0; } + +// hp3750 +Signal::Signal(){} diff --git a/storage/ndb/src/kernel/blocks/restore.hpp b/storage/ndb/src/kernel/blocks/restore.hpp index 5654bcebd0e..12d093b4593 100644 --- a/storage/ndb/src/kernel/blocks/restore.hpp +++ b/storage/ndb/src/kernel/blocks/restore.hpp @@ -72,6 +72,9 @@ public: }; private: + struct File; // CC + friend struct File; + struct File { File() {} diff --git a/storage/ndb/src/kernel/vm/LinearPool.hpp b/storage/ndb/src/kernel/vm/LinearPool.hpp new file mode 100644 index 00000000000..bb95a1e0016 --- /dev/null +++ b/storage/ndb/src/kernel/vm/LinearPool.hpp @@ -0,0 +1,656 @@ +/* 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 LINEAR_POOL_HPP +#define LINEAR_POOL_HPP + +#include +#include "SuperPool.hpp" + +/* + * LinearPool - indexed record pool + * + * LinearPool implements a pool where each record has a 0-based index. + * Any index value (up to 2^32-1) is allowed. Normal efficient usage is + * to assign index values in sequence and to re-use any values which + * have become free. This is default seize/release behaviour. + * + * LinearPool has 2 internal RecordPool instances: + * + * (a) record pool of T (the template argument class) + * (b) record pool of "maps" (array of Uint32) + * + * The maps translate an index into an i-value in (a). Each map has + * a level. Level 0 maps point to i-values. Level N+1 maps point to + * level N maps. There is a unique "root map" at top. + * + * This works exactly like numbers in a given base. Each map has base + * size entries. For implementation convenience the base must be power + * of 2 between 2^1 and 2^15. It is given by its log2 value (1-15). + * + * A position in a map is also called a "digit". + * + * There is a doubly linked list of available maps (some free entries) + * on each level. There is a doubly linked freelist within each map. + * There is also a bitmask of used entries in each map. + * + * Level 0 free entry has space for one record. Level N free entry + * implies space for base^N records. The implied levels are created and + * removed on demand. Empty maps are usually removed. + * + * Default base is 256 (log2 = 8) which requires maximum 4 levels or + * digits (similar to ip address). + * + * TODO + * + * - move most of the inline code to LinearPool.cpp + * - optimize for common case + * - add optimized 2-level implementation (?) + */ + +#include "SuperPool.hpp" + +template +class LinearPool { + typedef SuperPool::PtrI PtrI; + + // Base. + STATIC_CONST( Base = 1 << LogBase ); + + // Digit mask. + STATIC_CONST( DigitMask = Base - 1 ); + + // Max possible levels (0 to max root level). + STATIC_CONST( MaxLevels = (32 + LogBase - 1) / LogBase ); + + // Number of words in map used bit mask. + STATIC_CONST( BitmaskSize = (Base + 31) / 32 ); + + // Map. + struct Map { + Uint32 m_level; + Uint32 m_occup; // number of used entries + Uint32 m_firstfree; // position of first free entry + PtrI m_parent; // parent map + Uint32 m_index; // from root to here + PtrI m_nextavail; + PtrI m_prevavail; + Uint32 m_bitmask[BitmaskSize]; + PtrI m_entry[Base]; + }; + +public: + + // Constructor. + LinearPool(GroupPool& gp); + + // Destructor. + ~LinearPool(); + + // Update pointer ptr.p according to index value ptr.i. + void getPtr(Ptr& ptr); + + // Allocate record from the pool. Reuses free index if possible. + bool seize(Ptr& ptr); + + // Allocate given index. Like seize but returns -1 if in use. + int seize_index(Ptr& ptr, Uint32 index); + + // Return record to the pool. + void release(Ptr& ptr); + + // Return number of used records (may require 1 page scan). + Uint32 count(); + + // Verify (debugging). + void verify(); + +private: + + // Given index find the bottom map. + void get_map(Ptr& map_ptr, Uint32 index); + + // Add new root map and increase level + bool add_root(); + + // Add new non-root map. + bool add_map(Ptr& map_ptr, Ptr parent_ptr, Uint32 digit); + + // Subroutine to initialize map free lists. + void init_free(Ptr map_ptr); + + // Add entry at given free position. + void add_entry(Ptr map_ptr, Uint32 digit, PtrI ptr_i); + + // Remove entry and map if it becomes empty. + void remove_entry(Ptr map_ptr, Uint32 digit); + + // Remove map and all parents which become empty. + void remove_map(Ptr map_ptr); + + // Add map to available list. + void add_avail(Ptr map_ptr); + + // Remove map from available list. + void remove_avail(Ptr map_ptr); + + // Verify available lists + void verify_avail(); + + // Verify map (recursive). + void verify_map(Ptr map_ptr, Uint32 level, Uint32* count); + + RecordPool m_records; + RecordPool m_maps; + Uint32 m_levels; // 0 means empty pool + PtrI m_root; + PtrI m_avail[MaxLevels]; +}; + +template +inline +LinearPool::LinearPool(GroupPool& gp) : + m_records(gp), + m_maps(gp), + m_levels(0), + m_root(RNIL) +{ + Uint32 n; + for (n = 0; n < MaxLevels; n++) + m_avail[n] = RNIL; +} + +template +inline +LinearPool::~LinearPool() +{ +} + +template +inline void +LinearPool::getPtr(Ptr& ptr) +{ + Uint32 index = ptr.i; + // get level 0 map + Ptr map_ptr; + get_map(map_ptr, index); + // get record + Ptr rec_ptr; + Uint32 digit = index & DigitMask; + assert(BitmaskImpl::get(BitmaskSize, map_ptr.p->m_bitmask, digit)); + rec_ptr.i = map_ptr.p->m_entry[digit]; + m_records.getPtr(rec_ptr); + ptr.p = rec_ptr.p; +} + +template +inline bool +LinearPool::seize(Ptr& ptr) +{ + // look for free list on some level + Ptr map_ptr; + map_ptr.i = RNIL; + Uint32 n = 0; + while (n < m_levels) { + if ((map_ptr.i = m_avail[n]) != RNIL) + break; + n++; + } + if (map_ptr.i == RNIL) { + // add new level with available maps + if (! add_root()) + return false; + assert(n < m_levels); + map_ptr.i = m_avail[n]; + } + m_maps.getPtr(map_ptr); + // walk down creating missing levels and using an entry on each + Uint32 digit; + Ptr new_ptr; + new_ptr.i = RNIL; + while (true) { + digit = map_ptr.p->m_firstfree; + if (n == 0) + break; + Ptr child_ptr; + if (! add_map(child_ptr, map_ptr, digit)) { + if (new_ptr.i != RNIL) + remove_map(new_ptr); + return false; + } + new_ptr = child_ptr; + map_ptr = child_ptr; + n--; + } + // now on level 0 + assert(map_ptr.p->m_level == 0); + Ptr rec_ptr; + if (! m_records.seize(rec_ptr)) { + if (new_ptr.i != RNIL) + remove_map(new_ptr); + return false; + } + add_entry(map_ptr, digit, rec_ptr.i); + ptr.i = digit + (map_ptr.p->m_index << LogBase); + ptr.p = rec_ptr.p; + return true; +} + +template +inline int +LinearPool::seize_index(Ptr& ptr, Uint32 index) +{ + // extract all digits at least up to current root level + Uint32 digits[MaxLevels]; + Uint32 n = 0; + Uint32 tmp = index; + do { + digits[n] = tmp & DigitMask; + tmp >>= LogBase; + } while (++n < m_levels || tmp != 0); + // add any new root levels + while (n > m_levels) { + if (! add_root()) + return false; + } + // start from root + Ptr map_ptr; + map_ptr.i = m_root; + m_maps.getPtr(map_ptr); + // walk down creating or re-using existing levels + Uint32 digit; + bool used; + Ptr new_ptr; + new_ptr.i = RNIL; + while (true) { + digit = digits[--n]; + used = BitmaskImpl::get(BitmaskSize, map_ptr.p->m_bitmask, digit); + if (n == 0) + break; + if (used) { + map_ptr.i = map_ptr.p->m_entry[digit]; + m_maps.getPtr(map_ptr); + } else { + Ptr child_ptr; + if (! add_map(child_ptr, map_ptr, digit)) { + if (new_ptr.i != RNIL) + remove_map(new_ptr); + } + new_ptr = child_ptr; + map_ptr = child_ptr; + } + } + // now at level 0 + assert(map_ptr.p->m_level == 0); + Ptr rec_ptr; + if (used || ! m_records.seize(rec_ptr)) { + if (new_ptr.i != RNIL) + remove_map(new_ptr); + return used ? -1 : false; + } + add_entry(map_ptr, digit, rec_ptr.i); + assert(index == digit + (map_ptr.p->m_index << LogBase)); + ptr.i = index; + ptr.p = rec_ptr.p; + return true; +} + +template +inline void +LinearPool::release(Ptr& ptr) +{ + Uint32 index = ptr.i; + // get level 0 map + Ptr map_ptr; + get_map(map_ptr, index); + // release record + Ptr rec_ptr; + Uint32 digit = index & DigitMask; + rec_ptr.i = map_ptr.p->m_entry[digit]; + m_records.release(rec_ptr); + // remove entry + remove_entry(map_ptr, digit); + // null pointer + ptr.i = RNIL; + ptr.p = 0; +} + +template +inline Uint32 +LinearPool::count() +{ + SuperPool& sp = m_records.m_superPool; + Uint32 count1 = sp.getRecUseCount(m_records.m_recInfo); + return count1; +} + +template +inline void +LinearPool::verify() +{ + verify_avail(); + if (m_root == RNIL) { + assert(m_levels == 0); + return; + } + assert(m_levels != 0); + Ptr map_ptr; + map_ptr.i = m_root; + m_maps.getPtr(map_ptr); + Uint32 count1 = count(); + Uint32 count2 = 0; + verify_map(map_ptr, m_levels - 1, &count2); + assert(count1 == count2); +} + +// private methods + +template +inline void +LinearPool::get_map(Ptr& map_ptr, Uint32 index) +{ + // root map must exist + Ptr tmp_ptr; + tmp_ptr.i = m_root; + m_maps.getPtr(tmp_ptr); + assert(tmp_ptr.p->m_level + 1 == m_levels); + // extract index digits up to current root level + Uint32 digits[MaxLevels]; + Uint32 n = 0; + do { + digits[n] = index & DigitMask; + index >>= LogBase; + } while (++n < m_levels); + assert(index == 0); + // walk down indirect levels + while (--n > 0) { + tmp_ptr.i = tmp_ptr.p->m_entry[digits[n]]; + m_maps.getPtr(tmp_ptr); + } + // level 0 map + assert(tmp_ptr.p->m_level == 0); + map_ptr = tmp_ptr; +} + +template +inline bool +LinearPool::add_root() +{ + // new root + Ptr map_ptr; + if (! m_maps.seize(map_ptr)) + return false; + Uint32 n = m_levels++; + assert(n < MaxLevels); + // set up + map_ptr.p->m_level = n; + map_ptr.p->m_parent = RNIL; + map_ptr.p->m_index = 0; + init_free(map_ptr); + // on level > 0 digit 0 points to old root + if (n > 0) { + Ptr old_ptr; + old_ptr.i = m_root; + m_maps.getPtr(old_ptr); + assert(old_ptr.p->m_parent == RNIL); + old_ptr.p->m_parent = map_ptr.i; + add_entry(map_ptr, 0, old_ptr.i); + } + // set new root + m_root = map_ptr.i; + return true; +} + +template +inline bool +LinearPool::add_map(Ptr& map_ptr, Ptr parent_ptr, Uint32 digit) +{ + if (! m_maps.seize(map_ptr)) + return false; + assert(parent_ptr.p->m_level != 0); + // set up + map_ptr.p->m_level = parent_ptr.p->m_level - 1; + map_ptr.p->m_parent = parent_ptr.i; + map_ptr.p->m_index = digit + (parent_ptr.p->m_index << LogBase); + init_free(map_ptr); + add_entry(parent_ptr, digit, map_ptr.i); + return true; +} + +template +inline void +LinearPool::init_free(Ptr map_ptr) +{ + map_ptr.p->m_occup = 0; + map_ptr.p->m_firstfree = 0; + // freelist + Uint32 j; + Uint16 back = ZNIL; + for (j = 0; j < Base - 1; j++) { + map_ptr.p->m_entry[j] = back | ((j + 1) << 16); + back = j; + } + map_ptr.p->m_entry[j] = back | (ZNIL << 16); + // bitmask + BitmaskImpl::clear(BitmaskSize, map_ptr.p->m_bitmask); + // add to available + add_avail(map_ptr); +} + +template +inline void +LinearPool::add_entry(Ptr map_ptr, Uint32 digit, PtrI ptr_i) +{ + assert(map_ptr.p->m_occup < Base && digit < Base); + assert(! BitmaskImpl::get(BitmaskSize, map_ptr.p->m_bitmask, digit)); + // unlink from freelist + Uint32 val = map_ptr.p->m_entry[digit]; + Uint16 back = val & ZNIL; + Uint16 forw = val >> 16; + if (back != ZNIL) { + assert(back < Base); + map_ptr.p->m_entry[back] &= ZNIL; + map_ptr.p->m_entry[back] |= (forw << 16); + } + if (forw != ZNIL) { + assert(forw < Base); + map_ptr.p->m_entry[forw] &= (ZNIL << 16); + map_ptr.p->m_entry[forw] |= back; + } + if (back == ZNIL) { + map_ptr.p->m_firstfree = forw; + } + // set new value + map_ptr.p->m_entry[digit] = ptr_i; + map_ptr.p->m_occup++; + BitmaskImpl::set(BitmaskSize, map_ptr.p->m_bitmask, digit); + if (map_ptr.p->m_occup == Base) + remove_avail(map_ptr); +} + +template +inline void +LinearPool::remove_entry(Ptr map_ptr, Uint32 digit) +{ + assert(map_ptr.p->m_occup != 0 && digit < Base); + assert(BitmaskImpl::get(BitmaskSize, map_ptr.p->m_bitmask, digit)); + // add to freelist + Uint32 firstfree = map_ptr.p->m_firstfree; + map_ptr.p->m_entry[digit] = ZNIL | (firstfree << 16); + if (firstfree != ZNIL) { + assert(firstfree < Base); + map_ptr.p->m_entry[firstfree] &= (ZNIL << 16); + map_ptr.p->m_entry[firstfree] |= digit; + } + map_ptr.p->m_firstfree = digit; + map_ptr.p->m_occup--; + BitmaskImpl::clear(BitmaskSize, map_ptr.p->m_bitmask, digit); + if (map_ptr.p->m_occup + 1 == Base) + add_avail(map_ptr); + else if (map_ptr.p->m_occup == 0) + remove_map(map_ptr); +} + +template +inline void +LinearPool::remove_map(Ptr map_ptr) +{ + assert(map_ptr.p->m_occup == 0); + remove_avail(map_ptr); + Ptr parent_ptr; + parent_ptr.i = map_ptr.p->m_parent; + Uint32 digit = map_ptr.p->m_index & DigitMask; + PtrI map_ptr_i = map_ptr.i; + m_maps.release(map_ptr); + if (m_root == map_ptr_i) { + assert(parent_ptr.i == RNIL); + Uint32 used = count(); + assert(used == 0); + m_root = RNIL; + m_levels = 0; + } + if (parent_ptr.i != RNIL) { + m_maps.getPtr(parent_ptr); + // remove child entry (recursive) + remove_entry(parent_ptr, digit); + } +} + +template +inline void +LinearPool::add_avail(Ptr map_ptr) +{ + Uint32 n = map_ptr.p->m_level; + assert(n < m_levels); + map_ptr.p->m_nextavail = m_avail[n]; + if (map_ptr.p->m_nextavail != RNIL) { + Ptr next_ptr; + next_ptr.i = map_ptr.p->m_nextavail; + m_maps.getPtr(next_ptr); + next_ptr.p->m_prevavail = map_ptr.i; + } + map_ptr.p->m_prevavail = RNIL; + m_avail[n] = map_ptr.i; +} + +template +inline void +LinearPool::remove_avail(Ptr map_ptr) +{ + Uint32 n = map_ptr.p->m_level; + assert(n < m_levels); + if (map_ptr.p->m_nextavail != RNIL) { + Ptr next_ptr; + next_ptr.i = map_ptr.p->m_nextavail; + m_maps.getPtr(next_ptr); + next_ptr.p->m_prevavail = map_ptr.p->m_prevavail; + } + if (map_ptr.p->m_prevavail != RNIL) { + Ptr prev_ptr; + prev_ptr.i = map_ptr.p->m_prevavail; + m_maps.getPtr(prev_ptr); + prev_ptr.p->m_nextavail = map_ptr.p->m_nextavail; + } + if (map_ptr.p->m_prevavail == RNIL) { + m_avail[n] = map_ptr.p->m_nextavail; + } + map_ptr.p->m_nextavail = RNIL; + map_ptr.p->m_prevavail = RNIL; +} + +template +inline void +LinearPool::verify_avail() +{ + // check available lists + for (Uint32 n = 0; n < MaxLevels; n++) { + Ptr map_ptr; + map_ptr.i = m_avail[n]; + Uint32 back = RNIL; + while (map_ptr.i != RNIL) { + m_maps.getPtr(map_ptr); + assert(map_ptr.p->m_occup < Base); + assert(back == map_ptr.p->m_prevavail); + back = map_ptr.i; + map_ptr.i = map_ptr.p->m_nextavail; + } + } +} + +template +inline void +LinearPool::verify_map(Ptr map_ptr, Uint32 level, Uint32* count) +{ + assert(level < MaxLevels); + assert(map_ptr.p->m_level == level); + // check freelist + { + Uint32 nused = BitmaskImpl::count(BitmaskSize, map_ptr.p->m_bitmask); + assert(nused <= Base); + assert(map_ptr.p->m_occup == nused); + Uint32 nfree = 0; + Uint32 j = map_ptr.p->m_firstfree; + Uint16 back = ZNIL; + while (j != ZNIL) { + assert(j < Base); + assert(! BitmaskImpl::get(BitmaskSize, map_ptr.p->m_bitmask, j)); + Uint32 val = map_ptr.p->m_entry[j]; + assert(back == (val & ZNIL)); + back = j; + j = (val >> 16); + nfree++; + } + assert(nused + nfree == Base); + } + // check entries + { + for (Uint32 j = 0; j < Base; j++) { + bool free = ! BitmaskImpl::get(BitmaskSize, map_ptr.p->m_bitmask, j); + if (free) + continue; + if (level != 0) { + Ptr child_ptr; + child_ptr.i = map_ptr.p->m_entry[j]; + m_maps.getPtr(child_ptr); + assert(child_ptr.p->m_parent == map_ptr.i); + assert(child_ptr.p->m_index == j + (map_ptr.p->m_index << LogBase)); + verify_map(child_ptr, level - 1, count); + } else { + Ptr rec_ptr; + rec_ptr.i = map_ptr.p->m_entry[j]; + m_records.getPtr(rec_ptr); + (*count)++; + } + } + } + // check membership on available list + { + Ptr avail_ptr; + avail_ptr.i = m_avail[map_ptr.p->m_level]; + bool found = false; + while (avail_ptr.i != RNIL) { + if (avail_ptr.i == map_ptr.i) { + found = true; + break; + } + m_maps.getPtr(avail_ptr); + avail_ptr.i = avail_ptr.p->m_nextavail; + } + assert(found == (map_ptr.p->m_occup < Base)); + } +} + +#endif diff --git a/storage/ndb/src/kernel/vm/SimulatedBlock.cpp b/storage/ndb/src/kernel/vm/SimulatedBlock.cpp index de310a533db..9d6919482cb 100644 --- a/storage/ndb/src/kernel/vm/SimulatedBlock.cpp +++ b/storage/ndb/src/kernel/vm/SimulatedBlock.cpp @@ -1882,79 +1882,9 @@ SimulatedBlock::xfrm_key(Uint32 tab, const Uint32* src, while (i < noOfKeyAttr) { const KeyDescriptor::KeyAttr& keyAttr = desc->keyAttr[i]; - - Uint32 array = - AttributeDescriptor::getArrayType(keyAttr.attributeDescriptor); - Uint32 srcBytes = - AttributeDescriptor::getSizeInBytes(keyAttr.attributeDescriptor); - - Uint32 srcWords = ~0; - Uint32 dstWords = ~0; - uchar* dstPtr = (uchar*)&dst[dstPos]; - const uchar* srcPtr = (const uchar*)&src[srcPos]; - CHARSET_INFO* cs = keyAttr.charsetInfo; - - if (cs == NULL) - { - jam(); - Uint32 len; - switch(array){ - case NDB_ARRAYTYPE_SHORT_VAR: - len = 1 + srcPtr[0]; - break; - case NDB_ARRAYTYPE_MEDIUM_VAR: - len = 2 + srcPtr[0] + (srcPtr[1] << 8); - break; -#ifndef VM_TRACE - default: -#endif - case NDB_ARRAYTYPE_FIXED: - len = srcBytes; - } - srcWords = (len + 3) >> 2; - dstWords = srcWords; - memcpy(dstPtr, srcPtr, dstWords << 2); - - if (0) - { - ndbout_c("srcPos: %d dstPos: %d len: %d srcWords: %d dstWords: %d", - srcPos, dstPos, len, srcWords, dstWords); - - for(Uint32 i = 0; istrxfrm_multiply; - if (xmul == 0) - xmul = 1; - /* - * Varchar is really Char. End spaces do not matter. To get - * same hash we blank-pad to maximum length via strnxfrm. - * TODO use MySQL charset-aware hash function instead - */ - Uint32 dstLen = xmul * (srcBytes - lb); - ndbrequire(dstLen <= ((dstSize - dstPos) << 2)); - int n = NdbSqlUtil::strnxfrm_bug7284(cs, dstPtr, dstLen, srcPtr + lb, len); - ndbrequire(n != -1); - while ((n & 3) != 0) - { - dstPtr[n++] = 0; - } - dstWords = (n >> 2); - srcWords = (lb + len + 3) >> 2; - } - - dstPos += dstWords; - srcPos += srcWords; + Uint32 dstWords = + xfrm_attr(keyAttr.attributeDescriptor, keyAttr.charsetInfo, + src, srcPos, dst, dstPos, dstSize); keyPartLen[i++] = dstWords; } @@ -1969,6 +1899,84 @@ SimulatedBlock::xfrm_key(Uint32 tab, const Uint32* src, return dstPos; } +Uint32 +SimulatedBlock::xfrm_attr(Uint32 attrDesc, CHARSET_INFO* cs, + const Uint32* src, Uint32 & srcPos, + Uint32* dst, Uint32 & dstPos, Uint32 dstSize) const +{ + Uint32 array = + AttributeDescriptor::getArrayType(attrDesc); + Uint32 srcBytes = + AttributeDescriptor::getSizeInBytes(attrDesc); + + Uint32 srcWords = ~0; + Uint32 dstWords = ~0; + uchar* dstPtr = (uchar*)&dst[dstPos]; + const uchar* srcPtr = (const uchar*)&src[srcPos]; + + if (cs == NULL) + { + jam(); + Uint32 len; + switch(array){ + case NDB_ARRAYTYPE_SHORT_VAR: + len = 1 + srcPtr[0]; + break; + case NDB_ARRAYTYPE_MEDIUM_VAR: + len = 2 + srcPtr[0] + (srcPtr[1] << 8); + break; +#ifndef VM_TRACE + default: +#endif + case NDB_ARRAYTYPE_FIXED: + len = srcBytes; + } + srcWords = (len + 3) >> 2; + dstWords = srcWords; + memcpy(dstPtr, srcPtr, dstWords << 2); + + if (0) + { + ndbout_c("srcPos: %d dstPos: %d len: %d srcWords: %d dstWords: %d", + srcPos, dstPos, len, srcWords, dstWords); + + for(Uint32 i = 0; istrxfrm_multiply; + if (xmul == 0) + xmul = 1; + /* + * Varchar end-spaces are ignored in comparisons. To get same hash + * we blank-pad to maximum length via strnxfrm. + */ + Uint32 dstLen = xmul * (srcBytes - lb); + ndbrequire(dstLen <= ((dstSize - dstPos) << 2)); + int n = NdbSqlUtil::strnxfrm_bug7284(cs, dstPtr, dstLen, srcPtr + lb, len); + ndbrequire(n != -1); + while ((n & 3) != 0) + { + dstPtr[n++] = 0; + } + dstWords = (n >> 2); + srcWords = (lb + len + 3) >> 2; + } + + dstPos += dstWords; + srcPos += srcWords; + return dstWords; +} + Uint32 SimulatedBlock::create_distr_key(Uint32 tableId, Uint32 *data, diff --git a/storage/ndb/src/kernel/vm/SimulatedBlock.hpp b/storage/ndb/src/kernel/vm/SimulatedBlock.hpp index bd4af5fa1ee..3bb134a92cd 100644 --- a/storage/ndb/src/kernel/vm/SimulatedBlock.hpp +++ b/storage/ndb/src/kernel/vm/SimulatedBlock.hpp @@ -402,8 +402,12 @@ protected: * @return length */ Uint32 xfrm_key(Uint32 tab, const Uint32* src, - Uint32 *dst, Uint32 dstLen, + Uint32 *dst, Uint32 dstSize, Uint32 keyPartLen[MAX_ATTRIBUTES_IN_INDEX]) const; + + Uint32 xfrm_attr(Uint32 attrDesc, CHARSET_INFO* cs, + const Uint32* src, Uint32 & srcPos, + Uint32* dst, Uint32 & dstPos, Uint32 dstSize) const; /** * diff --git a/storage/ndb/src/kernel/vm/SuperPool.cpp b/storage/ndb/src/kernel/vm/SuperPool.cpp index 65e5dd99629..c61bfcc3541 100644 --- a/storage/ndb/src/kernel/vm/SuperPool.cpp +++ b/storage/ndb/src/kernel/vm/SuperPool.cpp @@ -17,28 +17,33 @@ #include #include "SuperPool.hpp" +#define SP_ALIGN(sz, al) (((sz) + (al) - 1) & ~((al) - 1)) + +// This is used for m_freeRecI when there is no record pool page. +#define NNIL 0xffffffff + // SuperPool SuperPool::SuperPool(Uint32 pageSize, Uint32 pageBits) : - m_pageSize(SP_ALIGN_SIZE(pageSize, SP_ALIGN)), + m_pageSize(pageSize), m_pageBits(pageBits), + m_recBits(32 - m_pageBits), + m_recMask((1 << m_recBits) - 1), m_memRoot(0), m_pageEnt(0), - m_typeCheck(0), - m_typeSeq(0), - m_pageList(), - m_totalSize(0), - m_initSize(0), - m_incrSize(0), - m_maxSize(0) + m_pageType(0), + m_freeList(), + m_initPages(0), + m_incrPages(0), + m_maxPages(0), + m_totPages(0), + m_typeCount(0), + m_groupMinPct(0), + m_groupMinPages(0), + m_groupTotPages(0) { - assert(5 <= pageBits <= 30); -} - -bool -SuperPool::init() -{ - return true; + assert(m_pageSize != 0 && (m_pageSize & (m_pageSize - 1)) == 0); + assert(m_pageBits <= 30); } SuperPool::~SuperPool() @@ -47,13 +52,15 @@ SuperPool::~SuperPool() SuperPool::PageEnt::PageEnt() : m_pageType(0), - m_freeRecI(RNIL), m_useCount(0), + m_freeRecI(NNIL), m_nextPageI(RNIL), m_prevPageI(RNIL) { } +// page list routines + SuperPool::PageList::PageList() : m_headPageI(RNIL), m_tailPageI(RNIL), @@ -66,55 +73,29 @@ SuperPool::PageList::PageList(PtrI pageI) : m_tailPageI(pageI), m_pageCount(1) { -} - -SuperPool::RecInfo::RecInfo(Uint32 recType, Uint32 recSize) : - m_recType(recType), - m_recSize(recSize), - m_maxUseCount(0), - m_currPageI(RNIL), - m_currFreeRecI(RNIL), - m_currUseCount(0), - m_totalUseCount(0), - m_totalRecCount(0), - m_freeList(), - m_activeList(), - m_fullList() -{ -} - -SuperPool::PtrI -SuperPool::getPageI(void* pageP) -{ - const Uint32 pageSize = m_pageSize; - const Uint32 pageBits = m_pageBits; - const Uint32 recBits = 32 - pageBits; - void* const memRoot = m_memRoot; - assert(pageP == SP_ALIGN_PTR(pageP, memRoot, pageSize)); - my_ptrdiff_t ipL = ((Uint8*)pageP - (Uint8*)memRoot) / pageSize; - Int32 ip = (Int32)ipL; - Int32 lim = 1 << (pageBits - 1); - assert(ip == ipL && -lim <= ip && ip < lim && ip != -1); - PtrI pageI = ip << recBits; - assert(pageP == getPageP(pageI)); - return pageI; + assert(pageI != RNIL); } void SuperPool::movePages(PageList& pl1, PageList& pl2) { - const Uint32 recBits = 32 - m_pageBits; + PtrI pageI1 = pl1.m_tailPageI; + PtrI pageI2 = pl2.m_headPageI; if (pl1.m_pageCount != 0) { + assert(pageI1 != RNIL); if (pl2.m_pageCount != 0) { - PtrI pageI1 = pl1.m_tailPageI; - PtrI pageI2 = pl2.m_headPageI; + assert(pageI2 != RNIL); PageEnt& pe1 = getPageEnt(pageI1); PageEnt& pe2 = getPageEnt(pageI2); pe1.m_nextPageI = pageI2; pe2.m_prevPageI = pageI1; + pl1.m_tailPageI = pl2.m_tailPageI; pl1.m_pageCount += pl2.m_pageCount; + } else { + assert(pageI2 == RNIL); } } else { + assert(pageI1 == RNIL); pl1 = pl2; } pl2.m_headPageI = pl2.m_tailPageI = RNIL; @@ -124,6 +105,9 @@ SuperPool::movePages(PageList& pl1, PageList& pl2) void SuperPool::addHeadPage(PageList& pl, PtrI pageI) { + assert(pageI != RNIL); + PageEnt& pe = getPageEnt(pageI); + assert(pe.m_nextPageI == RNIL & pe.m_prevPageI == RNIL); PageList pl2(pageI); movePages(pl2, pl); pl = pl2; @@ -132,6 +116,9 @@ SuperPool::addHeadPage(PageList& pl, PtrI pageI) void SuperPool::addTailPage(PageList& pl, PtrI pageI) { + assert(pageI != RNIL); + PageEnt& pe = getPageEnt(pageI); + assert(pe.m_nextPageI == RNIL & pe.m_prevPageI == RNIL); PageList pl2(pageI); movePages(pl, pl2); } @@ -139,81 +126,187 @@ SuperPool::addTailPage(PageList& pl, PtrI pageI) void SuperPool::removePage(PageList& pl, PtrI pageI) { + assert(pageI != RNIL); PageEnt& pe = getPageEnt(pageI); - PtrI pageI1 = pe.m_prevPageI; - PtrI pageI2 = pe.m_nextPageI; - if (pageI1 != RNIL) { - PageEnt& pe1 = getPageEnt(pageI1); - pe1.m_nextPageI = pageI2; - if (pageI2 != RNIL) { - PageEnt& pe2 = getPageEnt(pageI2); - pe2.m_prevPageI = pageI1; - } else { - pl.m_tailPageI = pageI1; - } + if (pe.m_nextPageI != RNIL) { + assert(pl.m_tailPageI != pageI); + PageEnt& nextPe = getPageEnt(pe.m_nextPageI); + nextPe.m_prevPageI = pe.m_prevPageI; } else { - if (pageI2 != RNIL) { - PageEnt& pe2 = getPageEnt(pageI2); - pe2.m_prevPageI = pageI1; - pl.m_headPageI = pageI2; - } else { - pl.m_headPageI = pl.m_tailPageI = RNIL; - } + assert(pl.m_tailPageI == pageI); + pl.m_tailPageI = pe.m_prevPageI; } - pe.m_prevPageI = pe.m_nextPageI = RNIL; + if (pe.m_prevPageI != RNIL) { + assert(pl.m_headPageI != pageI); + PageEnt& prevPe = getPageEnt(pe.m_prevPageI); + prevPe.m_nextPageI = pe.m_nextPageI; + } else { + assert(pl.m_headPageI == pageI); + pl.m_headPageI = pe.m_nextPageI; + } + pe.m_nextPageI = RNIL; + pe.m_prevPageI = RNIL; assert(pl.m_pageCount != 0); pl.m_pageCount--; } -void -SuperPool::setCurrPage(RecInfo& ri, PtrI newPageI) +// reverse mapping + +SuperPool::PtrI +SuperPool::getPageI(void* pageP) { - PtrI oldPageI = ri.m_currPageI; - if (oldPageI != RNIL) { - // copy from cache - PageEnt& pe = getPageEnt(oldPageI); - pe.m_freeRecI = ri.m_currFreeRecI; - pe.m_useCount = ri.m_currUseCount; - // add to right list according to "pp2" policy - if (pe.m_useCount == 0) { - pe.m_pageType = 0; - addHeadPage(m_pageList, oldPageI); - ri.m_totalRecCount -= ri.m_maxUseCount; - } else if (pe.m_useCount < ri.m_maxUseCount) { - addHeadPage(ri.m_activeList, oldPageI); - } else { - addHeadPage(ri.m_fullList, oldPageI); - } + Uint32 pageSize = m_pageSize; + Uint32 pageBits = m_pageBits; + Uint32 recBits = m_recBits; + void* memRoot = m_memRoot; + my_ptrdiff_t ipL = (Uint8*)pageP - (Uint8*)memRoot; + assert(ipL % pageSize == 0); + ipL /= (Int32)pageSize; + Int32 ip = (Int32)ipL; + Int32 lim = 1 << (pageBits - 1); + if (! (ip == ipL && -lim <= ip && ip < lim && ip != -1)) { + // page was too distant from memory root + return RNIL; } - if (newPageI != RNIL) { - PageEnt& pe = getPageEnt(newPageI); - // copy to cache - ri.m_currPageI = newPageI; - ri.m_currFreeRecI = pe.m_freeRecI; - ri.m_currUseCount = pe.m_useCount; - // remove from right list - if (pe.m_useCount == 0) { - removePage(ri.m_freeList, newPageI); - } else if (pe.m_useCount < ri.m_maxUseCount) { - removePage(ri.m_activeList, newPageI); - } else { - removePage(ri.m_fullList, newPageI); - } - } else { - ri.m_currPageI = RNIL; - ri.m_currFreeRecI = RNIL; - ri.m_currUseCount = 0; + PtrI pageI = ip << recBits; + assert(pageP == getPageP(pageI)); + return pageI; +} + +// record pool + +SuperPool::RecInfo::RecInfo(GroupPool& gp, Uint32 recSize) : + m_groupPool(gp), + m_recSize(recSize), + m_recType(0), + m_maxPerPage(0), + m_freeRecI(NNIL), + m_useCount(0), + m_pageList(), + m_hyX(1), + m_hyY(2) +{ + SuperPool& sp = gp.m_superPool; + m_recType = (sp.m_typeCount++ << 1) | 1; + assert(m_recSize == SP_ALIGN(m_recSize, sizeof(Uint32))); + { // compute max records per page + Uint32 n1 = sp.m_pageSize / m_recSize; + Uint32 b2 = (sp.m_recBits < 16 ? sp.m_recBits : 16); + Uint32 n2 = (1 << b2) - 1; // last is reserved + m_maxPerPage = (n1 < n2 ? n1 : n2); + assert(m_maxPerPage != 0); } } +Uint32 +SuperPool::getFreeCount(RecInfo& ri, PtrI recI) +{ + Uint32 n = 0; + Uint32 recMask = m_recMask; + Uint32 loopRecI = recI; + while ((loopRecI & recMask) != recMask) { + n++; + void* loopRecP = getRecP(loopRecI, ri); + loopRecI = *(Uint32*)loopRecP; + } + assert(n == (Uint16)n); + return n; +} + +Uint32 +SuperPool::getRecPageCount(RecInfo& ri) +{ + Uint32 n = 0; + for (Uint32 k = 0; k <= 2; k++) + n += ri.m_pageList[k].m_pageCount; + if (ri.m_freeRecI != NNIL) + n += 1; + return n; +} + +Uint32 +SuperPool::getRecTotCount(RecInfo& ri) +{ + return ri.m_maxPerPage * getRecPageCount(ri); +} + +Uint32 +SuperPool::getRecUseCount(RecInfo& ri) +{ + Uint32 n = ri.m_useCount; + // current page does not keep count + if (ri.m_freeRecI != NNIL) { + Uint32 maxPerPage = ri.m_maxPerPage; + Uint32 freeCount = getFreeCount(ri, ri.m_freeRecI); + assert(maxPerPage >= freeCount); + n += maxPerPage - freeCount; + } + return n; +} + +// current page + +Uint32 +SuperPool::getRecPageList(RecInfo& ri, PageEnt& pe) +{ + if (pe.m_useCount == 0) + return 0; + if (pe.m_useCount < ri.m_maxPerPage) + return 1; + if (pe.m_useCount == ri.m_maxPerPage) + return 2; + assert(false); + return ~(Uint32)0; +} + +void +SuperPool::addCurrPage(RecInfo& ri, PtrI pageI) +{ + PageEnt& pe = getPageEnt(pageI); + ri.m_freeRecI = pe.m_freeRecI; + // remove from right list + Uint32 k = getRecPageList(ri, pe); + assert(k != 2); + removePage(ri.m_pageList[k], pageI); + assert(ri.m_useCount >= pe.m_useCount); + ri.m_useCount -= pe.m_useCount; +} + +void +SuperPool::removeCurrPage(RecInfo& ri) +{ + Uint32 recMask = m_recMask; + PtrI pageI = ri.m_freeRecI & ~ m_recMask; + // update page entry + PageEnt& pe = getPageEnt(pageI); + pe.m_freeRecI = ri.m_freeRecI; + Uint32 maxPerPage = ri.m_maxPerPage; + Uint32 freeCount = getFreeCount(ri, pe.m_freeRecI); + assert(maxPerPage >= freeCount); + pe.m_useCount = maxPerPage - freeCount; + // add to right list + Uint32 k = getRecPageList(ri, pe); + addHeadPage(ri.m_pageList[k], pageI); + ri.m_useCount += pe.m_useCount; + ri.m_freeRecI = NNIL; + if (k == 0) { + freeRecPages(ri); + } +} + +// page allocation + bool SuperPool::getAvailPage(RecInfo& ri) { PtrI pageI; - if ((pageI = ri.m_activeList.m_headPageI) != RNIL || - (pageI = ri.m_freeList.m_headPageI) != RNIL || + if ((pageI = ri.m_pageList[1].m_headPageI) != RNIL || + (pageI = ri.m_pageList[0].m_headPageI) != RNIL || (pageI = getFreePage(ri)) != RNIL) { - setCurrPage(ri, pageI); + // the page is in record pool now + if (ri.m_freeRecI != NNIL) + removeCurrPage(ri); + addCurrPage(ri, pageI); return true; } return false; @@ -222,121 +315,310 @@ SuperPool::getAvailPage(RecInfo& ri) SuperPool::PtrI SuperPool::getFreePage(RecInfo& ri) { + GroupPool& gp = ri.m_groupPool; PtrI pageI; - if (m_pageList.m_pageCount != 0) { - pageI = m_pageList.m_headPageI; - removePage(m_pageList, pageI); - } else { - pageI = getNewPage(); - if (pageI == RNIL) - return RNIL; + if ((pageI = getFreePage(gp)) != RNIL) { + initFreePage(ri, pageI); + addHeadPage(ri.m_pageList[0], pageI); + return pageI; } + return RNIL; +} + +SuperPool::PtrI +SuperPool::getFreePage(GroupPool& gp) +{ + PtrI pageI; + if ((pageI = gp.m_freeList.m_headPageI) != RNIL) { + removePage(gp.m_freeList, pageI); + return pageI; + } + if (gp.m_totPages < getMaxPages(gp) && + (pageI = getFreePage()) != RNIL) { + gp.m_totPages++; + return pageI; + } + return RNIL; +} + +SuperPool::PtrI +SuperPool::getFreePage() +{ + PtrI pageI; + if ((pageI = m_freeList.m_headPageI) != RNIL) { + removePage(m_freeList, pageI); + return pageI; + } + if ((pageI = getNewPage()) != RNIL) { + return pageI; + } + return RNIL; +} + +void +SuperPool::initFreePage(RecInfo& ri, PtrI pageI) +{ void* pageP = getPageP(pageI); // set up free record list - Uint32 maxUseCount = ri.m_maxUseCount; + Uint32 num = ri.m_maxPerPage; Uint32 recSize = ri.m_recSize; void* recP = (Uint8*)pageP; Uint32 irNext = 1; - while (irNext < maxUseCount) { + while (irNext < num) { *(Uint32*)recP = pageI | irNext; recP = (Uint8*)recP + recSize; irNext++; } - *(Uint32*)recP = RNIL; - // add to total record count - ri.m_totalRecCount += maxUseCount; + // terminator has all recBits set + *(Uint32*)recP = pageI | m_recMask; // set up new page entry PageEnt& pe = getPageEnt(pageI); new (&pe) PageEnt(); pe.m_pageType = ri.m_recType; pe.m_freeRecI = pageI | 0; pe.m_useCount = 0; - // set type check bits - setCheckBits(pageI, ri.m_recType); - // add to record pool free list - addHeadPage(ri.m_freeList, pageI); - return pageI; + // set type check byte + Uint32 ip = pageI >> m_recBits; + m_pageType[ip] = (ri.m_recType & 0xFF); +} + +// release + +void +SuperPool::releaseNotCurrent(RecInfo& ri, PtrI recI) +{ + PageEnt& pe = getPageEnt(recI); + void* recP = getRecP(recI, ri); + *(Uint32*)recP = pe.m_freeRecI; + pe.m_freeRecI = recI; + PtrI pageI = recI & ~ m_recMask; + Uint32 maxPerPage = ri.m_maxPerPage; + // move to right list + Uint32 k1 = getRecPageList(ri, pe); + assert(pe.m_useCount != 0); + pe.m_useCount--; + Uint32 k2 = getRecPageList(ri, pe); + if (k1 != k2) { + removePage(ri.m_pageList[k1], pageI); + addHeadPage(ri.m_pageList[k2], pageI); + if (k2 == 0) { + freeRecPages(ri); + } + } + assert(ri.m_useCount != 0); + ri.m_useCount--; } void -SuperPool::setSizes(size_t initSize, size_t incrSize, size_t maxSize) +SuperPool::freeRecPages(RecInfo& ri) { - const Uint32 pageSize = m_pageSize; - m_initSize = SP_ALIGN_SIZE(initSize, pageSize); - m_incrSize = SP_ALIGN_SIZE(incrSize, pageSize); - m_maxSize = SP_ALIGN_SIZE(maxSize, pageSize); + // ignore current page + Uint32 useCount = ri.m_useCount; + Uint32 totCount = 0; + for (uint32 k = 0; k <= 2; k++) + totCount += ri.m_pageList[k].m_pageCount; + totCount *= ri.m_maxPerPage; + assert(totCount >= useCount); + if ((totCount - useCount) * ri.m_hyY < useCount * ri.m_hyX) + return; + // free all free pages + GroupPool& gp = ri.m_groupPool; + Uint32 minPages = getMinPages(gp); + PageList& pl = ri.m_pageList[0]; + while (pl.m_pageCount != 0) { + PtrI pageI = pl.m_headPageI; + removePage(pl, pageI); + PageEnt& pe = getPageEnt(pageI); + pe.m_pageType = 0; + pe.m_freeRecI = NNIL; + Uint32 ip = pageI >> m_recBits; + m_pageType[ip] = 0; + if (gp.m_totPages <= minPages) { + addHeadPage(gp.m_freeList, pageI); + } else { + // return excess to super pool + addHeadPage(m_freeList, pageI); + assert(gp.m_totPages != 0); + gp.m_totPages--; + } + } } +void +SuperPool::freeAllRecPages(RecInfo& ri, bool force) +{ + GroupPool& gp = ri.m_groupPool; + if (ri.m_freeRecI != NNIL) + removeCurrPage(ri); + assert(force || ri.m_useCount == 0); + for (Uint32 k = 0; k <= 2; k++) + movePages(gp.m_freeList, ri.m_pageList[k]); +} + +// size parameters + +void +SuperPool::setInitPages(Uint32 initPages) +{ + m_initPages = initPages; +} + +void +SuperPool::setIncrPages(Uint32 incrPages) +{ + m_incrPages = incrPages; +} + +void +SuperPool::setMaxPages(Uint32 maxPages) +{ + m_maxPages = maxPages; +} + +Uint32 +SuperPool::getGpMinPages() +{ + Uint32 minPages = (m_groupMinPct * m_totPages) / 100; + if (minPages < m_groupMinPages) + minPages = m_groupMinPages; + return minPages; +} + +Uint32 +SuperPool::getMinPages(GroupPool& gp) +{ + Uint32 minPages = (gp.m_minPct * m_totPages) / 100; + if (minPages < gp.m_minPages) + minPages = gp.m_minPages; + return minPages; +} + +Uint32 +SuperPool::getMaxPages(GroupPool& gp) +{ + Uint32 n1 = getGpMinPages(); + Uint32 n2 = getMinPages(gp); + assert(n1 >= n2); + // pages reserved by other groups + Uint32 n3 = n1 - n2; + // rest can be claimed + Uint32 n4 = (m_totPages >= n3 ? m_totPages - n3 : 0); + return n4; +} + +// debug + void SuperPool::verify(RecInfo& ri) { - PageList* plList[3] = { &ri.m_freeList, &ri.m_activeList, &ri.m_fullList }; - for (int i = 0; i < 3; i++) { - PageList& pl = *plList[i]; - unsigned count = 0; + GroupPool& gp = ri.m_groupPool; + verifyPageList(m_freeList); + verifyPageList(gp.m_freeList); + for (Uint32 k = 0; k <= 2; k++) { + PageList& pl = ri.m_pageList[k]; + verifyPageList(pl); PtrI pageI = pl.m_headPageI; while (pageI != RNIL) { PageEnt& pe = getPageEnt(pageI); - PtrI pageI1 = pe.m_prevPageI; - PtrI pageI2 = pe.m_nextPageI; - if (count == 0) { - assert(pageI1 == RNIL); - } else { - assert(pageI1 != RNIL); - PageEnt& pe1 = getPageEnt(pageI1); - assert(pe1.m_nextPageI == pageI); - if (pageI2 != RNIL) { - PageEnt& pe2 = getPageEnt(pageI2); - assert(pe2.m_prevPageI == pageI); - } - } - pageI = pageI2; - count++; + assert(pe.m_pageType == ri.m_recType); + Uint32 maxPerPage = ri.m_maxPerPage; + Uint32 freeCount = getFreeCount(ri, pe.m_freeRecI); + assert(maxPerPage >= freeCount); + Uint32 useCount = maxPerPage - freeCount; + assert(pe.m_useCount == useCount); + assert(k != 0 || useCount == 0); + assert(k != 1 || (useCount != 0 && freeCount != 0)); + assert(k != 2 || freeCount == 0); + pageI = pe.m_nextPageI; } - assert(pl.m_pageCount == count); } } +void +SuperPool::verifyPageList(PageList& pl) +{ + Uint32 count = 0; + PtrI pageI = pl.m_headPageI; + while (pageI != RNIL) { + PageEnt& pe = getPageEnt(pageI); + if (pe.m_prevPageI == RNIL) { + assert(count == 0); + } else { + PageEnt& prevPe = getPageEnt(pe.m_prevPageI); + assert(prevPe.m_nextPageI == pageI); + } + if (pe.m_nextPageI == RNIL) { + assert(pl.m_tailPageI == pageI); + } else { + PageEnt& nextPe = getPageEnt(pe.m_nextPageI); + assert(nextPe.m_prevPageI == pageI); + } + if (pe.m_pageType != 0) { + assert(pe.m_freeRecI != NNIL); + PageEnt& pe2 = getPageEnt(pe.m_freeRecI); + assert(&pe == &pe2); + } else { + assert(pe.m_freeRecI == NNIL); + } + pageI = pe.m_nextPageI; + count++; + } + assert(pl.m_pageCount == count); +} + +// GroupPool + +GroupPool::GroupPool(SuperPool& sp) : + m_superPool(sp), + m_minPct(0), + m_minPages(0), + m_totPages(0), + m_freeList() +{ +} + +GroupPool::~GroupPool() +{ +} + +void +GroupPool::setMinPct(Uint32 minPct) +{ + SuperPool& sp = m_superPool; + // subtract any previous value + assert(sp.m_groupMinPct >= m_minPct); + sp.m_groupMinPct -= m_minPct; + // add new value + sp.m_groupMinPct += minPct; + m_minPct = minPct; +} + +void +GroupPool::setMinPages(Uint32 minPages) +{ + SuperPool& sp = m_superPool; + // subtract any previous value + assert(sp.m_groupMinPages >= m_minPages); + sp.m_groupMinPages -= m_minPages; + // add new value + sp.m_groupMinPages += minPages; + m_minPages = minPages; +} + // HeapPool HeapPool::HeapPool(Uint32 pageSize, Uint32 pageBits) : SuperPool(pageSize, pageBits), m_areaHead(), m_currArea(&m_areaHead), - m_lastArea(&m_areaHead), - m_mallocPart(4) + m_lastArea(&m_areaHead) { } -bool -HeapPool::init() -{ - const Uint32 pageBits = m_pageBits; - if (! SuperPool::init()) - return false;; - // allocate page entry array - Uint32 peBytes = (1 << pageBits) * sizeof(PageEnt); - m_pageEnt = static_cast(malloc(peBytes)); - if (m_pageEnt == 0) - return false; - memset(m_pageEnt, 0, peBytes); - // allocate type check array - Uint32 tcWords = 1 << (pageBits - (5 - SP_CHECK_LOG2)); - m_typeCheck = static_cast(malloc(tcWords << 2)); - if (m_typeCheck == 0) - return false; - memset(m_typeCheck, 0, tcWords << 2); - // allocate initial data - assert(m_totalSize == 0); - if (! allocMoreData(m_initSize)) - return false; - return true; -} - HeapPool::~HeapPool() { free(m_pageEnt); - free(m_typeCheck); + free(m_pageType); Area* ap; while ((ap = m_areaHead.m_nextArea) != 0) { m_areaHead.m_nextArea = ap->m_nextArea; @@ -349,29 +631,28 @@ HeapPool::Area::Area() : m_nextArea(0), m_firstPageI(RNIL), m_currPage(0), - m_numPages(0), - m_memory(0) + m_memory(0), + m_pages(0), + m_numPages(0) { } SuperPool::PtrI HeapPool::getNewPage() { - const Uint32 pageSize = m_pageSize; - const Uint32 pageBits = m_pageBits; - const Uint32 recBits= 32 - pageBits; Area* ap = m_currArea; if (ap->m_currPage == ap->m_numPages) { // area is used up if (ap->m_nextArea == 0) { - // todo dynamic increase - assert(m_incrSize == 0); - return RNIL; + if (! allocMemory()) + return RNIL; } ap = m_currArea = ap->m_nextArea; + assert(ap != 0); } assert(ap->m_currPage < ap->m_numPages); PtrI pageI = ap->m_firstPageI; + Uint32 recBits = m_recBits; Int32 ip = (Int32)pageI >> recBits; ip += ap->m_currPage; pageI = ip << recBits; @@ -380,63 +661,90 @@ HeapPool::getNewPage() } bool -HeapPool::allocMoreData(size_t size) +HeapPool::allocInit() { - const Uint32 pageSize = m_pageSize; - const Uint32 pageBits = m_pageBits; - const Uint32 recBits = 32 - pageBits; - const Uint32 incrSize = m_incrSize; - const Uint32 incrPages = incrSize / pageSize; - const Uint32 mallocPart = m_mallocPart; - size = SP_ALIGN_SIZE(size, pageSize); - if (incrSize != 0) - size = SP_ALIGN_SIZE(size, incrSize); - Uint32 needPages = size / pageSize; - while (needPages != 0) { - Uint32 wantPages = needPages; - if (incrPages != 0 && wantPages > incrPages) - wantPages = incrPages; - Uint32 tryPages = 0; - void* p1 = 0; - for (Uint32 i = mallocPart; i > 0 && p1 == 0; i--) { - // one page is usually wasted due to alignment to memory root - tryPages = ((wantPages + 1) * i) / mallocPart; - if (tryPages < 2) - break; - p1 = malloc(pageSize * tryPages); - } - if (p1 == 0) + Uint32 pageCount = (1 << m_pageBits); + if (m_pageEnt == 0) { + // allocate page entry array + Uint32 bytes = pageCount * sizeof(PageEnt); + m_pageEnt = static_cast(malloc(bytes)); + if (m_pageEnt == 0) return false; - if (m_memRoot == 0) { - // set memory root at first "big" alloc - // assume malloc header makes later ip = -1 impossible - m_memRoot = p1; - } - void* p2 = SP_ALIGN_PTR(p1, m_memRoot, pageSize); - Uint32 numPages = tryPages - (p1 != p2); - my_ptrdiff_t ipL = ((Uint8*)p2 - (Uint8*)m_memRoot) / pageSize; - Int32 ip = (Int32)ipL; - Int32 lim = 1 << (pageBits - 1); - if (! (ip == ipL && -lim <= ip && ip + numPages < lim)) { - free(p1); + for (Uint32 i = 0; i < pageCount; i++) + new (&m_pageEnt[i]) PageEnt(); + } + if (m_pageType == 0) { + // allocate type check array + Uint32 bytes = pageCount; + m_pageType = static_cast(malloc(bytes)); + if (m_pageType == 0) return false; - } - assert(ip != -1); - PtrI pageI = ip << recBits; - needPages = (needPages >= numPages ? needPages - numPages : 0); - m_totalSize += numPages * pageSize; - // allocate new area - Area* ap = static_cast(malloc(sizeof(Area))); - if (ap == 0) { - free(p1); - return false; - } - new (ap) Area(); - ap->m_firstPageI = pageI; - ap->m_numPages = numPages; - ap->m_memory = p1; - m_lastArea->m_nextArea = ap; - m_lastArea = ap; + memset(m_pageType, 0, bytes); + } + return true; +} + +bool +HeapPool::allocArea(Area* ap, Uint32 tryPages) +{ + Uint32 pageSize = m_pageSize; + // one page is usually lost due to alignment + Uint8* p1 = (Uint8*)malloc(pageSize * (tryPages + 1)); + if (p1 == 0) + return false; + // align + UintPtr n1 = (UintPtr)p1; + UintPtr n2 = SP_ALIGN(n1, (UintPtr)pageSize); + Uint8* p2 = p1 + (n2 - n1); + assert(p2 >= p1 && p2 - p1 < pageSize && (UintPtr)p2 % pageSize == 0); + // set memory root to first allocated page + if (m_memRoot == 0) + m_memRoot = p2; + // convert to i-value + Uint32 pageI = getPageI(p2); + ap->m_firstPageI = pageI; + ap->m_currPage = 0; + ap->m_memory = p1; + ap->m_pages = p2; + ap->m_numPages = tryPages + (p1 == p2); + return true; +} + +bool +HeapPool::allocMemory() +{ + if (! allocInit()) + return false; + // compute number of additional pages needed + if (m_maxPages <= m_totPages) + return false; + Uint32 needPages = (m_totPages == 0 ? m_initPages : m_incrPages); + if (needPages > m_maxPages - m_totPages) + needPages = m_maxPages - m_totPages; + while (needPages != 0) { + // add new area + Area* ap = static_cast(malloc(sizeof(Area))); + if (ap == 0) + return false; + new (ap) Area(); + m_lastArea->m_nextArea = ap; + m_lastArea = ap; + // initial malloc is done in m_incrPages pieces + Uint32 wantPages = needPages; + if (m_incrPages != 0 && wantPages > m_incrPages) + wantPages = m_incrPages; + Uint32 tryPages = wantPages; + while (tryPages != 0) { + if (allocArea(ap, tryPages)) + break; + tryPages /= 2; + } + if (tryPages == 0) + return false; + // update counts + Uint32 numPages = ap->m_numPages; + m_totPages += numPages; + needPages = (needPages > numPages ? needPages - numPages : 0); } return true; } diff --git a/storage/ndb/src/kernel/vm/SuperPool.hpp b/storage/ndb/src/kernel/vm/SuperPool.hpp index 157c75aa0d5..187383f5f71 100644 --- a/storage/ndb/src/kernel/vm/SuperPool.hpp +++ b/storage/ndb/src/kernel/vm/SuperPool.hpp @@ -22,20 +22,18 @@ #include #include -#define NDB_SP_VERIFY_LEVEL 1 - /* * SuperPool - super pool for record pools (abstract class) * - * Documents SuperPool and RecordPool. + * Documents: SuperPool GroupPool RecordPool * - * GENERAL + * SUPER POOL * * A "super pool" is a shared pool of pages of fixed size. A "record * pool" is a pool of records of fixed size. One super pool instance is - * used by any number of record pools to allocate their memory. - * A special case is a "page pool" where a record is a simple page, - * possibly smaller than super pool page. + * used by a number of record pools to allocate their memory. A special + * case is a "page pool" where a record is a simple page whose size + * divides super pool page size. * * A record pool allocates memory in pages. Thus each used page is * associated with one record pool and one record type. The records on @@ -49,27 +47,26 @@ * record is stored as an "i-value" from which the record pointer "p" is * computed. In super pool the i-value is a Uint32 with two parts: * - * - "ip" index of page within super pool (high pageBits) - * - "ir" index of record within page (low recBits) + * - "ip" index of page within super pool (high "pageBits") + * - "ir" index of record within page (low "recBits") + * + * At most 16 recBits are used, the rest are zero. * * The translation between "ip" and page address is described in next * section. Once page address is known, the record address is found * from "ir" in the obvious way. * - * The main advantage with i-value is that it can be verified. The - * level of verification depends on compile type (release, debug). + * One advantage of i-value is that it can be verified. The level of + * verification can depend on compile options. * - * - "v0" minimal sanity check - * - "v1" check record type matches page type, see below - * - "v2" check record is in use (not yet implemented) + * - "v1" check i-value specifies valid page + * - "v2" check record type matches page type, see below + * - "v3" check record is in use + * - "v4" check unused record is unmodified * * Another advantage of a 32-bit i-value is that it extends the space of * 32-bit addressable records on a 64-bit platform. * - * RNIL is 0xffffff00 and indicates NULL i-value. To avoid hitting RNIL - * it is required that pageBits <= 30 and that the maximum value of the - * range (2^pageBits-1) is not used. - * * MEMORY ROOT * * This super pool requires a "memory root" i.e. a memory address such @@ -77,13 +74,28 @@ * * page address = memory root + (signed)ip * page size * - * This is possible on most platforms, provided that the memory root and + * This is possible on all platforms, provided that the memory root and * all pages are either on the heap or on the stack, in order to keep * the size of "ip" reasonably small. * * The cast (signed)ip is done as integer of pageBits bits. "ip" has * same sign bit as i-value "i" so (signed)ip = (Int32)i >> recBits. - * The RNIL restriction can be expressed as (signed)ip != -1. + * + * RESERVED I-VALUES + * + * RNIL is 0xffffff00 (signed -256). It is used everywhere in NDB as + * "null pointer" i.e. as an i-value which does not point to a record. + * In addition the signed values -255 to -1 are reserved for use by the + * application. + * + * An i-value with all "ir" bits set is used as terminator in free + * record list. Unlike RNIL, it still has valid page bits "ip". + * + * Following restrictions avoid hitting the reserved values: + * + * - pageBits is <= 30 + * - the maximum "ip" value 2^pageBits-1 (signed -1) is not used + * - the maximum "ir" value 2^recBits-1 is not used * * PAGE ENTRIES * @@ -95,37 +107,54 @@ * - pointers (as i-values) to next and previous page in list * * Page entry cannot be stored on the page itself since this prevents - * aligning pages to OS block size and the use of BATs (don't ask) for - * page pools in NDB. For now the implementation provides an array of - * page entries with place for all (2^pageBits) entries. + * aligning pages to OS block size and the use of BATs for page pools in + * NDB. For now the implementation provides an array of page entries + * with place for all potential (2^pageBits) entries. * * PAGE TYPE * - * Page type is (in principle) unique to the record pool using the super - * pool. It is assigned in record pool constructor. Page type zero - * means that the page is free i.e. not allocated to a record pool. + * Page type is unique to the record pool using the super pool. It is + * assigned in record pool constructor. Page type zero means that the + * page is free i.e. not allocated to a record pool. * - * Each "i-p" conversion checks ("v1") that the record belongs to same + * Each "i-p" conversion checks ("v2") that the record belongs to same * pool as the page. This check is much more common than page or record - * allocation. To make it cache effective, there is a separate array of - * reduced "type bits" (computed from real type). + * allocation. To make it cache effective, there is a separate page + * type array. It truncates type to one non-zero byte. * - * FREE LISTS + * GROUP POOL * - * A record is either used or on the free list of the record pool. - * A page has a use count i.e. number of used records. When use count - * drops to zero the page can be returned to the super pool. This is - * not necessarily done at once, or ever. + * Each record pool belongs to a group. The group specifies minimum + * size or memory percentage the group must be able to allocate. The + * sum of the minimum sizes of group pools is normally smaller than + * super pool size. This provides unclaimed memory which a group can + * use temporarily to allocate more than its minimum. * - * To make freeing pages feasible, the record pool free list has two - * levels. There are available pages (some free) and a singly linked - * free list within the page. A page allocated to record pool is on one - * of 4 lists: + * The record pools within a group compete freely for the available + * memory within the group. * - * - free page list (all free, available) - * - active page list (some free, some used, available) - * - full page list (none free) - * - current page (list of 1), see below + * Typical exmaple is group of all metadata pools. The group allows + * specifying the memory to reserve for metadata, without having to + * specify number of tables, attributes, indexes, triggers, etc. + * + * PAGE LISTS + * + * Super pool has free page list. Each group pool uses it to allocate + * its own free page list. And each record pool within the group uses + * the group's free list to allocate its pages. + * + * A page allocated to a record pool has a use count i.e. number of used + * records. When use count drops to zero the page can be returned to + * the group. This is not necessarily done at once. + * + * The list of free records in a record pool has two levels. There are + * available pages (some free) and a singly linked free list within the + * page. A page allocated to record pool is on one of 4 lists: + * + * - free page (all free, available, could be returned to group) + * - busy page (some free, some used, available) + * - full page (none free) + * - current page (list of one), see below * * Some usage types (temporary pools) may never free records. They pay * a small penalty for the extra overhead. @@ -133,7 +162,7 @@ * RECORD POOL * * A pool of records which allocates its memory from a super pool - * instance specified in the constructor. There are 3 basic operations: + * instance via a group pool. There are 3 basic operations: * * - getPtr - translate i-value to pointer-to-record p * - seize - allocate record @@ -141,76 +170,64 @@ * * CURRENT PAGE * - * getPtr is a fast computation which does not touch the page. For - * seize and release there is an optimization: + * getPtr is a fast computation which does not touch the page entry. + * For seize (and release) there is a small optimization. * - * Define "current page" as page of latest seize or release. Its page - * entry is cached under record pool instance. The page is removed from - * its normal list. Seize and release on current page are fast and - * avoid touching the page. The current page is used until + * The "current page" is the page of latest seize. It is unlinked from + * its normal list and the free record pointer is stored under record + * pool instance. * - * - seize and current page is full - * - release and the page is not current page + * The page remains current until there is a seize and the page is full. + * Then the real page entry and its list membership are updated, and + * a new page is made current. * - * Then the real page entry is updated and the page is added to the - * appropriate list, and a new page is made current. + * This implies that each (active) record pool allocates at least one + * page which is never returned to the group. * * PAGE POLICY * - * Allocating new page to record pool is expensive. Therefore record - * pool should not always return empty pages to super pool. There are - * two trivial policies, each with problems: + * A group pool returns its "excess" (above minimum) free pages to the + * super pool immediately. * - * - "pp1" never return empty page to super pool - * - "pp2" always return empty page to super pool + * Allocating a new page to a record pool is expensive due to free list + * setup. Therefore a record pool should not always return empty pages + * to the group. Policies: * - * This implementation uses "pp2" for now. A real policy is implemented - * in next version. + * - "pp1" never return empty page to the group + * - "pp2" always return empty (non-current) page to the group + * - "pp3" simple hysteresis * - * OPEN ISSUES AND LIMITATIONS + * Last one "pp3" is used. It works as follows: * - * - smarter (virtual) placement of check bits & page entries - * - should getPtr etc be inlined? (too much code) - * - real page policy - * - other implementations (only HeapPool is done) - * - super pool list of all record pools, for statistics etc - * - access by multiple threads is not supported + * When a page becomes free, check if number of free records exceeds + * some fixed fraction of all records. If it does, move all free pages + * to the group. Current page is ignored in the check. + * + * TODO + * + * Define abstract class SuperAlloc. Make SuperPool a concrete class + * with SuperAlloc instance in ctor. Replace HeapPool by HeapAlloc. */ -// align size -#define SP_ALIGN_SIZE(sz, al) \ - (((sz) + (al) - 1) & ~((al) - 1)) - -// align pointer relative to base -#define SP_ALIGN_PTR(p, base, al) \ - (void*)((Uint8*)(base) + SP_ALIGN_SIZE((Uint8*)(p) - (Uint8*)(base), (al))) +// Types forward. +class GroupPool; class SuperPool { public: - // Type of i-value, used to reference both pages and records. Page - // index "ip" occupies the high bits. The i-value of a page is same - // as i-value of record 0 on the page. + // Type of i-value, used to reference both pages and records. typedef Uint32 PtrI; - // Size and address alignment given as number of bytes (power of 2). - STATIC_CONST( SP_ALIGN = 8 ); - - // Page entry. Current|y allocated as array of (2^pageBits). + // Page entry. struct PageEnt { PageEnt(); - Uint32 m_pageType; - Uint32 m_freeRecI; - Uint32 m_useCount; + Uint16 m_pageType; // zero if not in record pool + Uint16 m_useCount; // used records on the page + PtrI m_freeRecI; // first free record on the page PtrI m_nextPageI; PtrI m_prevPageI; }; - // Number of bits for cache effective type check given as log of 2. - // Example: 2 means 4 bits and uses 32k for 2g of 32k pages. - STATIC_CONST( SP_CHECK_LOG2 = 2 ); - - // Doubly-linked list of pages. There is one free list in super pool - // and free, active, full list in each record pool. + // Doubly-linked list of page entries. struct PageList { PageList(); PageList(PtrI pageI); @@ -219,54 +236,13 @@ public: Uint32 m_pageCount; }; - // Record pool information. Each record pool instance contains one. - struct RecInfo { - RecInfo(Uint32 recType, Uint32 recSize); - const Uint32 m_recType; - const Uint32 m_recSize; - Uint32 m_maxUseCount; // could be computed - Uint32 m_currPageI; // current page - Uint32 m_currFreeRecI; - Uint32 m_currUseCount; - Uint32 m_totalUseCount; // total per pool - Uint32 m_totalRecCount; - PageList m_freeList; - PageList m_activeList; - PageList m_fullList; - }; - - // Constructor. Gives page size in bytes (excluding page header) and + // Constructor. Gives page size in bytes (must be power of 2) and // number of bits to use for page index "ip" in i-value. SuperPool(Uint32 pageSize, Uint32 pageBits); - // Initialize. Must be called after setting sizes or other parameters - // and before the pool is used. - virtual bool init(); - // Destructor. virtual ~SuperPool() = 0; - // Translate i-value to page entry. - PageEnt& getPageEnt(PtrI pageI); - - // Translate i-value to page address. - void* getPageP(PtrI pageI); - - // Translate page address to i-value (unused). - PtrI getPageI(void* pageP); - - // Given type, return non-zero reduced type check bits. - Uint32 makeCheckBits(Uint32 type); - - // Get type check bits from type check array. - Uint32 getCheckBits(PtrI pageI); - - // Set type check bits in type check array. - void setCheckBits(PtrI pageI, Uint32 type); - - // Translate i-value to record address. - void* getRecP(PtrI recI, RecInfo& ri); - // Move all pages from second list to end of first list. void movePages(PageList& pl1, PageList& pl2); @@ -279,174 +255,190 @@ public: // Remove any page from page list. void removePage(PageList& pl, PtrI pageI); - // Set current page. Previous current page is updated and added to - // appropriate list. - void setCurrPage(RecInfo& ri, PtrI pageI); + // Translate i-value ("ri" ignored) to page entry. + PageEnt& getPageEnt(PtrI pageI); + + // Translate i-value ("ri" ignored) to page address. + void* getPageP(PtrI pageI); + + // Translate page address to i-value. Address must be page-aligned to + // memory root. Returns RNIL if "ip" range exceeded. + PtrI getPageI(void* pageP); + + // Record pool info. + struct RecInfo { + RecInfo(GroupPool& gp, Uint32 recSize); + GroupPool& m_groupPool; + Uint32 m_recSize; + Uint16 m_recType; + Uint16 m_maxPerPage; + PtrI m_freeRecI; // first free record on current page + Uint32 m_useCount; // used records excluding current page + PageList m_pageList[3]; // 0-free 1-busy 2-full + Uint16 m_hyX; // hysteresis fraction x/y in "pp3" + Uint16 m_hyY; + }; + + // Translate i-value to record address. + void* getRecP(PtrI recI, RecInfo& ri); + + // Count records on page free list. + Uint32 getFreeCount(RecInfo& ri, PtrI freeRecPtrI); + + // Compute total number of pages in pool. + Uint32 getRecPageCount(RecInfo& ri); + + // Compute total number of records (used or not) in pool. + Uint32 getRecTotCount(RecInfo& ri); + + // Compute total number of used records in pool. + Uint32 getRecUseCount(RecInfo& ri); + + // Compute record pool page list index (0,1,2). + Uint32 getRecPageList(RecInfo& ri, PageEnt& pe); + + // Add current page. + void addCurrPage(RecInfo& ri, PtrI pageI); + + // Remove current page. + void removeCurrPage(RecInfo& ri); // Get page with some free records and make it current. Takes head of - // active or free list, or else gets free page from super pool. + // used or free list, or else gets free page from group pool. bool getAvailPage(RecInfo& ri); - // Get free page from super pool and add it to record pool free list. - // This is an expensive subroutine of getAvailPage(). + // Get free page from group pool and add it to record pool free list. + // This is an expensive subroutine of getAvailPage(RecInfo&): PtrI getFreePage(RecInfo& ri); - // Get new free page from the implementation. + // Get free detached (not on list) page from group pool. + PtrI getFreePage(GroupPool& gp); + + // Get free detached page from super pool. + PtrI getFreePage(); + + // Get new free detached page from the implementation. virtual PtrI getNewPage() = 0; - // Set 3 size parameters, rounded to page size. If called before - // init() then init() allocates the initial size. - void setSizes(size_t initSize = 0, size_t incrSize = 0, size_t maxSize = 0); + // Initialize free list etc. Subroutine of getFreePage(RecInfo&). + void initFreePage(RecInfo& ri, PtrI pageI); - const Uint32 m_pageSize; - const Uint32 m_pageBits; - // implementation must set up these pointers - void* m_memRoot; - PageEnt* m_pageEnt; - Uint32* m_typeCheck; - Uint32 m_typeSeq; - PageList m_pageList; - size_t m_totalSize; - size_t m_initSize; - size_t m_incrSize; - size_t m_maxSize; + // Release record which is not on current page. + void releaseNotCurrent(RecInfo& ri, PtrI recI); + + // Free pages from record pool according to page policy. + void freeRecPages(RecInfo& ri); + + // Free all pages in record pool. + void freeAllRecPages(RecInfo& ri, bool force); + + // Set pool size parameters in pages. Call allocMemory() for changes + // (such as extra mallocs) to take effect. + void setInitPages(Uint32 initPages); + void setIncrPages(Uint32 incrPages); + void setMaxPages(Uint32 maxPages); + + // Get number of pages reserved by all groups. + Uint32 getGpMinPages(); + + // Get number of pages reserved to a group. + Uint32 getMinPages(GroupPool& gp); + + // Get max number of pages a group can try to allocate. + Uint32 getMaxPages(GroupPool& gp); + + // Allocate more memory according to current parameters. Returns + // false if no new memory was allocated. Otherwise returns true, + // even if the amount allocated was less than requested. + virtual bool allocMemory() = 0; // Debugging. void verify(RecInfo& ri); + void verifyPageList(PageList& pl); + + // Super pool parameters. + const Uint32 m_pageSize; + const Uint16 m_pageBits; + const Uint16 m_recBits; + const Uint32 m_recMask; + // Implementation must set up these 3 pointers. + void* m_memRoot; + PageEnt* m_pageEnt; + Uint8* m_pageType; + // Free page list. + PageList m_freeList; + // Free pages and sizes. + Uint32 m_initPages; + Uint32 m_incrPages; + Uint32 m_maxPages; + Uint32 m_totPages; + Uint32 m_typeCount; + // Reserved and allocated by group pools. + Uint32 m_groupMinPct; + Uint32 m_groupMinPages; + Uint32 m_groupTotPages; }; inline SuperPool::PageEnt& SuperPool::getPageEnt(PtrI pageI) { - Uint32 ip = pageI >> (32 - m_pageBits); + Uint32 ip = pageI >> m_recBits; return m_pageEnt[ip]; } inline void* SuperPool::getPageP(PtrI ptrI) { - Int32 ip = (Int32)ptrI >> (32 - m_pageBits); - my_ptrdiff_t sz = m_pageSize; - void* pageP = (Uint8*)m_memRoot + ip * sz; - return pageP; -} - -inline Uint32 -SuperPool::makeCheckBits(Uint32 type) -{ - Uint32 shift = 1 << SP_CHECK_LOG2; - Uint32 mask = (1 << shift) - 1; - return 1 + type % mask; -} - -inline Uint32 -SuperPool::getCheckBits(PtrI pageI) -{ - Uint32 ip = pageI >> (32 - m_pageBits); - Uint32 xp = ip >> (5 - SP_CHECK_LOG2); - Uint32 yp = ip & (1 << (5 - SP_CHECK_LOG2)) - 1; - Uint32& w = m_typeCheck[xp]; - Uint32 shift = 1 << SP_CHECK_LOG2; - Uint32 mask = (1 << shift) - 1; - // get - Uint32 bits = (w >> yp * shift) & mask; - return bits; -} - -inline void -SuperPool::setCheckBits(PtrI pageI, Uint32 type) -{ - Uint32 ip = pageI >> (32 - m_pageBits); - Uint32 xp = ip >> (5 - SP_CHECK_LOG2); - Uint32 yp = ip & (1 << (5 - SP_CHECK_LOG2)) - 1; - Uint32& w = m_typeCheck[xp]; - Uint32 shift = 1 << SP_CHECK_LOG2; - Uint32 mask = (1 << shift) - 1; - // set - Uint32 bits = makeCheckBits(type); - w &= ~(mask << yp * shift); - w |= (bits << yp * shift); + Int32 ip = (Int32)ptrI >> m_recBits; + return (Uint8*)m_memRoot + ip * (my_ptrdiff_t)m_pageSize; } inline void* SuperPool::getRecP(PtrI ptrI, RecInfo& ri) { - const Uint32 recMask = (1 << (32 - m_pageBits)) - 1; - PtrI pageI = ptrI & ~recMask; -#if NDB_SP_VERIFY_LEVEL >= 1 - Uint32 bits1 = getCheckBits(pageI); - Uint32 bits2 = makeCheckBits(ri.m_recType); - assert(bits1 == bits2); -#endif - void* pageP = getPageP(pageI); - Uint32 ir = ptrI & recMask; - void* recP = (Uint8*)pageP + ir * ri.m_recSize; - return recP; + Uint32 ip = ptrI >> m_recBits; + assert(m_pageType[ip] == (ri.m_recType & 0xFF)); + Uint32 ir = ptrI & m_recMask; + return (Uint8*)getPageP(ptrI) + ir * ri.m_recSize; } /* - * HeapPool - SuperPool on heap (concrete class) - * - * A super pool based on malloc with memory root on the heap. This - * pool type has 2 realistic uses: - * - * - a small pool with only initial malloc and pageBits set to match - * - the big pool from which all heap allocations are done - * - * A "smart" malloc may break "ip" limit by using different VM areas for - * different sized requests. For this reason malloc is done in units of - * increment size if possible. Memory root is set to start of first - * malloc. + * GroupPool - subset of a super pool pages (concrete class) */ -class HeapPool : public SuperPool { +class GroupPool { public: - // Describes malloc area. The areas are kept in singly linked list. - // There is a list head and pointers to current and last area. - struct Area { - Area(); - Area* m_nextArea; - PtrI m_firstPageI; - Uint32 m_currPage; - Uint32 m_numPages; - void* m_memory; - }; + // Types. + typedef SuperPool::PageList PageList; // Constructor. - HeapPool(Uint32 pageSize, Uint32 pageBits); - - // Initialize. - virtual bool init(); + GroupPool(SuperPool& sp); // Destructor. - virtual ~HeapPool(); + ~GroupPool(); - // Use malloc to allocate more. - bool allocMoreData(size_t size); + // Set minimum pct reserved in super pool. + void setMinPct(Uint32 resPct); - // Get new page from current area. - virtual PtrI getNewPage(); + // Set minimum pages reserved in super pool. + void setMinPages(Uint32 resPages); - // List of malloc areas. - Area m_areaHead; - Area* m_currArea; - Area* m_lastArea; - - // Fraction of malloc size to try if cannot get all in one. - Uint32 m_mallocPart; + SuperPool& m_superPool; + Uint32 m_minPct; + Uint32 m_minPages; + Uint32 m_totPages; + PageList m_freeList; }; /* * RecordPool - record pool using one super pool instance (template) - * - * Documented under SuperPool. Satisfies ArrayPool interface. */ template class RecordPool { public: // Constructor. - RecordPool(SuperPool& superPool); + RecordPool(GroupPool& gp); // Destructor. ~RecordPool(); @@ -462,9 +454,9 @@ public: // todo variants of basic methods - // Return all pages to super pool. The force flag is required if + // Return all pages to group pool. The force flag is required if // there are any used records. - void free(bool force); + void freeAllRecPages(bool force); SuperPool& m_superPool; SuperPool::RecInfo m_recInfo; @@ -472,24 +464,17 @@ public: template inline -RecordPool::RecordPool(SuperPool& superPool) : - m_superPool(superPool), - m_recInfo(1 + superPool.m_typeSeq++, sizeof(T)) +RecordPool::RecordPool(GroupPool& gp) : + m_superPool(gp.m_superPool), + m_recInfo(gp, sizeof(T)) { - SuperPool::RecInfo& ri = m_recInfo; - assert(sizeof(T) == SP_ALIGN_SIZE(sizeof(T), sizeof(Uint32))); - Uint32 maxUseCount = superPool.m_pageSize / sizeof(T); - Uint32 sizeLimit = 1 << (32 - superPool.m_pageBits); - if (maxUseCount >= sizeLimit) - maxUseCount = sizeLimit; - ri.m_maxUseCount = maxUseCount; } template inline RecordPool::~RecordPool() { - free(true); + freeAllRecPages(true); } template @@ -506,18 +491,19 @@ RecordPool::seize(Ptr& ptr) { SuperPool& sp = m_superPool; SuperPool::RecInfo& ri = m_recInfo; - if (ri.m_currFreeRecI != RNIL || sp.getAvailPage(ri)) { - SuperPool::PtrI recI = ri.m_currFreeRecI; + Uint32 recMask = sp.m_recMask; + // get current page + if ((ri.m_freeRecI & recMask) != recMask || + sp.getAvailPage(ri)) { + SuperPool::PtrI recI = ri.m_freeRecI; void* recP = sp.getRecP(recI, ri); - ri.m_currFreeRecI = *(Uint32*)recP; - Uint32 useCount = ri.m_currUseCount; - assert(useCount < ri.m_maxUseCount); - ri.m_currUseCount = useCount + 1; - ri.m_totalUseCount++; + ri.m_freeRecI = *(Uint32*)recP; ptr.i = recI; ptr.p = static_cast(recP); return true; } + ptr.i = RNIL; + ptr.p = 0; return false; } @@ -527,35 +513,79 @@ RecordPool::release(Ptr& ptr) { SuperPool& sp = m_superPool; SuperPool::RecInfo& ri = m_recInfo; - const Uint32 recMask = (1 << (32 - sp.m_pageBits)) - 1; SuperPool::PtrI recI = ptr.i; - SuperPool::PtrI pageI = recI & ~recMask; - if (pageI != ri.m_currPageI) { - sp.setCurrPage(ri, pageI); + Uint32 recMask = sp.m_recMask; + // check if current page + if ((recI & ~recMask) == (ri.m_freeRecI & ~recMask)) { + void* recP = sp.getRecP(recI, ri); + *(Uint32*)recP = ri.m_freeRecI; + ri.m_freeRecI = recI; + } else { + sp.releaseNotCurrent(ri, recI); } - void* recP = sp.getRecP(recI, ri); - *(Uint32*)recP = ri.m_currFreeRecI; - ri.m_currFreeRecI = recI; - Uint32 useCount = ri.m_currUseCount; - assert(useCount != 0); - ri.m_currUseCount = useCount - 1; - ri.m_totalUseCount--; ptr.i = RNIL; ptr.p = 0; } template inline void -RecordPool::free(bool force) +RecordPool::freeAllRecPages(bool force) { SuperPool& sp = m_superPool; - SuperPool::RecInfo& ri = m_recInfo; - sp.setCurrPage(ri, RNIL); - assert(force || ri.m_totalUseCount == 0); - sp.movePages(sp.m_pageList, ri.m_freeList); - sp.movePages(sp.m_pageList, ri.m_activeList); - sp.movePages(sp.m_pageList, ri.m_fullList); - ri.m_totalRecCount = 0; + sp.freeAllRecPages(m_recInfo, force); } +/* + * HeapPool - SuperPool on heap (concrete class) + * + * A super pool based on malloc with memory root on the heap. This + * pool type has 2 realistic uses: + * + * - a small pool with only initial malloc and pageBits set to match + * - the big pool from which all heap allocations are done + * + * A smart malloc may break "ip" limit by using different VM areas for + * different sized requests. For this reason malloc is done in units of + * increment size if possible. Memory root is set to the page-aligned + * address from first page malloc. + */ + +class HeapPool : public SuperPool { +public: + // Describes malloc area. The areas are kept in singly linked list. + // There is a list head and pointers to current and last area. + struct Area { + Area(); + Area* m_nextArea; + PtrI m_firstPageI; + Uint32 m_currPage; + void* m_memory; // from malloc + void* m_pages; // page-aligned pages + Uint32 m_numPages; // number of pages + }; + + // Constructor. + HeapPool(Uint32 pageSize, Uint32 pageBits); + + // Destructor. + virtual ~HeapPool(); + + // Get new page from current area. + virtual PtrI getNewPage(); + + // Allocate fixed arrays. + bool allocInit(); + + // Allocate array of aligned pages. + bool allocArea(Area* ap, Uint32 tryPages); + + // Allocate memory. + virtual bool allocMemory(); + + // List of malloc areas. + Area m_areaHead; + Area* m_currArea; + Area* m_lastArea; +}; + #endif diff --git a/storage/ndb/src/kernel/vm/testSuperPool.cpp b/storage/ndb/src/kernel/vm/testSuperPool.cpp index 194b3a43fa0..3438c12323b 100644 --- a/storage/ndb/src/kernel/vm/testSuperPool.cpp +++ b/storage/ndb/src/kernel/vm/testSuperPool.cpp @@ -1,6 +1,6 @@ #if 0 make -f Makefile -f - testSuperPool <<'_eof_' -testSuperPool: testSuperPool.cpp libkernel.a +testSuperPool: testSuperPool.cpp libkernel.a LinearPool.hpp $(CXXCOMPILE) -o $@ $@.cpp libkernel.a -L../../common/util/.libs -lgeneral _eof_ exit $? @@ -23,6 +23,7 @@ exit $? Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "SuperPool.hpp" +#include "LinearPool.hpp" #include template @@ -56,6 +57,7 @@ random_coprime(Uint32 n) { Uint32 prime[] = { 101, 211, 307, 401, 503, 601, 701, 809, 907 }; Uint32 count = sizeof(prime) / sizeof(prime[0]); + assert(n != 0); while (1) { Uint32 i = urandom(count); if (n % prime[i] != 0) @@ -81,19 +83,22 @@ cmpPtrP(const void* a, const void* b) static Uint32 loopcount = 3; -template -void -sp_test(SuperPool& sp) +template +static void +sp_test(GroupPool& gp) { - typedef A T; - RecordPool rp(sp); + SuperPool& sp = gp.m_superPool; + RecordPool rp(gp); + assert(gp.m_totPages == gp.m_freeList.m_pageCount); SuperPool::RecInfo& ri = rp.m_recInfo; - Uint32 pageCount = sp.m_totalSize / sp.m_pageSize; - Uint32 perPage = rp.m_recInfo.m_maxUseCount; + Uint32 pageCount = sp.m_totPages; + Uint32 perPage = rp.m_recInfo.m_maxPerPage; Uint32 perPool = perPage * pageCount; ndbout << "pages=" << pageCount << " perpage=" << perPage << " perpool=" << perPool << endl; Ptr* ptrList = new Ptr [perPool]; memset(ptrList, 0x1f, perPool * sizeof(Ptr)); + Uint32 verify = 1000; + Uint32 useCount; Uint32 loop; for (loop = 0; loop < loopcount; loop++) { ndbout << "loop " << loop << endl; @@ -101,25 +106,26 @@ sp_test(SuperPool& sp) // seize all ndbout << "seize all" << endl; for (i = 0; i < perPool + 1; i++) { + if (verify == 0 || urandom(perPool) < verify) + sp.verify(ri); j = i; - sp.verify(ri); Ptr ptr1 = { 0, RNIL }; if (! rp.seize(ptr1)) break; - // write value ptr1.p->fill(); ptr1.p->check(); - // verify getPtr Ptr ptr2 = { 0, ptr1.i }; rp.getPtr(ptr2); assert(ptr1.i == ptr2.i && ptr1.p == ptr2.p); - // save ptrList[j] = ptr1; } - assert(i == perPool); - assert(ri.m_totalUseCount == perPool && ri.m_totalRecCount == perPool); sp.verify(ri); + ndbout << "seized " << i << endl; + assert(i == perPool); + useCount = sp.getRecUseCount(ri); + assert(useCount == perPool); // check duplicates + ndbout << "check dups" << endl; { Ptr* ptrList2 = new Ptr [perPool]; memcpy(ptrList2, ptrList, perPool * sizeof(Ptr)); @@ -135,7 +141,8 @@ sp_test(SuperPool& sp) ndbout << "release all" << endl; Uint32 coprime = random_coprime(perPool); for (i = 0; i < perPool; i++) { - sp.verify(ri); + if (verify == 0 || urandom(perPool) < verify) + sp.verify(ri); switch (loop % 3) { case 0: // ascending j = i; @@ -153,27 +160,31 @@ sp_test(SuperPool& sp) rp.release(ptr); assert(ptr.i == RNIL && ptr.p == 0); } - sp.setCurrPage(ri, RNIL); - assert(ri.m_totalUseCount == 0 && ri.m_totalRecCount == 0); sp.verify(ri); + useCount = sp.getRecUseCount(ri); + assert(useCount == 0); // seize/release at random ndbout << "seize/release at random" << endl; for (i = 0; i < loopcount * perPool; i++) { + if (verify == 0 || urandom(perPool) < verify) + sp.verify(ri); j = urandom(perPool); Ptr& ptr = ptrList[j]; if (ptr.i == RNIL) { - rp.seize(ptr); - ptr.p->fill(); + if (rp.seize(ptr)) + ptr.p->fill(); } else { ptr.p->check(); rp.release(ptr); } } - ndbout << "used " << ri.m_totalUseCount << endl; + ndbout << "used " << ri.m_useCount << endl; sp.verify(ri); // release all ndbout << "release all" << endl; for (i = 0; i < perPool; i++) { + if (verify == 0 || urandom(perPool) < verify) + sp.verify(ri); j = i; Ptr& ptr = ptrList[j]; if (ptr.i != RNIL) { @@ -181,40 +192,173 @@ sp_test(SuperPool& sp) rp.release(ptr); } } - sp.setCurrPage(ri, RNIL); - assert(ri.m_totalUseCount == 0 && ri.m_totalRecCount == 0); sp.verify(ri); + useCount = sp.getRecUseCount(ri); + assert(useCount == 0); } // done delete [] ptrList; } -static Uint32 pageCount = 99; +template +static void +lp_test(GroupPool& gp) +{ + SuperPool& sp = gp.m_superPool; + LinearPool lp(gp); + ndbout << "linear pool test" << endl; + Ptr ptr; + Uint32 loop; + for (loop = 0; loop < loopcount; loop++) { + int count = 0; + while (1) { + bool ret = lp.seize(ptr); + lp.verify(); + if (! ret) + break; + assert(ptr.i == count); + Ptr ptr2; + ptr2.i = ptr.i; + ptr2.p = 0; + lp.getPtr(ptr2); + assert(ptr.p == ptr2.p); + count++; + } + assert(count != 0); + ndbout << "seized " << count << endl; + switch (loop % 3) { + case 0: + { + int n = 0; + while (n < count) { + ptr.i = n; + lp.release(ptr); + lp.verify(); + n++; + } + ndbout << "released in order" << endl; + } + break; + case 1: + { + int n = count; + while (n > 0) { + n--; + ptr.i = n; + lp.release(ptr); + lp.verify(); + } + ndbout << "released in reverse" << endl; + } + break; + default: + { + int coprime = random_coprime(count); + int n = 0; + while (n < count) { + int m = (coprime * n) % count; + ptr.i = m; + lp.release(ptr); + lp.verify(); + n++; + } + ndbout << "released at random" << endl; + } + break; + } + { Uint32 cnt = lp.count(); assert(cnt == 0); } + // seize_index test + char *used = new char [10 * count]; + memset(used, false, sizeof(used)); + Uint32 i, ns = 0, nr = 0; + for (i = 0; i < count; i++) { + Uint32 index = urandom(10 * count); + if (used[index]) { + ptr.i = index; + lp.release(ptr); + lp.verify(); + nr++; + } else { + int i = lp.seize_index(ptr, index); + assert(i >= 0); + lp.verify(); + if (i == 0) // no space + continue; + assert(ptr.i == index); + Ptr ptr2; + ptr2.i = ptr.i; + ptr2.p = 0; + lp.getPtr(ptr2); + assert(ptr.p == ptr2.p); + ns++; + } + used[index] = ! used[index]; + } + ndbout << "random sparse seize " << ns << " release " << nr << endl; + nr = 0; + for (i = 0; i < 10 * count; i++) { + if (used[i]) { + ptr.i = i; + lp.release(ptr); + lp.verify(); + used[i] = false; + nr++; + } + } + ndbout << "released " << nr << endl; + { Uint32 cnt = lp.count(); assert(cnt == 0); } + } +} + static Uint32 pageSize = 32768; -static Uint32 pageBits = 15; +static Uint32 pageBits = 17; -const Uint32 sz1 = 3, sz2 = 4, sz3 = 53, sz4 = 424, sz5 = 5353; +const Uint32 sz1 = 3; +const Uint32 sz2 = 4; +const Uint32 sz3 = 53; +const Uint32 sz4 = 424; +const Uint32 sz5 = 5353; -template void sp_test(SuperPool& sp); -template void sp_test(SuperPool& sp); -template void sp_test(SuperPool& sp); -template void sp_test(SuperPool& sp); -template void sp_test(SuperPool& sp); +typedef A T1; +typedef A T2; +typedef A T3; +typedef A T4; +typedef A T5; + +template static void sp_test(GroupPool& sp); +template static void sp_test(GroupPool& sp); +template static void sp_test(GroupPool& sp); +template static void sp_test(GroupPool& sp); +template static void sp_test(GroupPool& sp); +// +template static void lp_test(GroupPool& sp); int -main() +main(int argc, char** argv) { + if (argc > 1 && strncmp(argv[1], "-l", 2) == 0) + loopcount = atoi(argv[1] + 2); HeapPool sp(pageSize, pageBits); - sp.setSizes(pageCount * pageSize); - if (! sp.init()) + sp.setInitPages(7); + sp.setMaxPages(7); + if (! sp.allocMemory()) assert(false); + GroupPool gp(sp); Uint16 s = (Uint16)getpid(); srandom(s); ndbout << "rand " << s << endl; - sp_test(sp); - sp_test(sp); - sp_test(sp); - sp_test(sp); - sp_test(sp); + int count; + count = 0; + while (++count <= 0) { // change to 1 to find new bug + sp_test(gp); + sp_test(gp); + sp_test(gp); + sp_test(gp); + sp_test(gp); + } + count = 0; + while (++count <= 1) { + lp_test(gp); + } return 0; } diff --git a/storage/ndb/src/mgmapi/mgmapi.cpp b/storage/ndb/src/mgmapi/mgmapi.cpp index 2b31f0e638d..79284964186 100644 --- a/storage/ndb/src/mgmapi/mgmapi.cpp +++ b/storage/ndb/src/mgmapi/mgmapi.cpp @@ -336,10 +336,16 @@ ndb_mgm_call(NdbMgmHandle handle, const ParserRow *command_reply, const Properties* p = parser.parse(ctx, session); if (p == NULL){ if(!ndb_mgm_is_connected(handle)) { - return NULL; + DBUG_RETURN(NULL); } else { + if(ctx.m_status==Parser_t::Eof + || ctx.m_status==Parser_t::NoLine) + { + ndb_mgm_disconnect(handle); + DBUG_RETURN(NULL); + } /** * Print some info about why the parser returns NULL */ diff --git a/storage/ndb/src/ndbapi/Ndb.cpp b/storage/ndb/src/ndbapi/Ndb.cpp index 50f2123a811..8bfedc2f96f 100644 --- a/storage/ndb/src/ndbapi/Ndb.cpp +++ b/storage/ndb/src/ndbapi/Ndb.cpp @@ -1300,7 +1300,12 @@ Uint64 Ndb::getLatestGCI() void Ndb::setReportThreshEventGCISlip(unsigned thresh) { - theEventBuffer->m_gci_slip_thresh= thresh; + if (theEventBuffer->m_free_thresh != thresh) + { + theEventBuffer->m_free_thresh= thresh; + theEventBuffer->m_min_free_thresh= thresh; + theEventBuffer->m_max_free_thresh= 100; + } } void Ndb::setReportThreshEventFreeMem(unsigned thresh) diff --git a/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp b/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp index 76352a9000c..1fa0c6386be 100644 --- a/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp +++ b/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp @@ -539,6 +539,8 @@ NdbEventBuffer::NdbEventBuffer(Ndb *ndb) : m_latestGCI(0), m_total_alloc(0), m_free_thresh(10), + m_min_free_thresh(10), + m_max_free_thresh(100), m_gci_slip_thresh(3), m_dropped_ev_op(0), m_active_op_count(0) @@ -635,8 +637,6 @@ int NdbEventBuffer::expand(unsigned sz) EventBufData_chunk *chunk_data= (EventBufData_chunk *)NdbMem_Allocate(alloc_size); - m_total_alloc+= alloc_size; - chunk_data->sz= sz; m_allocated_data.push_back(chunk_data); @@ -855,6 +855,11 @@ find_bucket(Vector * active, Uint64 gci) void NdbEventBuffer::execSUB_GCP_COMPLETE_REP(const SubGcpCompleteRep * const rep) { + if (unlikely(m_active_op_count == 0)) + { + return; + } + DBUG_ENTER("NdbEventBuffer::execSUB_GCP_COMPLETE_REP"); const Uint64 gci= rep->gci; @@ -862,11 +867,6 @@ NdbEventBuffer::execSUB_GCP_COMPLETE_REP(const SubGcpCompleteRep * const rep) Gci_container *bucket = find_bucket(&m_active_gci, gci); - if (unlikely(m_active_op_count == 0)) - { - DBUG_VOID_RETURN; - } - if (unlikely(bucket == 0)) { /** @@ -902,8 +902,8 @@ NdbEventBuffer::execSUB_GCP_COMPLETE_REP(const SubGcpCompleteRep * const rep) assert(bucket->m_data.m_count); #endif m_complete_data.m_data.append(bucket->m_data); - reportStatus(); } + reportStatus(); bzero(bucket, sizeof(Gci_container)); bucket->m_gci = gci + ACTIVE_GCI_DIRECTORY_SIZE; bucket->m_gcp_complete_rep_count = m_system_nodes; @@ -1356,23 +1356,47 @@ NdbEventBuffer::reportStatus() else apply_gci= latest_gci; - if (100*m_free_data_sz < m_free_thresh*m_total_alloc || - latest_gci-apply_gci >= m_gci_slip_thresh) + if (100*m_free_data_sz < m_min_free_thresh*m_total_alloc && + m_total_alloc > 1024*1024) { - Uint32 data[8]; - data[0]= NDB_LE_EventBufferStatus; - data[1]= m_total_alloc-m_free_data_sz; - data[2]= m_total_alloc; - data[3]= 0; - data[4]= apply_gci & ~(Uint32)0; - data[5]= apply_gci >> 32; - data[6]= latest_gci & ~(Uint32)0; - data[7]= latest_gci >> 32; - m_ndb->theImpl->send_event_report(data,8); -#ifdef VM_TRACE - assert(m_total_alloc >= m_free_data_sz); -#endif + /* report less free buffer than m_free_thresh, + next report when more free than 2 * m_free_thresh + */ + m_min_free_thresh= 0; + m_max_free_thresh= 2 * m_free_thresh; + goto send_report; } + + if (100*m_free_data_sz > m_max_free_thresh*m_total_alloc && + m_total_alloc > 1024*1024) + { + /* report more free than 2 * m_free_thresh + next report when less free than m_free_thresh + */ + m_min_free_thresh= m_free_thresh; + m_max_free_thresh= 100; + goto send_report; + } + if (latest_gci-apply_gci >= m_gci_slip_thresh) + { + goto send_report; + } + return; + +send_report: + Uint32 data[8]; + data[0]= NDB_LE_EventBufferStatus; + data[1]= m_total_alloc-m_free_data_sz; + data[2]= m_total_alloc; + data[3]= 0; + data[4]= apply_gci & ~(Uint32)0; + data[5]= apply_gci >> 32; + data[6]= latest_gci & ~(Uint32)0; + data[7]= latest_gci >> 32; + m_ndb->theImpl->send_event_report(data,8); +#ifdef VM_TRACE + assert(m_total_alloc >= m_free_data_sz); +#endif } template class Vector; diff --git a/storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp b/storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp index 0436cea66ce..542a4a594a5 100644 --- a/storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp +++ b/storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp @@ -271,7 +271,7 @@ public: unsigned m_total_alloc; // total allocated memory // threshholds to report status - unsigned m_free_thresh; + unsigned m_free_thresh, m_min_free_thresh, m_max_free_thresh; unsigned m_gci_slip_thresh; NdbError m_error; diff --git a/storage/ndb/src/ndbapi/NdbImpl.hpp b/storage/ndb/src/ndbapi/NdbImpl.hpp index 30e0d28a765..b24d10da9b2 100644 --- a/storage/ndb/src/ndbapi/NdbImpl.hpp +++ b/storage/ndb/src/ndbapi/NdbImpl.hpp @@ -95,11 +95,9 @@ public: /** * NOTE free lists must be _after_ theNdbObjectIdMap take * assure that destructors are run in correct order + * NOTE these has to be in this specific order to make destructor run in + * correct order */ - Ndb_free_list_t theConIdleList; - Ndb_free_list_t theOpIdleList; - Ndb_free_list_t theScanOpIdleList; - Ndb_free_list_t theIndexOpIdleList; Ndb_free_list_t theRecAttrIdleList; Ndb_free_list_t theSignalIdleList; Ndb_free_list_t theLabelList; @@ -108,6 +106,10 @@ public: Ndb_free_list_t theCallList; Ndb_free_list_t theNdbBlobIdleList; Ndb_free_list_t theScanList; + Ndb_free_list_t theScanOpIdleList; + Ndb_free_list_t theOpIdleList; + Ndb_free_list_t theIndexOpIdleList; + Ndb_free_list_t theConIdleList; }; #ifdef VM_TRACE diff --git a/storage/ndb/src/ndbapi/NdbIndexStat.cpp b/storage/ndb/src/ndbapi/NdbIndexStat.cpp index 2d470249561..8740b80a81d 100644 --- a/storage/ndb/src/ndbapi/NdbIndexStat.cpp +++ b/storage/ndb/src/ndbapi/NdbIndexStat.cpp @@ -423,11 +423,13 @@ NdbIndexStat::records_in_range(NdbDictionary::Index* index, NdbIndexScanOperatio NdbTransaction* trans = op->m_transConnection; if (op->interpret_exit_last_row() == -1 || op->getValue(NdbDictionary::Column::RECORDS_IN_RANGE, (char*)out) == 0) { + m_error = op->getNdbError(); DBUG_PRINT("error", ("op:%d", op->getNdbError().code)); DBUG_RETURN(-1); } if (trans->execute(NdbTransaction::NoCommit, NdbTransaction::AbortOnError, forceSend) == -1) { + m_error = trans->getNdbError(); DBUG_PRINT("error", ("trans:%d op:%d", trans->getNdbError().code, op->getNdbError().code)); DBUG_RETURN(-1); @@ -443,6 +445,7 @@ NdbIndexStat::records_in_range(NdbDictionary::Index* index, NdbIndexScanOperatio cnt++; } if (ret == -1) { + m_error = op->getNdbError(); DBUG_PRINT("error", ("trans:%d op:%d", trans->getNdbError().code, op->getNdbError().code)); DBUG_RETURN(-1); diff --git a/storage/ndb/src/ndbapi/NdbRecAttr.cpp b/storage/ndb/src/ndbapi/NdbRecAttr.cpp index 796be2b14e9..a03dd6c536f 100644 --- a/storage/ndb/src/ndbapi/NdbRecAttr.cpp +++ b/storage/ndb/src/ndbapi/NdbRecAttr.cpp @@ -24,6 +24,7 @@ NdbRecAttr::NdbRecAttr(Ndb*) { + theStorageX = 0; init(); } @@ -50,6 +51,9 @@ NdbRecAttr::setup(const NdbColumnImpl* anAttrInfo, char* aValue) theAttrId = anAttrInfo->m_attrId; m_size_in_bytes = tAttrByteSize; theValue = aValue; + + if (theStorageX) + delete[] theStorageX; // check alignment to signal data // a future version could check alignment per data type as well diff --git a/storage/ndb/test/ndbapi/bank/BankLoad.cpp b/storage/ndb/test/ndbapi/bank/BankLoad.cpp index 34947019a51..78fd6c7d678 100644 --- a/storage/ndb/test/ndbapi/bank/BankLoad.cpp +++ b/storage/ndb/test/ndbapi/bank/BankLoad.cpp @@ -23,7 +23,7 @@ */ struct AccountTypesStruct { int id; - const char* descr; + const char descr[64]; }; const AccountTypesStruct accountTypes[] = { { 0, "KASSA"}, diff --git a/storage/ndb/test/ndbapi/testNdbApi.cpp b/storage/ndb/test/ndbapi/testNdbApi.cpp index f456d852898..dd0628bb1b1 100644 --- a/storage/ndb/test/ndbapi/testNdbApi.cpp +++ b/storage/ndb/test/ndbapi/testNdbApi.cpp @@ -1141,6 +1141,21 @@ int runBug_11133(NDBT_Context* ctx, NDBT_Step* step){ return result; } +int runBug_WritePartialIgnoreError(NDBT_Context* ctx, NDBT_Step* step){ + int result = NDBT_OK; + const NdbDictionary::Table* pTab = ctx->getTab(); + + HugoOperations hugoOps(*pTab); + + Ndb* pNdb = GETNDB(step); + C2(hugoOps.startTransaction(pNdb) == 0); + C2(hugoOps.pkWritePartialRecord(pNdb, 0, 1) == 0); + C2(hugoOps.execute_Commit(pNdb, AO_IgnoreError) == 0); + C2(hugoOps.closeTransaction(pNdb) == 0); + + return result; +} + int runScan_4006(NDBT_Context* ctx, NDBT_Step* step){ int result = NDBT_OK; const Uint32 max= 5; @@ -1317,6 +1332,11 @@ TESTCASE("Bug_11133", INITIALIZER(runBug_11133); FINALIZER(runClearTable); } +TESTCASE("Bug_WritePartialIgnoreError", + "Test WritePartialIgnoreError\n"){ + INITIALIZER(runBug_WritePartialIgnoreError); + FINALIZER(runClearTable); +} TESTCASE("Scan_4006", "Check that getNdbScanOperation does not get 4006\n"){ INITIALIZER(runLoadTable); diff --git a/storage/ndb/test/run-test/daily-basic-tests.txt b/storage/ndb/test/run-test/daily-basic-tests.txt index ca4cc10f8cd..12f4a7bd6e5 100644 --- a/storage/ndb/test/run-test/daily-basic-tests.txt +++ b/storage/ndb/test/run-test/daily-basic-tests.txt @@ -528,6 +528,10 @@ max-time: 500 cmd: testNdbApi args: -n Scan_4006 T1 D1 D2 +max-time: 500 +cmd: testNdbApi +args: -n Bug_WritePartialIgnoreError T1 + #max-time: 500 #cmd: testInterpreter #args: T1 diff --git a/storage/ndb/test/run-test/make-config.sh b/storage/ndb/test/run-test/make-config.sh index e82acb8a7dd..a5ea2e58ae6 100755 --- a/storage/ndb/test/run-test/make-config.sh +++ b/storage/ndb/test/run-test/make-config.sh @@ -44,7 +44,7 @@ add_proc (){ ;; mysqld) echo "$proc_no.mysqld" >> $dir_file - echo "[ndb_mgmd]" >> $config_file + echo "[mysqld]" >> $config_file echo "Id: $node_id" >> $config_file echo "HostName: $2" >> $config_file node_id=`expr $node_id + 1` diff --git a/storage/ndb/test/tools/listen.cpp b/storage/ndb/test/tools/listen.cpp index 05edb012fdb..cffe256bf40 100644 --- a/storage/ndb/test/tools/listen.cpp +++ b/storage/ndb/test/tools/listen.cpp @@ -64,7 +64,6 @@ main(int argc, const char** argv){ ndbout << "Waiting for ndb to become ready..." << endl; int result = 0; - Uint64 last_gci= 0, cnt= 0; NdbDictionary::Dictionary *myDict = MyNdb.getDictionary(); Vector events; @@ -91,7 +90,7 @@ main(int argc, const char** argv){ { if(myDict->getNdbError().classification == NdbError::SchemaObjectExists) { - g_info << "Event creation failed event exists\n"; + g_info << "Event creation failed event exists. Removing...\n"; if (myDict->dropEvent(name.c_str())) { g_err << "Failed to drop event: " << myDict->getNdbError() << endl; @@ -146,19 +145,37 @@ main(int argc, const char** argv){ { while(MyNdb.pollEvents(100) == 0); - NdbEventOperation* pOp; - while((pOp= MyNdb.nextEvent()) != 0) + NdbEventOperation* pOp= MyNdb.nextEvent(); + while(pOp) { - if(pOp->getGCI() != last_gci) + Uint64 gci= pOp->getGCI(); + Uint64 cnt_i= 0, cnt_u= 0, cnt_d= 0; + do { - if(cnt) ndbout_c("GCI: %lld events: %lld", last_gci, cnt); - cnt= 1; - last_gci= pOp->getGCI(); - } - else - { - cnt++; - } + switch(pOp->getEventType()) + { + case NdbDictionary::Event::TE_INSERT: + cnt_i++; + break; + case NdbDictionary::Event::TE_DELETE: + cnt_d++; + break; + case NdbDictionary::Event::TE_UPDATE: + cnt_u++; + break; + case NdbDictionary::Event::TE_CLUSTER_FAILURE: + break; + case NdbDictionary::Event::TE_ALTER: + break; + case NdbDictionary::Event::TE_DROP: + break; + default: + /* We should REALLY never get here. */ + ndbout_c("Error: unknown event type"); + abort(); + } + } while ((pOp= MyNdb.nextEvent()) && gci == pOp->getGCI()); + ndbout_c("GCI: %lld events: %lld(I) %lld(U) %lld(D)", gci, cnt_i, cnt_u, cnt_d); } } end: diff --git a/storage/ndb/tools/ndb_size.pl b/storage/ndb/tools/ndb_size.pl index 64a20423636..ece0901e0b2 100644 --- a/storage/ndb/tools/ndb_size.pl +++ b/storage/ndb/tools/ndb_size.pl @@ -26,24 +26,33 @@ use HTML::Template; # BUGS # ---- # - enum/set is 0 byte storage! Woah - efficient! +# - DECIMAL is 0 byte storage. A bit too efficient. # - some float stores come out weird (when there's a comma e.g. 'float(4,1)') # - no disk data values # - computes the storage requirements of views (and probably MERGE) # - ignores character sets. my $template = HTML::Template->new(filename => 'ndb_size.tmpl', - die_on_bad_params => 0); + die_on_bad_params => 0) + or die "Could not open ndb_size.tmpl."; my $dbh; +if(@ARGV < 3 || $ARGV[0] eq '--usage' || $ARGV[0] eq '--help') +{ + print STDERR "Usage:\n"; + print STDERR "\tndb_size.pl database hostname user password\n\n"; + print STDERR "If you need to specify a port number, use host:port\n\n"; + exit(1); +} + { my $database= $ARGV[0]; my $hostname= $ARGV[1]; - my $port= $ARGV[2]; - my $user= $ARGV[3]; - my $password= $ARGV[4]; - my $dsn = "DBI:mysql:database=$database;host=$hostname;port=$port"; - $dbh= DBI->connect($dsn, $user, $password); + my $user= $ARGV[2]; + my $password= $ARGV[3]; + my $dsn = "DBI:mysql:database=$database;host=$hostname"; + $dbh= DBI->connect($dsn, $user, $password) or exit(1); $template->param(db => $database); $template->param(dsn => $dsn); } @@ -55,6 +64,14 @@ my $tables = $dbh->selectall_arrayref("show tables"); my @table_size; +my @dbDataMemory; +my @dbIndexMemory; +my @NoOfAttributes; +my @NoOfIndexes; +my @NoOfTables; +$NoOfTables[$_]{val} = @{$tables} foreach 0..$#releases; + + sub align { my($to,@unaligned) = @_; my @aligned; @@ -68,9 +85,8 @@ foreach(@{$tables}) { my $table= @{$_}[0]; my @columns; - my $info= $dbh->selectall_hashref("describe ".$dbh->quote($table),"Field"); - my @count = $dbh->selectrow_array("select count(*) from " - .$dbh->quote($table)); + my $info= $dbh->selectall_hashref('describe `'.$table.'`',"Field"); + my @count = $dbh->selectrow_array('select count(*) from `'.$table.'`'); my %columnsize; # used for index calculations # We now work out the DataMemory usage @@ -132,14 +148,17 @@ foreach(@{$tables}) my $fixed= 1+$size; my @dynamic=$dbh->selectrow_array("select avg(length(" .$dbh->quote($name) - .")) from ".$dbh->quote($table)); + .")) from `".$table.'`'); $dynamic[0]=0 if !$dynamic[0]; @realsize= ($fixed,$fixed,ceil($dynamic[0])); } elsif($type =~ /binary/ || $type =~ /char/) {@realsize=($size,$size,$size)} elsif($type =~ /text/ || $type =~ /blob/) - {@realsize=(256,256,1)} # FIXME check if 5.1 is correct + { + @realsize=(256,256,1); + $NoOfTables[$_]{val} += 1 foreach 0..$#releases; # blob uses table + } # FIXME check if 5.1 is correct @realsize= align(4,@realsize); @@ -166,7 +185,7 @@ foreach(@{$tables}) # we can still connect to pre-5.0 mysqlds. my %indexes; { - my $sth= $dbh->prepare("show index from "$dbh->quote($table)); + my $sth= $dbh->prepare("show index from `".$table.'`'); $sth->execute; while(my $i = $sth->fetchrow_hashref) { @@ -257,7 +276,51 @@ foreach(@{$tables}) IndexMemory=>\@IndexMemory, }; + + $dbDataMemory[$_]{val} += $DataMemory[$_]{val} foreach 0..$#releases; + $dbIndexMemory[$_]{val} += $IndexMemory[$_]{val} foreach 0..$#releases; + $NoOfAttributes[$_]{val} += @columns foreach 0..$#releases; + $NoOfIndexes[$_]{val} += @indexes foreach 0..$#releases; +} + +my @NoOfTriggers; +# for unique hash indexes +$NoOfTriggers[$_]{val} += $NoOfIndexes[$_]{val}*3 foreach 0..$#releases; +# for ordered index +$NoOfTriggers[$_]{val} += $NoOfIndexes[$_]{val} foreach 0..$#releases; + +my @ParamMemory; +foreach (0..$#releases) { + $ParamMemory[0]{releases}[$_]{val}= POSIX::ceil(200*$NoOfAttributes[$_]{val}/1024); + $ParamMemory[0]{name}= 'Attributes'; + + $ParamMemory[1]{releases}[$_]{val}= 20*$NoOfTables[$_]{val}; + $ParamMemory[1]{name}= 'Tables'; + + $ParamMemory[2]{releases}[$_]{val}= 10*$NoOfIndexes[$_]{val}; + $ParamMemory[2]{name}= 'OrderedIndexes'; + + $ParamMemory[3]{releases}[$_]{val}= 15*$NoOfIndexes[$_]{val}; + $ParamMemory[3]{name}= 'UniqueHashIndexes'; } $template->param(tables => \@table_size); +$template->param(Parameters => [{name=>'DataMemory (kb)', + releases=>\@dbDataMemory}, + {name=>'IndexMemory (kb)', + releases=>\@dbIndexMemory}, + {name=>'MaxNoOfTables', + releases=>\@NoOfTables}, + {name=>'MaxNoOfAttributes', + releases=>\@NoOfAttributes}, + {name=>'MaxNoOfOrderedIndexes', + releases=>\@NoOfIndexes}, + {name=>'MaxNoOfUniqueHashIndexes', + releases=>\@NoOfIndexes}, + {name=>'MaxNoOfTriggers', + releases=>\@NoOfTriggers} + ] + ); +$template->param(ParamMemory => \@ParamMemory); + print $template->output; diff --git a/storage/ndb/tools/ndb_size.tmpl b/storage/ndb/tools/ndb_size.tmpl index d83d5d2c6af..dc02b5a5970 100644 --- a/storage/ndb/tools/ndb_size.tmpl +++ b/storage/ndb/tools/ndb_size.tmpl @@ -13,18 +13,58 @@ td,th { border: 1px solid black }

MySQL Cluster analysis for

This is an automated analysis of the database for migration into MySQL Cluster. No warranty is made to the accuracy of the information.

-

This information should be valid for MySQL 4.1

+

This information should be valid for MySQL 4.1 and 5.0. Since 5.1 is not a final release yet, the numbers should be used as a guide only.

+

Parameter Settings

+

NOTE the configuration parameters below do not take into account system tables and other requirements.

+ + + + + + + + + + + + + + + +
Parameter
+ +

Memory usage because of parameters

+ +

Usage is in kilobytes. Actual usage will vary as you should set the parameters larger than those listed in the table above.

+ + + + + + + + + + + + + + + +
Parameter
+ +

Table List


-

+

">

diff --git a/strings/decimal.c b/strings/decimal.c index f536bdb1d6b..9cf4a281be2 100644 --- a/strings/decimal.c +++ b/strings/decimal.c @@ -972,12 +972,18 @@ int decimal2double(decimal_t *from, double *to) int double2decimal(double from, decimal_t *to) { /* TODO: fix it, when we'll have dtoa */ - char s[400], *end; - sprintf(s, "%f", from); - end= strend(s); - return string2decimal(s, to, &end); + char buff[400], *end; + int length, res; + DBUG_ENTER("double2decimal"); + length= my_sprintf(buff, (buff, "%.16G", from)); + DBUG_PRINT("info",("from: %g from_as_str: %s", from, buff)); + end= buff+length; + res= string2decimal(buff, to, &end); + DBUG_PRINT("exit", ("res: %d", res)); + DBUG_RETURN(res); } + static int ull2dec(ulonglong from, decimal_t *to) { int intg1, error=E_DEC_OK; diff --git a/strings/strxnmov.c b/strings/strxnmov.c index 3ef0e57650c..7f5d483061c 100644 --- a/strings/strxnmov.c +++ b/strings/strxnmov.c @@ -22,19 +22,17 @@ strxnmov(dst, len, src1, ..., srcn, NullS) moves the first len characters of the concatenation of src1,...,srcn - to dst. If there aren't that many characters, a NUL character will - be added to the end of dst to terminate it properly. This gives the - same effect as calling strxcpy(buff, src1, ..., srcn, NullS) with a - large enough buffer, and then calling strnmov(dst, buff, len). + to dst and add a closing NUL character. It is just like strnmov except that it concatenates multiple sources. Beware: the last argument should be the null character pointer. Take VERY great care not to omit it! Also be careful to use NullS and NOT to use 0, as on some machines 0 is not the same size as a character pointer, or not the same bit pattern as NullS. - Note: strxnmov is like strnmov in that it moves up to len - characters; dst will be padded on the right with one NUL characters if - needed. + NOTE + strxnmov is like strnmov in that it moves up to len + characters; dst will be padded on the right with one '\0' character. + if total-string-length >= length then dst[length] will be set to \0 */ #include @@ -58,8 +56,8 @@ char *strxnmov(char *dst,uint len, const char *src, ...) dst--; src = va_arg(pvar, char *); } - *dst=0; end: + *dst=0; va_end(pvar); return dst; } diff --git a/support-files/Makefile.am b/support-files/Makefile.am index 972d1dc7038..26d51438a1b 100644 --- a/support-files/Makefile.am +++ b/support-files/Makefile.am @@ -107,7 +107,5 @@ SUFFIXES = .sh $< > $@-t @MV@ $@-t $@ -all: binary-configure - # Don't update the files from bitkeeper %::SCCS/s.% diff --git a/support-files/my-large.cnf.sh b/support-files/my-large.cnf.sh index 4dc3f929c48..769684529e7 100644 --- a/support-files/my-large.cnf.sh +++ b/support-files/my-large.cnf.sh @@ -115,7 +115,7 @@ server-id = 1 #log-update = /path-to-dedicated-directory/hostname # Uncomment the following if you are using BDB tables -#bdb_cache_size = 64M +#bdb_cache_size = 256M #bdb_max_lock = 100000 # Uncomment the following if you are using InnoDB tables diff --git a/support-files/my-medium.cnf.sh b/support-files/my-medium.cnf.sh index 99b6e823f39..7cca12338a2 100644 --- a/support-files/my-medium.cnf.sh +++ b/support-files/my-medium.cnf.sh @@ -113,7 +113,7 @@ server-id = 1 #log-update = /path-to-dedicated-directory/hostname # Uncomment the following if you are using BDB tables -#bdb_cache_size = 4M +#bdb_cache_size = 16M #bdb_max_lock = 10000 # Uncomment the following if you are using InnoDB tables diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 27aa05ebf27..d93cb1f2176 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -361,8 +361,9 @@ BuildMySQL "--disable-shared \ %if %{STATIC_BUILD} --with-mysqld-ldflags='-all-static' \ --with-client-ldflags='-all-static' \ - --with-zlib-dir=bundled \ $USE_OTHER_LIBC_DIR \ +%else + --with-zlib-dir=bundled \ %endif --with-comment=\"MySQL Community Edition - Standard (GPL)\" \ --with-server-suffix='%{server_suffix}' \ @@ -507,22 +508,22 @@ echo "Restarting mysqld." %preun server if test $1 = 0 then - # Stop MySQL before uninstalling it + # Stop MySQL before uninstalling it if test -x %{_sysconfdir}/init.d/mysql then %{_sysconfdir}/init.d/mysql stop > /dev/null - fi - # Remove autostart of mysql - # for older SuSE Linux versions - if test -x /sbin/insserv - then - /sbin/insserv -r %{_sysconfdir}/init.d/mysql - # use chkconfig on Red Hat and newer SuSE releases - elif test -x /sbin/chkconfig - then - /sbin/chkconfig --del mysql - fi + # Remove autostart of mysql + # for older SuSE Linux versions + if test -x /sbin/insserv + then + /sbin/insserv -r %{_sysconfdir}/init.d/mysql + # use chkconfig on Red Hat and newer SuSE releases + elif test -x /sbin/chkconfig + then + /sbin/chkconfig --del mysql + fi + fi fi # We do not remove the mysql user since it may still own a lot of @@ -705,6 +706,11 @@ fi # itself - note that they must be ordered by date (important when # merging BK trees) %changelog +* Tue Nov 22 2005 Joerg Bruehe + +- Extend the file existence check for "init.d/mysql" on un-install + to also guard the call to "insserv"/"chkconfig". + * Thu Oct 27 2005 Lenz Grimmer - added more man pages diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 949c3d5bf1c..ce732690700 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -14419,6 +14419,177 @@ static void test_bug14210() myquery(rc); } +/* Bug#13488: wrong column metadata when fetching from cursor */ + +static void test_bug13488() +{ + MYSQL_BIND bind[3]; + MYSQL_STMT *stmt1; + int rc, f1, f2, f3, i; + const ulong type= CURSOR_TYPE_READ_ONLY; + const char *query= "select * from t1 left join t2 on f1=f2 where f1=1"; + + myheader("test_bug13488"); + + rc= mysql_query(mysql, "drop table if exists t1, t2"); + myquery(rc); + rc= mysql_query(mysql, "create table t1 (f1 int not null primary key)"); + myquery(rc); + rc= mysql_query(mysql, "create table t2 (f2 int not null primary key, " + "f3 int not null)"); + myquery(rc); + rc= mysql_query(mysql, "insert into t1 values (1), (2)"); + myquery(rc); + rc= mysql_query(mysql, "insert into t2 values (1,2), (2,4)"); + myquery(rc); + + memset(bind, 0, sizeof(bind)); + for (i= 0; i < 3; i++) + { + bind[i].buffer_type= MYSQL_TYPE_LONG; + bind[i].buffer_length= 4; + bind[i].length= 0; + } + bind[0].buffer=&f1; + bind[1].buffer=&f2; + bind[2].buffer=&f3; + + stmt1= mysql_stmt_init(mysql); + rc= mysql_stmt_attr_set(stmt1,STMT_ATTR_CURSOR_TYPE, (const void *)&type); + check_execute(stmt1, rc); + + rc= mysql_stmt_prepare(stmt1, query, strlen(query)); + check_execute(stmt1, rc); + + rc= mysql_stmt_execute(stmt1); + check_execute(stmt1, rc); + + rc= mysql_stmt_bind_result(stmt1, bind); + check_execute(stmt1, rc); + + rc= mysql_stmt_fetch(stmt1); + check_execute(stmt1, rc); + + rc= mysql_stmt_free_result(stmt1); + check_execute(stmt1, rc); + + rc= mysql_stmt_reset(stmt1); + check_execute(stmt1, rc); + + rc= mysql_stmt_close(stmt1); + check_execute(stmt1, rc); + + if (!opt_silent) + printf("data is: %s", (f1 == 1 && f2 == 1 && f3 == 2)?"OK": + "wrong"); + DIE_UNLESS(f1 == 1 && f2 == 1 && f3 == 2); + rc= mysql_query(mysql, "drop table t1, t2"); + myquery(rc); +} + +/* + Bug#13524: warnings of a previous command are not reset when fetching + from a cursor. +*/ + +static void test_bug13524() +{ + MYSQL_STMT *stmt; + int rc; + unsigned int warning_count; + const ulong type= CURSOR_TYPE_READ_ONLY; + const char *query= "select * from t1"; + + myheader("test_bug13524"); + + rc= mysql_query(mysql, "drop table if exists t1, t2"); + myquery(rc); + rc= mysql_query(mysql, "create table t1 (a int not null primary key)"); + myquery(rc); + rc= mysql_query(mysql, "insert into t1 values (1), (2), (3), (4)"); + myquery(rc); + + stmt= mysql_stmt_init(mysql); + rc= mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (const void*) &type); + check_execute(stmt, rc); + + rc= mysql_stmt_prepare(stmt, query, strlen(query)); + check_execute(stmt, rc); + + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); + + warning_count= mysql_warning_count(mysql); + DIE_UNLESS(warning_count == 0); + + /* Check that DROP TABLE produced a warning (no such table) */ + rc= mysql_query(mysql, "drop table if exists t2"); + myquery(rc); + warning_count= mysql_warning_count(mysql); + DIE_UNLESS(warning_count == 1); + + /* + Check that fetch from a cursor cleared the warning from the previous + command. + */ + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); + warning_count= mysql_warning_count(mysql); + DIE_UNLESS(warning_count == 0); + + /* Cleanup */ + mysql_stmt_close(stmt); + rc= mysql_query(mysql, "drop table t1"); + myquery(rc); +} + +/* + Bug#14845 "mysql_stmt_fetch returns MYSQL_NO_DATA when COUNT(*) is 0" +*/ + +static void test_bug14845() +{ + MYSQL_STMT *stmt; + int rc; + const ulong type= CURSOR_TYPE_READ_ONLY; + const char *query= "select count(*) from t1 where 1 = 0"; + + myheader("test_bug14845"); + + rc= mysql_query(mysql, "drop table if exists t1"); + myquery(rc); + rc= mysql_query(mysql, "create table t1 (id int(11) default null, " + "name varchar(20) default null)" + "engine=MyISAM DEFAULT CHARSET=utf8"); + myquery(rc); + rc= mysql_query(mysql, "insert into t1 values (1,'abc'),(2,'def')"); + myquery(rc); + + stmt= mysql_stmt_init(mysql); + rc= mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (const void*) &type); + check_execute(stmt, rc); + + rc= mysql_stmt_prepare(stmt, query, strlen(query)); + check_execute(stmt, rc); + + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + + rc= mysql_stmt_fetch(stmt); + DIE_UNLESS(rc == 0); + + rc= mysql_stmt_fetch(stmt); + DIE_UNLESS(rc == MYSQL_NO_DATA); + + /* Cleanup */ + mysql_stmt_close(stmt); + rc= mysql_query(mysql, "drop table t1"); + myquery(rc); +} + /* Read and parse arguments and MySQL options from my.cnf */ @@ -14675,6 +14846,9 @@ static struct my_tests_st my_tests[]= { { "test_bug11904", test_bug11904 }, { "test_bug12243", test_bug12243 }, { "test_bug14210", test_bug14210 }, + { "test_bug13488", test_bug13488 }, + { "test_bug13524", test_bug13524 }, + { "test_bug14845", test_bug14845 }, { 0, 0 } }; diff --git a/vio/vio.c b/vio/vio.c index ff93cff959f..bc286b2d2bb 100644 --- a/vio/vio.c +++ b/vio/vio.c @@ -87,7 +87,7 @@ static void vio_init(Vio* vio, enum enum_vio_type type, #ifdef HAVE_OPENSSL if (type == VIO_TYPE_SSL) { - vio->viodelete =vio_ssl_delete; + vio->viodelete =vio_delete; vio->vioerrno =vio_ssl_errno; vio->read =vio_ssl_read; vio->write =vio_ssl_write; diff --git a/vio/vio_priv.h b/vio/vio_priv.h index c1c78cc6efa..eb495025ddd 100644 --- a/vio/vio_priv.h +++ b/vio/vio_priv.h @@ -28,7 +28,6 @@ void vio_ignore_timeout(Vio *vio, uint which, uint timeout); #ifdef HAVE_OPENSSL #include "my_net.h" /* needed because of struct in_addr */ -void vio_ssl_delete(Vio* vio); int vio_ssl_read(Vio *vio,gptr buf, int size); int vio_ssl_write(Vio *vio,const gptr buf,int size); void vio_ssl_timeout(Vio *vio, uint which, uint timeout); diff --git a/vio/viossl.c b/vio/viossl.c index e6af07c4b0b..1273814c551 100644 --- a/vio/viossl.c +++ b/vio/viossl.c @@ -69,25 +69,6 @@ report_errors() DBUG_VOID_RETURN; } -/* - Delete a vio object - - SYNPOSIS - vio_ssl_delete() - vio Vio object. May be 0. -*/ - - -void vio_ssl_delete(Vio * vio) -{ - if (vio) - { - if (vio->type != VIO_CLOSED) - vio_close(vio); - my_free((gptr) vio,MYF(0)); - } -} - int vio_ssl_errno(Vio *vio __attribute__((unused))) { diff --git a/vio/viosslfactories.c b/vio/viosslfactories.c index 766d835d2c0..4ee27f1e491 100644 --- a/vio/viosslfactories.c +++ b/vio/viosslfactories.c @@ -191,9 +191,6 @@ void netware_ssl_cleanup() /* NetWare SSL initialization */ static void netware_ssl_init() { - /* initialize OpenSSL library */ - SSL_library_init(); - /* cleanup OpenSSL library */ NXVmRegisterExitHandler(netware_ssl_cleanup, NULL); } @@ -228,16 +225,17 @@ new_VioSSLConnectorFd(const char* key_file, ptr->ssl_method= 0; /* FIXME: constants! */ -#ifdef __NETWARE__ - netware_ssl_init(); -#endif - if (!ssl_algorithms_added) { DBUG_PRINT("info", ("todo: OpenSSL_add_all_algorithms()")); ssl_algorithms_added = TRUE; + SSL_library_init(); OpenSSL_add_all_algorithms(); } +#ifdef __NETWARE__ + netware_ssl_init(); +#endif + if (!ssl_error_strings_loaded) { DBUG_PRINT("info", ("todo:SSL_load_error_strings()")); @@ -319,17 +317,18 @@ new_VioSSLAcceptorFd(const char *key_file, /* FIXME: constants! */ ptr->session_id_context= ptr; -#ifdef __NETWARE__ - netware_ssl_init(); -#endif - if (!ssl_algorithms_added) { DBUG_PRINT("info", ("todo: OpenSSL_add_all_algorithms()")); ssl_algorithms_added = TRUE; + SSL_library_init(); OpenSSL_add_all_algorithms(); } +#ifdef __NETWARE__ + netware_ssl_init(); +#endif + if (!ssl_error_strings_loaded) { DBUG_PRINT("info", ("todo: SSL_load_error_strings()"));
Column