summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.bzrignore18
-rw-r--r--BUILD/FINISH.sh8
-rwxr-xr-xBUILD/cleanup8
-rw-r--r--BitKeeper/etc/logging_ok4
-rwxr-xr-xBuild-tools/Bootstrap38
-rwxr-xr-xBuild-tools/Do-compile37
-rwxr-xr-xBuild-tools/Do-pkg127
-rwxr-xr-xBuild-tools/Do-rpm450
-rwxr-xr-xBuild-tools/mysql-copyright27
-rw-r--r--[-rwxr-xr-x]INSTALL-WIN-SOURCE0
-rw-r--r--Makefile.am2
-rw-r--r--SSL/cacert.pem37
-rw-r--r--SSL/client-cert.pem87
-rw-r--r--SSL/client-key.pem26
-rw-r--r--SSL/client-req.pem38
-rw-r--r--SSL/server-cert.pem86
-rw-r--r--SSL/server-key.pem26
-rw-r--r--SSL/server-req.pem38
-rw-r--r--VC++Files/client/mysql.dsp8
-rw-r--r--VC++Files/client/mysqladmin.dsp8
-rw-r--r--VC++Files/client/mysqlclient.dsp8
-rw-r--r--VC++Files/client/mysqldump.dsp12
-rw-r--r--VC++Files/client/mysqlimport.dsp10
-rw-r--r--VC++Files/client/mysqlshow.dsp12
-rw-r--r--VC++Files/comp_err/comp_err.dsp8
-rw-r--r--VC++Files/innobase/innobase.dsp8
-rw-r--r--VC++Files/isamchk/isamchk.dsp8
-rw-r--r--VC++Files/libmysql/libmysql.dsp2
-rw-r--r--VC++Files/libmysqld/libmysqld.dsp12
-rw-r--r--VC++Files/libmysqltest/myTest.dsp8
-rw-r--r--VC++Files/my_print_defaults/my_print_defaults.dsp22
-rw-r--r--VC++Files/myisamlog/myisamlog.dsp10
-rw-r--r--VC++Files/mysql.dsw3
-rw-r--r--VC++Files/mysqlbinlog/mysqlbinlog.dsp12
-rw-r--r--VC++Files/mysqlcheck/mysqlcheck.dsp16
-rw-r--r--VC++Files/mysqldemb/mysqldemb.dsp4
-rw-r--r--VC++Files/mysqlmanager/MySqlManager.dsp8
-rw-r--r--VC++Files/mysqlserver/mysqlserver.dsp12
-rw-r--r--VC++Files/mysqlshutdown/mysqlshutdown.dsp10
-rw-r--r--VC++Files/mysys/mysys.dsp6
-rw-r--r--VC++Files/pack_isam/pack_isam.dsp8
-rw-r--r--VC++Files/perror/perror.dsp12
-rw-r--r--VC++Files/replace/replace.dsp8
-rw-r--r--VC++Files/sql/mysqld.dsp14
-rw-r--r--VC++Files/test1/test1.dsp8
-rw-r--r--VC++Files/thr_test/thr_test.dsp8
-rw-r--r--VC++Files/vio/vio.dsp12
-rw-r--r--VC++Files/zlib/zlib.dsp8
-rw-r--r--acconfig.h3
-rw-r--r--acinclude.m422
-rw-r--r--client/mysql.cc11
-rw-r--r--client/mysqladmin.c9
-rw-r--r--client/mysqlbinlog.cc88
-rw-r--r--client/mysqldump.c173
-rw-r--r--client/mysqlimport.c14
-rw-r--r--client/mysqltest.c170
-rw-r--r--configure.in22
-rw-r--r--extra/comp_err.c37
-rw-r--r--extra/my_print_defaults.c32
-rw-r--r--extra/resolveip.c8
-rw-r--r--include/config-win.h2
-rw-r--r--include/errmsg.h1
-rw-r--r--include/hash.h2
-rw-r--r--include/m_ctype.h27
-rw-r--r--include/m_string.h10
-rw-r--r--include/my_pthread.h2
-rw-r--r--include/my_sys.h19
-rw-r--r--include/myisam.h2
-rw-r--r--include/mysql.h51
-rw-r--r--include/mysql_com.h64
-rw-r--r--include/mysqld_error.h8
-rw-r--r--include/sql_common.h9
-rw-r--r--include/thr_alarm.h2
-rw-r--r--include/violite.h202
-rw-r--r--innobase/btr/btr0btr.c11
-rw-r--r--innobase/dict/dict0dict.c7
-rw-r--r--innobase/fsp/fsp0fsp.c33
-rw-r--r--innobase/os/os0file.c7
-rw-r--r--innobase/row/row0sel.c33
-rw-r--r--isam/_search.c2
-rw-r--r--isam/isamchk.c2
-rw-r--r--isam/isamdef.h1
-rw-r--r--isam/open.c22
-rw-r--r--isam/pack_isam.c2
-rw-r--r--isam/test_all.res371
-rw-r--r--libmysql/Makefile.am2
-rw-r--r--libmysql/Makefile.shared3
-rw-r--r--libmysql/client_settings.h16
-rw-r--r--libmysql/dll.c15
-rw-r--r--libmysql/errmsg.c45
-rw-r--r--libmysql/get_password.c2
-rw-r--r--libmysql/libmysql.c397
-rw-r--r--libmysqld/Makefile.am1
-rw-r--r--libmysqld/embedded_priv.h3
-rw-r--r--libmysqld/lib_sql.cc495
-rw-r--r--libmysqld/libmysqld.c211
-rw-r--r--myisam/ft_dump.c4
-rw-r--r--myisam/ft_nlq_search.c14
-rw-r--r--myisam/mi_check.c22
-rw-r--r--myisam/mi_checksum.c19
-rw-r--r--myisam/mi_create.c2
-rw-r--r--myisam/mi_dynrec.c14
-rw-r--r--myisam/mi_locking.c37
-rw-r--r--myisam/mi_open.c13
-rw-r--r--myisam/mi_packrec.c10
-rw-r--r--myisam/mi_search.c10
-rwxr-xr-xmyisam/mi_test_all.sh2
-rw-r--r--myisam/mi_update.c32
-rw-r--r--myisam/mi_write.c1
-rw-r--r--myisam/myisamchk.c41
-rw-r--r--myisam/myisamlog.c10
-rw-r--r--myisam/myisampack.c2
-rw-r--r--mysql-test/Makefile.am12
-rw-r--r--mysql-test/include/check_var_limit.inc9
-rw-r--r--mysql-test/include/have_openssl_2.inc4
-rw-r--r--mysql-test/mysql-test-run.sh22
-rw-r--r--mysql-test/r/bdb.result31
-rw-r--r--mysql-test/r/check_var_limit.require2
-rw-r--r--mysql-test/r/connect.result1
-rw-r--r--mysql-test/r/create.result62
-rw-r--r--mysql-test/r/ctype_many.result4
-rw-r--r--mysql-test/r/ctype_mb.result31
-rw-r--r--mysql-test/r/ctype_recoding.result24
-rw-r--r--mysql-test/r/ctype_ucs.result272
-rw-r--r--mysql-test/r/ctype_ujis.result58
-rw-r--r--mysql-test/r/ctype_utf8.result61
-rw-r--r--mysql-test/r/derived.result10
-rw-r--r--mysql-test/r/distinct.result37
-rw-r--r--mysql-test/r/drop.result10
-rw-r--r--mysql-test/r/func_compress.result6
-rw-r--r--mysql-test/r/func_crypt.result88
-rw-r--r--mysql-test/r/func_gconcat.result18
-rw-r--r--mysql-test/r/func_group.result2
-rw-r--r--mysql-test/r/func_regexp.result24
-rw-r--r--mysql-test/r/func_str.result2
-rw-r--r--mysql-test/r/func_test.result9
-rw-r--r--mysql-test/r/grant.result34
-rw-r--r--mysql-test/r/group_by.result11
-rw-r--r--mysql-test/r/have_openssl_2.require2
-rw-r--r--mysql-test/r/have_ujis.require2
-rw-r--r--mysql-test/r/innodb.result49
-rw-r--r--mysql-test/r/innodb_cache.result8
-rw-r--r--mysql-test/r/isam.result178
-rw-r--r--mysql-test/r/loaddata.result12
-rw-r--r--mysql-test/r/lowercase_table.result9
-rw-r--r--mysql-test/r/mix_innodb_myisam_binlog.result183
-rw-r--r--mysql-test/r/multi_update.result9
-rw-r--r--mysql-test/r/myisam.result56
-rw-r--r--mysql-test/r/mysqldump.result20
-rw-r--r--mysql-test/r/openssl_1.result12
-rw-r--r--mysql-test/r/packet.result12
-rw-r--r--mysql-test/r/query_cache.result535
-rw-r--r--mysql-test/r/query_cache_merge.result20
-rw-r--r--mysql-test/r/range.result189
-rw-r--r--mysql-test/r/rpl000015.result14
-rw-r--r--mysql-test/r/rpl_empty_master_crash.result2
-rw-r--r--mysql-test/r/rpl_error_ignored_table.result4
-rw-r--r--mysql-test/r/rpl_flush_log_loop.result4
-rw-r--r--mysql-test/r/rpl_loaddata.result16
-rw-r--r--mysql-test/r/rpl_loaddata_rule_m.result14
-rw-r--r--mysql-test/r/rpl_loaddata_rule_s.result14
-rw-r--r--mysql-test/r/rpl_log.result23
-rw-r--r--mysql-test/r/rpl_log_pos.result16
-rw-r--r--mysql-test/r/rpl_max_relay_size.result24
-rw-r--r--mysql-test/r/rpl_openssl.result30
-rw-r--r--mysql-test/r/rpl_redirect.result2
-rw-r--r--mysql-test/r/rpl_replicate_do.result4
-rw-r--r--mysql-test/r/rpl_reset_slave.result16
-rw-r--r--mysql-test/r/rpl_rotate_logs.result12
-rw-r--r--mysql-test/r/rpl_until.result72
-rw-r--r--mysql-test/r/sel000033.result14
-rw-r--r--mysql-test/r/sel000100.result38
-rw-r--r--mysql-test/r/select_safe.result4
-rw-r--r--mysql-test/r/show_check.result8
-rw-r--r--mysql-test/r/subselect.result100
-rw-r--r--mysql-test/r/subselect2.result10
-rw-r--r--mysql-test/r/symlink.result6
-rw-r--r--mysql-test/r/type_nchar.result50
-rw-r--r--mysql-test/r/union.result123
-rw-r--r--mysql-test/std_data/loaddata2.dat5
-rw-r--r--mysql-test/t/bdb.test13
-rw-r--r--mysql-test/t/connect.test5
-rw-r--r--mysql-test/t/create.test56
-rw-r--r--mysql-test/t/ctype_mb.test11
-rw-r--r--mysql-test/t/ctype_recoding.test9
-rw-r--r--mysql-test/t/ctype_ucs.test194
-rw-r--r--mysql-test/t/ctype_ujis.test26
-rw-r--r--mysql-test/t/ctype_utf8.test35
-rw-r--r--mysql-test/t/derived.test15
-rw-r--r--mysql-test/t/distinct.test47
-rw-r--r--mysql-test/t/drop.test10
-rw-r--r--mysql-test/t/func_compress.test6
-rw-r--r--mysql-test/t/func_crypt.test34
-rw-r--r--mysql-test/t/func_gconcat.test21
-rw-r--r--mysql-test/t/func_regexp.test14
-rw-r--r--mysql-test/t/func_test.test13
-rw-r--r--mysql-test/t/grant.test22
-rw-r--r--mysql-test/t/group_by.test2
-rw-r--r--mysql-test/t/innodb.test41
-rw-r--r--mysql-test/t/isam.test173
-rw-r--r--mysql-test/t/loaddata.test5
-rw-r--r--mysql-test/t/lock_tables_lost_commit.test2
-rw-r--r--mysql-test/t/lowercase_table.test4
-rw-r--r--mysql-test/t/mix_innodb_myisam_binlog.test175
-rw-r--r--mysql-test/t/multi_update.test7
-rw-r--r--mysql-test/t/myisam.test52
-rw-r--r--mysql-test/t/mysqldump.test10
-rw-r--r--mysql-test/t/openssl_1.test4
-rw-r--r--mysql-test/t/openssl_2.test5
-rw-r--r--mysql-test/t/packet.test6
-rw-r--r--mysql-test/t/query_cache.test530
-rw-r--r--mysql-test/t/query_cache_merge.test38
-rw-r--r--mysql-test/t/range.test112
-rw-r--r--mysql-test/t/rpl_loaddata.test15
-rw-r--r--mysql-test/t/rpl_loaddata_rule_m-master.opt1
-rw-r--r--mysql-test/t/rpl_loaddata_rule_m.test18
-rw-r--r--mysql-test/t/rpl_loaddata_rule_s-slave.opt1
-rw-r--r--mysql-test/t/rpl_loaddata_rule_s.test20
-rw-r--r--mysql-test/t/rpl_log-slave.opt1
-rw-r--r--mysql-test/t/rpl_log.test17
-rw-r--r--mysql-test/t/rpl_openssl.test60
-rw-r--r--mysql-test/t/rpl_relayrotate.test2
-rw-r--r--mysql-test/t/rpl_until.test77
-rw-r--r--mysql-test/t/sel000033.test20
-rw-r--r--mysql-test/t/sel000100.test48
-rw-r--r--mysql-test/t/select_safe.test4
-rw-r--r--mysql-test/t/show_check.test7
-rw-r--r--mysql-test/t/subselect.test38
-rw-r--r--mysql-test/t/symlink.test2
-rw-r--r--mysql-test/t/type_nchar.test35
-rw-r--r--mysql-test/t/union.test56
-rw-r--r--mysys/Makefile.am2
-rw-r--r--mysys/charset.c123
-rw-r--r--mysys/checksum.c25
-rw-r--r--mysys/default.c148
-rw-r--r--mysys/hash.c2
-rw-r--r--mysys/mf_iocache.c14
-rw-r--r--mysys/my_chsize.c109
-rw-r--r--mysys/my_crc32.c36
-rw-r--r--mysys/my_getopt.c5
-rw-r--r--mysys/my_pthread.c14
-rw-r--r--mysys/my_static.h1
-rw-r--r--mysys/testhash.c4
-rw-r--r--regex/cclass.h1
-rw-r--r--regex/regcomp.c55
-rw-r--r--scripts/fill_help_tables.sh46
-rw-r--r--scripts/make_binary_distribution.sh19
-rwxr-xr-xscripts/make_win_src_distribution.sh203
-rw-r--r--scripts/mysql_config.sh4
-rw-r--r--scripts/mysql_create_system_tables.sh2
-rw-r--r--scripts/mysql_fix_privilege_tables.sql14
-rw-r--r--scripts/mysql_install_db.sh20
-rw-r--r--scripts/mysqld_safe.sh2
-rw-r--r--sql-bench/compare-results.sh2
-rw-r--r--sql-bench/limits/mysql.cfg100
-rw-r--r--sql-common/client.c223
-rw-r--r--sql/derror.cc19
-rw-r--r--sql/field.cc47
-rw-r--r--sql/field.h36
-rw-r--r--sql/filesort.cc1
-rw-r--r--sql/gen_lex_hash.cc15
-rw-r--r--sql/ha_berkeley.cc9
-rw-r--r--sql/ha_innodb.cc165
-rw-r--r--sql/ha_myisam.cc10
-rw-r--r--sql/ha_myisam.h1
-rw-r--r--sql/handler.cc132
-rw-r--r--sql/handler.h78
-rw-r--r--sql/hash_filo.h2
-rw-r--r--sql/item.cc130
-rw-r--r--sql/item.h21
-rw-r--r--sql/item_cmpfunc.cc64
-rw-r--r--sql/item_cmpfunc.h37
-rw-r--r--sql/item_create.cc33
-rw-r--r--sql/item_create.h4
-rw-r--r--sql/item_func.cc124
-rw-r--r--sql/item_func.h25
-rw-r--r--sql/item_geofunc.h24
-rw-r--r--sql/item_strfunc.cc326
-rw-r--r--sql/item_strfunc.h80
-rw-r--r--sql/item_subselect.cc77
-rw-r--r--sql/item_subselect.h24
-rw-r--r--sql/item_sum.cc116
-rw-r--r--sql/item_sum.h67
-rw-r--r--sql/item_timefunc.h11
-rw-r--r--sql/item_uniq.h4
-rw-r--r--sql/lex.h12
-rw-r--r--sql/lock.cc4
-rw-r--r--sql/log.cc77
-rw-r--r--sql/log_event.cc228
-rw-r--r--sql/log_event.h27
-rw-r--r--sql/mysql_priv.h91
-rw-r--r--sql/mysqld.cc152
-rw-r--r--sql/net_serv.cc39
-rw-r--r--sql/opt_range.cc115
-rw-r--r--sql/password.c824
-rw-r--r--sql/protocol.cc40
-rw-r--r--sql/protocol.h15
-rw-r--r--sql/records.cc1
-rw-r--r--sql/repl_failsafe.cc40
-rw-r--r--sql/set_var.cc156
-rw-r--r--sql/set_var.h78
-rw-r--r--sql/share/Makefile.am2
-rw-r--r--sql/share/czech/errmsg.txt17
-rw-r--r--sql/share/danish/errmsg.txt15
-rw-r--r--sql/share/dutch/errmsg.txt15
-rw-r--r--sql/share/english/errmsg.txt10
-rw-r--r--sql/share/estonian/errmsg.txt15
-rw-r--r--sql/share/french/errmsg.txt15
-rw-r--r--sql/share/german/errmsg.txt13
-rw-r--r--sql/share/greek/errmsg.txt15
-rw-r--r--sql/share/hungarian/errmsg.txt15
-rw-r--r--sql/share/italian/errmsg.txt15
-rw-r--r--sql/share/japanese/errmsg.txt15
-rw-r--r--sql/share/korean/errmsg.txt15
-rw-r--r--sql/share/norwegian-ny/errmsg.txt15
-rw-r--r--sql/share/norwegian/errmsg.txt15
-rw-r--r--sql/share/polish/errmsg.txt15
-rw-r--r--sql/share/portuguese/errmsg.txt38
-rw-r--r--sql/share/romanian/errmsg.txt15
-rw-r--r--sql/share/russian/errmsg.txt13
-rw-r--r--sql/share/serbian/errmsg.txt15
-rw-r--r--sql/share/slovak/errmsg.txt15
-rw-r--r--sql/share/spanish/errmsg.txt50
-rw-r--r--sql/share/swedish/errmsg.txt17
-rw-r--r--sql/share/ukrainian/errmsg.txt13
-rw-r--r--sql/slave.cc405
-rw-r--r--sql/slave.h96
-rw-r--r--sql/sql_acl.cc768
-rw-r--r--sql/sql_acl.h19
-rw-r--r--sql/sql_base.cc12
-rw-r--r--sql/sql_cache.cc48
-rw-r--r--sql/sql_cache.h2
-rw-r--r--sql/sql_class.cc10
-rw-r--r--sql/sql_class.h33
-rw-r--r--sql/sql_crypt.cc2
-rw-r--r--sql/sql_db.cc47
-rw-r--r--sql/sql_derived.cc14
-rw-r--r--sql/sql_insert.cc21
-rw-r--r--sql/sql_lex.cc1
-rw-r--r--sql/sql_lex.h37
-rw-r--r--sql/sql_load.cc45
-rw-r--r--sql/sql_parse.cc982
-rw-r--r--sql/sql_prepare.cc127
-rw-r--r--sql/sql_repl.cc121
-rw-r--r--sql/sql_select.cc263
-rw-r--r--sql/sql_select.h3
-rw-r--r--sql/sql_show.cc212
-rw-r--r--sql/sql_string.cc5
-rw-r--r--sql/sql_table.cc156
-rw-r--r--sql/sql_test.cc2
-rw-r--r--sql/sql_udf.cc13
-rw-r--r--sql/sql_udf.h25
-rw-r--r--sql/sql_union.cc102
-rw-r--r--sql/sql_update.cc14
-rw-r--r--sql/sql_yacc.yy295
-rw-r--r--sql/table.cc3
-rw-r--r--sql/udf_example.cc25
-rw-r--r--strings/ctype-big5.c4
-rw-r--r--strings/ctype-bin.c66
-rw-r--r--strings/ctype-czech.c1
-rw-r--r--strings/ctype-euc_kr.c8
-rw-r--r--strings/ctype-gb2312.c10
-rw-r--r--strings/ctype-gbk.c4
-rw-r--r--strings/ctype-latin1.c4
-rw-r--r--strings/ctype-mb.c246
-rw-r--r--strings/ctype-simple.c72
-rw-r--r--strings/ctype-sjis.c4
-rw-r--r--strings/ctype-tis620.c192
-rw-r--r--strings/ctype-ucs2.c285
-rw-r--r--strings/ctype-ujis.c4
-rw-r--r--strings/ctype-utf8.c4
-rw-r--r--strings/ctype-win1250ch.c1
-rw-r--r--strings/xml.c2
-rw-r--r--support-files/MacOSX/Makefile.am6
-rwxr-xr-xsupport-files/MacOSX/MySQL46
-rw-r--r--support-files/MacOSX/StartupItem.Description.plist15
-rw-r--r--support-files/MacOSX/StartupItem.Info.plist38
-rwxr-xr-xsupport-files/MacOSX/StartupItem.postinstall36
-rw-r--r--support-files/mysql.spec.sh22
-rw-r--r--tests/client_test.c193
-rw-r--r--tools/mysqlmanager.c4
-rw-r--r--vio/Makefile.am2
-rw-r--r--vio/vio.c10
-rw-r--r--vio/vio_priv.h54
-rw-r--r--vio/viosocket.c30
-rw-r--r--vio/viossl.c89
-rw-r--r--vio/viosslfactories.c65
387 files changed, 12330 insertions, 7378 deletions
diff --git a/.bzrignore b/.bzrignore
index 35db3c5d5ba..c2e7d0878e4 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -23,6 +23,7 @@
.vimrc
50
=6
+BUILD/compile-pentium-maintainer
BitKeeper/etc/config
BitKeeper/etc/csets
BitKeeper/etc/csets-in
@@ -30,6 +31,8 @@ BitKeeper/etc/csets-out
BitKeeper/etc/gone
BitKeeper/etc/level
BitKeeper/etc/pushed
+BitKeeper/post-commit
+BitKeeper/post-commit-manual
BitKeeper/tmp/*
BitKeeper/tmp/bkr3sAHD
BitKeeper/tmp/gone
@@ -223,6 +226,7 @@ bkpull.log.5
bkpull.log.6
bkpush.log
build.log
+build_tags.sh
client/insert_test
client/log_event.cc
client/log_event.h
@@ -305,12 +309,16 @@ libmysql/conf_to_src
libmysql/my_static.h
libmysql/mysys_priv.h
libmysql/net.c
+libmysql/vio_priv.h
libmysql_r/*.c
libmysql_r/acconfig.h
libmysql_r/conf_to_src
libmysql_r/my_static.h
libmysql_r/mysys_priv.h
+libmysql_r/vio_priv.h
libmysqld/backup_dir
+libmysqld/client.c
+libmysqld/client_settings.h
libmysqld/convert.cc
libmysqld/derror.cc
libmysqld/errmsg.c
@@ -355,6 +363,7 @@ libmysqld/item_sum.cc
libmysqld/item_timefunc.cc
libmysqld/item_uniq.cc
libmysqld/key.cc
+libmysqld/libmysql.c
libmysqld/lock.cc
libmysqld/log.cc
libmysqld/log_event.cc
@@ -366,6 +375,7 @@ libmysqld/net_serv.cc
libmysqld/opt_ft.cc
libmysqld/opt_range.cc
libmysqld/opt_sum.cc
+libmysqld/pack.c
libmysqld/password.c
libmysqld/procedure.cc
libmysqld/protocol.cc
@@ -473,6 +483,7 @@ mysql-test/r/rpl_log.eval
mysql-test/r/slave-running.eval
mysql-test/r/slave-stopped.eval
mysql-test/share/mysql
+mysql-test/std_data/*.pem
mysql-test/var/*
mysql.kdevprj
mysql.proj
@@ -482,6 +493,7 @@ mysys/#mf_iocache.c#
mysys/charset2html
mysys/getopt.c
mysys/getopt1.c
+mysys/main.cc
mysys/ste5KbMa
mysys/test_charset
mysys/test_dir
@@ -585,6 +597,7 @@ stamp-h1
stamp-h2
stamp-h3
stamp-h4
+start_mysqld.sh
strings/conf_to_src
strings/ctype_autoconf.c
strings/ctype_extra_sources.c
@@ -611,6 +624,7 @@ support-files/mysql.spec
tags
test_xml
tests/client_test
+tests/connect_test
thread_test
tmp/*
tools/my_vsnprintf.c
@@ -622,7 +636,3 @@ vio/test-ssl
vio/test-sslclient
vio/test-sslserver
vio/viotest-ssl
-libmysqld/client.c
-libmysqld/client_settings.h
-libmysqld/libmysql.c
-libmysqld/pack.c
diff --git a/BUILD/FINISH.sh b/BUILD/FINISH.sh
index 32a4efefdfb..72188b9c24b 100644
--- a/BUILD/FINISH.sh
+++ b/BUILD/FINISH.sh
@@ -23,12 +23,16 @@ autoconf || (echo \"Can't execute autoconf\" && exit 1)
if [ -d gemini ]
then
(cd gemini && aclocal && autoheader && aclocal && automake && autoconf)
-fi
+fi"
+if [ -z "$just_clean" ]
+then
+commands="$commands
CFLAGS=\"$cflags\" CXX=\"$CXX\" CXXFLAGS=\"$cxxflags\" CXXLDFLAGS=\"$CXXLDFLAGS\" \
$configure"
+fi
-if [ -z "$just_configure" ]
+if [ -z "$just_configure" -a -z "$just_clean" ]
then
commands="$commands
diff --git a/BUILD/cleanup b/BUILD/cleanup
new file mode 100755
index 00000000000..518c5722d87
--- /dev/null
+++ b/BUILD/cleanup
@@ -0,0 +1,8 @@
+#! /bin/sh
+
+path=`dirname $0`
+. "$path/SETUP.sh"
+
+just_clean=1;
+
+. "$path/FINISH.sh"
diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok
index 299c12c1f4a..177107f8779 100644
--- a/BitKeeper/etc/logging_ok
+++ b/BitKeeper/etc/logging_ok
@@ -20,7 +20,9 @@ bk@admin.bk
bk@mysql.r18.ru
carsten@tsort.bitbybit.dk
davida@isil.mysql.com
+dlenev@build.mysql.com
dlenev@mysql.com
+gerberb@ou800.zenez.com
gluh@gluh.(none)
gluh@gluh.mysql.r18.ru
greg@gcw.ath.cx
@@ -71,6 +73,7 @@ monty@donna.mysql.fi
monty@hundin.mysql.fi
monty@mashka.(none)
monty@mashka.mysql.fi
+monty@mishka.mysql.fi
monty@narttu.
monty@narttu.mysql.fi
monty@rescue.
@@ -95,6 +98,7 @@ peter@linux.local
peter@mysql.com
peterg@mysql.com
pgulutzan@linux.local
+ram@gw.mysql.r18.ru
ram@gw.udmsearch.izhnet.ru
ram@mysql.r18.ru
ram@ram.(none)
diff --git a/Build-tools/Bootstrap b/Build-tools/Bootstrap
index 33eca958ae0..94446d9880f 100755
--- a/Build-tools/Bootstrap
+++ b/Build-tools/Bootstrap
@@ -10,6 +10,7 @@
# written by Lenz Grimmer <lenz@mysql.com>
#
+use Cwd;
use Getopt::Long;
Getopt::Long::Configure ("bundling");
@@ -26,18 +27,19 @@ else
# Some predefined settings
$build_command= "BUILD/compile-pentium-max";
-chomp ($LOGFILE= `pwd`);
-$LOGFILE.= "/Bootstrap.log";
-chomp ($opt_directory= `pwd`);
-$opt_docdir= $opt_directory . "/mysqldoc";
+$PWD= cwd();
+$LOGFILE= $PWD . "/Bootstrap.log";
+$opt_docdir= $PWD . "/mysqldoc";
$opt_build_command= undef;
$opt_changelog= undef;
$opt_delete= undef;
+$opt_directory= $PWD;
$opt_dry_run= undef;
$opt_export_only= undef;
$opt_help= $opt_verbose= 0;
$opt_log= undef;
$opt_mail= "";
+$opt_pull= undef;
$opt_revision= undef;
$opt_suffix= "";
$opt_test= undef;
@@ -58,6 +60,7 @@ GetOptions(
"help|h",
"log|l:s",
"mail|m=s",
+ "pull|p",
"revision|r=s",
"skip-check|s",
"skip-manual",
@@ -80,8 +83,7 @@ if (defined $opt_log)
}
else
{
- chomp ($LOGFILE= `pwd`);
- $LOGFILE.= "/" . $opt_log;
+ $LOGFILE= $PWD . "/" . $opt_log;
}
}
}
@@ -103,7 +105,7 @@ defined($REPO=$ARGV[0]) || print_help("Please enter the BK repository to be used
system ("bk help > /dev/null") == 0 or &abort("Cannot execute BitKeeper binary!");
system ("bk root $REPO > /dev/null 2>&1") == 0 or &abort("$REPO does not seem to be a valid BK repository!");
-if (($opt_directory ne ".") && (!-d $opt_directory && !$opt_dry_run))
+if (($opt_directory ne $PWD) && (!-d $opt_directory && !$opt_dry_run))
{
&abort("Could not find target directory \"$opt_directory\"!");
}
@@ -111,6 +113,23 @@ if (($opt_directory ne ".") && (!-d $opt_directory && !$opt_dry_run))
&logger("Logging to $LOGFILE") if (defined $opt_log);
#
+# Pull recent changes first
+#
+if ($opt_pull)
+{
+ &logger("Updating BK tree $REPO to latest ChangeSet first");
+ $command= "cd $REPO; bk pull; cd ..";
+ &run_command($command, "Could not update $REPO!");
+
+ unless ($opt_skip_manual)
+ {
+ &logger("Updating manual tree in $opt_docdir");
+ $command= "cd $opt_docdir; bk pull; cd ..";
+ &run_command($command, "Could not update $opt_docdir!");
+ }
+}
+
+#
# Use a temporary name until we know the version number
#
$target_dir= $opt_directory . "/mysql-" . $$ . "-" . time() . ".tmp";
@@ -253,7 +272,7 @@ if (defined $opt_changelog)
#
# Add the latest manual from the mysqldoc tree
#
-if (!$opt_skip_manual)
+unless ($opt_skip_manual)
{
$msg= "Adding manual.texi";
&logger($msg);
@@ -310,7 +329,7 @@ $command= "make dist";
if ($opt_win_dist)
{
&logger ("Creating Windows source package");
- $command= "./scripts/make_win_src_distibution";
+ $command= "./scripts/make_win_src_distribution --tar --zip";
&run_command($command, "make_win_src_distribution failed!");
}
@@ -378,6 +397,7 @@ Options:
include a log file snippet, if logging is enabled)
Note that the \@-Sign needs to be quoted!
Example: --mail=user\\\@domain.com
+-p, --pull Update the source BK trees before building
-r, --revision=<rev> Export the tree as of revision <rev>
(default is up to the latest revision)
-s, --skip-check Skip checking the distribution with "make distcheck"
diff --git a/Build-tools/Do-compile b/Build-tools/Do-compile
index 1e404f9c509..0541ebe96ce 100755
--- a/Build-tools/Do-compile
+++ b/Build-tools/Do-compile
@@ -8,7 +8,7 @@ use Getopt::Long;
$opt_distribution=$opt_user=$opt_config_env="";
$opt_dbd_options=$opt_perl_options=$opt_config_options=$opt_make_options=$opt_suffix="";
$opt_tmp=$opt_version_suffix="";
-$opt_help=$opt_delete=$opt_debug=$opt_stage=$opt_no_test=$opt_no_perl=$opt_with_low_memory=$opt_fast_benchmark=$opt_static_client=$opt_static_server=$opt_static_perl=$opt_sur=$opt_with_small_disk=$opt_local_perl=$opt_tcpip=$opt_build_thread=$opt_use_old_distribution=$opt_enable_shared=$opt_no_crash_me=$opt_no_strip=$opt_with_debug=$opt_no_benchmark=$opt_no_mysqltest=0;
+$opt_help=$opt_delete=$opt_debug=$opt_stage=$opt_no_test=$opt_no_perl=$opt_with_low_memory=$opt_fast_benchmark=$opt_static_client=$opt_static_server=$opt_static_perl=$opt_sur=$opt_with_small_disk=$opt_local_perl=$opt_tcpip=$opt_build_thread=$opt_use_old_distribution=$opt_enable_shared=$opt_no_crash_me=$opt_no_strip=$opt_with_debug=$opt_no_benchmark=$opt_no_mysqltest=$opt_without_embedded=$opt_readline=0;
$opt_innodb=$opt_bdb=$opt_raid=$opt_libwrap=0;
GetOptions(
@@ -36,6 +36,7 @@ GetOptions(
"perl-files=s",
"perl-options=s",
"raid",
+ "readline",
"stage=i",
"static-client",
"static-perl",
@@ -51,6 +52,7 @@ GetOptions(
"with-low-memory",
"with-other-libc=s",
"with-small-disk",
+ "without-embedded",
) || usage();
usage() if ($opt_help);
@@ -230,6 +232,8 @@ if ($opt_stage <= 1)
$opt_config_options.= " --with-low-memory" if ($opt_with_low_memory);
$opt_config_options.= " --with-mysqld-ldflags=-all-static" if ($opt_static_server);
$opt_config_options.= " --with-raid" if ($opt_raid);
+ $opt_config_options.= " --with-readline" if ($opt_readline);
+ $opt_config_options.= " --with-embedded-server" unless ($opt_without_embedded);
# Only enable InnoDB when requested (required to be able to
# build the "Classic" packages that do not include InnoDB)
@@ -446,10 +450,10 @@ $0 takes the following options:
--bdb
Compile with support for Berkeley DB tables
---config-env <environment for configure>
+--config-env=<environment for configure>
To set up the environment, like 'CC=cc CXX=gcc CXXFLAGS=-O3'
---config-options <options>
+--config-options=<options>
To add some extra options to configure (e.g. '--with-perl=yes')
--dbd-options <options>
@@ -461,7 +465,7 @@ Print all shell commands on stdout.
--delete
Delete the distribution file.
---distribution <distribution_file>
+--distribution=<distribution_file>
Name of the MySQL source distribution file.
--enable-shared
@@ -482,7 +486,7 @@ Compile with TCP wrapper support
--local-perl
Install Perl modules locally
---make-options <options>
+--make-options=<options>
Options to make after configure. (Like 'CXXLD=gcc')
--no-crash-me
@@ -500,16 +504,22 @@ Do not run the benchmark test (written in perl)
--no-mysqltest
Do not run the the mysql-test-run test (Same as 'make test')
---perl-files=list of files
+--no-perl
+Do not compile or install Perl modules, use the system installed ones
+
+--perl-files=<list of files>
Compile and install the given perl modules.
---perl-options <options>
+--perl-options=<options>
Build Perl modules with the additional options
--raid
Compile with RAID support
---stage (1-6)
+--readline
+Compile against readline library instead of libedit
+
+--stage=[1-6]
Start script from some specific point.
--static-client
@@ -524,18 +534,18 @@ Build statically linked server binary
--tcpip
Connect to the server to be tested via TCP/IP instead of socket
---tmp <directory>
+--tmp=<directory>
Use a different temporary directory than /tmp
--use-old-distribution
Do not clean up the build environment and extract a fresh source
distribution, use an existing one instead.
---user <user_name>
+--user=<user_name>
Mail 'user_name'\@mysql.com if something went wrong.
If user is empty then no mail is sent.
---version-suffix suffix
+--version-suffix=suffix
Set name suffix (e.g. 'com' or '-max') for a distribution
--with-debug
@@ -544,13 +554,16 @@ Build binaries with debug information (implies "--no-strip")
--with-low-memory
Use less memory when compiling.
---with-other-libc <path to libc>
+--with-other-libc=<path to libc>
Link against libc and other standard libraries installed in the specified
non-standard location overriding default.
--with-small-disk
Clean up the build environment before testing the binary distribution
(to save disk space)
+
+--without-embedded
+Don't compile the embedded server.
EOF
exit 1;
}
diff --git a/Build-tools/Do-pkg b/Build-tools/Do-pkg
index e95d86c0f6e..4d0f120c6e3 100755
--- a/Build-tools/Do-pkg
+++ b/Build-tools/Do-pkg
@@ -1,7 +1,9 @@
#!/usr/bin/perl -w
#
# Do-pkg - convert a binary distribution into a Mac OS X PKG and put it
-# inside a Disk Image (.dmg)
+# inside a Disk Image (.dmg). Additionally, add a separate package,
+# including the required Startup Item to automatically start MySQL on
+# bootup.
#
# The script currently assumes the following environment (which should exist
# like that, if the Do-compile script was used to build the binary
@@ -17,14 +19,19 @@
# written by Lenz Grimmer <lenz@mysql.com>
#
+use Cwd;
+use File::Basename;
+use File::Copy;
use Getopt::Long;
Getopt::Long::Configure ("bundling");
+use Sys::Hostname;
$opt_dry_run= undef;
$opt_help= undef;
$opt_log= undef;
$opt_mail= "";
$opt_skip_dmg= undef;
+$opt_skip_si= undef;
$opt_suffix= undef;
$opt_verbose= undef;
$opt_version= undef;
@@ -35,13 +42,14 @@ GetOptions(
"log|l:s",
"mail|m=s",
"skip-dmg|skip-disk-image|s",
+ "skip-si|skip-startup-item",
"suffix=s",
"verbose|v",
"version=s",
) || &print_help;
# Include helper functions
-chomp($PWD= `pwd`);
+$PWD= cwd();
$LOGGER= "$PWD/logger.pm";
if (-f "$LOGGER")
{
@@ -54,7 +62,7 @@ else
$PM= "/Developer/Applications/PackageMaker.app/Contents/MacOS/PackageMaker";
$TMP= $ENV{TMPDIR};
-$TMP eq "" ? $TMP= $TMP . "/PKGBUILD": $TMP= "/tmp/PKGBUILD";
+$TMP eq "" ? $TMP= $TMP . "/PKGBUILD.$$": $TMP= "/tmp/PKGBUILD.$$";
$PKGROOT= "$TMP/PMROOT";
$PKGDEST= "$TMP/PKG";
$RESOURCE_DIR= "$TMP/Resources";
@@ -62,8 +70,8 @@ $SUFFIX= $opt_suffix;
$VERSION= $opt_version;
($MAJOR, $MINOR, $RELEASE)= split(/\./, $VERSION);
$NAME= "mysql$SUFFIX-$VERSION";
-chomp($HOST= `hostname`);
-chomp($ID= `whoami`);
+$HOST= hostname();
+$ID= getpwuid($>);
$HOST=~ /^([^.-]*)/;
$HOST= $1;
$LOGFILE= "$PWD/Logs/$HOST-$MAJOR.$MINOR$SUFFIX.log";
@@ -73,6 +81,12 @@ $SUPFILEDIR= <$SRCBASEDIR/support-files/MacOSX>;
$TAR= <$BUILDDIR/$NAME-apple-darwin*-powerpc.tar.gz>;
$INFO= <$SUPFILEDIR/Info.plist>;
$DESC= <$SUPFILEDIR/Description.plist>;
+$SI_INFO= <$SUPFILEDIR/StartupItem.Info.plist>;
+$SI_DESC= <$SUPFILEDIR/StartupItem.Description.plist>;
+$SI_PARAMS= <$SUPFILEDIR/StartupParameters.plist>;
+$SI_POST= <$SUPFILEDIR/StartupItem.postinstall>;
+$SI_NAME= "MySQLStartupItem";
+$SI_SCRIPT= <$SUPFILEDIR/MySQL>;
@RESOURCES= qw/ ReadMe.txt postinstall preinstall /;
@LICENSES= ("$SRCBASEDIR/COPYING","$SRCBASEDIR/MySQLEULA.txt");
@@ -99,7 +113,9 @@ if (defined $opt_log)
# Creating the UFS disk image requires root privileges
die("You must be root to run this script!") if ($ID ne "root" && !$opt_dry_run);
-foreach $file ($TAR, $INFO, $DESC)
+@files= ($TAR, $INFO, $DESC);
+@files= (@files, $SI_INFO, $SI_DESC, $SI_POST, $SI_SCRIPT) unless $opt_skip_si;
+foreach $file (@files)
{
&abort("Unable to find $file!") unless (-f "$file");
}
@@ -112,14 +128,22 @@ foreach $dir ($TMP, $PKGROOT, $PKGDEST, $RESOURCE_DIR)
{
if (!-d $dir)
{
- &run_command("mkdir $dir", "Could not make directory $dir!");
+ &logger("Creating directory $dir!");
+ unless($opt_dry_run)
+ {
+ mkdir($dir) or &abort("Could not make directory $dir!");
+ }
}
}
foreach $resfile (@RESOURCES)
{
- $command= "cp $SUPFILEDIR/$resfile $RESOURCE_DIR";
- &run_command($command, "Error while copying $SUPFILEDIR/$resfile to $RESOURCE_DIR");
+ &logger("Copying $SUPFILEDIR/$resfile to $RESOURCE_DIR");
+ unless($opt_dry_run)
+ {
+ copy("$SUPFILEDIR/$resfile", "$RESOURCE_DIR") or
+ &abort("Error while copying $SUPFILEDIR/$resfile to $RESOURCE_DIR");
+ }
}
# Search for license file
@@ -127,12 +151,17 @@ foreach $license (@LICENSES)
{
if (-f "$license")
{
- $command= "cp $license $RESOURCE_DIR/License.txt";
- &run_command($command, "Error while copying $license to $RESOURCE_DIR");
+ &logger("Copy $license to $RESOURCE_DIR/License.txt");
+ unless($opt_dry_run)
+ {
+ copy("$license", "$RESOURCE_DIR/License.txt") or
+ &abort("Error while copying $license to $RESOURCE_DIR");
+ }
}
}
-&abort("Could not find a license file!") unless (-f "$RESOURCE_DIR/License.txt");
+&abort("Could not find a license file!")
+unless (-f "$RESOURCE_DIR/License.txt");
# Extract the binary tarball and create the "mysql" symlink
&logger("Extracting $TAR to $PKGROOT");
@@ -145,10 +174,38 @@ foreach $license (@LICENSES)
# returning a non-zero value, even though the package was created correctly
&logger("Running PackageMaker");
$command= "$PM -build -p $PKGDEST/$NAME.pkg -f $PKGROOT -r $RESOURCE_DIR -i $INFO -d $DESC || true";
-&run_command($command, "Error while building package!");
+&run_command($command, "Error while building package $NAME.pkg!");
+
+#
+# Build the Startup Item PKG
+#
+unless ($opt_skip_si)
+{
+ &logger("Cleaning up $PKGROOT");
+ &run_command("rm -rf $PKGROOT/*", "Unable to clean up $PKGROOT!");
+ &logger("Cleaning up $RESOURCE_DIR");
+ &run_command("rm -rf $RESOURCE_DIR/*", "Unable to clean up $RESOURCE_DIR!");
+
+ &logger("Installing MySQL StartupItem files into $PKGROOT/MySQL");
+ unless($opt_dry_run)
+ {
+ mkdir("$PKGROOT/MySQL") or &abort("Error creating $PKGROOT/MySQL");
+ copy("$SI_SCRIPT", "$PKGROOT/MySQL/")
+ or &abort("Error copying $SI_SCRIPT!");
+ chmod(0755, "$PKGROOT/MySQL/" . basename("$SI_SCRIPT"));
+ copy("$SI_PARAMS", "$PKGROOT/MySQL/")
+ or &abort("Error copying $SI_PARAMS!");
+ chmod(0644, "$PKGROOT/MySQL/" . basename("$SI_PARAMS"));
+ &run_command("chown -R root.wheel $PKGROOT/*", "Cannot chown $PKGROOT!");
+ copy("$SI_POST", "$RESOURCE_DIR/postinstall")
+ or &abort("Error copying $SI_POST!");
+ chmod(0644, "$RESOURCE_DIR/postinstall");
+ }
-&logger("Removing $PKGROOT");
-&run_command("rm -rf $PKGROOT", "Unable to remove $PKGROOT!");
+ &logger("Building $SI_NAME.pkg using PackageMaker");
+ $command= "$PM -build -p $PKGDEST/$SI_NAME.pkg -f $PKGROOT -r $RESOURCE_DIR -i $SI_INFO -d $SI_DESC || true";
+ &run_command($command, "Error while building package $SI_NAME.pkg!");
+}
if ($opt_skip_dmg)
{
@@ -159,7 +216,7 @@ if ($opt_skip_dmg)
# Determine the size of the Disk image to be created and add a 5% safety
# margin for filesystem overhead
&logger("Determining required disk image size for $PKGDEST");
-if (! $opt_dry_run)
+unless($opt_dry_run)
{
chomp($_= `du -sk $PKGDEST`);
@size= split();
@@ -167,7 +224,10 @@ if (! $opt_dry_run)
&logger("Disk image size: $size KB");
}
-&abort("Zero bytes? Something is wrong here!") if ($size == 0);
+unless($opt_dry_run)
+{
+ &abort("Zero bytes? Something is wrong here!") if ($size == 0);
+}
# Now create and mount the disk image
$TMPNAME= $NAME . ".tmp";
@@ -181,7 +241,7 @@ $command= "hdiutil create $TMPNAME -size ${size}k -ov -fs UFS -volname $NAME";
chomp($mountpoint=`mount | grep "\/Volumes\/$NAME" | cut -f3 -d" "`) if (!$opt_dry_run);
&logger("Copying $PKGDEST/$NAME.pkg to Disk image /Volumes/$NAME");
&run_command("ditto $PKGDEST /Volumes/$NAME", "Could not copy $PKGDEST to /Volumes/$NAME!");
-&run_command("ditto $RESOURCE_DIR/ReadMe.txt /Volumes/$NAME", "Could not copy $RESOURCE_DIR/ReadMe.txt to /Volumes/$NAME!");
+&run_command("ditto $SUPFILEDIR/ReadMe.txt /Volumes/$NAME", "Could not copy $SPFILEDIR/ReadMe.txt to /Volumes/$NAME!");
chomp($mountpoint=`mount | grep "\/Volumes\/$NAME" | cut -f1 -d" "`) if (!$opt_dry_run);
&abort("/Volumes/$NAME not attached!") if (!$mountpoint && !$opt_dry_run);
&logger("Unmounting $mountpoint");
@@ -221,20 +281,23 @@ NOTE: You need to run this script with root privileges (required
Options:
- --dry-run Dry run without executing
--h, --help Print this help
--l, --log[=<filename>] Write a log file [to <filename>]
- (default is "$LOGFILE")
--m, --mail=<address> Mail a failure report to the given address
- (and include a log file snippet, if logging
- is enabled)
- Note that the \@-Sign needs to be quoted!
- Example: --mail=user\\\@domain.com
--s, --skip-disk-image Just build the PKG, don't put it into a
- disk image afterwards
- --suffix=<suffix> The package suffix (e.g. "-standard" or "-pro)
- --version=<version> The MySQL version number (e.g. 4.0.11-gamma)
--v, --verbose Verbose execution
+ --dry-run Dry run without executing
+-h, --help Print this help
+-l, --log[=<filename>] Write a log file [to <filename>]
+ (default is "$LOGFILE")
+-m, --mail=<address> Mail a failure report to the given
+ address (and include a log file snippet,
+ if logging is enabled)
+ Note that the \@-Sign needs to be quoted!
+ Example: --mail=user\\\@domain.com
+-s, --skip-disk-image, --skip-dmg Just build the PKGs, don't put it into a
+ disk image afterwards
+ --skip-startup-item, --skip-si Skip the creation of the StartupItem PKG
+ --suffix=<suffix> The package suffix
+ (e.g. "-standard" or "-pro)
+ --version=<version> The MySQL version number
+ (e.g. 4.0.11-gamma)
+-v, --verbose Verbose execution
EOF
exit 1;
diff --git a/Build-tools/Do-rpm b/Build-tools/Do-rpm
index 6d107bc2413..0f423feb921 100755
--- a/Build-tools/Do-rpm
+++ b/Build-tools/Do-rpm
@@ -1,259 +1,227 @@
-#!/bin/bash
-
-#helper functions
-
-function copy_to_bmachine
+#!/usr/bin/perl -w
+#
+# Do-rpm - compile RPM packages out of a source tarball and move the
+# resulting RPM packages into the current directory.
+#
+# The script currently assumes the following environment (which should exist
+# like that, if the Do-compile script was used to build the binary
+# distribution)
+#
+# - there must be a source distribution (mysql-<version>.tar.gz)
+# in the current directory
+# - there must be a spec file (mysql-<version>.spec) in the directory
+# $HOME/<hostname>/mysql-<version>/support-files/
+#
+# Use the "--help" option for more info!
+#
+# written by Lenz Grimmer <lenz@mysql.com>
+#
+
+use Cwd;
+use File::Basename;
+use File::Copy;
+use Getopt::Long;
+Getopt::Long::Configure ("bundling");
+use Sys::Hostname;
+
+$opt_cc= undef;
+$opt_cflags= undef;
+$opt_clean= undef;
+$opt_cxx= undef;
+$opt_cxxflags= undef;
+$opt_dry_run= undef;
+$opt_help= undef;
+$opt_log= undef;
+$opt_mail= "";
+$opt_verbose= undef;
+
+$MAJOR= $MINOR= $RELEASE= 0;
+
+GetOptions(
+ "cc=s",
+ "cflags=s",
+ "clean|c",
+ "cxx=s",
+ "cxxflags=s",
+ "dry-run|t",
+ "help|h",
+ "log|l:s",
+ "mail|m=s",
+ "verbose|v",
+) || &print_help;
+
+defined($VERSION=$ARGV[0]) || print_help("Please provide the MySQL version!");
+
+# Include helper functions
+$PWD= cwd();
+$LOGGER= "$PWD/logger.pm";
+if (-f "$LOGGER")
{
- if [ x$local_build = x1 ]; then
- rm -f $2
- cp $1 $2
- else
- scp $1 $owner@$bmachine:$2
- fi
+ do "$LOGGER";
}
-
-function copy_from_bmachine
+else
{
- if [ x$local_build = x1 ]; then
- rm -f $2
- cp $1 $2
- else
- scp $owner@$bmachine:$1 $2
- fi
+ die "ERROR: $LOGGER cannot be found!\n";
}
-function run_command
+#
+# Override predefined Log file name
+#
+if (defined $opt_log)
{
- if [ x$local_build = x1 ]; then
- bash $1
- else
- cat $1 | ssh $owner@$bmachine bash
- fi
+ if ($opt_log ne "")
+ {
+ if ($opt_log =~ /^\/.*/)
+ {
+ $LOGFILE= $opt_log;
+ }
+ else
+ {
+ $LOGFILE= $PWD . "/" . $opt_log;
+ }
+ }
}
-#Supply defaults
-
-# We built on one of two machines
-bmachine=work
-smachine=work
-owner=my
-
-# Hard path!!
-bpath=`/bin/pwd`
-
-for d in /usr/src/redhat /usr/src/packages ; do
-if test -d "$d"
-then
- rpmdir=$d
-fi
-done
-
-if test -z "$rpmdir"
-then
- echo "Could not find suitable rpmdir on this system"
- exit 1
-fi
-
-
-logdir="$bpath/Logs"
-
-###### Perl STUFF #####
-
-# Perl version numbers. Should be autodetected from the files in the
-# Perl-mysql-modules/ directory.
-DBI_VERSION="1.14"
-DATA_SHOWTABLE_VERSION="3.3"
-DBD_MYSQL_VERSION="1.2215"
-MAKERPM="$rpmdir/SOURCES/makerpm.pl"
-
-#######################
-AM_MAKEFLAGS="-j 2"
-
-VER=`grep "AM_INIT_AUTOMAKE(mysql, " $bpath/configure.in | \
- sed -e 's;AM_INIT_AUTOMAKE(mysql, ;;' -e 's;);;'`
-VER_NO_DASH=`echo $VER | sed -e "s|-.*$||"`
-tarball=$bpath/mysql-$VER.tar.gz
-
-while test $# -gt 0; do
- case "$1" in
- --rpmdir=*)
- rpmdir=`echo $1 | sed -e "s;--rpmdir=;;"`
- ;;
- --smachine=*)
- smachine=`echo $1 | sed -e "s;--smachine=;;"`
- ;;
- --bmachine=*)
- bmachine=`echo $1 | sed -e "s;--bmachine=;;"`
- ;;
- --owner=*)
- owner=`echo $1 | sed -e "s;--owner=;;"`
- ;;
- --tarball=*)
- tarball=`echo $1 | sed -e "s;--tarball=;;"`
- ;;
- --logdir=*)
- logdir=`echo $1 | sed -e "s;--logdir=;;"`
- ;;
- --local )
- local_build=1
- ;;
- --skip-perl )
- skip_perl=1
- ;;
- * ) break ;;
- esac
- shift
-done
-
-echo "Removing old MySQL packages"
-rm -f $bpath/NEW-RPMS/MySQL-*rpm
-
-if [ ! -d "$logdir" ]; then
- echo "$logdir does not exist, creating"
- mkdir -p $logdir
-fi
-
-if [ ! -f "$tarball" ]; then
- echo "Tarball file $tarball does not exist, please make one first"
- exit 1
-fi
-
-log=$logdir/Log-RPM-`date +%y%m%d-%H%M`
-
-echo "Building RPM for MySQL version $VER on $bmachine"
-echo "Details in $log"
-
-(
-set -x
-# remove old stuff
-rm -rf $rpmdir/BUILD/mysql-*
-rm -f $rpmdir/SOURCES/mysql-*
-rm -f $rpmdir/SRPMS/MySQL-*
-rm -f $rpmdir/SPECS/mysql-*
-rm -rf /var/tmp/mysql
-
-# Copy MySQL source and spec files
-
-#Sasha: I left the scp stuff commented out instead of deleted to make it
-#easy to revert in a hurry, if there is a need. Once everything is tested
-#and works perfectly, the scp stuff should be deleted to avoid confusion
-
-#scp $bpath/mysql-$VER.tar.gz $owner@$bmachine:$rpmdir/SOURCES
-copy_to_bmachine $tarball $rpmdir/SOURCES
-#scp $bpath/Docs/Images/mysql-logo.gif $owner@$bmachine:$rpmdir/SOURCES/mysql.gif
-copy_to_bmachine $bpath/Docs/Images/mysql-logo.gif $rpmdir/SOURCES/mysql.gif
-#scp $bpath/support-files/mysql-$VER.spec $owner@$bmachine:$rpmdir/SPECS
-copy_to_bmachine $bpath/support-files/mysql-$VER.spec $rpmdir/SPECS
-
-# Copy perl things. Has to be uncompressed since Compress.pm is not
-# installed yet. Set CEXT to .gz when we support compression.
-CEXT=
-#scp $bpath/Perl-mysql-modules/To-SOURCES/* $owner@$bmachine:$rpmdir/SOURCES
-
-# This had to be installed on the target machince!
-# http://www.perl.com/CPAN/modules/by-module/Archive/Archive-Tar-0.21.tar.gz
-# cd /usr/lib/perl5/site_perl/5.005; ln -s ../* .; rm -f 5.005
-
-TMP_SCRIPT_MYSQL=00-temp-for-do-rpm.$$
-cat > $logdir/$TMP_SCRIPT_MYSQL <<END
-set -x
-
-# Check environment
-#export MYSQL_BUILD_PATH="/usr/local/bin:/my/gnu/bin:/usr/bin:/bin"
-#export MYSQL_BUILD_CFLAGS="-O6 -fno-omit-frame-pointer -mcpu=pentiumpro"
-#export MYSQL_BUILD_CXXFLAGS="-O6 -fno-omit-frame-pointer \
-# -felide-constructors -fno-exceptions -fno-rtti -mcpu=pentiumpro"
-export MYSQL_BUILD_PATH="/usr/bin:/bin"
-export MYSQL_BUILD_CFLAGS="-O6 -fno-omit-frame-pointer -mpentium"
-export MYSQL_BUILD_CXXFLAGS="-O6 -fno-omit-frame-pointer \
- -felide-constructors -fno-exceptions -fno-rtti -mpentium"
-gcc -v
-
-# Make RPM
-rpm -ba $rpmdir/SPECS/mysql-$VER.spec
-rm -f /tmp/$TMP_SCRIPT_MYSQL
-END
+($MAJOR, $MINOR, $RELEASE)= split(/\./, $VERSION);
+$HOST= hostname();
+$HOST=~ /^([^.-]*)/;
+$HOST= $1;
+$LOGFILE= "$PWD/Logs/Do-rpm-$HOST-$MAJOR.$MINOR.log";
-if [ ! x$skip_perl=x1 ]; then
+&print_help("") if ($opt_help);
- TMP_SCRIPT_PERL=00-temp-for-perl-rpm.$$
- cat > $logdir/$TMP_SCRIPT_PERL <<END
- set -x
-
- # First clean up so we do not get old versions when wildcard matching
- rm -f $rpmdir/SOURCES/DBI-*.spec $rpmdir/SOURCES/mysql*
- rm -f $rpmdir/RPMS/i386/Perl-*.rpm
- rm -f $rpmdir/SRPMS/Perl-*.rpm
- rm -f $rpmdir/RPMS/i386/MySQL*-$VER_NO_DASH*.rpm
- rm -f $rpmdir/SRPMS/MySQL*-$VER_NO_DASH*.rpm
-
- chmod a+x ${MAKERPM}
- rm
-
- ${MAKERPM} --verbose --package-name=DBI --package-version ${DBI_VERSION} \
- --specs --source=DBI-${DBI_VERSION}.tar$CEXT
-
- rpm -ba $rpmdir/SPECS/DBI-${DBI_VERSION}.spec
-
- ${MAKERPM} --verbose --package-name=Data-ShowTable \
- --package-version ${DATA_SHOWTABLE_VERSION} \
- --specs --source=Data-ShowTable-${DATA_SHOWTABLE_VERSION}.tar$CEXT
-
- rpm -ba $rpmdir/SPECS/Data-ShowTable-${DATA_SHOWTABLE_VERSION}.spec
-
- for v in ${DBD_MYSQL_VERSION}; do
- ${MAKERPM}
- --specs \
- --source=Msql-Mysql-modules-$v.tar$CEXT \
- --setup-dir=Msql-Mysql-modules-$v \
- --package-name=DBD-mysql \
- --package-version=$v \
- --makemakeropts='--noprompt --mysql-install --mysql-install-nodbd \
- --nomsql-install --nomsql1-install' \
- --require=perl-Data-ShowTable --require=perl-DBI
- rpm -ba $rpmdir/SPECS/DBD-mysql-$v.spec
- done
-
- for srcrpm in $rpmdir/SRPMS/perl-*.src.rpm
- do
- rpm --rebuild $srcrpm
- done
-
- rm -f /tmp/$TMP_SCRIPT_PERL
-END
-fi
-
- # scp $bpath/Logs/$TMP_SCRIPT_MYSQL $owner@$bmachine:/tmp/$TMP_SCRIPT_MYSQL
-
-# ssh $bmachine -l $owner bash $bpath/Logs/$TMP_SCRIPT_MYSQL
-
-cmd=$logdir/$TMP_SCRIPT_MYSQL
-run_command $cmd
+#
+# Newer RPM versions ship with a separate tool "rpmbuild" to build RPMs
+#
+if (-x "/usr/bin/rpmbuild")
+{
+ $RPM= "/usr/bin/rpmbuild";
+}
+else
+{
+ $RPM= "/bin/rpm";
+}
-if [ $? != 0 ]; then
- echo "$cmd failed, perhaps the following will help figure out why:"
- tail $log
-fi
+if ($RPM)
+{
+ &logger("Found rpm binary: $RPM");
+}
+else
+{
+ &abort("Unable to find RPM binary!");
+}
-if [ x$local_build != x1 ]; then
+#
+# determine some RPM settings for this host
+#
+chomp($RPMARCH= `$RPM --eval "%{_arch}" 2> /dev/null`);
+chomp($RPMDIR= `$RPM --eval "%{_rpmdir}" 2> /dev/null`);
+chomp($SOURCEDIR= `$RPM --eval "%{_sourcedir}" 2> /dev/null`);
+chomp($SPECDIR= `$RPM --eval "%{_specdir}" 2> /dev/null`);
+chomp($SRCRPMDIR= `$RPM --eval "%{_srcrpmdir}" 2> /dev/null`);
- # Build perl RPM (we currently need to be root to do this and that is
- # not possible)
+$SOURCEFILE= "mysql-$VERSION.tar.gz";
+$SPECFILE= "$PWD/$HOST/mysql-$VERSION/support-files/mysql-$VERSION.spec";
- #scp $bpath/Logs/$TMP_SCRIPT_PERL $owner@$bmachine:/tmp/$TMP_SCRIPT_PERL
- #ssh $bmachine -l root bash /tmp/$TMP_SCRIPT_PERL
+&logger("Starting RPM build of MySQL-$VERSION on $HOST");
- # Copy RPMs back to the source dir. We must do this here since the
- # $bmachine may not have permission to access $smachine.
- scp $owner@$bmachine:$rpmdir/RPMS/i386/MySQL*-$VER_NO_DASH*.rpm $bpath/NEW-RPMS
- scp $owner@$bmachine:$rpmdir/SRPMS/MySQL*-$VER_NO_DASH*.rpm $bpath/NEW-RPMS
+foreach $file ($SOURCEFILE, $SPECFILE)
+{
+ &abort("Unable to find $file!") unless (-f "$file");
+}
- # And the perl ones
- #scp $owner@$bmachine:$rpmdir/RPMS/i386/Perl*-*.rpm $bpath/NEW-RPMS
- #scp $owner@$bmachine:$rpmdir/SRPMS/Perl*-*.rpm $bpath/NEW-RPMS
+#
+# Install source and spec file
+#
+&logger("Copying SOURCE and SPEC file to build directories.");
+copy($SOURCEFILE, $SOURCEDIR)
+or &abort("Unable to copy $SOURCEFILE to $SOURCEDIR!");
+copy($SPECFILE, $SPECDIR)
+or &abort("Unable to copy $SPECFILE to $SPECDIR!");
+
+#
+# Set environment variables - these are being used in the
+# official MySQL RPM spec file
+#
+&logger("Setting special build environment variables")
+if ($opt_cc) or ($opt_cflags) or ($opt_cxxflags) or ($opt_cxx);
+$ENV{MYSQL_BUILD_CC}=$opt_cc if ($opt_cc);
+$ENV{MYSQL_BUILD_CFLAGS}=$opt_cflags if ($opt_cflags);
+$ENV{MYSQL_BUILD_CXXFLAGS}=$opt_cxxflags if ($opt_cxxflags);
+$ENV{MYSQL_BUILD_CXX}=$opt_cxx if ($opt_cxx);
+
+#
+# Build the RPMs
+#
+$command= "$RPM";
+$command.= " -v" if ($opt_verbose);
+$command.= " -ba";
+$command.= " --clean" if $opt_clean;
+$command.= " $SPECDIR/";
+$command.= basename($SPECFILE);
+&logger("Building RPM.");
+&run_command($command, "Error while building the RPMs!");
+
+#
+# Move the resulting RPMs into the pwd
+#
+$command= "mv";
+$command.= " -v " if ($opt_verbose);
+$command.= "$SRCRPMDIR/MySQL*$VERSION*.src.rpm $PWD";
+&run_command($command, "Error moving source RPM!");
+
+$command= "mv";
+$command.= " -v " if ($opt_verbose);
+$command.= "$RPMDIR/$RPMARCH/MySQL*$VERSION*.$RPMARCH.rpm $PWD";
+&run_command($command, "Error moving binary RPMs!");
+
+#
+# Clean up
+#
+if ($opt_clean)
+{
+ &logger("Removing spec file and source package");
+ unlink("$SPECDIR/" . basename($SPECFILE));
+ unlink("$SOURCEDIR/$SOURCEFILE");
+}
- #Remove some of the files that can interfere with future builds
+&logger("SUCCESS: RPM files successfully created.") if (!$opt_dry_run);
+exit 0;
- rm -rf /var/tmp/mysql
-fi
-) > $log 2>&1
+sub print_help
+{
+ my $message= $_[0];
+ if ($message ne "")
+ {
+ print "\n";
+ print "ERROR: $message\n\n}";
+ }
+ print <<EOF;
+
+Usage: Do-rpm <options> <version>
+
+Creates a binary RPM package out of a MySQL source distribution and moves the
+resulting RPMs into the current directory. <version> is the MySQL version
+number (e.g. 4.0.11-gamma)
+
+Options:
+
+ --cc=<compiler> Use <compiler> to compile C code
+ --ccflags=<flags> Use special C compiler flags
+ --cxx=<compiler> Use <compiler> to compile C++ code
+ --cxxflags=<flags> Use special C++ compiler flags
+-c, --clean Clean up after the build
+-t, --dry-run Dry run without executing
+-h, --help Print this help
+-l, --log[=<filename>] Write a log file [to <filename>]
+ (default is "$LOGFILE")
+-m, --mail=<address> Mail a failure report to the given address
+ (and include a log file snippet, if logging
+ is enabled)
+ Note that the \@-Sign needs to be quoted!
+ Example: --mail=user\\\@domain.com
+-v, --verbose Verbose execution
+
+EOF
+ exit 1;
+}
diff --git a/Build-tools/mysql-copyright b/Build-tools/mysql-copyright
index 70b65d3f2cf..a798ee7ab65 100755
--- a/Build-tools/mysql-copyright
+++ b/Build-tools/mysql-copyright
@@ -3,8 +3,11 @@
# Untar a MySQL distribution, change the copyright texts,
# pack it up again to a given directory
-$VER="1.2";
+$VER="1.3";
+use Cwd;
+use File::Basename;
+use File::Copy;
use Getopt::Long;
$opt_help = 0;
@@ -17,8 +20,7 @@ GetOptions("help","version","target=s") || error();
# fix the directory prefix for target dir
-$WD= `pwd`;
-chop $WD;
+$WD= cwd();
$opt_target= $WD . '/' . $opt_target;
&main();
@@ -73,11 +75,11 @@ sub main
$newdistname= $1."com".$2.$3;
}
# find out the extract path (should be same as distname!)
- $destdir= `tar tvzf ../$distfile | head -1`;
- # remove leading crab
- $destdir =~ s/.*\d+:\d+:\d+[ ]//;
- # remove newline and slash from the end
- $destdir= substr($destdir, 0, -2);
+ chomp($destdir= `tar ztf ../$distfile | head -1`);
+ # remove slash from the end
+ $destdir= substr($destdir, 0, -1);
+ print "destdir: $destdir\n";
+ print "distname: $distname\n";
if ("$destdir" ne "$distname")
{
@@ -96,15 +98,18 @@ sub main
# remove the 'PUBLIC' file from distribution and copy MySQLEULA.txt
# on the toplevel of the directory instead. file 'PUBLIC' shouldn't
# exist in the new mysql distributions, but let's be sure..
- `rm -f $destdir/PUBLIC $destdir/README`;
- `cp -p $WD/Docs/MySQLEULA.txt $destdir/`;
+ unlink("$destdir/PUBLIC", "$destdir/README");
+ copy("$WD/Docs/MySQLEULA.txt", "$destdir");
+ # remove readline subdir
+ `rm -rf $destdir/cmd-line-utils/readline`;
+
# fix file copyrights
&fix_usage_copyright();
&add_copyright();
# rename the directory with new distribution name
- `mv -f $destdir $newdistname`;
+ rename($destdir, $newdistname);
# tar the new distribution
`tar cz -f $opt_target/$newdistname.tar.gz *`;
diff --git a/INSTALL-WIN-SOURCE b/INSTALL-WIN-SOURCE
index 969eb91f5b1..969eb91f5b1 100755..100644
--- a/INSTALL-WIN-SOURCE
+++ b/INSTALL-WIN-SOURCE
diff --git a/Makefile.am b/Makefile.am
index ffebf891795..56e5b78ea90 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -20,7 +20,7 @@ AUTOMAKE_OPTIONS = foreign
# These are built from source in the Docs directory
EXTRA_DIST = INSTALL-SOURCE README \
- COPYING COPYING.LIB
+ COPYING COPYING.LIB zlib
SUBDIRS = . include @docs_dirs@ \
@readline_topdir@ sql-common \
@thread_dirs@ pstack @sql_client_dirs@ \
diff --git a/SSL/cacert.pem b/SSL/cacert.pem
index 698784b49f9..b939a037c30 100644
--- a/SSL/cacert.pem
+++ b/SSL/cacert.pem
@@ -1,20 +1,21 @@
-----BEGIN CERTIFICATE-----
-MIIDQjCCAqugAwIBAgIBADANBgkqhkiG9w0BAQQFADB6MQswCQYDVQQGEwJSVTET
-MBEGA1UECBMKU29tZS1TdGF0ZTERMA8GA1UEBxMIT3JlbmJ1cmcxETAPBgNVBAoT
-CE15U1FMIEFCMQ8wDQYDVQQDEwZXYWxydXMxHzAdBgkqhkiG9w0BCQEWEHdhbHJ1
-c0BteXNxbC5jb20wHhcNMDIwODAyMjE1NTUzWhcNMDMwODAyMjE1NTUzWjB6MQsw
-CQYDVQQGEwJSVTETMBEGA1UECBMKU29tZS1TdGF0ZTERMA8GA1UEBxMIT3JlbmJ1
-cmcxETAPBgNVBAoTCE15U1FMIEFCMQ8wDQYDVQQDEwZXYWxydXMxHzAdBgkqhkiG
-9w0BCQEWEHdhbHJ1c0BteXNxbC5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJ
-AoGBALFLPDNDeq213XvhBP3TxhC0NcGKJ/sWzaHkNmunQ8sTbV8AfdFafvP7cSHk
-O3jh7smpVWnxmcIbq1dpsbb7X5vQVc8ru07Z8VhCJWx6H8kgI95Am6wbm2ho2Lok
-9ODG8f/lA4kLv8Vo0hqtfV5T1mnZpSzkh6G4b0yPzHu8gtObAgMBAAGjgdcwgdQw
-HQYDVR0OBBYEFNnYan2rzhBiGhb86Wr03PFmrNC5MIGkBgNVHSMEgZwwgZmAFNnY
-an2rzhBiGhb86Wr03PFmrNC5oX6kfDB6MQswCQYDVQQGEwJSVTETMBEGA1UECBMK
-U29tZS1TdGF0ZTERMA8GA1UEBxMIT3JlbmJ1cmcxETAPBgNVBAoTCE15U1FMIEFC
-MQ8wDQYDVQQDEwZXYWxydXMxHzAdBgkqhkiG9w0BCQEWEHdhbHJ1c0BteXNxbC5j
-b22CAQAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQQFAAOBgQADeMZEA5Rh4PDq
-DmS9cYyogjb9gkuLHeo/pqfU8iSZVsSaf6Uqh6TWKQOuK3I4R1K8iMo4cW6LhxxH
-HLFrVIQn6xhLvfC0T6Zl7G0w6rAY2+QlbEhjnsgHtLGrB5xjSYLq6Uz3gAMbEsA4
-rCpQJECDe2PzoUXZj9mE2sdljiGcvQ==
+MIIDcTCCAtqgAwIBAgIBADANBgkqhkiG9w0BAQQFADCBiDELMAkGA1UEBhMCU0Ux
+EDAOBgNVBAcTB1VwcHNhbGExETAPBgNVBAoTCE15U1FMIEFCMSEwHwYDVQQDExhB
+YnN0cmFjdCBNeVNRTCBEZXZlbG9wZXIxMTAvBgkqhkiG9w0BCQEWImFic3RyYWN0
+Lm15c3FsLmRldmVsb3BlckBteXNxbC5jb20wHhcNMDMwODA3MTEyMTQwWhcNMDMw
+OTA2MTEyMTQwWjCBiDELMAkGA1UEBhMCU0UxEDAOBgNVBAcTB1VwcHNhbGExETAP
+BgNVBAoTCE15U1FMIEFCMSEwHwYDVQQDExhBYnN0cmFjdCBNeVNRTCBEZXZlbG9w
+ZXIxMTAvBgkqhkiG9w0BCQEWImFic3RyYWN0Lm15c3FsLmRldmVsb3BlckBteXNx
+bC5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALgbnH12rP8XEJsRuy69
+9n412tEOucpQyxkpNiDgLRvlYEGIJutK2LAqPHoPg7Em2+WJ+vrFh/BVx4hOUHmk
+tJ94qTHLLCCj07cjzcoADjzPT9254VqSuQy/JvDNamKEOEdXU8l4/bc26VKVZ99x
+iqXbHLiIWNa+UUwyRDSkERepAgMBAAGjgegwgeUwHQYDVR0OBBYEFJVKQT7xXBK0
+ez6fOwwjZpA9f07YMIG1BgNVHSMEga0wgaqAFJVKQT7xXBK0ez6fOwwjZpA9f07Y
+oYGOpIGLMIGIMQswCQYDVQQGEwJTRTEQMA4GA1UEBxMHVXBwc2FsYTERMA8GA1UE
+ChMITXlTUUwgQUIxITAfBgNVBAMTGEFic3RyYWN0IE15U1FMIERldmVsb3BlcjEx
+MC8GCSqGSIb3DQEJARYiYWJzdHJhY3QubXlzcWwuZGV2ZWxvcGVyQG15c3FsLmNv
+bYIBADAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBAUAA4GBAJFucCIj0wREcF9P
+vOaKVbvcaBwgit6oXOf7ZOPcIUQxQJOnXLVkWIdMP2mP/zHAUsCmXT2k8aXWRegB
+6kh/PjV/vSYFbGtE/vh/12x/nSIUU+Y9B1EwvoeskuOwu34Ih514Y1z1bPMNt18N
+4LGzMEBeklJ3gxBPlRXER9BSUpRH
-----END CERTIFICATE-----
diff --git a/SSL/client-cert.pem b/SSL/client-cert.pem
index 729379babdc..54b173baae2 100644
--- a/SSL/client-cert.pem
+++ b/SSL/client-cert.pem
@@ -3,24 +3,24 @@ Certificate:
Version: 3 (0x2)
Serial Number: 2 (0x2)
Signature Algorithm: md5WithRSAEncryption
- Issuer: C=RU, ST=Some-State, L=Orenburg, O=MySQL AB, CN=Walrus/Email=walrus@mysql.com
+ Issuer: C=SE, L=Uppsala, O=MySQL AB, CN=Abstract MySQL Developer/Email=abstract.mysql.developer@mysql.com
Validity
- Not Before: Aug 2 22:08:07 2002 GMT
- Not After : Aug 2 22:08:07 2003 GMT
- Subject: C=RU, L=orenburg, O=MySQL AB, OU=client, CN=walrus/Email=walrus@mysql.com
+ Not Before: Aug 7 11:41:56 2003 GMT
+ Not After : Aug 4 11:41:56 2013 GMT
+ Subject: C=SE, L=Uppsala, O=MySQL AB, CN=MySQL Client/Email=abstract.mysql.developer@mysql.com
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
RSA Public Key: (1024 bit)
Modulus (1024 bit):
- 00:ab:27:e4:1e:f0:34:8b:a9:50:df:0a:b0:55:20:
- b3:1f:0f:cf:f1:51:1e:66:48:a6:f8:4e:0d:d4:49:
- f4:ea:d3:41:6b:7e:06:78:3c:29:9d:8e:d3:33:4d:
- 0b:fc:34:4d:18:88:48:61:af:11:da:db:84:c0:92:
- 91:81:6a:b6:21:d5:8e:9b:f2:6f:d8:06:ad:d6:77:
- f6:8b:bd:07:d5:b7:fb:c6:f0:64:e6:3f:58:f0:6a:
- 1e:81:73:97:6d:9d:c6:ec:b0:5e:1e:c6:57:82:b0:
- 98:9c:ae:26:84:43:0d:98:6c:b4:d8:52:13:70:15:
- 79:61:40:84:19:ea:f6:63:3f
+ 00:c4:03:0a:ee:e3:b1:12:fc:ee:b4:19:f4:e1:60:
+ 1d:e0:28:c3:96:2d:df:82:69:cd:74:7c:54:58:d0:
+ ae:b3:59:3f:0c:19:1c:99:10:a6:12:c9:cf:3a:64:
+ 05:43:8e:bf:d2:65:36:80:91:0b:65:b0:27:26:38:
+ c9:23:d8:36:a2:4a:f0:f7:c0:2f:68:38:70:01:27:
+ 29:ff:b2:c5:52:e1:6b:f1:c8:d7:c3:5c:ee:f0:37:
+ 6c:2a:9b:96:1a:05:9e:eb:33:a2:39:5a:77:66:62:
+ 27:75:1f:2f:6f:38:da:e5:9f:78:af:ca:6b:22:3f:
+ 57:2b:bc:a6:8f:47:d1:99:6f
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Basic Constraints:
@@ -28,39 +28,40 @@ Certificate:
Netscape Comment:
OpenSSL Generated Certificate
X509v3 Subject Key Identifier:
- A6:D9:70:92:AC:2B:F6:48:A5:FB:29:CF:78:4A:57:B5:3B:43:97:EE
+ 80:81:A9:22:EB:AB:D6:CA:7E:3F:8D:BB:D1:AC:2A:F4:87:9D:13:29
X509v3 Authority Key Identifier:
- keyid:D9:D8:6A:7D:AB:CE:10:62:1A:16:FC:E9:6A:F4:DC:F1:66:AC:D0:B9
- DirName:/C=RU/ST=Some-State/L=Orenburg/O=MySQL AB/CN=Walrus/Email=walrus@mysql.com
+ keyid:95:4A:41:3E:F1:5C:12:B4:7B:3E:9F:3B:0C:23:66:90:3D:7F:4E:D8
+ DirName:/C=SE/L=Uppsala/O=MySQL AB/CN=Abstract MySQL Developer/Email=abstract.mysql.developer@mysql.com
serial:00
Signature Algorithm: md5WithRSAEncryption
- 15:96:43:10:89:e0:a6:82:a4:91:0f:7e:2e:d8:80:54:ba:63:
- e2:8f:b0:aa:ea:be:35:2c:8f:0d:03:a9:86:2e:32:51:33:8a:
- cc:b2:5e:b3:12:cb:b7:42:06:40:89:ce:92:87:40:f1:6a:79:
- 0c:3e:00:1d:06:bf:3c:c1:da:f6:3b:e1:42:e6:55:4c:31:e1:
- b9:79:f3:99:14:f6:68:9e:67:2b:e3:71:88:6b:2b:e2:08:bd:
- 67:79:ea:0e:7d:34:0d:41:22:3a:f4:8f:4d:51:07:6f:5a:44:
- 34:05:d1:b3:ca:cf:09:2b:43:25:a1:7f:ac:f4:54:f1:e3:93:
- 47:44
+ 6d:8a:af:34:07:ac:95:72:a4:78:fe:f8:b8:30:9a:e0:d9:74:
+ 82:34:5c:fd:11:15:dd:63:fd:65:20:04:7e:b5:8f:2e:26:ef:
+ ab:b9:10:5f:9b:40:65:76:ab:ed:bd:bf:d5:bc:89:7f:19:d8:
+ a7:b5:9e:24:bd:c7:ac:8e:16:35:83:c8:ce:8d:85:7c:b4:36:
+ 28:dd:3a:97:e5:b2:dd:8f:88:4d:5b:50:bd:97:28:61:8e:e7:
+ 05:5c:c2:bb:46:a1:ac:7e:ee:ac:7d:72:d5:a7:07:4e:1d:68:
+ 4e:80:e2:35:7d:db:24:73:be:bc:0d:ca:f4:ae:4e:21:52:3b:
+ ae:81
-----BEGIN CERTIFICATE-----
-MIIDajCCAtOgAwIBAgIBAjANBgkqhkiG9w0BAQQFADB6MQswCQYDVQQGEwJSVTET
-MBEGA1UECBMKU29tZS1TdGF0ZTERMA8GA1UEBxMIT3JlbmJ1cmcxETAPBgNVBAoT
-CE15U1FMIEFCMQ8wDQYDVQQDEwZXYWxydXMxHzAdBgkqhkiG9w0BCQEWEHdhbHJ1
-c0BteXNxbC5jb20wHhcNMDIwODAyMjIwODA3WhcNMDMwODAyMjIwODA3WjB2MQsw
-CQYDVQQGEwJSVTERMA8GA1UEBxMIb3JlbmJ1cmcxETAPBgNVBAoTCE15U1FMIEFC
-MQ8wDQYDVQQLEwZjbGllbnQxDzANBgNVBAMTBndhbHJ1czEfMB0GCSqGSIb3DQEJ
-ARYQd2FscnVzQG15c3FsLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA
-qyfkHvA0i6lQ3wqwVSCzHw/P8VEeZkim+E4N1En06tNBa34GeDwpnY7TM00L/DRN
-GIhIYa8R2tuEwJKRgWq2IdWOm/Jv2Aat1nf2i70H1bf7xvBk5j9Y8GoegXOXbZ3G
-7LBeHsZXgrCYnK4mhEMNmGy02FITcBV5YUCEGer2Yz8CAwEAAaOCAQIwgf8wCQYD
-VR0TBAIwADAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlm
-aWNhdGUwHQYDVR0OBBYEFKbZcJKsK/ZIpfspz3hKV7U7Q5fuMIGkBgNVHSMEgZww
-gZmAFNnYan2rzhBiGhb86Wr03PFmrNC5oX6kfDB6MQswCQYDVQQGEwJSVTETMBEG
-A1UECBMKU29tZS1TdGF0ZTERMA8GA1UEBxMIT3JlbmJ1cmcxETAPBgNVBAoTCE15
-U1FMIEFCMQ8wDQYDVQQDEwZXYWxydXMxHzAdBgkqhkiG9w0BCQEWEHdhbHJ1c0Bt
-eXNxbC5jb22CAQAwDQYJKoZIhvcNAQEEBQADgYEAFZZDEIngpoKkkQ9+LtiAVLpj
-4o+wquq+NSyPDQOphi4yUTOKzLJesxLLt0IGQInOkodA8Wp5DD4AHQa/PMHa9jvh
-QuZVTDHhuXnzmRT2aJ5nK+NxiGsr4gi9Z3nqDn00DUEiOvSPTVEHb1pENAXRs8rP
-CStDJaF/rPRU8eOTR0Q=
+MIIDkTCCAvqgAwIBAgIBAjANBgkqhkiG9w0BAQQFADCBiDELMAkGA1UEBhMCU0Ux
+EDAOBgNVBAcTB1VwcHNhbGExETAPBgNVBAoTCE15U1FMIEFCMSEwHwYDVQQDExhB
+YnN0cmFjdCBNeVNRTCBEZXZlbG9wZXIxMTAvBgkqhkiG9w0BCQEWImFic3RyYWN0
+Lm15c3FsLmRldmVsb3BlckBteXNxbC5jb20wHhcNMDMwODA3MTE0MTU2WhcNMTMw
+ODA0MTE0MTU2WjB8MQswCQYDVQQGEwJTRTEQMA4GA1UEBxMHVXBwc2FsYTERMA8G
+A1UEChMITXlTUUwgQUIxFTATBgNVBAMTDE15U1FMIENsaWVudDExMC8GCSqGSIb3
+DQEJARYiYWJzdHJhY3QubXlzcWwuZGV2ZWxvcGVyQG15c3FsLmNvbTCBnzANBgkq
+hkiG9w0BAQEFAAOBjQAwgYkCgYEAxAMK7uOxEvzutBn04WAd4CjDli3fgmnNdHxU
+WNCus1k/DBkcmRCmEsnPOmQFQ46/0mU2gJELZbAnJjjJI9g2okrw98AvaDhwAScp
+/7LFUuFr8cjXw1zu8DdsKpuWGgWe6zOiOVp3ZmIndR8vbzja5Z94r8prIj9XK7ym
+j0fRmW8CAwEAAaOCARQwggEQMAkGA1UdEwQCMAAwLAYJYIZIAYb4QgENBB8WHU9w
+ZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1UdDgQWBBSAgaki66vWyn4/
+jbvRrCr0h50TKTCBtQYDVR0jBIGtMIGqgBSVSkE+8VwStHs+nzsMI2aQPX9O2KGB
+jqSBizCBiDELMAkGA1UEBhMCU0UxEDAOBgNVBAcTB1VwcHNhbGExETAPBgNVBAoT
+CE15U1FMIEFCMSEwHwYDVQQDExhBYnN0cmFjdCBNeVNRTCBEZXZlbG9wZXIxMTAv
+BgkqhkiG9w0BCQEWImFic3RyYWN0Lm15c3FsLmRldmVsb3BlckBteXNxbC5jb22C
+AQAwDQYJKoZIhvcNAQEEBQADgYEAbYqvNAeslXKkeP74uDCa4Nl0gjRc/REV3WP9
+ZSAEfrWPLibvq7kQX5tAZXar7b2/1byJfxnYp7WeJL3HrI4WNYPIzo2FfLQ2KN06
+l+Wy3Y+ITVtQvZcoYY7nBVzCu0ahrH7urH1y1acHTh1oToDiNX3bJHO+vA3K9K5O
+IVI7roE=
-----END CERTIFICATE-----
diff --git a/SSL/client-key.pem b/SSL/client-key.pem
index feff11bfdb7..58fa805e620 100644
--- a/SSL/client-key.pem
+++ b/SSL/client-key.pem
@@ -1,15 +1,15 @@
-----BEGIN RSA PRIVATE KEY-----
-MIICXQIBAAKBgQCrJ+Qe8DSLqVDfCrBVILMfD8/xUR5mSKb4Tg3USfTq00FrfgZ4
-PCmdjtMzTQv8NE0YiEhhrxHa24TAkpGBarYh1Y6b8m/YBq3Wd/aLvQfVt/vG8GTm
-P1jwah6Bc5dtncbssF4exleCsJicriaEQw2YbLTYUhNwFXlhQIQZ6vZjPwIDAQAB
-AoGAChyxPaKzeAzo2kSnZmAoNQ2aG4fPY/um4cS6zHASKE2S7+biOvhS/RwTHlTP
-AHeWlnx2yk6tn2CY10fRkPPdDsnyj7FpuZmjhmFtprOn+1Mwft7gNTMdKN2EV46/
-hMQxm8/Wu9ejm6IhOeg3Q7lBFwE9tY0kgMzU4zDI3A0HDQECQQDUcxFgxIrOi4Gw
-EGxmJgopL+NjG7/4PdT2FM5z1bbwOtfsD1fHKWSiODbfpK8eMwBReI4wfDQ7ViND
-xmuDykFDAkEAzj3QH9s8Ej3Vgt88326OhY1W5jTH6M0XkuZ0YatELz3MvLwFhIF4
-puouLJQVo3pQBLV+Tmnh2LQqkii7xA7oVQJBALZxzvW0M6QmyAvEPuMGPema94KQ
-PS7ZIr7lpVpyqTTqw600i+Q8VvC8p9stmTmtANP2XN2kfFKMqaI1jvVRxvMCQDJE
-8sOxBjVUCQS7MPUs12RKDRJTbx6ZTtOphFiCDD6Pi6W9FoMzo5rbnaGT/qo4F+Tt
-7/lg6YGOeInjj9C76XkCQQC2m6j8NeX9E4Pimp1GDE93N2JJ+biJxLI8yFqruv7N
-B2M/28JKLGLjam6YVJy4eSA9clXVqwWNxii3fb8qQ7u6
+MIICXQIBAAKBgQDEAwru47ES/O60GfThYB3gKMOWLd+Cac10fFRY0K6zWT8MGRyZ
+EKYSyc86ZAVDjr/SZTaAkQtlsCcmOMkj2DaiSvD3wC9oOHABJyn/ssVS4WvxyNfD
+XO7wN2wqm5YaBZ7rM6I5WndmYid1Hy9vONrln3ivymsiP1crvKaPR9GZbwIDAQAB
+AoGAcR7IaoGhKbIrGGl6d67+zuT3q24h9aOV3Mn7653TlNHGnvbHGFcRYPpyy+H5
+X7m8XnHm+F+80hzNGzPecP9Q12oPOyoZgeQn6bTK73OFkNcX7FAkNdyH4xVhf2aK
+YOzTcQfq3gRCqXtVIg4qBShTMjJLE31R8H430Or62XmJgFECQQDjP+Kz+ecQwuTB
+HADLm+GQgceIB1kLgdQoZ3deUxGvqtVImuDRViSM0F2srfJ4GfkEDhc27UI5f6ir
+ZTOw4ww7AkEA3M9wCPgWNtbOXbYjaNA0IzHcjMDxQDVvJAmb3EiZlKQp4EfrESxR
+ly/u08TyfwrK6q5WS7xE0ad8+95G1af4XQJBAI9+3ME20SB1YItMCniHYwSj3oHX
+2fN5NKWax/Zoz+c0IV+qZMHq+kNso2oRoOUTyXk1CJWndcTnBnPMALr2c9cCQQCZ
+VL7Cq6uZVx6kemcqUHH0AprZbt3YLYLI7pc5p3xmeHzPzoEQQstBhjp8+aU+zPrN
+blRkcQ8E2x5yNA7SLLrNAkAhzkA+EK8hc0f9W3ncy+py0Rn0i5Ay0N3T715vkThf
+CfOHE3L91dLlmYpL5xVqOpugY/2sHyxwctv97DgS6tHZ
-----END RSA PRIVATE KEY-----
diff --git a/SSL/client-req.pem b/SSL/client-req.pem
index ef11a22165f..b3667fb5ec6 100644
--- a/SSL/client-req.pem
+++ b/SSL/client-req.pem
@@ -1,30 +1,12 @@
------BEGIN RSA PRIVATE KEY-----
-Proc-Type: 4,ENCRYPTED
-DEK-Info: DES-EDE3-CBC,8CE2AB38FB50D4B9
-
-rrnYZLUKlzV4U7+wqe5CWzTd4RLJb5h4M77aBRQfuHGejSaRsskN2ffpO8uQEAYM
-WTJSRC+NO+jDMBZhzt1ktWqCs8d6l6azHoBybIrMJsbUhwybm+OiOfp23RrbNoS/
-S4fsgNdAAGhsRvKDdsItCyYvdH8nTzn+g9r/z2V4tOOXd6MYuT42XA6Uz2tis2SZ
-GWEGa7mAweApzSiibE+pzjPS+fdX4E12n6NCVYLhn1JuvzVva/KFSebs4Wh75miC
-WvRgkt/5eDQn+vkV67hE3I6p9pPcLh1+PMfaQ25U8VM/r7ejnVFWm7teGH6GKPKJ
-cU+PYfblyWcgtiO/fwfGMIqSyNtHj/C3VFVie5D1MTJzBopiPGEcfz00LjBccjjh
-j1meTRVN8pMZTgkxlnIFwbU6TPPvx8a9urFVQIJ4z8r2EMvYh5Cqpq87+lH9Pn0C
-vzCl78Tz5QLghXNnMbbdD2aPP0PwPEXgh86iZxo06g85n0l26WUzYJlWzBYD4DrF
-SbnEUAftTujEOm6MqJNLpJN6UPOtq/HvSaHl1bykGK+zU4gqHj0ur03HlF0l4xNg
-OfsoNsJV+O9RUUJ0+D5eqUALJjN8TCV1wNMXOVzr/ue3QCVdlWVfZY4RPffwK9Yp
-Fh52T7a2v+shhqZUQNtFDAg50Ac7deUthSWNmi5N680POnJg9KdtBdMhYLa1j3rP
-D9oasSK0ugevHuQ6wUiD/95CzZlJXE9K4kTTYmaRk5MTWXhFQxdqHZo1v+pGtaNI
-f+/E7q7BiNesSt31U/vkX0Tm3oJ1dgOnS8M2uxiYiKH2mJ/E32tZKw==
------END RSA PRIVATE KEY-----
-----BEGIN CERTIFICATE REQUEST-----
-MIIB0jCCATsCAQAwgZExCzAJBgNVBAYTAkVFMRMwEQYDVQQIEwpTb21lLVN0YXRl
-MRAwDgYDVQQHEwdUYWxsaW5uMSYwJAYDVQQKEx1NeVNRTCBkZW1vIGNsaWVudCBj
-ZXJ0aWZpY2F0ZTEUMBIGA1UEAxMLVG9udSBTYW11ZWwxHTAbBgkqhkiG9w0BCQEW
-DnRvbnVAbXlzcWwuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDo1FLN
-TruWFjrwiWuQTNvgMHVaAnJiv+3avgnogNuAVDDWde3jEKUVRFspkRL+DLd2Telf
-VlxFPK2ycS1qesu8BIAIdNZ99nxcdts1xPb12NSJn53MP04/c8E+QX5OCb/qGtmi
-Ew3RDNrY9Ju4VCEXrtezAmGHqQH/9P6cevxnQwIDAQABoAAwDQYJKoZIhvcNAQEE
-BQADgYEAvENK1JAQfC8xnrFGw2IxfUmUwlRidiRtYTgtVfTr7vA+m4WaaKioni6E
-PQXjcvl6kfyRoxc4qWsGi3T7QM2RnvCtbwR2NGSIKX1cBTS31RMr12NSAeXn6Twz
-ZwSZ55EHj9N2hArTPNlVjxvDQX3D6/ZBi6JnHAxXigzDqhArgjU=
+MIIBvDCCASUCAQAwfDELMAkGA1UEBhMCU0UxEDAOBgNVBAcTB1VwcHNhbGExETAP
+BgNVBAoTCE15U1FMIEFCMRUwEwYDVQQDEwxNeVNRTCBDbGllbnQxMTAvBgkqhkiG
+9w0BCQEWImFic3RyYWN0Lm15c3FsLmRldmVsb3BlckBteXNxbC5jb20wgZ8wDQYJ
+KoZIhvcNAQEBBQADgY0AMIGJAoGBAMQDCu7jsRL87rQZ9OFgHeAow5Yt34JpzXR8
+VFjQrrNZPwwZHJkQphLJzzpkBUOOv9JlNoCRC2WwJyY4ySPYNqJK8PfAL2g4cAEn
+Kf+yxVLha/HI18Nc7vA3bCqblhoFnuszojlad2ZiJ3UfL2842uWfeK/KayI/Vyu8
+po9H0ZlvAgMBAAGgADANBgkqhkiG9w0BAQQFAAOBgQAnKdk68dGJXvlj/GXwBUWN
+oXWF7hq4fDmwyhmcFUqk8qZKPKFUxkcER0GLzYeUgvD2URSfaS3/YW0d7K7kXGwP
+rB5edb+suaYf6mjm/w37xw/EJI9rdSKcB/3SSu8mALds7sUHDAO+MO0WkA/9d7t0
+LOsUqcDvMkKpZuYwNILwLw==
-----END CERTIFICATE REQUEST-----
diff --git a/SSL/server-cert.pem b/SSL/server-cert.pem
index b15bd04a25c..9ce296482db 100644
--- a/SSL/server-cert.pem
+++ b/SSL/server-cert.pem
@@ -3,24 +3,24 @@ Certificate:
Version: 3 (0x2)
Serial Number: 1 (0x1)
Signature Algorithm: md5WithRSAEncryption
- Issuer: C=RU, ST=Some-State, L=Orenburg, O=MySQL AB, CN=Walrus/Email=walrus@mysql.com
+ Issuer: C=SE, L=Uppsala, O=MySQL AB, CN=Abstract MySQL Developer/Email=abstract.mysql.developer@mysql.com
Validity
- Not Before: Aug 2 21:59:26 2002 GMT
- Not After : Aug 2 21:59:26 2003 GMT
- Subject: C=RU, L=Orenburg, O=MySQL AB, CN=server/Email=walrus@mysql.com
+ Not Before: Aug 7 11:39:27 2003 GMT
+ Not After : Aug 4 11:39:27 2013 GMT
+ Subject: C=SE, L=Uppsala, O=MySQL AB, CN=MySQL Server/Email=abstract.mysql.developer@mysql.com
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
RSA Public Key: (1024 bit)
Modulus (1024 bit):
- 00:bd:7d:f1:91:51:38:fe:4b:79:b5:ff:e0:41:ae:
- 0e:a8:bb:7b:60:42:95:01:75:e7:22:74:55:7d:74:
- 4d:50:51:0c:5e:09:4b:2b:0c:8e:3f:9f:14:3f:5e:
- d9:25:36:9b:cc:77:35:30:e9:8c:bf:3b:bd:da:62:
- 85:4c:90:c8:de:71:2c:0a:7b:dc:e6:85:fd:b4:24:
- 88:a7:8f:03:3d:15:7c:59:3d:f8:73:f0:36:2a:b8:
- 80:7c:d8:c7:d6:1f:6d:b2:b7:b7:48:9f:24:56:81:
- 2c:2e:9c:b9:95:48:50:56:9f:1a:60:96:c4:c0:eb:
- 8d:2d:55:38:3f:6b:82:bc:b3
+ 00:e9:86:7a:55:84:88:4c:be:a4:f8:92:73:30:12:
+ 49:0b:7a:85:87:39:34:39:0d:7d:0b:8d:18:c2:17:
+ 95:13:52:d2:3f:55:10:57:c8:3f:5a:f5:b2:fa:8b:
+ d0:67:49:cc:aa:82:fc:9f:ce:00:b4:73:f3:36:d2:
+ 3a:d3:c2:b0:0e:14:c3:d4:b2:21:74:a1:f0:31:81:
+ 60:87:98:73:5c:10:c1:b1:1a:4d:f1:f3:b0:98:3f:
+ f0:d7:97:9b:2b:fd:d5:21:79:b2:2f:eb:64:15:c9:
+ 9b:9d:fc:9e:2d:d4:f8:04:5b:ea:a9:75:4b:42:c3:
+ 3d:0e:4d:2a:a8:b8:ca:99:8d
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Basic Constraints:
@@ -28,38 +28,40 @@ Certificate:
Netscape Comment:
OpenSSL Generated Certificate
X509v3 Subject Key Identifier:
- C9:D0:D2:F7:17:79:27:1C:4B:C9:E7:92:D5:5E:8C:7E:F2:FE:A7:B7
+ 6E:E4:9B:6A:C5:EA:E4:E6:C7:EF:D7:1E:C8:63:45:60:2B:1B:D4:D4
X509v3 Authority Key Identifier:
- keyid:D9:D8:6A:7D:AB:CE:10:62:1A:16:FC:E9:6A:F4:DC:F1:66:AC:D0:B9
- DirName:/C=RU/ST=Some-State/L=Orenburg/O=MySQL AB/CN=Walrus/Email=walrus@mysql.com
+ keyid:95:4A:41:3E:F1:5C:12:B4:7B:3E:9F:3B:0C:23:66:90:3D:7F:4E:D8
+ DirName:/C=SE/L=Uppsala/O=MySQL AB/CN=Abstract MySQL Developer/Email=abstract.mysql.developer@mysql.com
serial:00
Signature Algorithm: md5WithRSAEncryption
- 62:77:bc:16:dc:4c:70:63:4d:03:ce:19:5e:c4:6c:31:0e:57:
- 26:d8:6e:25:08:f2:01:ae:98:59:0a:ba:b7:32:c0:39:69:b8:
- 4b:aa:59:7c:97:72:4e:50:02:ee:ef:d6:d6:62:b8:25:36:91:
- b6:3b:8f:6f:2f:3c:d8:9d:b7:cf:8f:f6:29:50:e9:31:54:77:
- 2b:7b:21:72:0f:60:4c:d4:1c:bb:c4:46:e5:fd:a7:5f:ea:46:
- e4:df:e9:95:77:2d:91:f8:3b:33:78:83:5d:10:de:98:7c:38:
- 91:27:f6:52:8a:b6:54:f1:0f:7a:f0:1d:da:a5:22:d2:75:cc:
- 4c:c3
+ 7c:b6:9c:fc:ea:9e:e6:88:32:f5:24:81:9b:89:c0:13:fa:75:
+ 18:51:af:77:ae:b8:4e:12:5f:48:ab:0c:e6:c5:a4:87:93:6e:
+ 98:97:f5:f3:d3:0b:e0:fc:5e:34:3e:f2:93:58:73:97:b6:a7:
+ 66:96:81:cd:73:48:f3:75:24:64:61:13:78:3e:ed:df:7c:4d:
+ fa:2e:3a:64:99:12:24:9e:a2:51:5c:23:85:0b:0c:bb:f5:8e:
+ 89:80:27:ba:7c:d2:68:90:ff:1f:68:2e:1b:fd:06:bc:c8:41:
+ d7:b2:be:9c:94:5c:6d:1e:96:3b:75:bc:12:f0:44:bd:36:00:
+ 84:cd
-----BEGIN CERTIFICATE-----
-MIIDWTCCAsKgAwIBAgIBATANBgkqhkiG9w0BAQQFADB6MQswCQYDVQQGEwJSVTET
-MBEGA1UECBMKU29tZS1TdGF0ZTERMA8GA1UEBxMIT3JlbmJ1cmcxETAPBgNVBAoT
-CE15U1FMIEFCMQ8wDQYDVQQDEwZXYWxydXMxHzAdBgkqhkiG9w0BCQEWEHdhbHJ1
-c0BteXNxbC5jb20wHhcNMDIwODAyMjE1OTI2WhcNMDMwODAyMjE1OTI2WjBlMQsw
-CQYDVQQGEwJSVTERMA8GA1UEBxMIT3JlbmJ1cmcxETAPBgNVBAoTCE15U1FMIEFC
-MQ8wDQYDVQQDEwZzZXJ2ZXIxHzAdBgkqhkiG9w0BCQEWEHdhbHJ1c0BteXNxbC5j
-b20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAL198ZFROP5LebX/4EGuDqi7
-e2BClQF15yJ0VX10TVBRDF4JSysMjj+fFD9e2SU2m8x3NTDpjL87vdpihUyQyN5x
-LAp73OaF/bQkiKePAz0VfFk9+HPwNiq4gHzYx9YfbbK3t0ifJFaBLC6cuZVIUFaf
-GmCWxMDrjS1VOD9rgryzAgMBAAGjggECMIH/MAkGA1UdEwQCMAAwLAYJYIZIAYb4
-QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1UdDgQWBBTJ
-0NL3F3knHEvJ55LVXox+8v6ntzCBpAYDVR0jBIGcMIGZgBTZ2Gp9q84QYhoW/Olq
-9NzxZqzQuaF+pHwwejELMAkGA1UEBhMCUlUxEzARBgNVBAgTClNvbWUtU3RhdGUx
-ETAPBgNVBAcTCE9yZW5idXJnMREwDwYDVQQKEwhNeVNRTCBBQjEPMA0GA1UEAxMG
-V2FscnVzMR8wHQYJKoZIhvcNAQkBFhB3YWxydXNAbXlzcWwuY29tggEAMA0GCSqG
-SIb3DQEBBAUAA4GBAGJ3vBbcTHBjTQPOGV7EbDEOVybYbiUI8gGumFkKurcywDlp
-uEuqWXyXck5QAu7v1tZiuCU2kbY7j28vPNidt8+P9ilQ6TFUdyt7IXIPYEzUHLvE
-RuX9p1/qRuTf6ZV3LZH4OzN4g10Q3ph8OJEn9lKKtlTxD3rwHdqlItJ1zEzD
+MIIDkTCCAvqgAwIBAgIBATANBgkqhkiG9w0BAQQFADCBiDELMAkGA1UEBhMCU0Ux
+EDAOBgNVBAcTB1VwcHNhbGExETAPBgNVBAoTCE15U1FMIEFCMSEwHwYDVQQDExhB
+YnN0cmFjdCBNeVNRTCBEZXZlbG9wZXIxMTAvBgkqhkiG9w0BCQEWImFic3RyYWN0
+Lm15c3FsLmRldmVsb3BlckBteXNxbC5jb20wHhcNMDMwODA3MTEzOTI3WhcNMTMw
+ODA0MTEzOTI3WjB8MQswCQYDVQQGEwJTRTEQMA4GA1UEBxMHVXBwc2FsYTERMA8G
+A1UEChMITXlTUUwgQUIxFTATBgNVBAMTDE15U1FMIFNlcnZlcjExMC8GCSqGSIb3
+DQEJARYiYWJzdHJhY3QubXlzcWwuZGV2ZWxvcGVyQG15c3FsLmNvbTCBnzANBgkq
+hkiG9w0BAQEFAAOBjQAwgYkCgYEA6YZ6VYSITL6k+JJzMBJJC3qFhzk0OQ19C40Y
+wheVE1LSP1UQV8g/WvWy+ovQZ0nMqoL8n84AtHPzNtI608KwDhTD1LIhdKHwMYFg
+h5hzXBDBsRpN8fOwmD/w15ebK/3VIXmyL+tkFcmbnfyeLdT4BFvqqXVLQsM9Dk0q
+qLjKmY0CAwEAAaOCARQwggEQMAkGA1UdEwQCMAAwLAYJYIZIAYb4QgENBB8WHU9w
+ZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1UdDgQWBBRu5Jtqxerk5sfv
+1x7IY0VgKxvU1DCBtQYDVR0jBIGtMIGqgBSVSkE+8VwStHs+nzsMI2aQPX9O2KGB
+jqSBizCBiDELMAkGA1UEBhMCU0UxEDAOBgNVBAcTB1VwcHNhbGExETAPBgNVBAoT
+CE15U1FMIEFCMSEwHwYDVQQDExhBYnN0cmFjdCBNeVNRTCBEZXZlbG9wZXIxMTAv
+BgkqhkiG9w0BCQEWImFic3RyYWN0Lm15c3FsLmRldmVsb3BlckBteXNxbC5jb22C
+AQAwDQYJKoZIhvcNAQEEBQADgYEAfLac/Oqe5ogy9SSBm4nAE/p1GFGvd664ThJf
+SKsM5sWkh5NumJf189ML4PxeND7yk1hzl7anZpaBzXNI83UkZGETeD7t33xN+i46
+ZJkSJJ6iUVwjhQsMu/WOiYAnunzSaJD/H2guG/0GvMhB17K+nJRcbR6WO3W8EvBE
+vTYAhM0=
-----END CERTIFICATE-----
diff --git a/SSL/server-key.pem b/SSL/server-key.pem
index 5afd717e07c..4292dc79929 100644
--- a/SSL/server-key.pem
+++ b/SSL/server-key.pem
@@ -1,15 +1,15 @@
-----BEGIN RSA PRIVATE KEY-----
-MIICXAIBAAKBgQC9ffGRUTj+S3m1/+BBrg6ou3tgQpUBdecidFV9dE1QUQxeCUsr
-DI4/nxQ/XtklNpvMdzUw6Yy/O73aYoVMkMjecSwKe9zmhf20JIinjwM9FXxZPfhz
-8DYquIB82MfWH22yt7dInyRWgSwunLmVSFBWnxpglsTA640tVTg/a4K8swIDAQAB
-AoGARciG2NRHn+aduPe1V5rJDTyWD/oVM8d+ykJ7ZUsaWdSvMEZN51mlXSqxYzED
-2N+GesL/1LZ9vcM7hJw5qNu9DQOc7CtMT4k/bmhPJsT226roKKVbw/ocOEY5dK8+
-T9/x8qgo7zC3Qk/bKgjj61m8cQ7Mz/J7ZCEMmDNNrORCzRECQQDrcvJlsBTALilr
-MaAqNyaa0tykEabzg2mUFx5uvmzlwNx9ApSidoU5Xop9c6u00zgCDpsDlcwjhOs1
-jcqRkBTrAkEAzggY7BeN3FnW8tsV0Wq4LL6vK30pe0JIylxrKsFjY4LTo9t/8TKK
-6ZOEETVtM7sepIkxECw5RCBi9sxi3NClWQJAbrA5WKjw+HA7NJO98lq/IWYkKFXM
-IQsUpXRA8FtBormKbpK6Aa6qbxANF3E7teTencj0Azl3IPOqCCFCrDAKRQJAc6bv
-9ncyVqLHmgOJN8ikIdnYEp1rj5khqxY9wf5UgCOMEcrBAu/QMlVwKQjIh+VdyhaI
-x/9LFgboBomsZS9p4QJBAIXaX/WoqL/wgBGS2UroianFFXL6/Bt//CUoGpYgKQYQ
-+x+8heMRppmM0to2J7j9nGE83ikMWfPUwMi4TbyWH3Q=
+MIICXgIBAAKBgQDphnpVhIhMvqT4knMwEkkLeoWHOTQ5DX0LjRjCF5UTUtI/VRBX
+yD9a9bL6i9BnScyqgvyfzgC0c/M20jrTwrAOFMPUsiF0ofAxgWCHmHNcEMGxGk3x
+87CYP/DXl5sr/dUhebIv62QVyZud/J4t1PgEW+qpdUtCwz0OTSqouMqZjQIDAQAB
+AoGBALTq11nrjIEQbdSZ+R1z/R0kddB2U+wjdA3/6P9tr7PBxVsFdtzbKaI5mcib
+iwCKX0J2qmrP+SHUdsexBZxLR4KV/Z55v9Pym99Dy+DxDA95zURyCMKRBIzlU5uN
+F7USEQoltLUCsmZwNWdit0gfxSWdddkHNuI0uxTzHwuDcUlNAkEA/76zVremngNL
+DlekM9NPn/8E/TXBHN1b1jdUKd7WymSJykdcm3viU98dFNZFWF8B0jiTcuBKXgpR
+vTShNab/swJBAOnCGp554BLhioTyyk8qjRLt3xEsjsDljJULHVLYWcUqIkMf97GL
+VLBhl6ZEI9i0WduqvgZ+Bacd0uHqIHz1Yb8CQQDm1CjqTDiGxlIoT9JVNJTZxEOs
+h6gVdXY+kxHT+N3FL5luiZp8fAR7zxVgiUVtzdLG+2madfapiobcT3RyCJkhAkBI
+64AaR7KasTjg2Ew7/e4cJZAcb2XozrLYG6t+GHeIhehCQEqoW+qDSy5fc4orI7eU
+SuMUa2OgCjGqv7p6wKFJAkEAznmum/MbVOBpC4FsdnIGkxyFKIbh2OLY2aUb2KkK
+Ouf4S8Y5Ldgszi0fnDPRaxWJzewwZKvcff2zj+mYZeAXbA==
-----END RSA PRIVATE KEY-----
diff --git a/SSL/server-req.pem b/SSL/server-req.pem
index 4cd6610e735..7c3db0660ad 100644
--- a/SSL/server-req.pem
+++ b/SSL/server-req.pem
@@ -1,30 +1,12 @@
------BEGIN RSA PRIVATE KEY-----
-Proc-Type: 4,ENCRYPTED
-DEK-Info: DES-EDE3-CBC,6CBD09E71246DC01
-
-byRzq5+j3r8FX2kQerTUZT5Bw/N6zrN3cmH6NHGJcrqD+vcPdtWf+Rk+mpNXgSQn
-ldkfmniU/htzJ0cUV+KE229Qx10Hx9mIJIbf0Y/rBCUBuaXWVrQB36W9w3rkNPFA
-EEuRMkreOJF42RD16+NBJv+RcHIGzGejXecJKUGF5DKlN0U8YHXnkXTQl54kIdr0
-H7rTrvJygwPk9/ik0M9/vmwduAMvTaHDmvgeolpMlJkxwz8vYkbUnFFJZhB6XNCb
-1w3lJ0EmRJicK5BnZmCEmgt8xiv0PAtg00jBbwddQbn1reAyViBtBT9iXdusHXS5
-Po63rSt7r3MO8aetcMQ6FkklH+ChuS/vFoNY57AwrzF4uEI4GSoZP0ESrRC5Ar5W
-Lzg/HrQAWbPCRlb6Jj3db1woRzFS8joOashROsZdeV/5P4Emhc6J7QMTvB1OHAhQ
-ugOJazJtxjg0DN8+9cM1wtHI7N89PLHhOg13LZNLeeehzIlPwKI2JLqXUc6oR407
-i+S7GCqu7wU+if0Enux8Dj7yrvnTUiqVCL2dyKTS3sBq0Cm2UhbecHclor13y6no
-y1o50TKKD6Zig2hZmSpqKznMxGMVIT36BE0aOMQUmk+aVnRuROclwTTL0ZNLzA+g
-QRTRfQ6iNMf34ypqAMdAMPzDGLPycKuFdxVQxFEVaM2/mrdWFwVAqFsLvzyGvdrh
-nkNyRgTWR/pfH9b3mXLqf6gMPNs764WhFIcZIDk9a4XBBUm2YDb2CxDzDCo/EUMA
-jvIiU0Jt132SEHHF/wAka6d2DnwZ3vexRp6Tebv/uy9IlMLPE+68dw==
------END RSA PRIVATE KEY-----
-----BEGIN CERTIFICATE REQUEST-----
-MIIB0jCCATsCAQAwgZExCzAJBgNVBAYTAkVFMRMwEQYDVQQIEwpTb21lLVN0YXRl
-MRAwDgYDVQQHEwdUYWxsaW5uMSYwJAYDVQQKEx1NeVNRTCBzZXJ2ZXIgZGVtbyBj
-ZXJ0aWZpY2F0ZTEUMBIGA1UEAxMLVG9udSBTYW11ZWwxHTAbBgkqhkiG9w0BCQEW
-DnRvbnVAbXlzcWwuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCerI3Y
-HZyy/YiWLLpCU/pdvYWK5crTD8ABPPKSRk/ZgK4qic/v6NRl/Pb1OiZMKdsG+jSh
-h/OXtTyU8YQFrK1XJdkC2wBx4KmqtB0pNl6ppA3yRbmDdCtF8+IjvOdc5hG29t3E
-rO1lQiw5RyrJ619FAxCrI7zKXIKat7NtZxjSxwIDAQABoAAwDQYJKoZIhvcNAQEE
-BQADgYEAlrUnGX4LYIiVjztHA4gUcOSVeEHCci2qEUq+7yY1JhAw54YDa2MLTTwa
-cH+rXLHjN0MTNfv9tRxdSX+trk3pyvhgFjssD100dJkF83RfVv2tKg9kscVOGQp7
-MkwOnJjfAjQBlTbTOQM46BTjv2FgvsppkO3ViryI//YxKvj/628=
+MIIBvDCCASUCAQAwfDELMAkGA1UEBhMCU0UxEDAOBgNVBAcTB1VwcHNhbGExETAP
+BgNVBAoTCE15U1FMIEFCMRUwEwYDVQQDEwxNeVNRTCBTZXJ2ZXIxMTAvBgkqhkiG
+9w0BCQEWImFic3RyYWN0Lm15c3FsLmRldmVsb3BlckBteXNxbC5jb20wgZ8wDQYJ
+KoZIhvcNAQEBBQADgY0AMIGJAoGBAOmGelWEiEy+pPiSczASSQt6hYc5NDkNfQuN
+GMIXlRNS0j9VEFfIP1r1svqL0GdJzKqC/J/OALRz8zbSOtPCsA4Uw9SyIXSh8DGB
+YIeYc1wQwbEaTfHzsJg/8NeXmyv91SF5si/rZBXJm538ni3U+ARb6ql1S0LDPQ5N
+Kqi4ypmNAgMBAAGgADANBgkqhkiG9w0BAQQFAAOBgQCagJxGHBC+G5aSh3OguFn6
+z+qAC7u3B181kPBgNv20zMgLeq7YiAh3iNx4XO2+QXRGzMznFKx1tFr/mavCpgLs
+p3+dCvQt5FHEFFK1D1pDeXy4146X07hOTtC9jc/jSWeVnH4ujuX5gMtZqisOyYWV
+/gpw6dBtkTYlhS+y86kM/Q==
-----END CERTIFICATE REQUEST-----
diff --git a/VC++Files/client/mysql.dsp b/VC++Files/client/mysql.dsp
index c0fd1e785d5..2e9e1729bed 100644
--- a/VC++Files/client/mysql.dsp
+++ b/VC++Files/client/mysql.dsp
@@ -25,7 +25,7 @@ CFG=mysql - Win32 Debug
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
-CPP=cl.exe
+CPP=xicl6.exe
RSC=rc.exe
!IF "$(CFG)" == "mysql - Win32 Release"
@@ -49,7 +49,7 @@ RSC=rc.exe
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"../client_release/mysql.exe" /libpath:"..\lib_release\\"
# SUBTRACT LINK32 /incremental:yes
@@ -68,14 +68,14 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"../client_debug/mysql.exe" /pdbtype:sept /libpath:"..\lib_debug\\"
diff --git a/VC++Files/client/mysqladmin.dsp b/VC++Files/client/mysqladmin.dsp
index 11189ecb065..2c762cd8a24 100644
--- a/VC++Files/client/mysqladmin.dsp
+++ b/VC++Files/client/mysqladmin.dsp
@@ -25,7 +25,7 @@ CFG=mysqladmin - Win32 Debug
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
-CPP=cl.exe
+CPP=xicl6.exe
RSC=rc.exe
!IF "$(CFG)" == "mysqladmin - Win32 Release"
@@ -49,7 +49,7 @@ RSC=rc.exe
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"../client_release/mysqladmin.exe" /libpath:"..\lib_release\\"
@@ -67,14 +67,14 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"../client_debug/mysqladmin.exe" /pdbtype:sept /libpath:"..\lib_debug\\"
diff --git a/VC++Files/client/mysqlclient.dsp b/VC++Files/client/mysqlclient.dsp
index 0f4c46acd2a..685c9ae1a15 100644
--- a/VC++Files/client/mysqlclient.dsp
+++ b/VC++Files/client/mysqlclient.dsp
@@ -25,7 +25,7 @@ CFG=mysqlclient - Win32 Debug
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
-CPP=cl.exe
+CPP=xicl6.exe
RSC=rc.exe
!IF "$(CFG)" == "mysqlclient - Win32 Release"
@@ -48,7 +48,7 @@ RSC=rc.exe
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LIB32=link.exe -lib
+LIB32=xilink6.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"..\lib_release\mysqlclient.lib"
@@ -65,14 +65,14 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /G6 /MTd /W3 /ZI /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_WINDOWS" /D "USE_TLS" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_WINDOWS" /D "USE_TLS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LIB32=link.exe -lib
+LIB32=xilink6.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"..\lib_debug\mysqlclient.lib"
diff --git a/VC++Files/client/mysqldump.dsp b/VC++Files/client/mysqldump.dsp
index 4fae9a5769a..d36664e09ce 100644
--- a/VC++Files/client/mysqldump.dsp
+++ b/VC++Files/client/mysqldump.dsp
@@ -25,7 +25,7 @@ CFG=mysqldump - Win32 Debug
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
-CPP=cl.exe
+CPP=xicl6.exe
RSC=rc.exe
!IF "$(CFG)" == "mysqldump - Win32 Release"
@@ -42,14 +42,14 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G6 /MT /W3 /GX- /O2 /I "../include" /I "../" /D "NDEBUG" /D "DBUG_OFF" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../" /D "NDEBUG" /D "DBUG_OFF" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"../client_release/mysqldump.exe" /libpath:"..\lib_release\\"
@@ -67,16 +67,16 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G6 /MTd /W3 /Gm /GX- /ZI /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"../client_debug/mysqldump.exe" /pdbtype:sept /libpath:"..\lib_debug\\"
+# ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"../client_debug/mysqldump.exe" /pdbtype:sept /libpath:"..\lib_debug\\"
!ENDIF
diff --git a/VC++Files/client/mysqlimport.dsp b/VC++Files/client/mysqlimport.dsp
index 8eb08f1411f..a8b239d226f 100644
--- a/VC++Files/client/mysqlimport.dsp
+++ b/VC++Files/client/mysqlimport.dsp
@@ -25,7 +25,7 @@ CFG=mysqlimport - Win32 Debug
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
-CPP=cl.exe
+CPP=xicl6.exe
RSC=rc.exe
!IF "$(CFG)" == "mysqlimport - Win32 Release"
@@ -42,14 +42,14 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G6 /MT /W3 /GX- /O2 /I "../include" /I "../" /D "NDEBUG" /D "DBUG_OFF" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../" /D "NDEBUG" /D "DBUG_OFF" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"../client_release/mysqlimport.exe" /libpath:"..\lib_release\\"
# SUBTRACT LINK32 /incremental:yes
@@ -68,14 +68,14 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G6 /MTd /W3 /Gm /GX- /ZI /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setargv.obj /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"../client_debug/mysqlimport.exe" /pdbtype:sept /libpath:"..\lib_debug\\"
diff --git a/VC++Files/client/mysqlshow.dsp b/VC++Files/client/mysqlshow.dsp
index 78627246050..26705465fec 100644
--- a/VC++Files/client/mysqlshow.dsp
+++ b/VC++Files/client/mysqlshow.dsp
@@ -25,7 +25,7 @@ CFG=mysqlshow - Win32 Debug
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
-CPP=cl.exe
+CPP=xicl6.exe
RSC=rc.exe
!IF "$(CFG)" == "mysqlshow - Win32 Release"
@@ -42,14 +42,14 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G6 /MT /W3 /GX- /O2 /I "../include" /I "../" /D "NDEBUG" /D "DBUG_OFF" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../" /D "NDEBUG" /D "DBUG_OFF" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"../client_release/mysqlshow.exe" /libpath:"..\lib_release\\"
@@ -67,16 +67,16 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G6 /MTd /W3 /Gm /GX- /ZI /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"../client_debug/mysqlshow.exe" /pdbtype:sept /libpath:"..\lib_debug\\"
+# ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"../client_debug/mysqlshow.exe" /pdbtype:sept /libpath:"..\lib_debug\\"
!ENDIF
diff --git a/VC++Files/comp_err/comp_err.dsp b/VC++Files/comp_err/comp_err.dsp
index 71582b84763..deaf0627262 100644
--- a/VC++Files/comp_err/comp_err.dsp
+++ b/VC++Files/comp_err/comp_err.dsp
@@ -24,7 +24,7 @@ CFG=comp_err - Win32 Release
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
-CPP=cl.exe
+CPP=xicl6.exe
RSC=rc.exe
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
@@ -33,8 +33,8 @@ RSC=rc.exe
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
+# PROP Output_Dir "release"
+# PROP Intermediate_Dir "release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
@@ -44,7 +44,7 @@ RSC=rc.exe
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\lib_release\mysys.lib wsock32.lib ..\lib_release\strings.lib ..\lib_release\dbug.lib /nologo /subsystem:console /machine:I386 /nodefaultlib:"LIBC.lib" /out:"Release/comp-err.exe"
# Begin Target
diff --git a/VC++Files/innobase/innobase.dsp b/VC++Files/innobase/innobase.dsp
index 7e6f3037400..9985ec7e454 100644
--- a/VC++Files/innobase/innobase.dsp
+++ b/VC++Files/innobase/innobase.dsp
@@ -87,8 +87,8 @@ LIB32=xilink6.exe -lib
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "innobase___Win32_nt"
-# PROP Intermediate_Dir "innobase___Win32_nt"
+# PROP Output_Dir "nt"
+# PROP Intermediate_Dir "nt"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /G6 /MT /W3 /GX /O2 /I "../innobase/include" /I "../include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "WIN32" /D "_MBCS" /D "MYSQL_SERVER" /YX /FD /c
# ADD CPP /nologo /G6 /MT /W3 /GX /O2 /I "../innobase/include" /I "../include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "WIN32" /D "_MBCS" /D "MYSQL_SERVER" /FD /c
@@ -111,8 +111,8 @@ LIB32=xilink6.exe -lib
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "innobase___Win32_Max_nt"
-# PROP Intermediate_Dir "innobase___Win32_Max_nt"
+# PROP Output_Dir "max_nt"
+# PROP Intermediate_Dir "max_nt"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /G6 /MT /W3 /GX /O2 /I "../innobase/include" /I "../include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "WIN32" /D "_MBCS" /D "MYSQL_SERVER" /YX /FD /c
# ADD CPP /nologo /G6 /MT /W3 /GX /O2 /I "../innobase/include" /I "../include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "WIN32" /D "_MBCS" /D "MYSQL_SERVER" /FD /c
diff --git a/VC++Files/isamchk/isamchk.dsp b/VC++Files/isamchk/isamchk.dsp
index e1e0f8aac3a..0e8e2b04bd7 100644
--- a/VC++Files/isamchk/isamchk.dsp
+++ b/VC++Files/isamchk/isamchk.dsp
@@ -25,7 +25,7 @@ CFG=isamchk - Win32 Debug
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
-CPP=cl.exe
+CPP=xicl6.exe
RSC=rc.exe
!IF "$(CFG)" == "isamchk - Win32 Release"
@@ -49,7 +49,7 @@ RSC=rc.exe
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setargv.obj /nologo /subsystem:console /machine:I386 /out:"../client_release/isamchk.exe"
# SUBTRACT LINK32 /pdb:none
@@ -68,14 +68,14 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /I "../isam" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /I "../include" /I "../isam" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
# SUBTRACT CPP /Fr /YX
# ADD BASE RSC /l 0x41d /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib wsock32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setargv.obj /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"../client_debug/isamchk.exe" /pdbtype:sept
# SUBTRACT LINK32 /verbose /pdb:none
diff --git a/VC++Files/libmysql/libmysql.dsp b/VC++Files/libmysql/libmysql.dsp
index d4f7ed6df82..8ab15a03110 100644
--- a/VC++Files/libmysql/libmysql.dsp
+++ b/VC++Files/libmysql/libmysql.dsp
@@ -76,7 +76,7 @@ PostBuild_Cmds=xcopy release\libmysql.lib ..\lib_release /y
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "." /I "..\include" /I "../zlib" /D "_DEBUG" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /I "." /I "..\include" /I "../zlib" /D "_DEBUG" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
diff --git a/VC++Files/libmysqld/libmysqld.dsp b/VC++Files/libmysqld/libmysqld.dsp
index 691c66a074d..593c53a57ba 100644
--- a/VC++Files/libmysqld/libmysqld.dsp
+++ b/VC++Files/libmysqld/libmysqld.dsp
@@ -25,7 +25,7 @@ CFG=libmysqld - Win32 Debug
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
-CPP=cl.exe
+CPP=xicl6.exe
MTL=midl.exe
RSC=rc.exe
@@ -38,8 +38,8 @@ RSC=rc.exe
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
+# PROP Output_Dir "release"
+# PROP Intermediate_Dir "release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBMYSQLD_EXPORTS" /YX /FD /c
@@ -51,7 +51,7 @@ RSC=rc.exe
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_release\myisam.lib ..\lib_release\myisammrg.lib ..\lib_release\mysys.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib ..\lib_release\innodb.lib ..\lib_release\bdb.lib ..\lib_release\zlib.lib /nologo /dll /pdb:none /machine:I386 /out:"../lib_release/libmysqld.dll" /implib:"../lib_release/libmysqld.lib"
@@ -69,7 +69,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBMYSQLD_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MT /W3 /Gm /Zi /Od /I "../include" /I "../sql" /I "../regex" /I "../bdb/build_win32" /I "../zlib" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "HAVE_BERKELEY_DB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "HAVE_INNOBASE_DB" /D "USE_TLS" /D "__WIN__" /FD /GZ /c
+# ADD CPP /nologo /MT /W3 /Z7 /Od /I "../include" /I "../sql" /I "../regex" /I "../bdb/build_win32" /I "../zlib" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "HAVE_BERKELEY_DB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "HAVE_INNOBASE_DB" /D "USE_TLS" /D "__WIN__" /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x416 /d "_DEBUG"
@@ -77,7 +77,7 @@ LINK32=link.exe
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_debug\dbug.lib ..\lib_debug\mysys.lib ..\lib_debug\strings.lib ..\lib_debug\regex.lib ..\lib_debug\heap.lib ..\lib_debug\innodb.lib /nologo /dll /pdb:none /debug /machine:I386 /nodefaultlib:"LIBCMTD" /out:"../lib_debug/libmysqld.dll" /implib:"../lib_debug/libmysqld.lib"
diff --git a/VC++Files/libmysqltest/myTest.dsp b/VC++Files/libmysqltest/myTest.dsp
index 744b2c04993..1d3a790edd5 100644
--- a/VC++Files/libmysqltest/myTest.dsp
+++ b/VC++Files/libmysqltest/myTest.dsp
@@ -25,7 +25,7 @@ CFG=myTest - Win32 Debug
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
-CPP=cl.exe
+CPP=xicl6.exe
RSC=rc.exe
!IF "$(CFG)" == "myTest - Win32 Release"
@@ -49,7 +49,7 @@ RSC=rc.exe
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 libmysql.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\lib_release"
@@ -67,14 +67,14 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "..\include" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /I "..\include" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
# SUBTRACT CPP /Fr /YX
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 libmysql.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /pdbtype:sept /libpath:"..\lib_debug"
diff --git a/VC++Files/my_print_defaults/my_print_defaults.dsp b/VC++Files/my_print_defaults/my_print_defaults.dsp
index b485a20a844..25f5332eb0f 100644
--- a/VC++Files/my_print_defaults/my_print_defaults.dsp
+++ b/VC++Files/my_print_defaults/my_print_defaults.dsp
@@ -25,7 +25,7 @@ CFG=my_print_defaults - Win32 Debug
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
-CPP=cl.exe
+CPP=xicl6.exe
RSC=rc.exe
!IF "$(CFG)" == "my_print_defaults - Win32 Release"
@@ -37,8 +37,8 @@ RSC=rc.exe
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
+# PROP Output_Dir "release"
+# PROP Intermediate_Dir "release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
@@ -47,9 +47,9 @@ RSC=rc.exe
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /subsystem:console /machine:I386
+LINK32=xilink6.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "my_print_defaults - Win32 Debug"
@@ -64,16 +64,16 @@ LINK32=link.exe
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /MT /W3 /Gm /GX /ZI /Od /I "../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MT /W3 /GX /Z7 /Od /I "../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x416 /d "_DEBUG"
# ADD RSC /l 0x416 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"LIBCMTD.lib" /pdbtype:sept
+LINK32=xilink6.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"LIBCMTD.lib" /pdbtype:sept
!ENDIF
diff --git a/VC++Files/myisamlog/myisamlog.dsp b/VC++Files/myisamlog/myisamlog.dsp
index bbb6739cb16..6df65add63c 100644
--- a/VC++Files/myisamlog/myisamlog.dsp
+++ b/VC++Files/myisamlog/myisamlog.dsp
@@ -25,7 +25,7 @@ CFG=myisamlog - Win32 Debug
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
-CPP=cl.exe
+CPP=xicl6.exe
RSC=rc.exe
!IF "$(CFG)" == "myisamlog - Win32 Release"
@@ -37,8 +37,8 @@ RSC=rc.exe
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
+# PROP Output_Dir "release"
+# PROP Intermediate_Dir "release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
@@ -48,7 +48,7 @@ RSC=rc.exe
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib setargv.obj /nologo /subsystem:console /pdb:"release/myisamchk.pdb" /machine:I386 /out:"../client_release/myisamlog.exe"
# SUBTRACT LINK32 /pdb:none
@@ -74,7 +74,7 @@ LINK32=link.exe
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib wsock32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setargv.obj /nologo /subsystem:console /incremental:no /pdb:"debug/myisamchk.pdb" /debug /machine:I386 /out:"../client_debug/myisamlog.exe" /pdbtype:sept
# SUBTRACT LINK32 /pdb:none
diff --git a/VC++Files/mysql.dsw b/VC++Files/mysql.dsw
index d6903f4dbc7..4ff8c1df3fc 100644
--- a/VC++Files/mysql.dsw
+++ b/VC++Files/mysql.dsw
@@ -605,9 +605,6 @@ Package=<5>
Package=<4>
{{{
- Begin Project Dependency
- Project_Dep_Name strings
- End Project Dependency
}}}
###############################################################################
diff --git a/VC++Files/mysqlbinlog/mysqlbinlog.dsp b/VC++Files/mysqlbinlog/mysqlbinlog.dsp
index 5aea3a396e8..914bbcf70a3 100644
--- a/VC++Files/mysqlbinlog/mysqlbinlog.dsp
+++ b/VC++Files/mysqlbinlog/mysqlbinlog.dsp
@@ -25,7 +25,7 @@ CFG=mysqlbinlog - Win32 Debug
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
-CPP=cl.exe
+CPP=xicl6.exe
RSC=rc.exe
!IF "$(CFG)" == "mysqlbinlog - Win32 Release"
@@ -37,8 +37,8 @@ RSC=rc.exe
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
+# PROP Output_Dir "eelease"
+# PROP Intermediate_Dir "eelease"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
@@ -48,7 +48,7 @@ RSC=rc.exe
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"../client_release/mysqlbinlog.exe" /libpath:"..\lib_release\\"
# SUBTRACT LINK32 /pdb:none /debug
@@ -67,13 +67,13 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /I "../" /I "../sql" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "MYSQL_SERVER" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /I "../include" /I "../" /I "../sql" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "MYSQL_SERVER" /FD /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"../client_debug/mysqlbinlog.exe" /pdbtype:sept /libpath:"..\lib_debug\\"
diff --git a/VC++Files/mysqlcheck/mysqlcheck.dsp b/VC++Files/mysqlcheck/mysqlcheck.dsp
index 9b821261672..f8487119da3 100644
--- a/VC++Files/mysqlcheck/mysqlcheck.dsp
+++ b/VC++Files/mysqlcheck/mysqlcheck.dsp
@@ -25,7 +25,7 @@ CFG=mysqlcheck - Win32 Debug
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
-CPP=cl.exe
+CPP=xicl6.exe
RSC=rc.exe
!IF "$(CFG)" == "mysqlcheck - Win32 Release"
@@ -38,7 +38,7 @@ RSC=rc.exe
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
+# PROP Intermediate_Dir "release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
@@ -48,8 +48,8 @@ RSC=rc.exe
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+LINK32=xilink6.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"../client_release/mysqlcheck.exe" /libpath:"..\lib_release\\"
!ELSEIF "$(CFG)" == "mysqlcheck - Win32 Debug"
@@ -65,15 +65,15 @@ LINK32=link.exe
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "MYSQL_SERVER" /FD /c
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "MYSQL_SERVER" /FD /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+LINK32=xilink6.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"../client_debug/mysqlcheck.exe" /pdbtype:sept /libpath:"..\lib_debug\\"
!ENDIF
diff --git a/VC++Files/mysqldemb/mysqldemb.dsp b/VC++Files/mysqldemb/mysqldemb.dsp
index f28815c0f15..4a14401ed29 100644
--- a/VC++Files/mysqldemb/mysqldemb.dsp
+++ b/VC++Files/mysqldemb/mysqldemb.dsp
@@ -38,7 +38,7 @@ RSC=rc.exe
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
+# PROP Intermediate_Dir "release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /MT /W3 /O2 /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /I "../zlib" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "MYSQL_SERVER" /D "HAVE_INNOBASE_DB" /D "DBUG_OFF" /D "USE_TLS" /D "__WIN__" /FD /c
@@ -65,7 +65,7 @@ LIB32=xilink6.exe -lib
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /Zi /Od /I "../zlib" /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "MYSQL_SERVER" /D "HAVE_INNOBASE_DB" /D "USE_TLS" /D "__WIN__" /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Z7 /Od /I "../zlib" /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "MYSQL_SERVER" /D "HAVE_INNOBASE_DB" /D "USE_TLS" /D "__WIN__" /FD /GZ /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x416 /d "_DEBUG"
# ADD RSC /l 0x416 /d "_DEBUG"
diff --git a/VC++Files/mysqlmanager/MySqlManager.dsp b/VC++Files/mysqlmanager/MySqlManager.dsp
index a5338b8f5ce..c6108acfc8f 100644
--- a/VC++Files/mysqlmanager/MySqlManager.dsp
+++ b/VC++Files/mysqlmanager/MySqlManager.dsp
@@ -25,7 +25,7 @@ CFG=MySqlManager - Win32 Debug
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
-CPP=cl.exe
+CPP=xicl6.exe
MTL=midl.exe
RSC=rc.exe
@@ -52,7 +52,7 @@ RSC=rc.exe
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
# ADD LINK32 /nologo /subsystem:windows /machine:I386 /out:"../client_release/MySqlManager.exe"
# SUBTRACT LINK32 /nodefaultlib
@@ -71,7 +71,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /G6 /MTd /W3 /Gm /GR /GX /Zi /Od /I "../include" /D "_DEBUG" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /GR /GX /Z7 /Od /I "../include" /D "_DEBUG" /D "_WINDOWS" /FD /c
# SUBTRACT CPP /Fr /YX /Yc /Yu
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "_DEBUG" /o "NUL" /win32
@@ -81,7 +81,7 @@ LINK32=link.exe
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib /nologo /subsystem:windows /incremental:no /debug /machine:I386 /out:"../client_debug/MySqlManager.exe" /pdbtype:sept /libpath:"..\lib_debug\\"
# SUBTRACT LINK32 /pdb:none
diff --git a/VC++Files/mysqlserver/mysqlserver.dsp b/VC++Files/mysqlserver/mysqlserver.dsp
index 0ef59eb226e..d8df71ebbb2 100644
--- a/VC++Files/mysqlserver/mysqlserver.dsp
+++ b/VC++Files/mysqlserver/mysqlserver.dsp
@@ -25,7 +25,7 @@ CFG=mysqlserver - Win32 Debug
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
-CPP=cl.exe
+CPP=xicl6.exe
RSC=rc.exe
!IF "$(CFG)" == "mysqlserver - Win32 Release"
@@ -37,8 +37,8 @@ RSC=rc.exe
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
+# PROP Output_Dir "release"
+# PROP Intermediate_Dir "release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /MT /W3 /O2 /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "HAVE_BERKELEY_DB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "HAVE_INNOBASE_DB" /D "DBUG_OFF" /D "USE_TLS" /YX /FD /c
@@ -47,7 +47,7 @@ RSC=rc.exe
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LIB32=link.exe -lib
+LIB32=xilink6.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
@@ -64,13 +64,13 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /Zi /Od /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "HAVE_BERKELEY_DB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "HAVE_INNOBASE_DB" /D "USE_TLS" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Z7 /Od /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "HAVE_BERKELEY_DB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "HAVE_INNOBASE_DB" /D "USE_TLS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x416 /d "_DEBUG"
# ADD RSC /l 0x416 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LIB32=link.exe -lib
+LIB32=xilink6.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
diff --git a/VC++Files/mysqlshutdown/mysqlshutdown.dsp b/VC++Files/mysqlshutdown/mysqlshutdown.dsp
index fd78c6ddb21..d4dd389e99d 100644
--- a/VC++Files/mysqlshutdown/mysqlshutdown.dsp
+++ b/VC++Files/mysqlshutdown/mysqlshutdown.dsp
@@ -25,7 +25,7 @@ CFG=mysqlshutdown - Win32 Release
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
-CPP=cl.exe
+CPP=xicl6.exe
MTL=midl.exe
RSC=rc.exe
@@ -43,7 +43,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G6 /W3 /GX- /O2 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c
+# ADD CPP /nologo /G6 /W3 /O2 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
@@ -52,7 +52,7 @@ RSC=rc.exe
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /out:"../client_release/mysqlshutdown.exe"
@@ -72,7 +72,7 @@ LINK32=link.exe
# PROP Target_Dir ""
# ADD BASE CPP /nologo /G6 /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c
# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /G6 /W3 /GX- /O2 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c
+# ADD CPP /nologo /G6 /W3 /Z7 /O2 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
@@ -81,7 +81,7 @@ LINK32=link.exe
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /out:"../client_release/mysqlshutdown.exe"
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /out:"../client_debug/mysqlshutdown.exe"
diff --git a/VC++Files/mysys/mysys.dsp b/VC++Files/mysys/mysys.dsp
index 8d1928f4c6d..9f7a6bbf2e9 100644
--- a/VC++Files/mysys/mysys.dsp
+++ b/VC++Files/mysys/mysys.dsp
@@ -66,7 +66,7 @@ LIB32=xilink6.exe -lib
# PROP Intermediate_Dir "debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /G6 /MTd /W3 /ZI /Od /I "../include" /I "../zlib" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_WINDOWS" /D "USE_SYMDIR" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /I "../include" /I "../zlib" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_WINDOWS" /D "USE_SYMDIR" /FD /c
# SUBTRACT CPP /Fr
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
@@ -86,8 +86,8 @@ LIB32=xilink6.exe -lib
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "mysys___Win32_Max"
-# PROP Intermediate_Dir "mysys___Win32_Max"
+# PROP Output_Dir "max"
+# PROP Intermediate_Dir "max"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /G6 /MT /W3 /O2 /I "../include" /D "NDEBUG" /D "DBUG_OFF" /D "_WINDOWS" /FD /c
# SUBTRACT BASE CPP /YX
diff --git a/VC++Files/pack_isam/pack_isam.dsp b/VC++Files/pack_isam/pack_isam.dsp
index 25e4ef4a2e0..cdcba702e15 100644
--- a/VC++Files/pack_isam/pack_isam.dsp
+++ b/VC++Files/pack_isam/pack_isam.dsp
@@ -25,7 +25,7 @@ CFG=pack_isam - Win32 Debug
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
-CPP=cl.exe
+CPP=xicl6.exe
RSC=rc.exe
!IF "$(CFG)" == "pack_isam - Win32 Release"
@@ -48,7 +48,7 @@ RSC=rc.exe
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setargv.obj /nologo /subsystem:console /machine:I386 /out:"../client_release/pack_isam.exe"
@@ -66,14 +66,14 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /I "../isam" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /I "../include" /I "../isam" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
# SUBTRACT CPP /Fr
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib wsock32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setargv.obj /nologo /subsystem:console /debug /machine:I386 /out:"../client_debug/pack_isam.exe" /pdbtype:sept
diff --git a/VC++Files/perror/perror.dsp b/VC++Files/perror/perror.dsp
index 6d5c96b2a84..99bd8f67ae2 100644
--- a/VC++Files/perror/perror.dsp
+++ b/VC++Files/perror/perror.dsp
@@ -25,7 +25,7 @@ CFG=perror - Win32 Debug
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
-CPP=cl.exe
+CPP=xicl6.exe
MTL=midl.exe
RSC=rc.exe
@@ -38,8 +38,8 @@ RSC=rc.exe
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
+# PROP Output_Dir "release"
+# PROP Intermediate_Dir "release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
@@ -52,7 +52,7 @@ RSC=rc.exe
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"../client_release/perror.exe"
# SUBTRACT LINK32 /pdb:none
@@ -71,7 +71,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FD /GZ /c
+# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /I "../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FD /GZ /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
@@ -80,7 +80,7 @@ LINK32=link.exe
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib wsock32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /incremental:no /debug /machine:I386 /pdbtype:sept
# SUBTRACT LINK32 /pdb:none
diff --git a/VC++Files/replace/replace.dsp b/VC++Files/replace/replace.dsp
index f0c4848156a..2fe763ff388 100644
--- a/VC++Files/replace/replace.dsp
+++ b/VC++Files/replace/replace.dsp
@@ -25,7 +25,7 @@ CFG=replace - Win32 Debug
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
-CPP=cl.exe
+CPP=xicl6.exe
RSC=rc.exe
!IF "$(CFG)" == "replace - Win32 Release"
@@ -49,7 +49,7 @@ RSC=rc.exe
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setargv.obj /nologo /subsystem:console /machine:I386 /out:"../client_release/replace.exe"
@@ -67,14 +67,14 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /I "../include" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x40b /d "_DEBUG"
# ADD RSC /l 0x40b /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib wsock32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setargv.obj /nologo /subsystem:console /incremental:no /machine:I386 /out:"../client_debug/replace.exe" /pdbtype:sept
# SUBTRACT LINK32 /debug
diff --git a/VC++Files/sql/mysqld.dsp b/VC++Files/sql/mysqld.dsp
index 8192623f957..f8724fb0b06 100644
--- a/VC++Files/sql/mysqld.dsp
+++ b/VC++Files/sql/mysqld.dsp
@@ -28,7 +28,7 @@ CFG=mysqld - Win32 Release
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
-CPP=cl.exe
+CPP=xicl6.exe
RSC=rc.exe
!IF "$(CFG)" == "mysqld - Win32 Release"
@@ -52,7 +52,7 @@ RSC=rc.exe
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_release\vio.lib ..\lib_release\isam.lib ..\lib_release\merge.lib ..\lib_release\mysys.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib /nologo /subsystem:console /pdb:none /machine:I386 /out:"../client_release/mysqld-opt.exe"
# SUBTRACT LINK32 /debug
@@ -71,14 +71,14 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../bdb/build_win32" /I "../include" /I "../regex" /I "../zlib" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "USE_SYMDIR" /D "HAVE_DLOPEN" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /I "../bdb/build_win32" /I "../include" /I "../regex" /I "../zlib" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "USE_SYMDIR" /D "HAVE_DLOPEN" /FD /c
# SUBTRACT CPP /Fr /YX
# ADD BASE RSC /l 0x410 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_debug\dbug.lib ..\lib_debug\vio.lib ..\lib_debug\isam.lib ..\lib_debug\merge.lib ..\lib_debug\mysys.lib ..\lib_debug\strings.lib ..\lib_debug\regex.lib ..\lib_debug\heap.lib ..\lib_debug\bdb.lib ..\lib_debug\innodb.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"../client_debug/mysqld.exe" /pdbtype:sept
@@ -105,7 +105,7 @@ LINK32=link.exe
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_release\dbug.lib ..\lib_release\isam.lib ..\lib_release\merge.lib ..\lib_release\mysys.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib /nologo /subsystem:console /debug /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_release\vio.lib ..\lib_release\isam.lib ..\lib_release\merge.lib ..\lib_release\myisam.lib ..\lib_release\myisammrg.lib ..\lib_release\mysys.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib ..\lib_release\innodb.lib ..\lib_release\zlib.lib /nologo /subsystem:console /map /machine:I386 /out:"../client_release/mysqld-nt.exe"
# SUBTRACT LINK32 /pdb:none /debug
@@ -133,7 +133,7 @@ LINK32=link.exe
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_release\isam.lib ..\lib_release\merge.lib ..\lib_release\myisam.lib ..\lib_release\myisammrg.lib ..\lib_release\mysys.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib ..\lib_release\zlib.lib /nologo /subsystem:console /map /machine:I386 /out:"../client_release/mysqld-nt.exe"
# SUBTRACT BASE LINK32 /pdb:none /debug
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_release\vio.lib ..\lib_release\isam.lib ..\lib_release\merge.lib ..\lib_release\myisam.lib ..\lib_release\myisammrg.lib ..\lib_release\mysys-max.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib ..\lib_release\zlib.lib ..\lib_release\innodb.lib ..\lib_release\bdb.lib /nologo /subsystem:console /map /machine:I386 /out:"../client_release/mysqld-max-nt.exe"
@@ -162,7 +162,7 @@ LINK32=link.exe
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_release\isam.lib ..\lib_release\merge.lib ..\lib_release\mysys.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib /nologo /subsystem:console /pdb:none /debug /machine:I386 /out:"../client_release/mysqld-opt.exe"
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_release\vio.lib ..\lib_release\isam.lib ..\lib_release\merge.lib ..\lib_release\myisam.lib ..\lib_release\myisammrg.lib ..\lib_release\mysys-max.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib ..\lib_release\innodb.lib ..\lib_release\bdb.lib ..\lib_release\zlib.lib /nologo /subsystem:console /pdb:none /machine:I386 /out:"../client_release/mysqld-max.exe"
# SUBTRACT LINK32 /debug
diff --git a/VC++Files/test1/test1.dsp b/VC++Files/test1/test1.dsp
index fb70ceda692..df4b31d684e 100644
--- a/VC++Files/test1/test1.dsp
+++ b/VC++Files/test1/test1.dsp
@@ -25,7 +25,7 @@ CFG=test1 - Win32 Debug
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
-CPP=cl.exe
+CPP=xicl6.exe
RSC=rc.exe
!IF "$(CFG)" == "test1 - Win32 Release"
@@ -49,7 +49,7 @@ RSC=rc.exe
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
@@ -67,14 +67,14 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /I "../include" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 libmysql.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\lib_debug"
# SUBTRACT LINK32 /incremental:no
diff --git a/VC++Files/thr_test/thr_test.dsp b/VC++Files/thr_test/thr_test.dsp
index a7854a66049..0c80de42521 100644
--- a/VC++Files/thr_test/thr_test.dsp
+++ b/VC++Files/thr_test/thr_test.dsp
@@ -25,7 +25,7 @@ CFG=thr_test - Win32 Debug
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
-CPP=cl.exe
+CPP=xicl6.exe
RSC=rc.exe
!IF "$(CFG)" == "thr_test - Win32 Release"
@@ -49,7 +49,7 @@ RSC=rc.exe
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# SUBTRACT LINK32 /nodefaultlib
@@ -68,14 +68,14 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /D "__WIN32__" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /I "../include" /D "__WIN32__" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
# SUBTRACT CPP /Fr /YX
# ADD BASE RSC /l 0x40b /d "_DEBUG"
# ADD RSC /l 0x40b /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=link.exe
+LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /pdbtype:sept
diff --git a/VC++Files/vio/vio.dsp b/VC++Files/vio/vio.dsp
index 50c920a465d..c250e693995 100644
--- a/VC++Files/vio/vio.dsp
+++ b/VC++Files/vio/vio.dsp
@@ -25,7 +25,7 @@ CFG=vio - Win32 Debug
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
-CPP=cl.exe
+CPP=xicl6.exe
RSC=rc.exe
!IF "$(CFG)" == "vio - Win32 Release"
@@ -37,8 +37,8 @@ RSC=rc.exe
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
+# PROP Output_Dir "release"
+# PROP Intermediate_Dir "release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /D "NDEBUG" /D "DBUG_OFF" /D "_WINDOWS" /FD /c
@@ -47,7 +47,7 @@ RSC=rc.exe
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LIB32=link.exe -lib
+LIB32=xilink6.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"..\lib_release\vio.lib"
@@ -64,13 +64,13 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /G6 /MTd /W3 /ZI /Od /I "../include" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_WINDOWS" /D "USE_SYMDIR" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /I "../include" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_WINDOWS" /D "USE_SYMDIR" /FD /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LIB32=link.exe -lib
+LIB32=xilink6.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"..\lib_debug\vio.lib"
diff --git a/VC++Files/zlib/zlib.dsp b/VC++Files/zlib/zlib.dsp
index fd9d6b2bd68..40aaadaa4e1 100644
--- a/VC++Files/zlib/zlib.dsp
+++ b/VC++Files/zlib/zlib.dsp
@@ -25,7 +25,7 @@ CFG=zlib - Win32 Debug
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
-CPP=cl.exe
+CPP=xicl6.exe
RSC=rc.exe
!IF "$(CFG)" == "zlib - Win32 Release"
@@ -48,7 +48,7 @@ RSC=rc.exe
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LIB32=link.exe -lib
+LIB32=xilink6.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"..\lib_release\zlib.lib"
@@ -65,13 +65,13 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /G6 /MTd /W3 /Zi /Od /D "_DEBUG" /D "__WIN32__" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /D "_DEBUG" /D "__WIN32__" /D "_WINDOWS" /FD /c
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LIB32=link.exe -lib
+LIB32=xilink6.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"..\lib_debug\zlib.lib"
diff --git a/acconfig.h b/acconfig.h
index 0b822d67cf5..b254b3263fd 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -213,6 +213,9 @@
/* Define if the system files define ulong */
#undef HAVE_ULONG
+/* Define if the system files define in_addr_t */
+#undef HAVE_IN_ADDR_T
+
/* UNIXWARE7 threads are not posix */
#undef HAVE_UNIXWARE7_THREADS
diff --git a/acinclude.m4 b/acinclude.m4
index 01edc6050da..577adba5769 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -244,6 +244,28 @@ fi
])
+AC_DEFUN(MYSQL_CHECK_IN_ADDR_T,
+[AC_MSG_CHECKING(for type in_addr_t)
+AC_CACHE_VAL(ac_cv_in_addr_t,
+[AC_TRY_RUN([#include <stdio.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+int main(int argc, char **argv)
+{
+ in_addr_t foo;
+ exit(0);
+}], ac_cv_in_addr_t=yes, ac_cv_in_addr_t=no, ac_cv_in_addr_t=no)])
+AC_MSG_RESULT($ac_cv_in_addr_t)
+if test "$ac_cv_in_addr_t" = "yes"
+then
+ AC_DEFINE(HAVE_IN_ADDR_T)
+fi
+])
+
+
AC_DEFUN(MYSQL_PTHREAD_YIELD,
[AC_CACHE_CHECK([if pthread_yield takes zero arguments], ac_cv_pthread_yield_zero_arg,
[AC_TRY_LINK([#define _GNU_SOURCE
diff --git a/client/mysql.cc b/client/mysql.cc
index b249ccbfbc5..37c83411091 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -1811,10 +1811,11 @@ print_field_types(MYSQL_RES *result)
MYSQL_FIELD *field;
while ((field = mysql_fetch_field(result)))
{
- tee_fprintf(PAGER,"'%s.%s.%s.%s' %d %d %d %d %d\n",
+ tee_fprintf(PAGER,"Catalog: '%s'\nDatabase: '%s'\nTable: '%s'\nName: '%s'\nType: %d\nLength: %d\nMax length: %d\nIs_null: %d\nFlags: %d\nDecimals: %d\n\n",
field->catalog, field->db, field->table, field->name,
(int) field->type,
- field->length, field->max_length,
+ field->length, field->max_length,
+ !IS_NOT_NULL(field->flags),
field->flags, field->decimals);
}
tee_puts("", PAGER);
@@ -2650,10 +2651,10 @@ com_status(String *buffer __attribute__((unused)),
(void) mysql_fetch_row(result); // Read eof
}
#ifdef HAVE_OPENSSL
- if (mysql.net.vio && mysql.net.vio->ssl_ &&
- SSL_get_cipher(mysql.net.vio->ssl_))
+ if (mysql.net.vio && mysql.net.vio->ssl_arg &&
+ SSL_get_cipher((SSL*) mysql.net.vio->ssl_arg))
tee_fprintf(stdout, "SSL:\t\t\tCipher in use is %s\n",
- SSL_get_cipher(mysql.net.vio->ssl_));
+ SSL_get_cipher((SSL*) mysql.net.vio->ssl_arg));
else
#endif /* HAVE_OPENSSL */
tee_puts("SSL:\t\t\tNot in use", stdout);
diff --git a/client/mysqladmin.c b/client/mysqladmin.c
index 018bcbc1963..f263d321a7b 100644
--- a/client/mysqladmin.c
+++ b/client/mysqladmin.c
@@ -769,9 +769,12 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
return 1;
}
if (argv[1][0])
- make_scrambled_password(crypted_pw,argv[1],
- (find_type(argv[0], &command_typelib, 2) ==
- ADMIN_OLD_PASSWORD), &rand_st);
+ {
+ if (find_type(argv[0], &command_typelib, 2) == ADMIN_OLD_PASSWORD)
+ make_scrambled_password_323(crypted_pw, argv[1]);
+ else
+ make_scrambled_password(crypted_pw, argv[1]);
+ }
else
crypted_pw[0]=0; /* No password */
sprintf(buff,"set password='%s',sql_log_off=0",crypted_pw);
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index 9fdda0a3853..942c55f3078 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -182,7 +182,16 @@ public:
void process(Append_block_log_event *ae)
{
if (ae->file_id >= file_names.elements)
- die("Skiped CreateFile event for file_id: %u",ae->file_id);
+ {
+ /*
+ There is no Create_file event (a bad binlog or a big
+ --position). Assuming it's a big --position, we just do nothing and
+ print a warning.
+ */
+ fprintf(stderr,"Warning: ignoring Append_block as there is no \
+Create_file event for file_id: %u\n",ae->file_id);
+ return;
+ }
Create_file_log_event* ce=
*((Create_file_log_event**)file_names.buffer + ae->file_id);
append_to_file(ce->fname,O_APPEND|O_BINARY|O_WRONLY,ae->block,ae->block_len);
@@ -567,45 +576,49 @@ Could not read entry at offset %s : Error in log format or read error",
}
if (rec_count >= offset)
{
- // see if we should skip this event (only care about queries for now)
- if (one_database)
- {
- if (ev->get_type_code() == QUERY_EVENT)
+ if (!short_form)
+ fprintf(result_file, "# at %s\n",llstr(old_off,llbuff));
+
+ switch (ev->get_type_code()) {
+ case QUERY_EVENT:
+ if (one_database)
{
- //const char * log_dbname = ev->get_db();
const char * log_dbname = ((Query_log_event*)ev)->db;
- //printf("entry: %llu, database: %s\n", rec_count, log_dbname);
-
if ((log_dbname != NULL) && (strcmp(log_dbname, database)))
{
- //printf("skipping, %s is not %s\n", log_dbname, database);
rec_count++;
delete ev;
continue; // next
}
-#ifndef DBUG_OFF
- else
- {
- printf("no skip\n");
- }
-#endif
- }
-#ifndef DBUG_OFF
- else
- {
- const char * query_type = ev->get_type_str();
- printf("not query -- %s\n", query_type);
}
-#endif
- }
- if (!short_form)
- fprintf(result_file, "# at %s\n",llstr(old_off,llbuff));
-
- switch (ev->get_type_code()) {
+ ev->print(result_file, short_form, last_db);
+ break;
case CREATE_FILE_EVENT:
{
Create_file_log_event* ce= (Create_file_log_event*)ev;
- ce->print(result_file, short_form, last_db,true);
+ if (one_database)
+ {
+ /*
+ We test if this event has to be ignored. If yes, we don't save this
+ event; this will have the good side-effect of ignoring all related
+ Append_block and Exec_load.
+ Note that Load event from 3.23 is not tested.
+ */
+ const char * log_dbname = ce->db;
+ if ((log_dbname != NULL) && (strcmp(log_dbname, database)))
+ {
+ rec_count++;
+ delete ev;
+ continue; // next
+ }
+ }
+ /*
+ We print the event, but with a leading '#': this is just to inform the
+ user of the original command; the command we want to execute will be a
+ derivation of this original command (we will change the filename and
+ use LOCAL), prepared in the 'case EXEC_LOAD_EVENT' below.
+ */
+ ce->print(result_file, short_form, last_db, true);
load_processor.process(ce);
ev= 0;
break;
@@ -619,9 +632,20 @@ Could not read entry at offset %s : Error in log format or read error",
ev->print(result_file, short_form, last_db);
Execute_load_log_event *exv= (Execute_load_log_event*)ev;
Create_file_log_event *ce= load_processor.grab_event(exv->file_id);
- ce->print(result_file, short_form, last_db,true);
- my_free((char*)ce->fname,MYF(MY_WME));
- delete ce;
+ /*
+ if ce is 0, it probably means that we have not seen the Create_file
+ event (a bad binlog, or most probably --position is after the
+ Create_file event). Print a warning comment.
+ */
+ if (ce)
+ {
+ ce->print(result_file, short_form, last_db,true);
+ my_free((char*)ce->fname,MYF(MY_WME));
+ delete ce;
+ }
+ else
+ fprintf(stderr,"Warning: ignoring Exec_load as there is no \
+Create_file event for file_id: %u\n",exv->file_id);
break;
}
default:
@@ -633,7 +657,7 @@ Could not read entry at offset %s : Error in log format or read error",
delete ev;
}
if (fd >= 0)
- my_close(fd, MYF(MY_WME));
+ my_close(fd, MYF(MY_WME));
end_io_cache(file);
}
diff --git a/client/mysqldump.c b/client/mysqldump.c
index b317c7e5d13..5e57f6480db 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -297,7 +297,7 @@ static int dump_all_tables_in_db(char *db);
static int init_dumping(char *);
static int dump_databases(char **);
static int dump_all_databases();
-static char *quote_name(char *name, char *buff);
+static char *quote_name(const char *name, char *buff, my_bool force);
static void print_quoted_xml(FILE *output, char *fname, char *str, uint len);
static void print_version(void)
@@ -347,7 +347,7 @@ static void write_header(FILE *sql_file, char *db_name)
fprintf(sql_file, "-- MySQL dump %s\n--\n", DUMP_VERSION);
fprintf(sql_file, "-- Host: %s Database: %s\n",
current_host ? current_host : "localhost", db_name ? db_name : "");
- fputs("---------------------------------------------------------\n",
+ fputs("-- ------------------------------------------------------\n",
sql_file);
fprintf(sql_file, "-- Server version\t%s\n",
mysql_get_server_info(&mysql_connection));
@@ -631,33 +631,43 @@ static my_bool test_if_special_chars(const char *str)
return 0;
} /* test_if_special_chars */
-static char *quote_name(char *name, char *buff)
+
+static char *quote_name(const char *name, char *buff, my_bool force)
{
- char *end;
- if (!opt_quoted && !test_if_special_chars(name))
- return name;
- buff[0]=QUOTE_CHAR;
- end=strmov(buff+1,name);
- end[0]=QUOTE_CHAR;
- end[1]=0;
+ char *to= buff;
+ if (!force && !opt_quoted && !test_if_special_chars(name))
+ return (char*) name;
+ *to++= QUOTE_CHAR;
+ while (*name)
+ {
+ if (*name == QUOTE_CHAR)
+ *to= QUOTE_CHAR;
+ *to++= *name++;
+ }
+ to[0]=QUOTE_CHAR;
+ to[1]=0;
return buff;
} /* quote_name */
/*
-** getStructure -- retrievs database structure, prints out corresponding
-** CREATE statement and fills out insert_pat.
-** Return values: number of fields in table, 0 if error
+ getStructure -- retrievs database structure, prints out corresponding
+ CREATE statement and fills out insert_pat.
+
+ RETURN
+ number of fields in table, 0 if error
*/
+
static uint getTableStructure(char *table, char* db)
{
MYSQL_RES *tableRes;
MYSQL_ROW row;
my_bool init=0;
uint numFields;
- char *strpos, *table_name;
+ char *strpos, *result_table, *opt_quoted_table;
const char *delayed;
- char name_buff[NAME_LEN+3],table_buff[NAME_LEN+3];
+ char name_buff[NAME_LEN+3],table_buff[NAME_LEN*2+3];
+ char table_buff2[NAME_LEN*2+3];
FILE *sql_file = md_result_file;
DBUG_ENTER("getTableStructure");
@@ -667,7 +677,8 @@ static uint getTableStructure(char *table, char* db)
fprintf(stderr, "-- Retrieving table structure for table %s...\n", table);
sprintf(insert_pat,"SET OPTION SQL_QUOTE_SHOW_CREATE=%d", (opt_quoted || opt_keywords));
- table_name=quote_name(table,table_buff);
+ result_table= quote_name(table, table_buff, 1);
+ opt_quoted_table= quote_name(table, table_buff2, 0);
if (!mysql_query(sock,insert_pat))
{
/* using SHOW CREATE statement */
@@ -691,7 +702,7 @@ static uint getTableStructure(char *table, char* db)
end= strmov(end, ",");
}
}
- end= strmov(--end, "\" */");
+ end= strmov(end-1, "\" */");
if (mysql_query(sock, buff))
{
fprintf(stderr, "%s: Can't set the compatible mode '%s' (%s)\n",
@@ -701,11 +712,11 @@ static uint getTableStructure(char *table, char* db)
}
}
- sprintf(buff,"show create table `%s`",table);
+ sprintf(buff,"show create table %s", result_table);
if (mysql_query(sock, buff))
{
- fprintf(stderr, "%s: Can't get CREATE TABLE for table '%s' (%s)\n",
- my_progname, table, mysql_error(sock));
+ fprintf(stderr, "%s: Can't get CREATE TABLE for table %s (%s)\n",
+ my_progname, result_table, mysql_error(sock));
safe_exit(EX_MYSQLERR);
DBUG_RETURN(0);
}
@@ -724,10 +735,10 @@ static uint getTableStructure(char *table, char* db)
write_header(sql_file, db);
}
if (!opt_xml)
- fprintf(sql_file, "\n--\n-- Table structure for table '%s'\n--\n\n",
- table);
+ fprintf(sql_file, "\n--\n-- Table structure for table %s\n--\n\n",
+ result_table);
if (opt_drop)
- fprintf(sql_file, "DROP TABLE IF EXISTS %s;\n",table_name);
+ fprintf(sql_file, "DROP TABLE IF EXISTS %s;\n", opt_quoted_table);
tableRes=mysql_store_result(sock);
row=mysql_fetch_row(tableRes);
@@ -735,11 +746,11 @@ static uint getTableStructure(char *table, char* db)
fprintf(sql_file, "%s;\n", row[1]);
mysql_free_result(tableRes);
}
- sprintf(insert_pat,"show fields from %s",table_name);
+ sprintf(insert_pat,"show fields from %s", result_table);
if (mysql_query(sock,insert_pat) || !(tableRes=mysql_store_result(sock)))
{
- fprintf(stderr, "%s: Can't get info about table: '%s'\nerror: %s\n",
- my_progname, table, mysql_error(sock));
+ fprintf(stderr, "%s: Can't get info about table: %s\nerror: %s\n",
+ my_progname, result_table, mysql_error(sock));
if (path)
my_fclose(sql_file, MYF(MY_WME));
safe_exit(EX_MYSQLERR);
@@ -747,10 +758,11 @@ static uint getTableStructure(char *table, char* db)
}
if (cFlag)
- sprintf(insert_pat, "INSERT %sINTO %s (", delayed, table_name);
+ sprintf(insert_pat, "INSERT %sINTO %s (", delayed, opt_quoted_table);
else
{
- sprintf(insert_pat, "INSERT %sINTO %s VALUES ", delayed, table_name);
+ sprintf(insert_pat, "INSERT %sINTO %s VALUES ", delayed,
+ opt_quoted_table);
if (!extended_insert)
strcat(insert_pat,"(");
}
@@ -765,7 +777,7 @@ static uint getTableStructure(char *table, char* db)
}
init=1;
if (cFlag)
- strpos=strmov(strpos,quote_name(row[SHOW_FIELDNAME],name_buff));
+ strpos=strmov(strpos,quote_name(row[SHOW_FIELDNAME], name_buff, 0));
}
numFields = (uint) mysql_num_rows(tableRes);
mysql_free_result(tableRes);
@@ -775,11 +787,11 @@ static uint getTableStructure(char *table, char* db)
/* fprintf(stderr, "%s: Can't set SQL_QUOTE_SHOW_CREATE option (%s)\n",
my_progname, mysql_error(sock)); */
- sprintf(insert_pat,"show fields from %s",table_name);
+ sprintf(insert_pat,"show fields from %s", result_table);
if (mysql_query(sock,insert_pat) || !(tableRes=mysql_store_result(sock)))
{
- fprintf(stderr, "%s: Can't get info about table: '%s'\nerror: %s\n",
- my_progname, table, mysql_error(sock));
+ fprintf(stderr, "%s: Can't get info about table: %s\nerror: %s\n",
+ my_progname, result_table, mysql_error(sock));
safe_exit(EX_MYSQLERR);
DBUG_RETURN(0);
}
@@ -801,17 +813,17 @@ static uint getTableStructure(char *table, char* db)
write_header(sql_file, db);
}
if (!opt_xml)
- fprintf(sql_file, "\n--\n-- Table structure for table '%s'\n--\n\n",
- table);
+ fprintf(sql_file, "\n--\n-- Table structure for table %s\n--\n\n",
+ result_table);
if (opt_drop)
- fprintf(sql_file, "DROP TABLE IF EXISTS %s;\n",table_name);
- fprintf(sql_file, "CREATE TABLE %s (\n", table_name);
+ fprintf(sql_file, "DROP TABLE IF EXISTS %s;\n",result_table);
+ fprintf(sql_file, "CREATE TABLE %s (\n", result_table);
}
if (cFlag)
- sprintf(insert_pat, "INSERT %sINTO %s (", delayed, table_name);
+ sprintf(insert_pat, "INSERT %sINTO %s (", delayed, result_table);
else
{
- sprintf(insert_pat, "INSERT %sINTO %s VALUES ", delayed, table_name);
+ sprintf(insert_pat, "INSERT %sINTO %s VALUES ", delayed, result_table);
if (!extended_insert)
strcat(insert_pat,"(");
}
@@ -829,15 +841,17 @@ static uint getTableStructure(char *table, char* db)
}
init=1;
if (cFlag)
- strpos=strmov(strpos,quote_name(row[SHOW_FIELDNAME],name_buff));
+ strpos=strmov(strpos,quote_name(row[SHOW_FIELDNAME], name_buff, 0));
if (!tFlag)
{
if (opt_keywords)
- fprintf(sql_file, " %s.%s %s", table_name,
- quote_name(row[SHOW_FIELDNAME],name_buff), row[SHOW_TYPE]);
+ fprintf(sql_file, " %s.%s %s", result_table,
+ quote_name(row[SHOW_FIELDNAME],name_buff, 0),
+ row[SHOW_TYPE]);
else
fprintf(sql_file, " %s %s", quote_name(row[SHOW_FIELDNAME],
- name_buff), row[SHOW_TYPE]);
+ name_buff, 0),
+ row[SHOW_TYPE]);
if (row[SHOW_DEFAULT])
{
fputs(" DEFAULT ", sql_file);
@@ -856,11 +870,11 @@ static uint getTableStructure(char *table, char* db)
/* Make an sql-file, if path was given iow. option -T was given */
char buff[20+FN_REFLEN];
uint keynr,primary_key;
- sprintf(buff,"show keys from %s",table_name);
+ sprintf(buff,"show keys from %s", result_table);
if (mysql_query(sock, buff))
{
- fprintf(stderr, "%s: Can't get keys for table '%s' (%s)\n",
- my_progname, table, mysql_error(sock));
+ fprintf(stderr, "%s: Can't get keys for table %s (%s)\n",
+ my_progname, result_table, mysql_error(sock));
if (path)
my_fclose(sql_file, MYF(MY_WME));
safe_exit(EX_MYSQLERR);
@@ -897,15 +911,15 @@ static uint getTableStructure(char *table, char* db)
putc(')', sql_file);
if (atoi(row[1])) /* Test if duplicate key */
/* Duplicate allowed */
- fprintf(sql_file, ",\n KEY %s (",quote_name(row[2],name_buff));
+ fprintf(sql_file, ",\n KEY %s (",quote_name(row[2],name_buff,0));
else if (keynr == primary_key)
fputs(",\n PRIMARY KEY (",sql_file); /* First UNIQUE is primary */
else
- fprintf(sql_file, ",\n UNIQUE %s (",quote_name(row[2],name_buff));
+ fprintf(sql_file, ",\n UNIQUE %s (",quote_name(row[2],name_buff,0));
}
else
putc(',', sql_file);
- fputs(quote_name(row[4],name_buff), sql_file);
+ fputs(quote_name(row[4], name_buff, 0), sql_file);
if (row[7])
fprintf(sql_file, " (%s)",row[7]); /* Sub key */
}
@@ -916,23 +930,23 @@ static uint getTableStructure(char *table, char* db)
/* Get MySQL specific create options */
if (create_options)
{
- sprintf(buff,"show table status like '%s'",table);
+ sprintf(buff,"show table status like %s",result_table);
if (mysql_query(sock, buff))
{
if (mysql_errno(sock) != ER_PARSE_ERROR)
{ /* If old MySQL version */
if (verbose)
fprintf(stderr,
- "-- Warning: Couldn't get status information for table '%s' (%s)\n",
- table,mysql_error(sock));
+ "-- Warning: Couldn't get status information for table %s (%s)\n",
+ result_table,mysql_error(sock));
}
}
else if (!(tableRes=mysql_store_result(sock)) ||
!(row=mysql_fetch_row(tableRes)))
{
fprintf(stderr,
- "Error: Couldn't read status information for table '%s' (%s)\n",
- table,mysql_error(sock));
+ "Error: Couldn't read status information for table %s (%s)\n",
+ result_table,mysql_error(sock));
}
else
{
@@ -1016,6 +1030,7 @@ static char *field_escape(char *to,const char *from,uint length)
static void dumpTable(uint numFields, char *table)
{
char query[QUERY_LENGTH], *end, buff[256],table_buff[NAME_LEN+3];
+ char *result_table, table_buff2[NAME_LEN*2+3], *opt_quoted_table;
MYSQL_RES *res;
MYSQL_FIELD *field;
MYSQL_ROW row;
@@ -1023,6 +1038,8 @@ static void dumpTable(uint numFields, char *table)
if (verbose)
fprintf(stderr, "-- Sending SELECT query...\n");
+ result_table= quote_name(table,table_buff, 1);
+ opt_quoted_table= quote_name(table, table_buff2, 0);
if (path)
{
char filename[FN_REFLEN], tmp_path[FN_REFLEN];
@@ -1049,7 +1066,7 @@ static void dumpTable(uint numFields, char *table)
end= add_load_option(end, lines_terminated, " LINES TERMINATED BY");
*end= '\0';
- sprintf(buff," FROM %s",quote_name(table,table_buff));
+ sprintf(buff," FROM %s", result_table);
end= strmov(end,buff);
if (where)
end= strxmov(end, " WHERE ",where,NullS);
@@ -1062,10 +1079,10 @@ static void dumpTable(uint numFields, char *table)
else
{
if (!opt_xml)
- fprintf(md_result_file,"\n--\n-- Dumping data for table '%s'\n--\n",
- table);
+ fprintf(md_result_file,"\n--\n-- Dumping data for table %s\n--\n",
+ result_table);
sprintf(query, "SELECT /*!40001 SQL_NO_CACHE */ * FROM %s",
- quote_name(table,table_buff));
+ result_table);
if (where)
{
if (!opt_xml)
@@ -1092,18 +1109,17 @@ static void dumpTable(uint numFields, char *table)
fprintf(stderr, "-- Retrieving rows...\n");
if (mysql_num_fields(res) != numFields)
{
- fprintf(stderr,"%s: Error in field count for table: '%s' ! Aborting.\n",
- my_progname,table);
+ fprintf(stderr,"%s: Error in field count for table: %s ! Aborting.\n",
+ my_progname, result_table);
safe_exit(EX_CONSCHECK);
return;
}
if (opt_disable_keys)
- fprintf(md_result_file,"/*!40000 ALTER TABLE %s DISABLE KEYS */;\n",
- quote_name(table, table_buff));
+ fprintf(md_result_file, "\n/*!40000 ALTER TABLE %s DISABLE KEYS */;\n",
+ opt_quoted_table);
if (opt_lock)
- fprintf(md_result_file,"LOCK TABLES %s WRITE;\n",
- quote_name(table,table_buff));
+ fprintf(md_result_file,"LOCK TABLES %s WRITE;\n", opt_quoted_table);
total_length=net_buffer_length; /* Force row break */
row_break=0;
@@ -1131,13 +1147,13 @@ static void dumpTable(uint numFields, char *table)
{
if (!(field = mysql_fetch_field(res)))
{
- sprintf(query,"%s: Not enough fields from table '%s'! Aborting.\n",
- my_progname,table);
+ sprintf(query,"%s: Not enough fields from table %s! Aborting.\n",
+ my_progname, result_table);
fputs(query,stderr);
safe_exit(EX_CONSCHECK);
return;
}
- if (extended_insert)
+ if (extended_insert && !opt_xml)
{
ulong length = lengths[i];
if (i == 0)
@@ -1222,7 +1238,7 @@ static void dumpTable(uint numFields, char *table)
if (opt_xml)
fprintf(md_result_file, "\t</row>\n");
- if (extended_insert)
+ if (extended_insert && !opt_xml)
{
ulong row_length;
dynstr_append(&extended_row,")");
@@ -1259,11 +1275,11 @@ static void dumpTable(uint numFields, char *table)
fflush(md_result_file);
if (mysql_errno(sock))
{
- sprintf(query,"%s: Error %d: %s when dumping table '%s' at row: %ld\n",
+ sprintf(query,"%s: Error %d: %s when dumping table %s at row: %ld\n",
my_progname,
mysql_errno(sock),
mysql_error(sock),
- table,
+ result_table,
rownr);
fputs(query,stderr);
safe_exit(EX_CONSCHECK);
@@ -1273,7 +1289,7 @@ static void dumpTable(uint numFields, char *table)
fputs("UNLOCK TABLES;\n", md_result_file);
if (opt_disable_keys)
fprintf(md_result_file,"/*!40000 ALTER TABLE %s ENABLE KEYS */;\n",
- quote_name(table,table_buff));
+ opt_quoted_table);
if (opt_autocommit)
fprintf(md_result_file, "commit;\n");
mysql_free_result(res);
@@ -1404,7 +1420,7 @@ static int init_dumping(char *database)
(opt_quoted ? "`" : ""));
}
}
- if (extended_insert)
+ if (extended_insert && !opt_xml)
if (init_dynamic_string(&extended_row, "", 1024, 1024))
exit(EX_EOM);
return 0;
@@ -1415,7 +1431,7 @@ static int dump_all_tables_in_db(char *database)
{
char *table;
uint numrows;
- char table_buff[NAME_LEN+3];
+ char table_buff[NAME_LEN*2+3];
if (init_dumping(database))
return 1;
@@ -1427,7 +1443,7 @@ static int dump_all_tables_in_db(char *database)
init_dynamic_string(&query, "LOCK TABLES ", 256, 1024);
for (numrows=0 ; (table = getTableName(1)) ; numrows++)
{
- dynstr_append(&query, quote_name(table, table_buff));
+ dynstr_append(&query, quote_name(table, table_buff, 1));
dynstr_append(&query, " READ /*!32311 LOCAL */,");
}
if (numrows && mysql_real_query(sock, query.str, query.length-1))
@@ -1459,7 +1475,7 @@ static int dump_all_tables_in_db(char *database)
static int dump_selected_tables(char *db, char **table_names, int tables)
{
uint numrows;
- char table_buff[NAME_LEN+3];
+ char table_buff[NAME_LEN*+3];
if (init_dumping(db))
return 1;
@@ -1471,7 +1487,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
init_dynamic_string(&query, "LOCK TABLES ", 256, 1024);
for (i=0 ; i < tables ; i++)
{
- dynstr_append(&query, quote_name(table_names[i], table_buff));
+ dynstr_append(&query, quote_name(table_names[i], table_buff, 1));
dynstr_append(&query, " READ /*!32311 LOCAL */,");
}
if (mysql_real_query(sock, query.str, query.length-1))
@@ -1643,9 +1659,8 @@ int main(int argc, char **argv)
fprintf(md_result_file,
"\n--\n-- Position to start replication from\n--\n\n");
fprintf(md_result_file,
- "CHANGE MASTER TO MASTER_LOG_FILE='%s' ;\n", row[0]);
- fprintf(md_result_file, "CHANGE MASTER TO MASTER_LOG_POS=%s ;\n",
- row[1]);
+ "CHANGE MASTER TO MASTER_LOG_FILE='%s', \
+MASTER_LOG_POS=%s ;\n",row[0],row[1]);
}
mysql_free_result(master);
}
@@ -1676,7 +1691,7 @@ int main(int argc, char **argv)
if (md_result_file != stdout)
my_fclose(md_result_file, MYF(0));
my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR));
- if (extended_insert)
+ if (extended_insert & !opt_xml)
dynstr_free(&extended_row);
my_end(0);
return(first_error);
diff --git a/client/mysqlimport.c b/client/mysqlimport.c
index d049d69011b..5ad6d1dc429 100644
--- a/client/mysqlimport.c
+++ b/client/mysqlimport.c
@@ -45,16 +45,15 @@ static char *opt_password=0, *current_user=0,
*lines_terminated=0, *enclosed=0, *opt_enclosed=0,
*escaped=0, *opt_columns=0,
*default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME;
-static uint opt_mysql_port=0;
+static uint opt_mysql_port= 0, opt_protocol= 0;
static my_string opt_mysql_unix_port=0;
-static my_string opt_ignore_lines=0;
+static longlong opt_ignore_lines= -1;
static CHARSET_INFO *charset_info= &my_charset_latin1;
#include <sslopt-vars.h>
#ifdef HAVE_SMEM
static char *shared_memory_base_name=0;
#endif
-static uint opt_protocol=0;
static struct my_option my_long_options[] =
{
@@ -97,7 +96,7 @@ static struct my_option my_long_options[] =
{"ignore", 'i', "If duplicate unique key was found, keep old row.",
(gptr*) &ignore, (gptr*) &ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"ignore-lines", OPT_IGN_LINES, "Ignore first n lines of data infile.",
- (gptr*) &opt_ignore_lines, (gptr*) &opt_ignore_lines, 0, GET_STR,
+ (gptr*) &opt_ignore_lines, (gptr*) &opt_ignore_lines, 0, GET_LL,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"lines-terminated-by", OPT_LTB, "Lines in the i.file are terminated by ...",
(gptr*) &lines_terminated, (gptr*) &lines_terminated, 0, GET_STR,
@@ -259,7 +258,7 @@ static int get_options(int *argc, char ***argv)
static int write_to_table(char *filename, MYSQL *sock)
{
char tablename[FN_REFLEN], hard_path[FN_REFLEN],
- sql_statement[FN_REFLEN*2+256], *end;
+ sql_statement[FN_REFLEN*16+256], *end;
my_bool local_file;
DBUG_ENTER("write_to_table");
DBUG_PRINT("enter",("filename: %s",filename));
@@ -311,8 +310,9 @@ static int write_to_table(char *filename, MYSQL *sock)
" OPTIONALLY ENCLOSED BY");
end= add_load_option(end, escaped, " ESCAPED BY");
end= add_load_option(end, lines_terminated, " LINES TERMINATED BY");
- if (opt_ignore_lines)
- end= strmov(strmov(strmov(end, " IGNORE "), opt_ignore_lines), " LINES");
+ if (opt_ignore_lines >= 0)
+ end= strmov(longlong10_to_str(opt_ignore_lines,
+ strmov(end, " IGNORE "),10), " LINES");
if (opt_columns)
end= strmov(strmov(strmov(end, " ("), opt_columns), ")");
*end= '\0';
diff --git a/client/mysqltest.c b/client/mysqltest.c
index 3b814b27810..fd8cf7ecc8b 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -42,7 +42,7 @@
**********************************************************************/
-#define MTEST_VERSION "1.29"
+#define MTEST_VERSION "1.30"
#include <my_global.h>
#include <mysql_embed.h>
@@ -204,6 +204,7 @@ Q_WAIT_FOR_SLAVE_TO_STOP,
Q_REQUIRE_VERSION,
Q_ENABLE_WARNINGS, Q_DISABLE_WARNINGS,
Q_ENABLE_INFO, Q_DISABLE_INFO,
+Q_EXEC,
Q_UNKNOWN, /* Unknown command. */
Q_COMMENT, /* Comments, ignored. */
Q_COMMENT_WITH_COMMAND
@@ -226,6 +227,13 @@ const char *command_names[]=
"connection",
"query",
"connect",
+ /* the difference between sleep and real_sleep is that sleep will use
+ the delay from command line (--sleep) if there is one.
+ real_sleep always uses delay from it's argument.
+ the logic is that sometimes delays are cpu-dependent (and --sleep
+ can be used to set this delay. real_sleep is used for cpu-independent
+ delays
+ */
"sleep",
"real_sleep",
"inc",
@@ -267,6 +275,7 @@ const char *command_names[]=
"disable_warnings",
"enable_info",
"disable_info",
+ "exec",
0
};
@@ -501,15 +510,6 @@ void init_parser()
memset(&var_reg,0, sizeof(var_reg));
}
-int hex_val(int c)
-{
- if (my_isdigit(charset_info,c))
- return c - '0';
- else if ((c = my_tolower(charset_info,c)) >= 'a' && c <= 'f')
- return c - 'a' + 10;
- else
- return -1;
-}
int dyn_string_cmp(DYNAMIC_STRING* ds, const char* fname)
{
@@ -664,7 +664,7 @@ static VAR* var_obtain(char* name, int len)
if ((v = (VAR*)hash_search(&var_hash, name, len)))
return v;
v = var_init(0, name, len, "", 0);
- hash_insert(&var_hash, (byte*)v);
+ my_hash_insert(&var_hash, (byte*)v);
return v;
}
@@ -840,6 +840,66 @@ int do_source(struct st_query* q)
return open_file(name);
}
+/*
+ Execute given command.
+
+ SYNOPSIS
+ do_exec()
+ q called command
+
+ DESCRIPTION
+ If one uses --exec command [args] command in .test file
+ we will execute the command and record its output.
+
+ RETURN VALUES
+ 0 ok
+ 1 error
+*/
+
+int do_exec(struct st_query* q)
+{
+ int error= 0;
+ DYNAMIC_STRING *ds;
+ DYNAMIC_STRING ds_tmp;
+ char buf[1024];
+ FILE *res_file;
+ char *cmd= q->first_argument;
+
+ while (*cmd && my_isspace(charset_info, *cmd))
+ cmd++;
+ if (!*cmd)
+ die("Missing argument in exec\n");
+
+ if (q->record_file[0])
+ {
+ init_dynamic_string(&ds_tmp, "", 16384, 65536);
+ ds= &ds_tmp;
+ }
+ else
+ ds= &ds_res;
+
+ if (!(res_file= popen(cmd, "r")) && q->abort_on_error)
+ die("popen() failed\n");
+ while (fgets(buf, sizeof(buf), res_file))
+ dynstr_append(ds, buf);
+ pclose(res_file);
+ if (record)
+ {
+ if (!q->record_file[0] && !result_file)
+ die("At line %u: Missing result file", start_lineno);
+ if (!result_file)
+ str_to_file(q->record_file, ds->str, ds->length);
+ }
+ else if (q->record_file[0])
+ {
+ error= check_result(ds, q->record_file, q->require_file);
+ }
+ if (ds == &ds_tmp)
+ dynstr_free(&ds_tmp);
+
+ return error;
+}
+
int var_query_set(VAR* v, const char* p, const char** p_end)
{
char* end = (char*)((p_end && *p_end) ? *p_end : p + strlen(p));
@@ -862,7 +922,28 @@ int var_query_set(VAR* v, const char* p, const char** p_end)
}
if ((row = mysql_fetch_row(res)) && row[0])
- eval_expr(v, row[0], 0);
+ {
+ /*
+ Concatenate all row results with tab in between to allow us to work
+ with results from many columns (for example from SHOW VARIABLES)
+ */
+ DYNAMIC_STRING result;
+ uint i;
+ ulong *lengths;
+ char *end;
+
+ init_dynamic_string(&result, "", 16384, 65536);
+ lengths= mysql_fetch_lengths(res);
+ for (i=0; i < mysql_num_fields(res); i++)
+ {
+ if (row[0])
+ dynstr_append_mem(&result, row[i], lengths[i]);
+ dynstr_append_mem(&result, "\t", 1);
+ }
+ end= result.str + result.length-1;
+ eval_expr(v, result.str, (const char**) &end);
+ dynstr_free(&result);
+ }
else
eval_expr(v, "", 0);
@@ -919,8 +1000,6 @@ int eval_expr(VAR* v, const char* p, const char** p_end)
return 0;
}
- if (p_end)
- *p_end = 0;
die("Invalid expr: %s", p);
return 1;
}
@@ -1217,7 +1296,7 @@ static char *get_string(char **to_ptr, char **from_ptr,
VAR *var=var_get(start, &end, 0, 1);
if (var && to == (char*) end+1)
{
- DBUG_PRINT("info",("var: %s -> %s", start, var->str_val));
+ DBUG_PRINT("info",("var: '%s' -> '%s'", start, var->str_val));
DBUG_RETURN(var->str_val); /* return found variable value */
}
}
@@ -1547,56 +1626,6 @@ int do_while(struct st_query* q)
}
-int safe_copy_unescape(char* dest, char* src, int size)
-{
- register char* p_dest = dest, *p_src = src;
- register int c, val;
- enum { ST_NORMAL, ST_ESCAPED, ST_HEX2} state = ST_NORMAL ;
-
- size--; /* just to make life easier */
-
- for (; p_dest - size < dest && p_src - size < src &&
- (c = *p_src) != '\n' && c; ++p_src)
- {
- switch(state) {
- case ST_NORMAL:
- if (c == '\\')
- state = ST_ESCAPED;
- else
- *p_dest++ = c;
- break;
- case ST_ESCAPED:
- if ((val = hex_val(c)) > 0)
- {
- *p_dest = val;
- state = ST_HEX2;
- }
- else
- {
- state = ST_NORMAL;
- *p_dest++ = c;
- }
- break;
- case ST_HEX2:
- if ((val = hex_val(c)) > 0)
- {
- *p_dest = (*p_dest << 4) + val;
- p_dest++;
- }
- else
- *p_dest++ = c;
-
- state = ST_NORMAL;
- break;
-
- }
- }
-
- *p_dest = 0;
- return (p_dest - dest);
-}
-
-
int read_line(char* buf, int size)
{
int c;
@@ -2149,7 +2178,7 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags)
if (!(flags & QUERY_REAP))
DBUG_RETURN(0);
- if (mysql_read_query_result(mysql) ||
+ if ((*mysql->methods->read_query_result)(mysql) ||
(!(last_result = res = mysql_store_result(mysql)) &&
mysql_field_count(mysql)))
{
@@ -2371,7 +2400,7 @@ static void var_from_env(const char *name, const char *def_val)
tmp = def_val;
v = var_init(0, name, 0, tmp, 0);
- hash_insert(&var_hash, (byte*)v);
+ my_hash_insert(&var_hash, (byte*)v);
}
@@ -2387,9 +2416,9 @@ static void init_var_hash(MYSQL *mysql)
var_from_env("MYSQL_TEST_DIR", "/tmp");
var_from_env("BIG_TEST", opt_big_test ? "1" : "0");
v= var_init(0,"MAX_TABLES", 0, (sizeof(ulong) == 4) ? "31" : "62",0);
- hash_insert(&var_hash, (byte*) v);
+ my_hash_insert(&var_hash, (byte*) v);
v= var_init(0,"SERVER_VERSION", 0, mysql_get_server_info(mysql), 0);
- hash_insert(&var_hash, (byte*) v);
+ my_hash_insert(&var_hash, (byte*) v);
DBUG_VOID_RETURN;
}
@@ -2584,6 +2613,9 @@ int main(int argc, char **argv)
case Q_PING:
(void) mysql_ping(&cur_con->mysql);
break;
+ case Q_EXEC:
+ (void) do_exec(q);
+ break;
default: processed = 0; break;
}
}
diff --git a/configure.in b/configure.in
index f376e77e09a..eb8daea18d4 100644
--- a/configure.in
+++ b/configure.in
@@ -38,12 +38,12 @@ do
case $host_os in
netware* | modesto*)
echo "$i/errmsg.sys: $i/errmsg.txt
- \$(top_builddir)/extra/comp_err.linux \$^ $i/errmsg.sys" \
+ \$(top_builddir)/extra/comp_err.linux -C\$(srcdir)/charsets/ \$^ $i/errmsg.sys" \
>> $AVAILABLE_LANGUAGES_ERRORS_RULES
;;
*)
echo "$i/errmsg.sys: $i/errmsg.txt
- \$(top_builddir)/extra/comp_err \$^ $i/errmsg.sys" \
+ \$(top_builddir)/extra/comp_err -C\$(srcdir)/charsets/ \$^ $i/errmsg.sys" \
>> $AVAILABLE_LANGUAGES_ERRORS_RULES
;;
esac
@@ -1337,7 +1337,12 @@ then
if test -f /usr/lib/libthread.so -o -f /usr/lib/libthreadT.so
then
MYSQL_REMOVE_SOCKET_FROM_LIBS_HACK
- with_named_thread="-Kthread -lsocket -lnsl"
+ if expr "$CC" : ".*gcc.*"
+ then
+ with_named_thread="-pthread -lsocket -lnsl"
+ else
+ with_named_thread="-Kthread -lsocket -lnsl"
+ fi
if expr "$SYSTEM_TYPE" : ".*unixware7.0.0" > /dev/null
then
AC_DEFINE(HAVE_UNIXWARE7_THREADS)
@@ -1373,7 +1378,12 @@ then
if test -f /usr/lib/libthread.so -o -f /usr/lib/libthreadT.so
then
MYSQL_REMOVE_SOCKET_FROM_LIBS_HACK
- with_named_thread="-Kthread -lsocket -lnsl"
+ if expr "$CC" : ".*gcc.*"
+ then
+ with_named_thread="-pthread -lsocket -lnsl"
+ else
+ with_named_thread="-Kthread -lsocket -lnsl"
+ fi
if expr "$SYSTEM_TYPE" : ".*unixware7.0.0" > /dev/null
then
AC_DEFINE(HAVE_UNIXWARE7_THREADS)
@@ -1719,8 +1729,10 @@ MYSQL_CHECK_ULONG
MYSQL_CHECK_UCHAR
# Do the system files define uint
MYSQL_CHECK_UINT
-#Check for fp_except in ieeefp.h
+# Check for fp_except in ieeefp.h
MYSQL_CHECK_FP_EXCEPT
+# Check for IN_ADDR_T
+MYSQL_CHECK_IN_ADDR_T
# Do the c++ compiler have a bool type
MYSQL_CXX_BOOL
# Check some common bugs with gcc 2.8.# on sparc
diff --git a/extra/comp_err.c b/extra/comp_err.c
index 806fb5052b4..07369aa565e 100644
--- a/extra/comp_err.c
+++ b/extra/comp_err.c
@@ -24,11 +24,13 @@
#define MAXLENGTH 1000
#define MAX_ROWS 1000
#define MAX_FILES 10
+#define MAX_CHARSET_NAME 64
int row_count;
uint file_pos[MAX_ROWS],file_row_pos[MAX_FILES];
my_string saved_row[MAX_ROWS];
uchar file_head[]= { 254,254,2,1 };
+char charset_name[MAX_CHARSET_NAME];
static void get_options(int *argc,char **argv[]);
static int count_rows(FILE *from,pchar c, pchar c2);
@@ -40,11 +42,12 @@ static int copy_rows(FILE *to);
int main(int argc,char *argv[])
{
+ uint csnum= 0;
int i,error,files,length;
uchar head[32];
FILE *from,*to;
MY_INIT(argv[0]);
-
+
get_options(&argc,&argv);
error=1;
row_count=files=0;
@@ -61,6 +64,20 @@ int main(int argc,char *argv[])
}
VOID(count_rows(from,'"','}')); /* Calculate start-info */
+ if (!charset_name[0])
+ {
+ fprintf(stderr,"Character set is not specified in '%s'\n",*argv);
+ fclose(from);
+ goto end;
+ }
+
+ if (!(csnum= get_charset_number(charset_name, MY_CS_PRIMARY)))
+ {
+ fprintf(stderr,"Unknown character '%s' in '%s'\n",charset_name, *argv);
+ fclose(from);
+ goto end;
+ }
+
if (remember_rows(from,'}') < 0) /* Remember rows */
{
fprintf(stderr,"Can't find textrows in '%s'\n",*argv);
@@ -91,7 +108,8 @@ int main(int argc,char *argv[])
{
int2store(head+10+i+i,file_row_pos[i]);
}
-
+ head[30]= csnum;
+
fseek(to,0l,0);
if (fwrite(head,1,32,to) != 32)
goto end;
@@ -134,6 +152,10 @@ static void get_options(register int *argc,register char **argv[])
case 'V':
printf("%s (Compile errormessage) Ver 1.3\n",progname);
break;
+ case 'C':
+ charsets_dir= pos+1;
+ *(pos--)= '\0';
+ break;
case 'I':
case '?':
printf(" %s (Compile errormessage) Ver 1.3\n",progname);
@@ -168,8 +190,19 @@ static int count_rows(FILE *from, pchar c, pchar c2)
DBUG_ENTER("count_rows");
pos=ftell(from); count=0;
+
+ charset_name[0]= '\0';
while (fgets(rad,MAXLENGTH,from) != NULL)
{
+ if (!strncmp(rad,"character-set=",14))
+ {
+ char *b= rad+14, *e;
+ for (e=b ; e[0] && e-b < MAX_CHARSET_NAME &&
+ e[0] != ' ' && e[0] != '\r' &&
+ e[0] != '\n' && e[0] != '\t' ; e++);
+ e[0]= '\0';
+ strcpy(charset_name, b);
+ }
if (rad[0] == c || rad[0] == c2)
break;
count++;
diff --git a/extra/my_print_defaults.c b/extra/my_print_defaults.c
index a5ce489c0fd..e580603bcb8 100644
--- a/extra/my_print_defaults.c
+++ b/extra/my_print_defaults.c
@@ -26,6 +26,7 @@
#include <my_getopt.h>
const char *config_file="my"; /* Default config file */
+uint verbose= 0, opt_defaults_file_used= 0;
static struct my_option my_long_options[] =
{
@@ -47,6 +48,8 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"help", '?', "Display this help message and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"verbose", 'v', "Increase the output level",
+ 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
@@ -54,7 +57,7 @@ static struct my_option my_long_options[] =
static void usage(my_bool version)
{
- printf("%s Ver 1.5 for %s at %s\n",my_progname,SYSTEM_TYPE,
+ printf("%s Ver 1.6 for %s at %s\n",my_progname,SYSTEM_TYPE,
MACHINE_TYPE);
if (version)
return;
@@ -72,12 +75,18 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument __attribute__((unused)))
{
switch (optid) {
+ case 'c':
+ opt_defaults_file_used= 1;
+ break;
case 'n':
exit(0);
case 'I':
case '?':
usage(0);
exit(0);
+ case 'v':
+ verbose++;
+ break;
case 'V':
usage(1);
exit(0);
@@ -103,7 +112,7 @@ static int get_options(int *argc,char ***argv)
int main(int argc, char **argv)
{
- int count;
+ int count, error;
char **load_default_groups, *tmp_arguments[2],
**argument, **arguments;
MY_INIT(argv[0]);
@@ -125,13 +134,26 @@ int main(int argc, char **argv)
arguments=tmp_arguments;
arguments[0]=my_progname;
arguments[1]=0;
- load_defaults(config_file, (const char **) load_default_groups,
- &count, &arguments);
+ if ((error= load_defaults(config_file, (const char **) load_default_groups,
+ &count, &arguments)))
+ {
+ if (verbose && opt_defaults_file_used)
+ {
+ if (error == 1)
+ fprintf(stderr, "WARNING: Defaults file '%s' not found!\n",
+ config_file);
+ /* This error is not available now. For the future */
+ if (error == 2)
+ fprintf(stderr, "WARNING: Defaults file '%s' is not a regular file!\n",
+ config_file);
+ }
+ error= 2;
+ }
for (argument= arguments+1 ; *argument ; argument++)
puts(*argument);
my_free((char*) load_default_groups,MYF(0));
free_defaults(arguments);
- exit(0);
+ exit(error);
}
diff --git a/extra/resolveip.c b/extra/resolveip.c
index cef79180720..a9e5f16e576 100644
--- a/extra/resolveip.c
+++ b/extra/resolveip.c
@@ -36,6 +36,10 @@
extern int h_errno;
#endif
+#ifndef HAVE_IN_ADDR_T
+#define in_addr_t u_long
+#endif
+
static my_bool silent;
@@ -91,8 +95,6 @@ static int get_options(int *argc,char ***argv)
{
int ho_error;
- /* load_defaults("my",load_default_groups,argc,argv); */
-
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error);
@@ -109,7 +111,7 @@ static int get_options(int *argc,char ***argv)
int main(int argc, char **argv)
{
struct hostent *hpaddr;
- u_long taddr;
+ in_addr_t taddr;
char *ip,**q;
int error=0;
diff --git a/include/config-win.h b/include/config-win.h
index 6b40a0f2ed3..884b2edfb63 100644
--- a/include/config-win.h
+++ b/include/config-win.h
@@ -280,9 +280,9 @@ inline double ulonglong2double(ulonglong value)
#define HAVE_CREATESEMAPHORE
#define HAVE_ISNAN
#define HAVE_FINITE
-#define HAVE_ISAM /* We want to have support for ISAM in 4.0 */
#define HAVE_QUERY_CACHE
#define SPRINTF_RETURNS_INT
+#define HAVE_SETFILEPOINTER
#define HAVE_VIO
#ifdef NOT_USED
diff --git a/include/errmsg.h b/include/errmsg.h
index 1f4e6e12f00..a354c125e36 100644
--- a/include/errmsg.h
+++ b/include/errmsg.h
@@ -86,3 +86,4 @@ extern const char *client_errors[]; /* Error messages */
#define CR_SHARED_MEMORY_CONNECT_SET_ERROR 2045
#define CR_CONN_UNKNOW_PROTOCOL 2046
#define CR_INVALID_CONN_HANDLE 2047
+#define CR_MYSQL_SERVER_INIT_MISSED 2048
diff --git a/include/hash.h b/include/hash.h
index 6c805bc2da7..3c2ae32c70e 100644
--- a/include/hash.h
+++ b/include/hash.h
@@ -49,7 +49,7 @@ void hash_free(HASH *tree);
byte *hash_element(HASH *hash,uint idx);
gptr hash_search(HASH *info,const byte *key,uint length);
gptr hash_next(HASH *info,const byte *key,uint length);
-my_bool hash_insert(HASH *info,const byte *data);
+my_bool my_hash_insert(HASH *info,const byte *data);
my_bool hash_delete(HASH *hash,byte *record);
my_bool hash_update(HASH *hash,byte *record,byte *old_key,uint old_key_length);
void hash_replace(HASH *hash, uint idx, byte *new_row);
diff --git a/include/m_ctype.h b/include/m_ctype.h
index 4ae6734a48c..b1557e5293b 100644
--- a/include/m_ctype.h
+++ b/include/m_ctype.h
@@ -63,6 +63,7 @@ typedef struct unicase_info_st
#define MY_CS_STRNXFRM 64 /* if strnxfrm is used for sort */
#define MY_CS_UNICODE 128 /* is a charset is full unicode */
#define MY_CS_NONTEXT 256 /* if a charset is not sprintf() compatible */
+#define MY_CS_AVAILABLE 512 /* If either compiled-in or loaded*/
#define MY_CHARSET_UNDEFINED 0
@@ -74,6 +75,12 @@ typedef struct my_uni_idx_st
uchar *tab;
} MY_UNI_IDX;
+typedef struct
+{
+ uint beg;
+ uint end;
+ uint mblen;
+} my_match_t;
enum my_lex_states
{
@@ -115,12 +122,18 @@ typedef struct my_collation_handler_st
int (*strcasecmp)(struct charset_info_st *, const char *, const char *);
+ uint (*instr)(struct charset_info_st *,
+ const char *big, uint b_length,
+ const char *small, uint s_length,
+ my_match_t *match, uint nmatch);
+
/* Hash calculation */
void (*hash_sort)(struct charset_info_st *cs, const uchar *key, uint len,
ulong *nr1, ulong *nr2);
} MY_COLLATION_HANDLER;
-extern MY_COLLATION_HANDLER my_collation_bin_handler;
+extern MY_COLLATION_HANDLER my_collation_mb_bin_handler;
+extern MY_COLLATION_HANDLER my_collation_8bit_bin_handler;
extern MY_COLLATION_HANDLER my_collation_8bit_simple_ci_handler;
@@ -131,6 +144,7 @@ typedef struct my_charset_handler_st
int (*mbcharlen)(struct charset_info_st *, uint);
uint (*numchars)(struct charset_info_st *, const char *b, const char *e);
uint (*charpos)(struct charset_info_st *, const char *b, const char *e, uint pos);
+ uint (*lengthsp)(struct charset_info_st *, const char *ptr, uint length);
/* Unicode convertion */
int (*mb_wc)(struct charset_info_st *cs,my_wc_t *wc,
@@ -240,6 +254,13 @@ extern void my_hash_sort_simple(CHARSET_INFO *cs,
const uchar *key, uint len,
ulong *nr1, ulong *nr2);
+extern uint my_lengthsp_8bit(CHARSET_INFO *cs, const char *ptr, uint length);
+
+extern uint my_instr_simple(struct charset_info_st *,
+ const char *big, uint b_length,
+ const char *small, uint s_length,
+ my_match_t *match, uint nmatch);
+
/* Functions for 8bit */
extern void my_caseup_str_8bit(CHARSET_INFO *, char *);
@@ -304,6 +325,10 @@ int my_wildcmp_mb(CHARSET_INFO *,
int escape, int w_one, int w_many);
uint my_numchars_mb(CHARSET_INFO *, const char *b, const char *e);
uint my_charpos_mb(CHARSET_INFO *, const char *b, const char *e, uint pos);
+uint my_instr_mb(struct charset_info_st *,
+ const char *big, uint b_length,
+ const char *small, uint s_length,
+ my_match_t *match, uint nmatch);
extern my_bool my_parse_charset_xml(const char *bug, uint len,
diff --git a/include/m_string.h b/include/m_string.h
index 5863bb51b73..062d0b4cf65 100644
--- a/include/m_string.h
+++ b/include/m_string.h
@@ -122,6 +122,16 @@ extern void bmove_align(gptr dst,const gptr src,uint len);
#define bmove512(A,B,C) memcpy(A,B,C)
#endif
+#ifdef HAVE_purify
+#include <assert.h>
+#define memcpy_overlap(A,B,C) \
+DBUG_ASSERT((A) == (B) || ((A)+(C)) <= (B) || ((B)+(C)) <= (A)); \
+bmove((byte*) key,(byte*) from,(size_t) length);
+#else
+#define memcpy_overlap(A,B,C) memcpy((A), (B), (C))
+#endif /* HAVE_purify */
+
+
/* Prototypes for string functions */
#if !defined(bfill) && !defined(HAVE_BFILL)
diff --git a/include/my_pthread.h b/include/my_pthread.h
index d8374cad314..424452a9298 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -1,4 +1,3 @@
-
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -111,7 +110,6 @@ void pthread_exit(void *a); /* was #define pthread_exit(A) ExitThread(A)*/
#endif
#define pthread_self() win_pthread_self
#define HAVE_LOCALTIME_R 1
-#define HAVE_GMTIME_R 1
#define _REENTRANT 1
#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1
diff --git a/include/my_sys.h b/include/my_sys.h
index d80390fbbde..8047c5f3e47 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -207,11 +207,13 @@ extern CHARSET_INFO *default_charset_info;
extern CHARSET_INFO *all_charsets[256];
extern CHARSET_INFO compiled_charsets[];
-extern uint get_charset_number(const char *cs_name);
+extern uint get_charset_number(const char *cs_name, uint cs_flags);
+extern uint get_collation_number(const char *name);
extern const char *get_charset_name(uint cs_number);
+
extern CHARSET_INFO *get_charset(uint cs_number, myf flags);
extern CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags);
-extern CHARSET_INFO *get_charset_by_csname(const char *cs_name,
+extern CHARSET_INFO *get_charset_by_csname(const char *cs_name,
uint cs_flags, myf my_flags);
extern void free_charsets(void);
extern char *get_charsets_dir(char *buf);
@@ -500,6 +502,8 @@ my_off_t my_b_append_tell(IO_CACHE* info);
#define my_b_bytes_in_cache(info) (uint) (*(info)->current_end - \
*(info)->current_pos)
+typedef uint32 ha_checksum;
+
/* Pointer to a key cache data structure (see the key cache module) */
typedef struct st_key_cache* KEY_CACHE_HANDLE;
@@ -722,6 +726,8 @@ extern int _my_b_get(IO_CACHE *info);
extern int _my_b_async_read(IO_CACHE *info,byte *Buffer,uint Count);
extern int _my_b_write(IO_CACHE *info,const byte *Buffer,uint Count);
extern int my_b_append(IO_CACHE *info,const byte *Buffer,uint Count);
+extern int my_b_safe_write(IO_CACHE *info,const byte *Buffer,uint Count);
+
extern int my_block_write(IO_CACHE *info, const byte *Buffer,
uint Count, my_off_t pos);
extern int _flush_io_cache(IO_CACHE *info, int need_append_buffer_lock);
@@ -783,17 +789,18 @@ extern void set_prealloc_root(MEM_ROOT *root, char *ptr);
extern char *strdup_root(MEM_ROOT *root,const char *str);
extern char *strmake_root(MEM_ROOT *root,const char *str,uint len);
extern char *memdup_root(MEM_ROOT *root,const char *str,uint len);
-extern void load_defaults(const char *conf_file, const char **groups,
- int *argc, char ***argv);
+extern int load_defaults(const char *conf_file, const char **groups,
+ int *argc, char ***argv);
extern void free_defaults(char **argv);
extern void print_defaults(const char *conf_file, const char **groups);
extern my_bool my_compress(byte *, ulong *, ulong *);
extern my_bool my_uncompress(byte *, ulong *, ulong *);
extern byte *my_compress_alloc(const byte *packet, ulong *len, ulong *complen);
-extern ulong checksum(const byte *mem, uint count);
+extern ha_checksum my_checksum(ha_checksum crc, const byte *mem, uint count);
extern uint my_bit_log2(ulong value);
-uint my_count_bits(ulonglong v);
+extern uint my_count_bits(ulonglong v);
extern void my_sleep(ulong m_seconds);
+extern ulong crc32(ulong crc, const uchar *buf, uint len);
#ifdef __WIN__
extern my_bool have_tcpip; /* Is set if tcpip is used */
diff --git a/include/myisam.h b/include/myisam.h
index 5be64d2212f..bf28168b7d7 100644
--- a/include/myisam.h
+++ b/include/myisam.h
@@ -53,8 +53,6 @@ extern "C" {
#define mi_portable_sizeof_char_ptr 8
-typedef uint32 ha_checksum;
-
/* Param to/from mi_info */
typedef struct st_mi_isaminfo /* Struct from h_info */
diff --git a/include/mysql.h b/include/mysql.h
index 8e8ffc2b788..95f480b41c1 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -142,7 +142,7 @@ enum mysql_option
MYSQL_OPT_PROTOCOL, MYSQL_SHARED_MEMORY_BASE_NAME, MYSQL_OPT_READ_TIMEOUT,
MYSQL_OPT_WRITE_TIMEOUT, MYSQL_OPT_USE_RESULT,
MYSQL_OPT_USE_REMOTE_CONNECTION, MYSQL_OPT_USE_EMBEDDED_CONNECTION,
- MYSQL_OPT_GUESS_CONNECTION
+ MYSQL_OPT_GUESS_CONNECTION, MYSQL_SET_CLIENT_IP
};
struct st_mysql_options {
@@ -180,6 +180,7 @@ struct st_mysql_options {
my_bool separate_thread;
#endif
enum mysql_option methods_to_use;
+ char *client_ip;
};
enum mysql_status
@@ -229,7 +230,9 @@ typedef struct st_mysql
enum mysql_status status;
my_bool free_me; /* If free in mysql_close */
my_bool reconnect; /* set to 1 if automatic reconnect */
- char scramble_buff[21]; /* New protocol requires longer scramble*/
+
+ /* session-wide random string */
+ char scramble[SCRAMBLE_LENGTH+1];
/*
Set if this is the original connection, not a master or a slave we have
@@ -248,7 +251,6 @@ typedef struct st_mysql
LIST *stmts; /* list of all statements */
const struct st_mysql_methods *methods;
- struct st_mysql_res *result;
void *thd;
} MYSQL;
@@ -357,6 +359,9 @@ int STDCALL mysql_send_query(MYSQL *mysql, const char *q,
unsigned long length);
int STDCALL mysql_real_query(MYSQL *mysql, const char *q,
unsigned long length);
+MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql);
+MYSQL_RES * STDCALL mysql_use_result(MYSQL *mysql);
+
/* perform query on master */
my_bool STDCALL mysql_master_query(MYSQL *mysql, const char *q,
unsigned long length);
@@ -412,8 +417,6 @@ const char * STDCALL mysql_get_host_info(MYSQL *mysql);
unsigned int STDCALL mysql_get_proto_info(MYSQL *mysql);
MYSQL_RES * STDCALL mysql_list_dbs(MYSQL *mysql,const char *wild);
MYSQL_RES * STDCALL mysql_list_tables(MYSQL *mysql,const char *wild);
-MYSQL_RES * STDCALL mysql_list_fields(MYSQL *mysql, const char *table,
- const char *wild);
MYSQL_RES * STDCALL mysql_list_processes(MYSQL *mysql);
int STDCALL mysql_options(MYSQL *mysql,enum mysql_option option,
const char *arg);
@@ -427,6 +430,8 @@ MYSQL_FIELD_OFFSET STDCALL mysql_field_seek(MYSQL_RES *result,
MYSQL_ROW STDCALL mysql_fetch_row(MYSQL_RES *result);
unsigned long * STDCALL mysql_fetch_lengths(MYSQL_RES *result);
MYSQL_FIELD * STDCALL mysql_fetch_field(MYSQL_RES *result);
+MYSQL_RES * STDCALL mysql_list_fields(MYSQL *mysql, const char *table,
+ const char *wild);
unsigned long STDCALL mysql_escape_string(char *to,const char *from,
unsigned long from_length);
unsigned long STDCALL mysql_real_escape_string(MYSQL *mysql,
@@ -457,6 +462,7 @@ int STDCALL mysql_manager_command(MYSQL_MANAGER* con,
int STDCALL mysql_manager_fetch_line(MYSQL_MANAGER* con,
char* res_buf,
int res_buf_size);
+my_bool STDCALL mysql_read_query_result(MYSQL *mysql);
/*
@@ -497,10 +503,12 @@ typedef struct st_mysql_bind
/* Following are for internal use. Set by mysql_bind_param */
unsigned char *inter_buffer; /* for the current data position */
unsigned long offset; /* offset position for char/binary fetch */
+ unsigned long internal_length; /* Used if length is 0 */
unsigned int param_number; /* For null count and error messages */
my_bool long_data_used; /* If used with mysql_send_long_data */
my_bool binary_data; /* data buffer is binary */
my_bool null_field; /* NULL data cache flag */
+ my_bool internal_is_null; /* Used if is_null is 0 */
void (*store_param_func)(NET *net, struct st_mysql_bind *param);
void (*fetch_result)(struct st_mysql_bind *, unsigned char **row);
} MYSQL_BIND;
@@ -535,22 +543,29 @@ typedef struct st_mysql_stmt
} MYSQL_STMT;
-#define mysql_read_query_result(mysql) (*(mysql)->methods->read_query_result)(mysql)
-#define mysql_store_result(mysql) (*(mysql)->methods->store_result)(mysql)
-#define mysql_use_result(mysql) (*(mysql)->methods->use_result)(mysql)
-
typedef struct st_mysql_methods
{
- my_bool STDCALL (*read_query_result)(MYSQL *mysql);
- my_bool STDCALL (*advanced_command)(MYSQL *mysql,
+ my_bool (STDCALL *read_query_result)(MYSQL *mysql);
+ my_bool (STDCALL *advanced_command)(MYSQL *mysql,
enum enum_server_command command,
const char *header,
unsigned long header_length,
const char *arg,
- unsigned long arg_length, my_bool skip_check);
- MYSQL_RES * STDCALL (*store_result)(MYSQL *mysql);
- MYSQL_RES * STDCALL (*use_result)(MYSQL *mysql);
- void STDCALL (*fetch_lengths)(unsigned long *to, MYSQL_ROW column, uint field_count);
+ unsigned long arg_length,
+ my_bool skip_check);
+ MYSQL_DATA *(STDCALL *read_rows)(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
+ unsigned int fields);
+ MYSQL_RES * (STDCALL *use_result)(MYSQL *mysql);
+ void (STDCALL *fetch_lengths)(unsigned long *to,
+ MYSQL_ROW column, unsigned int field_count);
+#if !defined(MYSQL_SERVER) || defined(EMBEDDED_LIBRARY)
+ MYSQL_FIELD * (STDCALL *list_fields)(MYSQL *mysql);
+ my_bool (STDCALL *read_prepare_result)(MYSQL *mysql, MYSQL_STMT *stmt);
+ int (STDCALL *stmt_execute)(MYSQL_STMT *stmt);
+ MYSQL_DATA *(STDCALL *read_binary_rows)(MYSQL_STMT *stmt);
+ int (STDCALL *unbuffered_fetch)(MYSQL *mysql, char **row);
+ void (STDCALL *free_embedded_thd)(MYSQL *mysql);
+#endif
} MYSQL_METHODS;
MYSQL_STMT * STDCALL mysql_prepare(MYSQL * mysql, const char *query,
@@ -570,13 +585,13 @@ my_bool STDCALL mysql_rollback(MYSQL * mysql);
my_bool STDCALL mysql_autocommit(MYSQL * mysql, my_bool auto_mode);
int STDCALL mysql_fetch(MYSQL_STMT *stmt);
int STDCALL mysql_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind,
- my_ulonglong column,
+ unsigned int column,
unsigned long offset);
my_bool STDCALL mysql_send_long_data(MYSQL_STMT *stmt,
unsigned int param_number,
const char *data,
unsigned long length);
-MYSQL_RES *STDCALL mysql_prepare_result(MYSQL_STMT *stmt);
+MYSQL_RES *STDCALL mysql_get_metadata(MYSQL_STMT *stmt);
MYSQL_RES *STDCALL mysql_param_result(MYSQL_STMT *stmt);
my_ulonglong STDCALL mysql_stmt_affected_rows(MYSQL_STMT *stmt);
int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt);
@@ -615,6 +630,8 @@ int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB);
unsigned long net_safe_read(MYSQL* mysql);
void mysql_once_init(void);
+extern my_bool server_inited;
+
#ifdef __NETWARE__
#pragma pack(pop) /* restore alignment */
#endif
diff --git a/include/mysql_com.h b/include/mysql_com.h
index b1c94e5c735..d5a70e4dfe8 100644
--- a/include/mysql_com.h
+++ b/include/mysql_com.h
@@ -49,8 +49,15 @@ enum enum_server_command
};
-#define SCRAMBLE_LENGTH 8
-#define SCRAMBLE41_LENGTH 20
+/*
+ Length of random string sent by server on handshake; this is also length of
+ obfuscated password, recieved from client
+*/
+#define SCRAMBLE_LENGTH 20
+#define SCRAMBLE_LENGTH_323 8
+/* length of password stored in the db: new passwords are preceeded with '*' */
+#define SCRAMBLED_PASSWORD_CHAR_LENGTH (SCRAMBLE_LENGTH*2+1)
+#define SCRAMBLED_PASSWORD_CHAR_LENGTH_323 (SCRAMBLE_LENGTH_323*2)
#define NOT_NULL_FLAG 1 /* Field can't be NULL */
@@ -302,38 +309,41 @@ extern "C" {
extern unsigned long max_allowed_packet;
extern unsigned long net_buffer_length;
-void randominit(struct rand_struct *,unsigned long seed1,
- unsigned long seed2);
+/*
+ These functions are used for authentication by client and server and
+ implemented in sql/password.c
+*/
+
+void randominit(struct rand_struct *, unsigned long seed1,
+ unsigned long seed2);
double my_rnd(struct rand_struct *);
-void make_scrambled_password(char *to,const char *password,
- my_bool force_old_scramble,struct rand_struct *rand_st);
-int get_password_length(my_bool force_old_scramble);
-char get_password_version(const char* password);
-void create_random_string(int length,struct rand_struct *rand_st,char* target);
-my_bool validate_password(const char* password, const char* message,
- unsigned long* salt);
-void password_hash_stage1(char *to, const char *password);
-void password_hash_stage2(char *to,const char *salt);
-void password_crypt(const char* from,char* to, const char* password,int length);
-void get_hash_and_password(unsigned long* salt, unsigned char pversion,char* hash,
- unsigned char* bin_password);
-void get_salt_from_password(unsigned long *res,const char *password);
-void create_key_from_old_password(const char* password,char* key);
-void make_password_from_salt(char *to, unsigned long *hash_res,
- unsigned char password_version);
-char *scramble(char *to,const char *message,const char *password,
- my_bool old_ver);
-my_bool check_scramble(const char *, const char *message,
- unsigned long *salt,my_bool old_ver);
+void create_random_string(char *to, uint length, struct rand_struct *rand_st);
+
+void hash_password(unsigned long *to, const char *password, uint password_len);
+void make_scrambled_password_323(char *to, const char *password);
+void scramble_323(char *to, const char *message, const char *password);
+my_bool check_scramble_323(const char *, const char *message,
+ unsigned long *salt);
+void get_salt_from_password_323(unsigned long *res, const char *password);
+void make_password_from_salt_323(char *to, const unsigned long *salt);
+
+void make_scrambled_password(char *to, const char *password);
+void scramble(char *to, const char *message, const char *password);
+my_bool check_scramble(const char *reply, const char *message,
+ const unsigned char *hash_stage2);
+void get_salt_from_password(unsigned char *res, const char *password);
+void make_password_from_salt(char *to, const unsigned char *hash_stage2);
+
+/* end of password.c */
+
char *get_tty_password(char *opt_message);
-void hash_password(unsigned long *result, const char *password);
const char *mysql_errno_to_sqlstate(unsigned int mysql_errno);
/* Some other useful functions */
void my_init(void);
-void load_defaults(const char *conf_file, const char **groups,
- int *argc, char ***argv);
+int load_defaults(const char *conf_file, const char **groups,
+ int *argc, char ***argv);
my_bool my_thread_init(void);
void my_thread_end(void);
diff --git a/include/mysqld_error.h b/include/mysqld_error.h
index d2240b7a28e..7646d3e7494 100644
--- a/include/mysqld_error.h
+++ b/include/mysqld_error.h
@@ -289,4 +289,10 @@
#define ER_CANT_AGGREGATE_NCOLLATIONS 1270
#define ER_VARIABLE_IS_NOT_STRUCT 1271
#define ER_UNKNOWN_COLLATION 1272
-#define ER_ERROR_MESSAGES 273
+#define ER_SLAVE_IGNORED_SSL_PARAMS 1273
+#define ER_SERVER_IS_IN_SECURE_AUTH_MODE 1274
+#define ER_WARN_FIELD_RESOLVED 1275
+#define ER_BAD_SLAVE_UNTIL_COND 1276
+#define ER_MISSING_SKIP_SLAVE 1277
+#define ER_UNTIL_COND_IGNORED 1278
+#define ER_ERROR_MESSAGES 279
diff --git a/include/sql_common.h b/include/sql_common.h
index 9fea46be298..1f442339c4f 100644
--- a/include/sql_common.h
+++ b/include/sql_common.h
@@ -28,14 +28,19 @@ my_ulonglong net_field_length_ll(uchar **packet);
MYSQL_FIELD *unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
my_bool default_value, uint server_capabilities);
void free_rows(MYSQL_DATA *cur);
-MYSQL_DATA *read_rows (MYSQL *mysql,MYSQL_FIELD *fields,
- uint field_count);
my_bool mysql_autenticate(MYSQL *mysql, const char *passwd);
void free_old_query(MYSQL *mysql);
void end_server(MYSQL *mysql);
my_bool mysql_reconnect(MYSQL *mysql);
void mysql_read_default_options(struct st_mysql_options *options,
const char *filename,const char *group);
+my_bool STDCALL
+cli_advanced_command(MYSQL *mysql, enum enum_server_command command,
+ const char *header, ulong header_length,
+ const char *arg, ulong arg_length, my_bool skip_check);
+
+void set_stmt_errmsg(MYSQL_STMT * stmt, const char *err, int errcode,
+ const char *sqlstate);
#ifdef __cplusplus
}
#endif
diff --git a/include/thr_alarm.h b/include/thr_alarm.h
index 439f046252f..8ff4472f700 100644
--- a/include/thr_alarm.h
+++ b/include/thr_alarm.h
@@ -100,7 +100,7 @@ typedef struct st_alarm {
#define thr_alarm_init(A) (*(A))=0
#define thr_alarm_in_use(A) (*(A)!= 0)
void init_thr_alarm(uint max_alarm);
-bool thr_alarm(thr_alarm_t *alarmed, uint sec, ALARM *buff);
+my_bool thr_alarm(thr_alarm_t *alarmed, uint sec, ALARM *buff);
void thr_alarm_kill(pthread_t thread_id);
void thr_end_alarm(thr_alarm_t *alarmed);
void end_thr_alarm(my_bool free_structures);
diff --git a/include/violite.h b/include/violite.h
index 9205f5b799a..37c5abbbe67 100644
--- a/include/violite.h
+++ b/include/violite.h
@@ -37,18 +37,24 @@ enum enum_vio_type
VIO_TYPE_SSL, VIO_TYPE_SHARED_MEMORY
};
-#ifndef __WIN__
-#define HANDLE void *
-#endif
-
Vio* vio_new(my_socket sd, enum enum_vio_type type, my_bool localhost);
#ifdef __WIN__
Vio* vio_new_win32pipe(HANDLE hPipe);
-Vio* vio_new_win32shared_memory(NET *net,HANDLE handle_file_map, HANDLE handle_map,
- HANDLE event_server_wrote, HANDLE event_server_read,
- HANDLE event_client_wrote, HANDLE event_client_read);
-#endif
+Vio* vio_new_win32shared_memory(NET *net,HANDLE handle_file_map,
+ HANDLE handle_map,
+ HANDLE event_server_wrote,
+ HANDLE event_server_read,
+ HANDLE event_client_wrote,
+ HANDLE event_client_read);
+int vio_read_pipe(Vio *vio, gptr buf, int size);
+int vio_write_pipe(Vio *vio, const gptr buf, int size);
+int vio_close_pipe(Vio * vio);
+#else
+#define HANDLE void *
+#endif /* __WIN__ */
+
void vio_delete(Vio* vio);
+int vio_close(Vio* vio);
#ifdef EMBEDDED_LIBRARY
void vio_reset(Vio *vio);
@@ -57,71 +63,73 @@ void vio_reset(Vio* vio, enum enum_vio_type type,
my_socket sd, HANDLE hPipe, my_bool localhost);
#endif
-/*
- * vio_read and vio_write should have the same semantics
- * as read(2) and write(2).
- */
int vio_read(Vio *vio, gptr buf, int size);
int vio_write(Vio *vio, const gptr buf, int size);
-/*
- * Whenever the socket is set to blocking mode or not.
- */
int vio_blocking(Vio *vio, my_bool onoff, my_bool *old_mode);
my_bool vio_is_blocking(Vio *vio);
-/*
- * setsockopt TCP_NODELAY at IPPROTO_TCP level, when possible.
- */
+/* setsockopt TCP_NODELAY at IPPROTO_TCP level, when possible */
int vio_fastsend(Vio *vio);
-/*
- * setsockopt SO_KEEPALIVE at SOL_SOCKET level, when possible.
- */
+/* setsockopt SO_KEEPALIVE at SOL_SOCKET level, when possible */
int vio_keepalive(Vio *vio, my_bool onoff);
-/*
- * Whenever we should retry the last read/write operation.
- */
+/* Whenever we should retry the last read/write operation. */
my_bool vio_should_retry(Vio *vio);
-/*
- * When the workday is over...
- */
-int vio_close(Vio* vio);
-/*
- * Short text description of the socket for those, who are curious..
- */
+/* Short text description of the socket for those, who are curious.. */
const char* vio_description(Vio *vio);
-
/* Return the type of the connection */
enum enum_vio_type vio_type(Vio* vio);
-
/* Return last error number */
-int vio_errno(Vio*vio);
-
+int vio_errno(Vio*vio);
/* Get socket number */
my_socket vio_fd(Vio*vio);
+/* Remote peer's address and name in text form */
+my_bool vio_peer_addr(Vio* vio, char *buf, uint16 *port);
+/* Remotes in_addr */
+void vio_in_addr(Vio *vio, struct in_addr *in);
+my_bool vio_poll_read(Vio *vio,uint timeout);
+void vio_timeout(Vio *vio,uint timeout);
-/*
- * Remote peer's address and name in text form.
- */
-my_bool vio_peer_addr(Vio* vio, char *buf, uint16 *port);
+#ifdef HAVE_OPENSSL
+#define HEADER_DES_LOCL_H dummy_something
+#include <openssl/ssl.h>
+#include <openssl/err.h>
-/* Remotes in_addr */
+struct st_VioSSLAcceptorFd
+{
+ SSL_CTX *ssl_context;
+ SSL_METHOD *ssl_method;
+ struct st_VioSSLAcceptorFd *session_id_context;
+};
-void vio_in_addr(Vio *vio, struct in_addr *in);
+/* One copy for client */
+struct st_VioSSLConnectorFd
+{
+ SSL_CTX *ssl_context;
+ /* function pointers which are only once for SSL client */
+ SSL_METHOD *ssl_method;
+};
-my_bool vio_poll_read(Vio *vio,uint timeout);
+int sslaccept(struct st_VioSSLAcceptorFd*, Vio *, long timeout);
+int sslconnect(struct st_VioSSLConnectorFd*, Vio *, long timeout);
-#ifdef __cplusplus
-}
-#endif
+struct st_VioSSLConnectorFd
+*new_VioSSLConnectorFd(const char *key_file, const char *cert_file,
+ const char *ca_file, const char *ca_path,
+ const char *cipher);
+struct st_VioSSLAcceptorFd
+*new_VioSSLAcceptorFd(const char *key_file, const char *cert_file,
+ const char *ca_file,const char *ca_path,
+ const char *cipher);
+Vio *new_VioSSL(struct st_VioSSLAcceptorFd *fd, Vio *sd, int state);
+#endif /* HAVE_OPENSSL */
#ifdef HAVE_SMEM
int vio_read_shared_memory(Vio *vio, gptr buf, int size);
int vio_write_shared_memory(Vio *vio, const gptr buf, int size);
int vio_close_shared_memory(Vio * vio);
#endif
-#ifdef __WIN__
-int vio_read_pipe(Vio *vio, gptr buf, int size);
-int vio_write_pipe(Vio *vio, const gptr buf, int size);
-int vio_close_pipe(Vio * vio);
+
+#ifdef __cplusplus
+}
#endif
#if defined(HAVE_VIO) && !defined(DONT_MAP_VIO)
@@ -138,77 +146,9 @@ int vio_close_pipe(Vio * vio);
#define vio_close(vio) ((vio)->vioclose)(vio)
#define vio_peer_addr(vio, buf, prt) (vio)->peer_addr(vio, buf, prt)
#define vio_in_addr(vio, in) (vio)->in_addr(vio, in)
+#define vio_timeout(vio, seconds) (vio)->timeout(vio, seconds)
#endif /* defined(HAVE_VIO) && !defined(DONT_MAP_VIO) */
-#ifdef HAVE_OPENSSL
-#define HEADER_DES_LOCL_H dummy_something
-#include <openssl/ssl.h>
-#include <openssl/err.h>
-#include "my_net.h" /* needed because of struct in_addr */
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-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);
-
-/* setsockopt TCP_NODELAY at IPPROTO_TCP level, when possible. */
- int vio_ssl_fastsend(Vio* vio);
-/* setsockopt SO_KEEPALIVE at SOL_SOCKET level, when possible. */
-int vio_ssl_keepalive(Vio* vio, my_bool onoff);
-/* Whenever we should retry the last read/write operation. */
-my_bool vio_ssl_should_retry(Vio* vio);
-/* When the workday is over... */
-int vio_ssl_close(Vio* vio);
-/* Return last error number */
-int vio_ssl_errno(Vio *vio);
-my_bool vio_ssl_peer_addr(Vio* vio, char *buf, uint16 *port);
-void vio_ssl_in_addr(Vio *vio, struct in_addr *in);
-int vio_ssl_blocking(Vio * vio, my_bool set_blocking_mode, my_bool *old_mode);
-
-/* Single copy for server */
-enum vio_ssl_acceptorfd_state
-{
- state_connect = 1,
- state_accept = 2
-};
-
-struct st_VioSSLAcceptorFd
-{
- SSL_CTX* ssl_context_;
- SSL_METHOD* ssl_method_;
- struct st_VioSSLAcceptorFd* session_id_context_;
-};
-
-/* One copy for client */
-struct st_VioSSLConnectorFd
-{
- SSL_CTX* ssl_context_;
- /* function pointers which are only once for SSL client */
- SSL_METHOD* ssl_method_;
-};
-
-int sslaccept(struct st_VioSSLAcceptorFd*, Vio*, long timeout);
-int sslconnect(struct st_VioSSLConnectorFd*, Vio*, long timeout);
-
-struct st_VioSSLConnectorFd
-*new_VioSSLConnectorFd(const char* key_file, const char* cert_file,
- const char* ca_file, const char* ca_path,
- const char* cipher);
-struct st_VioSSLAcceptorFd
-*new_VioSSLAcceptorFd(const char* key_file, const char* cert_file,
- const char* ca_file,const char* ca_path,
- const char* cipher);
-Vio* new_VioSSL(struct st_VioSSLAcceptorFd* fd, Vio* sd,int state);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* HAVE_OPENSSL */
-
/* This enumerator is used in parser - should be always visible */
enum SSL_type
{
@@ -237,7 +177,7 @@ struct st_vio
void (*viodelete)(Vio*);
int (*vioerrno)(Vio*);
int (*read)(Vio*, gptr, int);
- int (*write)(Vio*, const gptr, int);
+ int (*write)(Vio*, gptr, int);
int (*vioblocking)(Vio*, my_bool, my_bool *);
my_bool (*is_blocking)(Vio*);
int (*viokeepalive)(Vio*, my_bool);
@@ -246,20 +186,18 @@ struct st_vio
void (*in_addr)(Vio*, struct in_addr*);
my_bool (*should_retry)(Vio*);
int (*vioclose)(Vio*);
-
-#ifdef HAVE_OPENSSL
- SSL* ssl_;
-#endif /* HAVE_OPENSSL */
+ void (*timeout)(Vio*, unsigned int timeout);
+ void *ssl_arg;
#ifdef HAVE_SMEM
- HANDLE handle_file_map;
- char *handle_map;
- HANDLE event_server_wrote;
- HANDLE event_server_read;
- HANDLE event_client_wrote;
- HANDLE event_client_read;
- long shared_memory_remain;
- char *shared_memory_pos;
- NET *net;
+ HANDLE handle_file_map;
+ char *handle_map;
+ HANDLE event_server_wrote;
+ HANDLE event_server_read;
+ HANDLE event_client_wrote;
+ HANDLE event_client_read;
+ long shared_memory_remain;
+ char *shared_memory_pos;
+ NET *net;
#endif /* HAVE_SMEM */
#endif /* HAVE_VIO */
};
diff --git a/innobase/btr/btr0btr.c b/innobase/btr/btr0btr.c
index d8a0959e47f..1af9336ce72 100644
--- a/innobase/btr/btr0btr.c
+++ b/innobase/btr/btr0btr.c
@@ -2376,8 +2376,15 @@ btr_index_rec_validate(
type = dict_index_get_nth_type(index, i);
- if (len != UNIV_SQL_NULL && dtype_is_fixed_size(type)
- && len != dtype_get_fixed_size(type)) {
+ if ((dict_index_get_nth_field(index, i)->prefix_len == 0
+ && len != UNIV_SQL_NULL && dtype_is_fixed_size(type)
+ && len != dtype_get_fixed_size(type))
+ ||
+ (dict_index_get_nth_field(index, i)->prefix_len > 0
+ && len != UNIV_SQL_NULL && dtype_is_fixed_size(type)
+ && len !=
+ dict_index_get_nth_field(index, i)->prefix_len)) {
+
fprintf(stderr,
"InnoDB: Record in index %s in table %s, page %lu, at offset %lu\n"
"InnoDB: field %lu len is %lu, should be %lu\n",
diff --git a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c
index 924fa3ecf95..a576a886b97 100644
--- a/innobase/dict/dict0dict.c
+++ b/innobase/dict/dict0dict.c
@@ -1596,6 +1596,13 @@ dict_index_build_internal_clust(
break;
}
+ if (dict_index_get_nth_field(new_index, i)->prefix_len
+ > 0) {
+ new_index->trx_id_offset = 0;
+
+ break;
+ }
+
new_index->trx_id_offset += fixed_size;
}
diff --git a/innobase/fsp/fsp0fsp.c b/innobase/fsp/fsp0fsp.c
index 20bf4972f64..8727c5156e4 100644
--- a/innobase/fsp/fsp0fsp.c
+++ b/innobase/fsp/fsp0fsp.c
@@ -2656,7 +2656,13 @@ fseg_free_page_low(
ulint not_full_n_used;
ulint state;
ulint i;
- char errbuf[200];
+ char errbuf[200];
+
+#ifdef __WIN__
+ dulint desm;
+ dulint segm;
+#endif
+
ut_ad(seg_inode && mtr);
ut_ad(mach_read_from_4(seg_inode + FSEG_MAGIC_N) ==
@@ -2736,7 +2742,10 @@ fseg_free_page_low(
fprintf(stderr,
"InnoDB: Dump of the segment inode: %s\n", errbuf);
- fprintf(stderr,
+
+#ifndef __WIN__
+
+ fprintf(stderr,
"InnoDB: Serious error: InnoDB is trying to free space %lu page %lu,\n"
"InnoDB: which does not belong to segment %lu %lu but belongs\n"
"InnoDB: to segment %lu %lu.\n",
@@ -2750,6 +2759,26 @@ fseg_free_page_low(
ut_dulint_get_low(
mtr_read_dulint(seg_inode + FSEG_ID, MLOG_8BYTES, mtr)));
+#else
+
+/* More pedantic usage to avoid VC++ 6.0 compiler errors due to inline
+ function expansion issues */
+
+ desm = mtr_read_dulint(descr + XDES_ID, MLOG_8BYTES, mtr);
+ segm = mtr_read_dulint(seg_inode + FSEG_ID, MLOG_8BYTES, mtr);
+
+ fprintf(stderr,
+"InnoDB: Serious error: InnoDB is trying to free space %lu page %lu,\n"
+"InnoDB: which does not belong to segment %lu %lu but belongs\n"
+"InnoDB: to segment %lu %lu.\n",
+ space, page,
+ ut_dulint_get_high(desm),
+ ut_dulint_get_low(desm),
+ ut_dulint_get_high(segm),
+ ut_dulint_get_low(segm));
+
+#endif
+
fprintf(stderr,
"InnoDB: If the InnoDB recovery crashes here, see section 6.1\n"
"InnoDB: of http://www.innodb.com/ibman.html about forcing recovery.\n");
diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c
index e31fd1d9efe..f4f50320906 100644
--- a/innobase/os/os0file.c
+++ b/innobase/os/os0file.c
@@ -226,13 +226,8 @@ os_file_get_last_error(void)
"InnoDB: the directory. It may also be you have created a subdirectory\n"
"InnoDB: of the same name as a data file.\n");
} else {
- if (strerror((int)err) != NULL) {
- fprintf(stderr,
- "InnoDB: Error number %lu means '%s'.\n", err, strerror((int)err));
- }
-
fprintf(stderr,
- "InnoDB: See also section 13.2 at http://www.innodb.com/ibman.html\n"
+ "InnoDB: See section 13.2 at http://www.innodb.com/ibman.html\n"
"InnoDB: about operating system error numbers.\n");
}
}
diff --git a/innobase/row/row0sel.c b/innobase/row/row0sel.c
index 81bbf5053c0..d0f6965f94e 100644
--- a/innobase/row/row0sel.c
+++ b/innobase/row/row0sel.c
@@ -2170,7 +2170,7 @@ row_sel_store_mysql_rec(
ulint len;
byte* blob_buf;
ulint i;
-
+
ut_ad(prebuilt->mysql_template);
if (prebuilt->blob_heap != NULL) {
@@ -2178,9 +2178,9 @@ row_sel_store_mysql_rec(
prebuilt->blob_heap = NULL;
}
- /* Mark all columns as not SQL NULL */
+ /* Mark all columns as SQL NULL */
- memset(mysql_rec, '\0', prebuilt->null_bitmap_len);
+ memset(mysql_rec, 255, prebuilt->null_bitmap_len);
for (i = 0; i < prebuilt->n_template; i++) {
@@ -2235,16 +2235,21 @@ row_sel_store_mysql_rec(
data = blob_buf;
}
-
+
row_sel_field_store_in_mysql_format(
mysql_rec + templ->mysql_col_offset,
templ->mysql_col_len, data, len,
templ->type, templ->is_unsigned);
if (extern_field_heap) {
- mem_heap_free(extern_field_heap);
+ mem_heap_free(extern_field_heap);
extern_field_heap = NULL;
- }
+ }
+
+ if (templ->mysql_null_bit_mask) {
+ mysql_rec[templ->mysql_null_byte_offset] &=
+ ~(byte) (templ->mysql_null_bit_mask);
+ }
} else {
/* MySQL seems to assume the field for an SQL NULL
value is set to zero. Not taking this into account
@@ -2252,19 +2257,13 @@ row_sel_store_mysql_rec(
bug number 154 in the MySQL bug database: GROUP BY
and DISTINCT could treat NULL values inequal. */
- memset(mysql_rec + templ->mysql_col_offset, '\0',
+ memset(mysql_rec + templ->mysql_col_offset,
+ ((templ->type == DATA_VARCHAR ||
+ templ->type == DATA_VARMYSQL ||
+ templ->type == DATA_BINARY) ? ' ' : '\0'),
templ->mysql_col_len);
-
- if (!templ->mysql_null_bit_mask) {
- fprintf(stderr,
-"InnoDB: Error: trying to return an SQL NULL field in a non-null\n"
-"innoDB: column! Table name %s\n", prebuilt->table->name);
- } else {
- mysql_rec[templ->mysql_null_byte_offset] |=
- (byte) (templ->mysql_null_bit_mask);
- }
}
- }
+ }
return(TRUE);
}
diff --git a/isam/_search.c b/isam/_search.c
index 1ceeab1e824..7b61abfb46b 100644
--- a/isam/_search.c
+++ b/isam/_search.c
@@ -119,7 +119,7 @@ int _nisam_search(register N_INFO *info, register N_KEYDEF *keyinfo, uchar *key,
{
keypos=_nisam_get_last_key(info,keyinfo,buff,lastkey,keypos);
if (!(nextflag & SEARCH_SMALLER) &&
- _nisam_key_cmp(keyinfo->seg, info->lastkey, key, key_len, SEARCH_FIND))
+ _nisam_key_cmp(keyinfo->seg, lastkey, key, key_len, SEARCH_FIND))
{
my_errno=HA_ERR_KEY_NOT_FOUND; /* Didn't find key */
goto err;
diff --git a/isam/isamchk.c b/isam/isamchk.c
index 653d932c79d..e59da07e85b 100644
--- a/isam/isamchk.c
+++ b/isam/isamchk.c
@@ -1329,7 +1329,7 @@ int extend;
print_error("Found wrong record at %lu",(ulong) start_recpos);
got_error=1;
}
- crc^=checksum(record,info->s->base.reclength);
+ crc^=_nisam_checksum(record,info->s->base.reclength);
link_used+=info->s->pack.ref_length;
used+=block_info.rec_len+info->s->pack.ref_length;
}
diff --git a/isam/isamdef.h b/isam/isamdef.h
index 0884b18e997..54656b6842e 100644
--- a/isam/isamdef.h
+++ b/isam/isamdef.h
@@ -358,6 +358,7 @@ extern int _nisam_read_pack_record(N_INFO *info,ulong filepos,byte *buf);
extern int _nisam_read_rnd_pack_record(N_INFO*, byte *,ulong, int);
extern int _nisam_pack_rec_unpack(N_INFO *info,byte *to,byte *from,
uint reclength);
+extern ulong _nisam_checksum(const byte *mem, uint count);
typedef struct st_sortinfo {
uint key_length;
diff --git a/isam/open.c b/isam/open.c
index 48fab27cac1..be62fd86192 100644
--- a/isam/open.c
+++ b/isam/open.c
@@ -415,6 +415,9 @@ static void setup_functions(register ISAM_SHARE *share)
share->read_rnd=_nisam_read_rnd_dynamic_record;
share->delete_record=_nisam_delete_dynamic_record;
share->compare_record=_nisam_cmp_dynamic_record;
+
+ /* add bits used to pack data to pack_reclength for faster allocation */
+ share->base.pack_reclength+= share->base.pack_bits;
if (share->base.blobs)
{
share->update_record=_nisam_update_blob_record;
@@ -453,3 +456,22 @@ static void setup_key_functions(register N_KEYDEF *keyinfo)
}
return;
}
+
+/*
+ Calculate a long checksum for a memoryblock. Used to verify pack_isam
+
+ SYNOPSIS
+ checksum()
+ mem Pointer to memory block
+ count Count of bytes
+*/
+
+ulong _nisam_checksum(const byte *mem, uint count)
+{
+ ulong crc;
+ for (crc= 0; count-- ; mem++)
+ crc= ((crc << 1) + *((uchar*) mem)) +
+ test(crc & ((ulong) 1L << (8*sizeof(ulong)-1)));
+ return crc;
+}
+
diff --git a/isam/pack_isam.c b/isam/pack_isam.c
index fd12aac1e09..9108070f918 100644
--- a/isam/pack_isam.c
+++ b/isam/pack_isam.c
@@ -738,7 +738,7 @@ static int get_statistic(MRG_INFO *mrg,HUFF_COUNTS *huff_counts)
{
if (! error)
{
- crc^=checksum(record,reclength);
+ crc^=_nisam_checksum(record,reclength);
for (pos=record,count=huff_counts ;
count < end_count ;
count++,
diff --git a/isam/test_all.res b/isam/test_all.res
index f6280dd9f98..5de37e44585 100644
--- a/isam/test_all.res
+++ b/isam/test_all.res
@@ -1,367 +1,30 @@
+echo "test2 -L -K -W -P"
test2 -L -K -W -P
-- Creating isam-file
-- Writing key:s
-- Delete
-- Update
-- Same key: first - next -> last - prev -> first
-- All keys: first - next -> last - prev -> first
-- Test if: Read first - next - prev - prev - next == first
-- Test if: Read last - prev - next - next - prev == last
-- Test read key-part
-- Read key (first) - next - delete - next -> last
-- Read last of key - prev - delete - prev -> first
-- Test if: Read rrnd - same
-- Test nisam_records_in_range
-- nisam_info
-- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
-- Removing keys
-
-Following test have been made:
-Write records: 907
-Update records: 87
-Same-key-read: 6
-Delete records: 907
-Key cacheing used
-Write cacheing used
-Locking used
+echo "test2 -L -K -W -P -A"
test2 -L -K -W -P -A
-- Creating isam-file
-- Writing key:s
-- Delete
-- Update
-- Same key: first - next -> last - prev -> first
-- All keys: first - next -> last - prev -> first
-- Test if: Read first - next - prev - prev - next == first
-- Test if: Read last - prev - next - next - prev == last
-- Test read key-part
-- Read key (first) - next - delete - next -> last
-- Read last of key - prev - delete - prev -> first
-- Test if: Read rrnd - same
-- Test nisam_records_in_range
-- nisam_info
-- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
-- Removing keys
-
-Following test have been made:
-Write records: 907
-Update records: 87
-Same-key-read: 6
-Delete records: 907
-Key cacheing used
-Write cacheing used
-Asyncron io with locking used
+echo "test2 -L -K -W -P -S -R1 -m500"
test2 -L -K -W -P -S -R1 -m500
-- Creating isam-file
-- Writing key:s
-- Delete
-- Update
-- Same key: first - next -> last - prev -> first
-- All keys: first - next -> last - prev -> first
-- Test if: Read first - next - prev - prev - next == first
-- Test if: Read last - prev - next - next - prev == last
-- Test read key-part
-- Read key (first) - next - delete - next -> last
-- Test if: Read rrnd - same
-- Test nisam_records_in_range
-- nisam_info
-- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
-- Removing keys
-
-Following test have been made:
-Write records: 475
-Update records: 44
-Same-key-read: 4
-Delete records: 475
-Record pointer size: 1
-Key cacheing used
-Write cacheing used
-Locking used
-test2 -L -K -R1 -m2000 ; Should give error 135
-- Creating isam-file
-- Writing key:s
-- Delete
-- Update
-- Same key: first - next -> last - prev -> first
-- All keys: first - next -> last - prev -> first
-- Test if: Read first - next - prev - prev - next == first
-- Test if: Read last - prev - next - next - prev == last
-- Test read key-part
-- Read key (first) - next - delete - next -> last
-- Read last of key - prev - delete - prev -> first
-- Read first - delete - next -> last
-- Read last - delete - prev -> first
-- Test if: Read rrnd - same
-- Test nisam_records_in_range
-- nisam_info
-- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
-- Removing keys
-
-Following test have been made:
-Write records: 1647
-Update records: 125
-Same-key-read: 8
-Delete records: 1647
-Record pointer size: 1
-Key cacheing used
-Locking used
+echo "test2 -L -K -R1 -m2000 ; Should give error 135"
+test2 -L -K -R1 -m2000
+echo "test2 -L -K -P -S -R3 -m50 -b1000000"
test2 -L -K -P -S -R3 -m50 -b1000000
-- Creating isam-file
-- Writing key:s
-- Delete
-- Update
-- Same key: first - next -> last - prev -> first
-- All keys: first - next -> last - prev -> first
-- Test if: Read first - next - prev - prev - next == first
-- Test if: Read last - prev - next - next - prev == last
-- Test read key-part
-- Test if: Read rrnd - same
-- Test nisam_records_in_range
-- nisam_info
-- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
-- Removing keys
-
-Following test have been made:
-Write records: 50
-Update records: 5
-Same-key-read: 2
-Delete records: 50
-Record pointer size: 3
-Key cacheing used
-Locking used
+echo "test2 -L -B"
test2 -L -B
-- Creating isam-file
-- Writing key:s
-- Delete
-- Update
-- Same key: first - next -> last - prev -> first
-- All keys: first - next -> last - prev -> first
-- Test if: Read first - next - prev - prev - next == first
-- Test if: Read last - prev - next - next - prev == last
-- Test read key-part
-- Read key (first) - next - delete - next -> last
-- Read last of key - prev - delete - prev -> first
-- Test if: Read rrnd - same
-- Test nisam_records_in_range
-- nisam_info
-- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
-- Removing keys
-
-Following test have been made:
-Write records: 903
-Update records: 86
-Same-key-read: 5
-Delete records: 903
-Locking used
-blobs used
+echo "test2 -L -K -W -P -m50 -l"
test2 -L -K -W -P -m50 -l
-- Creating isam-file
-- Writing key:s
-- Delete
-- Update
-- Same key: first - next -> last - prev -> first
-- All keys: first - next -> last - prev -> first
-- Test if: Read first - next - prev - prev - next == first
-- Test if: Read last - prev - next - next - prev == last
-- Test read key-part
-- Test if: Read rrnd - same
-- Test nisam_records_in_range
-- nisam_info
-- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
-- Removing keys
-
-Following test have been made:
-Write records: 50
-Update records: 5
-Same-key-read: 2
-Delete records: 50
-Key cacheing used
-Write cacheing used
-Locking used
-Commands Used count Errors Recover errors
-open 14 0 0
-write 700 0 0
-update 70 0 0
-delete 700 0 0
-close 14 0 0
-extra 84 0 0
-Total 1582 0 0
+isamlog
+echo "test2 -L -K -W -P -m50 -l -b100"
test2 -L -K -W -P -m50 -l -b100
-- Creating isam-file
-- Writing key:s
-- Delete
-- Update
-- Same key: first - next -> last - prev -> first
-- All keys: first - next -> last - prev -> first
-- Test if: Read first - next - prev - prev - next == first
-- Test if: Read last - prev - next - next - prev == last
-- Test read key-part
-- Test if: Read rrnd - same
-- Test nisam_records_in_range
-- nisam_info
-- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
-- Removing keys
-
-Following test have been made:
-Write records: 50
-Update records: 5
-Same-key-read: 2
-Delete records: 50
-Key cacheing used
-Write cacheing used
-Locking used
-Commands Used count Errors Recover errors
-open 15 0 0
-write 750 0 0
-update 75 0 0
-delete 750 0 0
-close 15 0 0
-extra 90 0 0
-Total 1695 0 0
+isamlog
+echo "time test2"
time test2
-- Creating isam-file
-- Writing key:s
-- Delete
-- Update
-- Same key: first - next -> last - prev -> first
-- All keys: first - next -> last - prev -> first
-- Test if: Read first - next - prev - prev - next == first
-- Test if: Read last - prev - next - next - prev == last
-- Test read key-part
-- Read key (first) - next - delete - next -> last
-- Read last of key - prev - delete - prev -> first
-- Test if: Read rrnd - same
-- Test nisam_records_in_range
-- nisam_info
-- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
-- Removing keys
-
-Following test have been made:
-Write records: 907
-Update records: 87
-Same-key-read: 6
-Delete records: 907
+echo "time test2 -K"
time test2 -K
-- Creating isam-file
-- Writing key:s
-- Delete
-- Update
-- Same key: first - next -> last - prev -> first
-- All keys: first - next -> last - prev -> first
-- Test if: Read first - next - prev - prev - next == first
-- Test if: Read last - prev - next - next - prev == last
-- Test read key-part
-- Read key (first) - next - delete - next -> last
-- Read last of key - prev - delete - prev -> first
-- Test if: Read rrnd - same
-- Test nisam_records_in_range
-- nisam_info
-- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
-- Removing keys
-
-Following test have been made:
-Write records: 907
-Update records: 87
-Same-key-read: 6
-Delete records: 907
-Key cacheing used
+echo "time test2 -L"
time test2 -L
-- Creating isam-file
-- Writing key:s
-- Delete
-- Update
-- Same key: first - next -> last - prev -> first
-- All keys: first - next -> last - prev -> first
-- Test if: Read first - next - prev - prev - next == first
-- Test if: Read last - prev - next - next - prev == last
-- Test read key-part
-- Read key (first) - next - delete - next -> last
-- Read last of key - prev - delete - prev -> first
-- Test if: Read rrnd - same
-- Test nisam_records_in_range
-- nisam_info
-- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
-- Removing keys
-
-Following test have been made:
-Write records: 907
-Update records: 87
-Same-key-read: 6
-Delete records: 907
-Locking used
+echo "time test2 -L -K"
time test2 -L -K
-- Creating isam-file
-- Writing key:s
-- Delete
-- Update
-- Same key: first - next -> last - prev -> first
-- All keys: first - next -> last - prev -> first
-- Test if: Read first - next - prev - prev - next == first
-- Test if: Read last - prev - next - next - prev == last
-- Test read key-part
-- Read key (first) - next - delete - next -> last
-- Read last of key - prev - delete - prev -> first
-- Test if: Read rrnd - same
-- Test nisam_records_in_range
-- nisam_info
-- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
-- Removing keys
-
-Following test have been made:
-Write records: 907
-Update records: 87
-Same-key-read: 6
-Delete records: 907
-Key cacheing used
-Locking used
+echo "time test2 -L -K -W"
time test2 -L -K -W
-- Creating isam-file
-- Writing key:s
-- Delete
-- Update
-- Same key: first - next -> last - prev -> first
-- All keys: first - next -> last - prev -> first
-- Test if: Read first - next - prev - prev - next == first
-- Test if: Read last - prev - next - next - prev == last
-- Test read key-part
-- Read key (first) - next - delete - next -> last
-- Read last of key - prev - delete - prev -> first
-- Test if: Read rrnd - same
-- Test nisam_records_in_range
-- nisam_info
-- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
-- Removing keys
-
-Following test have been made:
-Write records: 907
-Update records: 87
-Same-key-read: 6
-Delete records: 907
-Key cacheing used
-Write cacheing used
-Locking used
+echo "time test2 -L -K -W -S"
time test2 -L -K -W -S
-- Creating isam-file
-- Writing key:s
-- Delete
-- Update
-- Same key: first - next -> last - prev -> first
-- All keys: first - next -> last - prev -> first
-- Test if: Read first - next - prev - prev - next == first
-- Test if: Read last - prev - next - next - prev == last
-- Test read key-part
-- Read key (first) - next - delete - next -> last
-- Read last of key - prev - delete - prev -> first
-- Test if: Read rrnd - same
-- Test nisam_records_in_range
-- nisam_info
-- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
-- Removing keys
-
-Following test have been made:
-Write records: 907
-Update records: 87
-Same-key-read: 6
-Delete records: 907
-Key cacheing used
-Write cacheing used
-Locking used
diff --git a/libmysql/Makefile.am b/libmysql/Makefile.am
index 0125bd2b98d..3e026fe589a 100644
--- a/libmysql/Makefile.am
+++ b/libmysql/Makefile.am
@@ -42,7 +42,7 @@ link_sources:
rm -f $(srcdir)/$$f; \
@LN_CP_F@ $(srcdir)/../strings/$$f $(srcdir)/$$f; \
done; \
- for f in $$vs; do \
+ for f in $$vs $(vioheaders); do \
rm -f $(srcdir)/$$f; \
@LN_CP_F@ $(srcdir)/../vio/$$f $(srcdir)/$$f; \
done; \
diff --git a/libmysql/Makefile.shared b/libmysql/Makefile.shared
index 9a5869c47ff..1d431fa3624 100644
--- a/libmysql/Makefile.shared
+++ b/libmysql/Makefile.shared
@@ -47,6 +47,7 @@ mystringsobjects = strmov.lo strxmov.lo strxnmov.lo strnmov.lo \
mystringsextra= strto.c
dbugobjects = dbug.lo # IT IS IN SAFEMALLOC.C sanity.lo
mysysheaders = mysys_priv.h my_static.h
+vioheaders = vio_priv.h
mysysobjects1 = my_init.lo my_static.lo my_malloc.lo my_realloc.lo \
my_create.lo my_delete.lo mf_tempfile.lo my_open.lo \
my_read.lo my_write.lo errors.lo \
@@ -88,7 +89,7 @@ clean-local:
`echo $(vio_objects) | sed "s;\.lo;.c;g"` \
`echo $(sql_cmn_objects) | sed "s;\.lo;.c;g"` \
$(CHARSET_SRCS) $(CHARSET_OBJS) \
- $(mystringsextra) $(mysysheaders) \
+ $(mystringsextra) $(mysysheaders) $(vioheaders)\
../linked_client_sources net.c
conf_to_src_SOURCES = conf_to_src.c
diff --git a/libmysql/client_settings.h b/libmysql/client_settings.h
index 43f341c7b1c..d0432503ee9 100644
--- a/libmysql/client_settings.h
+++ b/libmysql/client_settings.h
@@ -41,3 +41,19 @@ my_bool send_file_to_server(MYSQL *mysql, const char *filename);
#define reset_sigpipe(mysql)
#endif
+void mysql_read_default_options(struct st_mysql_options *options,
+ const char *filename,const char *group);
+MYSQL * STDCALL
+cli_mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
+ const char *passwd, const char *db,
+ uint port, const char *unix_socket,ulong client_flag);
+
+void STDCALL cli_mysql_close(MYSQL *mysql);
+
+MYSQL_FIELD * STDCALL cli_list_fields(MYSQL *mysql);
+my_bool STDCALL cli_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt);
+MYSQL_DATA *cli_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
+ uint fields);
+int STDCALL cli_stmt_execute(MYSQL_STMT *stmt);
+MYSQL_DATA *cli_read_binary_rows(MYSQL_STMT *stmt);
+int STDCALL cli_unbuffered_fetch(MYSQL *mysql, char **row);
diff --git a/libmysql/dll.c b/libmysql/dll.c
index f0a67d8f091..e9334d68a0c 100644
--- a/libmysql/dll.c
+++ b/libmysql/dll.c
@@ -112,17 +112,18 @@ int _export FAR PASCAL libmain(HANDLE hModule,short cbHeapSize,
#ifdef OS2
-//
-// This function is called automatically by _DLL_InitTerm
-// Every dll runtime enviroment is not tz enabled, so tzset()
-// must be called to enable TZ handling
-// Also timezone is fixed.
-//
+/*
+ This function is called automatically by _DLL_InitTerm
+ Every dll runtime enviroment is not tz enabled, so tzset()
+ must be called to enable TZ handling
+ Also timezone is fixed.
+*/
+
extern "C" unsigned long _System DllMain(unsigned long modhandle,
unsigned long flag)
{
if (flag == 0) {
- tzset(); // Set tzname
+ tzset(); /* Set tzname */
time_t currentTime = time(NULL);
struct tm *ts = localtime(&currentTime);
if (ts->tm_isdst > 0)
diff --git a/libmysql/errmsg.c b/libmysql/errmsg.c
index bbb85885886..148625129b5 100644
--- a/libmysql/errmsg.c
+++ b/libmysql/errmsg.c
@@ -26,24 +26,24 @@ const char *client_errors[]=
{
"Unbekannter MySQL Fehler",
"Kann UNIX-Socket nicht anlegen (%d)",
- "Keine Verbindung zu lokalem MySQL Server, socket: '%-.64s' (%d)",
- "Keine Verbindung zu MySQL Server auf %-.64s (%d)",
+ "Keine Verbindung zu lokalem MySQL Server, socket: '%-.100s' (%d)",
+ "Keine Verbindung zu MySQL Server auf %-.100s (%d)",
"Kann TCP/IP-Socket nicht anlegen (%d)",
- "Unbekannter MySQL Server Host (%-.64s) (%d)",
+ "Unbekannter MySQL Server Host (%-.100s) (%d)",
"MySQL Server nicht vorhanden",
"Protokolle ungleich. Server Version = % d Client Version = %d",
"MySQL client got out of memory",
"Wrong host info",
"Localhost via UNIX socket",
- "%-.64s via TCP/IP",
+ "%-.100s via TCP/IP",
"Error in server handshake",
"Lost connection to MySQL server during query",
"Commands out of sync; You can't run this command now",
- "Verbindung ueber Named Pipe; Host: %-.64s",
+ "Verbindung ueber Named Pipe; Host: %-.100s",
"Kann nicht auf Named Pipe warten. Host: %-.64s pipe: %-.32s (%lu)",
"Kann Named Pipe nicht oeffnen. Host: %-.64s pipe: %-.32s (%lu)",
"Kann den Status der Named Pipe nicht setzen. Host: %-.64s pipe: %-.32s (%lu)",
- "Can't initialize character set %-.64s (path: %-.64s)",
+ "Can't initialize character set %-.32s (path: %-.100s)",
"Got packet bigger than 'max_allowed_packet'",
"Embedded server",
"Error on SHOW SLAVE STATUS:",
@@ -71,7 +71,8 @@ const char *client_errors[]=
"Can't open shared memory. Server abandoded and don't sent the answer event (%lu)",
"Can't open shared memory. Can't send the request event to server (%lu)",
"Wrong or unknown protocol",
- "Invalid connection handle"
+ "Invalid connection handle",
+ "mysql_server_init wasn't called"
};
/* Start of code added by Roberto M. Serqueira - martinsc@uol.com.br - 05.24.2001 */
@@ -81,24 +82,24 @@ const char *client_errors[]=
{
"Erro desconhecido do MySQL",
"Não pode criar 'UNIX socket' (%d)",
- "Não pode se conectar ao servidor MySQL local através do 'socket' '%-.64s' (%d)",
- "Não pode se conectar ao servidor MySQL em '%-.64s' (%d)",
+ "Não pode se conectar ao servidor MySQL local através do 'socket' '%-.100s' (%d)",
+ "Não pode se conectar ao servidor MySQL em '%-.100s' (%d)",
"Não pode criar 'socket TCP/IP' (%d)",
- "'Host' servidor MySQL '%-.64s' (%d) desconhecido",
+ "'Host' servidor MySQL '%-.100s' (%d) desconhecido",
"Servidor MySQL desapareceu",
"Incompatibilidade de protocolos. Versão do Servidor: %d - Versão do Cliente: %d",
"Cliente do MySQL com falta de memória",
"Informação inválida de 'host'",
"Localhost via 'UNIX socket'",
- "%-.64s via 'TCP/IP'",
+ "%-.100s via 'TCP/IP'",
"Erro na negociação de acesso ao servidor",
"Conexão perdida com servidor MySQL durante 'query'",
"Comandos fora de sincronismo. Você não pode executar este comando agora",
- "%-.64s via 'named pipe'",
+ "%-.100s via 'named pipe'",
"Não pode esperar pelo 'named pipe' para o 'host' %-.64s - 'pipe' %-.32s (%lu)",
"Não pode abrir 'named pipe' para o 'host' %-.64s - 'pipe' %-.32s (%lu)",
"Não pode estabelecer o estado do 'named pipe' para o 'host' %-.64s - 'pipe' %-.32s (%lu)",
- "Não pode inicializar conjunto de caracteres %-.64s (caminho %-.64s)",
+ "Não pode inicializar conjunto de caracteres %-.32s (caminho %-.100s)",
"Obteve pacote maior do que 'max_allowed_packet'",
"Embedded server"
"Error on SHOW SLAVE STATUS:",
@@ -126,7 +127,8 @@ const char *client_errors[]=
"Can't open shared memory. Server abandoded and don't sent the answer event (%lu)",
"Can't open shared memory. Can't send the request event to server (%lu)",
"Wrong or unknown protocol",
- "Invalid connection handle"
+ "Invalid connection handle",
+ "mysql_server_init wasn't called"
};
#else /* ENGLISH */
@@ -134,24 +136,24 @@ const char *client_errors[]=
{
"Unknown MySQL error",
"Can't create UNIX socket (%d)",
- "Can't connect to local MySQL server through socket '%-.64s' (%d)",
- "Can't connect to MySQL server on '%-.64s' (%d)",
+ "Can't connect to local MySQL server through socket '%-.100s' (%d)",
+ "Can't connect to MySQL server on '%-.100s' (%d)",
"Can't create TCP/IP socket (%d)",
- "Unknown MySQL Server Host '%-.64s' (%d)",
+ "Unknown MySQL Server Host '%-.100s' (%d)",
"MySQL server has gone away",
"Protocol mismatch. Server Version = %d Client Version = %d",
"MySQL client run out of memory",
"Wrong host info",
"Localhost via UNIX socket",
- "%-.64s via TCP/IP",
+ "%-.100s via TCP/IP",
"Error in server handshake",
"Lost connection to MySQL server during query",
"Commands out of sync; You can't run this command now",
- "%-.64s via named pipe",
+ "%-.100s via named pipe",
"Can't wait for named pipe to host: %-.64s pipe: %-.32s (%lu)",
"Can't open named pipe to host: %-.64s pipe: %-.32s (%lu)",
"Can't set state of named pipe to host: %-.64s pipe: %-.32s (%lu)",
- "Can't initialize character set %-.64s (path: %-.64s)",
+ "Can't initialize character set %-.32s (path: %-.100s)",
"Got packet bigger than 'max_allowed_packet'",
"Embedded server",
"Error on SHOW SLAVE STATUS:",
@@ -179,7 +181,8 @@ const char *client_errors[]=
"Can't open shared memory. Server abandoded and don't sent the answer event (%lu)",
"Can't open shared memory. Can't send the request event to server (%lu)",
"Wrong or unknown protocol",
- "Invalid connection handle"
+ "Invalid connection handle",
+ "mysql_server_init wasn't called"
};
#endif
diff --git a/libmysql/get_password.c b/libmysql/get_password.c
index e6221ea556e..0e3b2dcb0ae 100644
--- a/libmysql/get_password.c
+++ b/libmysql/get_password.c
@@ -78,7 +78,7 @@ char *get_tty_password(char *opt_message)
char *pos=to,*end=to+sizeof(to)-1;
int i=0;
DBUG_ENTER("get_tty_password");
- fprintf(stdout,opt_message ? opt_message : "Enter password: ");
+ _cputs(opt_message ? opt_message : "Enter password: ");
for (;;)
{
char tmp;
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index 19cfedce51d..3efce367cae 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -155,9 +155,16 @@ void STDCALL mysql_server_end()
{
/* If library called my_init(), free memory allocated by it */
if (!org_my_init_done)
+ {
my_end(0);
+#ifndef THREAD
+ /* Remove TRACING, if enabled by mysql_debug() */
+ DBUG_POP();
+#endif
+ }
else
mysql_thread_end();
+ mysql_client_init= org_my_init_done= 0;
}
#endif /*EMBEDDED_LIBRARY*/
@@ -272,7 +279,7 @@ my_bool STDCALL mysql_master_query(MYSQL *mysql, const char *q,
DBUG_ENTER("mysql_master_query");
if (mysql_master_send_query(mysql, q, length))
DBUG_RETURN(1);
- DBUG_RETURN(mysql_read_query_result(mysql));
+ DBUG_RETURN((*mysql->methods->read_query_result)(mysql));
}
my_bool STDCALL mysql_master_send_query(MYSQL *mysql, const char *q,
@@ -294,7 +301,7 @@ my_bool STDCALL mysql_slave_query(MYSQL *mysql, const char *q,
DBUG_ENTER("mysql_slave_query");
if (mysql_slave_send_query(mysql, q, length))
DBUG_RETURN(1);
- DBUG_RETURN(mysql_read_query_result(mysql));
+ DBUG_RETURN((*mysql->methods->read_query_result)(mysql));
}
@@ -594,6 +601,8 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
const char *passwd, const char *db)
{
char buff[512],*end=buff;
+ NET *net= &mysql->net;
+ ulong pkt_length;
DBUG_ENTER("mysql_change_user");
if (!user)
@@ -604,41 +613,54 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
/* Store user into the buffer */
end=strmov(end,user)+1;
- /*
- We always start with old type handshake the only difference is message sent
- If server handles secure connection type we'll not send the real scramble
- */
- if (mysql->server_capabilities & CLIENT_SECURE_CONNECTION)
+ /* write scrambled password according to server capabilities */
+ if (passwd[0])
{
- if (passwd[0])
+ if (mysql->server_capabilities & CLIENT_SECURE_CONNECTION)
{
- /* Prepare false scramble */
- bfill(end, SCRAMBLE_LENGTH, 'x');
- end+=SCRAMBLE_LENGTH;
- *end=0;
-
+ *end++= SCRAMBLE_LENGTH;
+ scramble(end, mysql->scramble, passwd);
+ end+= SCRAMBLE_LENGTH;
+ }
+ else
+ {
+ scramble_323(end, mysql->scramble, passwd);
+ end+= SCRAMBLE_LENGTH_323 + 1;
}
- else /* For empty password */
- *end=0; /* zero length scramble */
}
else
- {
- /*
- Real scramble is only sent to old servers. This can be blocked
- by calling mysql_options(MYSQL *, MYSQL_SECURE_CONNECT, (char*) &1);
- */
- end=scramble(end, mysql->scramble_buff, passwd,
- (my_bool) (mysql->protocol_version == 9));
- }
+ *end++= '\0'; /* empty password */
/* Add database if needed */
- end=strmov(end+1,db ? db : "");
+ end= strmov(end, db ? db : "") + 1;
/* Write authentication package */
simple_command(mysql,COM_CHANGE_USER, buff,(ulong) (end-buff),1);
- if (mysql_autenticate(mysql, passwd))
+ pkt_length= net_safe_read(mysql);
+
+ if (pkt_length == packet_error)
goto error;
+ if (pkt_length == 1 && net->read_pos[0] == 254 &&
+ mysql->server_capabilities & CLIENT_SECURE_CONNECTION)
+ {
+ /*
+ By sending this very specific reply server asks us to send scrambled
+ password in old format. The reply contains scramble_323.
+ */
+ scramble_323(buff, mysql->scramble, passwd);
+ if (my_net_write(net, buff, SCRAMBLE_LENGTH_323 + 1) || net_flush(net))
+ {
+ net->last_errno= CR_SERVER_LOST;
+ strmov(net->sqlstate, unknown_sqlstate);
+ strmov(net->last_error,ER(net->last_errno));
+ goto error;
+ }
+ /* Read what server thinks about out new auth message report */
+ if (net_safe_read(mysql) == packet_error)
+ goto error;
+ }
+
/* Free old connect information */
my_free(mysql->user,MYF(MY_ALLOW_ZERO_PTR));
my_free(mysql->passwd,MYF(MY_ALLOW_ZERO_PTR));
@@ -951,6 +973,19 @@ mysql_list_tables(MYSQL *mysql, const char *wild)
DBUG_RETURN (mysql_store_result(mysql));
}
+MYSQL_FIELD * STDCALL cli_list_fields(MYSQL *mysql)
+{
+ MYSQL_DATA *query;
+ if (!(query= cli_read_rows(mysql,(MYSQL_FIELD*) 0,
+ protocol_41(mysql) ? 8 : 6)))
+ return NULL;
+
+ mysql->field_count= query->rows;
+ return unpack_fields(query,&mysql->field_alloc,
+ query->rows, 1, mysql->server_capabilities);
+}
+
+
/**************************************************************************
List all fields in a table
If wild is given then only the fields matching wild is returned
@@ -961,34 +996,27 @@ mysql_list_tables(MYSQL *mysql, const char *wild)
MYSQL_RES * STDCALL
mysql_list_fields(MYSQL *mysql, const char *table, const char *wild)
{
- MYSQL_RES *result;
- MYSQL_DATA *query;
+ MYSQL_RES *result;
+ MYSQL_FIELD *fields;
char buff[257],*end;
DBUG_ENTER("mysql_list_fields");
DBUG_PRINT("enter",("table: '%s' wild: '%s'",table,wild ? wild : ""));
- LINT_INIT(query);
-
end=strmake(strmake(buff, table,128)+1,wild ? wild : "",128);
+ free_old_query(mysql);
if (simple_command(mysql,COM_FIELD_LIST,buff,(ulong) (end-buff),1) ||
- !(query = read_rows(mysql,(MYSQL_FIELD*) 0,
- protocol_41(mysql) ? 8 : 6)))
+ !(fields= (*mysql->methods->list_fields)(mysql)))
DBUG_RETURN(NULL);
- free_old_query(mysql);
if (!(result = (MYSQL_RES *) my_malloc(sizeof(MYSQL_RES),
MYF(MY_WME | MY_ZEROFILL))))
- {
- free_rows(query);
DBUG_RETURN(NULL);
- }
+
result->methods= mysql->methods;
result->field_alloc=mysql->field_alloc;
mysql->fields=0;
- result->field_count = (uint) query->rows;
- result->fields= unpack_fields(query,&result->field_alloc,
- result->field_count, 1,
- mysql->server_capabilities);
+ result->field_count = mysql->field_count;
+ result->fields= fields;
result->eof=1;
DBUG_RETURN(result);
}
@@ -1009,8 +1037,8 @@ mysql_list_processes(MYSQL *mysql)
free_old_query(mysql);
pos=(uchar*) mysql->net.read_pos;
field_count=(uint) net_field_length(&pos);
- if (!(fields = read_rows(mysql,(MYSQL_FIELD*) 0,
- protocol_41(mysql) ? 7 : 5)))
+ if (!(fields = (*mysql->methods->read_rows)(mysql,(MYSQL_FIELD*) 0,
+ protocol_41(mysql) ? 7 : 5)))
DBUG_RETURN(NULL);
if (!(mysql->fields=unpack_fields(fields,&mysql->field_alloc,field_count,0,
mysql->server_capabilities)))
@@ -1466,8 +1494,8 @@ static void set_stmt_error(MYSQL_STMT * stmt, int errcode,
Copy error message to statement handler
*/
-static void set_stmt_errmsg(MYSQL_STMT * stmt, const char *err, int errcode,
- const char *sqlstate)
+void set_stmt_errmsg(MYSQL_STMT * stmt, const char *err, int errcode,
+ const char *sqlstate)
{
DBUG_ENTER("set_stmt_error_msg");
DBUG_PRINT("enter", ("error: %d/%s '%s'", errcode, sqlstate, err));
@@ -1541,7 +1569,7 @@ static my_bool my_realloc_str(NET *net, ulong length)
1 error
*/
-static my_bool read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt)
+my_bool STDCALL cli_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt)
{
uchar *pos;
uint field_count;
@@ -1564,25 +1592,16 @@ static my_bool read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt)
mysql->server_status|= SERVER_STATUS_IN_TRANS;
mysql->extra_info= net_field_length_ll(&pos);
- if (!(fields_data= read_rows(mysql, (MYSQL_FIELD*) 0, 7)))
+ if (!(fields_data= (*mysql->methods->read_rows)(mysql,(MYSQL_FIELD*)0,7)))
DBUG_RETURN(1);
if (!(stmt->fields= unpack_fields(fields_data,&stmt->mem_root,
field_count,0,
mysql->server_capabilities)))
DBUG_RETURN(1);
}
- if (!(stmt->params= (MYSQL_BIND *) alloc_root(&stmt->mem_root,
- sizeof(MYSQL_BIND)*
- (param_count +
- field_count))))
- {
- set_stmt_error(stmt, CR_OUT_OF_MEMORY, unknown_sqlstate);
- DBUG_RETURN(0);
- }
- stmt->bind= (stmt->params + param_count);
stmt->field_count= (uint) field_count;
stmt->param_count= (ulong) param_count;
- mysql->status= MYSQL_STATUS_READY;
+
DBUG_RETURN(0);
}
@@ -1626,14 +1645,25 @@ mysql_prepare(MYSQL *mysql, const char *query, ulong length)
}
init_alloc_root(&stmt->mem_root,8192,0);
- if (read_prepare_result(mysql, stmt))
+ if ((*mysql->methods->read_prepare_result)(mysql, stmt))
{
stmt_close(stmt, 1);
DBUG_RETURN(0);
}
+
+ if (!(stmt->params= (MYSQL_BIND *) alloc_root(&stmt->mem_root,
+ sizeof(MYSQL_BIND)*
+ (stmt->param_count +
+ stmt->field_count))))
+ {
+ set_stmt_error(stmt, CR_OUT_OF_MEMORY, unknown_sqlstate);
+ DBUG_RETURN(0);
+ }
+ stmt->bind= stmt->params + stmt->param_count;
stmt->state= MY_ST_PREPARE;
stmt->mysql= mysql;
mysql->stmts= list_add(mysql->stmts, &stmt->list);
+ mysql->status= MYSQL_STATUS_READY;
stmt->list.data= stmt;
DBUG_PRINT("info", ("Parameter count: %ld", stmt->param_count));
DBUG_RETURN(stmt);
@@ -1693,10 +1723,10 @@ unsigned int alloc_stmt_fields(MYSQL_STMT *stmt)
*/
MYSQL_RES * STDCALL
-mysql_prepare_result(MYSQL_STMT *stmt)
+mysql_get_metadata(MYSQL_STMT *stmt)
{
MYSQL_RES *result;
- DBUG_ENTER("mysql_prepare_result");
+ DBUG_ENTER("mysql_get_metadata");
if (!stmt->field_count || !stmt->fields)
{
@@ -1736,7 +1766,6 @@ mysql_param_result(MYSQL_STMT *stmt)
}
-
/********************************************************************
Prepare-execute, and param handling
*********************************************************************/
@@ -1751,6 +1780,7 @@ static void store_param_type(NET *net, uint type)
net->write_pos+=2;
}
+
/****************************************************************************
Functions to store parameter data from a prepared statement.
@@ -1766,7 +1796,6 @@ static void store_param_type(NET *net, uint type)
1 Error (Can't alloc net->buffer)
****************************************************************************/
-
static void store_param_tinyint(NET *net, MYSQL_BIND *param)
{
*(net->write_pos++)= (uchar) *param->buffer;
@@ -1950,36 +1979,21 @@ static my_bool execute(MYSQL_STMT * stmt, char *packet, ulong length)
mysql->last_used_con= mysql;
int4store(buff, stmt->stmt_id); /* Send stmt id to server */
- if ((*mysql->methods->advanced_command)(mysql, COM_EXECUTE, buff,
- MYSQL_STMT_HEADER, packet,
- length, 1) ||
- mysql_read_query_result(mysql))
+ if (cli_advanced_command(mysql, COM_EXECUTE, buff,
+ MYSQL_STMT_HEADER, packet,
+ length, 1) ||
+ (*mysql->methods->read_query_result)(mysql))
{
set_stmt_errmsg(stmt, net->last_error, net->last_errno, net->sqlstate);
DBUG_RETURN(1);
}
- stmt->state= MY_ST_EXECUTE;
- mysql_free_result(stmt->result);
- stmt->result= (MYSQL_RES *)0;
- stmt->result_buffered= 0;
- stmt->current_row= 0;
DBUG_RETURN(0);
}
-
-/*
- Execute the prepare query
-*/
-
-int STDCALL mysql_execute(MYSQL_STMT *stmt)
+int STDCALL cli_stmt_execute(MYSQL_STMT *stmt)
{
- DBUG_ENTER("mysql_execute");
+ DBUG_ENTER("cli_stmt_execute");
- if (stmt->state == MY_ST_UNKNOWN)
- {
- set_stmt_error(stmt, CR_NO_PREPARE_STMT, unknown_sqlstate);
- DBUG_RETURN(1);
- }
if (stmt->param_count)
{
NET *net= &stmt->mysql->net;
@@ -2040,6 +2054,30 @@ int STDCALL mysql_execute(MYSQL_STMT *stmt)
DBUG_RETURN((int) execute(stmt,0,0));
}
+/*
+ Execute the prepare query
+*/
+
+int STDCALL mysql_execute(MYSQL_STMT *stmt)
+{
+ DBUG_ENTER("mysql_execute");
+
+ if (stmt->state == MY_ST_UNKNOWN)
+ {
+ set_stmt_error(stmt, CR_NO_PREPARE_STMT, unknown_sqlstate);
+ DBUG_RETURN(1);
+ }
+ if ((*stmt->mysql->methods->stmt_execute)(stmt))
+ DBUG_RETURN(1);
+
+ stmt->state= MY_ST_EXECUTE;
+ mysql_free_result(stmt->result);
+ stmt->result= (MYSQL_RES *)0;
+ stmt->result_buffered= 0;
+ stmt->current_row= 0;
+ DBUG_RETURN(0);
+}
+
/*
Return total parameters count in the statement
@@ -2063,8 +2101,6 @@ my_ulonglong STDCALL mysql_stmt_affected_rows(MYSQL_STMT *stmt)
static my_bool int_is_null_true= 1; /* Used for MYSQL_TYPE_NULL */
static my_bool int_is_null_false= 0;
-static my_bool int_is_null_dummy;
-static unsigned long param_length_is_dummy;
/*
Setup the parameter data buffers from application
@@ -2400,7 +2436,10 @@ static void send_data_long(MYSQL_BIND *param, longlong value)
char tmp[22]; /* Enough for longlong */
uint length= (uint)(longlong10_to_str(value,(char *)tmp,10)-tmp);
ulong copy_length= min((ulong)length-param->offset, param->buffer_length);
- memcpy(buffer, (char *)tmp+param->offset, copy_length);
+ if ((long) copy_length < 0)
+ copy_length=0;
+ else
+ memcpy(buffer, (char *)tmp+param->offset, copy_length);
*param->length= length;
if (copy_length != param->buffer_length)
@@ -2448,7 +2487,10 @@ static void send_data_double(MYSQL_BIND *param, double value)
char tmp[128];
uint length= my_sprintf(tmp,(tmp,"%g",value));
ulong copy_length= min((ulong)length-param->offset, param->buffer_length);
- memcpy(buffer, (char *)tmp+param->offset, copy_length);
+ if ((long) copy_length < 0)
+ copy_length=0;
+ else
+ memcpy(buffer, (char *)tmp+param->offset, copy_length);
*param->length= length;
if (copy_length != param->buffer_length)
@@ -2513,15 +2555,19 @@ static void send_data_str(MYSQL_BIND *param, char *value, uint length)
case MYSQL_TYPE_BLOB:
*param->length= length;
length= min(length-param->offset, param->buffer_length);
- memcpy(buffer, value+param->offset, length);
+ if ((long) length > 0)
+ memcpy(buffer, value+param->offset, length);
break;
default:
*param->length= length;
length= min(length-param->offset, param->buffer_length);
- memcpy(buffer, value+param->offset, length);
+ if ((long) length < 0)
+ length= 0;
+ else
+ memcpy(buffer, value+param->offset, length);
if (length != param->buffer_length)
buffer[length]= '\0';
- }
+ }
}
@@ -2583,15 +2629,16 @@ static void send_data_time(MYSQL_BIND *param, MYSQL_TIME ltime,
/* Fetch data to buffers */
-static void fetch_results(MYSQL_BIND *param, uint field_type, uchar **row,
- my_bool field_is_unsigned)
+static void fetch_results(MYSQL_BIND *param, MYSQL_FIELD *field, uchar **row)
{
ulong length;
-
+ enum enum_field_types field_type= field->type;
+
switch (field_type) {
case MYSQL_TYPE_TINY:
{
char value= (char) **row;
+ uint field_is_unsigned= (field->flags & UNSIGNED_FLAG);
longlong data= ((field_is_unsigned) ? (longlong) (unsigned char) value:
(longlong) value);
send_data_long(param,data);
@@ -2602,6 +2649,7 @@ static void fetch_results(MYSQL_BIND *param, uint field_type, uchar **row,
case MYSQL_TYPE_YEAR:
{
short value= sint2korr(*row);
+ uint field_is_unsigned= (field->flags & UNSIGNED_FLAG);
longlong data= ((field_is_unsigned) ? (longlong) (unsigned short) value:
(longlong) value);
send_data_long(param,data);
@@ -2611,6 +2659,7 @@ static void fetch_results(MYSQL_BIND *param, uint field_type, uchar **row,
case MYSQL_TYPE_LONG:
{
long value= sint4korr(*row);
+ uint field_is_unsigned= (field->flags & UNSIGNED_FLAG);
longlong data= ((field_is_unsigned) ? (longlong) (unsigned long) value:
(longlong) value);
send_data_long(param,data);
@@ -2759,24 +2808,6 @@ static void fetch_result_str(MYSQL_BIND *param, uchar **row)
*row+= length;
}
-static uint default_binary_field_length(uint field_type)
-{
- switch(field_type) {
- case MYSQL_TYPE_TINY:
- return 1;
- case MYSQL_TYPE_SHORT:
- return 2;
- case MYSQL_TYPE_LONG:
- case MYSQL_TYPE_FLOAT:
- return 4;
- case MYSQL_TYPE_LONGLONG:
- case MYSQL_TYPE_DOUBLE:
- return 8;
- default:
- return 0;
- }
-}
-
/*
Setup the bind buffers for resultset processing
@@ -2816,10 +2847,10 @@ my_bool STDCALL mysql_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind)
This is to make the excute code easier
*/
if (!param->is_null)
- param->is_null= &int_is_null_dummy;
+ param->is_null= &param->internal_is_null;
if (!param->length)
- param->length= &param_length_is_dummy;
+ param->length= &param->internal_length;
param->param_number= param_count++;
param->offset= 0;
@@ -2923,10 +2954,7 @@ static int stmt_fetch_row(MYSQL_STMT *stmt, uchar *row)
if (field->type == bind->buffer_type)
(*bind->fetch_result)(bind, &row);
else
- {
- my_bool field_is_unsigned= (field->flags & UNSIGNED_FLAG) ? 1: 0;
- fetch_results(bind, field->type, &row, field_is_unsigned);
- }
+ fetch_results(bind, field, &row);
}
if (!((bit<<=1) & 255))
{
@@ -2937,6 +2965,14 @@ static int stmt_fetch_row(MYSQL_STMT *stmt, uchar *row)
return 0;
}
+int STDCALL cli_unbuffered_fetch(MYSQL *mysql, char **row)
+{
+ if (packet_error == net_safe_read(mysql))
+ return 1;
+
+ *row= (mysql->net.read_pos[0] == 254) ? NULL : (mysql->net.read_pos+1);
+ return 0;
+}
/*
Fetch and return row data to bound buffers, if any
@@ -2948,8 +2984,8 @@ int STDCALL mysql_fetch(MYSQL_STMT *stmt)
uchar *row;
DBUG_ENTER("mysql_fetch");
- stmt->last_fetched_column= 0; /* reset */
- if (stmt->result_buffered) /* buffered */
+ stmt->last_fetched_column= 0; /* reset */
+ if (stmt->result_buffered) /* buffered */
{
MYSQL_RES *res;
@@ -2964,22 +3000,22 @@ int STDCALL mysql_fetch(MYSQL_STMT *stmt)
row= (uchar *)res->data_cursor->data;
res->data_cursor= res->data_cursor->next;
}
- else /* un-buffered */
+ else /* un-buffered */
{
- if (packet_error == net_safe_read(mysql))
+ if((*mysql->methods->unbuffered_fetch)(mysql, ( char **)&row))
{
set_stmt_errmsg(stmt, mysql->net.last_error, mysql->net.last_errno,
mysql->net.sqlstate);
DBUG_RETURN(1);
}
- if (mysql->net.read_pos[0] == 254)
+ if (!row)
{
mysql->status= MYSQL_STATUS_READY;
stmt->current_row= 0;
goto no_data;
}
- row= mysql->net.read_pos+1;
- }
+ }
+
stmt->current_row= row;
DBUG_RETURN(stmt_fetch_row(stmt, row));
@@ -2990,107 +3026,55 @@ no_data:
/*
- Fetch only specified column data to buffers
+ Fetch datat for one specified column data
+
+ SYNOPSIS
+ mysql_fetch_column()
+ stmt Prepared statement handler
+ bind Where date should be placed. Should be filled in as
+ when calling mysql_bind_param()
+ column Column to fetch (first column is 0)
+ ulong offset Offset in result data (to fetch blob in pieces)
+ This is normally 0
+ RETURN
+ 0 ok
+ 1 error
*/
int STDCALL mysql_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind,
- my_ulonglong icol,
- ulong offset)
+ uint column, ulong offset)
{
- uchar *row;
- my_bool null_data;
-
+ MYSQL_BIND *param= stmt->bind+column;
DBUG_ENTER("mysql_fetch_column");
- if (!(row= stmt->current_row))
+ if (!stmt->current_row)
goto no_data;
#ifdef CHECK_EXTRA_ARGUMENTS
- if (!bind || icol >= stmt->field_count)
+ if (column >= stmt->field_count)
{
- set_stmt_errmsg(stmt, "Invalid column descriptor or offset",1,
- unknown_sqlstate);
+ set_stmt_errmsg(stmt, "Invalid column descriptor",1, unknown_sqlstate);
DBUG_RETURN(1);
}
#endif
- /* column '0' == first column */
- if (stmt->res_buffers)
- {
- /*
- Already buffers are parsed and cached to stmt->bind
- during mysql_fetch() call.
- */
- MYSQL_BIND *param= stmt->bind+icol;
- null_data= param->null_field;
- row= param->inter_buffer;
- }
- else
- {
- if (stmt->last_fetched_column == icol+1)
- {
- /*
- Data buffer is already parsed during the last call, get
- the cached information
- */
- if (!stmt->last_fetched_buffer)
- null_data= 1;
- else
- {
- null_data= 0;
- row= stmt->last_fetched_buffer;
- }
- }
- else
- {
- /*
- Advance the data buffer to icol position and cache
- the information for subsequent calls
- */
- uint bit= icol > 6 ? 1 : 4;
- stmt->last_fetched_column= icol+1;
-
- if (row[icol/8] & (bit << icol & 7))
- {
- stmt->last_fetched_buffer= 0;
- null_data= 1;
- }
- else
- {
- uint length, i;
-
- null_data= 0;
- row+= (stmt->field_count+9)/8; /* skip null bits */
-
- for (i=0; i < icol; i++)
- {
- if (!(length= default_binary_field_length((uint)(stmt->fields[i].
- type))))
- length= net_field_length(&row);
- row+= length;
- }
- stmt->last_fetched_buffer= row;
- }
- }
- }
- if (null_data)
+ if (param->null_field)
{
if (bind->is_null)
*bind->is_null= 1;
}
else
{
- MYSQL_FIELD *field= stmt->fields+icol;
- my_bool field_is_unsigned= (field->flags & UNSIGNED_FLAG) ? 1: 0;
-
+ MYSQL_FIELD *field= stmt->fields+column;
+ uchar *row= param->inter_buffer;
bind->offset= offset;
if (bind->is_null)
*bind->is_null= 0;
if (bind->length) /* Set the length if non char/binary types */
- *bind->length= default_binary_field_length(field->type);
+ *bind->length= *param->length;
else
- bind->length= &param_length_is_dummy;
- fetch_results(bind, field->type, &row, field_is_unsigned);
+ bind->length= &param->internal_length; /* Needed for fetch_result() */
+ fetch_results(bind, field, &row);
}
DBUG_RETURN(0);
@@ -3104,7 +3088,7 @@ no_data:
Read all rows of data from server (binary format)
*/
-static MYSQL_DATA *read_binary_rows(MYSQL_STMT *stmt)
+MYSQL_DATA *cli_read_binary_rows(MYSQL_STMT *stmt)
{
ulong pkt_len;
uchar *cp;
@@ -3200,7 +3184,7 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt)
}
result->methods= mysql->methods;
stmt->result_buffered= 1;
- if (!(result->data= read_binary_rows(stmt)))
+ if (!(result->data= (*stmt->mysql->methods->read_binary_rows)(stmt)))
{
my_free((gptr) result,MYF(0));
DBUG_RETURN(0);
@@ -3504,7 +3488,18 @@ my_bool STDCALL mysql_next_result(MYSQL *mysql)
mysql->affected_rows= ~(my_ulonglong) 0;
if (mysql->last_used_con->server_status & SERVER_MORE_RESULTS_EXISTS)
- DBUG_RETURN(mysql_read_query_result(mysql));
+ DBUG_RETURN((*mysql->methods->read_query_result)(mysql));
DBUG_RETURN(0);
}
+
+MYSQL_RES * STDCALL mysql_use_result(MYSQL *mysql)
+{
+ return (*mysql->methods->use_result)(mysql);
+}
+
+my_bool STDCALL mysql_read_query_result(MYSQL *mysql)
+{
+ return (*mysql->methods->read_query_result)(mysql);
+}
+
diff --git a/libmysqld/Makefile.am b/libmysqld/Makefile.am
index b22ff9e5001..09b03bce79a 100644
--- a/libmysqld/Makefile.am
+++ b/libmysqld/Makefile.am
@@ -22,6 +22,7 @@ MYSQLSHAREdir = $(pkgdatadir)
MYSQLBASEdir= $(prefix)
DEFS = -DEMBEDDED_LIBRARY -DMYSQL_SERVER \
+ -DNO_EMBEDDED_ACCESS_CHECKS \
-DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \
-DDATADIR="\"$(MYSQLDATAdir)\"" \
-DSHAREDIR="\"$(MYSQLSHAREdir)\""
diff --git a/libmysqld/embedded_priv.h b/libmysqld/embedded_priv.h
index dfc06e38ab2..833cc1b1f80 100644
--- a/libmysqld/embedded_priv.h
+++ b/libmysqld/embedded_priv.h
@@ -26,4 +26,7 @@ C_MODE_START
extern void lib_connection_phase(NET *net, int phase);
extern void init_embedded_mysql(MYSQL *mysql, int client_flag, char *db);
extern void *create_embedded_thd(int client_flag, char *db);
+extern MYSQL_METHODS embedded_methods;
+void free_old_query(MYSQL *mysql);
+extern my_bool server_inited;
C_MODE_END
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index aaa31908360..ddfd05d64b6 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -26,7 +26,6 @@
static int fake_argc= 1;
static char *fake_argv[]= {(char *)"", 0};
static const char *fake_groups[] = { "server", "embedded", 0 };
-static char inited, org_my_init_done;
#if defined (__WIN__)
#include "../sql/mysqld.cpp"
@@ -34,33 +33,32 @@ static char inited, org_my_init_done;
#include "../sql/mysqld.cc"
#endif
-#define SCRAMBLE_LENGTH 8
+int check_user(THD *thd, enum enum_server_command command,
+ const char *passwd, uint passwd_len, const char *db,
+ bool check_count);
C_MODE_START
#include <mysql.h>
+#undef ER
#include "errmsg.h"
#include <sql_common.h>
-static int check_connections1(THD * thd);
-static int check_connections2(THD * thd);
-static bool check_user(THD *thd, enum_server_command command,
- const char *user, const char *passwd, const char *db,
- bool check_count);
-char * get_mysql_home(){ return mysql_home;};
-char * get_mysql_real_data_home(){ return mysql_real_data_home;};
+static my_bool org_my_init_done;
+my_bool server_inited;
-my_bool
+static my_bool STDCALL
emb_advanced_command(MYSQL *mysql, enum enum_server_command command,
const char *header, ulong header_length,
const char *arg, ulong arg_length, my_bool skip_check)
{
my_bool result= 1;
THD *thd=(THD *) mysql->thd;
+ NET *net= &mysql->net;
/* Check that we are calling the client functions in right order */
if (mysql->status != MYSQL_STATUS_READY)
{
- strmov(thd->net.last_error,
- ER(thd->net.last_errno=CR_COMMANDS_OUT_OF_SYNC));
+ strmov(net->last_error,
+ ER(net->last_errno=CR_COMMANDS_OUT_OF_SYNC));
return 1;
}
@@ -70,59 +68,181 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command,
mysql->field_count= 0;
thd->store_globals(); // Fix if more than one connect
+ /*
+ We have to call free_old_query before we start to fill mysql->fields
+ for new query. In the case of embedded server we collect field data
+ during query execution (not during data retrieval as it is in remote
+ client). So we have to call free_old_query here
+ */
free_old_query(mysql);
+ if (!arg)
+ {
+ arg= header;
+ arg_length= header_length;
+ }
+
result= dispatch_command(command, thd, (char *) arg, arg_length + 1);
if (!skip_check)
result= thd->net.last_errno ? -1 : 0;
- if ((mysql->net.last_errno= thd->net.last_errno))
+ if ((net->last_errno= thd->net.last_errno))
{
- memcpy(mysql->net.last_error, thd->net.last_error,
- sizeof(mysql->net.last_error));
- memcpy(mysql->net.sqlstate, thd->net.sqlstate,
- sizeof(mysql->net.sqlstate));
+ memcpy(net->last_error, thd->net.last_error, sizeof(net->last_error));
+ memcpy(net->sqlstate, thd->net.sqlstate, sizeof(net->sqlstate));
}
+ else
+ net->last_error[0]= 0;
mysql->warning_count= ((THD*)mysql->thd)->total_warn_count;
return result;
}
-C_MODE_END
+static MYSQL_DATA * STDCALL
+emb_read_rows(MYSQL *mysql, MYSQL_FIELD *mysql_fields __attribute__((unused)),
+ unsigned int fields __attribute__((unused)))
+{
+ MYSQL_DATA *result= ((THD*)mysql->thd)->data;
+ if (!result)
+ {
+ if (!(result=(MYSQL_DATA*) my_malloc(sizeof(MYSQL_DATA),
+ MYF(MY_WME | MY_ZEROFILL))))
+ {
+ NET *net = &mysql->net;
+ net->last_errno=CR_OUT_OF_MEMORY;
+ strmov(net->sqlstate, unknown_sqlstate);
+ strmov(net->last_error,ER(net->last_errno));
+ return NULL;
+ }
+ return result;
+ }
+ *result->prev_ptr= NULL;
+ ((THD*)mysql->thd)->data= NULL;
+ return result;
+}
-void THD::clear_error()
+static MYSQL_FIELD * STDCALL emb_list_fields(MYSQL *mysql)
{
- net.last_error[0]= 0;
- net.last_errno= 0;
- net.report_error= 0;
+ return mysql->fields;
}
-static bool check_user(THD *thd,enum_server_command command, const char *user,
- const char *passwd, const char *db, bool check_count)
+static my_bool STDCALL emb_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt)
{
- thd->db=0;
+ THD *thd= (THD*)mysql->thd;
+ stmt->stmt_id= thd->client_stmt_id;
+ stmt->param_count= thd->client_param_count;
+ stmt->field_count= mysql->field_count;
- if (!(thd->user = my_strdup(user, MYF(0))))
+ if (stmt->field_count != 0)
{
- send_error(thd,ER_OUT_OF_RESOURCES);
- return 1;
+ if (!(mysql->server_status & SERVER_STATUS_AUTOCOMMIT))
+ mysql->server_status|= SERVER_STATUS_IN_TRANS;
+
+ stmt->fields= mysql->fields;
+ stmt->mem_root= mysql->field_alloc;
+ mysql->fields= NULL;
+ }
+
+ return 0;
+}
+
+/**************************************************************************
+ Get column lengths of the current row
+ If one uses mysql_use_result, res->lengths contains the length information,
+ else the lengths are calculated from the offset between pointers.
+**************************************************************************/
+
+static void STDCALL emb_fetch_lengths(ulong *to, MYSQL_ROW column, unsigned int field_count)
+{
+ MYSQL_ROW end;
+
+ for (end=column + field_count; column != end ; column++,to++)
+ *to= *column ? *(uint *)((*column) - sizeof(uint)) : 0;
+}
+
+static my_bool STDCALL emb_mysql_read_query_result(MYSQL *mysql)
+{
+ if (mysql->net.last_errno)
+ return -1;
+
+ if (mysql->field_count)
+ mysql->status=MYSQL_STATUS_GET_RESULT;
+
+ return 0;
+}
+
+static int STDCALL emb_stmt_execute(MYSQL_STMT *stmt)
+{
+ DBUG_ENTER("emb_stmt_execute");
+ THD *thd= (THD*)stmt->mysql->thd;
+ thd->client_param_count= stmt->param_count;
+ thd->client_params= stmt->params;
+ if (emb_advanced_command(stmt->mysql, COM_EXECUTE,0,0,
+ (const char*)&stmt->stmt_id,sizeof(stmt->stmt_id),1)
+ || emb_mysql_read_query_result(stmt->mysql))
+ {
+ NET *net= &stmt->mysql->net;
+ set_stmt_errmsg(stmt, net->last_error, net->last_errno, net->sqlstate);
+ DBUG_RETURN(1);
+ }
+ DBUG_RETURN(0);
+}
+
+MYSQL_DATA *emb_read_binary_rows(MYSQL_STMT *stmt)
+{
+ return emb_read_rows(stmt->mysql, 0, 0);
+}
+
+int STDCALL emb_unbuffered_fetch(MYSQL *mysql, char **row)
+{
+ MYSQL_DATA *data= ((THD*)mysql->thd)->data;
+ if (!data || !data->data)
+ {
+ *row= NULL;
+ if (data)
+ {
+ free_rows(data);
+ ((THD*)mysql->thd)->data= NULL;
+ }
}
- thd->master_access= ~0L; // No user checking
- thd->priv_user= thd->user;
- mysql_log.write(thd,command,
- (thd->priv_user == thd->user ?
- (char*) "%s@%s on %s" :
- (char*) "%s@%s as anonymous on %s"),
- user,
- thd->host_or_ip,
- db ? db : (char*) "");
- thd->db_access=0;
- if (db && db[0])
- return test(mysql_change_db(thd,db));
else
- send_ok(thd); // Ready to handle questions
- return 0; // ok
+ {
+ *row= (char *)data->data->data;
+ data->data= data->data->next;
+ }
+ return 0;
}
+static void STDCALL emb_free_embedded_thd(MYSQL *mysql)
+{
+ THD *thd= (THD*)mysql->thd;
+ if (thd->data)
+ free_rows(thd->data);
+ delete thd;
+}
+
+MYSQL_METHODS embedded_methods=
+{
+ emb_mysql_read_query_result,
+ emb_advanced_command,
+ emb_read_rows,
+ mysql_store_result,
+ emb_fetch_lengths,
+ emb_list_fields,
+ emb_read_prepare_result,
+ emb_stmt_execute,
+ emb_read_binary_rows,
+ emb_unbuffered_fetch,
+ emb_free_embedded_thd
+};
+
+C_MODE_END
+
+void THD::clear_error()
+{
+ net.last_error[0]= 0;
+ net.last_errno= 0;
+ net.report_error= 0;
+}
/*
Make a copy of array and the strings array points to
@@ -182,9 +302,9 @@ int STDCALL mysql_server_init(int argc, char **argv, char **groups)
/* Only call MY_INIT() if it hasn't been called before */
- if (!inited)
+ if (!server_inited)
{
- inited=1;
+ server_inited=1;
org_my_init_done=my_init_done;
}
if (!org_my_init_done)
@@ -218,7 +338,7 @@ int STDCALL mysql_server_init(int argc, char **argv, char **groups)
error_handler_hook = my_message_sql;
- opt_noacl = 1; // No permissions
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (acl_init((THD *)0, opt_noacl))
{
mysql_server_end();
@@ -226,11 +346,16 @@ int STDCALL mysql_server_init(int argc, char **argv, char **groups)
}
if (!opt_noacl)
(void) grant_init((THD *)0);
+
+#endif
+
init_max_user_conn();
init_update_queries();
#ifdef HAVE_DLOPEN
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (!opt_noacl)
+#endif
udf_init();
#endif
@@ -264,6 +389,15 @@ int STDCALL mysql_server_init(int argc, char **argv, char **groups)
sql_print_error("Warning: Can't create thread to manage maintenance");
}
+ if (opt_init_file)
+ {
+ if (read_init_file(opt_init_file))
+ {
+ mysql_server_end();
+ return 1;
+ }
+ }
+
/*
Update mysqld variables from client variables if set
The client variables are set also by get_one_option() in mysqld.cc
@@ -323,48 +457,94 @@ void *create_embedded_thd(int client_flag, char *db)
thd->db= db;
thd->db_length= db ? strip_sp(db) : 0;
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
thd->db_access= DB_ACLS;
thd->master_access= ~NO_ACCESS;
+#endif
thd->net.query_cache_query= 0;
+ thd->data= 0;
+
return thd;
}
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+int check_embedded_connection(MYSQL *mysql)
+{
+ THD *thd= (THD*)mysql->thd;
+ int result;
+ char scramble_buff[SCRAMBLE_LENGTH];
+ int passwd_len;
+
+ thd->host= mysql->options.client_ip ?
+ mysql->options.client_ip : (char*)my_localhost;
+ thd->ip= thd->host;
+ thd->host_or_ip= thd->host;
+
+ if (acl_check_host(thd->host,thd->ip))
+ {
+ result= ER_HOST_NOT_PRIVILEGED;
+ goto err;
+ }
+
+ thd->user= mysql->user;
+ if (mysql->passwd && mysql->passwd[0])
+ {
+ memset(thd->scramble, 55, SCRAMBLE_LENGTH); // dummy scramble
+ thd->scramble[SCRAMBLE_LENGTH]= 0;
+ scramble(scramble_buff, thd->scramble, mysql->passwd);
+ passwd_len= SCRAMBLE_LENGTH;
+ }
+ else
+ passwd_len= 0;
+
+ if((result= check_user(thd, COM_CONNECT,
+ scramble_buff, passwd_len, thd->db, true)))
+ goto err;
+
+ return 0;
+err:
+ {
+ NET *net= &mysql->net;
+ memcpy(net->last_error, thd->net.last_error, sizeof(net->last_error));
+ memcpy(net->sqlstate, thd->net.sqlstate, sizeof(net->sqlstate));
+ }
+ return result;
+}
+#endif
+
C_MODE_END
bool Protocol::send_fields(List<Item> *list, uint flag)
{
List_iterator_fast<Item> it(*list);
Item *item;
- MYSQL_FIELD *field, *client_field;
+ MYSQL_FIELD *client_field;
MYSQL *mysql= thd->mysql;
+ MEM_ROOT *field_alloc;
DBUG_ENTER("send_fields");
- field_count= list->elements;
- if (!(mysql->result=(MYSQL_RES*) my_malloc(sizeof(MYSQL_RES)+
- sizeof(ulong) * (field_count + 1),
- MYF(MY_WME | MY_ZEROFILL))))
- goto err;
- mysql->result->lengths= (ulong *)(mysql->result + 1);
+ if (!mysql) // bootstrap file handling
+ DBUG_RETURN(0);
- mysql->field_count=field_count;
- alloc= &mysql->field_alloc;
- field= (MYSQL_FIELD *)alloc_root(alloc, sizeof(MYSQL_FIELD) * field_count);
- if (!field)
+ field_count= list->elements;
+ field_alloc= &mysql->field_alloc;
+ if (!(client_field= thd->mysql->fields=
+ (MYSQL_FIELD *)alloc_root(field_alloc,
+ sizeof(MYSQL_FIELD) * field_count)))
goto err;
- client_field= field;
while ((item= it++))
{
Send_field server_field;
item->make_field(&server_field);
- client_field->db= strdup_root(alloc, server_field.db_name);
- client_field->table= strdup_root(alloc, server_field.table_name);
- client_field->name= strdup_root(alloc, server_field.col_name);
- client_field->org_table= strdup_root(alloc, server_field.org_table_name);
- client_field->org_name= strdup_root(alloc, server_field.org_col_name);
+ client_field->db= strdup_root(field_alloc, server_field.db_name);
+ client_field->table= strdup_root(field_alloc, server_field.table_name);
+ client_field->name= strdup_root(field_alloc, server_field.col_name);
+ client_field->org_table= strdup_root(field_alloc, server_field.org_table_name);
+ client_field->org_name= strdup_root(field_alloc, server_field.org_col_name);
client_field->length= server_field.length;
client_field->type= server_field.type;
client_field->flags= server_field.flags;
@@ -385,31 +565,16 @@ bool Protocol::send_fields(List<Item> *list, uint flag)
String tmp(buff, sizeof(buff), default_charset_info), *res;
if (!(res=item->val_str(&tmp)))
- client_field->def= strdup_root(alloc, "");
+ client_field->def= strdup_root(field_alloc, "");
else
- client_field->def= strdup_root(alloc, tmp.ptr());
+ client_field->def= strdup_root(field_alloc, tmp.ptr());
}
else
client_field->def=0;
client_field->max_length= 0;
++client_field;
}
- mysql->result->fields = field;
-
- if (!(mysql->result->data= (MYSQL_DATA*) my_malloc(sizeof(MYSQL_DATA),
- MYF(MY_WME | MY_ZEROFILL))))
- goto err;
-
- init_alloc_root(&mysql->result->data->alloc,8192,0); /* Assume rowlength < 8192 */
- mysql->result->data->alloc.min_malloc=sizeof(MYSQL_ROWS);
- mysql->result->data->rows=0;
- mysql->result->data->fields=field_count;
- mysql->result->field_count=field_count;
- mysql->result->data->prev_ptr= &mysql->result->data->data;
-
- mysql->result->field_alloc= mysql->field_alloc;
- mysql->result->current_field=0;
- mysql->result->current_row=0;
+ thd->mysql->field_count= field_count;
DBUG_RETURN(prepare_for_send(list));
err:
@@ -424,21 +589,60 @@ bool Protocol::send_records_num(List<Item> *list, ulonglong records)
bool Protocol::write()
{
+ if (!thd->mysql) // bootstrap file handling
+ return false;
+
*next_field= 0;
return false;
}
+bool Protocol_prep::write()
+{
+ MYSQL_ROWS *cur;
+ MYSQL_DATA *data= thd->data;
+
+ if (!data)
+ {
+ if (!(data= (MYSQL_DATA*) my_malloc(sizeof(MYSQL_DATA),
+ MYF(MY_WME | MY_ZEROFILL))))
+ return true;
+
+ alloc= &data->alloc;
+ init_alloc_root(alloc,8192,0); /* Assume rowlength < 8192 */
+ alloc->min_malloc=sizeof(MYSQL_ROWS);
+ data->rows=0;
+ data->fields=field_count;
+ data->prev_ptr= &data->data;
+ thd->data= data;
+ }
+
+ data->rows++;
+ if (!(cur= (MYSQL_ROWS *)alloc_root(alloc, sizeof(MYSQL_ROWS)+packet->length())))
+ {
+ my_error(ER_OUT_OF_RESOURCES,MYF(0));
+ return true;
+ }
+ cur->data= (MYSQL_ROW)(((char *)cur) + sizeof(MYSQL_ROWS));
+ memcpy(cur->data, packet->ptr()+1, packet->length()-1);
+
+ *data->prev_ptr= cur;
+ data->prev_ptr= &cur->next;
+ cur->next= 0;
+
+ return false;
+}
+
void
send_ok(THD *thd,ha_rows affected_rows,ulonglong id,const char *message)
{
DBUG_ENTER("send_ok");
MYSQL *mysql= current_thd->mysql;
+ if (!mysql) // bootstrap file handling
+ DBUG_VOID_RETURN;
mysql->affected_rows= affected_rows;
mysql->insert_id= id;
if (message)
- {
strmake(thd->net.last_error, message, sizeof(thd->net.last_error)-1);
- }
DBUG_VOID_RETURN;
}
@@ -449,13 +653,27 @@ send_eof(THD *thd, bool no_flush)
void Protocol_simple::prepare_for_resend()
{
- MYSQL_ROWS *cur;
- MYSQL_DATA *result= thd->mysql->result->data;
+ MYSQL_ROWS *cur;
+ MYSQL_DATA *data= thd->data;
DBUG_ENTER("send_data");
- alloc= &result->alloc;
- result->rows++;
+ if (!data)
+ {
+ if (!(data= (MYSQL_DATA*) my_malloc(sizeof(MYSQL_DATA),
+ MYF(MY_WME | MY_ZEROFILL))))
+ goto err;
+
+ alloc= &data->alloc;
+ init_alloc_root(alloc,8192,0); /* Assume rowlength < 8192 */
+ alloc->min_malloc=sizeof(MYSQL_ROWS);
+ data->rows=0;
+ data->fields=field_count;
+ data->prev_ptr= &data->data;
+ thd->data= data;
+ }
+
+ data->rows++;
if (!(cur= (MYSQL_ROWS *)alloc_root(alloc, sizeof(MYSQL_ROWS)+(field_count + 1) * sizeof(char *))))
{
my_error(ER_OUT_OF_RESOURCES,MYF(0));
@@ -463,11 +681,11 @@ void Protocol_simple::prepare_for_resend()
}
cur->data= (MYSQL_ROW)(((char *)cur) + sizeof(MYSQL_ROWS));
- *result->prev_ptr= cur;
- result->prev_ptr= &cur->next;
+ *data->prev_ptr= cur;
+ data->prev_ptr= &cur->next;
next_field=cur->data;
- next_mysql_field= thd->mysql->result->fields;
-
+ next_mysql_field= thd->mysql->fields;
+err:
DBUG_VOID_RETURN;
}
@@ -480,15 +698,20 @@ bool Protocol_simple::store_null()
bool Protocol::net_store_data(const char *from, uint length)
{
- if (!(*next_field=alloc_root(alloc, length + 1)))
+ char *field_buf;
+ if (!thd->mysql) // bootstrap file handling
+ return false;
+
+ if (!(field_buf=alloc_root(alloc, length + sizeof(uint) + 1)))
return true;
+ *(uint *)field_buf= length;
+ *next_field= field_buf + sizeof(uint);
memcpy(*next_field, from, length);
(*next_field)[length]= 0;
if (next_mysql_field->max_length < length)
next_mysql_field->max_length=length;
++next_field;
++next_mysql_field;
-
return false;
}
@@ -509,3 +732,91 @@ bool Protocol::convert_str(const char *from, uint length)
return false;
}
#endif
+
+bool setup_params_data(st_prep_stmt *stmt)
+{
+ THD *thd= stmt->thd;
+ List<Item> &params= thd->lex.param_list;
+ List_iterator<Item> param_iterator(params);
+ Item_param *param;
+ ulong param_no= 0;
+ MYSQL_BIND *client_param= thd->client_params;
+
+ DBUG_ENTER("setup_params_data");
+
+ for (;(param= (Item_param *)param_iterator++); client_param++)
+ {
+ setup_param_functions(param, client_param->buffer_type);
+ if (!param->long_data_supplied)
+ {
+ if (*client_param->is_null)
+ param->maybe_null= param->null_value= 1;
+ else
+ {
+ uchar *buff= (uchar*)client_param->buffer;
+ param->maybe_null= param->null_value= 0;
+ param->setup_param_func(param,&buff,
+ client_param->length ?
+ *client_param->length :
+ client_param->buffer_length);
+ }
+ }
+ param_no++;
+ }
+ DBUG_RETURN(0);
+}
+
+bool setup_params_data_withlog(st_prep_stmt *stmt)
+{
+ THD *thd= stmt->thd;
+ List<Item> &params= thd->lex.param_list;
+ List_iterator<Item> param_iterator(params);
+ Item_param *param;
+ MYSQL_BIND *client_param= thd->client_params;
+
+ DBUG_ENTER("setup_params_data");
+
+ String str, *res, *query= new String(stmt->query->alloced_length());
+ query->copy(*stmt->query);
+
+ ulong param_no= 0;
+ uint32 length= 0;
+
+ for (;(param= (Item_param *)param_iterator++); client_param++)
+ {
+ setup_param_functions(param, client_param->buffer_type);
+ if (param->long_data_supplied)
+ res= param->query_val_str(&str);
+
+ else
+ {
+ if (*client_param->is_null)
+ {
+ param->maybe_null= param->null_value= 1;
+ res= &my_null_string;
+ }
+ else
+ {
+ uchar *buff= (uchar*)client_param->buffer;
+ param->maybe_null= param->null_value= 0;
+ param->setup_param_func(param,&buff,
+ client_param->length ?
+ *client_param->length :
+ client_param->buffer_length);
+ res= param->query_val_str(&str);
+ }
+ }
+ if (query->replace(param->pos_in_query+length, 1, *res))
+ DBUG_RETURN(1);
+
+ length+= res->length()-1;
+ param_no++;
+ }
+
+ if (alloc_query(stmt->thd, (char *)query->ptr(), query->length()+1))
+ DBUG_RETURN(1);
+
+ query->free();
+ DBUG_RETURN(0);
+}
+
diff --git a/libmysqld/libmysqld.c b/libmysqld/libmysqld.c
index 357c13c5826..59c18368279 100644
--- a/libmysqld/libmysqld.c
+++ b/libmysqld/libmysqld.c
@@ -24,6 +24,7 @@
#include <sys/stat.h>
#include <signal.h>
#include <time.h>
+#include "client_settings.h"
#ifdef HAVE_PWD_H
#include <pwd.h>
#endif
@@ -46,8 +47,6 @@
#define INADDR_NONE -1
#endif
-#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_TRANSACTIONS | CLIENT_PROTOCOL_41)
-
#if defined(MSDOS) || defined(__WIN__)
#define ERRNO WSAGetLastError()
#define perror(A)
@@ -58,22 +57,6 @@
#define closesocket(A) close(A)
#endif
-void free_old_query(MYSQL *mysql);
-my_bool
-emb_advanced_command(MYSQL *mysql, enum enum_server_command command,
- const char *header, ulong header_length,
- const char *arg, ulong arg_length, my_bool skip_check);
-
-/* From client.c */
-void mysql_read_default_options(struct st_mysql_options *options,
- const char *filename,const char *group);
-MYSQL * STDCALL
-cli_mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
- const char *passwd, const char *db,
- uint port, const char *unix_socket,ulong client_flag);
-
-void STDCALL cli_mysql_close(MYSQL *mysql);
-
#ifdef HAVE_GETPWUID
struct passwd *getpwuid(uid_t);
char* getlogin(void);
@@ -163,58 +146,35 @@ static inline int mysql_init_charset(MYSQL *mysql)
return 0;
}
-/**************************************************************************
- Get column lengths of the current row
- If one uses mysql_use_result, res->lengths contains the length information,
- else the lengths are calculated from the offset between pointers.
-**************************************************************************/
-
-static void emb_fetch_lengths(ulong *to, MYSQL_ROW column, uint field_count)
-{
- MYSQL_ROW end;
-
- for (end=column + field_count; column != end ; column++,to++)
- {
- *to= *column ? strlen(*column) : 0;
- }
-}
-
-
-/*
-** Note that the mysql argument must be initialized with mysql_init()
-** before calling mysql_real_connect !
-*/
-
-static my_bool STDCALL emb_mysql_read_query_result(MYSQL *mysql);
-static MYSQL_RES * STDCALL emb_mysql_store_result(MYSQL *mysql);
-static MYSQL_RES * STDCALL emb_mysql_use_result(MYSQL *mysql);
-
-static MYSQL_METHODS embedded_methods=
-{
- emb_mysql_read_query_result,
- emb_advanced_command,
- emb_mysql_store_result,
- emb_mysql_use_result,
- emb_fetch_lengths
-};
+int check_embedded_connection(MYSQL *mysql);
MYSQL * STDCALL
mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
const char *passwd, const char *db,
uint port, const char *unix_socket,ulong client_flag)
{
- char *db_name;
+ char *db_name;
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ char name_buff[USERNAME_LENGTH];
+#endif
DBUG_ENTER("mysql_real_connect");
DBUG_PRINT("enter",("host: %s db: %s user: %s",
host ? host : "(Null)",
db ? db : "(Null)",
user ? user : "(Null)"));
- if (mysql->options.methods_to_use == MYSQL_OPT_USE_REMOTE_CONNECTION)
- cli_mysql_real_connect(mysql, host, user,
- passwd, db, port, unix_socket, client_flag);
- if ((mysql->options.methods_to_use == MYSQL_OPT_GUESS_CONNECTION) &&
- host && strcmp(host,LOCAL_HOST))
+#if defined(EMBEDDED_LIBRARY) || !defined(DBUG_OFF)
+ if (!server_inited)
+ {
+ mysql->net.last_errno=CR_MYSQL_SERVER_INIT_MISSED;
+ strmov(mysql->net.last_error,ER(mysql->net.last_errno));
+ goto error;
+ }
+#endif
+
+ if (mysql->options.methods_to_use == MYSQL_OPT_USE_REMOTE_CONNECTION ||
+ (mysql->options.methods_to_use == MYSQL_OPT_GUESS_CONNECTION &&
+ host && strcmp(host,LOCAL_HOST)))
cli_mysql_real_connect(mysql, host, user,
passwd, db, port, unix_socket, client_flag);
@@ -235,6 +195,29 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
if (!db || !db[0])
db=mysql->options.db;
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ if (!user || !user[0])
+ user=mysql->options.user;
+
+ if (!passwd)
+ {
+ passwd=mysql->options.password;
+#if !defined(DONT_USE_MYSQL_PWD)
+ if (!passwd)
+ passwd=getenv("MYSQL_PWD"); /* get it from environment */
+#endif
+ }
+ if (!user || !user[0])
+ {
+ read_user_name(name_buff);
+ if (!name_buff[0])
+ user= name_buff;
+ }
+
+ mysql->user=my_strdup(user,MYF(0));
+ mysql->passwd= passwd ? my_strdup(passwd,MYF(0)) : NULL;
+#endif /*!NO_EMBEDDED_ACCESS_CHECKS*/
+
port=0;
unix_socket=0;
db_name = db ? my_strdup(db,MYF(MY_WME)) : NULL;
@@ -243,6 +226,11 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
init_embedded_mysql(mysql, client_flag, db_name);
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ if (check_embedded_connection(mysql))
+ goto error;
+#endif
+
if (mysql_init_charset(mysql))
goto error;
@@ -266,7 +254,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
goto error;
if (mysql->fields)
{
- if (!(res= mysql_use_result(mysql)))
+ if (!(res= (*mysql->methods->use_result)(mysql)))
goto error;
mysql_free_result(res);
}
@@ -277,7 +265,8 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
DBUG_RETURN(mysql);
error:
- DBUG_PRINT("error",("message: %u (%s)",mysql->net.last_errno,mysql->net.last_error));
+ DBUG_PRINT("error",("message: %u (%s)", mysql->net.last_errno,
+ mysql->net.last_error));
{
/* Free alloced memory */
my_bool free_me=mysql->free_me;
@@ -289,105 +278,3 @@ error:
DBUG_RETURN(0);
}
-/*************************************************************************
-** Send a QUIT to the server and close the connection
-** If handle is alloced by mysql connect free it.
-*************************************************************************/
-
-void STDCALL mysql_close(MYSQL *mysql)
-{
- DBUG_ENTER("mysql_close");
- if (mysql->methods != &embedded_methods)
- {
- cli_mysql_close(mysql);
- DBUG_VOID_RETURN;
- }
-
- if (mysql) /* Some simple safety */
- {
- my_free(mysql->options.user,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.host,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.password,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.unix_socket,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.db,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.my_cnf_file,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.my_cnf_group,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.charset_dir,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.charset_name,MYF(MY_ALLOW_ZERO_PTR));
- if (mysql->options.init_commands)
- {
- DYNAMIC_ARRAY *init_commands= mysql->options.init_commands;
- char **ptr= (char**)init_commands->buffer;
- char **end= ptr + init_commands->elements;
- for (; ptr<end; ptr++)
- my_free(*ptr,MYF(MY_WME));
- delete_dynamic(init_commands);
- my_free((char*)init_commands,MYF(MY_WME));
- }
- /* Clear pointers for better safety */
- bzero((char*) &mysql->options,sizeof(mysql->options));
-#ifdef HAVE_OPENSSL
- ((VioConnectorFd*)(mysql->connector_fd))->delete();
- mysql->connector_fd = 0;
-#endif /* HAVE_OPENSSL */
- if (mysql->free_me)
- my_free((gptr) mysql,MYF(0));
- }
- DBUG_VOID_RETURN;
-}
-
-static my_bool STDCALL emb_mysql_read_query_result(MYSQL *mysql)
-{
- if (mysql->net.last_errno)
- return -1;
-
- if (mysql->field_count)
- {
- mysql->status=MYSQL_STATUS_GET_RESULT;
- mysql->affected_rows= mysql->result->row_count= mysql->result->data->rows;
- mysql->result->data_cursor= mysql->result->data->data;
- }
-
- return 0;
-}
-
-/**************************************************************************
-** Alloc result struct for buffered results. All rows are read to buffer.
-** mysql_data_seek may be used.
-**************************************************************************/
-static MYSQL_RES * STDCALL emb_mysql_store_result(MYSQL *mysql)
-{
- MYSQL_RES *result= mysql->result;
- if (!result)
- return 0;
-
- result->methods= mysql->methods;
- mysql->result= NULL;
- *result->data->prev_ptr= 0;
- result->eof= 1;
- result->lengths= (ulong*)(result + 1);
- mysql->affected_rows= result->row_count= result->data->rows;
- result->data_cursor= result->data->data;
-
- mysql->status=MYSQL_STATUS_READY; /* server is ready */
- return result;
-}
-
-/**************************************************************************
-** Alloc struct for use with unbuffered reads. Data is fetched by domand
-** when calling to mysql_fetch_row.
-** mysql_data_seek is a noop.
-**
-** No other queries may be specified with the same MYSQL handle.
-** There shouldn't be much processing per row because mysql server shouldn't
-** have to wait for the client (and will not wait more than 30 sec/packet).
-**************************************************************************/
-
-static MYSQL_RES * STDCALL emb_mysql_use_result(MYSQL *mysql)
-{
- DBUG_ENTER("mysql_use_result");
- if (mysql->options.separate_thread)
- DBUG_RETURN(0);
-
- DBUG_RETURN(emb_mysql_store_result(mysql));
-}
diff --git a/myisam/ft_dump.c b/myisam/ft_dump.c
index 57ae67c7a02..183068789fe 100644
--- a/myisam/ft_dump.c
+++ b/myisam/ft_dump.c
@@ -130,7 +130,11 @@ int main(int argc,char *argv[])
if (subkeys >= 0)
weight=*(float*)&subkeys;
+#ifdef HAVE_SNPRINTF
snprintf(buf,MAX_LEN,"%.*s",(int) keylen,info->lastkey+1);
+#else
+ sprintf(buf,"%.*s",(int) keylen,info->lastkey+1);
+#endif
my_casedn_str(default_charset_info,buf);
total++;
lengths[keylen]++;
diff --git a/myisam/ft_nlq_search.c b/myisam/ft_nlq_search.c
index b1d7d67ae79..690ad0fc453 100644
--- a/myisam/ft_nlq_search.c
+++ b/myisam/ft_nlq_search.c
@@ -68,6 +68,7 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
uint keylen, r, doc_cnt;
FT_SUPERDOC sdoc, *sptr;
TREE_ELEMENT *selem;
+ double gweight=1;
MI_INFO *info=aio->info;
uchar *keybuff=aio->keybuff;
MI_KEYDEF *keyinfo=info->s->keyinfo+aio->keynr;
@@ -89,7 +90,7 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
r=_mi_search(info, keyinfo, keybuff, keylen, SEARCH_FIND, key_root);
info->update|= HA_STATE_AKTIV; /* for _mi_test_if_changed() */
- while (!r)
+ while (!r && gweight)
{
if (keylen &&
@@ -138,6 +139,10 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
doc_cnt++;
+ gweight=word->weight*GWS_IN_USE;
+ if (gweight < 0 || doc_cnt > 2000000)
+ gweight=0;
+
if (_mi_test_if_changed(info) == 0)
r=_mi_search_next(info, keyinfo, info->lastkey, info->lastkey_length,
SEARCH_BIGGER, key_root);
@@ -145,13 +150,8 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
r=_mi_search(info, keyinfo, info->lastkey, info->lastkey_length,
SEARCH_BIGGER, key_root);
}
- if (doc_cnt)
- {
- word->weight*=GWS_IN_USE;
- if (word->weight < 0)
- word->weight=0;
+ word->weight=gweight;
- }
DBUG_RETURN(0);
}
diff --git a/myisam/mi_check.c b/myisam/mi_check.c
index 16fe5567d72..629bb397f39 100644
--- a/myisam/mi_check.c
+++ b/myisam/mi_check.c
@@ -36,7 +36,7 @@
/* Functions defined in this file */
static int check_k_link(MI_CHECK *param, MI_INFO *info,uint nr);
-static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
+static int chk_index(MI_CHECK *param, MI_INFO *info,MI_KEYDEF *keyinfo,
my_off_t page, uchar *buff, ha_rows *keys,
ha_checksum *key_checksum, uint level);
static uint isam_key_length(MI_INFO *info,MI_KEYDEF *keyinfo);
@@ -1504,6 +1504,7 @@ int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name)
File new_file;
my_off_t index_pos[MI_MAX_POSSIBLE_KEY];
uint r_locks,w_locks;
+ int old_lock;
MYISAM_SHARE *share=info->s;
MI_STATE_INFO old_state;
DBUG_ENTER("sort_index");
@@ -1547,8 +1548,11 @@ int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name)
flush_key_blocks(*share->keycache,share->kfile, FLUSH_IGNORE_CHANGED);
share->state.version=(ulong) time((time_t*) 0);
- old_state=share->state; /* save state if not stored */
- r_locks=share->r_locks; w_locks=share->w_locks;
+ old_state= share->state; /* save state if not stored */
+ r_locks= share->r_locks;
+ w_locks= share->w_locks;
+ old_lock= info->lock_type;
+
/* Put same locks as old file */
share->r_locks= share->w_locks= share->tot_locks= 0;
(void) _mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE);
@@ -1559,12 +1563,13 @@ int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name)
MYF(0)) ||
mi_open_keyfile(share))
goto err2;
- info->lock_type=F_UNLCK; /* Force mi_readinfo to lock */
+ info->lock_type= F_UNLCK; /* Force mi_readinfo to lock */
_mi_readinfo(info,F_WRLCK,0); /* Will lock the table */
- info->lock_type=F_WRLCK;
- share->r_locks=r_locks; share->w_locks=w_locks;
+ info->lock_type= old_lock;
+ share->r_locks= r_locks;
+ share->w_locks= w_locks;
share->tot_locks= r_locks+w_locks;
- share->state=old_state; /* Restore old state */
+ share->state= old_state; /* Restore old state */
info->state->key_file_length=param->new_file_pos;
info->update= (short) (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
@@ -3825,6 +3830,9 @@ void update_key_parts(MI_KEYDEF *keyinfo, ulong *rec_per_key_part,
tmp=records;
else
tmp= (records + (count+1)/2) / (count+1);
+ /* for some weird keys (e.g. FULLTEXT) tmp can be <1 here.
+ let's ensure it is not */
+ set_if_bigger(tmp,1);
if (tmp >= (ulonglong) ~(ulong) 0)
tmp=(ulonglong) ~(ulong) 0;
*rec_per_key_part=(ulong) tmp;
diff --git a/myisam/mi_checksum.c b/myisam/mi_checksum.c
index a760b03a032..cdbb634c5ff 100644
--- a/myisam/mi_checksum.c
+++ b/myisam/mi_checksum.c
@@ -28,30 +28,29 @@ ha_checksum mi_checksum(MI_INFO *info, const byte *buf)
{
const byte *pos;
const byte *end;
+ ulong length;
switch (rec->type) {
case FIELD_BLOB:
{
- ulong length=_mi_calc_blob_length(rec->length-
+ length=_mi_calc_blob_length(rec->length-
mi_portable_sizeof_char_ptr,
buf);
memcpy((char*) &pos, buf+rec->length- mi_portable_sizeof_char_ptr,
sizeof(char*));
- end=pos+length;
break;
}
case FIELD_VARCHAR:
{
- uint length;
length=uint2korr(buf);
- pos=buf+2; end=pos+length;
+ pos=buf+2;
break;
}
default:
- pos=buf; end=buf+rec->length;
+ length=rec->length;
+ pos=buf;
break;
}
- for ( ; pos != end ; pos++)
- crc=((crc << 8) + *((uchar*) pos)) + (crc >> (8*sizeof(ha_checksum)-8));
+ crc=my_checksum(crc, pos ? pos : "", length);
}
return crc;
}
@@ -59,9 +58,5 @@ ha_checksum mi_checksum(MI_INFO *info, const byte *buf)
ha_checksum mi_static_checksum(MI_INFO *info, const byte *pos)
{
- ha_checksum crc;
- const byte *end=pos+info->s->base.reclength;
- for (crc=0; pos != end; pos++)
- crc=((crc << 8) + *((uchar*) pos)) + (crc >> (8*sizeof(ha_checksum)-8));
- return crc;
+ return my_checksum(0, pos, info->s->base.reclength);
}
diff --git a/myisam/mi_create.c b/myisam/mi_create.c
index 26bb23c3a7f..0982e5bdaf6 100644
--- a/myisam/mi_create.c
+++ b/myisam/mi_create.c
@@ -303,7 +303,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
keydef->seg[0].type == (int) HA_KEYTYPE_NUM)
keydef->seg[0].flag&= ~HA_SPACE_PACK;
- /* Only use HA_PACK_KEY if the first segment is a variable length key */
+ /* Only use HA_PACK_KEY when first segment is a variable length key */
if (!(keydef->seg[0].flag & (HA_SPACE_PACK | HA_BLOB_PART |
HA_VAR_LENGTH)))
{
diff --git a/myisam/mi_dynrec.c b/myisam/mi_dynrec.c
index faf86c3ffbd..86d648a5af0 100644
--- a/myisam/mi_dynrec.c
+++ b/myisam/mi_dynrec.c
@@ -17,6 +17,7 @@
/* Functions to handle space-packed-records and blobs */
#include "myisamdef.h"
+#include <assert.h>
/* Enough for comparing if number is zero */
static char zero_string[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
@@ -58,11 +59,11 @@ int _mi_write_blob_record(MI_INFO *info, const byte *record)
{
byte *rec_buff;
int error;
- ulong reclength,extra;
+ ulong reclength,reclength2,extra;
extra= (ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER)+MI_SPLIT_LENGTH+
MI_DYN_DELETE_BLOCK_HEADER+1);
- reclength= (info->s->base.pack_reclength + info->s->base.pack_bits +
+ reclength= (info->s->base.pack_reclength +
_my_calc_total_blob_length(info,record)+ extra);
#ifdef NOT_USED /* We now support big rows */
if (reclength > MI_DYN_MAX_ROW_LENGTH)
@@ -76,10 +77,13 @@ int _mi_write_blob_record(MI_INFO *info, const byte *record)
my_errno=ENOMEM;
return(-1);
}
- reclength=_mi_rec_pack(info,rec_buff+ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER),
- record);
+ reclength2= _mi_rec_pack(info,rec_buff+ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER),
+ record);
+ DBUG_PRINT("info",("reclength: %lu reclength2: %lu",
+ reclength, reclength2));
+ DBUG_ASSERT(reclength2 <= reclength);
error=write_dynamic_record(info,rec_buff+ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER),
- reclength);
+ reclength2);
my_afree(rec_buff);
return(error);
}
diff --git a/myisam/mi_locking.c b/myisam/mi_locking.c
index af0c760b706..785979235ce 100644
--- a/myisam/mi_locking.c
+++ b/myisam/mi_locking.c
@@ -36,6 +36,7 @@ int mi_lock_database(MI_INFO *info, int lock_type)
uint flag;
uint switch_fl= 0;
DBUG_ENTER("mi_lock_database");
+ DBUG_PRINT("info",("lock_type: %d", lock_type));
if (share->options & HA_OPTION_READ_ONLY_DATA ||
info->lock_type == lock_type)
@@ -54,6 +55,7 @@ int mi_lock_database(MI_INFO *info, int lock_type)
{
switch (lock_type) {
case F_UNLCK:
+ DBUG_PRINT("info", ("old lock: %d", info->lock_type));
if (info->lock_type == F_RDLCK)
count= --share->r_locks;
else
@@ -84,6 +86,8 @@ int mi_lock_database(MI_INFO *info, int lock_type)
}
if (!count)
{
+ DBUG_PRINT("info",("changed: %u w_locks: %u",
+ (uint) share->changed, share->w_locks));
if (share->changed && !share->w_locks)
{
share->state.process= share->last_process=share->this_process;
@@ -116,19 +120,22 @@ int mi_lock_database(MI_INFO *info, int lock_type)
if (error)
mi_mark_crashed(info);
}
- if (share->r_locks)
- { /* Only read locks left */
- flag=1;
- if (my_lock(share->kfile,F_RDLCK,0L,F_TO_EOF,
- MYF(MY_WME | MY_SEEK_NOT_DONE)) && !error)
- error=my_errno;
- }
- else if (!share->w_locks)
- { /* No more locks */
- flag=1;
- if (my_lock(share->kfile,F_UNLCK,0L,F_TO_EOF,
- MYF(MY_WME | MY_SEEK_NOT_DONE)) && !error)
- error=my_errno;
+ if (info->lock_type != F_EXTRA_LCK)
+ {
+ if (share->r_locks)
+ { /* Only read locks left */
+ flag=1;
+ if (my_lock(share->kfile,F_RDLCK,0L,F_TO_EOF,
+ MYF(MY_WME | MY_SEEK_NOT_DONE)) && !error)
+ error=my_errno;
+ }
+ else if (!share->w_locks)
+ { /* No more locks */
+ flag=1;
+ if (my_lock(share->kfile,F_UNLCK,0L,F_TO_EOF,
+ MYF(MY_WME | MY_SEEK_NOT_DONE)) && !error)
+ error=my_errno;
+ }
}
}
info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
@@ -357,6 +364,8 @@ int _mi_writeinfo(register MI_INFO *info, uint operation)
int error,olderror;
MYISAM_SHARE *share=info->s;
DBUG_ENTER("_mi_writeinfo");
+ DBUG_PRINT("info",("operation: %u tot_locks: %u", operation,
+ share->tot_locks));
error=0;
if (share->tot_locks == 0)
@@ -384,9 +393,7 @@ int _mi_writeinfo(register MI_INFO *info, uint operation)
my_errno=olderror;
}
else if (operation)
- {
share->changed= 1; /* Mark keyfile changed */
- }
DBUG_RETURN(error);
} /* _mi_writeinfo */
diff --git a/myisam/mi_open.c b/myisam/mi_open.c
index 5d8f384a5af..c4b24acdb77 100644
--- a/myisam/mi_open.c
+++ b/myisam/mi_open.c
@@ -633,7 +633,7 @@ byte *mi_alloc_rec_buff(MI_INFO *info, ulong length, byte **buf)
/* to simplify initial init of info->rec_buf in mi_open and mi_extra */
if (length == (ulong) -1)
{
- length= max(info->s->base.pack_reclength+info->s->base.pack_bits,
+ length= max(info->s->base.pack_reclength,
info->s->base.max_key_length);
/* Avoid unnecessary realloc */
if (newptr && length == old_length)
@@ -688,6 +688,8 @@ void mi_setup_functions(register MYISAM_SHARE *share)
share->compare_unique=_mi_cmp_dynamic_unique;
share->calc_checksum= mi_checksum;
+ /* add bits used to pack data to pack_reclength for faster allocation */
+ share->base.pack_reclength+= share->base.pack_bits;
if (share->base.blobs)
{
share->update_record=_mi_update_blob_record;
@@ -776,6 +778,7 @@ uint mi_state_info_write(File file, MI_STATE_INFO *state, uint pWrite)
uchar *ptr=buff;
uint i, keys= (uint) state->header.keys,
key_blocks=state->header.max_block_size;
+ DBUG_ENTER("mi_state_info_write");
memcpy_fixed(ptr,&state->header,sizeof(state->header));
ptr+=sizeof(state->header);
@@ -826,10 +829,10 @@ uint mi_state_info_write(File file, MI_STATE_INFO *state, uint pWrite)
}
if (pWrite & 1)
- return my_pwrite(file,(char*) buff, (uint) (ptr-buff), 0L,
- MYF(MY_NABP | MY_THREADSAFE));
- else
- return my_write(file, (char*) buff, (uint) (ptr-buff), MYF(MY_NABP));
+ DBUG_RETURN(my_pwrite(file,(char*) buff, (uint) (ptr-buff), 0L,
+ MYF(MY_NABP | MY_THREADSAFE)));
+ DBUG_RETURN(my_write(file, (char*) buff, (uint) (ptr-buff),
+ MYF(MY_NABP)));
}
diff --git a/myisam/mi_packrec.c b/myisam/mi_packrec.c
index 66cfd169026..1bd39aa900b 100644
--- a/myisam/mi_packrec.c
+++ b/myisam/mi_packrec.c
@@ -165,7 +165,9 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys)
diff_length=(int) rec_reflength - (int) share->base.rec_reflength;
if (fix_keys)
share->rec_reflength=rec_reflength;
- share->base.min_block_length=share->min_pack_length+share->pack.ref_length;
+ share->base.min_block_length=share->min_pack_length+1;
+ if (share->min_pack_length > 254)
+ share->base.min_block_length+=2;
if (!(share->decode_trees=(MI_DECODE_TREE*)
my_malloc((uint) (trees*sizeof(MI_DECODE_TREE)+
@@ -741,6 +743,12 @@ static void uf_blob(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff,
{
ulong length=get_bits(bit_buff,rec->space_length_bits);
uint pack_length=(uint) (end-to)-mi_portable_sizeof_char_ptr;
+ if (bit_buff->blob_pos+length > bit_buff->end)
+ {
+ bit_buff->error=1;
+ bzero((byte*) to,(end-to));
+ return;
+ }
decode_bytes(rec,bit_buff,bit_buff->blob_pos,bit_buff->blob_pos+length);
_my_store_blob_length((byte*) to,pack_length,length);
memcpy_fixed((char*) to+pack_length,(char*) &bit_buff->blob_pos,
diff --git a/myisam/mi_search.c b/myisam/mi_search.c
index c2168d97cfe..2871633102d 100644
--- a/myisam/mi_search.c
+++ b/myisam/mi_search.c
@@ -810,9 +810,10 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
register uchar **page_pos, register uchar *key)
{
reg1 HA_KEYSEG *keyseg;
- uchar *start_key,*page=*page_pos,*page_end,*from,*from_end;
+ uchar *start_key,*page,*page_end,*from,*from_end;
uint length,tmp;
+ page= *page_pos;
page_end=page+MI_MAX_KEY_BUFF+1;
start_key=key;
@@ -868,7 +869,9 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
length-=tmp;
from=page; from_end=page_end;
}
- memcpy((byte*) key,(byte*) from,(size_t) length);
+ DBUG_PRINT("info",("key: %lx from: %lx length: %u",
+ key, from, length));
+ memcpy_overlap((byte*) key, (byte*) from, (size_t) length);
key+=length;
from+=length;
}
@@ -1590,6 +1593,9 @@ _mi_calc_bin_pack_key_length(MI_KEYDEF *keyinfo,uint nod_flag,uchar *next_key,
uint length,key_length,ref_length;
s_temp->totlength=key_length=_mi_keylength(keyinfo,key)+nod_flag;
+#ifdef HAVE_purify
+ s_temp->n_length= s_temp->n_ref_length=0; /* For valgrind */
+#endif
s_temp->key=key;
s_temp->prev_key=org_key;
if (prev_key) /* If not first key in block */
diff --git a/myisam/mi_test_all.sh b/myisam/mi_test_all.sh
index a2d57ea1a83..07e71d65675 100755
--- a/myisam/mi_test_all.sh
+++ b/myisam/mi_test_all.sh
@@ -3,7 +3,9 @@
# Execute some simple basic test on MyISAM libary to check if things
# works at all.
+valgrind="valgrind --alignment=8 --leak-check=yes"
silent="-s"
+
if test -f mi_test1$MACH ; then suffix=$MACH else suffix=""; fi
mi_test1$suffix $silent
myisamchk$suffix -se test1
diff --git a/myisam/mi_update.c b/myisam/mi_update.c
index 53c09a1d35c..d1d41ac351a 100644
--- a/myisam/mi_update.c
+++ b/myisam/mi_update.c
@@ -96,7 +96,14 @@ int mi_update(register MI_INFO *info, const byte *oldrec, byte *newrec)
if (_mi_ft_cmp(info,i,oldrec, newrec))
{
if ((int) i == info->lastinx)
+ {
+ /*
+ We are changeing the index we are reading on. Mark that
+ the index data has changed and we need to do a full search
+ when doing read-next
+ */
key_changed|=HA_STATE_WRITTEN;
+ }
changed|=((ulonglong) 1 << i);
if (_mi_ft_update(info,i,(char*) old_key,oldrec,newrec,pos))
goto err;
@@ -123,25 +130,36 @@ int mi_update(register MI_INFO *info, const byte *oldrec, byte *newrec)
}
/*
If we are running with external locking, we must update the index file
- that something has changed
+ that something has changed.
*/
if (changed || !my_disable_locking)
- key_changed|= HA_STATE_KEY_CHANGED;
+ key_changed|= HA_STATE_CHANGED;
if (share->calc_checksum)
{
info->checksum=(*share->calc_checksum)(info,newrec);
- key_changed|= HA_STATE_KEY_CHANGED; /* Must update index file */
+ /* Store new checksum in index file header */
+ key_changed|= HA_STATE_CHANGED;
}
{
- /* Don't update index file if data file is not extended */
+ /*
+ Don't update index file if data file is not extended and no status
+ information changed
+ */
MI_STATUS_INFO state;
+ ha_rows org_split;
+ my_off_t org_delete_link;
+
memcpy((char*) &state, (char*) info->state, sizeof(state));
+ org_split= share->state.split;
+ org_delete_link= share->state.dellink;
if ((*share->update_record)(info,pos,newrec))
goto err;
if (!key_changed &&
- memcmp((char*) &state, (char*) info->state, sizeof(state)))
- key_changed|= HA_STATE_KEY_CHANGED; /* Must update index file */
+ (memcmp((char*) &state, (char*) info->state, sizeof(state)) ||
+ org_split != share->state.split ||
+ org_delete_link != share->state.dellink))
+ key_changed|= HA_STATE_CHANGED; /* Must update index file */
}
if (auto_key_changed)
update_auto_increment(info,newrec);
@@ -165,7 +183,7 @@ err:
DBUG_PRINT("error",("key: %d errno: %d",i,my_errno));
save_errno=my_errno;
if (changed)
- key_changed|= HA_STATE_KEY_CHANGED;
+ key_changed|= HA_STATE_CHANGED;
if (my_errno == HA_ERR_FOUND_DUPP_KEY || my_errno == HA_ERR_RECORD_FILE_FULL)
{
info->errkey= (int) i;
diff --git a/myisam/mi_write.c b/myisam/mi_write.c
index 8c08d6f179e..1fd5cddec62 100644
--- a/myisam/mi_write.c
+++ b/myisam/mi_write.c
@@ -931,4 +931,3 @@ void mi_end_bulk_insert(MI_INFO *info)
info->bulk_insert=0;
}
}
-
diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c
index 63d61af774b..5fa36841ec7 100644
--- a/myisam/myisamchk.c
+++ b/myisam/myisamchk.c
@@ -811,15 +811,18 @@ static int myisamchk(MI_CHECK *param, my_string filename)
!(param->testflag & T_CHECK_ONLY_CHANGED))))
need_to_check=1;
- if ((param->testflag & T_STATISTICS) &&
- (share->state.changed & STATE_NOT_ANALYZED))
- need_to_check=1;
- if ((param->testflag & T_SORT_INDEX) &&
- (share->state.changed & STATE_NOT_SORTED_PAGES))
- need_to_check=1;
- if ((param->testflag & T_REP_BY_SORT) &&
- (share->state.changed & STATE_NOT_OPTIMIZED_KEYS))
- need_to_check=1;
+ if (info->s->base.keys && info->state->records)
+ {
+ if ((param->testflag & T_STATISTICS) &&
+ (share->state.changed & STATE_NOT_ANALYZED))
+ need_to_check=1;
+ if ((param->testflag & T_SORT_INDEX) &&
+ (share->state.changed & STATE_NOT_SORTED_PAGES))
+ need_to_check=1;
+ if ((param->testflag & T_REP_BY_SORT) &&
+ (share->state.changed & STATE_NOT_OPTIMIZED_KEYS))
+ need_to_check=1;
+ }
if ((param->testflag & T_CHECK_ONLY_CHANGED) &&
(share->state.changed & (STATE_CHANGED | STATE_CRASHED |
STATE_CRASHED_ON_REPAIR)))
@@ -899,6 +902,11 @@ static int myisamchk(MI_CHECK *param, my_string filename)
param->error_printed=0;
goto end2;
}
+ /*
+ _mi_readinfo() has locked the table.
+ We mark the table as locked (without doing file locks) to be able to
+ use functions that only works on locked tables (like row caching).
+ */
mi_lock_database(info, F_EXTRA_LCK);
datafile=info->dfile;
@@ -1418,23 +1426,24 @@ static int mi_sort_records(MI_CHECK *param,
if (!(((ulonglong) 1 << sort_key) & share->state.key_map))
{
- mi_check_print_error(param,"Can't sort table '%s' on key %d; No such key",
+ mi_check_print_warning(param,
+ "Can't sort table '%s' on key %d; No such key",
name,sort_key+1);
param->error_printed=0;
- DBUG_RETURN(-1);
+ DBUG_RETURN(0); /* Nothing to do */
}
if (keyinfo->flag & HA_FULLTEXT)
{
- mi_check_print_error(param,"Can't sort table '%s' on FULLTEXT key %d",
- name,sort_key+1);
+ mi_check_print_warning(param,"Can't sort table '%s' on FULLTEXT key %d",
+ name,sort_key+1);
param->error_printed=0;
- DBUG_RETURN(-1);
+ DBUG_RETURN(0); /* Nothing to do */
}
if (share->data_file_type == COMPRESSED_RECORD)
{
- mi_check_print_error(param,"Can't sort read-only table '%s'", name);
+ mi_check_print_warning(param,"Can't sort read-only table '%s'", name);
param->error_printed=0;
- DBUG_RETURN(-1);
+ DBUG_RETURN(0); /* Nothing to do */
}
if (!(param->testflag & T_SILENT))
{
diff --git a/myisam/myisamlog.c b/myisam/myisamlog.c
index 5bca25dd439..9b987364521 100644
--- a/myisam/myisamlog.c
+++ b/myisam/myisamlog.c
@@ -415,8 +415,16 @@ static int examine_log(my_string file_name, char **table_names)
VOID(tree_walk(&tree,(tree_walk_action) test_if_open,(void*) &open_param,
left_root_right));
file_info.id=open_param.max_id+1;
+ /*
+ * In the line below +10 is added to accomodate '<' and '>' chars
+ * plus '\0' at the end, so that there is place for 7 digits.
+ * It is improbable that same table can have that many entries in
+ * the table cache.
+ * The additional space is needed for the sprintf commands two lines
+ * below.
+ */
file_info.show_name=my_memdup(isam_file_name,
- (uint) strlen(isam_file_name)+6,
+ (uint) strlen(isam_file_name)+10,
MYF(MY_WME));
if (file_info.id > 1)
sprintf(strend(file_info.show_name),"<%d>",file_info.id);
diff --git a/myisam/myisampack.c b/myisam/myisampack.c
index 21b73ce244d..5ca57248204 100644
--- a/myisam/myisampack.c
+++ b/myisam/myisampack.c
@@ -243,7 +243,7 @@ static struct my_option my_long_options[] =
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"force", 'f',
- "Force packing of table even if it gets bigger or if tempfile exists.",
+ "Force packing of table even if it gets bigger or if tempfile exists.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"join", 'j',
"Join all given tables into 'new_table_name'. All tables MUST have identical layouts.",
diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am
index fb97dd5b1de..2babb6fba66 100644
--- a/mysql-test/Makefile.am
+++ b/mysql-test/Makefile.am
@@ -21,8 +21,9 @@ benchdir_root= $(prefix)
testdir = $(benchdir_root)/mysql-test
EXTRA_SCRIPTS = mysql-test-run.sh install_test_db.sh
EXTRA_DIST = $(EXTRA_SCRIPTS)
-test_SCRIPTS = mysql-test-run install_test_db
-CLEANFILES = $(test_SCRIPTS)
+test_SCRIPTS = mysql-test-run install_test_db
+test_DATA = std_data/client-key.pem std_data/client-cert.pem std_data/cacert.pem
+CLEANFILES = $(test_SCRIPTS) $(test_DATA)
dist-hook:
mkdir -p $(distdir)/t $(distdir)/r $(distdir)/include \
@@ -32,6 +33,8 @@ dist-hook:
$(INSTALL_DATA) $(srcdir)/r/*.result $(srcdir)/r/*.require $(distdir)/r
$(INSTALL_DATA) $(srcdir)/std_data/*.dat $(srcdir)/std_data/*.000001 $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(distdir)/std_data
+ $(INSTALL_DATA) $(srcdir)/std_data/*.pem $(distdir)/std_data
+
install-data-local:
$(mkinstalldirs) \
@@ -49,6 +52,11 @@ install-data-local:
$(INSTALL_DATA) $(srcdir)/include/*.inc $(DESTDIR)$(testdir)/include
$(INSTALL_DATA) $(srcdir)/std_data/*.dat $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(DESTDIR)$(testdir)/std_data
+ $(INSTALL_DATA) $(srcdir)/std_data/*.pem $(DESTDIR)$(testdir)/std_data
+
+std_data/%.pem:
+ @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data
+
SUFFIXES = .sh
diff --git a/mysql-test/include/check_var_limit.inc b/mysql-test/include/check_var_limit.inc
new file mode 100644
index 00000000000..f955aeb345e
--- /dev/null
+++ b/mysql-test/include/check_var_limit.inc
@@ -0,0 +1,9 @@
+#
+# Check that second part of $LIMIT is between $MIN_LIMIT and $MAX_LIMIT
+# This is useful to check that a variable from SHOW_VARIABLES is within
+# certain limits. Check query_cache_merge.test for an example of using this.
+#
+-- require r/check_var_limit.require
+disable_query_log;
+eval select SUBSTRING_INDEX("$LIMIT", "\\t", -1) BETWEEN $MIN_LIMIT AND $MAX_LIMIT as "limit";
+enable_query_log;
diff --git a/mysql-test/include/have_openssl_2.inc b/mysql-test/include/have_openssl_2.inc
deleted file mode 100644
index 9671ce29573..00000000000
--- a/mysql-test/include/have_openssl_2.inc
+++ /dev/null
@@ -1,4 +0,0 @@
--- require r/have_openssl_2.require
-disable_query_log;
-SHOW STATUS LIKE "Ssl_cipher";
-enable_query_log;
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index f11cad4a13e..0f45b8af1b0 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -16,6 +16,9 @@ USE_MANAGER=0
MY_TZ=GMT-3
TZ=$MY_TZ; export TZ # for UNIX_TIMESTAMP tests to work
+# For query_cache test
+ulimit -n 1024
+
#++
# Program Definitions
#--
@@ -253,12 +256,6 @@ while test $# -gt 0; do
--start-and-exit)
START_AND_EXIT=1
;;
- --skip-innodb)
- EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-innodb"
- EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-innodb" ;;
- --skip-bdb)
- EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-bdb"
- EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-bdb" ;;
--skip-rpl) NO_SLAVE=1 ;;
--skip-test=*) SKIP_TEST=`$ECHO "$1" | $SED -e "s;--skip-test=;;"`;;
--do-test=*) DO_TEST=`$ECHO "$1" | $SED -e "s;--do-test=;;"`;;
@@ -431,6 +428,11 @@ if [ x$SOURCE_DIST = x1 ] ; then
else
MYSQL_TEST="$BASEDIR/client/mysqltest"
fi
+ if [ -f "$BASEDIR/client/.libs/mysqldump" ] ; then
+ MYSQL_DUMP="$BASEDIR/client/.libs/mysqldump --no-defaults -uroot --socket=$MASTER_MYSOCK"
+ else
+ MYSQL_DUMP="$BASEDIR/client/mysqldump --no-defaults -uroot --socket=$MASTER_MYSOCK"
+ fi
if [ -n "$STRACE_CLIENT" ]; then
MYSQL_TEST="strace -o $MYSQL_TEST_DIR/var/log/mysqltest.strace $MYSQL_TEST"
fi
@@ -452,6 +454,7 @@ else
MYSQLD="$VALGRIND $BASEDIR/bin/mysqld"
fi
MYSQL_TEST="$BASEDIR/bin/mysqltest"
+ MYSQL_DUMP="$BASEDIR/bin/mysqldump --no-defaults -uroot --socket=$MASTER_MYSOCK"
MYSQLADMIN="$BASEDIR/bin/mysqladmin"
WAIT_PID="$BASEDIR/bin/mysql_waitpid"
MYSQL_MANAGER="$BASEDIR/bin/mysqlmanager"
@@ -469,6 +472,8 @@ else
fi
fi
+export MYSQL_DUMP
+
if [ -z "$MASTER_MYSQLD" ]
then
MASTER_MYSQLD=$MYSQLD
@@ -835,7 +840,6 @@ start_master()
/bin/sh $master_init_script
fi
cd $BASEDIR # for gcov
- #start master
if [ -z "$DO_BENCH" ]
then
master_args="--no-defaults --log-bin=$MYSQL_TEST_DIR/var/log/master-bin \
@@ -854,6 +858,7 @@ start_master()
--tmpdir=$MYSQL_TMP_DIR \
--language=$LANGUAGE \
--innodb_data_file_path=ibdata1:50M \
+ --open-files-limit=1024 \
$MASTER_40_ARGS \
$SMALL_SERVER \
$EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT"
@@ -1372,6 +1377,9 @@ fi
$ECHO "Starting Tests"
+#
+# This can probably be deleted
+#
if [ "$DO_BENCH" = 1 ]
then
BENCHDIR=$BASEDIR/sql-bench/
diff --git a/mysql-test/r/bdb.result b/mysql-test/r/bdb.result
index fd2f7b7e49b..f619775aa97 100644
--- a/mysql-test/r/bdb.result
+++ b/mysql-test/r/bdb.result
@@ -1114,3 +1114,34 @@ a b
select * from t2;
a b
drop table t1,t2;
+create table t1 (x int not null, index(x)) type=bdb;
+insert into t1 values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+select * from t1 where x <= 10 and x >= 7;
+x
+7
+8
+9
+10
+select * from t1 where x <= 10 and x >= 7 order by x;
+x
+7
+8
+9
+10
+select * from t1 where x <= 10 and x >= 7 order by x desc;
+x
+10
+9
+8
+7
+select * from t1 where x <= 8 and x >= 5 order by x desc;
+x
+8
+7
+6
+5
+select * from t1 where x < 8 and x > 5 order by x desc;
+x
+7
+6
+drop table t1;
diff --git a/mysql-test/r/check_var_limit.require b/mysql-test/r/check_var_limit.require
new file mode 100644
index 00000000000..01a59782180
--- /dev/null
+++ b/mysql-test/r/check_var_limit.require
@@ -0,0 +1,2 @@
+limit
+1
diff --git a/mysql-test/r/connect.result b/mysql-test/r/connect.result
index 9c848c3434f..c0608af0de2 100644
--- a/mysql-test/r/connect.result
+++ b/mysql-test/r/connect.result
@@ -30,6 +30,7 @@ show tables;
Tables_in_test
update mysql.user set password=old_password("gambling2") where user="test";
flush privileges;
+set password=old_password('gambling3');
show tables;
Tables_in_mysql
columns_priv
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index b51836f39e0..06ddd5e2280 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -312,3 +312,65 @@ SET SESSION table_type=default;
drop table t1;
create table t1 select x'4132';
drop table t1;
+create table t1(a int,b int,c int unsigned,d date,e char,f datetime,g time,h blob);
+insert into t1(a)values(1);
+insert into t1(a,b,c,d,e,f,g,h)
+values(2,-2,2,'1825-12-14','a','2003-1-1 3:2:1','4:3:2','binary data');
+select * from t1;
+a b c d e f g h
+1 NULL NULL NULL NULL NULL NULL NULL
+2 -2 2 1825-12-14 a 2003-01-01 03:02:01 04:03:02 binary data
+select a,
+ifnull(b,cast(-7 as signed)) as b,
+ifnull(c,cast(7 as unsigned)) as c,
+ifnull(d,cast('2000-01-01' as date)) as d,
+ifnull(e,cast('b' as char)) as e,
+ifnull(f,cast('2000-01-01' as datetime)) as f,
+ifnull(g,cast('5:4:3' as time)) as g,
+ifnull(h,cast('yet another binary data' as binary)) as h,
+addtime(cast('1:0:0' as time),cast('1:0:0' as time)) as dd
+from t1;
+a b c d e f g h dd
+1 -7 7 2000-01-01 b 2000-01-01 00:00:00 05:04:03 yet another binary data 02:00:00
+2 -2 2 1825-12-14 a 2003-01-01 03:02:01 04:03:02 binary data 02:00:00
+create table t2
+select
+a,
+ifnull(b,cast(-7 as signed)) as b,
+ifnull(c,cast(7 as unsigned)) as c,
+ifnull(d,cast('2000-01-01' as date)) as d,
+ifnull(e,cast('b' as char)) as e,
+ifnull(f,cast('2000-01-01' as datetime)) as f,
+ifnull(g,cast('5:4:3' as time)) as g,
+ifnull(h,cast('yet another binary data' as binary)) as h,
+addtime(cast('1:0:0' as time),cast('1:0:0' as time)) as dd
+from t1;
+explain t2;
+Field Type Null Key Default Extra
+a int(11) YES NULL
+b bigint(11) 0
+c bigint(10) 0
+d date 0000-00-00
+e char(1)
+f datetime 0000-00-00 00:00:00
+g time 00:00:00
+h mediumblob
+dd time 00:00:00
+select * from t2;
+a b c d e f g h dd
+1 -7 7 2000-01-01 b 2000-01-01 00:00:00 05:04:03 yet another binary data 02:00:00
+2 -2 2 1825-12-14 a 2003-01-01 03:02:01 04:03:02 binary data 02:00:00
+drop table t1, t2;
+drop database if exists test_$1;
+create database test_$1;
+use test_$1;
+select database();
+database()
+test_$1
+drop database test_$1;
+select database();
+database()
+NULL
+select database();
+database()
+NULL
diff --git a/mysql-test/r/ctype_many.result b/mysql-test/r/ctype_many.result
index a1a1bd75db6..ebc84db7115 100644
--- a/mysql-test/r/ctype_many.result
+++ b/mysql-test/r/ctype_many.result
@@ -1433,7 +1433,7 @@ CYR CAPIT EM Ðœ Ðœ í Ðœ
CYR CAPIT EN Ð Ð î Ð
CYR CAPIT O О О ï О
CYR CAPIT PE П П ð П
-CYR CAPIT ER Р Р ò
+CYR CAPIT ER Р Р ò Р
CYR CAPIT ES С С ó С
CYR CAPIT TE Т Т ô Т
CYR CAPIT U У У õ У
@@ -1574,7 +1574,7 @@ CYR CAPIT EM í Ðœ í 
CYR CAPIT EN î Ð î 
CYR CAPIT O ï О ï 
CYR CAPIT PE ð П ð 
-CYR CAPIT ER ò Р ò 
+CYR CAPIT ER ò Р ò 
CYR CAPIT ES ó С ó !
CYR CAPIT TE ô Т ô "
CYR CAPIT U õ У õ #
diff --git a/mysql-test/r/ctype_mb.result b/mysql-test/r/ctype_mb.result
index 4b3b464dea1..298e774186d 100644
--- a/mysql-test/r/ctype_mb.result
+++ b/mysql-test/r/ctype_mb.result
@@ -19,3 +19,34 @@ SELECT * FROM t1;
c1 c2 c3
aaaabbbbcccc aaaabbbbcccc aaaabbbbcccc
DROP TABLE t1;
+CREATE TABLE t1 (a CHAR(4) CHARACTER SET utf8, KEY key_a(a(3)));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(4) character set utf8 default NULL,
+ KEY `key_a` (`a`(3))
+) TYPE=MyISAM CHARSET=latin1
+SHOW KEYS FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 1 key_a 1 a A NULL 9 NULL YES BTREE
+ALTER TABLE t1 CHANGE a a CHAR(4);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(4) default NULL,
+ KEY `key_a` (`a`(3))
+) TYPE=MyISAM CHARSET=latin1
+SHOW KEYS FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 1 key_a 1 a A NULL 3 NULL YES BTREE
+ALTER TABLE t1 CHANGE a a CHAR(4) CHARACTER SET utf8;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(4) character set utf8 default NULL,
+ KEY `key_a` (`a`(3))
+) TYPE=MyISAM CHARSET=latin1
+SHOW KEYS FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 1 key_a 1 a A NULL 9 NULL YES BTREE
+DROP TABLE t1;
diff --git a/mysql-test/r/ctype_recoding.result b/mysql-test/r/ctype_recoding.result
index 624eab4cf0b..5a53c1db2e1 100644
--- a/mysql-test/r/ctype_recoding.result
+++ b/mysql-test/r/ctype_recoding.result
@@ -16,16 +16,16 @@ EFF0EEE1E0
DROP TABLE t1;
CREATE TABLE ÔÁÂÌÉÃÁ
(
-ÐÏÌÅ CHAR(32) CHARACTER SET koi8r NOT NULL
-);
+ÐÏÌÅ CHAR(32) CHARACTER SET koi8r NOT NULL COMMENT "ËÏÍÍÅÎÔÁÒÉÊ ÐÏÌÑ"
+) COMMENT "ËÏÍÍÅÎÔÁÒÉÊ ÔÁÂÌÉÃÙ";
SHOW TABLES;
Tables_in_test
ÔÁÂÌÉÃÁ
SHOW CREATE TABLE ÔÁÂÌÉÃÁ;
Table Create Table
ÔÁÂÌÉÃÁ CREATE TABLE `ÔÁÂÌÉÃÁ` (
- `ÐÏÌÅ` char(32) character set koi8r NOT NULL default ''
-) TYPE=MyISAM CHARSET=latin1
+ `ÐÏÌÅ` char(32) character set koi8r NOT NULL default '' COMMENT 'ËÏÍÍÅÎÔÁÒÉÊ ÐÏÌÑ'
+) TYPE=MyISAM CHARSET=latin1 COMMENT='ËÏÍÍÅÎÔÁÒÉÊ ÔÁÂÌÉÃÙ'
SHOW FIELDS FROM ÔÁÂÌÉÃÁ;
Field Type Null Key Default Extra
ÐÏÌÅ char(32)
@@ -36,8 +36,8 @@ Tables_in_test
SHOW CREATE TABLE òàáëèöà;
Table Create Table
òàáëèöà CREATE TABLE `òàáëèöà` (
- `ïîëå` char(32) character set koi8r NOT NULL default ''
-) TYPE=MyISAM CHARSET=latin1
+ `ïîëå` char(32) character set koi8r NOT NULL default '' COMMENT 'êîììåíòàðèé ïîëÿ'
+) TYPE=MyISAM CHARSET=latin1 COMMENT='êîììåíòàðèé òàáëèöû'
SHOW FIELDS FROM òàáëèöà;
Field Type Null Key Default Extra
ïîëå char(32)
@@ -48,8 +48,8 @@ Tables_in_test
SHOW CREATE TABLE таблица;
Table Create Table
таблица CREATE TABLE `таблица` (
- `поле` char(32) character set koi8r NOT NULL default ''
-) TYPE=MyISAM CHARSET=latin1
+ `поле` char(32) character set koi8r NOT NULL default '' COMMENT 'комментарий полÑ'
+) TYPE=MyISAM CHARSET=latin1 COMMENT='комментарий таблицы'
SHOW FIELDS FROM таблица;
Field Type Null Key Default Extra
поле char(32)
@@ -70,3 +70,11 @@ SHOW TABLES IN òåñò;
Tables_in_òåñò
SET CHARACTER SET koi8r;
DROP DATABASE ÔÅÓÔ;
+SET NAMES koi8r;
+SELECT hex('ÔÅÓÔ');
+hex('ÔÅÓÔ')
+D4C5D3D4
+SET character_set_connection=cp1251;
+SELECT hex('ÔÅÓÔ');
+hex('ÔÅÓÔ')
+F2E5F1F2
diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result
new file mode 100644
index 00000000000..db626c8acb1
--- /dev/null
+++ b/mysql-test/r/ctype_ucs.result
@@ -0,0 +1,272 @@
+DROP TABLE IF EXISTS t1;
+SET CHARACTER SET koi8r;
+CREATE TABLE t1 (word VARCHAR(64) CHARACTER SET ucs2);
+INSERT INTO t1 VALUES (_koi8r'ò'), (X'2004');
+SELECT hex(word) FROM t1 ORDER BY word;
+hex(word)
+0420
+2004
+DELETE FROM t1;
+INSERT INTO t1 VALUES (X'042000200020'), (X'200400200020');
+SELECT hex(word) FROM t1 ORDER BY word;
+hex(word)
+0420
+2004
+DROP TABLE t1;
+SELECT LPAD(_ucs2 X'0420',10,_ucs2 X'0421');
+LPAD(_ucs2 X'0420',10,_ucs2 X'0421')
+óóóóóóóóóò
+SELECT LPAD(_ucs2 X'0420',10,_ucs2 X'04210422');
+LPAD(_ucs2 X'0420',10,_ucs2 X'04210422')
+óôóôóôóôóò
+SELECT LPAD(_ucs2 X'0420',10,_ucs2 X'042104220423');
+LPAD(_ucs2 X'0420',10,_ucs2 X'042104220423')
+óôõóôõóôõò
+SELECT LPAD(_ucs2 X'0420042104220423042404250426042704280429042A042B',10,_ucs2 X'042104220423');
+LPAD(_ucs2 X'0420042104220423042404250426042704280429042A042B',10,_ucs2 X'042104220423')
+òóôõæèãþûý
+SELECT RPAD(_ucs2 X'0420',10,_ucs2 X'0421');
+RPAD(_ucs2 X'0420',10,_ucs2 X'0421')
+òóóóóóóóóó
+SELECT RPAD(_ucs2 X'0420',10,_ucs2 X'04210422');
+RPAD(_ucs2 X'0420',10,_ucs2 X'04210422')
+òóôóôóôóôó
+SELECT RPAD(_ucs2 X'0420',10,_ucs2 X'042104220423');
+RPAD(_ucs2 X'0420',10,_ucs2 X'042104220423')
+òóôõóôõóôõ
+SELECT RPAD(_ucs2 X'0420042104220423042404250426042704280429042A042B',10,_ucs2 X'042104220423');
+RPAD(_ucs2 X'0420042104220423042404250426042704280429042A042B',10,_ucs2 X'042104220423')
+òóôõæèãþûý
+CREATE TABLE t1 SELECT
+LPAD(_ucs2 X'0420',10,_ucs2 X'0421') l,
+RPAD(_ucs2 X'0420',10,_ucs2 X'0421') r;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `l` char(10) character set ucs2 NOT NULL default '',
+ `r` char(10) character set ucs2 NOT NULL default ''
+) TYPE=MyISAM CHARSET=latin1
+DROP TABLE t1;
+SET NAMES koi8r;
+SET character_set_connection=ucs2;
+create table t1 (a varchar(10) character set ucs2, key(a));
+insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test");
+explain select * from t1 where a like 'abc%';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 21 NULL 1 Using where; Using index
+explain select * from t1 where a like concat('abc','%');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 21 NULL 1 Using where; Using index
+select * from t1 where a like "abc%";
+a
+abc
+abcd
+select * from t1 where a like concat("abc","%");
+a
+abc
+abcd
+select * from t1 where a like "ABC%";
+a
+abc
+abcd
+select * from t1 where a like "test%";
+a
+test
+select * from t1 where a like "te_t";
+a
+test
+select * from t1 where a like "%a%";
+a
+select * from t1 where a like "%abcd%";
+a
+abcd
+select * from t1 where a like "%abc\d%";
+a
+abcd
+drop table t1;
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ucs2);
+INSERT INTO t1 VALUES ('ÆÙ×Á'),('æÙ×Á'),('Æù×Á'),('ÆÙ÷Á'),('ÆÙ×á'),('æù÷á');
+INSERT INTO t1 VALUES ('ÆÙ×ÁÐÒÏÌÄÖ'),('æÙ×ÁÐÒÏÌÄÖ'),('Æù×ÁÐÒÏÌÄÖ'),('ÆÙ÷ÁÐÒÏÌÄÖ');
+INSERT INTO t1 VALUES ('ÆÙ×áÐÒÏÌÄÖ'),('ÆÙ×ÁðÒÏÌÄÖ'),('ÆÙ×ÁÐòÏÌÄÖ'),('ÆÙ×ÁÐÒïÌÄÖ');
+INSERT INTO t1 VALUES ('ÆÙ×ÁÐÒÏìÄÖ'),('ÆÙ×ÁÐÒÏÌäÖ'),('ÆÙ×ÁÐÒÏÌÄö'),('æù÷áðòïìäö');
+SELECT * FROM t1 WHERE a LIKE '%Æù×Á%';
+a
+ÆÙ×Á
+æÙ×Á
+Æù×Á
+ÆÙ÷Á
+ÆÙ×á
+æù÷á
+ÆÙ×ÁÐÒÏÌÄÖ
+æÙ×ÁÐÒÏÌÄÖ
+Æù×ÁÐÒÏÌÄÖ
+ÆÙ÷ÁÐÒÏÌÄÖ
+ÆÙ×áÐÒÏÌÄÖ
+ÆÙ×ÁðÒÏÌÄÖ
+ÆÙ×ÁÐòÏÌÄÖ
+ÆÙ×ÁÐÒïÌÄÖ
+ÆÙ×ÁÐÒÏìÄÖ
+ÆÙ×ÁÐÒÏÌäÖ
+ÆÙ×ÁÐÒÏÌÄö
+æù÷áðòïìäö
+SELECT * FROM t1 WHERE a LIKE '%Æù×%';
+a
+ÆÙ×Á
+æÙ×Á
+Æù×Á
+ÆÙ÷Á
+ÆÙ×á
+æù÷á
+ÆÙ×ÁÐÒÏÌÄÖ
+æÙ×ÁÐÒÏÌÄÖ
+Æù×ÁÐÒÏÌÄÖ
+ÆÙ÷ÁÐÒÏÌÄÖ
+ÆÙ×áÐÒÏÌÄÖ
+ÆÙ×ÁðÒÏÌÄÖ
+ÆÙ×ÁÐòÏÌÄÖ
+ÆÙ×ÁÐÒïÌÄÖ
+ÆÙ×ÁÐÒÏìÄÖ
+ÆÙ×ÁÐÒÏÌäÖ
+ÆÙ×ÁÐÒÏÌÄö
+æù÷áðòïìäö
+SELECT * FROM t1 WHERE a LIKE 'Æù×Á%';
+a
+ÆÙ×Á
+æÙ×Á
+Æù×Á
+ÆÙ÷Á
+ÆÙ×á
+æù÷á
+ÆÙ×ÁÐÒÏÌÄÖ
+æÙ×ÁÐÒÏÌÄÖ
+Æù×ÁÐÒÏÌÄÖ
+ÆÙ÷ÁÐÒÏÌÄÖ
+ÆÙ×áÐÒÏÌÄÖ
+ÆÙ×ÁðÒÏÌÄÖ
+ÆÙ×ÁÐòÏÌÄÖ
+ÆÙ×ÁÐÒïÌÄÖ
+ÆÙ×ÁÐÒÏìÄÖ
+ÆÙ×ÁÐÒÏÌäÖ
+ÆÙ×ÁÐÒÏÌÄö
+æù÷áðòïìäö
+SELECT * FROM t1 WHERE a LIKE 'Æù×Á%' COLLATE ucs2_bin;
+a
+Æù×Á
+Æù×ÁÐÒÏÌÄÖ
+DROP TABLE t1;
+CREATE TABLE t1 (word varchar(64) NOT NULL, PRIMARY KEY (word))
+TYPE=MyISAM CHARACTER SET ucs2 COLLATE ucs2_general_ci;
+INSERT INTO t1 (word) VALUES ("cat");
+SELECT * FROM t1 WHERE word LIKE "c%";
+word
+cat
+SELECT * FROM t1 WHERE word LIKE "ca_";
+word
+cat
+SELECT * FROM t1 WHERE word LIKE "cat";
+word
+cat
+SELECT * FROM t1 WHERE word LIKE _ucs2 x'00630025';
+word
+cat
+SELECT * FROM t1 WHERE word LIKE _ucs2 x'00630061005F';
+word
+cat
+DROP TABLE t1;
+SET NAMES latin1;
+CREATE TABLE t1 (
+word VARCHAR(64),
+bar INT(11) default 0,
+PRIMARY KEY (word))
+TYPE=MyISAM
+CHARSET ucs2
+COLLATE ucs2_general_ci ;
+INSERT INTO t1 (word) VALUES ("aar");
+INSERT INTO t1 (word) VALUES ("a");
+INSERT INTO t1 (word) VALUES ("aardvar");
+INSERT INTO t1 (word) VALUES ("aardvark");
+INSERT INTO t1 (word) VALUES ("aardvara");
+INSERT INTO t1 (word) VALUES ("aardvarz");
+EXPLAIN SELECT * FROM t1 ORDER BY word;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort
+SELECT * FROM t1 ORDER BY word;
+word bar
+a 0
+aar 0
+aardvar 0
+aardvara 0
+aardvark 0
+aardvarz 0
+EXPLAIN SELECT word FROM t1 ORDER BY word;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 128 NULL 6 Using index
+SELECT word FROM t1 ORDER by word;
+word
+a
+aar
+aardvar
+aardvara
+aardvark
+aardvarz
+DROP TABLE t1;
+CREATE TABLE t1 (
+word VARCHAR(64) ,
+PRIMARY KEY (word))
+TYPE=MyISAM
+CHARSET ucs2
+COLLATE ucs2_general_ci;
+INSERT INTO t1 (word) VALUES ("aar");
+INSERT INTO t1 (word) VALUES ("a");
+INSERT INTO t1 (word) VALUES ("aardvar");
+INSERT INTO t1 (word) VALUES ("aardvark");
+INSERT INTO t1 (word) VALUES ("aardvara");
+INSERT INTO t1 (word) VALUES ("aardvarz");
+EXPLAIN SELECT * FROM t1 ORDER BY WORD;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 128 NULL 6 Using index
+SELECT * FROM t1 ORDER BY word;
+word
+a
+aar
+aardvar
+aardvara
+aardvark
+aardvarz
+DROP TABLE t1;
+CREATE TABLE t1 (
+word TEXT,
+bar INT(11) AUTO_INCREMENT,
+PRIMARY KEY (bar))
+TYPE=MyISAM
+CHARSET ucs2
+COLLATE ucs2_general_ci ;
+INSERT INTO t1 (word) VALUES ("aar");
+INSERT INTO t1 (word) VALUES ("a" );
+INSERT INTO t1 (word) VALUES ("aardvar");
+INSERT INTO t1 (word) VALUES ("aardvark");
+INSERT INTO t1 (word) VALUES ("aardvara");
+INSERT INTO t1 (word) VALUES ("aardvarz");
+EXPLAIN SELECT * FROM t1 ORDER BY word;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort
+SELECT * FROM t1 ORDER BY word;
+word bar
+a 2
+aar 1
+aardvar 3
+aardvara 5
+aardvark 4
+aardvarz 6
+EXPLAIN SELECT word FROM t1 ORDER BY word;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort
+SELECT word FROM t1 ORDER BY word;
+word
+a
+aar
+aardvar
+aardvara
+aardvark
+aardvarz
+DROP TABLE t1;
diff --git a/mysql-test/r/ctype_ujis.result b/mysql-test/r/ctype_ujis.result
index ffb305a81cf..1730b17eaed 100644
--- a/mysql-test/r/ctype_ujis.result
+++ b/mysql-test/r/ctype_ujis.result
@@ -1,4 +1,5 @@
drop table if exists t1;
+set names ujis;
create table t1 (c text character set ujis);
insert into t1 values (0xa4a2),(0xa4a3);
select hex(left(c,1)) from t1 group by c;
@@ -6,3 +7,60 @@ hex(left(c,1))
A4A2
A4A3
drop table t1;
+select locate(0xa2a1,0xa1a2a1a3);
+locate(0xa2a1,0xa1a2a1a3)
+2
+select locate(_ujis 0xa2a1,_ujis 0xa1a2a1a3);
+locate(_ujis 0xa2a1,_ujis 0xa1a2a1a3)
+0
+select locate(_ujis 0xa2a1,_ujis 0xa1a2a1a3 collate ujis_bin);
+locate(_ujis 0xa2a1,_ujis 0xa1a2a1a3 collate ujis_bin)
+0
+select locate('he','hello');
+locate('he','hello')
+1
+select locate('he','hello',2);
+locate('he','hello',2)
+0
+select locate('lo','hello',2);
+locate('lo','hello',2)
+4
+select locate('HE','hello');
+locate('HE','hello')
+1
+select locate('HE','hello',2);
+locate('HE','hello',2)
+0
+select locate('LO','hello',2);
+locate('LO','hello',2)
+4
+select locate('HE','hello' collate ujis_bin);
+locate('HE','hello' collate ujis_bin)
+0
+select locate('HE','hello' collate ujis_bin,2);
+locate('HE','hello' collate ujis_bin,2)
+0
+select locate('LO','hello' collate ujis_bin,2);
+locate('LO','hello' collate ujis_bin,2)
+0
+select locate(_ujis 0xa1a3,_ujis 0xa1a2a1a3);
+locate(_ujis 0xa1a3,_ujis 0xa1a2a1a3)
+2
+select 0xa1a2a1a3 like concat(_binary'%',0xa2a1,_binary'%');
+0xa1a2a1a3 like concat(_binary'%',0xa2a1,_binary'%')
+1
+select _ujis 0xa1a2a1a3 like concat(_ujis'%',_ujis 0xa2a1, _ujis'%');
+_ujis 0xa1a2a1a3 like concat(_ujis'%',_ujis 0xa2a1, _ujis'%')
+0
+select _ujis 0xa1a2a1a3 like concat(_ujis'%',_ujis 0xa2a1, _ujis'%') collate ujis_bin;
+_ujis 0xa1a2a1a3 like concat(_ujis'%',_ujis 0xa2a1, _ujis'%') collate ujis_bin
+0
+select 'a' like 'a';
+'a' like 'a'
+1
+select 'A' like 'a';
+'A' like 'a'
+1
+select 'A' like 'a' collate ujis_bin;
+'A' like 'a' collate ujis_bin
+0
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
new file mode 100644
index 00000000000..1f07de17b14
--- /dev/null
+++ b/mysql-test/r/ctype_utf8.result
@@ -0,0 +1,61 @@
+set names utf8;
+select left(_utf8 0xD0B0D0B1D0B2,1);
+left(_utf8 0xD0B0D0B1D0B2,1)
+а
+select right(_utf8 0xD0B0D0B2D0B2,1);
+right(_utf8 0xD0B0D0B2D0B2,1)
+в
+select locate('he','hello');
+locate('he','hello')
+1
+select locate('he','hello',2);
+locate('he','hello',2)
+0
+select locate('lo','hello',2);
+locate('lo','hello',2)
+4
+select locate('HE','hello');
+locate('HE','hello')
+1
+select locate('HE','hello',2);
+locate('HE','hello',2)
+0
+select locate('LO','hello',2);
+locate('LO','hello',2)
+4
+select locate('HE','hello' collate utf8_bin);
+locate('HE','hello' collate utf8_bin)
+0
+select locate('HE','hello' collate utf8_bin,2);
+locate('HE','hello' collate utf8_bin,2)
+0
+select locate('LO','hello' collate utf8_bin,2);
+locate('LO','hello' collate utf8_bin,2)
+0
+select locate(_utf8 0xD0B1, _utf8 0xD0B0D0B1D0B2);
+locate(_utf8 0xD0B1, _utf8 0xD0B0D0B1D0B2)
+2
+select locate(_utf8 0xD091, _utf8 0xD0B0D0B1D0B2);
+locate(_utf8 0xD091, _utf8 0xD0B0D0B1D0B2)
+2
+select locate(_utf8 0xD0B1, _utf8 0xD0B0D091D0B2);
+locate(_utf8 0xD0B1, _utf8 0xD0B0D091D0B2)
+2
+select locate(_utf8 0xD091, _utf8 0xD0B0D0B1D0B2 collate utf8_bin);
+locate(_utf8 0xD091, _utf8 0xD0B0D0B1D0B2 collate utf8_bin)
+0
+select locate(_utf8 0xD0B1, _utf8 0xD0B0D091D0B2 collate utf8_bin);
+locate(_utf8 0xD0B1, _utf8 0xD0B0D091D0B2 collate utf8_bin)
+0
+select 'a' like 'a';
+'a' like 'a'
+1
+select 'A' like 'a';
+'A' like 'a'
+1
+select 'A' like 'a' collate utf8_bin;
+'A' like 'a' collate utf8_bin
+0
+select _utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD0B1,_utf8 '%');
+_utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD0B1,_utf8 '%')
+1
diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result
index f9e52174469..6932e0d5476 100644
--- a/mysql-test/r/derived.result
+++ b/mysql-test/r/derived.result
@@ -196,3 +196,13 @@ drop table t1,t2;
SELECT a.x FROM (SELECT 1 AS x) AS a HAVING a.x = 1;
x
1
+create table a1 select 1 as a;
+select 2 as a from (select * from a1) b;
+ERROR 3D000: No Database Selected
+use test;
+select 2 as a from (select * from a1) b;
+a
+2
+drop table a1;
+select mail_id, if(folder.f_description!='', folder.f_description, folder.f_name) as folder_name, date, address_id, phrase, address, subject from folder, (select mail.mail_id as mail_id, date_format(mail.h_date, '%b %e, %Y %h:%i') as date, mail.folder_id, sender.address_id as address_id, sender.phrase as phrase, sender.address as address, mail.h_subject as subject from mail left join mxa as mxa_sender on mail.mail_id=mxa_sender.mail_id and mxa_sender.type='from' left join address as sender on mxa_sender.address_id=sender.address_id mxa as mxa_recipient, address as recipient, where 1 and mail.mail_id=mxa_recipient.mail_id and mxa_recipient.address_id=recipient.address_id and mxa_recipient.type='to' and match(sender.phrase, sender.address, sender.comment) against ('jeremy' in boolean mode) and match(recipient.phrase, recipient.address, recipient.comment) against ('monty' in boolean mode) order by mail.h_date desc limit 0, 25 ) as query where query.folder_id=folder.folder_id;
+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 'mxa as mxa_recipient, address as recipient, where 1 and mail.mail_id=mxa_r' at line 1
diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result
index c7ce157a670..5e713f59100 100644
--- a/mysql-test/r/distinct.result
+++ b/mysql-test/r/distinct.result
@@ -427,3 +427,40 @@ name
a
e
drop table t1;
+CREATE TABLE t1 (
+ID int(11) NOT NULL auto_increment,
+NAME varchar(75) DEFAULT '' NOT NULL,
+LINK_ID int(11) DEFAULT '0' NOT NULL,
+PRIMARY KEY (ID),
+KEY NAME (NAME),
+KEY LINK_ID (LINK_ID)
+);
+INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (1,'Mike',0);
+INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (2,'Jack',0);
+INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (3,'Bill',0);
+CREATE TABLE t2 (
+ID int(11) NOT NULL auto_increment,
+NAME varchar(150) DEFAULT '' NOT NULL,
+PRIMARY KEY (ID),
+KEY NAME (NAME)
+);
+SELECT DISTINCT
+t2.id AS key_link_id,
+t2.name AS link
+FROM t1
+LEFT JOIN t2 ON t1.link_id=t2.id
+GROUP BY t1.id
+ORDER BY link;
+key_link_id link
+NULL NULL
+drop table t1,t2;
+CREATE TABLE t1 (
+html varchar(5) default NULL,
+rin int(11) default '0',
+out int(11) default '0'
+) TYPE=MyISAM;
+INSERT INTO t1 VALUES ('1',1,0);
+SELECT DISTINCT html,SUM(out)/(SUM(rin)+1) as 'prod' FROM t1 GROUP BY rin;
+html prod
+1 0.00
+drop table t1;
diff --git a/mysql-test/r/drop.result b/mysql-test/r/drop.result
index 367b28e9bf7..3748af1b8f9 100644
--- a/mysql-test/r/drop.result
+++ b/mysql-test/r/drop.result
@@ -44,3 +44,13 @@ mysql
test
drop database mysqltest;
ERROR HY000: Can't drop database 'mysqltest'; database doesn't exist
+drop table t1;
+flush tables with read lock;
+create table t1(n int);
+ERROR HY000: Can't execute the query because you have a conflicting read lock
+unlock tables;
+create table t1(n int);
+show tables;
+Tables_in_test
+t1
+drop table t1;
diff --git a/mysql-test/r/func_compress.result b/mysql-test/r/func_compress.result
index c4d2eacf363..57eef44b3bb 100644
--- a/mysql-test/r/func_compress.result
+++ b/mysql-test/r/func_compress.result
@@ -40,3 +40,9 @@ uncompress(compress(""))
select uncompressed_length("");
uncompressed_length("")
0
+select compress(NULL);
+compress(NULL)
+NULL
+select uncompress(NULL);
+uncompress(NULL)
+NULL
diff --git a/mysql-test/r/func_crypt.result b/mysql-test/r/func_crypt.result
index 461ae1e7e09..5ee0f0f3e93 100644
--- a/mysql-test/r/func_crypt.result
+++ b/mysql-test/r/func_crypt.result
@@ -1,15 +1,79 @@
select length(encrypt('foo', 'ff')) <> 0;
length(encrypt('foo', 'ff')) <> 0
1
-select password("a",""), password("a",NULL), password("","a"), password(NULL,"a");
-password("a","") password("a",NULL) password("","a") password(NULL,"a")
-*2517f7235d68d4ba2e5019c93420523101157a792c01 NULL NULL
-select password("aaaaaaaaaaaaaaaa","a"), password("a","aaaaaaaaaaaaaaaa");
-password("aaaaaaaaaaaaaaaa","a") password("a","aaaaaaaaaaaaaaaa")
-*2cd3b9a44e9a9994789a30f935c92f45a96c5472f381 *37c7c5c794ff144819f2531bf03c57772cd84e40db09
-select old_password('test'), length(password("1")), length(encrypt('test')), encrypt('test','aa');
-old_password('test') length(password("1")) length(encrypt('test')) encrypt('test','aa')
-378b243e220ca493 45 13 aaqPiZY5xR5l.
-select old_password(""), old_password(NULL), password(""), password(NULL);
-old_password("") old_password(NULL) password("") password(NULL)
- NULL NULL
+select password('abc');
+password('abc')
+*0D3CED9BEC10A777AEC23CCC353A8C08A633045E
+select password('');
+password('')
+
+select old_password('abc');
+old_password('abc')
+7cd2b5942be28759
+select old_password('');
+old_password('')
+
+select password('gabbagabbahey');
+password('gabbagabbahey')
+*B0F99D2963660DD7E16B751EC9EE2F17B6A68FA6
+select old_password('idkfa');
+old_password('idkfa')
+5c078dc54ca0fcca
+select length(password('1'));
+length(password('1'))
+41
+select length(encrypt('test'));
+length(encrypt('test'))
+13
+select encrypt('test','aa');
+encrypt('test','aa')
+aaqPiZY5xR5l.
+select old_password(NULL);
+old_password(NULL)
+NULL
+select password(NULL);
+password(NULL)
+NULL
+set global old_passwords=on;
+select password('');
+password('')
+
+select old_password('');
+old_password('')
+
+select password('idkfa');
+password('idkfa')
+*B669C9DAC3AA6F2254B03CDEF8DFDD6B2D1054BA
+select old_password('idkfa');
+old_password('idkfa')
+5c078dc54ca0fcca
+set old_passwords=on;
+select password('idkfa');
+password('idkfa')
+5c078dc54ca0fcca
+select old_password('idkfa');
+old_password('idkfa')
+5c078dc54ca0fcca
+set global old_passwords=off;
+select password('idkfa');
+password('idkfa')
+5c078dc54ca0fcca
+select old_password('idkfa');
+old_password('idkfa')
+5c078dc54ca0fcca
+set old_passwords=off;
+select password('idkfa ');
+password('idkfa ')
+*2DC31D90647B4C1ABC9231563D2236E96C9A2DB2
+select password('idkfa');
+password('idkfa')
+*B669C9DAC3AA6F2254B03CDEF8DFDD6B2D1054BA
+select password(' idkfa');
+password(' idkfa')
+*12B099E56BB7FE8D43C78FD834A9D1D11178D045
+select old_password('idkfa');
+old_password('idkfa')
+5c078dc54ca0fcca
+select old_password(' i d k f a ');
+old_password(' i d k f a ')
+5c078dc54ca0fcca
diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result
index a4493e7c95c..5c3c2f10000 100644
--- a/mysql-test/r/func_gconcat.result
+++ b/mysql-test/r/func_gconcat.result
@@ -167,6 +167,11 @@ t2.URL_ID = t1.URL_ID group by REQ_ID;
REQ_ID URL
1 X
5 X,X,X
+select REQ_ID, Group_Concat(URL) as URL, Min(t1.URL_ID) urll,
+Max(t1.URL_ID) urlg from t1, t2 where t2.URL_ID = t1.URL_ID group by REQ_ID;
+REQ_ID URL urll urlg
+1 X 4 4
+5 X,X,X 4 5
drop table t1;
drop table t2;
create table t1 (id int, name varchar(16));
@@ -178,3 +183,16 @@ select distinct ifnull(group_concat(concat(t1.id, ':', t1.name)), 'shortname') a
with distinct: cutoff at length of shortname
1:longername,1:evenlongername
drop table t1;
+create table t1(id int);
+create table t2(id int);
+insert into t1 values(0),(1);
+select group_concat(t1.id) FROM t1,t2;
+group_concat(t1.id)
+NULL
+drop table t1;
+drop table t2;
+create table t1 (bar varchar(32));
+insert into t1 values('test'),('test2');
+select * from t1 having group_concat(bar)='';
+bar
+drop table t1;
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index d861d1a582e..6c3960a91ee 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -551,7 +551,7 @@ id select_type table type possible_keys key key_len ref rows Extra
explain
select min(a1) from t1 where a1 between a3 and 'KKK';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 14 Using where
+1 SIMPLE t1 ALL NULL NULL NULL NULL 14 Using where
explain
select min(a4) from t1 where (a4 + 0.01) between 0.07 and 0.08;
id select_type table type possible_keys key key_len ref rows Extra
diff --git a/mysql-test/r/func_regexp.result b/mysql-test/r/func_regexp.result
index 8d22994ef2b..35742136ee6 100644
--- a/mysql-test/r/func_regexp.result
+++ b/mysql-test/r/func_regexp.result
@@ -52,3 +52,27 @@ select * from t1 where xxx REGEXP '^this is some text: to test - out\\.reg exp [
xxx
this is some text: to test - out.reg exp (22/45)
drop table t1;
+select _latin1 0xFF regexp _latin1 '[[:lower:]]' COLLATE latin1_bin;
+_latin1 0xFF regexp _latin1 '[[:lower:]]' COLLATE latin1_bin
+1
+select _koi8r 0xFF regexp _koi8r '[[:lower:]]' COLLATE koi8r_bin;
+_koi8r 0xFF regexp _koi8r '[[:lower:]]' COLLATE koi8r_bin
+0
+select _latin1 0xFF regexp _latin1 '[[:upper:]]' COLLATE latin1_bin;
+_latin1 0xFF regexp _latin1 '[[:upper:]]' COLLATE latin1_bin
+0
+select _koi8r 0xFF regexp _koi8r '[[:upper:]]' COLLATE koi8r_bin;
+_koi8r 0xFF regexp _koi8r '[[:upper:]]' COLLATE koi8r_bin
+1
+select _latin1 0xF7 regexp _latin1 '[[:alpha:]]';
+_latin1 0xF7 regexp _latin1 '[[:alpha:]]'
+0
+select _koi8r 0xF7 regexp _koi8r '[[:alpha:]]';
+_koi8r 0xF7 regexp _koi8r '[[:alpha:]]'
+1
+select _latin1'a' regexp _latin1'A' collate latin1_general_ci;
+_latin1'a' regexp _latin1'A' collate latin1_general_ci
+1
+select _latin1'a' regexp _latin1'A' collate latin1_bin;
+_latin1'a' regexp _latin1'A' collate latin1_bin
+0
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index 82f68cdaa84..ac25277351c 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -410,7 +410,7 @@ collation(concat(_latin2'a',_latin2'b')) coercibility(concat(_latin2'a',_latin2'
latin2_general_ci 3
select collation(lpad(_latin2'a',4,_latin2'b')), coercibility(lpad(_latin2'a',4,_latin2'b'));
collation(lpad(_latin2'a',4,_latin2'b')) coercibility(lpad(_latin2'a',4,_latin2'b'))
-binary 3
+latin2_general_ci 3
select collation(rpad(_latin2'a',4,_latin2'b')), coercibility(rpad(_latin2'a',4,_latin2'b'));
collation(rpad(_latin2'a',4,_latin2'b')) coercibility(rpad(_latin2'a',4,_latin2'b'))
latin2_general_ci 3
diff --git a/mysql-test/r/func_test.result b/mysql-test/r/func_test.result
index e3a0d066a85..851c308ba3e 100644
--- a/mysql-test/r/func_test.result
+++ b/mysql-test/r/func_test.result
@@ -1,3 +1,4 @@
+drop table if exists t1,t2;
select 0=0,1>0,1>=1,1<0,1<=0,1!=0,strcmp("abc","abcd"),strcmp("b","a"),strcmp("a","a") ;
0=0 1>0 1>=1 1<0 1<=0 1!=0 strcmp("abc","abcd") strcmp("b","a") strcmp("a","a")
1 1 1 0 0 1 -1 1 0
@@ -123,3 +124,11 @@ select _koi8r'a' COLLATE koi8r_general_ci LIKE _koi8r'A' COLLATE koi8r_bin;
ERROR HY000: Illegal mix of collations (koi8r_general_ci,EXPLICIT) and (koi8r_bin,EXPLICIT) for operation 'like'
select _koi8r'a' LIKE _latin1'A';
ERROR HY000: Illegal mix of collations (koi8r_general_ci,COERCIBLE) and (latin1_swedish_ci,COERCIBLE) for operation 'like'
+CREATE TABLE t1 ( faq_group_id int(11) NOT NULL default '0', faq_id int(11) NOT NULL default '0', title varchar(240) default NULL, keywords text, description longblob, solution longblob, status tinyint(4) NOT NULL default '0', access_id smallint(6) default NULL, lang_id smallint(6) NOT NULL default '0', created datetime NOT NULL default '0000-00-00 00:00:00', updated datetime default NULL, last_access datetime default NULL, last_notify datetime default NULL, solved_count int(11) NOT NULL default '0', static_solved int(11) default NULL, solved_1 int(11) default NULL, solved_2 int(11) default NULL, solved_3 int(11) default NULL, solved_4 int(11) default NULL, solved_5 int(11) default NULL, expires datetime default NULL, notes text, assigned_to smallint(6) default NULL, assigned_group smallint(6) default NULL, last_edited_by smallint(6) default NULL, orig_ref_no varchar(15) binary default NULL, c$fundstate smallint(6) default NULL, c$contributor smallint(6) default NULL, UNIQUE KEY t1$faq_id (faq_id), KEY t1$group_id$faq_id (faq_group_id,faq_id), KEY t1$c$fundstate (c$fundstate) ) TYPE=MyISAM;
+INSERT INTO t1 VALUES (82,82,'How to use the DynaVox Usage Counts Feature','usages count, number, corner, white, box, button','<as-html>\r\n<table width=\"100%\" border=\"0\">\r\n <tr>\r\n <td width=\"3%\"> </td>\r\n <td width=\"97%\">\r\n <h3><font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\"#000000\">How \r\n To</font><!-- #BeginEditable \"CS_troubleshoot_question\" --><font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\"#000099\"><font color=\"#000000\">: \r\n Display or Hide the Usage Counts to find out how many times each button is being selected. </font></font><!-- #EndEditable --></h3>\r\n </td>\r\n </tr>\r\n</table>','<as-html>\r\n <table width=\"100%\" border=\"0\">\r\n <tr>\r\n <td width=\"3%\"> </td>\r\n \r\n<td width=\"97%\"><!-- #BeginEditable \"CS_troubleshoot_answer\" --> \r\n \r\n<p><font color=\"#000000\" face=\"Verdana, Arial, Helvetica, sans-serif\">1. Select \r\n the <i>On/Setup</i> button to access the DynaVox Setup Menu.<br>\r\n 2. Select <b>Button Features.</b><br>\r\n 3. Below the <b>OK</b> button is the <b>Usage Counts</b> button.<br>\r\n a. If it says \"Hidden\" then the Usage Counts will not be displayed.<br>\r\n b. If it says \"Displayed\" then the Usage Counts will be shown.<br>\r\n c. Select the <b>Usage Counts</b> Option Ring once and it will toggle \r\n to the alternative option.<br>\r\n 4. Once the correct setting has been chosen, select <b>OK</b> to leave the <i>Button \r\n Features</i> menu.<br>\r\n 5. Select <b>OK</b> out of the <i>Setup</i> menu and return to the communication \r\n page.</font></p>\r\n <p><font color=\"#000000\" face=\"Verdana, Arial, Helvetica, sans-serif\">For \r\n further information on <i>Usage Counts,</i> see the <i>Button Features \r\n Menu Entry</i> in the DynaVox/DynaMyte Reference Manual.</font></p>\r\n<!-- #EndEditable --></td>\r\n </tr>\r\n</table>',4,1,1,'2001-11-16 16:43:34','2002-11-25 12:09:43','2003-07-24 01:04:48',NULL,11,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,11,NULL,NULL,NULL);
+CREATE TABLE t2 ( access_id smallint(6) NOT NULL default '0', name varchar(20) binary default NULL, rank smallint(6) NOT NULL default '0', KEY t2$access_id (access_id) ) TYPE=MyISAM;
+INSERT INTO t2 VALUES (1,'Everyone',2),(2,'Help',3),(3,'Customer Support',1);
+SELECT f_acc.rank, a1.rank, a2.rank FROM t1 LEFT JOIN t1 f1 ON (f1.access_id=1 AND f1.faq_group_id = t1.faq_group_id) LEFT JOIN t2 a1 ON (a1.access_id = f1.access_id) LEFT JOIN t1 f2 ON (f2.access_id=3 AND f2.faq_group_id = t1.faq_group_id) LEFT JOIN t2 a2 ON (a2.access_id = f2.access_id), t2 f_acc WHERE LEAST(a1.rank,a2.rank) = f_acc.rank;
+rank rank rank
+2 2 NULL
+DROP TABLE t1,t2;
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result
index 7d3aeb62227..89426edb000 100644
--- a/mysql-test/r/grant.result
+++ b/mysql-test/r/grant.result
@@ -91,19 +91,39 @@ show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
GRANT SELECT, INSERT, INSERT (a), REFERENCES (a) ON `test`.`t1` TO 'mysqltest_1'@'localhost'
-REVOKE insert,insert (a) on t1 from mysqltest_1@localhost;
-GRANT references on t1 to mysqltest_1@localhost;
+REVOKE select,update,insert,insert (a) on t1 from mysqltest_1@localhost;
show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
-GRANT SELECT, REFERENCES, REFERENCES (a) ON `test`.`t1` TO 'mysqltest_1'@'localhost'
+GRANT REFERENCES (a) ON `test`.`t1` TO 'mysqltest_1'@'localhost'
+GRANT select,references on t1 to mysqltest_1@localhost;
select table_priv,column_priv from mysql.tables_priv where user="mysqltest_1";
table_priv column_priv
Select,References References
-delete from mysql.user where user='mysqltest_1';
-delete from mysql.db where user='mysqltest_1';
-delete from mysql.tables_priv where user='mysqltest_1';
-delete from mysql.columns_priv where user='mysqltest_1';
+grant all on test.* to mysqltest_3@localhost with grant option;
+revoke all on test.* from mysqltest_3@localhost;
+show grants for mysqltest_3@localhost;
+Grants for mysqltest_3@localhost
+GRANT USAGE ON *.* TO 'mysqltest_3'@'localhost'
+GRANT USAGE ON `test`.* TO 'mysqltest_3'@'localhost' WITH GRANT OPTION
+revoke grant option on test.* from mysqltest_3@localhost;
+show grants for mysqltest_3@localhost;
+Grants for mysqltest_3@localhost
+GRANT USAGE ON *.* TO 'mysqltest_3'@'localhost'
+grant all on test.t1 to mysqltest_2@localhost with grant option;
+revoke all on test.t1 from mysqltest_2@localhost;
+show grants for mysqltest_2@localhost;
+Grants for mysqltest_2@localhost
+GRANT USAGE ON *.* TO 'mysqltest_2'@'localhost'
+GRANT USAGE ON `test`.`t1` TO 'mysqltest_2'@'localhost' WITH GRANT OPTION
+revoke grant option on test.t1 from mysqltest_2@localhost;
+show grants for mysqltest_2@localhost;
+Grants for mysqltest_2@localhost
+GRANT USAGE ON *.* TO 'mysqltest_2'@'localhost'
+delete from mysql.user where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
+delete from mysql.db where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
+delete from mysql.tables_priv where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
+delete from mysql.columns_priv where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
flush privileges;
drop table t1;
GRANT FILE on mysqltest.* to mysqltest_1@localhost;
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index 3cb9c59cc57..c286b4d8fc4 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -586,4 +586,15 @@ select id, sum(qty) as sqty, count(qty) as cqty from t1 group by id having sum(q
id sqty cqty
1 5 2
2 9 2
+select count(*), case interval(qty,2,3,4,5,6,7,8) when -1 then NULL when 0 then "zero" when 1 then "one" when 2 then "two" end as category from t1 group by category;
+count(*) category
+2 NULL
+1 one
+1 two
+select count(*), interval(qty,2,3,4,5,6,7,8) as category from t1 group by category;
+count(*) category
+1 1
+1 2
+1 3
+1 4
drop table t1;
diff --git a/mysql-test/r/have_openssl_2.require b/mysql-test/r/have_openssl_2.require
deleted file mode 100644
index 032b60d544a..00000000000
--- a/mysql-test/r/have_openssl_2.require
+++ /dev/null
@@ -1,2 +0,0 @@
-Variable_name Value
-Ssl_cipher EDH-RSA-DES-CBC3-SHA
diff --git a/mysql-test/r/have_ujis.require b/mysql-test/r/have_ujis.require
index b4de2234ec7..43a309ad74e 100644
--- a/mysql-test/r/have_ujis.require
+++ b/mysql-test/r/have_ujis.require
@@ -1,2 +1,2 @@
Collation Charset Id Default Compiled Sortlen
-ujis_japanese_ci ujis 12 Yes Yes 0
+ujis_japanese_ci ujis 12 Yes Yes 1
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index 8592393fd42..718e554b904 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -251,6 +251,18 @@ n
6
rollback;
drop table t1;
+create table t1 (n int not null primary key) type=innodb;
+start transaction;
+insert into t1 values (4);
+flush tables with read lock;
+commit;
+ERROR HY000: Can't execute the query because you have a conflicting read lock
+unlock tables;
+commit;
+select * from t1;
+n
+4
+drop table t1;
create table t1 ( id int NOT NULL PRIMARY KEY, nom varchar(64)) type=innodb;
begin;
insert into t1 values(1,'hamdouni');
@@ -1342,3 +1354,40 @@ id label
3524 Societe Test
3525 Fournisseur Test
drop table t1,t2;
+create table t1 (c1 char(5) unique not null, c2 int, stamp timestamp) type=innodb;
+select * from t1;
+c1 c2 stamp
+replace delayed into t1 (c1, c2) values ( "text1","11"),( "text2","12");
+ERROR HY000: Table storage engine for 't1' doesn't have this option
+select * from t1;
+c1 c2 stamp
+replace delayed into t1 (c1, c2) values ( "text1","12"),( "text2","13"),( "text3","14", "a" ),( "text4","15", "b" );
+ERROR HY000: Table storage engine for 't1' doesn't have this option
+select * from t1;
+c1 c2 stamp
+drop table t1;
+create table t1 (a int, b varchar(200), c text not null) checksum=1 type=myisam;
+create table t2 (a int, b varchar(200), c text not null) checksum=0 type=innodb;
+create table t3 (a int, b varchar(200), c text not null) checksum=1 type=innodb;
+insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, "");
+insert t2 select * from t1;
+insert t3 select * from t1;
+checksum table t1, t2, t3, t4 quick;
+Table Checksum
+test.t1 968604391
+test.t2 NULL
+test.t3 NULL
+test.t4 NULL
+checksum table t1, t2, t3, t4;
+Table Checksum
+test.t1 968604391
+test.t2 968604391
+test.t3 968604391
+test.t4 NULL
+checksum table t1, t2, t3, t4 extended;
+Table Checksum
+test.t1 968604391
+test.t2 968604391
+test.t3 968604391
+test.t4 NULL
+drop table t1,t2,t3;
diff --git a/mysql-test/r/innodb_cache.result b/mysql-test/r/innodb_cache.result
index c422dca36f1..7706e60d143 100644
--- a/mysql-test/r/innodb_cache.result
+++ b/mysql-test/r/innodb_cache.result
@@ -10,7 +10,7 @@ a
3
show status like "Qcache_queries_in_cache";
Variable_name Value
-Qcache_queries_in_cache 1
+Qcache_queries_in_cache 0
drop table t1;
commit;
set autocommit=1;
@@ -24,7 +24,7 @@ a
3
show status like "Qcache_queries_in_cache";
Variable_name Value
-Qcache_queries_in_cache 1
+Qcache_queries_in_cache 0
drop table t1;
commit;
create table t1 (a int not null) type=innodb;
@@ -90,14 +90,14 @@ a
2
show status like "Qcache_queries_in_cache";
Variable_name Value
-Qcache_queries_in_cache 3
+Qcache_queries_in_cache 1
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 4
commit;
show status like "Qcache_queries_in_cache";
Variable_name Value
-Qcache_queries_in_cache 3
+Qcache_queries_in_cache 1
drop table if exists t1;
CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) TYPE=InnoDB;
select count(*) from t1;
diff --git a/mysql-test/r/isam.result b/mysql-test/r/isam.result
index b83185b0c01..80d78bc72da 100644
--- a/mysql-test/r/isam.result
+++ b/mysql-test/r/isam.result
@@ -1,13 +1,5 @@
drop table if exists t1,t2;
create table t1 (a tinyint not null auto_increment, b blob not null, primary key (a)) type=isam;
-Warnings:
-Warning 1263 Data truncated for column 'b' at row 1
-Warnings:
-Warning 1263 Data truncated for column 'b' at row 1
-Warnings:
-Warning 1263 Data truncated for column 'b' at row 1
-Warnings:
-Warning 1263 Data truncated for column 'b' at row 1
delete from t1 where (a & 1);
select sum(length(b)) from t1;
sum(length(b))
@@ -87,3 +79,173 @@ t1 0 PRIMARY 1 a A 4 NULL NULL BTREE
t1 1 b 1 b A 1 NULL NULL BTREE
t1 1 b 2 c A 4 NULL NULL BTREE
drop table t1,t2;
+create table t1 (i1 int, i2 int, i3 int, i4 int, i5 int, i6 int, i7 int, i8
+int, i9 int, i10 int, i11 int, i12 int, i13 int, i14 int, i15 int, i16 int, i17
+int, i18 int, i19 int, i20 int, i21 int, i22 int, i23 int, i24 int, i25 int,
+i26 int, i27 int, i28 int, i29 int, i30 int, i31 int, i32 int, i33 int, i34
+int, i35 int, i36 int, i37 int, i38 int, i39 int, i40 int, i41 int, i42 int,
+i43 int, i44 int, i45 int, i46 int, i47 int, i48 int, i49 int, i50 int, i51
+int, i52 int, i53 int, i54 int, i55 int, i56 int, i57 int, i58 int, i59 int,
+i60 int, i61 int, i62 int, i63 int, i64 int, i65 int, i66 int, i67 int, i68
+int, i69 int, i70 int, i71 int, i72 int, i73 int, i74 int, i75 int, i76 int,
+i77 int, i78 int, i79 int, i80 int, i81 int, i82 int, i83 int, i84 int, i85
+int, i86 int, i87 int, i88 int, i89 int, i90 int, i91 int, i92 int, i93 int,
+i94 int, i95 int, i96 int, i97 int, i98 int, i99 int, i100 int, i101 int, i102
+int, i103 int, i104 int, i105 int, i106 int, i107 int, i108 int, i109 int, i110
+int, i111 int, i112 int, i113 int, i114 int, i115 int, i116 int, i117 int, i118
+int, i119 int, i120 int, i121 int, i122 int, i123 int, i124 int, i125 int, i126
+int, i127 int, i128 int, i129 int, i130 int, i131 int, i132 int, i133 int, i134
+int, i135 int, i136 int, i137 int, i138 int, i139 int, i140 int, i141 int, i142
+int, i143 int, i144 int, i145 int, i146 int, i147 int, i148 int, i149 int, i150
+int, i151 int, i152 int, i153 int, i154 int, i155 int, i156 int, i157 int, i158
+int, i159 int, i160 int, i161 int, i162 int, i163 int, i164 int, i165 int, i166
+int, i167 int, i168 int, i169 int, i170 int, i171 int, i172 int, i173 int, i174
+int, i175 int, i176 int, i177 int, i178 int, i179 int, i180 int, i181 int, i182
+int, i183 int, i184 int, i185 int, i186 int, i187 int, i188 int, i189 int, i190
+int, i191 int, i192 int, i193 int, i194 int, i195 int, i196 int, i197 int, i198
+int, i199 int, i200 int, i201 int, i202 int, i203 int, i204 int, i205 int, i206
+int, i207 int, i208 int, i209 int, i210 int, i211 int, i212 int, i213 int, i214
+int, i215 int, i216 int, i217 int, i218 int, i219 int, i220 int, i221 int, i222
+int, i223 int, i224 int, i225 int, i226 int, i227 int, i228 int, i229 int, i230
+int, i231 int, i232 int, i233 int, i234 int, i235 int, i236 int, i237 int, i238
+int, i239 int, i240 int, i241 int, i242 int, i243 int, i244 int, i245 int, i246
+int, i247 int, i248 int, i249 int, i250 int, i251 int, i252 int, i253 int, i254
+int, i255 int, i256 int, i257 int, i258 int, i259 int, i260 int, i261 int, i262
+int, i263 int, i264 int, i265 int, i266 int, i267 int, i268 int, i269 int, i270
+int, i271 int, i272 int, i273 int, i274 int, i275 int, i276 int, i277 int, i278
+int, i279 int, i280 int, i281 int, i282 int, i283 int, i284 int, i285 int, i286
+int, i287 int, i288 int, i289 int, i290 int, i291 int, i292 int, i293 int, i294
+int, i295 int, i296 int, i297 int, i298 int, i299 int, i300 int, i301 int, i302
+int, i303 int, i304 int, i305 int, i306 int, i307 int, i308 int, i309 int, i310
+int, i311 int, i312 int, i313 int, i314 int, i315 int, i316 int, i317 int, i318
+int, i319 int, i320 int, i321 int, i322 int, i323 int, i324 int, i325 int, i326
+int, i327 int, i328 int, i329 int, i330 int, i331 int, i332 int, i333 int, i334
+int, i335 int, i336 int, i337 int, i338 int, i339 int, i340 int, i341 int, i342
+int, i343 int, i344 int, i345 int, i346 int, i347 int, i348 int, i349 int, i350
+int, i351 int, i352 int, i353 int, i354 int, i355 int, i356 int, i357 int, i358
+int, i359 int, i360 int, i361 int, i362 int, i363 int, i364 int, i365 int, i366
+int, i367 int, i368 int, i369 int, i370 int, i371 int, i372 int, i373 int, i374
+int, i375 int, i376 int, i377 int, i378 int, i379 int, i380 int, i381 int, i382
+int, i383 int, i384 int, i385 int, i386 int, i387 int, i388 int, i389 int, i390
+int, i391 int, i392 int, i393 int, i394 int, i395 int, i396 int, i397 int, i398
+int, i399 int, i400 int, i401 int, i402 int, i403 int, i404 int, i405 int, i406
+int, i407 int, i408 int, i409 int, i410 int, i411 int, i412 int, i413 int, i414
+int, i415 int, i416 int, i417 int, i418 int, i419 int, i420 int, i421 int, i422
+int, i423 int, i424 int, i425 int, i426 int, i427 int, i428 int, i429 int, i430
+int, i431 int, i432 int, i433 int, i434 int, i435 int, i436 int, i437 int, i438
+int, i439 int, i440 int, i441 int, i442 int, i443 int, i444 int, i445 int, i446
+int, i447 int, i448 int, i449 int, i450 int, i451 int, i452 int, i453 int, i454
+int, i455 int, i456 int, i457 int, i458 int, i459 int, i460 int, i461 int, i462
+int, i463 int, i464 int, i465 int, i466 int, i467 int, i468 int, i469 int, i470
+int, i471 int, i472 int, i473 int, i474 int, i475 int, i476 int, i477 int, i478
+int, i479 int, i480 int, i481 int, i482 int, i483 int, i484 int, i485 int, i486
+int, i487 int, i488 int, i489 int, i490 int, i491 int, i492 int, i493 int, i494
+int, i495 int, i496 int, i497 int, i498 int, i499 int, i500 int, i501 int, i502
+int, i503 int, i504 int, i505 int, i506 int, i507 int, i508 int, i509 int, i510
+int, i511 int, i512 int, i513 int, i514 int, i515 int, i516 int, i517 int, i518
+int, i519 int, i520 int, i521 int, i522 int, i523 int, i524 int, i525 int, i526
+int, i527 int, i528 int, i529 int, i530 int, i531 int, i532 int, i533 int, i534
+int, i535 int, i536 int, i537 int, i538 int, i539 int, i540 int, i541 int, i542
+int, i543 int, i544 int, i545 int, i546 int, i547 int, i548 int, i549 int, i550
+int, i551 int, i552 int, i553 int, i554 int, i555 int, i556 int, i557 int, i558
+int, i559 int, i560 int, i561 int, i562 int, i563 int, i564 int, i565 int, i566
+int, i567 int, i568 int, i569 int, i570 int, i571 int, i572 int, i573 int, i574
+int, i575 int, i576 int, i577 int, i578 int, i579 int, i580 int, i581 int, i582
+int, i583 int, i584 int, i585 int, i586 int, i587 int, i588 int, i589 int, i590
+int, i591 int, i592 int, i593 int, i594 int, i595 int, i596 int, i597 int, i598
+int, i599 int, i600 int, i601 int, i602 int, i603 int, i604 int, i605 int, i606
+int, i607 int, i608 int, i609 int, i610 int, i611 int, i612 int, i613 int, i614
+int, i615 int, i616 int, i617 int, i618 int, i619 int, i620 int, i621 int, i622
+int, i623 int, i624 int, i625 int, i626 int, i627 int, i628 int, i629 int, i630
+int, i631 int, i632 int, i633 int, i634 int, i635 int, i636 int, i637 int, i638
+int, i639 int, i640 int, i641 int, i642 int, i643 int, i644 int, i645 int, i646
+int, i647 int, i648 int, i649 int, i650 int, i651 int, i652 int, i653 int, i654
+int, i655 int, i656 int, i657 int, i658 int, i659 int, i660 int, i661 int, i662
+int, i663 int, i664 int, i665 int, i666 int, i667 int, i668 int, i669 int, i670
+int, i671 int, i672 int, i673 int, i674 int, i675 int, i676 int, i677 int, i678
+int, i679 int, i680 int, i681 int, i682 int, i683 int, i684 int, i685 int, i686
+int, i687 int, i688 int, i689 int, i690 int, i691 int, i692 int, i693 int, i694
+int, i695 int, i696 int, i697 int, i698 int, i699 int, i700 int, i701 int, i702
+int, i703 int, i704 int, i705 int, i706 int, i707 int, i708 int, i709 int, i710
+int, i711 int, i712 int, i713 int, i714 int, i715 int, i716 int, i717 int, i718
+int, i719 int, i720 int, i721 int, i722 int, i723 int, i724 int, i725 int, i726
+int, i727 int, i728 int, i729 int, i730 int, i731 int, i732 int, i733 int, i734
+int, i735 int, i736 int, i737 int, i738 int, i739 int, i740 int, i741 int, i742
+int, i743 int, i744 int, i745 int, i746 int, i747 int, i748 int, i749 int, i750
+int, i751 int, i752 int, i753 int, i754 int, i755 int, i756 int, i757 int, i758
+int, i759 int, i760 int, i761 int, i762 int, i763 int, i764 int, i765 int, i766
+int, i767 int, i768 int, i769 int, i770 int, i771 int, i772 int, i773 int, i774
+int, i775 int, i776 int, i777 int, i778 int, i779 int, i780 int, i781 int, i782
+int, i783 int, i784 int, i785 int, i786 int, i787 int, i788 int, i789 int, i790
+int, i791 int, i792 int, i793 int, i794 int, i795 int, i796 int, i797 int, i798
+int, i799 int, i800 int, i801 int, i802 int, i803 int, i804 int, i805 int, i806
+int, i807 int, i808 int, i809 int, i810 int, i811 int, i812 int, i813 int, i814
+int, i815 int, i816 int, i817 int, i818 int, i819 int, i820 int, i821 int, i822
+int, i823 int, i824 int, i825 int, i826 int, i827 int, i828 int, i829 int, i830
+int, i831 int, i832 int, i833 int, i834 int, i835 int, i836 int, i837 int, i838
+int, i839 int, i840 int, i841 int, i842 int, i843 int, i844 int, i845 int, i846
+int, i847 int, i848 int, i849 int, i850 int, i851 int, i852 int, i853 int, i854
+int, i855 int, i856 int, i857 int, i858 int, i859 int, i860 int, i861 int, i862
+int, i863 int, i864 int, i865 int, i866 int, i867 int, i868 int, i869 int, i870
+int, i871 int, i872 int, i873 int, i874 int, i875 int, i876 int, i877 int, i878
+int, i879 int, i880 int, i881 int, i882 int, i883 int, i884 int, i885 int, i886
+int, i887 int, i888 int, i889 int, i890 int, i891 int, i892 int, i893 int, i894
+int, i895 int, i896 int, i897 int, i898 int, i899 int, i900 int, i901 int, i902
+int, i903 int, i904 int, i905 int, i906 int, i907 int, i908 int, i909 int, i910
+int, i911 int, i912 int, i913 int, i914 int, i915 int, i916 int, i917 int, i918
+int, i919 int, i920 int, i921 int, i922 int, i923 int, i924 int, i925 int, i926
+int, i927 int, i928 int, i929 int, i930 int, i931 int, i932 int, i933 int, i934
+int, i935 int, i936 int, i937 int, i938 int, i939 int, i940 int, i941 int, i942
+int, i943 int, i944 int, i945 int, i946 int, i947 int, i948 int, i949 int, i950
+int, i951 int, i952 int, i953 int, i954 int, i955 int, i956 int, i957 int, i958
+int, i959 int, i960 int, i961 int, i962 int, i963 int, i964 int, i965 int, i966
+int, i967 int, i968 int, i969 int, i970 int, i971 int, i972 int, i973 int, i974
+int, i975 int, i976 int, i977 int, i978 int, i979 int, i980 int, i981 int, i982
+int, i983 int, i984 int, i985 int, i986 int, i987 int, i988 int, i989 int, i990
+int, i991 int, i992 int, i993 int, i994 int, i995 int, i996 int, i997 int, i998
+int, i999 int, i1000 int, b blob) row_format=dynamic;
+insert into t1 values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, "Sergei");
+update t1 set b=repeat('a',256);
+update t1 set i1=0, i2=0, i3=0, i4=0, i5=0, i6=0, i7=0;
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+drop table t1;
diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result
index 508e1844d84..d738431e016 100644
--- a/mysql-test/r/loaddata.result
+++ b/mysql-test/r/loaddata.result
@@ -28,3 +28,15 @@ NULL NULL 0000-00-00 0000-00-00
NULL 0000-00-00 0000-00-00 0000-00-00
NULL 2003-03-03 2003-03-03 NULL
drop table t1;
+create table t1 (a text, b text);
+load data infile '../../std_data/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
+Warnings:
+Warning 1260 Record count is fewer than the column count at row 3
+select concat('|',a,'|'), concat('|',b,'|') from t1;
+concat('|',a,'|') concat('|',b,'|')
+|Field A| |Field B|
+|Field 1| |Field 2'
+Field 3,'Field 4|
+|Field 5' ,'Field 6| NULL
+|Field 6| | 'Field 7'|
+drop table t1;
diff --git a/mysql-test/r/lowercase_table.result b/mysql-test/r/lowercase_table.result
index af4e2300088..9c6b212a4b6 100644
--- a/mysql-test/r/lowercase_table.result
+++ b/mysql-test/r/lowercase_table.result
@@ -6,6 +6,15 @@ id Word
1 a
2 b
3 c
+SELECT T1.id from T1 LIMIT 1;
+id
+1
+SELECT T2.id from t1 as T2 LIMIT 1;
+id
+1
+SELECT T2.id from t1 as t2 LIMIT 1;
+id
+1
RENAME TABLE T1 TO T2;
ALTER TABLE T2 ADD new_col int not null;
ALTER TABLE T2 RENAME T3;
diff --git a/mysql-test/r/mix_innodb_myisam_binlog.result b/mysql-test/r/mix_innodb_myisam_binlog.result
new file mode 100644
index 00000000000..d6da3604fd2
--- /dev/null
+++ b/mysql-test/r/mix_innodb_myisam_binlog.result
@@ -0,0 +1,183 @@
+drop table if exists t1, t2;
+create table t1 (a int) type=innodb;
+create table t2 (a int) type=myisam;
+reset master;
+begin;
+insert into t1 values(1);
+insert into t2 select * from t1;
+commit;
+show binlog events from 79;
+Log_name Pos Event_type Server_id Orig_log_pos Info
+master-bin.000001 79 Query 1 79 use `test`; BEGIN
+master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(1)
+master-bin.000001 178 Query 1 79 use `test`; insert into t2 select * from t1
+master-bin.000001 244 Query 1 244 use `test`; COMMIT
+delete from t1;
+delete from t2;
+reset master;
+begin;
+insert into t1 values(2);
+insert into t2 select * from t1;
+rollback;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+show binlog events from 79;
+Log_name Pos Event_type Server_id Orig_log_pos Info
+master-bin.000001 79 Query 1 79 use `test`; BEGIN
+master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(2)
+master-bin.000001 178 Query 1 79 use `test`; insert into t2 select * from t1
+master-bin.000001 244 Query 1 244 use `test`; ROLLBACK
+delete from t1;
+delete from t2;
+reset master;
+begin;
+insert into t1 values(3);
+savepoint my_savepoint;
+insert into t1 values(4);
+insert into t2 select * from t1;
+rollback to savepoint my_savepoint;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+commit;
+show binlog events from 79;
+Log_name Pos Event_type Server_id Orig_log_pos Info
+master-bin.000001 79 Query 1 79 use `test`; BEGIN
+master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(3)
+master-bin.000001 178 Query 1 79 use `test`; savepoint my_savepoint
+master-bin.000001 235 Query 1 79 use `test`; insert into t1 values(4)
+master-bin.000001 294 Query 1 79 use `test`; insert into t2 select * from t1
+master-bin.000001 360 Query 1 79 use `test`; rollback to savepoint my_savepoint
+master-bin.000001 429 Query 1 429 use `test`; COMMIT
+delete from t1;
+delete from t2;
+reset master;
+begin;
+insert into t1 values(5);
+savepoint my_savepoint;
+insert into t1 values(6);
+insert into t2 select * from t1;
+rollback to savepoint my_savepoint;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+insert into t1 values(7);
+commit;
+select a from t1 order by a;
+a
+5
+7
+show binlog events from 79;
+Log_name Pos Event_type Server_id Orig_log_pos Info
+master-bin.000001 79 Query 1 79 use `test`; BEGIN
+master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(5)
+master-bin.000001 178 Query 1 79 use `test`; savepoint my_savepoint
+master-bin.000001 235 Query 1 79 use `test`; insert into t1 values(6)
+master-bin.000001 294 Query 1 79 use `test`; insert into t2 select * from t1
+master-bin.000001 360 Query 1 79 use `test`; rollback to savepoint my_savepoint
+master-bin.000001 429 Query 1 79 use `test`; insert into t1 values(7)
+master-bin.000001 488 Query 1 488 use `test`; COMMIT
+delete from t1;
+delete from t2;
+reset master;
+select get_lock("a",10);
+get_lock("a",10)
+1
+begin;
+insert into t1 values(8);
+insert into t2 select * from t1;
+select get_lock("a",10);
+get_lock("a",10)
+1
+show binlog events from 79;
+Log_name Pos Event_type Server_id Orig_log_pos Info
+master-bin.000001 79 Query 1 79 use `test`; BEGIN
+master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(8)
+master-bin.000001 178 Query 1 79 use `test`; insert into t2 select * from t1
+master-bin.000001 244 Query 1 244 use `test`; ROLLBACK
+delete from t1;
+delete from t2;
+reset master;
+insert into t1 values(9);
+insert into t2 select * from t1;
+show binlog events from 79;
+Log_name Pos Event_type Server_id Orig_log_pos Info
+master-bin.000001 79 Query 1 79 use `test`; insert into t1 values(9)
+master-bin.000001 138 Query 1 138 use `test`; insert into t2 select * from t1
+delete from t1;
+delete from t2;
+reset master;
+insert into t1 values(10);
+begin;
+insert into t2 select * from t1;
+show binlog events from 79;
+Log_name Pos Event_type Server_id Orig_log_pos Info
+master-bin.000001 79 Query 1 79 use `test`; insert into t1 values(10)
+master-bin.000001 139 Query 1 139 use `test`; insert into t2 select * from t1
+insert into t1 values(11);
+commit;
+show binlog events from 79;
+Log_name Pos Event_type Server_id Orig_log_pos Info
+master-bin.000001 79 Query 1 79 use `test`; insert into t1 values(10)
+master-bin.000001 139 Query 1 139 use `test`; insert into t2 select * from t1
+master-bin.000001 205 Query 1 205 use `test`; BEGIN
+master-bin.000001 245 Query 1 205 use `test`; insert into t1 values(11)
+master-bin.000001 305 Query 1 305 use `test`; COMMIT
+alter table t2 type=INNODB;
+delete from t1;
+delete from t2;
+reset master;
+begin;
+insert into t1 values(12);
+insert into t2 select * from t1;
+commit;
+show binlog events from 79;
+Log_name Pos Event_type Server_id Orig_log_pos Info
+master-bin.000001 79 Query 1 79 use `test`; BEGIN
+master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(12)
+master-bin.000001 179 Query 1 79 use `test`; insert into t2 select * from t1
+master-bin.000001 245 Query 1 245 use `test`; COMMIT
+delete from t1;
+delete from t2;
+reset master;
+begin;
+insert into t1 values(13);
+insert into t2 select * from t1;
+rollback;
+show binlog events from 79;
+Log_name Pos Event_type Server_id Orig_log_pos Info
+delete from t1;
+delete from t2;
+reset master;
+begin;
+insert into t1 values(14);
+savepoint my_savepoint;
+insert into t1 values(15);
+insert into t2 select * from t1;
+rollback to savepoint my_savepoint;
+commit;
+show binlog events from 79;
+Log_name Pos Event_type Server_id Orig_log_pos Info
+master-bin.000001 79 Query 1 79 use `test`; BEGIN
+master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(14)
+master-bin.000001 179 Query 1 179 use `test`; COMMIT
+delete from t1;
+delete from t2;
+reset master;
+begin;
+insert into t1 values(16);
+savepoint my_savepoint;
+insert into t1 values(17);
+insert into t2 select * from t1;
+rollback to savepoint my_savepoint;
+insert into t1 values(18);
+commit;
+select a from t1 order by a;
+a
+16
+18
+show binlog events from 79;
+Log_name Pos Event_type Server_id Orig_log_pos Info
+master-bin.000001 79 Query 1 79 use `test`; BEGIN
+master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(16)
+master-bin.000001 179 Query 1 79 use `test`; insert into t1 values(18)
+master-bin.000001 239 Query 1 239 use `test`; COMMIT
+drop table t1,t2;
diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result
index 15d04422f9d..a7579b538b5 100644
--- a/mysql-test/r/multi_update.result
+++ b/mysql-test/r/multi_update.result
@@ -332,3 +332,12 @@ create table t2(Z varchar(15));
insert into t2(Z) select concat(a.a,b.a,c.a,d.a) from t1 as a, t1 as b, t1 as c, t1 as d;
update t2,t3 set Z =param_scenario_costs;
drop table t1,t2,t3;
+create table t1 (a int, b int);
+create table t2 (a int, b int);
+insert into t1 values (1,1),(2,1),(3,1);
+insert into t2 values (1,1), (3,1);
+update t1 left join t2 on t1.a=t2.a set t1.b=2, t2.b=2 where t1.b=1 and t2.b=1 or t2.a is NULL;
+select t1.a, t1.b,t2.a, t2.b from t1 left join t2 on t1.a=t2.a where t1.b=1 and t2.b=1 or t2.a is NULL;
+a b a b
+2 2 NULL NULL
+drop table t1,t2;
diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result
index d158c39cba8..49475c9cbec 100644
--- a/mysql-test/r/myisam.result
+++ b/mysql-test/r/myisam.result
@@ -285,6 +285,17 @@ insert into t1 values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, "Sergei");
+update t1 set b=repeat('a',256);
+update t1 set i1=0, i2=0, i3=0, i4=0, i5=0, i6=0, i7=0;
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+delete from t1 where i8=1;
+select i1,i2 from t1;
+i1 i2
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
drop table t1;
CREATE TABLE `t1` (
`post_id` mediumint(8) unsigned NOT NULL auto_increment,
@@ -365,8 +376,47 @@ explain select * from t1 use index() where c=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where
drop table t1,t2;
+create table t1 (a int not null auto_increment primary key, b varchar(255));
+insert into t1 (b) values (repeat('a',100)),(repeat('b',100)),(repeat('c',100));
+update t1 set b=repeat(left(b,1),200) where a=1;
+delete from t1 where (a & 1)= 0;
+update t1 set b=repeat('e',200) where a=1;
+flush tables;
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+update t1 set b=repeat(left(b,1),255) where a between 1 and 5;
+update t1 set b=repeat(left(b,1),10) where a between 32 and 43;
+update t1 set b=repeat(left(b,1),2) where a between 64 and 66;
+update t1 set b=repeat(left(b,1),65) where a between 67 and 70;
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+insert into t1 (b) values (repeat('z',100));
+update t1 set b="test" where left(b,1) > 'n';
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+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`)) TYPE=MyISAM;
ERROR 42000: This version of MySQL doesn't yet support 'RTREE INDEX'
-DROP TABLE IF EXISTS t1;
-Warnings:
-Note 1051 Unknown table 't1'
+create table t1 (a int, b varchar(200), c text not null) checksum=1;
+create table t2 (a int, b varchar(200), c text not null) checksum=0;
+insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, "");
+insert t2 select * from t1;
+checksum table t1, t2, t3 quick;
+Table Checksum
+test.t1 968604391
+test.t2 NULL
+test.t3 NULL
+checksum table t1, t2, t3;
+Table Checksum
+test.t1 968604391
+test.t2 968604391
+test.t3 NULL
+checksum table t1, t2, t3 extended;
+Table Checksum
+test.t1 968604391
+test.t2 968604391
+test.t3 NULL
+drop table t1,t2;
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
new file mode 100644
index 00000000000..cf1ef55ca69
--- /dev/null
+++ b/mysql-test/r/mysqldump.result
@@ -0,0 +1,20 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(a int);
+INSERT INTO t1 VALUES (1), (2);
+<?xml version="1.0"?>
+<mysqldump>
+<database name="test">
+DROP TABLE IF EXISTS t1;
+LOCK TABLES t1 WRITE;
+ <table name="t1">
+ <row>
+ <field name="a">1</field>
+ </row>
+ <row>
+ <field name="a">2</field>
+ </row>
+ </table>
+UNLOCK TABLES;
+</database>
+</mysqldump>
+DROP TABLE t1;
diff --git a/mysql-test/r/openssl_1.result b/mysql-test/r/openssl_1.result
index afc4b12a341..4cf6bee6123 100644
--- a/mysql-test/r/openssl_1.result
+++ b/mysql-test/r/openssl_1.result
@@ -3,29 +3,29 @@ create table t1(f1 int);
insert into t1 values (5);
grant select on test.* to ssl_user1@localhost require SSL;
grant select on test.* to ssl_user2@localhost require cipher "EDH-RSA-DES-CBC3-SHA";
-grant select on test.* to ssl_user3@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "/C=RU/L=orenburg/O=MySQL AB/OU=client/CN=walrus/Email=walrus@mysql.com";
-grant select on test.* to ssl_user4@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "/C=RU/L=orenburg/O=MySQL AB/OU=client/CN=walrus/Email=walrus@mysql.com" ISSUER "/C=RU/ST=Some-State/L=Orenburg/O=MySQL AB/CN=Walrus/Email=walrus@mysql.com";
+grant select on test.* to ssl_user3@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com";
+grant select on test.* to ssl_user4@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com" ISSUER "/C=SE/L=Uppsala/O=MySQL AB/CN=Abstract MySQL Developer/Email=abstract.mysql.developer@mysql.com";
flush privileges;
select * from t1;
f1
5
delete from t1;
-ERROR 42000: Access denied for user: 'ssl_user1@localhost' to database 'test'
+ERROR 42000: Access denied for user: 'ssl_user1'@'localhost' to database 'test'
select * from t1;
f1
5
delete from t1;
-ERROR 42000: Access denied for user: 'ssl_user2@localhost' to database 'test'
+ERROR 42000: Access denied for user: 'ssl_user2'@'localhost' to database 'test'
select * from t1;
f1
5
delete from t1;
-ERROR 42000: Access denied for user: 'ssl_user3@localhost' to database 'test'
+ERROR 42000: Access denied for user: 'ssl_user3'@'localhost' to database 'test'
select * from t1;
f1
5
delete from t1;
-ERROR 42000: Access denied for user: 'ssl_user4@localhost' to database 'test'
+ERROR 42000: Access denied for user: 'ssl_user4'@'localhost' to database 'test'
delete from mysql.user where user='ssl_user%';
delete from mysql.db where user='ssl_user%';
flush privileges;
diff --git a/mysql-test/r/packet.result b/mysql-test/r/packet.result
index 6e3c459b39d..5729d7af166 100644
--- a/mysql-test/r/packet.result
+++ b/mysql-test/r/packet.result
@@ -5,12 +5,12 @@ set net_buffer_length=100;
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
len
1024
-select repeat('a',200);
-repeat('a',200)
+select repeat('a',2000);
+repeat('a',2000)
NULL
select @@net_buffer_length, @@max_allowed_packet;
@@net_buffer_length @@max_allowed_packet
-1024 80
+1024 1024
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
ERROR 08S01: Got a packet bigger than 'max_allowed_packet'
set global max_allowed_packet=default;
@@ -20,6 +20,6 @@ set net_buffer_length=default;
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
len
100
-select length(repeat('a',200));
-length(repeat('a',200))
-200
+select length(repeat('a',2000));
+length(repeat('a',2000))
+2000
diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result
index 420281b7ef2..d1ef5ab828e 100644
--- a/mysql-test/r/query_cache.result
+++ b/mysql-test/r/query_cache.result
@@ -2,7 +2,7 @@ flush query cache;
flush query cache;
reset query cache;
flush status;
-drop table if exists t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t00,mysqltest.t1;
+drop table if exists t1,t2,t3;
drop database if exists mysqltest;
create table t1 (a int not null);
insert into t1 values (1),(2),(3);
@@ -709,536 +709,3 @@ Variable_name Value
Qcache_queries_in_cache 2
SET OPTION SQL_SELECT_LIMIT=DEFAULT;
drop table t1;
-flush status;
-create table t0(a int);
-create table t1(a int);
-create table t2(a int);
-create table t3(a int);
-create table t4(a int);
-create table t5(a int);
-create table t6(a int);
-create table t7(a int);
-create table t8(a int);
-create table t9(a int);
-create table t10(a int);
-create table t11(a int);
-create table t12(a int);
-create table t13(a int);
-create table t14(a int);
-create table t15(a int);
-create table t16(a int);
-create table t17(a int);
-create table t18(a int);
-create table t19(a int);
-create table t20(a int);
-create table t21(a int);
-create table t22(a int);
-create table t23(a int);
-create table t24(a int);
-create table t25(a int);
-create table t26(a int);
-create table t27(a int);
-create table t28(a int);
-create table t29(a int);
-create table t30(a int);
-create table t31(a int);
-create table t32(a int);
-create table t33(a int);
-create table t34(a int);
-create table t35(a int);
-create table t36(a int);
-create table t37(a int);
-create table t38(a int);
-create table t39(a int);
-create table t40(a int);
-create table t41(a int);
-create table t42(a int);
-create table t43(a int);
-create table t44(a int);
-create table t45(a int);
-create table t46(a int);
-create table t47(a int);
-create table t48(a int);
-create table t49(a int);
-create table t50(a int);
-create table t51(a int);
-create table t52(a int);
-create table t53(a int);
-create table t54(a int);
-create table t55(a int);
-create table t56(a int);
-create table t57(a int);
-create table t58(a int);
-create table t59(a int);
-create table t60(a int);
-create table t61(a int);
-create table t62(a int);
-create table t63(a int);
-create table t64(a int);
-create table t65(a int);
-create table t66(a int);
-create table t67(a int);
-create table t68(a int);
-create table t69(a int);
-create table t70(a int);
-create table t71(a int);
-create table t72(a int);
-create table t73(a int);
-create table t74(a int);
-create table t75(a int);
-create table t76(a int);
-create table t77(a int);
-create table t78(a int);
-create table t79(a int);
-create table t80(a int);
-create table t81(a int);
-create table t82(a int);
-create table t83(a int);
-create table t84(a int);
-create table t85(a int);
-create table t86(a int);
-create table t87(a int);
-create table t88(a int);
-create table t89(a int);
-create table t90(a int);
-create table t91(a int);
-create table t92(a int);
-create table t93(a int);
-create table t94(a int);
-create table t95(a int);
-create table t96(a int);
-create table t97(a int);
-create table t98(a int);
-create table t99(a int);
-create table t100(a int);
-create table t101(a int);
-create table t102(a int);
-create table t103(a int);
-create table t104(a int);
-create table t105(a int);
-create table t106(a int);
-create table t107(a int);
-create table t108(a int);
-create table t109(a int);
-create table t110(a int);
-create table t111(a int);
-create table t112(a int);
-create table t113(a int);
-create table t114(a int);
-create table t115(a int);
-create table t116(a int);
-create table t117(a int);
-create table t118(a int);
-create table t119(a int);
-create table t120(a int);
-create table t121(a int);
-create table t122(a int);
-create table t123(a int);
-create table t124(a int);
-create table t125(a int);
-create table t126(a int);
-create table t127(a int);
-create table t128(a int);
-create table t129(a int);
-create table t130(a int);
-create table t131(a int);
-create table t132(a int);
-create table t133(a int);
-create table t134(a int);
-create table t135(a int);
-create table t136(a int);
-create table t137(a int);
-create table t138(a int);
-create table t139(a int);
-create table t140(a int);
-create table t141(a int);
-create table t142(a int);
-create table t143(a int);
-create table t144(a int);
-create table t145(a int);
-create table t146(a int);
-create table t147(a int);
-create table t148(a int);
-create table t149(a int);
-create table t150(a int);
-create table t151(a int);
-create table t152(a int);
-create table t153(a int);
-create table t154(a int);
-create table t155(a int);
-create table t156(a int);
-create table t157(a int);
-create table t158(a int);
-create table t159(a int);
-create table t160(a int);
-create table t161(a int);
-create table t162(a int);
-create table t163(a int);
-create table t164(a int);
-create table t165(a int);
-create table t166(a int);
-create table t167(a int);
-create table t168(a int);
-create table t169(a int);
-create table t170(a int);
-create table t171(a int);
-create table t172(a int);
-create table t173(a int);
-create table t174(a int);
-create table t175(a int);
-create table t176(a int);
-create table t177(a int);
-create table t178(a int);
-create table t179(a int);
-create table t180(a int);
-create table t181(a int);
-create table t182(a int);
-create table t183(a int);
-create table t184(a int);
-create table t185(a int);
-create table t186(a int);
-create table t187(a int);
-create table t188(a int);
-create table t189(a int);
-create table t190(a int);
-create table t191(a int);
-create table t192(a int);
-create table t193(a int);
-create table t194(a int);
-create table t195(a int);
-create table t196(a int);
-create table t197(a int);
-create table t198(a int);
-create table t199(a int);
-create table t200(a int);
-create table t201(a int);
-create table t202(a int);
-create table t203(a int);
-create table t204(a int);
-create table t205(a int);
-create table t206(a int);
-create table t207(a int);
-create table t208(a int);
-create table t209(a int);
-create table t210(a int);
-create table t211(a int);
-create table t212(a int);
-create table t213(a int);
-create table t214(a int);
-create table t215(a int);
-create table t216(a int);
-create table t217(a int);
-create table t218(a int);
-create table t219(a int);
-create table t220(a int);
-create table t221(a int);
-create table t222(a int);
-create table t223(a int);
-create table t224(a int);
-create table t225(a int);
-create table t226(a int);
-create table t227(a int);
-create table t228(a int);
-create table t229(a int);
-create table t230(a int);
-create table t231(a int);
-create table t232(a int);
-create table t233(a int);
-create table t234(a int);
-create table t235(a int);
-create table t236(a int);
-create table t237(a int);
-create table t238(a int);
-create table t239(a int);
-create table t240(a int);
-create table t241(a int);
-create table t242(a int);
-create table t243(a int);
-create table t244(a int);
-create table t245(a int);
-create table t246(a int);
-create table t247(a int);
-create table t248(a int);
-create table t249(a int);
-create table t250(a int);
-create table t251(a int);
-create table t252(a int);
-create table t253(a int);
-create table t254(a int);
-create table t255(a int);
-create table t256(a int);
-create table t00 (a int) type=MERGE UNION=(t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256) INSERT_METHOD=FIRST;
-insert into t0 values (1),(2);
-insert into t1 values (1),(2);
-insert into t2 values (1),(2);
-insert into t3 values (1),(2);
-insert into t4 values (1),(2);
-insert into t5 values (1),(2);
-insert into t6 values (1),(2);
-insert into t7 values (1),(2);
-insert into t8 values (1),(2);
-insert into t9 values (1),(2);
-insert into t10 values (1),(2);
-insert into t11 values (1),(2);
-insert into t12 values (1),(2);
-insert into t13 values (1),(2);
-insert into t14 values (1),(2);
-insert into t15 values (1),(2);
-insert into t16 values (1),(2);
-insert into t17 values (1),(2);
-insert into t18 values (1),(2);
-insert into t19 values (1),(2);
-insert into t20 values (1),(2);
-insert into t21 values (1),(2);
-insert into t22 values (1),(2);
-insert into t23 values (1),(2);
-insert into t24 values (1),(2);
-insert into t25 values (1),(2);
-insert into t26 values (1),(2);
-insert into t27 values (1),(2);
-insert into t28 values (1),(2);
-insert into t29 values (1),(2);
-insert into t30 values (1),(2);
-insert into t31 values (1),(2);
-insert into t32 values (1),(2);
-insert into t33 values (1),(2);
-insert into t34 values (1),(2);
-insert into t35 values (1),(2);
-insert into t36 values (1),(2);
-insert into t37 values (1),(2);
-insert into t38 values (1),(2);
-insert into t39 values (1),(2);
-insert into t40 values (1),(2);
-insert into t41 values (1),(2);
-insert into t42 values (1),(2);
-insert into t43 values (1),(2);
-insert into t44 values (1),(2);
-insert into t45 values (1),(2);
-insert into t46 values (1),(2);
-insert into t47 values (1),(2);
-insert into t48 values (1),(2);
-insert into t49 values (1),(2);
-insert into t50 values (1),(2);
-insert into t51 values (1),(2);
-insert into t52 values (1),(2);
-insert into t53 values (1),(2);
-insert into t54 values (1),(2);
-insert into t55 values (1),(2);
-insert into t56 values (1),(2);
-insert into t57 values (1),(2);
-insert into t58 values (1),(2);
-insert into t59 values (1),(2);
-insert into t60 values (1),(2);
-insert into t61 values (1),(2);
-insert into t62 values (1),(2);
-insert into t63 values (1),(2);
-insert into t64 values (1),(2);
-insert into t65 values (1),(2);
-insert into t66 values (1),(2);
-insert into t67 values (1),(2);
-insert into t68 values (1),(2);
-insert into t69 values (1),(2);
-insert into t70 values (1),(2);
-insert into t71 values (1),(2);
-insert into t72 values (1),(2);
-insert into t73 values (1),(2);
-insert into t74 values (1),(2);
-insert into t75 values (1),(2);
-insert into t76 values (1),(2);
-insert into t77 values (1),(2);
-insert into t78 values (1),(2);
-insert into t79 values (1),(2);
-insert into t80 values (1),(2);
-insert into t81 values (1),(2);
-insert into t82 values (1),(2);
-insert into t83 values (1),(2);
-insert into t84 values (1),(2);
-insert into t85 values (1),(2);
-insert into t86 values (1),(2);
-insert into t87 values (1),(2);
-insert into t88 values (1),(2);
-insert into t89 values (1),(2);
-insert into t90 values (1),(2);
-insert into t91 values (1),(2);
-insert into t92 values (1),(2);
-insert into t93 values (1),(2);
-insert into t94 values (1),(2);
-insert into t95 values (1),(2);
-insert into t96 values (1),(2);
-insert into t97 values (1),(2);
-insert into t98 values (1),(2);
-insert into t99 values (1),(2);
-insert into t100 values (1),(2);
-insert into t101 values (1),(2);
-insert into t102 values (1),(2);
-insert into t103 values (1),(2);
-insert into t104 values (1),(2);
-insert into t105 values (1),(2);
-insert into t106 values (1),(2);
-insert into t107 values (1),(2);
-insert into t108 values (1),(2);
-insert into t109 values (1),(2);
-insert into t110 values (1),(2);
-insert into t111 values (1),(2);
-insert into t112 values (1),(2);
-insert into t113 values (1),(2);
-insert into t114 values (1),(2);
-insert into t115 values (1),(2);
-insert into t116 values (1),(2);
-insert into t117 values (1),(2);
-insert into t118 values (1),(2);
-insert into t119 values (1),(2);
-insert into t120 values (1),(2);
-insert into t121 values (1),(2);
-insert into t122 values (1),(2);
-insert into t123 values (1),(2);
-insert into t124 values (1),(2);
-insert into t125 values (1),(2);
-insert into t126 values (1),(2);
-insert into t127 values (1),(2);
-insert into t128 values (1),(2);
-insert into t129 values (1),(2);
-insert into t130 values (1),(2);
-insert into t131 values (1),(2);
-insert into t132 values (1),(2);
-insert into t133 values (1),(2);
-insert into t134 values (1),(2);
-insert into t135 values (1),(2);
-insert into t136 values (1),(2);
-insert into t137 values (1),(2);
-insert into t138 values (1),(2);
-insert into t139 values (1),(2);
-insert into t140 values (1),(2);
-insert into t141 values (1),(2);
-insert into t142 values (1),(2);
-insert into t143 values (1),(2);
-insert into t144 values (1),(2);
-insert into t145 values (1),(2);
-insert into t146 values (1),(2);
-insert into t147 values (1),(2);
-insert into t148 values (1),(2);
-insert into t149 values (1),(2);
-insert into t150 values (1),(2);
-insert into t151 values (1),(2);
-insert into t152 values (1),(2);
-insert into t153 values (1),(2);
-insert into t154 values (1),(2);
-insert into t155 values (1),(2);
-insert into t156 values (1),(2);
-insert into t157 values (1),(2);
-insert into t158 values (1),(2);
-insert into t159 values (1),(2);
-insert into t160 values (1),(2);
-insert into t161 values (1),(2);
-insert into t162 values (1),(2);
-insert into t163 values (1),(2);
-insert into t164 values (1),(2);
-insert into t165 values (1),(2);
-insert into t166 values (1),(2);
-insert into t167 values (1),(2);
-insert into t168 values (1),(2);
-insert into t169 values (1),(2);
-insert into t170 values (1),(2);
-insert into t171 values (1),(2);
-insert into t172 values (1),(2);
-insert into t173 values (1),(2);
-insert into t174 values (1),(2);
-insert into t175 values (1),(2);
-insert into t176 values (1),(2);
-insert into t177 values (1),(2);
-insert into t178 values (1),(2);
-insert into t179 values (1),(2);
-insert into t180 values (1),(2);
-insert into t181 values (1),(2);
-insert into t182 values (1),(2);
-insert into t183 values (1),(2);
-insert into t184 values (1),(2);
-insert into t185 values (1),(2);
-insert into t186 values (1),(2);
-insert into t187 values (1),(2);
-insert into t188 values (1),(2);
-insert into t189 values (1),(2);
-insert into t190 values (1),(2);
-insert into t191 values (1),(2);
-insert into t192 values (1),(2);
-insert into t193 values (1),(2);
-insert into t194 values (1),(2);
-insert into t195 values (1),(2);
-insert into t196 values (1),(2);
-insert into t197 values (1),(2);
-insert into t198 values (1),(2);
-insert into t199 values (1),(2);
-insert into t200 values (1),(2);
-insert into t201 values (1),(2);
-insert into t202 values (1),(2);
-insert into t203 values (1),(2);
-insert into t204 values (1),(2);
-insert into t205 values (1),(2);
-insert into t206 values (1),(2);
-insert into t207 values (1),(2);
-insert into t208 values (1),(2);
-insert into t209 values (1),(2);
-insert into t210 values (1),(2);
-insert into t211 values (1),(2);
-insert into t212 values (1),(2);
-insert into t213 values (1),(2);
-insert into t214 values (1),(2);
-insert into t215 values (1),(2);
-insert into t216 values (1),(2);
-insert into t217 values (1),(2);
-insert into t218 values (1),(2);
-insert into t219 values (1),(2);
-insert into t220 values (1),(2);
-insert into t221 values (1),(2);
-insert into t222 values (1),(2);
-insert into t223 values (1),(2);
-insert into t224 values (1),(2);
-insert into t225 values (1),(2);
-insert into t226 values (1),(2);
-insert into t227 values (1),(2);
-insert into t228 values (1),(2);
-insert into t229 values (1),(2);
-insert into t230 values (1),(2);
-insert into t231 values (1),(2);
-insert into t232 values (1),(2);
-insert into t233 values (1),(2);
-insert into t234 values (1),(2);
-insert into t235 values (1),(2);
-insert into t236 values (1),(2);
-insert into t237 values (1),(2);
-insert into t238 values (1),(2);
-insert into t239 values (1),(2);
-insert into t240 values (1),(2);
-insert into t241 values (1),(2);
-insert into t242 values (1),(2);
-insert into t243 values (1),(2);
-insert into t244 values (1),(2);
-insert into t245 values (1),(2);
-insert into t246 values (1),(2);
-insert into t247 values (1),(2);
-insert into t248 values (1),(2);
-insert into t249 values (1),(2);
-insert into t250 values (1),(2);
-insert into t251 values (1),(2);
-insert into t252 values (1),(2);
-insert into t253 values (1),(2);
-insert into t254 values (1),(2);
-insert into t255 values (1),(2);
-insert into t256 values (1),(2);
-select count(*) from t00;
-count(*)
-514
-select count(*) from t00;
-count(*)
-514
-show status like "Qcache_queries_in_cache";
-Variable_name Value
-Qcache_queries_in_cache 1
-show status like "Qcache_hits";
-Variable_name Value
-Qcache_hits 1
-delete from t256;
-show status like "Qcache_queries_in_cache";
-Variable_name Value
-Qcache_queries_in_cache 0
-drop table t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t00;
diff --git a/mysql-test/r/query_cache_merge.result b/mysql-test/r/query_cache_merge.result
new file mode 100644
index 00000000000..c6df4266de2
--- /dev/null
+++ b/mysql-test/r/query_cache_merge.result
@@ -0,0 +1,20 @@
+SET @@global.query_cache_size=1355776;
+flush status;
+select count(*) from t00;
+count(*)
+514
+select count(*) from t00;
+count(*)
+514
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 1
+delete from t256;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257,t00;
+SET @@global.query_cache_size=0;
diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result
index f59b1989a34..9f76676ee1a 100644
--- a/mysql-test/r/range.result
+++ b/mysql-test/r/range.result
@@ -1,4 +1,4 @@
-drop table if exists t1, t2;
+drop table if exists t1;
CREATE TABLE t1 (
event_date date DEFAULT '0000-00-00' NOT NULL,
type int(11) DEFAULT '0' NOT NULL,
@@ -226,134 +226,63 @@ insert into t1 values (0,1,NULL,"aaa"), (1,1,NULL,"aaa"), (2,1,NULL,"aaa"),
select a.id1, b.idnull from t1 as a, t1 as b where a.id2=1 and a.id1=1 and b.id1=a.idnull order by b.id2 desc limit 1;
id1 idnull
drop table t1;
-create table t1 (
-id int not null auto_increment,
-name char(1) not null,
-uid int not null,
-primary key (id),
-index uid_index (uid));
-create table t2 (
-id int not null auto_increment,
-name char(1) not null,
-uid int not null,
-primary key (id),
-index uid_index (uid));
-insert into t1(id, uid, name) values(1, 0, ' ');
-insert into t1(uid, name) values(0, ' ');
-insert into t2(uid, name) select uid, name from t1;
-insert into t1(uid, name) select uid, name from t2;
-insert into t2(uid, name) select uid, name from t1;
-insert into t1(uid, name) select uid, name from t2;
-insert into t2(uid, name) select uid, name from t1;
-insert into t1(uid, name) select uid, name from t2;
-insert into t2(uid, name) select uid, name from t1;
-insert into t1(uid, name) select uid, name from t2;
-insert into t2(uid, name) select uid, name from t1;
-insert into t1(uid, name) select uid, name from t2;
-insert into t2(uid, name) select uid, name from t1;
-insert into t2(uid, name) select uid, name from t1;
-insert into t2(uid, name) select uid, name from t1;
-insert into t2(uid, name) select uid, name from t1;
-insert into t1(uid, name) select uid, name from t2;
-delete from t2;
-insert into t2(uid, name) values
-(1, CHAR(64+1)),
-(2, CHAR(64+2)),
-(3, CHAR(64+3)),
-(4, CHAR(64+4)),
-(5, CHAR(64+5)),
-(6, CHAR(64+6)),
-(7, CHAR(64+7)),
-(8, CHAR(64+8)),
-(9, CHAR(64+9)),
-(10, CHAR(64+10)),
-(11, CHAR(64+11)),
-(12, CHAR(64+12)),
-(13, CHAR(64+13)),
-(14, CHAR(64+14)),
-(15, CHAR(64+15)),
-(16, CHAR(64+16)),
-(17, CHAR(64+17)),
-(18, CHAR(64+18)),
-(19, CHAR(64+19)),
-(20, CHAR(64+20)),
-(21, CHAR(64+21)),
-(22, CHAR(64+22)),
-(23, CHAR(64+23)),
-(24, CHAR(64+24)),
-(25, CHAR(64+25)),
-(26, CHAR(64+26));
-insert into t1(uid, name) select uid, name from t2;
-delete from t2;
-insert into t2(id, uid, name) select id, uid, name from t1;
-select count(*) from t1;
-count(*)
-1026
-select count(*) from t2;
-count(*)
-1026
-explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0;
+create table t1 (x int, y int, index(x), index(y));
+insert into t1 (x) values (1),(2),(3),(4),(5),(6),(7),(8),(9);
+update t1 set y=x;
+explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 7 and t1.y+0;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref y y 5 const 1 Using where
+1 SIMPLE t2 range x x 5 NULL 4 Using where
+explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 7 and t2.x <= t1.y+0;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref y y 5 const 1 Using where
+1 SIMPLE t2 range x x 5 NULL 4 Using where
+explain select * from t1, t1 t2 where t1.y = 2 and t2.x between t1.y-1 and t1.y+1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref y y 5 const 1 Using where
+1 SIMPLE t2 ALL x NULL NULL NULL 9 Range checked for each record (index map: 1)
+explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= t1.y-1 and t2.x <= t1.y+1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref y y 5 const 1 Using where
+1 SIMPLE t2 ALL x NULL NULL NULL 9 Range checked for each record (index map: 1)
+explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 0 and t1.y;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range uid_index uid_index 4 NULL 128 Using where
-1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 38
-explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid != 0;
+1 SIMPLE t1 ref y y 5 const 1 Using where
+1 SIMPLE t2 ALL x NULL NULL NULL 9 Using where
+explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 0 and t2.x <= t1.y;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range uid_index uid_index 4 NULL 129 Using where
-1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 38
-select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0;
-id name uid id name uid
-1001 A 1 1001 A 1
-1002 B 2 1002 B 2
-1003 C 3 1003 C 3
-1004 D 4 1004 D 4
-1005 E 5 1005 E 5
-1006 F 6 1006 F 6
-1007 G 7 1007 G 7
-1008 H 8 1008 H 8
-1009 I 9 1009 I 9
-1010 J 10 1010 J 10
-1011 K 11 1011 K 11
-1012 L 12 1012 L 12
-1013 M 13 1013 M 13
-1014 N 14 1014 N 14
-1015 O 15 1015 O 15
-1016 P 16 1016 P 16
-1017 Q 17 1017 Q 17
-1018 R 18 1018 R 18
-1019 S 19 1019 S 19
-1020 T 20 1020 T 20
-1021 U 21 1021 U 21
-1022 V 22 1022 V 22
-1023 W 23 1023 W 23
-1024 X 24 1024 X 24
-1025 Y 25 1025 Y 25
-1026 Z 26 1026 Z 26
-select * from t1, t2 where t1.uid=t2.uid AND t1.uid != 0;
-id name uid id name uid
-1001 A 1 1001 A 1
-1002 B 2 1002 B 2
-1003 C 3 1003 C 3
-1004 D 4 1004 D 4
-1005 E 5 1005 E 5
-1006 F 6 1006 F 6
-1007 G 7 1007 G 7
-1008 H 8 1008 H 8
-1009 I 9 1009 I 9
-1010 J 10 1010 J 10
-1011 K 11 1011 K 11
-1012 L 12 1012 L 12
-1013 M 13 1013 M 13
-1014 N 14 1014 N 14
-1015 O 15 1015 O 15
-1016 P 16 1016 P 16
-1017 Q 17 1017 Q 17
-1018 R 18 1018 R 18
-1019 S 19 1019 S 19
-1020 T 20 1020 T 20
-1021 U 21 1021 U 21
-1022 V 22 1022 V 22
-1023 W 23 1023 W 23
-1024 X 24 1024 X 24
-1025 Y 25 1025 Y 25
-1026 Z 26 1026 Z 26
-drop table t1,t2;
+1 SIMPLE t1 ref y y 5 const 1 Using where
+1 SIMPLE t2 range x x 5 NULL 2 Using where
+explain select count(*) from t1 where x in (1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range x x 5 NULL 1 Using where; Using index
+explain select count(*) from t1 where x in (1,2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range x x 5 NULL 2 Using where; Using index
+drop table t1;
+CREATE TABLE t1 (key1 int(11) NOT NULL default '0', KEY i1 (key1), KEY i2 (key1));
+INSERT INTO t1 VALUES (0),(0),(1),(1);
+CREATE TABLE t2 (keya int(11) NOT NULL default '0', KEY j1 (keya));
+INSERT INTO t2 VALUES (0),(0),(1),(1),(2),(2);
+explain select * from t1, t2 where (t1.key1 <t2.keya + 1) and t2.keya=3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref j1 j1 4 const 1 Using where; Using index
+1 SIMPLE t1 ALL i1,i2 NULL NULL NULL 4 Range checked for each record (index map: 3)
+explain select * from t1 force index(i2), t2 where (t1.key1 <t2.keya + 1) and t2.keya=3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref j1 j1 4 const 1 Using where; Using index
+1 SIMPLE t1 ALL i2 NULL NULL NULL 4 Range checked for each record (index map: 2)
+DROP TABLE t1,t2;
+create table t1 (id int(10) primary key);
+insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9);
+select id from t1 where id in (2,5,9) ;
+id
+2
+5
+9
+select id from t1 where id=2 or id=5 or id=9 ;
+id
+2
+5
+9
+drop table t1;
diff --git a/mysql-test/r/rpl000015.result b/mysql-test/r/rpl000015.result
index 047f1ac5044..0166c49ddb2 100644
--- a/mysql-test/r/rpl000015.result
+++ b/mysql-test/r/rpl000015.result
@@ -4,20 +4,20 @@ File Position Binlog_do_db Binlog_ignore_db
master-bin.000001 79
reset slave;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
change master to master_host='127.0.0.1';
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 test MASTER_PORT 7 4 slave-relay-bin.000001 4 No No 0 0 0 4
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
+127.0.0.1 test MASTER_PORT 7 4 slave-relay-bin.000001 4 No No 0 0 0 4 None 0 No
change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=MASTER_PORT;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 7 4 slave-relay-bin.000001 4 No No 0 0 0 4
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
+127.0.0.1 root MASTER_PORT 7 4 slave-relay-bin.000001 4 No No 0 0 0 4 None 0 No
start slave;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 7 master-bin.000001 79 slave-relay-bin.000001 123 master-bin.000001 Yes Yes 0 0 79 123
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
+127.0.0.1 root MASTER_PORT 7 master-bin.000001 79 slave-relay-bin.000001 123 master-bin.000001 Yes Yes 0 0 79 123 None 0 No
drop table if exists t1;
create table t1 (n int);
insert into t1 values (10),(45),(90);
diff --git a/mysql-test/r/rpl_empty_master_crash.result b/mysql-test/r/rpl_empty_master_crash.result
index 6aac1cbfc91..b44ba841e00 100644
--- a/mysql-test/r/rpl_empty_master_crash.result
+++ b/mysql-test/r/rpl_empty_master_crash.result
@@ -5,7 +5,7 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
load table t1 from master;
ERROR 08S01: Error connecting to master: Master is not configured
load table t1 from master;
diff --git a/mysql-test/r/rpl_error_ignored_table.result b/mysql-test/r/rpl_error_ignored_table.result
index f22b62838bb..961c8fcd91d 100644
--- a/mysql-test/r/rpl_error_ignored_table.result
+++ b/mysql-test/r/rpl_error_ignored_table.result
@@ -8,8 +8,8 @@ create table t1 (a int primary key);
insert into t1 values (1),(1);
ERROR 23000: Duplicate entry '1' for key 1
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 1 master-bin.000001 213 slave-relay-bin.000002 257 master-bin.000001 Yes Yes test.t1 0 0 213 257
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
+127.0.0.1 root MASTER_PORT 1 master-bin.000001 213 slave-relay-bin.000002 257 master-bin.000001 Yes Yes test.t1 0 0 213 257 None 0 No
show tables like 't1';
Tables_in_test (t1)
drop table t1;
diff --git a/mysql-test/r/rpl_flush_log_loop.result b/mysql-test/r/rpl_flush_log_loop.result
index a1709647f19..18e09f33ff7 100644
--- a/mysql-test/r/rpl_flush_log_loop.result
+++ b/mysql-test/r/rpl_flush_log_loop.result
@@ -13,5 +13,5 @@ master_password='',master_port=SLAVE_PORT;
start slave;
flush logs;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root SLAVE_PORT 60 slave-bin.000001 79 relay-log.000002 4 slave-bin.000001 Yes Yes 0 0 79 4
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
+127.0.0.1 root SLAVE_PORT 60 slave-bin.000001 79 relay-log.000002 4 slave-bin.000001 Yes Yes 0 0 79 4 None 0 No
diff --git a/mysql-test/r/rpl_loaddata.result b/mysql-test/r/rpl_loaddata.result
index 55dcf2f4f0f..d722cb295ce 100644
--- a/mysql-test/r/rpl_loaddata.result
+++ b/mysql-test/r/rpl_loaddata.result
@@ -4,6 +4,7 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
+reset master;
create table t1(a int not null auto_increment, b int, primary key(a) );
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
create temporary table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60));
@@ -19,6 +20,9 @@ day id category name
2003-02-22 2461 b a a a @ %  ' " a
2003-03-22 2161 c asdf
2003-04-22 2416 a bbbbb
+show master status;
+File Position Binlog_do_db Binlog_ignore_db
+slave-bin.000001 964
drop table t1;
drop table t2;
drop table t3;
@@ -28,8 +32,8 @@ load data infile '../../std_data/rpl_loaddata.dat' into table t1;
set global sql_slave_skip_counter=1;
start slave;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 1 master-bin.000001 1311 slave-relay-bin.000002 1355 master-bin.000001 Yes Yes 0 0 1311 1355
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
+127.0.0.1 root MASTER_PORT 1 master-bin.000001 1311 slave-relay-bin.000002 1355 master-bin.000001 Yes Yes 0 0 1311 1355 None 0 No
set sql_log_bin=0;
delete from t1;
set sql_log_bin=1;
@@ -38,8 +42,8 @@ stop slave;
change master to master_user='test';
change master to master_user='root';
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 1 master-bin.000001 1442 slave-relay-bin.000001 4 master-bin.000001 No No 0 0 1442 4
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
+127.0.0.1 root MASTER_PORT 1 master-bin.000001 1442 slave-relay-bin.000001 4 master-bin.000001 No No 0 0 1442 4 None 0 No
set global sql_slave_skip_counter=1;
start slave;
set sql_log_bin=0;
@@ -49,5 +53,5 @@ load data infile '../../std_data/rpl_loaddata.dat' into table t1;
stop slave;
reset slave;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 1 4 slave-relay-bin.000001 4 No No 0 0 0 4
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
+127.0.0.1 root MASTER_PORT 1 4 slave-relay-bin.000001 4 No No 0 0 0 4 None 0 No
diff --git a/mysql-test/r/rpl_loaddata_rule_m.result b/mysql-test/r/rpl_loaddata_rule_m.result
new file mode 100644
index 00000000000..c98b3fb358f
--- /dev/null
+++ b/mysql-test/r/rpl_loaddata_rule_m.result
@@ -0,0 +1,14 @@
+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;
+reset master;
+create database test2;
+create table t1(a int, b int, unique(b));
+use test2;
+load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
+show binlog events from 79;
+Log_name Pos Event_type Server_id Orig_log_pos Info
+drop database test2;
diff --git a/mysql-test/r/rpl_loaddata_rule_s.result b/mysql-test/r/rpl_loaddata_rule_s.result
new file mode 100644
index 00000000000..26893cb1e9e
--- /dev/null
+++ b/mysql-test/r/rpl_loaddata_rule_s.result
@@ -0,0 +1,14 @@
+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;
+reset master;
+create table t1(a int, b int, unique(b));
+load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
+select count(*) from t1;
+count(*)
+2
+show binlog events from 79;
+Log_name Pos Event_type Server_id Orig_log_pos Info
diff --git a/mysql-test/r/rpl_log.result b/mysql-test/r/rpl_log.result
index ab45826a3e7..53e152c1834 100644
--- a/mysql-test/r/rpl_log.result
+++ b/mysql-test/r/rpl_log.result
@@ -12,7 +12,10 @@ create table t1(n int not null auto_increment primary key);
insert into t1 values (NULL);
drop table t1;
create table t1 (word char(20) not null);
-load data infile '../../std_data/words.dat' into table t1;
+load data infile '../../std_data/words.dat' into table t1 ignore 1 lines;
+select count(*) from t1;
+count(*)
+69
drop table t1;
show binlog events;
Log_name Pos Event_type Server_id Orig_log_pos Info
@@ -81,18 +84,18 @@ slave-bin.000001 200 Query 1 200 use `test`; insert into t1 values (NULL)
slave-bin.000001 263 Query 1 263 use `test`; drop table t1
slave-bin.000001 311 Query 1 311 use `test`; create table t1 (word char(20) not null)
slave-bin.000001 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=581
-slave-bin.000001 1065 Exec_load 1 1056 ;file_id=1
-slave-bin.000001 1088 Query 1 1079 use `test`; drop table t1
-slave-bin.000001 1136 Query 1 4 use `test`; create table t5 (a int)
-slave-bin.000001 1194 Query 1 62 use `test`; drop table t5
+slave-bin.000001 1065 Exec_load 1 1065 ;file_id=1
+slave-bin.000001 1088 Query 1 1088 use `test`; drop table t1
+slave-bin.000001 1136 Query 1 1136 use `test`; create table t5 (a int)
+slave-bin.000001 1194 Query 1 1194 use `test`; drop table t5
slave-bin.000001 1242 Rotate 2 1242 slave-bin.000002;pos=4
show binlog events in 'slave-bin.000002' from 4;
Log_name Pos Event_type Server_id Orig_log_pos Info
-slave-bin.000002 4 Query 1 110 use `test`; create table t1 (n int)
-slave-bin.000002 62 Query 1 168 use `test`; insert into t1 values (1)
-slave-bin.000002 122 Query 1 228 use `test`; drop table t1
+slave-bin.000002 4 Query 1 4 use `test`; create table t1 (n int)
+slave-bin.000002 62 Query 1 62 use `test`; insert into t1 values (1)
+slave-bin.000002 122 Query 1 122 use `test`; drop table t1
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 1 master-bin.000002 276 slave-relay-bin.000003 214 master-bin.000002 Yes Yes 0 0 276 214
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
+127.0.0.1 root MASTER_PORT 1 master-bin.000002 276 slave-relay-bin.000003 214 master-bin.000002 Yes Yes 0 0 276 214 None 0 No
show binlog events in 'slave-bin.000005' from 4;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
diff --git a/mysql-test/r/rpl_log_pos.result b/mysql-test/r/rpl_log_pos.result
index bc655b9b15a..7a796d52374 100644
--- a/mysql-test/r/rpl_log_pos.result
+++ b/mysql-test/r/rpl_log_pos.result
@@ -8,26 +8,26 @@ show master status;
File Position Binlog_do_db Binlog_ignore_db
master-bin.000001 79
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 1 master-bin.000001 79 slave-relay-bin.000002 123 master-bin.000001 Yes Yes 0 0 79 123
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
+127.0.0.1 root MASTER_PORT 1 master-bin.000001 79 slave-relay-bin.000002 123 master-bin.000001 Yes Yes 0 0 79 123 None 0 No
stop slave;
change master to master_log_pos=73;
start slave;
stop slave;
change master to master_log_pos=73;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 1 master-bin.000001 73 slave-relay-bin.000001 4 master-bin.000001 No No 0 0 73 4
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
+127.0.0.1 root MASTER_PORT 1 master-bin.000001 73 slave-relay-bin.000001 4 master-bin.000001 No No 0 0 73 4 None 0 No
start slave;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 1 master-bin.000001 73 slave-relay-bin.000001 48 master-bin.000001 No Yes 0 0 73 48
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
+127.0.0.1 root MASTER_PORT 1 master-bin.000001 73 slave-relay-bin.000001 48 master-bin.000001 No Yes 0 0 73 48 None 0 No
stop slave;
change master to master_log_pos=173;
start slave;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 1 master-bin.000001 173 slave-relay-bin.000001 4 master-bin.000001 No Yes 0 0 173 4
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
+127.0.0.1 root MASTER_PORT 1 master-bin.000001 173 slave-relay-bin.000001 4 master-bin.000001 No Yes 0 0 173 4 None 0 No
show master status;
File Position Binlog_do_db Binlog_ignore_db
master-bin.000001 79
diff --git a/mysql-test/r/rpl_max_relay_size.result b/mysql-test/r/rpl_max_relay_size.result
index 741b3538799..a8b5527f687 100644
--- a/mysql-test/r/rpl_max_relay_size.result
+++ b/mysql-test/r/rpl_max_relay_size.result
@@ -15,8 +15,8 @@ select @@global.max_relay_log_size;
4096
start slave;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 1 master-bin.000001 50477 slave-relay-bin.000014 1221 master-bin.000001 Yes Yes 0 0 50477 1221
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
+127.0.0.1 root MASTER_PORT 1 master-bin.000001 50477 slave-relay-bin.000014 1221 master-bin.000001 Yes Yes 0 0 50477 1221 None 0 No
stop slave;
reset slave;
set global max_relay_log_size=(5*4096);
@@ -25,8 +25,8 @@ select @@global.max_relay_log_size;
20480
start slave;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 1 master-bin.000001 50477 slave-relay-bin.000004 9457 master-bin.000001 Yes Yes 0 0 50477 9457
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
+127.0.0.1 root MASTER_PORT 1 master-bin.000001 50477 slave-relay-bin.000004 9457 master-bin.000001 Yes Yes 0 0 50477 9457 None 0 No
stop slave;
reset slave;
set global max_relay_log_size=0;
@@ -35,26 +35,26 @@ select @@global.max_relay_log_size;
0
start slave;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 1 master-bin.000001 50477 slave-relay-bin.000008 1283 master-bin.000001 Yes Yes 0 0 50477 1283
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
+127.0.0.1 root MASTER_PORT 1 master-bin.000001 50477 slave-relay-bin.000008 1283 master-bin.000001 Yes Yes 0 0 50477 1283 None 0 No
stop slave;
reset slave;
flush logs;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 1 4 slave-relay-bin.000001 4 No No 0 0 0 4
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
+127.0.0.1 root MASTER_PORT 1 4 slave-relay-bin.000001 4 No No 0 0 0 4 None 0 No
reset slave;
start slave;
flush logs;
create table t1 (a int);
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 1 master-bin.000001 50535 slave-relay-bin.000009 62 master-bin.000001 Yes Yes 0 0 50535 62
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
+127.0.0.1 root MASTER_PORT 1 master-bin.000001 50535 slave-relay-bin.000009 62 master-bin.000001 Yes Yes 0 0 50535 62 None 0 No
flush logs;
drop table t1;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 1 master-bin.000001 50583 slave-relay-bin.000010 52 master-bin.000001 Yes Yes 0 0 50583 52
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
+127.0.0.1 root MASTER_PORT 1 master-bin.000001 50583 slave-relay-bin.000010 52 master-bin.000001 Yes Yes 0 0 50583 52 None 0 No
flush logs;
show master status;
File Position Binlog_do_db Binlog_ignore_db
diff --git a/mysql-test/r/rpl_openssl.result b/mysql-test/r/rpl_openssl.result
new file mode 100644
index 00000000000..880facfe075
--- /dev/null
+++ b/mysql-test/r/rpl_openssl.result
@@ -0,0 +1,30 @@
+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;
+grant replication slave on *.* to replssl@'%' require ssl;
+create table t1 (t int);
+stop slave;
+change master to master_user='replssl',master_password='';
+start slave;
+insert into t1 values (1);
+select * from t1;
+t
+stop slave;
+change master to master_ssl=1 , master_ssl_ca ='MYSQL_TEST_DIR/std_data/cacert.pem', master_ssl_cert='MYSQL_TEST_DIR/std_data/client-cert.pem', master_ssl_key='MYSQL_TEST_DIR/std_data/client-key.pem';
+start slave;
+select * from t1;
+t
+1
+show slave status;
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
+127.0.0.1 replssl MASTER_MYPORT 1 master-bin.000001 289 slave-relay-bin.000001 108 master-bin.000001 Yes Yes 0 0 289 108 None 0 Yes MYSQL_TEST_DIR/std_data/cacert.pem MYSQL_TEST_DIR/std_data/client-cert.pem MYSQL_TEST_DIR/std_data/client-key.pem
+stop slave;
+change master to master_user='root',master_password='', master_ssl=0;
+start slave;
+drop table t1;
+show slave status;
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
+127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 337 slave-relay-bin.000001 96 master-bin.000001 Yes Yes 0 0 337 96 None 0 No MYSQL_TEST_DIR/std_data/cacert.pem MYSQL_TEST_DIR/std_data/client-cert.pem MYSQL_TEST_DIR/std_data/client-key.pem
diff --git a/mysql-test/r/rpl_redirect.result b/mysql-test/r/rpl_redirect.result
index 79ff6685706..b52c4a10b38 100644
--- a/mysql-test/r/rpl_redirect.result
+++ b/mysql-test/r/rpl_redirect.result
@@ -5,7 +5,7 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
SHOW SLAVE STATUS;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
SHOW SLAVE HOSTS;
Server_id Host Port Rpl_recovery_rank Master_id
2 127.0.0.1 SLAVE_PORT 2 1
diff --git a/mysql-test/r/rpl_replicate_do.result b/mysql-test/r/rpl_replicate_do.result
index ad92ee5b491..8288bd66a9d 100644
--- a/mysql-test/r/rpl_replicate_do.result
+++ b/mysql-test/r/rpl_replicate_do.result
@@ -27,5 +27,5 @@ select * from t11;
ERROR 42S02: Table 'test.t11' doesn't exist
drop table if exists t1,t2,t11;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 1 master-bin.000001 1281 slave-relay-bin.000002 1325 master-bin.000001 Yes Yes test.t1 0 0 1281 1325
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
+127.0.0.1 root MASTER_PORT 1 master-bin.000001 1281 slave-relay-bin.000002 1325 master-bin.000001 Yes Yes test.t1 0 0 1281 1325 None 0 No
diff --git a/mysql-test/r/rpl_reset_slave.result b/mysql-test/r/rpl_reset_slave.result
index 239c4158410..6318e3a0ecd 100644
--- a/mysql-test/r/rpl_reset_slave.result
+++ b/mysql-test/r/rpl_reset_slave.result
@@ -5,18 +5,18 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 1 master-bin.000001 79 slave-relay-bin.000002 123 master-bin.000001 Yes Yes 0 0 79 123
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
+127.0.0.1 root MASTER_PORT 1 master-bin.000001 79 slave-relay-bin.000002 123 master-bin.000001 Yes Yes 0 0 79 123 None 0 No
stop slave;
change master to master_user='test';
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 test MASTER_PORT 1 master-bin.000001 79 slave-relay-bin.000001 4 master-bin.000001 No No 0 0 79 4
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
+127.0.0.1 test MASTER_PORT 1 master-bin.000001 79 slave-relay-bin.000001 4 master-bin.000001 No No 0 0 79 4 None 0 No
reset slave;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 1 4 slave-relay-bin.000001 4 No No 0 0 0 4
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
+127.0.0.1 root MASTER_PORT 1 4 slave-relay-bin.000001 4 No No 0 0 0 4 None 0 No
start slave;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 1 master-bin.000001 79 slave-relay-bin.000002 123 master-bin.000001 Yes Yes 0 0 79 123
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
+127.0.0.1 root MASTER_PORT 1 master-bin.000001 79 slave-relay-bin.000002 123 master-bin.000001 Yes Yes 0 0 79 123 None 0 No
diff --git a/mysql-test/r/rpl_rotate_logs.result b/mysql-test/r/rpl_rotate_logs.result
index 7c5057c7fb2..73e578baf75 100644
--- a/mysql-test/r/rpl_rotate_logs.result
+++ b/mysql-test/r/rpl_rotate_logs.result
@@ -15,8 +15,8 @@ insert into temp_table values ("testing temporary tables");
create table t1 (s text);
insert into t1 values('Could not break slave'),('Tried hard');
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 60 master-bin.000001 417 slave-relay-bin.000001 461 master-bin.000001 Yes Yes 0 0 417 461
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
+127.0.0.1 root MASTER_PORT 60 master-bin.000001 417 slave-relay-bin.000001 461 master-bin.000001 Yes Yes 0 0 417 461 None 0 No
select * from t1;
s
Could not break slave
@@ -56,8 +56,8 @@ Log_name
master-bin.000003
insert into t2 values (65);
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 60 master-bin.000003 290 slave-relay-bin.000001 1088 master-bin.000003 Yes Yes 0 0 290 1088
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
+127.0.0.1 root MASTER_PORT 60 master-bin.000003 290 slave-relay-bin.000001 1088 master-bin.000003 Yes Yes 0 0 290 1088 None 0 No
select * from t2;
m
34
@@ -80,8 +80,8 @@ select * from t4;
a
testing temporary tables part 2
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 60 master-bin.000004 2886 slave-relay-bin.000001 7891 master-bin.000004 Yes Yes 0 0 2886 7891
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
+127.0.0.1 root MASTER_PORT 60 master-bin.000004 2886 slave-relay-bin.000001 7891 master-bin.000004 Yes Yes 0 0 2886 7891 None 0 No
lock tables t3 read;
select count(*) from t3 where n >= 4;
count(*)
diff --git a/mysql-test/r/rpl_until.result b/mysql-test/r/rpl_until.result
new file mode 100644
index 00000000000..3dc3de8802d
--- /dev/null
+++ b/mysql-test/r/rpl_until.result
@@ -0,0 +1,72 @@
+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;
+create table t1(n int not null auto_increment primary key);
+insert into t1 values (1),(2),(3),(4);
+drop table t1;
+create table t2(n int not null auto_increment primary key);
+insert into t2 values (1),(2);
+insert into t2 values (3),(4);
+drop table t2;
+show binlog events;
+Log_name Pos Event_type Server_id Orig_log_pos Info
+master-bin.000001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
+master-bin.000001 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key)
+master-bin.000001 172 Query 1 172 use `test`; insert into t1 values (1),(2),(3),(4)
+master-bin.000001 244 Query 1 244 use `test`; drop table t1
+master-bin.000001 292 Query 1 292 use `test`; create table t2(n int not null auto_increment primary key)
+master-bin.000001 385 Query 1 385 use `test`; insert into t2 values (1),(2)
+master-bin.000001 449 Query 1 449 use `test`; insert into t2 values (3),(4)
+master-bin.000001 513 Query 1 513 use `test`; drop table t2
+start slave until master_log_file='master-bin.000001', master_log_pos=244;
+select * from t1;
+n
+1
+2
+3
+4
+show slave status;
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
+127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 332 master-bin.000001 Yes No 0 0 244 649 Master master-bin.000001 244 No
+start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
+select * from t1;
+n
+1
+2
+3
+4
+show slave status;
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
+127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 332 master-bin.000001 Yes No 0 0 244 649 Master master-no-such-bin.000001 291 No
+start slave until relay_log_file='slave-relay-bin.000002', relay_log_pos=537;
+select * from t2;
+n
+1
+2
+show slave status;
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
+127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 537 master-bin.000001 Yes No 0 0 449 649 Relay slave-relay-bin.000002 537 No
+start slave;
+stop slave;
+start slave until master_log_file='master-bin.000001', master_log_pos=561;
+show slave status;
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
+127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 649 master-bin.000001 Yes No 0 0 561 693 Master master-bin.000001 561 No
+start slave until master_log_file='master-bin', master_log_pos=561;
+ERROR HY000: Wrong parameter or combination of parameters for START SLAVE UNTIL
+start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
+ERROR HY000: Wrong parameter or combination of parameters for START SLAVE UNTIL
+start slave until master_log_file='master-bin.000001';
+ERROR HY000: Wrong parameter or combination of parameters for START SLAVE UNTIL
+start slave until relay_log_file='slave-relay-bin.000002';
+ERROR HY000: Wrong parameter or combination of parameters for START SLAVE UNTIL
+start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
+ERROR HY000: Wrong parameter or combination of parameters for START SLAVE UNTIL
+start slave sql_thread;
+start slave until master_log_file='master-bin.000001', master_log_pos=561;
+Warnings:
+Note 1253 The slave was already running
diff --git a/mysql-test/r/sel000033.result b/mysql-test/r/sel000033.result
deleted file mode 100644
index 1bfafaf5b27..00000000000
--- a/mysql-test/r/sel000033.result
+++ /dev/null
@@ -1,14 +0,0 @@
-drop table if exists t1;
-create table t1 (id int(10) primary key);
-insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9);
-select id from t1 where id in (2,5,9) ;
-id
-2
-5
-9
-select id from t1 where id=2 or id=5 or id=9 ;
-id
-2
-5
-9
-drop table t1;
diff --git a/mysql-test/r/sel000100.result b/mysql-test/r/sel000100.result
deleted file mode 100644
index 3ffa4004b84..00000000000
--- a/mysql-test/r/sel000100.result
+++ /dev/null
@@ -1,38 +0,0 @@
-DROP TABLE IF EXISTS t1,t2;
-CREATE TABLE t1 (
-ID int(11) NOT NULL auto_increment,
-NAME varchar(75) DEFAULT '' NOT NULL,
-LINK_ID int(11) DEFAULT '0' NOT NULL,
-PRIMARY KEY (ID),
-KEY NAME (NAME),
-KEY LINK_ID (LINK_ID)
-);
-INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (1,'Mike',0);
-INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (2,'Jack',0);
-INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (3,'Bill',0);
-CREATE TABLE t2 (
-ID int(11) NOT NULL auto_increment,
-NAME varchar(150) DEFAULT '' NOT NULL,
-PRIMARY KEY (ID),
-KEY NAME (NAME)
-);
-SELECT DISTINCT
-t2.id AS key_link_id,
-t2.name AS link
-FROM t1
-LEFT JOIN t2 ON t1.link_id=t2.id
-GROUP BY t1.id
-ORDER BY link;
-key_link_id link
-NULL NULL
-drop table t1,t2;
-CREATE TABLE t1 (
-html varchar(5) default NULL,
-rin int(11) default '0',
-out int(11) default '0'
-) TYPE=MyISAM;
-INSERT INTO t1 VALUES ('1',1,0);
-SELECT DISTINCT html,SUM(out)/(SUM(rin)+1) as 'prod' FROM t1 GROUP BY rin;
-html prod
-1 0.00
-drop table t1;
diff --git a/mysql-test/r/select_safe.result b/mysql-test/r/select_safe.result
index 446dd41e216..4930d20f702 100644
--- a/mysql-test/r/select_safe.result
+++ b/mysql-test/r/select_safe.result
@@ -67,12 +67,12 @@ analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
insert into t1 values (null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a");
-explain select * from t1,t1 as t2 where t1.b=t2.b;
+explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL b NULL NULL NULL 21
1 SIMPLE t2 ALL b NULL NULL NULL 16 Using where
set MAX_SEEKS_FOR_KEY=1;
-explain select * from t1,t1 as t2 where t1.b=t2.b;
+explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL b NULL NULL NULL 21
1 SIMPLE t2 ref b b 21 test.t1.b 6 Using where
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index 201d1b541ae..2a5955e6d87 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -43,7 +43,7 @@ wait_timeout 28800
show variables like "this_doesn't_exists%";
Variable_name Value
show table status from test like "this_doesn't_exists%";
-Name Type Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Charset Create_options Comment
+Name Type Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
show databases;
Database
mysql
@@ -227,6 +227,12 @@ select * from t1;
type_bool type_tiny type_short type_mediumint type_bigint type_decimal type_numeric empty_char type_char type_varchar type_timestamp type_date type_time type_datetime type_year type_enum type_set type_tinyblob type_blob type_medium_blob type_long_blob
0 1 NULL NULL NULL NULL NULL NULL NULL NULL 2003-02-07 10:00:01 0000-00-00 00:00:00 0000-00-00 00:00:00 NULL NULL NULL NULL NULL NULL NULL
drop table t1;
+create table t1 (a int not null);
+create table t2 select max(a) from t1;
+show columns from t2;
+Field Type Null Key Default Extra
+max(a) bigint(20) YES NULL
+drop table t1,t2;
create table t1 (c decimal, d double, f float, r real);
show columns from t1;
Field Type Null Key Default Extra
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index cf02eda9aba..d29609f5f85 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -42,6 +42,9 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> system NULL NULL NULL NULL 1
3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
2 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1275 Field or reference 'a' of SELECT #3 was resolved in SELECT #1
+Note 1275 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
1
1
@@ -207,6 +210,8 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t4 ALL NULL NULL NULL NULL 3
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 Using where
+Warnings:
+Note 1275 Field or reference 't4.a' of SELECT #3 was resolved in SELECT #1
select * from t3 where exists (select * from t2 where t2.b=t3.a);
a
7
@@ -286,8 +291,11 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2
2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1
3 DEPENDENT UNION t5 ALL NULL NULL NULL NULL 2 Using where
+Warnings:
+Note 1275 Field or reference 't2.a' of SELECT #2 was resolved in SELECT #1
+Note 1275 Field or reference 't2.a' of SELECT #3 was resolved in SELECT #1
select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2;
-ERROR 21000: Subselect returns more than 1 record
+ERROR 21000: Subquery returns more than 1 record
create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq));
create table t7( uq int primary key, name char(25));
insert into t7 values(1,"Oblastnaia bolnitsa"),(2,"Bolnitsa Krasnogo Kresta");
@@ -301,6 +309,8 @@ explain select * from t6 where exists (select * from t7 where uq = clinic_uq);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t6 ALL NULL NULL NULL NULL 4 Using where
2 DEPENDENT SUBQUERY t7 eq_ref PRIMARY PRIMARY 4 test.t6.clinic_uq 1
+Warnings:
+Note 1275 Field or reference 'clinic_uq' of SELECT #2 was resolved in SELECT #1
select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
ERROR 23000: Column: 'a' in field list is ambiguous
drop table if exists t1,t2,t3;
@@ -344,7 +354,7 @@ SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce');
pseudo
joce
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo LIKE '%joce%');
-ERROR 21000: Subselect returns more than 1 record
+ERROR 21000: Subquery returns more than 1 record
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8;
CREATE TABLE `t1` (
`topic` mediumint(8) unsigned NOT NULL default '0',
@@ -374,7 +384,7 @@ SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION SELECT 1) UNION ALL SELECT 1;
1
1
SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION ALL SELECT 1) UNION SELECT 1;
-ERROR 21000: Subselect returns more than 1 record
+ERROR 21000: Subquery returns more than 1 record
EXPLAIN SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION SELECT 1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL topic 3 NULL 2 Using index
@@ -461,9 +471,9 @@ UNIQUE KEY `maxnumrep` (`maxnumrep`)
) TYPE=MyISAM ROW_FORMAT=FIXED;
INSERT INTO t1 (numeropost,maxnumrep) VALUES (1,0),(2,1);
select numeropost as a FROM t1 GROUP BY (SELECT 1 FROM t1 HAVING a=1);
-ERROR 21000: Subselect returns more than 1 record
+ERROR 21000: Subquery returns more than 1 record
select numeropost as a FROM t1 ORDER BY (SELECT 1 FROM t1 HAVING a=1);
-ERROR 21000: Subselect returns more than 1 record
+ERROR 21000: Subquery returns more than 1 record
drop table t1;
create table t1 (a int);
insert into t1 values (1),(2),(3);
@@ -476,7 +486,7 @@ drop table t1;
CREATE TABLE t1 (field char(1) NOT NULL DEFAULT 'b');
INSERT INTO t1 VALUES ();
SELECT field FROM t1 WHERE 1=(SELECT 1 UNION ALL SELECT 1 FROM (SELECT 1) a HAVING field='b');
-ERROR 21000: Subselect returns more than 1 record
+ERROR 21000: Subquery returns more than 1 record
drop table t1;
CREATE TABLE `t1` (
`numeropost` mediumint(8) unsigned NOT NULL default '0',
@@ -494,7 +504,7 @@ SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=1) FROM (SELECT
numreponse (SELECT numeropost FROM t1 HAVING numreponse=1)
INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test');
EXPLAIN SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1');
-ERROR 21000: Subselect returns more than 1 record
+ERROR 21000: Subquery returns more than 1 record
EXPLAIN SELECT MAX(numreponse) FROM t1 WHERE numeropost='1';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
@@ -521,7 +531,7 @@ a b
update t1 set b= (select b from t1);
ERROR HY000: You can't specify target table 't1' for update in FROM clause
update t1 set b= (select b from t2);
-ERROR 21000: Subselect returns more than 1 record
+ERROR 21000: Subquery returns more than 1 record
update t1 set b= (select b from t2 where t1.a = t2.a);
select * from t1;
a b
@@ -544,7 +554,7 @@ a b
delete from t1 where b = (select b from t1);
ERROR HY000: You can't specify target table 't1' for update in FROM clause
delete from t1 where b = (select b from t2);
-ERROR 21000: Subselect returns more than 1 record
+ERROR 21000: Subquery returns more than 1 record
delete from t1 where b = (select b from t2 where t1.a = t2.a);
select * from t1;
a b
@@ -570,7 +580,7 @@ a b
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a);
ERROR HY000: You can't specify target table 't12' for update in FROM clause
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2);
-ERROR 21000: Subselect returns more than 1 record
+ERROR 21000: Subquery returns more than 1 record
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a);
select * from t11;
a b
@@ -589,7 +599,7 @@ insert into t3 values (1),(2);
INSERT INTO t1 (x) VALUES ((SELECT x FROM t1));
ERROR HY000: You can't specify target table 't1' for update in FROM clause
INSERT INTO t1 (x) VALUES ((SELECT b FROM t3));
-ERROR 21000: Subselect returns more than 1 record
+ERROR 21000: Subquery returns more than 1 record
INSERT INTO t1 (x) VALUES ((SELECT a FROM t2));
select * from t1;
x
@@ -631,7 +641,7 @@ x y
replace into t1 (x, y) VALUES ((SELECT x FROM t1), (SELECT a+1 FROM t2));
ERROR HY000: You can't specify target table 't1' for update in FROM clause
replace into t1 (x, y) VALUES ((SELECT a FROM t3), (SELECT a+1 FROM t2));
-ERROR 21000: Subselect returns more than 1 record
+ERROR 21000: Subquery returns more than 1 record
replace into t1 (x, y) VALUES ((SELECT a FROM t2), (SELECT a+1 FROM t2));
select * from t1;
x y
@@ -702,7 +712,7 @@ id
CREATE TABLE t1 (id int(11) default NULL, KEY id (id)) TYPE=MyISAM CHARSET=latin1;
INSERT INTO t1 values (1),(1);
UPDATE t2 SET id=(SELECT * FROM t1);
-ERROR 21000: Subselect returns more than 1 record
+ERROR 21000: Subquery returns more than 1 record
drop table t2, t1;
create table t1 (a int);
insert into t1 values (1),(2),(3);
@@ -809,6 +819,7 @@ explain select (select a+1) from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3
Warnings:
+Note 1275 Field or reference 'a' of SELECT #2 was resolved in SELECT #1
Note 1248 Select 2 was reduced during optimisation
select (select a+1) from t1;
(select a+1)
@@ -829,7 +840,7 @@ a t1.a in (select t2.a from t2)
explain SELECT t1.a, t1.a in (select t2.a from t2) FROM t1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 Using index
-2 DEPENDENT SUBQUERY t2 index_in a a 5 func 2 Using where; Using index
+2 DEPENDENT SUBQUERY t2 index_subquery a a 5 func 2 Using index
CREATE TABLE t3 (a int(11) default '0');
INSERT INTO t3 VALUES (1),(2),(3);
SELECT t1.a, t1.a in (select t2.a from t2,t3 where t3.a=t2.a) FROM t1;
@@ -1035,6 +1046,9 @@ t1 CREATE TABLE `t1` (
) TYPE=MyISAM CHARSET=latin1
drop table t1;
CREATE TABLE t1 SELECT (SELECT 1 as a UNION SELECT 1+1 limit 1,1) as a;
+select * from t1;
+a
+2
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -1172,7 +1186,7 @@ insert into t1 values (1,0), (2,0), (3,0);
insert into t2 values (1,1), (2,1), (3,1), (2,2);
update ignore t1 set b=(select b from t2 where t1.a=t2.a);
Warnings:
-Error 1241 Subselect returns more than 1 record
+Error 1241 Subquery returns more than 1 record
select * from t1;
a b
1 1
@@ -1240,7 +1254,7 @@ a
explain select * from t2 where t2.a in (select a from t1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 Using where; Using index
-2 DEPENDENT SUBQUERY t1 simple_in PRIMARY PRIMARY 4 func 1 Using index
+2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 Using index
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
a
2
@@ -1248,7 +1262,7 @@ a
explain select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 Using where; Using index
-2 DEPENDENT SUBQUERY t1 simple_in PRIMARY PRIMARY 4 func 1 Using index; Using where
+2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 Using index; Using where
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
a
2
@@ -1273,7 +1287,7 @@ a
explain select * from t2 where t2.a in (select a from t1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 index NULL a 5 NULL 4 Using where; Using index
-2 DEPENDENT SUBQUERY t1 index_in a a 5 func 1001 Using index
+2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 Using index
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
a
2
@@ -1281,7 +1295,7 @@ a
explain select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 index NULL a 5 NULL 4 Using where; Using index
-2 DEPENDENT SUBQUERY t1 index_in a a 5 func 1001 Using index; Using where
+2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 Using index; Using where
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
a
2
@@ -1304,7 +1318,7 @@ a
explain select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 index NULL a 5 NULL 4 Using where; Using index
-2 DEPENDENT SUBQUERY t1 index_in a a 5 func 1001 Using index; Using where
+2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 Using index; Using where
drop table t1, t2, t3;
create table t1 (a int, b int);
create table t2 (a int, b int);
@@ -1352,3 +1366,49 @@ ERROR HY000: Illegal mix of collations (latin1_german1_ci,IMPLICIT) and (latin1_
select * from t1 where s1 > any (select max(s2) from t1);
ERROR HY000: Illegal mix of collations (latin1_german1_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation '>'
drop table t1;
+create table t1(toid int,rd int);
+create table t2(userid int,pmnew int,pmtotal int);
+insert into t2 values(1,0,0),(2,0,0);
+insert into t1 values(1,0),(1,0),(1,0),(1,12),(1,15),(1,123),(1,12312),(1,12312),(1,123),(2,0),(2,0),(2,1),(2,2);
+select userid,pmtotal,pmnew, (select count(rd) from t1 where toid=t2.userid) calc_total, (select count(rd) from t1 where rd=0 and toid=t2.userid) calc_new from t2 where userid in (select distinct toid from t1);
+userid pmtotal pmnew calc_total calc_new
+1 0 0 9 3
+2 0 0 4 2
+drop table t1, t2;
+create table t1 (s1 char(5));
+select (select 'a','b' from t1 union select 'a','b' from t1) from t1;
+ERROR 21000: Cardinality error (more/less than 1 columns)
+insert into t1 values ('tttt');
+select * from t1 where ('a','b')=(select 'a','b' from t1 union select 'a','b' from t1);
+s1
+tttt
+explain (select * from t1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 system NULL NULL NULL NULL 1
+(select * from t1);
+s1
+tttt
+drop table t1;
+create table t1 (s1 char(5), index s1(s1));
+create table t2 (s1 char(5), index s1(s1));
+insert into t1 values ('a1'),('a2'),('a3');
+insert into t2 values ('a1'),('a2');
+select s1, s1 NOT IN (SELECT s1 FROM t2) from t1;
+s1 s1 NOT IN (SELECT s1 FROM t2)
+a1 0
+a2 0
+a3 1
+select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
+s1 s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')
+a1 0
+a2 1
+a3 1
+explain select s1, s1 NOT IN (SELECT s1 FROM t2) from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 index NULL s1 6 NULL 3 Using index
+2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 Using index
+explain select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 index NULL s1 6 NULL 3 Using index
+2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 1 Using index; Using where
+drop table t1,t2;
diff --git a/mysql-test/r/subselect2.result b/mysql-test/r/subselect2.result
index c387d8b2d76..98df44553d2 100644
--- a/mysql-test/r/subselect2.result
+++ b/mysql-test/r/subselect2.result
@@ -123,9 +123,9 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system PRIMARY NULL NULL NULL 0 const row not found
1 PRIMARY t2 ALL DDOCTYPEID_IDX NULL NULL NULL 9 Using where
1 PRIMARY t4 eq_ref PRIMARY PRIMARY 32 test.t2.DOCTYPEID 1
-2 DEPENDENT SUBQUERY t3 simple_in PRIMARY,FFOLDERID_IDX PRIMARY 32 func 1 Using index; Using where
-3 DEPENDENT SUBQUERY t3 simple_in PRIMARY,FFOLDERID_IDX PRIMARY 32 func 1 Using index; Using where
-4 DEPENDENT SUBQUERY t3 simple_in PRIMARY,FFOLDERID_IDX PRIMARY 32 func 1 Using index; Using where
-5 DEPENDENT SUBQUERY t3 simple_in PRIMARY,FFOLDERID_IDX PRIMARY 32 func 1 Using index; Using where
-6 DEPENDENT SUBQUERY t3 simple_in PRIMARY,FFOLDERID_IDX,CMFLDRPARNT_IDX PRIMARY 32 func 1 Using index; Using where
+2 DEPENDENT SUBQUERY t3 unique_subquery PRIMARY,FFOLDERID_IDX PRIMARY 32 func 1 Using index; Using where
+3 DEPENDENT SUBQUERY t3 unique_subquery PRIMARY,FFOLDERID_IDX PRIMARY 32 func 1 Using index; Using where
+4 DEPENDENT SUBQUERY t3 unique_subquery PRIMARY,FFOLDERID_IDX PRIMARY 32 func 1 Using index; Using where
+5 DEPENDENT SUBQUERY t3 unique_subquery PRIMARY,FFOLDERID_IDX PRIMARY 32 func 1 Using index; Using where
+6 DEPENDENT SUBQUERY t3 unique_subquery PRIMARY,FFOLDERID_IDX,CMFLDRPARNT_IDX PRIMARY 32 func 1 Using index; Using where
drop table t1, t2, t3, t4;
diff --git a/mysql-test/r/symlink.result b/mysql-test/r/symlink.result
index 216fb4d6124..c31d1019d89 100644
--- a/mysql-test/r/symlink.result
+++ b/mysql-test/r/symlink.result
@@ -40,14 +40,12 @@ t9 CREATE TABLE `t9` (
`b` char(16) NOT NULL default '',
`c` int(11) NOT NULL default '0',
PRIMARY KEY (`a`)
-) TYPE=MyISAM CHARSET=latin1
+) TYPE=MyISAM CHARSET=latin1 DATA DIRECTORY='TEST_DIR/var/tmp/' INDEX DIRECTORY='TEST_DIR/var/run/'
alter table t9 rename t8, add column d int not null;
alter table t8 rename t7;
rename table t7 to t9;
drop table t1;
Got one of the listed errors
-Warnings:
-Note 1008 Can't drop database 'test_mysqltest'; database doesn't exist
Got one of the listed errors
Got one of the listed errors
Got one of the listed errors
@@ -64,5 +62,5 @@ t9 CREATE TABLE `t9` (
`c` int(11) NOT NULL default '0',
`d` int(11) NOT NULL default '0',
PRIMARY KEY (`a`)
-) TYPE=MyISAM CHARSET=latin1
+) TYPE=MyISAM CHARSET=latin1 DATA DIRECTORY='TEST_DIR/var/tmp/' INDEX DIRECTORY='TEST_DIR/var/run/'
drop database mysqltest;
diff --git a/mysql-test/r/type_nchar.result b/mysql-test/r/type_nchar.result
new file mode 100644
index 00000000000..c495853cd4c
--- /dev/null
+++ b/mysql-test/r/type_nchar.result
@@ -0,0 +1,50 @@
+drop table if exists t1;
+create table t1 (c nchar(10));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` char(10) character set utf8 default NULL
+) TYPE=MyISAM CHARSET=latin1
+drop table t1;
+create table t1 (c national char(10));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` char(10) character set utf8 default NULL
+) TYPE=MyISAM CHARSET=latin1
+drop table t1;
+create table t1 (c national varchar(10));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` varchar(10) character set utf8 default NULL
+) TYPE=MyISAM CHARSET=latin1
+drop table t1;
+create table t1 (c nvarchar(10));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` varchar(10) character set utf8 default NULL
+) TYPE=MyISAM CHARSET=latin1
+drop table t1;
+create table t1 (c nchar varchar(10));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` varchar(10) character set utf8 default NULL
+) TYPE=MyISAM CHARSET=latin1
+drop table t1;
+create table t1 (c national character varying(10));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` varchar(10) character set utf8 default NULL
+) TYPE=MyISAM CHARSET=latin1
+drop table t1;
+create table t1 (c nchar varying(10));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` varchar(10) character set utf8 default NULL
+) TYPE=MyISAM CHARSET=latin1
+drop table t1;
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index 396eba7197b..952ed566132 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -103,7 +103,7 @@ a b
2 b
select found_rows();
found_rows()
-6
+8
explain select a,b from t1 union all select a,b from t2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
@@ -312,6 +312,127 @@ a b
5 f
6 e
drop table t1,t2,t3,t4;
+create table t1 (a int);
+insert into t1 values (1),(2),(3);
+create table t2 (a int);
+insert into t2 values (3),(4),(5);
+(SELECT SQL_CALC_FOUND_ROWS * FROM t1) UNION all (SELECT * FROM t2) LIMIT 1;
+a
+1
+select found_rows();
+found_rows()
+6
+(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION all (SELECT * FROM t2) LIMIT 2;
+a
+1
+3
+select found_rows();
+found_rows()
+4
+(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION all (SELECT * FROM t2);
+a
+1
+3
+4
+5
+select found_rows();
+found_rows()
+4
+(SELECT SQL_CALC_FOUND_ROWS * FROM t1) UNION all (SELECT * FROM t2 LIMIT 1);
+a
+1
+2
+3
+3
+select found_rows();
+found_rows()
+4
+(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION SELECT * FROM t2 LIMIT 1;
+ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1 UNION all SELECT * FROM t2 LIMIT 2;
+a
+1
+3
+select found_rows();
+found_rows()
+6
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION all SELECT * FROM t2 LIMIT 2;
+a
+1
+2
+select found_rows();
+found_rows()
+6
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION SELECT * FROM t2 LIMIT 2;
+a
+1
+2
+select found_rows();
+found_rows()
+6
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION SELECT * FROM t2 LIMIT 100;
+a
+1
+2
+3
+4
+5
+select found_rows();
+found_rows()
+6
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 100 UNION SELECT * FROM t2;
+a
+1
+2
+3
+4
+5
+select found_rows();
+found_rows()
+5
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1 UNION SELECT * FROM t2;
+a
+1
+3
+4
+5
+select found_rows();
+found_rows()
+6
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1 UNION SELECT * FROM t2 LIMIT 2;
+a
+1
+3
+select found_rows();
+found_rows()
+6
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION SELECT * FROM t2 LIMIT 2,2;
+a
+3
+4
+select found_rows();
+found_rows()
+6
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 limit 2,2 UNION SELECT * FROM t2;
+a
+3
+4
+5
+select found_rows();
+found_rows()
+5
+SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a desc LIMIT 1;
+a
+5
+(SELECT * FROM t1 ORDER by a) UNION ALL (SELECT * FROM t2 ORDER BY a) ORDER BY A desc LIMIT 4;
+a
+5
+4
+3
+3
+(SELECT * FROM t1) UNION all (SELECT SQL_CALC_FOUND_ROWS * FROM t2) LIMIT 1;
+ERROR 42000: Wrong usage/placement of 'SQL_CALC_FOUND_ROWS'
+drop table t1,t2;
CREATE TABLE t1 ( id int(3) unsigned default '0') TYPE=MyISAM;
INSERT INTO t1 (id) VALUES("1");
CREATE TABLE t2 ( id int(3) unsigned default '0', id_master int(5) default '0', text1 varchar(5) default NULL, text2 varchar(5) default NULL) TYPE=MyISAM;
diff --git a/mysql-test/std_data/loaddata2.dat b/mysql-test/std_data/loaddata2.dat
new file mode 100644
index 00000000000..6e9d6745b8d
--- /dev/null
+++ b/mysql-test/std_data/loaddata2.dat
@@ -0,0 +1,5 @@
+Field A,'Field B'
+Field 1,'Field 2'
+Field 3,'Field 4'
+'Field 5' ,'Field 6'
+Field 6, 'Field 7'
diff --git a/mysql-test/t/bdb.test b/mysql-test/t/bdb.test
index 27755e51b7f..a0fbc56a9da 100644
--- a/mysql-test/t/bdb.test
+++ b/mysql-test/t/bdb.test
@@ -776,3 +776,16 @@ select * from t1;
select * from t2;
select * from t2;
drop table t1,t2;
+
+#
+# The bug #971
+#
+
+create table t1 (x int not null, index(x)) type=bdb;
+insert into t1 values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+select * from t1 where x <= 10 and x >= 7;
+select * from t1 where x <= 10 and x >= 7 order by x;
+select * from t1 where x <= 10 and x >= 7 order by x desc;
+select * from t1 where x <= 8 and x >= 5 order by x desc;
+select * from t1 where x < 8 and x > 5 order by x desc;
+drop table t1;
diff --git a/mysql-test/t/connect.test b/mysql-test/t/connect.test
index e6ccc52f0d4..7585ff0f608 100644
--- a/mysql-test/t/connect.test
+++ b/mysql-test/t/connect.test
@@ -48,8 +48,9 @@ flush privileges;
#connect (con1,localhost,test,gambling2,"");
#show tables;
connect (con1,localhost,test,gambling2,mysql);
+set password=old_password('gambling3');
show tables;
-connect (con1,localhost,test,gambling2,test);
+connect (con1,localhost,test,gambling3,test);
show tables;
# Re enable this one day if error handling on connect will take place
@@ -63,7 +64,9 @@ show tables;
#connect (con1,localhost,test,zorro,);
#--error 1045
+
# remove user 'test' so that other tests which may use 'test'
# do not depend on this test.
+
delete from mysql.user where user="test";
flush privileges;
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
index ebb3854309b..0b86b67fdbf 100644
--- a/mysql-test/t/create.test
+++ b/mysql-test/t/create.test
@@ -219,6 +219,60 @@ drop table t1;
#
# Bug # 801
#
-
create table t1 select x'4132';
drop table t1;
+
+#
+# Test types of data for create select with functions
+#
+
+create table t1(a int,b int,c int unsigned,d date,e char,f datetime,g time,h blob);
+insert into t1(a)values(1);
+insert into t1(a,b,c,d,e,f,g,h)
+values(2,-2,2,'1825-12-14','a','2003-1-1 3:2:1','4:3:2','binary data');
+select * from t1;
+select a,
+ ifnull(b,cast(-7 as signed)) as b,
+ ifnull(c,cast(7 as unsigned)) as c,
+ ifnull(d,cast('2000-01-01' as date)) as d,
+ ifnull(e,cast('b' as char)) as e,
+ ifnull(f,cast('2000-01-01' as datetime)) as f,
+ ifnull(g,cast('5:4:3' as time)) as g,
+ ifnull(h,cast('yet another binary data' as binary)) as h,
+ addtime(cast('1:0:0' as time),cast('1:0:0' as time)) as dd
+from t1;
+
+create table t2
+select
+ a,
+ ifnull(b,cast(-7 as signed)) as b,
+ ifnull(c,cast(7 as unsigned)) as c,
+ ifnull(d,cast('2000-01-01' as date)) as d,
+ ifnull(e,cast('b' as char)) as e,
+ ifnull(f,cast('2000-01-01' as datetime)) as f,
+ ifnull(g,cast('5:4:3' as time)) as g,
+ ifnull(h,cast('yet another binary data' as binary)) as h,
+ addtime(cast('1:0:0' as time),cast('1:0:0' as time)) as dd
+from t1;
+explain t2;
+
+select * from t2;
+
+drop table t1, t2;
+
+#
+# Bug #1209
+#
+
+--disable_warnings
+drop database if exists test_$1;
+--enable_warnings
+create database test_$1;
+use test_$1;
+select database();
+drop database test_$1;
+select database();
+
+# Connect without a database
+connect (user4,localhost,mysqltest_1,,*NO-ONE*);
+select database();
diff --git a/mysql-test/t/ctype_mb.test b/mysql-test/t/ctype_mb.test
index 5c3e67eec01..96bb634deb3 100644
--- a/mysql-test/t/ctype_mb.test
+++ b/mysql-test/t/ctype_mb.test
@@ -6,3 +6,14 @@ SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES ('aaaabbbbccccdddd','aaaabbbbccccdddd','aaaabbbbccccdddd');
SELECT * FROM t1;
DROP TABLE t1;
+
+CREATE TABLE t1 (a CHAR(4) CHARACTER SET utf8, KEY key_a(a(3)));
+SHOW CREATE TABLE t1;
+SHOW KEYS FROM t1;
+ALTER TABLE t1 CHANGE a a CHAR(4);
+SHOW CREATE TABLE t1;
+SHOW KEYS FROM t1;
+ALTER TABLE t1 CHANGE a a CHAR(4) CHARACTER SET utf8;
+SHOW CREATE TABLE t1;
+SHOW KEYS FROM t1;
+DROP TABLE t1;
diff --git a/mysql-test/t/ctype_recoding.test b/mysql-test/t/ctype_recoding.test
index 25df9c0a86b..325a8f075ed 100644
--- a/mysql-test/t/ctype_recoding.test
+++ b/mysql-test/t/ctype_recoding.test
@@ -13,8 +13,8 @@ DROP TABLE t1;
CREATE TABLE ÔÁÂÌÉÃÁ
(
- ÐÏÌÅ CHAR(32) CHARACTER SET koi8r NOT NULL
-);
+ ÐÏÌÅ CHAR(32) CHARACTER SET koi8r NOT NULL COMMENT "ËÏÍÍÅÎÔÁÒÉÊ ÐÏÌÑ"
+) COMMENT "ËÏÍÍÅÎÔÁÒÉÊ ÔÁÂÌÉÃÙ";
SHOW TABLES;
SHOW CREATE TABLE ÔÁÂÌÉÃÁ;
@@ -45,3 +45,8 @@ SHOW TABLES;
SHOW TABLES IN òåñò;
SET CHARACTER SET koi8r;
DROP DATABASE ÔÅÓÔ;
+
+SET NAMES koi8r;
+SELECT hex('ÔÅÓÔ');
+SET character_set_connection=cp1251;
+SELECT hex('ÔÅÓÔ');
diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test
new file mode 100644
index 00000000000..0457c204e32
--- /dev/null
+++ b/mysql-test/t/ctype_ucs.test
@@ -0,0 +1,194 @@
+-- source include/have_ucs2.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+SET CHARACTER SET koi8r;
+
+#
+# Check that 0x20 is only trimmed when it is
+# a part of real SPACE character, not just a part
+# of a multibyte sequence.
+# Note, CYRILLIC LETTER ER is used as an example, which
+# is stored as 0x0420 in UCS2, thus contains 0x20 in the
+# low byte. The second character is THREE-PER-M, U+2004,
+# which contains 0x20 in the high byte.
+#
+
+CREATE TABLE t1 (word VARCHAR(64) CHARACTER SET ucs2);
+INSERT INTO t1 VALUES (_koi8r'ò'), (X'2004');
+SELECT hex(word) FROM t1 ORDER BY word;
+DELETE FROM t1;
+
+#
+# Check that real spaces are correctly trimmed.
+#
+
+INSERT INTO t1 VALUES (X'042000200020'), (X'200400200020');
+SELECT hex(word) FROM t1 ORDER BY word;
+DROP TABLE t1;
+
+#
+# Check LPAD/RPAD
+#
+SELECT LPAD(_ucs2 X'0420',10,_ucs2 X'0421');
+SELECT LPAD(_ucs2 X'0420',10,_ucs2 X'04210422');
+SELECT LPAD(_ucs2 X'0420',10,_ucs2 X'042104220423');
+SELECT LPAD(_ucs2 X'0420042104220423042404250426042704280429042A042B',10,_ucs2 X'042104220423');
+
+SELECT RPAD(_ucs2 X'0420',10,_ucs2 X'0421');
+SELECT RPAD(_ucs2 X'0420',10,_ucs2 X'04210422');
+SELECT RPAD(_ucs2 X'0420',10,_ucs2 X'042104220423');
+SELECT RPAD(_ucs2 X'0420042104220423042404250426042704280429042A042B',10,_ucs2 X'042104220423');
+
+CREATE TABLE t1 SELECT
+LPAD(_ucs2 X'0420',10,_ucs2 X'0421') l,
+RPAD(_ucs2 X'0420',10,_ucs2 X'0421') r;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+######################################################
+#
+# Test of like
+#
+
+SET NAMES koi8r;
+SET character_set_connection=ucs2;
+
+create table t1 (a varchar(10) character set ucs2, key(a));
+insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test");
+explain select * from t1 where a like 'abc%';
+explain select * from t1 where a like concat('abc','%');
+select * from t1 where a like "abc%";
+select * from t1 where a like concat("abc","%");
+select * from t1 where a like "ABC%";
+select * from t1 where a like "test%";
+select * from t1 where a like "te_t";
+select * from t1 where a like "%a%";
+select * from t1 where a like "%abcd%";
+select * from t1 where a like "%abc\d%";
+drop table t1;
+
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ucs2);
+INSERT INTO t1 VALUES ('ÆÙ×Á'),('æÙ×Á'),('Æù×Á'),('ÆÙ÷Á'),('ÆÙ×á'),('æù÷á');
+INSERT INTO t1 VALUES ('ÆÙ×ÁÐÒÏÌÄÖ'),('æÙ×ÁÐÒÏÌÄÖ'),('Æù×ÁÐÒÏÌÄÖ'),('ÆÙ÷ÁÐÒÏÌÄÖ');
+INSERT INTO t1 VALUES ('ÆÙ×áÐÒÏÌÄÖ'),('ÆÙ×ÁðÒÏÌÄÖ'),('ÆÙ×ÁÐòÏÌÄÖ'),('ÆÙ×ÁÐÒïÌÄÖ');
+INSERT INTO t1 VALUES ('ÆÙ×ÁÐÒÏìÄÖ'),('ÆÙ×ÁÐÒÏÌäÖ'),('ÆÙ×ÁÐÒÏÌÄö'),('æù÷áðòïìäö');
+SELECT * FROM t1 WHERE a LIKE '%Æù×Á%';
+SELECT * FROM t1 WHERE a LIKE '%Æù×%';
+SELECT * FROM t1 WHERE a LIKE 'Æù×Á%';
+SELECT * FROM t1 WHERE a LIKE 'Æù×Á%' COLLATE ucs2_bin;
+DROP TABLE t1;
+
+#
+# Bug 1181
+#
+CREATE TABLE t1 (word varchar(64) NOT NULL, PRIMARY KEY (word))
+TYPE=MyISAM CHARACTER SET ucs2 COLLATE ucs2_general_ci;
+INSERT INTO t1 (word) VALUES ("cat");
+SELECT * FROM t1 WHERE word LIKE "c%";
+SELECT * FROM t1 WHERE word LIKE "ca_";
+SELECT * FROM t1 WHERE word LIKE "cat";
+SELECT * FROM t1 WHERE word LIKE _ucs2 x'00630025';
+SELECT * FROM t1 WHERE word LIKE _ucs2 x'00630061005F';
+DROP TABLE t1;
+
+######################################################
+
+#
+# Bug 1264
+#
+# Description:
+#
+# When using a ucs2 table in MySQL,
+# either with ucs2_general_ci or ucs2_bin collation,
+# words are returned in an incorrect order when using ORDER BY
+# on an _indexed_ CHAR or VARCHAR column. They are sorted with
+# the longest word *first* instead of last. I.E. The word "aardvark"
+# is in the results before the word "a".
+#
+# If there is no index for the column, the problem does not occur.
+#
+# Interestingly, if there is no second column, the words are returned
+# in the correct order.
+#
+# According to EXPLAIN, it looks like when the output includes columns that
+# are not part of the index sorted on, it does a filesort, which fails.
+# Using a straight index yields correct results.
+
+SET NAMES latin1;
+
+#
+# Two fields, index
+#
+
+CREATE TABLE t1 (
+ word VARCHAR(64),
+ bar INT(11) default 0,
+ PRIMARY KEY (word))
+ TYPE=MyISAM
+ CHARSET ucs2
+ COLLATE ucs2_general_ci ;
+
+INSERT INTO t1 (word) VALUES ("aar");
+INSERT INTO t1 (word) VALUES ("a");
+INSERT INTO t1 (word) VALUES ("aardvar");
+INSERT INTO t1 (word) VALUES ("aardvark");
+INSERT INTO t1 (word) VALUES ("aardvara");
+INSERT INTO t1 (word) VALUES ("aardvarz");
+EXPLAIN SELECT * FROM t1 ORDER BY word;
+SELECT * FROM t1 ORDER BY word;
+EXPLAIN SELECT word FROM t1 ORDER BY word;
+SELECT word FROM t1 ORDER by word;
+DROP TABLE t1;
+
+#
+# One field, index
+#
+
+CREATE TABLE t1 (
+ word VARCHAR(64) ,
+ PRIMARY KEY (word))
+ TYPE=MyISAM
+ CHARSET ucs2
+ COLLATE ucs2_general_ci;
+
+INSERT INTO t1 (word) VALUES ("aar");
+INSERT INTO t1 (word) VALUES ("a");
+INSERT INTO t1 (word) VALUES ("aardvar");
+INSERT INTO t1 (word) VALUES ("aardvark");
+INSERT INTO t1 (word) VALUES ("aardvara");
+INSERT INTO t1 (word) VALUES ("aardvarz");
+EXPLAIN SELECT * FROM t1 ORDER BY WORD;
+SELECT * FROM t1 ORDER BY word;
+DROP TABLE t1;
+
+
+#
+# Two fields, no index
+#
+
+CREATE TABLE t1 (
+ word TEXT,
+ bar INT(11) AUTO_INCREMENT,
+ PRIMARY KEY (bar))
+ TYPE=MyISAM
+ CHARSET ucs2
+ COLLATE ucs2_general_ci ;
+INSERT INTO t1 (word) VALUES ("aar");
+INSERT INTO t1 (word) VALUES ("a" );
+INSERT INTO t1 (word) VALUES ("aardvar");
+INSERT INTO t1 (word) VALUES ("aardvark");
+INSERT INTO t1 (word) VALUES ("aardvara");
+INSERT INTO t1 (word) VALUES ("aardvarz");
+EXPLAIN SELECT * FROM t1 ORDER BY word;
+SELECT * FROM t1 ORDER BY word;
+EXPLAIN SELECT word FROM t1 ORDER BY word;
+SELECT word FROM t1 ORDER BY word;
+DROP TABLE t1;
+
+#
+# END OF Bug 1264 test
+#
+########################################################
+
diff --git a/mysql-test/t/ctype_ujis.test b/mysql-test/t/ctype_ujis.test
index e41caf55948..bcf6507b4c7 100644
--- a/mysql-test/t/ctype_ujis.test
+++ b/mysql-test/t/ctype_ujis.test
@@ -7,6 +7,8 @@
drop table if exists t1;
--enable_warnings
+set names ujis;
+
#
# Test problem with LEFT()
#
@@ -15,3 +17,27 @@ create table t1 (c text character set ujis);
insert into t1 values (0xa4a2),(0xa4a3);
select hex(left(c,1)) from t1 group by c;
drop table t1;
+
+#
+#
+#
+select locate(0xa2a1,0xa1a2a1a3);
+select locate(_ujis 0xa2a1,_ujis 0xa1a2a1a3);
+select locate(_ujis 0xa2a1,_ujis 0xa1a2a1a3 collate ujis_bin);
+select locate('he','hello');
+select locate('he','hello',2);
+select locate('lo','hello',2);
+select locate('HE','hello');
+select locate('HE','hello',2);
+select locate('LO','hello',2);
+select locate('HE','hello' collate ujis_bin);
+select locate('HE','hello' collate ujis_bin,2);
+select locate('LO','hello' collate ujis_bin,2);
+select locate(_ujis 0xa1a3,_ujis 0xa1a2a1a3);
+
+select 0xa1a2a1a3 like concat(_binary'%',0xa2a1,_binary'%');
+select _ujis 0xa1a2a1a3 like concat(_ujis'%',_ujis 0xa2a1, _ujis'%');
+select _ujis 0xa1a2a1a3 like concat(_ujis'%',_ujis 0xa2a1, _ujis'%') collate ujis_bin;
+select 'a' like 'a';
+select 'A' like 'a';
+select 'A' like 'a' collate ujis_bin;
diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test
new file mode 100644
index 00000000000..46359e84f1d
--- /dev/null
+++ b/mysql-test/t/ctype_utf8.test
@@ -0,0 +1,35 @@
+#
+# Tests with the utf8 character set
+#
+
+set names utf8;
+
+select left(_utf8 0xD0B0D0B1D0B2,1);
+select right(_utf8 0xD0B0D0B2D0B2,1);
+
+select locate('he','hello');
+select locate('he','hello',2);
+select locate('lo','hello',2);
+select locate('HE','hello');
+select locate('HE','hello',2);
+select locate('LO','hello',2);
+select locate('HE','hello' collate utf8_bin);
+select locate('HE','hello' collate utf8_bin,2);
+select locate('LO','hello' collate utf8_bin,2);
+
+select locate(_utf8 0xD0B1, _utf8 0xD0B0D0B1D0B2);
+select locate(_utf8 0xD091, _utf8 0xD0B0D0B1D0B2);
+select locate(_utf8 0xD0B1, _utf8 0xD0B0D091D0B2);
+select locate(_utf8 0xD091, _utf8 0xD0B0D0B1D0B2 collate utf8_bin);
+select locate(_utf8 0xD0B1, _utf8 0xD0B0D091D0B2 collate utf8_bin);
+
+select 'a' like 'a';
+select 'A' like 'a';
+select 'A' like 'a' collate utf8_bin;
+select _utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD0B1,_utf8 '%');
+
+#
+# Fix this, it should return 1:
+#
+#select _utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD091,_utf8 '%');
+#
diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test
index c3edbabcd53..39e61b7caaa 100644
--- a/mysql-test/t/derived.test
+++ b/mysql-test/t/derived.test
@@ -94,3 +94,18 @@ drop table t1,t2;
# derived table reference
#
SELECT a.x FROM (SELECT 1 AS x) AS a HAVING a.x = 1;
+
+#
+# Test for select if database is not selected.
+#
+# Connect without a database
+create table a1 select 1 as a;
+connect (con1,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,master.sock);
+connection con1;
+--error 1046
+select 2 as a from (select * from a1) b;
+use test;
+select 2 as a from (select * from a1) b;
+drop table a1;
+--error 1064
+select mail_id, if(folder.f_description!='', folder.f_description, folder.f_name) as folder_name, date, address_id, phrase, address, subject from folder, (select mail.mail_id as mail_id, date_format(mail.h_date, '%b %e, %Y %h:%i') as date, mail.folder_id, sender.address_id as address_id, sender.phrase as phrase, sender.address as address, mail.h_subject as subject from mail left join mxa as mxa_sender on mail.mail_id=mxa_sender.mail_id and mxa_sender.type='from' left join address as sender on mxa_sender.address_id=sender.address_id mxa as mxa_recipient, address as recipient, where 1 and mail.mail_id=mxa_recipient.mail_id and mxa_recipient.address_id=recipient.address_id and mxa_recipient.type='to' and match(sender.phrase, sender.address, sender.comment) against ('jeremy' in boolean mode) and match(recipient.phrase, recipient.address, recipient.comment) against ('monty' in boolean mode) order by mail.h_date desc limit 0, 25 ) as query where query.folder_id=folder.folder_id;
diff --git a/mysql-test/t/distinct.test b/mysql-test/t/distinct.test
index 0563b432873..56c00e7501c 100644
--- a/mysql-test/t/distinct.test
+++ b/mysql-test/t/distinct.test
@@ -285,3 +285,50 @@ INSERT INTO t1 VALUES (3, 'aaaaa');
INSERT INTO t1 VALUES (2, 'eeeeeee');
select distinct left(name,1) as name from t1;
drop table t1;
+
+#
+# Test case from sel000100
+#
+
+CREATE TABLE t1 (
+ ID int(11) NOT NULL auto_increment,
+ NAME varchar(75) DEFAULT '' NOT NULL,
+ LINK_ID int(11) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (ID),
+ KEY NAME (NAME),
+ KEY LINK_ID (LINK_ID)
+);
+
+INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (1,'Mike',0);
+INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (2,'Jack',0);
+INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (3,'Bill',0);
+
+CREATE TABLE t2 (
+ ID int(11) NOT NULL auto_increment,
+ NAME varchar(150) DEFAULT '' NOT NULL,
+ PRIMARY KEY (ID),
+ KEY NAME (NAME)
+);
+
+SELECT DISTINCT
+ t2.id AS key_link_id,
+ t2.name AS link
+FROM t1
+LEFT JOIN t2 ON t1.link_id=t2.id
+GROUP BY t1.id
+ORDER BY link;
+drop table t1,t2;
+
+#
+# test case for #674
+#
+
+CREATE TABLE t1 (
+ html varchar(5) default NULL,
+ rin int(11) default '0',
+ out int(11) default '0'
+) TYPE=MyISAM;
+
+INSERT INTO t1 VALUES ('1',1,0);
+SELECT DISTINCT html,SUM(out)/(SUM(rin)+1) as 'prod' FROM t1 GROUP BY rin;
+drop table t1;
diff --git a/mysql-test/t/drop.test b/mysql-test/t/drop.test
index a55cbb45fd9..43329a849f8 100644
--- a/mysql-test/t/drop.test
+++ b/mysql-test/t/drop.test
@@ -43,3 +43,13 @@ drop database mysqltest;
show databases;
--error 1008
drop database mysqltest;
+
+# test create table and FLUSH TABLES WITH READ LOCK
+drop table t1;
+flush tables with read lock;
+--error 1223;
+create table t1(n int);
+unlock tables;
+create table t1(n int);
+show tables;
+drop table t1;
diff --git a/mysql-test/t/func_compress.test b/mysql-test/t/func_compress.test
index 826721a4053..7462c020357 100644
--- a/mysql-test/t/func_compress.test
+++ b/mysql-test/t/func_compress.test
@@ -23,3 +23,9 @@ select uncompress("");
select uncompress(compress(""));
select uncompressed_length("");
+#
+# NULL (Bug #1333)
+#
+
+select compress(NULL);
+select uncompress(NULL);
diff --git a/mysql-test/t/func_crypt.test b/mysql-test/t/func_crypt.test
index c72356bda1a..c1c7090cab3 100644
--- a/mysql-test/t/func_crypt.test
+++ b/mysql-test/t/func_crypt.test
@@ -4,7 +4,33 @@ select length(encrypt('foo', 'ff')) <> 0;
--replace_result $1$aa$4OSUA5cjdx0RUQ08opV27/ aaqPiZY5xR5l.
# Test new and old password handling functions
-select password("a",""), password("a",NULL), password("","a"), password(NULL,"a");
-select password("aaaaaaaaaaaaaaaa","a"), password("a","aaaaaaaaaaaaaaaa");
-select old_password('test'), length(password("1")), length(encrypt('test')), encrypt('test','aa');
-select old_password(""), old_password(NULL), password(""), password(NULL);
+select password('abc');
+select password('');
+select old_password('abc');
+select old_password('');
+select password('gabbagabbahey');
+select old_password('idkfa');
+select length(password('1'));
+select length(encrypt('test'));
+select encrypt('test','aa');
+select old_password(NULL);
+select password(NULL);
+set global old_passwords=on;
+select password('');
+select old_password('');
+select password('idkfa');
+select old_password('idkfa');
+set old_passwords=on;
+select password('idkfa');
+select old_password('idkfa');
+set global old_passwords=off;
+select password('idkfa');
+select old_password('idkfa');
+
+# this test shows that new scrambles honor spaces in passwords:
+set old_passwords=off;
+select password('idkfa ');
+select password('idkfa');
+select password(' idkfa');
+select old_password('idkfa');
+select old_password(' i d k f a ');
diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test
index f426f9ca4ee..b10f6d2af21 100644
--- a/mysql-test/t/func_gconcat.test
+++ b/mysql-test/t/func_gconcat.test
@@ -91,6 +91,11 @@ insert into t2 values (1,4), (5,4), (5,5);
--replace_result www.help.com X www.host.com X www.google.com X
select REQ_ID, Group_Concat(URL) as URL from t1, t2 where
t2.URL_ID = t1.URL_ID group by REQ_ID;
+# check min/max function
+--replace_result www.help.com X www.host.com X www.google.com X
+select REQ_ID, Group_Concat(URL) as URL, Min(t1.URL_ID) urll,
+Max(t1.URL_ID) urlg from t1, t2 where t2.URL_ID = t1.URL_ID group by REQ_ID;
+
drop table t1;
drop table t2;
@@ -99,3 +104,19 @@ insert into t1 values (1,'longername'),(1,'evenlongername');
select ifnull(group_concat(concat(t1.id, ':', t1.name)), 'shortname') as 'without distinct: how it should be' from t1;
select distinct ifnull(group_concat(concat(t1.id, ':', t1.name)), 'shortname') as 'with distinct: cutoff at length of shortname' from t1;
drop table t1;
+
+# check zero rows
+create table t1(id int);
+create table t2(id int);
+insert into t1 values(0),(1);
+select group_concat(t1.id) FROM t1,t2;
+drop table t1;
+drop table t2;
+
+# check having
+create table t1 (bar varchar(32));
+insert into t1 values('test'),('test2');
+select * from t1 having group_concat(bar)='';
+drop table t1;
+
+
diff --git a/mysql-test/t/func_regexp.test b/mysql-test/t/func_regexp.test
index 6e5d601844e..6ecb56ef9c4 100644
--- a/mysql-test/t/func_regexp.test
+++ b/mysql-test/t/func_regexp.test
@@ -45,3 +45,17 @@ create table t1 (xxx char(128));
insert into t1 (xxx) values('this is some text: to test - out.reg exp (22/45)');
select * from t1 where xxx REGEXP '^this is some text: to test - out\\.reg exp [[(][0-9]+[/\\][0-9]+[])][ ]*$';
drop table t1;
+
+#
+# Check with different character sets and collations
+#
+select _latin1 0xFF regexp _latin1 '[[:lower:]]' COLLATE latin1_bin;
+select _koi8r 0xFF regexp _koi8r '[[:lower:]]' COLLATE koi8r_bin;
+select _latin1 0xFF regexp _latin1 '[[:upper:]]' COLLATE latin1_bin;
+select _koi8r 0xFF regexp _koi8r '[[:upper:]]' COLLATE koi8r_bin;
+
+select _latin1 0xF7 regexp _latin1 '[[:alpha:]]';
+select _koi8r 0xF7 regexp _koi8r '[[:alpha:]]';
+
+select _latin1'a' regexp _latin1'A' collate latin1_general_ci;
+select _latin1'a' regexp _latin1'A' collate latin1_bin;
diff --git a/mysql-test/t/func_test.test b/mysql-test/t/func_test.test
index ae1963dd3f5..95b10c4ffb9 100644
--- a/mysql-test/t/func_test.test
+++ b/mysql-test/t/func_test.test
@@ -1,3 +1,6 @@
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
#
# Testing of comparison functions
#
@@ -65,3 +68,13 @@ select _koi8r'a' COLLATE koi8r_bin LIKE _koi8r'A';
select _koi8r'a' COLLATE koi8r_general_ci LIKE _koi8r'A' COLLATE koi8r_bin;
--error 1266
select _koi8r'a' LIKE _latin1'A';
+
+#
+# Test for LEAST() BUG in LEFT JOIN
+#
+CREATE TABLE t1 ( faq_group_id int(11) NOT NULL default '0', faq_id int(11) NOT NULL default '0', title varchar(240) default NULL, keywords text, description longblob, solution longblob, status tinyint(4) NOT NULL default '0', access_id smallint(6) default NULL, lang_id smallint(6) NOT NULL default '0', created datetime NOT NULL default '0000-00-00 00:00:00', updated datetime default NULL, last_access datetime default NULL, last_notify datetime default NULL, solved_count int(11) NOT NULL default '0', static_solved int(11) default NULL, solved_1 int(11) default NULL, solved_2 int(11) default NULL, solved_3 int(11) default NULL, solved_4 int(11) default NULL, solved_5 int(11) default NULL, expires datetime default NULL, notes text, assigned_to smallint(6) default NULL, assigned_group smallint(6) default NULL, last_edited_by smallint(6) default NULL, orig_ref_no varchar(15) binary default NULL, c$fundstate smallint(6) default NULL, c$contributor smallint(6) default NULL, UNIQUE KEY t1$faq_id (faq_id), KEY t1$group_id$faq_id (faq_group_id,faq_id), KEY t1$c$fundstate (c$fundstate) ) TYPE=MyISAM;
+INSERT INTO t1 VALUES (82,82,'How to use the DynaVox Usage Counts Feature','usages count, number, corner, white, box, button','<as-html>\r\n<table width=\"100%\" border=\"0\">\r\n <tr>\r\n <td width=\"3%\"> </td>\r\n <td width=\"97%\">\r\n <h3><font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\"#000000\">How \r\n To</font><!-- #BeginEditable \"CS_troubleshoot_question\" --><font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\"#000099\"><font color=\"#000000\">: \r\n Display or Hide the Usage Counts to find out how many times each button is being selected. </font></font><!-- #EndEditable --></h3>\r\n </td>\r\n </tr>\r\n</table>','<as-html>\r\n <table width=\"100%\" border=\"0\">\r\n <tr>\r\n <td width=\"3%\"> </td>\r\n \r\n<td width=\"97%\"><!-- #BeginEditable \"CS_troubleshoot_answer\" --> \r\n \r\n<p><font color=\"#000000\" face=\"Verdana, Arial, Helvetica, sans-serif\">1. Select \r\n the <i>On/Setup</i> button to access the DynaVox Setup Menu.<br>\r\n 2. Select <b>Button Features.</b><br>\r\n 3. Below the <b>OK</b> button is the <b>Usage Counts</b> button.<br>\r\n a. If it says \"Hidden\" then the Usage Counts will not be displayed.<br>\r\n b. If it says \"Displayed\" then the Usage Counts will be shown.<br>\r\n c. Select the <b>Usage Counts</b> Option Ring once and it will toggle \r\n to the alternative option.<br>\r\n 4. Once the correct setting has been chosen, select <b>OK</b> to leave the <i>Button \r\n Features</i> menu.<br>\r\n 5. Select <b>OK</b> out of the <i>Setup</i> menu and return to the communication \r\n page.</font></p>\r\n <p><font color=\"#000000\" face=\"Verdana, Arial, Helvetica, sans-serif\">For \r\n further information on <i>Usage Counts,</i> see the <i>Button Features \r\n Menu Entry</i> in the DynaVox/DynaMyte Reference Manual.</font></p>\r\n<!-- #EndEditable --></td>\r\n </tr>\r\n</table>',4,1,1,'2001-11-16 16:43:34','2002-11-25 12:09:43','2003-07-24 01:04:48',NULL,11,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,11,NULL,NULL,NULL);
+CREATE TABLE t2 ( access_id smallint(6) NOT NULL default '0', name varchar(20) binary default NULL, rank smallint(6) NOT NULL default '0', KEY t2$access_id (access_id) ) TYPE=MyISAM;
+INSERT INTO t2 VALUES (1,'Everyone',2),(2,'Help',3),(3,'Customer Support',1);
+SELECT f_acc.rank, a1.rank, a2.rank FROM t1 LEFT JOIN t1 f1 ON (f1.access_id=1 AND f1.faq_group_id = t1.faq_group_id) LEFT JOIN t2 a1 ON (a1.access_id = f1.access_id) LEFT JOIN t1 f2 ON (f2.access_id=3 AND f2.faq_group_id = t1.faq_group_id) LEFT JOIN t2 a2 ON (a2.access_id = f2.access_id), t2 f_acc WHERE LEAST(a1.rank,a2.rank) = f_acc.rank;
+DROP TABLE t1,t2;
diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test
index f48ada33866..78221fa4e40 100644
--- a/mysql-test/t/grant.test
+++ b/mysql-test/t/grant.test
@@ -65,14 +65,24 @@ show grants for mysqltest_1@localhost;
select table_priv,column_priv from mysql.tables_priv where user="mysqltest_1";
REVOKE select (a), update on t1 from mysqltest_1@localhost;
show grants for mysqltest_1@localhost;
-REVOKE insert,insert (a) on t1 from mysqltest_1@localhost;
-GRANT references on t1 to mysqltest_1@localhost;
+REVOKE select,update,insert,insert (a) on t1 from mysqltest_1@localhost;
show grants for mysqltest_1@localhost;
+GRANT select,references on t1 to mysqltest_1@localhost;
select table_priv,column_priv from mysql.tables_priv where user="mysqltest_1";
-delete from mysql.user where user='mysqltest_1';
-delete from mysql.db where user='mysqltest_1';
-delete from mysql.tables_priv where user='mysqltest_1';
-delete from mysql.columns_priv where user='mysqltest_1';
+grant all on test.* to mysqltest_3@localhost with grant option;
+revoke all on test.* from mysqltest_3@localhost;
+show grants for mysqltest_3@localhost;
+revoke grant option on test.* from mysqltest_3@localhost;
+show grants for mysqltest_3@localhost;
+grant all on test.t1 to mysqltest_2@localhost with grant option;
+revoke all on test.t1 from mysqltest_2@localhost;
+show grants for mysqltest_2@localhost;
+revoke grant option on test.t1 from mysqltest_2@localhost;
+show grants for mysqltest_2@localhost;
+delete from mysql.user where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
+delete from mysql.db where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
+delete from mysql.tables_priv where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
+delete from mysql.columns_priv where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
flush privileges;
drop table t1;
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index 1153622a40f..752896ce7b2 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -429,4 +429,6 @@ select id, sum(qty) as sqty, count(qty) as cqty from t1 group by id having sum(q
select id, sum(qty) as sqty from t1 group by id having sqty>2 and count(qty)>1;
select id, sum(qty) as sqty, count(qty) as cqty from t1 group by id having sqty>2 and cqty>1;
select id, sum(qty) as sqty, count(qty) as cqty from t1 group by id having sum(qty)>2 and count(qty)>1;
+select count(*), case interval(qty,2,3,4,5,6,7,8) when -1 then NULL when 0 then "zero" when 1 then "one" when 2 then "two" end as category from t1 group by category;
+select count(*), interval(qty,2,3,4,5,6,7,8) as category from t1 group by category;
drop table t1;
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index 6e7eb0ea06f..823ac25cf66 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -134,6 +134,21 @@ rollback;
drop table t1;
#
+# Test for commit and FLUSH TABLES WITH READ LOCK
+#
+
+create table t1 (n int not null primary key) type=innodb;
+start transaction;
+insert into t1 values (4);
+flush tables with read lock;
+--error 1223;
+commit;
+unlock tables;
+commit;
+select * from t1;
+drop table t1;
+
+#
# Testing transactions
#
@@ -925,3 +940,29 @@ SELECT t2.id, t1.label FROM t2 INNER JOIN
(SELECT t1.id_object as id_object FROM t1 WHERE t1.label LIKE '%test%') AS lbl
ON (t2.id = lbl.id_object) INNER JOIN t1 ON (t2.id = t1.id_object);
drop table t1,t2;
+
+#
+# Bug #1078
+#
+create table t1 (c1 char(5) unique not null, c2 int, stamp timestamp) type=innodb;
+select * from t1;
+--error 1031
+replace delayed into t1 (c1, c2) values ( "text1","11"),( "text2","12");
+select * from t1;
+--error 1031
+replace delayed into t1 (c1, c2) values ( "text1","12"),( "text2","13"),( "text3","14", "a" ),( "text4","15", "b" );
+select * from t1;
+drop table t1;
+
+create table t1 (a int, b varchar(200), c text not null) checksum=1 type=myisam;
+create table t2 (a int, b varchar(200), c text not null) checksum=0 type=innodb;
+create table t3 (a int, b varchar(200), c text not null) checksum=1 type=innodb;
+insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, "");
+insert t2 select * from t1;
+insert t3 select * from t1;
+checksum table t1, t2, t3, t4 quick;
+checksum table t1, t2, t3, t4;
+checksum table t1, t2, t3, t4 extended;
+#show table status;
+drop table t1,t2,t3;
+
diff --git a/mysql-test/t/isam.test b/mysql-test/t/isam.test
index fc2dbac439c..a31ba864b2f 100644
--- a/mysql-test/t/isam.test
+++ b/mysql-test/t/isam.test
@@ -70,3 +70,176 @@ show columns from t1;
show full columns from t1;
show index from t1;
drop table t1,t2;
+
+#
+# test of table with huge number of packed fields
+#
+
+create table t1 (i1 int, i2 int, i3 int, i4 int, i5 int, i6 int, i7 int, i8
+int, i9 int, i10 int, i11 int, i12 int, i13 int, i14 int, i15 int, i16 int, i17
+int, i18 int, i19 int, i20 int, i21 int, i22 int, i23 int, i24 int, i25 int,
+i26 int, i27 int, i28 int, i29 int, i30 int, i31 int, i32 int, i33 int, i34
+int, i35 int, i36 int, i37 int, i38 int, i39 int, i40 int, i41 int, i42 int,
+i43 int, i44 int, i45 int, i46 int, i47 int, i48 int, i49 int, i50 int, i51
+int, i52 int, i53 int, i54 int, i55 int, i56 int, i57 int, i58 int, i59 int,
+i60 int, i61 int, i62 int, i63 int, i64 int, i65 int, i66 int, i67 int, i68
+int, i69 int, i70 int, i71 int, i72 int, i73 int, i74 int, i75 int, i76 int,
+i77 int, i78 int, i79 int, i80 int, i81 int, i82 int, i83 int, i84 int, i85
+int, i86 int, i87 int, i88 int, i89 int, i90 int, i91 int, i92 int, i93 int,
+i94 int, i95 int, i96 int, i97 int, i98 int, i99 int, i100 int, i101 int, i102
+int, i103 int, i104 int, i105 int, i106 int, i107 int, i108 int, i109 int, i110
+int, i111 int, i112 int, i113 int, i114 int, i115 int, i116 int, i117 int, i118
+int, i119 int, i120 int, i121 int, i122 int, i123 int, i124 int, i125 int, i126
+int, i127 int, i128 int, i129 int, i130 int, i131 int, i132 int, i133 int, i134
+int, i135 int, i136 int, i137 int, i138 int, i139 int, i140 int, i141 int, i142
+int, i143 int, i144 int, i145 int, i146 int, i147 int, i148 int, i149 int, i150
+int, i151 int, i152 int, i153 int, i154 int, i155 int, i156 int, i157 int, i158
+int, i159 int, i160 int, i161 int, i162 int, i163 int, i164 int, i165 int, i166
+int, i167 int, i168 int, i169 int, i170 int, i171 int, i172 int, i173 int, i174
+int, i175 int, i176 int, i177 int, i178 int, i179 int, i180 int, i181 int, i182
+int, i183 int, i184 int, i185 int, i186 int, i187 int, i188 int, i189 int, i190
+int, i191 int, i192 int, i193 int, i194 int, i195 int, i196 int, i197 int, i198
+int, i199 int, i200 int, i201 int, i202 int, i203 int, i204 int, i205 int, i206
+int, i207 int, i208 int, i209 int, i210 int, i211 int, i212 int, i213 int, i214
+int, i215 int, i216 int, i217 int, i218 int, i219 int, i220 int, i221 int, i222
+int, i223 int, i224 int, i225 int, i226 int, i227 int, i228 int, i229 int, i230
+int, i231 int, i232 int, i233 int, i234 int, i235 int, i236 int, i237 int, i238
+int, i239 int, i240 int, i241 int, i242 int, i243 int, i244 int, i245 int, i246
+int, i247 int, i248 int, i249 int, i250 int, i251 int, i252 int, i253 int, i254
+int, i255 int, i256 int, i257 int, i258 int, i259 int, i260 int, i261 int, i262
+int, i263 int, i264 int, i265 int, i266 int, i267 int, i268 int, i269 int, i270
+int, i271 int, i272 int, i273 int, i274 int, i275 int, i276 int, i277 int, i278
+int, i279 int, i280 int, i281 int, i282 int, i283 int, i284 int, i285 int, i286
+int, i287 int, i288 int, i289 int, i290 int, i291 int, i292 int, i293 int, i294
+int, i295 int, i296 int, i297 int, i298 int, i299 int, i300 int, i301 int, i302
+int, i303 int, i304 int, i305 int, i306 int, i307 int, i308 int, i309 int, i310
+int, i311 int, i312 int, i313 int, i314 int, i315 int, i316 int, i317 int, i318
+int, i319 int, i320 int, i321 int, i322 int, i323 int, i324 int, i325 int, i326
+int, i327 int, i328 int, i329 int, i330 int, i331 int, i332 int, i333 int, i334
+int, i335 int, i336 int, i337 int, i338 int, i339 int, i340 int, i341 int, i342
+int, i343 int, i344 int, i345 int, i346 int, i347 int, i348 int, i349 int, i350
+int, i351 int, i352 int, i353 int, i354 int, i355 int, i356 int, i357 int, i358
+int, i359 int, i360 int, i361 int, i362 int, i363 int, i364 int, i365 int, i366
+int, i367 int, i368 int, i369 int, i370 int, i371 int, i372 int, i373 int, i374
+int, i375 int, i376 int, i377 int, i378 int, i379 int, i380 int, i381 int, i382
+int, i383 int, i384 int, i385 int, i386 int, i387 int, i388 int, i389 int, i390
+int, i391 int, i392 int, i393 int, i394 int, i395 int, i396 int, i397 int, i398
+int, i399 int, i400 int, i401 int, i402 int, i403 int, i404 int, i405 int, i406
+int, i407 int, i408 int, i409 int, i410 int, i411 int, i412 int, i413 int, i414
+int, i415 int, i416 int, i417 int, i418 int, i419 int, i420 int, i421 int, i422
+int, i423 int, i424 int, i425 int, i426 int, i427 int, i428 int, i429 int, i430
+int, i431 int, i432 int, i433 int, i434 int, i435 int, i436 int, i437 int, i438
+int, i439 int, i440 int, i441 int, i442 int, i443 int, i444 int, i445 int, i446
+int, i447 int, i448 int, i449 int, i450 int, i451 int, i452 int, i453 int, i454
+int, i455 int, i456 int, i457 int, i458 int, i459 int, i460 int, i461 int, i462
+int, i463 int, i464 int, i465 int, i466 int, i467 int, i468 int, i469 int, i470
+int, i471 int, i472 int, i473 int, i474 int, i475 int, i476 int, i477 int, i478
+int, i479 int, i480 int, i481 int, i482 int, i483 int, i484 int, i485 int, i486
+int, i487 int, i488 int, i489 int, i490 int, i491 int, i492 int, i493 int, i494
+int, i495 int, i496 int, i497 int, i498 int, i499 int, i500 int, i501 int, i502
+int, i503 int, i504 int, i505 int, i506 int, i507 int, i508 int, i509 int, i510
+int, i511 int, i512 int, i513 int, i514 int, i515 int, i516 int, i517 int, i518
+int, i519 int, i520 int, i521 int, i522 int, i523 int, i524 int, i525 int, i526
+int, i527 int, i528 int, i529 int, i530 int, i531 int, i532 int, i533 int, i534
+int, i535 int, i536 int, i537 int, i538 int, i539 int, i540 int, i541 int, i542
+int, i543 int, i544 int, i545 int, i546 int, i547 int, i548 int, i549 int, i550
+int, i551 int, i552 int, i553 int, i554 int, i555 int, i556 int, i557 int, i558
+int, i559 int, i560 int, i561 int, i562 int, i563 int, i564 int, i565 int, i566
+int, i567 int, i568 int, i569 int, i570 int, i571 int, i572 int, i573 int, i574
+int, i575 int, i576 int, i577 int, i578 int, i579 int, i580 int, i581 int, i582
+int, i583 int, i584 int, i585 int, i586 int, i587 int, i588 int, i589 int, i590
+int, i591 int, i592 int, i593 int, i594 int, i595 int, i596 int, i597 int, i598
+int, i599 int, i600 int, i601 int, i602 int, i603 int, i604 int, i605 int, i606
+int, i607 int, i608 int, i609 int, i610 int, i611 int, i612 int, i613 int, i614
+int, i615 int, i616 int, i617 int, i618 int, i619 int, i620 int, i621 int, i622
+int, i623 int, i624 int, i625 int, i626 int, i627 int, i628 int, i629 int, i630
+int, i631 int, i632 int, i633 int, i634 int, i635 int, i636 int, i637 int, i638
+int, i639 int, i640 int, i641 int, i642 int, i643 int, i644 int, i645 int, i646
+int, i647 int, i648 int, i649 int, i650 int, i651 int, i652 int, i653 int, i654
+int, i655 int, i656 int, i657 int, i658 int, i659 int, i660 int, i661 int, i662
+int, i663 int, i664 int, i665 int, i666 int, i667 int, i668 int, i669 int, i670
+int, i671 int, i672 int, i673 int, i674 int, i675 int, i676 int, i677 int, i678
+int, i679 int, i680 int, i681 int, i682 int, i683 int, i684 int, i685 int, i686
+int, i687 int, i688 int, i689 int, i690 int, i691 int, i692 int, i693 int, i694
+int, i695 int, i696 int, i697 int, i698 int, i699 int, i700 int, i701 int, i702
+int, i703 int, i704 int, i705 int, i706 int, i707 int, i708 int, i709 int, i710
+int, i711 int, i712 int, i713 int, i714 int, i715 int, i716 int, i717 int, i718
+int, i719 int, i720 int, i721 int, i722 int, i723 int, i724 int, i725 int, i726
+int, i727 int, i728 int, i729 int, i730 int, i731 int, i732 int, i733 int, i734
+int, i735 int, i736 int, i737 int, i738 int, i739 int, i740 int, i741 int, i742
+int, i743 int, i744 int, i745 int, i746 int, i747 int, i748 int, i749 int, i750
+int, i751 int, i752 int, i753 int, i754 int, i755 int, i756 int, i757 int, i758
+int, i759 int, i760 int, i761 int, i762 int, i763 int, i764 int, i765 int, i766
+int, i767 int, i768 int, i769 int, i770 int, i771 int, i772 int, i773 int, i774
+int, i775 int, i776 int, i777 int, i778 int, i779 int, i780 int, i781 int, i782
+int, i783 int, i784 int, i785 int, i786 int, i787 int, i788 int, i789 int, i790
+int, i791 int, i792 int, i793 int, i794 int, i795 int, i796 int, i797 int, i798
+int, i799 int, i800 int, i801 int, i802 int, i803 int, i804 int, i805 int, i806
+int, i807 int, i808 int, i809 int, i810 int, i811 int, i812 int, i813 int, i814
+int, i815 int, i816 int, i817 int, i818 int, i819 int, i820 int, i821 int, i822
+int, i823 int, i824 int, i825 int, i826 int, i827 int, i828 int, i829 int, i830
+int, i831 int, i832 int, i833 int, i834 int, i835 int, i836 int, i837 int, i838
+int, i839 int, i840 int, i841 int, i842 int, i843 int, i844 int, i845 int, i846
+int, i847 int, i848 int, i849 int, i850 int, i851 int, i852 int, i853 int, i854
+int, i855 int, i856 int, i857 int, i858 int, i859 int, i860 int, i861 int, i862
+int, i863 int, i864 int, i865 int, i866 int, i867 int, i868 int, i869 int, i870
+int, i871 int, i872 int, i873 int, i874 int, i875 int, i876 int, i877 int, i878
+int, i879 int, i880 int, i881 int, i882 int, i883 int, i884 int, i885 int, i886
+int, i887 int, i888 int, i889 int, i890 int, i891 int, i892 int, i893 int, i894
+int, i895 int, i896 int, i897 int, i898 int, i899 int, i900 int, i901 int, i902
+int, i903 int, i904 int, i905 int, i906 int, i907 int, i908 int, i909 int, i910
+int, i911 int, i912 int, i913 int, i914 int, i915 int, i916 int, i917 int, i918
+int, i919 int, i920 int, i921 int, i922 int, i923 int, i924 int, i925 int, i926
+int, i927 int, i928 int, i929 int, i930 int, i931 int, i932 int, i933 int, i934
+int, i935 int, i936 int, i937 int, i938 int, i939 int, i940 int, i941 int, i942
+int, i943 int, i944 int, i945 int, i946 int, i947 int, i948 int, i949 int, i950
+int, i951 int, i952 int, i953 int, i954 int, i955 int, i956 int, i957 int, i958
+int, i959 int, i960 int, i961 int, i962 int, i963 int, i964 int, i965 int, i966
+int, i967 int, i968 int, i969 int, i970 int, i971 int, i972 int, i973 int, i974
+int, i975 int, i976 int, i977 int, i978 int, i979 int, i980 int, i981 int, i982
+int, i983 int, i984 int, i985 int, i986 int, i987 int, i988 int, i989 int, i990
+int, i991 int, i992 int, i993 int, i994 int, i995 int, i996 int, i997 int, i998
+int, i999 int, i1000 int, b blob) row_format=dynamic;
+insert into t1 values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, "Sergei");
+update t1 set b=repeat('a',256);
+update t1 set i1=0, i2=0, i3=0, i4=0, i5=0, i6=0, i7=0;
+check table t1;
+drop table t1;
diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test
index 199da9c4a84..1720ae69bbb 100644
--- a/mysql-test/t/loaddata.test
+++ b/mysql-test/t/loaddata.test
@@ -15,3 +15,8 @@ truncate table t1;
load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d);
SELECT * from t1;
drop table t1;
+
+create table t1 (a text, b text);
+load data infile '../../std_data/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
+select concat('|',a,'|'), concat('|',b,'|') from t1;
+drop table t1;
diff --git a/mysql-test/t/lock_tables_lost_commit.test b/mysql-test/t/lock_tables_lost_commit.test
index a8a7a65bd76..d8301017801 100644
--- a/mysql-test/t/lock_tables_lost_commit.test
+++ b/mysql-test/t/lock_tables_lost_commit.test
@@ -6,8 +6,8 @@ connect (con2,localhost,root,,);
connection con1;
--disable_warnings
drop table if exists t1;
---enable_warnings
create table t1(a int) type=innodb;
+--enable_warnings
lock tables t1 write;
insert into t1 values(10);
disconnect con1;
diff --git a/mysql-test/t/lowercase_table.test b/mysql-test/t/lowercase_table.test
index 2a3cc5b7e8f..28e45bde5c5 100644
--- a/mysql-test/t/lowercase_table.test
+++ b/mysql-test/t/lowercase_table.test
@@ -9,6 +9,10 @@ drop table if exists t1,t2,t3;
create table T1 (id int primary key, Word varchar(40) not null, Index(Word));
INSERT INTO T1 VALUES (1, 'a'), (2, 'b'), (3, 'c');
SELECT * FROM t1;
+SELECT T1.id from T1 LIMIT 1;
+SELECT T2.id from t1 as T2 LIMIT 1;
+# This gave an error in 4.0, but it's fixed in 4.1
+SELECT T2.id from t1 as t2 LIMIT 1;
RENAME TABLE T1 TO T2;
ALTER TABLE T2 ADD new_col int not null;
ALTER TABLE T2 RENAME T3;
diff --git a/mysql-test/t/mix_innodb_myisam_binlog.test b/mysql-test/t/mix_innodb_myisam_binlog.test
new file mode 100644
index 00000000000..314587feda6
--- /dev/null
+++ b/mysql-test/t/mix_innodb_myisam_binlog.test
@@ -0,0 +1,175 @@
+# Check that binlog is ok when a transaction mixes updates to InnoDB and
+# MyISAM.
+# It would be nice to make this a replication test, but in 4.0 the
+# slave is always with --skip-innodb in the testsuite. I (Guilhem) however
+# did some tests manually on a slave; tables are replicated fine and
+# Exec_master_log_pos advances as expected.
+
+-- source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists t1, t2;
+--enable_warnings
+
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+
+connection con1;
+create table t1 (a int) type=innodb;
+create table t2 (a int) type=myisam;
+
+reset master;
+
+begin;
+insert into t1 values(1);
+insert into t2 select * from t1;
+commit;
+
+show binlog events from 79;
+
+delete from t1;
+delete from t2;
+reset master;
+
+begin;
+insert into t1 values(2);
+insert into t2 select * from t1;
+# should say some changes to non-transact1onal tables couldn't be rolled back
+rollback;
+
+show binlog events from 79;
+
+delete from t1;
+delete from t2;
+reset master;
+
+begin;
+insert into t1 values(3);
+savepoint my_savepoint;
+insert into t1 values(4);
+insert into t2 select * from t1;
+rollback to savepoint my_savepoint;
+commit;
+
+show binlog events from 79;
+
+delete from t1;
+delete from t2;
+reset master;
+
+begin;
+insert into t1 values(5);
+savepoint my_savepoint;
+insert into t1 values(6);
+insert into t2 select * from t1;
+rollback to savepoint my_savepoint;
+insert into t1 values(7);
+commit;
+select a from t1 order by a; # check that savepoints work :)
+
+show binlog events from 79;
+
+# and when ROLLBACK is not explicit?
+delete from t1;
+delete from t2;
+reset master;
+
+select get_lock("a",10);
+begin;
+insert into t1 values(8);
+insert into t2 select * from t1;
+disconnect con1;
+
+connection con2;
+# We want to SHOW BINLOG EVENTS, to know what was logged. But there is no
+# guarantee that logging of the terminated con1 has been done yet (it may not
+# even be started, so con1 may have not even attempted to lock the binlog yet;
+# so SHOW BINLOG EVENTS may come before con1 does the loggin. To be sure that
+# logging has been done, we use a user lock.
+select get_lock("a",10);
+show binlog events from 79;
+
+# and when not in a transact1on?
+delete from t1;
+delete from t2;
+reset master;
+
+insert into t1 values(9);
+insert into t2 select * from t1;
+
+show binlog events from 79;
+
+# Check that when the query updat1ng the MyISAM table is the first in the
+# transact1on, we log it immediately.
+delete from t1;
+delete from t2;
+reset master;
+
+insert into t1 values(10); # first make t1 non-empty
+begin;
+insert into t2 select * from t1;
+show binlog events from 79;
+insert into t1 values(11);
+commit;
+
+show binlog events from 79;
+
+
+# Check that things work like before this BEGIN/ROLLBACK code was added,
+# when t2 is INNODB
+
+alter table t2 type=INNODB;
+
+delete from t1;
+delete from t2;
+reset master;
+
+begin;
+insert into t1 values(12);
+insert into t2 select * from t1;
+commit;
+
+show binlog events from 79;
+
+delete from t1;
+delete from t2;
+reset master;
+
+begin;
+insert into t1 values(13);
+insert into t2 select * from t1;
+rollback;
+
+show binlog events from 79;
+
+delete from t1;
+delete from t2;
+reset master;
+
+begin;
+insert into t1 values(14);
+savepoint my_savepoint;
+insert into t1 values(15);
+insert into t2 select * from t1;
+rollback to savepoint my_savepoint;
+commit;
+
+show binlog events from 79;
+
+delete from t1;
+delete from t2;
+reset master;
+
+begin;
+insert into t1 values(16);
+savepoint my_savepoint;
+insert into t1 values(17);
+insert into t2 select * from t1;
+rollback to savepoint my_savepoint;
+insert into t1 values(18);
+commit;
+select a from t1 order by a; # check that savepoints work :)
+
+show binlog events from 79;
+
+drop table t1,t2;
diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test
index 8e560cab455..6b59778bbce 100644
--- a/mysql-test/t/multi_update.test
+++ b/mysql-test/t/multi_update.test
@@ -268,3 +268,10 @@ create table t2(Z varchar(15));
insert into t2(Z) select concat(a.a,b.a,c.a,d.a) from t1 as a, t1 as b, t1 as c, t1 as d;
update t2,t3 set Z =param_scenario_costs;
drop table t1,t2,t3;
+create table t1 (a int, b int);
+create table t2 (a int, b int);
+insert into t1 values (1,1),(2,1),(3,1);
+insert into t2 values (1,1), (3,1);
+update t1 left join t2 on t1.a=t2.a set t1.b=2, t2.b=2 where t1.b=1 and t2.b=1 or t2.a is NULL;
+select t1.a, t1.b,t2.a, t2.b from t1 left join t2 on t1.a=t2.a where t1.b=1 and t2.b=1 or t2.a is NULL;
+drop table t1,t2;
diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test
index 5267b57259b..8c43ce1937f 100644
--- a/mysql-test/t/myisam.test
+++ b/mysql-test/t/myisam.test
@@ -295,6 +295,12 @@ insert into t1 values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, "Sergei");
+update t1 set b=repeat('a',256);
+update t1 set i1=0, i2=0, i3=0, i4=0, i5=0, i6=0, i7=0;
+check table t1;
+delete from t1 where i8=1;
+select i1,i2 from t1;
+check table t1;
drop table t1;
#
@@ -357,10 +363,54 @@ explain select * from t1 use index() where c=1;
drop table t1,t2;
#
+# Test bug when updating a split dynamic row where keys are not changed
+#
+
+create table t1 (a int not null auto_increment primary key, b varchar(255));
+insert into t1 (b) values (repeat('a',100)),(repeat('b',100)),(repeat('c',100));
+update t1 set b=repeat(left(b,1),200) where a=1;
+delete from t1 where (a & 1)= 0;
+update t1 set b=repeat('e',200) where a=1;
+flush tables;
+check table t1;
+
+#
+# check updating with keys
+#
+
+disable_query_log;
+let $1 = 100;
+while ($1)
+{
+ eval insert into t1 (b) values (repeat(char(($1 & 32)+65), $1));
+ dec $1;
+}
+enable_query_log;
+update t1 set b=repeat(left(b,1),255) where a between 1 and 5;
+update t1 set b=repeat(left(b,1),10) where a between 32 and 43;
+update t1 set b=repeat(left(b,1),2) where a between 64 and 66;
+update t1 set b=repeat(left(b,1),65) where a between 67 and 70;
+check table t1;
+insert into t1 (b) values (repeat('z',100));
+update t1 set b="test" where left(b,1) > 'n';
+check table t1;
+drop table t1;
+
+#
# Test RTREE index
#
--error 1235
CREATE TABLE t1 (`a` int(11) NOT NULL default '0', `b` int(11) NOT NULL default '0', UNIQUE KEY `a` USING RTREE (`a`,`b`)) TYPE=MyISAM;
# INSERT INTO t1 VALUES (1,1),(1,1);
# DELETE FROM rt WHERE a<1;
-DROP TABLE IF EXISTS t1;
+# DROP TABLE IF EXISTS t1;
+
+create table t1 (a int, b varchar(200), c text not null) checksum=1;
+create table t2 (a int, b varchar(200), c text not null) checksum=0;
+insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, "");
+insert t2 select * from t1;
+checksum table t1, t2, t3 quick;
+checksum table t1, t2, t3;
+checksum table t1, t2, t3 extended;
+#show table status;
+drop table t1,t2;
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
new file mode 100644
index 00000000000..c98fd4050f2
--- /dev/null
+++ b/mysql-test/t/mysqldump.test
@@ -0,0 +1,10 @@
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+# XML output
+
+CREATE TABLE t1(a int);
+INSERT INTO t1 VALUES (1), (2);
+--exec $MYSQL_DUMP -X test t1
+DROP TABLE t1;
diff --git a/mysql-test/t/openssl_1.test b/mysql-test/t/openssl_1.test
index c1c818efb70..39612f680f3 100644
--- a/mysql-test/t/openssl_1.test
+++ b/mysql-test/t/openssl_1.test
@@ -10,8 +10,8 @@ insert into t1 values (5);
grant select on test.* to ssl_user1@localhost require SSL;
grant select on test.* to ssl_user2@localhost require cipher "EDH-RSA-DES-CBC3-SHA";
-grant select on test.* to ssl_user3@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "/C=RU/L=orenburg/O=MySQL AB/OU=client/CN=walrus/Email=walrus@mysql.com";
-grant select on test.* to ssl_user4@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "/C=RU/L=orenburg/O=MySQL AB/OU=client/CN=walrus/Email=walrus@mysql.com" ISSUER "/C=RU/ST=Some-State/L=Orenburg/O=MySQL AB/CN=Walrus/Email=walrus@mysql.com";
+grant select on test.* to ssl_user3@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com";
+grant select on test.* to ssl_user4@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com" ISSUER "/C=SE/L=Uppsala/O=MySQL AB/CN=Abstract MySQL Developer/Email=abstract.mysql.developer@mysql.com";
flush privileges;
connect (con1,localhost,ssl_user1,,);
connect (con2,localhost,ssl_user2,,);
diff --git a/mysql-test/t/openssl_2.test b/mysql-test/t/openssl_2.test
deleted file mode 100644
index a8ee62db7f6..00000000000
--- a/mysql-test/t/openssl_2.test
+++ /dev/null
@@ -1,5 +0,0 @@
-# We want to test everything with SSL turned on.
--- source include/have_openssl_2.inc
-
-SHOW STATUS LIKE 'Ssl%';
-
diff --git a/mysql-test/t/packet.test b/mysql-test/t/packet.test
index 5c4e7efcaf3..cbeaa04ca52 100644
--- a/mysql-test/t/packet.test
+++ b/mysql-test/t/packet.test
@@ -12,8 +12,8 @@ set global net_buffer_length=100;
set net_buffer_length=100;
# Have to be > 1024 as min value of net_buffer_length is 1024
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
-# Should return NULL as 200 is bigger than max_allowed_packet
-select repeat('a',200);
+# Should return NULL as 2000 is bigger than max_allowed_packet
+select repeat('a',2000);
#
# Connection 2 should get error for too big packets
@@ -28,4 +28,4 @@ set max_allowed_packet=default;
set global net_buffer_length=default;
set net_buffer_length=default;
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
-select length(repeat('a',200));
+select length(repeat('a',2000));
diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test
index b784bcf5076..dcdf70ee612 100644
--- a/mysql-test/t/query_cache.test
+++ b/mysql-test/t/query_cache.test
@@ -11,7 +11,7 @@ flush query cache; # This crashed in some versions
reset query cache;
flush status;
--disable_warnings
-drop table if exists t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t00,mysqltest.t1;
+drop table if exists t1,t2,t3;
drop database if exists mysqltest;
--enable_warnings
@@ -487,531 +487,3 @@ select * from t1;
show status like "Qcache_queries_in_cache";
SET OPTION SQL_SELECT_LIMIT=DEFAULT;
drop table t1;
-
-#
-# more then 255 (257) merged tables test
-#
-flush status;
-create table t0(a int);
-create table t1(a int);
-create table t2(a int);
-create table t3(a int);
-create table t4(a int);
-create table t5(a int);
-create table t6(a int);
-create table t7(a int);
-create table t8(a int);
-create table t9(a int);
-create table t10(a int);
-create table t11(a int);
-create table t12(a int);
-create table t13(a int);
-create table t14(a int);
-create table t15(a int);
-create table t16(a int);
-create table t17(a int);
-create table t18(a int);
-create table t19(a int);
-create table t20(a int);
-create table t21(a int);
-create table t22(a int);
-create table t23(a int);
-create table t24(a int);
-create table t25(a int);
-create table t26(a int);
-create table t27(a int);
-create table t28(a int);
-create table t29(a int);
-create table t30(a int);
-create table t31(a int);
-create table t32(a int);
-create table t33(a int);
-create table t34(a int);
-create table t35(a int);
-create table t36(a int);
-create table t37(a int);
-create table t38(a int);
-create table t39(a int);
-create table t40(a int);
-create table t41(a int);
-create table t42(a int);
-create table t43(a int);
-create table t44(a int);
-create table t45(a int);
-create table t46(a int);
-create table t47(a int);
-create table t48(a int);
-create table t49(a int);
-create table t50(a int);
-create table t51(a int);
-create table t52(a int);
-create table t53(a int);
-create table t54(a int);
-create table t55(a int);
-create table t56(a int);
-create table t57(a int);
-create table t58(a int);
-create table t59(a int);
-create table t60(a int);
-create table t61(a int);
-create table t62(a int);
-create table t63(a int);
-create table t64(a int);
-create table t65(a int);
-create table t66(a int);
-create table t67(a int);
-create table t68(a int);
-create table t69(a int);
-create table t70(a int);
-create table t71(a int);
-create table t72(a int);
-create table t73(a int);
-create table t74(a int);
-create table t75(a int);
-create table t76(a int);
-create table t77(a int);
-create table t78(a int);
-create table t79(a int);
-create table t80(a int);
-create table t81(a int);
-create table t82(a int);
-create table t83(a int);
-create table t84(a int);
-create table t85(a int);
-create table t86(a int);
-create table t87(a int);
-create table t88(a int);
-create table t89(a int);
-create table t90(a int);
-create table t91(a int);
-create table t92(a int);
-create table t93(a int);
-create table t94(a int);
-create table t95(a int);
-create table t96(a int);
-create table t97(a int);
-create table t98(a int);
-create table t99(a int);
-create table t100(a int);
-create table t101(a int);
-create table t102(a int);
-create table t103(a int);
-create table t104(a int);
-create table t105(a int);
-create table t106(a int);
-create table t107(a int);
-create table t108(a int);
-create table t109(a int);
-create table t110(a int);
-create table t111(a int);
-create table t112(a int);
-create table t113(a int);
-create table t114(a int);
-create table t115(a int);
-create table t116(a int);
-create table t117(a int);
-create table t118(a int);
-create table t119(a int);
-create table t120(a int);
-create table t121(a int);
-create table t122(a int);
-create table t123(a int);
-create table t124(a int);
-create table t125(a int);
-create table t126(a int);
-create table t127(a int);
-create table t128(a int);
-create table t129(a int);
-create table t130(a int);
-create table t131(a int);
-create table t132(a int);
-create table t133(a int);
-create table t134(a int);
-create table t135(a int);
-create table t136(a int);
-create table t137(a int);
-create table t138(a int);
-create table t139(a int);
-create table t140(a int);
-create table t141(a int);
-create table t142(a int);
-create table t143(a int);
-create table t144(a int);
-create table t145(a int);
-create table t146(a int);
-create table t147(a int);
-create table t148(a int);
-create table t149(a int);
-create table t150(a int);
-create table t151(a int);
-create table t152(a int);
-create table t153(a int);
-create table t154(a int);
-create table t155(a int);
-create table t156(a int);
-create table t157(a int);
-create table t158(a int);
-create table t159(a int);
-create table t160(a int);
-create table t161(a int);
-create table t162(a int);
-create table t163(a int);
-create table t164(a int);
-create table t165(a int);
-create table t166(a int);
-create table t167(a int);
-create table t168(a int);
-create table t169(a int);
-create table t170(a int);
-create table t171(a int);
-create table t172(a int);
-create table t173(a int);
-create table t174(a int);
-create table t175(a int);
-create table t176(a int);
-create table t177(a int);
-create table t178(a int);
-create table t179(a int);
-create table t180(a int);
-create table t181(a int);
-create table t182(a int);
-create table t183(a int);
-create table t184(a int);
-create table t185(a int);
-create table t186(a int);
-create table t187(a int);
-create table t188(a int);
-create table t189(a int);
-create table t190(a int);
-create table t191(a int);
-create table t192(a int);
-create table t193(a int);
-create table t194(a int);
-create table t195(a int);
-create table t196(a int);
-create table t197(a int);
-create table t198(a int);
-create table t199(a int);
-create table t200(a int);
-create table t201(a int);
-create table t202(a int);
-create table t203(a int);
-create table t204(a int);
-create table t205(a int);
-create table t206(a int);
-create table t207(a int);
-create table t208(a int);
-create table t209(a int);
-create table t210(a int);
-create table t211(a int);
-create table t212(a int);
-create table t213(a int);
-create table t214(a int);
-create table t215(a int);
-create table t216(a int);
-create table t217(a int);
-create table t218(a int);
-create table t219(a int);
-create table t220(a int);
-create table t221(a int);
-create table t222(a int);
-create table t223(a int);
-create table t224(a int);
-create table t225(a int);
-create table t226(a int);
-create table t227(a int);
-create table t228(a int);
-create table t229(a int);
-create table t230(a int);
-create table t231(a int);
-create table t232(a int);
-create table t233(a int);
-create table t234(a int);
-create table t235(a int);
-create table t236(a int);
-create table t237(a int);
-create table t238(a int);
-create table t239(a int);
-create table t240(a int);
-create table t241(a int);
-create table t242(a int);
-create table t243(a int);
-create table t244(a int);
-create table t245(a int);
-create table t246(a int);
-create table t247(a int);
-create table t248(a int);
-create table t249(a int);
-create table t250(a int);
-create table t251(a int);
-create table t252(a int);
-create table t253(a int);
-create table t254(a int);
-create table t255(a int);
-create table t256(a int);
-create table t00 (a int) type=MERGE UNION=(t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256) INSERT_METHOD=FIRST;
-insert into t0 values (1),(2);
-insert into t1 values (1),(2);
-insert into t2 values (1),(2);
-insert into t3 values (1),(2);
-insert into t4 values (1),(2);
-insert into t5 values (1),(2);
-insert into t6 values (1),(2);
-insert into t7 values (1),(2);
-insert into t8 values (1),(2);
-insert into t9 values (1),(2);
-insert into t10 values (1),(2);
-insert into t11 values (1),(2);
-insert into t12 values (1),(2);
-insert into t13 values (1),(2);
-insert into t14 values (1),(2);
-insert into t15 values (1),(2);
-insert into t16 values (1),(2);
-insert into t17 values (1),(2);
-insert into t18 values (1),(2);
-insert into t19 values (1),(2);
-insert into t20 values (1),(2);
-insert into t21 values (1),(2);
-insert into t22 values (1),(2);
-insert into t23 values (1),(2);
-insert into t24 values (1),(2);
-insert into t25 values (1),(2);
-insert into t26 values (1),(2);
-insert into t27 values (1),(2);
-insert into t28 values (1),(2);
-insert into t29 values (1),(2);
-insert into t30 values (1),(2);
-insert into t31 values (1),(2);
-insert into t32 values (1),(2);
-insert into t33 values (1),(2);
-insert into t34 values (1),(2);
-insert into t35 values (1),(2);
-insert into t36 values (1),(2);
-insert into t37 values (1),(2);
-insert into t38 values (1),(2);
-insert into t39 values (1),(2);
-insert into t40 values (1),(2);
-insert into t41 values (1),(2);
-insert into t42 values (1),(2);
-insert into t43 values (1),(2);
-insert into t44 values (1),(2);
-insert into t45 values (1),(2);
-insert into t46 values (1),(2);
-insert into t47 values (1),(2);
-insert into t48 values (1),(2);
-insert into t49 values (1),(2);
-insert into t50 values (1),(2);
-insert into t51 values (1),(2);
-insert into t52 values (1),(2);
-insert into t53 values (1),(2);
-insert into t54 values (1),(2);
-insert into t55 values (1),(2);
-insert into t56 values (1),(2);
-insert into t57 values (1),(2);
-insert into t58 values (1),(2);
-insert into t59 values (1),(2);
-insert into t60 values (1),(2);
-insert into t61 values (1),(2);
-insert into t62 values (1),(2);
-insert into t63 values (1),(2);
-insert into t64 values (1),(2);
-insert into t65 values (1),(2);
-insert into t66 values (1),(2);
-insert into t67 values (1),(2);
-insert into t68 values (1),(2);
-insert into t69 values (1),(2);
-insert into t70 values (1),(2);
-insert into t71 values (1),(2);
-insert into t72 values (1),(2);
-insert into t73 values (1),(2);
-insert into t74 values (1),(2);
-insert into t75 values (1),(2);
-insert into t76 values (1),(2);
-insert into t77 values (1),(2);
-insert into t78 values (1),(2);
-insert into t79 values (1),(2);
-insert into t80 values (1),(2);
-insert into t81 values (1),(2);
-insert into t82 values (1),(2);
-insert into t83 values (1),(2);
-insert into t84 values (1),(2);
-insert into t85 values (1),(2);
-insert into t86 values (1),(2);
-insert into t87 values (1),(2);
-insert into t88 values (1),(2);
-insert into t89 values (1),(2);
-insert into t90 values (1),(2);
-insert into t91 values (1),(2);
-insert into t92 values (1),(2);
-insert into t93 values (1),(2);
-insert into t94 values (1),(2);
-insert into t95 values (1),(2);
-insert into t96 values (1),(2);
-insert into t97 values (1),(2);
-insert into t98 values (1),(2);
-insert into t99 values (1),(2);
-insert into t100 values (1),(2);
-insert into t101 values (1),(2);
-insert into t102 values (1),(2);
-insert into t103 values (1),(2);
-insert into t104 values (1),(2);
-insert into t105 values (1),(2);
-insert into t106 values (1),(2);
-insert into t107 values (1),(2);
-insert into t108 values (1),(2);
-insert into t109 values (1),(2);
-insert into t110 values (1),(2);
-insert into t111 values (1),(2);
-insert into t112 values (1),(2);
-insert into t113 values (1),(2);
-insert into t114 values (1),(2);
-insert into t115 values (1),(2);
-insert into t116 values (1),(2);
-insert into t117 values (1),(2);
-insert into t118 values (1),(2);
-insert into t119 values (1),(2);
-insert into t120 values (1),(2);
-insert into t121 values (1),(2);
-insert into t122 values (1),(2);
-insert into t123 values (1),(2);
-insert into t124 values (1),(2);
-insert into t125 values (1),(2);
-insert into t126 values (1),(2);
-insert into t127 values (1),(2);
-insert into t128 values (1),(2);
-insert into t129 values (1),(2);
-insert into t130 values (1),(2);
-insert into t131 values (1),(2);
-insert into t132 values (1),(2);
-insert into t133 values (1),(2);
-insert into t134 values (1),(2);
-insert into t135 values (1),(2);
-insert into t136 values (1),(2);
-insert into t137 values (1),(2);
-insert into t138 values (1),(2);
-insert into t139 values (1),(2);
-insert into t140 values (1),(2);
-insert into t141 values (1),(2);
-insert into t142 values (1),(2);
-insert into t143 values (1),(2);
-insert into t144 values (1),(2);
-insert into t145 values (1),(2);
-insert into t146 values (1),(2);
-insert into t147 values (1),(2);
-insert into t148 values (1),(2);
-insert into t149 values (1),(2);
-insert into t150 values (1),(2);
-insert into t151 values (1),(2);
-insert into t152 values (1),(2);
-insert into t153 values (1),(2);
-insert into t154 values (1),(2);
-insert into t155 values (1),(2);
-insert into t156 values (1),(2);
-insert into t157 values (1),(2);
-insert into t158 values (1),(2);
-insert into t159 values (1),(2);
-insert into t160 values (1),(2);
-insert into t161 values (1),(2);
-insert into t162 values (1),(2);
-insert into t163 values (1),(2);
-insert into t164 values (1),(2);
-insert into t165 values (1),(2);
-insert into t166 values (1),(2);
-insert into t167 values (1),(2);
-insert into t168 values (1),(2);
-insert into t169 values (1),(2);
-insert into t170 values (1),(2);
-insert into t171 values (1),(2);
-insert into t172 values (1),(2);
-insert into t173 values (1),(2);
-insert into t174 values (1),(2);
-insert into t175 values (1),(2);
-insert into t176 values (1),(2);
-insert into t177 values (1),(2);
-insert into t178 values (1),(2);
-insert into t179 values (1),(2);
-insert into t180 values (1),(2);
-insert into t181 values (1),(2);
-insert into t182 values (1),(2);
-insert into t183 values (1),(2);
-insert into t184 values (1),(2);
-insert into t185 values (1),(2);
-insert into t186 values (1),(2);
-insert into t187 values (1),(2);
-insert into t188 values (1),(2);
-insert into t189 values (1),(2);
-insert into t190 values (1),(2);
-insert into t191 values (1),(2);
-insert into t192 values (1),(2);
-insert into t193 values (1),(2);
-insert into t194 values (1),(2);
-insert into t195 values (1),(2);
-insert into t196 values (1),(2);
-insert into t197 values (1),(2);
-insert into t198 values (1),(2);
-insert into t199 values (1),(2);
-insert into t200 values (1),(2);
-insert into t201 values (1),(2);
-insert into t202 values (1),(2);
-insert into t203 values (1),(2);
-insert into t204 values (1),(2);
-insert into t205 values (1),(2);
-insert into t206 values (1),(2);
-insert into t207 values (1),(2);
-insert into t208 values (1),(2);
-insert into t209 values (1),(2);
-insert into t210 values (1),(2);
-insert into t211 values (1),(2);
-insert into t212 values (1),(2);
-insert into t213 values (1),(2);
-insert into t214 values (1),(2);
-insert into t215 values (1),(2);
-insert into t216 values (1),(2);
-insert into t217 values (1),(2);
-insert into t218 values (1),(2);
-insert into t219 values (1),(2);
-insert into t220 values (1),(2);
-insert into t221 values (1),(2);
-insert into t222 values (1),(2);
-insert into t223 values (1),(2);
-insert into t224 values (1),(2);
-insert into t225 values (1),(2);
-insert into t226 values (1),(2);
-insert into t227 values (1),(2);
-insert into t228 values (1),(2);
-insert into t229 values (1),(2);
-insert into t230 values (1),(2);
-insert into t231 values (1),(2);
-insert into t232 values (1),(2);
-insert into t233 values (1),(2);
-insert into t234 values (1),(2);
-insert into t235 values (1),(2);
-insert into t236 values (1),(2);
-insert into t237 values (1),(2);
-insert into t238 values (1),(2);
-insert into t239 values (1),(2);
-insert into t240 values (1),(2);
-insert into t241 values (1),(2);
-insert into t242 values (1),(2);
-insert into t243 values (1),(2);
-insert into t244 values (1),(2);
-insert into t245 values (1),(2);
-insert into t246 values (1),(2);
-insert into t247 values (1),(2);
-insert into t248 values (1),(2);
-insert into t249 values (1),(2);
-insert into t250 values (1),(2);
-insert into t251 values (1),(2);
-insert into t252 values (1),(2);
-insert into t253 values (1),(2);
-insert into t254 values (1),(2);
-insert into t255 values (1),(2);
-insert into t256 values (1),(2);
-enable_result_log;
-select count(*) from t00;
-select count(*) from t00;
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_hits";
-delete from t256;
-show status like "Qcache_queries_in_cache";
-drop table t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t00;
diff --git a/mysql-test/t/query_cache_merge.test b/mysql-test/t/query_cache_merge.test
new file mode 100644
index 00000000000..02e316932a3
--- /dev/null
+++ b/mysql-test/t/query_cache_merge.test
@@ -0,0 +1,38 @@
+# Test query cache with many tables
+
+--source include/have_query_cache.inc
+let $LIMIT=`SHOW VARIABLES LIKE 'open_files_limit'`;
+let $MIN_LIMIT=600;
+let $MAX_LIMIT=65536;
+--source include/check_var_limit.inc
+
+SET @@global.query_cache_size=1355776;
+
+#
+# more then 255 (257) merged tables test
+#
+
+flush status;
+disable_query_log;
+--disable_warnings
+let $1 = 257;
+while ($1)
+{
+ eval drop table if exists t$1;
+ eval create table t$1(a int);
+ eval insert into t$1 values (1),(2);
+ dec $1;
+}
+--enable_warnings
+
+create table t00 (a int) type=MERGE UNION=(t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257) INSERT_METHOD=FIRST;
+enable_query_log;
+select count(*) from t00;
+select count(*) from t00;
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_hits";
+delete from t256;
+show status like "Qcache_queries_in_cache";
+drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257,t00;
+
+SET @@global.query_cache_size=0;
diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test
index 2f7de168640..7bf6570b558 100644
--- a/mysql-test/t/range.test
+++ b/mysql-test/t/range.test
@@ -3,7 +3,7 @@
#
--disable_warnings
-drop table if exists t1, t2;
+drop table if exists t1;
--enable_warnings
CREATE TABLE t1 (
@@ -174,6 +174,7 @@ select count(*) from t1 where art = 'j' or art = 'J';
select count(*) from t1 where art = 'j';
select count(*) from t1 where art = 'J';
drop table t1;
+
create table t1 ( id1 int not null, id2 int not null, idnull int null, c char(20), primary key (id1,id2));
insert into t1 values (0,1,NULL,"aaa"), (1,1,NULL,"aaa"), (2,1,NULL,"aaa"),
(3,1,NULL,"aaa"), (4,1,NULL,"aaa"), (5,1,NULL,"aaa"),
@@ -185,85 +186,42 @@ insert into t1 values (0,1,NULL,"aaa"), (1,1,NULL,"aaa"), (2,1,NULL,"aaa"),
select a.id1, b.idnull from t1 as a, t1 as b where a.id2=1 and a.id1=1 and b.id1=a.idnull order by b.id2 desc limit 1;
drop table t1;
-
#
-# Problem with optimizing !=
+# BETWEEN problems
#
+create table t1 (x int, y int, index(x), index(y));
+insert into t1 (x) values (1),(2),(3),(4),(5),(6),(7),(8),(9);
+update t1 set y=x;
+# between with only one end fixed
+explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 7 and t1.y+0;
+explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 7 and t2.x <= t1.y+0;
+# between with both expressions on both ends
+explain select * from t1, t1 t2 where t1.y = 2 and t2.x between t1.y-1 and t1.y+1;
+explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= t1.y-1 and t2.x <= t1.y+1;
+# equation propagation
+explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 0 and t1.y;
+explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 0 and t2.x <= t1.y;
+# testing IN
+explain select count(*) from t1 where x in (1);
+explain select count(*) from t1 where x in (1,2);
+drop table t1;
-create table t1 (
- id int not null auto_increment,
- name char(1) not null,
- uid int not null,
- primary key (id),
- index uid_index (uid));
-
-create table t2 (
- id int not null auto_increment,
- name char(1) not null,
- uid int not null,
- primary key (id),
- index uid_index (uid));
-
-insert into t1(id, uid, name) values(1, 0, ' ');
-insert into t1(uid, name) values(0, ' ');
-
-insert into t2(uid, name) select uid, name from t1;
-insert into t1(uid, name) select uid, name from t2;
-insert into t2(uid, name) select uid, name from t1;
-insert into t1(uid, name) select uid, name from t2;
-insert into t2(uid, name) select uid, name from t1;
-insert into t1(uid, name) select uid, name from t2;
-insert into t2(uid, name) select uid, name from t1;
-insert into t1(uid, name) select uid, name from t2;
-insert into t2(uid, name) select uid, name from t1;
-insert into t1(uid, name) select uid, name from t2;
-insert into t2(uid, name) select uid, name from t1;
-insert into t2(uid, name) select uid, name from t1;
-insert into t2(uid, name) select uid, name from t1;
-insert into t2(uid, name) select uid, name from t1;
-insert into t1(uid, name) select uid, name from t2;
-
-delete from t2;
-insert into t2(uid, name) values
- (1, CHAR(64+1)),
- (2, CHAR(64+2)),
- (3, CHAR(64+3)),
- (4, CHAR(64+4)),
- (5, CHAR(64+5)),
- (6, CHAR(64+6)),
- (7, CHAR(64+7)),
- (8, CHAR(64+8)),
- (9, CHAR(64+9)),
- (10, CHAR(64+10)),
- (11, CHAR(64+11)),
- (12, CHAR(64+12)),
- (13, CHAR(64+13)),
- (14, CHAR(64+14)),
- (15, CHAR(64+15)),
- (16, CHAR(64+16)),
- (17, CHAR(64+17)),
- (18, CHAR(64+18)),
- (19, CHAR(64+19)),
- (20, CHAR(64+20)),
- (21, CHAR(64+21)),
- (22, CHAR(64+22)),
- (23, CHAR(64+23)),
- (24, CHAR(64+24)),
- (25, CHAR(64+25)),
- (26, CHAR(64+26));
-
-insert into t1(uid, name) select uid, name from t2;
-
-delete from t2;
-insert into t2(id, uid, name) select id, uid, name from t1;
-
-select count(*) from t1;
-select count(*) from t2;
+#
+# bug #1172
+#
+CREATE TABLE t1 (key1 int(11) NOT NULL default '0', KEY i1 (key1), KEY i2 (key1));
+INSERT INTO t1 VALUES (0),(0),(1),(1);
+CREATE TABLE t2 (keya int(11) NOT NULL default '0', KEY j1 (keya));
+INSERT INTO t2 VALUES (0),(0),(1),(1),(2),(2);
+explain select * from t1, t2 where (t1.key1 <t2.keya + 1) and t2.keya=3;
+explain select * from t1 force index(i2), t2 where (t1.key1 <t2.keya + 1) and t2.keya=3;
+DROP TABLE t1,t2;
-explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0;
-explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid != 0;
+# test for a bug with in() and unique key
-select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0;
-select * from t1, t2 where t1.uid=t2.uid AND t1.uid != 0;
+create table t1 (id int(10) primary key);
+insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9);
-drop table t1,t2;
+select id from t1 where id in (2,5,9) ;
+select id from t1 where id=2 or id=5 or id=9 ;
+drop table t1;
diff --git a/mysql-test/t/rpl_loaddata.test b/mysql-test/t/rpl_loaddata.test
index 061066c7a31..478d4b75a36 100644
--- a/mysql-test/t/rpl_loaddata.test
+++ b/mysql-test/t/rpl_loaddata.test
@@ -13,6 +13,10 @@
source include/master-slave.inc;
+connection slave;
+reset master;
+connection master;
+
create table t1(a int not null auto_increment, b int, primary key(a) );
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
@@ -28,6 +32,14 @@ sync_with_master;
select * from t1;
select * from t3;
+# We want to be sure that LOAD DATA is in the slave's binlog.
+# But we can't simply read this binlog, because as the slave has not been
+# restarted for this test, the file_id is uncertain (would cause test
+# failures). So instead, we test if the binlog looks long enough to
+# contain LOAD DATA. That is, I (Guilhem) have done SHOW BINLOG EVENTS on my
+# machine, saw that the binlog is of size 964 when things go fine.
+# If LOAD DATA was not logged, the binlog would be shorter.
+show master status;
connection master;
@@ -39,6 +51,9 @@ create table t1(a int, b int, unique(b));
save_master_pos;
connection slave;
sync_with_master;
+
+# See if slave stops when there's a duplicate entry for key error in LOAD DATA
+
insert into t1 values(1,10);
connection master;
diff --git a/mysql-test/t/rpl_loaddata_rule_m-master.opt b/mysql-test/t/rpl_loaddata_rule_m-master.opt
new file mode 100644
index 00000000000..9d4a8f0b95e
--- /dev/null
+++ b/mysql-test/t/rpl_loaddata_rule_m-master.opt
@@ -0,0 +1 @@
+--binlog_ignore_db=test
diff --git a/mysql-test/t/rpl_loaddata_rule_m.test b/mysql-test/t/rpl_loaddata_rule_m.test
new file mode 100644
index 00000000000..18f295f8ce2
--- /dev/null
+++ b/mysql-test/t/rpl_loaddata_rule_m.test
@@ -0,0 +1,18 @@
+# See if the master logs LOAD DATA INFILE correctly when binlog_*_db rules
+# exist.
+# This is for BUG#1100 (LOAD DATA INFILE was half-logged).
+
+source include/master-slave.inc;
+connection slave;
+reset master;
+
+# Test logging on master
+
+connection master;
+# 'test' is the current database
+create database test2;
+create table t1(a int, b int, unique(b));
+use test2;
+load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
+show binlog events from 79; # should be nothing
+drop database test2;
diff --git a/mysql-test/t/rpl_loaddata_rule_s-slave.opt b/mysql-test/t/rpl_loaddata_rule_s-slave.opt
new file mode 100644
index 00000000000..9d4a8f0b95e
--- /dev/null
+++ b/mysql-test/t/rpl_loaddata_rule_s-slave.opt
@@ -0,0 +1 @@
+--binlog_ignore_db=test
diff --git a/mysql-test/t/rpl_loaddata_rule_s.test b/mysql-test/t/rpl_loaddata_rule_s.test
new file mode 100644
index 00000000000..1ea4f6825f5
--- /dev/null
+++ b/mysql-test/t/rpl_loaddata_rule_s.test
@@ -0,0 +1,20 @@
+# See if the slave logs (in its own binlog, with --log-slave-updates) a
+# replicated LOAD DATA INFILE correctly when it has binlog_*_db rules.
+# This is for BUG#1100 (LOAD DATA INFILE was half-logged).
+
+source include/master-slave.inc;
+connection slave;
+reset master;
+
+connection master;
+# 'test' is the current database
+create table t1(a int, b int, unique(b));
+load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
+
+# Test logging on slave;
+
+save_master_pos;
+connection slave;
+sync_with_master;
+select count(*) from t1; # check that LOAD was replicated
+show binlog events from 79; # should be nothing
diff --git a/mysql-test/t/rpl_log-slave.opt b/mysql-test/t/rpl_log-slave.opt
new file mode 100644
index 00000000000..8b137891791
--- /dev/null
+++ b/mysql-test/t/rpl_log-slave.opt
@@ -0,0 +1 @@
+
diff --git a/mysql-test/t/rpl_log.test b/mysql-test/t/rpl_log.test
index f64aa292d30..77be92f64fd 100644
--- a/mysql-test/t/rpl_log.test
+++ b/mysql-test/t/rpl_log.test
@@ -15,6 +15,16 @@ sync_with_master;
stop slave;
reset master;
reset slave;
+# We are going to read the slave's binlog which contains file_id (for some LOAD
+# DATA INFILE); to make it repeatable (not influenced by other tests), we need
+# to stop and start the slave, to be sure file_id will start from 1.
+# This can be done with 'server_stop slave', but
+# this would require the manager, so most of the time the test will be skipped
+# :(
+# To workaround this, I (Guilhem) add a (empty) rpl_log-slave.opt (because when
+# mysql-test-run finds such a file it restarts the slave before doing the
+# test). That's not very elegant but I could find no better way, sorry.
+
let $VERSION=`select version()`;
connection master;
@@ -23,7 +33,8 @@ create table t1(n int not null auto_increment primary key);
insert into t1 values (NULL);
drop table t1;
create table t1 (word char(20) not null);
-load data infile '../../std_data/words.dat' into table t1;
+load data infile '../../std_data/words.dat' into table t1 ignore 1 lines;
+select count(*) from t1;
drop table t1;
--replace_result $VERSION VERSION
show binlog events;
@@ -45,8 +56,8 @@ flush logs;
# So, depending on a few milliseconds, we end up with 2 rotate events in the
# relay log or one, which influences the output of SHOW SLAVE STATUS, making
# it not predictable and causing random test failures.
-# To make it predictable, we do a useless update now, but which has the interest
-# of making the slave catch both rotate events.
+# To make it predictable, we do a useless update now, but which has the
+# interest of making the slave catch both rotate events.
create table t5 (a int);
drop table t5;
diff --git a/mysql-test/t/rpl_openssl.test b/mysql-test/t/rpl_openssl.test
new file mode 100644
index 00000000000..bd658786bd7
--- /dev/null
+++ b/mysql-test/t/rpl_openssl.test
@@ -0,0 +1,60 @@
+source include/have_openssl_1.inc;
+source include/master-slave.inc;
+
+# We don't test all types of ssl auth params here since it's a bit hard
+# until problems with OpenSSL 0.9.7 are unresolved
+
+# creating replication user for whom ssl auth is required
+# preparing playground
+connection master;
+grant replication slave on *.* to replssl@'%' require ssl;
+create table t1 (t int);
+save_master_pos;
+
+#syncing with master
+connection slave;
+sync_with_master;
+
+#trying to use this user without ssl
+stop slave;
+change master to master_user='replssl',master_password='';
+start slave;
+
+#showing that replication don't work
+connection master;
+insert into t1 values (1);
+#reasonable timeout for changes to propagate to slave
+sleep 3;
+connection slave;
+select * from t1;
+
+#showing that replication could work with ssl params
+stop slave;
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+eval change master to master_ssl=1 , master_ssl_ca ='$MYSQL_TEST_DIR/std_data/cacert.pem', master_ssl_cert='$MYSQL_TEST_DIR/std_data/client-cert.pem', master_ssl_key='$MYSQL_TEST_DIR/std_data/client-key.pem';
+start slave;
+
+#avoiding unneeded sleeps
+connection master;
+save_master_pos;
+connection slave;
+sync_with_master;
+
+#checking that replication is ok
+select * from t1;
+
+#checking show slave status
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
+show slave status;
+
+#checking if replication works without ssl also performing clean up
+stop slave;
+change master to master_user='root',master_password='', master_ssl=0;
+start slave;
+connection master;
+drop table t1;
+save_master_pos;
+connection slave;
+sync_with_master;
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
+show slave status;
diff --git a/mysql-test/t/rpl_relayrotate.test b/mysql-test/t/rpl_relayrotate.test
index 3df55eea57d..3f315ba9365 100644
--- a/mysql-test/t/rpl_relayrotate.test
+++ b/mysql-test/t/rpl_relayrotate.test
@@ -40,7 +40,7 @@ start slave;
# Usually it stops when the SQL thread is around the 15th relay log.
# We cannot use MASTER_POS_WAIT() as master's position
# increases only when the slave executes the COMMIT.
-system sleep 1;
+sleep 1;
stop slave;
# We suppose the SQL thread stopped before COMMIT.
# If so the transaction was rolled back
diff --git a/mysql-test/t/rpl_until.test b/mysql-test/t/rpl_until.test
new file mode 100644
index 00000000000..69101f8fa2c
--- /dev/null
+++ b/mysql-test/t/rpl_until.test
@@ -0,0 +1,77 @@
+source include/master-slave.inc;
+
+# prepare version for substitutions
+let $VERSION=`select version()`;
+
+# stop slave before he will start replication also sync with master
+# for avoiding undetermenistic behaviour
+save_master_pos;
+connection slave;
+sync_with_master;
+stop slave;
+
+connection master;
+# create some events on master
+create table t1(n int not null auto_increment primary key);
+insert into t1 values (1),(2),(3),(4);
+drop table t1;
+create table t2(n int not null auto_increment primary key);
+insert into t2 values (1),(2);
+insert into t2 values (3),(4);
+drop table t2;
+--replace_result $VERSION VERSION
+show binlog events;
+
+# try to replicate all queries until drop of t1
+connection slave;
+start slave until master_log_file='master-bin.000001', master_log_pos=244;
+sleep 2;
+# here table should be still not deleted
+select * from t1;
+--replace_result $MASTER_MYPORT MASTER_MYPORT
+show slave status;
+
+# this should fail right after start
+start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
+# again this table should be still not deleted
+select * from t1;
+sleep 2;
+--replace_result $MASTER_MYPORT MASTER_MYPORT
+show slave status;
+
+# try replicate all until second insert to t2;
+start slave until relay_log_file='slave-relay-bin.000002', relay_log_pos=537;
+sleep 2;
+select * from t2;
+--replace_result $MASTER_MYPORT MASTER_MYPORT
+show slave status;
+
+# clean up
+start slave;
+connection master;
+save_master_pos;
+connection slave;
+sync_with_master;
+stop slave;
+
+# this should stop immideately
+start slave until master_log_file='master-bin.000001', master_log_pos=561;
+sleep 2;
+# here the sql slave thread should be stopped
+--replace_result $MASTER_MYPORT MASTER_MYPORT
+show slave status;
+
+#testing various error conditions
+--error 1276
+start slave until master_log_file='master-bin', master_log_pos=561;
+--error 1276
+start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
+--error 1276
+start slave until master_log_file='master-bin.000001';
+--error 1276
+start slave until relay_log_file='slave-relay-bin.000002';
+--error 1276
+start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
+
+start slave sql_thread;
+start slave until master_log_file='master-bin.000001', master_log_pos=561;
diff --git a/mysql-test/t/sel000033.test b/mysql-test/t/sel000033.test
deleted file mode 100644
index 72e096311ce..00000000000
--- a/mysql-test/t/sel000033.test
+++ /dev/null
@@ -1,20 +0,0 @@
-# sel000033
-#
-# Versions
-# --------
-# 3.22
-# 3.23
-#
-# Description
-# -----------
-# test for a bug with in() and unique key
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (id int(10) primary key);
-insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-select id from t1 where id in (2,5,9) ;
-select id from t1 where id=2 or id=5 or id=9 ;
-drop table t1;
diff --git a/mysql-test/t/sel000100.test b/mysql-test/t/sel000100.test
deleted file mode 100644
index c9923d178c6..00000000000
--- a/mysql-test/t/sel000100.test
+++ /dev/null
@@ -1,48 +0,0 @@
---disable_warnings
-DROP TABLE IF EXISTS t1,t2;
---enable_warnings
-
-CREATE TABLE t1 (
- ID int(11) NOT NULL auto_increment,
- NAME varchar(75) DEFAULT '' NOT NULL,
- LINK_ID int(11) DEFAULT '0' NOT NULL,
- PRIMARY KEY (ID),
- KEY NAME (NAME),
- KEY LINK_ID (LINK_ID)
-);
-
-INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (1,'Mike',0);
-INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (2,'Jack',0);
-INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (3,'Bill',0);
-
-CREATE TABLE t2 (
- ID int(11) NOT NULL auto_increment,
- NAME varchar(150) DEFAULT '' NOT NULL,
- PRIMARY KEY (ID),
- KEY NAME (NAME)
-);
-
-SELECT DISTINCT
- t2.id AS key_link_id,
- t2.name AS link
-FROM t1
-LEFT JOIN t2 ON t1.link_id=t2.id
-GROUP BY t1.id
-ORDER BY link;
-
-drop table t1,t2;
-
-#
-# test case for #674
-#
-CREATE TABLE t1 (
- html varchar(5) default NULL,
- rin int(11) default '0',
- out int(11) default '0'
-) TYPE=MyISAM;
-
-INSERT INTO t1 VALUES ('1',1,0);
-
-SELECT DISTINCT html,SUM(out)/(SUM(rin)+1) as 'prod' FROM t1 GROUP BY rin;
-
-drop table t1;
diff --git a/mysql-test/t/select_safe.test b/mysql-test/t/select_safe.test
index 1f46355d39b..3cafd31a879 100644
--- a/mysql-test/t/select_safe.test
+++ b/mysql-test/t/select_safe.test
@@ -59,9 +59,9 @@ SELECT * from t1;
SELECT @@MAX_SEEKS_FOR_KEY;
analyze table t1;
insert into t1 values (null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a");
-explain select * from t1,t1 as t2 where t1.b=t2.b;
+explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
set MAX_SEEKS_FOR_KEY=1;
-explain select * from t1,t1 as t2 where t1.b=t2.b;
+explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
SET MAX_SEEKS_FOR_KEY=DEFAULT;
drop table t1;
diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test
index f6f0ac0b82b..633826186be 100644
--- a/mysql-test/t/show_check.test
+++ b/mysql-test/t/show_check.test
@@ -120,6 +120,13 @@ insert into t1 (type_timestamp) values ("2003-02-07 10:00:01");
select * from t1;
drop table t1;
+#
+# Check metadata
+#
+create table t1 (a int not null);
+create table t2 select max(a) from t1;
+show columns from t2;
+drop table t1,t2;
# Check auto conversions of types
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index 457b64a5a11..c6a574bae62 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -606,6 +606,7 @@ CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a+0)) a;
SHOW CREATE TABLE t1;
drop table t1;
CREATE TABLE t1 SELECT (SELECT 1 as a UNION SELECT 1+1 limit 1,1) as a;
+select * from t1;
SHOW CREATE TABLE t1;
drop table t1;
@@ -892,9 +893,11 @@ DROP TABLE t1, t2;
#
# UNION unlocking test
#
+--disable_warnings
create table t1 (a int) type=innodb;
create table t2 (a int) type=innodb;
create table t3 (a int) type=innodb;
+--enable_warnings
insert into t1 values (1),(2),(3),(4);
insert into t2 values (10),(20),(30),(40);
insert into t3 values (1),(2),(10),(50);
@@ -912,3 +915,38 @@ select * from t1 where s1 > (select max(s2) from t1);
-- error 1266
select * from t1 where s1 > any (select max(s2) from t1);
drop table t1;
+
+#
+# aggregate functions reinitialization
+#
+create table t1(toid int,rd int);
+create table t2(userid int,pmnew int,pmtotal int);
+insert into t2 values(1,0,0),(2,0,0);
+insert into t1 values(1,0),(1,0),(1,0),(1,12),(1,15),(1,123),(1,12312),(1,12312),(1,123),(2,0),(2,0),(2,1),(2,2);
+select userid,pmtotal,pmnew, (select count(rd) from t1 where toid=t2.userid) calc_total, (select count(rd) from t1 where rd=0 and toid=t2.userid) calc_new from t2 where userid in (select distinct toid from t1);
+drop table t1, t2;
+
+#
+# row union
+#
+create table t1 (s1 char(5));
+-- error 1240
+select (select 'a','b' from t1 union select 'a','b' from t1) from t1;
+insert into t1 values ('tttt');
+select * from t1 where ('a','b')=(select 'a','b' from t1 union select 'a','b' from t1);
+explain (select * from t1);
+(select * from t1);
+drop table t1;
+
+#
+# IN optimisation test results
+#
+create table t1 (s1 char(5), index s1(s1));
+create table t2 (s1 char(5), index s1(s1));
+insert into t1 values ('a1'),('a2'),('a3');
+insert into t2 values ('a1'),('a2');
+select s1, s1 NOT IN (SELECT s1 FROM t2) from t1;
+select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
+explain select s1, s1 NOT IN (SELECT s1 FROM t2) from t1;
+explain select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
+drop table t1,t2;
diff --git a/mysql-test/t/symlink.test b/mysql-test/t/symlink.test
index a8daf36ed10..f618c342936 100644
--- a/mysql-test/t/symlink.test
+++ b/mysql-test/t/symlink.test
@@ -49,6 +49,7 @@ check table t9;
optimize table t9;
repair table t9;
alter table t9 add column c int not null;
+--replace_result $MYSQL_TEST_DIR TEST_DIR
show create table t9;
# Test renames
@@ -89,5 +90,6 @@ enable_query_log;
alter table t9 rename mysqltest.t9;
select count(*) from mysqltest.t9;
+--replace_result $MYSQL_TEST_DIR TEST_DIR
show create table mysqltest.t9;
drop database mysqltest;
diff --git a/mysql-test/t/type_nchar.test b/mysql-test/t/type_nchar.test
new file mode 100644
index 00000000000..e85609e3f0c
--- /dev/null
+++ b/mysql-test/t/type_nchar.test
@@ -0,0 +1,35 @@
+#
+# Test nchar/nvarchar
+#
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+create table t1 (c nchar(10));
+show create table t1;
+drop table t1;
+
+create table t1 (c national char(10));
+show create table t1;
+drop table t1;
+
+create table t1 (c national varchar(10));
+show create table t1;
+drop table t1;
+
+create table t1 (c nvarchar(10));
+show create table t1;
+drop table t1;
+
+create table t1 (c nchar varchar(10));
+show create table t1;
+drop table t1;
+
+create table t1 (c national character varying(10));
+show create table t1;
+drop table t1;
+
+create table t1 (c nchar varying(10));
+show create table t1;
+drop table t1;
+
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index 3506c713907..dfb5a15bf40 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -194,6 +194,62 @@ select * from t4;
drop table t1,t2,t3,t4;
#
+# Test of SQL_CALC_FOUND_ROW handling
+#
+create table t1 (a int);
+insert into t1 values (1),(2),(3);
+create table t2 (a int);
+insert into t2 values (3),(4),(5);
+
+# Test global limits
+(SELECT SQL_CALC_FOUND_ROWS * FROM t1) UNION all (SELECT * FROM t2) LIMIT 1;
+select found_rows();
+(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION all (SELECT * FROM t2) LIMIT 2;
+select found_rows();
+
+# Test cases where found_rows() should return number of returned rows
+(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION all (SELECT * FROM t2);
+select found_rows();
+(SELECT SQL_CALC_FOUND_ROWS * FROM t1) UNION all (SELECT * FROM t2 LIMIT 1);
+select found_rows();
+# This used to work in 4.0 but not anymore in 4.1
+--error 1149
+(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION SELECT * FROM t2 LIMIT 1;
+#select found_rows();
+
+# In these case found_rows() should work
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1 UNION all SELECT * FROM t2 LIMIT 2;
+select found_rows();
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION all SELECT * FROM t2 LIMIT 2;
+select found_rows();
+
+# The following examples will not be exact
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION SELECT * FROM t2 LIMIT 2;
+select found_rows();
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION SELECT * FROM t2 LIMIT 100;
+select found_rows();
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 100 UNION SELECT * FROM t2;
+select found_rows();
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1 UNION SELECT * FROM t2;
+select found_rows();
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1 UNION SELECT * FROM t2 LIMIT 2;
+select found_rows();
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION SELECT * FROM t2 LIMIT 2,2;
+select found_rows();
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 limit 2,2 UNION SELECT * FROM t2;
+select found_rows();
+
+# Test some limits with ORDER BY
+SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a desc LIMIT 1;
+(SELECT * FROM t1 ORDER by a) UNION ALL (SELECT * FROM t2 ORDER BY a) ORDER BY A desc LIMIT 4;
+
+# Wrong usage
+--error 1234
+(SELECT * FROM t1) UNION all (SELECT SQL_CALC_FOUND_ROWS * FROM t2) LIMIT 1;
+
+drop table t1,t2;
+
+#
# Test for another bug with UNION and LEFT JOIN
#
CREATE TABLE t1 ( id int(3) unsigned default '0') TYPE=MyISAM;
diff --git a/mysys/Makefile.am b/mysys/Makefile.am
index 5b1c859cb2a..9e563755ebd 100644
--- a/mysys/Makefile.am
+++ b/mysys/Makefile.am
@@ -29,7 +29,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c\
mf_path.c mf_loadpath.c\
my_open.c my_create.c my_dup.c my_seek.c my_read.c \
my_pread.c my_write.c \
- mf_keycache.c \
+ mf_keycache.c my_crc32.c \
mf_iocache.c mf_iocache2.c mf_cache.c mf_tempfile.c \
mf_tempdir.c my_lock.c mf_brkhant.c my_alarm.c \
my_malloc.c my_realloc.c my_once.c mulalloc.c \
diff --git a/mysys/charset.c b/mysys/charset.c
index 7a82f8780a0..7d0516ac81b 100644
--- a/mysys/charset.c
+++ b/mysys/charset.c
@@ -119,7 +119,7 @@ static void simple_cs_init_functions(CHARSET_INFO *cs)
if (cs->state & MY_CS_BINSORT)
{
- cs->coll= &my_collation_bin_handler;
+ cs->coll= &my_collation_8bit_bin_handler;
}
else
{
@@ -226,7 +226,6 @@ static my_bool create_fromuni(CHARSET_INFO *cs)
static void simple_cs_copy_data(CHARSET_INFO *to, CHARSET_INFO *from)
{
to->number= from->number ? from->number : to->number;
- to->state|= from->state;
if (from->csname)
to->csname= my_once_strdup(from->csname,MYF(MY_WME));
@@ -278,12 +277,10 @@ static my_bool simple_cs_is_full(CHARSET_INFO *cs)
static int add_collation(CHARSET_INFO *cs)
{
- if (cs->name && (cs->number || (cs->number=get_charset_number(cs->name))))
+ if (cs->name && (cs->number || (cs->number=get_collation_number(cs->name))))
{
if (!all_charsets[cs->number])
{
- if (cs->state & MY_CS_COMPILED)
- goto clear;
if (!(all_charsets[cs->number]=
(CHARSET_INFO*) my_once_alloc(sizeof(CHARSET_INFO),MYF(0))))
return MY_XML_ERROR;
@@ -296,6 +293,8 @@ static int add_collation(CHARSET_INFO *cs)
if (cs->binary_number == cs->number)
cs->state |= MY_CS_BINSORT;
+ all_charsets[cs->number]->state|= cs->state;
+
if (!(all_charsets[cs->number]->state & MY_CS_COMPILED))
{
simple_cs_init_functions(all_charsets[cs->number]);
@@ -304,15 +303,28 @@ static int add_collation(CHARSET_INFO *cs)
{
all_charsets[cs->number]->state |= MY_CS_LOADED;
}
+ all_charsets[cs->number]->state|= MY_CS_AVAILABLE;
}
else
{
+ /*
+ We need the below to make get_charset_name()
+ and get_charset_number() working even if a
+ character set has not been really incompiled.
+ The above functions are used for example
+ in error message compiler extra/comp_err.c.
+ If a character set was compiled, this information
+ will get lost and overwritten in add_compiled_collation().
+ */
CHARSET_INFO *dst= all_charsets[cs->number];
- dst->state |= cs->state;
+ dst->number= cs->number;
if (cs->comment)
dst->comment= my_once_strdup(cs->comment,MYF(MY_WME));
+ if (cs->csname)
+ dst->csname= my_once_strdup(cs->csname,MYF(MY_WME));
+ if (cs->name)
+ dst->name= my_once_strdup(cs->name,MYF(MY_WME));
}
-clear:
cs->number= 0;
cs->primary_number= 0;
cs->binary_number= 0;
@@ -389,77 +401,79 @@ char *get_charsets_dir(char *buf)
CHARSET_INFO *all_charsets[256];
CHARSET_INFO *default_charset_info = &my_charset_latin1;
-#define MY_ADD_CHARSET(x) all_charsets[(x)->number]=(x)
+static void add_compiled_collation(CHARSET_INFO *cs)
+{
+ all_charsets[cs->number]= cs;
+ cs->state|= MY_CS_AVAILABLE;
+}
static my_bool init_compiled_charsets(myf flags __attribute__((unused)))
{
CHARSET_INFO *cs;
- MY_ADD_CHARSET(&my_charset_bin);
+ add_compiled_collation(&my_charset_bin);
- MY_ADD_CHARSET(&my_charset_latin1);
- MY_ADD_CHARSET(&my_charset_latin1_bin);
- MY_ADD_CHARSET(&my_charset_latin1_german2_ci);
+ add_compiled_collation(&my_charset_latin1);
+ add_compiled_collation(&my_charset_latin1_bin);
+ add_compiled_collation(&my_charset_latin1_german2_ci);
#ifdef HAVE_CHARSET_big5
- MY_ADD_CHARSET(&my_charset_big5_chinese_ci);
- MY_ADD_CHARSET(&my_charset_big5_bin);
+ add_compiled_collation(&my_charset_big5_chinese_ci);
+ add_compiled_collation(&my_charset_big5_bin);
#endif
#ifdef HAVE_CHARSET_cp1250
- MY_ADD_CHARSET(&my_charset_cp1250_czech_ci);
+ add_compiled_collation(&my_charset_cp1250_czech_ci);
#endif
#ifdef HAVE_CHARSET_latin2
- MY_ADD_CHARSET(&my_charset_latin2_czech_ci);
+ add_compiled_collation(&my_charset_latin2_czech_ci);
#endif
#ifdef HAVE_CHARSET_euckr
- MY_ADD_CHARSET(&my_charset_euckr_korean_ci);
- MY_ADD_CHARSET(&my_charset_euckr_bin);
+ add_compiled_collation(&my_charset_euckr_korean_ci);
+ add_compiled_collation(&my_charset_euckr_bin);
#endif
#ifdef HAVE_CHARSET_gb2312
- MY_ADD_CHARSET(&my_charset_gb2312_chinese_ci);
- MY_ADD_CHARSET(&my_charset_gb2312_bin);
+ add_compiled_collation(&my_charset_gb2312_chinese_ci);
+ add_compiled_collation(&my_charset_gb2312_bin);
#endif
#ifdef HAVE_CHARSET_gbk
- MY_ADD_CHARSET(&my_charset_gbk_chinese_ci);
- MY_ADD_CHARSET(&my_charset_gbk_bin);
+ add_compiled_collation(&my_charset_gbk_chinese_ci);
+ add_compiled_collation(&my_charset_gbk_bin);
#endif
#ifdef HAVE_CHARSET_sjis
- MY_ADD_CHARSET(&my_charset_sjis_japanese_ci);
- MY_ADD_CHARSET(&my_charset_sjis_bin);
+ add_compiled_collation(&my_charset_sjis_japanese_ci);
+ add_compiled_collation(&my_charset_sjis_bin);
#endif
#ifdef HAVE_CHARSET_tis620
- MY_ADD_CHARSET(&my_charset_tis620_thai_ci);
- MY_ADD_CHARSET(&my_charset_tis620_bin);
+ add_compiled_collation(&my_charset_tis620_thai_ci);
+ add_compiled_collation(&my_charset_tis620_bin);
#endif
#ifdef HAVE_CHARSET_ucs2
- MY_ADD_CHARSET(&my_charset_ucs2_general_ci);
- MY_ADD_CHARSET(&my_charset_ucs2_bin);
+ add_compiled_collation(&my_charset_ucs2_general_ci);
+ add_compiled_collation(&my_charset_ucs2_bin);
#endif
#ifdef HAVE_CHARSET_ujis
- MY_ADD_CHARSET(&my_charset_ujis_japanese_ci);
- MY_ADD_CHARSET(&my_charset_ujis_bin);
+ add_compiled_collation(&my_charset_ujis_japanese_ci);
+ add_compiled_collation(&my_charset_ujis_bin);
#endif
#ifdef HAVE_CHARSET_utf8
- MY_ADD_CHARSET(&my_charset_utf8_general_ci);
- MY_ADD_CHARSET(&my_charset_utf8_bin);
+ add_compiled_collation(&my_charset_utf8_general_ci);
+ add_compiled_collation(&my_charset_utf8_bin);
#endif
/* Copy compiled charsets */
for (cs=compiled_charsets; cs->name; cs++)
- {
- all_charsets[cs->number]=cs;
- }
+ add_compiled_collation(cs);
return FALSE;
}
@@ -513,7 +527,7 @@ void free_charsets(void)
}
-uint get_charset_number(const char *charset_name)
+uint get_collation_number(const char *name)
{
CHARSET_INFO **cs;
if (init_available_charsets(MYF(0))) /* If it isn't initialized */
@@ -522,12 +536,27 @@ uint get_charset_number(const char *charset_name)
for (cs= all_charsets; cs < all_charsets+255; ++cs)
{
if ( cs[0] && cs[0]->name &&
- !my_strcasecmp(&my_charset_latin1, cs[0]->name, charset_name))
+ !my_strcasecmp(&my_charset_latin1, cs[0]->name, name))
return cs[0]->number;
}
return 0; /* this mimics find_type() */
}
+uint get_charset_number(const char *charset_name, uint cs_flags)
+{
+ CHARSET_INFO **cs;
+ if (init_available_charsets(MYF(0))) /* If it isn't initialized */
+ return 0;
+
+ for (cs= all_charsets; cs < all_charsets+255; ++cs)
+ {
+ if ( cs[0] && cs[0]->csname && (cs[0]->state & cs_flags) &&
+ !my_strcasecmp(&my_charset_latin1, cs[0]->csname, charset_name))
+ return cs[0]->number;
+ }
+ return 0;
+}
+
const char *get_charset_name(uint charset_number)
{
@@ -555,7 +584,7 @@ static CHARSET_INFO *get_internal_charset(uint cs_number, myf flags)
cs= all_charsets[cs_number];
- if (cs && !(cs->state & (MY_CS_COMPILED | MY_CS_LOADED)))
+ if (cs && !(cs->state & MY_CS_COMPILED) && !(cs->state & MY_CS_LOADED))
{
strxmov(get_charsets_dir(buf), cs->csname, ".xml", NullS);
my_read_charset_file(buf,flags);
@@ -593,7 +622,7 @@ CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags)
CHARSET_INFO *cs;
(void) init_available_charsets(MYF(0)); /* If it isn't initialized */
- cs_number=get_charset_number(cs_name);
+ cs_number=get_collation_number(cs_name);
cs= cs_number ? get_internal_charset(cs_number,flags) : NULL;
if (!cs && (flags & MY_WME))
@@ -611,23 +640,15 @@ CHARSET_INFO *get_charset_by_csname(const char *cs_name,
uint cs_flags,
myf flags)
{
- CHARSET_INFO *cs=NULL;
- CHARSET_INFO **css;
+ uint cs_number;
+ CHARSET_INFO *cs;
DBUG_ENTER("get_charset_by_csname");
DBUG_PRINT("enter",("name: '%s'", cs_name));
(void) init_available_charsets(MYF(0)); /* If it isn't initialized */
- for (css= all_charsets; css < all_charsets+255; ++css)
- {
- if ( css[0] && (css[0]->state & cs_flags) &&
- css[0]->csname && !my_strcasecmp(&my_charset_latin1,
- css[0]->csname, cs_name))
- {
- cs= css[0]->number ? get_internal_charset(css[0]->number,flags) : NULL;
- break;
- }
- }
+ cs_number= get_charset_number(cs_name, cs_flags);
+ cs= cs_number ? get_internal_charset(cs_number, flags) : NULL;
if (!cs && (flags & MY_WME))
{
diff --git a/mysys/checksum.c b/mysys/checksum.c
index 1dd135c7ad9..92ec3d550f1 100644
--- a/mysys/checksum.c
+++ b/mysys/checksum.c
@@ -19,19 +19,24 @@
#include "my_sys.h"
/*
- Calculate a long checksum for a memoryblock. Used to verify pack_isam
-
+ Calculate a long checksum for a memoryblock.
+
SYNOPSIS
- checksum()
- mem Pointer to memory block
- count Count of bytes
+ my_checksum()
+ crc start value for crc
+ pos pointer to memory block
+ length length of the block
*/
-ulong checksum(const byte *mem, uint count)
+ha_checksum my_checksum(ha_checksum crc, const byte *pos, uint length)
{
- ulong crc;
- for (crc= 0; count-- ; mem++)
- crc= ((crc << 1) + *((uchar*) mem)) +
- test(crc & ((ulong) 1L << (8*sizeof(ulong)-1)));
+#ifdef NOT_USED
+ const byte *end=pos+length;
+ for ( ; pos != end ; pos++)
+ crc=((crc << 8) + *((uchar*) pos)) + (crc >> (8*sizeof(ha_checksum)-8));
return crc;
+#else
+ return (ha_checksum)crc32((uint)crc, (const uchar *)pos, length);
+#endif
}
+
diff --git a/mysys/default.c b/mysys/default.c
index 9f7181b7da9..8bdf8d4f741 100644
--- a/mysys/default.c
+++ b/mysys/default.c
@@ -15,22 +15,22 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/****************************************************************************
-** Add all options from files named "group".cnf from the default_directories
-** before the command line arguments.
-** On Windows defaults will also search in the Windows directory for a file
-** called 'group'.ini
-** As long as the program uses the last argument for conflicting
-** options one only have to add a call to "load_defaults" to enable
-** use of default values.
-** pre- and end 'blank space' are removed from options and values. The
-** following escape sequences are recognized in values: \b \t \n \r \\
-**
-** The following arguments are handled automaticly; If used, they must be
-** first argument on the command line!
-** --no-defaults ; no options are read.
-** --defaults-file=full-path-to-default-file ; Only this file will be read.
-** --defaults-extra-file=full-path-to-default-file ; Read this file before ~/
-** --print-defaults ; Print the modified command line and exit
+ Add all options from files named "group".cnf from the default_directories
+ before the command line arguments.
+ On Windows defaults will also search in the Windows directory for a file
+ called 'group'.ini
+ As long as the program uses the last argument for conflicting
+ options one only have to add a call to "load_defaults" to enable
+ use of default values.
+ pre- and end 'blank space' are removed from options and values. The
+ following escape sequences are recognized in values: \b \t \n \r \\
+
+ The following arguments are handled automaticly; If used, they must be
+ first argument on the command line!
+ --no-defaults ; no options are read.
+ --defaults-file=full-path-to-default-file ; Only this file will be read.
+ --defaults-extra-file=full-path-to-default-file ; Read this file before ~/
+ --print-defaults ; Print the modified command line and exit
****************************************************************************/
#include "mysys_priv.h"
@@ -66,13 +66,46 @@ NullS,
#define windows_ext ".ini"
#endif
-static my_bool search_default_file(DYNAMIC_ARRAY *args,MEM_ROOT *alloc,
- const char *dir, const char *config_file,
- const char *ext, TYPELIB *group);
+static int search_default_file(DYNAMIC_ARRAY *args,MEM_ROOT *alloc,
+ const char *dir, const char *config_file,
+ const char *ext, TYPELIB *group);
static char *remove_end_comment(char *ptr);
-void load_defaults(const char *conf_file, const char **groups,
+
+/*
+ Read options from configurations files
+
+ SYNOPSIS
+ load_defaults()
+ conf_file Basename for configuration file to search for.
+ If this is a path, then only this file is read.
+ groups Which [group] entrys to read.
+ Points to an null terminated array of pointers
+ argc Pointer to argc of original program
+ argv Pointer to argv of original program
+
+ IMPLEMENTATION
+
+ Read options from configuration files and put them BEFORE the arguments
+ that are already in argc and argv. This way the calling program can
+ easily command line options override options in configuration files
+
+ NOTES
+ In case of fatal error, the function will print a warning and do
+ exit(1)
+
+ To free used memory one should call free_defaults() with the argument
+ that was put in *argv
+
+ RETURN
+ 0 ok
+ 1 The given conf_file didn't exists
+ 2 The given conf_file was not a normal readable file
+*/
+
+
+int load_defaults(const char *conf_file, const char **groups,
int *argc, char ***argv)
{
DYNAMIC_ARRAY args;
@@ -80,6 +113,7 @@ void load_defaults(const char *conf_file, const char **groups,
TYPELIB group;
my_bool found_print_defaults=0;
uint args_used=0;
+ int error= 0;
MEM_ROOT alloc;
char *ptr,**res;
DBUG_ENTER("load_defaults");
@@ -100,7 +134,7 @@ void load_defaults(const char *conf_file, const char **groups,
(*argc)--;
*argv=res;
*(MEM_ROOT*) ptr= alloc; /* Save alloc root for free */
- DBUG_VOID_RETURN;
+ DBUG_RETURN(0);
}
/* Check if we want to force the use a specific default file */
@@ -129,14 +163,14 @@ void load_defaults(const char *conf_file, const char **groups,
goto err;
if (forced_default_file)
{
- if (search_default_file(&args, &alloc, "", forced_default_file, "",
- &group))
+ if ((error= search_default_file(&args, &alloc, "",
+ forced_default_file, "", &group)) < 0)
goto err;
}
else if (dirname_length(conf_file))
{
- if (search_default_file(&args, &alloc, NullS, conf_file, default_ext,
- &group))
+ if ((error= search_default_file(&args, &alloc, NullS, conf_file,
+ default_ext, &group)) < 0)
goto err;
}
else
@@ -144,29 +178,36 @@ void load_defaults(const char *conf_file, const char **groups,
#ifdef __WIN__
char system_dir[FN_REFLEN];
GetWindowsDirectory(system_dir,sizeof(system_dir));
- if (search_default_file(&args, &alloc, system_dir, conf_file, windows_ext,
- &group))
+ if ((search_default_file(&args, &alloc, system_dir, conf_file,
+ windows_ext, &group)))
goto err;
#endif
#if defined(__EMX__) || defined(OS2)
if (getenv("ETC") &&
- search_default_file(&args, &alloc, getenv("ETC"), conf_file,
- default_ext, &group))
+ (search_default_file(&args, &alloc, getenv("ETC"), conf_file,
+ default_ext, &group)) < 0)
goto err;
#endif
for (dirs=default_directories ; *dirs; dirs++)
{
- int error=0;
if (**dirs)
- error=search_default_file(&args, &alloc, *dirs, conf_file,
- default_ext, &group);
+ {
+ if (search_default_file(&args, &alloc, *dirs, conf_file,
+ default_ext, &group) < 0)
+ goto err;
+ }
else if (defaults_extra_file)
- error=search_default_file(&args, &alloc, NullS, defaults_extra_file,
- default_ext, &group);
- if (error)
- goto err;
+ {
+ if (search_default_file(&args, &alloc, NullS, defaults_extra_file,
+ default_ext, &group) < 0)
+ goto err; /* Fatal error */
+ }
}
}
+ /*
+ Here error contains <> 0 only if we have a fully specified conf_file
+ or a forced default file
+ */
if (!(ptr=(char*) alloc_root(&alloc,sizeof(alloc)+
(args.elements + *argc +1) *sizeof(char*))))
goto err;
@@ -202,12 +243,12 @@ void load_defaults(const char *conf_file, const char **groups,
for (i=1 ; i < *argc ; i++)
printf("%s ", (*argv)[i]);
puts("");
- exit(1);
+ exit(0);
}
- DBUG_VOID_RETURN;
+ DBUG_RETURN(error);
err:
- fprintf(stderr,"Program aborted\n");
+ fprintf(stderr,"Fatal error in defaults handling. Program aborted\n");
exit(1);
}
@@ -220,9 +261,28 @@ void free_defaults(char **argv)
}
-static my_bool search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
- const char *dir, const char *config_file,
- const char *ext, TYPELIB *group)
+/*
+ Open a configuration file (if exists) and read given options from it
+
+ SYNOPSIS
+ search_default_file()
+ args Store pointer to found options here
+ alloc Allocate strings in this object
+ dir directory to read
+ config_file Name of configuration file
+ ext Extension for configuration file
+ group groups to read
+
+ RETURN
+ 0 Success
+ -1 Fatal error, abort
+ 1 File not found (Warning)
+ 2 File is not a regular file (Warning)
+*/
+
+static int search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
+ const char *dir, const char *config_file,
+ const char *ext, TYPELIB *group)
{
char name[FN_REFLEN+10],buff[4096],*ptr,*end,*value,*tmp;
FILE *fp;
@@ -247,7 +307,7 @@ static my_bool search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
{
MY_STAT stat_info;
if (!my_stat(name,&stat_info,MYF(0)))
- return 0;
+ return 1;
/*
Ignore world-writable regular files.
This is mainly done to protect us to not read a file created by
@@ -364,7 +424,7 @@ static my_bool search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
err:
my_fclose(fp,MYF(0));
- return 1;
+ return -1; /* Fatal error */
}
diff --git a/mysys/hash.c b/mysys/hash.c
index 0b2dbc484bc..b0ddbd90794 100644
--- a/mysys/hash.c
+++ b/mysys/hash.c
@@ -217,7 +217,7 @@ static int hashcmp(HASH *hash,HASH_LINK *pos,const byte *key,uint length)
/* Write a hash-key to the hash-index */
-my_bool hash_insert(HASH *info,const byte *record)
+my_bool my_hash_insert(HASH *info,const byte *record)
{
int flag;
uint halfbuff,hash_nr,first_index,idx;
diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c
index 0f35ee048bb..d96d4c0db3c 100644
--- a/mysys/mf_iocache.c
+++ b/mysys/mf_iocache.c
@@ -988,6 +988,20 @@ end:
}
+int my_b_safe_write(IO_CACHE *info, const byte *Buffer, uint Count)
+{
+ /*
+ Sasha: We are not writing this with the ? operator to avoid hitting
+ a possible compiler bug. At least gcc 2.95 cannot deal with
+ several layers of ternary operators that evaluated comma(,) operator
+ expressions inside - I do have a test case if somebody wants it
+ */
+ if (info->type == SEQ_READ_APPEND)
+ return my_b_append(info, Buffer, Count);
+ return my_b_write(info, Buffer, Count);
+}
+
+
/*
Write a block to disk where part of the data may be inside the record
buffer. As all write calls to the data goes through the cache,
diff --git a/mysys/my_chsize.c b/mysys/my_chsize.c
index 06e8f159f4a..8e46b0808c0 100644
--- a/mysys/my_chsize.c
+++ b/mysys/my_chsize.c
@@ -30,74 +30,83 @@
MyFlags Flags
DESCRIPTION
- my_chsize() truncates file if shorter, else fill with the filler character
+ my_chsize() truncates file if shorter else fill with the filler character
RETURN VALUE
0 Ok
1 Error
*/
-
int my_chsize(File fd, my_off_t newlength, int filler, myf MyFlags)
{
+ my_off_t oldsize;
+ char buff[IO_SIZE];
DBUG_ENTER("my_chsize");
DBUG_PRINT("my",("fd: %d length: %lu MyFlags: %d",fd,(ulong) newlength,
MyFlags));
-#ifdef HAVE_CHSIZE
- if (chsize(fd,(off_t) newlength))
+ oldsize = my_seek(fd, 0L, MY_SEEK_END, MYF(MY_WME+MY_FAE));
+ DBUG_PRINT("info",("old_size: %ld", (ulong) oldsize));
+
+ if (oldsize > newlength)
+#if defined(HAVE_SETFILEPOINTER)
+ /* This is for the moment only true on windows */
{
- DBUG_PRINT("error",("errno: %d",errno));
- my_errno=errno;
- if (MyFlags & MY_WME)
- my_error(EE_CANT_CHSIZE,MYF(ME_BELL+ME_WAITTANG),errno);
- DBUG_RETURN(1);
+ HANDLE win_file= (HANDLE) _get_osfhandle(fd);
+ long length_low, length_high;
+ length_low= (long) (ulong) newlength;
+ length_high= (long) ((ulonglong) newlength >> 32);
+ if (SetFilePointer(win_file, length_low, &length_high, FILE_BEGIN))
+ {
+ if (SetEndOfFile(win_file))
+ DBUG_RETURN(0);
+ }
+ my_errno= errno;
+ goto err;
}
- DBUG_RETURN(0);
-#else
- /* if file is shorter, expand with null, else fill unused part with null */
+#elif defined(HAVE_FTRUNCATE)
{
- my_off_t oldsize;
- char buff[IO_SIZE];
-
- oldsize = my_seek(fd, 0L, MY_SEEK_END, MYF(MY_WME+MY_FAE));
- DBUG_PRINT("info",("old_size: %ld", (ulong) oldsize));
-
-#ifdef HAVE_FTRUNCATE
- if (oldsize > newlength)
+ if (ftruncate(fd, (off_t) newlength))
{
- if (ftruncate(fd, (off_t) newlength))
- {
- my_errno=errno;
- DBUG_PRINT("error",("errno: %d",errno));
- if (MyFlags & MY_WME)
- my_error(EE_CANT_CHSIZE, MYF(ME_BELL+ME_WAITTANG), errno);
- DBUG_RETURN(1);
- }
- DBUG_RETURN(0);
- }
-#else
- if (oldsize > newlength)
- { /* Fill diff with null */
- VOID(my_seek(fd, newlength, MY_SEEK_SET, MYF(MY_WME+MY_FAE)));
- swap(my_off_t, newlength, oldsize);
+ my_errno= errno;
+ goto err;
}
-#endif
- /* Full file with 0 until it's as big as requested */
- bfill(buff, IO_SIZE, filler);
- while (newlength-oldsize > IO_SIZE)
+ DBUG_RETURN(0);
+ }
+#elif defined(HAVE_CHSIZE)
+ {
+ if (chsize(fd, (off_t) newlength))
{
- if (my_write(fd,(byte*) buff,IO_SIZE,MYF(MY_NABP)))
- goto err;
- oldsize+= IO_SIZE;
- }
- if (my_write(fd,(byte*) buff,(uint) (newlength-oldsize),MYF(MY_NABP)))
+ my_errno=errno;
goto err;
+ }
DBUG_RETURN(0);
- err:
- if (MyFlags & MY_WME)
- my_error(EE_CANT_CHSIZE,MYF(ME_BELL+ME_WAITTANG),my_errno);
- DBUG_PRINT("error",("errno: %d",my_errno));
- DBUG_RETURN(1);
+ }
+#else
+ {
+ /*
+ Fill space between requested length and true length with 'filler'
+ We should never come here on any modern machine
+ */
+ VOID(my_seek(fd, newlength, MY_SEEK_SET, MYF(MY_WME+MY_FAE)));
+ swap(my_off_t, newlength, oldsize);
}
#endif
-} /* my_chsize */
+
+ /* Full file with 'filler' until it's as big as requested */
+ bfill(buff, IO_SIZE, filler);
+ while (newlength-oldsize > IO_SIZE)
+ {
+ if (my_write(fd,(byte*) buff,IO_SIZE,MYF(MY_NABP)))
+ goto err;
+ oldsize+= IO_SIZE;
+ }
+ if (my_write(fd,(byte*) buff,(uint) (newlength-oldsize),MYF(MY_NABP)))
+ goto err;
+ DBUG_RETURN(0);
+
+err:
+ DBUG_PRINT("error", ("errno: %d", errno));
+ if (MyFlags & MY_WME)
+ my_error(EE_CANT_CHSIZE, MYF(ME_BELL+ME_WAITTANG), my_errno);
+ DBUG_RETURN(1);
+} /* my_chsize */
diff --git a/mysys/my_crc32.c b/mysys/my_crc32.c
new file mode 100644
index 00000000000..5514b01ede2
--- /dev/null
+++ b/mysys/my_crc32.c
@@ -0,0 +1,36 @@
+/* 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 */
+
+#include "mysys_priv.h"
+
+#ifndef HAVE_COMPRESS
+
+/* minimal set of defines for using crc32() from zlib codebase */
+#define _ZLIB_H
+#define ZEXPORT
+#define Z_NULL 0
+#define OF(args) args
+#undef DYNAMIC_CRC_TABLE
+typedef uchar Byte;
+typedef uchar Bytef;
+typedef uint uInt;
+typedef ulong uLong;
+typedef ulong uLongf;
+
+#include "../zlib/crc32.c"
+
+#endif
+
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c
index cbbf876ac06..edd35749633 100644
--- a/mysys/my_getopt.c
+++ b/mysys/my_getopt.c
@@ -461,7 +461,7 @@ static char *check_struct_option(char *cur_arg, char *key_name)
{
char *ptr, *end;
- ptr= strcend(cur_arg + 1, '.'); // Skip the first character
+ ptr= strcend(cur_arg + 1, '.'); /* Skip the first character */
end= strcend(cur_arg, '=');
/*
@@ -525,8 +525,7 @@ static int setval(const struct my_option *opts, gptr *value, char *argument,
break;
case GET_STR_ALLOC:
if ((*((char**) result_pos)))
- my_free((*(char**) result_pos),
- MYF(MY_WME | MY_FAE));
+ my_free((*(char**) result_pos), MYF(MY_WME | MY_FAE));
if (!(*((char**) result_pos)= my_strdup(argument, MYF(MY_WME))))
return EXIT_OUT_OF_MEMORY;
break;
diff --git a/mysys/my_pthread.c b/mysys/my_pthread.c
index 32528707480..f10a2210064 100644
--- a/mysys/my_pthread.c
+++ b/mysys/my_pthread.c
@@ -92,7 +92,7 @@ void *my_pthread_getspecific_imp(pthread_key_t key)
#ifdef __NETWARE__
/*
-don't kill the LibC Reaper thread or the main thread
+ Don't kill the LibC Reaper thread or the main thread
*/
#include <nks/thread.h>
#undef pthread_exit
@@ -105,8 +105,10 @@ void my_pthread_exit(void *status)
NXThreadGetContext(tid, &ctx);
NXContextGetName(ctx, name, PATH_MAX);
- // "MYSQLD.NLM's LibC Reaper" or "MYSQLD.NLM's main thread"
- // with a debug build of LibC the reaper can have different names
+ /*
+ "MYSQLD.NLM's LibC Reaper" or "MYSQLD.NLM's main thread"
+ with a debug build of LibC the reaper can have different names
+ */
if (!strindex(name, "\'s"))
{
pthread_exit(status);
@@ -114,8 +116,10 @@ void my_pthread_exit(void *status)
}
#endif
-/* Some functions for RTS threads, AIX, Siemens Unix and UnixWare 7
- (and DEC OSF/1 3.2 too) */
+/*
+ Some functions for RTS threads, AIX, Siemens Unix and UnixWare 7
+ (and DEC OSF/1 3.2 too)
+*/
int my_pthread_create_detached=1;
diff --git a/mysys/my_static.h b/mysys/my_static.h
index 1a33bcf21f3..08d1a93692f 100644
--- a/mysys/my_static.h
+++ b/mysys/my_static.h
@@ -19,7 +19,6 @@
a shared library
*/
-#include "mysys_priv.h"
#include <signal.h>
#define MAX_SIGNALS 10 /* Max signals under a dont-allow */
diff --git a/mysys/testhash.c b/mysys/testhash.c
index a1d14dc225d..72badffdbcd 100644
--- a/mysys/testhash.c
+++ b/mysys/testhash.c
@@ -83,7 +83,7 @@ static int do_test()
n1=rnd(1000); n2=rnd(100); n3=rnd(min(recant*5,MAX_RECORDS));
record= (char*) my_malloc(reclength,MYF(MY_FAE));
sprintf(record,"%6d:%4d:%8d:Pos: %4d ",n1,n2,n3,write_count);
- if (hash_insert(&hash,record))
+ if (my_hash_insert(&hash,record))
{
printf("Error: %d in write at record: %d\n",my_errno,i);
goto err;
@@ -199,7 +199,7 @@ static int do_test()
record=(byte*) my_malloc(reclength,MYF(MY_FAE));
memcpy(record,recpos,reclength);
record[reclength-1]=rnd(5)+1;
- if (hash_insert(&hash2,record))
+ if (my_hash_insert(&hash2,record))
{
printf("Got error when inserting record: %*s",reclength,record);
goto err;
diff --git a/regex/cclass.h b/regex/cclass.h
index e0f752f38b8..b877b5dee6b 100644
--- a/regex/cclass.h
+++ b/regex/cclass.h
@@ -18,4 +18,5 @@ extern struct cclass {
const char *name;
const char *chars;
const char *multis;
+ uint mask;
} cclasses[];
diff --git a/regex/regcomp.c b/regex/regcomp.c
index d95a0ddf5d0..6af99456c28 100644
--- a/regex/regcomp.c
+++ b/regex/regcomp.c
@@ -36,19 +36,19 @@ struct parse {
static char nuls[10]; /* place to point scanner in event of error */
struct cclass cclasses[CCLASS_LAST+1]= {
- { "alnum", "","" },
- { "alpha", "","" },
- { "blank", "","" },
- { "cntrl", "","" },
- { "digit", "","" },
- { "graph", "","" },
- { "lower", "","" },
- { "print", "","" },
- { "punct", "","" },
- { "space", "","" },
- { "upper", "","" },
- { "xdigit", "","" },
- { NULL,NULL,NULL }
+ { "alnum", "","", _U | _L | _NMR},
+ { "alpha", "","", _U | _L },
+ { "blank", "","", _B },
+ { "cntrl", "","", _CTR },
+ { "digit", "","", _NMR },
+ { "graph", "","", _PNT | _U | _L | _NMR},
+ { "lower", "","", _L },
+ { "print", "","", _PNT | _U | _L | _NMR | _B },
+ { "punct", "","", _PNT },
+ { "space", "","", _SPC },
+ { "upper", "","", _U },
+ { "xdigit", "","", _X },
+ { NULL,NULL,NULL, 0 }
};
/*
@@ -747,9 +747,7 @@ register cset *cs;
register char *sp = p->next;
register struct cclass *cp;
register size_t len;
- register char *u;
- register char c;
-
+
while (MORE() && my_isalpha(p->charset,PEEK()))
NEXT();
len = p->next - sp;
@@ -762,11 +760,26 @@ register cset *cs;
return;
}
- u = (char*) cp->chars;
- while ((c = *u++) != '\0')
- CHadd(cs, c);
- for (u = (char*) cp->multis; *u != '\0'; u += strlen(u) + 1)
- MCadd(p, cs, u);
+#ifndef USE_ORIG_REGEX_CODE
+ {
+ register size_t i;
+ for (i=1 ; i<256 ; i++)
+ if (p->charset->ctype[i+1] & cp->mask)
+ CHadd(cs, i);
+ }
+#else
+ {
+ register char *u = (char*) cp->chars;
+ register char c;
+
+ while ((c = *u++) != '\0')
+ CHadd(cs, c);
+
+ for (u = (char*) cp->multis; *u != '\0'; u += strlen(u) + 1)
+ MCadd(p, cs, u);
+ }
+#endif
+
}
/*
diff --git a/scripts/fill_help_tables.sh b/scripts/fill_help_tables.sh
index b8cf4ccb3a7..8ba05910596 100644
--- a/scripts/fill_help_tables.sh
+++ b/scripts/fill_help_tables.sh
@@ -35,7 +35,7 @@
# @c example_for_help_topic <topic_name>
# @example
# ....
-# @example
+# @end example
#
#
# Original version by Victor Vagin <vva@mysql.com>
@@ -44,13 +44,16 @@
use strict;
use Getopt::Long;
-my $insert_portion_size= 25;
-my $error_prefix= "help parsing error:";
+my $insert_portion_size= 15;
+my $error_prefix= "---- help parsing errors :";
my $path_to_lex_file= "../sql/lex.h";
my $verbose_option= 0;
my $help_option= 0;
+my $cur_line= 0;
+my $count_errors= 0;
+
GetOptions(
"help",\$help_option,
"verbose",\$verbose_option,
@@ -92,6 +95,17 @@ my %keywords;
$categories{Contents}->{__parent_category__}= "";
+sub print_error
+{
+ my ($text)= @_;
+ if ($count_errors==0)
+ {
+ print STDERR "$error_prefix\n";
+ }
+ print STDERR "line $cur_line : $text";
+ $count_errors++;
+}
+
sub add_topic_to_category
{
my ($topic_name)= @_;
@@ -104,7 +118,7 @@ sub add_topic_to_category
my $old_parent= $category->{__parent_category__};
if ($old_parent ne $current_parent_category)
{
- print STDERR "$error_prefix wrong parent for $current_category\n";
+ print_error "wrong parent for $current_category\n";
}
}
@@ -118,7 +132,7 @@ sub add_topic_to_category
my $old_category= $topics{$topic_name}->{category};
if ($old_category ne $category)
{
- print STDERR "$error_prefix wrong category for $topic_name\n";
+ print_error "wrong category for $topic_name\n";
}
}
@@ -133,7 +147,7 @@ sub add_example
if (exists($topics{$topic_name}->{example}))
{
- print STDERR "$error_prefix double example for $topic_name\n";
+ print_error "double example for $topic_name\n";
}
$topics{$topic_name}->{example}= $example;
@@ -148,7 +162,7 @@ sub add_description
if (exists($topics{$topic_name}->{description}))
{
- print STDERR "$error_prefix double description for $topic_name\n";
+ print_error "double description for $topic_name\n";
}
$topics{$topic_name}->{description}= $description;
add_topic_to_category($topic_name);
@@ -164,7 +178,7 @@ sub add_keyword
push(@{$topics{$topic_name}->{keywords}},$keyword);
if (exists($keywords{$keyword}->{$topic_name}))
{
- print STDERR "$error_prefix double keyword $keyword for $topic_name\n";
+ print_error "double keyword $keyword for $topic_name\n";
}
$keywords{$keyword}->{$topic_name}= $topics{$topic_name};
}
@@ -195,10 +209,12 @@ sub prepare_name
$a =~ s/\@table \@code/ /g;
$a =~ s/\(\)//g;
$a =~ s/\"/\\\"/g;
-
+
$a =~ s/((\w|\s)+)\(([\+-=><\/%*!<>\s]+)\)/$3/gxs;
$a =~ s/([\+-=><\/%*!<>\s]+)\(((\w|\s)+)\)/$1/gxs;
$a =~ s/((\w|\s)+)\((.+)\)/$1/gxs;
+
+ $a =~ s/((\s)+)$//g;
return $a;
}
@@ -278,12 +294,13 @@ sub parse_example
while (<>)
{
+ $cur_line++;
last if ($_=~/\@end example/);
$text .= $_;
}
$text= prepare_example($text);
-
+ $topic_name= prepare_name($topic_name);
add_example($topic_name,$text) if ($topic_name ne "");
}
@@ -319,11 +336,13 @@ sub parse_description
while (<>)
{
+ $cur_line++;
last if ($_=~/\@c end_description_for_help_topic/);
$text .= $_;
}
$text= prepare_description($text);
+ $topic_name= prepare_name($topic_name);
add_description($topic_name,$text);
}
@@ -354,6 +373,7 @@ while (<>)
parse_example ();
parse_description ();
parse_category ();
+ $cur_line++;
}
# test results of parsing:
@@ -542,3 +562,9 @@ if (scalar(@keywords_names))
}
printf ";\n\n";
}
+
+if ($count_errors)
+{
+ print STDERR "$count_errors errors !!!\n";
+ exit 1;
+}
diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh
index 1731a7555e0..9d166fc1baa 100644
--- a/scripts/make_binary_distribution.sh
+++ b/scripts/make_binary_distribution.sh
@@ -61,7 +61,7 @@ case $system in
esac
-mkdir $BASE $BASE/bin \
+mkdir $BASE $BASE/bin $BASE/docs \
$BASE/include $BASE/lib $BASE/support-files $BASE/share $BASE/scripts \
$BASE/mysql-test $BASE/mysql-test/t $BASE/mysql-test/r \
$BASE/mysql-test/include $BASE/mysql-test/std_data
@@ -73,9 +73,20 @@ if [ $BASE_SYSTEM != "netware" ] ; then
chmod o-rwx $BASE/data $BASE/data/*
fi
-for i in ChangeLog COPYING COPYING.LIB README Docs/INSTALL-BINARY \
- MySQLEULA.txt Docs/manual.html Docs/manual.txt Docs/manual_toc.html \
- LICENSE.doc README.NW Docs/mysqlbug.txt
+for i in ChangeLog \
+ Docs/manual.html \
+ Docs/manual.txt \
+ Docs/manual_toc.html \
+ Docs/mysql.info
+do
+ if [ -f $i ]
+ then
+ $CP $i $BASE/docs
+ fi
+done
+
+for i in COPYING COPYING.LIB README Docs/INSTALL-BINARY \
+ MySQLEULA.txt LICENSE.doc README.NW
do
if [ -f $i ]
then
diff --git a/scripts/make_win_src_distribution.sh b/scripts/make_win_src_distribution.sh
index df7ac29ee0d..02eb5366b01 100755
--- a/scripts/make_win_src_distribution.sh
+++ b/scripts/make_win_src_distribution.sh
@@ -13,7 +13,8 @@ DEBUG=0
SILENT=0
SUFFIX=""
DIRNAME=""
-OUTTAR=0
+OUTTAR="0"
+OUTZIP="0"
#
# This script must run from MySQL top directory
@@ -62,7 +63,8 @@ show_usage()
echo " --suffix Suffix name for the package"
echo " --dirname Directory name to copy files (intermediate)"
echo " --silent Do not list verbosely files processed"
- echo " --tar Create tar.gz package instead of .zip"
+ echo " --tar Create tar.gz package"
+ echo " --zip Create zip package"
echo " --help Show this help message"
exit 0
@@ -75,12 +77,14 @@ show_usage()
parse_arguments() {
for arg do
case "$arg" in
+ --add-tar) ADDTAR=1 ;;
--debug) DEBUG=1;;
--tmp=*) TMP=`echo "$arg" | sed -e "s;--tmp=;;"` ;;
--suffix=*) SUFFIX=`echo "$arg" | sed -e "s;--suffix=;;"` ;;
--dirname=*) DIRNAME=`echo "$arg" | sed -e "s;--dirname=;;"` ;;
--silent) SILENT=1 ;;
--tar) OUTTAR=1 ;;
+ --zip) OUTZIP=1 ;;
--help) show_usage ;;
*)
echo "Unknown argument '$arg'"
@@ -98,16 +102,51 @@ parse_arguments "$@"
for i in $TMP $TMPDIR $TEMPDIR $TEMP /tmp
do
- if [ "$i" ]; then
+ if [ "$i" ]; then
print_debug "Setting TMP to '$i'"
- TMP=$i
+ TMP=$i
break
fi
done
-
+
+#
+# Convert argument file from unix to DOS text
#
+if [ `which recode` ]
+then
+
+ print_debug "Using 'recode' to convert from unix to dos text"
+
+ unix_to_dos()
+ {
+ for arg do
+ print_debug "Replacing LF -> CRLF from '$arg'"
+
+ chmod u+w $arg
+ recode lat1..ibmpc $arg
+ done
+ }
+
+else
+
+ print_debug "Using 'sed' to convert from unix to dos text"
+
+ unix_to_dos()
+ {
+ for arg do
+ print_debug "Replacing LF -> CRLF from '$arg'"
+
+ sed -e 's/$/\r/' $arg > $arg.tmp
+ rm -f $arg
+ mv $arg.tmp $arg
+ done
+ }
+
+fi
+
+
#
# Create a tmp dest directory to copy files
#
@@ -123,14 +162,9 @@ $CP -r $SOURCE/VC++Files $BASE
(
find $BASE \( -name "*.dsp" -o -name "*.dsw" \) -and -not -path \*SCCS\* -print
)|(
- while read v
+ while read v
do
- print_debug "Replacing LF -> CRLF from '$v'"
-
- # ^M -> type CTRL V + CTRL M
- cat $v | sed 's/ //' | sed 's/$/ /' > $v.tmp
- rm $v
- mv $v.tmp $v
+ unix_to_dos $v
done
)
@@ -147,7 +181,7 @@ rm -r -f "$BASE/share/Makefile.am"
# Clean up if we did this from a bk tree
#
-if [ -d $BASE/SCCS ]
+if [ -d $BASE/SCCS ]
then
find $BASE/ -type d -name SCCS -printf " \"%p\"" | xargs rm -r -f
fi
@@ -169,9 +203,9 @@ copy_dir_files()
mkdir $BASE/$arg
fi
for i in *.c *.cpp *.h *.ih *.i *.ic *.asm *.def \
- README INSTALL* LICENSE
- do
- if [ -f $i ]
+ README INSTALL* LICENSE
+ do
+ if [ -f $i ]
then
$CP $SOURCE/$arg/$i $BASE/$arg/$i
fi
@@ -195,21 +229,19 @@ copy_dir_dirs() {
for arg do
- basedir=$arg
-
- if [ ! -d $BASE/$arg ]; then
- mkdir $BASE/$arg
- fi
-
- copy_dir_files $arg
-
- cd $SOURCE/$arg/
- for i in *
- do
- if [ -d $SOURCE/$basedir/$i ] && [ "$i" != "SCCS" ]; then
- copy_dir_files $basedir/$i
- fi
- done
+ cd $SOURCE
+ (
+ find $arg -type d \
+ -and -not -path \*SCCS\* \
+ -and -not -path \*.deps\* \
+ -and -not -path \*autom4te.cache -print
+ )|(
+ while read v
+ do
+ copy_dir_files $v
+ done
+ )
+
done
}
@@ -220,7 +252,7 @@ copy_dir_dirs() {
for i in client dbug extra heap include isam \
libmysql libmysqld merge myisam \
myisammrg mysys regex sql strings sql-common \
- vio zlib
+ tools vio zlib
do
copy_dir_files $i
done
@@ -249,31 +281,49 @@ touch $BASE/innobase/ib_config.h
#
cd $SOURCE
-for i in COPYING ChangeLog README \
+for i in COPYING COPYING.LIB ChangeLog README \
INSTALL-SOURCE INSTALL-WIN \
INSTALL-WIN-SOURCE \
Docs/manual_toc.html Docs/manual.html \
- Docs/mysqld_error.txt Docs/INSTALL-BINARY
-
+ Docs/manual.txt Docs/mysqld_error.txt \
+ Docs/INSTALL-BINARY
+
do
print_debug "Copying file '$i'"
- if [ -f $i ]
+ if [ -f $i ]
then
$CP $i $BASE/$i
fi
done
#
+# Raw dirs from source tree
+#
+
+for i in Docs/Flags scripts sql-bench SSL \
+ tests
+do
+ print_debug "Copying directory '$i'"
+ if [ -d $i ]
+ then
+ $CP -R $i $BASE/$i
+ fi
+done
+
+#
# Fix some windows files
#
./extra/replace std:: "" -- $BASE/sql/sql_yacc.cpp
+unix_to_dos $BASE/README
+mv $BASE/README $BASE/README.txt
+
#
# Initialize the initial data directory
#
-if [ -f scripts/mysql_install_db ]; then
+if [ -f scripts/mysql_install_db ]; then
print_debug "Initializing the 'data' directory"
scripts/mysql_install_db --no-defaults --windows --datadir=$BASE/data
fi
@@ -334,9 +384,15 @@ which_1 ()
# Create the result zip/tar file
#
-set_tarzip_options()
+if [ "$OUTTAR" = "0" ]; then
+ if [ "$OUTZIP" = "0" ]; then
+ OUTZIP=1
+ fi
+fi
+
+set_tarzip_options()
{
- for arg
+ for arg
do
if [ "$arg" = "tar" ]; then
ZIPFILE1=gnutar
@@ -360,43 +416,60 @@ set_tarzip_options()
done
}
-if [ "$OUTTAR" = "1" ]; then
- set_tarzip_options 'tar'
-else
- set_tarzip_options 'zip'
-fi
-
-tar=`which_1 $ZIPFILE1 $ZIPFILE2`
-if test "$?" = "1" -o "$tar" = ""
-then
- print_debug "Search failed for '$ZIPFILE1', '$ZIPFILE2', using default 'tar'"
- tar=tar
- set_tarzip_options 'tar'
-fi
#
# Create the archive
#
+create_archive()
+{
-print_debug "Using $tar to create archive"
+ print_debug "Using $tar to create archive"
-cd $TMP
+ cd $TMP
-rm -f $SOURCE/$NEW_NAME$EXT
-$tar $OPT $SOURCE/$NEW_NAME$EXT $NEW_DIR_NAME
-cd $SOURCE
+ rm -f $SOURCE/$NEW_NAME$EXT
+ $tar $OPT $SOURCE/$NEW_NAME$EXT $NEW_DIR_NAME
+ cd $SOURCE
-if [ "$NEED_COMPRESS" = "1" ]
-then
- print_debug "Compressing archive"
- gzip -9 $NEW_NAME$EXT
- EXT="$EXT.gz"
+ if [ "$NEED_COMPRESS" = "1" ]
+ then
+ print_debug "Compressing archive"
+ gzip -9 $NEW_NAME$EXT
+ EXT="$EXT.gz"
+ fi
+
+ if [ "$SILENT" = "0" ] ; then
+ echo "$NEW_NAME$EXT created successfully !!"
+ fi
+}
+
+if [ "$OUTTAR" = "1" ]; then
+ set_tarzip_options 'tar'
+
+ tar=`which_1 $ZIPFILE1 $ZIPFILE2`
+ if test "$?" = "1" -o "$tar" = ""
+ then
+ print_debug "Search failed for '$ZIPFILE1', '$ZIPFILE2', using default 'tar'"
+ tar=tar
+ set_tarzip_options 'tar'
+ fi
+
+ create_archive
+fi
+
+if [ "$OUTZIP" = "1" ]; then
+ set_tarzip_options 'zip'
+
+ tar=`which_1 $ZIPFILE1 $ZIPFILE2`
+ if test "$?" = "1" -o "$tar" = ""
+ then
+ echo "Search failed for '$ZIPFILE1', '$ZIPFILE2', cannot create zip!"
+ fi
+
+ create_archive
fi
print_debug "Removing temporary directory"
rm -r -f $BASE
-if [ "$SILENT" = "0" ] ; then
- echo "$NEW_NAME$EXT created successfully !!"
-fi
# End of script
diff --git a/scripts/mysql_config.sh b/scripts/mysql_config.sh
index 3cc5b3a5016..e8cc9322eaf 100644
--- a/scripts/mysql_config.sh
+++ b/scripts/mysql_config.sh
@@ -86,6 +86,8 @@ client_libs='@CLIENT_LIBS@'
libs="$ldflags -L'$pkglibdir' -lmysqlclient $client_libs"
libs=`echo $libs | sed -e 's; +;;'`
+libs_r="$ldflags -L'$pkglibdir' -lmysqlclient_r $client_libs"
+libs_r=`echo $libs_r | sed -e 's; +;;'`
cflags="-I'$pkgincludedir'"
embedded_libs="$ldflags -L'$pkglibdir' -lmysqld @LIBS@ @innodb_system_libs@"
@@ -95,6 +97,7 @@ Usage: $0 [OPTIONS]
Options:
--cflags [$cflags]
--libs [$libs]
+ --libs_r [$libs_r]
--socket [$socket]
--port [$port]
--version [$version]
@@ -109,6 +112,7 @@ while test $# -gt 0; do
case $1 in
--cflags) echo "$cflags" ;;
--libs) echo "$libs" ;;
+ --libs_r) echo "$libs_r" ;;
--socket) echo "$socket" ;;
--port) echo "$port" ;;
--version) echo "$version" ;;
diff --git a/scripts/mysql_create_system_tables.sh b/scripts/mysql_create_system_tables.sh
index 2739c45e750..c4cdc7b52d7 100644
--- a/scripts/mysql_create_system_tables.sh
+++ b/scripts/mysql_create_system_tables.sh
@@ -108,7 +108,7 @@ then
c_u="$c_u CREATE TABLE user ("
c_u="$c_u Host char(60) binary DEFAULT '' NOT NULL,"
c_u="$c_u User char(16) binary DEFAULT '' NOT NULL,"
- c_u="$c_u Password char(45) binary DEFAULT '' NOT NULL,"
+ c_u="$c_u Password char(41) binary DEFAULT '' NOT NULL,"
c_u="$c_u Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_u="$c_u Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_u="$c_u Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
diff --git a/scripts/mysql_fix_privilege_tables.sql b/scripts/mysql_fix_privilege_tables.sql
index 43dc6d89481..220bf4036db 100644
--- a/scripts/mysql_fix_privilege_tables.sql
+++ b/scripts/mysql_fix_privilege_tables.sql
@@ -1,10 +1,22 @@
+-- This script converts any old privilege tables to privilege tables suitable
+-- for MySQL 4.0.
+
+-- You can safely ignore all 'Duplicate column' and 'Unknown column' errors"
+-- as this just means that your tables where already up to date.
+-- This script is safe to run even if your tables are already up to date!
+
+-- On unix, you should use the mysql_fix_privilege_tables script to execute
+-- this sql script.
+-- On windows you should do 'mysql --force < mysql_fix_privilege_tables.sql'
+
+USE mysql;
ALTER TABLE user type=MyISAM;
ALTER TABLE db type=MyISAM;
ALTER TABLE host type=MyISAM;
ALTER TABLE func type=MyISAM;
ALTER TABLE columns_priv type=MyISAM;
ALTER TABLE tables_priv type=MyISAM;
-ALTER TABLE user change Password Password char(45) not null;
+ALTER TABLE user change Password Password char(41) not null;
ALTER TABLE user add File_priv enum('N','Y') NOT NULL;
CREATE TABLE IF NOT EXISTS func (
name char(64) DEFAULT '' NOT NULL,
diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh
index 309463441b5..65731c2bcb7 100644
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
@@ -33,6 +33,7 @@ parse_arguments() {
--basedir=*) basedir=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
--ldata=*|--datadir=*) ldata=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
--user=*) user=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
+ --skip-name-resolve) ip_only=1 ;;
--verbose) verbose=1 ;;
--rpm) in_rpm=1 ;;
--windows) windows=1 ;;
@@ -127,7 +128,7 @@ fi
if test ! -x $mysqld
then
- if test "$in_rpm" -eq 1
+ if test "$in_rpm" = 1
then
echo "FATAL ERROR $mysqld not found!"
exit 1
@@ -138,13 +139,8 @@ then
fi
fi
-# Try to determine the fully qualified domain name (FQDN)
-HOSTNAME="@HOSTNAME@"
-if $HOSTNAME -f > /dev/null 2>&1 ; then
- hostname=`$HOSTNAME -f`
-else
- hostname=`$HOSTNAME`
-fi
+# Try to determine the hostname
+hostname=`@HOSTNAME@`
# Check if hostname is valid
if test "$windows" -eq 0 -a "$in_rpm" -eq 0 -a $force -eq 0
@@ -171,6 +167,12 @@ then
fi
fi
+if test "$ip_only" = 1
+then
+ ip=`echo "$resolved" | awk '/ /{print $6}'`
+ hostname=$ip
+fi
+
# Create database directories mysql & test
if test ! -d $ldata; then mkdir $ldata; chmod 700 $ldata ; fi
@@ -185,7 +187,7 @@ then
c_d="yes"
fi
-if test $verbose -eq 1
+if test $verbose = 1
then
create_option="verbose"
else
diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh
index d7e3eedb84e..1c056e963cb 100644
--- a/scripts/mysqld_safe.sh
+++ b/scripts/mysqld_safe.sh
@@ -148,7 +148,7 @@ else
fi
args=
-parse_arguments `$print_defaults $defaults mysqld server mysqld_safe safe_mysqld`
+parse_arguments `$print_defaults --loose-verbose $defaults mysqld server mysqld_safe safe_mysqld`
parse_arguments PICK-ARGS-FROM-ARGV "$@"
if test ! -x $ledir/$MYSQLD
diff --git a/sql-bench/compare-results.sh b/sql-bench/compare-results.sh
index 9e3a8f2add8..e95bd23e6a3 100644
--- a/sql-bench/compare-results.sh
+++ b/sql-bench/compare-results.sh
@@ -93,7 +93,7 @@ foreach (@ARGV)
}
elsif (/Comments:\s+(.+)/i) {
$tot{$prog}{'comments'} = $1;
- } elsif (/^(\S+):\s*(estimated\s|)total\stime:\s+([\d.]+)\s+(wallclock\s|)secs/i)
+ } elsif (/^(\S+):.*(estimated\s|)total\stime:\s+([\d.]+)\s+(wallclock\s|)secs/i)
{
$tmp = $1; $tmp =~ s/://;
$tot{$prog}{$tmp} = [ $3, (length($2) ? "+" : "")];
diff --git a/sql-bench/limits/mysql.cfg b/sql-bench/limits/mysql.cfg
index cebb85d8dfd..feaa79e43e9 100644
--- a/sql-bench/limits/mysql.cfg
+++ b/sql-bench/limits/mysql.cfg
@@ -177,7 +177,7 @@ compute=no # Compute
###> execute error: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 'compute sum(a) by a' at line 1
###
###As far as some queries didnt return OK, result is NO
-connections=99 # Simultaneous connections (installation default)
+connections=101 # Simultaneous connections (installation default)
constraint_check=syntax only # Column constraints
###< create table crash_q (a int check (a>0))
###> OK
@@ -345,7 +345,7 @@ date_format_inresult=iso # Date format in result
###> OK
###
###< select a from crash_me_d
- ###> 2003-03-26
+ ###> 2003-08-27
###< delete from crash_me_d
###> OK
date_infinity=error # Supports 'infinity dates
@@ -695,7 +695,7 @@ func_extra_elt=yes # Function ELT
func_extra_encrypt=yes # Function ENCRYPT
###
###<select encrypt('hello')
- ###>tJNum3fO44bOE
+ ###>tHrzZO8Aq1FG6
func_extra_expand2arg=no # Function EXPAND
###
###<select expand('abcd',6)
@@ -991,7 +991,7 @@ func_extra_subtime=no # Function SUBTIME
func_extra_sysdate=yes # Function SYSDATE
###
###<select sysdate()
- ###>2003-03-26 13:44:57
+ ###>2003-08-27 19:55:21
func_extra_tail=no # Function TAIL
###
###<select tail('ABCDEFG',3)
@@ -1056,7 +1056,7 @@ func_extra_uid=no # Function UID
func_extra_unix_timestamp=yes # Function UNIX_TIMESTAMP
###
###<select unix_timestamp()
- ###>1048679097
+ ###>1062003321
func_extra_userenv=no # Function USERENV
###
###<select userenv
@@ -1068,7 +1068,7 @@ func_extra_value=no # Function VALUE
func_extra_version=yes # Function VERSION
###
###<select version()
- ###>4.0.12-debug
+ ###>4.0.15-debug-log
func_extra_weekday=yes # Function WEEKDAY
###
###<select weekday('1997-11-29') from crash_me_d
@@ -1136,11 +1136,11 @@ func_odbc_cot=yes # Function COT
func_odbc_curdate=yes # Function CURDATE
###
###<select curdate()
- ###>2003-03-26
+ ###>2003-08-27
func_odbc_curtime=yes # Function CURTIME
###
###<select curtime()
- ###>13:44:57
+ ###>19:55:21
func_odbc_database=yes # Function DATABASE
###
###<select database()
@@ -1269,7 +1269,7 @@ func_odbc_monthname=yes # Function MONTHNAME
func_odbc_now=yes # Function NOW
###
###<select now()
- ###>2003-03-26 13:44:57
+ ###>2003-08-27 19:55:21
func_odbc_pi=yes # Function PI
###
###<select pi()
@@ -1416,15 +1416,15 @@ func_sql_concat_as_||=error # Function concatenation with ||
func_sql_current_date=yes # Function CURRENT_DATE
###
###<select current_date
- ###>2003-03-26
+ ###>2003-08-27
func_sql_current_time=yes # Function CURRENT_TIME
###
###<select current_time
- ###>13:44:57
+ ###>19:55:21
func_sql_current_timestamp=yes # Function CURRENT_TIMESTAMP
###
###<select current_timestamp
- ###>2003-03-26 13:44:57
+ ###>2003-08-27 19:55:21
func_sql_current_user=with_parenthesis # CURRENT_USER
###< select CURRENT_USER
###> execute error:Unknown column 'CURRENT_USER' in 'field list'
@@ -1438,11 +1438,11 @@ func_sql_extract_sql=yes # Function EXTRACT
func_sql_localtime=yes # Function LOCALTIME
###
###<select localtime
- ###>2003-03-26 13:44:57
+ ###>2003-08-27 19:55:21
func_sql_localtimestamp=yes # Function LOCALTIMESTAMP
###
###<select localtimestamp
- ###>2003-03-26 13:44:57
+ ###>2003-08-27 19:55:21
func_sql_lower=yes # Function LOWER
###
###<select LOWER('ABC')
@@ -1846,6 +1846,16 @@ left_outer_join_using=yes # left outer join using
###> OK
###
###As far as all queries returned OK, result is YES
+length_of_varchar_field=actual length # CHARACTER_LENGTH(varchar_field)
+ ###< CREATE TABLE crash_me1 (S1 VARCHAR(100))
+ ###> OK
+ ###< INSERT INTO crash_me1 VALUES ('X')
+ ###> OK
+ ###
+ ###< SELECT CHARACTER_LENGTH(S1) FROM crash_me1
+ ### > 1
+ ###< drop table crash_me1
+ ###> OK
like_with_column=yes # column LIKE column
###< create table crash_q (a char(10),b char(10))
###> OK
@@ -1880,7 +1890,7 @@ logical_value=1 # Value of logical operation (1=1)
###>1
max_big_expressions=10 # big expressions
###We are trying (example with N=5):
- ###select 0+(1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+...(16398)
+ ###select 0+(1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+...(14308)
### 50:FAIL 10:OK 30:FAIL 14:FAIL 11:FAIL
max_char_size=255 # max char() size
###We are trying (example with N=5):
@@ -1902,10 +1912,10 @@ max_conditions=85660 # OR and AND in WHERE
###We are trying (example with N=5):
###select a from crash_me where a=1 and b='a' or a=0 and b='0' or a=1 and b='1' or a=2 and b='2' or a=3 and b='3' or a=4 and b='4'
### 27592:OK 41389:OK 48287:FAIL 42769:OK 45528:FAIL 43321:FAIL 42880:FAIL 42791:OK 42835:FAIL 42800:OK 42817:OK 42826:OK 42830:OK 42832:FAIL 42831:FAIL
-max_expressions=1659 # simple expressions
+max_expressions=1450 # simple expressions
###We are trying (example with N=5):
###select 1+1+1+1+1+1
- ### 5000:FAIL 1000:OK 3000:FAIL 1400:OK 2200:FAIL 1560:OK 1880:FAIL 1624:OK 1752:FAIL 1650:OK 1701:FAIL 1660:FAIL 1652:OK 1656:OK 1658:OK 1659:OK
+ ### 5000:FAIL 1000:OK 3000:FAIL 1400:OK 2200:FAIL 1560:FAIL 1432:OK 1496:FAIL 1445:OK 1470:FAIL 1450:OK 1460:FAIL 1452:FAIL 1451:FAIL
max_index=32 # max index
### max_unique_index=32 ,so max_index must be same
max_index_length=500 # index length
@@ -1946,10 +1956,10 @@ max_row_length_with_null=65502 # table row length with nulls (without blobs)
max_select_alias_name=+512 # select alias name length
###We are trying (example with N=5):
###select b as aaaaa from crash_me
-max_stack_expression=1659 # stacked expressions
+max_stack_expression=1450 # stacked expressions
###We are trying (example with N=5):
###select 1+(1+(1+(1+(1+(1)))))
- ### 1000:OK 1500:OK 1750:FAIL 1550:OK 1650:OK 1700:FAIL 1660:FAIL 1652:OK 1656:OK 1658:OK 1659:OK
+ ### 1000:OK 1500:FAIL 1100:OK 1300:OK 1400:OK 1450:OK 1475:FAIL 1455:FAIL 1451:FAIL
max_table_alias_name=+512 # table alias name length
###We are trying (example with N=5):
###select aaaaa.b from crash_me aaaaa
@@ -2119,7 +2129,7 @@ odbc_left_outer_join=yes # left outer join odbc style
###> OK
###
###As far as all queries returned OK, result is YES
-operating_system=Linux 2.4.18-my-4GB i686 # crash-me tested on
+operating_system=Linux 2.4.20-64GB-SMP i686 # crash-me tested on
order_by=yes # Order by
###< select a from crash_me order by a
###> OK
@@ -3696,7 +3706,7 @@ reserved_word_ansi-92/99_section=no # Keyword SECTION
###As far as all queries returned OK, result is NO
reserved_word_ansi-92/99_select=yes # Keyword SELECT
###< create table crash_me10 (SELECT int not null)
- ###> execute error: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 'SELECT int not null)' at line 1
+ ###> execute error: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 'int not null)' at line 1
###< drop table crash_me10
###> execute error:Unknown table 'crash_me10'
###
@@ -6043,12 +6053,56 @@ select_without_from=yes # SELECT without FROM
###> OK
###
###As far as all queries returned OK, result is YES
-server_version=MySQL 4.0.12 debug/ # server version
+server_version=MySQL 4.0.15 debug log/ # server version
simple_joins=yes # ANSI SQL simple joins
###< select crash_me.a from crash_me, crash_me t0
###> OK
###
###As far as all queries returned OK, result is YES
+sorted_group_by=yes # Group by always sorted
+ ###< create table crash_me_t1 (a int not null, b int not null)
+ ###> OK
+ ###< insert into crash_me_t1 values (1,1)
+ ###> OK
+ ###< insert into crash_me_t1 values (1,2)
+ ###> OK
+ ###< insert into crash_me_t1 values (3,1)
+ ###> OK
+ ###< insert into crash_me_t1 values (3,2)
+ ###> OK
+ ###< insert into crash_me_t1 values (2,2)
+ ###> OK
+ ###< insert into crash_me_t1 values (2,1)
+ ###> OK
+ ###< create table crash_me_t2 (a int not null, b int not null)
+ ###> OK
+ ###< create index crash_me_t2_ind on crash_me_t2 (a)
+ ###> OK
+ ###< insert into crash_me_t2 values (1,3)
+ ###> OK
+ ###< insert into crash_me_t2 values (3,1)
+ ###> OK
+ ###< insert into crash_me_t2 values (2,2)
+ ###> OK
+ ###< insert into crash_me_t2 values (1,1)
+ ###> OK
+ ###
+ ###< select crash_me_t1.a,crash_me_t2.b from crash_me_t1,crash_me_t2 where crash_me_t1.a=crash_me_t2.a group by crash_me_t1.a,crash_me_t2.b
+ ### > 1,1
+ ### > 1,3
+ ### > 2,2
+ ### > 3,1
+ ###
+ ### Check recordset:
+ ### 1,1 expected: 1,1
+ ### 1,3 expected: 1,3
+ ### 2,2 expected: 2,2
+ ### 3,1 expected: 3,1
+ ### Recordset corresponds with template
+ ###< drop table crash_me_t1
+ ###> OK
+ ###< drop table crash_me_t2
+ ###> OK
storage_of_float=round # Storage of float values
###< create table crash_q (q1 float(4,1))
###> OK
@@ -6166,7 +6220,7 @@ time_format_inresult=iso # Time format in result
###> OK
###
###< select a from crash_me_t
- ###> 13:44:57
+ ###> 19:55:21
###< delete from crash_me_t
###> OK
transactions=yes # transactions
diff --git a/sql-common/client.c b/sql-common/client.c
index 25b18c27d8a..77aa733fe0c 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -48,14 +48,12 @@
#endif
#define CLI_MYSQL_REAL_CONNECT cli_mysql_real_connect
-#define CLI_MYSQL_CLOSE cli_mysql_close
#undef net_flush
my_bool net_flush(NET *net);
#else /*EMBEDDED_LIBRARY*/
#define CLI_MYSQL_REAL_CONNECT mysql_real_connect
-#define CLI_MYSQL_CLOSE mysql_close
#endif /*EMBEDDED_LIBRARY*/
#if !defined(MYSQL_SERVER) && (defined(__WIN__) || defined(_WIN32) || defined(_WIN64))
@@ -636,10 +634,10 @@ void free_rows(MYSQL_DATA *cur)
}
}
-static my_bool
+my_bool STDCALL
cli_advanced_command(MYSQL *mysql, enum enum_server_command command,
- const char *header, ulong header_length,
- const char *arg, ulong arg_length, my_bool skip_check)
+ const char *header, ulong header_length,
+ const char *arg, ulong arg_length, my_bool skip_check)
{
NET *net= &mysql->net;
my_bool result= 1;
@@ -1008,7 +1006,7 @@ void mysql_read_default_options(struct st_mysql_options *options,
else the lengths are calculated from the offset between pointers.
**************************************************************************/
-static void cli_fetch_lengths(ulong *to, MYSQL_ROW column, uint field_count)
+static void STDCALL cli_fetch_lengths(ulong *to, MYSQL_ROW column, unsigned int field_count)
{
ulong *prev_length;
byte *start=0;
@@ -1139,8 +1137,8 @@ unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
/* Read all rows (fields or data) from server */
-MYSQL_DATA *read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
- uint fields)
+MYSQL_DATA *cli_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
+ unsigned int fields)
{
uint field;
ulong pkt_len;
@@ -1150,7 +1148,7 @@ MYSQL_DATA *read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
MYSQL_DATA *result;
MYSQL_ROWS **prev_ptr,*cur;
NET *net = &mysql->net;
- DBUG_ENTER("read_rows");
+ DBUG_ENTER("cli_read_rows");
if ((pkt_len= net_safe_read(mysql)) == packet_error)
DBUG_RETURN(0);
@@ -1392,91 +1390,28 @@ mysql_ssl_free(MYSQL *mysql __attribute__((unused)))
/*
- Handle password authentication
-*/
-
-my_bool mysql_autenticate(MYSQL *mysql, const char *passwd)
-{
- ulong pkt_length;
- NET *net= &mysql->net;
- char buff[SCRAMBLE41_LENGTH];
- char password_hash[SCRAMBLE41_LENGTH]; /* Used for storage of stage1 hash */
-
- /* We shall only query server if it expect us to do so */
- if ((pkt_length=net_safe_read(mysql)) == packet_error)
- goto error;
-
- if (mysql->server_capabilities & CLIENT_SECURE_CONNECTION)
- {
- /*
- This should always happen with new server unless empty password
- OK/Error packets have zero as the first char
- */
- if (pkt_length == 24 && net->read_pos[0])
- {
- /* Old passwords will have '*' at the first byte of hash */
- if (net->read_pos[0] != '*')
- {
- /* Build full password hash as it is required to decode scramble */
- password_hash_stage1(buff, passwd);
- /* Store copy as we'll need it later */
- memcpy(password_hash,buff,SCRAMBLE41_LENGTH);
- /* Finally hash complete password using hash we got from server */
- password_hash_stage2(password_hash,(const char*) net->read_pos);
- /* Decypt and store scramble 4 = hash for stage2 */
- password_crypt((const char*) net->read_pos+4,mysql->scramble_buff,
- password_hash, SCRAMBLE41_LENGTH);
- mysql->scramble_buff[SCRAMBLE41_LENGTH]=0;
- /* Encode scramble with password. Recycle buffer */
- password_crypt(mysql->scramble_buff,buff,buff,SCRAMBLE41_LENGTH);
- }
- else
- {
- /* Create password to decode scramble */
- create_key_from_old_password(passwd,password_hash);
- /* Decypt and store scramble 4 = hash for stage2 */
- password_crypt((const char*) net->read_pos+4,mysql->scramble_buff,
- password_hash, SCRAMBLE41_LENGTH);
- mysql->scramble_buff[SCRAMBLE41_LENGTH]=0;
- /* Finally scramble decoded scramble with password */
- scramble(buff, mysql->scramble_buff, passwd,0);
- }
- /* Write second package of authentication */
- if (my_net_write(net,buff,SCRAMBLE41_LENGTH) || net_flush(net))
- {
- net->last_errno= CR_SERVER_LOST;
- strmov(net->sqlstate, unknown_sqlstate);
- strmov(net->last_error,ER(net->last_errno));
- goto error;
- }
- /* Read what server thinks about out new auth message report */
- if (net_safe_read(mysql) == packet_error)
- goto error;
- }
- }
- return 0;
-
-error:
- return 1;
-}
-
-
-/*
Note that the mysql argument must be initialized with mysql_init()
before calling mysql_real_connect !
*/
static my_bool STDCALL cli_mysql_read_query_result(MYSQL *mysql);
-static MYSQL_RES * STDCALL cli_mysql_store_result(MYSQL *mysql);
static MYSQL_RES * STDCALL cli_mysql_use_result(MYSQL *mysql);
static MYSQL_METHODS client_methods=
{
cli_mysql_read_query_result,
cli_advanced_command,
- cli_mysql_store_result,
+ cli_read_rows,
cli_mysql_use_result,
cli_fetch_lengths
+#ifndef MYSQL_SERVER
+ ,cli_list_fields,
+ cli_read_prepare_result,
+ cli_stmt_execute,
+ cli_read_binary_rows,
+ cli_unbuffered_fetch,
+ NULL
+#endif
};
MYSQL * STDCALL
@@ -1502,6 +1437,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
#ifdef HAVE_SYS_UN_H
struct sockaddr_un UNIXaddr;
#endif
+
init_sigpipe_variables
DBUG_ENTER("mysql_real_connect");
LINT_INIT(host_info);
@@ -1553,7 +1489,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
mysql->server_status=SERVER_STATUS_AUTOCOMMIT;
/*
- Grab a socket and connect it to the server
+ Part 0: Grab a socket and connect it to the server
*/
#if defined(HAVE_SMEM)
if ((!mysql->options.protocol ||
@@ -1754,6 +1690,11 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
strmov(net->last_error,ER(net->last_errno));
goto error;
}
+
+ /*
+ Part 1: Connection established, read and parse first packet
+ */
+
if ((pkt_length=net_safe_read(mysql)) == packet_error)
goto error;
@@ -1774,8 +1715,13 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
end=strend((char*) net->read_pos+1);
mysql->thread_id=uint4korr(end+1);
end+=5;
- strmake(mysql->scramble_buff,end,8);
- end+=9;
+ /*
+ Scramble is split into two parts because old clients does not understand
+ long scrambles; here goes the first part.
+ */
+ strmake(mysql->scramble, end, SCRAMBLE_LENGTH_323);
+ end+= SCRAMBLE_LENGTH_323+1;
+
if (pkt_length >= (uint) (end+1 - (char*) net->read_pos))
mysql->server_capabilities=uint2korr(end);
if (pkt_length >= (uint) (end+18 - (char*) net->read_pos))
@@ -1784,6 +1730,14 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
mysql->server_language=end[2];
mysql->server_status=uint2korr(end+3);
}
+ end+= 18;
+ if (pkt_length >= (uint) (end + SCRAMBLE_LENGTH - SCRAMBLE_LENGTH_323 + 1 -
+ (char *) net->read_pos))
+ strmake(mysql->scramble+SCRAMBLE_LENGTH_323, end,
+ SCRAMBLE_LENGTH-SCRAMBLE_LENGTH_323);
+ else
+ mysql->server_capabilities&= ~CLIENT_SECURE_CONNECTION;
+
charset_number= mysql->server_language;
/* Set character set */
@@ -1860,9 +1814,12 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
mysql->unix_socket=0;
strmov(mysql->server_version,(char*) net->read_pos+1);
mysql->port=port;
- client_flag|=mysql->options.client_flag;
- /* Send client information for access check */
+ /*
+ Part 2: format and send client info to the server for access check
+ */
+
+ client_flag|=mysql->options.client_flag;
client_flag|=CLIENT_CAPABILITIES;
if (client_flag & CLIENT_MULTI_QUERIES)
client_flag|= CLIENT_MULTI_RESULTS;
@@ -1949,7 +1906,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
mysql->server_status, client_flag));
/* This needs to be changed as it's not useful with big packets */
if (user && user[0])
- strmake(end,user,32); /* Max user name */
+ strmake(end,user,USERNAME_LENGTH); /* Max user name */
else
read_user_name((char*) end);
@@ -1958,41 +1915,30 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
#include "_cust_libmysql.h"
#endif
DBUG_PRINT("info",("user: %s",end));
- /*
- We always start with old type handshake the only difference is message sent
- If server handles secure connection type we'll not send the real scramble
- */
- if (mysql->server_capabilities & CLIENT_SECURE_CONNECTION)
+ end= strend(end) + 1;
+ if (passwd[0])
{
- if (passwd[0])
+ if (mysql->server_capabilities & CLIENT_SECURE_CONNECTION)
{
- /* Prepare false scramble */
- end=strend(end)+1;
- bfill(end, SCRAMBLE_LENGTH, 'x');
- end+=SCRAMBLE_LENGTH;
- *end=0;
+ *end++= SCRAMBLE_LENGTH;
+ scramble(end, mysql->scramble, passwd);
+ end+= SCRAMBLE_LENGTH;
}
- else /* For empty password*/
+ else
{
- end=strend(end)+1;
- *end=0; /* Store zero length scramble */
+ scramble_323(end, mysql->scramble, passwd);
+ end+= SCRAMBLE_LENGTH_323 + 1;
}
}
else
- {
- /*
- Real scramble is only sent to old servers. This can be blocked
- by calling mysql_options(MYSQL *, MYSQL_SECURE_CONNECT, (char*) &1);
- */
- end=scramble(strend(end)+1, mysql->scramble_buff, passwd,
- (my_bool) (mysql->protocol_version == 9));
- }
+ *end++= '\0'; /* empty password */
+
/* Add database if needed */
if (db && (mysql->server_capabilities & CLIENT_CONNECT_WITH_DB))
{
- end=strmake(end+1,db,NAME_LEN);
- mysql->db=my_strdup(db,MYF(MY_WME));
- db=0;
+ end= strmake(end, db, NAME_LEN) + 1;
+ mysql->db= my_strdup(db,MYF(MY_WME));
+ db= 0;
}
/* Write authentication package */
if (my_net_write(net,buff,(ulong) (end-buff)) || net_flush(net))
@@ -2002,10 +1948,36 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
strmov(net->last_error,ER(net->last_errno));
goto error;
}
+
+ /*
+ Part 3: Authorization data's been sent. Now server can reply with
+ OK-packet, or re-request scrambled password.
+ */
- if (mysql_autenticate(mysql, passwd))
+ if ((pkt_length=net_safe_read(mysql)) == packet_error)
goto error;
+ if (pkt_length == 1 && net->read_pos[0] == 254 &&
+ mysql->server_capabilities & CLIENT_SECURE_CONNECTION)
+ {
+ /*
+ By sending this very specific reply server asks us to send scrambled
+ password in old format.
+ */
+ scramble_323(buff, mysql->scramble, passwd);
+ if (my_net_write(net, buff, SCRAMBLE_LENGTH_323 + 1) || net_flush(net))
+ {
+ net->last_errno= CR_SERVER_LOST;
+ strmov(net->sqlstate, unknown_sqlstate);
+ strmov(net->last_error,ER(net->last_errno));
+ goto error;
+ }
+ /* Read what server thinks about out new auth message report */
+ if (net_safe_read(mysql) == packet_error)
+ goto error;
+ }
+
+
if (client_flag & CLIENT_COMPRESS) /* We will use compression */
net->compress=1;
@@ -2028,7 +2000,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
goto error;
if (mysql->fields)
{
- if (!(res= mysql_use_result(mysql)))
+ if (!(res= cli_mysql_use_result(mysql)))
goto error;
mysql_free_result(res);
}
@@ -2157,6 +2129,7 @@ static void mysql_close_free_options(MYSQL *mysql)
my_free(mysql->options.my_cnf_group,MYF(MY_ALLOW_ZERO_PTR));
my_free(mysql->options.charset_dir,MYF(MY_ALLOW_ZERO_PTR));
my_free(mysql->options.charset_name,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(mysql->options.client_ip,MYF(MY_ALLOW_ZERO_PTR));
if (mysql->options.init_commands)
{
DYNAMIC_ARRAY *init_commands= mysql->options.init_commands;
@@ -2189,7 +2162,7 @@ static void mysql_close_free(MYSQL *mysql)
}
-void STDCALL CLI_MYSQL_CLOSE(MYSQL *mysql)
+void STDCALL mysql_close(MYSQL *mysql)
{
DBUG_ENTER("mysql_close");
if (mysql) /* Some simple safety */
@@ -2235,6 +2208,10 @@ void STDCALL CLI_MYSQL_CLOSE(MYSQL *mysql)
#endif
if (mysql != mysql->master)
mysql_close(mysql->master);
+#ifndef MYSQL_SERVER
+ if (mysql->thd)
+ (*mysql->methods->free_embedded_thd)(mysql);
+#endif
if (mysql->free_me)
my_free((gptr) mysql,MYF(0));
}
@@ -2247,7 +2224,7 @@ static my_bool STDCALL cli_mysql_read_query_result(MYSQL *mysql)
ulong field_count;
MYSQL_DATA *fields;
ulong length;
- DBUG_ENTER("mysql_read_query_result");
+ DBUG_ENTER("cli_mysql_read_query_result");
/*
Read from the connection which we actually used, which
@@ -2296,7 +2273,8 @@ get_info:
mysql->extra_info= net_field_length_ll(&pos); /* Maybe number of rec */
- if (!(fields=read_rows(mysql,(MYSQL_FIELD*)0,protocol_41(mysql) ? 7 : 5)))
+ if (!(fields=(*mysql->methods->read_rows)(mysql,(MYSQL_FIELD*)0,
+ protocol_41(mysql) ? 7 : 5)))
DBUG_RETURN(1);
if (!(mysql->fields=unpack_fields(fields,&mysql->field_alloc,
(uint) field_count,0,
@@ -2349,7 +2327,7 @@ mysql_real_query(MYSQL *mysql, const char *query, ulong length)
if (mysql_send_query(mysql,query,length))
DBUG_RETURN(1);
- DBUG_RETURN((int) mysql_read_query_result(mysql));
+ DBUG_RETURN((int) (*mysql->methods->read_query_result)(mysql));
}
@@ -2358,7 +2336,7 @@ mysql_real_query(MYSQL *mysql, const char *query, ulong length)
mysql_data_seek may be used.
**************************************************************************/
-static MYSQL_RES * STDCALL cli_mysql_store_result(MYSQL *mysql)
+MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql)
{
MYSQL_RES *result;
DBUG_ENTER("mysql_store_result");
@@ -2387,7 +2365,8 @@ static MYSQL_RES * STDCALL cli_mysql_store_result(MYSQL *mysql)
result->methods= mysql->methods;
result->eof=1; /* Marker for buffered */
result->lengths=(ulong*) (result+1);
- if (!(result->data=read_rows(mysql,mysql->fields,mysql->field_count)))
+ if (!(result->data=
+ (*mysql->methods->read_rows)(mysql,mysql->fields,mysql->field_count)))
{
my_free((gptr) result,MYF(0));
DBUG_RETURN(0);
@@ -2417,7 +2396,7 @@ static MYSQL_RES * STDCALL cli_mysql_store_result(MYSQL *mysql)
static MYSQL_RES * STDCALL cli_mysql_use_result(MYSQL *mysql)
{
MYSQL_RES *result;
- DBUG_ENTER("mysql_use_result");
+ DBUG_ENTER("cli_mysql_use_result");
mysql = mysql->last_used_con;
@@ -2557,6 +2536,8 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const char *arg)
case MYSQL_OPT_GUESS_CONNECTION:
mysql->options.methods_to_use= option;
break;
+ case MYSQL_SET_CLIENT_IP:
+ mysql->options.client_ip= my_strdup(arg, MYF(MY_WME));
default:
DBUG_RETURN(1);
}
diff --git a/sql/derror.cc b/sql/derror.cc
index 7ebe6e4b3c5..78efdcc33f3 100644
--- a/sql/derror.cc
+++ b/sql/derror.cc
@@ -49,6 +49,7 @@ static void read_texts(const char *file_name,const char ***point,
char name[FN_REFLEN];
const char *buff;
uchar head[32],*pos;
+ CHARSET_INFO *cset;
DBUG_ENTER("read_texts");
*point=0; // If something goes wrong
@@ -65,6 +66,21 @@ static void read_texts(const char *file_name,const char ***point,
head[2] != 2 || head[3] != 1)
goto err; /* purecov: inspected */
textcount=head[4];
+
+ if (!head[30])
+ {
+ sql_print_error("Character set information not found in '%s'. \
+Please install the latest version of this file.",name);
+ goto err1;
+ }
+
+ if (!(cset= get_charset(head[30],MYF(MY_WME))))
+ {
+ sql_print_error("Character set #%d is not supported for messagefile '%s'",
+ (int)head[30],name);
+ goto err1;
+ }
+
length=uint2korr(head+6); count=uint2korr(head+8);
if (count < error_messages)
@@ -114,9 +130,10 @@ err:
buff="Can't find messagefile '%s'";
break;
}
+ sql_print_error(buff,name);
+err1:
if (file != FERR)
VOID(my_close(file,MYF(MY_WME)));
- sql_print_error(buff,name);
unireg_abort(1);
} /* read_texts */
diff --git a/sql/field.cc b/sql/field.cc
index 051a4fa8057..68c9922e887 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -771,7 +771,7 @@ int Field_decimal::store(double nr)
char buff[320];
fyllchar = zerofill ? (char) '0' : (char) ' ';
-#ifdef HAVE_SNPRINTF_
+#ifdef HAVE_SNPRINTF
buff[sizeof(buff)-1]=0; // Safety
snprintf(buff,sizeof(buff)-1, "%.*f",(int) dec,nr);
length=(uint) strlen(buff);
@@ -2016,9 +2016,16 @@ double Field_longlong::val_real(void)
else
#endif
longlongget(j,ptr);
- return unsigned_flag ? ulonglong2double((ulonglong) j) : (double) j;
+ /* The following is open coded to avoid a bug in gcc 3.3 */
+ if (unsigned_flag)
+ {
+ ulonglong tmp= (ulonglong) j;
+ return ulonglong2double(tmp);
+ }
+ return (double) j;
}
+
longlong Field_longlong::val_int(void)
{
longlong j;
@@ -3968,12 +3975,8 @@ String *Field_string::val_str(String *val_buffer __attribute__((unused)),
String *val_ptr)
{
char *end=ptr+field_length;
-#ifdef WANT_TRUE_BINARY_STRINGS
- if (!binary)
-#endif
- while (end > ptr && end[-1] == ' ')
- end--;
- val_ptr->set((const char*) ptr,(uint) (end - ptr),field_charset);
+ uint length= field_charset->cset->lengthsp(field_charset, ptr, field_length);
+ val_ptr->set((const char*) ptr, length, field_charset);
return val_ptr;
}
@@ -4413,8 +4416,11 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs)
Field_blob::store_length(length);
if (table->copy_blobs || length <= MAX_FIELD_WIDTH)
{ // Must make a copy
- value.copy(from,length,charset());
- from=value.ptr();
+ if (from != value.ptr()) // For valgrind
+ {
+ value.copy(from,length,charset());
+ from=value.ptr();
+ }
}
bmove(ptr+packlength,(char*) &from,sizeof(char*));
}
@@ -5480,6 +5486,27 @@ create_field::create_field(Field *old_field,Field *orig_field)
if (flags & BLOB_FLAG)
pack_length= (pack_length- old_field->table->blob_ptr_size +
portable_sizeof_char_ptr);
+
+ switch (sql_type)
+ {
+ case FIELD_TYPE_BLOB:
+ switch (pack_length - portable_sizeof_char_ptr)
+ {
+ case 1: sql_type= FIELD_TYPE_TINY_BLOB; break;
+ case 2: sql_type= FIELD_TYPE_BLOB; break;
+ case 3: sql_type= FIELD_TYPE_MEDIUM_BLOB; break;
+ default: sql_type= FIELD_TYPE_LONG_BLOB; break;
+ }
+ length /= charset->mbmaxlen;
+ break;
+ case FIELD_TYPE_STRING:
+ case FIELD_TYPE_VAR_STRING:
+ length /= charset->mbmaxlen;
+ break;
+ default:
+ break;
+ }
+
decimals= old_field->decimals();
if (sql_type == FIELD_TYPE_STRING)
{
diff --git a/sql/field.h b/sql/field.h
index 794b4a89542..fe5141e9d80 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -125,6 +125,13 @@ public:
{ return null_ptr ? (null_ptr[row_offset] & null_bit ? 1 : 0) : table->null_row; }
inline bool is_real_null(uint row_offset=0)
{ return null_ptr ? (null_ptr[row_offset] & null_bit ? 1 : 0) : 0; }
+ inline bool is_null_in_record(const uchar *record)
+ {
+ if (!null_ptr)
+ return 0;
+ return test(record[(uint) (null_ptr - (uchar*) table->record[0])] &
+ null_bit);
+ }
inline void set_null(int row_offset=0)
{ if (null_ptr) null_ptr[row_offset]|= null_bit; }
inline void set_notnull(int row_offset=0)
@@ -305,6 +312,11 @@ public:
unireg_check_arg, field_name_arg, table_arg,
dec_arg, zero_arg,unsigned_arg)
{}
+ Field_decimal(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg,
+ struct st_table *table_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)
+ {}
enum_field_types type() const { return FIELD_TYPE_DECIMAL;}
enum ha_base_keytype key_type() const
{ return zerofill ? HA_KEYTYPE_BINARY : HA_KEYTYPE_NUM; }
@@ -334,6 +346,11 @@ public:
unireg_check_arg, field_name_arg, table_arg,
0, zero_arg,unsigned_arg)
{}
+ Field_tiny(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg,
+ struct st_table *table_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)
+ {}
enum Item_result result_type () const { return INT_RESULT; }
enum_field_types type() const { return FIELD_TYPE_TINY;}
enum ha_base_keytype key_type() const
@@ -364,6 +381,11 @@ public:
unireg_check_arg, field_name_arg, table_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)
+ :Field_num((char*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0,0,
+ NONE, field_name_arg, table_arg,0,0,unsigned_arg)
+ {}
enum Item_result result_type () const { return INT_RESULT; }
enum_field_types type() const { return FIELD_TYPE_SHORT;}
enum ha_base_keytype key_type() const
@@ -497,6 +519,11 @@ public:
unireg_check_arg, field_name_arg, table_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)
+ :Field_num((char*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0, (uint) 0,
+ NONE, field_name_arg, table_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; }
int store(const char *to,uint length,CHARSET_INFO *charset);
@@ -558,6 +585,11 @@ public:
:Field_str(ptr_arg, len_arg, null, 1,
unireg_check_arg, field_name_arg, table_arg, cs)
{}
+ Field_null(uint32 len_arg, const char *field_name_arg,
+ struct st_table *table_arg, CHARSET_INFO *cs)
+ :Field_str((char*) 0, len_arg, null, 1,
+ NONE, field_name_arg, table_arg, cs)
+ {}
enum_field_types type() const { return FIELD_TYPE_NULL;}
int store(const char *to, uint length, CHARSET_INFO *cs) { null[0]=1; return 0; }
int store(double nr) { null[0]=1; return 0; }
@@ -627,6 +659,10 @@ public:
:Field_tiny(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg, table_arg, 1, 1)
{}
+ Field_year(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg,
+ struct st_table *table_arg)
+ :Field_tiny(len_arg,maybe_null_arg,field_name_arg,table_arg,1)
+ {}
enum_field_types type() const { return FIELD_TYPE_YEAR;}
int store(const char *to,uint length,CHARSET_INFO *charset);
int store(double nr);
diff --git a/sql/filesort.cc b/sql/filesort.cc
index 13989bdae8f..1b481924690 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -1,4 +1,3 @@
-
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This program is free software; you can redistribute it and/or modify
diff --git a/sql/gen_lex_hash.cc b/sql/gen_lex_hash.cc
index dc4f23db3b2..7126b7ee577 100644
--- a/sql/gen_lex_hash.cc
+++ b/sql/gen_lex_hash.cc
@@ -430,18 +430,9 @@ int main(int argc,char **argv)
exit(1);
printf("/* Copyright (C) 2001 MySQL AB\n\
- This program is free software; you can redistribute it and/or modify\n\
- it under the terms of the GNU General Public License as published by\n\
- the Free Software Foundation; either version 2 of the License, or\n\
- (at your option) any later version.\n\n\
- This program is distributed in the hope that it will be useful,\n\
- but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
- GNU General Public License for more details.\n\n\
- You should have received a copy of the GNU General Public License\n\
- along with this program; if not, write to the Free Software\n\
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307\
- USA */\n\n");
+ This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n\
+ and you are welcome to modify and redistribute it under the GPL license\n\
+ \n*/\n\n");
printf("/* This code is generated by gen_lex_hash.cc that seeks for\
a perfect\nhash function */\n\n");
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc
index dbed955c0a9..1b99efeaa43 100644
--- a/sql/ha_berkeley.cc
+++ b/sql/ha_berkeley.cc
@@ -304,11 +304,13 @@ void berkeley_cleanup_log_files(void)
char **names;
int error;
+// by HF. Sometimes it crashes. TODO - find out why
+#ifndef EMBEDDED_LIBRARY
/* XXX: Probably this should be done somewhere else, and
* should be tunable by the user. */
if ((error = db_env->txn_checkpoint(db_env, 0, 0, 0)))
my_error(ER_ERROR_DURING_CHECKPOINT, MYF(0), error); /* purecov: inspected */
-
+#endif
if ((error = db_env->log_archive(db_env, &names, DB_ARCH_ABS)) != 0)
{
DBUG_PRINT("error", ("log_archive failed (error %d)", error)); /* purecov: inspected */
@@ -1433,6 +1435,8 @@ int ha_berkeley::index_read(byte * buf, const byte * key,
}
if (key_len == key_info->key_length)
{
+ if (find_flag == HA_READ_AFTER_KEY)
+ key_info->handler.bdb_return_if_eq= 1;
error=read_row(cursor->c_get(cursor, pack_key(&last_key,
active_index,
key_buff,
@@ -1441,6 +1445,7 @@ int ha_berkeley::index_read(byte * buf, const byte * key,
(find_flag == HA_READ_KEY_EXACT ?
DB_SET : DB_SET_RANGE)),
(char*) buf, active_index, &row, (DBT*) 0, 0);
+ key_info->handler.bdb_return_if_eq= 0;
}
else
{
@@ -2263,7 +2268,7 @@ static BDB_SHARE *get_share(const char *table_name, TABLE *table)
strmov(share->table_name,table_name);
share->key_file = key_file;
share->key_type = key_type;
- if (hash_insert(&bdb_open_tables, (byte*) share))
+ if (my_hash_insert(&bdb_open_tables, (byte*) share))
{
pthread_mutex_unlock(&bdb_mutex); /* purecov: inspected */
my_free((gptr) share,0); /* purecov: inspected */
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index d870d0debfd..4ff5aba4a32 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -28,7 +28,6 @@ InnoDB */
#include "mysql_priv.h"
#include "slave.h"
-#include "sql_cache.h"
#ifdef HAVE_INNOBASE_DB
#include <m_ctype.h>
@@ -394,7 +393,7 @@ check_trx_exists(
{
trx_t* trx;
- ut_a(thd == current_thd);
+ DBUG_ASSERT(thd == current_thd);
trx = (trx_t*) thd->transaction.all.innobase_tid;
@@ -1541,82 +1540,6 @@ ha_innobase::close(void)
DBUG_RETURN(0);
}
-/* The following accessor functions should really be inside MySQL code! */
-
-/******************************************************************
-Gets field offset for a field in a table. */
-inline
-uint
-get_field_offset(
-/*=============*/
- /* out: offset */
- TABLE* table, /* in: MySQL table object */
- Field* field) /* in: MySQL field object */
-{
- return((uint) (field->ptr - (char*) table->record[0]));
-}
-
-/******************************************************************
-Checks if a field in a record is SQL NULL. Uses the record format
-information in table to track the null bit in record. */
-inline
-uint
-field_in_record_is_null(
-/*====================*/
- /* out: 1 if NULL, 0 otherwise */
- TABLE* table, /* in: MySQL table object */
- Field* field, /* in: MySQL field object */
- char* record) /* in: a row in MySQL format */
-{
- int null_offset;
-
- if (!field->null_ptr) {
-
- return(0);
- }
-
- null_offset = (uint) ((char*) field->null_ptr
- - (char*) table->record[0]);
-
- if (record[null_offset] & field->null_bit) {
-
- return(1);
- }
-
- return(0);
-}
-
-/******************************************************************
-Sets a field in a record to SQL NULL. Uses the record format
-information in table to track the null bit in record. */
-inline
-void
-set_field_in_record_to_null(
-/*========================*/
- TABLE* table, /* in: MySQL table object */
- Field* field, /* in: MySQL field object */
- char* record) /* in: a row in MySQL format */
-{
- int null_offset;
-
- null_offset = (uint) ((char*) field->null_ptr
- - (char*) table->record[0]);
-
- record[null_offset] = record[null_offset] | field->null_bit;
-}
-
-/******************************************************************
-Resets SQL NULL bits in a record to zero. */
-inline
-void
-reset_null_bits(
-/*============*/
- TABLE* table, /* in: MySQL table object */
- char* record) /* in: a row in MySQL format */
-{
- bzero(record, table->null_bytes);
-}
-
extern "C" {
/*****************************************************************
InnoDB uses this function is to compare two data fields for which the
@@ -1826,11 +1749,10 @@ ha_innobase::store_key_val_for_row(
blob_data = row_mysql_read_blob_ref(&blob_len,
(byte*) (record
- + (ulint)get_field_offset(table, field)),
+ + (ulint) field->offset()),
(ulint) field->pack_length());
- ut_a(get_field_offset(table, field)
- == key_part->offset);
+ ut_a(field->offset() == key_part->offset);
if (blob_len > key_part->length) {
blob_len = key_part->length;
}
@@ -1885,7 +1807,7 @@ build_template(
ibool fetch_all_in_key = FALSE;
ulint i;
- ut_a(templ_type != ROW_MYSQL_REC_FIELDS || thd == current_thd);
+ DBUG_ASSERT(templ_type != ROW_MYSQL_REC_FIELDS || thd == current_thd);
clust_index = dict_table_get_first_index_noninline(prebuilt->table);
@@ -2010,9 +1932,7 @@ build_template(
templ->mysql_null_bit_mask = 0;
}
- templ->mysql_col_offset = (ulint)
- get_field_offset(table, field);
-
+ templ->mysql_col_offset = (ulint) field->offset();
templ->mysql_col_len = (ulint) field->pack_length();
templ->type = get_innobase_type_from_mysql_type(field);
templ->is_unsigned = (ulint) (field->flags & UNSIGNED_FLAG);
@@ -2058,8 +1978,8 @@ ha_innobase::write_row(
DBUG_ENTER("ha_innobase::write_row");
- ut_a(prebuilt->trx ==
- (trx_t*) current_thd->transaction.all.innobase_tid);
+ DBUG_ASSERT(prebuilt->trx ==
+ (trx_t*) current_thd->transaction.all.innobase_tid);
statistic_increment(ha_write_count, &LOCK_status);
@@ -2349,8 +2269,8 @@ calc_row_difference(
/* goto skip_field;
}*/
- o_ptr = (byte*) old_row + get_field_offset(table, field);
- n_ptr = (byte*) new_row + get_field_offset(table, field);
+ o_ptr = (byte*) old_row + field->offset();
+ n_ptr = (byte*) new_row + field->offset();
o_len = field->pack_length();
n_len = field->pack_length();
@@ -2375,13 +2295,11 @@ calc_row_difference(
}
if (field->null_ptr) {
- if (field_in_record_is_null(table, field,
- (char*) old_row)) {
+ if (field->is_null_in_record((uchar*) old_row)) {
o_len = UNIV_SQL_NULL;
}
- if (field_in_record_is_null(table, field,
- (char*) new_row)) {
+ if (field->is_null_in_record((uchar*) new_row)) {
n_len = UNIV_SQL_NULL;
}
}
@@ -2433,8 +2351,8 @@ ha_innobase::update_row(
DBUG_ENTER("ha_innobase::update_row");
- ut_a(prebuilt->trx ==
- (trx_t*) current_thd->transaction.all.innobase_tid);
+ DBUG_ASSERT(prebuilt->trx ==
+ (trx_t*) current_thd->transaction.all.innobase_tid);
if (table->time_stamp) {
update_timestamp(new_row + table->time_stamp - 1);
@@ -2495,8 +2413,8 @@ ha_innobase::delete_row(
DBUG_ENTER("ha_innobase::delete_row");
- ut_a(prebuilt->trx ==
- (trx_t*) current_thd->transaction.all.innobase_tid);
+ DBUG_ASSERT(prebuilt->trx ==
+ (trx_t*) current_thd->transaction.all.innobase_tid);
if (last_query_id != user_thd->query_id) {
prebuilt->sql_stat_start = TRUE;
@@ -2673,8 +2591,8 @@ ha_innobase::index_read(
DBUG_ENTER("index_read");
- ut_a(prebuilt->trx ==
- (trx_t*) current_thd->transaction.all.innobase_tid);
+ DBUG_ASSERT(prebuilt->trx ==
+ (trx_t*) current_thd->transaction.all.innobase_tid);
statistic_increment(ha_read_key_count, &LOCK_status);
@@ -2787,12 +2705,9 @@ ha_innobase::change_active_index(
statistic_increment(ha_read_key_count, &LOCK_status);
DBUG_ENTER("change_active_index");
+ DBUG_ASSERT(user_thd == current_thd);
ut_a(prebuilt->trx ==
- (trx_t*) current_thd->transaction.all.innobase_tid);
- ut_a(user_thd == current_thd);
-
- ut_a(prebuilt->trx ==
- (trx_t*) current_thd->transaction.all.innobase_tid);
+ (trx_t*) user_thd->transaction.all.innobase_tid);
active_index = keynr;
@@ -2877,8 +2792,8 @@ ha_innobase::general_fetch(
DBUG_ENTER("general_fetch");
- ut_a(prebuilt->trx ==
- (trx_t*) current_thd->transaction.all.innobase_tid);
+ DBUG_ASSERT(prebuilt->trx ==
+ (trx_t*) current_thd->transaction.all.innobase_tid);
innodb_srv_conc_enter_innodb(prebuilt->trx);
@@ -3111,8 +3026,8 @@ ha_innobase::rnd_pos(
statistic_increment(ha_read_rnd_count, &LOCK_status);
- ut_a(prebuilt->trx ==
- (trx_t*) current_thd->transaction.all.innobase_tid);
+ DBUG_ASSERT(prebuilt->trx ==
+ (trx_t*) current_thd->transaction.all.innobase_tid);
if (prebuilt->clust_index_was_generated) {
/* No primary key was defined for the table and we
@@ -3160,8 +3075,8 @@ ha_innobase::position(
row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
uint len;
- ut_a(prebuilt->trx ==
- (trx_t*) current_thd->transaction.all.innobase_tid);
+ DBUG_ASSERT(prebuilt->trx ==
+ (trx_t*) current_thd->transaction.all.innobase_tid);
if (prebuilt->clust_index_was_generated) {
/* No primary key was defined for the table and we
@@ -3443,7 +3358,7 @@ ha_innobase::create(
/* Get the transaction associated with the current thd, or create one
if not yet created */
- parent_trx = check_trx_exists(current_thd);
+ parent_trx = check_trx_exists(thd);
/* In case MySQL calls this in the middle of a SELECT query, release
possible adaptive hash latch to avoid deadlocks of threads */
@@ -3556,10 +3471,10 @@ ha_innobase::create(
}
}
- if (current_thd->query != NULL) {
+ if (thd->query != NULL) {
error = row_table_add_foreign_constraints(trx,
- current_thd->query, norm_name);
+ thd->query, norm_name);
error = convert_error_code_to_mysql(error, NULL);
@@ -3616,13 +3531,13 @@ ha_innobase::delete_table(
trx_t* parent_trx;
trx_t* trx;
char norm_name[1000];
-
+ THD *thd= current_thd;
DBUG_ENTER("ha_innobase::delete_table");
/* Get the transaction associated with the current thd, or create one
if not yet created */
- parent_trx = check_trx_exists(current_thd);
+ parent_trx = check_trx_exists(thd);
/* In case MySQL calls this in the middle of a SELECT query, release
possible adaptive hash latch to avoid deadlocks of threads */
@@ -3637,8 +3552,8 @@ ha_innobase::delete_table(
trx = trx_allocate_for_mysql();
- trx->mysql_thd = current_thd;
- trx->mysql_query_str = &((*current_thd).query);
+ trx->mysql_thd = thd;
+ trx->mysql_query_str = &(thd->query);
name_len = strlen(name);
@@ -3691,11 +3606,12 @@ innobase_drop_database(
char* ptr;
int error;
char namebuf[10000];
+ THD *thd= current_thd;
/* Get the transaction associated with the current thd, or create one
if not yet created */
- parent_trx = check_trx_exists(current_thd);
+ parent_trx = check_trx_exists(thd);
/* In case MySQL calls this in the middle of a SELECT query, release
possible adaptive hash latch to avoid deadlocks of threads */
@@ -3718,8 +3634,8 @@ innobase_drop_database(
my_casedn_str(system_charset_info, namebuf);
#endif
trx = trx_allocate_for_mysql();
- trx->mysql_thd = current_thd;
- trx->mysql_query_str = &((*current_thd).query);
+ trx->mysql_thd = thd;
+ trx->mysql_query_str = &(thd->query);
error = row_drop_database_for_mysql(namebuf, trx);
@@ -3759,13 +3675,14 @@ ha_innobase::rename_table(
trx_t* trx;
char norm_from[1000];
char norm_to[1000];
+ THD *thd= current_thd;
DBUG_ENTER("ha_innobase::rename_table");
/* Get the transaction associated with the current thd, or create one
if not yet created */
- parent_trx = check_trx_exists(current_thd);
+ parent_trx = check_trx_exists(thd);
/* In case MySQL calls this in the middle of a SELECT query, release
possible adaptive hash latch to avoid deadlocks of threads */
@@ -3779,8 +3696,8 @@ ha_innobase::rename_table(
}
trx = trx_allocate_for_mysql();
- trx->mysql_thd = current_thd;
- trx->mysql_query_str = &((*current_thd).query);
+ trx->mysql_thd = thd;
+ trx->mysql_query_str = &(thd->query);
name_len1 = strlen(from);
name_len2 = strlen(to);
@@ -4666,7 +4583,7 @@ static INNOBASE_SHARE *get_share(const char *table_name)
share->table_name_length=length;
share->table_name=(char*) (share+1);
strmov(share->table_name,table_name);
- if (hash_insert(&innobase_open_tables, (mysql_byte*) share))
+ if (my_hash_insert(&innobase_open_tables, (mysql_byte*) share))
{
pthread_mutex_unlock(&innobase_mutex);
my_free((gptr) share,0);
diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc
index e3712ae4271..497145b1106 100644
--- a/sql/ha_myisam.cc
+++ b/sql/ha_myisam.cc
@@ -242,6 +242,8 @@ int ha_myisam::open(const char *name, int mode, uint test_if_locked)
VOID(mi_extra(file, HA_EXTRA_WAIT_LOCK, 0));
if (!table->db_record_offset)
int_table_flags|=HA_REC_NOT_IN_SEQ;
+ if (file->s->options & (HA_OPTION_CHECKSUM | HA_OPTION_COMPRESS_RECORD))
+ int_table_flags|=HA_HAS_CHECKSUM;
return (0);
}
@@ -1240,7 +1242,7 @@ THR_LOCK_DATA **ha_myisam::store_lock(THD *thd,
void ha_myisam::update_create_info(HA_CREATE_INFO *create_info)
{
- table->file->info(HA_STATUS_AUTO | HA_STATUS_CONST);
+ ha_myisam::info(HA_STATUS_AUTO | HA_STATUS_CONST);
if (!(create_info->used_fields & HA_CREATE_USED_AUTO))
{
create_info->auto_increment_value=auto_increment_value;
@@ -1545,3 +1547,9 @@ int ha_myisam::ft_read(byte * buf)
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
}
+
+uint ha_myisam::checksum() const
+{
+ return (uint)file->s->state.checksum;
+}
+
diff --git a/sql/ha_myisam.h b/sql/ha_myisam.h
index f8ffd00a286..e8413ef0bd2 100644
--- a/sql/ha_myisam.h
+++ b/sql/ha_myisam.h
@@ -64,6 +64,7 @@ class ha_myisam: public handler
uint max_keys() const { return MI_MAX_KEY; }
uint max_key_parts() const { return MAX_REF_PARTS; }
uint max_key_length() const { return MI_MAX_KEY_LENGTH; }
+ uint checksum() const;
int open(const char *name, int mode, uint test_if_locked);
int close(void);
diff --git a/sql/handler.cc b/sql/handler.cc
index acfaa64473e..e14e326792d 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -359,7 +359,10 @@ int ha_commit_trans(THD *thd, THD_TRANS* trans)
if (trans == &thd->transaction.all && mysql_bin_log.is_open() &&
my_b_tell(&thd->transaction.trans_log))
{
- mysql_bin_log.write(thd, &thd->transaction.trans_log);
+ if (wait_if_global_read_lock(thd, 0))
+ DBUG_RETURN(1);
+ mysql_bin_log.write(thd, &thd->transaction.trans_log, 1);
+ start_waiting_global_read_lock(thd);
reinit_io_cache(&thd->transaction.trans_log,
WRITE_CACHE, (my_off_t) 0, 0, 1);
thd->transaction.trans_log.end_of_file= max_binlog_cache_size;
@@ -442,9 +445,21 @@ int ha_rollback_trans(THD *thd, THD_TRANS *trans)
}
#endif
if (trans == &thd->transaction.all)
+ {
+ /*
+ Update the binary log with a BEGIN/ROLLBACK block if we have cached some
+ queries and we updated some non-transactional table. Such cases should
+ be rare (updating a non-transactional table inside a transaction...).
+ */
+ if (unlikely((thd->options & OPTION_STATUS_NO_TRANS_UPDATE) &&
+ mysql_bin_log.is_open() &&
+ my_b_tell(&thd->transaction.trans_log)))
+ mysql_bin_log.write(thd, &thd->transaction.trans_log, 0);
+ /* Flushed or not, empty the binlog cache */
reinit_io_cache(&thd->transaction.trans_log,
- WRITE_CACHE, (my_off_t) 0, 0, 1);
- thd->transaction.trans_log.end_of_file= max_binlog_cache_size;
+ WRITE_CACHE, (my_off_t) 0, 0, 1);
+ thd->transaction.trans_log.end_of_file= max_binlog_cache_size;
+ }
thd->variables.tx_isolation=thd->session_tx_isolation;
if (operation_done)
{
@@ -458,9 +473,27 @@ int ha_rollback_trans(THD *thd, THD_TRANS *trans)
/*
-Rolls the current transaction back to a savepoint.
-Return value: 0 if success, 1 if there was not a savepoint of the given
-name.
+ Rolls the current transaction back to a savepoint.
+ Return value: 0 if success, 1 if there was not a savepoint of the given
+ name.
+ NOTE: how do we handle this (unlikely but legal) case:
+ [transaction] + [update to non-trans table] + [rollback to savepoint] ?
+ The problem occurs when a savepoint is before the update to the
+ non-transactional table. Then when there's a rollback to the savepoint, if we
+ simply truncate the binlog cache, we lose the part of the binlog cache where
+ the update is. If we want to not lose it, we need to write the SAVEPOINT
+ command and the ROLLBACK TO SAVEPOINT command to the binlog cache. The latter
+ is easy: it's just write at the end of the binlog cache, but the former should
+ be *inserted* to the place where the user called SAVEPOINT. The solution is
+ that when the user calls SAVEPOINT, we write it to the binlog cache (so no
+ need to later insert it). As transactions are never intermixed in the binary log
+ (i.e. they are serialized), we won't have conflicts with savepoint names when
+ using mysqlbinlog or in the slave SQL thread.
+ Then when ROLLBACK TO SAVEPOINT is called, if we updated some
+ non-transactional table, we don't truncate the binlog cache but instead write
+ ROLLBACK TO SAVEPOINT to it; otherwise we truncate the binlog cache (which
+ will chop the SAVEPOINT command from the binlog cache, which is good as in
+ that case there is no need to have it in the binlog).
*/
int ha_rollback_to_savepoint(THD *thd, char *savepoint_name)
@@ -485,8 +518,24 @@ int ha_rollback_to_savepoint(THD *thd, char *savepoint_name)
error=1;
}
else
- reinit_io_cache(&thd->transaction.trans_log, WRITE_CACHE,
- binlog_cache_pos, 0, 0);
+ {
+ /*
+ Write ROLLBACK TO SAVEPOINT to the binlog cache if we have updated some
+ non-transactional table. Otherwise, truncate the binlog cache starting
+ from the SAVEPOINT command.
+ */
+ if (unlikely((thd->options & OPTION_STATUS_NO_TRANS_UPDATE) &&
+ mysql_bin_log.is_open() &&
+ my_b_tell(&thd->transaction.trans_log)))
+ {
+ Query_log_event qinfo(thd, thd->query, thd->query_length, TRUE);
+ if (mysql_bin_log.write(&qinfo))
+ error= 1;
+ }
+ else
+ reinit_io_cache(&thd->transaction.trans_log, WRITE_CACHE,
+ binlog_cache_pos, 0, 0);
+ }
operation_done=1;
#endif
if (operation_done)
@@ -515,6 +564,13 @@ int ha_savepoint(THD *thd, char *savepoint_name)
#ifdef HAVE_INNOBASE_DB
innobase_savepoint(thd,savepoint_name, binlog_cache_pos);
#endif
+ /* Write it to the binary log (see comments of ha_rollback_to_savepoint). */
+ if (mysql_bin_log.is_open())
+ {
+ Query_log_event qinfo(thd, thd->query, thd->query_length, TRUE);
+ if (mysql_bin_log.write(&qinfo))
+ error= 1;
+ }
}
#endif /* USING_TRANSACTIONS */
DBUG_RETURN(error);
@@ -683,11 +739,6 @@ int handler::analyze(THD* thd, HA_CHECK_OPT* check_opt)
return HA_ADMIN_NOT_IMPLEMENTED;
}
-int handler::assign_to_keycache(THD* thd, HA_CHECK_OPT* check_opt)
-{
- return HA_ADMIN_NOT_IMPLEMENTED;
-}
-
int handler::preload_keys(THD* thd, HA_CHECK_OPT* check_opt)
{
return HA_ADMIN_NOT_IMPLEMENTED;
@@ -1054,50 +1105,27 @@ int ha_create_table(const char *name, HA_CREATE_INFO *create_info,
/* Use key cacheing on all databases */
-int ha_key_cache(KEY_CACHE_VAR *key_cache)
+void ha_key_cache(void)
{
- if (!key_cache->cache)
- {
- if (!key_cache->block_size)
- key_cache->block_size= dflt_key_cache_block_size;
- if (!key_cache->buff_size)
- key_cache->buff_size= dflt_key_buff_size;
- return !init_key_cache( &key_cache->cache,
- key_cache->block_size,
- key_cache->buff_size,
- key_cache);
- }
- return 0;
+ /*
+ The following mutex is not really needed as long as keybuff_size is
+ treated as a long value, but we use the mutex here to guard for future
+ changes.
+ */
+ pthread_mutex_lock(&LOCK_global_system_variables);
+ long tmp= (long) keybuff_size;
+ pthread_mutex_unlock(&LOCK_global_system_variables);
+ if (tmp)
+ (void) init_key_cache(tmp);
}
-int ha_resize_key_cache(KEY_CACHE_VAR *key_cache)
+void ha_resize_key_cache(void)
{
- if (key_cache->cache)
- {
- return !resize_key_cache(&key_cache->cache, key_cache->block_size,
- key_cache->buff_size);
- }
- return 0;
-}
-
-int ha_change_key_cache_param(KEY_CACHE_VAR *key_cache)
-{
- if (key_cache->cache)
- {
- change_key_cache_param(key_cache->cache);
- }
- return 0;
-}
-
-int ha_end_key_cache(KEY_CACHE_VAR *key_cache)
-{
- if (key_cache->cache)
- {
- end_key_cache(&key_cache->cache, 1);
- return key_cache->cache ? 1 : 0;
- }
- return 0;
+ pthread_mutex_lock(&LOCK_global_system_variables);
+ long tmp= (long) keybuff_size;
+ pthread_mutex_unlock(&LOCK_global_system_variables);
+ (void) resize_key_cache(tmp);
}
diff --git a/sql/handler.h b/sql/handler.h
index b05c4c46e69..b74e06c6edf 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -42,38 +42,39 @@
#define HA_ADMIN_INVALID -5
/* Bits in table_flags() to show what database can do */
-#define HA_READ_RND_SAME 1 /* Read RND-record to KEY-record
- (To update with RND-read) */
-#define HA_KEYPOS_TO_RNDPOS 2 /* ha_info gives pos to record */
-#define HA_TABLE_SCAN_ON_INDEX 4 /* No separate data/index file */
-#define HA_REC_NOT_IN_SEQ 8 /* ha_info don't return recnumber;
- It returns a position to ha_r_rnd */
-#define HA_HAS_GEOMETRY 16
-#define HA_NO_INDEX 32 /* No index needed for next/prev */
-#define HA_KEY_READ_WRONG_STR 64 /* keyread returns converted strings */
-#define HA_NULL_KEY 128 /* One can have keys with NULL */
-#define HA_DUPP_POS 256 /* ha_position() gives dupp row */
-#define HA_NO_BLOBS 512 /* Doesn't support blobs */
-#define HA_BLOB_KEY (HA_NO_BLOBS*2) /* key on blob */
-#define HA_AUTO_PART_KEY (HA_BLOB_KEY*2)
-#define HA_REQUIRE_PRIMARY_KEY (HA_AUTO_PART_KEY*2)
-#define HA_NOT_EXACT_COUNT (HA_REQUIRE_PRIMARY_KEY*2)
-#define HA_NO_WRITE_DELAYED (HA_NOT_EXACT_COUNT*2)
-#define HA_PRIMARY_KEY_IN_READ_INDEX (HA_NO_WRITE_DELAYED*2)
-#define HA_DROP_BEFORE_CREATE (HA_PRIMARY_KEY_IN_READ_INDEX*2)
-#define HA_NOT_READ_AFTER_KEY (HA_DROP_BEFORE_CREATE*2)
-#define HA_NOT_DELETE_WITH_CACHE (HA_NOT_READ_AFTER_KEY*2)
-#define HA_NO_TEMP_TABLES (HA_NOT_DELETE_WITH_CACHE*2)
-#define HA_NO_PREFIX_CHAR_KEYS (HA_NO_TEMP_TABLES*2)
-#define HA_CAN_FULLTEXT (HA_NO_PREFIX_CHAR_KEYS*2)
-#define HA_CAN_SQL_HANDLER (HA_CAN_FULLTEXT*2)
-#define HA_NO_AUTO_INCREMENT (HA_CAN_SQL_HANDLER*2)
+#define HA_READ_RND_SAME 1 /* Read RND-record to KEY-record
+ (To update with RND-read) */
+#define HA_KEYPOS_TO_RNDPOS 2 /* ha_info gives pos to record */
+#define HA_TABLE_SCAN_ON_INDEX 4 /* No separate data/index file */
+#define HA_REC_NOT_IN_SEQ 8 /* ha_info don't return recnumber;
+ It returns a position to ha_r_rnd */
+#define HA_HAS_GEOMETRY (1 << 4)
+#define HA_NO_INDEX (1 << 5) /* No index needed for next/prev */
+#define HA_KEY_READ_WRONG_STR (1 << 6) /* keyread returns converted strings */
+#define HA_NULL_KEY (1 << 7) /* One can have keys with NULL */
+#define HA_DUPP_POS (1 << 8) /* ha_position() gives dupp row */
+#define HA_NO_BLOBS (1 << 9) /* Doesn't support blobs */
+#define HA_BLOB_KEY (1 << 10) /* key on blob */
+#define HA_AUTO_PART_KEY (1 << 11)
+#define HA_REQUIRE_PRIMARY_KEY (1 << 12)
+#define HA_NOT_EXACT_COUNT (1 << 13)
+#define HA_NO_WRITE_DELAYED (1 << 14)
+#define HA_PRIMARY_KEY_IN_READ_INDEX (1 << 15)
+#define HA_DROP_BEFORE_CREATE (1 << 16)
+#define HA_NOT_READ_AFTER_KEY (1 << 17)
+#define HA_NOT_DELETE_WITH_CACHE (1 << 18)
+#define HA_NO_TEMP_TABLES (1 << 19)
+#define HA_NO_PREFIX_CHAR_KEYS (1 << 20)
+#define HA_CAN_FULLTEXT (1 << 21)
+#define HA_CAN_SQL_HANDLER (1 << 22)
+#define HA_NO_AUTO_INCREMENT (1 << 23)
+#define HA_HAS_CHECKSUM (1 << 24)
/*
Next record gives next record according last record read (even
if database is updated after read). Not used at this point.
*/
-#define HA_LASTKEY_ORDER (HA_NO_AUTO_INCREMENT*2)
+#define HA_LASTKEY_ORDER (1 << 25)
/* bits in index_flags(index_number) for what you can do with index */
@@ -306,9 +307,8 @@ public:
virtual bool check_and_repair(THD *thd) {return 1;}
virtual int optimize(THD* thd,HA_CHECK_OPT* check_opt);
virtual int analyze(THD* thd, HA_CHECK_OPT* check_opt);
- virtual int backup(THD* thd, HA_CHECK_OPT* check_opt);
- virtual int assign_to_keycache(THD* thd, HA_CHECK_OPT* check_opt);
virtual int preload_keys(THD* thd, HA_CHECK_OPT* check_opt);
+ virtual int backup(THD* thd, HA_CHECK_OPT* check_opt);
/*
restore assumes .frm file must exist, and that generate_table() has been
called; It will just copy the data file and run repair.
@@ -326,8 +326,8 @@ public:
virtual char* get_foreign_key_create_info()
{ return(NULL);} /* gets foreign key create string from InnoDB */
virtual void init_table_handle_for_HANDLER()
- { return; } /* prepare InnoDB for HANDLER */
- virtual void free_foreign_key_create_info(char* str) {}
+ { return; } /* prepare InnoDB for HANDLER */
+ virtual void free_foreign_key_create_info(char* str) {}
/* The following can be called without an open handler */
virtual const char *table_type() const =0;
virtual const char **bas_ext() const =0;
@@ -343,6 +343,7 @@ public:
virtual uint max_key_part_length() { return 255; }
virtual uint min_record_length(uint options) const { return 1; }
virtual bool low_byte_first() const { return 1; }
+ virtual uint checksum() const { return 0; }
virtual bool is_crashed() const { return 0; }
virtual bool auto_repair() const { return 0; }
@@ -356,13 +357,12 @@ public:
/* Type of table for caching query */
virtual uint8 table_cache_type() { return HA_CACHE_TBL_NONTRANSACT; }
- /*
- Is query with this cable cachable (have sense only for ASKTRANSACT
+ /*
+ Is query with this table cachable (have sense only for ASKTRANSACT
tables)
*/
- static bool caching_allowed(THD* thd, char* table_key,
+ static bool caching_allowed(THD* thd, char* table_key,
uint key_length, uint8 cahe_type);
-
};
/* Some extern variables used with handlers */
@@ -389,11 +389,9 @@ int ha_create_table(const char *name, HA_CREATE_INFO *create_info,
bool update_create_info);
int ha_delete_table(enum db_type db_type, const char *path);
void ha_drop_database(char* path);
-int ha_key_cache(KEY_CACHE_VAR *key_cache);
-int ha_resize_key_cache(KEY_CACHE_VAR *key_cache);
-int ha_change_key_cache_param(KEY_CACHE_VAR *key_cache);
-int ha_end_key_cache(KEY_CACHE_VAR *key_cache);
-int ha_start_stmt(THD *thd);
+void ha_key_cache(void);
+void ha_resize_key_cache(void);
+int ha_start_stmt(THD *thd);
int ha_report_binlog_offset_and_commit(THD *thd, char *log_file_name,
my_off_t end_offset);
int ha_commit_complete(THD *thd);
diff --git a/sql/hash_filo.h b/sql/hash_filo.h
index 92cd2658967..d1672e1a60c 100644
--- a/sql/hash_filo.h
+++ b/sql/hash_filo.h
@@ -116,7 +116,7 @@ public:
last_link=last_link->prev_used;
hash_delete(&cache,(byte*) tmp);
}
- if (hash_insert(&cache,(byte*) entry))
+ if (my_hash_insert(&cache,(byte*) entry))
{
if (free_element)
(*free_element)(entry); // This should never happen
diff --git a/sql/item.cc b/sql/item.cc
index 86fa2d82c41..9d34f299a07 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -23,7 +23,8 @@
#include <m_ctype.h>
#include "my_dir.h"
-static void mark_as_dependent(SELECT_LEX *last, SELECT_LEX *current,
+static void mark_as_dependent(THD *thd,
+ SELECT_LEX *last, SELECT_LEX *current,
Item_ident *item);
/*****************************************************************************
@@ -489,27 +490,38 @@ String *Item_null::val_str(String *str)
/* Item_param related */
void Item_param::set_null()
-{
- maybe_null=null_value=1;
+{
+ DBUG_ENTER("Item_param::set_null");
+ maybe_null= null_value= 1;
+ DBUG_VOID_RETURN;
}
void Item_param::set_int(longlong i)
-{
- int_value=(longlong)i;
- item_type = INT_ITEM;
+{
+ DBUG_ENTER("Item_param::set_int");
+ int_value= (longlong)i;
+ item_type= INT_ITEM;
+ DBUG_PRINT("info", ("integer: %lld", int_value));
+ DBUG_VOID_RETURN;
}
void Item_param::set_double(double value)
-{
+{
+ DBUG_ENTER("Item_param::set_double");
real_value=value;
- item_type = REAL_ITEM;
+ item_type= REAL_ITEM;
+ DBUG_PRINT("info", ("double: %lg", real_value));
+ DBUG_VOID_RETURN;
}
void Item_param::set_value(const char *str, uint length)
-{
- str_value.set(str,length,default_charset());
- item_type = STRING_ITEM;
+{
+ DBUG_ENTER("Item_param::set_value");
+ str_value.copy(str,length,default_charset());
+ item_type= STRING_ITEM;
+ DBUG_PRINT("info", ("string: %s", str_value.ptr()));
+ DBUG_VOID_RETURN;
}
@@ -751,17 +763,29 @@ bool Item_ref_null_helper::get_date(TIME *ltime, bool fuzzydate)
SYNOPSIS
mark_as_dependent()
+ thd - thread handler
last - select from which current item depend
current - current select
item - item which should be marked
*/
-static void mark_as_dependent(SELECT_LEX *last, SELECT_LEX *current,
+static void mark_as_dependent(THD *thd, SELECT_LEX *last, SELECT_LEX *current,
Item_ident *item)
{
// store pointer on SELECT_LEX from wich item is dependent
item->depended_from= last;
current->mark_as_dependent(last);
+ if (thd->lex.describe)
+ {
+ char warn_buff[MYSQL_ERRMSG_SIZE];
+ sprintf(warn_buff, ER(ER_WARN_FIELD_RESOLVED),
+ (item->db_name?item->db_name:""), (item->db_name?".":""),
+ (item->table_name?item->table_name:""), (item->table_name?".":""),
+ item->field_name,
+ current->select_number, last->select_number);
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
+ ER_WARN_FIELD_RESOLVED, warn_buff);
+ }
}
@@ -844,12 +868,12 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
if (rf->fix_fields(thd, tables, ref) || rf->check_cols(1))
return 1;
- mark_as_dependent(last, cursel, rf);
+ mark_as_dependent(thd, last, cursel, rf);
return 0;
}
else
{
- mark_as_dependent(last, cursel, this);
+ mark_as_dependent(thd, last, cursel, this);
if (last->having_fix_field)
{
Item_ref *rf;
@@ -903,6 +927,13 @@ void Item::make_field(Send_field *tmp_field)
init_make_field(tmp_field, field_type());
}
+
+void Item_empty_string::make_field(Send_field *tmp_field)
+{
+ init_make_field(tmp_field,FIELD_TYPE_VAR_STRING);
+}
+
+
enum_field_types Item::field_type() const
{
return ((result_type() == STRING_RESULT) ? FIELD_TYPE_VAR_STRING :
@@ -910,6 +941,73 @@ enum_field_types Item::field_type() const
FIELD_TYPE_DOUBLE);
}
+Field *Item::tmp_table_field_from_field_type(TABLE *table)
+{
+ switch (field_type())
+ {
+ case MYSQL_TYPE_DECIMAL:
+ return new Field_decimal(max_length, maybe_null, name, table,
+ unsigned_flag);
+ case MYSQL_TYPE_TINY:
+ return new Field_tiny(max_length, maybe_null, name, table,
+ unsigned_flag);
+ case MYSQL_TYPE_SHORT:
+ return new Field_short(max_length, maybe_null, name, table,
+ unsigned_flag);
+ case MYSQL_TYPE_LONG:
+ return new Field_long(max_length, maybe_null, name, table,
+ unsigned_flag);
+ case MYSQL_TYPE_FLOAT:
+ return new Field_float(max_length, maybe_null, name, table, decimals);
+ case MYSQL_TYPE_DOUBLE:
+ return new Field_double(max_length, maybe_null, name, table, decimals);
+ case MYSQL_TYPE_NULL:
+ return new Field_null(max_length, name, table, &my_charset_bin);
+#ifdef HAVE_LONG_LONG
+ case MYSQL_TYPE_LONGLONG:
+ return new Field_longlong(max_length, maybe_null, name, table,
+ unsigned_flag);
+#endif
+ case MYSQL_TYPE_NEWDATE:
+ case MYSQL_TYPE_INT24:
+ return new Field_long(max_length, maybe_null, name, table,
+ unsigned_flag);
+ case MYSQL_TYPE_DATE:
+ return new Field_date(maybe_null, name, table, &my_charset_bin);
+ case MYSQL_TYPE_TIME:
+ return new Field_time(maybe_null, name, table, &my_charset_bin);
+ case MYSQL_TYPE_TIMESTAMP:
+ case MYSQL_TYPE_DATETIME:
+ return new Field_datetime(maybe_null, name, table, &my_charset_bin);
+ case MYSQL_TYPE_YEAR:
+ return new Field_year(max_length, maybe_null, name, table);
+ case MYSQL_TYPE_ENUM:
+ case MYSQL_TYPE_SET:
+ return new Field_long(max_length, maybe_null, name, table,
+ unsigned_flag);
+ case MYSQL_TYPE_TINY_BLOB:
+ case MYSQL_TYPE_MEDIUM_BLOB:
+ 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);
+ case MYSQL_TYPE_VAR_STRING:
+ if (max_length > 255)
+ return new Field_blob(max_length, maybe_null, name, table, collation.collation);
+ else
+ return new Field_varstring(max_length, maybe_null, name, table, collation.collation);
+ case MYSQL_TYPE_STRING:
+ if (max_length > 255)
+ return new Field_blob(max_length, maybe_null, name, table, collation.collation);
+ else
+ return new Field_string(max_length, maybe_null, name, table, collation.collation);
+ default:
+ // This case should never be choosen
+ DBUG_ASSERT(0);
+ return 0;
+ }
+}
+
/* ARGSUSED */
void Item_field::make_field(Send_field *tmp_field)
{
@@ -1324,7 +1422,7 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
Item_field* fld;
if (!((*reference)= fld= new Item_field(tmp)))
return 1;
- mark_as_dependent(last, thd->lex.current_select, fld);
+ mark_as_dependent(thd, last, thd->lex.current_select, fld);
return 0;
}
else
@@ -1335,7 +1433,7 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
"forward reference in item list");
return -1;
}
- mark_as_dependent(last, thd->lex.current_select,
+ mark_as_dependent(thd, last, thd->lex.current_select,
this);
ref= last->ref_pointer_array + counter;
}
diff --git a/sql/item.h b/sql/item.h
index c97b66c8c53..d10df759b28 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2003
+/* Copyright (C) 2000-2003 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
@@ -120,6 +120,9 @@ public:
Constructor used by Item_field, Item_ref & agregate (sum) functions.
Used for duplicating lists in processing queries with temporary
tables
+ Also it used for Item_cond_and/Item_cond_or for creating
+ top AND/OR ctructure of WHERE clause to protect it of
+ optimisation changes in prepared statements
*/
Item(THD *thd, Item &item);
virtual ~Item() { name=0; } /*lint -e1509 */
@@ -140,7 +143,7 @@ public:
virtual double val()=0;
virtual longlong val_int()=0;
virtual String *val_str(String*)=0;
- virtual Field *tmp_table_field() { return 0; }
+ virtual Field *get_tmp_table_field() { return 0; }
virtual Field *tmp_table_field(TABLE *t_arg) { return 0; }
virtual const char *full_name() const { return name ? name : "???"; }
virtual double val_result() { return val(); }
@@ -184,6 +187,7 @@ public:
virtual void save_in_result_field(bool no_conversions) {}
virtual void no_rows_in_result() {}
virtual Item *copy_or_same(THD *thd) { return this; }
+ virtual Item *copy_andor_structure(THD *thd) { return this; }
virtual Item *real_item() { return this; }
virtual Item *get_tmp_table_item(THD *thd) { return copy_or_same(thd); }
@@ -205,6 +209,8 @@ public:
virtual bool null_inside() { return 0; }
// used in row subselects to get value of elements
virtual void bring_value() {}
+
+ Field *tmp_table_field_from_field_type(TABLE *table);
};
@@ -265,7 +271,7 @@ public:
{
return field->type();
}
- Field *tmp_table_field() { return result_field; }
+ Field *get_tmp_table_field() { return result_field; }
Field *tmp_table_field(TABLE *t_arg) { return result_field; }
bool get_date(TIME *ltime,bool fuzzydate);
bool get_date_result(TIME *ltime,bool fuzzydate);
@@ -340,7 +346,11 @@ public:
void set_time(TIME *tm, timestamp_type type);
bool get_time(TIME *tm);
void reset() {}
+#ifndef EMBEDDED_LIBRARY
void (*setup_param_func)(Item_param *param, uchar **pos);
+#else
+ void (*setup_param_func)(Item_param *param, uchar **pos, ulong data_len);
+#endif
enum Item_result result_type () const
{ return item_result_type; }
String *query_val_str(String *str);
@@ -503,6 +513,7 @@ public:
Item_empty_string(const char *header,uint length) :Item_string("",0,
&my_charset_bin)
{ name=(char*) header; max_length=length;}
+ void make_field(Send_field *field);
};
class Item_return_int :public Item_int
@@ -539,12 +550,12 @@ class Item_result_field :public Item /* Item with result field */
public:
Field *result_field; /* Save result here */
Item_result_field() :result_field(0) {}
- // Constructor used for Item_sum (see Item comment)
+ // Constructor used for Item_sum/Item_cond_and/or (see Item comment)
Item_result_field(THD *thd, Item_result_field &item):
Item(thd, item), result_field(item.result_field)
{}
~Item_result_field() {} /* Required with gcc 2.95 */
- Field *tmp_table_field() { return result_field; }
+ Field *get_tmp_table_field() { return result_field; }
Field *tmp_table_field(TABLE *t_arg) { return result_field; }
table_map used_tables() const { return 1; }
virtual void fix_length_and_dec()=0;
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 053eb9e6fef..e7dc3933c10 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2003
+/* Copyright (C) 2000-2003 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
@@ -545,6 +545,7 @@ void Item_func_interval::fix_length_and_dec()
used_tables_cache|= row->used_tables();
not_null_tables_cache&= row->not_null_tables();
with_sum_func= with_sum_func || row->with_sum_func;
+ const_item_cache&= row->const_item();
}
@@ -698,8 +699,21 @@ Item_func_ifnull::fix_length_and_dec()
agg_arg_collations(collation, args, arg_count);
else if (cached_result_type != REAL_RESULT)
decimals= 0;
+
+ cached_field_type= args[0]->field_type();
+ if (cached_field_type != args[1]->field_type())
+ cached_field_type= Item_func::field_type();
}
+enum_field_types Item_func_ifnull::field_type() const
+{
+ return cached_field_type;
+}
+
+Field *Item_func_ifnull::tmp_table_field(TABLE *table)
+{
+ return tmp_table_field_from_field_type(table);
+}
double
Item_func_ifnull::val()
@@ -1445,17 +1459,20 @@ void Item_func_in::fix_length_and_dec()
DBUG_ASSERT(0);
return;
}
- uint j=0;
- for (uint i=1 ; i < arg_count ; i++)
+ if (array && !(current_thd->is_fatal_error)) // If not EOM
{
- array->set(j,args[i]);
- if (!args[i]->null_value) // Skip NULL values
- j++;
- else
- have_null= 1;
+ uint j=0;
+ for (uint i=1 ; i < arg_count ; i++)
+ {
+ array->set(j,args[i]);
+ if (!args[i]->null_value) // Skip NULL values
+ j++;
+ else
+ have_null= 1;
+ }
+ if ((array->used_count=j))
+ array->sort();
}
- if ((array->used_count=j))
- array->sort();
}
else
{
@@ -1536,6 +1553,31 @@ longlong Item_func_bit_and::val_int()
return (longlong) (arg1 & arg2);
}
+Item_cond::Item_cond(THD *thd, Item_cond &item)
+ :Item_bool_func(thd, item),
+ abort_on_null(item.abort_on_null),
+ and_tables_cache(item.and_tables_cache)
+{
+ /*
+ here should be following text:
+
+ List_iterator_fast<Item*> li(item.list);
+ while(Item *it= li++)
+ list.push_back(it);
+
+ but it do not need,
+ because this constructor used only for AND/OR and
+ argument list will be copied by copy_andor_arguments call
+ */
+
+}
+
+void Item_cond::copy_andor_arguments(THD *thd, Item_cond *item)
+{
+ List_iterator_fast<Item> li(item->list);
+ while(Item *it= li++)
+ list.push_back(it->copy_andor_structure(thd));
+}
bool
Item_cond::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
@@ -1554,7 +1596,7 @@ Item_cond::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
and_tables_cache= ~(table_map) 0;
if (thd && check_stack_overrun(thd,buff))
- return 0; // Fatal error flag is set!
+ return 1; // Fatal error flag is set!
while ((item=li++))
{
table_map tmp_table_map;
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index c4638dcd24f..2a73718c821 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -82,6 +82,7 @@ public:
Item_bool_func() :Item_int_func() {}
Item_bool_func(Item *a) :Item_int_func(a) {}
Item_bool_func(Item *a,Item *b) :Item_int_func(a,b) {}
+ Item_bool_func(THD *thd, Item_bool_func &item) :Item_int_func(thd, item) {}
void fix_length_and_dec() { decimals=0; max_length=1; }
};
@@ -115,8 +116,8 @@ protected:
String tmp_value1,tmp_value2;
public:
- Item_bool_func2(Item *a,Item *b):
- Item_int_func(a,b), cmp(tmp_arg, tmp_arg+1) {}
+ Item_bool_func2(Item *a,Item *b)
+ :Item_int_func(a,b), cmp(tmp_arg, tmp_arg+1) {}
void fix_length_and_dec();
void set_cmp_func()
{
@@ -158,7 +159,7 @@ public:
class Item_func_eq :public Item_bool_rowready_func2
{
public:
- Item_func_eq(Item *a,Item *b) :Item_bool_rowready_func2(a,b) {};
+ Item_func_eq(Item *a,Item *b) :Item_bool_rowready_func2(a,b) {}
longlong val_int();
enum Functype functype() const { return EQ_FUNC; }
enum Functype rev_functype() const { return EQ_FUNC; }
@@ -280,6 +281,8 @@ public:
class Item_func_ifnull :public Item_func
{
enum Item_result cached_result_type;
+ enum_field_types cached_field_type;
+ bool field_type_defined;
public:
Item_func_ifnull(Item *a,Item *b)
:Item_func(a,b), cached_result_type(INT_RESULT)
@@ -288,8 +291,10 @@ public:
longlong val_int();
String *val_str(String *str);
enum Item_result result_type () const { return cached_result_type; }
+ enum_field_types field_type() const;
void fix_length_and_dec();
const char *func_name() const { return "ifnull"; }
+ Field *tmp_table_field(TABLE *table);
table_map not_null_tables() const { return 0; }
};
@@ -787,8 +792,13 @@ protected:
public:
/* Item_cond() is only used to create top level items */
Item_cond() : Item_bool_func(), abort_on_null(1) { const_item_cache=0; }
- Item_cond(Item *i1,Item *i2) :Item_bool_func(), abort_on_null(0)
- { list.push_back(i1); list.push_back(i2); }
+ Item_cond(Item *i1,Item *i2)
+ :Item_bool_func(), abort_on_null(0)
+ {
+ list.push_back(i1);
+ list.push_back(i2);
+ }
+ Item_cond(THD *thd, Item_cond &item);
~Item_cond() { list.delete_elements(); }
bool add(Item *item) { return list.push_back(item); }
bool fix_fields(THD *, struct st_table_list *, Item **ref);
@@ -801,6 +811,7 @@ public:
void split_sum_func(Item **ref_pointer_array, List<Item> &fields);
friend int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds);
void top_level_item() { abort_on_null=1; }
+ void copy_andor_arguments(THD *thd, Item_cond *item);
bool walk(Item_processor processor, byte *arg);
};
@@ -811,9 +822,17 @@ class Item_cond_and :public Item_cond
public:
Item_cond_and() :Item_cond() {}
Item_cond_and(Item *i1,Item *i2) :Item_cond(i1,i2) {}
+ Item_cond_and(THD *thd, Item_cond_and &item) :Item_cond(thd, item) {}
enum Functype functype() const { return COND_AND_FUNC; }
longlong val_int();
const char *func_name() const { return "and"; }
+ Item* copy_andor_structure(THD *thd)
+ {
+ Item_cond_and *item;
+ if((item= new Item_cond_and(thd, *this)))
+ item->copy_andor_arguments(thd, this);
+ return item;
+ }
};
class Item_cond_or :public Item_cond
@@ -821,10 +840,18 @@ class Item_cond_or :public Item_cond
public:
Item_cond_or() :Item_cond() {}
Item_cond_or(Item *i1,Item *i2) :Item_cond(i1,i2) {}
+ Item_cond_or(THD *thd, Item_cond_or &item) :Item_cond(thd, item) {}
enum Functype functype() const { return COND_OR_FUNC; }
longlong val_int();
const char *func_name() const { return "or"; }
table_map not_null_tables() const { return and_tables_cache; }
+ Item* copy_andor_structure(THD *thd)
+ {
+ Item_cond_or *item;
+ if((item= new Item_cond_or(thd, *this)))
+ item->copy_andor_arguments(thd, this);
+ return item;
+ }
};
diff --git a/sql/item_create.cc b/sql/item_create.cc
index e3e3c021a1e..b1173b9c7b8 100644
--- a/sql/item_create.cc
+++ b/sql/item_create.cc
@@ -52,13 +52,6 @@ Item *create_func_ord(Item* a)
return new Item_func_ord(a);
}
-Item *create_func_old_password(Item* a)
-{
- return new Item_func_old_password(a);
-}
-
-
-
Item *create_func_asin(Item* a)
{
return new Item_func_asin(a);
@@ -107,14 +100,6 @@ Item *create_func_cot(Item* a)
new Item_func_tan(a));
}
-
-#ifdef HAVE_COMPRESS
-Item *create_func_crc32(Item* a)
-{
- return new Item_func_crc32(a);
-}
-#endif
-
Item *create_func_date_format(Item* a,Item *b)
{
return new Item_func_date_format(a,b,0);
@@ -332,11 +317,6 @@ Item *create_func_quarter(Item* a)
return new Item_func_quarter(a);
}
-Item *create_func_password(Item* a)
-{
- return new Item_func_password(a);
-}
-
Item *create_func_radians(Item *a)
{
return new Item_func_units((char*) "radians",a,M_PI/180,0.0);
@@ -666,13 +646,10 @@ Item *create_func_point(Item *a, Item *b)
return new Item_func_point(a, b);
}
-#if !defined(HAVE_COMPRESS)
-
-Item *create_func_compress (Item*a __attribute__((unused))){return 0;}
-Item *create_func_uncompress (Item*a __attribute__((unused))){return 0;}
-Item *create_func_uncompressed_length(Item*a __attribute__((unused))){return 0;}
-
-#else
+Item *create_func_crc32(Item* a)
+{
+ return new Item_func_crc32(a);
+}
Item *create_func_compress(Item* a)
{
@@ -689,8 +666,6 @@ Item *create_func_uncompressed_length(Item* a)
return new Item_func_uncompressed_length(a);
}
-#endif
-
Item *create_func_datediff(Item *a, Item *b)
{
return new Item_func_minus(new Item_func_to_days(a),
diff --git a/sql/item_create.h b/sql/item_create.h
index 16c4fccf709..c75f4404bad 100644
--- a/sql/item_create.h
+++ b/sql/item_create.h
@@ -33,9 +33,7 @@ Item *create_func_connection_id(void);
Item *create_func_conv(Item* a, Item *b, Item *c);
Item *create_func_cos(Item* a);
Item *create_func_cot(Item* a);
-#ifdef HAVE_COMPRESS
Item *create_func_crc32(Item* a);
-#endif
Item *create_func_date_format(Item* a,Item *b);
Item *create_func_dayname(Item* a);
Item *create_func_dayofmonth(Item* a);
@@ -69,14 +67,12 @@ Item *create_func_monthname(Item* a);
Item *create_func_nullif(Item* a, Item *b);
Item *create_func_oct(Item *);
Item *create_func_ord(Item* a);
-Item *create_func_old_password(Item* a);
Item *create_func_period_add(Item* a, Item *b);
Item *create_func_period_diff(Item* a, Item *b);
Item *create_func_pi(void);
Item *create_func_pow(Item* a, Item *b);
Item *create_func_current_user(void);
Item *create_func_quarter(Item* a);
-Item *create_func_password(Item* a);
Item *create_func_radians(Item *a);
Item *create_func_release_lock(Item* a);
Item *create_func_repeat(Item* a, Item *b);
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 4bda8ae78cd..b7979e7909c 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -27,22 +27,18 @@
#include <hash.h>
#include <time.h>
#include <ft_global.h>
-#ifdef HAVE_COMPRESS
-#include <zlib.h>
-#endif
static void my_coll_agg_error(DTCollation &c1, DTCollation &c2,
const char *fname)
{
my_error(ER_CANT_AGGREGATE_2COLLATIONS,MYF(0),
- c1.collation->name,c1.derivation_name(),
+ c1.collation->name,c1.derivation_name(),
c2.collation->name,c2.derivation_name(),
fname);
}
-
-static void my_coll_agg_error(DTCollation &c1,
+static void my_coll_agg_error(DTCollation &c1,
DTCollation &c2,
DTCollation &c3,
const char *fname)
@@ -134,6 +130,27 @@ Item_func::Item_func(List<Item> &list)
set_arguments(list);
}
+Item_func::Item_func(THD *thd, Item_func &item)
+ :Item_result_field(thd, item),
+ allowed_arg_cols(item.allowed_arg_cols),
+ arg_count(item.arg_count),
+ used_tables_cache(item.used_tables_cache),
+ not_null_tables_cache(item.not_null_tables_cache),
+ const_item_cache(item.const_item_cache)
+{
+ if (arg_count)
+ {
+ if (arg_count <=2)
+ args= tmp_arg;
+ else
+ {
+ if (!(args=(Item**) thd->alloc(sizeof(Item*)*arg_count)))
+ return;
+ }
+ memcpy((char*) args, (char*) item.args, sizeof(Item*)*arg_count);
+ }
+}
+
/*
Resolve references to table column for a function and it's argument
@@ -173,13 +190,15 @@ bool
Item_func::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
{
Item **arg,**arg_end;
+#ifndef EMBEDDED_LIBRARY // Avoid compiler warning
char buff[STACK_BUFF_ALLOC]; // Max argument in function
+#endif
used_tables_cache= not_null_tables_cache= 0;
const_item_cache=1;
if (thd && check_stack_overrun(thd,buff))
- return 0; // Fatal error if flag is set!
+ return 1; // Fatal error if flag is set!
if (arg_count)
{ // Print purify happy
for (arg=args, arg_end=args+arg_count; arg != arg_end ; arg++)
@@ -1085,36 +1104,6 @@ longlong Item_func_min_max::val_int()
return value;
}
-
-#ifdef HAVE_COMPRESS
-longlong Item_func_crc32::val_int()
-{
- String *res=args[0]->val_str(&value);
- if (!res)
- {
- null_value=1;
- return 0; /* purecov: inspected */
- }
- null_value=0;
- return (longlong) crc32(0L, (Bytef*)res->ptr(), res->length());
-}
-
-
-longlong Item_func_uncompressed_length::val_int()
-{
- String *res= args[0]->val_str(&value);
- if (!res)
- {
- null_value=1;
- return 0; /* purecov: inspected */
- }
- null_value=0;
- if (res->is_empty()) return 0;
- return uint4korr(res->c_ptr()) & 0x3FFFFFFF;
-}
-#endif /* HAVE_COMPRESS */
-
-
longlong Item_func_length::val_int()
{
String *res=args[0]->val_str(&value);
@@ -1164,7 +1153,6 @@ longlong Item_func_locate::val_int()
{
String *a=args[0]->val_str(&value1);
String *b=args[1]->val_str(&value2);
- bool binary_cmp= (cmp_collation.collation->state & MY_CS_BINSORT) ? 1 : 0;
if (!a || !b)
{
null_value=1;
@@ -1172,55 +1160,27 @@ longlong Item_func_locate::val_int()
}
null_value=0;
uint start=0;
-#ifdef USE_MB
uint start0=0;
-#endif
+ my_match_t match;
+
if (arg_count == 3)
{
- start=(uint) args[2]->val_int()-1;
-#ifdef USE_MB
- if (use_mb(cmp_collation.collation))
- {
- start0=start;
- if (!binary_cmp)
- start=a->charpos(start);
- }
-#endif
+ start0= start =(uint) args[2]->val_int()-1;
+ start=a->charpos(start);
+
if (start > a->length() || start+b->length() > a->length())
return 0;
}
+
if (!b->length()) // Found empty string at start
return (longlong) (start+1);
-#ifdef USE_MB
- if (use_mb(cmp_collation.collation) && !binary_cmp)
- {
- const char *ptr=a->ptr()+start;
- const char *search=b->ptr();
- const char *strend = ptr+a->length();
- const char *end=strend-b->length()+1;
- const char *search_end=search+b->length();
- register uint32 l;
- while (ptr < end)
- {
- if (*ptr == *search)
- {
- register char *i,*j;
- i=(char*) ptr+1; j=(char*) search+1;
- while (j != search_end)
- if (*i++ != *j++) goto skipp;
- return (longlong) start0+1;
- }
- skipp:
- if ((l=my_ismbchar(cmp_collation.collation,ptr,strend)))
- ptr+=l;
- else ++ptr;
- ++start0;
- }
+
+ if (!cmp_collation.collation->coll->instr(cmp_collation.collation,
+ a->ptr()+start, a->length()-start,
+ b->ptr(), b->length(),
+ &match, 1))
return 0;
- }
-#endif /* USE_MB */
- return (longlong) (binary_cmp ? a->strstr(*b,start) :
- (a->strstr_case(*b,start)))+1;
+ return (longlong) match.mblen + start0 + 1;
}
@@ -1431,13 +1391,15 @@ bool
udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func,
uint arg_count, Item **arguments)
{
+#ifndef EMBEDDED_LIBRARY // Avoid compiler warning
char buff[STACK_BUFF_ALLOC]; // Max argument in function
+#endif
DBUG_ENTER("Item_udf_func::fix_fields");
if (thd)
{
if (check_stack_overrun(thd,buff))
- return 0; // Fatal error flag is set!
+ DBUG_RETURN(1); // Fatal error flag is set!
}
else
thd=current_thd; // In WHERE / const clause
@@ -1751,7 +1713,7 @@ public:
pthread_cond_init(&cond,NULL);
if (key)
{
- if (hash_insert(&hash_user_locks,(byte*) this))
+ if (my_hash_insert(&hash_user_locks,(byte*) this))
{
my_free((gptr) key,MYF(0));
key=0;
@@ -2112,7 +2074,7 @@ static user_var_entry *get_variable(HASH *hash, LEX_STRING &name,
entry->used_query_id=current_thd->query_id;
entry->type=STRING_RESULT;
memcpy(entry->name.str, name.str, name.length+1);
- if (hash_insert(hash,(byte*) entry))
+ if (my_hash_insert(hash,(byte*) entry))
{
my_free((char*) entry,MYF(0));
return 0;
diff --git a/sql/item_func.h b/sql/item_func.h
index 7fedbcf48ee..86cf19d92f3 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -104,6 +104,8 @@ public:
}
}
Item_func(List<Item> &list);
+ // Constructor used for Item_cond_and/or (see Item comment)
+ Item_func(THD *thd, Item_func &item);
~Item_func() {} /* Nothing to do; Items are freed automaticly */
bool fix_fields(THD *,struct st_table_list *, Item **ref);
table_map used_tables() const;
@@ -196,6 +198,7 @@ public:
Item_int_func(Item *a,Item *b) :Item_func(a,b) { max_length=21; }
Item_int_func(Item *a,Item *b,Item *c) :Item_func(a,b,c) { max_length=21; }
Item_int_func(List<Item> &list) :Item_func(list) { max_length=21; }
+ Item_int_func(THD *thd, Item_int_func &item) :Item_func(thd, item) {}
double val() { return (double) val_int(); }
String *val_str(String*str);
enum Item_result result_type () const { return INT_RESULT; }
@@ -538,6 +541,7 @@ public:
String *val_str(String *);
void fix_length_and_dec();
enum Item_result result_type () const { return cmp_type; }
+ table_map not_null_tables() const { return 0; }
};
class Item_func_min :public Item_func_min_max
@@ -555,27 +559,6 @@ public:
};
-#ifdef HAVE_COMPRESS
-class Item_func_crc32 :public Item_int_func
-{
- String value;
-public:
- Item_func_crc32(Item *a) :Item_int_func(a) {}
- longlong val_int();
- const char *func_name() const { return "crc32"; }
- void fix_length_and_dec() { max_length=10; }
-};
-class Item_func_uncompressed_length : public Item_int_func
-{
- String value;
-public:
- Item_func_uncompressed_length(Item *a):Item_int_func(a){}
- longlong val_int();
- const char *func_name() const{return "uncompressed_length";}
- void fix_length_and_dec() { max_length=10; }
-};
-#endif
-
class Item_func_length :public Item_int_func
{
String value;
diff --git a/sql/item_geofunc.h b/sql/item_geofunc.h
index d86914eb6c5..79e45cca26f 100644
--- a/sql/item_geofunc.h
+++ b/sql/item_geofunc.h
@@ -167,30 +167,6 @@ public:
const char *func_name() const { return "multipoint"; }
};
-#ifdef HAVE_COMPRESS
-
-class Item_func_compress: public Item_str_func
-{
- String buffer;
-public:
- Item_func_compress(Item *a):Item_str_func(a){}
- String *val_str(String *);
- void fix_length_and_dec(){max_length= (args[0]->max_length*120)/100+12;}
- const char *func_name() const{return "compress";}
-};
-
-class Item_func_uncompress: public Item_str_func
-{
- String buffer;
-public:
- Item_func_uncompress(Item *a): Item_str_func(a){}
- String *val_str(String *);
- void fix_length_and_dec(){max_length= MAX_BLOB_WIDTH;}
- const char *func_name() const{return "uncompress";}
-};
-
-#endif
-
/*
Spatial relations
*/
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index b0b9cc01bf1..86efde096c5 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -33,8 +33,9 @@
#include "md5.h"
#include "sha1.h"
#include "my_aes.h"
+#include "../mysys/my_static.h" // For soundex_map
-String empty_string("",default_charset_info);
+String my_empty_string("",default_charset_info);
static void my_coll_agg_error(DTCollation &c1, DTCollation &c2, const char *fname)
{
@@ -359,7 +360,7 @@ String *Item_func_des_encrypt::val_str(String *str)
if ((null_value=args[0]->null_value))
return 0;
if ((res_length=res->length()) == 0)
- return &empty_string;
+ return &my_empty_string;
if (arg_count == 1)
{
@@ -520,7 +521,7 @@ String *Item_func_concat_ws::val_str(String *str)
if ((res= args[i]->val_str(str)))
break;
if (i == arg_count)
- return &empty_string;
+ return &my_empty_string;
for (i++; i < arg_count ; i++)
{
@@ -661,7 +662,7 @@ String *Item_func_reverse::val_str(String *str)
return 0;
/* An empty string is a special case as the string pointer may be null */
if (!res->length())
- return &empty_string;
+ return &my_empty_string;
res=copy_if_not_alloced(str,res,res->length());
ptr = (char *) res->ptr();
end=ptr+res->length();
@@ -914,7 +915,7 @@ String *Item_func_left::val_str(String *str)
if ((null_value=args[0]->null_value))
return 0;
if (length <= 0)
- return &empty_string;
+ return &my_empty_string;
length= res->charpos(length);
if (res->length() > (ulong) length)
{ // Safe even if const arg
@@ -958,7 +959,7 @@ String *Item_func_right::val_str(String *str)
if ((null_value=args[0]->null_value))
return 0; /* purecov: inspected */
if (length <= 0)
- return &empty_string; /* purecov: inspected */
+ return &my_empty_string; /* purecov: inspected */
if (res->length() <= (uint) length)
return res; /* purecov: inspected */
@@ -991,7 +992,7 @@ String *Item_func_substr::val_str(String *str)
start=res->charpos(start);
length=res->charpos(length,start);
if (start < 0 || (uint) start+1 > res->length() || length <= 0)
- return &empty_string;
+ return &my_empty_string;
tmp_length=(int32) res->length()-start;
length=min(length,tmp_length);
@@ -1051,7 +1052,7 @@ String *Item_func_substr_index::val_str(String *str)
null_value=0;
uint delimeter_length=delimeter->length();
if (!res->length() || !delimeter_length || !count)
- return &empty_string; // Wrong parameters
+ return &my_empty_string; // Wrong parameters
res->set_charset(collation.collation);
@@ -1327,95 +1328,49 @@ void Item_func_trim::fix_length_and_dec()
}
-
-
-void Item_func_password::fix_length_and_dec()
-{
- /*
- If PASSWORD() was called with only one argument, it depends on a random
- number so we need to save this random number into the binary log.
- If called with two arguments, it is repeatable.
- */
- if (arg_count == 1)
- {
- THD *thd= current_thd;
- thd->rand_used= 1;
- thd->rand_saved_seed1= thd->rand.seed1;
- thd->rand_saved_seed2= thd->rand.seed2;
- }
- max_length= get_password_length(use_old_passwords);
-}
-
-/*
- Password() function has 2 arguments. Second argument can be used
- to make results repeatable
-*/
+/* Item_func_password */
String *Item_func_password::val_str(String *str)
{
- struct rand_struct rand_st; // local structure for 2 param version
- ulong seed=0; // seed to initialise random generator to
-
- String *res =args[0]->val_str(str);
+ String *res= args[0]->val_str(str);
if ((null_value=args[0]->null_value))
return 0;
-
- if (arg_count == 1)
- {
- if (res->length() == 0)
- return &empty_string;
- make_scrambled_password(tmp_value,res->c_ptr(),use_old_passwords,
- &current_thd->rand);
- str->set(tmp_value,get_password_length(use_old_passwords),res->charset());
- return str;
- }
- else
- {
- /* We'll need the buffer to get second parameter */
- char key_buff[80];
- String tmp_key_value(key_buff, sizeof(key_buff), system_charset_info);
- String *key =args[1]->val_str(&tmp_key_value);
-
- /* Check second argument for NULL value. First one is already checked */
- if ((null_value=args[1]->null_value))
- return 0;
-
- /* This shall be done after checking for null for proper results */
- if (res->length() == 0)
- return &empty_string;
-
- /* Generate the seed first this allows to avoid double allocation */
- char* seed_ptr=key->c_ptr();
- while (*seed_ptr)
- {
- seed=(seed*211+*seed_ptr) & 0xffffffffL; /* Use simple hashing */
- seed_ptr++;
- }
-
- /* Use constants which allow nice random values even with small seed */
- randominit(&rand_st,
- (ulong) ((ulonglong) seed*111111+33333333L) & (ulong) 0xffffffff,
- (ulong) ((ulonglong) seed*1111+55555555L) & (ulong) 0xffffffff);
-
- make_scrambled_password(tmp_value,res->c_ptr(),use_old_passwords,
- &rand_st);
- str->set(tmp_value,get_password_length(use_old_passwords),res->charset());
- return str;
- }
+ if (res->length() == 0)
+ return &my_empty_string;
+ make_scrambled_password(tmp_value, res->c_ptr());
+ str->set(tmp_value, SCRAMBLED_PASSWORD_CHAR_LENGTH, res->charset());
+ return str;
+}
+
+char *Item_func_password::alloc(THD *thd, const char *password)
+{
+ char *buff= (char *) thd->alloc(SCRAMBLED_PASSWORD_CHAR_LENGTH+1);
+ if (buff)
+ make_scrambled_password(buff, password);
+ return buff;
}
+/* Item_func_old_password */
+
String *Item_func_old_password::val_str(String *str)
{
- String *res =args[0]->val_str(str);
+ String *res= args[0]->val_str(str);
if ((null_value=args[0]->null_value))
return 0;
if (res->length() == 0)
- return &empty_string;
- make_scrambled_password(tmp_value,res->c_ptr(),1,&current_thd->rand);
- str->set(tmp_value,16,res->charset());
+ return &my_empty_string;
+ make_scrambled_password_323(tmp_value, res->c_ptr());
+ str->set(tmp_value, SCRAMBLED_PASSWORD_CHAR_LENGTH_323, res->charset());
return str;
}
+char *Item_func_old_password::alloc(THD *thd, const char *password)
+{
+ char *buff= (char *) thd->alloc(SCRAMBLED_PASSWORD_CHAR_LENGTH_323+1);
+ if (buff)
+ make_scrambled_password_323(buff, password);
+ return buff;
+}
#define bin_to_ascii(c) ((c)>=38?((c)-38+'a'):(c)>=12?((c)-12+'A'):(c)+'.')
@@ -1429,7 +1384,7 @@ String *Item_func_encrypt::val_str(String *str)
if ((null_value=args[0]->null_value))
return 0;
if (res->length() == 0)
- return &empty_string;
+ return &my_empty_string;
if (arg_count == 1)
{ // generate random salt
@@ -1500,8 +1455,8 @@ String *Item_func_database::val_str(String *str)
THD *thd= current_thd;
if (!thd->db)
{
- str->length(0);
- str->set_charset(system_charset_info);
+ null_value= 1;
+ return 0;
}
else
str->copy((const char*) thd->db,(uint) strlen(thd->db),system_charset_info);
@@ -1519,7 +1474,7 @@ String *Item_func_user::val_str(String *str)
// For system threads (e.g. replication SQL thread) user may be empty
if (!thd->user)
- return &empty_string;
+ return &my_empty_string;
res_length= (strlen(thd->user)+strlen(host)+2) * cs->mbmaxlen;
if (str->alloc(res_length))
@@ -1542,15 +1497,11 @@ void Item_func_soundex::fix_length_and_dec()
}
- /*
- If alpha, map input letter to soundex code.
- If not alpha and remove_garbage is set then skip to next char
- else return 0
- */
-
-extern "C" {
-extern const char *soundex_map; // In mysys/static.c
-}
+/*
+ If alpha, map input letter to soundex code.
+ If not alpha and remove_garbage is set then skip to next char
+ else return 0
+*/
static char get_scode(CHARSET_INFO *cs,char *ptr)
{
@@ -1582,7 +1533,7 @@ String *Item_func_soundex::val_str(String *str)
while (from != end && my_isspace(cs,*from)) // Skip pre-space
from++; /* purecov: inspected */
if (from == end)
- return &empty_string; // No alpha characters.
+ return &my_empty_string; // No alpha characters.
*to++ = my_toupper(cs,*from); // Copy first letter
last_ch = get_scode(cs,from); // code of the first letter
// for the first 'double-letter check.
@@ -1764,7 +1715,7 @@ String *Item_func_make_set::val_str(String *str)
ulonglong bits;
bool first_found=0;
Item **ptr=args;
- String *result=&empty_string;
+ String *result=&my_empty_string;
bits=item->val_int();
if ((null_value=item->null_value))
@@ -1788,7 +1739,7 @@ String *Item_func_make_set::val_str(String *str)
else
{
if (tmp_str.copy(*res)) // Don't use 'str'
- return &empty_string;
+ return &my_empty_string;
result= &tmp_str;
}
}
@@ -1798,11 +1749,11 @@ String *Item_func_make_set::val_str(String *str)
{ // Copy data to tmp_str
if (tmp_str.alloc(result->length()+res->length()+1) ||
tmp_str.copy(*result))
- return &empty_string;
+ return &my_empty_string;
result= &tmp_str;
}
if (tmp_str.append(',') || tmp_str.append(*res))
- return &empty_string;
+ return &my_empty_string;
}
}
}
@@ -1899,7 +1850,7 @@ String *Item_func_repeat::val_str(String *str)
goto err; // string and/or delim are null
null_value=0;
if (count <= 0) // For nicer SQL code
- return &empty_string;
+ return &my_empty_string;
if (count == 1) // To avoid reallocs
return res;
length=res->length();
@@ -1934,7 +1885,7 @@ void Item_func_rpad::fix_length_and_dec()
if (args[1]->const_item())
{
- uint32 length= (uint32) args[1]->val_int();
+ uint32 length= (uint32) args[1]->val_int() * collation.collation->mbmaxlen;
max_length=max(args[0]->max_length,length);
if (max_length >= MAX_BLOB_WIDTH)
{
@@ -1952,36 +1903,46 @@ void Item_func_rpad::fix_length_and_dec()
String *Item_func_rpad::val_str(String *str)
{
- uint32 res_length,length_pad;
+ uint32 res_byte_length,res_char_length,pad_char_length,pad_byte_length;
char *to;
const char *ptr_pad;
int32 count= (int32) args[1]->val_int();
+ int32 byte_count= count * collation.collation->mbmaxlen;
String *res =args[0]->val_str(str);
String *rpad = args[2]->val_str(str);
if (!res || args[1]->null_value || !rpad || count < 0)
goto err;
null_value=0;
- if (count <= (int32) (res_length=res->length()))
+ if (count <= (int32) (res_char_length=res->numchars()))
{ // String to pad is big enough
- res->length(count); // Shorten result if longer
+ res->length(res->charpos(count)); // Shorten result if longer
return (res);
}
- length_pad= rpad->length();
- if ((ulong) count > current_thd->variables.max_allowed_packet ||
- args[2]->null_value || !length_pad)
+ pad_char_length= rpad->numchars();
+ if ((ulong) byte_count > current_thd->variables.max_allowed_packet ||
+ args[2]->null_value || !pad_char_length)
goto err;
- if (!(res= alloc_buffer(res,str,&tmp_value,count)))
+ res_byte_length= res->length(); /* Must be done before alloc_buffer */
+ if (!(res= alloc_buffer(res,str,&tmp_value,byte_count)))
goto err;
- to= (char*) res->ptr()+res_length;
+ to= (char*) res->ptr()+res_byte_length;
ptr_pad=rpad->ptr();
- for (count-= res_length; (uint32) count > length_pad; count-= length_pad)
+ pad_byte_length= rpad->length();
+ count-= res_char_length;
+ for ( ; (uint32) count > pad_char_length; count-= pad_char_length)
{
- memcpy(to,ptr_pad,length_pad);
- to+= length_pad;
+ memcpy(to,ptr_pad,pad_byte_length);
+ to+= pad_byte_length;
}
- memcpy(to,ptr_pad,(size_t) count);
+ if (count)
+ {
+ pad_byte_length= rpad->charpos(count);
+ memcpy(to,ptr_pad,(size_t) pad_byte_length);
+ to+= pad_byte_length;
+ }
+ res->length(to- (char*) res->ptr());
return (res);
err:
@@ -2000,7 +1961,7 @@ void Item_func_lpad::fix_length_and_dec()
if (args[1]->const_item())
{
- uint32 length= (uint32) args[1]->val_int();
+ uint32 length= (uint32) args[1]->val_int() * collation.collation->mbmaxlen;
max_length=max(args[0]->max_length,length);
if (max_length >= MAX_BLOB_WIDTH)
{
@@ -2018,57 +1979,52 @@ void Item_func_lpad::fix_length_and_dec()
String *Item_func_lpad::val_str(String *str)
{
- uint32 res_length,length_pad;
- char *to;
- const char *ptr_pad;
- ulong count= (long) args[1]->val_int();
- String *res= args[0]->val_str(str);
- String *lpad= args[2]->val_str(str);
+ uint32 res_byte_length,res_char_length,pad_byte_length,pad_char_length;
+ ulong count= (long) args[1]->val_int(), byte_count;
+ String a1,a3;
+ String *res= args[0]->val_str(&a1);
+ String *pad= args[2]->val_str(&a3);
- if (!res || args[1]->null_value || !lpad)
+ if (!res || args[1]->null_value || !pad)
goto err;
+
null_value=0;
- if (count <= (res_length=res->length()))
- { // String to pad is big enough
- res->length(count); // Shorten result if longer
- return (res);
+ res_byte_length= res->length();
+ res_char_length= res->numchars();
+
+ if (count <= res_char_length)
+ {
+ res->length(res->charpos(count));
+ return res;
}
- length_pad= lpad->length();
- if (count > current_thd->variables.max_allowed_packet ||
- args[2]->null_value || !length_pad)
+
+ pad_byte_length= pad->length();
+ pad_char_length= pad->numchars();
+ byte_count= count * collation.collation->mbmaxlen;
+
+ if (byte_count > current_thd->variables.max_allowed_packet ||
+ args[2]->null_value || !pad_char_length || str->alloc(byte_count))
goto err;
-
- if (res->alloced_length() < count)
+
+ str->length(0);
+ str->set_charset(collation.collation);
+ count-= res_char_length;
+ while (count >= pad_char_length)
{
- if (str->alloced_length() >= count)
- {
- memcpy((char*) str->ptr()+(count-res_length),res->ptr(),res_length);
- res=str;
- }
- else
- {
- if (tmp_value.alloc(count))
- goto err;
- memcpy((char*) tmp_value.ptr()+(count-res_length),res->ptr(),res_length);
- res=&tmp_value;
- }
+ str->append(*pad);
+ count-= pad_char_length;
}
- else
- bmove_upp((char*) res->ptr()+count,res->ptr()+res_length,res_length);
- res->length(count);
-
- to= (char*) res->ptr();
- ptr_pad= lpad->ptr();
- for (count-= res_length; count > length_pad; count-= length_pad)
+ if (count > 0)
{
- memcpy(to,ptr_pad,length_pad);
- to+= length_pad;
+ pad->length(pad->charpos(count));
+ str->append(*pad);
}
- memcpy(to,ptr_pad,(size_t) count);
- return (res);
+ str->append(*res);
+ null_value= 0;
+ return str;
- err:
- null_value=1;
+err:
+ null_value= 1;
return 0;
}
@@ -2096,7 +2052,7 @@ String *Item_func_conv::val_str(String *str)
dec= (longlong) my_strntoull(res->charset(),res->ptr(),res->length(),from_base,&endptr,&err);
ptr= longlong2str(dec,ans,to_base);
if (str->copy(ans,(uint32) (ptr-ans), default_charset()))
- return &empty_string;
+ return &my_empty_string;
return str;
}
@@ -2286,7 +2242,7 @@ String *Item_func_hex::val_str(String *str)
return 0;
ptr= longlong2str(dec,ans,16);
if (str->copy(ans,(uint32) (ptr-ans),default_charset()))
- return &empty_string; // End of memory
+ return &my_empty_string; // End of memory
return str;
}
@@ -2323,7 +2279,9 @@ String *Item_load_file::val_str(String *str)
DBUG_ENTER("load_file");
if (!(file_name= args[0]->val_str(str)) ||
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
!(current_thd->master_access & FILE_ACL) ||
+#endif
!my_stat(file_name->c_ptr(), &stat_info, MYF(MY_WME)))
goto err;
if (!(stat_info.st_mode & S_IROTH))
@@ -2554,12 +2512,42 @@ null:
return 0;
}
+longlong Item_func_uncompressed_length::val_int()
+{
+ String *res= args[0]->val_str(&value);
+ if (!res)
+ {
+ null_value=1;
+ return 0; /* purecov: inspected */
+ }
+ null_value=0;
+ if (res->is_empty()) return 0;
+ return uint4korr(res->c_ptr()) & 0x3FFFFFFF;
+}
+
+longlong Item_func_crc32::val_int()
+{
+ String *res=args[0]->val_str(&value);
+ if (!res)
+ {
+ null_value=1;
+ return 0; /* purecov: inspected */
+ }
+ null_value=0;
+ return (longlong) crc32(0L, (uchar*)res->ptr(), res->length());
+}
+
#ifdef HAVE_COMPRESS
#include "zlib.h"
String *Item_func_compress::val_str(String *str)
{
String *res= args[0]->val_str(str);
+ if (!res)
+ {
+ null_value= 1;
+ return 0;
+ }
if (res->is_empty()) return res;
int err= Z_OK;
@@ -2581,7 +2569,7 @@ String *Item_func_compress::val_str(String *str)
buffer.realloc((uint32)new_size + 4 + 1);
Byte *body= ((Byte*)buffer.c_ptr()) + 4;
-
+
if ((err= compress(body, &new_size,
(const Bytef*)res->c_ptr(), res->length())) != Z_OK)
{
@@ -2603,19 +2591,24 @@ String *Item_func_compress::val_str(String *str)
}
buffer.length((uint32)new_size + 4);
-
+
return &buffer;
}
String *Item_func_uncompress::val_str(String *str)
{
String *res= args[0]->val_str(str);
+ if (!res)
+ {
+ null_value= 1;
+ return 0;
+ }
if (res->is_empty()) return res;
ulong new_size= uint4korr(res->c_ptr()) & 0x3FFFFFFF;
int err= Z_OK;
uint code;
-
+
if (new_size > MAX_BLOB_WIDTH)
{
push_warning_printf(current_thd,MYSQL_ERROR::WARN_LEVEL_ERROR,
@@ -2624,21 +2617,20 @@ String *Item_func_uncompress::val_str(String *str)
null_value= 0;
return 0;
}
-
+
buffer.realloc((uint32)new_size);
-
- if ((err= uncompress((Byte*)buffer.c_ptr(), &new_size,
+
+ if ((err= uncompress((Byte*)buffer.c_ptr(), &new_size,
((const Bytef*)res->c_ptr())+4,res->length())) == Z_OK)
{
buffer.length((uint32)new_size);
return &buffer;
}
-
- code= err==Z_BUF_ERROR ? ER_ZLIB_Z_BUF_ERROR :
+
+ code= err==Z_BUF_ERROR ? ER_ZLIB_Z_BUF_ERROR :
err==Z_MEM_ERROR ? ER_ZLIB_Z_MEM_ERROR : ER_ZLIB_Z_DATA_ERROR;
push_warning(current_thd,MYSQL_ERROR::WARN_LEVEL_ERROR,code,ER(code));
null_value= 1;
return 0;
}
-
#endif
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index f64a145b136..b82dacb4fe0 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -254,30 +254,45 @@ public:
};
+/*
+ Item_func_password -- new (4.1.1) PASSWORD() function implementation.
+ Returns strcat('*', octet2hex(sha1(sha1(password)))). '*' stands for new
+ password format, sha1(sha1(password) is so-called hash_stage2 value.
+ Length of returned string is always 41 byte. To find out how entire
+ authentification procedure works, see comments in password.c.
+*/
+
class Item_func_password :public Item_str_func
{
- char tmp_value[64]; /* This should be enough for new password format */
+ char tmp_value[SCRAMBLED_PASSWORD_CHAR_LENGTH+1];
public:
Item_func_password(Item *a) :Item_str_func(a) {}
- Item_func_password(Item *a, Item *b) :Item_str_func(a,b) {}
- String *val_str(String *);
- void fix_length_and_dec();
+ String *val_str(String *str);
+ void fix_length_and_dec() { max_length= SCRAMBLED_PASSWORD_CHAR_LENGTH; }
const char *func_name() const { return "password"; }
+ static char *alloc(THD *thd, const char *password);
};
+/*
+ Item_func_old_password -- PASSWORD() implementation used in MySQL 3.21 - 4.0
+ compatibility mode. This item is created in sql_yacc.yy when
+ 'old_passwords' session variable is set, and to handle OLD_PASSWORD()
+ function.
+*/
+
class Item_func_old_password :public Item_str_func
{
- char tmp_value[17]; /* old password length +1 */
+ char tmp_value[SCRAMBLED_PASSWORD_CHAR_LENGTH_323+1];
public:
Item_func_old_password(Item *a) :Item_str_func(a) {}
- String *val_str(String *);
- void fix_length_and_dec() { max_length = get_password_length(1); }
+ String *val_str(String *str);
+ void fix_length_and_dec() { max_length= SCRAMBLED_PASSWORD_CHAR_LENGTH_323; }
const char *func_name() const { return "old_password"; }
+ static char *alloc(THD *thd, const char *password);
};
-
class Item_func_des_encrypt :public Item_str_func
{
String tmp_value;
@@ -624,9 +639,56 @@ public:
Item_func_collation(Item *a) :Item_str_func(a) {}
String *val_str(String *);
const char *func_name() const { return "collation"; }
- void fix_length_and_dec()
+ void fix_length_and_dec()
{
max_length=40; // should be enough
collation.set(system_charset_info);
};
};
+
+class Item_func_crc32 :public Item_int_func
+{
+ String value;
+public:
+ Item_func_crc32(Item *a) :Item_int_func(a) {}
+ const char *func_name() const { return "crc32"; }
+ void fix_length_and_dec() { max_length=10; }
+ longlong val_int();
+};
+
+class Item_func_uncompressed_length : public Item_int_func
+{
+ String value;
+public:
+ Item_func_uncompressed_length(Item *a):Item_int_func(a){}
+ const char *func_name() const{return "uncompressed_length";}
+ void fix_length_and_dec() { max_length=10; }
+ longlong val_int();
+};
+
+#ifdef HAVE_COMPRESS
+#define ZLIB_DEPENDED_FUNCTION ;
+#else
+#define ZLIB_DEPENDED_FUNCTION { null_value=1; return 0; }
+#endif
+
+class Item_func_compress: public Item_str_func
+{
+ String buffer;
+public:
+ Item_func_compress(Item *a):Item_str_func(a){}
+ void fix_length_and_dec(){max_length= (args[0]->max_length*120)/100+12;}
+ const char *func_name() const{return "compress";}
+ String *val_str(String *) ZLIB_DEPENDED_FUNCTION
+};
+
+class Item_func_uncompress: public Item_str_func
+{
+ String buffer;
+public:
+ Item_func_uncompress(Item *a): Item_str_func(a){}
+ void fix_length_and_dec(){max_length= MAX_BLOB_WIDTH;}
+ const char *func_name() const{return "uncompress";}
+ String *val_str(String *) ZLIB_DEPENDED_FUNCTION
+};
+
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index cbda995504c..7c4fe8621a7 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -72,7 +72,7 @@ Item_subselect::trans_res
Item_subselect::select_transformer(JOIN *join)
{
DBUG_ENTER("Item_subselect::select_transformer");
- DBUG_RETURN(OK);
+ DBUG_RETURN(RES_OK);
}
@@ -214,14 +214,14 @@ Item_singlerow_subselect::select_transformer(JOIN *join)
cond= join->having;
else
if (!(cond= new Item_cond_and(join->conds, join->having)))
- return ERROR;
+ return RES_ERROR;
if (!(substitution= new Item_func_if(cond, substitution,
new Item_null())))
- return ERROR;
+ return RES_ERROR;
}
- return REDUCE;
+ return RES_REDUCE;
}
- return OK;
+ return RES_OK;
}
void Item_singlerow_subselect::store(uint i, Item *item)
@@ -508,7 +508,7 @@ Item_in_subselect::single_value_transformer(JOIN *join,
if (!optimizer || optimizer->fix_left(thd, up->get_table_list(), 0))
{
thd->lex.current_select= current;
- DBUG_RETURN(ERROR);
+ DBUG_RETURN(RES_ERROR);
}
thd->lex.current_select= current;
@@ -528,7 +528,7 @@ Item_in_subselect::single_value_transformer(JOIN *join,
if (select_lex->item_list.elements > 1)
{
my_error(ER_CARDINALITY_COL, MYF(0), 1);
- DBUG_RETURN(ERROR);
+ DBUG_RETURN(RES_ERROR);
}
item= (Item*) select_lex->item_list.head();
@@ -546,7 +546,7 @@ Item_in_subselect::single_value_transformer(JOIN *join,
if (join->having->fix_fields(thd, join->tables_list, &join->having))
{
select_lex->having_fix_field= 0;
- DBUG_RETURN(ERROR);
+ DBUG_RETURN(RES_ERROR);
}
select_lex->having_fix_field= 0;
}
@@ -570,15 +570,16 @@ Item_in_subselect::single_value_transformer(JOIN *join,
if (join->having->fix_fields(thd, join->tables_list, &join->having))
{
select_lex->having_fix_field= 0;
- DBUG_RETURN(ERROR);
+ DBUG_RETURN(RES_ERROR);
}
select_lex->having_fix_field= 0;
item= new Item_cond_or(item,
new Item_func_isnull(isnull));
}
+ item->name= (char *)in_additional_cond;
join->conds= and_items(join->conds, item);
if (join->conds->fix_fields(thd, join->tables_list, &join->conds))
- DBUG_RETURN(ERROR);
+ DBUG_RETURN(RES_ERROR);
}
else
{
@@ -592,7 +593,7 @@ Item_in_subselect::single_value_transformer(JOIN *join,
if (join->having->fix_fields(thd, join->tables_list, &join->having))
{
select_lex->having_fix_field= 0;
- DBUG_RETURN(ERROR);
+ DBUG_RETURN(RES_ERROR);
}
select_lex->having_fix_field= 0;
}
@@ -610,11 +611,11 @@ Item_in_subselect::single_value_transformer(JOIN *join,
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_SELECT_REDUCED, warn_buff);
}
- DBUG_RETURN(REDUCE);
+ DBUG_RETURN(RES_REDUCE);
}
}
}
- DBUG_RETURN(OK);
+ DBUG_RETURN(RES_OK);
}
Item_subselect::trans_res
@@ -640,7 +641,7 @@ Item_in_subselect::row_value_transformer(JOIN *join,
if (!optimizer || optimizer->fix_left(thd, up->get_table_list(), 0))
{
thd->lex.current_select= current;
- DBUG_RETURN(ERROR);
+ DBUG_RETURN(RES_ERROR);
}
thd->lex.current_select= current;
@@ -679,7 +680,7 @@ Item_in_subselect::row_value_transformer(JOIN *join,
if (join->having->fix_fields(thd, join->tables_list, &join->having))
{
select_lex->having_fix_field= 0;
- DBUG_RETURN(ERROR);
+ DBUG_RETURN(RES_ERROR);
}
select_lex->having_fix_field= 0;
}
@@ -687,9 +688,9 @@ Item_in_subselect::row_value_transformer(JOIN *join,
{
join->conds= and_items(join->conds, item);
if (join->conds->fix_fields(thd, join->tables_list, &join->having))
- DBUG_RETURN(ERROR);
+ DBUG_RETURN(RES_ERROR);
}
- DBUG_RETURN(OK);
+ DBUG_RETURN(RES_OK);
}
Item_subselect::trans_res
@@ -772,7 +773,7 @@ int subselect_union_engine::prepare()
return unit->prepare(thd, result, 0);
}
-int subselect_simplein_engine::prepare()
+int subselect_uniquesubquery_engine::prepare()
{
//this never should be called
DBUG_ASSERT(0);
@@ -846,7 +847,7 @@ void subselect_union_engine::fix_length_and_dec(Item_cache **row)
SELECT_LEX *sl= unit->first_select();
bool fake= 0;
res_type= set_row(sl, item, row, &fake);
- for (sl= sl->next_select(); sl; sl->next_select())
+ for (sl= sl->next_select(); sl; sl= sl->next_select())
{
List_iterator_fast<Item> li(sl->item_list);
Item *sel_item;
@@ -859,7 +860,7 @@ void subselect_union_engine::fix_length_and_dec(Item_cache **row)
}
}
-void subselect_simplein_engine::fix_length_and_dec(Item_cache **row)
+void subselect_uniquesubquery_engine::fix_length_and_dec(Item_cache **row)
{
//this never should be called
DBUG_ASSERT(0);
@@ -918,9 +919,9 @@ int subselect_union_engine::exec()
return res;
}
-int subselect_simplein_engine::exec()
+int subselect_uniquesubquery_engine::exec()
{
- DBUG_ENTER("subselect_simplein_engine::exec");
+ DBUG_ENTER("subselect_uniquesubquery_engine::exec");
int error;
TABLE *table= tab->table;
if ((tab->ref.key_err= (*tab->ref.key_copy)->copy()))
@@ -948,9 +949,9 @@ int subselect_simplein_engine::exec()
DBUG_RETURN(end_exec(table) || (error != 0));
}
-int subselect_simplein_engine::end_exec(TABLE *table)
+int subselect_uniquesubquery_engine::end_exec(TABLE *table)
{
- DBUG_ENTER("subselect_simplein_engine::end_exec");
+ DBUG_ENTER("subselect_uniquesubquery_engine::end_exec");
int error=0, tmp;
if ((tmp= table->file->extra(HA_EXTRA_NO_CACHE)))
{
@@ -967,10 +968,11 @@ int subselect_simplein_engine::end_exec(TABLE *table)
DBUG_RETURN(error != 0);
}
-int subselect_indexin_engine::exec()
+int subselect_indexsubquery_engine::exec()
{
- DBUG_ENTER("subselect_indexin_engine::exec");
+ DBUG_ENTER("subselect_indexsubselect_engine::exec");
int error;
+ bool null_finding= 0;
TABLE *table= tab->table;
((Item_in_subselect *) item)->value= 0;
@@ -1002,29 +1004,30 @@ int subselect_indexin_engine::exec()
{
if (!cond || cond->val_int())
{
- if (check_null && *tab->null_ref_key)
+ if (null_finding)
((Item_in_subselect *) item)->was_null= 1;
else
((Item_in_subselect *) item)->value= 1;
goto finish;
}
+ error= table->file->index_next_same(table->record[0],
+ tab->ref.key_buff,
+ tab->ref.key_length);
+ if (error && error != HA_ERR_END_OF_FILE)
+ {
+ error= report_error(table, error);
+ goto finish;
+ }
}
else
{
- if (!check_null || *tab->null_ref_key)
+ if (!check_null || null_finding)
goto finish;
*tab->null_ref_key= 1;
+ null_finding= 1;
if (safe_index_read(tab))
goto finish;
}
- error= table->file->index_next_same(table->record[0],
- tab->ref.key_buff,
- tab->ref.key_length);
- if (error && error != HA_ERR_KEY_NOT_FOUND)
- {
- error= report_error(table, error);
- goto finish;
- }
}
}
}
@@ -1072,7 +1075,7 @@ void subselect_union_engine::exclude()
unit->exclude_level();
}
-void subselect_simplein_engine::exclude()
+void subselect_uniquesubquery_engine::exclude()
{
//this never should be called
DBUG_ASSERT(0);
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index ddb53ab616a..a17715c57c1 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -51,7 +51,7 @@ public:
/* changed engine indicator */
bool engine_changed;
- enum trans_res {OK, REDUCE, ERROR};
+ enum trans_res {RES_OK, RES_REDUCE, RES_ERROR};
enum subs_type {UNKNOWN_SUBS, SINGLEROW_SUBS,
EXISTS_SUBS, IN_SUBS, ALLANY_SUBS};
@@ -183,8 +183,8 @@ public:
void fix_length_and_dec();
friend class select_exists_subselect;
- friend class subselect_simplein_engine;
- friend class subselect_indexin_engine;
+ friend class subselect_uniquesubquery_engine;
+ friend class subselect_indexsubquery_engine;
};
/* IN subselect */
@@ -227,7 +227,7 @@ public:
friend class Item_ref_null_helper;
friend class Item_is_not_null_test;
- friend class subselect_indexin_engine;
+ friend class subselect_indexsubquery_engine;
};
/* ALL/ANY/SOME subselect */
@@ -313,15 +313,15 @@ public:
};
struct st_join_table;
-class subselect_simplein_engine: public subselect_engine
+class subselect_uniquesubquery_engine: public subselect_engine
{
protected:
st_join_table *tab;
Item *cond;
public:
- subselect_simplein_engine(THD *thd, st_join_table *tab_arg,
- Item_subselect *subs, Item *where)
+ subselect_uniquesubquery_engine(THD *thd, st_join_table *tab_arg,
+ Item_subselect *subs, Item *where)
:subselect_engine(thd, subs, 0), tab(tab_arg), cond(where)
{}
@@ -335,14 +335,14 @@ public:
static int end_exec(TABLE *table);
};
-class subselect_indexin_engine: public subselect_simplein_engine
+class subselect_indexsubquery_engine: public subselect_uniquesubquery_engine
{
bool check_null;
public:
- subselect_indexin_engine(THD *thd, st_join_table *tab_arg,
- Item_subselect *subs, Item *where,
- bool chk_null)
- :subselect_simplein_engine(thd, tab_arg, subs, where),
+ subselect_indexsubquery_engine(THD *thd, st_join_table *tab_arg,
+ Item_subselect *subs, Item *where,
+ bool chk_null)
+ :subselect_uniquesubquery_engine(thd, tab_arg, subs, where),
check_null(chk_null)
{}
int exec();
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 0d05d05f0af..2b31e15cb4c 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -70,6 +70,8 @@ void Item_sum::make_field(Send_field *tmp_field)
tmp_field->db_name=(char*)"";
tmp_field->org_table_name=tmp_field->table_name=(char*)"";
tmp_field->org_col_name=tmp_field->col_name=name;
+ if (maybe_null)
+ tmp_field->flags&= ~NOT_NULL_FLAG;
}
else
init_make_field(tmp_field, field_type());
@@ -197,7 +199,8 @@ Item_sum_hybrid::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
max_length=item->max_length;
}
decimals=item->decimals;
- maybe_null=item->maybe_null;
+ /* MIN/MAX can return NULL for empty set indepedent of the used column */
+ maybe_null= 1;
unsigned_flag=item->unsigned_flag;
collation.set(item->collation);
result_field=0;
@@ -223,10 +226,9 @@ Item *Item_sum_sum::copy_or_same(THD* thd)
}
-bool Item_sum_sum::reset()
+void Item_sum_sum::clear()
{
null_value=1; sum=0.0;
- return Item_sum_sum::add();
}
@@ -251,10 +253,9 @@ Item *Item_sum_count::copy_or_same(THD* thd)
}
-bool Item_sum_count::reset()
+void Item_sum_count::clear()
{
- count=0;
- return add();
+ count= 0;
}
@@ -286,10 +287,9 @@ Item *Item_sum_avg::copy_or_same(THD* thd)
}
-bool Item_sum_avg::reset()
+void Item_sum_avg::clear()
{
sum=0.0; count=0;
- return Item_sum_avg::add();
}
@@ -342,11 +342,10 @@ Item *Item_sum_variance::copy_or_same(THD* thd)
}
-bool Item_sum_variance::reset()
+void Item_sum_variance::clear()
{
sum=sum_sqr=0.0;
count=0;
- return Item_sum_variance::add();
}
bool Item_sum_variance::add()
@@ -392,15 +391,15 @@ void Item_sum_variance::reset_field()
}
}
-void Item_sum_variance::update_field(int offset)
+void Item_sum_variance::update_field()
{
double nr,old_nr,old_sqr;
longlong field_count;
char *res=result_field->ptr;
- float8get(old_nr,res+offset);
- float8get(old_sqr,res+offset+sizeof(double));
- field_count=sint8korr(res+offset+sizeof(double)*2);
+ float8get(old_nr, res);
+ float8get(old_sqr, res+sizeof(double));
+ field_count=sint8korr(res+sizeof(double)*2);
nr=args[0]->val();
if (!args[0]->null_value)
@@ -592,10 +591,9 @@ longlong Item_sum_bit::val_int()
}
-bool Item_sum_bit::reset()
+void Item_sum_bit::clear()
{
- bits=reset_bits;
- return add();
+ bits= reset_bits;
}
Item *Item_sum_or::copy_or_same(THD* thd)
@@ -758,12 +756,12 @@ void Item_sum_bit::reset_field()
** calc next value and merge it with field_value
*/
-void Item_sum_sum::update_field(int offset)
+void Item_sum_sum::update_field()
{
double old_nr,nr;
char *res=result_field->ptr;
- float8get(old_nr,res+offset);
+ float8get(old_nr,res);
nr=args[0]->val();
if (!args[0]->null_value)
{
@@ -774,12 +772,12 @@ void Item_sum_sum::update_field(int offset)
}
-void Item_sum_count::update_field(int offset)
+void Item_sum_count::update_field()
{
longlong nr;
char *res=result_field->ptr;
- nr=sint8korr(res+offset);
+ nr=sint8korr(res);
if (!args[0]->maybe_null)
nr++;
else
@@ -792,14 +790,14 @@ void Item_sum_count::update_field(int offset)
}
-void Item_sum_avg::update_field(int offset)
+void Item_sum_avg::update_field()
{
double nr,old_nr;
longlong field_count;
char *res=result_field->ptr;
- float8get(old_nr,res+offset);
- field_count=sint8korr(res+offset+sizeof(double));
+ float8get(old_nr,res);
+ field_count=sint8korr(res+sizeof(double));
nr=args[0]->val();
if (!args[0]->null_value)
@@ -812,77 +810,65 @@ void Item_sum_avg::update_field(int offset)
int8store(res,field_count);
}
-void Item_sum_hybrid::update_field(int offset)
+void Item_sum_hybrid::update_field()
{
if (hybrid_type == STRING_RESULT)
- min_max_update_str_field(offset);
+ min_max_update_str_field();
else if (hybrid_type == INT_RESULT)
- min_max_update_int_field(offset);
+ min_max_update_int_field();
else
- min_max_update_real_field(offset);
+ min_max_update_real_field();
}
void
-Item_sum_hybrid::min_max_update_str_field(int offset)
+Item_sum_hybrid::min_max_update_str_field()
{
String *res_str=args[0]->val_str(&value);
- if (args[0]->null_value)
- result_field->copy_from_tmp(offset); // Use old value
- else
+ if (!args[0]->null_value)
{
res_str->strip_sp();
- result_field->ptr+=offset; // Get old max/min
result_field->val_str(&tmp_value,&tmp_value);
- result_field->ptr-=offset;
if (result_field->is_null() ||
(cmp_sign * sortcmp(res_str,&tmp_value,cmp_charset)) < 0)
result_field->store(res_str->ptr(),res_str->length(),res_str->charset());
- else
- { // Use old value
- char *res=result_field->ptr;
- memcpy(res,res+offset,result_field->pack_length());
- }
result_field->set_notnull();
}
}
void
-Item_sum_hybrid::min_max_update_real_field(int offset)
+Item_sum_hybrid::min_max_update_real_field()
{
double nr,old_nr;
- result_field->ptr+=offset;
old_nr=result_field->val_real();
nr=args[0]->val();
if (!args[0]->null_value)
{
- if (result_field->is_null(offset) ||
+ if (result_field->is_null(0) ||
(cmp_sign > 0 ? old_nr > nr : old_nr < nr))
old_nr=nr;
result_field->set_notnull();
}
- else if (result_field->is_null(offset))
+ else if (result_field->is_null(0))
result_field->set_null();
- result_field->ptr-=offset;
result_field->store(old_nr);
}
void
-Item_sum_hybrid::min_max_update_int_field(int offset)
+Item_sum_hybrid::min_max_update_int_field()
{
longlong nr,old_nr;
- result_field->ptr+=offset;
old_nr=result_field->val_int();
nr=args[0]->val_int();
if (!args[0]->null_value)
{
- if (result_field->is_null(offset))
+ if (result_field->is_null(0))
old_nr=nr;
else
{
@@ -895,30 +881,29 @@ Item_sum_hybrid::min_max_update_int_field(int offset)
}
result_field->set_notnull();
}
- else if (result_field->is_null(offset))
+ else if (result_field->is_null(0))
result_field->set_null();
- result_field->ptr-=offset;
result_field->store(old_nr);
}
-void Item_sum_or::update_field(int offset)
+void Item_sum_or::update_field()
{
ulonglong nr;
char *res=result_field->ptr;
- nr=uint8korr(res+offset);
+ nr=uint8korr(res);
nr|= (ulonglong) args[0]->val_int();
int8store(res,nr);
}
-void Item_sum_and::update_field(int offset)
+void Item_sum_and::update_field()
{
ulonglong nr;
char *res=result_field->ptr;
- nr=uint8korr(res+offset);
+ nr=uint8korr(res);
nr&= (ulonglong) args[0]->val_int();
int8store(res,nr);
}
@@ -1280,7 +1265,7 @@ Item *Item_sum_count_distinct::copy_or_same(THD* thd)
}
-bool Item_sum_count_distinct::reset()
+void Item_sum_count_distinct::clear()
{
if (use_tree)
reset_tree(tree);
@@ -1290,7 +1275,6 @@ bool Item_sum_count_distinct::reset()
table->file->delete_all_rows();
table->file->extra(HA_EXTRA_WRITE_CACHE);
}
- return add();
}
bool Item_sum_count_distinct::add()
@@ -1353,11 +1337,11 @@ longlong Item_sum_count_distinct::val_int()
#ifdef HAVE_DLOPEN
-bool Item_udf_sum::reset()
+void Item_udf_sum::clear()
{
- DBUG_ENTER("Item_udf_sum::reset");
- udf.reset(&null_value);
- DBUG_RETURN(0);
+ DBUG_ENTER("Item_udf_sum::clear");
+ udf.clear();
+ DBUG_VOID_RETURN;
}
bool Item_udf_sum::add()
@@ -1466,7 +1450,7 @@ int group_concat_key_cmp_with_distinct(void* arg, byte* key1,
for (uint i= 0; i < item->arg_count_field; i++)
{
Item *field_item= item->args[i];
- Field *field= field_item->tmp_table_field();
+ Field *field= field_item->real_item()->get_tmp_table_field();
if (field)
{
uint offset= field->abs_offset;
@@ -1497,7 +1481,7 @@ int group_concat_key_cmp_with_order(void* arg, byte* key1, byte* key2)
{
ORDER *order_item= item->order[i];
Item *item= *order_item->item;
- Field *field= item->tmp_table_field();
+ Field *field= item->real_item()->get_tmp_table_field();
if (field)
{
uint offset= field->abs_offset;
@@ -1548,7 +1532,7 @@ int dump_leaf_key(byte* key, uint32 count __attribute__((unused)),
Item *show_item= group_concat_item->args[i];
if (!show_item->const_item())
{
- Field *f= show_item->tmp_table_field();
+ Field *f= show_item->real_item()->get_tmp_table_field();
char *sv= f->ptr;
f->ptr= (char *)key + f->abs_offset;
String *res= f->val_str(&tmp,&tmp2);
@@ -1685,7 +1669,7 @@ Item *Item_func_group_concat::copy_or_same(THD* thd)
}
-bool Item_func_group_concat::reset()
+void Item_func_group_concat::clear()
{
result.length(0);
result.copy();
@@ -1699,7 +1683,6 @@ bool Item_func_group_concat::reset()
}
if (tree_mode)
reset_tree(tree);
- return add();
}
@@ -1716,7 +1699,7 @@ bool Item_func_group_concat::add()
Item *show_item= args[i];
if (!show_item->const_item())
{
- Field *f= show_item->tmp_table_field();
+ Field *f= show_item->real_item()->get_tmp_table_field();
if (!f->is_null())
{
record_is_null= FALSE;
@@ -1938,6 +1921,3 @@ String* Item_func_group_concat::val_str(String* str)
}
return &result;
}
-
-
-
diff --git a/sql/item_sum.h b/sql/item_sum.h
index ebb90c05215..78d887782e2 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -62,10 +62,11 @@ public:
enum Type type() const { return SUM_FUNC_ITEM; }
virtual enum Sumfunctype sum_func () const=0;
- virtual bool reset()=0;
+ inline bool reset() { clear(); return add(); };
+ virtual void clear()= 0;
virtual bool add()=0;
virtual void reset_field()=0;
- virtual void update_field(int offset)=0;
+ virtual void update_field()=0;
virtual bool keep_field_type(void) const { return 0; }
virtual void fix_length_and_dec() { maybe_null=1; null_value=1; }
virtual const char *func_name() const { return "?"; }
@@ -124,11 +125,11 @@ class Item_sum_sum :public Item_sum_num
Item_sum_sum(THD *thd, Item_sum_sum &item)
:Item_sum_num(thd, item), sum(item.sum) {}
enum Sumfunctype sum_func () const {return SUM_FUNC;}
- bool reset();
+ void clear();
bool add();
double val();
void reset_field();
- void update_field(int offset);
+ void update_field();
void no_rows_in_result() {}
const char *func_name() const { return "sum"; }
Item *copy_or_same(THD* thd);
@@ -151,13 +152,13 @@ class Item_sum_count :public Item_sum_int
table_map used_tables() const { return used_table_cache; }
bool const_item() const { return !used_table_cache; }
enum Sumfunctype sum_func () const { return COUNT_FUNC; }
- bool reset();
+ void clear();
void no_rows_in_result() { count=0; }
bool add();
void make_const(longlong count_arg) { count=count_arg; used_table_cache=0; }
longlong val_int();
void reset_field();
- void update_field(int offset);
+ void update_field();
const char *func_name() const { return "count"; }
Item *copy_or_same(THD* thd);
};
@@ -225,11 +226,11 @@ class Item_sum_count_distinct :public Item_sum_int
table_map used_tables() const { return used_table_cache; }
enum Sumfunctype sum_func () const { return COUNT_DISTINCT_FUNC; }
- bool reset();
+ void clear();
bool add();
longlong val_int();
void reset_field() { return ;} // Never called
- void update_field(int offset) { return ; } // Never called
+ void update_field() { return ; } // Never called
const char *func_name() const { return "count_distinct"; }
bool setup(THD *thd);
void make_unique();
@@ -269,11 +270,11 @@ class Item_sum_avg :public Item_sum_num
Item_sum_avg(THD *thd, Item_sum_avg &item)
:Item_sum_num(thd, item), sum(item.sum), count(item.count) {}
enum Sumfunctype sum_func () const {return AVG_FUNC;}
- bool reset();
+ void clear();
bool add();
double val();
void reset_field();
- void update_field(int offset);
+ void update_field();
Item *result_item(Field *field)
{ return new Item_avg_field(this); }
const char *func_name() const { return "avg"; }
@@ -322,11 +323,11 @@ class Item_sum_variance : public Item_sum_num
Item_sum_num(thd, item), sum(item.sum), sum_sqr(item.sum_sqr),
count(item.count) {}
enum Sumfunctype sum_func () const { return VARIANCE_FUNC; }
- bool reset();
+ void clear();
bool add();
double val();
void reset_field();
- void update_field(int offset);
+ void update_field();
Item *result_item(Field *field)
{ return new Item_variance_field(this); }
const char *func_name() const { return "variance"; }
@@ -385,19 +386,18 @@ class Item_sum_hybrid :public Item_sum
Item_sum_hybrid(THD *thd, Item_sum_hybrid &item):
Item_sum(thd, item), value(item.value), tmp_value(item.tmp_value),
sum(item.sum), sum_int(item.sum_int), hybrid_type(item.hybrid_type),
- cmp_sign(item.cmp_sign), used_table_cache(used_table_cache),
- cmp_charset(item.cmp_charset) {}
+ hybrid_field_type(item.hybrid_field_type),cmp_sign(item.cmp_sign),
+ used_table_cache(used_table_cache), cmp_charset(item.cmp_charset) {}
bool fix_fields(THD *, TABLE_LIST *, Item **);
table_map used_tables() const { return used_table_cache; }
bool const_item() const { return !used_table_cache; }
- bool reset()
+ void clear()
{
sum=0.0;
sum_int=0;
value.length(0);
null_value=1;
- return add();
}
double val();
longlong val_int();
@@ -407,10 +407,10 @@ class Item_sum_hybrid :public Item_sum
bool keep_field_type(void) const { return 1; }
enum Item_result result_type () const { return hybrid_type; }
enum enum_field_types field_type() const { return hybrid_field_type; }
- void update_field(int offset);
- void min_max_update_str_field(int offset);
- void min_max_update_real_field(int offset);
- void min_max_update_int_field(int offset);
+ void update_field();
+ void min_max_update_str_field();
+ void min_max_update_real_field();
+ void min_max_update_int_field();
};
@@ -451,7 +451,7 @@ class Item_sum_bit :public Item_sum_int
Item_sum_bit(THD *thd, Item_sum_bit &item):
Item_sum_int(thd, item), reset_bits(item.reset_bits), bits(item.bits) {}
enum Sumfunctype sum_func () const {return SUM_BIT_FUNC;}
- bool reset();
+ void clear();
longlong val_int();
void reset_field();
void fix_length_and_dec()
@@ -465,7 +465,7 @@ class Item_sum_or :public Item_sum_bit
Item_sum_or(Item *item_par) :Item_sum_bit(item_par,LL(0)) {}
Item_sum_or(THD *thd, Item_sum_or &item) :Item_sum_bit(thd, item) {}
bool add();
- void update_field(int offset);
+ void update_field();
const char *func_name() const { return "bit_or"; }
Item *copy_or_same(THD* thd);
};
@@ -477,7 +477,7 @@ class Item_sum_and :public Item_sum_bit
Item_sum_and(Item *item_par) :Item_sum_bit(item_par, ~(ulonglong) LL(0)) {}
Item_sum_and(THD *thd, Item_sum_and &item) :Item_sum_bit(thd, item) {}
bool add();
- void update_field(int offset);
+ void update_field();
const char *func_name() const { return "bit_and"; }
Item *copy_or_same(THD* thd);
};
@@ -509,10 +509,10 @@ public:
enum Sumfunctype sum_func () const { return UDF_SUM_FUNC; }
virtual bool have_field_update(void) const { return 0; }
- bool reset();
+ void clear();
bool add();
void reset_field() {};
- void update_field(int offset_arg) {};
+ void update_field() {};
};
@@ -591,9 +591,9 @@ class Item_sum_udf_float :public Item_sum_num
~Item_sum_udf_float() {}
enum Sumfunctype sum_func () const { return UDF_SUM_FUNC; }
double val() { return 0.0; }
- bool reset() { return 0; }
+ void clear() {}
bool add() { return 0; }
- void update_field(int offset) {}
+ void update_field() {}
};
@@ -608,9 +608,9 @@ public:
enum Sumfunctype sum_func () const { return UDF_SUM_FUNC; }
longlong val_int() { return 0; }
double val() { return 0; }
- bool reset() { return 0; }
+ void clear() {}
bool add() { return 0; }
- void update_field(int offset) {}
+ void update_field() {}
};
@@ -628,9 +628,9 @@ public:
enum Item_result result_type () const { return STRING_RESULT; }
void fix_length_and_dec() { maybe_null=1; max_length=0; }
enum Sumfunctype sum_func () const { return UDF_SUM_FUNC; }
- bool reset() { return 0; }
+ void clear() {}
bool add() { return 0; }
- void update_field(int offset) {}
+ void update_field() {}
};
#endif /* HAVE_DLOPEN */
@@ -714,13 +714,13 @@ class Item_func_group_concat : public Item_sum
const char *func_name() const { return "group_concat"; }
enum Type type() const { return SUM_FUNC_ITEM; }
virtual Item_result result_type () const { return STRING_RESULT; }
- bool reset();
+ void clear();
bool add();
void reset_field();
bool fix_fields(THD *, TABLE_LIST *, Item **);
bool setup(THD *thd);
void make_unique();
- virtual void update_field(int offset) {};
+ virtual void update_field() {}
double val()
{
String *res; res=val_str(&str_value);
@@ -733,4 +733,5 @@ class Item_func_group_concat : public Item_sum
}
String* val_str(String* str);
Item *copy_or_same(THD* thd);
+ void no_rows_in_result() {}
};
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h
index d84267a5066..6dcf7d00ce1 100644
--- a/sql/item_timefunc.h
+++ b/sql/item_timefunc.h
@@ -327,7 +327,6 @@ public:
max_length=10*default_charset()->mbmaxlen;
}
int save_in_field(Field *to, bool no_conversions);
- Field *tmp_table_field() { return result_field; }
Field *tmp_table_field(TABLE *t_arg)
{
return (new Field_date(maybe_null, name, t_arg, default_charset()));
@@ -342,7 +341,6 @@ public:
Item_date_func(Item *a) :Item_str_func(a) {}
Item_date_func(Item *a,Item *b) :Item_str_func(a,b) {}
enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; }
- Field *tmp_table_field() { return result_field; }
Field *tmp_table_field(TABLE *t_arg)
{
return (new Field_datetime(maybe_null, name, t_arg, default_charset()));
@@ -366,7 +364,6 @@ public:
longlong val_int() { return value; }
String *val_str(String *str);
void fix_length_and_dec();
- Field *tmp_table_field() { return result_field; }
Field *tmp_table_field(TABLE *t_arg)
{
return (new Field_time(maybe_null, name, t_arg, default_charset()));
@@ -533,7 +530,6 @@ public:
}
enum_field_types field_type() const { return MYSQL_TYPE_TIME; }
const char *func_name() const { return "sec_to_time"; }
- Field *tmp_table_field() { return result_field; }
Field *tmp_table_field(TABLE *t_arg)
{
return (new Field_time(maybe_null, name, t_arg, default_charset()));
@@ -634,7 +630,6 @@ public:
bool get_date(TIME *ltime, bool fuzzy_date);
const char *func_name() const { return "date"; }
enum_field_types field_type() const { return MYSQL_TYPE_DATE; }
- Field *tmp_table_field() { return result_field; }
Field *tmp_table_field(TABLE *t_arg)
{
return (new Field_date(maybe_null, name, t_arg, default_charset()));
@@ -650,7 +645,6 @@ public:
bool get_time(TIME *ltime);
const char *func_name() const { return "time"; }
enum_field_types field_type() const { return MYSQL_TYPE_TIME; }
- Field *tmp_table_field() { return result_field; }
Field *tmp_table_field(TABLE *t_arg)
{
return (new Field_time(maybe_null, name, t_arg, default_charset()));
@@ -665,7 +659,6 @@ public:
String *val_str(String *str);
const char *func_name() const { return "datetime"; }
enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; }
- Field *tmp_table_field() { return result_field; }
Field *tmp_table_field(TABLE *t_arg)
{
return (new Field_datetime(maybe_null, name, t_arg, default_charset()));
@@ -684,7 +677,6 @@ public:
decimals=0;
max_length=8*MY_CHARSET_BIN_MB_MAXLEN;
}
- Field *tmp_table_field() { return result_field; }
Field *tmp_table_field(TABLE *t_arg)
{
return (new Field_date(maybe_null, name, t_arg, &my_charset_bin));
@@ -711,7 +703,6 @@ public:
Change this when we support
microseconds in TIME/DATETIME
*/
- Field *tmp_table_field() { return result_field; }
Field *tmp_table_field(TABLE *t_arg)
{
if (cached_field_type == MYSQL_TYPE_TIME)
@@ -735,7 +726,6 @@ public:
decimals=0;
max_length=17*MY_CHARSET_BIN_MB_MAXLEN;
}
- Field *tmp_table_field() { return result_field; }
Field *tmp_table_field(TABLE *t_arg)
{
return (new Field_time(maybe_null, name, t_arg, &my_charset_bin));
@@ -755,7 +745,6 @@ public:
decimals=0;
max_length=8*MY_CHARSET_BIN_MB_MAXLEN;
}
- Field *tmp_table_field() { return result_field; }
Field *tmp_table_field(TABLE *t_arg)
{
return (new Field_time(maybe_null, name, t_arg, &my_charset_bin));
diff --git a/sql/item_uniq.h b/sql/item_uniq.h
index f2c64c4bde9..9b370b70181 100644
--- a/sql/item_uniq.h
+++ b/sql/item_uniq.h
@@ -41,10 +41,10 @@ public:
:Item_sum_num(thd, item) {}
double val() { return 0.0; }
enum Sumfunctype sum_func () const {return UNIQUE_USERS_FUNC;}
- bool reset() { return 0;}
+ void clear() {}
bool add() { return 0; }
void reset_field() {}
- void update_field(int offset) {}
+ void update_field() {}
bool fix_fields(THD *thd, TABLE_LIST *tlist, Item **ref)
{
fixed= 1;
diff --git a/sql/lex.h b/sql/lex.h
index 24bfe796cc0..e11b50ed16d 100644
--- a/sql/lex.h
+++ b/sql/lex.h
@@ -249,6 +249,12 @@ static SYMBOL symbols[] = {
{ "MASTER_PASSWORD", SYM(MASTER_PASSWORD_SYM),0,0},
{ "MASTER_PORT", SYM(MASTER_PORT_SYM),0,0},
{ "MASTER_SERVER_ID", SYM(MASTER_SERVER_ID_SYM),0,0},
+ { "MASTER_SSL", SYM(MASTER_SSL_SYM),0,0},
+ { "MASTER_SSL_CA", SYM(MASTER_SSL_CA_SYM),0,0},
+ { "MASTER_SSL_CAPATH",SYM(MASTER_SSL_CAPATH_SYM),0,0},
+ { "MASTER_SSL_CERT", SYM(MASTER_SSL_CERT_SYM),0,0},
+ { "MASTER_SSL_CIPHER",SYM(MASTER_SSL_CIPHER_SYM),0,0},
+ { "MASTER_SSL_KEY", SYM(MASTER_SSL_KEY_SYM),0,0},
{ "MASTER_USER", SYM(MASTER_USER_SYM),0,0},
{ "MAX_ROWS", SYM(MAX_ROWS),0,0},
{ "MAX_QUERIES_PER_HOUR", SYM(MAX_QUERIES_PER_HOUR), 0,0},
@@ -287,7 +293,9 @@ static SYMBOL symbols[] = {
{ "NOT", SYM(NOT),0,0},
{ "NULL", SYM(NULL_SYM),0,0},
{ "NUMERIC", SYM(NUMERIC_SYM),0,0},
+ { "NVARCHAR", SYM(NVARCHAR_SYM),0,0},
{ "OFFSET", SYM(OFFSET_SYM),0,0},
+ { "OLD_PASSWORD", SYM(OLD_PASSWORD),0,0},
{ "ON", SYM(ON),0,0},
{ "OPEN", SYM(OPEN_SYM),0,0},
{ "OPTIMIZE", SYM(OPTIMIZE),0,0},
@@ -404,6 +412,7 @@ static SYMBOL symbols[] = {
{ "USE", SYM(USE_SYM),0,0},
{ "USE_FRM", SYM(USE_FRM),0,0},
{ "USER", SYM(USER),0,0},
+ { "UNTIL", SYM(UNTIL_SYM),0,0},
{ "USING", SYM(USING),0,0},
{ "UTC_DATE", SYM(UTC_DATE_SYM),0,0},
{ "UTC_TIME", SYM(UTC_TIME_SYM),0,0},
@@ -473,9 +482,7 @@ static SYMBOL sql_functions[] = {
{ "COUNT", SYM(COUNT_SYM),0,0},
{ "COS", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_cos)},
{ "COT", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_cot)},
-#ifdef HAVE_COMPRESS
{ "CRC32", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_crc32)},
-#endif
{ "CROSSES", SYM(FUNC_ARG2),0,CREATE_FUNC(create_func_crosses)},
{ "CURDATE", SYM(CURDATE),0,0},
{ "CURTIME", SYM(CURTIME),0,0},
@@ -590,7 +597,6 @@ static SYMBOL sql_functions[] = {
{ "NUMPOINTS", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_numpoints)},
{ "OCTET_LENGTH", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_length)},
{ "OCT", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_oct)},
- { "OLD_PASSWORD", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_old_password)},
{ "ORD", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_ord)},
{ "OVERLAPS", SYM(FUNC_ARG2),0,CREATE_FUNC(create_func_overlaps)},
{ "PERIOD_ADD", SYM(FUNC_ARG2),0,CREATE_FUNC(create_func_period_add)},
diff --git a/sql/lock.cc b/sql/lock.cc
index 82004298453..29795415720 100644
--- a/sql/lock.cc
+++ b/sql/lock.cc
@@ -75,8 +75,6 @@ TODO:
#include "../myisammrg/myrg_def.h"
#endif
-extern HASH open_cache;
-
static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table,uint count,
bool unlock, TABLE **write_locked);
static int lock_external(THD *thd, TABLE **table,uint count);
@@ -526,7 +524,7 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list)
table->locked_by_name=1;
table_list->table=table;
- if (hash_insert(&open_cache, (byte*) table))
+ if (my_hash_insert(&open_cache, (byte*) table))
{
my_free((gptr) table,MYF(0));
DBUG_RETURN(-1);
diff --git a/sql/log.cc b/sql/log.cc
index d3ba5b63e19..608a7e94431 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -31,7 +31,6 @@
#include <m_ctype.h> // For test_if_number
MYSQL_LOG mysql_log,mysql_update_log,mysql_slow_log,mysql_bin_log;
-extern I_List<i_string> binlog_do_db, binlog_ignore_db;
static bool test_if_number(const char *str,
long *res, bool allow_wildcards);
@@ -270,7 +269,8 @@ bool MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
an extension for the binary log files.
In this case we write a standard header to it.
*/
- if (my_b_write(&log_file, (byte*) BINLOG_MAGIC, BIN_LOG_HEADER_SIZE))
+ if (my_b_safe_write(&log_file, (byte*) BINLOG_MAGIC,
+ BIN_LOG_HEADER_SIZE))
goto err;
bytes_written += BIN_LOG_HEADER_SIZE;
write_file_name_to_index_file=1;
@@ -704,6 +704,7 @@ int MYSQL_LOG::purge_first_log(struct st_relay_log_info* rli, bool included)
rli->group_relay_log_pos = BIN_LOG_HEADER_SIZE;
strmake(rli->group_relay_log_name,rli->linfo.log_file_name,
sizeof(rli->group_relay_log_name)-1);
+ rli->notify_group_relay_log_name_update();
}
/* Store where we are in the new file for the execution thread */
@@ -1091,8 +1092,11 @@ bool MYSQL_LOG::write(THD *thd,enum enum_server_command command,
if (thd)
{ // Normal thread
- if ((thd->options & OPTION_LOG_OFF) &&
- (thd->master_access & SUPER_ACL))
+ if ((thd->options & OPTION_LOG_OFF)
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ && (thd->master_access & SUPER_ACL)
+#endif
+)
{
VOID(pthread_mutex_unlock(&LOCK_log));
return 0; // No logging
@@ -1175,14 +1179,24 @@ bool MYSQL_LOG::write(Log_event* event_info)
*/
if (is_open())
{
- const char *local_db = event_info->get_db();
+ const char *local_db= event_info->get_db();
+ IO_CACHE *file= &log_file;
#ifdef USING_TRANSACTIONS
- IO_CACHE *file = ((event_info->get_cache_stmt()) ?
- &thd->transaction.trans_log :
- &log_file);
-#else
- IO_CACHE *file = &log_file;
-#endif
+ /*
+ Should we write to the binlog cache or to the binlog on disk?
+ Write to the binlog cache if:
+ - it is already not empty (meaning we're in a transaction; note that the
+ present event could be about a non-transactional table, but still we need
+ to write to the binlog cache in that case to handle updates to mixed
+ trans/non-trans table types the best possible in binlogging)
+ - or if the event asks for it (cache_stmt == true).
+ */
+ if (opt_using_transactions &&
+ (event_info->get_cache_stmt() ||
+ (thd && my_b_tell(&thd->transaction.trans_log))))
+ file= &thd->transaction.trans_log;
+#endif
+ DBUG_PRINT("info",("event type=%d",event_info->get_type_code()));
#ifdef HAVE_REPLICATION
/*
In the future we need to add to the following if tests like
@@ -1401,6 +1415,13 @@ uint MYSQL_LOG::next_file_id()
/*
Write a cached log entry to the binary log
+ SYNOPSIS
+ write()
+ thd
+ cache The cache to copy to the binlog
+ commit_or_rollback If true, will write "COMMIT" in the end, if false will
+ write "ROLLBACK".
+
NOTE
- We only come here if there is something in the cache.
- The thing in the cache is always a complete transaction
@@ -1408,10 +1429,13 @@ uint MYSQL_LOG::next_file_id()
IMPLEMENTATION
- To support transaction over replication, we wrap the transaction
- with BEGIN/COMMIT in the binary log.
+ with BEGIN/COMMIT or BEGIN/ROLLBACK in the binary log.
+ We want to write a BEGIN/ROLLBACK block when a non-transactional table was
+ updated in a transaction which was rolled back. This is to ensure that the
+ same updates are run on the slave.
*/
-bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache)
+bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache, bool commit_or_rollback)
{
VOID(pthread_mutex_lock(&LOCK_log));
DBUG_ENTER("MYSQL_LOG::write(cache");
@@ -1465,7 +1489,10 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache)
*/
{
- Query_log_event qinfo(thd, "COMMIT", 6, TRUE);
+ Query_log_event qinfo(thd,
+ commit_or_rollback ? "COMMIT" : "ROLLBACK",
+ commit_or_rollback ? 6 : 8,
+ TRUE);
qinfo.set_log_pos(this);
if (qinfo.write(&log_file) || flush_io_cache(&log_file))
goto err;
@@ -1528,8 +1555,11 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length,
int tmp_errno=0;
char buff[80],*end;
end=buff;
- if (!(thd->options & OPTION_UPDATE_LOG) &&
- (thd->master_access & SUPER_ACL))
+ if (!(thd->options & OPTION_UPDATE_LOG)
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ && (thd->master_access & SUPER_ACL)
+#endif
+ )
{
VOID(pthread_mutex_unlock(&LOCK_log));
return 0;
@@ -1556,8 +1586,8 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length,
tmp_errno=errno;
}
if (my_b_printf(&log_file, "# User@Host: %s[%s] @ %s [%s]\n",
- thd->priv_user,
- thd->user,
+ thd->priv_user ? thd->priv_user : "",
+ thd->user ? thd->user : "",
thd->host ? thd->host : "",
thd->ip ? thd->ip : "") == (uint) -1)
tmp_errno=errno;
@@ -1642,6 +1672,9 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length,
SYNOPSIS
wait_for_update()
thd Thread variable
+ master_or_slave If 0, the caller is the Binlog_dump thread from master;
+ if 1, the caller is the SQL thread from the slave. This
+ influences only thd->proc_info.
NOTES
One must have a lock on LOCK_log before calling this function.
@@ -1653,11 +1686,15 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length,
If you don't do it this way, you will get a deadlock in THD::awake()
*/
-void MYSQL_LOG:: wait_for_update(THD* thd)
+void MYSQL_LOG:: wait_for_update(THD* thd, bool master_or_slave)
{
safe_mutex_assert_owner(&LOCK_log);
const char* old_msg = thd->enter_cond(&update_cond, &LOCK_log,
- "Slave: waiting for binlog update");
+ master_or_slave ?
+ "Has read all relay log; waiting for \
+the I/O slave thread to update it" :
+ "Has sent all binlog to slave; \
+waiting for binlog to be updated");
pthread_cond_wait(&update_cond, &LOCK_log);
pthread_mutex_unlock(&LOCK_log); // See NOTES
thd->exit_cond(old_msg);
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 8a52ad9ebca..b6964c40422 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -27,25 +27,6 @@
#define log_cs &my_charset_latin1
/*
- my_b_safe_write()
-*/
-
-inline int my_b_safe_write(IO_CACHE* file, const byte *buf,
- int len)
-{
- /*
- Sasha: We are not writing this with the ? operator to avoid hitting
- a possible compiler bug. At least gcc 2.95 cannot deal with
- several layers of ternary operators that evaluated comma(,) operator
- expressions inside - I do have a test case if somebody wants it
- */
- if (file->type == SEQ_READ_APPEND)
- return my_b_append(file, buf,len);
- return my_b_write(file, buf,len);
-}
-
-
-/*
pretty_print_str()
*/
@@ -239,12 +220,11 @@ const char* Log_event::get_type_str()
#ifndef MYSQL_CLIENT
Log_event::Log_event(THD* thd_arg, uint16 flags_arg, bool using_trans)
- :temp_buf(0), exec_time(0), cached_event_len(0), flags(flags_arg),
- thd(thd_arg)
+ :log_pos(0), temp_buf(0), exec_time(0), cached_event_len(0),
+ flags(flags_arg), thd(thd_arg)
{
server_id= thd->server_id;
when= thd->start_time;
- log_pos= thd->log_pos;
cache_stmt= (using_trans &&
(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)));
}
@@ -331,7 +311,6 @@ int Log_event::exec_event(struct st_relay_log_info* rli)
handler and MyISAM and STOP SLAVE is issued in the middle of the
"transaction". START SLAVE will resume at BEGIN while the MyISAM table
has already been updated.
-
*/
if ((thd->options & OPTION_BEGIN) && opt_using_transactions)
rli->inc_event_relay_log_pos(get_event_len());
@@ -605,6 +584,8 @@ Log_event* Log_event::read_log_event(const char* buf, int event_len,
ev = new Query_log_event(buf, event_len, old_format);
break;
case LOAD_EVENT:
+ ev = new Create_file_log_event(buf, event_len, old_format);
+ break;
case NEW_LOAD_EVENT:
ev = new Load_log_event(buf, event_len, old_format);
break;
@@ -894,7 +875,6 @@ void Query_log_event::print(FILE* file, bool short_form, char* last_db)
int Query_log_event::exec_event(struct st_relay_log_info* rli)
{
int expected_error,actual_error= 0;
- init_sql_alloc(&thd->mem_root, 8192,0);
thd->db= (char*) rewrite_db(db);
/*
@@ -988,14 +968,14 @@ Default database: '%s'",
*/
} /* End of if (db_ok(... */
-end:
-
VOID(pthread_mutex_lock(&LOCK_thread_count));
thd->db= 0; // prevent db from being freed
thd->query= 0; // just to be sure
VOID(pthread_mutex_unlock(&LOCK_thread_count));
// assume no convert for next query unless set explictly
- //thd->variables.convert_set = 0;
+#ifdef TO_BE_REMOVED
+ thd->variables.convert_set = 0;
+#endif
close_thread_tables(thd);
free_root(&thd->mem_root,0);
return (thd->query_error ? thd->query_error : Log_event::exec_event(rli));
@@ -1091,15 +1071,6 @@ int Start_log_event::write_data(IO_CACHE* file)
the use of a bit of memory for a user lock which will not be used
anymore. If the user lock is later used, the old one will be released. In
other words, no deadlock problem.
- - If we have an active transaction at this point, the master died
- in the middle while writing the transaction to the binary log.
- In this case we should stop the slave.
- Guilhem 2003-06: I don't think we should. As the binlog is written before
- the table changes are committed, rollback has occured on the master; we
- should rather rollback on the slave and go on. If we don't rollback, and
- the next query is not BEGIN, then it will be considered as part of the
- unfinished transaction, and so will be rolled back at next BEGIN, which
- is a bug.
*/
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
@@ -1113,12 +1084,6 @@ int Start_log_event::exec_event(struct st_relay_log_info* rli)
This is 4.x, so a Start_log_event is only at master startup,
so we are sure the master has restarted and cleared his temp tables.
*/
-
- /*
- If the master died before writing the COMMIT to the binlog, rollback;
- otherwise it does not hurt to rollback.
- */
- ha_rollback(thd);
close_temporary_tables(thd);
cleanup_load_tmpdir();
break;
@@ -1471,6 +1436,13 @@ int Load_log_event::copy_log_event(const char *buf, ulong event_len,
#ifdef MYSQL_CLIENT
void Load_log_event::print(FILE* file, bool short_form, char* last_db)
{
+ print(file, short_form, last_db, 0);
+}
+
+
+void Load_log_event::print(FILE* file, bool short_form, char* last_db,
+ bool commented)
+{
if (!short_form)
{
print_header(file);
@@ -1486,9 +1458,12 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db)
}
if (db && db[0] && !same_db)
- fprintf(file, "use %s;\n", db);
+ fprintf(file, "%suse %s;\n",
+ commented ? "# " : "",
+ db);
- fprintf(file, "LOAD DATA ");
+ fprintf(file, "%sLOAD DATA ",
+ commented ? "# " : "");
if (check_fname_outside_temp_buf())
fprintf(file, "LOCAL ");
fprintf(file, "INFILE '%-*s' ", fname_len, fname);
@@ -1535,8 +1510,8 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db)
pretty_print_str(file, sql_ex.line_start, sql_ex.line_start_len);
}
- if ((int)skip_lines > 0)
- fprintf(file, " IGNORE %ld LINES ", (long) skip_lines);
+ if ((long) skip_lines > 0)
+ fprintf(file, " IGNORE %ld LINES", (long) skip_lines);
if (num_fields)
{
@@ -1607,12 +1582,23 @@ void Load_log_event::set_fields(List<Item> &field_list)
int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
bool use_rli_only_for_errors)
{
- init_sql_alloc(&thd->mem_root, 8192,0);
thd->db= (char*) rewrite_db(db);
DBUG_ASSERT(thd->query == 0);
thd->query = 0; // Should not be needed
thd->query_error = 0;
+ /*
+ We test replicate_*_db rules. Note that we have already prepared the file
+ to load, even if we are going to ignore and delete it now. So it is
+ possible that we did a lot of disk writes for nothing. In other words, a
+ big LOAD DATA INFILE on the master will still consume a lot of space on
+ the slave (space in the relay log + space of temp files: twice the space
+ of the file to load...) even if it will finally be ignored.
+ TODO: fix this; this can be done by testing rules in
+ Create_file_log_event::exec_event() and then discarding Append_block and
+ al. Another way is do the filtering in the I/O thread (more efficient: no
+ disk writes at all).
+ */
if (db_ok(thd->db, replicate_do_db, replicate_ignore_db))
{
thd->set_time((time_t)when);
@@ -1642,20 +1628,22 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
else if (sql_ex.opt_flags & IGNORE_FLAG)
handle_dup= DUP_IGNORE;
else
+ {
/*
- Note that when replication is running fine, if it was DUP_ERROR on the
+ When replication is running fine, if it was DUP_ERROR on the
master then we could choose DUP_IGNORE here, because if DUP_ERROR
suceeded on master, and data is identical on the master and slave,
then there should be no uniqueness errors on slave, so DUP_IGNORE is
the same as DUP_ERROR. But in the unlikely case of uniqueness errors
- (because the data on the master and slave happen to be different (user
- error or bug), we want LOAD DATA to print an error message on the
- slave to discover the problem.
+ (because the data on the master and slave happen to be different
+ (user error or bug), we want LOAD DATA to print an error message on
+ the slave to discover the problem.
If reading from net (a 3.23 master), mysql_load() will change this
to DUP_IGNORE.
*/
handle_dup= DUP_ERROR;
+ }
sql_exchange ex((char*)fname, sql_ex.opt_flags & DUMPFILE_FLAG);
String field_term(sql_ex.field_term,sql_ex.field_term_len,log_cs);
@@ -1731,7 +1719,7 @@ Slave: load data infile on table '%s' at log position %s in log \
err=ER(sql_errno);
}
slave_print_error(rli,sql_errno,"\
-Error '%s' running lOAD DATA INFILE on table '%s'. Default database: '%s'",
+Error '%s' running LOAD DATA INFILE on table '%s'. Default database: '%s'",
err, (char*)table_name, print_slave_db_safe(db));
free_root(&thd->mem_root,0);
return 1;
@@ -1762,14 +1750,13 @@ Fatal error running LOAD DATA INFILE on table '%s'. Default database: '%s'",
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
void Rotate_log_event::pack_info(Protocol *protocol)
{
- char *buf, *b_pos;
- if (!(buf= my_malloc(ident_len + 45, MYF(MY_WME))))
- return;
- memcpy(buf, new_log_ident, ident_len);
- b_pos= strmov(buf + ident_len, ";pos=");
- b_pos= longlong10_to_str(pos, b_pos, 10);
- protocol->store(buf, (uint) (b_pos-buf), &my_charset_bin);
- my_free(buf, MYF(MY_ALLOW_ZERO_PTR));
+ char buf1[256], buf[22];
+ String tmp(buf1, sizeof(buf1), log_cs);
+ tmp.length(0);
+ tmp.append(new_log_ident, ident_len);
+ tmp.append(";pos=");
+ tmp.append(llstr(pos,buf));
+ protocol->store(tmp.ptr(), tmp.length(), &my_charset_bin);
}
#endif
@@ -1858,6 +1845,25 @@ int Rotate_log_event::write_data(IO_CACHE* file)
We can't rotate the slave as this will cause infinitive rotations
in a A -> B -> A setup.
+ NOTES
+ As a transaction NEVER spans on 2 or more binlogs:
+ if we have an active transaction at this point, the master died while
+ writing the transaction to the binary log, i.e. while flushing the binlog
+ cache to the binlog. As the write was started, the transaction had been
+ committed on the master, so we lack of information to replay this
+ transaction on the slave; all we can do is stop with error.
+ If we didn't detect it, then positions would start to become garbage (as we
+ are incrementing rli->relay_log_pos whereas we are in a transaction: the
+ new rli->relay_log_pos will be
+ relay_log_pos of the BEGIN + size of the Rotate event = garbage.
+
+ Since MySQL 4.0.14, the master ALWAYS sends a Rotate event when it starts
+ sending the next binlog, so we are sure to receive a Rotate event just
+ after the end of the "dead master"'s binlog; so this exec_event() is the
+ right place to catch the problem. If we would wait until
+ Start_log_event::exec_event() it would be too late, rli->relay_log_pos
+ would already be garbage.
+
RETURN VALUES
0 ok
*/
@@ -1869,7 +1875,26 @@ int Rotate_log_event::exec_event(struct st_relay_log_info* rli)
DBUG_ENTER("Rotate_log_event::exec_event");
pthread_mutex_lock(&rli->data_lock);
+
+ if (thd->options & OPTION_BEGIN)
+ {
+ slave_print_error(rli, 0,
+ opt_using_transactions ?
+ "\
+There is an unfinished transaction in the relay log (could find neither \
+COMMIT nor ROLLBACK in the relay log); It could be that the master died while \
+writing the transaction to its binary log. Now the slave is rolling back the \
+transaction." :
+ "\
+There is an unfinished transaction in the relay log (could find neither \
+COMMIT nor ROLLBACK in the relay log); It could be that the master died while \
+writing the transaction to its binary log.");
+ pthread_mutex_unlock(&rli->data_lock);
+ DBUG_RETURN(1);
+ }
+
memcpy(log_name, new_log_ident, ident_len+1);
+ rli->notify_group_master_log_name_update();
rli->group_master_log_pos = pos;
rli->event_relay_log_pos += get_event_len();
rli->group_relay_log_pos = rli->event_relay_log_pos;
@@ -1894,8 +1919,8 @@ int Rotate_log_event::exec_event(struct st_relay_log_info* rli)
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
void Intvar_log_event::pack_info(Protocol *protocol)
{
- char buf[64], *pos;
- pos= strmov(buf, get_var_type_name());
+ char buf[256], *pos;
+ pos= strmake(buf, get_var_type_name(), sizeof(buf)-23);
*pos++= '=';
pos= longlong10_to_str(val, pos, -10);
protocol->store(buf, (uint) (pos-buf), &my_charset_bin);
@@ -2462,8 +2487,8 @@ void Stop_log_event::print(FILE* file, bool short_form, char* last_db)
Stop_log_event::exec_event()
The master stopped.
- We used to clean up all temporary tables but this is useless as, as the master
- has shut down properly, it has written all DROP TEMPORARY TABLE and DO
+ We used to clean up all temporary tables but this is useless as, as the
+ master has shut down properly, it has written all DROP TEMPORARY TABLE and DO
RELEASE_LOCK (prepared statements' deletion is TODO).
We used to clean up slave_load_tmpdir, but this is useless as it has been
cleared at the end of LOAD DATA INFILE.
@@ -2605,10 +2630,12 @@ void Create_file_log_event::print(FILE* file, bool short_form,
if (enable_local)
{
- if (!check_fname_outside_temp_buf())
- fprintf(file, "#");
- Load_log_event::print(file, 1, last_db);
- fprintf(file, "#");
+ Load_log_event::print(file, 1, last_db, !check_fname_outside_temp_buf());
+ /*
+ That one is for "file_id: etc" below: in mysqlbinlog we want the #, in
+ SHOW BINLOG EVENTS we don't.
+ */
+ fprintf(file, "#");
}
fprintf(file, " file_id: %d block_len: %d\n", file_id, block_len);
@@ -2641,7 +2668,7 @@ void Create_file_log_event::pack_info(Protocol *protocol)
pos= int10_to_str((long) block_len, pos, 10);
protocol->store(buf, (uint) (pos-buf), &my_charset_bin);
}
-#endif
+#endif /* defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) */
/*
@@ -2665,7 +2692,7 @@ int Create_file_log_event::exec_event(struct st_relay_log_info* rli)
init_io_cache(&file, fd, IO_SIZE, WRITE_CACHE, (my_off_t)0, 0,
MYF(MY_WME|MY_NABP)))
{
- slave_print_error(rli,my_errno, "Could not open file '%s'", fname_buf);
+ slave_print_error(rli,my_errno, "Error in Create_file event: could not open file '%s'", fname_buf);
goto err;
}
@@ -2676,7 +2703,9 @@ int Create_file_log_event::exec_event(struct st_relay_log_info* rli)
if (write_base(&file))
{
strmov(p, ".info"); // to have it right in the error message
- slave_print_error(rli,my_errno, "Could not write to file '%s'", fname_buf);
+ slave_print_error(rli,my_errno,
+ "Error in Create_file event: could not write to file '%s'",
+ fname_buf);
goto err;
}
end_io_cache(&file);
@@ -2686,16 +2715,14 @@ int Create_file_log_event::exec_event(struct st_relay_log_info* rli)
if ((fd = my_open(fname_buf, O_WRONLY|O_CREAT|O_BINARY|O_TRUNC,
MYF(MY_WME))) < 0)
{
- slave_print_error(rli,my_errno, "Could not open file '%s'", fname_buf);
+ slave_print_error(rli,my_errno, "Error in Create_file event: could not open file '%s'", fname_buf);
goto err;
}
if (my_write(fd, (byte*) block, block_len, MYF(MY_WME+MY_NABP)))
{
- slave_print_error(rli,my_errno, "Write to '%s' failed", fname_buf);
+ slave_print_error(rli,my_errno, "Error in Create_file event: write to '%s' failed", fname_buf);
goto err;
}
- if (mysql_bin_log.is_open())
- mysql_bin_log.write(this);
error=0; // Everything is ok
err:
@@ -2705,7 +2732,7 @@ err:
my_close(fd, MYF(0));
return error ? 1 : Log_event::exec_event(rli);
}
-#endif
+#endif /* defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) */
/**************************************************************************
@@ -2717,11 +2744,12 @@ err:
*/
#ifndef MYSQL_CLIENT
-Append_block_log_event::Append_block_log_event(THD* thd_arg, char* block_arg,
+Append_block_log_event::Append_block_log_event(THD* thd_arg, const char* db_arg,
+ char* block_arg,
uint block_len_arg,
bool using_trans)
:Log_event(thd_arg,0, using_trans), block(block_arg),
- block_len(block_len_arg), file_id(thd_arg->file_id)
+ block_len(block_len_arg), file_id(thd_arg->file_id), db(db_arg)
{
}
#endif
@@ -2787,7 +2815,7 @@ void Append_block_log_event::pack_info(Protocol *protocol)
block_len));
protocol->store(buf, length, &my_charset_bin);
}
-#endif
+#endif /* defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) */
/*
@@ -2805,16 +2833,14 @@ int Append_block_log_event::exec_event(struct st_relay_log_info* rli)
memcpy(p, ".data", 6);
if ((fd = my_open(fname, O_WRONLY|O_APPEND|O_BINARY, MYF(MY_WME))) < 0)
{
- slave_print_error(rli,my_errno, "Could not open file '%s'", fname);
+ slave_print_error(rli,my_errno, "Error in Append_block event: could not open file '%s'", fname);
goto err;
}
if (my_write(fd, (byte*) block, block_len, MYF(MY_WME+MY_NABP)))
{
- slave_print_error(rli,my_errno, "Write to '%s' failed", fname);
+ slave_print_error(rli,my_errno, "Error in Append_block event: write to '%s' failed", fname);
goto err;
}
- if (mysql_bin_log.is_open())
- mysql_bin_log.write(this);
error=0;
err:
@@ -2834,8 +2860,9 @@ err:
*/
#ifndef MYSQL_CLIENT
-Delete_file_log_event::Delete_file_log_event(THD *thd_arg, bool using_trans)
- :Log_event(thd_arg, 0, using_trans),file_id(thd_arg->file_id)
+Delete_file_log_event::Delete_file_log_event(THD *thd_arg, const char* db_arg,
+ bool using_trans)
+ :Log_event(thd_arg, 0, using_trans), file_id(thd_arg->file_id), db(db_arg)
{
}
#endif
@@ -2908,11 +2935,9 @@ int Delete_file_log_event::exec_event(struct st_relay_log_info* rli)
(void) my_delete(fname, MYF(MY_WME));
memcpy(p, ".info", 6);
(void) my_delete(fname, MYF(MY_WME));
- if (mysql_bin_log.is_open())
- mysql_bin_log.write(this);
return Log_event::exec_event(rli);
}
-#endif
+#endif /* defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) */
/**************************************************************************
@@ -2924,8 +2949,9 @@ int Delete_file_log_event::exec_event(struct st_relay_log_info* rli)
*/
#ifndef MYSQL_CLIENT
-Execute_load_log_event::Execute_load_log_event(THD *thd_arg, bool using_trans)
- :Log_event(thd_arg, 0, using_trans), file_id(thd_arg->file_id)
+Execute_load_log_event::Execute_load_log_event(THD *thd_arg, const char* db_arg,
+ bool using_trans)
+ :Log_event(thd_arg, 0, using_trans), file_id(thd_arg->file_id), db(db_arg)
{
}
#endif
@@ -2997,7 +3023,6 @@ int Execute_load_log_event::exec_event(struct st_relay_log_info* rli)
char *p= slave_load_file_stem(fname, file_id, server_id);
int fd;
int error = 1;
- ulong save_options;
IO_CACHE file;
Load_log_event* lev = 0;
@@ -3006,7 +3031,7 @@ int Execute_load_log_event::exec_event(struct st_relay_log_info* rli)
init_io_cache(&file, fd, IO_SIZE, READ_CACHE, (my_off_t)0, 0,
MYF(MY_WME|MY_NABP)))
{
- slave_print_error(rli,my_errno, "Could not open file '%s'", fname);
+ slave_print_error(rli,my_errno, "Error in Exec_load event: could not open file '%s'", fname);
goto err;
}
if (!(lev = (Load_log_event*)Log_event::read_log_event(&file,
@@ -3014,21 +3039,16 @@ int Execute_load_log_event::exec_event(struct st_relay_log_info* rli)
(bool)0)) ||
lev->get_type_code() != NEW_LOAD_EVENT)
{
- slave_print_error(rli,0, "File '%s' appears corrupted", fname);
+ slave_print_error(rli,0, "Error in Exec_load event: file '%s' appears corrupted", fname);
goto err;
}
- /*
- We are going to create a Load_log_event to finally load into the table.
- This event should not go into the binlog: in the binlog we only want the
- Create_file, Append_blocks and Execute_load. We disable binary logging and
- restore the thread's options just after finishing the load.
- */
- save_options = thd->options;
- thd->options &= ~ (ulong) (OPTION_BIN_LOG);
+
lev->thd = thd;
/*
lev->exec_event should use rli only for errors
- i.e. should not advance rli's position
+ i.e. should not advance rli's position.
+ lev->exec_event is the place where the table is loaded (it calls
+ mysql_load()).
*/
if (lev->exec_event(0,rli,1))
{
@@ -3049,15 +3069,11 @@ int Execute_load_log_event::exec_event(struct st_relay_log_info* rli)
tmp, fname);
my_free(tmp,MYF(0));
}
- thd->options= save_options;
goto err;
}
- thd->options = save_options;
(void) my_delete(fname, MYF(MY_WME));
memcpy(p, ".data", 6);
(void) my_delete(fname, MYF(MY_WME));
- if (mysql_bin_log.is_open())
- mysql_bin_log.write(this);
error = 0;
err:
diff --git a/sql/log_event.h b/sql/log_event.h
index a58479e2589..8ba5d0379a0 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -590,6 +590,7 @@ public:
#endif /* HAVE_REPLICATION */
#else
void print(FILE* file, bool short_form = 0, char* last_db = 0);
+ void print(FILE* file, bool short_form, char* last_db, bool commented);
#endif
Load_log_event(const char* buf, int event_len, bool old_format);
@@ -934,9 +935,20 @@ public:
char* block;
uint block_len;
uint file_id;
-
+ /*
+ 'db' is filled when the event is created in mysql_load() (the event needs to
+ have a 'db' member to be well filtered by binlog-*-db rules). 'db' is not
+ written to the binlog (it's not used by Append_block_log_event::write()), so
+ it can't be read in the Append_block_log_event(const char* buf, int
+ event_len) constructor.
+ In other words, 'db' is used only for filtering by binlog-*-db rules.
+ Create_file_log_event is different: its 'db' (which is inherited from
+ Load_log_event) is written to the binlog and can be re-read.
+ */
+ const char* db;
+
#ifndef MYSQL_CLIENT
- Append_block_log_event(THD* thd, char* block_arg,
+ Append_block_log_event(THD* thd, const char* db_arg, char* block_arg,
uint block_len_arg, bool using_trans);
#ifdef HAVE_REPLICATION
int exec_event(struct st_relay_log_info* rli);
@@ -952,6 +964,7 @@ public:
int get_data_size() { return block_len + APPEND_BLOCK_HEADER_LEN ;}
bool is_valid() { return block != 0; }
int write_data(IO_CACHE* file);
+ const char* get_db() { return db; }
};
/*****************************************************************************
@@ -963,9 +976,10 @@ class Delete_file_log_event: public Log_event
{
public:
uint file_id;
+ const char* db; /* see comment in Append_block_log_event */
#ifndef MYSQL_CLIENT
- Delete_file_log_event(THD* thd, bool using_trans);
+ Delete_file_log_event(THD* thd, const char* db_arg, bool using_trans);
#ifdef HAVE_REPLICATION
void pack_info(Protocol* protocol);
int exec_event(struct st_relay_log_info* rli);
@@ -981,6 +995,7 @@ public:
int get_data_size() { return DELETE_FILE_HEADER_LEN ;}
bool is_valid() { return file_id != 0; }
int write_data(IO_CACHE* file);
+ const char* get_db() { return db; }
};
/*****************************************************************************
@@ -992,9 +1007,10 @@ class Execute_load_log_event: public Log_event
{
public:
uint file_id;
-
+ const char* db; /* see comment in Append_block_log_event */
+
#ifndef MYSQL_CLIENT
- Execute_load_log_event(THD* thd, bool using_trans);
+ Execute_load_log_event(THD* thd, const char* db_arg, bool using_trans);
#ifdef HAVE_REPLICATION
void pack_info(Protocol* protocol);
int exec_event(struct st_relay_log_info* rli);
@@ -1009,6 +1025,7 @@ public:
int get_data_size() { return EXEC_LOAD_HEADER_LEN ;}
bool is_valid() { return file_id != 0; }
int write_data(IO_CACHE* file);
+ const char* get_db() { return db; }
};
#ifdef MYSQL_CLIENT
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 410704313d0..06cee8018f8 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -74,9 +74,6 @@ extern CHARSET_INFO *national_charset_info, *table_alias_charset;
****************************************************************************/
#define ACL_CACHE_SIZE 256
-/* Password lengh for 4.1 version previous versions had 16 bytes password hash */
-#define HASH_PASSWORD_LENGTH 45
-#define HASH_OLD_PASSWORD_LENGTH 16
#define MAX_PASSWORD_LENGTH 32
#define HOST_CACHE_SIZE 128
#define MAX_ACCEPT_RETRY 10 // Test accept this many times
@@ -212,16 +209,17 @@ extern CHARSET_INFO *national_charset_info, *table_alias_charset;
#define MODE_NOT_USED 16
#define MODE_ONLY_FULL_GROUP_BY 32
#define MODE_NO_UNSIGNED_SUBTRACTION 64
-#define MODE_POSTGRESQL 128
-#define MODE_ORACLE 256
-#define MODE_MSSQL 512
-#define MODE_DB2 1024
-#define MODE_SAPDB 2048
-#define MODE_NO_KEY_OPTIONS 4096
-#define MODE_NO_TABLE_OPTIONS 8192
-#define MODE_NO_FIELD_OPTIONS 16384
-#define MODE_MYSQL323 32768
-#define MODE_MYSQL40 65536
+#define MODE_NO_DIR_IN_CREATE 128
+#define MODE_POSTGRESQL 256
+#define MODE_ORACLE 512
+#define MODE_MSSQL 1024
+#define MODE_DB2 2048
+#define MODE_SAPDB 4096
+#define MODE_NO_KEY_OPTIONS 8192
+#define MODE_NO_TABLE_OPTIONS 16384
+#define MODE_NO_FIELD_OPTIONS 32768
+#define MODE_MYSQL323 65536
+#define MODE_MYSQL40 (MODE_MYSQL323*2)
#define MODE_ANSI (MODE_MYSQL40*2)
#define MODE_NO_AUTO_VALUE_ON_ZERO (MODE_ANSI*2)
@@ -395,26 +393,30 @@ bool check_stack_overrun(THD *thd,char *dummy);
#define check_stack_overrun(A, B) 0
#endif
-bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
- bool *write_to_binlog);
void table_cache_init(void);
void table_cache_free(void);
uint cached_tables(void);
-void assign_cache_init(void);
-void assign_cache_free(void);
-void reassign_key_cache(KEY_CACHE_ASMT *key_cache_asmt,
- KEY_CACHE_VAR *new_key_cache);
void kill_mysql(void);
void close_connection(THD *thd, uint errcode, bool lock);
-bool check_access(THD *thd, ulong access, const char *db=0, ulong *save_priv=0,
- bool no_grant=0, bool no_errors=0);
+bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
+ bool *write_to_binlog);
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+bool check_access(THD *thd, ulong access, const char *db, ulong *save_priv,
+ bool no_grant, bool no_errors);
bool check_table_access(THD *thd, ulong want_access, TABLE_LIST *tables,
- bool no_errors=0);
+ bool no_errors);
bool check_global_access(THD *thd, ulong want_access);
+#else
+#define check_access(thd, access, db, save_priv, no_grant, no_errors) false
+#define check_table_access(thd, want_access, tables, no_errors) false
+#define check_global_access(thd, want_access) false
+#endif
int mysql_backup_table(THD* thd, TABLE_LIST* table_list);
int mysql_restore_table(THD* thd, TABLE_LIST* table_list);
+int mysql_checksum_table(THD* thd, TABLE_LIST* table_list,
+ HA_CHECK_OPT* check_opt);
int mysql_check_table(THD* thd, TABLE_LIST* table_list,
HA_CHECK_OPT* check_opt);
int mysql_repair_table(THD* thd, TABLE_LIST* table_list,
@@ -423,10 +425,7 @@ int mysql_analyze_table(THD* thd, TABLE_LIST* table_list,
HA_CHECK_OPT* check_opt);
int mysql_optimize_table(THD* thd, TABLE_LIST* table_list,
HA_CHECK_OPT* check_opt);
-int mysql_assign_to_keycache(THD* thd, TABLE_LIST* table_list);
int mysql_preload_keys(THD* thd, TABLE_LIST* table_list);
-int reassign_keycache_tables(THD* thd, KEY_CACHE_VAR* src_cache,
- char *dest_name, bool remove_fl);
bool check_simple_select();
@@ -565,7 +564,8 @@ void mysqld_list_processes(THD *thd,const char *user,bool verbose);
int mysqld_show_status(THD *thd);
int mysqld_show_variables(THD *thd,const char *wild);
int mysqld_show(THD *thd, const char *wild, show_var_st *variables,
- enum enum_var_type value_type);
+ enum enum_var_type value_type,
+ pthread_mutex_t *mutex);
int mysqld_show_charsets(THD *thd,const char *wild);
int mysqld_show_collations(THD *thd,const char *wild);
int mysqld_show_table_types(THD *thd);
@@ -583,6 +583,7 @@ void mysql_stmt_reset(THD *thd, char *packet);
void mysql_stmt_get_longdata(THD *thd, char *pos, ulong packet_length);
int check_insert_fields(THD *thd,TABLE *table,List<Item> &fields,
List<Item> &values, ulong counter);
+void setup_param_functions(Item_param *param, uchar param_type);
/* sql_error.cc */
MYSQL_ERROR *push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level, uint code,
@@ -604,7 +605,8 @@ void set_item_name(Item *item,char *pos,uint length);
bool add_field_to_list(THD *thd, char *field_name, enum enum_field_types type,
char *length, char *decimal,
uint type_modifier,
- Item *default_value, Item *comment,
+ Item *default_value,
+ LEX_STRING *comment,
char *change, TYPELIB *interval,CHARSET_INFO *cs,
uint uint_geom_type);
void store_position_for_column(const char *name);
@@ -711,6 +713,9 @@ bool open_log(MYSQL_LOG *log, const char *hostname,
enum_log_type type, bool read_append,
bool no_auto_events, ulong max_size);
+/* mysqld.cc */
+extern void yyerror(const char*);
+
/*
External variables
*/
@@ -721,10 +726,10 @@ extern char *mysql_data_home,server_version[SERVER_VERSION_LENGTH],
#define mysql_tmpdir (my_tmpdir(&mysql_tmpdir_list))
extern MY_TMPDIR mysql_tmpdir_list;
extern const char *command_name[];
-extern const char *first_keyword, *localhost, *delayed_user, *binary_keyword;
+extern const char *first_keyword, *my_localhost, *delayed_user, *binary_keyword;
extern const char **errmesg; /* Error messages */
extern const char *myisam_recover_options_str;
-extern const char *in_left_expr_name;
+extern const char *in_left_expr_name, *in_additional_cond;
extern uchar *days_in_month;
extern char language[LIBLEN],reg_ext[FN_EXTLEN];
extern char glob_hostname[FN_REFLEN], mysql_home[FN_REFLEN];
@@ -753,6 +758,7 @@ extern ulong ha_read_first_count, ha_read_last_count;
extern ulong ha_read_rnd_count, ha_read_rnd_next_count;
extern ulong ha_commit_count, ha_rollback_count,table_cache_size;
extern ulong max_connections,max_connect_errors, connect_timeout;
+extern ulong slave_net_timeout;
extern ulong max_insert_delayed_threads, max_user_connections;
extern ulong long_query_count, what_to_log,flush_time;
extern ulong query_buff_size, thread_stack,thread_stack_min;
@@ -778,7 +784,7 @@ extern my_bool opt_safe_show_db, opt_local_infile, lower_case_table_names;
extern my_bool opt_slave_compressed_protocol, use_temp_pool;
extern my_bool opt_readonly;
extern my_bool opt_enable_named_pipe;
-extern my_bool opt_old_passwords, use_old_passwords;
+extern my_bool opt_secure_auth;
extern char *shared_memory_base_name, *mysqld_unix_port;
extern bool opt_enable_shared_memory;
@@ -790,7 +796,7 @@ extern pthread_mutex_t LOCK_mysql_create_db,LOCK_Acl,LOCK_open,
LOCK_error_log, LOCK_delayed_insert,
LOCK_delayed_status, LOCK_delayed_create, LOCK_crypt, LOCK_timezone,
LOCK_slave_list, LOCK_active_mi, LOCK_manager,
- LOCK_global_system_variables, LOCK_assign;
+ LOCK_global_system_variables, LOCK_user_conn;
extern rw_lock_t LOCK_grant;
extern pthread_cond_t COND_refresh, COND_thread_count, COND_manager;
extern pthread_attr_t connection_attrib;
@@ -798,7 +804,8 @@ extern I_List<THD> threads;
extern I_List<NAMED_LIST> key_caches;
extern MY_BITMAP temp_pool;
extern DATE_FORMAT dayord;
-extern String empty_string;
+extern String my_empty_string;
+extern String my_null_string;
extern SHOW_VAR init_vars[],status_vars[], internal_vars[];
extern struct show_table_type_st table_type_vars[];
extern SHOW_COMP_OPTION have_isam;
@@ -807,6 +814,11 @@ extern SHOW_COMP_OPTION have_berkeley_db;
extern struct system_variables global_system_variables;
extern struct system_variables max_system_variables;
extern struct rand_struct sql_rand;
+extern HASH open_cache;
+extern TABLE *unused_tables;
+extern I_List<i_string> binlog_do_db, binlog_ignore_db;
+extern const char* any_db;
+extern struct my_option my_long_options[];
/* optional things, have_* variables */
@@ -941,6 +953,14 @@ bool flush_error_log(void);
void free_list(I_List <i_string_pair> *list);
void free_list(I_List <i_string> *list);
+/* sql_yacc.cc */
+extern int yyparse(void *thd);
+
+/* frm_crypt.cc */
+#ifdef HAVE_CRYPTED_FRM
+SQL_CRYPT *get_crypt_for_frm(void);
+#endif
+
/* Some inline functions for more speed */
inline bool add_item_to_list(THD *thd, Item *item)
@@ -970,6 +990,12 @@ inline void mark_as_null_row(TABLE *table)
bfill(table->null_flags,table->null_bytes,255);
}
+inline void table_case_convert(char * name, uint length)
+{
+ if (lower_case_table_names)
+ my_casedn(files_charset_info, name, length);
+}
+
compare_func_creator comp_eq_creator(bool invert);
compare_func_creator comp_ge_creator(bool invert);
compare_func_creator comp_gt_creator(bool invert);
@@ -986,6 +1012,7 @@ compare_func_creator comp_ne_creator(bool invert);
table_list TABLE_LIST structure pointer (owner of TABLE)
tablenr - table number
*/
+
inline void setup_table_map(TABLE *table, TABLE_LIST *table_list, uint tablenr)
{
table->used_fields= 0;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 0da75c9f64b..65d9c24c683 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -210,6 +210,7 @@ const char *sql_mode_names[] =
{
"REAL_AS_FLOAT", "PIPES_AS_CONCAT", "ANSI_QUOTES", "IGNORE_SPACE",
"?", "ONLY_FULL_GROUP_BY", "NO_UNSIGNED_SUBTRACTION",
+ "NO_DIR_IN_CREATE",
"POSTGRESQL", "ORACLE", "MSSQL", "DB2", "SAPDB", "NO_KEY_OPTIONS",
"NO_TABLE_OPTIONS", "NO_FIELD_OPTIONS", "MYSQL323", "MYSQL40", "ANSI",
"NO_AUTO_VALUE_ON_ZERO", NullS
@@ -217,7 +218,7 @@ const char *sql_mode_names[] =
TYPELIB sql_mode_typelib= { array_elements(sql_mode_names)-1,"",
sql_mode_names };
const char *first_keyword= "first", *binary_keyword= "BINARY";
-const char *localhost= "localhost", *delayed_user= "DELAYED";
+const char *my_localhost= "localhost", *delayed_user= "DELAYED";
#if SIZEOF_OFF_T > 4 && defined(BIG_TABLES)
#define GET_HA_ROWS GET_ULL
#else
@@ -257,9 +258,10 @@ my_bool opt_local_infile, opt_external_locking, opt_slave_compressed_protocol;
my_bool opt_safe_user_create = 0, opt_no_mix_types = 0;
my_bool lower_case_table_names, opt_old_rpl_compat;
my_bool opt_show_slave_auth_info, opt_sql_bin_update = 0;
-my_bool opt_log_slave_updates= 0, opt_old_passwords=0, use_old_passwords=0;
+my_bool opt_log_slave_updates= 0;
my_bool opt_console= 0, opt_bdb, opt_innodb, opt_isam;
my_bool opt_readonly, use_temp_pool, relay_log_purge;
+my_bool opt_secure_auth= 0;
volatile bool mqh_used = 0;
uint mysqld_port, test_flags, select_errors, dropping_tables, ha_open_options;
@@ -317,6 +319,8 @@ const char *myisam_recover_options_str="OFF";
const char *sql_mode_str="OFF";
/* name of reference on left espression in rewritten IN subquery */
const char *in_left_expr_name= "<left expr>";
+/* name of additional condition */
+const char *in_additional_cond= "<IN COND>";
FILE *bootstrap_file;
@@ -361,15 +365,15 @@ pthread_t signal_thread;
pthread_attr_t connection_attrib;
/* replication parameters, if master_host is not NULL, we are a slave */
-my_bool master_ssl;
uint master_port= MYSQL_PORT, master_connect_retry = 60;
uint report_port= MYSQL_PORT;
ulong master_retry_count=0;
char *master_user, *master_password, *master_host, *master_info_file;
-char *relay_log_info_file, *master_ssl_key, *master_ssl_cert;
-char *master_ssl_capath, *master_ssl_cipher, *report_user;
-char *report_password, *report_host;
+char *relay_log_info_file, *report_user, *report_password, *report_host;
char *opt_relay_logname = 0, *opt_relaylog_index_name=0;
+my_bool master_ssl;
+char *master_ssl_key, *master_ssl_cert;
+char *master_ssl_ca, *master_ssl_capath, *master_ssl_cipher;
/* Static variables */
@@ -870,8 +874,10 @@ void clean_up(bool print_message)
if (use_slave_mask)
bitmap_free(&slave_error_mask);
#endif
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
acl_free(1);
grant_free();
+#endif
query_cache_destroy();
table_cache_free();
assign_cache_free();
@@ -1121,7 +1127,14 @@ static void server_init(void)
IPaddr.sin_family = AF_INET;
IPaddr.sin_addr.s_addr = my_bind_addr;
IPaddr.sin_port = (unsigned short) htons((unsigned short) mysqld_port);
+
+#ifndef __WIN__
+ /*
+ We should not use SO_REUSEADDR on windows as this would enable a
+ user to open two mysqld servers with the same TCP/IP port.
+ */
(void) setsockopt(ip_sock,SOL_SOCKET,SO_REUSEADDR,(char*)&arg,sizeof(arg));
+#endif /* __WIN__ */
if (bind(ip_sock, my_reinterpret_cast(struct sockaddr *) (&IPaddr),
sizeof(IPaddr)) < 0)
{
@@ -1664,6 +1677,7 @@ static void init_signals(void)
}
+#ifndef EMBEDDED_LIBRARY
static void start_signal_handler(void)
{
int error;
@@ -1826,6 +1840,7 @@ extern "C" void *signal_hand(void *arg __attribute__((unused)))
}
return(0); /* purecov: deadcode */
}
+#endif /*!EMBEDDED_LIBRARY*/
static void check_data_home(const char *path)
{}
@@ -2053,7 +2068,10 @@ static int init_common_variables(const char *conf_file_name, int argc,
max_connections,table_cache_size));
sql_print_error("Warning: Changed limits: max_connections: %ld table_cache: %ld",max_connections,table_cache_size);
}
+ open_files_limit= files;
}
+#else
+ open_files_limit= 0; /* Can't set or detect limit */
#endif
unireg_init(opt_specialflag); /* Set up extern variabels */
init_errmessage(); /* Read error messages from file */
@@ -2083,11 +2101,11 @@ static int init_common_variables(const char *conf_file_name, int argc,
}
default_charset_info= default_collation;
}
- global_system_variables.character_set_server= default_charset_info;
- global_system_variables.character_set_database= default_charset_info;
+ global_system_variables.collation_server= default_charset_info;
+ global_system_variables.collation_database= default_charset_info;
+ global_system_variables.collation_connection= default_charset_info;
global_system_variables.character_set_results= default_charset_info;
global_system_variables.character_set_client= default_charset_info;
- global_system_variables.collation_connection= default_charset_info;
if (use_temp_pool && bitmap_init(&temp_pool,1024,1))
return 1;
@@ -2222,7 +2240,9 @@ Now disabling --log-slave-updates.");
opt_error_log= 1; // Too long file name
else
{
+#ifndef EMBEDDED_LIBRARY
if (freopen(log_error_file, "a+", stdout))
+#endif
freopen(log_error_file, "a+", stderr);
}
}
@@ -2757,7 +2777,6 @@ static int bootstrap(FILE *file)
{
int error= 0;
DBUG_ENTER("bootstrap");
-#ifndef EMBEDDED_LIBRARY // TODO: Enable this
THD *thd= new THD;
thd->bootstrap=1;
@@ -2769,6 +2788,7 @@ static int bootstrap(FILE *file)
thread_count++;
bootstrap_file=file;
+#ifndef EMBEDDED_LIBRARY // TODO: Enable this
if (pthread_create(&thd->real_id,&connection_attrib,handle_bootstrap,
(void*) thd))
{
@@ -2783,11 +2803,17 @@ static int bootstrap(FILE *file)
DBUG_PRINT("quit",("One thread died (count=%u)",thread_count));
}
(void) pthread_mutex_unlock(&LOCK_thread_count);
+#else
+ thd->mysql= 0;
+ handle_bootstrap((void *)thd);
+#endif
+
error= thd->is_fatal_error;
+#ifndef EMBEDDED_LIBRARY
net_end(&thd->net);
+#endif
thd->cleanup();
delete thd;
-#endif /* EMBEDDED_LIBRARY */
DBUG_RETURN(error);
}
@@ -2827,12 +2853,6 @@ static void create_new_thread(THD *thd)
if (thread_count-delayed_insert_threads > max_used_connections)
max_used_connections=thread_count-delayed_insert_threads;
thd->thread_id=thread_id++;
- for (uint i=0; i < 8 ; i++) // Generate password teststring
- thd->scramble[i]= (char) (my_rnd(&sql_rand)*94+33);
- thd->scramble[8]=0;
- // Back it up as old clients may need it
- memcpy(thd->old_scramble,thd->scramble,9);
-
thd->real_id=pthread_self(); // Keep purify happy
@@ -3111,7 +3131,13 @@ extern "C" pthread_handler_decl(handle_connections_sockets,
continue;
}
if (sock == unix_sock)
- thd->host=(char*) localhost;
+ thd->host=(char*) my_localhost;
+#ifdef __WIN__
+ /* Set default wait_timeout */
+ ulong wait_timeout= global_system_variables.net_wait_timeout * 1000;
+ (void) setsockopt(new_sock, SOL_SOCKET, SO_RCVTIMEO, (char*)&wait_timeout,
+ sizeof(wait_timeout));
+#endif
create_new_thread(thd);
}
@@ -3195,7 +3221,7 @@ extern "C" pthread_handler_decl(handle_connections_namedpipes,arg)
continue;
}
/* host name is unknown */
- thd->host = my_strdup(localhost,MYF(0)); /* Host is unknown */
+ thd->host = my_strdup(my_localhost,MYF(0)); /* Host is unknown */
create_new_thread(thd);
}
@@ -3404,7 +3430,7 @@ errorconn:
if (!event_client_read) CloseHandle(event_client_read);
continue;
}
- thd->host = my_strdup(localhost,MYF(0)); /* Host is unknown */
+ thd->host = my_strdup(my_localhost,MYF(0)); /* Host is unknown */
create_new_thread(thd);
uint4korr(connect_number++);
}
@@ -3453,7 +3479,7 @@ enum options
OPT_MASTER_RETRY_COUNT,
OPT_MASTER_SSL, OPT_MASTER_SSL_KEY,
OPT_MASTER_SSL_CERT, OPT_MASTER_SSL_CAPATH,
- OPT_MASTER_SSL_CIPHER,
+ OPT_MASTER_SSL_CIPHER, OPT_MASTER_SSL_CA,
OPT_SQL_BIN_UPDATE_SAME, OPT_REPLICATE_DO_DB,
OPT_REPLICATE_IGNORE_DB, OPT_LOG_SLAVE_UPDATES,
OPT_BINLOG_DO_DB, OPT_BINLOG_IGNORE_DB,
@@ -3545,7 +3571,8 @@ enum options
OPT_EXPIRE_LOGS_DAYS,
OPT_DEFAULT_WEEK_FORMAT,
OPT_GROUP_CONCAT_MAX_LEN,
- OPT_DEFAULT_COLLATION
+ OPT_DEFAULT_COLLATION,
+ OPT_SECURE_AUTH
};
@@ -3793,31 +3820,32 @@ thread is in the master's binlogs.",
(gptr*) &master_info_file, (gptr*) &master_info_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"master-ssl", OPT_MASTER_SSL,
- "Planned to enable the slave to connect to the master using SSL. Does nothing yet.",
+ "Enable the slave to connect to the master using SSL.",
(gptr*) &master_ssl, (gptr*) &master_ssl, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"master-ssl-key", OPT_MASTER_SSL_KEY,
- "Master SSL keyfile name. Only applies if you have enabled master-ssl. Does \
-nothing yet.",
+ "Master SSL keyfile name. Only applies if you have enabled master-ssl.",
(gptr*) &master_ssl_key, (gptr*) &master_ssl_key, 0, GET_STR, OPT_ARG,
0, 0, 0, 0, 0, 0},
{"master-ssl-cert", OPT_MASTER_SSL_CERT,
"Master SSL certificate file name. Only applies if you have enabled \
-master-ssl. Does nothing yet.",
+master-ssl",
(gptr*) &master_ssl_cert, (gptr*) &master_ssl_cert, 0, GET_STR, OPT_ARG,
0, 0, 0, 0, 0, 0},
+ {"master-ssl-ca", OPT_MASTER_SSL_CA,
+ "Master SSL CA file. Only applies if you have enabled master-ssl.",
+ (gptr*) &master_ssl_ca, (gptr*) &master_ssl_ca, 0, GET_STR, OPT_ARG,
+ 0, 0, 0, 0, 0, 0},
{"master-ssl-capath", OPT_MASTER_SSL_CAPATH,
- "Master SSL CA path. Only applies if you have enabled master-ssl. \
-Does nothing yet.",
+ "Master SSL CA path. Only applies if you have enabled master-ssl.",
(gptr*) &master_ssl_capath, (gptr*) &master_ssl_capath, 0, GET_STR, OPT_ARG,
0, 0, 0, 0, 0, 0},
{"master-ssl-cipher", OPT_MASTER_SSL_CIPHER,
- "Master SSL cipher. Only applies if you have enabled master-ssl. \
-Does nothing yet.",
+ "Master SSL cipher. Only applies if you have enabled master-ssl.",
(gptr*) &master_ssl_cipher, (gptr*) &master_ssl_capath, 0, GET_STR, OPT_ARG,
0, 0, 0, 0, 0, 0},
{"myisam-recover", OPT_MYISAM_RECOVER,
- "Syntax: myisam-recover[=option[,option...]], where option can be DEFAULT, BACKUP or FORCE.",
+ "Syntax: myisam-recover[=option[,option...]], where option can be DEFAULT, BACKUP, FORCE or QUICK.",
(gptr*) &myisam_recover_options_str, (gptr*) &myisam_recover_options_str, 0,
GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"memlock", OPT_MEMLOCK, "Lock mysqld in memory.", (gptr*) &locked_in_memory,
@@ -3854,9 +3882,10 @@ Does nothing yet.",
(gptr*) &opt_no_mix_types, (gptr*) &opt_no_mix_types, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
#endif
- {"old-protocol", 'o', "Use the old (3.20) protocol client/server protocol.",
- (gptr*) &protocol_version, (gptr*) &protocol_version, 0, GET_UINT, NO_ARG,
- PROTOCOL_VERSION, 0, 0, 0, 0, 0},
+ {"old-passwords", OPT_OLD_PASSWORDS, "Use old password encryption method (needed for 4.0 and older clients).",
+ (gptr*) &global_system_variables.old_passwords,
+ (gptr*) &max_system_variables.old_passwords, 0, GET_BOOL, NO_ARG,
+ 0, 0, 0, 0, 0, 0},
{"old-rpl-compat", OPT_OLD_RPL_COMPAT,
"Use old LOAD DATA format in the binary log (don't save data in file).",
(gptr*) &opt_old_rpl_compat, (gptr*) &opt_old_rpl_compat, 0, GET_BOOL,
@@ -3923,8 +3952,6 @@ relay logs.",
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"safe-mode", OPT_SAFE, "Skip some optimize stages (for testing).",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"old-passwords", OPT_OLD_PASSWORDS, "Use old password encryption method (needed for 4.0 and older clients).",
- (gptr*) &opt_old_passwords, (gptr*) &opt_old_passwords, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifndef TO_BE_DELETED
{"safe-show-database", OPT_SAFE_SHOW_DB,
"Deprecated option; One should use GRANT SHOW DATABASES instead...",
@@ -3934,6 +3961,9 @@ relay logs.",
"Don't allow new user creation by the user who has no write privileges to the mysql.user table.",
(gptr*) &opt_safe_user_create, (gptr*) &opt_safe_user_create, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"secure-auth", OPT_SECURE_AUTH, "Disallow authentication for accounts that have old (pre-4.1) passwords.",
+ (gptr*) &opt_secure_auth, (gptr*) &opt_secure_auth, 0, GET_BOOL, NO_ARG,
+ my_bool(0), 0, 0, 0, 0, 0},
{"server-id", OPT_SERVER_ID,
"Uniquely identifies the server instance in the community of replication partners.",
(gptr*) &server_id, (gptr*) &server_id, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 0,
@@ -4222,7 +4252,7 @@ replicating a LOAD DATA INFILE command.",
"Max packetlength to send/receive from to server.",
(gptr*) &global_system_variables.max_allowed_packet,
(gptr*) &max_system_variables.max_allowed_packet, 0, GET_ULONG,
- REQUIRED_ARG, 1024*1024L, 80, 1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0},
+ REQUIRED_ARG, 1024*1024L, 1024, 1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0},
{"max_binlog_cache_size", OPT_MAX_BINLOG_CACHE_SIZE,
"Can be used to restrict the total size used to cache a multi-transaction query.",
(gptr*) &max_binlog_cache_size, (gptr*) &max_binlog_cache_size, 0,
@@ -4478,14 +4508,15 @@ struct show_var_st status_vars[]= {
{"Bytes_received", (char*) &bytes_received, SHOW_LONG},
{"Bytes_sent", (char*) &bytes_sent, SHOW_LONG},
{"Com_admin_commands", (char*) &com_other, SHOW_LONG},
- {"Com_alter_table", (char*) (com_stat+(uint) SQLCOM_ALTER_TABLE),SHOW_LONG},
{"Com_alter_db", (char*) (com_stat+(uint) SQLCOM_ALTER_DB),SHOW_LONG},
+ {"Com_alter_table", (char*) (com_stat+(uint) SQLCOM_ALTER_TABLE),SHOW_LONG},
{"Com_analyze", (char*) (com_stat+(uint) SQLCOM_ANALYZE),SHOW_LONG},
{"Com_backup_table", (char*) (com_stat+(uint) SQLCOM_BACKUP_TABLE),SHOW_LONG},
{"Com_begin", (char*) (com_stat+(uint) SQLCOM_BEGIN),SHOW_LONG},
{"Com_change_db", (char*) (com_stat+(uint) SQLCOM_CHANGE_DB),SHOW_LONG},
{"Com_change_master", (char*) (com_stat+(uint) SQLCOM_CHANGE_MASTER),SHOW_LONG},
{"Com_check", (char*) (com_stat+(uint) SQLCOM_CHECK),SHOW_LONG},
+ {"Com_checksum", (char*) (com_stat+(uint) SQLCOM_CHECKSUM),SHOW_LONG},
{"Com_commit", (char*) (com_stat+(uint) SQLCOM_COMMIT),SHOW_LONG},
{"Com_create_db", (char*) (com_stat+(uint) SQLCOM_CREATE_DB),SHOW_LONG},
{"Com_create_function", (char*) (com_stat+(uint) SQLCOM_CREATE_FUNCTION),SHOW_LONG},
@@ -4498,6 +4529,7 @@ struct show_var_st status_vars[]= {
{"Com_drop_function", (char*) (com_stat+(uint) SQLCOM_DROP_FUNCTION),SHOW_LONG},
{"Com_drop_index", (char*) (com_stat+(uint) SQLCOM_DROP_INDEX),SHOW_LONG},
{"Com_drop_table", (char*) (com_stat+(uint) SQLCOM_DROP_TABLE),SHOW_LONG},
+ {"Com_drop_user", (char*) (com_stat+(uint) SQLCOM_DROP_USER),SHOW_LONG},
{"Com_flush", (char*) (com_stat+(uint) SQLCOM_FLUSH),SHOW_LONG},
{"Com_grant", (char*) (com_stat+(uint) SQLCOM_GRANT),SHOW_LONG},
{"Com_ha_close", (char*) (com_stat+(uint) SQLCOM_HA_CLOSE),SHOW_LONG},
@@ -4512,6 +4544,7 @@ struct show_var_st status_vars[]= {
{"Com_load_master_table", (char*) (com_stat+(uint) SQLCOM_LOAD_MASTER_TABLE),SHOW_LONG},
{"Com_lock_tables", (char*) (com_stat+(uint) SQLCOM_LOCK_TABLES),SHOW_LONG},
{"Com_optimize", (char*) (com_stat+(uint) SQLCOM_OPTIMIZE),SHOW_LONG},
+ {"Com_preload_keys", (char*) (com_stat+(uint) SQLCOM_PRELOAD_KEYS),SHOW_LONG},
{"Com_purge", (char*) (com_stat+(uint) SQLCOM_PURGE),SHOW_LONG},
{"Com_purge_before_date", (char*) (com_stat+(uint) SQLCOM_PURGE_BEFORE),SHOW_LONG},
{"Com_rename_table", (char*) (com_stat+(uint) SQLCOM_RENAME_TABLE),SHOW_LONG},
@@ -4521,13 +4554,15 @@ struct show_var_st status_vars[]= {
{"Com_reset", (char*) (com_stat+(uint) SQLCOM_RESET),SHOW_LONG},
{"Com_restore_table", (char*) (com_stat+(uint) SQLCOM_RESTORE_TABLE),SHOW_LONG},
{"Com_revoke", (char*) (com_stat+(uint) SQLCOM_REVOKE),SHOW_LONG},
+ {"Com_revoke_all", (char*) (com_stat+(uint) SQLCOM_REVOKE_ALL),SHOW_LONG},
{"Com_rollback", (char*) (com_stat+(uint) SQLCOM_ROLLBACK),SHOW_LONG},
{"Com_savepoint", (char*) (com_stat+(uint) SQLCOM_SAVEPOINT),SHOW_LONG},
{"Com_select", (char*) (com_stat+(uint) SQLCOM_SELECT),SHOW_LONG},
{"Com_set_option", (char*) (com_stat+(uint) SQLCOM_SET_OPTION),SHOW_LONG},
- {"Com_show_binlog_events", (char*) (com_stat+(uint) SQLCOM_SHOW_BINLOG_EVENTS),SHOW_LONG},
{"Com_show_binlogs", (char*) (com_stat+(uint) SQLCOM_SHOW_BINLOGS),SHOW_LONG},
+ {"Com_show_binlog_events", (char*) (com_stat+(uint) SQLCOM_SHOW_BINLOG_EVENTS),SHOW_LONG},
{"Com_show_charsets", (char*) (com_stat+(uint) SQLCOM_SHOW_CHARSETS),SHOW_LONG},
+ {"Com_show_collations", (char*) (com_stat+(uint) SQLCOM_SHOW_COLLATIONS),SHOW_LONG},
{"Com_show_column_types", (char*) (com_stat+(uint) SQLCOM_SHOW_COLUMN_TYPES),SHOW_LONG},
{"Com_show_create_table", (char*) (com_stat+(uint) SQLCOM_SHOW_CREATE),SHOW_LONG},
{"Com_show_create_db", (char*) (com_stat+(uint) SQLCOM_SHOW_CREATE_DB),SHOW_LONG},
@@ -4535,6 +4570,7 @@ struct show_var_st status_vars[]= {
{"Com_show_errors", (char*) (com_stat+(uint) SQLCOM_SHOW_ERRORS),SHOW_LONG},
{"Com_show_fields", (char*) (com_stat+(uint) SQLCOM_SHOW_FIELDS),SHOW_LONG},
{"Com_show_grants", (char*) (com_stat+(uint) SQLCOM_SHOW_GRANTS),SHOW_LONG},
+ {"Com_show_innodb_status", (char*) (com_stat+(uint) SQLCOM_SHOW_INNODB_STATUS),SHOW_LONG},
{"Com_show_keys", (char*) (com_stat+(uint) SQLCOM_SHOW_KEYS),SHOW_LONG},
{"Com_show_logs", (char*) (com_stat+(uint) SQLCOM_SHOW_LOGS),SHOW_LONG},
{"Com_show_master_status", (char*) (com_stat+(uint) SQLCOM_SHOW_MASTER_STAT),SHOW_LONG},
@@ -4545,7 +4581,6 @@ struct show_var_st status_vars[]= {
{"Com_show_slave_hosts", (char*) (com_stat+(uint) SQLCOM_SHOW_SLAVE_HOSTS),SHOW_LONG},
{"Com_show_slave_status", (char*) (com_stat+(uint) SQLCOM_SHOW_SLAVE_STAT),SHOW_LONG},
{"Com_show_status", (char*) (com_stat+(uint) SQLCOM_SHOW_STATUS),SHOW_LONG},
- {"Com_show_innodb_status", (char*) (com_stat+(uint) SQLCOM_SHOW_INNODB_STATUS),SHOW_LONG},
{"Com_show_tables", (char*) (com_stat+(uint) SQLCOM_SHOW_TABLES),SHOW_LONG},
{"Com_show_table_types", (char*) (com_stat+(uint) SQLCOM_SHOW_TABLE_TYPES),SHOW_LONG},
{"Com_show_variables", (char*) (com_stat+(uint) SQLCOM_SHOW_VARIABLES),SHOW_LONG},
@@ -4740,7 +4775,8 @@ static void mysql_init_variables(void)
opt_log= opt_update_log= opt_bin_log= opt_slow_log= 0;
opt_disable_networking= opt_skip_show_db=0;
opt_logname= opt_update_logname= opt_binlog_index_name= opt_slow_logname=0;
- opt_bootstrap= opt_myisam_log= use_old_passwords= 0;
+ opt_secure_auth= 0;
+ opt_bootstrap= opt_myisam_log= 0;
mqh_used= 0;
segfaulted= kill_in_progress= 0;
cleanup_done= 0;
@@ -4820,8 +4856,9 @@ static void mysql_init_variables(void)
master_user= (char*) "test";
master_password= master_host= 0;
master_info_file= (char*) "master.info",
- relay_log_info_file= (char*) "relay-log.info",
- master_ssl_key= master_ssl_cert= master_ssl_capath= master_ssl_cipher= 0;
+ relay_log_info_file= (char*) "relay-log.info";
+ master_ssl_key= master_ssl_cert= master_ssl_ca=
+ master_ssl_capath= master_ssl_cipher= 0;
report_user= report_password = report_host= 0; /* TO BE DELETED */
opt_relay_logname= opt_relaylog_index_name= 0;
@@ -4833,17 +4870,18 @@ static void mysql_init_variables(void)
/* Set default values for some option variables */
- global_system_variables.character_set_server= default_charset_info;
- global_system_variables.character_set_database= default_charset_info;
+ global_system_variables.collation_server= default_charset_info;
+ global_system_variables.collation_database= default_charset_info;
+ global_system_variables.collation_connection= default_charset_info;
global_system_variables.character_set_results= default_charset_info;
global_system_variables.character_set_client= default_charset_info;
- global_system_variables.collation_connection= default_charset_info;
global_system_variables.table_type= DB_TYPE_MYISAM;
global_system_variables.tx_isolation= ISO_REPEATABLE_READ;
global_system_variables.select_limit= (ulonglong) HA_POS_ERROR;
max_system_variables.select_limit= (ulonglong) HA_POS_ERROR;
global_system_variables.max_join_size= (ulonglong) HA_POS_ERROR;
max_system_variables.max_join_size= (ulonglong) HA_POS_ERROR;
+ global_system_variables.old_passwords= 0;
/* Variables that depends on compile options */
#ifndef DBUG_OFF
@@ -4965,9 +5003,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case 'L':
strmake(language, argument, sizeof(language)-1);
break;
- case 'o':
- protocol_version=PROTOCOL_VERSION-1;
- break;
#ifdef HAVE_REPLICATION
case OPT_SLAVE_SKIP_ERRORS:
init_slave_skip_errors(argument);
@@ -5190,11 +5225,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
my_use_symdir=0;
break;
case (int) OPT_BIND_ADDRESS:
- if (argument && my_isdigit(mysqld_charset, argument[0]))
- {
- my_bind_addr = (ulong) inet_addr(argument);
- }
- else
+ if (!argument || (my_bind_addr= (ulong) inet_addr(argument)) == INADDR_NONE)
{
struct hostent *ent;
if (argument || argument[0])
@@ -5603,6 +5634,19 @@ static void fix_paths(void)
}
+/*
+ set how many open files we want to be able to handle
+
+ SYNOPSIS
+ set_maximum_open_files()
+ max_file_limit Files to open
+
+ NOTES
+ The request may not fulfilled becasue of system limitations
+
+ RETURN
+ Files available to open
+*/
#ifdef SET_RLIMIT_NOFILE
static uint set_maximum_open_files(uint max_file_limit)
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index f12705572d6..7944a528b83 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -88,10 +88,15 @@ void sql_print_error(const char *format,...);
#ifdef MYSQL_SERVER
#define USE_QUERY_CACHE
+/*
+ The following variables/functions should really not be declared
+ extern, but as it's hard to include mysql_priv.h here, we have to
+ live with this for a while.
+*/
extern uint test_flags;
-extern void query_cache_insert(NET *net, const char *packet, ulong length);
extern ulong bytes_sent, bytes_received, net_big_packet_count;
extern pthread_mutex_t LOCK_bytes_sent , LOCK_bytes_received;
+extern void query_cache_insert(NET *net, const char *packet, ulong length);
#else
#undef statistic_add
#undef statistic_increment
@@ -240,10 +245,12 @@ my_bool net_flush(NET *net)
*****************************************************************************/
/*
-** Write a logical packet with packet header
-** Format: Packet length (3 bytes), packet number(1 byte)
-** When compression is used a 3 byte compression length is added
-** NOTE: If compression is used the original package is modified!
+ Write a logical packet with packet header
+ Format: Packet length (3 bytes), packet number(1 byte)
+ When compression is used a 3 byte compression length is added
+
+ NOTE
+ If compression is used the original package is modified!
*/
my_bool
@@ -364,8 +371,8 @@ net_write_command(NET *net,uchar command,
The cached buffer can be sent as it is with 'net_flush()'.
In this code we have to be careful to not send a packet longer than
- MAX_PACKET_LENGTH to net_real_write() if we are using the compressed protocol
- as we store the length of the compressed packet in 3 bytes.
+ MAX_PACKET_LENGTH to net_real_write() if we are using the compressed
+ protocol as we store the length of the compressed packet in 3 bytes.
RETURN
0 ok
@@ -458,7 +465,7 @@ net_real_write(NET *net,const char *packet,ulong len)
#ifdef MYSQL_SERVER
net->last_errno= ER_OUT_OF_RESOURCES;
net->error= 2;
- //TODO is it needed to set this variable if we have no socket
+ /* TODO is it needed to set this variable if we have no socket */
net->report_error= 1;
#endif
net->reading_or_writing= 0;
@@ -483,6 +490,7 @@ net_real_write(NET *net,const char *packet,ulong len)
thr_alarm(&alarmed,(uint) net->write_timeout,&alarm_buff);
#else
alarmed=0;
+ vio_timeout(net->vio, net->write_timeout);
#endif /* NO_ALARM */
pos=(char*) packet; end=pos+len;
@@ -674,6 +682,8 @@ my_real_read(NET *net, ulong *complen)
#ifndef NO_ALARM
if (net_blocking)
thr_alarm(&alarmed,net->read_timeout,&alarm_buff);
+#else
+ vio_timeout(net->vio, net->read_timeout);
#endif /* NO_ALARM */
pos = net->buff + net->where_b; /* net->packet -4 */
@@ -877,20 +887,23 @@ my_net_read(NET *net)
{
/* We are using the compressed protocol */
- ulong buf_length= net->buf_length;
- ulong start_of_packet= net->buf_length - net->remain_in_buf;
- ulong first_packet_offset=start_of_packet;
+ ulong buf_length;
+ ulong start_of_packet;
+ ulong first_packet_offset;
uint read_length, multi_byte_packet=0;
if (net->remain_in_buf)
{
+ buf_length= net->buf_length; /* Data left in old packet */
+ first_packet_offset= start_of_packet= (net->buf_length -
+ net->remain_in_buf);
/* Restore the character that was overwritten by the end 0 */
- net->buff[start_of_packet]=net->save_char;
+ net->buff[start_of_packet]= net->save_char;
}
else
{
/* reuse buffer, as there is nothing in it that we need */
- buf_length=start_of_packet=first_packet_offset=0;
+ buf_length= start_of_packet= first_packet_offset= 0;
}
for (;;)
{
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 8720603f3f9..5b1e2c98001 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -341,8 +341,8 @@ SQL_SELECT *make_select(TABLE *head, table_map const_tables,
DBUG_RETURN(0);
if (!(select= new SQL_SELECT))
{
- *error= 1;
- DBUG_RETURN(0); /* purecov: inspected */
+ *error= 1; // out of memory
+ DBUG_RETURN(0); /* purecov: inspected */
}
select->read_tables=read_tables;
select->const_tables=const_tables;
@@ -456,15 +456,17 @@ SEL_ARG *SEL_ARG::clone(SEL_ARG *new_parent,SEL_ARG **next_arg)
SEL_ARG *tmp;
if (type != KEY_RANGE)
{
- tmp=new SEL_ARG(type);
+ if(!(tmp=new SEL_ARG(type)))
+ return 0; // out of memory
tmp->prev= *next_arg; // Link into next/prev chain
(*next_arg)->next=tmp;
(*next_arg)= tmp;
}
else
{
- tmp=new SEL_ARG(field,part, min_value,max_value,
- min_flag, max_flag, maybe_flag);
+ if(!(tmp=new SEL_ARG(field,part, min_value,max_value,
+ min_flag, max_flag, maybe_flag)))
+ return 0; // out of memory
tmp->parent=new_parent;
tmp->next_key_part=next_key_part;
if (left != &null_element)
@@ -616,6 +618,7 @@ int SQL_SELECT::test_quick_select(key_map keys_to_use, table_map prev_tables,
SEL_TREE *tree;
KEY_PART *key_parts;
PARAM param;
+ THD *thd= current_thd;
/* set up parameter that is passed to all functions */
param.baseflag=basflag;
@@ -626,13 +629,13 @@ int SQL_SELECT::test_quick_select(key_map keys_to_use, table_map prev_tables,
param.keys=0;
param.mem_root= &alloc;
- current_thd->no_errors=1; // Don't warn about NULL
+ thd->no_errors=1; // Don't warn about NULL
init_sql_alloc(&alloc,2048,0);
if (!(param.key_parts = (KEY_PART*) alloc_root(&alloc,
sizeof(KEY_PART)*
head->key_parts)))
{
- current_thd->no_errors=0;
+ thd->no_errors=0;
free_root(&alloc,MYF(0)); // Return memory & allocator
DBUG_RETURN(0); // Can't use range
}
@@ -689,7 +692,7 @@ int SQL_SELECT::test_quick_select(key_map keys_to_use, table_map prev_tables,
uint keynr= param.real_keynr[idx];
if ((*key)->type == SEL_ARG::MAYBE_KEY ||
(*key)->maybe_flag)
- needed_reg|= (key_map) 1 << keynr;
+ needed_reg|= (key_map) 1 << keynr;
found_records=check_quick_select(&param, idx, *key);
if (found_records != HA_POS_ERROR && found_records > 2 &&
@@ -713,7 +716,7 @@ int SQL_SELECT::test_quick_select(key_map keys_to_use, table_map prev_tables,
param.range_count,
found_records)+
(double) found_records / TIME_FOR_COMPARE);
- if (read_time > found_read_time)
+ if (read_time > found_read_time && found_records != HA_POS_ERROR)
{
read_time=found_read_time;
records=found_records;
@@ -734,7 +737,7 @@ int SQL_SELECT::test_quick_select(key_map keys_to_use, table_map prev_tables,
}
free_root(&alloc,MYF(0)); // Return memory & allocator
my_pthread_setspecific_ptr(THR_MALLOC,old_root);
- current_thd->no_errors=0;
+ thd->no_errors=0;
}
DBUG_EXECUTE("info",print_quick(quick,needed_reg););
/*
@@ -762,6 +765,8 @@ static SEL_TREE *get_mm_tree(PARAM *param,COND *cond)
while ((item=li++))
{
SEL_TREE *new_tree=get_mm_tree(param,item);
+ if (current_thd->is_fatal_error)
+ DBUG_RETURN(0); // out of memory
tree=tree_and(param,tree,new_tree);
if (tree && tree->type == SEL_TREE::IMPOSSIBLE)
break;
@@ -777,7 +782,7 @@ static SEL_TREE *get_mm_tree(PARAM *param,COND *cond)
{
SEL_TREE *new_tree=get_mm_tree(param,item);
if (!new_tree)
- DBUG_RETURN(0);
+ DBUG_RETURN(0); // out of memory
tree=tree_or(param,tree,new_tree);
if (!tree || tree->type == SEL_TREE::ALWAYS)
break;
@@ -793,18 +798,16 @@ static SEL_TREE *get_mm_tree(PARAM *param,COND *cond)
DBUG_RETURN(new SEL_TREE(SEL_TREE::ALWAYS));
DBUG_RETURN(new SEL_TREE(SEL_TREE::IMPOSSIBLE));
}
+
table_map ref_tables=cond->used_tables();
- if (ref_tables & ~(param->prev_tables | param->read_tables |
- param->current_table))
- DBUG_RETURN(0); // Can't be calculated yet
if (cond->type() != Item::FUNC_ITEM)
{ // Should be a field
- if (ref_tables & param->current_table)
+ if ((ref_tables & param->current_table) ||
+ (ref_tables & ~(param->prev_tables | param->read_tables)))
DBUG_RETURN(0);
DBUG_RETURN(new SEL_TREE(SEL_TREE::MAYBE));
}
- if (!(ref_tables & param->current_table))
- DBUG_RETURN(new SEL_TREE(SEL_TREE::MAYBE)); // This may be false or true
+
Item_func *cond_func= (Item_func*) cond;
if (cond_func->select_optimize() == Item_func::OPTIMIZE_NONE)
DBUG_RETURN(0); // Can't be calculated
@@ -815,12 +818,13 @@ static SEL_TREE *get_mm_tree(PARAM *param,COND *cond)
{
Field *field=((Item_field*) (cond_func->arguments()[0]))->field;
Item_result cmp_type=field->cmp_type();
- tree= get_mm_parts(param,field,Item_func::GE_FUNC,
- cond_func->arguments()[1],cmp_type);
- DBUG_RETURN(tree_and(param,tree,
+ DBUG_RETURN(tree_and(param,
+ get_mm_parts(param, field,
+ Item_func::GE_FUNC,
+ cond_func->arguments()[1], cmp_type),
get_mm_parts(param, field,
Item_func::LE_FUNC,
- cond_func->arguments()[2],cmp_type)));
+ cond_func->arguments()[2], cmp_type)));
}
DBUG_RETURN(0);
}
@@ -846,6 +850,12 @@ static SEL_TREE *get_mm_tree(PARAM *param,COND *cond)
DBUG_RETURN(0); // Can't optimize this IN
}
+ if (ref_tables & ~(param->prev_tables | param->read_tables |
+ param->current_table))
+ DBUG_RETURN(0); // Can't be calculated yet
+ if (!(ref_tables & param->current_table))
+ DBUG_RETURN(new SEL_TREE(SEL_TREE::MAYBE)); // This may be false or true
+
/* check field op const */
/* btw, ft_func's arguments()[0] isn't FIELD_ITEM. SerG*/
if (cond_func->arguments()[0]->type() == Item::FIELD_ITEM)
@@ -877,21 +887,15 @@ static SEL_TREE *get_mm_tree(PARAM *param,COND *cond)
static SEL_TREE *
-get_mm_parts(PARAM *param,Field *field, Item_func::Functype type,Item *value,
- Item_result cmp_type)
+get_mm_parts(PARAM *param, Field *field, Item_func::Functype type,
+ Item *value, Item_result cmp_type)
{
- bool ne_func= FALSE;
DBUG_ENTER("get_mm_parts");
if (field->table != param->table)
DBUG_RETURN(0);
- if (type == Item_func::NE_FUNC)
- {
- ne_func= TRUE;
- type= Item_func::LT_FUNC;
- }
-
- KEY_PART *key_part = param->key_parts,*end=param->key_parts_end;
+ KEY_PART *key_part = param->key_parts;
+ KEY_PART *end = param->key_parts_end;
SEL_TREE *tree=0;
if (value &&
value->used_tables() & ~(param->prev_tables | param->read_tables))
@@ -901,8 +905,8 @@ get_mm_parts(PARAM *param,Field *field, Item_func::Functype type,Item *value,
if (field->eq(key_part->field))
{
SEL_ARG *sel_arg=0;
- if (!tree)
- tree=new SEL_TREE();
+ if (!tree && !(tree=new SEL_TREE()))
+ DBUG_RETURN(0); // out of memory
if (!value || !(value->used_tables() & ~param->read_tables))
{
sel_arg=get_mm_leaf(param,key_part->field,key_part,type,value);
@@ -914,20 +918,15 @@ get_mm_parts(PARAM *param,Field *field, Item_func::Functype type,Item *value,
DBUG_RETURN(tree);
}
}
- else
- sel_arg=new SEL_ARG(SEL_ARG::MAYBE_KEY);// This key may be used later
+ else {
+ // This key may be used later
+ if(!(sel_arg=new SEL_ARG(SEL_ARG::MAYBE_KEY)))
+ DBUG_RETURN(0); // out of memory
+ }
sel_arg->part=(uchar) key_part->part;
tree->keys[key_part->key]=sel_add(tree->keys[key_part->key],sel_arg);
}
}
-
- if (ne_func)
- {
- SEL_TREE *tree2= get_mm_parts(param, field, Item_func::GT_FUNC,
- value, cmp_type);
- if (tree2)
- tree= tree=tree_or(param,tree,tree2);
- }
DBUG_RETURN(tree);
}
@@ -1010,9 +1009,8 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part,
DBUG_RETURN(0);
if (!maybe_null) // Not null field
DBUG_RETURN(type == Item_func::ISNULL_FUNC ? &null_element : 0);
- tree=new SEL_ARG(field,is_null_string,is_null_string);
- if (!tree)
- DBUG_RETURN(0);
+ if (!(tree=new SEL_ARG(field,is_null_string,is_null_string)))
+ DBUG_RETURN(0); // out of memory
if (type == Item_func::ISNOTNULL_FUNC)
{
tree->min_flag=NEAR_MIN; /* IS NOT NULL -> X > NULL */
@@ -1050,7 +1048,7 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part,
field->get_key_image(str+maybe_null,key_part->part_length,
field->charset(),key_part->image_type);
if (!(tree=new SEL_ARG(field,str,str)))
- DBUG_RETURN(0);
+ DBUG_RETURN(0); // out of memory
switch (type) {
case Item_func::LT_FUNC:
@@ -1490,7 +1488,8 @@ key_or(SEL_ARG *key1,SEL_ARG *key2)
SEL_ARG *key2_next=key2->next;
if (key2_shared)
{
- key2=new SEL_ARG(*key2);
+ if(!(key2=new SEL_ARG(*key2)))
+ return 0; // out of memory
key2->increment_use_count(key1->use_count+1);
key2->next=key2_next; // New copy of key2
}
@@ -2334,16 +2333,16 @@ get_quick_keys(PARAM *param,QUICK_SELECT *quick,KEY_PART *key,
}
/* Get range for retrieving rows in QUICK_SELECT::get_next */
- range= new QUICK_RANGE(param->min_key,
- (uint) (tmp_min_key - param->min_key),
- param->max_key,
- (uint) (tmp_max_key - param->max_key),
- flag);
+ if(!(range= new QUICK_RANGE(param->min_key,
+ (uint) (tmp_min_key - param->min_key),
+ param->max_key,
+ (uint) (tmp_max_key - param->max_key),
+ flag)))
+ return 1; // out of memory
+
set_if_bigger(quick->max_used_key_length,range->min_length);
set_if_bigger(quick->max_used_key_length,range->max_length);
set_if_bigger(quick->used_key_parts, (uint) key_tree->part+1);
- if (!range) // Not enough memory
- return 1;
quick->ranges.push_back(range);
end:
@@ -2404,17 +2403,17 @@ QUICK_SELECT *get_quick_select_for_ref(TABLE *table, TABLE_REF *ref)
uint part;
if (!quick)
- return 0;
+ return 0; /* no ranges found */
if (cp_buffer_from_ref(ref))
{
if (current_thd->is_fatal_error)
- return 0; // End of memory
+ return 0; // out of memory
return quick; // empty range
}
QUICK_RANGE *range= new QUICK_RANGE();
if (!range)
- goto err;
+ goto err; // out of memory
range->min_key=range->max_key=(char*) ref->key_buff;
range->min_length=range->max_length=ref->key_length;
diff --git a/sql/password.c b/sql/password.c
index 257547671e5..9f4910d8c60 100644
--- a/sql/password.c
+++ b/sql/password.c
@@ -29,28 +29,33 @@
The password is saved (in user.password) by using the PASSWORD() function in
mysql.
+ This is .c file because it's used in libmysqlclient, which is entirely in C.
+ (we need it to be portable to a variety of systems).
Example:
update user set password=PASSWORD("hello") where user="test"
This saves a hashed number as a string in the password field.
+ The new autentication is performed in following manner:
- New in MySQL 4.1 authentication works even more secure way.
- At the first step client sends user name to the sever, and password if
- it is empty. So in case of empty password authentication is as fast as before.
- At the second stap servers sends scramble to client, which is encoded with
- password stage2 hash stored in the password database as well as salt, needed
- for client to build stage2 password to decrypt scramble.
- Client decrypts the scramble and encrypts it once again with stage1 password.
- This information is sent to server.
- Server decrypts the scramble to get stage1 password and hashes it to get
- stage2 hash. This hash is when compared to hash stored in the database.
+ SERVER: public_seed=create_random_string()
+ send(public_seed)
- This authentication needs 2 packet round trips instead of one but it is much
- stronger. Now if one will steal mysql database content he will not be able
- to break into MySQL.
+ CLIENT: recv(public_seed)
+ hash_stage1=sha1("password")
+ hash_stage2=sha1(hash_stage1)
+ reply=xor(hash_stage1, sha1(public_seed,hash_stage2)
- New Password handling functions by Peter Zaitsev
+ // this three steps are done in scramble()
+ send(reply)
+
+
+ SERVER: recv(reply)
+ hash_stage1=xor(reply, sha1(public_seed,hash_stage2))
+ candidate_hash2=sha1(hash_stage1)
+ check(candidate_hash2==hash_stage2)
+
+ // this three steps are done in check_scramble()
*****************************************************************************/
@@ -60,31 +65,21 @@
#include <sha1.h>
#include "mysql.h"
-
-
-/* Character to use as version identifier for version 4.1 */
-#define PVERSION41_CHAR '*'
-
-/* Scramble length for new password version */
-
+/************ MySQL 3.23-4.0 authentification routines: untouched ***********/
/*
New (MySQL 3.21+) random generation structure initialization
-
SYNOPSIS
randominit()
rand_st OUT Structure to initialize
seed1 IN First initialization parameter
seed2 IN Second initialization parameter
-
- RETURN
- none
*/
-void randominit(struct rand_struct *rand_st,ulong seed1, ulong seed2)
-{ /* For mysql 3.21.# */
+void randominit(struct rand_struct *rand_st, ulong seed1, ulong seed2)
+{ /* For mysql 3.21.# */
#ifdef HAVE_purify
- bzero((char*) rand_st,sizeof(*rand_st)); /* Avoid UMC varnings */
+ bzero((char*) rand_st,sizeof(*rand_st)); /* Avoid UMC varnings */
#endif
rand_st->max_value= 0x3FFFFFFFL;
rand_st->max_value_dbl=(double) rand_st->max_value;
@@ -94,35 +89,12 @@ void randominit(struct rand_struct *rand_st,ulong seed1, ulong seed2)
/*
- Old (MySQL 3.20) random generation structure initialization
-
- SYNOPSIS
- old_randominit()
- rand_st OUT Structure to initialize
- seed1 IN First initialization parameter
-
- RETURN
- none
-*/
-
-static void old_randominit(struct rand_struct *rand_st,ulong seed1)
-{ /* For mysql 3.20.# */
- rand_st->max_value= 0x01FFFFFFL;
- rand_st->max_value_dbl=(double) rand_st->max_value;
- seed1%=rand_st->max_value;
- rand_st->seed1=seed1 ; rand_st->seed2=seed1/2;
-}
-
-
-/*
- Generate Random number
-
+ Generate random number.
SYNOPSIS
my_rnd()
rand_st INOUT Structure used for number generation
-
- RETURN
- Generated pseudo random number
+ RETURN VALUE
+ generated pseudo random number
*/
double my_rnd(struct rand_struct *rand_st)
@@ -134,73 +106,24 @@ double my_rnd(struct rand_struct *rand_st)
/*
- Generate String of printable random characters of requested length
- String will not be zero terminated.
-
+ Generate binary hash from raw text string
+ Used for Pre-4.1 password handling
SYNOPSIS
- create_random_string()
- length IN Lenght of
- rand_st INOUT Structure used for number generation
- target OUT Buffer for generation
-
- RETURN
- none
+ hash_password()
+ result OUT store hash in this location
+ password IN plain text password to build hash
+ password_len IN password length (password may be not null-terminated)
*/
-void create_random_string(int length,struct rand_struct *rand_st,char *target)
-{
- char *end=target+length;
- /* Use pointer arithmetics as it is faster way to do so. */
- for (; target<end ; target++)
- *target= (char) (my_rnd(rand_st)*94+33);
-}
-
-
-/*
- Encrypt/Decrypt function used for password encryption in authentication
- Simple XOR is used here but it is OK as we crypt random strings
-
- SYNOPSIS
- password_crypt()
- from IN Data for encryption
- to OUT Encrypt data to the buffer (may be the same)
- password IN Password used for encryption (same length)
- length IN Length of data to encrypt
-
- RETURN
- none
-*/
-
-void password_crypt(const char *from,char *to, const char *password,int length)
-{
- const char *from_end=from+length;
-
- while (from < from_end)
- *to++= *(from++) ^* (password++);
-}
-
-
-/*
- Generate binary hash from raw text password
- Used for Pre-4.1 Password handling
-
- SYNOPSIS
- hash_pasword()
- result OUT Store hash in this location
- password IN Plain text password to build hash
-
- RETURN
- none
-*/
-
-void hash_password(ulong *result, const char *password)
+void hash_password(ulong *result, const char *password, uint password_len)
{
register ulong nr=1345345333L, add=7, nr2=0x12345671L;
ulong tmp;
- for (; *password ; password++)
+ const char *password_end= password + password_len;
+ for (; password < password_end; password++)
{
if (*password == ' ' || *password == '\t')
- continue; /* skipp space in password */
+ continue; /* skip space in password */
tmp= (ulong) (uchar) *password;
nr^= (((nr & 63)+add)*tmp)+ (nr << 8);
nr2+=(nr2 << 8) ^ nr;
@@ -208,519 +131,388 @@ void hash_password(ulong *result, const char *password)
}
result[0]=nr & (((ulong) 1L << 31) -1L); /* Don't use sign bit (str2int) */;
result[1]=nr2 & (((ulong) 1L << 31) -1L);
- return;
}
/*
- Stage one password hashing.
- Used in MySQL 4.1 password handling
-
+ Create password to be stored in user database from raw string
+ Used for pre-4.1 password handling
SYNOPSIS
- password_hash_stage1()
- to OUT Store stage one hash to this location
- password IN Plain text password to build hash
-
- RETURN
- none
+ make_scrambled_password_323()
+ to OUT store scrambled password here
+ password IN user-supplied password
*/
-void password_hash_stage1(char *to, const char *password)
+void make_scrambled_password_323(char *to, const char *password)
{
- SHA1_CONTEXT context;
- sha1_reset(&context);
- for (; *password ; password++)
- {
- if (*password == ' ' || *password == '\t')
- continue;/* skip space in password */
- sha1_input(&context,(uint8*) &password[0],1);
- }
- sha1_result(&context,(uint8*)to);
+ ulong hash_res[2];
+ hash_password(hash_res, password, strlen(password));
+ sprintf(to, "%08lx%08lx", hash_res[0], hash_res[1]);
}
/*
- Stage two password hashing.
- Used in MySQL 4.1 password handling
-
+ Scramble string with password.
+ Used in pre 4.1 authentication phase.
SYNOPSIS
- password_hash_stage2()
- to INOUT Use this as stage one hash and store stage two hash here
- salt IN Salt used for stage two hashing
-
- RETURN
- none
+ scramble_323()
+ to OUT Store scrambled message here. Buffer must be at least
+ SCRAMBLE_LENGTH_323+1 bytes long
+ message IN Message to scramble. Message must be at least
+ SRAMBLE_LENGTH_323 bytes long.
+ password IN Password to use while scrambling
*/
-void password_hash_stage2(char *to, const char *salt)
+void scramble_323(char *to, const char *message, const char *password)
{
- SHA1_CONTEXT context;
- sha1_reset(&context);
- sha1_input(&context,(uint8*) salt, 4);
- sha1_input(&context,(uint8*) to, SHA1_HASH_SIZE);
- sha1_result(&context,(uint8*) to);
+ struct rand_struct rand_st;
+ ulong hash_pass[2], hash_message[2];
+
+ if (password && password[0])
+ {
+ char extra, *to_start=to;
+ const char *message_end= message + SCRAMBLE_LENGTH_323;
+ hash_password(hash_pass,password, strlen(password));
+ hash_password(hash_message, message, SCRAMBLE_LENGTH_323);
+ randominit(&rand_st,hash_pass[0] ^ hash_message[0],
+ hash_pass[1] ^ hash_message[1]);
+ for (; message < message_end; message++)
+ *to++= (char) (floor(my_rnd(&rand_st)*31)+64);
+ extra=(char) (floor(my_rnd(&rand_st)*31));
+ while (to_start != to)
+ *(to_start++)^=extra;
+ }
+ *to= 0;
}
/*
- Create password to be stored in user database from raw string
- Handles both MySQL 4.1 and Pre-MySQL 4.1 passwords
-
+ Check scrambled message
+ Used in pre 4.1 password handling
SYNOPSIS
- make_scramble_password()
- to OUT Store scrambled password here
- password IN Raw string password
- force_old_scramle
- IN Force generation of old scramble variant
- rand_st INOUT Structure for temporary number generation.
- RETURN
- none
+ check_scramble_323()
+ scrambled scrambled message to check.
+ message original random message which was used for scrambling; must
+ be exactly SCRAMBLED_LENGTH_323 bytes long and
+ NULL-terminated.
+ hash_pass password which should be used for scrambling
+ All params are IN.
+
+ RETURN VALUE
+ 0 - password correct
+ !0 - password invalid
*/
-void make_scrambled_password(char *to,const char *password,
- my_bool force_old_scramble,
- struct rand_struct *rand_st)
+my_bool
+check_scramble_323(const char *scrambled, const char *message,
+ ulong *hash_pass)
{
- ulong hash_res[2]; /* Used for pre 4.1 password hashing */
- unsigned short salt; /* Salt for 4.1 version password */
- uint8 digest[SHA1_HASH_SIZE];
- if (force_old_scramble) /* Pre 4.1 password encryption */
- {
- hash_password(hash_res,password);
- sprintf(to,"%08lx%08lx",hash_res[0],hash_res[1]);
- }
- else /* New password 4.1 password scrambling */
+ struct rand_struct rand_st;
+ ulong hash_message[2];
+ char buff[16],*to,extra; /* Big enough for check */
+ const char *pos;
+
+ hash_password(hash_message, message, SCRAMBLE_LENGTH_323);
+ randominit(&rand_st,hash_pass[0] ^ hash_message[0],
+ hash_pass[1] ^ hash_message[1]);
+ to=buff;
+ for (pos=scrambled ; *pos ; pos++)
+ *to++=(char) (floor(my_rnd(&rand_st)*31)+64);
+ extra=(char) (floor(my_rnd(&rand_st)*31));
+ to=buff;
+ while (*scrambled)
{
- to[0]=PVERSION41_CHAR; /* New passwords have version prefix */
- /* Rnd returns number from 0 to 1 so this would be good salt generation.*/
- salt=(unsigned short) (my_rnd(rand_st)*65535+1);
- /* Use only 2 first bytes from it */
- sprintf(to+1,"%04x",salt);
- /* First hasing is done without salt */
- password_hash_stage1((char*) digest, password);
- /* Second stage is done with salt */
- password_hash_stage2((char*) digest,(char*)to+1),
- /* Print resulting hash into the password*/
- sprintf(to+5,
- "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
- digest[0],digest[1],digest[2],digest[3],digest[4],digest[5],digest[6],
- digest[7],digest[8],digest[9],digest[10],digest[11],digest[12],digest[13],
- digest[14],digest[15],digest[16],digest[17],digest[18],digest[19]);
+ if (*scrambled++ != (char) (*to++ ^ extra))
+ return 1; /* Wrong password */
}
+ return 0;
}
+static inline uint8 char_val(uint8 X)
+{
+ return (uint) (X >= '0' && X <= '9' ? X-'0' :
+ X >= 'A' && X <= 'Z' ? X-'A'+10 : X-'a'+10);
+}
-/*
- Convert password from binary string form to salt form
- Used for MySQL 4.1 password handling
+/*
+ Convert password from hex string (as stored in mysql.user) to binary form.
SYNOPSIS
- get_salt_from_bin_password()
- res OUT Store salt form password here
- password IN Binary password to be converted
- salt IN hashing-salt to be used for salt form generation
-
- RETURN
- none
+ get_salt_from_password_323()
+ res OUT store salt here
+ password IN password string as stored in mysql.user
+ NOTE
+ This function does not have length check for passwords. It will just crash
+ Password hashes in old format must have length divisible by 8
*/
-void get_salt_from_bin_password(ulong *res,unsigned char *password,ulong salt)
+void get_salt_from_password_323(ulong *res, const char *password)
{
- unsigned char *password_end=password+SCRAMBLE41_LENGTH;
- *res=salt;
- res++;
-
- /* Process password of known length*/
- while (password<password_end)
+ res[0]= res[1]= 0;
+ if (password)
{
- ulong val=0;
- uint i;
- for (i=0 ; i < 4 ; i++)
- val=(val << 8)+(*password++);
- *res++=val;
+ while (*password)
+ {
+ ulong val=0;
+ uint i;
+ for (i=0 ; i < 8 ; i++)
+ val=(val << 4)+char_val(*password++);
+ *res++=val;
+ }
}
}
/*
- Validate password for MySQL 4.1 password handling.
-
+ Convert scrambled password from binary form to asciiz hex string.
SYNOPSIS
- validate_password()
- password IN Encrypted Scramble which we got from the client
- message IN Original scramble which we have sent to the client before
- salt IN Password in the salted form to match to
-
- RETURN
- 0 for correct password
- !0 for invalid password
+ make_password_from_salt_323()
+ to OUT store resulting string password here, at least 17 bytes
+ salt IN password in salt format, 2 ulongs
*/
-my_bool validate_password(const char *password, const char *message,
- ulong *salt)
+void make_password_from_salt_323(char *to, const ulong *salt)
{
- char buffer[SCRAMBLE41_LENGTH]; /* Used for password validation */
- char tmpsalt[8]; /* Temporary value to convert salt to string form */
- ulong salt_candidate[6]; /* Computed candidate salt */
- ulong *sc=salt_candidate; /* we need to be able to increment */
- ulong *salt_end;
-
- /* Now we shall get stage1 encrypted password in buffer*/
- password_crypt(password,buffer,message,SCRAMBLE41_LENGTH);
-
- /* For compatibility reasons we use ulong to store salt while we need char */
- sprintf(tmpsalt,"%04x",(unsigned short)salt[0]);
-
- password_hash_stage2(buffer,tmpsalt);
- /* Convert password to salt to compare */
- get_salt_from_bin_password(salt_candidate,(uchar*) buffer,salt[0]);
-
- /* Now we shall get exactly the same password as we have stored for user */
- for (salt_end=salt+5 ; salt < salt_end; )
- if (*++salt != *++sc)
- return 1;
-
- /* Or password correct*/
- return 0;
+ sprintf(to,"%08lx%08lx", salt[0], salt[1]);
}
/*
- Get length of password string which is stored in mysql.user table
+ **************** MySQL 4.1.1 authentification routines *************
+*/
+/*
+ Generate string of printable random characters of requested length
SYNOPSIS
- get_password_length()
- force_old_scramble IN If we wish to use pre 4.1 scramble format
-
- RETURN
- password length >0
+ create_random_string()
+ to OUT buffer for generation; must be at least length+1 bytes
+ long; result string is always null-terminated
+ length IN how many random characters to put in buffer
+ rand_st INOUT structure used for number generation
*/
-int get_password_length(my_bool force_old_scramble)
+void create_random_string(char *to, uint length, struct rand_struct *rand_st)
{
- return (force_old_scramble) ? 16 : SHA1_HASH_SIZE*2+4+1;
+ char *end= to + length;
+ /* Use pointer arithmetics as it is faster way to do so. */
+ for (; to < end; to++)
+ *to= (char) (my_rnd(rand_st)*94+33);
+ *to= '\0';
}
-/*
- Get version of the password based on mysql.user password string
-
- SYNOPSIS
- get_password_version()
- password IN Password string as stored in mysql.user
-
- RETURN
- 0 for pre 4.1 passwords
- !0 password version char for newer passwords
-*/
+/* Character to use as version identifier for version 4.1 */
-char get_password_version(const char *password)
-{
- if (password==NULL) return 0;
- if (password[0]==PVERSION41_CHAR) return PVERSION41_CHAR;
- return 0;
-}
+#define PVERSION41_CHAR '*'
/*
- Get integer value of Hex character
-
+ Convert given octet sequence to asciiz string of hex characters;
+ str..str+len and 'to' may not overlap.
SYNOPSIS
- char_val()
- X IN Character to find value for
-
- RETURN
- Appropriate integer value
+ octet2hex()
+ buf OUT output buffer. Must be at least 2*len+1 bytes
+ str, len IN the beginning and the length of the input string
*/
-
-
-static inline unsigned int char_val(char X)
+static void
+octet2hex(char *to, const uint8 *str, uint len)
{
- return (uint) (X >= '0' && X <= '9' ? X-'0' :
- X >= 'A' && X <= 'Z' ? X-'A'+10 :
- X-'a'+10);
+ const uint8 *str_end= str + len;
+ for (; str != str_end; ++str)
+ {
+ *to++= _dig_vec[(*str & 0xF0) >> 4];
+ *to++= _dig_vec[*str & 0x0F];
+ }
+ *to= '\0';
}
/*
- Get Binary salt from password as in mysql.user format
-
+ Convert given asciiz string of hex (0..9 a..f) characters to octet
+ sequence.
SYNOPSIS
- get_salt_from_password()
- res OUT Store binary salt here
- password IN Password string as stored in mysql.user
-
- RETURN
- none
-
- NOTE
- This function does not have length check for passwords. It will just crash
- Password hashes in old format must have length divisible by 8
-*/
-
-void get_salt_from_password(ulong *res,const char *password)
+ hex2octet()
+ to OUT buffer to place result; must be at least len/2 bytes
+ str, len IN begin, length for character string; str and to may not
+ overlap; len % 2 == 0
+*/
+
+static void
+hex2octet(uint8 *to, const char *str, uint len)
{
- if (password) /* zero salt corresponds to empty password */
+ const char *str_end= str + len;
+ while (str < str_end)
{
- if (password[0]==PVERSION41_CHAR) /* if new password */
- {
- uint val=0;
- uint i;
- password++; /* skip version identifier */
-
- /*get hashing salt from password and store in in the start of array */
- for (i=0 ; i < 4 ; i++)
- val=(val << 4)+char_val(*password++);
- *res++=val;
- }
- /* We process old passwords the same way as new ones in other case */
-#ifdef EXTRA_DEBUG
- if (strlen(password)%8!=0)
- fprintf(stderr,"Warning: Incorrect password length for salting: %d\n",
- strlen(password));
-#endif
- while (*password)
- {
- ulong val=0;
- uint i;
- for (i=0 ; i < 8 ; i++)
- val=(val << 4)+char_val(*password++);
- *res++=val;
- }
+ register char tmp= char_val(*str++);
+ *to++= (tmp << 4) | char_val(*str++);
}
- return;
}
/*
- Get string version as stored in mysql.user from salt form
-
+ Encrypt/Decrypt function used for password encryption in authentication.
+ Simple XOR is used here but it is OK as we crypt random strings. Note,
+ that XOR(s1, XOR(s1, s2)) == s2, XOR(s1, s2) == XOR(s2, s1)
SYNOPSIS
- make_password_from_salt()
- to OUT Store resulting string password here
- hash_res IN Password in salt format
- password_version
- IN According to which version salt should be treated
-
- RETURN
- none
+ my_crypt()
+ to OUT buffer to hold crypted string; must be at least len bytes
+ long; to and s1 (or s2) may be the same.
+ s1, s2 IN input strings (of equal length)
+ len IN length of s1 and s2
*/
-void make_password_from_salt(char *to, ulong *hash_res,uint8 password_version)
+static void
+my_crypt(char *to, const uchar *s1, const uchar *s2, uint len)
{
- if (!password_version) /* Handling of old passwords. */
- sprintf(to,"%08lx%08lx",hash_res[0],hash_res[1]);
- else
- if (password_version==PVERSION41_CHAR)
- sprintf(to,"%c%04x%08lx%08lx%08lx%08lx%08lx",PVERSION41_CHAR,(unsigned short)hash_res[0],hash_res[1],
- hash_res[2],hash_res[3],hash_res[4],hash_res[5]);
- else /* Just use empty password if we can't handle it. This should not happen */
- to[0]='\0';
+ const uint8 *s1_end= s1 + len;
+ while (s1 < s1_end)
+ *to++= *s1++ ^ *s2++;
}
/*
- Convert password in salted form to binary string password and hash-salt
- For old password this involes one more hashing
-
+ MySQL 4.1.1 password hashing: SHA conversion (see RFC 2289, 3174) twice
+ applied to the password string, and then produced octet sequence is
+ converted to hex string.
+ The result of this function is used as return value from PASSWORD() and
+ is stored in the database.
SYNOPSIS
- get_hash_and_password()
- salt IN Salt to convert from
- pversion IN Password version to use
- hash OUT Store zero ended hash here
- bin_password OUT Store binary password here (no zero at the end)
-
- RETURN
- 0 for pre 4.1 passwords
- !0 password version char for newer passwords
+ make_scrambled_password()
+ buf OUT buffer of size 2*SHA1_HASH_SIZE + 2 to store hex string
+ password IN NULL-terminated password string
*/
-void get_hash_and_password(ulong *salt, uint8 pversion, char *hash,
- unsigned char *bin_password)
+void
+make_scrambled_password(char *to, const char *password)
{
- int t;
- ulong* salt_end;
- ulong val;
- SHA1_CONTEXT context;
-
- if (pversion) /* New password version assumed */
- {
- salt_end=salt+5;
- sprintf(hash,"%04x",(unsigned short)salt[0]);
- while (salt<salt_end)
- {
- val=*(++salt);
- for (t=3; t>=0; t--)
- {
- bin_password[t]= (char) (val & 255);
- val>>=8; /* Scroll 8 bits to get next part*/
- }
- bin_password+=4; /* Get to next 4 chars*/
- }
- }
- else
- {
- unsigned char *bp= bin_password; /* Binary password loop pointer */
-
- /* Use zero starting hash as an indication of old password */
- hash[0]=0;
- salt_end=salt+2;
- /* Encode salt using SHA1 here */
- sha1_reset(&context);
- while (salt<salt_end) /* Iterate over these elements*/
- {
- val= *salt;
- for (t=3;t>=0;t--)
- {
- bp[t]= (uchar) (val & 255);
- val>>=8; /* Scroll 8 bits to get next part*/
- }
- bp+= 4; /* Get to next 4 chars*/
- salt++;
- }
- /* Use 8 bytes of binary password for hash */
- sha1_input(&context,(uint8*)bin_password,8);
- sha1_result(&context,(uint8*)bin_password);
- }
+ SHA1_CONTEXT sha1_context;
+ uint8 hash_stage2[SHA1_HASH_SIZE];
+
+ sha1_reset(&sha1_context);
+ /* stage 1: hash password */
+ sha1_input(&sha1_context, (uint8 *) password, strlen(password));
+ sha1_result(&sha1_context, (uint8 *) to);
+ /* stage 2: hash stage1 output */
+ sha1_reset(&sha1_context);
+ sha1_input(&sha1_context, (uint8 *) to, SHA1_HASH_SIZE);
+ /* separate buffer is used to pass 'to' in octet2hex */
+ sha1_result(&sha1_context, hash_stage2);
+ /* convert hash_stage2 to hex string */
+ *to++= PVERSION41_CHAR;
+ octet2hex(to, hash_stage2, SHA1_HASH_SIZE);
}
-
+
/*
- Create key from old password to decode scramble
- Used in 4.1 authentication with passwords stored old way
-
+ Produce an obscure octet sequence from password and random
+ string, recieved from the server. This sequence corresponds to the
+ password, but password can not be easily restored from it. The sequence
+ is then sent to the server for validation. Trailing zero is not stored
+ in the buf as it is not needed.
+ This function is used by client to create authenticated reply to the
+ server's greeting.
SYNOPSIS
- create_key_from_old_password()
- passwd IN Password used for key generation
- key OUT Created 20 bytes key
-
- RETURN
- None
+ scramble()
+ buf OUT store scrambled string here. The buf must be at least
+ SHA1_HASH_SIZE bytes long.
+ message IN random message, must be exactly SCRAMBLE_LENGTH long and
+ NULL-terminated.
+ password IN users' password
*/
-
-void create_key_from_old_password(const char *passwd, char *key)
+void
+scramble(char *to, const char *message, const char *password)
{
- char buffer[SCRAMBLE41_LENGTH]; /* Buffer for various needs */
- ulong salt[6]; /* Salt (large for safety) */
- /* At first hash password to the string stored in password */
- make_scrambled_password(buffer,passwd,1,(struct rand_struct *)NULL);
- /* Now convert it to the salt form */
- get_salt_from_password(salt,buffer);
- /* Finally get hash and bin password from salt */
- get_hash_and_password(salt,0,buffer,(unsigned char*) key);
+ SHA1_CONTEXT sha1_context;
+ uint8 hash_stage1[SHA1_HASH_SIZE];
+ uint8 hash_stage2[SHA1_HASH_SIZE];
+
+ sha1_reset(&sha1_context);
+ /* stage 1: hash password */
+ sha1_input(&sha1_context, (uint8 *) password, strlen(password));
+ sha1_result(&sha1_context, hash_stage1);
+ /* stage 2: hash stage 1; note that hash_stage2 is stored in the database */
+ sha1_reset(&sha1_context);
+ sha1_input(&sha1_context, hash_stage1, SHA1_HASH_SIZE);
+ sha1_result(&sha1_context, hash_stage2);
+ /* create crypt string as sha1(message, hash_stage2) */;
+ sha1_reset(&sha1_context);
+ sha1_input(&sha1_context, (const uint8 *) message, SCRAMBLE_LENGTH);
+ sha1_input(&sha1_context, hash_stage2, SHA1_HASH_SIZE);
+ /* xor allows 'from' and 'to' overlap: lets take advantage of it */
+ sha1_result(&sha1_context, (uint8 *) to);
+ my_crypt(to, (const uchar *) to, hash_stage1, SCRAMBLE_LENGTH);
}
/*
- Scramble string with password
- Used at pre 4.1 authentication phase.
-
+ Check that scrambled message corresponds to the password; the function
+ is used by server to check that recieved reply is authentic.
+ This function does not check lengths of given strings: message must be
+ null-terminated, reply and hash_stage2 must be at least SHA1_HASH_SIZE
+ long (if not, something fishy is going on).
SYNOPSIS
- scramble()
- to OUT Store scrambled message here
- message IN Message to scramble
- password IN Password to use while scrambling
- old_ver IN Forse old version random number generator
-
- RETURN
- End of scrambled string
+ check_scramble()
+ scramble clients' reply, presumably produced by scramble()
+ message original random string, previously sent to client
+ (presumably second argument of scramble()), must be
+ exactly SCRAMBLE_LENGTH long and NULL-terminated.
+ hash_stage2 hex2octet-decoded database entry
+ All params are IN.
+
+ RETURN VALUE
+ 0 password is correct
+ !0 password is invalid
*/
-char *scramble(char *to,const char *message,const char *password,
- my_bool old_ver)
+my_bool
+check_scramble(const char *scramble, const char *message,
+ const uint8 *hash_stage2)
{
- struct rand_struct rand_st;
- ulong hash_pass[2],hash_message[2];
- char message_buffer[9]; /* Real message buffer */
- char *msg=message_buffer;
-
- /* We use special message buffer now as new server can provide longer hash */
-
- memcpy(message_buffer,message,8);
- message_buffer[8]=0;
-
- if (password && password[0])
- {
- char *to_start=to;
- hash_password(hash_pass,password);
- hash_password(hash_message,message_buffer);
- if (old_ver)
- old_randominit(&rand_st,hash_pass[0] ^ hash_message[0]);
- else
- randominit(&rand_st,hash_pass[0] ^ hash_message[0],
- hash_pass[1] ^ hash_message[1]);
- while (*msg++)
- *to++= (char) (floor(my_rnd(&rand_st)*31)+64);
- if (!old_ver)
- { /* Make it harder to break */
- char extra=(char) (floor(my_rnd(&rand_st)*31));
- while (to_start != to)
- *(to_start++)^=extra;
- }
- }
- *to=0;
- return to;
+ SHA1_CONTEXT sha1_context;
+ uint8 buf[SHA1_HASH_SIZE];
+ uint8 hash_stage2_reassured[SHA1_HASH_SIZE];
+
+ sha1_reset(&sha1_context);
+ /* create key to encrypt scramble */
+ sha1_input(&sha1_context, (const uint8 *) message, SCRAMBLE_LENGTH);
+ sha1_input(&sha1_context, hash_stage2, SHA1_HASH_SIZE);
+ sha1_result(&sha1_context, buf);
+ /* encrypt scramble */
+ my_crypt((char *) buf, buf, (const uchar *) scramble, SCRAMBLE_LENGTH);
+ /* now buf supposedly contains hash_stage1: so we can get hash_stage2 */
+ sha1_reset(&sha1_context);
+ sha1_input(&sha1_context, buf, SHA1_HASH_SIZE);
+ sha1_result(&sha1_context, hash_stage2_reassured);
+ return memcmp(hash_stage2, hash_stage2_reassured, SHA1_HASH_SIZE);
}
/*
- Check scrambled message
- Used for pre 4.1 password handling
+ Convert scrambled password from asciiz hex string to binary form.
+ SYNOPSIS
+ get_salt_from_password()
+ res OUT buf to hold password. Must be at least SHA1_HASH_SIZE
+ bytes long.
+ password IN 4.1.1 version value of user.password
+*/
+
+void get_salt_from_password(uint8 *hash_stage2, const char *password)
+{
+ hex2octet(hash_stage2, password+1 /* skip '*' */, SHA1_HASH_SIZE * 2);
+}
+/*
+ Convert scrambled password from binary form to asciiz hex string.
SYNOPSIS
- scramble()
- scrambled IN Scrambled message to check
- message IN Original message which was scramble
- hash_pass IN Password which should be used for scrambling
- old_ver IN Forse old version random number generator
-
- RETURN
- 0 Password correct
- !0 Password invalid
+ make_password_from_salt()
+ to OUT store resulting string here, 2*SHA1_HASH_SIZE+2 bytes
+ salt IN password in salt format
*/
-my_bool check_scramble(const char *scrambled, const char *message,
- ulong *hash_pass, my_bool old_ver)
+void make_password_from_salt(char *to, const uint8 *hash_stage2)
{
- struct rand_struct rand_st;
- ulong hash_message[2];
- char buff[16],*to,extra; /* Big enough for check */
- const char *pos;
- char message_buffer[SCRAMBLE_LENGTH+1]; /* Copy of message */
-
- /* We need to copy the message as this function can be called for MySQL 4.1
- scramble which is not zero ended and can have zeroes inside
- We could just write zero to proper place in original message but
- this would make it harder to understand code for next generations
- */
-
- memcpy(message_buffer,message,SCRAMBLE_LENGTH); /* Ignore the rest */
- message_buffer[SCRAMBLE_LENGTH]=0;
-
- /* Check if this exactly N bytes. Overwise this is something fishy */
- if (strlen(message_buffer)!=SCRAMBLE_LENGTH)
- return 1; /* Wrong password */
-
- hash_password(hash_message,message_buffer);
- if (old_ver)
- old_randominit(&rand_st,hash_pass[0] ^ hash_message[0]);
- else
- randominit(&rand_st,hash_pass[0] ^ hash_message[0],
- hash_pass[1] ^ hash_message[1]);
- to=buff;
- for (pos=scrambled ; *pos ; pos++)
- *to++=(char) (floor(my_rnd(&rand_st)*31)+64);
- if (old_ver)
- extra=0;
- else
- extra=(char) (floor(my_rnd(&rand_st)*31));
- to=buff;
- while (*scrambled)
- {
- if (*scrambled++ != (char) (*to++ ^ extra))
- return 1; /* Wrong password */
- }
- return 0;
+ *to++= PVERSION41_CHAR;
+ octet2hex(to, hash_stage2, SHA1_HASH_SIZE);
}
diff --git a/sql/protocol.cc b/sql/protocol.cc
index e90aa7585e2..79420fb71d5 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -28,6 +28,9 @@
#ifndef EMBEDDED_LIBRARY
bool Protocol::net_store_data(const char *from, uint length)
+#else
+bool Protocol_prep::net_store_data(const char *from, uint length)
+#endif
{
ulong packet_length=packet->length();
/*
@@ -43,7 +46,6 @@ bool Protocol::net_store_data(const char *from, uint length)
packet->length((uint) (to+length-packet->ptr()));
return 0;
}
-#endif
/* Send a error string to client */
@@ -349,10 +351,35 @@ send_eof(THD *thd, bool no_flush)
}
DBUG_VOID_RETURN;
}
+
+/*
+ Please client to send scrambled_password in old format.
+ SYNOPSYS
+ send_old_password_request()
+ thd thread handle
+
+ RETURN VALUE
+ 0 ok
+ !0 error
+*/
+
+bool send_old_password_request(THD *thd)
+{
+ static char buff[1]= { (char) 254 };
+ NET *net= &thd->net;
+ return my_net_write(net, buff, 1) || net_flush(net);
+}
+
#endif /* EMBEDDED_LIBRARY */
/*
- Faster net_store_length when we know length is a 32 bit integer
+ Faster net_store_length when we know that length is less than 65536.
+ We keep a separate version for that range because it's widely used in
+ libmysql.
+ uint is used as agrument type because of MySQL type conventions:
+ uint for 0..65536
+ ulong for 0..4294967296
+ ulonglong for bigger numbers.
*/
char *net_store_length(char *pkg, uint length)
@@ -1105,3 +1132,12 @@ bool Protocol_prep::store_time(TIME *tm)
buff[0]=(char) length; // Length is stored first
return packet->append(buff, length+1, PACKET_BUFFET_EXTRA_ALLOC);
}
+
+#ifdef EMBEDDED_LIBRARY
+/* Should be removed when we define the Protocol_cursor's future */
+bool Protocol_cursor::write()
+{
+ return Protocol_simple::write();
+}
+#endif
+
diff --git a/sql/protocol.h b/sql/protocol.h
index 05aee12d3d9..94fd303e259 100644
--- a/sql/protocol.h
+++ b/sql/protocol.h
@@ -53,7 +53,11 @@ public:
bool store(const char *from, CHARSET_INFO *cs);
String *storage_packet() { return packet; }
inline void free() { packet->free(); }
+#ifndef EMBEDDED_LIBRARY
bool write();
+#else
+ virtual bool write();
+#endif
inline bool store(uint32 from)
{ return store_long((longlong) from); }
inline bool store(longlong from)
@@ -121,6 +125,10 @@ public:
Protocol_prep(THD *thd) :Protocol(thd) {}
virtual bool prepare_for_send(List<Item> *item_list);
virtual void prepare_for_resend();
+#ifdef EMBEDDED_LIBRARY
+ virtual bool write();
+ bool net_store_data(const char *from, uint length);
+#endif
virtual bool store_null();
virtual bool store_tiny(longlong from);
virtual bool store_short(longlong from);
@@ -164,8 +172,15 @@ void net_printf(THD *thd,uint sql_errno, ...);
void send_ok(THD *thd, ha_rows affected_rows=0L, ulonglong id=0L,
const char *info=0);
void send_eof(THD *thd, bool no_flush=0);
+bool send_old_password_request(THD *thd);
char *net_store_length(char *packet,ulonglong length);
char *net_store_length(char *packet,uint length);
char *net_store_data(char *to,const char *from, uint length);
char *net_store_data(char *to,int32 from);
char *net_store_data(char *to,longlong from);
+
+#ifdef EMBEDDED_LIBRARY
+bool setup_params_data(struct st_prep_stmt *stmt);
+bool setup_params_data_withlog(struct st_prep_stmt *stmt);
+#endif
+
diff --git a/sql/records.cc b/sql/records.cc
index 72a6d480356..7ba9ff0f42f 100644
--- a/sql/records.cc
+++ b/sql/records.cc
@@ -1,4 +1,3 @@
-
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This program is free software; you can redistribute it and/or modify
diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc
index e9c3b1ed0b0..7c943d4ae53 100644
--- a/sql/repl_failsafe.cc
+++ b/sql/repl_failsafe.cc
@@ -34,7 +34,6 @@ RPL_STATUS rpl_status=RPL_NULL;
pthread_mutex_t LOCK_rpl_status;
pthread_cond_t COND_rpl_status;
HASH slave_list;
-extern const char* any_db;
const char *rpl_role_type[] = {"MASTER","SLAVE",NullS};
TYPELIB rpl_role_typelib = {array_elements(rpl_role_type)-1,"",
@@ -154,9 +153,8 @@ int register_slave(THD* thd, uchar* packet, uint packet_length)
SLAVE_INFO *si;
uchar *p= packet, *p_end= packet + packet_length;
- if (check_access(thd, REPL_SLAVE_ACL, any_db))
+ if (check_access(thd, REPL_SLAVE_ACL, any_db,0,0,0))
return 1;
-
if (!(si = (SLAVE_INFO*)my_malloc(sizeof(SLAVE_INFO), MYF(MY_WME))))
goto err2;
@@ -177,7 +175,7 @@ int register_slave(THD* thd, uchar* packet, uint packet_length)
pthread_mutex_lock(&LOCK_slave_list);
unregister_slave(thd,0,0);
- res= hash_insert(&slave_list, (byte*) si);
+ res= my_hash_insert(&slave_list, (byte*) si);
pthread_mutex_unlock(&LOCK_slave_list);
return res;
@@ -250,6 +248,18 @@ static int find_target_pos(LEX_MASTER_INFO *mi, IO_CACHE *log, char *errmsg)
/* Impossible */
}
+/*
+ Before 4.0.15 we had a member of THD called log_pos, it was meant for
+ failsafe replication code in repl_failsafe.cc which is disabled until
+ it is reworked. Event's log_pos used to be preserved through
+ log-slave-updates to make code in repl_failsafe.cc work (this
+ function, SHOW NEW MASTER); but on the other side it caused unexpected
+ values in Exec_master_log_pos in A->B->C replication setup,
+ synchronization problems in master_pos_wait(), ... So we
+ (Dmitri & Guilhem) removed it.
+
+ So for now this function is broken.
+*/
int translate_master(THD* thd, LEX_MASTER_INFO* mi, char* errmsg)
{
@@ -415,6 +425,9 @@ static Slave_log_event* find_slave_event(IO_CACHE* log,
return (Slave_log_event*)ev;
}
+/*
+ This function is broken now. See comment for translate_master().
+ */
int show_new_master(THD* thd)
{
@@ -525,7 +538,7 @@ HOSTS";
goto err;
}
si->server_id = server_id;
- hash_insert(&slave_list, (byte*)si);
+ my_hash_insert(&slave_list, (byte*)si);
}
strmake(si->host, row[1], sizeof(si->host)-1);
si->port = atoi(row[port_ind]);
@@ -670,6 +683,17 @@ int connect_to_master(THD *thd, MYSQL* mysql, MASTER_INFO* mi)
}
mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT, (char *) &slave_net_timeout);
mysql_options(mysql, MYSQL_OPT_READ_TIMEOUT, (char *) &slave_net_timeout);
+
+#ifdef HAVE_OPENSSL
+ if (mi->ssl)
+ mysql_ssl_set(mysql,
+ mi->ssl_key[0]?mi->ssl_key:0,
+ mi->ssl_cert[0]?mi->ssl_cert:0,
+ mi->ssl_ca[0]?mi->ssl_ca:0,
+ mi->ssl_capath[0]?mi->ssl_capath:0,
+ mi->ssl_cipher[0]?mi->ssl_cipher:0);
+#endif
+
mysql_options(mysql, MYSQL_SET_CHARSET_NAME, default_charset_info->csname);
mysql_options(mysql, MYSQL_SET_CHARSET_DIR, (char *) charsets_dir);
if (!mysql_real_connect(mysql, mi->host, mi->user, mi->password, 0,
@@ -903,6 +927,12 @@ int load_master_data(THD* thd)
strmake(active_mi->rli.group_master_log_name,active_mi->master_log_name,
sizeof(active_mi->rli.group_master_log_name)-1);
/*
+ Cancel the previous START SLAVE UNTIL, as the fact to download
+ a new copy logically makes UNTIL irrelevant.
+ */
+ clear_until_condition(&active_mi->rli);
+
+ /*
No need to update rli.event* coordinates, they will be when the slave
threads start ; only rli.group* coordinates are necessary here.
*/
diff --git a/sql/set_var.cc b/sql/set_var.cc
index dc7f56f875e..f5f0b400793 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -121,6 +121,8 @@ sys_var_character_set_client sys_character_set_client("character_set_client");
sys_var_character_set_connection sys_character_set_connection("character_set_connection");
sys_var_character_set_results sys_character_set_results("character_set_results");
sys_var_collation_connection sys_collation_connection("collation_connection");
+sys_var_collation_database sys_collation_database("collation_database");
+sys_var_collation_server sys_collation_server("collation_server");
sys_var_bool_ptr sys_concurrent_insert("concurrent_insert",
&myisam_concurrent_insert);
sys_var_long_ptr sys_connect_timeout("connect_timeout",
@@ -226,6 +228,7 @@ sys_var_thd_ulong sys_net_retry_count("net_retry_count",
&SV::net_retry_count,
fix_net_retry_count);
sys_var_thd_bool sys_new_mode("new", &SV::new_mode);
+sys_var_thd_bool sys_old_passwords("old_passwords", &SV::old_passwords);
sys_var_thd_ulong sys_preload_buff_size("preload_buffer_size",
&SV::preload_buff_size);
sys_var_thd_ulong sys_read_buff_size("read_buffer_size",
@@ -252,6 +255,7 @@ sys_var_thd_enum sys_query_cache_type("query_cache_type",
&SV::query_cache_type,
&query_cache_type_typelib);
#endif /* HAVE_QUERY_CACHE */
+sys_var_bool_ptr sys_secure_auth("secure_auth", &opt_secure_auth);
sys_var_long_ptr sys_server_id("server_id",&server_id);
sys_var_bool_ptr sys_slave_compressed_protocol("slave_compressed_protocol",
&opt_slave_compressed_protocol);
@@ -389,6 +393,8 @@ sys_var *sys_variables[]=
&sys_character_set_connection,
&sys_character_set_results,
&sys_collation_connection,
+ &sys_collation_database,
+ &sys_collation_server,
&sys_concurrent_insert,
&sys_connect_timeout,
&sys_default_week_format,
@@ -445,6 +451,7 @@ sys_var *sys_variables[]=
&sys_net_wait_timeout,
&sys_net_write_timeout,
&sys_new_mode,
+ &sys_old_passwords,
&sys_preload_buff_size,
&sys_pseudo_thread_id,
&sys_query_cache_size,
@@ -463,6 +470,7 @@ sys_var *sys_variables[]=
#endif
&sys_rpl_recovery_rank,
&sys_safe_updates,
+ &sys_secure_auth,
&sys_select_limit,
&sys_server_id,
#ifdef HAVE_REPLICATION
@@ -518,6 +526,8 @@ struct show_var_st init_vars[]= {
{sys_character_set_connection.name,(char*) &sys_character_set_connection,SHOW_SYS},
{sys_character_set_results.name,(char*) &sys_character_set_results, SHOW_SYS},
{sys_collation_connection.name,(char*) &sys_collation_connection, SHOW_SYS},
+ {sys_collation_database.name,(char*) &sys_collation_database, SHOW_SYS},
+ {sys_collation_server.name,(char*) &sys_collation_server, SHOW_SYS},
{sys_concurrent_insert.name,(char*) &sys_concurrent_insert, SHOW_SYS},
{sys_connect_timeout.name, (char*) &sys_connect_timeout, SHOW_SYS},
{"datadir", mysql_real_data_home, SHOW_CHAR},
@@ -627,6 +637,7 @@ struct show_var_st init_vars[]= {
{sys_net_retry_count.name, (char*) &sys_net_retry_count, SHOW_SYS},
{sys_net_write_timeout.name,(char*) &sys_net_write_timeout, SHOW_SYS},
{sys_new_mode.name, (char*) &sys_new_mode, SHOW_SYS},
+ {sys_old_passwords.name, (char*) &sys_old_passwords, SHOW_SYS},
{"open_files_limit", (char*) &open_files_limit, SHOW_LONG},
{"pid_file", (char*) pidfile_name, SHOW_CHAR},
{"log_error", (char*) log_error_file, SHOW_CHAR},
@@ -634,20 +645,21 @@ struct show_var_st init_vars[]= {
{"protocol_version", (char*) &protocol_version, SHOW_INT},
{sys_preload_buff_size.name, (char*) &sys_preload_buff_size, SHOW_SYS},
{sys_pseudo_thread_id.name, (char*) &sys_pseudo_thread_id, SHOW_SYS},
- {sys_read_buff_size.name, (char*) &sys_read_buff_size, SHOW_SYS},
- {sys_readonly.name, (char*) &sys_readonly, SHOW_SYS},
- {sys_read_rnd_buff_size.name,(char*) &sys_read_rnd_buff_size, SHOW_SYS},
-#ifdef HAVE_REPLICATION
- {sys_relay_log_purge.name, (char*) &sys_relay_log_purge, SHOW_SYS},
-#endif
- {sys_rpl_recovery_rank.name,(char*) &sys_rpl_recovery_rank, SHOW_SYS},
#ifdef HAVE_QUERY_CACHE
{sys_query_cache_limit.name,(char*) &sys_query_cache_limit, SHOW_SYS},
{sys_query_cache_min_res_unit.name, (char*) &sys_query_cache_min_res_unit,
SHOW_SYS},
{sys_query_cache_size.name, (char*) &sys_query_cache_size, SHOW_SYS},
{sys_query_cache_type.name, (char*) &sys_query_cache_type, SHOW_SYS},
+ {"secure_auth", (char*) &sys_secure_auth, SHOW_SYS},
#endif /* HAVE_QUERY_CACHE */
+ {sys_read_buff_size.name, (char*) &sys_read_buff_size, SHOW_SYS},
+ {sys_readonly.name, (char*) &sys_readonly, SHOW_SYS},
+ {sys_read_rnd_buff_size.name,(char*) &sys_read_rnd_buff_size, SHOW_SYS},
+#ifdef HAVE_REPLICATION
+ {sys_relay_log_purge.name, (char*) &sys_relay_log_purge, SHOW_SYS},
+#endif
+ {sys_rpl_recovery_rank.name,(char*) &sys_rpl_recovery_rank, SHOW_SYS},
#ifdef HAVE_SMEM
{"shared_memory", (char*) &opt_enable_shared_memory, SHOW_MY_BOOL},
{"shared_memory_base_name", (char*) &shared_memory_base_name, SHOW_CHAR_PTR},
@@ -864,10 +876,12 @@ void fix_max_relay_log_size(THD *thd, enum_var_type type)
bool sys_var_long_ptr::update(THD *thd, set_var *var)
{
ulonglong tmp= var->value->val_int();
+ pthread_mutex_lock(&LOCK_global_system_variables);
if (option_limits)
*value= (ulong) getopt_ull_limit_value(tmp, option_limits);
else
*value= (ulong) tmp;
+ pthread_mutex_unlock(&LOCK_global_system_variables);
return 0;
}
@@ -881,17 +895,21 @@ void sys_var_long_ptr::set_default(THD *thd, enum_var_type type)
bool sys_var_ulonglong_ptr::update(THD *thd, set_var *var)
{
ulonglong tmp= var->value->val_int();
+ pthread_mutex_lock(&LOCK_global_system_variables);
if (option_limits)
*value= (ulonglong) getopt_ull_limit_value(tmp, option_limits);
else
*value= (ulonglong) tmp;
+ pthread_mutex_unlock(&LOCK_global_system_variables);
return 0;
}
void sys_var_ulonglong_ptr::set_default(THD *thd, enum_var_type type)
{
+ pthread_mutex_lock(&LOCK_global_system_variables);
*value= (ulonglong) option_limits->def_value;
+ pthread_mutex_unlock(&LOCK_global_system_variables);
}
@@ -1183,9 +1201,21 @@ Item *sys_var::item(THD *thd, enum_var_type var_type, LEX_STRING *base)
case SHOW_LONG:
return new Item_uint((int32) *(ulong*) value_ptr(thd, var_type, base));
case SHOW_LONGLONG:
- return new Item_int(*(longlong*) value_ptr(thd, var_type, base));
+ {
+ longlong value;
+ pthread_mutex_lock(&LOCK_global_system_variables);
+ value= *(longlong*) value_ptr(thd, var_type, base);
+ pthread_mutex_unlock(&LOCK_global_system_variables);
+ return new Item_int(value);
+ }
case SHOW_HA_ROWS:
- return new Item_int((longlong) *(ha_rows*) value_ptr(thd, var_type, base));
+ {
+ ha_rows value;
+ pthread_mutex_lock(&LOCK_global_system_variables);
+ value= *(ha_rows*) value_ptr(thd, var_type, base);
+ pthread_mutex_unlock(&LOCK_global_system_variables);
+ return new Item_int((longlong) value);
+ }
case SHOW_MY_BOOL:
return new Item_int((int32) *(my_bool*) value_ptr(thd, var_type, base),1);
case SHOW_CHAR:
@@ -1291,7 +1321,7 @@ bool sys_var_collation::check(THD *thd, set_var *var)
String str(buff,sizeof(buff), system_charset_info), *res;
if (!(res=var->value->val_str(&str)))
- res= &empty_string;
+ res= &my_empty_string;
if (!(tmp=get_charset_by_name(res->c_ptr(),MYF(0))))
{
@@ -1332,6 +1362,7 @@ bool sys_var_character_set::check(THD *thd, set_var *var)
bool sys_var_character_set::update(THD *thd, set_var *var)
{
ci_ptr(thd,var->type)[0]= var->save_result.charset;
+ thd->update_charset();
return 0;
}
@@ -1417,20 +1448,19 @@ CHARSET_INFO **
sys_var_character_set_server::ci_ptr(THD *thd, enum_var_type type)
{
if (type == OPT_GLOBAL)
- return &global_system_variables.character_set_server;
+ return &global_system_variables.collation_server;
else
- return &thd->variables.character_set_server;
+ return &thd->variables.collation_server;
}
void sys_var_character_set_server::set_default(THD *thd, enum_var_type type)
{
if (type == OPT_GLOBAL)
- global_system_variables.character_set_server= default_charset_info;
+ global_system_variables.collation_server= default_charset_info;
else
{
- thd->variables.character_set_server= (global_system_variables.
- character_set_server);
+ thd->variables.collation_server= global_system_variables.collation_server;
thd->update_charset();
}
}
@@ -1440,19 +1470,19 @@ CHARSET_INFO ** sys_var_character_set_database::ci_ptr(THD *thd,
enum_var_type type)
{
if (type == OPT_GLOBAL)
- return &global_system_variables.character_set_database;
+ return &global_system_variables.collation_database;
else
- return &thd->variables.character_set_database;
+ return &thd->variables.collation_database;
}
void sys_var_character_set_database::set_default(THD *thd, enum_var_type type)
{
if (type == OPT_GLOBAL)
- global_system_variables.character_set_database= default_charset_info;
+ global_system_variables.collation_database= default_charset_info;
else
{
- thd->variables.character_set_database= thd->db_charset;
+ thd->variables.collation_database= thd->db_charset;
thd->update_charset();
}
}
@@ -1493,6 +1523,77 @@ void sys_var_collation_connection::set_default(THD *thd, enum_var_type type)
}
}
+bool sys_var_collation_database::update(THD *thd, set_var *var)
+{
+ if (var->type == OPT_GLOBAL)
+ global_system_variables.collation_database= var->save_result.charset;
+ else
+ {
+ thd->variables.collation_database= var->save_result.charset;
+ thd->update_charset();
+ }
+ return 0;
+}
+
+
+byte *sys_var_collation_database::value_ptr(THD *thd, enum_var_type type,
+ LEX_STRING *base)
+{
+ CHARSET_INFO *cs= ((type == OPT_GLOBAL) ?
+ global_system_variables.collation_database :
+ thd->variables.collation_database);
+ return cs ? (byte*) cs->name : (byte*) "NULL";
+}
+
+
+void sys_var_collation_database::set_default(THD *thd, enum_var_type type)
+{
+ if (type == OPT_GLOBAL)
+ global_system_variables.collation_database= default_charset_info;
+ else
+ {
+ thd->variables.collation_database= (global_system_variables.
+ collation_database);
+ thd->update_charset();
+ }
+}
+
+
+bool sys_var_collation_server::update(THD *thd, set_var *var)
+{
+ if (var->type == OPT_GLOBAL)
+ global_system_variables.collation_server= var->save_result.charset;
+ else
+ {
+ thd->variables.collation_server= var->save_result.charset;
+ thd->update_charset();
+ }
+ return 0;
+}
+
+
+byte *sys_var_collation_server::value_ptr(THD *thd, enum_var_type type,
+ LEX_STRING *base)
+{
+ CHARSET_INFO *cs= ((type == OPT_GLOBAL) ?
+ global_system_variables.collation_server :
+ thd->variables.collation_server);
+ return cs ? (byte*) cs->name : (byte*) "NULL";
+}
+
+
+void sys_var_collation_server::set_default(THD *thd, enum_var_type type)
+{
+ if (type == OPT_GLOBAL)
+ global_system_variables.collation_server= default_charset_info;
+ else
+ {
+ thd->variables.collation_server= (global_system_variables.
+ collation_server);
+ thd->update_charset();
+ }
+}
+
static LEX_STRING default_key_cache_base= {(char *) DEFAULT_KEY_CACHE_NAME, 7};
@@ -1704,6 +1805,7 @@ byte *sys_var_insert_id::value_ptr(THD *thd, enum_var_type type,
bool sys_var_pseudo_thread_id::check(THD *thd, set_var *var)
{
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (thd->master_access & SUPER_ACL)
return 0;
else
@@ -1711,6 +1813,9 @@ bool sys_var_pseudo_thread_id::check(THD *thd, set_var *var)
my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), "SUPER");
return 1;
}
+#else
+ return 0;
+#endif
}
@@ -1894,8 +1999,6 @@ static byte *get_sys_var_length(const sys_var *var, uint *length,
void set_var_init()
{
- extern struct my_option my_long_options[]; // From mysqld
-
hash_init(&system_variable_hash, system_charset_info,
array_elements(sys_variables),0,0,
(hash_get_key) get_sys_var_length,0,0);
@@ -1906,7 +2009,7 @@ void set_var_init()
{
(*var)->name_length= strlen((*var)->name);
(*var)->option_limits= find_option(my_long_options, (*var)->name);
- hash_insert(&system_variable_hash, (byte*) *var);
+ my_hash_insert(&system_variable_hash, (byte*) *var);
}
/*
Special cases
@@ -2009,7 +2112,6 @@ int set_var::check(THD *thd)
}
if ((type == OPT_GLOBAL && check_global_access(thd, SUPER_ACL)))
return 1;
-
/* value is a NULL pointer if we are using SET ... = DEFAULT */
if (!value)
{
@@ -2072,17 +2174,25 @@ int set_var_user::update(THD *thd)
int set_var_password::check(THD *thd)
{
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (!user->host.str)
user->host.str= (char*) thd->host_or_ip;
/* Returns 1 as the function sends error to client */
return check_change_password(thd, user->host.str, user->user.str) ? 1 : 0;
+#else
+ return 0;
+#endif
}
int set_var_password::update(THD *thd)
{
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
/* Returns 1 as the function sends error to client */
return (change_password(thd, user->host.str, user->user.str, password) ?
1 : 0);
+#else
+ return 0;
+#endif
}
/****************************************************************************
diff --git a/sql/set_var.h b/sql/set_var.h
index 74cc03a3cb9..812bd6c9420 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -30,11 +30,6 @@ class set_var;
typedef struct system_variables SV;
extern TYPELIB bool_typelib, delay_key_write_typelib, sql_mode_typelib;
-extern ulonglong dflt_key_buff_size;
-extern uint dflt_key_cache_block_size;
-extern uint dflt_key_cache_division_limit;
-extern uint dflt_key_cache_age_threshold;
-
enum enum_var_type
{
OPT_DEFAULT, OPT_SESSION, OPT_GLOBAL
@@ -528,72 +523,33 @@ public:
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
};
-
-class sys_var_key_cache_param :public sys_var
-{
-protected:
- uint offset;
-public:
- sys_var_key_cache_param(const char *name_arg)
- :sys_var(name_arg)
- {
- offset= 0;
- }
- byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
-};
-
-class sys_var_key_buffer_size :public sys_var_key_cache_param
+class sys_var_collation_server :public sys_var_collation
{
public:
- sys_var_key_buffer_size(const char *name_arg)
- :sys_var_key_cache_param(name_arg)
- {
- offset= offsetof(KEY_CACHE_VAR, buff_size);
- }
+ sys_var_collation_server(const char *name_arg) :sys_var_collation(name_arg) {}
bool update(THD *thd, set_var *var);
- SHOW_TYPE type() { return SHOW_LONGLONG; }
- bool check_default(enum_var_type type) { return 1; }
- bool is_struct() { return 1; }
-};
-
-class sys_var_key_cache_block_size :public sys_var_key_cache_param
-{
-public:
- sys_var_key_cache_block_size(const char *name_arg)
- :sys_var_key_cache_param(name_arg)
- {
- offset= offsetof(KEY_CACHE_VAR, block_size);
- }
- bool update(THD *thd, set_var *var);
- SHOW_TYPE type() { return SHOW_LONG; }
- bool check_default(enum_var_type type) { return 1; }
- bool is_struct() { return 1; }
+ void set_default(THD *thd, enum_var_type type);
+ byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
};
-class sys_var_key_cache_division_limit :public sys_var_key_cache_param
+class sys_var_collation_database :public sys_var_collation
{
public:
- sys_var_key_cache_division_limit(const char *name_arg)
- :sys_var_key_cache_param(name_arg)
- {
- offset= offsetof(KEY_CACHE_VAR, division_limit);
- }
+ sys_var_collation_database(const char *name_arg) :sys_var_collation(name_arg) {}
bool update(THD *thd, set_var *var);
- SHOW_TYPE type() { return SHOW_LONG; }
- bool check_default(enum_var_type type) { return 1; }
- bool is_struct() { return 1; }
+ void set_default(THD *thd, enum_var_type type);
+ byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
};
-class sys_var_key_cache_age_threshold :public sys_var_key_cache_param
+class sys_var_key_buffer_size :public sys_var
{
public:
- sys_var_key_cache_age_threshold(const char *name_arg)
- :sys_var_key_cache_param(name_arg)
- {
- offset= offsetof(KEY_CACHE_VAR, age_threshold);
- }
+ sys_var_key_buffer_size(const char *name_arg)
+ :sys_var(name_arg)
+ {}
bool update(THD *thd, set_var *var);
- SHOW_TYPE type() { return SHOW_LONG; }
+ SHOW_TYPE type() { return SHOW_LONGLONG; }
+ byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
bool check_default(enum_var_type type) { return 1; }
bool is_struct() { return 1; }
};
@@ -750,6 +706,9 @@ public:
}
};
+/* updated in sql_acl.cc */
+
+extern sys_var_thd_bool sys_old_passwords;
/* For sql_yacc */
struct sys_var_with_base
@@ -775,6 +734,5 @@ gptr find_named(I_List<NAMED_LIST> *list, const char *name, uint length,
void delete_elements(I_List<NAMED_LIST> *list, void (*free_element)(gptr));
/* key_cache functions */
-KEY_CACHE_VAR *get_or_create_key_cache(const char *name, uint length);
+KEY_CACHE *get_or_create_key_cache(const char *name, uint length);
void free_key_cache(gptr key_cache);
-bool process_key_caches(int (* func) (KEY_CACHE_VAR *));
diff --git a/sql/share/Makefile.am b/sql/share/Makefile.am
index 35202ff4722..662159a9c63 100644
--- a/sql/share/Makefile.am
+++ b/sql/share/Makefile.am
@@ -30,7 +30,7 @@ install-data-local:
fix_errors:
for lang in @AVAILABLE_LANGUAGES@; \
do \
- ../../extra/comp_err $(srcdir)/$$lang/errmsg.txt $(srcdir)/$$lang/errmsg.sys; \
+ ../../extra/comp_err -C$(srcdir)/charsets/ $(srcdir)/$$lang/errmsg.txt $(srcdir)/$$lang/errmsg.sys; \
done
# Don't update the files from bitkeeper
diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt
index 1beffa81671..dc2405031fd 100644
--- a/sql/share/czech/errmsg.txt
+++ b/sql/share/czech/errmsg.txt
@@ -1,4 +1,4 @@
-v/*
+/*
Modifikoval Petr -B©najdr, snajdr@pvt.net, snajdr@cpress.cz v.0.01
ISO LATIN-8852-2
Dal-B¹í verze Jan Pazdziora, adelton@fi.muni.cz
@@ -10,6 +10,8 @@ v/*
Thu Nov 30 14:02:52 MET 2000 podle 3.23.28
*/
+character-set=latin2
+
"hashchk",
"isamchk",
"NE",
@@ -251,7 +253,7 @@ v/*
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
-"Subselect returns more than 1 record",
+"Subquery returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
@@ -270,6 +272,11 @@ v/*
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
+"Record count is fewer than the column count at row %ld";
+"Record count is more than the column count at row %ld";
+"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
+"Data truncated, out of range for column '%s' at row %ld";
+"Data truncated for column '%s' at row %ld"
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users"
@@ -278,3 +285,9 @@ v/*
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
+"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
+"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
+"Wrong parameter or combination of parameters for START SLAVE UNTIL"
+"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
+"SQL thread is not to be started so UNTIL options are ignored"
diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt
index c13141fc669..e0b6abe8c94 100644
--- a/sql/share/danish/errmsg.txt
+++ b/sql/share/danish/errmsg.txt
@@ -4,6 +4,8 @@
/* Knud Riishøjgård knudriis@post.tele.dk 99 &&
Carsten H. Pedersen, carsten.pedersen@bitbybit.dk oct. 1999 / aug. 2001. */
+character-set=latin1
+
"hashchk",
"isamchk",
"NEJ",
@@ -245,7 +247,7 @@
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
-"Subselect returns more than 1 record",
+"Subquery returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
@@ -264,6 +266,11 @@
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
+"Record count is fewer than the column count at row %ld";
+"Record count is more than the column count at row %ld";
+"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
+"Data truncated, out of range for column '%s' at row %ld";
+"Data truncated for column '%s' at row %ld"
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users"
@@ -272,3 +279,9 @@
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
+"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
+"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
+"Wrong parameter or combination of parameters for START SLAVE UNTIL"
+"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
+"SQL thread is not to be started so UNTIL options are ignored"
diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt
index b454566f3ba..0f16c7b1631 100644
--- a/sql/share/dutch/errmsg.txt
+++ b/sql/share/dutch/errmsg.txt
@@ -12,6 +12,8 @@
Translated new error messages.
*/
+character-set=latin1
+
"hashchk",
"isamchk",
"NEE",
@@ -253,7 +255,7 @@
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
-"Subselect returns more than 1 record",
+"Subquery returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
@@ -272,6 +274,11 @@
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
+"Record count is fewer than the column count at row %ld";
+"Record count is more than the column count at row %ld";
+"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
+"Data truncated, out of range for column '%s' at row %ld";
+"Data truncated for column '%s' at row %ld"
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users"
@@ -280,3 +287,9 @@
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
+"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
+"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
+"Wrong parameter or combination of parameters for START SLAVE UNTIL"
+"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
+"SQL thread is not to be started so UNTIL options are ignored"
diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt
index 5655ad32d3d..ad07fad58b2 100644
--- a/sql/share/english/errmsg.txt
+++ b/sql/share/english/errmsg.txt
@@ -1,6 +1,8 @@
/* Copyright Abandoned 1997 TCX DataKonsult AB & Monty Program KB & Detron HB
This file is public domain and comes with NO WARRANTY of any kind */
+character-set=latin1
+
"hashchk",
"isamchk",
"NO",
@@ -242,7 +244,7 @@
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
-"Subselect returns more than 1 record",
+"Subquery returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
@@ -274,3 +276,9 @@
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
+"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format",
+"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
+"Wrong parameter or combination of parameters for START SLAVE UNTIL"
+"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
+"SQL thread is not to be started so UNTIL options are ignored"
diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt
index 8e7a7121dfa..a1041b487f7 100644
--- a/sql/share/estonian/errmsg.txt
+++ b/sql/share/estonian/errmsg.txt
@@ -6,6 +6,8 @@
*/
+character-set=latin7
+
"hashchk",
"isamchk",
"EI",
@@ -247,7 +249,7 @@
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
-"Subselect returns more than 1 record",
+"Subquery returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
@@ -266,6 +268,11 @@
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
+"Record count is fewer than the column count at row %ld";
+"Record count is more than the column count at row %ld";
+"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
+"Data truncated, out of range for column '%s' at row %ld";
+"Data truncated for column '%s' at row %ld"
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users"
@@ -274,3 +281,9 @@
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
+"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
+"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
+"Wrong parameter or combination of parameters for START SLAVE UNTIL"
+"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
+"SQL thread is not to be started so UNTIL options are ignored"
diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt
index 8a6d786bee8..8e79d6f5067 100644
--- a/sql/share/french/errmsg.txt
+++ b/sql/share/french/errmsg.txt
@@ -1,6 +1,8 @@
/* Copyright Abandoned 1997 TCX DataKonsult AB & Monty Program KB & Detron HB
This file is public domain and comes with NO WARRANTY of any kind */
+character-set=latin1
+
"hashchk",
"isamchk",
"NON",
@@ -242,7 +244,7 @@
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
-"Subselect returns more than 1 record",
+"Subquery returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
@@ -261,6 +263,11 @@
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
+"Record count is fewer than the column count at row %ld";
+"Record count is more than the column count at row %ld";
+"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
+"Data truncated, out of range for column '%s' at row %ld";
+"Data truncated for column '%s' at row %ld"
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users"
@@ -269,3 +276,9 @@
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
+"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
+"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
+"Wrong parameter or combination of parameters for START SLAVE UNTIL"
+"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
+"SQL thread is not to be started so UNTIL options are ignored"
diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt
index db20cc5dad9..20edc56f4c8 100644
--- a/sql/share/german/errmsg.txt
+++ b/sql/share/german/errmsg.txt
@@ -10,6 +10,8 @@
2002-12-11
*/
+character-set=latin1
+
"hashchk",
"isamchk",
"Nein",
@@ -270,6 +272,11 @@
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
+"Record count is fewer than the column count at row %ld";
+"Record count is more than the column count at row %ld";
+"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
+"Data truncated, out of range for column '%s' at row %ld";
+"Data truncated for column '%s' at row %ld"
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users"
@@ -278,3 +285,9 @@
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
+"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
+"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
+"Wrong parameter or combination of parameters for START SLAVE UNTIL"
+"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
+"SQL thread is not to be started so UNTIL options are ignored"
diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt
index f844ee59dab..74c81bfb9a4 100644
--- a/sql/share/greek/errmsg.txt
+++ b/sql/share/greek/errmsg.txt
@@ -1,6 +1,8 @@
/* Copyright Abandoned 1997 TCX DataKonsult AB & Monty Program KB & Detron HB
This file is public domain and comes with NO WARRANTY of any kind */
+character-set=greek
+
"hashchk",
"isamchk",
"Ï×É",
@@ -242,7 +244,7 @@
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
-"Subselect returns more than 1 record",
+"Subquery returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
@@ -261,6 +263,11 @@
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
+"Record count is fewer than the column count at row %ld";
+"Record count is more than the column count at row %ld";
+"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
+"Data truncated, out of range for column '%s' at row %ld";
+"Data truncated for column '%s' at row %ld"
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users"
@@ -269,3 +276,9 @@
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
+"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
+"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
+"Wrong parameter or combination of parameters for START SLAVE UNTIL"
+"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
+"SQL thread is not to be started so UNTIL options are ignored"
diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt
index 7e60515aace..36b1027ee6e 100644
--- a/sql/share/hungarian/errmsg.txt
+++ b/sql/share/hungarian/errmsg.txt
@@ -3,6 +3,8 @@
Updated May, 2000
This file is public domain and comes with NO WARRANTY of any kind */
+character-set=latin2
+
"hashchk",
"isamchk",
"NEM",
@@ -244,7 +246,7 @@
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
-"Subselect returns more than 1 record",
+"Subquery returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
@@ -263,6 +265,11 @@
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
+"Record count is fewer than the column count at row %ld";
+"Record count is more than the column count at row %ld";
+"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
+"Data truncated, out of range for column '%s' at row %ld";
+"Data truncated for column '%s' at row %ld"
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users"
@@ -271,3 +278,9 @@
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
+"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
+"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
+"Wrong parameter or combination of parameters for START SLAVE UNTIL"
+"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
+"SQL thread is not to be started so UNTIL options are ignored"
diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt
index a624d90661d..b9ad340f9f8 100644
--- a/sql/share/italian/errmsg.txt
+++ b/sql/share/italian/errmsg.txt
@@ -1,6 +1,8 @@
/* Copyright Abandoned 1997 TCX DataKonsult AB & Monty Program KB & Detron HB
This file is public domain and comes with NO WARRANTY of any kind */
+character-set=latin1
+
"hashchk",
"isamchk",
"NO",
@@ -242,7 +244,7 @@
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
-"Subselect returns more than 1 record",
+"Subquery returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
@@ -261,6 +263,11 @@
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
+"Record count is fewer than the column count at row %ld";
+"Record count is more than the column count at row %ld";
+"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
+"Data truncated, out of range for column '%s' at row %ld";
+"Data truncated for column '%s' at row %ld"
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users"
@@ -269,3 +276,9 @@
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
+"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
+"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
+"Wrong parameter or combination of parameters for START SLAVE UNTIL"
+"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
+"SQL thread is not to be started so UNTIL options are ignored"
diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt
index b5693fe6e41..4a36dc7b54c 100644
--- a/sql/share/japanese/errmsg.txt
+++ b/sql/share/japanese/errmsg.txt
@@ -3,6 +3,8 @@
3.22.10-beta euc-japanese (ujis) text
*/
+character-set=ujis
+
"hashchk",
"isamchk",
"NO",
@@ -244,7 +246,7 @@
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
-"Subselect returns more than 1 record",
+"Subquery returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
@@ -263,6 +265,11 @@
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
+"Record count is fewer than the column count at row %ld";
+"Record count is more than the column count at row %ld";
+"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
+"Data truncated, out of range for column '%s' at row %ld";
+"Data truncated for column '%s' at row %ld"
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users"
@@ -271,3 +278,9 @@
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
+"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
+"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
+"Wrong parameter or combination of parameters for START SLAVE UNTIL"
+"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
+"SQL thread is not to be started so UNTIL options are ignored"
diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt
index bc2d6eb9caa..d6a2510ea09 100644
--- a/sql/share/korean/errmsg.txt
+++ b/sql/share/korean/errmsg.txt
@@ -1,6 +1,8 @@
/* Copyright Abandoned 1997 TCX DataKonsult AB & Monty Program KB & Detron HB
This È­ÀÏ is public domain and comes with NO WARRANTY of any kind */
+character-set=euckr
+
"hashchk",
"isamchk",
"¾Æ´Ï¿À",
@@ -242,7 +244,7 @@
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
-"Subselect returns more than 1 record",
+"Subquery returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
@@ -261,6 +263,11 @@
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
+"Record count is fewer than the column count at row %ld";
+"Record count is more than the column count at row %ld";
+"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
+"Data truncated, out of range for column '%s' at row %ld";
+"Data truncated for column '%s' at row %ld"
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users"
@@ -269,3 +276,9 @@
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
+"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
+"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
+"Wrong parameter or combination of parameters for START SLAVE UNTIL"
+"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
+"SQL thread is not to be started so UNTIL options are ignored"
diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt
index 9bf0d4845c7..1849e1e6595 100644
--- a/sql/share/norwegian-ny/errmsg.txt
+++ b/sql/share/norwegian-ny/errmsg.txt
@@ -3,6 +3,8 @@
/* Roy-Magne Mo rmo@www.hivolda.no 97 */
+character-set=latin1
+
"hashchk",
"isamchk",
"NEI",
@@ -244,7 +246,7 @@
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
-"Subselect returns more than 1 record",
+"Subquery returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
@@ -263,6 +265,11 @@
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
+"Record count is fewer than the column count at row %ld";
+"Record count is more than the column count at row %ld";
+"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
+"Data truncated, out of range for column '%s' at row %ld";
+"Data truncated for column '%s' at row %ld"
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users"
@@ -271,3 +278,9 @@
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
+"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
+"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
+"Wrong parameter or combination of parameters for START SLAVE UNTIL"
+"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
+"SQL thread is not to be started so UNTIL options are ignored"
diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt
index 4a025e7218f..942ec7f3303 100644
--- a/sql/share/norwegian/errmsg.txt
+++ b/sql/share/norwegian/errmsg.txt
@@ -3,6 +3,8 @@
/* Roy-Magne Mo rmo@www.hivolda.no 97 */
+character-set=latin1
+
"hashchk",
"isamchk",
"NEI",
@@ -244,7 +246,7 @@
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
-"Subselect returns more than 1 record",
+"Subquery returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
@@ -263,6 +265,11 @@
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
+"Record count is fewer than the column count at row %ld";
+"Record count is more than the column count at row %ld";
+"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
+"Data truncated, out of range for column '%s' at row %ld";
+"Data truncated for column '%s' at row %ld"
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users"
@@ -271,3 +278,9 @@
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
+"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
+"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
+"Wrong parameter or combination of parameters for START SLAVE UNTIL"
+"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
+"SQL thread is not to be started so UNTIL options are ignored"
diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt
index 1a6634fb96c..2db59ddae86 100644
--- a/sql/share/polish/errmsg.txt
+++ b/sql/share/polish/errmsg.txt
@@ -5,6 +5,8 @@
Charset ISO-8859-2
*/
+character-set=latin2
+
"hashchk",
"isamchk",
"NIE",
@@ -246,7 +248,7 @@
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
-"Subselect returns more than 1 record",
+"Subquery returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
@@ -265,6 +267,11 @@
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
+"Record count is fewer than the column count at row %ld";
+"Record count is more than the column count at row %ld";
+"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
+"Data truncated, out of range for column '%s' at row %ld";
+"Data truncated for column '%s' at row %ld"
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users"
@@ -273,3 +280,9 @@
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
+"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
+"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
+"Wrong parameter or combination of parameters for START SLAVE UNTIL"
+"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
+"SQL thread is not to be started so UNTIL options are ignored"
diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt
index 99a940e62ab..af4e210a5b7 100644
--- a/sql/share/portuguese/errmsg.txt
+++ b/sql/share/portuguese/errmsg.txt
@@ -1,6 +1,9 @@
/* Copyright Abandoned 1997 TCX DataKonsult AB & Monty Program KB & Detron HB
This file is public domain and comes with NO WARRANTY of any kind */
/* Updated by Thiago Delgado Pinto - thiagodp@ieg.com.br - 06.07.2002 */
+
+character-set=latin1
+
"hashchk",
"isamchk",
"NÃO",
@@ -219,26 +222,26 @@
"Não pode acrescentar uma restrição de chave estrangeira",
"Não pode acrescentar uma linha filha: uma restrição de chave estrangeira falhou",
"Não pode apagar uma linha pai: uma restrição de chave estrangeira falhou",
-"Erro connectando para o master: %-.128s",
+"Erro conectando com o master: %-.128s",
"Erro rodando consulta no master: %-.128s",
"Erro quando executando comando %s: %-.128s",
"Uso errado de %s e %s",
-"Os comandos SELECT usados têm diferentes números de colunas",
-"Não pode executar a consulta porque você tem um conflitante travamento de leitura",
-"Combinação de tabelas transacionais e não transacionais está desativada",
+"Os comandos SELECT usados têm diferente número de colunas",
+"Não posso executar a consulta porque você tem um conflito de travamento de leitura",
+"Mistura de tabelas transacional e não-transacional está desabilitada",
"Opção '%s' usada duas vezes no comando",
-"Usuário '%-.64s' há excedido o '%s' de recursos (atual valor: %ld)",
-"Acesso negado. Você necessita o privilégio %-.128s para essa operação",
+"Usuário '%-.64s' tem excedido o '%s' recurso (atual valor: %ld)",
+"Acesso negado. Você precisa o privilégio %-.128s para essa operação",
"Variável '%-.64s' é uma LOCAL variável e não pode ser usada com SET GLOBAL",
-"Variável '%-.64s' é uma GLOBAL variável e deve ser configurada com SET GLOBAL",
-"Variável '%-.64s' não tem um valor default (padrão)",
+"Variável '%-.64s' é uma GLOBAL variável e deve ser configurada com SET GLOBAL",
+"Variável '%-.64s' não tem um valor padrão",
"Variável '%-.64s' não pode ser configurada para o valor de '%-.64s'",
-"Tipo de argumento errado para a variável '%-.64s'",
+"Tipo errado de argumento para variável '%-.64s'",
"Variável '%-.64s' somente pode ser configurada, não lida",
-"Uso/localização errada de '%s'",
+"Errado uso/colocação de '%s'",
"Esta versão de MySQL não suporta ainda '%s'",
-"Obteve fatal error %d: '%-.128s' a partir do master quando lendo dados do binary log",
-"Slave SQL thread ignored the query because of replicate-*-table rules",
+"Obteve fatal erro %d: '%-.128s' do master quando lendo dados do binary log",
+"Slave SQL thread ignorado a consulta devido às normas de replicação-*-tabela"
"Definição errada da chave estrangeira para '%-.64s': %s",
"Referência da chave e referência da tabela não coincidem",
"Error de cardinalidade (mais/menos que %d colunas)",
@@ -261,6 +264,11 @@
"Z_MEM_ERROR: Não suficiente espaço no buffer emissor para zlib (provavelmente, o comprimento dos dados descomprimidos está corrupto)",
"Z_DATA_ERROR: Dados de entrada está corrupto para zlib",
"%d linha(s) foi(foram) cortada(s) por group_concat()",
+"Record count is fewer than the column count at row %ld";
+"Record count is more than the column count at row %ld";
+"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
+"Data truncated, out of range for column '%s' at row %ld";
+"Data truncated for column '%s' at row %ld"
"Usando engine de armazenamento %s para tabela '%s'",
"Combinação ilegal de collations (%s,%s) e (%s,%s) para operação '%s'",
"Can't drop one or more of the requested users"
@@ -269,3 +277,9 @@
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
+"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
+"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
+"Wrong parameter or combination of parameters for START SLAVE UNTIL"
+"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
+"SQL thread is not to be started so UNTIL options are ignored"
diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt
index 61591d54d40..54f2b2db679 100644
--- a/sql/share/romanian/errmsg.txt
+++ b/sql/share/romanian/errmsg.txt
@@ -5,6 +5,8 @@
e-mail: tzoompy@cs.washington.edu
*/
+character-set=latin2
+
"hashchk",
"isamchk",
"NU",
@@ -246,7 +248,7 @@
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
-"Subselect returns more than 1 record",
+"Subquery returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
@@ -265,6 +267,11 @@
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
+"Record count is fewer than the column count at row %ld";
+"Record count is more than the column count at row %ld";
+"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
+"Data truncated, out of range for column '%s' at row %ld";
+"Data truncated for column '%s' at row %ld"
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users"
@@ -273,3 +280,9 @@
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
+"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
+"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
+"Wrong parameter or combination of parameters for START SLAVE UNTIL"
+"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
+"SQL thread is not to be started so UNTIL options are ignored"
diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt
index b1876f83008..ea9b8265b77 100644
--- a/sql/share/russian/errmsg.txt
+++ b/sql/share/russian/errmsg.txt
@@ -3,6 +3,8 @@
This file is public domain and comes with NO WARRANTY of any kind */
/* charset: KOI8-R */
+character-set=koi8r
+
"hashchk",
"isamchk",
"îåô",
@@ -263,6 +265,11 @@
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
+"Record count is fewer than the column count at row %ld";
+"Record count is more than the column count at row %ld";
+"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
+"Data truncated, out of range for column '%s' at row %ld";
+"Data truncated for column '%s' at row %ld"
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users"
@@ -271,3 +278,9 @@
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
+"óÅÒ×ÅÒ ÚÁÐÕÝÅÎ × ÒÅÖÉÍÅ --secure-auth (ÂÅÚÏÐÁÓÎÏÊ Á×ÔÏÒÉÚÁÃÉÉ), ÎÏ ÄÌÑ ÐÏÌØÚÏ×ÁÔÅÌÑ '%s@%s' ÐÁÒÏÌØ ÓÏÈÒÁÎ£Î × ÓÔÁÒÏÍ ÆÏÒÍÁÔÅ; ÎÅÏÂÈÏÄÉÍÏ ÏÂÎÏ×ÉÔØ ÆÏÒÍÁÔ ÐÁÒÏÌÑ"
+"ðÏÌÅ ÉÌÉ ÓÓÙÌËÁ '%-.64s%s%-.64s%s%-.64s' ÉÚ SELECTÁ #%d ÂÙÌÁ ÎÁÊÄÅÎÁ × SELECTÅ #%d",
+"Wrong parameter or combination of parameters for START SLAVE UNTIL"
+"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
+"SQL thread is not to be started so UNTIL options are ignored"
diff --git a/sql/share/serbian/errmsg.txt b/sql/share/serbian/errmsg.txt
index 9e2a37e4053..d57ef669050 100644
--- a/sql/share/serbian/errmsg.txt
+++ b/sql/share/serbian/errmsg.txt
@@ -7,6 +7,8 @@
Charset: cp1250
*/
+character-set=cp1250
+
"hashchk",
"isamchk",
"NE",
@@ -237,7 +239,7 @@
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
-"Subselect returns more than 1 record",
+"Subquery returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
@@ -256,6 +258,11 @@
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
+"Record count is fewer than the column count at row %ld";
+"Record count is more than the column count at row %ld";
+"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
+"Data truncated, out of range for column '%s' at row %ld";
+"Data truncated for column '%s' at row %ld"
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users"
@@ -264,3 +271,9 @@
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
+"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
+"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
+"Wrong parameter or combination of parameters for START SLAVE UNTIL"
+"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
+"SQL thread is not to be started so UNTIL options are ignored"
diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt
index a96d512cb72..f913ca3fbff 100644
--- a/sql/share/slovak/errmsg.txt
+++ b/sql/share/slovak/errmsg.txt
@@ -9,6 +9,8 @@
Date: Streda 11. November 1998 20:58:15
*/
+character-set=latin2
+
"hashchk",
"isamchk",
"NIE",
@@ -250,7 +252,7 @@
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
-"Subselect returns more than 1 record",
+"Subquery returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
@@ -269,6 +271,11 @@
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
+"Record count is fewer than the column count at row %ld";
+"Record count is more than the column count at row %ld";
+"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
+"Data truncated, out of range for column '%s' at row %ld";
+"Data truncated for column '%s' at row %ld"
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users"
@@ -277,3 +284,9 @@
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
+"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
+"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
+"Wrong parameter or combination of parameters for START SLAVE UNTIL"
+"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
+"SQL thread is not to be started so UNTIL options are ignored"
diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt
index df18b8bf7f0..b69599cfa33 100644
--- a/sql/share/spanish/errmsg.txt
+++ b/sql/share/spanish/errmsg.txt
@@ -2,6 +2,9 @@
This file is public domain and comes with NO WARRANTY of any kind
Traduccion por Miguel Angel Fernandez Roiz -- LoboCom Sistemas, s.l.
From June 28, 2001 translated by Miguel Solorzano miguel@mysql.com */
+
+character-set=latin1
+
"hashchk",
"isamchk",
"NO",
@@ -223,27 +226,27 @@
"Error de coneccion a master: %-128s",
"Error executando el query en master: %-128%",
"Error de %s: %-128%",
-"Wrong usage of %s and %s",
-"The used SELECT statements have a different number of columns",
-"Can't execute the query because you have a conflicting read lock",
-"Mixing of transactional and non-transactional tables is disabled",
-"Option '%s' used twice in statement",
-"User '%-.64s' has exceeded the '%s' resource (current value: %ld)",
-"Access denied. You need the %-.128s privilege for this operation",
-"Variable '%-.64s' is a LOCAL variable and can't be used with SET GLOBAL",
-"Variable '%-.64s' is a GLOBAL variable and should be set with SET GLOBAL",
-"Variable '%-.64s' doesn't have a default value",
-"Variable '%-.64s' can't be set to the value of '%-.64s'",
-"Wrong argument type to variable '%-.64s'",
-"Variable '%-.64s' can only be set, not read",
-"Wrong usage/placement of '%s'",
-"This version of MySQL doesn't yet support '%s'",
-"Got fatal error %d: '%-.128s' from master when reading data from binary log",
-"Slave SQL thread ignored the query because of replicate-*-table rules",
+"Equivocado uso de %s y %s",
+"El comando SELECT usado tiene diferente número de columnas",
+"No puedo ejecutar el query porque usted tiene conflicto de traba de lectura",
+"Mezla de transancional y no-transancional tablas está deshabilitada",
+"Opción '%s' usada dos veces en el comando",
+"Usuario '%-.64s' ha excedido el recurso '%s' (actual valor: %ld)",
+"Acceso negado. Usted necesita el privilegio %-.128s para esta operación",
+"Variable '%-.64s' es una LOCAL variable y no puede ser usada con SET GLOBAL",
+"Variable '%-.64s' es una GLOBAL variable y no puede ser configurada con SET GLOBAL",
+"Variable '%-.64s' no tiene un valor patrón",
+"Variable '%-.64s' no puede ser configurada para el valor de '%-.64s'",
+"Tipo de argumento equivocado para variable '%-.64s'",
+"Variable '%-.64s' solamente puede ser configurada, no leída",
+"Equivocado uso/colocación de '%s'",
+"Esta versión de MySQL no soporta todavia '%s'",
+"Recibió fatal error %d: '%-.128s' del master cuando leyendo datos del binary log",
+"Slave SQL thread ignorado el query debido a las reglas de replicación-*-tabla"
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
-"Subselect returns more than 1 record",
+"Subquery returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
@@ -262,6 +265,11 @@
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
+"Record count is fewer than the column count at row %ld";
+"Record count is more than the column count at row %ld";
+"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
+"Data truncated, out of range for column '%s' at row %ld";
+"Data truncated for column '%s' at row %ld"
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users"
@@ -270,3 +278,9 @@
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
+"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
+"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
+"Wrong parameter or combination of parameters for START SLAVE UNTIL"
+"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
+"SQL thread is not to be started so UNTIL options are ignored"
diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt
index 07187f7ca34..e0d0bea47d2 100644
--- a/sql/share/swedish/errmsg.txt
+++ b/sql/share/swedish/errmsg.txt
@@ -1,6 +1,8 @@
/* Copyright Abandoned 1997 TCX DataKonsult AB & Monty Program KB & Detron HB
This file is public domain and comes with NO WARRANTY of any kind */
+character-set=latin1
+
"hashchk",
"isamchk",
"NO",
@@ -242,10 +244,10 @@
"Felaktig FOREIGN KEY-definition för '%-.64s': %s",
"Nyckelreferensen och tabellreferensen stämmer inte överens",
"Kardinalitetsfel (fler/färre än %d kolumner)",
-"Subselect returnerade mer än 1 rad",
+"Subquery returnerade mer än 1 rad",
"Okänd PREPARED STATEMENT id (%ld) var given till %s",
"Hjälpdatabasen finns inte eller är skadad",
-"Cyklisk referens i subselect",
+"Cyklisk referens i subqueries",
"Konvertar kolumn '%s' från %s till %s",
"Referens '%-.64s' stöds inte (%s)",
"Varje 'derived table' måste ha sitt eget alias",
@@ -261,6 +263,11 @@
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d rad(er) kapades av group_concat()",
+"Record count is fewer than the column count at row %ld";
+"Record count is more than the column count at row %ld";
+"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
+"Data truncated, out of range for column '%s' at row %ld";
+"Data truncated for column '%s' at row %ld"
"Använder handler %s för tabell '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users"
@@ -269,3 +276,9 @@
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
+"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
+"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
+"Wrong parameter or combination of parameters for START SLAVE UNTIL"
+"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
+"SQL thread is not to be started so UNTIL options are ignored"
diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt
index a0604ba862c..8bd060781bb 100644
--- a/sql/share/ukrainian/errmsg.txt
+++ b/sql/share/ukrainian/errmsg.txt
@@ -6,6 +6,8 @@
* Version: 13/09/2001 mysql-3.23.41
*/
+character-set=koi8u
+
"hashchk",
"isamchk",
"î¶",
@@ -266,6 +268,11 @@
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
+"Record count is fewer than the column count at row %ld";
+"Record count is more than the column count at row %ld";
+"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
+"Data truncated, out of range for column '%s' at row %ld";
+"Data truncated for column '%s' at row %ld"
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users"
@@ -274,3 +281,9 @@
"Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
+"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
+"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
+"óÔÏ×ÂÅÃØ ÁÂÏ ÐÏÓÉÌÁÎÎÑ '%-.64s%s%-.64s%s%-.64s' ¦Ú SELECTÕ #%d ÂÕÌÏ ÚÎÁÊÄÅÎÅ Õ SELECT¦ #%d",
+"Wrong parameter or combination of parameters for START SLAVE UNTIL"
+"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
+"SQL thread is not to be started so UNTIL options are ignored"
diff --git a/sql/slave.cc b/sql/slave.cc
index d45cf1aa8b9..641707aab2f 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -238,10 +238,12 @@ int init_relay_log_pos(RELAY_LOG_INFO* rli,const char* log,
*errmsg=0;
pthread_mutex_t *log_lock=rli->relay_log.get_log_lock();
- pthread_mutex_lock(log_lock);
+
if (need_data_lock)
pthread_mutex_lock(&rli->data_lock);
+ pthread_mutex_lock(log_lock);
+
/* Close log file and free buffers if it's already open */
if (rli->cur_log_fd >= 0)
{
@@ -304,10 +306,12 @@ err:
if (!relay_log_purge)
rli->log_space_limit= 0;
pthread_cond_broadcast(&rli->data_cond);
+
+ pthread_mutex_unlock(log_lock);
+
if (need_data_lock)
pthread_mutex_unlock(&rli->data_lock);
- pthread_mutex_unlock(log_lock);
DBUG_RETURN ((*errmsg) ? 1 : 0);
}
@@ -786,7 +790,7 @@ int add_table_rule(HASH* h, const char* table_spec)
e->tbl_name = e->db + (dot - table_spec) + 1;
e->key_len = len;
memcpy(e->db, table_spec, len);
- (void)hash_insert(h, (byte*)e);
+ (void)my_hash_insert(h, (byte*)e);
return 0;
}
@@ -1505,11 +1509,10 @@ static bool wait_for_relay_log_space(RELAY_LOG_INFO* rli)
DBUG_ENTER("wait_for_relay_log_space");
pthread_mutex_lock(&rli->log_space_lock);
- save_proc_info = thd->proc_info;
- thd->proc_info = "Waiting for relay log space to free";
save_proc_info= thd->enter_cond(&rli->log_space_cond,
&rli->log_space_lock,
- "Waiting for relay log space to free");
+ "\
+Waiting for the SQL slave thread to free enough relay log space");
while (rli->log_space_limit < rli->log_space_total &&
!(slave_killed=io_slave_killed(thd,mi)) &&
!rli->ignore_log_space_limit)
@@ -1544,6 +1547,7 @@ static int count_relay_log_space(RELAY_LOG_INFO* rli)
DBUG_RETURN(0);
}
+
void init_master_info_with_options(MASTER_INFO* mi)
{
mi->master_log_name[0] = 0;
@@ -1554,11 +1558,24 @@ void init_master_info_with_options(MASTER_INFO* mi)
if (master_user)
strmake(mi->user, master_user, sizeof(mi->user) - 1);
if (master_password)
- strmake(mi->password, master_password, HASH_PASSWORD_LENGTH);
+ strmake(mi->password, master_password, MAX_PASSWORD_LENGTH);
mi->port = master_port;
mi->connect_retry = master_connect_retry;
+
+ mi->ssl= master_ssl;
+ if (master_ssl_ca)
+ strmake(mi->ssl_ca, master_ssl_ca, sizeof(mi->ssl_ca)-1);
+ if (master_ssl_capath)
+ strmake(mi->ssl_capath, master_ssl_capath, sizeof(mi->ssl_capath)-1);
+ if (master_ssl_cert)
+ strmake(mi->ssl_cert, master_ssl_cert, sizeof(mi->ssl_cert)-1);
+ if (master_ssl_cipher)
+ strmake(mi->ssl_cipher, master_ssl_cipher, sizeof(mi->ssl_cipher)-1);
+ if (master_ssl_key)
+ strmake(mi->ssl_key, master_ssl_key, sizeof(mi->ssl_key)-1);
}
+
void clear_last_slave_error(RELAY_LOG_INFO* rli)
{
//Clear the errors displayed by SHOW SLAVE STATUS
@@ -1566,6 +1583,24 @@ void clear_last_slave_error(RELAY_LOG_INFO* rli)
rli->last_slave_errno=0;
}
+
+/*
+ Reset UNTIL condition for RELAY_LOG_INFO
+ SYNOPSYS
+ clear_until_condition()
+ rli - RELAY_LOG_INFO structure where UNTIL condition should be reset
+ */
+void clear_until_condition(RELAY_LOG_INFO* rli)
+{
+ rli->until_condition= RELAY_LOG_INFO::UNTIL_NONE;
+ rli->until_log_name[0]= 0;
+ rli->until_log_pos= 0;
+}
+
+
+#define LINES_IN_MASTER_INFO_WITH_SSL 14
+
+
int init_master_info(MASTER_INFO* mi, const char* master_info_fname,
const char* slave_info_fname,
bool abort_if_no_master_info_file)
@@ -1643,25 +1678,87 @@ file '%s')", fname);
}
mi->fd = fd;
- int port, connect_retry, master_log_pos;
-
+ int port, connect_retry, master_log_pos, ssl= 0, lines;
+ char *first_non_digit;
+
+ /*
+ Starting from 4.1.x master.info has new format. Now its
+ first line contains number of lines in file. By reading this
+ number we will be always distinguish to which version our
+ master.info corresponds to. We can't simply count lines in
+ file since versions before 4.1.x could generate files with more
+ lines than needed.
+ If first line doesn't contain a number or contain number less than
+ 14 then such file is treated like file from pre 4.1.1 version.
+ There is no ambiguity when reading an old master.info, as before
+ 4.1.1, the first line contained the binlog's name, which is either
+ empty or has an extension (contains a '.'), so can't be confused
+ with an integer.
+
+ So we're just reading first line and trying to figure which version
+ is this.
+ */
+
+ /*
+ The first row is temporarily stored in mi->master_log_name,
+ if it is line count and not binlog name (new format) it will be
+ overwritten by the second row later.
+ */
if (init_strvar_from_file(mi->master_log_name,
sizeof(mi->master_log_name), &mi->file,
- "") ||
- init_intvar_from_file(&master_log_pos, &mi->file, 4) ||
+ ""))
+ goto errwithmsg;
+
+ lines= strtoul(mi->master_log_name, &first_non_digit, 10);
+
+ if (mi->master_log_name[0]!='\0' &&
+ *first_non_digit=='\0' && lines >= LINES_IN_MASTER_INFO_WITH_SSL)
+ { // Seems to be new format
+ if (init_strvar_from_file(mi->master_log_name,
+ sizeof(mi->master_log_name), &mi->file, ""))
+ goto errwithmsg;
+ }
+ else
+ lines= 7;
+
+ if (init_intvar_from_file(&master_log_pos, &mi->file, 4) ||
init_strvar_from_file(mi->host, sizeof(mi->host), &mi->file,
master_host) ||
init_strvar_from_file(mi->user, sizeof(mi->user), &mi->file,
master_user) ||
- init_strvar_from_file(mi->password, HASH_PASSWORD_LENGTH+1, &mi->file,
- master_password) ||
+ init_strvar_from_file(mi->password, SCRAMBLED_PASSWORD_CHAR_LENGTH+1,
+ &mi->file, master_password) ||
init_intvar_from_file(&port, &mi->file, master_port) ||
init_intvar_from_file(&connect_retry, &mi->file,
master_connect_retry))
- {
- sql_print_error("Error reading master configuration");
- goto err;
- }
+ goto errwithmsg;
+
+ /*
+ If file has ssl part use it even if we have server without
+ SSL support. But these option will be ignored later when
+ slave will try connect to master, so in this case warning
+ is printed.
+ */
+ if (lines >= LINES_IN_MASTER_INFO_WITH_SSL &&
+ (init_intvar_from_file(&ssl, &mi->file, master_ssl) ||
+ init_strvar_from_file(mi->ssl_ca, sizeof(mi->ssl_ca),
+ &mi->file, master_ssl_ca) ||
+ init_strvar_from_file(mi->ssl_capath, sizeof(mi->ssl_capath),
+ &mi->file, master_ssl_capath) ||
+ init_strvar_from_file(mi->ssl_cert, sizeof(mi->ssl_cert),
+ &mi->file, master_ssl_cert) ||
+ init_strvar_from_file(mi->ssl_cipher, sizeof(mi->ssl_cipher),
+ &mi->file, master_ssl_cipher) ||
+ init_strvar_from_file(mi->ssl_key, sizeof(mi->ssl_key),
+ &mi->file, master_ssl_key)))
+ goto errwithmsg;
+#ifndef HAVE_OPENSSL
+ if (ssl)
+ sql_print_error("SSL information in the master info file "
+ "('%s') are ignored because this MySQL slave was compiled "
+ "without SSL support.", fname);
+#endif /* HAVE_OPENSSL */
+
/*
This has to be handled here as init_intvar_from_file can't handle
my_off_t types
@@ -1669,6 +1766,7 @@ file '%s')", fname);
mi->master_log_pos= (my_off_t) master_log_pos;
mi->port= (uint) port;
mi->connect_retry= (uint) connect_retry;
+ mi->ssl= (my_bool) ssl;
}
DBUG_PRINT("master_info",("log_file_name: %s position: %ld",
mi->master_log_name,
@@ -1685,7 +1783,10 @@ file '%s')", fname);
sql_print_error("Failed to flush master info file");
pthread_mutex_unlock(&mi->data_lock);
DBUG_RETURN(error);
-
+
+errwithmsg:
+ sql_print_error("Error reading master configuration");
+
err:
if (fd >= 0)
{
@@ -1820,6 +1921,22 @@ int show_master_info(THD* thd, MASTER_INFO* mi)
MYSQL_TYPE_LONGLONG));
field_list.push_back(new Item_return_int("Relay_log_space", 10,
MYSQL_TYPE_LONGLONG));
+ field_list.push_back(new Item_empty_string("Until_condition", 6));
+ field_list.push_back(new Item_empty_string("Until_Log_File", FN_REFLEN));
+ field_list.push_back(new Item_return_int("Until_Log_pos", 10,
+ MYSQL_TYPE_LONGLONG));
+ field_list.push_back(new Item_empty_string("Master_SSL_Allowed", 7));
+ field_list.push_back(new Item_empty_string("Master_SSL_CA_File",
+ sizeof(mi->ssl_ca)));
+ field_list.push_back(new Item_empty_string("Master_SSL_CA_Path",
+ sizeof(mi->ssl_capath)));
+ field_list.push_back(new Item_empty_string("Master_SSL_Cert",
+ sizeof(mi->ssl_cert)));
+ field_list.push_back(new Item_empty_string("Master_SSL_Cipher",
+ sizeof(mi->ssl_cipher)));
+ field_list.push_back(new Item_empty_string("Master_SSL_Key",
+ sizeof(mi->ssl_key)));
+
if (protocol->send_fields(&field_list, 1))
DBUG_RETURN(-1);
@@ -1868,6 +1985,25 @@ int show_master_info(THD* thd, MASTER_INFO* mi)
protocol->store((uint32) mi->rli.slave_skip_counter);
protocol->store((ulonglong) mi->rli.group_master_log_pos);
protocol->store((ulonglong) mi->rli.log_space_total);
+
+ protocol->store(
+ mi->rli.until_condition==RELAY_LOG_INFO::UNTIL_NONE ? "None":
+ ( mi->rli.until_condition==RELAY_LOG_INFO::UNTIL_MASTER_POS? "Master":
+ "Relay"), &my_charset_bin);
+ protocol->store(mi->rli.until_log_name, &my_charset_bin);
+ protocol->store((ulonglong) mi->rli.until_log_pos);
+
+#ifdef HAVE_OPENSSL
+ protocol->store(mi->ssl? "Yes":"No", &my_charset_bin);
+#else
+ protocol->store(mi->ssl? "Ignored":"No", &my_charset_bin);
+#endif
+ protocol->store(mi->ssl_ca, &my_charset_bin);
+ protocol->store(mi->ssl_capath, &my_charset_bin);
+ protocol->store(mi->ssl_cert, &my_charset_bin);
+ protocol->store(mi->ssl_cipher, &my_charset_bin);
+ protocol->store(mi->ssl_key, &my_charset_bin);
+
pthread_mutex_unlock(&mi->rli.data_lock);
pthread_mutex_unlock(&mi->data_lock);
@@ -1886,11 +2022,22 @@ bool flush_master_info(MASTER_INFO* mi)
DBUG_ENTER("flush_master_info");
DBUG_PRINT("enter",("master_pos: %ld", (long) mi->master_log_pos));
+ /*
+ In certain cases this code may create master.info files that seems
+ corrupted, because of extra lines filled with garbage in the end
+ file (this happens if new contents take less space than previous
+ contents of file). But because of number of lines in the first line
+ of file we don't care about this garbage.
+ */
+
my_b_seek(file, 0L);
- my_b_printf(file, "%s\n%s\n%s\n%s\n%s\n%d\n%d\n",
- mi->master_log_name, llstr(mi->master_log_pos, lbuf),
+ my_b_printf(file, "%u\n%s\n%s\n%s\n%s\n%s\n%d\n%d\n%d\n%s\n%s\n%s\n%s\n%s\n",
+ LINES_IN_MASTER_INFO_WITH_SSL,
+ mi->master_log_name, llstr(mi->master_log_pos, lbuf),
mi->host, mi->user,
- mi->password, mi->port, mi->connect_retry);
+ mi->password, mi->port, mi->connect_retry,
+ (int)(mi->ssl), mi->ssl_ca, mi->ssl_capath, mi->ssl_cert,
+ mi->ssl_cipher, mi->ssl_key);
flush_io_cache(file);
DBUG_RETURN(0);
}
@@ -1901,11 +2048,11 @@ st_relay_log_info::st_relay_log_info()
cur_log_old_open_count(0), group_master_log_pos(0), log_space_total(0),
ignore_log_space_limit(0), slave_skip_counter(0), abort_pos_wait(0),
slave_run_id(0), sql_thd(0), last_slave_errno(0), inited(0), abort_slave(0),
- slave_running(0)
+ slave_running(0), until_condition(UNTIL_NONE), until_log_pos(0)
{
group_relay_log_name[0]= event_relay_log_name[0]= group_master_log_name[0]= 0;
- last_slave_error[0]=0;
-
+ last_slave_error[0]=0; until_log_name[0]= 0;
+
bzero((char*) &info_file, sizeof(info_file));
bzero((char*) &cache_buf, sizeof(cache_buf));
pthread_mutex_init(&run_lock, MY_MUTEX_INIT_FAST);
@@ -2058,7 +2205,8 @@ int st_relay_log_info::wait_for_pos(THD* thd, String* log_name,
DBUG_PRINT("info",("Waiting for master update"));
const char* msg = thd->enter_cond(&data_cond, &data_lock,
- "Waiting for master update");
+ "Waiting for the SQL slave thread to \
+advance position");
/*
We are going to pthread_cond_(timed)wait(); if the SQL thread stops it
will wake us up.
@@ -2125,7 +2273,13 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type)
thd->master_access= ~0;
thd->priv_user = 0;
thd->slave_thread = 1;
- thd->options = (((opt_log_slave_updates) ? OPTION_BIN_LOG:0) | OPTION_AUTO_IS_NULL) ;
+ thd->options = ((opt_log_slave_updates) ? OPTION_BIN_LOG:0) |
+ OPTION_AUTO_IS_NULL;
+ /*
+ It's nonsense to constraint the slave threads with max_join_size; if a
+ query succeeded on master, we HAVE to execute it.
+ */
+ thd->variables.max_join_size= HA_POS_ERROR;
thd->client_capabilities = CLIENT_LOCAL_FILES;
thd->real_id=pthread_self();
pthread_mutex_lock(&LOCK_thread_count);
@@ -2145,11 +2299,8 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type)
VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals));
#endif
- if (thd->variables.max_join_size == HA_POS_ERROR)
- thd->options |= OPTION_BIG_SELECTS;
-
if (thd_type == SLAVE_THD_SQL)
- thd->proc_info= "Waiting for the next event in slave queue";
+ thd->proc_info= "Waiting for the next event in relay log";
else
thd->proc_info= "Waiting for master update";
thd->version=refresh_version;
@@ -2303,9 +2454,10 @@ server_errno=%d)",
return packet_error;
}
- if (len == 1)
+ /* Check if eof packet */
+ if (len < 8 && mysql->net.read_pos[0] == 254)
{
- sql_print_error("Slave: received 0 length packet from server, apparent\
+ sql_print_error("Slave: received end packet from server, apparent\
master shutdown: %s",
mysql_error(mysql));
return packet_error;
@@ -2337,13 +2489,126 @@ point. If you are sure that your master is ok, run this query manually on the\
}
}
+/*
+ Check if condition stated in UNTIL clause of START SLAVE is reached.
+ SYNOPSYS
+ st_relay_log_info::is_until_satisfied()
+ DESCRIPTION
+ Checks if UNTIL condition is reached. Uses caching result of last
+ comparison of current log file name and target log file name. So cached
+ value should be invalidated if current log file name changes
+ (see st_relay_log_info::notify_... functions).
+
+ This caching is needed to avoid of expensive string comparisons and
+ strtol() conversions needed for log names comparison. We don't need to
+ compare them each time this function is called, we only need to do this
+ when current log name changes. If we have UNTIL_MASTER_POS condition we
+ need to do this only after Rotate_log_event::exec_event() (which is
+ rare, so caching gives real benifit), and if we have UNTIL_RELAY_POS
+ condition then we should invalidate cached comarison value after
+ inc_group_relay_log_pos() which called for each group of events (so we
+ have some benefit if we have something like queries that use
+ autoincrement or if we have transactions).
+
+ Should be called ONLY if until_condition != UNTIL_NONE !
+ RETURN VALUE
+ true - condition met or error happened (condition seems to have
+ bad log file name)
+ false - condition not met
+*/
+
+bool st_relay_log_info::is_until_satisfied()
+{
+ const char *log_name;
+ ulonglong log_pos;
+
+ DBUG_ASSERT(until_condition != UNTIL_NONE);
+
+ if (until_condition == UNTIL_MASTER_POS)
+ {
+ log_name= group_master_log_name;
+ log_pos= group_master_log_pos;
+ }
+ else
+ { /* until_condition == UNTIL_RELAY_POS */
+ log_name= group_relay_log_name;
+ log_pos= group_relay_log_pos;
+ }
+
+ if (until_log_names_cmp_result == UNTIL_LOG_NAMES_CMP_UNKNOWN)
+ {
+ /*
+ We have no cached comaprison results so we should compare log names
+ and cache result
+ */
+
+ DBUG_ASSERT(*log_name || log_pos == 0);
+
+ if (*log_name)
+ {
+ const char *basename= log_name + dirname_length(log_name);
+
+ const char *q= (const char*)(fn_ext(basename)+1);
+ if (strncmp(basename, until_log_name, (int)(q-basename)) == 0)
+ {
+ /* Now compare extensions. */
+ char *q_end;
+ ulong log_name_extension= strtoul(q, &q_end, 10);
+ if (log_name_extension < until_log_name_extension)
+ until_log_names_cmp_result= UNTIL_LOG_NAMES_CMP_LESS;
+ else
+ until_log_names_cmp_result=
+ (log_name_extension > until_log_name_extension) ?
+ UNTIL_LOG_NAMES_CMP_GREATER : UNTIL_LOG_NAMES_CMP_EQUAL ;
+ }
+ else
+ {
+ /* Probably error so we aborting */
+ sql_print_error("Slave SQL thread is stopped because UNTIL "
+ "condition is bad.");
+ return true;
+ }
+ }
+ else
+ return until_log_pos == 0;
+ }
+
+ return ((until_log_names_cmp_result == UNTIL_LOG_NAMES_CMP_EQUAL &&
+ log_pos >= until_log_pos) ||
+ until_log_names_cmp_result == UNTIL_LOG_NAMES_CMP_GREATER);
+}
+
static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli)
{
+ /*
+ We acquire this mutex since we need it for all operations except
+ event execution. But we will release it in places where we will
+ wait for something for example inside of next_event().
+ */
+ pthread_mutex_lock(&rli->data_lock);
+
+ if (rli->until_condition!=RELAY_LOG_INFO::UNTIL_NONE &&
+ rli->is_until_satisfied())
+ {
+ sql_print_error("Slave SQL thread stopped because it reached its"
+ " UNTIL position");
+ /*
+ Setting abort_slave flag because we do not want additional message about
+ error in query execution to be printed.
+ */
+ rli->abort_slave= 1;
+ pthread_mutex_unlock(&rli->data_lock);
+ return 1;
+ }
+
Log_event * ev = next_event(rli);
+
DBUG_ASSERT(rli->sql_thd==thd);
+
if (sql_slave_killed(thd,rli))
{
+ pthread_mutex_unlock(&rli->data_lock);
delete ev;
return 1;
}
@@ -2351,7 +2616,6 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli)
{
int type_code = ev->get_type_code();
int exec_res;
- pthread_mutex_lock(&rli->data_lock);
/*
Skip queries originating from this server or number of
@@ -2380,7 +2644,7 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli)
pthread_mutex_unlock(&rli->data_lock);
delete ev;
return 0; // avoid infinite update loops
- }
+ }
pthread_mutex_unlock(&rli->data_lock);
thd->server_id = ev->server_id; // use the original server id for logging
@@ -2389,7 +2653,6 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli)
if (!ev->when)
ev->when = time(NULL);
ev->thd = thd;
- thd->log_pos = ev->log_pos;
exec_res = ev->exec_event(rli);
DBUG_ASSERT(rli->sql_thd==thd);
delete ev;
@@ -2397,7 +2660,8 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli)
}
else
{
- sql_print_error("\
+ pthread_mutex_unlock(&rli->data_lock);
+ slave_print_error(rli, 0, "\
Could not parse relay log event entry. The possible reasons are: the master's \
binary log is corrupted (you can check this by running 'mysqlbinlog' on the \
binary log), the slave's relay log is corrupted (you can check this by running \
@@ -2472,7 +2736,7 @@ slave_begin:
}
- thd->proc_info = "connecting to master";
+ thd->proc_info = "Connecting to master";
// we can get killed during safe_connect
if (!safe_connect(thd, mysql, mi))
sql_print_error("Slave I/O thread: connected to master '%s@%s:%d',\
@@ -2519,7 +2783,7 @@ dump");
goto err;
}
- thd->proc_info = "Waiting to reconnect after a failed dump request";
+ thd->proc_info= "Waiting to reconnect after a failed binlog dump request";
end_server(mysql);
/*
First time retry immediately, assuming that we can recover
@@ -2540,7 +2804,7 @@ dump");
goto err;
}
- thd->proc_info = "Reconnecting after a failed dump request";
+ thd->proc_info = "Reconnecting after a failed binlog dump request";
if (!suppress_warnings)
sql_print_error("Slave I/O thread: failed dump request, \
reconnecting to try again, log '%s' at postion %s", IO_RPL_LOG_NAME,
@@ -2559,7 +2823,13 @@ after reconnect");
while (!io_slave_killed(thd,mi))
{
bool suppress_warnings= 0;
- thd->proc_info = "Reading master update";
+ /*
+ We say "waiting" because read_event() will wait if there's nothing to
+ read. But if there's something to read, it will not wait. The important
+ thing is to not confuse users by saying "reading" whereas we're in fact
+ receiving nothing.
+ */
+ thd->proc_info = "Waiting for master to send event";
ulong event_len = read_event(mysql, mi, &suppress_warnings);
if (io_slave_killed(thd,mi))
{
@@ -2586,7 +2856,7 @@ max_allowed_packet",
mysql_error(mysql));
goto err;
}
- thd->proc_info = "Waiting to reconnect after a failed read";
+ thd->proc_info = "Waiting to reconnect after a failed master event read";
end_server(mysql);
if (retry_count++)
{
@@ -2602,7 +2872,7 @@ max_allowed_packet",
reconnect after a failed read");
goto err;
}
- thd->proc_info = "Reconnecting after a failed read";
+ thd->proc_info = "Reconnecting after a failed master event read";
if (!suppress_warnings)
sql_print_error("Slave I/O thread: Failed reading log event, \
reconnecting to retry, log '%s' position %s", IO_RPL_LOG_NAME,
@@ -2619,7 +2889,7 @@ reconnect done to recover from failed read");
} // if (event_len == packet_error)
retry_count=0; // ok event, reset retry counter
- thd->proc_info = "Queueing event from master";
+ thd->proc_info = "Queueing master event to the relay log";
if (queue_event(mi,(const char*)mysql->net.read_pos + 1,
event_len))
{
@@ -2801,7 +3071,7 @@ log '%s' at position %s, relay log '%s' position: %s", RPL_LOG_NAME,
while (!sql_slave_killed(thd,rli))
{
- thd->proc_info = "Processing master log event";
+ thd->proc_info = "Reading event from the relay log";
DBUG_ASSERT(rli->sql_thd == thd);
THD_CHECK_SENTRY(thd);
if (exec_relay_log_event(thd,rli))
@@ -2833,6 +3103,11 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \
DBUG_ASSERT(rli->slave_running == 1); // tracking buffer overrun
/* When master_pos_wait() wakes up it will check this and terminate */
rli->slave_running= 0;
+ /*
+ Going out of the transaction. Necessary to mark it, in case the user
+ restarts replication from a non-transactional statement (with CHANGE
+ MASTER).
+ */
/* Wake up master_pos_wait() */
pthread_mutex_unlock(&rli->data_lock);
DBUG_PRINT("info",("Signaling possibly waiting master_pos_wait() functions"));
@@ -2908,7 +3183,7 @@ static int process_io_create_file(MASTER_INFO* mi, Create_file_log_event* cev)
in the loop
*/
{
- Append_block_log_event aev(thd,0,0,0);
+ Append_block_log_event aev(thd,0,0,0,0);
for (;;)
{
@@ -2921,7 +3196,7 @@ static int process_io_create_file(MASTER_INFO* mi, Create_file_log_event* cev)
if (unlikely(!num_bytes)) /* eof */
{
net_write_command(net, 0, "", 0, "", 0);/* 3.23 master wants it */
- Execute_load_log_event xev(thd,0);
+ Execute_load_log_event xev(thd,0,0);
xev.log_pos = mi->master_log_pos;
if (unlikely(mi->rli.relay_log.append(&xev)))
{
@@ -3048,6 +3323,12 @@ static int queue_old_event(MASTER_INFO *mi, const char *buf,
tmp_buf[event_len]=0; // Create_file constructor wants null-term buffer
buf = (const char*)tmp_buf;
}
+ /*
+ This will transform LOAD_EVENT into CREATE_FILE_EVENT, ask the master to
+ send the loaded file, and write it to the relay log in the form of
+ Append_block/Exec_load (the SQL thread needs the data, as that thread is not
+ connected to the master).
+ */
Log_event *ev = Log_event::read_log_event(buf,event_len, &errmsg,
1 /*old format*/ );
if (unlikely(!ev))
@@ -3075,6 +3356,12 @@ static int queue_old_event(MASTER_INFO *mi, const char *buf,
inc_pos= 0;
break;
case CREATE_FILE_EVENT:
+ /*
+ Yes it's possible to have CREATE_FILE_EVENT here, even if we're in
+ queue_old_event() which is for 3.23 events which don't comprise
+ CREATE_FILE_EVENT. This is because read_log_event() above has just
+ transformed LOAD_EVENT into CREATE_FILE_EVENT.
+ */
{
/* We come here when and only when tmp_buf != 0 */
DBUG_ASSERT(tmp_buf);
@@ -3273,6 +3560,17 @@ static int connect_to_master(THD* thd, MYSQL* mysql, MASTER_INFO* mi,
mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT, (char *) &slave_net_timeout);
mysql_options(mysql, MYSQL_OPT_READ_TIMEOUT, (char *) &slave_net_timeout);
+
+#ifdef HAVE_OPENSSL
+ if (mi->ssl)
+ mysql_ssl_set(mysql,
+ mi->ssl_key[0]?mi->ssl_key:0,
+ mi->ssl_cert[0]?mi->ssl_cert:0,
+ mi->ssl_ca[0]?mi->ssl_ca:0,
+ mi->ssl_capath[0]?mi->ssl_capath:0,
+ mi->ssl_cipher[0]?mi->ssl_cipher:0);
+#endif
+
mysql_options(mysql, MYSQL_SET_CHARSET_NAME, default_charset_info->csname);
/* This one is not strictly needed but we have it here for completeness */
mysql_options(mysql, MYSQL_SET_CHARSET_DIR, (char *) charsets_dir);
@@ -3440,17 +3738,18 @@ Log_event* next_event(RELAY_LOG_INFO* rli)
pthread_mutex_t *log_lock = rli->relay_log.get_log_lock();
const char* errmsg=0;
THD* thd = rli->sql_thd;
+
DBUG_ENTER("next_event");
DBUG_ASSERT(thd != 0);
/*
For most operations we need to protect rli members with data_lock,
- so we will hold it for the most of the loop below
- However, we will release it whenever it is worth the hassle,
- and in the cases when we go into a pthread_cond_wait() with the
- non-data_lock mutex
+ so we assume calling function acquired this mutex for us and we will
+ hold it for the most of the loop below However, we will release it
+ whenever it is worth the hassle, and in the cases when we go into a
+ pthread_cond_wait() with the non-data_lock mutex
*/
- pthread_mutex_lock(&rli->data_lock);
+ safe_mutex_assert_owner(&rli->data_lock);
while (!sql_slave_killed(thd,rli))
{
@@ -3509,7 +3808,6 @@ Before assert, my_b_tell(cur_log)=%s rli->event_relay_log_pos=%s",
DBUG_ASSERT(thd==rli->sql_thd);
if (hot_log)
pthread_mutex_unlock(log_lock);
- pthread_mutex_unlock(&rli->data_lock);
DBUG_RETURN(ev);
}
DBUG_ASSERT(thd==rli->sql_thd);
@@ -3574,7 +3872,7 @@ Before assert, my_b_tell(cur_log)=%s rli->event_relay_log_pos=%s",
pthread_mutex_unlock(&rli->log_space_lock);
pthread_cond_broadcast(&rli->log_space_cond);
// Note that wait_for_update unlocks lock_log !
- rli->relay_log.wait_for_update(rli->sql_thd);
+ rli->relay_log.wait_for_update(rli->sql_thd, 1);
// re-acquire data lock since we released it earlier
pthread_mutex_lock(&rli->data_lock);
continue;
@@ -3685,7 +3983,6 @@ event(errno: %d cur_log->error: %d)",
errmsg = "slave SQL thread was killed";
err:
- pthread_mutex_unlock(&rli->data_lock);
if (errmsg)
sql_print_error("Error reading relay log event: %s", errmsg);
DBUG_RETURN(0);
diff --git a/sql/slave.h b/sql/slave.h
index 0cd291a50f8..b52648005d3 100644
--- a/sql/slave.h
+++ b/sql/slave.h
@@ -32,6 +32,30 @@
*****************************************************************************/
+/*
+ MUTEXES in replication:
+
+ LOCK_active_mi: this is meant for multimaster, when we can switch from a
+ master to another. It protects active_mi. We don't care of it for the moment,
+ as active_mi never moves (it's created at startup and deleted at shutdown,
+ and not changed: it always points to the same MASTER_INFO struct), because we
+ don't have multimaster. So for the moment, mi does not move, and mi->rli does
+ not either.
+
+ In MASTER_INFO: run_lock, data_lock
+ run_lock protects all information about the run state: slave_running, and the
+ existence of the I/O thread (to stop/start it, you need this mutex).
+ data_lock protects some moving members of the struct: counters (log name,
+ position) and relay log (MYSQL_LOG object).
+
+ In RELAY_LOG_INFO: run_lock, data_lock
+ see MASTER_INFO
+
+ In MYSQL_LOG: LOCK_log, LOCK_index of the binlog and the relay log
+ LOCK_log: when you write to it. LOCK_index: when you create/delete a binlog
+ (so that you have to update the .index file).
+*/
+
extern ulong master_retry_count;
extern MY_BITMAP slave_error_mask;
extern bool use_slave_mask;
@@ -43,10 +67,6 @@ extern my_bool opt_log_slave_updates;
extern ulonglong relay_log_space_limit;
struct st_master_info;
-extern "C" {
- extern ulong slave_net_timeout;
-};
-
enum enum_binlog_formats {
BINLOG_FORMAT_CURRENT=0, /* 0 is important for easy 'if (mi->old_format)' */
BINLOG_FORMAT_323_LESS_57,
@@ -213,9 +233,55 @@ typedef struct st_relay_log_info
bool inited;
volatile bool abort_slave, slave_running;
+ /*
+ Condition and its parameters from START SLAVE UNTIL clause.
+
+ UNTIL condition is tested with is_until_satisfied() method that is
+ called by exec_relay_log_event(). is_until_satisfied() caches the result
+ of the comparison of log names because log names don't change very often;
+ this cache is invalidated by parts of code which change log names with
+ notify_*_log_name_updated() methods. (They need to be called only if SQL
+ thread is running).
+ */
+
+ enum {UNTIL_NONE= 0, UNTIL_MASTER_POS, UNTIL_RELAY_POS} until_condition;
+ char until_log_name[FN_REFLEN];
+ ulonglong until_log_pos;
+ /* extension extracted from log_name and converted to int */
+ ulong until_log_name_extension;
+ /*
+ Cached result of comparison of until_log_name and current log name
+ -2 means unitialised, -1,0,1 are comarison results
+ */
+ enum
+ {
+ UNTIL_LOG_NAMES_CMP_UNKNOWN= -2, UNTIL_LOG_NAMES_CMP_LESS= -1,
+ UNTIL_LOG_NAMES_CMP_EQUAL= 0, UNTIL_LOG_NAMES_CMP_GREATER= 1
+ } until_log_names_cmp_result;
+
st_relay_log_info();
~st_relay_log_info();
+ /*
+ Invalidate cached until_log_name and group_relay_log_name comparison
+ result. Should be called after any update of group_realy_log_name if
+ there chances that sql_thread is running.
+ */
+ inline void notify_group_relay_log_name_update()
+ {
+ if (until_condition==UNTIL_RELAY_POS)
+ until_log_names_cmp_result= UNTIL_LOG_NAMES_CMP_UNKNOWN;
+ }
+
+ /*
+ The same as previous but for group_master_log_name.
+ */
+ inline void notify_group_master_log_name_update()
+ {
+ if (until_condition==UNTIL_MASTER_POS)
+ until_log_names_cmp_result= UNTIL_LOG_NAMES_CMP_UNKNOWN;
+ }
+
inline void inc_event_relay_log_pos(ulonglong val)
{
event_relay_log_pos+= val;
@@ -229,6 +295,9 @@ typedef struct st_relay_log_info
group_relay_log_pos= event_relay_log_pos;
strmake(group_relay_log_name,event_relay_log_name,
sizeof(group_relay_log_name)-1);
+
+ notify_group_relay_log_name_update();
+
/*
If the slave does not support transactions and replicates a transaction,
users should not trust group_master_log_pos (which they can display with
@@ -248,6 +317,10 @@ typedef struct st_relay_log_info
int wait_for_pos(THD* thd, String* log_name, longlong log_pos,
longlong timeout);
+
+ /* Check if UNTIL condition is satisfied. See slave.cc for more. */
+ bool is_until_satisfied();
+
} RELAY_LOG_INFO;
@@ -288,16 +361,19 @@ Log_event* next_event(RELAY_LOG_INFO* rli);
typedef struct st_master_info
{
+ /* the variables below are needed because we can change masters on the fly */
char master_log_name[FN_REFLEN];
char host[HOSTNAME_LENGTH+1];
char user[USERNAME_LENGTH+1];
char password[MAX_PASSWORD_LENGTH+1];
+ my_bool ssl; // enables use of SSL connection if true
+ char ssl_ca[FN_REFLEN], ssl_capath[FN_REFLEN], ssl_cert[FN_REFLEN];
+ char ssl_cipher[FN_REFLEN], ssl_key[FN_REFLEN];
my_off_t master_log_pos;
File fd; // we keep the file open, so we need to remember the file pointer
IO_CACHE file;
- /* the variables below are needed because we can change masters on the fly */
pthread_mutex_t data_lock,run_lock;
pthread_cond_t data_cond,start_cond,stop_cond;
THD *io_thd;
@@ -315,10 +391,13 @@ typedef struct st_master_info
volatile ulong slave_run_id;
st_master_info()
- :fd(-1), io_thd(0), inited(0), old_format(BINLOG_FORMAT_CURRENT),
+ :ssl(0), fd(-1), io_thd(0), inited(0), old_format(BINLOG_FORMAT_CURRENT),
abort_slave(0),slave_running(0), slave_run_id(0)
{
host[0] = 0; user[0] = 0; password[0] = 0;
+ ssl_ca[0]= 0; ssl_capath[0]= 0; ssl_cert[0]= 0;
+ ssl_cipher[0]= 0; ssl_key[0]= 0;
+
bzero((char*) &file, sizeof(file));
pthread_mutex_init(&run_lock, MY_MUTEX_INIT_FAST);
pthread_mutex_init(&data_lock, MY_MUTEX_INIT_FAST);
@@ -431,6 +510,7 @@ void slave_print_error(RELAY_LOG_INFO* rli, int err_code, const char* msg, ...);
void end_slave(); /* clean up */
void init_master_info_with_options(MASTER_INFO* mi);
+void clear_until_condition(RELAY_LOG_INFO* rli);
void clear_last_slave_error(RELAY_LOG_INFO* rli);
int init_master_info(MASTER_INFO* mi, const char* master_info_fname,
const char* slave_info_fname,
@@ -468,6 +548,10 @@ extern my_string master_user, master_password, master_host,
master_info_file, relay_log_info_file, report_user, report_host,
report_password;
+extern my_bool master_ssl;
+extern my_string master_ssl_ca, master_ssl_capath, master_ssl_cert,
+ master_ssl_cipher, master_ssl_key;
+
extern I_List<i_string> replicate_do_db, replicate_ignore_db;
extern I_List<i_string_pair> replicate_rewrite_db;
extern I_List<THD> threads;
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 9738c0c5d9e..179da6096de 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -34,6 +34,7 @@
#include <m_ctype.h>
#include <stdarg.h>
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
class acl_entry :public hash_filo_element
{
@@ -51,7 +52,7 @@ static byte* acl_entry_get_key(acl_entry *entry,uint *length,
return (byte*) entry->key;
}
-#define ACL_KEY_LENGTH (sizeof(long)+NAME_LEN+17)
+#define ACL_KEY_LENGTH (sizeof(long)+NAME_LEN+USERNAME_LENGTH+1)
static DYNAMIC_ARRAY acl_hosts,acl_users,acl_dbs;
static MEM_ROOT mem, memex;
@@ -68,12 +69,54 @@ static ulong get_sort(uint count,...);
static void init_check_host(void);
static ACL_USER *find_acl_user(const char *host, const char *user);
static bool update_user_table(THD *thd, const char *host, const char *user,
- const char *new_password);
+ const char *new_password, uint new_password_len);
static void update_hostname(acl_host_and_ip *host, const char *hostname);
static bool compare_hostname(const acl_host_and_ip *host,const char *hostname,
const char *ip);
/*
+ Convert scrambled password to binary form, according to scramble type,
+ Binary form is stored in user.salt.
+*/
+
+static
+void
+set_user_salt(ACL_USER *acl_user, const char *password, uint password_len)
+{
+ if (password_len == SCRAMBLED_PASSWORD_CHAR_LENGTH)
+ {
+ get_salt_from_password(acl_user->salt, password);
+ acl_user->salt_len= SCRAMBLE_LENGTH;
+ }
+ else if (password_len == SCRAMBLED_PASSWORD_CHAR_LENGTH_323)
+ {
+ get_salt_from_password_323((ulong *) acl_user->salt, password);
+ acl_user->salt_len= SCRAMBLE_LENGTH_323;
+ }
+ else
+ acl_user->salt_len= 0;
+}
+
+/*
+ This after_update function is used when user.password is less than
+ SCRAMBLE_LENGTH bytes.
+*/
+
+static void restrict_update_of_old_passwords_var(THD *thd,
+ enum_var_type var_type)
+{
+ if (var_type == OPT_GLOBAL)
+ {
+ pthread_mutex_lock(&LOCK_global_system_variables);
+ global_system_variables.old_passwords= 1;
+ pthread_mutex_unlock(&LOCK_global_system_variables);
+ }
+ else
+ thd->variables.old_passwords= 1;
+}
+
+
+/*
Read grant privileges from the privilege tables in the 'mysql' database.
SYNOPSIS
@@ -114,8 +157,6 @@ my_bool acl_init(THD *org_thd, bool dont_read_acl_tables)
if (!(thd=new THD))
DBUG_RETURN(1); /* purecov: inspected */
thd->store_globals();
- /* Use passwords according to command line option */
- use_old_passwords= opt_old_passwords;
acl_cache->clear(1); // Clear locked hostname cache
thd->db= my_strdup("mysql",MYF(0));
@@ -172,103 +213,126 @@ my_bool acl_init(THD *org_thd, bool dont_read_acl_tables)
init_read_record(&read_record_info,thd,table=tables[1].table,NULL,1,0);
VOID(my_init_dynamic_array(&acl_users,sizeof(ACL_USER),50,100));
- if (table->field[2]->field_length == 8 &&
- protocol_version == PROTOCOL_VERSION)
+ if (table->field[2]->field_length < SCRAMBLED_PASSWORD_CHAR_LENGTH_323)
{
- sql_print_error("Old 'user' table. (Check README or the Reference manual). Continuing --old-protocol"); /* purecov: tested */
- protocol_version=9; /* purecov: tested */
+ sql_print_error("Fatal error: mysql.user table is damaged or in "
+ "unsupported 3.20 format.");
+ goto end;
}
DBUG_PRINT("info",("user table fields: %d, password length: %d",
table->fields, table->field[2]->field_length));
- if (table->field[2]->field_length < 45 && !use_old_passwords)
+
+ pthread_mutex_lock(&LOCK_global_system_variables);
+ if (table->field[2]->field_length < SCRAMBLED_PASSWORD_CHAR_LENGTH)
+ {
+ if (opt_secure_auth)
+ {
+ pthread_mutex_unlock(&LOCK_global_system_variables);
+ sql_print_error("Fatal error: mysql.user table is in old format, "
+ "but server started with --secure-auth option.");
+ goto end;
+ }
+ sys_old_passwords.after_update= restrict_update_of_old_passwords_var;
+ if (global_system_variables.old_passwords)
+ pthread_mutex_unlock(&LOCK_global_system_variables);
+ else
+ {
+ global_system_variables.old_passwords= 1;
+ pthread_mutex_unlock(&LOCK_global_system_variables);
+ sql_print_error("mysql.user table is not updated to new password format; "
+ "Disabling new password usage until "
+ "mysql_fix_privilege_tables is run");
+ }
+ thd->variables.old_passwords= 1;
+ }
+ else
{
- sql_print_error("mysql.user table is not updated to new password format; Disabling new password usage until mysql_fix_privilege_tables is run");
- use_old_passwords= 1;
+ sys_old_passwords.after_update= 0;
+ pthread_mutex_unlock(&LOCK_global_system_variables);
}
allow_all_hosts=0;
while (!(read_record_info.read_record(&read_record_info)))
{
ACL_USER user;
- uint length=0;
- update_hostname(&user.host,get_field(&mem, table->field[0]));
- user.user=get_field(&mem, table->field[1]);
- user.password=get_field(&mem, table->field[2]);
- if (user.password && (length=(uint) strlen(user.password)) == 8 &&
- protocol_version == PROTOCOL_VERSION)
- {
- sql_print_error(
- "Found old style password for user '%s'. Ignoring user. (You may want to restart mysqld using --old-protocol)",
- user.user ? user.user : ""); /* purecov: tested */
- }
- else /* non empty and not short passwords */
- {
- user.pversion=get_password_version(user.password);
- /* Only passwords of specific lengths depending on version are allowed */
- if ((!user.pversion && (length % 8 || length > 16)) ||
- (user.pversion && length != 45))
- {
- sql_print_error(
- "Found invalid password for user: '%s'@'%s'; Ignoring user",
- user.user ? user.user : "",
- user.host.hostname ? user.host.hostname : ""); /* purecov: tested */
- continue; /* purecov: tested */
+ update_hostname(&user.host, get_field(&mem, table->field[0]));
+ user.user= get_field(&mem, table->field[1]);
+ const char *password= get_field(&mem, table->field[2]);
+ uint password_len= password ? strlen(password) : 0;
+ set_user_salt(&user, password, password_len);
+ if (user.salt_len == 0 && password_len != 0)
+ {
+ switch (password_len) {
+ case 45: /* 4.1: to be removed */
+ sql_print_error("Found 4.1 style password for user '%s@%s'. "
+ "Ignoring user. "
+ "You should change password for this user.",
+ user.user ? user.user : "",
+ user.host.hostname ? user.host.hostname : "");
+ break;
+ default:
+ sql_print_error("Found invalid password for user: '%s@%s'; "
+ "Ignoring user", user.user ? user.user : "",
+ user.host.hostname ? user.host.hostname : "");
+ break;
}
}
- get_salt_from_password(user.salt,user.password);
- user.access=get_access(table,3) & GLOBAL_ACLS;
- user.sort=get_sort(2,user.host.hostname,user.user);
- user.hostname_length= (user.host.hostname ?
- (uint) strlen(user.host.hostname) : 0);
- if (table->fields >= 31) /* Starting from 4.0.2 we have more fields */
- {
- char *ssl_type=get_field(&mem, table->field[24]);
- if (!ssl_type)
- user.ssl_type=SSL_TYPE_NONE;
- else if (!strcmp(ssl_type, "ANY"))
- user.ssl_type=SSL_TYPE_ANY;
- else if (!strcmp(ssl_type, "X509"))
- user.ssl_type=SSL_TYPE_X509;
- else /* !strcmp(ssl_type, "SPECIFIED") */
- user.ssl_type=SSL_TYPE_SPECIFIED;
-
- user.ssl_cipher= get_field(&mem, table->field[25]);
- user.x509_issuer= get_field(&mem, table->field[26]);
- user.x509_subject= get_field(&mem, table->field[27]);
-
- char *ptr = get_field(&mem, table->field[28]);
- user.user_resource.questions=atoi(ptr);
- ptr = get_field(&mem, table->field[29]);
- user.user_resource.updates=atoi(ptr);
- ptr = get_field(&mem, table->field[30]);
- user.user_resource.connections=atoi(ptr);
- if (user.user_resource.questions || user.user_resource.updates ||
- user.user_resource.connections)
- mqh_used=1;
- }
- else
+ else // password is correct
{
- user.ssl_type=SSL_TYPE_NONE;
- bzero((char *)&(user.user_resource),sizeof(user.user_resource));
-#ifndef TO_BE_REMOVED
- if (table->fields <= 13)
- { // Without grant
- if (user.access & CREATE_ACL)
- user.access|=REFERENCES_ACL | INDEX_ACL | ALTER_ACL;
+ user.access= get_access(table,3) & GLOBAL_ACLS;
+ user.sort= get_sort(2,user.host.hostname,user.user);
+ user.hostname_length= (user.host.hostname ?
+ (uint) strlen(user.host.hostname) : 0);
+ if (table->fields >= 31) /* Starting from 4.0.2 we have more fields */
+ {
+ char *ssl_type=get_field(&mem, table->field[24]);
+ if (!ssl_type)
+ user.ssl_type=SSL_TYPE_NONE;
+ else if (!strcmp(ssl_type, "ANY"))
+ user.ssl_type=SSL_TYPE_ANY;
+ else if (!strcmp(ssl_type, "X509"))
+ user.ssl_type=SSL_TYPE_X509;
+ else /* !strcmp(ssl_type, "SPECIFIED") */
+ user.ssl_type=SSL_TYPE_SPECIFIED;
+
+ user.ssl_cipher= get_field(&mem, table->field[25]);
+ user.x509_issuer= get_field(&mem, table->field[26]);
+ user.x509_subject= get_field(&mem, table->field[27]);
+
+ char *ptr = get_field(&mem, table->field[28]);
+ user.user_resource.questions=atoi(ptr);
+ ptr = get_field(&mem, table->field[29]);
+ user.user_resource.updates=atoi(ptr);
+ ptr = get_field(&mem, table->field[30]);
+ user.user_resource.connections=atoi(ptr);
+ if (user.user_resource.questions || user.user_resource.updates ||
+ user.user_resource.connections)
+ mqh_used=1;
}
- /* Convert old privileges */
- user.access|= LOCK_TABLES_ACL | CREATE_TMP_ACL | SHOW_DB_ACL;
- if (user.access & FILE_ACL)
- user.access|= REPL_CLIENT_ACL | REPL_SLAVE_ACL;
- if (user.access & PROCESS_ACL)
- user.access|= SUPER_ACL | EXECUTE_ACL;
+ else
+ {
+ user.ssl_type=SSL_TYPE_NONE;
+ bzero((char *)&(user.user_resource),sizeof(user.user_resource));
+#ifndef TO_BE_REMOVED
+ if (table->fields <= 13)
+ { // Without grant
+ if (user.access & CREATE_ACL)
+ user.access|=REFERENCES_ACL | INDEX_ACL | ALTER_ACL;
+ }
+ /* Convert old privileges */
+ user.access|= LOCK_TABLES_ACL | CREATE_TMP_ACL | SHOW_DB_ACL;
+ if (user.access & FILE_ACL)
+ user.access|= REPL_CLIENT_ACL | REPL_SLAVE_ACL;
+ if (user.access & PROCESS_ACL)
+ user.access|= SUPER_ACL | EXECUTE_ACL;
#endif
+ }
+ VOID(push_dynamic(&acl_users,(gptr) &user));
+ if (!user.host.hostname || user.host.hostname[0] == wild_many &&
+ !user.host.hostname[1])
+ allow_all_hosts=1; // Anyone can connect
}
- VOID(push_dynamic(&acl_users,(gptr) &user));
- if (!user.host.hostname || user.host.hostname[0] == wild_many &&
- !user.host.hostname[1])
- allow_all_hosts=1; // Anyone can connect
}
qsort((gptr) dynamic_element(&acl_users,0,ACL_USER*),acl_users.elements,
sizeof(ACL_USER),(qsort_cmp) acl_compare);
@@ -469,136 +533,109 @@ static int acl_compare(ACL_ACCESS *a,ACL_ACCESS *b)
/*
- Prepare crypted scramble to be sent to the client
-*/
-
-void prepare_scramble(THD *thd, ACL_USER *acl_user,char* prepared_scramble)
-{
- /* Binary password format to be used for generation*/
- char bin_password[SCRAMBLE41_LENGTH];
- /* Generate new long scramble for the thread */
- create_random_string(SCRAMBLE41_LENGTH,&thd->rand,thd->scramble);
- thd->scramble[SCRAMBLE41_LENGTH]=0;
- /* Get binary form, First 4 bytes of prepared scramble is salt */
- get_hash_and_password(acl_user->salt,acl_user->pversion,prepared_scramble,
- (unsigned char*) bin_password);
- /* Store "*" as identifier for old passwords */
- if (!acl_user->pversion)
- prepared_scramble[0]='*';
- /* Finally encrypt password to get prepared scramble */
- password_crypt(thd->scramble, prepared_scramble+4, bin_password,
- SCRAMBLE41_LENGTH);
-}
-
-
-/*
- Get master privilges for user (priviliges for all tables).
- Required before connecting to MySQL
+ Seek ACL entry for a user, check password, SSL cypher, and if
+ everything is OK, update THD user data and USER_RESOURCES struct.
- As we have 2 stage handshake now we cache user not to lookup
- it second time. At the second stage we do not lookup user in case
- we already know it;
+ IMPLEMENTATION
+ This function does not check if the user has any sensible privileges:
+ only user's existence and validity is checked.
+ Note, that entire operation is protected by acl_cache_lock.
+ SYNOPSIS
+ acl_getroot()
+ thd thread handle. If all checks are OK,
+ thd->priv_user, thd->master_access are updated.
+ thd->host, thd->ip, thd->user are used for checks.
+ mqh user resources; on success mqh is reset, else
+ unchanged
+ passwd scrambled & crypted password, recieved from client
+ (to check): thd->scramble or thd->scramble_323 is
+ used to decrypt passwd, so they must contain
+ original random string,
+ passwd_len length of passwd, must be one of 0, 8,
+ SCRAMBLE_LENGTH_323, SCRAMBLE_LENGTH
+ 'thd' and 'mqh' are updated on success; other params are IN.
+
+ RETURN VALUE
+ 0 success: thd->priv_user, thd->priv_host, thd->master_access, mqh are
+ updated
+ 1 user not found or authentification failure
+ 2 user found, has long (4.1.1) salt, but passwd is in old (3.23) format.
+ -1 user found, has short (3.23) salt, but passwd is in new (4.1.1) format.
*/
-ulong acl_getroot(THD *thd, const char *host, const char *ip, const char *user,
- const char *password,const char *message,char **priv_user,
- char *priv_host, bool old_ver, USER_RESOURCES *mqh,
- char *prepared_scramble, uint *cur_priv_version,
- ACL_USER **cached_user)
+int acl_getroot(THD *thd, USER_RESOURCES *mqh,
+ const char *passwd, uint passwd_len)
{
- ulong user_access=NO_ACCESS;
- *priv_user= (char*) user;
- bool password_correct= 0;
- int stage= (*cached_user != NULL); /* NULL passed as first stage */
- ACL_USER *acl_user= NULL;
+ ulong user_access= NO_ACCESS;
+ int res= 1;
+ ACL_USER *acl_user= 0;
DBUG_ENTER("acl_getroot");
- bzero((char*) mqh, sizeof(USER_RESOURCES));
if (!initialized)
{
- // If no data allow anything
- DBUG_RETURN((ulong) ~NO_ACCESS); /* purecov: tested */
+ /*
+ here if mysqld's been started with --skip-grant-tables option.
+ */
+ thd->priv_user= (char *) ""; // privileges for
+ *thd->priv_host= '\0'; // the user are unknown
+ thd->master_access= ~NO_ACCESS; // everything is allowed
+ bzero((char*) mqh, sizeof(*mqh));
+ DBUG_RETURN(0);
}
+
VOID(pthread_mutex_lock(&acl_cache->lock));
/*
- Get possible access from user_list. This is or'ed to others not
- fully specified
-
- If we have cached user use it, in other case look it up.
+ Find acl entry in user database. Note, that find_acl_user is not the same,
+ because it doesn't take into account the case when user is not empty,
+ but acl_user->user is empty
*/
- if (stage && (*cur_priv_version == priv_version))
- acl_user= *cached_user;
- else
+ for (uint i=0 ; i < acl_users.elements ; i++)
{
- for (uint i=0 ; i < acl_users.elements ; i++)
+ ACL_USER *acl_user_tmp= dynamic_element(&acl_users,i,ACL_USER*);
+ if (!acl_user_tmp->user || !strcmp(thd->user, acl_user_tmp->user))
{
- ACL_USER *acl_user_search=dynamic_element(&acl_users,i,ACL_USER*);
- if (!acl_user_search->user || !strcmp(user,acl_user_search->user))
+ if (compare_hostname(&acl_user_tmp->host, thd->host, thd->ip))
{
- if (compare_hostname(&acl_user_search->host,host,ip))
+ /* check password: it should be empty or valid */
+ if (passwd_len == acl_user_tmp->salt_len)
{
- /* Found mathing user */
- acl_user= acl_user_search;
- /* Store it as a cache */
- *cached_user= acl_user;
- *cur_priv_version= priv_version;
- break;
+ if (acl_user_tmp->salt_len == 0 ||
+ acl_user_tmp->salt_len == SCRAMBLE_LENGTH &&
+ check_scramble(passwd, thd->scramble, acl_user_tmp->salt) == 0 ||
+ check_scramble_323(passwd, thd->scramble,
+ (ulong *) acl_user_tmp->salt) == 0)
+ {
+ acl_user= acl_user_tmp;
+ res= 0;
+ }
}
+ else if (passwd_len == SCRAMBLE_LENGTH &&
+ acl_user_tmp->salt_len == SCRAMBLE_LENGTH_323)
+ res= -1;
+ else if (passwd_len == SCRAMBLE_LENGTH_323 &&
+ acl_user_tmp->salt_len == SCRAMBLE_LENGTH)
+ res= 2;
+ /* linear search complete: */
+ break;
}
}
}
-
- /* Now we have acl_user found and may start our checks */
+ /*
+ This was moved to separate tree because of heavy HAVE_OPENSSL case.
+ If acl_user is not null, res is 0.
+ */
if (acl_user)
{
- /* Password should present for both or absend for both */
- if (!acl_user->password && !*password)
- password_correct=1;
- else if (!acl_user->password || !*password)
- {
- *cached_user= 0; // Impossible to connect
- }
- else
- {
- /* New version password is checked differently */
- if (acl_user->pversion)
- {
- if (stage) /* We check password only on the second stage */
- {
- if (!validate_password(password,message,acl_user->salt))
- password_correct=1;
- }
- else /* First stage - just prepare scramble */
- prepare_scramble(thd,acl_user,prepared_scramble);
- }
- /* Old way to check password */
- else
- {
- /* Checking the scramble at any stage. First - old clients */
- if (!check_scramble(password,message,acl_user->salt,
- (my_bool) old_ver))
- password_correct=1;
- else if (!stage) /* Here if password incorrect */
- {
- /* At the first stage - prepare scramble */
- prepare_scramble(thd,acl_user,prepared_scramble);
- }
- }
- }
- }
-
- /* If user not found password_correct will also be zero */
- if (!password_correct)
- goto unlock_and_exit;
-
- /* OK. User found and password checked continue validation */
-
- {
+ /* OK. User found and password checked continue validation */
Vio *vio=thd->net.vio;
+#ifdef HAVE_OPENSSL
+ SSL *ssl= (SSL*) vio->ssl_arg;
+#endif
+
/*
At this point we know that user is allowed to connect
from given host by given username/password pair. Now
@@ -607,26 +644,26 @@ ulong acl_getroot(THD *thd, const char *host, const char *ip, const char *user,
*/
switch (acl_user->ssl_type) {
case SSL_TYPE_NOT_SPECIFIED: // Impossible
- case SSL_TYPE_NONE: /* SSL is not required to connect */
- user_access=acl_user->access;
+ case SSL_TYPE_NONE: // SSL is not required
+ user_access= acl_user->access;
break;
#ifdef HAVE_OPENSSL
- case SSL_TYPE_ANY: /* Any kind of SSL is good enough */
+ case SSL_TYPE_ANY: // Any kind of SSL is ok
if (vio_type(vio) == VIO_TYPE_SSL)
- user_access=acl_user->access;
+ user_access= acl_user->access;
break;
case SSL_TYPE_X509: /* Client should have any valid certificate. */
/*
Connections with non-valid certificates are dropped already
in sslaccept() anyway, so we do not check validity here.
-
+
We need to check for absence of SSL because without SSL
we should reject connection.
*/
if (vio_type(vio) == VIO_TYPE_SSL &&
- SSL_get_verify_result(vio->ssl_) == X509_V_OK &&
- SSL_get_peer_certificate(vio->ssl_))
- user_access=acl_user->access;
+ SSL_get_verify_result(ssl) == X509_V_OK &&
+ SSL_get_peer_certificate(ssl))
+ user_access= acl_user->access;
break;
case SSL_TYPE_SPECIFIED: /* Client should have specified attrib */
/*
@@ -636,89 +673,83 @@ ulong acl_getroot(THD *thd, const char *host, const char *ip, const char *user,
use.
*/
if (vio_type(vio) != VIO_TYPE_SSL ||
- SSL_get_verify_result(vio->ssl_) != X509_V_OK)
+ SSL_get_verify_result(ssl) != X509_V_OK)
break;
if (acl_user->ssl_cipher)
{
DBUG_PRINT("info",("comparing ciphers: '%s' and '%s'",
- acl_user->ssl_cipher,SSL_get_cipher(vio->ssl_)));
- if (!strcmp(acl_user->ssl_cipher,SSL_get_cipher(vio->ssl_)))
- user_access=acl_user->access;
+ acl_user->ssl_cipher,SSL_get_cipher(ssl)));
+ if (!strcmp(acl_user->ssl_cipher,SSL_get_cipher(ssl)))
+ user_access= acl_user->access;
else
{
if (global_system_variables.log_warnings)
sql_print_error("X509 ciphers mismatch: should be '%s' but is '%s'",
acl_user->ssl_cipher,
- SSL_get_cipher(vio->ssl_));
- user_access=NO_ACCESS;
+ SSL_get_cipher(ssl));
break;
}
}
/* Prepare certificate (if exists) */
DBUG_PRINT("info",("checkpoint 1"));
- X509* cert=SSL_get_peer_certificate(vio->ssl_);
+ X509* cert=SSL_get_peer_certificate(ssl);
DBUG_PRINT("info",("checkpoint 2"));
/* If X509 issuer is speified, we check it... */
if (acl_user->x509_issuer)
{
- DBUG_PRINT("info",("checkpoint 3"));
+ DBUG_PRINT("info",("checkpoint 3"));
char *ptr = X509_NAME_oneline(X509_get_issuer_name(cert), 0, 0);
DBUG_PRINT("info",("comparing issuers: '%s' and '%s'",
acl_user->x509_issuer, ptr));
- if (strcmp(acl_user->x509_issuer, ptr))
- {
- if (global_system_variables.log_warnings)
- sql_print_error("X509 issuer mismatch: should be '%s' but is '%s'",
- acl_user->x509_issuer, ptr);
- user_access=NO_ACCESS;
- free(ptr);
- break;
- }
- user_access=acl_user->access;
- free(ptr);
+ if (strcmp(acl_user->x509_issuer, ptr))
+ {
+ if (global_system_variables.log_warnings)
+ sql_print_error("X509 issuer mismatch: should be '%s' "
+ "but is '%s'", acl_user->x509_issuer, ptr);
+ free(ptr);
+ break;
+ }
+ user_access= acl_user->access;
+ free(ptr);
}
DBUG_PRINT("info",("checkpoint 4"));
/* X509 subject is specified, we check it .. */
if (acl_user->x509_subject)
{
- char *ptr= X509_NAME_oneline(X509_get_subject_name(cert), 0, 0);
- DBUG_PRINT("info",("comparing subjects: '%s' and '%s'",
- acl_user->x509_subject, ptr));
- if (strcmp(acl_user->x509_subject,ptr))
- {
- if (global_system_variables.log_warnings)
- sql_print_error("X509 subject mismatch: '%s' vs '%s'",
- acl_user->x509_subject, ptr);
- user_access=NO_ACCESS;
- }
- else
- user_access=acl_user->access;
- free(ptr);
+ char *ptr= X509_NAME_oneline(X509_get_subject_name(cert), 0, 0);
+ DBUG_PRINT("info",("comparing subjects: '%s' and '%s'",
+ acl_user->x509_subject, ptr));
+ if (strcmp(acl_user->x509_subject,ptr))
+ {
+ if (global_system_variables.log_warnings)
+ sql_print_error("X509 subject mismatch: '%s' vs '%s'",
+ acl_user->x509_subject, ptr);
+ }
+ else
+ user_access= acl_user->access;
+ free(ptr);
}
break;
-#else /* HAVE_OPENSSL */
+#else /* HAVE_OPENSSL */
default:
/*
- If we don't have SSL but SSL is required for this user the
- authentication should fail.
- */
+ If we don't have SSL but SSL is required for this user the
+ authentication should fail.
+ */
break;
#endif /* HAVE_OPENSSL */
}
- }
-
- *mqh=acl_user->user_resource;
- if (!acl_user->user)
- *priv_user=(char*) ""; // Change to anonymous user /* purecov: inspected */
+ thd->master_access= user_access;
+ thd->priv_user= acl_user->user ? thd->user : (char *) "";
+ *mqh= acl_user->user_resource;
- if (acl_user->host.hostname)
- strmake(priv_host, acl_user->host.hostname, MAX_HOSTNAME);
- else
- *priv_host= 0;
-
-unlock_and_exit:
+ if (acl_user->host.hostname)
+ strmake(thd->priv_host, acl_user->host.hostname, MAX_HOSTNAME);
+ else
+ *thd->priv_host= 0;
+ }
VOID(pthread_mutex_unlock(&acl_cache->lock));
- DBUG_RETURN(user_access);
+ DBUG_RETURN(res);
}
@@ -729,8 +760,9 @@ static byte* check_get_key(ACL_USER *buff,uint *length,
return (byte*) buff->host.hostname;
}
+
static void acl_update_user(const char *user, const char *host,
- const char *password,
+ const char *password, uint password_len,
enum SSL_type ssl_type,
const char *ssl_cipher,
const char *x509_issuer,
@@ -766,20 +798,9 @@ static void acl_update_user(const char *user, const char *host,
acl_user->x509_subject= (x509_subject ?
strdup_root(&mem,x509_subject) : 0);
}
- if (password)
- {
- if (!password[0]) /* If password is empty set it to null */
- {
- acl_user->password=0;
- acl_user->pversion=0; // just initialize
- }
- else
- {
- acl_user->password=(char*) ""; // Just point at something
- get_salt_from_password(acl_user->salt,password);
- acl_user->pversion=get_password_version(acl_user->password);
- }
- }
+
+ set_user_salt(acl_user, password, password_len);
+ /* search complete: */
break;
}
}
@@ -788,7 +809,7 @@ static void acl_update_user(const char *user, const char *host,
static void acl_insert_user(const char *user, const char *host,
- const char *password,
+ const char *password, uint password_len,
enum SSL_type ssl_type,
const char *ssl_cipher,
const char *x509_issuer,
@@ -799,7 +820,6 @@ static void acl_insert_user(const char *user, const char *host,
ACL_USER acl_user;
acl_user.user=*user ? strdup_root(&mem,user) : 0;
update_hostname(&acl_user.host,strdup_root(&mem,host));
- acl_user.password=0;
acl_user.access=privileges;
acl_user.user_resource = *mqh;
acl_user.sort=get_sort(2,acl_user.host.hostname,acl_user.user);
@@ -809,12 +829,8 @@ static void acl_insert_user(const char *user, const char *host,
acl_user.ssl_cipher= ssl_cipher ? strdup_root(&mem,ssl_cipher) : 0;
acl_user.x509_issuer= x509_issuer ? strdup_root(&mem,x509_issuer) : 0;
acl_user.x509_subject=x509_subject ? strdup_root(&mem,x509_subject) : 0;
- if (password)
- {
- acl_user.password=(char*) ""; // Just point at something
- get_salt_from_password(acl_user.salt,password);
- acl_user.pversion=get_password_version(password);
- }
+
+ set_user_salt(&acl_user, password, password_len);
VOID(push_dynamic(&acl_users,(gptr) &acl_user));
if (!acl_user.host.hostname || acl_user.host.hostname[0] == wild_many
@@ -970,51 +986,6 @@ exit:
return (db_access & host_access);
}
-
-int wild_case_compare(CHARSET_INFO *cs, const char *str,const char *wildstr)
-{
- reg3 int flag;
- DBUG_ENTER("wild_case_compare");
- DBUG_PRINT("enter",("str: '%s' wildstr: '%s'",str,wildstr));
- while (*wildstr)
- {
- while (*wildstr && *wildstr != wild_many && *wildstr != wild_one)
- {
- if (*wildstr == wild_prefix && wildstr[1])
- wildstr++;
- if (my_toupper(cs, *wildstr++) !=
- my_toupper(cs, *str++)) DBUG_RETURN(1);
- }
- if (! *wildstr ) DBUG_RETURN (*str != 0);
- if (*wildstr++ == wild_one)
- {
- if (! *str++) DBUG_RETURN (1); /* One char; skip */
- }
- else
- { /* Found '*' */
- if (!*wildstr) DBUG_RETURN(0); /* '*' as last char: OK */
- flag=(*wildstr != wild_many && *wildstr != wild_one);
- do
- {
- if (flag)
- {
- char cmp;
- if ((cmp= *wildstr) == wild_prefix && wildstr[1])
- cmp=wildstr[1];
- cmp=my_toupper(cs, cmp);
- while (*str && my_toupper(cs, *str) != cmp)
- str++;
- if (!*str) DBUG_RETURN (1);
- }
- if (wild_case_compare(cs, str,wildstr) == 0) DBUG_RETURN (0);
- } while (*str++);
- DBUG_RETURN(1);
- }
- }
- DBUG_RETURN (*str != '\0');
-}
-
-
/*
Check if there are any possible matching entries for this host
@@ -1054,7 +1025,7 @@ static void init_check_host(void)
else if (!hash_search(&acl_check_hosts,(byte*) &acl_user->host,
(uint) strlen(acl_user->host.hostname)))
{
- if (hash_insert(&acl_check_hosts,(byte*) acl_user))
+ if (my_hash_insert(&acl_check_hosts,(byte*) acl_user))
{ // End of memory
allow_all_hosts=1; // Should never happen
DBUG_VOID_RETURN;
@@ -1121,7 +1092,7 @@ bool check_change_password(THD *thd, const char *host, const char *user)
(strcmp(thd->user,user) ||
my_strcasecmp(&my_charset_latin1, host, thd->host_or_ip)))
{
- if (check_access(thd, UPDATE_ACL, "mysql",0,1))
+ if (check_access(thd, UPDATE_ACL, "mysql",0,1,0))
return(1);
}
if (!thd->slave_thread && !thd->user[0])
@@ -1151,7 +1122,6 @@ bool check_change_password(THD *thd, const char *host, const char *user)
bool change_password(THD *thd, const char *host, const char *user,
char *new_password)
{
- uint length=0;
DBUG_ENTER("change_password");
DBUG_PRINT("enter",("host: '%s' user: '%s' new_password: '%s'",
host,user,new_password));
@@ -1160,37 +1130,27 @@ bool change_password(THD *thd, const char *host, const char *user,
if (check_change_password(thd, host, user))
DBUG_RETURN(1);
- /*
- password should always be 0,16 or 45 chars;
- Simple hack to avoid cracking
- */
- length=(uint) strlen(new_password);
- if (length != 45)
- new_password[length & 16]=0;
-
VOID(pthread_mutex_lock(&acl_cache->lock));
ACL_USER *acl_user;
- if (!(acl_user= find_acl_user(host,user)))
+ if (!(acl_user= find_acl_user(host, user)))
{
- send_error(thd, ER_PASSWORD_NO_MATCH);
VOID(pthread_mutex_unlock(&acl_cache->lock));
+ send_error(thd, ER_PASSWORD_NO_MATCH);
DBUG_RETURN(1);
}
+ /* update loaded acl entry: */
+ uint new_password_len= new_password ? strlen(new_password) : 0;
+ set_user_salt(acl_user, new_password, new_password_len);
+
if (update_user_table(thd,
acl_user->host.hostname ? acl_user->host.hostname : "",
acl_user->user ? acl_user->user : "",
- new_password))
+ new_password, new_password_len))
{
VOID(pthread_mutex_unlock(&acl_cache->lock)); /* purecov: deadcode */
send_error(thd,0); /* purecov: deadcode */
DBUG_RETURN(1); /* purecov: deadcode */
}
- get_salt_from_password(acl_user->salt,new_password);
- acl_user->pversion=get_password_version(new_password);
- if (!new_password[0])
- acl_user->password=0;
- else
- acl_user->password=(char*) ""; // Point at something
acl_cache->clear(1); // Clear locked hostname cache
VOID(pthread_mutex_unlock(&acl_cache->lock));
@@ -1230,7 +1190,7 @@ find_acl_user(const char *host, const char *user)
if (!acl_user->user && !user[0] ||
acl_user->user && !strcmp(user,acl_user->user))
{
- if (compare_hostname(&(acl_user->host),host,host))
+ if (compare_hostname(&acl_user->host,host,host))
{
DBUG_RETURN(acl_user);
}
@@ -1303,7 +1263,7 @@ static bool compare_hostname(const acl_host_and_ip *host, const char *hostname,
*/
static bool update_user_table(THD *thd, const char *host, const char *user,
- const char *new_password)
+ const char *new_password, uint new_password_len)
{
TABLE_LIST tables;
TABLE *table;
@@ -1345,7 +1305,7 @@ static bool update_user_table(THD *thd, const char *host, const char *user,
DBUG_RETURN(1); /* purecov: deadcode */
}
store_record(table,record[1]);
- table->field[2]->store(new_password,(uint) strlen(new_password), &my_charset_latin1);
+ table->field[2]->store(new_password, new_password_len, &my_charset_latin1);
if ((error=table->file->update_row(table->record[1],table->record[0])))
{
table->file->print_error(error,MYF(0)); /* purecov: deadcode */
@@ -1393,24 +1353,23 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
{
int error = -1;
bool old_row_exists=0;
- char *password,empty_string[1];
+ const char *password= "";
+ uint password_len= 0;
char what= (revoke_grant) ? 'N' : 'Y';
DBUG_ENTER("replace_user_table");
safe_mutex_assert_owner(&acl_cache->lock);
- password=empty_string;
- empty_string[0]=0;
-
if (combo.password.str && combo.password.str[0])
{
- if ((combo.password.length != HASH_PASSWORD_LENGTH)
- && combo.password.length != HASH_OLD_PASSWORD_LENGTH)
+ if (combo.password.length != SCRAMBLED_PASSWORD_CHAR_LENGTH &&
+ combo.password.length != SCRAMBLED_PASSWORD_CHAR_LENGTH_323)
{
my_printf_error(ER_PASSWORD_NO_MATCH,
- "Password hash should be a %d-digit hexadecimal number",
- MYF(0),HASH_PASSWORD_LENGTH);
+ "Password hash should be a %d-digit hexadecimal number",
+ MYF(0), SCRAMBLED_PASSWORD_CHAR_LENGTH);
DBUG_RETURN(-1);
}
+ password_len= combo.password.length;
password=combo.password.str;
}
@@ -1435,17 +1394,20 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
goto end;
}
old_row_exists = 0;
- restore_record(table,default_values); // cp empty row from default_values
- table->field[0]->store(combo.host.str,combo.host.length, &my_charset_latin1);
- table->field[1]->store(combo.user.str,combo.user.length, &my_charset_latin1);
- table->field[2]->store(password,(uint) strlen(password), &my_charset_latin1);
+ restore_record(table,default_values); // cp empty row from default_values
+ table->field[0]->store(combo.host.str,combo.host.length,
+ &my_charset_latin1);
+ table->field[1]->store(combo.user.str,combo.user.length,
+ &my_charset_latin1);
+ table->field[2]->store(password, password_len,
+ &my_charset_latin1);
}
else
{
old_row_exists = 1;
store_record(table,record[1]); // Save copy for update
if (combo.password.str) // If password given
- table->field[2]->store(password,(uint) strlen(password), &my_charset_latin1);
+ table->field[2]->store(password, password_len, &my_charset_latin1);
}
/* Update table columns with new privileges */
@@ -1542,10 +1504,8 @@ end:
if (!error)
{
acl_cache->clear(1); // Clear privilege cache
- if (!combo.password.str)
- password=0; // No password given on command
if (old_row_exists)
- acl_update_user(combo.user.str,combo.host.str,password,
+ acl_update_user(combo.user.str, combo.host.str, password, password_len,
thd->lex.ssl_type,
thd->lex.ssl_cipher,
thd->lex.x509_issuer,
@@ -1553,7 +1513,7 @@ end:
&thd->lex.mqh,
rights);
else
- acl_insert_user(combo.user.str,combo.host.str,password,
+ acl_insert_user(combo.user.str, combo.host.str, password, password_len,
thd->lex.ssl_type,
thd->lex.ssl_cipher,
thd->lex.x509_issuer,
@@ -1686,6 +1646,7 @@ class GRANT_TABLE :public Sql_alloc
public:
char *host,*db,*user,*tname, *hash_key;
ulong privs, cols;
+ ulong sort;
uint key_length;
HASH hash_columns;
GRANT_TABLE (const char *h, const char *d,const char *u, const char *t,
@@ -1695,6 +1656,7 @@ public:
host = strdup_root(&memex,h);
db = strdup_root(&memex,d);
user = strdup_root(&memex,u);
+ sort= get_sort(3,host,db,user);
tname= strdup_root(&memex,t);
if (lower_case_table_names)
{
@@ -1717,7 +1679,8 @@ public:
user = get_field(&memex,form->field[2]);
if (!user)
user=(char*) "";
- tname = get_field(&memex,form->field[3]);
+ sort= get_sort(3,host,db,user);
+ tname= get_field(&memex,form->field[3]);
if (!host || !db || !tname)
{
/* Wrong table row; Ignore it */
@@ -1775,7 +1738,7 @@ public:
privs = cols = 0; /* purecov: deadcode */
return; /* purecov: deadcode */
}
- hash_insert(&hash_columns, (byte *) mem_check);
+ my_hash_insert(&hash_columns, (byte *) mem_check);
} while (!col_privs->file->index_next(col_privs->record[0]) &&
!key_cmp(col_privs,key,0,key_len));
}
@@ -1826,10 +1789,11 @@ static GRANT_TABLE *table_hash_search(const char *host,const char* ip,
}
else
{
- if ((host && !wild_case_compare(&my_charset_latin1,
- host,grant_table->host)) ||
- (ip && !wild_case_compare(&my_charset_latin1,
- ip,grant_table->host)))
+ if (((host && !wild_case_compare(&my_charset_latin1,
+ host,grant_table->host)) ||
+ (ip && !wild_case_compare(&my_charset_latin1,
+ ip,grant_table->host))) &&
+ (!found || found->sort < grant_table->sort))
found=grant_table; // Host ok
}
}
@@ -1936,7 +1900,7 @@ static int replace_column_table(GRANT_TABLE *g_t,
goto end; /* purecov: inspected */
}
GRANT_COLUMN *grant_column = new GRANT_COLUMN(xx->column,privileges);
- hash_insert(&g_t->hash_columns,(byte*) grant_column);
+ my_hash_insert(&g_t->hash_columns,(byte*) grant_column);
}
}
table->file->index_end();
@@ -2287,7 +2251,7 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
result= -1; /* purecov: deadcode */
continue; /* purecov: deadcode */
}
- hash_insert(&column_priv_hash,(byte*) grant_table);
+ my_hash_insert(&column_priv_hash,(byte*) grant_table);
}
/* If revoke_grant, calculate the new column privilege for tables_priv */
@@ -2530,7 +2494,7 @@ my_bool grant_init(THD *org_thd)
{
GRANT_TABLE *mem_check;
if (!(mem_check=new GRANT_TABLE(t_table,c_table)) ||
- mem_check->ok() && hash_insert(&column_priv_hash,(byte*) mem_check))
+ mem_check->ok() && my_hash_insert(&column_priv_hash,(byte*) mem_check))
{
/* This could only happen if we are out memory */
grant_option= FALSE; /* purecov: deadcode */
@@ -3024,12 +2988,15 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
global.append ("'@'",3);
global.append(lex_user->host.str,lex_user->host.length);
global.append ('\'');
- if (acl_user->password)
+ if (acl_user->salt_len)
{
- char passd_buff[HASH_PASSWORD_LENGTH+1];
- make_password_from_salt(passd_buff,acl_user->salt,acl_user->pversion);
+ char passwd_buff[SCRAMBLED_PASSWORD_CHAR_LENGTH+1];
+ if (acl_user->salt_len == SCRAMBLE_LENGTH)
+ 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(passd_buff);
+ global.append(passwd_buff);
global.append('\'');
}
/* "show grants" SSL related stuff */
@@ -3083,7 +3050,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
protocol->store(global.ptr(),global.length(),global.charset());
if (protocol->write())
{
- error=-1;
+ error= -1;
goto end;
}
}
@@ -3141,7 +3108,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
protocol->store(db.ptr(),db.length(),db.charset());
if (protocol->write())
{
- error=-1;
+ error= -1;
goto end;
}
}
@@ -3167,15 +3134,19 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
if ((table_access | grant_table->cols) != 0)
{
String global(buff,sizeof(buff),&my_charset_latin1);
+ ulong test_access= (table_access | grant_table->cols) & ~GRANT_ACL;
+
global.length(0);
global.append("GRANT ",6);
if (test_all_bits(table_access, (TABLE_ACLS & ~GRANT_ACL)))
global.append("ALL PRIVILEGES",14);
+ else if (!test_access)
+ global.append("USAGE",5);
else
{
int found= 0;
- ulong j,test_access= (table_access | grant_table->cols) & ~GRANT_ACL;
+ ulong j;
for (counter= 0, j= SELECT_ACL; j <= TABLE_ACLS; counter++, j<<= 1)
{
@@ -3342,7 +3313,7 @@ int open_grant_tables(THD *thd, TABLE_LIST *tables)
}
ACL_USER *check_acl_user(LEX_USER *user_name,
- uint *acl_user_idx)
+ uint *acl_acl_userdx)
{
ACL_USER *acl_user= 0;
uint counter;
@@ -3362,14 +3333,14 @@ ACL_USER *check_acl_user(LEX_USER *user_name,
if (counter == acl_users.elements)
return 0;
- *acl_user_idx= counter;
+ *acl_acl_userdx= counter;
return acl_user;
}
int mysql_drop_user(THD *thd, List <LEX_USER> &list)
{
- uint counter, user_id;
+ uint counter, acl_userd;
int result;
ACL_USER *acl_user;
ACL_DB *acl_db;
@@ -3389,7 +3360,7 @@ int mysql_drop_user(THD *thd, List <LEX_USER> &list)
{
if (!(acl_user= check_acl_user(user_name, &counter)))
{
- sql_print_error("DROP USER: Can't drop user: '%s'@'%s'",
+ sql_print_error("DROP USER: Can't drop user: '%s'@'%s'; No such user",
user_name->user.str,
user_name->host.str);
result= -1;
@@ -3397,13 +3368,13 @@ int mysql_drop_user(THD *thd, List <LEX_USER> &list)
}
if ((acl_user->access & ~0))
{
- sql_print_error("DROP USER: Can't drop user: '%s'@'%s'",
+ sql_print_error("DROP USER: Can't drop user: '%s'@'%s'; Global privileges exists",
user_name->user.str,
user_name->host.str);
result= -1;
continue;
}
- user_id= counter;
+ acl_userd= counter;
for (counter= 0 ; counter < acl_dbs.elements ; counter++)
{
@@ -3420,7 +3391,7 @@ int mysql_drop_user(THD *thd, List <LEX_USER> &list)
}
if (counter != acl_dbs.elements)
{
- sql_print_error("DROP USER: Can't drop user: '%s'@'%s'",
+ sql_print_error("DROP USER: Can't drop user: '%s'@'%s'; Database privileges exists",
user_name->user.str,
user_name->host.str);
result= -1;
@@ -3443,7 +3414,7 @@ int mysql_drop_user(THD *thd, List <LEX_USER> &list)
}
if (counter != column_priv_hash.records)
{
- sql_print_error("DROP USER: Can't drop user: '%s'@'%s'",
+ sql_print_error("DROP USER: Can't drop user: '%s'@'%s'; Table privileges exists",
user_name->user.str,
user_name->host.str);
result= -1;
@@ -3469,7 +3440,7 @@ int mysql_drop_user(THD *thd, List <LEX_USER> &list)
tables[0].table->file->index_end();
DBUG_RETURN(-1);
}
- delete_dynamic_element(&acl_users, user_id);
+ delete_dynamic_element(&acl_users, acl_userd);
}
tables[0].table->file->index_end();
}
@@ -3590,3 +3561,50 @@ template class List_iterator<LEX_USER>;
template class List<LEX_COLUMN>;
template class List<LEX_USER>;
#endif
+
+#endif /*NO_EMBEDDED_ACCESS_CHECKS */
+
+
+int wild_case_compare(CHARSET_INFO *cs, const char *str,const char *wildstr)
+{
+ reg3 int flag;
+ DBUG_ENTER("wild_case_compare");
+ DBUG_PRINT("enter",("str: '%s' wildstr: '%s'",str,wildstr));
+ while (*wildstr)
+ {
+ while (*wildstr && *wildstr != wild_many && *wildstr != wild_one)
+ {
+ if (*wildstr == wild_prefix && wildstr[1])
+ wildstr++;
+ if (my_toupper(cs, *wildstr++) !=
+ my_toupper(cs, *str++)) DBUG_RETURN(1);
+ }
+ if (! *wildstr ) DBUG_RETURN (*str != 0);
+ if (*wildstr++ == wild_one)
+ {
+ if (! *str++) DBUG_RETURN (1); /* One char; skip */
+ }
+ else
+ { /* Found '*' */
+ if (!*wildstr) DBUG_RETURN(0); /* '*' as last char: OK */
+ flag=(*wildstr != wild_many && *wildstr != wild_one);
+ do
+ {
+ if (flag)
+ {
+ char cmp;
+ if ((cmp= *wildstr) == wild_prefix && wildstr[1])
+ cmp=wildstr[1];
+ cmp=my_toupper(cs, cmp);
+ while (*str && my_toupper(cs, *str) != cmp)
+ str++;
+ if (!*str) DBUG_RETURN (1);
+ }
+ if (wild_case_compare(cs, str,wildstr) == 0) DBUG_RETURN (0);
+ } while (*str++);
+ DBUG_RETURN(1);
+ }
+ }
+ DBUG_RETURN (*str != '\0');
+}
+
diff --git a/sql/sql_acl.h b/sql/sql_acl.h
index 0dc8c058b3d..220eb0d55ad 100644
--- a/sql/sql_acl.h
+++ b/sql/sql_acl.h
@@ -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 */
-
#define SELECT_ACL (1L << 0)
#define INSERT_ACL (1L << 1)
#define UPDATE_ACL (1L << 2)
@@ -59,6 +58,8 @@
#define EXTRA_ACL (1L << 29)
#define NO_ACCESS (1L << 30)
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+
/*
Defines to change the above bits to how things are stored in tables
This is needed as the 'host' and 'db' table is missing a few privileges
@@ -111,9 +112,9 @@ public:
acl_host_and_ip host;
uint hostname_length;
USER_RESOURCES user_resource;
- char *user,*password;
- ulong salt[6]; // New password has longer length
- uint8 pversion; // password version
+ char *user;
+ uint8 salt[SCRAMBLE_LENGTH+1]; // scrambled password in binary form
+ uint8 salt_len; // 0 - no password, 4 - 3.20, 8 - 3.23, 20 - 4.1.1
enum SSL_type ssl_type;
const char *ssl_cipher, *x509_issuer, *x509_subject;
};
@@ -135,11 +136,8 @@ void acl_reload(THD *thd);
void acl_free(bool end=0);
ulong acl_get(const char *host, const char *ip, const char *bin_ip,
const char *user, const char *db, my_bool db_is_pattern);
-ulong acl_getroot(THD *thd, const char *host, const char *ip, const char *user,
- const char *password,const char *scramble,
- char **priv_user, char *priv_host,
- bool old_ver, USER_RESOURCES *max,char* prepared_scramble,
- uint *cur_priv_version, ACL_USER **cached_user);
+int acl_getroot(THD *thd, USER_RESOURCES *mqh, const char *passwd,
+ uint passwd_len);
bool acl_check_host(const char *host, const char *ip);
bool check_change_password(THD *thd, const char *host, const char *user);
bool change_password(THD *thd, const char *host, const char *user,
@@ -165,3 +163,6 @@ void get_privilege_desc(char *to, uint max_length, ulong access);
void get_mqh(const char *user, const char *host, USER_CONN *uc);
int mysql_drop_user(THD *thd, List <LEX_USER> &list);
int mysql_revoke_all(THD *thd, List <LEX_USER> &list);
+
+#endif /*!NO_EMBEDDED_ACCESS_CHECKS*/
+
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index d7ef553eb8a..537368943db 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -157,7 +157,6 @@ OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *wild)
table_list.grant.privilege=0;
if (check_table_access(thd,SELECT_ACL | EXTRA_ACL,&table_list,1))
continue;
-
/* need to check if we haven't already listed it */
for (table= open_list ; table ; table=table->next)
{
@@ -950,7 +949,7 @@ TABLE *open_table(THD *thd,const char *db,const char *table_name,
table->version=refresh_version;
table->flush_version=flush_version;
DBUG_PRINT("info", ("inserting table %p into the cache", table));
- VOID(hash_insert(&open_cache,(byte*) table));
+ VOID(my_hash_insert(&open_cache,(byte*) table));
}
table->in_use=thd;
@@ -1823,8 +1822,10 @@ Field *find_field_in_table(THD *thd,TABLE *table,const char *name,uint length,
else
thd->dupp_field=field;
}
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (check_grants && check_grant_column(thd,table,name,length))
return WRONG_GRANT;
+#endif
return field;
}
@@ -2226,11 +2227,12 @@ insert_fields(THD *thd,TABLE_LIST *tables, const char *db_name,
tables->alias) &&
(!db_name || !strcmp(tables->db,db_name))))
{
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
/* Ensure that we have access right to all columns */
if (!(table->grant.privilege & SELECT_ACL) &&
check_grant_all_columns(thd,SELECT_ACL,table))
DBUG_RETURN(-1);
-
+#endif
Field **ptr=table->field,*field;
thd->used_tables|=table->map;
while ((field = *ptr++))
@@ -2455,7 +2457,7 @@ int mysql_create_index(THD *thd, TABLE_LIST *table_list, List<Key> &keys)
DBUG_ENTER("mysql_create_index");
bzero((char*) &create_info,sizeof(create_info));
create_info.db_type=DB_TYPE_DEFAULT;
- create_info.table_charset= thd->variables.character_set_database;
+ create_info.table_charset= thd->variables.collation_database;
DBUG_RETURN(mysql_alter_table(thd,table_list->db,table_list->real_name,
&create_info, table_list,
fields, keys, drop, alter, 0, (ORDER*)0, FALSE,
@@ -2472,7 +2474,7 @@ int mysql_drop_index(THD *thd, TABLE_LIST *table_list, List<Alter_drop> &drop)
DBUG_ENTER("mysql_drop_index");
bzero((char*) &create_info,sizeof(create_info));
create_info.db_type=DB_TYPE_DEFAULT;
- create_info.table_charset= thd->variables.character_set_database;
+ create_info.table_charset= thd->variables.collation_database;
DBUG_RETURN(mysql_alter_table(thd,table_list->db,table_list->real_name,
&create_info, table_list,
fields, keys, drop, alter, 0, (ORDER*)0, FALSE,
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index 64e8be8e224..9460b6cf577 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -769,9 +769,18 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
STRUCT_LOCK(&structure_guard_mutex);
if (query_cache_size == 0)
+ {
+ STRUCT_UNLOCK(&structure_guard_mutex);
DBUG_VOID_RETURN;
+ }
DUMP(this);
+ if (ask_handler_allowance(thd, tables_used))
+ {
+ STRUCT_UNLOCK(&structure_guard_mutex);
+ DBUG_VOID_RETURN;
+ }
+
/* Key is query + database + flag */
if (thd->db_length)
{
@@ -814,7 +823,7 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
Query_cache_query *header = query_block->query();
header->init_n_lock();
- if (hash_insert(&queries, (byte*) query_block))
+ if (my_hash_insert(&queries, (byte*) query_block))
{
refused++;
DBUG_PRINT("qcache", ("insertion in query hash"));
@@ -993,6 +1002,7 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
Query_cache_table *table = block_table->parent;
table_list.db = table->db();
table_list.alias= table_list.real_name= table->table();
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (check_table_access(thd,SELECT_ACL,&table_list,1))
{
DBUG_PRINT("qcache",
@@ -1012,6 +1022,7 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
thd->lex.safe_to_cache_query= 0; // Don't try to cache this
goto err_unlock; // Parse query
}
+#endif /*!NO_EMBEDDED_ACCESS_CHECKS*/
if (check_tables && !handler::caching_allowed(thd, table->db(),
table->key_length(),
table->type()))
@@ -2035,7 +2046,7 @@ Query_cache::insert_table(uint key_len, char *key,
Query_cache_block_table *list_root = table_block->table(0);
list_root->n = 0;
list_root->next = list_root->prev = list_root;
- if (hash_insert(&tables, (const byte *) table_block))
+ if (my_hash_insert(&tables, (const byte *) table_block))
{
DBUG_PRINT("qcache", ("Can't insert table to hash"));
// write_block_data return locked block
@@ -2548,6 +2559,39 @@ TABLE_COUNTER_TYPE Query_cache::is_cacheable(THD *thd, uint32 query_len,
DBUG_RETURN(0);
}
+/*
+ Check handler allowence to cache query with this tables
+
+ SYNOPSYS
+ Query_cache::ask_handler_allowance()
+ thd - thread handlers
+ tables_used - tables list used in query
+
+ RETURN
+ 0 - caching allowed
+ 1 - caching disallowed
+*/
+my_bool Query_cache::ask_handler_allowance(THD *thd,
+ TABLE_LIST *tables_used)
+{
+ DBUG_ENTER("Query_cache::is_cacheable");
+
+ for (; tables_used; tables_used= tables_used->next)
+ {
+ TABLE *table= tables_used->table;
+ if (!handler::caching_allowed(thd, table->table_cache_key,
+ table->key_length,
+ table->file->table_cache_type()))
+ {
+ DBUG_PRINT("qcache", ("Handler does not allow caching for %s.%s",
+ tables_used->db, tables_used->alias));
+ thd->lex.safe_to_cache_query= 0; // Don't try to cache this
+ DBUG_RETURN(1);
+ }
+ }
+ DBUG_RETURN(0);
+}
+
/*****************************************************************************
Packing
diff --git a/sql/sql_cache.h b/sql/sql_cache.h
index f6eb7c7a0fb..68e69ab523f 100644
--- a/sql/sql_cache.h
+++ b/sql/sql_cache.h
@@ -345,6 +345,8 @@ protected:
TABLE_COUNTER_TYPE is_cacheable(THD *thd, uint32 query_len, char *query,
LEX *lex, TABLE_LIST *tables_used,
uint8 *tables_type);
+
+ static my_bool ask_handler_allowance(THD *thd, TABLE_LIST *tables_used);
public:
Query_cache(ulong query_cache_limit = ULONG_MAX,
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 763408dc5c2..de2da5a379b 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -107,7 +107,7 @@ THD::THD():user_time(0), is_fatal_error(0),
variables.pseudo_thread_id= 0;
file_id = 0;
warn_id= 0;
- db_charset= global_system_variables.character_set_database;
+ db_charset= global_system_variables.collation_database;
mysys_var=0;
#ifndef DBUG_OFF
dbug_sentry=THD_SENTRY_MAGIC;
@@ -133,11 +133,13 @@ THD::THD():user_time(0), is_fatal_error(0),
where="field list";
server_id = ::server_id;
slave_net = 0;
- log_pos = 0;
command=COM_CONNECT;
set_query_id=1;
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
db_access=NO_ACCESS;
+#endif
version=refresh_version; // For boot
+ *scramble= '\0';
init();
/* Initialize sub structures */
@@ -316,7 +318,7 @@ THD::~THD()
#endif
DBUG_PRINT("info", ("freeing host"));
- if (host != localhost) // If not pointer to constant
+ if (host != my_localhost) // If not pointer to constant
safeFree(host);
if (user != delayed_user)
safeFree(user);
@@ -583,7 +585,7 @@ sql_exchange::sql_exchange(char *name,bool flag)
:file_name(name), opt_enclosed(0), dumpfile(flag), skip_lines(0)
{
field_term= &default_field_term;
- enclosed= line_start= &empty_string;
+ enclosed= line_start= &my_empty_string;
line_term= &default_line_term;
escaped= &default_escaped;
}
diff --git a/sql/sql_class.h b/sql/sql_class.h
index e10795c4d9d..da6aab8d266 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -129,7 +129,7 @@ public:
}
void set_max_size(ulong max_size_arg);
void signal_update() { pthread_cond_broadcast(&update_cond);}
- void wait_for_update(THD* thd);
+ void wait_for_update(THD* thd, bool master_or_slave);
void set_need_start_event() { need_start_event = 1; }
void init(enum_log_type log_type_arg,
enum cache_type io_cache_type_arg,
@@ -146,7 +146,7 @@ public:
bool write(THD *thd, const char *query, uint query_length,
time_t query_start=0);
bool write(Log_event* event_info); // binary log write
- bool write(THD *thd, IO_CACHE *cache);
+ bool write(THD *thd, IO_CACHE *cache, bool commit_or_rollback);
/*
v stands for vector
@@ -341,7 +341,11 @@ typedef struct st_prep_stmt
char last_error[MYSQL_ERRMSG_SIZE];
bool error_in_prepare, long_data_used;
bool log_full_query;
+#ifndef EMBEDDED_LIBRARY
bool (*setup_params)(st_prep_stmt *stmt, uchar *pos, uchar *read_pos);
+#else
+ bool (*setup_params_data)(st_prep_stmt *stmt);
+#endif
} PREP_STMT;
@@ -385,6 +389,7 @@ struct system_variables
ulong table_type;
ulong tmp_table_size;
ulong tx_isolation;
+ /* Determines if which non-standard SQL behaviour should be enabled */
ulong sql_mode;
ulong default_week_format;
ulong max_seeks_for_key;
@@ -398,11 +403,15 @@ struct system_variables
my_bool log_warnings;
my_bool low_priority_updates;
my_bool new_mode;
+ my_bool old_passwords;
- CHARSET_INFO *character_set_server;
- CHARSET_INFO *character_set_database;
+ /* Only charset part of these variables is sensible */
CHARSET_INFO *character_set_client;
CHARSET_INFO *character_set_results;
+
+ /* Both charset and collation parts of these variables are important */
+ CHARSET_INFO *collation_server;
+ CHARSET_INFO *collation_database;
CHARSET_INFO *collation_connection;
};
@@ -417,6 +426,10 @@ class THD :public ilink
public:
#ifdef EMBEDDED_LIBRARY
struct st_mysql *mysql;
+ struct st_mysql_data *data;
+ unsigned long client_stmt_id;
+ unsigned long client_param_count;
+ struct st_mysql_bind *client_params;
#endif
NET net; // client connection descriptor
LEX lex; // parse tree descriptor
@@ -459,7 +472,6 @@ public:
const char *host_or_ip;
ulong client_capabilities; /* What the client supports */
- /* Determines if which non-standard SQL behaviour should be enabled */
ulong max_client_packet_length;
ulong master_access; /* Global privileges from mysql.user */
ulong db_access; /* Privileges for current db */
@@ -556,11 +568,10 @@ public:
enum_tx_isolation session_tx_isolation;
/* for user variables replication*/
DYNAMIC_ARRAY user_var_events;
- // extend scramble to handle new auth
- char scramble[SCRAMBLE41_LENGTH+1];
- // old scramble is needed to handle old clients
- char old_scramble[SCRAMBLE_LENGTH+1];
- uint8 query_cache_type; // type of query cache processing
+
+ /* scramble - random string sent to client on handshake */
+ char scramble[SCRAMBLE_LENGTH+1];
+
bool slave_thread;
bool set_query_id,locked,count_cuted_fields,some_tables_deleted;
bool last_cuted_field;
@@ -580,7 +591,6 @@ public:
*/
LOG_INFO* current_linfo;
NET* slave_net; // network connection from slave -> m.
- my_off_t log_pos;
/* Used by the sys_var class to store temporary values */
union
{
@@ -965,7 +975,6 @@ typedef struct st_sort_buffer {
SORT_FIELD *sortorder;
} SORT_BUFFER;
-
/* Structure for db & table in sql_yacc */
class Table_ident :public Sql_alloc
diff --git a/sql/sql_crypt.cc b/sql/sql_crypt.cc
index 930ecfffef7..b0b8050e311 100644
--- a/sql/sql_crypt.cc
+++ b/sql/sql_crypt.cc
@@ -32,7 +32,7 @@
SQL_CRYPT::SQL_CRYPT(const char *password)
{
ulong rand_nr[2];
- hash_password(rand_nr,password);
+ hash_password(rand_nr,password, strlen(password));
crypt_init(rand_nr);
}
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 34e81402dd0..750dd4ff493 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -62,7 +62,7 @@ static bool write_db_opt(THD *thd, const char *path, HA_CREATE_INFO *create)
ulong length;
CHARSET_INFO *cs= (create && create->table_charset) ?
create->table_charset :
- thd->variables.character_set_database;
+ thd->variables.collation_database;
length= my_sprintf(buf,(buf, "default-character-set=%s\ndefault-collation=%s\n", cs->csname,cs->name));
/* Error is written by my_write */
@@ -99,7 +99,7 @@ static bool load_db_opt(THD *thd, const char *path, HA_CREATE_INFO *create)
uint nbytes;
bzero((char*) create,sizeof(*create));
- create->table_charset= global_system_variables.character_set_database;
+ create->table_charset= global_system_variables.collation_database;
if ((file=my_open(path, O_RDONLY | O_SHARE, MYF(0))) >= 0)
{
IO_CACHE cache;
@@ -288,8 +288,8 @@ int mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info)
{
thd->db_charset= (create_info && create_info->table_charset) ?
create_info->table_charset :
- global_system_variables.character_set_database;
- thd->variables.character_set_database= thd->db_charset;
+ global_system_variables.collation_database;
+ thd->variables.collation_database= thd->db_charset;
}
mysql_update_log.write(thd,thd->query, thd->query_length);
@@ -391,6 +391,33 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
exit:
start_waiting_global_read_lock(thd);
+ /*
+ If this database was the client's selected database, we silently change the
+ client's selected database to nothing (to have an empty SELECT DATABASE() in
+ the future). For this we free() thd->db and set it to 0. But we don't do
+ free() for the slave thread. Indeed, doing a x_free() on it leads to nasty
+ problems (i.e. long painful debugging) because in this thread, thd->db is
+ the same as data_buf and db of the Query_log_event which is dropping the
+ database. So if you free() thd->db, you're freeing data_buf. You set thd->db
+ to 0 but not data_buf (thd->db and data_buf are two distinct pointers which
+ point to the same place). Then in ~Query_log_event(), we have
+ 'if (data_buf) free(data_buf)'
+ data_buf is !=0 so this makes a DOUBLE free().
+ Side effects of this double free() are, randomly (depends on the machine),
+ when the slave is replicating a DROP DATABASE:
+ - garbage characters in the error message:
+ "Error 'Can't drop database 'test2'; database doesn't exist' on query
+ 'h4zI¿'"
+ - segfault
+ - hang in "free(vio)" (yes!) in the I/O or SQL slave threads (so slave
+ server hangs at shutdown etc).
+ */
+ if (thd->db && !strcmp(thd->db, db))
+ {
+ if (!(thd->slave_thread)) /* a slave thread will free it itself */
+ x_free(thd->db);
+ thd->db= 0;
+ }
exit2:
VOID(pthread_mutex_unlock(&LOCK_mysql_create_db));
@@ -587,6 +614,7 @@ bool mysql_change_db(THD *thd, const char *name)
DBUG_RETURN(1);
}
DBUG_PRINT("info",("Use database: %s", dbname));
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (test_all_bits(thd->master_access,DB_ACLS))
db_access=DB_ACLS;
else
@@ -606,7 +634,7 @@ bool mysql_change_db(THD *thd, const char *name)
my_free(dbname,MYF(0));
DBUG_RETURN(1);
}
-
+#endif
(void) sprintf(path,"%s/%s",mysql_data_home,dbname);
length=unpack_dirname(path,path); // Convert if not unix
if (length && path[length-1] == FN_LIBCHAR)
@@ -621,14 +649,15 @@ bool mysql_change_db(THD *thd, const char *name)
x_free(thd->db);
thd->db=dbname; // THD::~THD will free this
thd->db_length=db_length;
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
thd->db_access=db_access;
-
+#endif
strmov(path+unpack_dirname(path,path), MY_DB_OPT_FILE);
load_db_opt(thd, path, &create);
thd->db_charset= create.table_charset ?
create.table_charset :
- global_system_variables.character_set_database;
- thd->variables.character_set_database= thd->db_charset;
+ global_system_variables.collation_database;
+ thd->variables.collation_database= thd->db_charset;
DBUG_RETURN(0);
}
@@ -651,6 +680,7 @@ int mysqld_show_create_db(THD *thd, char *dbname,
DBUG_RETURN(1);
}
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (test_all_bits(thd->master_access,DB_ACLS))
db_access=DB_ACLS;
else
@@ -669,6 +699,7 @@ int mysqld_show_create_db(THD *thd, char *dbname,
dbname);
DBUG_RETURN(1);
}
+#endif
(void) sprintf(path,"%s/%s",mysql_data_home, dbname);
length=unpack_dirname(path,path); // Convert if not unix
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index 771d68e8462..a740bb1b3c7 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -25,8 +25,6 @@
#include "sql_select.h"
#include "sql_acl.h"
-extern const char *any_db; // Special symbol for check_access
-
/*
Resolve derived tables in all queries
@@ -91,13 +89,15 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit,
We have to do access checks here as this code is executed before any
sql command is started to execute.
*/
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (tables)
- res= check_table_access(thd,SELECT_ACL, tables);
+ res= check_table_access(thd,SELECT_ACL, tables,0);
else
- res= check_access(thd, SELECT_ACL, any_db);
+ res= check_access(thd, SELECT_ACL, any_db,0,0,0);
if (res)
- DBUG_RETURN(-1);
-
+ DBUG_RETURN(1);
+#endif
+
if (!(res=open_and_lock_tables(thd,tables)))
{
if (is_union || is_subsel)
@@ -203,7 +203,9 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit,
org_table_list->table=table;
table->derived_select_number= select_cursor->select_number;
table->tmp_table= TMP_TABLE;
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
org_table_list->grant.privilege= SELECT_ACL;
+#endif
if (lex->describe)
{
// to fix a problem in EXPLAIN
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 947205949f1..af28d48ed8a 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -60,9 +60,11 @@ check_insert_fields(THD *thd,TABLE *table,List<Item> &fields,
MYF(0),counter);
return -1;
}
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (grant_option &&
check_grant_all_columns(thd,INSERT_ACL,table))
return -1;
+#endif
table->time_stamp=0; // This is saved by caller
}
else
@@ -96,7 +98,9 @@ check_insert_fields(THD *thd,TABLE *table,List<Item> &fields,
table->time_stamp= table->timestamp_field->offset()+1;
}
// For the values we need select_priv
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
table->grant.want_privilege=(SELECT_ACL & ~table->grant.privilege);
+#endif
return 0;
}
@@ -130,14 +134,15 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
thd->lex.select_lex.table_list.first;
DBUG_ENTER("mysql_insert");
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (thd->master_access & SUPER_ACL)
+#endif
{
if (!(thd->options & OPTION_UPDATE_LOG))
log_on&= ~(int) DELAYED_LOG_UPDATE;
if (!(thd->options & OPTION_BIN_LOG))
log_on&= ~(int) DELAYED_LOG_BIN;
}
-
/*
in safe mode or with skip-new change delayed insert to be regular
if we are told to replace duplicates, the insert cannot be concurrent
@@ -172,7 +177,10 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
else
res= (table == 0);
else
+ {
+ lock_type=TL_WRITE;
res= open_and_lock_tables(thd, table_list);
+ }
}
else
res= open_and_lock_tables(thd, table_list);
@@ -623,10 +631,11 @@ public:
group_count(0)
{
thd.user=thd.priv_user=(char*) delayed_user;
- thd.host=(char*) localhost;
+ thd.host=(char*) my_localhost;
thd.current_tablenr=0;
thd.version=refresh_version;
thd.command=COM_DELAYED_INSERT;
+ thd.lex.current_select= 0; /* for my_message_sql */
bzero((char*) &thd.net,sizeof(thd.net)); // Safety
thd.system_thread=1;
@@ -1448,6 +1457,8 @@ void select_insert::send_error(uint errcode,const char *err)
table->file->has_transactions());
mysql_bin_log.write(&qinfo);
}
+ if (!table->tmp_table)
+ thd->options|=OPTION_STATUS_NO_TRANS_UPDATE;
}
if (info.copied || info.deleted)
query_cache_invalidate3(thd, table, 1);
@@ -1468,7 +1479,11 @@ bool select_insert::send_eof()
*/
if (info.copied || info.deleted)
+ {
query_cache_invalidate3(thd, table, 1);
+ if (!(table->file->has_transactions() || table->tmp_table))
+ thd->options|=OPTION_STATUS_NO_TRANS_UPDATE;
+ }
if (last_insert_id)
thd->insert_id(last_insert_id); // For binary log
@@ -1559,8 +1574,6 @@ bool select_create::send_data(List<Item> &values)
return 0;
}
-extern HASH open_cache;
-
bool select_create::send_eof()
{
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 81322ae35f1..22c90d1a515 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -982,6 +982,7 @@ void st_select_lex::init_query()
cond_count= with_wild= 0;
ref_pointer_array= 0;
select_n_having_items= 0;
+ prep_where= 0;
}
void st_select_lex::init_select()
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index eb1d0c4b3ff..1bdf8c75d9c 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -61,7 +61,7 @@ enum enum_sql_command {
SQLCOM_CREATE_FUNCTION, SQLCOM_DROP_FUNCTION,
SQLCOM_REVOKE,SQLCOM_OPTIMIZE, SQLCOM_CHECK,
SQLCOM_ASSIGN_TO_KEYCACHE, SQLCOM_PRELOAD_KEYS,
- SQLCOM_FLUSH, SQLCOM_KILL, SQLCOM_ANALYZE,
+ SQLCOM_FLUSH, SQLCOM_KILL, SQLCOM_ANALYZE,
SQLCOM_ROLLBACK, SQLCOM_ROLLBACK_TO_SAVEPOINT,
SQLCOM_COMMIT, SQLCOM_SAVEPOINT,
SQLCOM_SLAVE_START, SQLCOM_SLAVE_STOP,
@@ -74,7 +74,7 @@ enum enum_sql_command {
SQLCOM_SHOW_BINLOG_EVENTS, SQLCOM_SHOW_NEW_MASTER, SQLCOM_DO,
SQLCOM_SHOW_WARNS, SQLCOM_EMPTY_QUERY, SQLCOM_SHOW_ERRORS,
SQLCOM_SHOW_COLUMN_TYPES, SQLCOM_SHOW_TABLE_TYPES, SQLCOM_SHOW_PRIVILEGES,
- SQLCOM_HELP, SQLCOM_DROP_USER, SQLCOM_REVOKE_ALL,
+ SQLCOM_HELP, SQLCOM_DROP_USER, SQLCOM_REVOKE_ALL, SQLCOM_CHECKSUM,
/* This should be the last !!! */
SQLCOM_END
@@ -88,6 +88,13 @@ typedef struct st_lex_master_info
uint port, connect_retry;
ulonglong pos;
ulong server_id;
+ /*
+ Variable for MASTER_SSL option.
+ MASTER_SSL=0 in CHANGE MASTER TO corresponds to SSL_DISABLE
+ MASTER_SSL=1 corresponds to SSL_ENABLE
+ */
+ enum {SSL_UNCHANGED=0, SSL_DISABLE, SSL_ENABLE} ssl;
+ char *ssl_key, *ssl_cert, *ssl_ca, *ssl_capath, *ssl_cipher;
char *relay_log_name;
ulong relay_log_pos;
} LEX_MASTER_INFO;
@@ -280,8 +287,8 @@ protected:
select_result *result;
int res;
- bool describe, found_rows_for_union,
- prepared, // prepare phase already performed for UNION (unit)
+ ulong describe, found_rows_for_union;
+ bool prepared, // prepare phase already performed for UNION (unit)
optimized, // optimize phase already performed for UNION (unit)
executed, // already executed
t_and_f; // used for transferring tables_and_fields_initied UNIT:: methods
@@ -340,6 +347,7 @@ class st_select_lex: public st_select_lex_node
public:
char *db, *db1, *table1, *db2, *table2; /* For outer join using .. */
Item *where, *having; /* WHERE & HAVING clauses */
+ Item *prep_where; /* saved WHERE clause for prepared statement processing */
enum olap_type olap;
SQL_LIST table_list, group_list; /* FROM & GROUP BY clauses */
List<Item> item_list; /* list of fields & expressions */
@@ -480,15 +488,22 @@ typedef struct st_lex
SELECT_LEX *all_selects_list;
uchar *ptr,*tok_start,*tok_end,*end_of_query;
char *length,*dec,*change,*name;
+ char *help_arg;
char *backup_dir; /* For RESTORE/BACKUP */
char* to_log; /* For PURGE MASTER LOGS TO */
time_t purge_time; /* For PURGE MASTER LOGS BEFORE */
char* x509_subject,*x509_issuer,*ssl_cipher;
char* found_colon; /* For multi queries - next query */
- enum SSL_type ssl_type; /* defined in violite.h */
String *wild;
sql_exchange *exchange;
select_result *result;
+ Item *default_value;
+ LEX_STRING *comment;
+ LEX_USER *grant_user;
+ gptr yacc_yyss,yacc_yyvs;
+ THD *thd;
+ CHARSET_INFO *charset;
+ SQL_LIST *gorder_list;
List<key_part_spec> col_list;
List<key_part_spec> ref_list;
@@ -507,11 +522,6 @@ typedef struct st_lex
TYPELIB *interval;
create_field *last_field;
char *savepoint_name; // Transaction savepoint id
- Item *default_value, *comment;
- uint uint_geom_type;
- LEX_USER *grant_user;
- gptr yacc_yyss,yacc_yyvs;
- THD *thd;
udf_func udf;
HA_CHECK_OPT check_opt; // check/repair options
HA_CREATE_INFO create_info;
@@ -520,6 +530,7 @@ typedef struct st_lex
ulong thread_id,type;
enum_sql_command sql_command;
thr_lock_type lock_option;
+ enum SSL_type ssl_type; /* defined in violite.h */
enum my_lex_states next_state;
enum enum_duplicates duplicates;
enum enum_tx_isolation tx_isolation;
@@ -527,17 +538,15 @@ typedef struct st_lex
enum ha_rkey_function ha_rkey_mode;
enum enum_enable_or_disable alter_keys_onoff;
enum enum_var_type option_type;
+ uint uint_geom_type;
uint grant, grant_tot_col, which_columns;
uint fk_delete_opt, fk_update_opt, fk_match_option;
uint param_count;
+ uint slave_thd_opt;
bool drop_primary, drop_if_exists, drop_temporary, local_file;
bool in_comment, ignore_space, verbose, simple_alter, no_write_to_binlog;
bool derived_tables, describe;
bool safe_to_cache_query;
- uint slave_thd_opt;
- CHARSET_INFO *charset;
- char *help_arg;
- SQL_LIST *gorder_list;
st_lex() {}
inline void uncacheable()
{
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index d030eaf617c..60e0a7c7e94 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -77,9 +77,6 @@ static int read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
List<Item> &fields, READ_INFO &read_info,
String &enclosed);
-
-#ifndef EMBEDDED_LIBRARY
-
int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
List<Item> &fields, enum enum_duplicates handle_duplicates,
bool read_file_from_client,thr_lock_type lock_type)
@@ -91,7 +88,9 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
String *field_term=ex->field_term,*escaped=ex->escaped,
*enclosed=ex->enclosed;
bool is_fifo=0;
+#ifndef EMBEDDED_LIBRARY
LOAD_FILE_INFO lf_info;
+#endif
char *db = table_list->db; // This is never null
/* If no current database, use database where table is located */
char *tdb= thd->db ? thd->db : db;
@@ -171,7 +170,6 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
else
#endif
{
- read_file_from_client=0;
#ifdef DONT_ALLOW_FULL_LOAD_DATA_PATHS
ex->file_name+=dirname_length(ex->file_name);
#endif
@@ -184,6 +182,17 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
}
else
{
+#ifdef EMBEDDED_LIBRARY
+ char *chk_name= ex->file_name;
+ while ((*chk_name == ' ') || (*chk_name == 't'))
+ chk_name++;
+ if (*chk_name == FN_CURLIB)
+ {
+ sprintf(name, "%s%s", mysql_data_home, ex->file_name);
+ unpack_filename(name, name);
+ }
+ else
+#endif /*EMBEDDED_LIBRARY*/
unpack_filename(name,ex->file_name);
#if !defined(__WIN__) && !defined(OS2) && ! defined(__NETWARE__)
MY_STAT stat_info;
@@ -215,7 +224,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
info.handle_duplicates=handle_duplicates;
info.escape_char=escaped->length() ? (*escaped)[0] : INT_MAX;
- READ_INFO read_info(file,tot_length,thd->variables.character_set_database,
+ READ_INFO read_info(file,tot_length,thd->variables.collation_database,
*field_term,*ex->line_start, *ex->line_term, *enclosed,
info.escape_char, read_file_from_client, is_fifo);
if (read_info.error)
@@ -225,6 +234,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
DBUG_RETURN(-1); // Can't allocate buffers
}
+#ifndef EMBEDDED_LIBRARY
if (!opt_old_rpl_compat && mysql_bin_log.is_open())
{
lf_info.thd = thd;
@@ -238,6 +248,8 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
lf_info.log_delayed= log_delayed;
read_info.set_io_cache_arg((void*) &lf_info);
}
+#endif /*!EMBEDDED_LIBRARY*/
+
restore_record(table,default_values);
thd->count_cuted_fields=1; /* calc cuted fields */
@@ -293,6 +305,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
{
if (transactional_table)
ha_autocommit_or_rollback(thd,error);
+#ifndef EMBEDDED_LIBRARY
if (!opt_old_rpl_compat && mysql_bin_log.is_open())
{
if (lf_info.wrote_create_file)
@@ -311,10 +324,11 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
which is nonsense.
*/
read_info.end_io_cache();
- Delete_file_log_event d(thd, log_delayed);
+ Delete_file_log_event d(thd, db, log_delayed);
mysql_bin_log.write(&d);
}
}
+#endif /*!EMBEDDED_LIBRARY*/
error= -1; // Error on read
goto err;
}
@@ -327,6 +341,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
if (!log_delayed)
thd->options|=OPTION_STATUS_NO_TRANS_UPDATE;
+#ifndef EMBEDDED_LIBRARY
if (mysql_bin_log.is_open())
{
if (opt_old_rpl_compat)
@@ -343,11 +358,12 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
read_info.end_io_cache(); // make sure last block gets logged
if (lf_info.wrote_create_file)
{
- Execute_load_log_event e(thd, log_delayed);
+ Execute_load_log_event e(thd, db, log_delayed);
mysql_bin_log.write(&e);
}
}
}
+#endif /*!EMBEDDED_LIBRARY*/
if (transactional_table)
error=ha_autocommit_or_rollback(thd,error);
err:
@@ -359,8 +375,6 @@ err:
DBUG_RETURN(error);
}
-#endif /* EMBEDDED_LIBRARY */
-
/****************************************************************************
** Read of rows of fixed size + optional garage + optonal newline
****************************************************************************/
@@ -640,11 +654,12 @@ READ_INFO::READ_INFO(File file_par, uint tot_length, CHARSET_INFO *cs,
mysys/mf_iocache.c. So we work around the problem with a
manual assignment
*/
+ need_end_io_cache = 1;
+
+#ifndef EMBEDDED_LIBRARY
if (get_it_from_net)
cache.read_function = _my_b_net_read;
- need_end_io_cache = 1;
-#ifndef EMBEDDED_LIBRARY
if (!opt_old_rpl_compat && mysql_bin_log.is_open())
cache.pre_read = cache.pre_close =
(IO_CACHE_CALLBACK) log_loaded_block;
@@ -806,9 +821,13 @@ int READ_INFO::read_field()
row_end= to;
return 0;
}
- /* Copy the found '"' character */
+ /*
+ The string didn't terminate yet.
+ Store back next character for the loop
+ */
PUSH(chr);
- chr='"';
+ /* copy the found term character to 'to' */
+ chr= found_enclosed_char;
}
else if (chr == field_term_char && found_enclosed_char == INT_MAX)
{
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 2bf96a7deca..b9e9077466b 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -44,7 +44,6 @@
#define MIN_HANDSHAKE_SIZE 6
#endif /* HAVE_OPENSSL */
-extern int yyparse(void *thd);
extern "C" pthread_mutex_t THR_LOCK_keycache;
#ifdef SOLARIS
extern "C" int gethostname(char *name, int namelen);
@@ -53,15 +52,19 @@ extern "C" int gethostname(char *name, int namelen);
static int check_for_max_user_connections(THD *thd, USER_CONN *uc);
static void decrease_user_connections(USER_CONN *uc);
static bool check_db_used(THD *thd,TABLE_LIST *tables);
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
static bool check_merge_table_access(THD *thd, char *db, TABLE_LIST *tables);
+static bool single_table_command_access(THD *thd, ulong privilege,
+ TABLE_LIST *tables, int *res);
+#else
+#define check_merge_table_access(thd, db, tables) false
+#define single_table_command_access(thd, privilege, tables, res) false
+#endif
static void remove_escape(char *name);
static void refresh_status(void);
static bool append_file_to_dir(THD *thd, char **filename_ptr,
char *table_name);
-static bool single_table_command_access(THD *thd, ulong privilege,
- TABLE_LIST *tables, int *res);
-
const char *any_db="*any*"; // Special symbol for check_access
const char *command_name[]={
@@ -120,7 +123,6 @@ static bool end_active_trans(THD *thd)
static HASH hash_user_connections;
-extern pthread_mutex_t LOCK_user_conn;
static int get_or_create_user_conn(THD *thd, const char *user,
const char *host,
@@ -161,7 +163,7 @@ static int get_or_create_user_conn(THD *thd, const char *user,
if (max_user_connections && mqh->connections > max_user_connections)
uc->user_resources.connections = max_user_connections;
uc->intime=thd->thr_create_time;
- if (hash_insert(&hash_user_connections, (byte*) uc))
+ if (my_hash_insert(&hash_user_connections, (byte*) uc))
{
my_free((char*) uc,0);
send_error(thd, 0, NullS); // Out of memory
@@ -176,154 +178,186 @@ end:
}
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
/*
- Check if user is ok
-
+ Check if user exist and password supplied is correct.
SYNOPSIS
check_user()
- thd Thread handle
- command Command for connection (for log)
- user Name of user trying to connect
- passwd Scrambled password sent from client
- db Database to connect to
- check_count If set to 1, don't allow too many connection
- simple_connect If 1 then client is of old type and we should connect
- using the old method (no challange)
- do_send_error Set to 1 if we should send error to user
- prepared_scramble Buffer to store hash password of new connection
- had_password Set to 1 if the user gave a password
- cur_priv_version Check flag to know if someone flushed the privileges
- since last code
- hint_user Pointer used by acl_getroot() to remmeber user for
- next call
-
- RETURN
- 0 ok
- thd->user, thd->master_access, thd->priv_user, thd->db and
- thd->db_access are updated
- 1 Access denied; Error sent to client
- -1 If do_send_error == 1: Failed connect, error sent to client
- If do_send_error == 0: Prepare for stage of connect
+ thd thread handle, thd->{host,user,ip} are used
+ command originator of the check: now check_user is called
+ during connect and change user procedures; used for
+ logging.
+ passwd scrambled password recieved from client
+ passwd_len length of scrambled password
+ db database name to connect to, may be NULL
+ check_count dont know exactly
+
+ Note, that host, user and passwd may point to communication buffer.
+ Current implementation does not depened on that, but future changes
+ should be done with this in mind; 'thd' is INOUT, all other params
+ are 'IN'.
+
+ RETURN VALUE
+ 0 OK; thd->user, thd->master_access, thd->priv_user, thd->db and
+ thd->db_access are updated; OK is sent to client;
+ -1 access denied or handshake error; error is sent to client;
+ >0 error, not sent to client
*/
-static int check_user(THD *thd,enum_server_command command, const char *user,
- const char *passwd, const char *db, bool check_count,
- bool simple_connect, bool do_send_error,
- char *prepared_scramble, bool had_password,
- uint *cur_priv_version, ACL_USER** hint_user)
+int check_user(THD *thd, enum enum_server_command command,
+ const char *passwd, uint passwd_len, const char *db,
+ bool check_count)
{
- thd->db=0;
- thd->db_length=0;
- USER_RESOURCES ur;
- char tmp_passwd[SCRAMBLE41_LENGTH+1];
DBUG_ENTER("check_user");
+ my_bool opt_secure_auth_local;
+ pthread_mutex_lock(&LOCK_global_system_variables);
+ opt_secure_auth_local= opt_secure_auth;
+ pthread_mutex_unlock(&LOCK_global_system_variables);
+
/*
- Move password to temporary buffer as it may be stored in communication
- buffer
+ If the server is running in secure auth mode, short scrambles are
+ forbidden.
*/
- strmake(tmp_passwd, passwd, sizeof(tmp_passwd));
- passwd= tmp_passwd; // Use local copy
-
- /* We shall avoid dupplicate user allocations here */
- if (!thd->user && !(thd->user = my_strdup(user, MYF(0))))
+ if (opt_secure_auth_local && passwd_len == SCRAMBLE_LENGTH_323)
{
- send_error(thd,ER_OUT_OF_RESOURCES);
- DBUG_RETURN(1);
+ net_printf(thd, ER_NOT_SUPPORTED_AUTH_MODE);
+ mysql_log.write(thd, COM_CONNECT, ER(ER_NOT_SUPPORTED_AUTH_MODE));
+ DBUG_RETURN(-1);
}
- thd->master_access=acl_getroot(thd, thd->host, thd->ip, thd->user,
- passwd, thd->scramble,
- &thd->priv_user, thd->priv_host,
- (protocol_version == 9 ||
- !(thd->client_capabilities &
- CLIENT_LONG_PASSWORD)),
- &ur,prepared_scramble,
- cur_priv_version,hint_user);
-
- DBUG_PRINT("info",
- ("Capabilities: %d packet_length: %ld Host: '%s' Login user: '%s' Priv_user: '%s' Using password: %s Access: %u db: '%s'",
- thd->client_capabilities, thd->max_client_packet_length,
- thd->host_or_ip, thd->user, thd->priv_user,
- had_password ? "yes": "no",
- thd->master_access, thd->db ? thd->db : "*none*"));
+ if (passwd_len != 0 &&
+ passwd_len != SCRAMBLE_LENGTH &&
+ passwd_len != SCRAMBLE_LENGTH_323)
+ DBUG_RETURN(ER_HANDSHAKE_ERROR);
/*
- In case we're going to retry we should not send error message at this
- point
+ Clear thd->db as it points to something, that will be freed when
+ connection is closed. We don't want to accidently free a wrong pointer
+ if connect failed. Also in case of 'CHANGE USER' failure, current
+ database will be switched to 'no database selected'.
*/
- if (thd->master_access & NO_ACCESS)
+ thd->db= 0;
+ thd->db_length= 0;
+
+ USER_RESOURCES ur;
+ int res= acl_getroot(thd, &ur, passwd, passwd_len);
+#ifndef EMBEDDED_LIBRARY
+ if (res == -1)
+ {
+ /*
+ This happens when client (new) sends password scrambled with
+ scramble(), but database holds old value (scrambled with
+ scramble_323()). Here we please client to send scrambled_password
+ in old format.
+ */
+ NET *net= &thd->net;
+ if (opt_secure_auth_local)
+ {
+ net_printf(thd, ER_SERVER_IS_IN_SECURE_AUTH_MODE,
+ thd->user, thd->host_or_ip);
+ mysql_log.write(thd, COM_CONNECT, ER(ER_SERVER_IS_IN_SECURE_AUTH_MODE),
+ thd->user, thd->host_or_ip);
+ DBUG_RETURN(-1);
+ }
+ if (send_old_password_request(thd) ||
+ my_net_read(net) != SCRAMBLE_LENGTH_323 + 1) // We have to read very
+ { // specific packet size
+ inc_host_errors(&thd->remote.sin_addr);
+ DBUG_RETURN(ER_HANDSHAKE_ERROR);
+ }
+ /* Final attempt to check the user based on reply */
+ /* So as passwd is short, errcode is always >= 0 */
+ res= acl_getroot(thd, &ur, (char *) net->read_pos, SCRAMBLE_LENGTH_323);
+ }
+#endif /*EMBEDDED_LIBRARY*/
+ /* here res is always >= 0 */
+ if (res == 0)
{
- if (do_send_error || !had_password || !*hint_user)
+ if (!(thd->master_access & NO_ACCESS)) // authentification is OK
{
- DBUG_PRINT("info",("Access denied"));
+ DBUG_PRINT("info",
+ ("Capabilities: %d packet_length: %ld Host: '%s' "
+ "Login user: '%s' Priv_user: '%s' Using password: %s "
+ "Access: %u db: '%s'",
+ thd->client_capabilities, thd->max_client_packet_length,
+ thd->host_or_ip, thd->user, thd->priv_user,
+ passwd_len ? "yes": "no",
+ thd->master_access, thd->db ? thd->db : "*none*"));
+
+ if (check_count)
+ {
+ VOID(pthread_mutex_lock(&LOCK_thread_count));
+ bool count_ok= thread_count < max_connections + delayed_insert_threads
+ || (thd->master_access & SUPER_ACL);
+ VOID(pthread_mutex_unlock(&LOCK_thread_count));
+ if (!count_ok)
+ { // too many connections
+ send_error(thd, ER_CON_COUNT_ERROR);
+ DBUG_RETURN(-1);
+ }
+ }
+
+ /* Why logging is performed before all checks've passed? */
+ mysql_log.write(thd,command,
+ (thd->priv_user == thd->user ?
+ (char*) "%s@%s on %s" :
+ (char*) "%s@%s as anonymous on %s"),
+ thd->user, thd->host_or_ip,
+ db ? db : (char*) "");
+
/*
- Old client should get nicer error message if password version is
- not supported
+ This is the default access rights for the current database. It's
+ set to 0 here because we don't have an active database yet (and we
+ may not have an active database to set.
*/
- if (simple_connect && *hint_user && (*hint_user)->pversion)
+ thd->db_access=0;
+
+ /* Don't allow user to connect if he has done too many queries */
+ if ((ur.questions || ur.updates ||
+ ur.connections || max_user_connections) &&
+ get_or_create_user_conn(thd,thd->user,thd->host_or_ip,&ur))
+ DBUG_RETURN(1);
+ if (thd->user_connect && thd->user_connect->user_resources.connections &&
+ check_for_max_user_connections(thd, thd->user_connect))
+ DBUG_RETURN(1);
+
+ /* Change database if necessary: OK or FAIL is sent in mysql_change_db */
+ if (db && db[0])
{
- net_printf(thd, ER_NOT_SUPPORTED_AUTH_MODE);
- mysql_log.write(thd,COM_CONNECT,ER(ER_NOT_SUPPORTED_AUTH_MODE));
+ if (mysql_change_db(thd, db))
+ {
+ if (thd->user_connect)
+ decrease_user_connections(thd->user_connect);
+ DBUG_RETURN(-1);
+ }
}
else
- {
- net_printf(thd, ER_ACCESS_DENIED_ERROR,
- thd->user,
- thd->host_or_ip,
- had_password ? ER(ER_YES) : ER(ER_NO));
- mysql_log.write(thd,COM_CONNECT,ER(ER_ACCESS_DENIED_ERROR),
- thd->user,
- thd->host_or_ip,
- had_password ? ER(ER_YES) : ER(ER_NO));
- }
- DBUG_RETURN(1); // Error already given
- }
- DBUG_PRINT("info",("Prepare for second part of handshake"));
- DBUG_RETURN(-1); // no report error in special handshake
- }
-
- if (check_count)
- {
- VOID(pthread_mutex_lock(&LOCK_thread_count));
- bool tmp=(thread_count - delayed_insert_threads >= max_connections &&
- !(thd->master_access & SUPER_ACL));
- VOID(pthread_mutex_unlock(&LOCK_thread_count));
- if (tmp)
- { // Too many connections
- send_error(thd, ER_CON_COUNT_ERROR);
- DBUG_RETURN(1);
+ send_ok(thd);
+ thd->password= test(passwd_len); // remember for error messages
+ /* Ready to handle queries */
+ DBUG_RETURN(0);
}
}
- mysql_log.write(thd,command,
- (thd->priv_user == thd->user ?
- (char*) "%s@%s on %s" :
- (char*) "%s@%s as anonymous on %s"),
- user,
- thd->host_or_ip,
- db ? db : (char*) "");
- thd->db_access=0;
- /* Don't allow user to connect if he has done too many queries */
- if ((ur.questions || ur.updates || ur.connections || max_user_connections) &&
- get_or_create_user_conn(thd,user,thd->host_or_ip,&ur))
- DBUG_RETURN(1);
- if (thd->user_connect && ((thd->user_connect->user_resources.connections) ||
- max_user_connections) &&
- check_for_max_user_connections(thd, thd->user_connect))
- DBUG_RETURN(1);
-
- if (db && db[0])
- {
- int error= test(mysql_change_db(thd,db));
- if (error && thd->user_connect)
- decrease_user_connections(thd->user_connect);
- DBUG_RETURN(error);
- }
- send_ok(thd); // Ready to handle questions
- thd->password= test(passwd[0]); // Remember for error messages
- DBUG_RETURN(0); // ok
+ else if (res == 2) // client gave short hash, server has long hash
+ {
+ net_printf(thd, ER_NOT_SUPPORTED_AUTH_MODE);
+ mysql_log.write(thd,COM_CONNECT,ER(ER_NOT_SUPPORTED_AUTH_MODE));
+ DBUG_RETURN(-1);
+ }
+ net_printf(thd, ER_ACCESS_DENIED_ERROR,
+ thd->user,
+ thd->host_or_ip,
+ passwd_len ? ER(ER_YES) : ER(ER_NO));
+ mysql_log.write(thd, COM_CONNECT, ER(ER_ACCESS_DENIED_ERROR),
+ thd->user,
+ thd->host_or_ip,
+ passwd_len ? ER(ER_YES) : ER(ER_NO));
+ DBUG_RETURN(-1);
}
+#endif /*!NO_EMBEDDED_ACCESS_CHECKS*/
+
/*
Check for maximum allowable user connections, if the mysqld server is
@@ -433,6 +467,7 @@ bool is_update_query(enum enum_sql_command command)
return uc_update_queries[command];
}
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
/*
Check if maximum queries per hour limit has been reached
returns 0 if OK.
@@ -523,54 +558,44 @@ static void reset_mqh(THD *thd, LEX_USER *lu, bool get_them= 0)
}
(void) pthread_mutex_unlock(&LOCK_user_conn);
}
-
+#endif /*!NO_EMBEDDED_ACCESS_CHECKS*/
/*
- Check connnectionn and get priviliges
-
+ Perform handshake, authorize client and update thd ACL variables.
SYNOPSIS
- check_connections
- thd Thread handle
+ check_connection()
+ thd thread handle
RETURN
- 0 ok
- -1 Error, which is sent to user
- > 0 Error code (not sent to user)
+ 0 success, OK is sent to user, thd is updated.
+ -1 error, which is sent to user
+ > 0 error code (not sent to user)
*/
-#ifndef EMBEDDED_LIBRARY
-static int
-check_connections(THD *thd)
+#ifndef EMBEDDED_LIBRARY
+static int check_connection(THD *thd)
{
- int res;
- uint connect_errors=0;
- uint cur_priv_version;
- bool using_password;
+ uint connect_errors= 0;
NET *net= &thd->net;
- char *end, *user, *passwd, *db;
- char prepared_scramble[SCRAMBLE41_LENGTH+4]; /* Buffer for scramble&hash */
- char db_buff[NAME_LEN+1];
- ACL_USER* cached_user=NULL; /* Initialise to NULL for first stage */
- DBUG_PRINT("info",("New connection received on %s",
- vio_description(net->vio)));
-
- /* Remove warning from valgrind. TODO: Fix it in password.c */
- bzero((char*) &prepared_scramble[0], sizeof(prepared_scramble));
+
+ DBUG_PRINT("info",
+ ("New connection received on %s", vio_description(net->vio)));
+
if (!thd->host) // If TCP/IP connection
{
char ip[30];
if (vio_peer_addr(net->vio, ip, &thd->peer_port))
return (ER_BAD_HOST_ERROR);
- if (!(thd->ip = my_strdup(ip,MYF(0))))
+ if (!(thd->ip= my_strdup(ip,MYF(0))))
return (ER_OUT_OF_RESOURCES);
- thd->host_or_ip=thd->ip;
+ thd->host_or_ip= thd->ip;
#if !defined(HAVE_SYS_UN_H) || defined(HAVE_mit_thread)
/* Fast local hostname resolve for Win32 */
if (!strcmp(thd->ip,"127.0.0.1"))
{
- thd->host= (char*) localhost;
- thd->host_or_ip= localhost;
+ thd->host= (char*) my_localhost;
+ thd->host_or_ip= my_localhost;
}
else
#endif
@@ -600,15 +625,14 @@ check_connections(THD *thd)
DBUG_PRINT("info",("Host: %s",thd->host));
thd->host_or_ip= thd->host;
thd->ip= 0;
- bzero((char*) &thd->remote,sizeof(struct sockaddr));
+ bzero((char*) &thd->remote, sizeof(struct sockaddr));
}
- /* Ensure that wrong hostnames doesn't cause buffer overflows */
vio_keepalive(net->vio, TRUE);
-
- ulong pkt_len=0;
+ ulong pkt_len= 0;
+ char *end;
{
/* buff[] needs to big enough to hold the server_version variable */
- char buff[SERVER_VERSION_LENGTH + SCRAMBLE_LENGTH+64];
+ char buff[SERVER_VERSION_LENGTH + SCRAMBLE_LENGTH + 64];
ulong client_flags = (CLIENT_LONG_FLAG | CLIENT_CONNECT_WITH_DB |
CLIENT_PROTOCOL_41 | CLIENT_SECURE_CONNECTION);
@@ -622,19 +646,34 @@ check_connections(THD *thd)
client_flags |= CLIENT_SSL; /* Wow, SSL is avalaible! */
#endif /* HAVE_OPENSSL */
- end=strnmov(buff,server_version,SERVER_VERSION_LENGTH)+1;
- int4store((uchar*) end,thd->thread_id);
- end+=4;
- memcpy(end,thd->scramble,SCRAMBLE_LENGTH+1);
- end+=SCRAMBLE_LENGTH +1;
- int2store(end,client_flags);
+ end= strnmov(buff, server_version, SERVER_VERSION_LENGTH) + 1;
+ int4store((uchar*) end, thd->thread_id);
+ end+= 4;
+ /*
+ So as check_connection is the only entry point to authorization
+ procedure, scramble is set here. This gives us new scramble for
+ each handshake.
+ */
+ create_random_string(thd->scramble, SCRAMBLE_LENGTH, &thd->rand);
+ /*
+ Old clients does not understand long scrambles, but can ignore packet
+ tail: that's why first part of the scramble is placed here, and second
+ part at the end of packet.
+ */
+ end= strmake(end, thd->scramble, SCRAMBLE_LENGTH_323) + 1;
+
+ int2store(end, client_flags);
+ /* write server characteristics: up to 16 bytes allowed */
end[2]=(char) default_charset_info->number;
- int2store(end+3,thd->server_status);
- bzero(end+5,13);
- end+=18;
-
- // At this point we write connection message and read reply
- if (net_write_command(net,(uchar) protocol_version, "", 0, buff,
+ int2store(end+3, thd->server_status);
+ bzero(end+5, 13);
+ end+= 18;
+ /* write scramble tail */
+ end= strmake(end, thd->scramble + SCRAMBLE_LENGTH_323,
+ SCRAMBLE_LENGTH - SCRAMBLE_LENGTH_323) + 1;
+
+ /* At this point we write connection message and read reply */
+ if (net_write_command(net, (uchar) protocol_version, "", 0, buff,
(uint) (end-buff)) ||
(pkt_len= my_net_read(net)) == packet_error ||
pkt_len < MIN_HANDSHAKE_SIZE)
@@ -723,7 +762,7 @@ check_connections(THD *thd)
return(ER_HANDSHAKE_ERROR);
}
DBUG_PRINT("info", ("Reading user information over SSL layer"));
- if ((pkt_len=my_net_read(net)) == packet_error ||
+ if ((pkt_len= my_net_read(net)) == packet_error ||
pkt_len < NORMAL_HANDSHAKE_SIZE)
{
DBUG_PRINT("error", ("Failed to read user information (pkt_len= %lu)",
@@ -740,25 +779,6 @@ check_connections(THD *thd)
return(ER_HANDSHAKE_ERROR);
}
- user= end;
- passwd= strend(user)+1;
- db=0;
- using_password= test(passwd[0]);
- if (thd->client_capabilities & CLIENT_CONNECT_WITH_DB)
- {
- db= strend(passwd)+1;
- uint32 length= copy_and_convert(db_buff, sizeof(db_buff)-1,
- system_charset_info,
- db, strlen(db),
- thd->charset());
- db_buff[length]= 0;
- db= db_buff;
- }
-
- /* We can get only old hash at this point */
- if (using_password && strlen(passwd) != SCRAMBLE_LENGTH)
- return ER_HANDSHAKE_ERROR;
-
if (thd->client_capabilities & CLIENT_INTERACTIVE)
thd->variables.net_wait_timeout= thd->variables.net_interactive_timeout;
if ((thd->client_capabilities & CLIENT_TRANSACTIONS) &&
@@ -766,63 +786,37 @@ check_connections(THD *thd)
net->return_status= &thd->server_status;
net->read_timeout=(uint) thd->variables.net_read_timeout;
- /* Simple connect only for old clients. New clients always use secure auth */
- bool simple_connect=(!(thd->client_capabilities & CLIENT_SECURE_CONNECTION));
-
- /* Check user permissions. If password failure we'll get scramble back */
- if ((res=check_user(thd, COM_CONNECT, user, passwd, db, 1, simple_connect,
- simple_connect, prepared_scramble, using_password,
- &cur_priv_version,
- &cached_user)) < 0)
- {
- /* Store current used and database as they are erased with next packet */
- char tmp_user[USERNAME_LENGTH+1];
- char tmp_db[NAME_LEN+1];
-
- /* If the client is old we just have to return error */
- if (simple_connect)
- return -1;
-
- DBUG_PRINT("info",("password challenge"));
-
- tmp_user[0]= tmp_db[0]= 0;
- if (user)
- strmake(tmp_user,user,USERNAME_LENGTH);
- if (db)
- strmake(tmp_db,db,NAME_LEN);
+ char *user= end;
+ char *passwd= strend(user)+1;
+ char *db= passwd;
+ char db_buff[NAME_LEN+1]; // buffer to store db in utf8
+ /*
+ Old clients send null-terminated string as password; new clients send
+ the size (1 byte) + string (not null-terminated). Hence in case of empty
+ password both send '\0'.
+ */
+ uint passwd_len= thd->client_capabilities & CLIENT_SECURE_CONNECTION ?
+ *passwd++ : strlen(passwd);
+ db= thd->client_capabilities & CLIENT_CONNECT_WITH_DB ?
+ db + passwd_len + 1 : 0;
+
+ /* Since 4.1 all database names are stored in utf8 */
+ if (db)
+ {
+ db_buff[copy_and_convert(db_buff, sizeof(db_buff)-1,
+ system_charset_info,
+ db, strlen(db),
+ thd->charset())]= 0;
+ db= db_buff;
+ }
- /* Write hash and encrypted scramble to client */
- if (my_net_write(net,prepared_scramble,SCRAMBLE41_LENGTH+4) ||
- net_flush(net))
- {
- inc_host_errors(&thd->remote.sin_addr);
- return ER_HANDSHAKE_ERROR;
- }
- /* Reading packet back */
- if ((pkt_len= my_net_read(net)) == packet_error)
- {
- inc_host_errors(&thd->remote.sin_addr);
- return ER_HANDSHAKE_ERROR;
- }
- /* We have to get very specific packet size */
- if (pkt_len != SCRAMBLE41_LENGTH)
- {
- inc_host_errors(&thd->remote.sin_addr);
- return ER_HANDSHAKE_ERROR;
- }
- /* Final attempt to check the user based on reply */
- if (check_user(thd,COM_CONNECT, tmp_user, (char*)net->read_pos,
- tmp_db, 1, 0, 1, prepared_scramble, using_password,
- &cur_priv_version,
- &cached_user))
- return -1;
- }
- else if (res)
- return -1; // Error sent from check_user()
- return 0;
+ if (thd->user)
+ x_free(thd->user);
+ if (!(thd->user= my_strdup(user, MYF(0))))
+ return (ER_OUT_OF_RESOURCES);
+ return check_user(thd, COM_CONNECT, passwd, passwd_len, db, true);
}
-
pthread_handler_decl(handle_one_connection,arg)
{
THD *thd=(THD*) arg;
@@ -876,7 +870,7 @@ pthread_handler_decl(handle_one_connection,arg)
NET *net= &thd->net;
thd->thread_stack= (char*) &thd;
- if ((error=check_connections(thd)))
+ if ((error=check_connection(thd)))
{ // Wrong permissions
if (error > 0)
net_printf(thd,error,thd->host_or_ip);
@@ -938,6 +932,8 @@ end_thread:
return(0); /* purecov: deadcode */
}
+#endif /* EMBEDDED_LIBRARY */
+
/*
Execute commands from bootstrap_file.
Used when creating the initial grant tables
@@ -952,12 +948,15 @@ extern "C" pthread_handler_decl(handle_bootstrap,arg)
/* The following must be called before DBUG_ENTER */
if (my_thread_init() || thd->store_globals())
{
+#ifndef EMBEDDED_LIBRARY
close_connection(thd, ER_OUT_OF_RESOURCES, 1);
+#endif
thd->fatal_error();
goto end;
}
DBUG_ENTER("handle_bootstrap");
+#ifndef EMBEDDED_LIBRARY
pthread_detach_this_thread();
thd->thread_stack= (char*) &thd;
#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__)
@@ -965,6 +964,7 @@ extern "C" pthread_handler_decl(handle_bootstrap,arg)
VOID(sigemptyset(&set)); // Get mask in use
VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals));
#endif
+#endif /* EMBEDDED_LIBRARY */
if (thd->variables.max_join_size == HA_POS_ERROR)
thd->options |= OPTION_BIG_SELECTS;
@@ -986,6 +986,7 @@ extern "C" pthread_handler_decl(handle_bootstrap,arg)
thd->query= thd->memdup_w_gap(buff, length+1, thd->db_length+1);
thd->query[length] = '\0';
thd->query_id=query_id++;
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (mqh_used && thd->user_connect && check_mqh(thd, SQLCOM_END))
{
thd->net.error = 0;
@@ -993,6 +994,7 @@ extern "C" pthread_handler_decl(handle_bootstrap,arg)
free_root(&thd->mem_root,MYF(MY_KEEP_PREALLOC));
break;
}
+#endif
mysql_parse(thd,thd->query,length);
close_thread_tables(thd); // Free tables
if (thd->is_fatal_error)
@@ -1003,17 +1005,17 @@ extern "C" pthread_handler_decl(handle_bootstrap,arg)
/* thd->fatal_error should be set in case something went wrong */
end:
+#ifndef EMBEDDED_LIBRARY
(void) pthread_mutex_lock(&LOCK_thread_count);
thread_count--;
(void) pthread_mutex_unlock(&LOCK_thread_count);
(void) pthread_cond_broadcast(&COND_thread_count);
my_thread_end();
pthread_exit(0);
+#endif
DBUG_RETURN(0); // Never reached
}
-#endif /* EMBEDDED_LIBRARY */
-
/* This works because items are allocated with sql_alloc() */
void free_items(Item *item)
@@ -1048,11 +1050,12 @@ int mysql_table_dump(THD* thd, char* db, char* tbl_name, int fd)
if (!(table=open_ltable(thd, table_list, TL_READ_NO_INSERT)))
DBUG_RETURN(1);
- if (check_access(thd, SELECT_ACL, db, &table_list->grant.privilege))
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ if (check_access(thd, SELECT_ACL, db, &table_list->grant.privilege,0,0))
goto err;
if (grant_option && check_grant(thd, SELECT_ACL, table_list))
goto err;
-
+#endif
thd->free_list = 0;
thd->query_length=(uint) strlen(tbl_name);
thd->query = tbl_name;
@@ -1161,7 +1164,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
mysql_log.write(thd,command,"%s",thd->db);
break;
}
-#ifndef EMBEDDED_LIBRARY
+#ifdef HAVE_REPLICATION
case COM_REGISTER_SLAVE:
{
if (!register_slave(thd, (uchar*)packet, packet_length))
@@ -1188,116 +1191,73 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
case COM_CHANGE_USER:
{
thd->change_user();
- thd->clear_error(); // If errors from rollback
+ thd->clear_error(); // if errors from rollback
- statistic_increment(com_other,&LOCK_status);
- char *user= (char*) packet;
+ statistic_increment(com_other, &LOCK_status);
+ char *user= (char*) packet;
char *passwd= strend(user)+1;
- char *db= strend(passwd)+1;
-
- /* Save user and privileges */
- uint save_master_access=thd->master_access;
- uint save_db_access= thd->db_access;
- uint save_db_length= thd->db_length;
- char *save_user= thd->user;
- thd->user=NULL; /* Needed for check_user to allocate new user */
- char *save_priv_user= thd->priv_user;
- char *save_db= thd->db;
- USER_CONN *save_uc= thd->user_connect;
- bool simple_connect;
- bool using_password;
- char prepared_scramble[SCRAMBLE41_LENGTH+4];/* Buffer for scramble,hash */
- char tmp_user[USERNAME_LENGTH+1];
- char tmp_db[NAME_LEN+1];
- ACL_USER* cached_user ; /* Cached user */
- uint cur_priv_version; /* Cached grant version */
- int res;
- ulong pkt_len= 0; /* Length of reply packet */
-
- bzero((char*) prepared_scramble, sizeof(prepared_scramble));
+ /*
+ Old clients send null-terminated string ('\0' for empty string) for
+ password. New clients send the size (1 byte) + string (not null
+ terminated, so also '\0' for empty string).
+ */
+ char db_buff[NAME_LEN+1]; // buffer to store db in utf8
+ char *db= passwd;
+ uint passwd_len= thd->client_capabilities & CLIENT_SECURE_CONNECTION ?
+ *passwd++ : strlen(passwd);
+ db+= passwd_len + 1;
/* Small check for incomming packet */
-
if ((uint) ((uchar*) db - net->read_pos) > packet_length)
- goto restore_user_err;
-
- /* Now we shall basically perform authentication again */
-
- /* We can get only old hash at this point */
- if (passwd[0] && strlen(passwd)!=SCRAMBLE_LENGTH)
- goto restore_user_err;
-
- cached_user= NULL;
-
- /* Simple connect only for old clients. New clients always use sec. auth*/
- simple_connect=(!(thd->client_capabilities & CLIENT_SECURE_CONNECTION));
-
- /* Store information if we used password. passwd will be dammaged */
- using_password=test(passwd[0]);
+ {
+ send_error(thd, ER_UNKNOWN_COM_ERROR);
+ break;
+ }
- if (simple_connect) /* Restore scramble for old clients */
- memcpy(thd->scramble,thd->old_scramble,9);
+ /* Convert database name to utf8 */
+ db_buff[copy_and_convert(db_buff, sizeof(db_buff)-1,
+ system_charset_info, db, strlen(db),
+ thd->charset())]= 0;
+ db= db_buff;
- /*
- Check user permissions. If password failure we'll get scramble back
- Do not retry if we already have sent error (result>0)
- */
- if ((res=check_user(thd,COM_CHANGE_USER, user, passwd, db, 0,
- simple_connect, simple_connect, prepared_scramble,
- using_password, &cur_priv_version, &cached_user)) < 0)
+ /* Save user and privileges */
+ uint save_master_access= thd->master_access;
+ uint save_db_access= thd->db_access;
+ uint save_db_length= thd->db_length;
+ char *save_user= thd->user;
+ char *save_priv_user= thd->priv_user;
+ char *save_db= thd->db;
+ USER_CONN *save_uc= thd->user_connect;
+ thd->user= my_strdup(user, MYF(0));
+ if (!thd->user)
{
- /* If the client is old we just have to have auth failure */
- if (simple_connect)
- goto restore_user; /* Error is already reported */
-
- /* Store current used and database as they are erased with next packet */
- tmp_user[0]= tmp_db[0]= 0;
- if (user)
- strmake(tmp_user,user,USERNAME_LENGTH);
- if (db)
- strmake(tmp_db,db,NAME_LEN);
-
- /* Write hash and encrypted scramble to client */
- if (my_net_write(net,prepared_scramble,SCRAMBLE41_LENGTH+4) ||
- net_flush(net))
- goto restore_user_err;
-
- /* Reading packet back */
- if ((pkt_len=my_net_read(net)) == packet_error)
- goto restore_user_err;
-
- /* We have to get very specific packet size */
- if (pkt_len != SCRAMBLE41_LENGTH)
- goto restore_user;
-
- /* Final attempt to check the user based on reply */
- if (check_user(thd,COM_CHANGE_USER, tmp_user, (char*) net->read_pos,
- tmp_db, 0, 0, 1, prepared_scramble, using_password,
- &cur_priv_version, &cached_user))
- goto restore_user;
+ thd->user= save_user;
+ send_error(thd, ER_OUT_OF_RESOURCES);
+ break;
}
- else if (res)
- goto restore_user;
-
- /* Finally we've authenticated new user */
- if (max_connections && save_uc)
- decrease_user_connections(save_uc);
- x_free((gptr) save_db);
- x_free((gptr) save_user);
- thd->password=using_password;
- break;
- /* Bad luck we shall restore old user */
-restore_user_err:
- send_error(thd, ER_UNKNOWN_COM_ERROR);
+ int res= check_user(thd, COM_CHANGE_USER, passwd, passwd_len, db, false);
-restore_user:
- x_free(thd->user);
- thd->master_access=save_master_access;
- thd->db_access=save_db_access;
- thd->db=save_db;
- thd->db_length=save_db_length;
- thd->user=save_user;
- thd->priv_user=save_priv_user;
+ if (res)
+ {
+ /* authentification failure, we shall restore old user */
+ if (res > 0)
+ send_error(thd, ER_UNKNOWN_COM_ERROR);
+ x_free(thd->user);
+ thd->user= save_user;
+ thd->priv_user= save_priv_user;
+ thd->master_access= save_master_access;
+ thd->db_access= save_db_access;
+ thd->db= save_db;
+ thd->db_length= save_db_length;
+ }
+ else
+ {
+ /* we've authenticated new user */
+ if (max_connections && save_uc)
+ decrease_user_connections(save_uc);
+ x_free((gptr) save_db);
+ x_free((gptr) save_user);
+ }
break;
}
#endif /* EMBEDDED_LIBRARY */
@@ -1395,11 +1355,13 @@ restore_user:
my_casedn_str(files_charset_info, table_list.real_name);
remove_escape(table_list.real_name); // This can't have wildcards
- if (check_access(thd,SELECT_ACL,table_list.db,&thd->col_access))
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ if (check_access(thd,SELECT_ACL,table_list.db,&thd->col_access,0,0))
break;
table_list.grant.privilege=thd->col_access;
if (grant_option && check_grant(thd,SELECT_ACL,&table_list,2))
break;
+#endif /*DONT_ALLOW_SHOW_COMMANDS*/
mysqld_list_fields(thd,&table_list,fields);
free_items(thd->free_list);
break;
@@ -1422,7 +1384,7 @@ restore_user:
net_printf(thd,ER_WRONG_DB_NAME, db ? db : "NULL");
break;
}
- if (check_access(thd,CREATE_ACL,db,0,1))
+ if (check_access(thd,CREATE_ACL,db,0,1,0))
break;
mysql_log.write(thd,command,packet);
mysql_create_db(thd,db,0,0);
@@ -1438,7 +1400,7 @@ restore_user:
net_printf(thd,ER_WRONG_DB_NAME, db ? db : "NULL");
break;
}
- if (check_access(thd,DROP_ACL,db,0,1))
+ if (check_access(thd,DROP_ACL,db,0,1,0))
break;
if (thd->locked_tables || thd->active_transaction())
{
@@ -1541,11 +1503,19 @@ restore_user:
break;
case COM_PROCESS_INFO:
statistic_increment(com_stat[SQLCOM_SHOW_PROCESSLIST],&LOCK_status);
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (!thd->priv_user[0] && check_global_access(thd,PROCESS_ACL))
break;
+#endif
mysql_log.write(thd,command,NullS);
- mysqld_list_processes(thd,thd->master_access & PROCESS_ACL ? NullS :
- thd->priv_user,0);
+ mysqld_list_processes(thd,
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ thd->master_access & PROCESS_ACL ?
+ NullS : thd->priv_user
+#else
+ NullS
+#endif
+ ,0);
break;
case COM_PROCESS_KILL:
{
@@ -1685,7 +1655,7 @@ mysql_execute_command(THD *thd)
*/
thd->old_total_warn_count= thd->total_warn_count;
-#ifndef EMBEDDED_LIBRARY
+#ifdef HAVE_REPLICATION
if (thd->slave_thread)
{
/*
@@ -1711,7 +1681,7 @@ mysql_execute_command(THD *thd)
}
#endif
}
-#endif /* EMBEDDED_LIBRARY */
+#endif /* !HAVE_REPLICATION */
/*
TODO: make derived tables processing 'inside' SELECT processing.
TODO: solve problem with depended derived tables in subselects
@@ -1746,7 +1716,11 @@ mysql_execute_command(THD *thd)
Except for the replication thread and the 'super' users.
*/
if (opt_readonly &&
- !(thd->slave_thread || (thd->master_access & SUPER_ACL)) &&
+ !(thd->slave_thread
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ || (thd->master_access & SUPER_ACL)
+#endif
+ ) &&
(uc_update_queries[lex->sql_command] > 0))
{
send_error(thd, ER_CANT_UPDATE_WITH_READLOCK);
@@ -1758,29 +1732,34 @@ mysql_execute_command(THD *thd)
case SQLCOM_SELECT:
{
select_result *result=lex->result;
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (tables)
{
res=check_table_access(thd,
lex->exchange ? SELECT_ACL | FILE_ACL :
SELECT_ACL,
- tables);
+ tables,0);
}
else
res=check_access(thd, lex->exchange ? SELECT_ACL | FILE_ACL : SELECT_ACL,
- any_db);
+ any_db,0,0,0);
if (res)
{
res=0;
break; // Error message is given
}
-
+#endif
+ /*
+ In case of single SELECT unit->global_parameters points on first SELECT
+ TODO: move counters to SELECT_LEX
+ */
unit->offset_limit_cnt= (ha_rows) unit->global_parameters->offset_limit;
unit->select_limit_cnt= (ha_rows) (unit->global_parameters->select_limit+
unit->global_parameters->offset_limit);
if (unit->select_limit_cnt <
(ha_rows) unit->global_parameters->select_limit)
unit->select_limit_cnt= HA_POS_ERROR; // no limit
- if (unit->select_limit_cnt == HA_POS_ERROR)
+ if (unit->select_limit_cnt == HA_POS_ERROR && !select_lex->next_select())
select_lex->options&= ~OPTION_FOUND_ROWS;
if (!(res=open_and_lock_tables(thd,tables)))
@@ -1821,8 +1800,9 @@ mysql_execute_command(THD *thd)
}
break;
}
+
case SQLCOM_DO:
- if (tables && ((res= check_table_access(thd, SELECT_ACL, tables)) ||
+ if (tables && ((res= check_table_access(thd, SELECT_ACL, tables,0)) ||
(res= open_and_lock_tables(thd,tables))))
break;
@@ -1858,7 +1838,6 @@ mysql_execute_command(THD *thd)
break;
}
#endif
-
case SQLCOM_SHOW_WARNS:
{
res= mysqld_show_warnings(thd, (ulong)
@@ -1878,6 +1857,7 @@ mysql_execute_command(THD *thd)
{
if (check_global_access(thd, REPL_SLAVE_ACL))
goto error;
+ /* This query don't work now. See comment in repl_failsafe.cc */
#ifndef WORKING_NEW_MASTER
net_printf(thd, ER_NOT_SUPPORTED_YET, "SHOW NEW MASTER");
res= 1;
@@ -1887,7 +1867,7 @@ mysql_execute_command(THD *thd)
break;
}
-#ifndef EMBEDDED_LIBRARY
+#ifdef HAVE_REPLICATION
case SQLCOM_SHOW_SLAVE_HOSTS:
{
if (check_global_access(thd, REPL_SLAVE_ACL))
@@ -1907,7 +1887,7 @@ mysql_execute_command(THD *thd)
case SQLCOM_BACKUP_TABLE:
{
if (check_db_used(thd,tables) ||
- check_table_access(thd,SELECT_ACL, tables) ||
+ check_table_access(thd,SELECT_ACL, tables,0) ||
check_global_access(thd, FILE_ACL))
goto error; /* purecov: inspected */
res = mysql_backup_table(thd, tables);
@@ -1917,7 +1897,7 @@ mysql_execute_command(THD *thd)
case SQLCOM_RESTORE_TABLE:
{
if (check_db_used(thd,tables) ||
- check_table_access(thd, INSERT_ACL, tables) ||
+ check_table_access(thd, INSERT_ACL, tables,0) ||
check_global_access(thd, FILE_ACL))
goto error; /* purecov: inspected */
res = mysql_restore_table(thd, tables);
@@ -1934,14 +1914,12 @@ mysql_execute_command(THD *thd)
case SQLCOM_PRELOAD_KEYS:
{
if (check_db_used(thd, tables) ||
- check_access(thd, INDEX_ACL, tables->db, &tables->grant.privilege))
+ check_access(thd, INDEX_ACL, tables->db, &tables->grant.privilege,0,0))
goto error;
res = mysql_preload_keys(thd, tables);
break;
}
-
-
-#ifndef EMBEDDED_LIBRARY
+#ifdef HAVE_REPLICATION
case SQLCOM_CHANGE_MASTER:
{
if (check_global_access(thd, SUPER_ACL))
@@ -1978,8 +1956,7 @@ mysql_execute_command(THD *thd)
else
res = load_master_data(thd);
break;
-#endif /* EMBEDDED_LIBRARY */
-
+#endif /* HAVE_REPLICATION */
#ifdef HAVE_INNOBASE_DB
case SQLCOM_SHOW_INNODB_STATUS:
{
@@ -1989,13 +1966,13 @@ mysql_execute_command(THD *thd)
break;
}
#endif
-
-#ifndef EMBEDDED_LIBRARY
+#ifdef HAVE_REPLICATION
case SQLCOM_LOAD_MASTER_TABLE:
{
if (!tables->db)
tables->db=thd->db;
- if (check_access(thd,CREATE_ACL,tables->db,&tables->grant.privilege))
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ if (check_access(thd,CREATE_ACL,tables->db,&tables->grant.privilege,0,0))
goto error; /* purecov: inspected */
if (grant_option)
{
@@ -2007,6 +1984,7 @@ mysql_execute_command(THD *thd)
if (error)
goto error;
}
+#endif
if (strlen(tables->real_name) > NAME_LEN)
{
net_printf(thd,ER_WRONG_TABLE_NAME,tables->real_name);
@@ -2022,15 +2000,18 @@ mysql_execute_command(THD *thd)
UNLOCK_ACTIVE_MI;
break;
}
-#endif /* EMBEDDED_LIBRARY */
+#endif /* HAVE_REPLICATION */
case SQLCOM_CREATE_TABLE:
{
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
ulong want_priv= ((lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) ?
CREATE_TMP_ACL : CREATE_ACL);
+#endif
if (!tables->db)
tables->db=thd->db;
- if (check_access(thd,want_priv,tables->db,&tables->grant.privilege) ||
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ if (check_access(thd,want_priv,tables->db,&tables->grant.privilege,0,0) ||
check_merge_table_access(thd, tables->db,
(TABLE_LIST *)
lex->create_info.merge_list.first))
@@ -2045,6 +2026,7 @@ mysql_execute_command(THD *thd)
if (error)
goto error;
}
+#endif
if (strlen(tables->real_name) > NAME_LEN)
{
net_printf(thd, ER_WRONG_TABLE_NAME, tables->alias);
@@ -2074,11 +2056,13 @@ mysql_execute_command(THD *thd)
net_printf(thd,ER_UPDATE_TABLE_USED,tables->real_name);
DBUG_VOID_RETURN;
}
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (tables->next)
{
- if (check_table_access(thd, SELECT_ACL, tables->next))
+ if (check_table_access(thd, SELECT_ACL, tables->next,0))
goto error; // Error message is given
}
+#endif
select_lex->options|= SELECT_NO_UNLOCK;
unit->offset_limit_cnt= select_lex->offset_limit;
unit->select_limit_cnt= select_lex->select_limit+
@@ -2108,14 +2092,6 @@ mysql_execute_command(THD *thd)
(Table_ident *)lex->name);
else
{
- List_iterator<create_field> fields(lex->create_list);
- create_field *field;
- while ((field= fields++))
- {
- if (!field->charset)
- field->charset= lex->create_info.table_charset;
- field->create_length_to_internal_length();
- }
res= mysql_create_table(thd,tables->db ? tables->db : thd->db,
tables->real_name, &lex->create_info,
lex->create_list,
@@ -2129,17 +2105,19 @@ mysql_execute_command(THD *thd)
case SQLCOM_CREATE_INDEX:
if (!tables->db)
tables->db=thd->db;
- if (check_access(thd,INDEX_ACL,tables->db,&tables->grant.privilege))
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ if (check_access(thd,INDEX_ACL,tables->db,&tables->grant.privilege,0,0))
goto error; /* purecov: inspected */
if (grant_option && check_grant(thd,INDEX_ACL,tables))
goto error;
+#endif
if (end_active_trans(thd))
res= -1;
else
res = mysql_create_index(thd, tables, lex->key_list);
break;
-#ifndef EMBEDDED_LIBRARY
+#ifdef HAVE_REPLICATION
case SQLCOM_SLAVE_START:
{
LOCK_ACTIVE_MI;
@@ -2172,7 +2150,7 @@ mysql_execute_command(THD *thd)
UNLOCK_ACTIVE_MI;
break;
}
-#endif
+#endif /* HAVE_REPLICATION */
case SQLCOM_ALTER_TABLE:
#if defined(DONT_ALLOW_SHOW_COMMANDS)
@@ -2191,14 +2169,15 @@ mysql_execute_command(THD *thd)
tables->db=thd->db;
if (!select_lex->db)
select_lex->db=tables->db;
- if (check_access(thd,ALTER_ACL,tables->db,&tables->grant.privilege) ||
- check_access(thd,INSERT_ACL | CREATE_ACL,select_lex->db,&priv) ||
+ if (check_access(thd,ALTER_ACL,tables->db,&tables->grant.privilege,0,0) ||
+ check_access(thd,INSERT_ACL | CREATE_ACL,select_lex->db,&priv,0,0)||
check_merge_table_access(thd, tables->db,
(TABLE_LIST *)
lex->create_info.merge_list.first))
goto error; /* purecov: inspected */
if (!tables->db)
tables->db=thd->db;
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (grant_option)
{
if (check_grant(thd,ALTER_ACL,tables))
@@ -2214,6 +2193,7 @@ mysql_execute_command(THD *thd)
goto error;
}
}
+#endif
/* Don't yet allow changing of symlinks with ALTER TABLE */
lex->create_info.data_file_name=lex->create_info.index_file_name=0;
/* ALTER TABLE ends previous transaction */
@@ -2232,18 +2212,19 @@ mysql_execute_command(THD *thd)
}
break;
}
-#endif
+#endif /*DONT_ALLOW_SHOW_COMMANDS*/
case SQLCOM_RENAME_TABLE:
{
TABLE_LIST *table;
if (check_db_used(thd,tables))
goto error;
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
for (table=tables ; table ; table=table->next->next)
{
if (check_access(thd, ALTER_ACL | DROP_ACL, table->db,
- &table->grant.privilege) ||
+ &table->grant.privilege,0,0) ||
check_access(thd, INSERT_ACL | CREATE_ACL, table->next->db,
- &table->next->grant.privilege))
+ &table->next->grant.privilege,0,0))
goto error;
if (grant_option)
{
@@ -2258,6 +2239,7 @@ mysql_execute_command(THD *thd)
goto error;
}
}
+#endif
query_cache_invalidate3(thd, tables, 0);
if (end_active_trans(thd))
res= -1;
@@ -2287,16 +2269,24 @@ mysql_execute_command(THD *thd)
{
if (check_db_used(thd, tables) ||
check_access(thd, SELECT_ACL | EXTRA_ACL, tables->db,
- &tables->grant.privilege))
+ &tables->grant.privilege,0,0))
goto error;
res = mysqld_show_create(thd, tables);
break;
}
#endif
+ case SQLCOM_CHECKSUM:
+ {
+ if (check_db_used(thd,tables) ||
+ check_table_access(thd, SELECT_ACL | EXTRA_ACL , tables,0))
+ goto error; /* purecov: inspected */
+ res = mysql_checksum_table(thd, tables, &lex->check_opt);
+ break;
+ }
case SQLCOM_REPAIR:
{
if (check_db_used(thd,tables) ||
- check_table_access(thd,SELECT_ACL | INSERT_ACL, tables))
+ check_table_access(thd,SELECT_ACL | INSERT_ACL, tables,0))
goto error; /* purecov: inspected */
res = mysql_repair_table(thd, tables, &lex->check_opt);
/* ! we write after unlocking the table */
@@ -2314,7 +2304,7 @@ mysql_execute_command(THD *thd)
case SQLCOM_CHECK:
{
if (check_db_used(thd,tables) ||
- check_table_access(thd, SELECT_ACL | EXTRA_ACL , tables))
+ check_table_access(thd, SELECT_ACL | EXTRA_ACL , tables,0))
goto error; /* purecov: inspected */
res = mysql_check_table(thd, tables, &lex->check_opt);
break;
@@ -2322,7 +2312,7 @@ mysql_execute_command(THD *thd)
case SQLCOM_ANALYZE:
{
if (check_db_used(thd,tables) ||
- check_table_access(thd,SELECT_ACL | INSERT_ACL, tables))
+ check_table_access(thd,SELECT_ACL | INSERT_ACL, tables,0))
goto error; /* purecov: inspected */
res = mysql_analyze_table(thd, tables, &lex->check_opt);
/* ! we write after unlocking the table */
@@ -2342,7 +2332,7 @@ mysql_execute_command(THD *thd)
{
HA_CREATE_INFO create_info;
if (check_db_used(thd,tables) ||
- check_table_access(thd,SELECT_ACL | INSERT_ACL, tables))
+ check_table_access(thd,SELECT_ACL | INSERT_ACL, tables,0))
goto error; /* purecov: inspected */
if (specialflag & (SPECIAL_SAFE_MODE | SPECIAL_NO_NEW_FUNC))
{
@@ -2382,7 +2372,6 @@ mysql_execute_command(THD *thd)
if (single_table_command_access(thd, UPDATE_ACL, tables, &res))
goto error;
-
if (select_lex->item_list.elements != lex->value_list.elements)
{
send_error(thd,ER_WRONG_VALUE_COUNT);
@@ -2400,10 +2389,12 @@ mysql_execute_command(THD *thd)
res= -1;
break;
case SQLCOM_UPDATE_MULTI:
- if (check_access(thd,UPDATE_ACL,tables->db,&tables->grant.privilege))
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ if (check_access(thd,UPDATE_ACL,tables->db,&tables->grant.privilege,0,0))
goto error;
if (grant_option && check_grant(thd,UPDATE_ACL,tables))
goto error;
+#endif
if (select_lex->item_list.elements != lex->value_list.elements)
{
send_error(thd,ER_WRONG_VALUE_COUNT);
@@ -2433,13 +2424,16 @@ mysql_execute_command(THD *thd)
case SQLCOM_REPLACE:
case SQLCOM_INSERT:
{
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
my_bool update=(lex->value_list.elements ? UPDATE_ACL : 0);
ulong privilege= (lex->duplicates == DUP_REPLACE ?
INSERT_ACL | DELETE_ACL : INSERT_ACL | update);
if (single_table_command_access(thd, privilege, tables, &res))
goto error;
-
+#else
+ my_bool update=(lex->value_list.elements ? 1 : 0);
+#endif
if (select_lex->item_list.elements != lex->value_list.elements)
{
send_error(thd,ER_WRONG_VALUE_COUNT);
@@ -2460,19 +2454,22 @@ mysql_execute_command(THD *thd)
Check that we have modify privileges for the first table and
select privileges for the rest
*/
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
{
ulong privilege= (lex->duplicates == DUP_REPLACE ?
INSERT_ACL | DELETE_ACL : INSERT_ACL);
TABLE_LIST *save_next=tables->next;
tables->next=0;
if (check_access(thd, privilege,
- tables->db,&tables->grant.privilege) ||
+ tables->db,&tables->grant.privilege,0,0) ||
(grant_option && check_grant(thd, privilege, tables)))
goto error;
+
tables->next=save_next;
- if ((res=check_table_access(thd, SELECT_ACL, save_next)))
+ if ((res=check_table_access(thd, SELECT_ACL, save_next,0)))
goto error;
}
+#endif
/* Don't unlock tables until command is written to binary log */
select_lex->options|= SELECT_NO_UNLOCK;
@@ -2506,10 +2503,12 @@ mysql_execute_command(THD *thd)
break;
}
case SQLCOM_TRUNCATE:
- if (check_access(thd,DELETE_ACL,tables->db,&tables->grant.privilege))
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ if (check_access(thd,DELETE_ACL,tables->db,&tables->grant.privilege,0,0))
goto error; /* purecov: inspected */
if (grant_option && check_grant(thd,DELETE_ACL,tables))
goto error;
+#endif
/*
Don't allow this within a transaction because we want to use
re-generate table
@@ -2523,11 +2522,12 @@ mysql_execute_command(THD *thd)
break;
case SQLCOM_DELETE:
{
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (single_table_command_access(thd, DELETE_ACL, tables, &res))
goto error;
-
// Set privilege for the WHERE clause
tables->grant.want_privilege=(SELECT_ACL & ~tables->grant.privilege);
+#endif
res = mysql_delete(thd,tables, select_lex->where,
(ORDER*) select_lex->order_list.first,
select_lex->select_limit, select_lex->options);
@@ -2544,8 +2544,8 @@ mysql_execute_command(THD *thd)
/* sql_yacc guarantees that tables and aux_tables are not zero */
if (check_db_used(thd, tables) || check_db_used(thd,aux_tables) ||
- check_table_access(thd,SELECT_ACL, tables) ||
- check_table_access(thd,DELETE_ACL, aux_tables))
+ check_table_access(thd,SELECT_ACL, tables,0) ||
+ check_table_access(thd,DELETE_ACL, aux_tables,0))
goto error;
if ((thd->options & OPTION_SAFE_UPDATES) && !select_lex->where)
{
@@ -2622,7 +2622,7 @@ mysql_execute_command(THD *thd)
{
if (!lex->drop_temporary)
{
- if (check_table_access(thd,DROP_ACL,tables))
+ if (check_table_access(thd,DROP_ACL,tables,0))
goto error; /* purecov: inspected */
if (end_active_trans(thd))
{
@@ -2649,10 +2649,12 @@ mysql_execute_command(THD *thd)
case SQLCOM_DROP_INDEX:
if (!tables->db)
tables->db=thd->db;
- if (check_access(thd,INDEX_ACL,tables->db,&tables->grant.privilege))
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ if (check_access(thd,INDEX_ACL,tables->db,&tables->grant.privilege,0,0))
goto error; /* purecov: inspected */
if (grant_option && check_grant(thd,INDEX_ACL,tables))
goto error;
+#endif
if (end_active_trans(thd))
res= -1;
else
@@ -2670,10 +2672,18 @@ mysql_execute_command(THD *thd)
break;
#endif
case SQLCOM_SHOW_PROCESSLIST:
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (!thd->priv_user[0] && check_global_access(thd,PROCESS_ACL))
break;
- mysqld_list_processes(thd,thd->master_access & PROCESS_ACL ? NullS :
- thd->priv_user,lex->verbose);
+#endif
+ mysqld_list_processes(thd,
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ thd->master_access & PROCESS_ACL ? NullS :
+ thd->priv_user
+#else
+ NullS
+#endif
+ ,lex->verbose);
break;
case SQLCOM_SHOW_TABLE_TYPES:
res= mysqld_show_table_types(thd);
@@ -2686,11 +2696,12 @@ mysql_execute_command(THD *thd)
break;
case SQLCOM_SHOW_STATUS:
res= mysqld_show(thd,(lex->wild ? lex->wild->ptr() : NullS),status_vars,
- OPT_GLOBAL);
+ OPT_GLOBAL, &LOCK_status);
break;
case SQLCOM_SHOW_VARIABLES:
res= mysqld_show(thd, (lex->wild ? lex->wild->ptr() : NullS),
- init_vars, lex->option_type);
+ init_vars, lex->option_type,
+ &LOCK_global_system_variables);
break;
case SQLCOM_SHOW_LOGS:
#ifdef DONT_ALLOW_SHOW_COMMANDS
@@ -2698,8 +2709,10 @@ mysql_execute_command(THD *thd)
DBUG_VOID_RETURN;
#else
{
- if (grant_option && check_access(thd, FILE_ACL, any_db))
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ if (grant_option && check_access(thd, FILE_ACL, any_db,0,0,0))
goto error;
+#endif
res= mysqld_show_logs(thd);
break;
}
@@ -2723,7 +2736,8 @@ mysql_execute_command(THD *thd)
net_printf(thd,ER_WRONG_DB_NAME, db);
goto error;
}
- if (check_access(thd,SELECT_ACL,db,&thd->col_access))
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ if (check_access(thd,SELECT_ACL,db,&thd->col_access,0,0))
goto error; /* purecov: inspected */
if (!thd->col_access && check_grant_db(thd,db))
{
@@ -2733,6 +2747,7 @@ mysql_execute_command(THD *thd)
db);
goto error;
}
+#endif
/* grant is checked in mysqld_show_tables */
if (select_lex->options & SELECT_DESCRIBE)
res= mysqld_extend_show_tables(thd,db,
@@ -2766,11 +2781,13 @@ mysql_execute_command(THD *thd)
}
remove_escape(db); // Fix escaped '_'
remove_escape(tables->real_name);
- if (check_access(thd,SELECT_ACL | EXTRA_ACL,db,&thd->col_access))
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ if (check_access(thd,SELECT_ACL | EXTRA_ACL,db,&thd->col_access,0,0))
goto error; /* purecov: inspected */
tables->grant.privilege=thd->col_access;
if (grant_option && check_grant(thd,SELECT_ACL,tables,2))
goto error;
+#endif
res= mysqld_show_fields(thd,tables,
(lex->wild ? lex->wild->ptr() : NullS),
lex->verbose);
@@ -2793,11 +2810,13 @@ mysql_execute_command(THD *thd)
remove_escape(tables->real_name);
if (!tables->db)
tables->db=thd->db;
- if (check_access(thd,SELECT_ACL,db,&thd->col_access))
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ if (check_access(thd,SELECT_ACL,db,&thd->col_access,0,0))
goto error; /* purecov: inspected */
tables->grant.privilege=thd->col_access;
if (grant_option && check_grant(thd,SELECT_ACL,tables,2))
goto error;
+#endif
res= mysqld_show_keys(thd,tables);
break;
}
@@ -2805,15 +2824,16 @@ mysql_execute_command(THD *thd)
case SQLCOM_CHANGE_DB:
mysql_change_db(thd,select_lex->db);
break;
-#ifndef EMBEDDED_LIBRARY
+
case SQLCOM_LOAD:
{
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
uint privilege= (lex->duplicates == DUP_REPLACE ?
INSERT_ACL | DELETE_ACL : INSERT_ACL);
if (!lex->local_file)
{
- if (check_access(thd,privilege | FILE_ACL,tables->db))
+ if (check_access(thd,privilege | FILE_ACL,tables->db,0,0,0))
goto error;
}
else
@@ -2824,17 +2844,18 @@ mysql_execute_command(THD *thd)
send_error(thd,ER_NOT_ALLOWED_COMMAND);
goto error;
}
- if (check_access(thd,privilege,tables->db,&tables->grant.privilege) ||
+ if (check_access(thd,privilege,tables->db,&tables->grant.privilege,0,0) ||
grant_option && check_grant(thd,privilege,tables))
goto error;
}
+#endif /*NO_EMBEDDED_ACCESS_CHECKS*/
res=mysql_load(thd, lex->exchange, tables, lex->field_list,
lex->duplicates, (bool) lex->local_file, lex->lock_option);
break;
}
-#endif /* EMBEDDED_LIBRARY */
+
case SQLCOM_SET_OPTION:
- if (tables && ((res= check_table_access(thd, SELECT_ACL, tables)) ||
+ if (tables && ((res= check_table_access(thd, SELECT_ACL, tables,0)) ||
(res= open_and_lock_tables(thd,tables))))
break;
fix_tables_pointers(lex->all_selects_list);
@@ -2859,7 +2880,7 @@ mysql_execute_command(THD *thd)
unlock_locked_tables(thd);
if (check_db_used(thd,tables) || end_active_trans(thd))
goto error;
- if (check_table_access(thd, LOCK_TABLES_ACL | SELECT_ACL, tables))
+ if (check_table_access(thd, LOCK_TABLES_ACL | SELECT_ACL, tables,0))
goto error;
thd->in_lock_tables=1;
thd->options|= OPTION_TABLE_LOCK;
@@ -2896,7 +2917,7 @@ mysql_execute_command(THD *thd)
break;
}
#endif
- if (check_access(thd,CREATE_ACL,lex->name,0,1))
+ if (check_access(thd,CREATE_ACL,lex->name,0,1,0))
break;
res=mysql_create_db(thd,lex->name,&lex->create_info,0);
break;
@@ -2924,7 +2945,7 @@ mysql_execute_command(THD *thd)
break;
}
#endif
- if (check_access(thd,DROP_ACL,lex->name,0,1))
+ if (check_access(thd,DROP_ACL,lex->name,0,1,0))
break;
if (thd->locked_tables || thd->active_transaction())
{
@@ -2941,7 +2962,7 @@ mysql_execute_command(THD *thd)
net_printf(thd,ER_WRONG_DB_NAME, lex->name);
break;
}
- if (check_access(thd,ALTER_ACL,lex->name,0,1))
+ if (check_access(thd,ALTER_ACL,lex->name,0,1,0))
break;
if (thd->locked_tables || thd->active_transaction())
{
@@ -2958,7 +2979,7 @@ mysql_execute_command(THD *thd)
net_printf(thd,ER_WRONG_DB_NAME, lex->name);
break;
}
- if (check_access(thd,DROP_ACL,lex->name,0,1))
+ if (check_access(thd,DROP_ACL,lex->name,0,1,0))
break;
if (thd->locked_tables || thd->active_transaction())
{
@@ -2969,7 +2990,7 @@ mysql_execute_command(THD *thd)
break;
}
case SQLCOM_CREATE_FUNCTION:
- if (check_access(thd,INSERT_ACL,"mysql",0,1))
+ if (check_access(thd,INSERT_ACL,"mysql",0,1,0))
break;
#ifdef HAVE_DLOPEN
if (!(res = mysql_create_function(thd,&lex->udf)))
@@ -2979,7 +3000,7 @@ mysql_execute_command(THD *thd)
#endif
break;
case SQLCOM_DROP_FUNCTION:
- if (check_access(thd,DELETE_ACL,"mysql",0,1))
+ if (check_access(thd,DELETE_ACL,"mysql",0,1,0))
break;
#ifdef HAVE_DLOPEN
if (!(res = mysql_drop_function(thd,&lex->udf.name)))
@@ -2988,9 +3009,10 @@ mysql_execute_command(THD *thd)
res= -1;
#endif
break;
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
case SQLCOM_DROP_USER:
{
- if (check_access(thd, GRANT_ACL,"mysql",0,1))
+ if (check_access(thd, GRANT_ACL,"mysql",0,1,0))
break;
if (!(res= mysql_drop_user(thd, lex->users_list)))
{
@@ -3006,7 +3028,7 @@ mysql_execute_command(THD *thd)
}
case SQLCOM_REVOKE_ALL:
{
- if (check_access(thd, GRANT_ACL ,"mysql",0,1))
+ if (check_access(thd, GRANT_ACL ,"mysql",0,1,0))
break;
if (!(res = mysql_revoke_all(thd, lex->users_list)))
{
@@ -3026,7 +3048,7 @@ mysql_execute_command(THD *thd)
if (check_access(thd, lex->grant | lex->grant_tot_col | GRANT_ACL,
tables && tables->db ? tables->db : select_lex->db,
tables ? &tables->grant.privilege : 0,
- tables ? 0 : 1))
+ tables ? 0 : 1,0))
goto error;
/*
@@ -3046,7 +3068,7 @@ mysql_execute_command(THD *thd)
my_strcasecmp(&my_charset_latin1,
user->host.str, thd->host_or_ip)))
{
- if (check_access(thd, UPDATE_ACL, "mysql",0,1))
+ if (check_access(thd, UPDATE_ACL, "mysql",0,1,0))
goto error;
break; // We are allowed to do changes
}
@@ -3100,6 +3122,7 @@ mysql_execute_command(THD *thd)
}
break;
}
+#endif /*!NO_EMBEDDED_ACCESS_CHECKS*/
case SQLCOM_RESET:
/*
RESET commands are never written to the binary log, so we have to
@@ -3139,18 +3162,20 @@ mysql_execute_command(THD *thd)
case SQLCOM_KILL:
kill_one_thread(thd,lex->thread_id);
break;
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
case SQLCOM_SHOW_GRANTS:
res=0;
if ((thd->priv_user &&
!strcmp(thd->priv_user,lex->grant_user->user.str)) ||
- !check_access(thd, SELECT_ACL, "mysql",0,1))
+ !check_access(thd, SELECT_ACL, "mysql",0,1,0))
{
res = mysql_show_grants(thd,lex->grant_user);
}
break;
+#endif
case SQLCOM_HA_OPEN:
if (check_db_used(thd,tables) ||
- check_table_access(thd,SELECT_ACL, tables))
+ check_table_access(thd,SELECT_ACL, tables,0))
goto error;
res = mysql_ha_open(thd, tables);
break;
@@ -3212,7 +3237,16 @@ mysql_execute_command(THD *thd)
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
if (!ha_rollback(thd))
{
- if (thd->options & OPTION_STATUS_NO_TRANS_UPDATE)
+ /*
+ If a non-transactional table was updated, warn; don't warn if this is a
+ slave thread (because when a slave thread executes a ROLLBACK, it has
+ been read from the binary log, so it's 100% sure and normal to produce
+ error ER_WARNING_NOT_COMPLETE_ROLLBACK. If we sent the warning to the
+ slave SQL thread, it would not stop the thread but just be printed in
+ the error log; but we don't want users to wonder why they have this
+ message in the error log, so we don't send it.
+ */
+ if ((thd->options & OPTION_STATUS_NO_TRANS_UPDATE) && !thd->slave_thread)
send_warning(thd,ER_WARNING_NOT_COMPLETE_ROLLBACK,0);
else
send_ok(thd);
@@ -3224,7 +3258,7 @@ mysql_execute_command(THD *thd)
case SQLCOM_ROLLBACK_TO_SAVEPOINT:
if (!ha_rollback_to_savepoint(thd, lex->savepoint_name))
{
- if (thd->options & OPTION_STATUS_NO_TRANS_UPDATE)
+ if ((thd->options & OPTION_STATUS_NO_TRANS_UPDATE) && !thd->slave_thread)
send_warning(thd, ER_WARNING_NOT_COMPLETE_ROLLBACK, 0);
else
send_ok(thd);
@@ -3251,11 +3285,12 @@ error:
}
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
/*
Check grants for commands which work only with one table and all other
tables belong to subselects.
- SYNOPSYS
+ SYNOPSIS
single_table_command_access()
thd - Thread handler
privilege - asked privelage
@@ -3271,7 +3306,7 @@ static bool single_table_command_access(THD *thd, ulong privilege,
TABLE_LIST *tables, int *res)
{
- if (check_access(thd, privilege, tables->db, &tables->grant.privilege))
+ if (check_access(thd, privilege, tables->db, &tables->grant.privilege,0,0))
return 1;
// Show only 1 table for check_grant
@@ -3284,7 +3319,7 @@ static bool single_table_command_access(THD *thd, ulong privilege,
if (subselects_tables)
{
tables->next= subselects_tables;
- if ((*res= check_table_access(thd, SELECT_ACL, subselects_tables)))
+ if ((*res= check_table_access(thd, SELECT_ACL, subselects_tables,0)))
return 1;
}
return 0;
@@ -3455,24 +3490,6 @@ check_table_access(THD *thd, ulong want_access,TABLE_LIST *tables,
return FALSE;
}
-
-static bool check_db_used(THD *thd,TABLE_LIST *tables)
-{
- for (; tables ; tables=tables->next)
- {
- if (!tables->db)
- {
- if (!(tables->db=thd->db))
- {
- send_error(thd,ER_NO_DB_ERROR); /* purecov: tested */
- return TRUE; /* purecov: tested */
- }
- }
- }
- return FALSE;
-}
-
-
static bool check_merge_table_access(THD *thd, char *db,
TABLE_LIST *table_list)
{
@@ -3487,11 +3504,28 @@ static bool check_merge_table_access(THD *thd, char *db,
tmp->db=db;
}
error=check_table_access(thd, SELECT_ACL | UPDATE_ACL | DELETE_ACL,
- table_list);
+ table_list,0);
}
return error;
}
+#endif /*!NO_EMBEDDED_ACCESS_CHECKS*/
+
+static bool check_db_used(THD *thd,TABLE_LIST *tables)
+{
+ for (; tables ; tables=tables->next)
+ {
+ if (!tables->db)
+ {
+ if (!(tables->db=thd->db))
+ {
+ send_error(thd,ER_NO_DB_ERROR); /* purecov: tested */
+ return TRUE; /* purecov: tested */
+ }
+ }
+ }
+ return FALSE;
+}
/****************************************************************************
Check stack size; Send error if there isn't enough stack to continue
@@ -3717,12 +3751,14 @@ mysql_parse(THD *thd, char *inBuf, uint length)
LEX *lex=lex_start(thd, (uchar*) inBuf, length);
if (!yyparse((void *)thd) && ! thd->is_fatal_error)
{
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (mqh_used && thd->user_connect &&
check_mqh(thd, lex->sql_command))
{
thd->net.error = 0;
}
else
+#endif
{
if (thd->net.report_error)
send_error(thd, 0, NullS);
@@ -3759,7 +3795,7 @@ mysql_parse(THD *thd, char *inBuf, uint length)
bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
char *length, char *decimals,
uint type_modifier,
- Item *default_value, Item *comment,
+ Item *default_value, LEX_STRING *comment,
char *change, TYPELIB *interval, CHARSET_INFO *cs,
uint uint_geom_type)
{
@@ -3833,8 +3869,8 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
else
{
/* In this case comment is always of type Item_string */
- new_field->comment.str= (char*) comment->str_value.ptr();
- new_field->comment.length=comment->str_value.length();
+ new_field->comment.str= (char*) comment->str;
+ new_field->comment.length=comment->length;
}
if (length && !(new_field->length= (uint) atoi(length)))
length=0; /* purecov: inspected */
@@ -4328,7 +4364,6 @@ void add_join_natural(TABLE_LIST *a,TABLE_LIST *b)
b->natural_join=a;
}
-
/*
Reload/resets privileges and the different caches.
@@ -4355,6 +4390,7 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
bool result=0;
select_errors=0; /* Write if more errors */
bool tmp_write_to_binlog= 1;
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (options & REFRESH_GRANT)
{
acl_reload(thd);
@@ -4362,6 +4398,7 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
if (mqh_used)
reset_mqh(thd,(LEX_USER *) NULL,true);
}
+#endif
if (options & REFRESH_LOG)
{
/*
@@ -4427,7 +4464,7 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
refresh_status();
if (options & REFRESH_THREADS)
flush_thread_cache();
-#ifndef EMBEDDED_LIBRARY
+#ifdef HAVE_REPLICATION
if (options & REFRESH_MASTER)
{
tmp_write_to_binlog= 0;
@@ -4442,7 +4479,7 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
result=load_des_key_file(des_key_file);
}
#endif
-#ifndef EMBEDDED_LIBRARY
+#ifdef HAVE_REPLICATION
if (options & REFRESH_SLAVE)
{
tmp_write_to_binlog= 0;
@@ -4452,14 +4489,15 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
UNLOCK_ACTIVE_MI;
}
#endif
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (options & REFRESH_USER_RESOURCES)
reset_mqh(thd,(LEX_USER *) NULL);
+#endif
if (write_to_binlog)
*write_to_binlog= tmp_write_to_binlog;
return result;
}
-
/*
kill on thread
@@ -4489,14 +4527,18 @@ void kill_one_thread(THD *thd, ulong id)
VOID(pthread_mutex_unlock(&LOCK_thread_count));
if (tmp)
{
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
if ((thd->master_access & SUPER_ACL) ||
!strcmp(thd->user,tmp->user))
+#endif
{
tmp->awake(1 /*prepare to die*/);
error=0;
}
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
else
error=ER_KILL_DENIED_ERROR;
+#endif
pthread_mutex_unlock(&tmp->LOCK_delete);
}
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 550e4bbe086..ff1a8f8f8e6 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -76,8 +76,15 @@ Long data handling:
#define STMT_QUERY_LOG_LENGTH 8192
-extern int yyparse(void *thd);
-static String null_string("NULL", 4, default_charset_info);
+#ifdef EMBEDDED_LIBRARY
+#define SETUP_PARAM_FUNCTION(fn_name) \
+static void fn_name(Item_param *param, uchar **pos, ulong data_len)
+#else
+#define SETUP_PARAM_FUNCTION(fn_name) \
+static void fn_name(Item_param *param, uchar **pos)
+#endif
+
+String my_null_string("NULL", 4, default_charset_info);
/*
Find prepared statement in thd
@@ -142,6 +149,7 @@ void free_prep_stmt(PREP_STMT *stmt, TREE_FREE mode, void *not_used)
Send prepared stmt info to client after prepare
*/
+#ifndef EMBEDDED_LIBRARY
static bool send_prep_stmt(PREP_STMT *stmt, uint columns)
{
NET *net=&stmt->thd->net;
@@ -150,14 +158,21 @@ static bool send_prep_stmt(PREP_STMT *stmt, uint columns)
int4store(buff+1, stmt->stmt_id);
int2store(buff+5, columns);
int2store(buff+7, stmt->param_count);
-#ifndef EMBEDDED_LIBRARY
/* This should be fixed to work with prepared statements
*/
return (my_net_write(net, buff, sizeof(buff)) || net_flush(net));
+}
#else
- return true;
-#endif
+static bool send_prep_stmt(PREP_STMT *stmt, uint columns __attribute__((unused)))
+{
+ THD *thd= stmt->thd;
+
+ thd->client_stmt_id= stmt->stmt_id;
+ thd->client_param_count= stmt->param_count;
+
+ return 0;
}
+#endif /*!EMBEDDED_LIBRAYR*/
/*
Send information about all item parameters
@@ -182,6 +197,7 @@ static bool send_item_params(PREP_STMT *stmt)
caller by positing the pointer to param data
*/
+#ifndef EMBEDDED_LIBRARY
static ulong get_param_length(uchar **packet)
{
reg1 uchar *pos= *packet;
@@ -203,6 +219,10 @@ static ulong get_param_length(uchar **packet)
(*packet)+=9; // Must be 254 when here
return (ulong) uint4korr(pos+1);
}
+#else
+#define get_param_length(A) data_len
+#endif /*!EMBEDDED_LIBRARY*/
+
/*
Setup param conversion routines
@@ -222,31 +242,31 @@ static ulong get_param_length(uchar **packet)
*/
-static void setup_param_tiny(Item_param *param, uchar **pos)
+SETUP_PARAM_FUNCTION(setup_param_tiny)
{
param->set_int((longlong)(**pos));
*pos+= 1;
}
-static void setup_param_short(Item_param *param, uchar **pos)
+SETUP_PARAM_FUNCTION(setup_param_short)
{
param->set_int((longlong)sint2korr(*pos));
*pos+= 2;
}
-static void setup_param_int32(Item_param *param, uchar **pos)
+SETUP_PARAM_FUNCTION(setup_param_int32)
{
param->set_int((longlong)sint4korr(*pos));
*pos+= 4;
}
-static void setup_param_int64(Item_param *param, uchar **pos)
+SETUP_PARAM_FUNCTION(setup_param_int64)
{
param->set_int((longlong)sint8korr(*pos));
*pos+= 8;
}
-static void setup_param_float(Item_param *param, uchar **pos)
+SETUP_PARAM_FUNCTION(setup_param_float)
{
float data;
float4get(data,*pos);
@@ -254,7 +274,7 @@ static void setup_param_float(Item_param *param, uchar **pos)
*pos+= 4;
}
-static void setup_param_double(Item_param *param, uchar **pos)
+SETUP_PARAM_FUNCTION(setup_param_double)
{
double data;
float8get(data,*pos);
@@ -262,7 +282,7 @@ static void setup_param_double(Item_param *param, uchar **pos)
*pos+= 8;
}
-static void setup_param_time(Item_param *param, uchar **pos)
+SETUP_PARAM_FUNCTION(setup_param_time)
{
ulong length;
@@ -286,7 +306,7 @@ static void setup_param_time(Item_param *param, uchar **pos)
*pos+= length;
}
-static void setup_param_datetime(Item_param *param, uchar **pos)
+SETUP_PARAM_FUNCTION(setup_param_datetime)
{
uint length= get_param_length(pos);
@@ -316,7 +336,7 @@ static void setup_param_datetime(Item_param *param, uchar **pos)
*pos+= length;
}
-static void setup_param_date(Item_param *param, uchar **pos)
+SETUP_PARAM_FUNCTION(setup_param_date)
{
ulong length;
@@ -338,14 +358,14 @@ static void setup_param_date(Item_param *param, uchar **pos)
*pos+= length;
}
-static void setup_param_str(Item_param *param, uchar **pos)
+SETUP_PARAM_FUNCTION(setup_param_str)
{
ulong len= get_param_length(pos);
param->set_value((const char *)*pos, len);
*pos+= len;
}
-static void setup_param_functions(Item_param *param, uchar param_type)
+void setup_param_functions(Item_param *param, uchar param_type)
{
switch (param_type) {
case FIELD_TYPE_TINY:
@@ -391,6 +411,7 @@ static void setup_param_functions(Item_param *param, uchar param_type)
}
}
+#ifndef EMBEDDED_LIBRARY
/*
Update the parameter markers by reading data from client packet
and if binary/update log is set, generate the valid query.
@@ -420,7 +441,7 @@ static bool insert_params_withlog(PREP_STMT *stmt, uchar *pos, uchar *read_pos)
if (IS_PARAM_NULL(pos,param_no))
{
param->maybe_null= param->null_value= 1;
- res= &null_string;
+ res= &my_null_string;
}
else
{
@@ -476,11 +497,7 @@ static bool setup_params_data(PREP_STMT *stmt)
Item_param *param;
DBUG_ENTER("setup_params_data");
-#ifndef EMBEDDED_LIBRARY
uchar *pos=(uchar*) thd->net.read_pos+1+MYSQL_STMT_HEADER; //skip header
-#else
- uchar *pos= 0; //just to compile TODO code for embedded case
-#endif
uchar *read_pos= pos+(stmt->param_count+7) / 8; //skip null bits
if (*read_pos++) //types supplied / first execute
@@ -500,6 +517,8 @@ static bool setup_params_data(PREP_STMT *stmt)
DBUG_RETURN(0);
}
+#endif /*!EMBEDDED_LIBRARY*/
+
/*
Validate the following information for INSERT statement:
- field existance
@@ -517,16 +536,18 @@ static bool mysql_test_insert_fields(PREP_STMT *stmt,
List_item *values;
DBUG_ENTER("mysql_test_insert_fields");
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
my_bool update=(thd->lex.value_list.elements ? UPDATE_ACL : 0);
ulong privilege= (thd->lex.duplicates == DUP_REPLACE ?
INSERT_ACL | DELETE_ACL : INSERT_ACL | update);
if (check_access(thd,privilege,table_list->db,
- &table_list->grant.privilege) ||
- (grant_option && check_grant(thd,privilege,table_list)) ||
- open_and_lock_tables(thd, table_list))
+ &table_list->grant.privilege,0,0) ||
+ (grant_option && check_grant(thd,privilege,table_list)))
+ DBUG_RETURN(1);
+#endif
+ if (open_and_lock_tables(thd, table_list))
DBUG_RETURN(1);
-
table= table_list->table;
if ((values= its++))
@@ -574,12 +595,14 @@ static bool mysql_test_upd_fields(PREP_STMT *stmt, TABLE_LIST *table_list,
THD *thd= stmt->thd;
DBUG_ENTER("mysql_test_upd_fields");
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (check_access(thd,UPDATE_ACL,table_list->db,
- &table_list->grant.privilege) ||
- (grant_option && check_grant(thd,UPDATE_ACL,table_list)) ||
- open_and_lock_tables(thd, table_list))
+ &table_list->grant.privilege,0,0) ||
+ (grant_option && check_grant(thd,UPDATE_ACL,table_list)))
+ DBUG_RETURN(1);
+#endif
+ if (open_and_lock_tables(thd, table_list))
DBUG_RETURN(1);
-
if (setup_tables(table_list) ||
setup_fields(thd, 0, table_list, fields, 1, 0, 0) ||
setup_conds(thd, table_list, &conds) || thd->net.report_error)
@@ -620,15 +643,16 @@ static bool mysql_test_select_fields(PREP_STMT *stmt, TABLE_LIST *tables,
select_result *result= thd->lex.result;
DBUG_ENTER("mysql_test_select_fields");
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
ulong privilege= lex->exchange ? SELECT_ACL | FILE_ACL : SELECT_ACL;
if (tables)
{
- if (check_table_access(thd, privilege, tables))
+ if (check_table_access(thd, privilege, tables,0))
DBUG_RETURN(1);
}
- else if (check_access(thd, privilege, "*any*"))
+ else if (check_access(thd, privilege, "*any*",0,0,0))
DBUG_RETURN(1);
-
+#endif
if ((&lex->select_lex != lex->all_selects_list &&
lex->unit.create_total_list(thd, lex, &tables, 0)))
DBUG_RETURN(1);
@@ -659,13 +683,13 @@ static bool mysql_test_select_fields(PREP_STMT *stmt, TABLE_LIST *tables,
wild_num, conds, og_num, order, group, having, proc,
select_lex, unit, 0))
DBUG_RETURN(1);
-#ifndef EMBEDDED_LIBRARY
if (send_prep_stmt(stmt, fields.elements) ||
thd->protocol_simple.send_fields(&fields, 0) ||
+#ifndef EMBEDDED_LIBRARY
net_flush(&thd->net) ||
+#endif
send_item_params(stmt))
DBUG_RETURN(1);
-#endif
join->cleanup();
}
DBUG_RETURN(0);
@@ -784,10 +808,18 @@ static bool init_param_items(PREP_STMT *stmt)
if (mysql_bin_log.is_open() || mysql_update_log.is_open())
{
stmt->log_full_query= 1;
+#ifndef EMBEDDED_LIBRARY
stmt->setup_params= insert_params_withlog;
+#else
+ stmt->setup_params_data= setup_params_data_withlog;
+#endif
}
else
+#ifndef EMBEDDED_LIBRARY
stmt->setup_params= insert_params; // not fully qualified query
+#else
+ stmt->setup_params_data= setup_params_data;
+#endif
if (!stmt->param_count)
stmt->param= (Item_param **)0;
@@ -873,11 +905,21 @@ bool mysql_stmt_prepare(THD *thd, char *packet, uint packet_length)
if (!(specialflag & SPECIAL_NO_PRIOR))
my_pthread_setprio(pthread_self(),WAIT_PRIOR);
+
+ // save WHERE clause pointers to avoid damaging they by optimisation
+ for (SELECT_LEX *sl= thd->lex.all_selects_list;
+ sl;
+ sl= sl->next_select_in_list())
+ {
+ sl->prep_where= sl->where;
+ }
+
if (init_param_items(&stmt))
goto err;
+
- stmt.mem_root= stmt.thd->mem_root;
+ stmt.mem_root= stmt.thd->mem_root;
tree_insert(&thd->prepared_statements, (void *)&stmt, 0, (void *)0);
thd->mem_root= thd_root; // restore main mem_root
DBUG_RETURN(0);
@@ -919,10 +961,25 @@ void mysql_stmt_execute(THD *thd, char *packet)
LEX thd_lex= thd->lex;
thd->lex= stmt->lex;
+
+ for (SELECT_LEX *sl= stmt->lex.all_selects_list;
+ sl;
+ sl= sl->next_select_in_list())
+ {
+ // copy WHERE clause pointers to avoid damaging they by optimisation
+ if (sl->prep_where)
+ sl->where= sl->prep_where->copy_andor_structure(thd);
+ DBUG_ASSERT(sl->join == 0);
+ }
init_stmt_execute(stmt);
+#ifndef EMBEDDED_LIBRARY
if (stmt->param_count && setup_params_data(stmt))
DBUG_VOID_RETURN;
+#else
+ if (stmt->param_count && (*stmt->setup_params_data)(stmt))
+ DBUG_VOID_RETURN;
+#endif
if (!(specialflag & SPECIAL_NO_PRIOR))
my_pthread_setprio(pthread_self(),QUERY_PRIOR);
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 3cdf033c477..7bb51989cc3 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -24,8 +24,6 @@
#include "log_event.h"
#include <my_dir.h>
-extern const char* any_db;
-
int max_binlog_dump_events = 0; // unlimited
my_bool opt_sporadic_binlog_dump_fail = 0;
static int binlog_dump_count = 0;
@@ -545,7 +543,7 @@ Increase max_allowed_packet on master";
if (!thd->killed)
{
/* Note that the following call unlocks lock_log */
- mysql_bin_log.wait_for_update(thd);
+ mysql_bin_log.wait_for_update(thd, 0);
}
else
pthread_mutex_unlock(log_lock);
@@ -560,7 +558,7 @@ Increase max_allowed_packet on master";
if (read_packet)
{
- thd->proc_info = "sending update to slave";
+ thd->proc_info = "Sending binlog event to slave";
if (my_net_write(net, (char*)packet->ptr(), packet->length()) )
{
errmsg = "Failed on my_net_write()";
@@ -597,7 +595,7 @@ Increase max_allowed_packet on master";
{
bool loop_breaker = 0;
// need this to break out of the for loop from switch
- thd->proc_info = "switching to next log";
+ thd->proc_info = "Finished reading one binlog; switching to next binlog";
switch (mysql_bin_log.find_next_log(&linfo, 1)) {
case LOG_INFO_EOF:
loop_breaker = (flags & BINLOG_DUMP_NON_BLOCK);
@@ -636,14 +634,14 @@ end:
(void)my_close(file, MYF(MY_WME));
send_eof(thd);
- thd->proc_info = "waiting to finalize termination";
+ thd->proc_info = "Waiting to finalize termination";
pthread_mutex_lock(&LOCK_thread_count);
thd->current_linfo = 0;
pthread_mutex_unlock(&LOCK_thread_count);
DBUG_VOID_RETURN;
err:
- thd->proc_info = "waiting to finalize termination";
+ thd->proc_info = "Waiting to finalize termination";
end_io_cache(&log);
/*
Exclude iteration through thread list
@@ -663,13 +661,13 @@ err:
int start_slave(THD* thd , MASTER_INFO* mi, bool net_report)
{
- int slave_errno;
+ int slave_errno= 0;
if (!thd)
thd = current_thd;
int thread_mask;
DBUG_ENTER("start_slave");
- if (check_access(thd, SUPER_ACL, any_db))
+ if (check_access(thd, SUPER_ACL, any_db,0,0,0))
DBUG_RETURN(1);
lock_slave_threads(mi); // this allows us to cleanly read slave_running
// Get a mask of _stopped_ threads
@@ -687,21 +685,88 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report)
if (init_master_info(mi,master_info_file,relay_log_info_file, 0))
slave_errno=ER_MASTER_INFO;
else if (server_id_supplied && *mi->host)
- slave_errno = start_slave_threads(0 /*no mutex */,
+ {
+ /*
+ If we will start SQL thread we will care about UNTIL options
+ If not and they are specified we will ignore them and warn user
+ about this fact.
+ */
+ if (thread_mask & SLAVE_SQL)
+ {
+ pthread_mutex_lock(&mi->rli.data_lock);
+
+ if (thd->lex.mi.pos)
+ {
+ mi->rli.until_condition= RELAY_LOG_INFO::UNTIL_MASTER_POS;
+ mi->rli.until_log_pos= thd->lex.mi.pos;
+ /*
+ We don't check thd->lex.mi.log_file_name for NULL here
+ since it is checked in sql_yacc.yy
+ */
+ strmake(mi->rli.until_log_name, thd->lex.mi.log_file_name,
+ sizeof(mi->rli.until_log_name)-1);
+ }
+ else if (thd->lex.mi.relay_log_pos)
+ {
+ mi->rli.until_condition= RELAY_LOG_INFO::UNTIL_RELAY_POS;
+ mi->rli.until_log_pos= thd->lex.mi.relay_log_pos;
+ strmake(mi->rli.until_log_name, thd->lex.mi.relay_log_name,
+ sizeof(mi->rli.until_log_name)-1);
+ }
+ else
+ clear_until_condition(&mi->rli);
+
+ if (mi->rli.until_condition != RELAY_LOG_INFO::UNTIL_NONE)
+ {
+ /* Preparing members for effective until condition checking */
+ const char *p= fn_ext(mi->rli.until_log_name);
+ char *p_end;
+ if (*p)
+ {
+ //p points to '.'
+ mi->rli.until_log_name_extension= strtoul(++p,&p_end, 10);
+ /*
+ p_end points to the first invalid character. If it equals
+ to p, no digits were found, error. If it contains '\0' it
+ means conversion went ok.
+ */
+ if(p_end==p || *p_end)
+ slave_errno=ER_BAD_SLAVE_UNTIL_COND;
+ }
+ else
+ slave_errno=ER_BAD_SLAVE_UNTIL_COND;
+
+ /* mark the cached result of the UNTIL comparison as "undefined" */
+ mi->rli.until_log_names_cmp_result=
+ RELAY_LOG_INFO::UNTIL_LOG_NAMES_CMP_UNKNOWN;
+
+ /* Issuing warning then started without --skip-slave-start */
+ if (!opt_skip_slave_start)
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, ER_MISSING_SKIP_SLAVE,
+ ER(ER_MISSING_SKIP_SLAVE));
+ }
+
+ pthread_mutex_unlock(&mi->rli.data_lock);
+ }
+ else if (thd->lex.mi.pos || thd->lex.mi.relay_log_pos)
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, ER_UNTIL_COND_IGNORED,
+ ER(ER_UNTIL_COND_IGNORED));
+
+
+ if(!slave_errno)
+ slave_errno = start_slave_threads(0 /*no mutex */,
1 /* wait for start */,
mi,
master_info_file,relay_log_info_file,
thread_mask);
+ }
else
slave_errno = ER_BAD_SLAVE;
}
else
- {
//no error if all threads are already started, only a warning
- slave_errno= 0;
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, ER_SLAVE_WAS_RUNNING,
ER(ER_SLAVE_WAS_RUNNING));
- }
unlock_slave_threads(mi);
@@ -724,7 +789,7 @@ int stop_slave(THD* thd, MASTER_INFO* mi, bool net_report )
if (!thd)
thd = current_thd;
- if (check_access(thd, SUPER_ACL, any_db))
+ if (check_access(thd, SUPER_ACL, any_db,0,0,0))
return 1;
thd->proc_info = "Killing slave";
int thread_mask;
@@ -814,6 +879,8 @@ int reset_slave(THD *thd, MASTER_INFO* mi)
*/
init_master_info_with_options(mi);
clear_last_slave_error(&mi->rli);
+ clear_until_condition(&mi->rli);
+
// close master_info_file, relay_log_info_file, set mi->inited=rli->inited=0
end_master_info(mi);
// and delete these two files
@@ -903,7 +970,7 @@ int change_master(THD* thd, MASTER_INFO* mi)
DBUG_RETURN(1);
}
- thd->proc_info = "changing master";
+ thd->proc_info = "Changing master";
LEX_MASTER_INFO* lex_mi = &thd->lex.mi;
// TODO: see if needs re-write
if (init_master_info(mi, master_info_file, relay_log_info_file, 0))
@@ -949,6 +1016,25 @@ int change_master(THD* thd, MASTER_INFO* mi)
mi->port = lex_mi->port;
if (lex_mi->connect_retry)
mi->connect_retry = lex_mi->connect_retry;
+
+ if (lex_mi->ssl != LEX_MASTER_INFO::SSL_UNCHANGED)
+ mi->ssl= (lex_mi->ssl == LEX_MASTER_INFO::SSL_ENABLE);
+ if (lex_mi->ssl_ca)
+ strmake(mi->ssl_ca, lex_mi->ssl_ca, sizeof(mi->ssl_ca)-1);
+ if (lex_mi->ssl_capath)
+ strmake(mi->ssl_capath, lex_mi->ssl_capath, sizeof(mi->ssl_capath)-1);
+ if (lex_mi->ssl_cert)
+ strmake(mi->ssl_cert, lex_mi->ssl_cert, sizeof(mi->ssl_cert)-1);
+ if (lex_mi->ssl_cipher)
+ strmake(mi->ssl_cipher, lex_mi->ssl_cipher, sizeof(mi->ssl_cipher)-1);
+ if (lex_mi->ssl_key)
+ strmake(mi->ssl_key, lex_mi->ssl_key, sizeof(mi->ssl_key)-1);
+#ifndef HAVE_OPENSSL
+ if (lex_mi->ssl || lex_mi->ssl_ca || lex_mi->ssl_capath ||
+ lex_mi->ssl_cert || lex_mi->ssl_cipher || lex_mi->ssl_key )
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
+ ER_SLAVE_IGNORED_SSL_PARAMS, ER(ER_SLAVE_IGNORED_SSL_PARAMS));
+#endif
if (lex_mi->relay_log_name)
{
@@ -969,7 +1055,7 @@ int change_master(THD* thd, MASTER_INFO* mi)
if (need_relay_log_purge)
{
relay_log_purge= 1;
- thd->proc_info="purging old relay logs";
+ thd->proc_info="Purging old relay logs";
if (purge_relay_logs(&mi->rli, thd,
0 /* not only reset, but also reinit */,
&errmsg))
@@ -1008,6 +1094,7 @@ int change_master(THD* thd, MASTER_INFO* mi)
mi->rli.abort_pos_wait++; /* for MASTER_POS_WAIT() to abort */
/* Clear the error, for a clean start. */
clear_last_slave_error(&mi->rli);
+ clear_until_condition(&mi->rli);
/*
If we don't write new coordinates to disk now, then old will remain in
relay-log.info until START SLAVE is issued; but if mysqld is shutdown
@@ -1258,7 +1345,7 @@ int log_loaded_block(IO_CACHE* file)
lf_info->last_pos_in_file = file->pos_in_file;
if (lf_info->wrote_create_file)
{
- Append_block_log_event a(lf_info->thd, buffer, block_len,
+ Append_block_log_event a(lf_info->thd, lf_info->db, buffer, block_len,
lf_info->log_delayed);
mysql_bin_log.write(&a);
}
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 412e891bad1..ff41e9fd067 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -32,7 +32,7 @@
const char *join_type_str[]={ "UNKNOWN","system","const","eq_ref","ref",
"MAYBE_REF","ALL","range","index","fulltext",
- "ref_or_null","simple_in","index_in"
+ "ref_or_null","unique_subquery","index_subquery"
};
static void optimize_keyuse(JOIN *join, DYNAMIC_ARRAY *keyuse_array);
@@ -158,8 +158,9 @@ static void copy_sum_funcs(Item_sum **func_ptr);
static bool add_ref_to_table_cond(THD *thd, JOIN_TAB *join_tab);
static bool init_sum_functions(Item_sum **func, Item_sum **end);
static bool update_sum_func(Item_sum **func);
-static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
+static void select_describe(JOIN *join, bool need_tmp_table,bool need_order,
bool distinct, const char *message=NullS);
+static Item *remove_additional_cond(Item* conds);
/*
@@ -324,8 +325,8 @@ JOIN::prepare(Item ***rref_pointer_array,
{
Item_subselect::trans_res res;
if ((res= subselect->select_transformer(this)) !=
- Item_subselect::OK)
- DBUG_RETURN((res == Item_subselect::ERROR));
+ Item_subselect::RES_OK)
+ DBUG_RETURN((res == Item_subselect::RES_ERROR));
}
}
@@ -464,8 +465,10 @@ bool JOIN::test_in_subselect(Item **where)
((class Item_func *)this->conds)->functype() ==
Item_func::COND_AND_FUNC)
{
- *where= conds;
- join_tab->info= "Using index; Using where";
+ if ((*where= remove_additional_cond(conds)))
+ join_tab->info= "Using index; Using where";
+ else
+ join_tab->info= "Using index";
return 1;
}
return 0;
@@ -475,8 +478,7 @@ bool JOIN::test_in_subselect(Item **where)
/*
global select optimisation.
return 0 - success
- 1 - go out
- -1 - go out with cleaning
+ 1 - error
error code saved in field 'error'
*/
int
@@ -513,11 +515,9 @@ JOIN::optimize()
conds= optimize_cond(conds,&cond_value);
if (thd->net.report_error)
{
- // quick abort
- delete procedure;
- error= thd->is_fatal_error ? -1 : 1;
+ error= 1;
DBUG_PRINT("error",("Error from optimize_cond"));
- DBUG_RETURN(error);
+ DBUG_RETURN(1);
}
if (cond_value == Item::COND_FALSE ||
@@ -540,8 +540,7 @@ JOIN::optimize()
{
if (res > 1)
{
- delete procedure;
- DBUG_RETURN(-1);
+ DBUG_RETURN(1);
}
if (res < 0)
{
@@ -774,13 +773,14 @@ JOIN::optimize()
{
if (test_in_subselect(&where))
{
- join_tab[0].type= JT_SIMPLE_IN;
+ join_tab[0].type= JT_UNIQUE_SUBQUERY;
error= 0;
DBUG_RETURN(unit->item->
- change_engine(new subselect_simplein_engine(thd,
- join_tab,
- unit->item,
- where)));
+ change_engine(new
+ subselect_uniquesubquery_engine(thd,
+ join_tab,
+ unit->item,
+ where)));
}
}
else if (join_tab[0].type == JT_REF &&
@@ -788,14 +788,15 @@ JOIN::optimize()
{
if (test_in_subselect(&where))
{
- join_tab[0].type= JT_INDEX_IN;
+ join_tab[0].type= JT_INDEX_SUBQUERY;
error= 0;
DBUG_RETURN(unit->item->
- change_engine(new subselect_indexin_engine(thd,
- join_tab,
- unit->item,
- where,
- 0)));
+ change_engine(new
+ subselect_indexsubquery_engine(thd,
+ join_tab,
+ unit->item,
+ where,
+ 0)));
}
}
} else if (join_tab[0].type == JT_REF_OR_NULL &&
@@ -804,14 +805,20 @@ JOIN::optimize()
((Item_func *) having)->functype() ==
Item_func::ISNOTNULLTEST_FUNC)
{
- join_tab[0].type= JT_INDEX_IN;
+ join_tab[0].type= JT_INDEX_SUBQUERY;
error= 0;
+
+ if ((conds= remove_additional_cond(conds)))
+ join_tab->info= "Using index; Using where";
+ else
+ join_tab->info= "Using index";
+
DBUG_RETURN(unit->item->
- change_engine(new subselect_indexin_engine(thd,
- join_tab,
- unit->item,
- conds,
- 1)));
+ change_engine(new subselect_indexsubquery_engine(thd,
+ join_tab,
+ unit->item,
+ conds,
+ 1)));
}
}
@@ -1003,12 +1010,6 @@ JOIN::reinit()
/* Reset of sum functions */
first_record= 0;
- if (sum_funcs)
- {
- Item_sum *func, **func_ptr= sum_funcs;
- while ((func= *(func_ptr++)))
- func->null_value= 1;
- }
if (exec_tmp_table1)
{
@@ -1043,6 +1044,7 @@ JOIN::exec()
DBUG_ENTER("JOIN::exec");
error= 0;
+ thd->limit_found_rows= thd->examined_row_count= 0;
if (procedure)
{
if (procedure->change_columns(fields_list) ||
@@ -1425,6 +1427,8 @@ JOIN::exec()
thd->proc_info="Sending data";
error= thd->net.report_error ||
do_select(curr_join, curr_fields_list, NULL, procedure);
+ thd->limit_found_rows= curr_join->send_records;
+ thd->examined_row_count= curr_join->examined_rows;
DBUG_VOID_RETURN;
}
@@ -1508,7 +1512,7 @@ mysql_select(THD *thd, Item ***rref_pointer_array,
conds, og_num, order, group, having, proc_param,
select_lex, unit, tables_and_fields_initied))
{
- DBUG_RETURN(-1);
+ goto err;
}
}
join->select_options= select_options;
@@ -1523,15 +1527,12 @@ mysql_select(THD *thd, Item ***rref_pointer_array,
conds, og_num, order, group, having, proc_param,
select_lex, unit, tables_and_fields_initied))
{
- DBUG_RETURN(-1);
+ goto err;
}
}
if ((err= join->optimize()))
{
- if (err == -1)
- DBUG_RETURN(join->error);
- DBUG_ASSERT(err == 1);
goto err; // 1
}
@@ -1547,8 +1548,6 @@ err:
(join->tmp_join->error=join->error,join->tmp_join):
join);
- thd->limit_found_rows= curr_join->send_records;
- thd->examined_row_count= curr_join->examined_rows;
thd->proc_info="end";
err= join->cleanup();
if (thd->net.report_error)
@@ -2051,28 +2050,34 @@ merge_key_fields(KEY_FIELD *start,KEY_FIELD *new_fields,KEY_FIELD *end,
static void
add_key_field(KEY_FIELD **key_fields,uint and_level,
- Field *field,bool eq_func,Item *value,
+ Field *field,bool eq_func,Item **value, uint num_values,
table_map usable_tables)
{
uint exists_optimize= 0;
if (!(field->flags & PART_KEY_FLAG))
{
// Don't remove column IS NULL on a LEFT JOIN table
- if (!eq_func || !value || value->type() != Item::NULL_ITEM ||
- !field->table->maybe_null || field->null_ptr)
+ if (!eq_func || (*value)->type() != Item::NULL_ITEM ||
+ !field->table->maybe_null || field->null_ptr)
return; // Not a key. Skip it
exists_optimize= KEY_OPTIMIZE_EXISTS;
}
else
{
table_map used_tables=0;
- if (value && ((used_tables=value->used_tables()) &
- (field->table->map | RAND_TABLE_BIT)))
+ bool optimizable=0;
+ for (uint i=0; i<num_values; i++)
+ {
+ used_tables|=(*value)->used_tables();
+ if (!((*value)->used_tables() & (field->table->map | RAND_TABLE_BIT)))
+ optimizable=1;
+ }
+ if (!optimizable)
return;
if (!(usable_tables & field->table->map))
{
- if (!eq_func || !value || value->type() != Item::NULL_ITEM ||
- !field->table->maybe_null || field->null_ptr)
+ if (!eq_func || (*value)->type() != Item::NULL_ITEM ||
+ !field->table->maybe_null || field->null_ptr)
return; // Can't use left join optimize
exists_optimize= KEY_OPTIMIZE_EXISTS;
}
@@ -2083,12 +2088,6 @@ add_key_field(KEY_FIELD **key_fields,uint and_level,
field->table->keys_in_use_for_query);
stat[0].keys|= possible_keys; // Add possible keys
- if (!value)
- { // Probably BETWEEN or IN
- stat[0].const_keys |= possible_keys;
- return; // Can't be used as eq key
- }
-
/*
Save the following cases:
Field op constant
@@ -2097,26 +2096,38 @@ add_key_field(KEY_FIELD **key_fields,uint and_level,
Field op formula
Field IS NULL
Field IS NOT NULL
+ Field BETWEEN ...
+ Field IN ...
*/
stat[0].key_dependent|=used_tables;
- if (value->const_item())
- stat[0].const_keys |= possible_keys;
+ bool is_const=1;
+ for (uint i=0; i<num_values; i++)
+ is_const&= (*value)->const_item();
+ if (is_const)
+ stat[0].const_keys |= possible_keys;
/*
We can't always use indexes when comparing a string index to a
- number. cmp_type() is checked to allow compare of dates to numbers
- */
+ number. cmp_type() is checked to allow compare of dates to numbers.
+ eq_func is NEVER true when num_values > 1
+ */
if (!eq_func ||
field->result_type() == STRING_RESULT &&
- value->result_type() != STRING_RESULT &&
- field->cmp_type() != value->result_type())
+ (*value)->result_type() != STRING_RESULT &&
+ field->cmp_type() != (*value)->result_type())
return;
}
}
+ DBUG_ASSERT(num_values == 1);
+ /*
+ For the moment eq_func is always true. This slot is reserved for future
+ extensions where we want to remembers other things than just eq comparisons
+ */
+ DBUG_ASSERT(eq_func);
/* Store possible eq field */
(*key_fields)->field= field;
(*key_fields)->eq_func= eq_func;
- (*key_fields)->val= value;
+ (*key_fields)->val= *value;
(*key_fields)->level= and_level;
(*key_fields)->optimize= exists_optimize;
(*key_fields)++;
@@ -2165,12 +2176,14 @@ add_key_fields(JOIN_TAB *stat,KEY_FIELD **key_fields,uint *and_level,
case Item_func::OPTIMIZE_NONE:
break;
case Item_func::OPTIMIZE_KEY:
+ // BETWEEN or IN
if (cond_func->key_item()->real_item()->type() == Item::FIELD_ITEM &&
!(cond_func->used_tables() & OUTER_REF_TABLE_BIT))
add_key_field(key_fields,*and_level,
- ((Item_field*) (cond_func->key_item()->real_item()))
- ->field,
- 0,(Item*) 0,usable_tables);
+ ((Item_field*) (cond_func->key_item()->real_item()))->
+ field, 0,
+ cond_func->arguments()+1, cond_func->argument_count()-1,
+ usable_tables);
break;
case Item_func::OPTIMIZE_OP:
{
@@ -2184,7 +2197,7 @@ add_key_fields(JOIN_TAB *stat,KEY_FIELD **key_fields,uint *and_level,
((Item_field*) (cond_func->arguments()[0])->real_item())
->field,
equal_func,
- (cond_func->arguments()[1]),usable_tables);
+ cond_func->arguments()+1, 1, usable_tables);
}
if (cond_func->arguments()[1]->real_item()->type() == Item::FIELD_ITEM &&
cond_func->functype() != Item_func::LIKE_FUNC &&
@@ -2194,7 +2207,7 @@ add_key_fields(JOIN_TAB *stat,KEY_FIELD **key_fields,uint *and_level,
((Item_field*) (cond_func->arguments()[1])->real_item())
->field,
equal_func,
- (cond_func->arguments()[0]),usable_tables);
+ cond_func->arguments(),1,usable_tables);
}
break;
}
@@ -2203,11 +2216,14 @@ add_key_fields(JOIN_TAB *stat,KEY_FIELD **key_fields,uint *and_level,
if (cond_func->arguments()[0]->real_item()->type() == Item::FIELD_ITEM &&
!(cond_func->used_tables() & OUTER_REF_TABLE_BIT))
{
+ Item *tmp=new Item_null;
+ if (!tmp) // Should never be true
+ return;
add_key_field(key_fields,*and_level,
((Item_field*) (cond_func->arguments()[0])->real_item())
->field,
cond_func->functype() == Item_func::ISNULL_FUNC,
- new Item_null, usable_tables);
+ &tmp, 1, usable_tables);
}
break;
}
@@ -2459,7 +2475,7 @@ static void optimize_keyuse(JOIN *join, DYNAMIC_ARRAY *keyuse_array)
Constant tables are ignored.
To avoid bad matches, we don't make ref_table_rows less than 100.
*/
- keyuse->ref_table_rows= ~(table_map) 0; // If no ref
+ keyuse->ref_table_rows= ~(ha_rows) 0; // If no ref
if (keyuse->used_tables &
(map= (keyuse->used_tables & ~join->const_table_map &
~OUTER_REF_TABLE_BIT)))
@@ -3326,13 +3342,33 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
join->best_positions[i].records_read &&
!(join->select_options & OPTION_FOUND_ROWS)))
{
+ /* Join with outer join condition */
+ COND *orig_cond=sel->cond;
+ sel->cond=and_conds(sel->cond,tab->on_expr);
if (sel->test_quick_select(tab->keys,
used_tables & ~ current_map,
(join->select_options &
OPTION_FOUND_ROWS ?
HA_POS_ERROR :
join->unit->select_limit_cnt)) < 0)
- DBUG_RETURN(1); // Impossible range
+ {
+ /*
+ Before reporting "Impossible WHERE" for the whole query
+ we have to check isn't it only "impossible ON" instead
+ */
+ sel->cond=orig_cond;
+ if (!tab->on_expr ||
+ sel->test_quick_select(tab->keys,
+ used_tables & ~ current_map,
+ (join->select_options &
+ OPTION_FOUND_ROWS ?
+ HA_POS_ERROR :
+ join->unit->select_limit_cnt)) < 0)
+ DBUG_RETURN(1); // Impossible WHERE
+ }
+ else
+ sel->cond=orig_cond;
+
/* Fix for EXPLAIN */
if (sel->quick)
join->best_positions[i].records_read= sel->quick->records;
@@ -3995,9 +4031,42 @@ change_cond_ref_to_const(I_List<COND_CMP> *save_list,Item *and_father,
}
}
+/*
+ Remove additional condition inserted by IN/ALL/ANY transformation
+
+ SYNOPSIS
+ remove_additional_cond()
+ conds - condition for processing
+
+ RETURN VALUES
+ new conditions
+*/
+
+static Item *remove_additional_cond(Item* conds)
+{
+ if (conds->name == in_additional_cond)
+ return 0;
+ if (conds->type() == Item::COND_ITEM)
+ {
+ Item_cond *cnd= (Item_cond*) conds;
+ List_iterator<Item> li(*(cnd->argument_list()));
+ Item *item;
+ while ((item= li++))
+ {
+ if (item->name == in_additional_cond)
+ {
+ li.remove();
+ if (cnd->argument_list()->elements == 1)
+ return cnd->argument_list()->head();
+ return conds;
+ }
+ }
+ }
+ return conds;
+}
static void
-propagate_cond_constants(I_List<COND_CMP> *save_list,COND *and_level,
+propagate_cond_constants(I_List<COND_CMP> *save_list,COND *and_father,
COND *cond)
{
if (cond->type() == Item::COND_ITEM)
@@ -4023,7 +4092,7 @@ propagate_cond_constants(I_List<COND_CMP> *save_list,COND *and_level,
cond_cmp->cmp_func->arguments()[1]);
}
}
- else if (and_level != cond && !cond->marker) // In a AND group
+ else if (and_father != cond && !cond->marker) // In a AND group
{
if (cond->type() == Item::FUNC_ITEM &&
(((Item_func*) cond)->functype() == Item_func::EQ_FUNC ||
@@ -4041,7 +4110,7 @@ propagate_cond_constants(I_List<COND_CMP> *save_list,COND *and_level,
func->arguments()[1]=resolve_const_item(func->arguments()[1],
func->arguments()[0]);
func->update_used_tables();
- change_cond_ref_to_const(save_list,and_level,and_level,
+ change_cond_ref_to_const(save_list,and_father,and_father,
func->arguments()[0],
func->arguments()[1]);
}
@@ -4050,7 +4119,7 @@ propagate_cond_constants(I_List<COND_CMP> *save_list,COND *and_level,
func->arguments()[0]=resolve_const_item(func->arguments()[0],
func->arguments()[1]);
func->update_used_tables();
- change_cond_ref_to_const(save_list,and_level,and_level,
+ change_cond_ref_to_const(save_list,and_father,and_father,
func->arguments()[1],
func->arguments()[0]);
}
@@ -4794,7 +4863,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
keyinfo->algorithm= HA_KEY_ALG_UNDEF;
for (; group ; group=group->next,key_part_info++)
{
- Field *field=(*group->item)->tmp_table_field();
+ Field *field=(*group->item)->get_tmp_table_field();
bool maybe_null=(*group->item)->maybe_null;
key_part_info->null_bit=0;
key_part_info->field= field;
@@ -5978,8 +6047,7 @@ end_send_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
if (!join->first_record)
{
/* No matching rows for group function */
- clear_tables(join);
- copy_fields(&join->tmp_table_param);
+ join->clear();
}
if (join->having && join->having->val_int() == 0)
error= -1; // Didn't satisfy having
@@ -6063,7 +6131,7 @@ end_write(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
Item *item= *group->item;
if (item->maybe_null)
{
- Field *field=item->tmp_table_field();
+ Field *field=item->get_tmp_table_field();
field->ptr[-1]= (byte) (field->is_null() ? 1 : 0);
}
}
@@ -6245,8 +6313,7 @@ end_write_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
if (!join->first_record)
{
/* No matching rows for group function */
- clear_tables(join);
- copy_fields(&join->tmp_table_param);
+ join->clear();
}
copy_sum_funcs(join->sum_funcs);
if (!join->having || join->having->val_int())
@@ -6933,7 +7000,7 @@ remove_duplicates(JOIN *join, TABLE *entry,List<Item> &fields, Item *having)
Item *item;
while ((item=it++))
{
- if (item->tmp_table_field() && ! item->const_item())
+ if (item->get_tmp_table_field() && ! item->const_item())
field_count++;
}
@@ -7129,7 +7196,7 @@ static int remove_dup_with_hash_index(THD *thd, TABLE *table,
goto err;
}
else
- (void) hash_insert(&hash, key_pos-key_length);
+ (void) my_hash_insert(&hash, key_pos-key_length);
key_pos+=extra_length;
}
my_free((char*) key_buffer,MYF(0));
@@ -7169,7 +7236,7 @@ SORT_FIELD *make_unireg_sortorder(ORDER *order, uint *length)
pos->field= ((Item_field*) (*order->item))->field;
else if (order->item[0]->type() == Item::SUM_FUNC_ITEM &&
!order->item[0]->const_item())
- pos->field= ((Item_sum*) order->item[0])->tmp_table_field();
+ pos->field= ((Item_sum*) order->item[0])->get_tmp_table_field();
else if (order->item[0]->type() == Item::COPY_STR_ITEM)
{ // Blob patch
pos->item= ((Item_copy_string*) (*order->item))->item;
@@ -7766,7 +7833,7 @@ calc_group_buffer(JOIN *join,ORDER *group)
join->group= 1;
for (; group ; group=group->next)
{
- Field *field=(*group->item)->tmp_table_field();
+ Field *field=(*group->item)->get_tmp_table_field();
if (field)
{
if (field->type() == FIELD_TYPE_BLOB)
@@ -8110,7 +8177,7 @@ change_to_use_tmp_fields(THD *thd, Item **ref_pointer_array,
{
item_field= item->get_tmp_table_item(thd);
}
- else if ((field= item->tmp_table_field()))
+ else if ((field= item->get_tmp_table_field()))
{
if (item->type() == Item::SUM_FUNC_ITEM && field->table->group)
item_field= ((Item_sum*) item)->result_item(field);
@@ -8213,7 +8280,7 @@ update_tmptable_sum_func(Item_sum **func_ptr,
{
Item_sum *func;
while ((func= *(func_ptr++)))
- func->update_field(0);
+ func->update_field();
}
@@ -8541,6 +8608,26 @@ int JOIN::rollup_send_data(uint idx)
return 0;
}
+/*
+ clear results if there are not rows found for group
+ (end_send_group/end_write_group)
+
+ SYNOPSYS
+ JOIN::clear()
+*/
+
+void JOIN::clear()
+{
+ clear_tables(this);
+ copy_fields(&tmp_table_param);
+
+ if (sum_funcs)
+ {
+ Item_sum *func, **func_ptr= sum_funcs;
+ while ((func= *(func_ptr++)))
+ func->clear();
+ }
+}
/****************************************************************************
EXPLAIN handling
diff --git a/sql/sql_select.h b/sql/sql_select.h
index 208eaaea7bd..6c17a646ee6 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -76,7 +76,7 @@ typedef struct st_join_cache {
enum join_type { JT_UNKNOWN,JT_SYSTEM,JT_CONST,JT_EQ_REF,JT_REF,JT_MAYBE_REF,
JT_ALL, JT_RANGE, JT_NEXT, JT_FT, JT_REF_OR_NULL,
- JT_SIMPLE_IN, JT_INDEX_IN};
+ JT_UNIQUE_SUBQUERY, JT_INDEX_SUBQUERY};
class JOIN;
@@ -279,6 +279,7 @@ class JOIN :public Sql_alloc
Item_sum ***func);
int rollup_send_data(uint idx);
bool test_in_subselect(Item **where);
+ void clear();
};
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 9084269f486..8550973ff88 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -73,10 +73,12 @@ mysqld_show_dbs(THD *thd,const char *wild)
while ((file_name=it++))
{
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (thd->master_access & (DB_ACLS | SHOW_DB_ACL) ||
acl_get(thd->host, thd->ip, (char*) &thd->remote.sin_addr,
thd->priv_user, file_name,0) ||
(grant_option && !check_grant_db(thd, file_name)))
+#endif
{
protocol->prepare_for_resend();
protocol->store(file_name, system_charset_info);
@@ -437,6 +439,7 @@ mysql_find_files(THD *thd,List<char> *files, const char *db,const char *path,
continue;
}
}
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
/* Don't show tables where we don't have any privileges */
if (db && !(col_access & TABLE_ACLS))
{
@@ -446,6 +449,7 @@ mysql_find_files(THD *thd,List<char> *files, const char *db,const char *path,
if (check_grant(thd,TABLE_ACLS,&table_list,1,1))
continue;
}
+#endif
if (files->push_back(thd->strdup(file->name)))
{
my_dirend(dirp);
@@ -501,7 +505,9 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild)
item->maybe_null=1;
field_list.push_back(item=new Item_datetime("Check_time"));
item->maybe_null=1;
- field_list.push_back(item=new Item_empty_string("Charset",32));
+ field_list.push_back(item=new Item_empty_string("Collation",32));
+ item->maybe_null=1;
+ field_list.push_back(item=new Item_int("Checksum",(longlong) 1,21));
item->maybe_null=1;
field_list.push_back(item=new Item_empty_string("Create_options",255));
item->maybe_null=1;
@@ -588,6 +594,10 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild)
}
str= (table->table_charset ? table->table_charset->name : "default");
protocol->store(str, system_charset_info);
+ if (file->table_flags() & HA_HAS_CHECKSUM)
+ protocol->store((ulonglong)file->checksum());
+ else
+ protocol->store_null(); // Checksum
{
char option_buff[350],*ptr;
ptr=option_buff;
@@ -668,8 +678,9 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild,
}
file=table->file;
file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
(void) get_table_grant(thd, table_list);
-
+#endif
List<Item> field_list;
field_list.push_back(new Item_empty_string("Field",NAME_LEN));
field_list.push_back(new Item_empty_string("Type",40));
@@ -749,6 +760,7 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild,
{
/* Add grant options & comments */
end=tmp;
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
col_access= get_column_grant(thd,table_list,field) & COL_ACLS;
for (uint bitnr=0; col_access ; col_access>>=1,bitnr++)
{
@@ -758,6 +770,9 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild,
end=strmov(end,grant_types.type_names[bitnr]);
}
}
+#else
+ end=strmov(end,"");
+#endif
protocol->store(tmp+1,end == tmp ? 0 : (uint) (end-tmp-1),
system_charset_info);
protocol->store(field->comment.str, field->comment.length,
@@ -791,9 +806,14 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
DBUG_RETURN(1);
}
+ if (store_create_info(thd, table, &buffer))
+ DBUG_RETURN(-1);
+
List<Item> field_list;
field_list.push_back(new Item_empty_string("Table",NAME_LEN));
- field_list.push_back(new Item_empty_string("Create Table", MAX_BLOB_WIDTH));
+ // 1024 is for not to confuse old clients
+ field_list.push_back(new Item_empty_string("Create Table",
+ max(buffer.length(),1024)));
if (protocol->send_fields(&field_list, 1))
DBUG_RETURN(1);
@@ -1017,11 +1037,38 @@ append_identifier(THD *thd, String *packet, const char *name, uint length)
}
}
+
+/* Append directory name (if exists) to CREATE INFO */
+
+static void append_directory(THD *thd, String *packet, const char *dir_type,
+ const char *filename)
+{
+ uint length;
+ if (filename && !(thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE))
+ {
+ length= dirname_length(filename);
+ packet->append(' ');
+ packet->append(dir_type);
+ packet->append(" DIRECTORY='", 12);
+ packet->append(filename, length);
+ packet->append('\'');
+ }
+}
+
+
#define LIST_PROCESS_HOST_LEN 64
static int
store_create_info(THD *thd, TABLE *table, String *packet)
{
+ List<Item> field_list;
+ char tmp[MAX_FIELD_WIDTH], *for_str, buff[128], *end;
+ String type(tmp, sizeof(tmp),&my_charset_bin);
+ Field **ptr,*field;
+ uint primary_key;
+ KEY *key_info;
+ handler *file= table->file;
+ HA_CREATE_INFO create_info;
my_bool foreign_db_mode= (thd->variables.sql_mode & (MODE_POSTGRESQL |
MODE_ORACLE |
MODE_MSSQL |
@@ -1037,9 +1084,6 @@ store_create_info(THD *thd, TABLE *table, String *packet)
restore_record(table,default_values); // Get empty record
- List<Item> field_list;
- char tmp[MAX_FIELD_WIDTH];
- String type(tmp, sizeof(tmp),&my_charset_bin);
if (table->tmp_table)
packet->append("CREATE TEMPORARY TABLE ", 23);
else
@@ -1047,13 +1091,14 @@ store_create_info(THD *thd, TABLE *table, String *packet)
append_identifier(thd,packet, table->real_name, strlen(table->real_name));
packet->append(" (\n", 3);
- Field **ptr,*field;
for (ptr=table->field ; (field= *ptr); ptr++)
{
+ bool has_default;
+ uint flags = field->flags;
+
if (ptr != table->field)
packet->append(",\n", 2);
- uint flags = field->flags;
packet->append(" ", 2);
append_identifier(thd,packet,field->field_name, strlen(field->field_name));
packet->append(' ');
@@ -1090,9 +1135,9 @@ store_create_info(THD *thd, TABLE *table, String *packet)
if (flags & NOT_NULL_FLAG)
packet->append(" NOT NULL", 9);
- bool has_default = (field->type() != FIELD_TYPE_BLOB &&
- field->type() != FIELD_TYPE_TIMESTAMP &&
- field->unireg_check != Field::NEXT_NUMBER);
+ has_default= (field->type() != FIELD_TYPE_BLOB &&
+ field->type() != FIELD_TYPE_TIMESTAMP &&
+ field->unireg_check != Field::NEXT_NUMBER);
if (has_default)
{
@@ -1122,9 +1167,11 @@ store_create_info(THD *thd, TABLE *table, String *packet)
}
}
- KEY *key_info=table->key_info;
- table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK | HA_STATUS_TIME);
- uint primary_key = table->primary_key;
+ 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= table->primary_key;
for (uint i=0 ; i < table->keys ; i++,key_info++)
{
@@ -1175,9 +1222,10 @@ store_create_info(THD *thd, TABLE *table, String *packet)
table->field[key_part->fieldnr-1]->key_length() &&
!(key_info->flags & HA_FULLTEXT)))
{
- char buff[64];
buff[0] = '(';
- char* end=int10_to_str((long) key_part->length, buff + 1,10);
+ char* end=int10_to_str((long) key_part->length /
+ key_part->field->charset()->mbmaxlen,
+ buff + 1,10);
*end++ = ')';
packet->append(buff,(uint) (end-buff));
}
@@ -1189,10 +1237,8 @@ store_create_info(THD *thd, TABLE *table, String *packet)
Get possible foreign key definitions stored in InnoDB and append them
to the CREATE TABLE statement
*/
- handler *file = table->file;
- char* for_str= file->get_foreign_key_create_info();
- if (for_str)
+ if ((for_str= file->get_foreign_key_create_info()))
{
packet->append(for_str, strlen(for_str));
file->free_foreign_key_create_info(for_str);
@@ -1203,8 +1249,6 @@ store_create_info(THD *thd, TABLE *table, String *packet)
{
packet->append(" TYPE=", 6);
packet->append(file->table_type());
- char buff[128];
- char* p;
if (table->table_charset &&
!(thd->variables.sql_mode & MODE_MYSQL323) &&
@@ -1222,21 +1266,22 @@ store_create_info(THD *thd, TABLE *table, String *packet)
if (table->min_rows)
{
packet->append(" MIN_ROWS=");
- p = longlong10_to_str(table->min_rows, buff, 10);
- packet->append(buff, (uint) (p - buff));
+ end= longlong10_to_str(table->min_rows, buff, 10);
+ packet->append(buff, (uint) (end- buff));
}
if (table->max_rows)
{
packet->append(" MAX_ROWS=");
- p = longlong10_to_str(table->max_rows, buff, 10);
- packet->append(buff, (uint) (p - buff));
+ end= longlong10_to_str(table->max_rows, buff, 10);
+ packet->append(buff, (uint) (end - buff));
}
+
if (table->avg_row_length)
{
packet->append(" AVG_ROW_LENGTH=");
- p=longlong10_to_str(table->avg_row_length, buff,10);
- packet->append(buff, (uint) (p - buff));
+ end= longlong10_to_str(table->avg_row_length, buff,10);
+ packet->append(buff, (uint) (end - buff));
}
if (table->db_create_options & HA_OPTION_PACK_KEYS)
@@ -1260,12 +1305,15 @@ store_create_info(THD *thd, TABLE *table, String *packet)
}
if (file->raid_type)
{
- char buff[100];
- sprintf(buff," RAID_TYPE=%s RAID_CHUNKS=%d RAID_CHUNKSIZE=%ld",
- my_raid_type(file->raid_type), file->raid_chunks,
- file->raid_chunksize/RAID_BLOCK_SIZE);
- packet->append(buff);
+ uint length;
+ length= my_snprintf(buff,sizeof(buff),
+ " RAID_TYPE=%s RAID_CHUNKS=%d RAID_CHUNKSIZE=%ld",
+ my_raid_type(file->raid_type), file->raid_chunks,
+ file->raid_chunksize/RAID_BLOCK_SIZE);
+ packet->append(buff, length);
}
+ append_directory(thd, packet, "DATA", create_info.data_file_name);
+ append_directory(thd, packet, "INDEX", create_info.index_file_name);
}
DBUG_RETURN(0);
}
@@ -1458,11 +1506,15 @@ int mysqld_show_collations(THD *thd, const char *wild)
for ( cs= all_charsets ; cs < all_charsets+255 ; cs++ )
{
CHARSET_INFO **cl;
+ if (!cs[0] || !(cs[0]->state & MY_CS_AVAILABLE) ||
+ !(cs[0]->state & MY_CS_PRIMARY))
+ continue;
for ( cl= all_charsets; cl < all_charsets+255 ;cl ++)
{
- if (!cs[0] || !cl[0] || !my_charset_same(cs[0],cl[0]) || !(cs[0]->state & MY_CS_PRIMARY))
+ if (!cl[0] || !(cl[0]->state & MY_CS_AVAILABLE) ||
+ !my_charset_same(cs[0],cl[0]))
continue;
- if (cs[0] && !(wild && wild[0] &&
+ if (!(wild && wild[0] &&
wild_case_compare(system_charset_info,cl[0]->name,wild)))
{
if (write_collation(protocol, cl[0]))
@@ -1506,8 +1558,10 @@ int mysqld_show_charsets(THD *thd, const char *wild)
for ( cs= all_charsets ; cs < all_charsets+255 ; cs++ )
{
- if (cs[0] && (cs[0]->state & MY_CS_PRIMARY) && !(wild && wild[0] &&
- wild_case_compare(system_charset_info,cs[0]->name,wild)))
+ if (cs[0] && (cs[0]->state & MY_CS_PRIMARY) &&
+ (cs[0]->state & MY_CS_AVAILABLE) &&
+ !(wild && wild[0] &&
+ wild_case_compare(system_charset_info,cs[0]->csname,wild)))
{
if (write_charset(protocol, cs[0]))
goto err;
@@ -1522,7 +1576,8 @@ err:
int mysqld_show(THD *thd, const char *wild, show_var_st *variables,
- enum enum_var_type value_type)
+ enum enum_var_type value_type,
+ pthread_mutex_t *mutex)
{
char buff[1024];
List<Item> field_list;
@@ -1536,8 +1591,7 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables,
DBUG_RETURN(1); /* purecov: inspected */
null_lex_str.str= 0; // For sys_var->value_ptr()
- /* pthread_mutex_lock(&THR_LOCK_keycache); */
- pthread_mutex_lock(&LOCK_status);
+ pthread_mutex_lock(mutex);
for (; variables->name; variables++)
{
if (!(wild && wild[0] && wild_case_compare(system_charset_info,
@@ -1625,83 +1679,83 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables,
case SHOW_SSL_CTX_SESS_ACCEPT:
end= int10_to_str((long) (!ssl_acceptor_fd ? 0 :
SSL_CTX_sess_accept(ssl_acceptor_fd->
- ssl_context_)),
+ ssl_context)),
buff, 10);
break;
case SHOW_SSL_CTX_SESS_ACCEPT_GOOD:
end= int10_to_str((long) (!ssl_acceptor_fd ? 0 :
SSL_CTX_sess_accept_good(ssl_acceptor_fd->
- ssl_context_)),
+ ssl_context)),
buff, 10);
break;
case SHOW_SSL_CTX_SESS_CONNECT_GOOD:
end= int10_to_str((long) (!ssl_acceptor_fd ? 0 :
SSL_CTX_sess_connect_good(ssl_acceptor_fd->
- ssl_context_)),
+ ssl_context)),
buff, 10);
break;
case SHOW_SSL_CTX_SESS_ACCEPT_RENEGOTIATE:
end= int10_to_str((long) (!ssl_acceptor_fd ? 0 :
- SSL_CTX_sess_accept_renegotiate(ssl_acceptor_fd->ssl_context_)),
+ SSL_CTX_sess_accept_renegotiate(ssl_acceptor_fd->ssl_context)),
buff, 10);
break;
case SHOW_SSL_CTX_SESS_CONNECT_RENEGOTIATE:
end= int10_to_str((long) (!ssl_acceptor_fd ? 0 :
- SSL_CTX_sess_connect_renegotiate(ssl_acceptor_fd-> ssl_context_)),
+ SSL_CTX_sess_connect_renegotiate(ssl_acceptor_fd-> ssl_context)),
buff, 10);
break;
case SHOW_SSL_CTX_SESS_CB_HITS:
end= int10_to_str((long) (!ssl_acceptor_fd ? 0 :
SSL_CTX_sess_cb_hits(ssl_acceptor_fd->
- ssl_context_)),
+ ssl_context)),
buff, 10);
break;
case SHOW_SSL_CTX_SESS_HITS:
end= int10_to_str((long) (!ssl_acceptor_fd ? 0 :
SSL_CTX_sess_hits(ssl_acceptor_fd->
- ssl_context_)),
+ ssl_context)),
buff, 10);
break;
case SHOW_SSL_CTX_SESS_CACHE_FULL:
end= int10_to_str((long) (!ssl_acceptor_fd ? 0 :
SSL_CTX_sess_cache_full(ssl_acceptor_fd->
- ssl_context_)),
+ ssl_context)),
buff, 10);
break;
case SHOW_SSL_CTX_SESS_MISSES:
end= int10_to_str((long) (!ssl_acceptor_fd ? 0 :
SSL_CTX_sess_misses(ssl_acceptor_fd->
- ssl_context_)),
+ ssl_context)),
buff, 10);
break;
case SHOW_SSL_CTX_SESS_TIMEOUTS:
end= int10_to_str((long) (!ssl_acceptor_fd ? 0 :
- SSL_CTX_sess_timeouts(ssl_acceptor_fd->ssl_context_)),
+ SSL_CTX_sess_timeouts(ssl_acceptor_fd->ssl_context)),
buff,10);
break;
case SHOW_SSL_CTX_SESS_NUMBER:
end= int10_to_str((long) (!ssl_acceptor_fd ? 0 :
- SSL_CTX_sess_number(ssl_acceptor_fd->ssl_context_)),
+ SSL_CTX_sess_number(ssl_acceptor_fd->ssl_context)),
buff,10);
break;
case SHOW_SSL_CTX_SESS_CONNECT:
end= int10_to_str((long) (!ssl_acceptor_fd ? 0 :
- SSL_CTX_sess_connect(ssl_acceptor_fd->ssl_context_)),
+ SSL_CTX_sess_connect(ssl_acceptor_fd->ssl_context)),
buff,10);
break;
case SHOW_SSL_CTX_SESS_GET_CACHE_SIZE:
end= int10_to_str((long) (!ssl_acceptor_fd ? 0 :
- SSL_CTX_sess_get_cache_size(ssl_acceptor_fd->ssl_context_)),
+ SSL_CTX_sess_get_cache_size(ssl_acceptor_fd->ssl_context)),
buff,10);
break;
case SHOW_SSL_CTX_GET_VERIFY_MODE:
end= int10_to_str((long) (!ssl_acceptor_fd ? 0 :
- SSL_CTX_get_verify_mode(ssl_acceptor_fd->ssl_context_)),
+ SSL_CTX_get_verify_mode(ssl_acceptor_fd->ssl_context)),
buff,10);
break;
case SHOW_SSL_CTX_GET_VERIFY_DEPTH:
end= int10_to_str((long) (!ssl_acceptor_fd ? 0 :
- SSL_CTX_get_verify_depth(ssl_acceptor_fd->ssl_context_)),
+ SSL_CTX_get_verify_depth(ssl_acceptor_fd->ssl_context)),
buff,10);
break;
case SHOW_SSL_CTX_GET_SESSION_CACHE_MODE:
@@ -1711,7 +1765,7 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables,
end= pos+4;
break;
}
- switch (SSL_CTX_get_session_cache_mode(ssl_acceptor_fd->ssl_context_))
+ switch (SSL_CTX_get_session_cache_mode(ssl_acceptor_fd->ssl_context))
{
case SSL_SESS_CACHE_OFF:
pos= "OFF";
@@ -1739,40 +1793,50 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables,
break;
/* First group - functions relying on SSL */
case SHOW_SSL_GET_VERSION:
- pos= thd->net.vio->ssl_ ? SSL_get_version(thd->net.vio->ssl_) : "";
+ pos= (thd->net.vio->ssl_arg ?
+ SSL_get_version((SSL*) thd->net.vio->ssl_arg) : "");
end= strend(pos);
break;
case SHOW_SSL_SESSION_REUSED:
- end= int10_to_str((long) (thd->net.vio->ssl_ ?
- SSL_session_reused(thd->net.vio->ssl_):
- 0), buff, 10);
+ end= int10_to_str((long) (thd->net.vio->ssl_arg ?
+ SSL_session_reused((SSL*) thd->net.vio->
+ ssl_arg) :
+ 0),
+ buff, 10);
break;
case SHOW_SSL_GET_DEFAULT_TIMEOUT:
- end= int10_to_str((long) (thd->net.vio->ssl_ ?
- SSL_get_default_timeout(thd->net.vio->ssl_):
- 0), buff, 10);
+ end= int10_to_str((long) (thd->net.vio->ssl_arg ?
+ SSL_get_default_timeout((SSL*) thd->net.vio->
+ ssl_arg) :
+ 0),
+ buff, 10);
break;
case SHOW_SSL_GET_VERIFY_MODE:
- end= int10_to_str((long) (thd->net.vio->ssl_ ?
- SSL_get_verify_mode(thd->net.vio->ssl_):
- 0), buff, 10);
+ end= int10_to_str((long) (thd->net.vio->ssl_arg ?
+ SSL_get_verify_mode((SSL*) thd->net.vio->
+ ssl_arg):
+ 0),
+ buff, 10);
break;
case SHOW_SSL_GET_VERIFY_DEPTH:
- end= int10_to_str((long) (thd->net.vio->ssl_ ?
- SSL_get_verify_depth(thd->net.vio->ssl_):
- 0), buff, 10);
+ end= int10_to_str((long) (thd->net.vio->ssl_arg ?
+ SSL_get_verify_depth((SSL*) thd->net.vio->
+ ssl_arg):
+ 0),
+ buff, 10);
break;
case SHOW_SSL_GET_CIPHER:
- pos= thd->net.vio->ssl_ ? SSL_get_cipher(thd->net.vio->ssl_) : "";
+ pos= (thd->net.vio->ssl_arg ?
+ SSL_get_cipher((SSL*) thd->net.vio->ssl_arg) : "" );
end= strend(pos);
break;
case SHOW_SSL_GET_CIPHER_LIST:
- if (thd->net.vio->ssl_)
+ if (thd->net.vio->ssl_arg)
{
char *to= buff;
for (int i=0 ; i++ ;)
{
- const char *p= SSL_get_cipher_list(thd->net.vio->ssl_,i);
+ const char *p= SSL_get_cipher_list((SSL*) thd->net.vio->ssl_arg,i);
if (p == NULL)
break;
to= strmov(to, p);
@@ -1796,14 +1860,12 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables,
goto err; /* purecov: inspected */
}
}
- pthread_mutex_unlock(&LOCK_status);
- /* pthread_mutex_unlock(&THR_LOCK_keycache); */
+ pthread_mutex_unlock(mutex);
send_eof(thd);
DBUG_RETURN(0);
err:
- pthread_mutex_unlock(&LOCK_status);
- /* pthread_mutex_unlock(&THR_LOCK_keycache); */
+ pthread_mutex_unlock(mutex);
DBUG_RETURN(1);
}
diff --git a/sql/sql_string.cc b/sql/sql_string.cc
index e7d7b08c93c..be9404ce0b8 100644
--- a/sql/sql_string.cc
+++ b/sql/sql_string.cc
@@ -28,6 +28,11 @@
#include <floatingpoint.h>
#endif
+/*
+ The following extern declarations are ok as these are interface functions
+ required by the string function
+*/
+
extern gptr sql_alloc(unsigned size);
extern void sql_element_free(void *ptr);
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 9990ac87ad0..530914b894c 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -29,7 +29,6 @@
#include <io.h>
#endif
-extern HASH open_cache;
static const char *primary_key_name="PRIMARY";
static bool check_if_keyname_exists(const char *name,KEY *start, KEY *end);
@@ -350,10 +349,10 @@ static int sort_keys(KEY *a, KEY *b)
fields List of fields to create
keys List of keys to create
tmp_table Set to 1 if this is an internal temporary table
- (From ALTER TABLE)
+ (From ALTER TABLE)
no_log Don't log the query to binary log.
- DESCRIPTION
+ DESCRIPTION
If one creates a temporary table, this is automaticly opened
no_log is needed for the case of CREATE ... SELECT,
@@ -422,6 +421,10 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
for (field_no=0; (sql_field=it++) ; field_no++)
{
+ if (!sql_field->charset)
+ sql_field->charset= create_info->table_charset;
+ sql_field->create_length_to_internal_length();
+
/* Don't pack keys in old tables if the user has requested this */
if ((sql_field->flags & BLOB_FLAG) ||
sql_field->sql_type == FIELD_TYPE_VAR_STRING &&
@@ -672,11 +675,11 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
/*
Make SPATIAL to be RTREE by default
SPATIAL only on BLOB or at least BINARY, this
- actually should be replaced by special GEOM type
+ actually should be replaced by special GEOM type
in near future when new frm file is ready
checking for proper key parts number:
*/
-
+
if (key_info->flags == HA_SPATIAL)
{
if (key_info->key_parts != 1)
@@ -699,7 +702,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
MYF(0), "RTREE INDEX");
DBUG_RETURN(-1);
}
-
+
List_iterator<key_part_spec> cols(key->columns);
for (uint column_nr=0 ; (column=cols++) ; column_nr++)
{
@@ -725,6 +728,9 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
*/
if (key->type == Key::FULLTEXT)
column->length=test(f_is_blob(sql_field->pack_flag));
+ else
+ column->length*= sql_field->charset->mbmaxlen;
+
if (f_is_blob(sql_field->pack_flag))
{
if (!(file->table_flags() & HA_BLOB_KEY))
@@ -745,9 +751,9 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
{
if (!column->length )
{
- /*
+ /*
BAR: 4 is: (Xmin,Xmax,Ymin,Ymax), this is for 2D case
- Lately we'll extend this code to support more dimensions
+ Lately we'll extend this code to support more dimensions
*/
column->length=4*sizeof(double);
}
@@ -798,7 +804,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
{
}
else if (column->length > length ||
- ((f_is_packed(sql_field->pack_flag) ||
+ ((f_is_packed(sql_field->pack_flag) ||
((file->table_flags() & HA_NO_PREFIX_CHAR_KEYS) &&
(key_info->flags & HA_NOSAME))) &&
column->length != length))
@@ -899,22 +905,27 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name);
DBUG_RETURN(-1);
}
+ if (wait_if_global_read_lock(thd, 0))
+ DBUG_RETURN(error);
VOID(pthread_mutex_lock(&LOCK_open));
if (!tmp_table && !(create_info->options & HA_LEX_CREATE_TMP_TABLE))
{
if (!access(path,F_OK))
{
- VOID(pthread_mutex_unlock(&LOCK_open));
if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS)
- DBUG_RETURN(0);
- my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name);
- DBUG_RETURN(-1);
+ error= 0;
+ else
+ my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name);
+ goto end;
}
}
thd->proc_info="creating table";
+ if (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE)
+ create_info->data_file_name= create_info->index_file_name= 0;
create_info->table_options=db_options;
+
if (rea_create_table(thd, path, create_info, fields, key_count,
key_info_buffer))
{
@@ -946,6 +957,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
error=0;
end:
VOID(pthread_mutex_unlock(&LOCK_open));
+ start_waiting_global_read_lock(thd);
thd->proc_info="After create";
DBUG_RETURN(error);
}
@@ -2019,19 +2031,6 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
List<Key> key_list; // Add new keys here
create_field *def;
- /*
- For each column set charset to the table
- default if the column charset hasn't been specified
- explicitely. Change CREATE length into internal length
- */
- def_it.rewind();
- while ((def= def_it++))
- {
- if (!def->charset)
- def->charset= create_info->table_charset;
- def->create_length_to_internal_length();
- }
-
/*
First collect all fields from table which isn't in drop_list
*/
@@ -2208,10 +2207,11 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
{ // Check if sub key
if (cfield->field->type() != FIELD_TYPE_BLOB &&
(cfield->field->pack_length() == key_part_length ||
- cfield->length != cfield->pack_length ||
- cfield->pack_length <= key_part_length))
+ cfield->length <= key_part_length /
+ key_part->field->charset()->mbmaxlen))
key_part_length=0; // Use whole field
}
+ key_part_length /= key_part->field->charset()->mbmaxlen;
key_parts.push_back(new key_part_spec(cfield->field_name,
key_part_length));
}
@@ -2664,7 +2664,7 @@ copy_data_between_tables(TABLE *from,TABLE *to,
delete_count++;
}
else
- found_count++;
+ found_count++;
}
end_read_record(&info);
free_io_cache(from);
@@ -2696,3 +2696,101 @@ copy_data_between_tables(TABLE *from,TABLE *to,
*deleted=delete_count;
DBUG_RETURN(error > 0 ? -1 : 0);
}
+
+
+int mysql_checksum_table(THD *thd, TABLE_LIST *tables, HA_CHECK_OPT *check_opt)
+{
+ TABLE_LIST *table;
+ List<Item> field_list;
+ Item *item;
+ Protocol *protocol= thd->protocol;
+ DBUG_ENTER("mysql_admin_table");
+
+ field_list.push_back(item = new Item_empty_string("Table", NAME_LEN*2));
+ item->maybe_null= 1;
+ field_list.push_back(item=new Item_int("Checksum",(longlong) 1,21));
+ item->maybe_null= 1;
+ if (protocol->send_fields(&field_list, 1))
+ DBUG_RETURN(-1);
+
+ for (table= tables; table; table= table->next)
+ {
+ char table_name[NAME_LEN*2+2];
+ bool fatal_error= 0;
+ TABLE *t;
+
+ strxmov(table_name, table->db ,".", table->real_name, NullS);
+
+ t= table->table= open_ltable(thd, table, TL_READ_NO_INSERT);
+ thd->clear_error(); // these errors shouldn't get client
+
+ protocol->prepare_for_resend();
+ protocol->store(table_name, system_charset_info);
+
+ if (!t)
+ {
+ /* Table didn't exist */
+ protocol->store_null();
+ thd->net.last_error[0]=0;
+ }
+ else
+ {
+ t->pos_in_table_list= table;
+
+ if (t->file->table_flags() & HA_HAS_CHECKSUM &&
+ !(check_opt->flags & T_EXTEND))
+ protocol->store((ulonglong)t->file->checksum());
+ else if (!(t->file->table_flags() & HA_HAS_CHECKSUM) &&
+ (check_opt->flags & T_QUICK))
+ protocol->store_null();
+ else
+ {
+ /* calculating table's checksum */
+ ha_checksum crc= 0;
+ if (t->file->rnd_init(1))
+ protocol->store_null();
+ else
+ {
+ while (!t->file->rnd_next(t->record[0]))
+ {
+ ha_checksum row_crc= 0;
+ if (t->record[0] != t->field[0]->ptr)
+ row_crc= my_checksum(row_crc, t->record[0],
+ t->field[0]->ptr - t->record[0]);
+
+ for (uint i= 0; i < t->fields; i++ )
+ {
+ Field *f= t->field[i];
+ if (f->type() == FIELD_TYPE_BLOB)
+ {
+ String tmp;
+ f->val_str(&tmp,&tmp);
+ row_crc= my_checksum(row_crc, tmp.ptr(), tmp.length());
+ }
+ else
+ row_crc= my_checksum(row_crc, f->ptr, f->pack_length());
+ }
+
+ crc+= row_crc;
+ }
+ protocol->store((ulonglong)crc);
+ }
+ }
+ thd->clear_error();
+ close_thread_tables(thd);
+ table->table=0; // For query cache
+ }
+ if (protocol->write())
+ goto err;
+ }
+
+ send_eof(thd);
+ DBUG_RETURN(0);
+
+ err:
+ close_thread_tables(thd); // Shouldn't be needed
+ if (table)
+ table->table=0;
+ DBUG_RETURN(-1);
+}
+
diff --git a/sql/sql_test.cc b/sql/sql_test.cc
index baf11290489..eb1fb48909a 100644
--- a/sql/sql_test.cc
+++ b/sql/sql_test.cc
@@ -41,7 +41,6 @@ static const char *lock_descriptions[] =
"High priority write lock",
"Highest priority write lock"
};
-extern HASH open_cache;
#ifndef DBUG_OFF
@@ -65,7 +64,6 @@ print_where(COND *cond,const char *info)
}
/* This is for debugging purposes */
-extern TABLE *unused_tables;
void print_cached_tables(void)
{
diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc
index d191550f396..c237b023e7b 100644
--- a/sql/sql_udf.cc
+++ b/sql/sql_udf.cc
@@ -92,10 +92,13 @@ static void init_syms(udf_func *tmp)
tmp->func_deinit = dlsym(tmp->dlhandle, nm);
if (tmp->type == UDFTYPE_AGGREGATE)
{
- (void)strmov( end, "_reset" );
- tmp->func_reset = dlsym( tmp->dlhandle, nm );
+ (void)strmov( end, "_clear" );
+ tmp->func_clear = dlsym( tmp->dlhandle, nm );
(void)strmov( end, "_add" );
tmp->func_add = dlsym( tmp->dlhandle, nm );
+ /* Give error if _clear and _add doesn't exists */
+ if (!tmp->func_clear || ! tmp->func_add)
+ tmp->func= 0;
}
}
@@ -342,7 +345,7 @@ static udf_func *add_udf(LEX_STRING *name, Item_result ret, char *dl,
tmp->returns = ret;
tmp->type = type;
tmp->usage_count=1;
- if (hash_insert(&udf_hash,(byte*) tmp))
+ if (my_hash_insert(&udf_hash,(byte*) tmp))
return 0;
using_udf_functions=1;
return tmp;
@@ -417,7 +420,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
u_d->func=udf->func;
u_d->func_init=udf->func_init;
u_d->func_deinit=udf->func_deinit;
- u_d->func_reset=udf->func_reset;
+ u_d->func_clear=udf->func_clear;
u_d->func_add=udf->func_add;
/* create entry in mysql/func table */
@@ -429,7 +432,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
if (!(table = open_ltable(thd,&tables,TL_WRITE)))
goto err;
- restore_record(table,default_values); // Get default values for fields
+ restore_record(table,default_values); // Default values for fields
table->field[0]->store(u_d->name.str, u_d->name.length, system_charset_info);
table->field[1]->store((longlong) u_d->returns);
table->field[2]->store(u_d->dl,(uint) strlen(u_d->dl), system_charset_info);
diff --git a/sql/sql_udf.h b/sql/sql_udf.h
index 29a351ac52f..7b10b80f148 100644
--- a/sql/sql_udf.h
+++ b/sql/sql_udf.h
@@ -33,7 +33,7 @@ typedef struct st_udf_func
void *func;
void *func_init;
void *func_deinit;
- void *func_reset;
+ void *func_clear;
void *func_add;
ulong usage_count;
} udf_func;
@@ -49,7 +49,7 @@ class udf_handler :public Sql_alloc
UDF_ARGS f_args;
UDF_INIT initid;
char *num_buffer;
- uchar error;
+ uchar error, is_null;
bool initialized;
Item **args;
@@ -57,7 +57,7 @@ class udf_handler :public Sql_alloc
table_map used_tables_cache;
bool const_item_cache;
udf_handler(udf_func *udf_arg) :u_d(udf_arg), buffers(0), error(0),
- initialized(0)
+ is_null(0), initialized(0)
{}
~udf_handler();
const char *name() const { return u_d ? u_d->name.str : "?"; }
@@ -73,7 +73,6 @@ class udf_handler :public Sql_alloc
*null_value=1;
return 0.0;
}
- uchar is_null=0;
double (*func)(UDF_INIT *, UDF_ARGS *, uchar *, uchar *)=
(double (*)(UDF_INIT *, UDF_ARGS *, uchar *, uchar *)) u_d->func;
double tmp=func(&initid, &f_args, &is_null, &error);
@@ -92,7 +91,6 @@ class udf_handler :public Sql_alloc
*null_value=1;
return LL(0);
}
- uchar is_null=0;
longlong (*func)(UDF_INIT *, UDF_ARGS *, uchar *, uchar *)=
(longlong (*)(UDF_INIT *, UDF_ARGS *, uchar *, uchar *)) u_d->func;
longlong tmp=func(&initid, &f_args, &is_null, &error);
@@ -104,22 +102,15 @@ class udf_handler :public Sql_alloc
*null_value=0;
return tmp;
}
- void reset(my_bool *null_value)
+ void clear()
{
- uchar is_null=0;
- if (get_arguments())
- {
- *null_value=1;
- return;
- }
- void (*func)(UDF_INIT *, UDF_ARGS *, uchar *, uchar *)=
- (void (*)(UDF_INIT *, UDF_ARGS *, uchar *, uchar *)) u_d->func_reset;
- func(&initid, &f_args, &is_null, &error);
- *null_value= (my_bool) (is_null || error);
+ is_null= 0;
+ void (*func)(UDF_INIT *, uchar *, uchar *)=
+ (void (*)(UDF_INIT *, uchar *, uchar *)) u_d->func_clear;
+ func(&initid, &is_null, &error);
}
void add(my_bool *null_value)
{
- uchar is_null=0;
if (get_arguments())
{
*null_value=1;
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index ae91b0b3ace..ae596625bf7 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -116,21 +116,20 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result,
bool tables_and_fields_initied)
{
SELECT_LEX *lex_select_save= thd->lex.current_select;
- SELECT_LEX *select_cursor;
+ SELECT_LEX *select_cursor,*sl;
DBUG_ENTER("st_select_lex_unit::prepare");
if (prepared)
DBUG_RETURN(0);
prepared= 1;
res= 0;
- found_rows_for_union= test(first_select_in_union()->options
- & OPTION_FOUND_ROWS);
+ found_rows_for_union= first_select_in_union()->options & OPTION_FOUND_ROWS;
TMP_TABLE_PARAM tmp_table_param;
result= sel_result;
t_and_f= tables_and_fields_initied;
bzero((char *)&tmp_table_param,sizeof(TMP_TABLE_PARAM));
- thd->lex.current_select= select_cursor= first_select_in_union();
+ thd->lex.current_select= sl= select_cursor= first_select_in_union();
/* Global option */
if (t_and_f)
{
@@ -185,7 +184,7 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result,
union_result->not_describe=1;
union_result->tmp_table_param=tmp_table_param;
- for (SELECT_LEX *sl= select_cursor; sl; sl= sl->next_select())
+ for (;sl; sl= sl->next_select())
{
JOIN *join= new JOIN(thd, sl->item_list,
sl->options | thd->options | SELECT_NO_UNLOCK,
@@ -195,7 +194,7 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result,
select_limit_cnt= sl->select_limit+sl->offset_limit;
if (select_limit_cnt < sl->select_limit)
select_limit_cnt= HA_POS_ERROR; // no limit
- if (select_limit_cnt == HA_POS_ERROR && !sl->braces)
+ if (select_limit_cnt == HA_POS_ERROR || sl->braces)
sl->options&= ~OPTION_FOUND_ROWS;
res= join->prepare(&sl->ref_pointer_array,
@@ -239,7 +238,7 @@ int st_select_lex_unit::exec()
{
SELECT_LEX *lex_select_save= thd->lex.current_select;
SELECT_LEX *select_cursor=first_select_in_union();
- ha_rows add_rows=0;
+ ulonglong add_rows=0;
DBUG_ENTER("st_select_lex_unit::exec");
if (executed && !(dependent || uncacheable))
@@ -256,29 +255,52 @@ int st_select_lex_unit::exec()
}
for (SELECT_LEX *sl= select_cursor; sl; sl= sl->next_select())
{
- ha_rows rows= 0;
+ ha_rows records_at_start= 0;
thd->lex.current_select= sl;
if (optimized)
res= sl->join->reinit();
else
{
- offset_limit_cnt= sl->offset_limit;
- select_limit_cnt= sl->select_limit+sl->offset_limit;
+ if (sl != global_parameters)
+ {
+ offset_limit_cnt= sl->offset_limit;
+ select_limit_cnt= sl->select_limit+sl->offset_limit;
+ }
+ else
+ {
+ offset_limit_cnt= 0;
+ /*
+ We can't use LIMIT at this stage if we are using ORDER BY for the
+ whole query
+ */
+ if (sl->order_list.first)
+ select_limit_cnt= HA_POS_ERROR;
+ else
+ select_limit_cnt= sl->select_limit+sl->offset_limit;
+ }
if (select_limit_cnt < sl->select_limit)
select_limit_cnt= HA_POS_ERROR; // no limit
- if (select_limit_cnt == HA_POS_ERROR)
+
+ /*
+ When using braces, SQL_CALC_FOUND_ROWS affects the whole query.
+ We don't calculate found_rows() per union part
+ */
+ if (select_limit_cnt == HA_POS_ERROR || sl->braces)
sl->options&= ~OPTION_FOUND_ROWS;
- else if (found_rows_for_union)
+ else
{
- rows= sl->select_limit;
- sl->options|= OPTION_FOUND_ROWS;
+ /*
+ We are doing an union without braces. In this case
+ SQL_CALC_FOUND_ROWS should be done on all sub parts
+ */
+ sl->options|= found_rows_for_union;
}
-
- /*
- As far as union share table space we should reassign table map,
- which can be spoiled by 'prepare' of JOIN of other UNION parts
- if it use same tables
+ sl->join->select_options=sl->options;
+ /*
+ As far as union share table space we should reassign table map,
+ which can be spoiled by 'prepare' of JOIN of other UNION parts
+ if it use same tables
*/
uint tablenr=0;
for (TABLE_LIST *table_list= (TABLE_LIST*) sl->table_list.first;
@@ -301,8 +323,10 @@ int st_select_lex_unit::exec()
}
if (!res)
{
+ records_at_start= table->file->records;
sl->join->exec();
res= sl->join->error;
+ offset_limit_cnt= sl->offset_limit;
if (!res && union_result->flush())
{
thd->lex.current_select= lex_select_save;
@@ -314,10 +338,19 @@ int st_select_lex_unit::exec()
thd->lex.current_select= lex_select_save;
DBUG_RETURN(res);
}
- if (found_rows_for_union && !sl->braces &&
- (sl->options & OPTION_FOUND_ROWS))
- add_rows+= (sl->join->send_records > rows) ?
- sl->join->send_records - rows : 0;
+ /* Needed for the following test and for records_at_start in next loop */
+ table->file->info(HA_STATUS_VARIABLE);
+ if (found_rows_for_union & sl->options)
+ {
+ /*
+ This is a union without braces. Remember the number of rows that
+ could also have been part of the result set.
+ We get this from the difference of between total number of possible
+ rows and actual rows added to the temporary table.
+ */
+ add_rows+= (ulonglong) (thd->limit_found_rows - (ulonglong)
+ ((table->file->records - records_at_start)));
+ }
}
}
optimized= 1;
@@ -330,18 +363,15 @@ int st_select_lex_unit::exec()
List<Item_func_match> empty_list;
empty_list.empty();
- if (!thd->is_fatal_error) // Check if EOM
+ if (!thd->is_fatal_error) // Check if EOM
{
ulong options= thd->options;
thd->lex.current_select= fake_select_lex;
- if (select_cursor->braces)
- {
- offset_limit_cnt= global_parameters->offset_limit;
- select_limit_cnt= global_parameters->select_limit +
- global_parameters->offset_limit;
- if (select_limit_cnt < global_parameters->select_limit)
- select_limit_cnt= HA_POS_ERROR; // no limit
- }
+ offset_limit_cnt= global_parameters->offset_limit;
+ select_limit_cnt= global_parameters->select_limit +
+ global_parameters->offset_limit;
+ if (select_limit_cnt < global_parameters->select_limit)
+ select_limit_cnt= HA_POS_ERROR; // no limit
if (select_limit_cnt == HA_POS_ERROR)
options&= ~OPTION_FOUND_ROWS;
else if (found_rows_for_union && !describe)
@@ -382,12 +412,8 @@ int st_select_lex_unit::exec()
(ORDER*) NULL, NULL, (ORDER*) NULL,
options | SELECT_NO_UNLOCK,
result, this, fake_select_lex, 0);
- if (found_rows_for_union && !res)
- {
- thd->limit_found_rows= table->file->records;
- if (!select_cursor->braces)
- thd->limit_found_rows+= add_rows;
- }
+ if (!res)
+ thd->limit_found_rows = (ulonglong)table->file->records + add_rows;
/*
Mark for slow query log if any of the union parts didn't use
indexes efficiently
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 29138f10989..946107049dc 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -86,8 +86,10 @@ int mysql_update(THD *thd,
/* Calculate "table->used_keys" based on the WHERE */
table->used_keys=table->keys_in_use;
table->quick_keys=0;
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
want_privilege=table->grant.want_privilege;
table->grant.want_privilege=(SELECT_ACL & ~table->grant.privilege);
+#endif
bzero((char*) &tables,sizeof(tables)); // For ORDER BY
tables.table= table;
@@ -122,7 +124,9 @@ int mysql_update(THD *thd,
}
/* Check the fields we are going to modify */
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
table->grant.want_privilege=want_privilege;
+#endif
if (setup_fields(thd, 0, update_table_list, fields, 1, 0, 0))
DBUG_RETURN(-1); /* purecov: inspected */
if (table->timestamp_field)
@@ -134,8 +138,10 @@ int mysql_update(THD *thd,
table->timestamp_field->query_id=timestamp_query_id;
}
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
/* Check values */
table->grant.want_privilege=(SELECT_ACL & ~table->grant.privilege);
+#endif
if (setup_fields(thd, 0, update_table_list, values, 0, 0, 0))
{
free_underlaid_joins(thd, &thd->lex.select_lex);
@@ -418,7 +424,9 @@ int mysql_multi_update(THD *thd,
TABLE_LIST *tl;
DBUG_ENTER("mysql_multi_update");
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
table_list->grant.want_privilege=(SELECT_ACL & ~table_list->grant.privilege);
+#endif
if ((res=open_and_lock_tables(thd,table_list)))
DBUG_RETURN(res);
fix_tables_pointers(thd->lex.all_selects_list);
@@ -600,6 +608,7 @@ multi_update::initialize_tables(JOIN *join)
{
TABLE *table=table_ref->table;
uint cnt= table_ref->shared;
+ Item_field *If;
List<Item> temp_fields= *fields_for_table[cnt];
ORDER group;
@@ -623,7 +632,10 @@ 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);
- if (temp_fields.push_front(new Item_field(((Field *) &offset))))
+ if (!(If=new Item_field(((Field *) &offset))))
+ DBUG_RETURN(1);
+ If->maybe_null=0;
+ if (temp_fields.push_front(If))
DBUG_RETURN(1);
/* Make an unique key over the first field to avoid duplicated updates */
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 24ffd669351..2334f151ca9 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -38,7 +38,6 @@
#include <myisam.h>
#include <myisammrg.h>
-extern void yyerror(const char*);
int yylex(void *yylval, void *yythd);
#define yyoverflow(A,B,C,D,E,F) if (my_yyoverflow((B),(D),(int*) (F))) { yyerror((char*) (A)); return 2; }
@@ -168,6 +167,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token SUPER_SYM
%token TRUNCATE_SYM
%token UNLOCK_SYM
+%token UNTIL_SYM
%token UPDATE_SYM
%token ACTION
@@ -277,6 +277,12 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token MASTER_PORT_SYM
%token MASTER_CONNECT_RETRY_SYM
%token MASTER_SERVER_ID_SYM
+%token MASTER_SSL_SYM
+%token MASTER_SSL_CA_SYM
+%token MASTER_SSL_CAPATH_SYM
+%token MASTER_SSL_CERT_SYM
+%token MASTER_SSL_CIPHER_SYM
+%token MASTER_SSL_KEY_SYM
%token RELAY_LOG_FILE_SYM
%token RELAY_LOG_POS_SYM
%token MATCH
@@ -295,6 +301,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token NEW_SYM
%token NCHAR_SYM
%token NCHAR_STRING
+%token NVARCHAR_SYM
%token NOT
%token NO_SYM
%token NULL_SYM
@@ -500,6 +507,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token MULTIPOINT
%token MULTIPOLYGON
%token NOW_SYM
+%token OLD_PASSWORD
%token PASSWORD
%token POINTFROMTEXT
%token POINT_SYM
@@ -670,8 +678,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
insert_values update delete truncate rename
show describe load alter optimize keycache preload flush
reset purge begin commit rollback savepoint
- slave master_def master_defs
- repair restore backup analyze check start
+ slave master_def master_defs master_file_def
+ repair restore backup analyze check start checksum
field_list field_list_item field_spec kill column_def key_def
keycache_list assign_to_keycache preload_list preload_keys
select_item_list select_item values_list no_braces
@@ -729,24 +737,27 @@ verb_clause:
| begin
| change
| check
+ | checksum
| commit
| create
| delete
| describe
| do
| drop
+ | flush
| grant
+ | handler
+ | help
| insert
- | flush
+ | kill
| load
| lock
- | kill
| optimize
| keycache
| preload
| purge
| rename
- | repair
+ | repair
| replace
| reset
| restore
@@ -755,15 +766,14 @@ verb_clause:
| savepoint
| select
| set
+ | show
| slave
| start
- | show
| truncate
- | handler
| unlock
| update
| use
- | help;
+ ;
/* help */
@@ -808,52 +818,77 @@ master_def:
Lex->mi.password = $3.str;
}
|
- MASTER_LOG_FILE_SYM EQ TEXT_STRING_sys
- {
- Lex->mi.log_file_name = $3.str;
- }
- |
MASTER_PORT_SYM EQ ULONG_NUM
{
Lex->mi.port = $3;
}
|
- MASTER_LOG_POS_SYM EQ ulonglong_num
- {
- Lex->mi.pos = $3;
- /*
- If the user specified a value < BIN_LOG_HEADER_SIZE, adjust it
- instead of causing subsequent errors.
- We need to do it in this file, because only there we know that
- MASTER_LOG_POS has been explicitely specified. On the contrary
- in change_master() (sql_repl.cc) we cannot distinguish between 0
- (MASTER_LOG_POS explicitely specified as 0) and 0 (unspecified),
- whereas we want to distinguish (specified 0 means "read the binlog
- from 0" (4 in fact), unspecified means "don't change the position
- (keep the preceding value)").
- */
- Lex->mi.pos = max(BIN_LOG_HEADER_SIZE, Lex->mi.pos);
- }
- |
MASTER_CONNECT_RETRY_SYM EQ ULONG_NUM
{
Lex->mi.connect_retry = $3;
}
+ | MASTER_SSL_SYM EQ ULONG_NUM
+ {
+ Lex->mi.ssl= $3 ?
+ LEX_MASTER_INFO::SSL_ENABLE : LEX_MASTER_INFO::SSL_DISABLE;
+ }
+ | MASTER_SSL_CA_SYM EQ TEXT_STRING_sys
+ {
+ Lex->mi.ssl_ca= $3.str;
+ }
+ | MASTER_SSL_CAPATH_SYM EQ TEXT_STRING_sys
+ {
+ Lex->mi.ssl_capath= $3.str;
+ }
+ | MASTER_SSL_CERT_SYM EQ TEXT_STRING_sys
+ {
+ Lex->mi.ssl_cert= $3.str;
+ }
+ | MASTER_SSL_CIPHER_SYM EQ TEXT_STRING_sys
+ {
+ Lex->mi.ssl_cipher= $3.str;
+ }
+ | MASTER_SSL_KEY_SYM EQ TEXT_STRING_sys
+ {
+ Lex->mi.ssl_key= $3.str;
+ }
|
- RELAY_LOG_FILE_SYM EQ TEXT_STRING_sys
- {
- Lex->mi.relay_log_name = $3.str;
- }
- |
- RELAY_LOG_POS_SYM EQ ULONG_NUM
+ master_file_def
+ ;
+
+master_file_def:
+ MASTER_LOG_FILE_SYM EQ TEXT_STRING_sys
{
- Lex->mi.relay_log_pos = $3;
- /* Adjust if < BIN_LOG_HEADER_SIZE (same comment as Lex->mi.pos) */
- Lex->mi.relay_log_pos = max(BIN_LOG_HEADER_SIZE, Lex->mi.relay_log_pos);
+ Lex->mi.log_file_name = $3.str;
}
+ | MASTER_LOG_POS_SYM EQ ulonglong_num
+ {
+ Lex->mi.pos = $3;
+ /*
+ If the user specified a value < BIN_LOG_HEADER_SIZE, adjust it
+ instead of causing subsequent errors.
+ We need to do it in this file, because only there we know that
+ MASTER_LOG_POS has been explicitely specified. On the contrary
+ in change_master() (sql_repl.cc) we cannot distinguish between 0
+ (MASTER_LOG_POS explicitely specified as 0) and 0 (unspecified),
+ whereas we want to distinguish (specified 0 means "read the binlog
+ from 0" (4 in fact), unspecified means "don't change the position
+ (keep the preceding value)").
+ */
+ Lex->mi.pos = max(BIN_LOG_HEADER_SIZE, Lex->mi.pos);
+ }
+ | RELAY_LOG_FILE_SYM EQ TEXT_STRING_sys
+ {
+ Lex->mi.relay_log_name = $3.str;
+ }
+ | RELAY_LOG_POS_SYM EQ ULONG_NUM
+ {
+ Lex->mi.relay_log_pos = $3;
+ /* Adjust if < BIN_LOG_HEADER_SIZE (same comment as Lex->mi.pos) */
+ Lex->mi.relay_log_pos = max(BIN_LOG_HEADER_SIZE, Lex->mi.relay_log_pos);
+ }
;
-
/* create a table */
create:
@@ -879,7 +914,7 @@ create:
bzero((char*) &lex->create_info,sizeof(lex->create_info));
lex->create_info.options=$2 | $4;
lex->create_info.db_type= (enum db_type) lex->thd->variables.table_type;
- lex->create_info.table_charset= thd->variables.character_set_database;
+ lex->create_info.table_charset= thd->variables.collation_database;
lex->name=0;
}
create2
@@ -1100,7 +1135,7 @@ opt_select_from:
| select_from select_lock_type;
udf_func_type:
- /* empty */ { $$ = UDFTYPE_FUNCTION; }
+ /* empty */ { $$ = UDFTYPE_FUNCTION; }
| AGGREGATE_SYM { $$ = UDFTYPE_AGGREGATE; };
udf_type:
@@ -1164,7 +1199,8 @@ field_spec:
{
LEX *lex=Lex;
lex->length=lex->dec=0; lex->type=0; lex->interval=0;
- lex->default_value=lex->comment=0;
+ lex->default_value=0;
+ lex->comment=0;
lex->charset=NULL;
}
type opt_attribute
@@ -1305,6 +1341,7 @@ varchar:
nvarchar:
NATIONAL_SYM VARCHAR {}
+ | NVARCHAR_SYM {}
| NCHAR_SYM VARCHAR {}
| NATIONAL_SYM CHAR_SYM VARYING {}
| NCHAR_SYM VARYING {}
@@ -1375,7 +1412,7 @@ attribute:
| opt_primary KEY_SYM { Lex->type|= PRI_KEY_FLAG | NOT_NULL_FLAG; }
| UNIQUE_SYM { Lex->type|= UNIQUE_FLAG; }
| UNIQUE_SYM KEY_SYM { Lex->type|= UNIQUE_KEY_FLAG; }
- | COMMENT_SYM text_literal { Lex->comment= $2; }
+ | COMMENT_SYM TEXT_STRING_sys { Lex->comment= &$2; }
| COLLATE_SYM collation_name
{
if (Lex->charset && !my_charset_same(Lex->charset,$2))
@@ -1567,7 +1604,7 @@ opt_ident:
opt_component:
/* empty */ { $$.str= 0; $$.length= 0; }
| '.' ident { $$=$2; };
-
+
string_list:
text_string { Lex->interval_list.push_back($1); }
| string_list ',' text_string { Lex->interval_list.push_back($3); };
@@ -1596,7 +1633,7 @@ alter:
lex->select_lex.db=lex->name=0;
bzero((char*) &lex->create_info,sizeof(lex->create_info));
lex->create_info.db_type= DB_TYPE_DEFAULT;
- lex->create_info.table_charset= thd->variables.character_set_database;
+ lex->create_info.table_charset= thd->variables.collation_database;
lex->create_info.row_type= ROW_TYPE_NOT_USED;
lex->alter_keys_onoff=LEAVE_AS_IS;
lex->simple_alter=1;
@@ -1632,7 +1669,8 @@ alter_list_item:
{
LEX *lex=Lex;
lex->length=lex->dec=0; lex->type=0; lex->interval=0;
- lex->default_value=lex->comment=0;
+ lex->default_value=0;
+ lex->comment=0;
lex->charset= NULL;
lex->simple_alter=0;
}
@@ -1715,23 +1753,41 @@ opt_to:
| AS {};
/*
- The first two deprecate the last two--delete the last two for 4.1 release
+ SLAVE START and SLAVE STOP are deprecated. We keep them for compatibility.
+ To use UNTIL, one must use START SLAVE, not SLAVE START.
*/
slave:
- START_SYM SLAVE slave_thread_opts
- {
- LEX *lex=Lex;
- lex->sql_command = SQLCOM_SLAVE_START;
- lex->type = 0;
- }
+ START_SYM SLAVE slave_thread_opts
+ {
+ LEX *lex=Lex;
+ lex->sql_command = SQLCOM_SLAVE_START;
+ lex->type = 0;
+ /* We'll use mi structure for UNTIL options */
+ bzero((char*) &lex->mi, sizeof(lex->mi));
+ }
+ slave_until
+ {}
| STOP_SYM SLAVE slave_thread_opts
{
LEX *lex=Lex;
lex->sql_command = SQLCOM_SLAVE_STOP;
lex->type = 0;
}
- ;
+ | SLAVE START_SYM slave_thread_opts
+ {
+ LEX *lex=Lex;
+ lex->sql_command = SQLCOM_SLAVE_START;
+ lex->type = 0;
+ }
+ | SLAVE STOP_SYM slave_thread_opts
+ {
+ LEX *lex=Lex;
+ lex->sql_command = SQLCOM_SLAVE_STOP;
+ lex->type = 0;
+ }
+ ;
+
start:
START_SYM TRANSACTION_SYM { Lex->sql_command = SQLCOM_BEGIN;}
@@ -1741,6 +1797,7 @@ start:
slave_thread_opts:
{ Lex->slave_thd_opt= 0; }
slave_thread_opt_list
+ {}
;
slave_thread_opt_list:
@@ -1754,6 +1811,28 @@ slave_thread_opt:
| RELAY_THREAD { Lex->slave_thd_opt|=SLAVE_IO; }
;
+slave_until:
+ /*empty*/ {}
+ | UNTIL_SYM slave_until_opts
+ {
+ LEX *lex=Lex;
+ if ((lex->mi.log_file_name || lex->mi.pos) &&
+ (lex->mi.relay_log_name || lex->mi.relay_log_pos) ||
+ !((lex->mi.log_file_name && lex->mi.pos) ||
+ (lex->mi.relay_log_name && lex->mi.relay_log_pos)))
+ {
+ send_error(lex->thd, ER_BAD_SLAVE_UNTIL_COND);
+ YYABORT;
+ }
+
+ }
+ ;
+
+slave_until_opts:
+ master_file_def
+ | slave_until_opts ',' master_file_def ;
+
+
restore:
RESTORE_SYM table_or_tables
{
@@ -1774,6 +1853,22 @@ backup:
Lex->backup_dir = $6.str;
};
+checksum:
+ CHECKSUM_SYM table_or_tables
+ {
+ LEX *lex=Lex;
+ lex->sql_command = SQLCOM_CHECKSUM;
+ }
+ table_list opt_checksum_type
+ {}
+ ;
+
+opt_checksum_type:
+ /* nothing */ { Lex->check_opt.flags= 0; }
+ | QUICK { Lex->check_opt.flags= T_QUICK; }
+ | EXTENDED_SYM { Lex->check_opt.flags= T_EXTEND; }
+ ;
+
repair:
REPAIR opt_no_write_to_binlog table_or_tables
{
@@ -2002,8 +2097,9 @@ select_init:
YYABORT;
}
/* select in braces, can't contain global parameters */
- sel->master_unit()->global_parameters=
- sel->master_unit()->fake_select_lex;
+ if (sel->master_unit()->fake_select_lex)
+ sel->master_unit()->global_parameters=
+ sel->master_unit()->fake_select_lex;
} union_opt;
select_init2:
@@ -2616,9 +2712,13 @@ simple_expr:
| NOW_SYM '(' expr ')'
{ $$= new Item_func_now_local($3); Lex->safe_to_cache_query=0;}
| PASSWORD '(' expr ')'
- { $$= new Item_func_password($3); }
- | PASSWORD '(' expr ',' expr ')'
- { $$= new Item_func_password($3,$5); }
+ {
+ $$= YYTHD->variables.old_passwords ?
+ (Item *) new Item_func_old_password($3) :
+ (Item *) new Item_func_password($3);
+ }
+ | OLD_PASSWORD '(' expr ')'
+ { $$= new Item_func_old_password($3); }
| POINT_SYM '(' expr ',' expr ')'
{ $$= new Item_func_point($3,$5); }
| POINTFROMTEXT '(' expr ')'
@@ -3422,7 +3522,7 @@ do: DO_SYM
*/
drop:
- DROP opt_temporary TABLE_SYM if_exists table_list opt_restrict
+ DROP opt_temporary table_or_tables if_exists table_list opt_restrict
{
LEX *lex=Lex;
lex->sql_command = SQLCOM_DROP_TABLE;
@@ -4449,6 +4549,7 @@ keyword:
| DYNAMIC_SYM {}
| END {}
| ENUM {}
+ | ERRORS {}
| ESCAPE_SYM {}
| EVENTS_SYM {}
| EXECUTE_SYM {}
@@ -4495,6 +4596,12 @@ keyword:
| MASTER_USER_SYM {}
| MASTER_PASSWORD_SYM {}
| MASTER_CONNECT_RETRY_SYM {}
+ | MASTER_SSL_SYM {}
+ | MASTER_SSL_CA_SYM {}
+ | MASTER_SSL_CAPATH_SYM {}
+ | MASTER_SSL_CERT_SYM {}
+ | MASTER_SSL_CIPHER_SYM {}
+ | MASTER_SSL_KEY_SYM {}
| MAX_CONNECTIONS_PER_HOUR {}
| MAX_QUERIES_PER_HOUR {}
| MAX_UPDATES_PER_HOUR {}
@@ -4518,7 +4625,9 @@ keyword:
| NEW_SYM {}
| NO_SYM {}
| NONE_SYM {}
+ | NVARCHAR_SYM {}
| OFFSET_SYM {}
+ | OLD_PASSWORD {}
| OPEN_SYM {}
| PACK_KEYS_SYM {}
| PARTIAL {}
@@ -4582,10 +4691,12 @@ keyword:
| UDF_SYM {}
| UNCOMMITTED_SYM {}
| UNICODE_SYM {}
+ | UNTIL_SYM {}
| USER {}
| USE_FRM {}
| VARIABLES {}
| VALUE_SYM {}
+ | WARNINGS {}
| WORK_SYM {}
| X509_SYM {}
| YEAR_SYM {}
@@ -4667,7 +4778,7 @@ option_value:
THD *thd= YYTHD;
LEX *lex= Lex;
$2= $2 ? $2: global_system_variables.character_set_client;
- lex->var_list.push_back(new set_var_collation_client($2,thd->variables.character_set_database,$2));
+ lex->var_list.push_back(new set_var_collation_client($2,thd->variables.collation_database,$2));
}
| NAMES_SYM charset_name_or_default opt_collate
{
@@ -4742,15 +4853,15 @@ text_or_password:
TEXT_STRING { $$=$1.str;}
| PASSWORD '(' TEXT_STRING ')'
{
- if (!$3.length)
- $$=$3.str;
- else
- {
- char *buff=(char*) YYTHD->alloc(HASH_PASSWORD_LENGTH+1);
- make_scrambled_password(buff,$3.str,use_old_passwords,
- &YYTHD->rand);
- $$=buff;
- }
+ $$= $3.length ? YYTHD->variables.old_passwords ?
+ Item_func_old_password::alloc(YYTHD, $3.str) :
+ Item_func_password::alloc(YYTHD, $3.str) :
+ $3.str;
+ }
+ | OLD_PASSWORD '(' TEXT_STRING ')'
+ {
+ $$= $3.length ? Item_func_old_password::alloc(YYTHD, $3.str) :
+ $3.str;
}
;
@@ -4926,7 +5037,7 @@ grant_privilege_list:
| grant_privilege_list ',' grant_privilege;
grant_privilege:
- SELECT_SYM { Lex->which_columns = SELECT_ACL;} opt_column_list {}
+ SELECT_SYM { Lex->which_columns = SELECT_ACL;} opt_column_list {}
| INSERT { Lex->which_columns = INSERT_ACL;} opt_column_list {}
| UPDATE_SYM { Lex->which_columns = UPDATE_ACL; } opt_column_list {}
| REFERENCES { Lex->which_columns = REFERENCES_ACL;} opt_column_list {}
@@ -5058,14 +5169,24 @@ grant_user:
$$=$1; $1->password=$4;
if ($4.length)
{
- char *buff=(char*) YYTHD->alloc(HASH_PASSWORD_LENGTH+1);
- if (buff)
- {
- make_scrambled_password(buff,$4.str,use_old_passwords,
- &YYTHD->rand);
- $1->password.str=buff;
- $1->password.length=HASH_PASSWORD_LENGTH;
- }
+ if (YYTHD->variables.old_passwords)
+ {
+ char *buff=
+ (char *) YYTHD->alloc(SCRAMBLED_PASSWORD_CHAR_LENGTH_323+1);
+ if (buff)
+ make_scrambled_password_323(buff, $4.str);
+ $1->password.str= buff;
+ $1->password.length= SCRAMBLED_PASSWORD_CHAR_LENGTH_323;
+ }
+ else
+ {
+ char *buff=
+ (char *) YYTHD->alloc(SCRAMBLED_PASSWORD_CHAR_LENGTH+1);
+ if (buff)
+ make_scrambled_password(buff, $4.str);
+ $1->password.str= buff;
+ $1->password.length= SCRAMBLED_PASSWORD_CHAR_LENGTH;
+ }
}
}
| user IDENTIFIED_SYM BY PASSWORD TEXT_STRING
@@ -5224,7 +5345,7 @@ union_opt:
;
optional_order_or_limit:
- /* Empty */ {}
+ /* Empty */ {}
|
{
THD *thd= YYTHD;
@@ -5233,9 +5354,12 @@ optional_order_or_limit:
SELECT_LEX *sel= lex->current_select;
SELECT_LEX_UNIT *unit= sel->master_unit();
SELECT_LEX *fake= unit->fake_select_lex;
- unit->global_parameters= fake;
- fake->no_table_names_allowed= 1;
- lex->current_select= fake;
+ if (fake)
+ {
+ unit->global_parameters= fake;
+ fake->no_table_names_allowed= 1;
+ lex->current_select= fake;
+ }
thd->where= "global ORDER clause";
}
order_or_limit
@@ -5319,3 +5443,4 @@ subselect_end:
LEX *lex=Lex;
lex->current_select = lex->current_select->return_after_parsing();
};
+
diff --git a/sql/table.cc b/sql/table.cc
index a980e086d60..c31b68fc2dc 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -236,7 +236,6 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
#ifdef HAVE_CRYPTED_FRM
else if (*(head+26) == 2)
{
- extern SQL_CRYPT *get_crypt_for_frm(void);
my_pthread_setspecific_ptr(THR_MALLOC,old_root);
crypted=get_crypt_for_frm();
my_pthread_setspecific_ptr(THR_MALLOC,&outparam->mem_root);
@@ -459,7 +458,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
if (outparam->timestamp_field == reg_field)
outparam->timestamp_field_offset=i;
if (use_hash)
- (void) hash_insert(&outparam->name_hash,(byte*) *field_ptr); // Will never fail
+ (void) my_hash_insert(&outparam->name_hash,(byte*) *field_ptr); // Will never fail
}
*field_ptr=0; // End marker
diff --git a/sql/udf_example.cc b/sql/udf_example.cc
index 7f4417bf8fe..ba056a9d2fd 100644
--- a/sql/udf_example.cc
+++ b/sql/udf_example.cc
@@ -149,6 +149,7 @@ longlong sequence(UDF_INIT *initid, UDF_ARGS *args, char *is_null,
my_bool avgcost_init( UDF_INIT* initid, UDF_ARGS* args, char* message );
void avgcost_deinit( UDF_INIT* initid );
void avgcost_reset( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error );
+void avgcost_clear( UDF_INIT* initid, char* is_null, char *error );
void avgcost_add( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error );
double avgcost( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error );
}
@@ -902,21 +903,29 @@ avgcost_deinit( UDF_INIT* initid )
delete initid->ptr;
}
+
+/* This is only for MySQL 4.0 compability */
void
-avgcost_reset( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char* message )
+avgcost_reset(UDF_INIT* initid, UDF_ARGS* args, char* is_null, char* message)
{
- struct avgcost_data* data = (struct avgcost_data*)initid->ptr;
- data->totalprice = 0.0;
- data->totalquantity = 0;
- data->count = 0;
+ avgcost_clear(initid, is_null, message);
+ avgcost_add(initid, args, is_null, message);
+}
- *is_null = 0;
- avgcost_add( initid, args, is_null, message );
+/* This is needed to get things to work in MySQL 4.1.1 and above */
+
+void
+avgcost_clear(UDF_INIT* initid, char* is_null, char* message)
+{
+ struct avgcost_data* data = (struct avgcost_data*)initid->ptr;
+ data->totalprice= 0.0;
+ data->totalquantity= 0;
+ data->count= 0;
}
void
-avgcost_add( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char* message )
+avgcost_add(UDF_INIT* initid, UDF_ARGS* args, char* is_null, char* message)
{
if (args->args[0] && args->args[1])
{
diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c
index 88309aadaa0..878493bc31f 100644
--- a/strings/ctype-big5.c
+++ b/strings/ctype-big5.c
@@ -6234,6 +6234,7 @@ static MY_COLLATION_HANDLER my_collation_big5_chinese_ci_handler =
my_like_range_big5,
my_wildcmp_mb,
my_strcasecmp_mb,
+ my_instr_mb,
my_hash_sort_simple
};
@@ -6243,6 +6244,7 @@ static MY_CHARSET_HANDLER my_charset_big5_handler=
mbcharlen_big5,
my_numchars_mb,
my_charpos_mb,
+ my_lengthsp_8bit,
my_mb_wc_big5, /* mb_wc */
my_wc_mb_big5, /* wc_mb */
my_caseup_str_mb,
@@ -6304,7 +6306,7 @@ CHARSET_INFO my_charset_big5_bin=
2, /* mbmaxlen */
0,
&my_charset_big5_handler,
- &my_collation_bin_handler
+ &my_collation_mb_bin_handler
};
diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c
index 10ea23e07eb..340084ad848 100644
--- a/strings/ctype-bin.c
+++ b/strings/ctype-bin.c
@@ -262,8 +262,68 @@ static int my_strnxfrm_bin(CHARSET_INFO *cs __attribute__((unused)),
return len;
}
+static
+uint my_instr_bin(CHARSET_INFO *cs __attribute__((unused)),
+ const char *big, uint b_length,
+ const char *small, uint s_length,
+ my_match_t *match, uint nmatch)
+{
+ register const uchar *str, *search, *end, *search_end;
+
+ if (s_length <= b_length)
+ {
+ if (!s_length)
+ {
+ if (nmatch)
+ {
+ match->beg= 0;
+ match->end= 0;
+ match->mblen= 0;
+ }
+ return 1; /* Empty string is always found */
+ }
+
+ str= (const uchar*) big;
+ search= (const uchar*) small;
+ end= (const uchar*) big+b_length-s_length+1;
+ search_end= (const uchar*) small + s_length;
+
+skipp:
+ while (str != end)
+ {
+ if ( (*str++) == (*search))
+ {
+ register const uchar *i,*j;
+
+ i= str;
+ j= search+1;
+
+ while (j != search_end)
+ if ((*i++) != (*j++))
+ goto skipp;
+
+ if (nmatch > 0)
+ {
+ match[0].beg= 0;
+ match[0].end= str- (const uchar*)big-1;
+ match[0].mblen= match[0].end;
+
+ if (nmatch > 1)
+ {
+ match[1].beg= match[0].end;
+ match[1].end= match[0].end+s_length;
+ match[1].mblen= match[1].end-match[1].beg;
+ }
+ }
+ return 2;
+ }
+ }
+ }
+ return 0;
+}
+
-MY_COLLATION_HANDLER my_collation_bin_handler =
+MY_COLLATION_HANDLER my_collation_8bit_bin_handler =
{
my_strnncoll_binary,
my_strnncollsp_binary,
@@ -271,6 +331,7 @@ MY_COLLATION_HANDLER my_collation_bin_handler =
my_like_range_simple,
my_wildcmp_bin,
my_strcasecmp_bin,
+ my_instr_bin,
my_hash_sort_bin
};
@@ -280,6 +341,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
NULL, /* mbcharlen */
my_numchars_8bit,
my_charpos_8bit,
+ my_lengthsp_8bit,
my_mb_wc_bin,
my_wc_mb_bin,
my_caseup_str_bin,
@@ -316,5 +378,5 @@ CHARSET_INFO my_charset_bin =
1, /* mbmaxlen */
(char) 255, /* max_sort_char */
&my_charset_handler,
- &my_collation_bin_handler
+ &my_collation_8bit_bin_handler
};
diff --git a/strings/ctype-czech.c b/strings/ctype-czech.c
index 2398bc33d45..b2e4f1886ed 100644
--- a/strings/ctype-czech.c
+++ b/strings/ctype-czech.c
@@ -612,6 +612,7 @@ static MY_COLLATION_HANDLER my_collation_latin2_czech_ci_handler =
my_like_range_czech,
my_wildcmp_8bit,
my_strcasecmp_8bit,
+ my_instr_simple,
my_hash_sort_simple,
};
diff --git a/strings/ctype-euc_kr.c b/strings/ctype-euc_kr.c
index e8d2c8c4d1d..d47c4268642 100644
--- a/strings/ctype-euc_kr.c
+++ b/strings/ctype-euc_kr.c
@@ -8637,12 +8637,13 @@ my_mb_wc_euc_kr(CHARSET_INFO *cs __attribute__((unused)),
static MY_COLLATION_HANDLER my_collation_ci_handler =
{
- my_strnncoll_simple,/* strnncoll */
+ my_strnncoll_simple, /* strnncoll */
my_strnncollsp_simple,
my_strnxfrm_simple, /* strnxfrm */
- my_like_range_simple,/* like_range */
+ my_like_range_simple, /* like_range */
my_wildcmp_mb, /* wildcmp */
my_strcasecmp_mb,
+ my_instr_mb,
my_hash_sort_simple,
};
@@ -8652,6 +8653,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
mbcharlen_euc_kr,
my_numchars_mb,
my_charpos_mb,
+ my_lengthsp_8bit,
my_mb_wc_euc_kr, /* mb_wc */
my_wc_mb_euc_kr, /* wc_mb */
my_caseup_str_mb,
@@ -8713,7 +8715,7 @@ CHARSET_INFO my_charset_euckr_bin=
2, /* mbmaxlen */
0,
&my_charset_handler,
- &my_collation_bin_handler
+ &my_collation_mb_bin_handler
};
#endif
diff --git a/strings/ctype-gb2312.c b/strings/ctype-gb2312.c
index 72548305ad1..d429fa34eea 100644
--- a/strings/ctype-gb2312.c
+++ b/strings/ctype-gb2312.c
@@ -5687,12 +5687,13 @@ my_mb_wc_gb2312(CHARSET_INFO *cs __attribute__((unused)),
static MY_COLLATION_HANDLER my_collation_ci_handler =
{
- my_strnncoll_simple,/* strnncoll */
+ my_strnncoll_simple, /* strnncoll */
my_strnncollsp_simple,
my_strnxfrm_simple, /* strnxfrm */
- my_like_range_simple,/* like_range */
+ my_like_range_simple, /* like_range */
my_wildcmp_mb, /* wildcmp */
- my_strcasecmp_mb,
+ my_strcasecmp_mb, /* instr */
+ my_instr_mb,
my_hash_sort_simple,
};
@@ -5702,6 +5703,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
mbcharlen_gb2312,
my_numchars_mb,
my_charpos_mb,
+ my_lengthsp_8bit,
my_mb_wc_gb2312, /* mb_wc */
my_wc_mb_gb2312, /* wc_mb */
my_caseup_str_mb,
@@ -5762,7 +5764,7 @@ CHARSET_INFO my_charset_gb2312_bin=
2, /* mbmaxlen */
0,
&my_charset_handler,
- &my_collation_bin_handler
+ &my_collation_mb_bin_handler
};
#endif
diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c
index 84819d2e1a8..fa7aa175103 100644
--- a/strings/ctype-gbk.c
+++ b/strings/ctype-gbk.c
@@ -9890,6 +9890,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
my_like_range_gbk,
my_wildcmp_mb,
my_strcasecmp_mb,
+ my_instr_mb,
my_hash_sort_simple,
};
@@ -9899,6 +9900,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
mbcharlen_gbk,
my_numchars_mb,
my_charpos_mb,
+ my_lengthsp_8bit,
my_mb_wc_gbk,
my_wc_mb_gbk,
my_caseup_str_mb,
@@ -9959,7 +9961,7 @@ CHARSET_INFO my_charset_gbk_bin=
2, /* mbmaxlen */
0,
&my_charset_handler,
- &my_collation_bin_handler
+ &my_collation_mb_bin_handler
};
diff --git a/strings/ctype-latin1.c b/strings/ctype-latin1.c
index d40e7b4b18f..a8a5329f844 100644
--- a/strings/ctype-latin1.c
+++ b/strings/ctype-latin1.c
@@ -180,6 +180,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
NULL,
my_numchars_8bit,
my_charpos_8bit,
+ my_lengthsp_8bit,
my_mb_wc_latin1,
my_wc_mb_latin1,
my_caseup_str_8bit,
@@ -389,6 +390,7 @@ static MY_COLLATION_HANDLER my_collation_german2_ci_handler=
my_like_range_simple,
my_wildcmp_8bit,
my_strcasecmp_8bit,
+ my_instr_simple,
my_hash_sort_simple
};
@@ -434,6 +436,6 @@ CHARSET_INFO my_charset_latin1_bin=
1, /* mbmaxlen */
0,
&my_charset_handler,
- &my_collation_bin_handler
+ &my_collation_8bit_bin_handler
};
diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c
index 3d1abe95675..813a33fd229 100644
--- a/strings/ctype-mb.c
+++ b/strings/ctype-mb.c
@@ -126,11 +126,7 @@ int my_strcasecmp_mb(CHARSET_INFO * cs,const char *s, const char *t)
#define INC_PTR(cs,A,B) A+=((use_mb_flag && \
my_ismbchar(cs,A,B)) ? my_ismbchar(cs,A,B) : 1)
-#ifdef LIKE_CMP_TOUPPER
-#define likeconv(s,A) (uchar) my_toupper(s,A)
-#else
#define likeconv(s,A) (uchar) (s)->sort_order[(uchar) (A)]
-#endif
int my_wildcmp_mb(CHARSET_INFO *cs,
const char *str,const char *str_end,
@@ -278,5 +274,247 @@ uint my_charpos_mb(CHARSET_INFO *cs __attribute__((unused)),
return b-b0;
}
+uint my_instr_mb(CHARSET_INFO *cs,
+ const char *big, uint b_length,
+ const char *small, uint s_length,
+ my_match_t *match, uint nmatch)
+{
+ register const char *end, *big0;
+ int res= 0;
+
+ if (s_length <= b_length)
+ {
+ if (!s_length)
+ {
+ if (nmatch)
+ {
+ match->beg= 0;
+ match->end= 0;
+ match->mblen= 0;
+ }
+ return 1; /* Empty string is always found */
+ }
+
+ big0= big;
+ end= big+b_length-s_length+1;
+
+ while (big < end)
+ {
+ int mblen;
+
+ if (!cs->coll->strnncoll(cs, (unsigned char*) big, s_length,
+ (unsigned char*) small, s_length))
+ {
+ if (nmatch)
+ {
+ match[0].beg= 0;
+ match[0].end= big-big0;
+ match[0].mblen= res;
+ if (nmatch > 1)
+ {
+ match[1].beg= match[0].end;
+ match[1].end= match[0].end+s_length;
+ match[1].mblen= 0; /* Not computed */
+ }
+ }
+ return 2;
+ }
+ mblen= (mblen= my_ismbchar(cs, big, end)) ? mblen : 1;
+ big+= mblen;
+ b_length-= mblen;
+ res++;
+ }
+ }
+ return 0;
+}
+
+/* BINARY collations handlers for MB charsets */
+
+static int my_strnncoll_mb_bin(CHARSET_INFO * cs __attribute__((unused)),
+ const uchar *s, uint slen,
+ const uchar *t, uint tlen)
+{
+ int cmp= memcmp(s,t,min(slen,tlen));
+ return cmp ? cmp : (int) (slen - tlen);
+}
+
+static int my_strnncollsp_mb_bin(CHARSET_INFO * cs,
+ const uchar *s, uint slen,
+ const uchar *t, uint tlen)
+{
+ int len, cmp;
+
+ for ( ; slen && my_isspace(cs, s[slen-1]) ; slen--);
+ for ( ; tlen && my_isspace(cs, t[tlen-1]) ; tlen--);
+
+ len = ( slen > tlen ) ? tlen : slen;
+
+ cmp= memcmp(s,t,len);
+ return cmp ? cmp : (int) (slen - tlen);
+}
+
+static int my_strnxfrm_mb_bin(CHARSET_INFO *cs __attribute__((unused)),
+ uchar * dest, uint len,
+ const uchar *src,
+ uint srclen __attribute__((unused)))
+{
+ if (dest != src)
+ memcpy(dest,src,len= min(len,srclen));
+ return len;
+}
+
+
+static int my_strcasecmp_mb_bin(CHARSET_INFO * cs __attribute__((unused)),
+ const char *s, const char *t)
+{
+ return strcmp(s,t);
+}
+
+static void my_hash_sort_mb_bin(CHARSET_INFO *cs __attribute__((unused)),
+ const uchar *key, uint len,ulong *nr1, ulong *nr2)
+{
+ const uchar *pos = key;
+
+ key+= len;
+
+ for (; pos < (uchar*) key ; pos++)
+ {
+ nr1[0]^=(ulong) ((((uint) nr1[0] & 63)+nr2[0]) *
+ ((uint)*pos)) + (nr1[0] << 8);
+ nr2[0]+=3;
+ }
+}
+
+static int my_wildcmp_mb_bin(CHARSET_INFO *cs,
+ const char *str,const char *str_end,
+ const char *wildstr,const char *wildend,
+ int escape, int w_one, int w_many)
+{
+ int result= -1; /* Not found, using wildcards */
+
+ bool use_mb_flag=use_mb(cs);
+
+ while (wildstr != wildend)
+ {
+ while (*wildstr != w_many && *wildstr != w_one)
+ {
+ int l;
+ if (*wildstr == escape && wildstr+1 != wildend)
+ wildstr++;
+ if (use_mb_flag &&
+ (l = my_ismbchar(cs, wildstr, wildend)))
+ {
+ if (str+l > str_end || memcmp(str, wildstr, l) != 0)
+ return 1;
+ str += l;
+ wildstr += l;
+ }
+ else
+ if (str == str_end || *wildstr++ != *str++)
+ return(1); /* No match */
+ if (wildstr == wildend)
+ return (str != str_end); /* Match if both are at end */
+ result=1; /* Found an anchor char */
+ }
+ if (*wildstr == w_one)
+ {
+ do
+ {
+ if (str == str_end) /* Skip one char if possible */
+ return (result);
+ INC_PTR(cs,str,str_end);
+ } while (++wildstr < wildend && *wildstr == w_one);
+ if (wildstr == wildend)
+ break;
+ }
+ if (*wildstr == w_many)
+ { /* Found w_many */
+ uchar cmp;
+ const char* mb = wildstr;
+ int mblen=0;
+
+ wildstr++;
+ /* Remove any '%' and '_' from the wild search string */
+ for (; wildstr != wildend ; wildstr++)
+ {
+ if (*wildstr == w_many)
+ continue;
+ if (*wildstr == w_one)
+ {
+ if (str == str_end)
+ return (-1);
+ INC_PTR(cs,str,str_end);
+ continue;
+ }
+ break; /* Not a wild character */
+ }
+ if (wildstr == wildend)
+ return(0); /* Ok if w_many is last */
+ if (str == str_end)
+ return -1;
+
+ if ((cmp= *wildstr) == escape && wildstr+1 != wildend)
+ cmp= *++wildstr;
+
+ mb=wildstr;
+ LINT_INIT(mblen);
+ if (use_mb_flag)
+ mblen = my_ismbchar(cs, wildstr, wildend);
+ INC_PTR(cs,wildstr,wildend); /* This is compared trough cmp */
+ do
+ {
+ if (use_mb_flag)
+ {
+ for (;;)
+ {
+ if (str >= str_end)
+ return -1;
+ if (mblen)
+ {
+ if (str+mblen <= str_end && memcmp(str, mb, mblen) == 0)
+ {
+ str += mblen;
+ break;
+ }
+ }
+ else if (!my_ismbchar(cs, str, str_end) && *str == cmp)
+ {
+ str++;
+ break;
+ }
+ INC_PTR(cs,str, str_end);
+ }
+ }
+ else
+ {
+ while (str != str_end && *str != cmp)
+ str++;
+ if (str++ == str_end) return (-1);
+ }
+ {
+ int tmp=my_wildcmp_mb(cs,str,str_end,wildstr,wildend,escape,w_one,w_many);
+ if (tmp <= 0)
+ return (tmp);
+ }
+ } while (str != str_end && wildstr[0] != w_many);
+ return(-1);
+ }
+ }
+ return (str != str_end ? 1 : 0);
+}
+
+
+MY_COLLATION_HANDLER my_collation_mb_bin_handler =
+{
+ my_strnncoll_mb_bin,
+ my_strnncollsp_mb_bin,
+ my_strnxfrm_mb_bin,
+ my_like_range_simple,
+ my_wildcmp_mb_bin,
+ my_strcasecmp_mb_bin,
+ my_instr_mb,
+ my_hash_sort_mb_bin
+};
+
#endif
diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c
index 8f3e66f782e..f85ce5e7a2b 100644
--- a/strings/ctype-simple.c
+++ b/strings/ctype-simple.c
@@ -1020,12 +1020,83 @@ uint my_charpos_8bit(CHARSET_INFO *cs __attribute__((unused)),
return pos;
}
+uint my_lengthsp_8bit(CHARSET_INFO *cs __attribute__((unused)),
+ const char *ptr, uint length)
+{
+ const char *end= ptr+length;
+ while (end > ptr && end[-1] == ' ')
+ end--;
+ return (uint) (end-ptr);
+}
+
+
+uint my_instr_simple(CHARSET_INFO *cs,
+ const char *big, uint b_length,
+ const char *small, uint s_length,
+ my_match_t *match, uint nmatch)
+{
+ register const uchar *str, *search, *end, *search_end;
+
+ if (s_length <= b_length)
+ {
+ if (!s_length)
+ {
+ if (nmatch)
+ {
+ match->beg= 0;
+ match->end= 0;
+ match->mblen= 0;
+ }
+ return 1; /* Empty string is always found */
+ }
+
+ str= (const uchar*) big;
+ search= (const uchar*) small;
+ end= (const uchar*) big+b_length-s_length+1;
+ search_end= (const uchar*) small + s_length;
+
+skipp:
+ while (str != end)
+ {
+ if (cs->sort_order[*str++] == cs->sort_order[*search])
+ {
+ register const uchar *i,*j;
+
+ i= str;
+ j= search+1;
+
+ while (j != search_end)
+ if (cs->sort_order[*i++] != cs->sort_order[*j++])
+ goto skipp;
+
+ if (nmatch > 0)
+ {
+ match[0].beg= 0;
+ match[0].end= str- (const uchar*)big-1;
+ match[0].mblen= match[0].end;
+
+ if (nmatch > 1)
+ {
+ match[1].beg= match[0].end;
+ match[1].end= match[0].end+s_length;
+ match[1].mblen= match[1].end-match[1].beg;
+ }
+ }
+ return 2;
+ }
+ }
+ }
+ return 0;
+}
+
+
MY_CHARSET_HANDLER my_charset_8bit_handler=
{
NULL, /* ismbchar */
NULL, /* mbcharlen */
my_numchars_8bit,
my_charpos_8bit,
+ my_lengthsp_8bit,
my_mb_wc_8bit,
my_wc_mb_8bit,
my_caseup_str_8bit,
@@ -1052,5 +1123,6 @@ MY_COLLATION_HANDLER my_collation_8bit_simple_ci_handler =
my_like_range_simple,
my_wildcmp_8bit,
my_strcasecmp_8bit,
+ my_instr_simple,
my_hash_sort_simple
};
diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c
index d8443165462..f302e678b9f 100644
--- a/strings/ctype-sjis.c
+++ b/strings/ctype-sjis.c
@@ -4477,6 +4477,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
my_like_range_sjis,
my_wildcmp_mb, /* wildcmp */
my_strcasecmp_8bit,
+ my_instr_mb,
my_hash_sort_simple,
};
@@ -4486,6 +4487,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
mbcharlen_sjis,
my_numchars_mb,
my_charpos_mb,
+ my_lengthsp_8bit,
my_mb_wc_sjis, /* mb_wc */
my_wc_mb_sjis, /* wc_mb */
my_caseup_str_8bit,
@@ -4546,7 +4548,7 @@ CHARSET_INFO my_charset_sjis_bin=
2, /* mbmaxlen */
0,
&my_charset_handler,
- &my_collation_bin_handler
+ &my_collation_mb_bin_handler
};
#endif
diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c
index 643ea77c73e..a4d8a7d1f79 100644
--- a/strings/ctype-tis620.c
+++ b/strings/ctype-tis620.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB
+/* Copyright (C) 2000-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
@@ -51,10 +51,7 @@
#ifdef HAVE_CHARSET_tis620
-static uchar* thai2sortable(const uchar *tstr,uint len);
-
#define BUFFER_MULTIPLY 4
-#define buffsize(s) (BUFFER_MULTIPLY * (strlen(s) + 1))
#define M L_MIDDLE
#define U L_UPPER
#define L L_LOWER
@@ -451,34 +448,50 @@ uchar NEAR sort_order_tis620[]=
(uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377',
};
-/* Convert thai string to "Standard C String Function" sortable string
- Arg: const source string and length of converted string
- Ret: Sortable string
-*/
/*
- NOTE: isn't it faster to alloc buffer in calling function?
- */
-static uchar* thai2sortable(const uchar * tstr,uint len)
-{
-/* We use only 3 levels (neglect capitalization). */
+ Convert thai string to "Standard C String Function" sortable string
- const uchar* p= tstr;
+ SYNOPSIS
+ thai2sortable()
+ tstr String to convert. Does not have to end with \0
+ len Length of tstr
+ out_length Will contain length of sortable string
+
+ NOTE
+ We use only 3 levels (neglect capitalization).
+
+ OPTIMIZE SUGGESTION
+ Should be faster to alloc buffer in calling function.
+
+ RETURN
+ Pointer to sortable string. Should be freed with 'free'
+*/
+
+static uchar *thai2sortable(const uchar *tstr, uint len, uint *out_length)
+{
+ const uchar *p= tstr;
uchar *outBuf;
uchar *pRight1, *pRight2, *pRight3;
uchar *pLeft1, *pLeft2, *pLeft3;
- uint bufSize;
- uint RightSize;
+ uint bufSize;
+ uint RightSize;
- len= (uint) strnlen((char*) tstr,len);
- bufSize= (uint) buffsize((char*) tstr);
+ bufSize= (uint) (len + 1) * BUFFER_MULTIPLY;
RightSize= sizeof(uchar) * (len + 1);
if (!(outBuf= pLeft1= pRight1=
(uchar *)malloc(sizeof(uchar) * bufSize + RightSize*2)))
+ {
+ /*
+ Can't allocate buffer; Use original string for sorting
+ This is not perfect, but better than nothing...
+ */
+ *out_length= len;
return (uchar*) tstr;
+ }
pLeft2= pRight2= pRight1 + sizeof(uchar) * bufSize;
pLeft3= pRight3= pRight2 + RightSize;
- while (--len)
+ while ((int) --len > 0)
{
int *t_ctype0= t_ctype[p[0]];
if (isldvowel(*p) && isconsnt(p[1]))
@@ -507,17 +520,14 @@ static uchar* thai2sortable(const uchar * tstr,uint len)
p++;
}
}
- if (!len)
+ if (!len) /* If last was not double byte */
{
int *t_ctype0= t_ctype[p[0]];
- *pRight1= t_ctype0[0];
- if (*pRight1 != IGNORE)
+ if ((*pRight1= t_ctype0[0] != IGNORE))
pRight1++;
- *pRight2= t_ctype0[1];
- if (*pRight2 != IGNORE)
+ if ((*pRight2= t_ctype0[1]) != IGNORE)
pRight2++;
- *pRight3= t_ctype0[2];
- if (*pRight3 != IGNORE)
+ if ((*pRight3= t_ctype0[2]) != IGNORE)
pRight3++;
}
*pRight1++= L2_BLANK;
@@ -526,31 +536,45 @@ static uchar* thai2sortable(const uchar * tstr,uint len)
memcpy(pRight1, pLeft2, pRight2 - pLeft2);
pRight1+= pRight2 - pLeft2;
memcpy(pRight1, pLeft3, pRight3 - pLeft3);
+ *out_length= (uint) ((pRight1+ (uint) (pRight3 - pLeft3)) - outBuf);
return outBuf;
}
-/* strncoll() replacement, compare 2 string, both are conveted to sortable string
- Arg: 2 Strings and it compare length
- Ret: strcmp result
+
+/*
+ strncoll() replacement, compare 2 string, both are conveted to sortable
+ string
+
+ Arg: 2 Strings and it compare length
+ Ret: strcmp result
*/
+
int my_strnncoll_tis620(CHARSET_INFO *cs __attribute__((unused)),
const uchar * s1, uint len1,
const uchar * s2, uint len2)
{
uchar *tc1, *tc2;
- int i;
- tc1= thai2sortable(s1, len1);
- tc2= thai2sortable(s2, len2);
- i= strcmp((char*)tc1, (char*)tc2);
- free(tc1);
- free(tc2);
- return i;
+ uint tc1_length, tc2_length, length;
+ int res;
+
+ tc1= thai2sortable(s1, len1, &tc1_length);
+ tc2= thai2sortable(s2, len2, &tc2_length);
+ length= min(tc1_length, tc2_length);
+
+ res= memcmp((char*)tc1, (char*) tc2, length);
+ if (tc1 != s1)
+ free(tc1);
+ if (tc2 != s2)
+ free(tc2);
+ return (res || tc1_length == tc2_length ? res :
+ (tc1_length < tc2_length ? -1 : 1));
}
+
static
int my_strnncollsp_tis620(CHARSET_INFO * cs,
- const uchar *s, uint slen,
- const uchar *t, uint tlen)
+ const uchar *s, uint slen,
+ const uchar *t, uint tlen)
{
for ( ; slen && my_isspace(cs, s[slen-1]) ; slen--);
for ( ; tlen && my_isspace(cs, t[tlen-1]) ; tlen--);
@@ -566,63 +590,48 @@ int my_strnxfrm_tis620(CHARSET_INFO *cs __attribute__((unused)),
uchar * dest, uint len,
const uchar * src, uint srclen)
{
- uint bufSize;
- uchar *tmp;
- bufSize= (uint) buffsize((char*)src);
- tmp= thai2sortable(src,srclen);
- set_if_smaller(bufSize,(uint) len);
- memcpy((uchar *)dest, tmp, bufSize);
- free(tmp);
- return (int)bufSize;
+ uint out_length;
+ uchar *tmp= thai2sortable(src, srclen, &out_length);
+
+ set_if_smaller(out_length, len);
+ memcpy(dest, tmp, out_length);
+ if (tmp != src)
+ free(tmp);
+ return (int) out_length;
}
+
/* strcoll replacment, compare 2 strings
Arg: 2 strings
- Ret: strcmp result
+ Ret: memcmp result
*/
+
int my_strcoll_tis620(const uchar * s1, const uchar * s2)
{
- uchar *tc1, *tc2;
- int i;
- tc1= thai2sortable(s1, (uint) strlen((char*)s1));
- tc2= thai2sortable(s2, (uint) strlen((char*)s2));
- i= strcmp((char*)tc1, (char*)tc2);
- free(tc1);
- free(tc2);
- return i;
+ return my_strnncoll_tis620((CHARSET_INFO *) 0, s1, strlen(s1), s2,
+ strlen(s1));
}
-/* strxfrm replacment, convert Thai string to sortable string
- Arg: Destination buffer, String and dest buffer size
- Ret: Converting string size
-*/
-int my_strxfrm_tis620(uchar * dest, const uchar * src, int len)
-{
- uint bufSize;
- uchar *tmp;
-
- bufSize= (uint)buffsize((char*) src);
- tmp= thai2sortable(src, len);
- memcpy((uchar *)dest, tmp, bufSize);
- free(tmp);
- return bufSize;
-}
-/* Convert SQL like string to C string
- Arg: String, its length, escape character, resource length, minimal string and maximum string
- Ret: Alway 0
+/*
+ Convert SQL LIKE string to C string
+
+ IMPLEMENTATION
+ We just copy this function from opt_range.cc. No need to convert to
+ thai2sortable string. min_str and max_str will be use for comparison and
+ converted there.
+
+ RETURN VALUES
+ 0
*/
-/* We just copy this function from opt_range.cc. No need to convert to
- thai2sortable string. min_str and max_str will be use for comparison and
- converted there. */
#define max_sort_chr ((char) 255)
my_bool my_like_range_tis620(CHARSET_INFO *cs __attribute__((unused)),
- const char *ptr, uint ptr_length,
- int escape, int w_one, int w_many,
- uint res_length, char *min_str, char *max_str,
- uint *min_length, uint *max_length)
+ const char *ptr, uint ptr_length,
+ int escape, int w_one, int w_many,
+ uint res_length, char *min_str, char *max_str,
+ uint *min_length, uint *max_length)
{
const char *end=ptr+ptr_length;
char *min_org=min_str;
@@ -636,18 +645,18 @@ my_bool my_like_range_tis620(CHARSET_INFO *cs __attribute__((unused)),
*min_str++ = *max_str++ = *ptr;
continue;
}
- if (*ptr == w_one) /* '_' in SQL */
+ if (*ptr == w_one) /* '_' in SQL */
{
*min_str++='\0'; /* This should be min char */
*max_str++=max_sort_chr;
continue;
}
- if (*ptr == w_many) /* '%' in SQL */
+ if (*ptr == w_many) /* '%' in SQL */
{
*min_length= (uint) (min_str - min_org);
*max_length=res_length;
do {
- *min_str++ = ' '; /* Because if key compression */
+ *min_str++ = ' '; /* For key compression */
*max_str++ = max_sort_chr;
} while (min_str != min_end);
return 0;
@@ -657,14 +666,18 @@ my_bool my_like_range_tis620(CHARSET_INFO *cs __attribute__((unused)),
*min_length= *max_length = (uint) (min_str - min_org);
while (min_str != min_end)
- *min_str++ = *max_str++ = ' '; /* Because if key compression */
+ *min_str++ = *max_str++ = ' '; /* For key compression */
return 0;
}
-/* Thai normalization for input sub system
- Arg: Buffer, 's length, String, 'length
- Ret: Void
+#ifdef NOT_NEEDED
+
+/*
+ Thai normalization for input sub system
+ Arg: Buffer, 's length, String, 'length
+ Ret: Void
*/
+
void ThNormalize(uchar* ptr, uint field_length, const uchar* from, uint length)
{
const uchar* fr= from;
@@ -686,6 +699,7 @@ void ThNormalize(uchar* ptr, uint field_length, const uchar* from, uint length)
else
*p++ = *fr++;
}
+#endif /* NOT_NEEDED */
static MY_COLLATION_HANDLER my_collation_ci_handler =
@@ -696,6 +710,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
my_like_range_tis620,
my_wildcmp_8bit, /* wildcmp */
my_strcasecmp_8bit,
+ NULL,
my_hash_sort_simple,
};
@@ -705,6 +720,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
NULL, /* mbcharlen */
my_numchars_8bit,
my_charpos_8bit,
+ my_lengthsp_8bit,
my_mb_wc_8bit, /* mb_wc */
my_wc_mb_8bit, /* wc_mb */
my_caseup_str_8bit,
@@ -766,7 +782,7 @@ CHARSET_INFO my_charset_tis620_bin=
1, /* mbmaxlen */
0,
&my_charset_handler,
- &my_collation_bin_handler
+ &my_collation_8bit_bin_handler
};
diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c
index 6c0cfd3e874..cdcd91b2916 100644
--- a/strings/ctype-ucs2.c
+++ b/strings/ctype-ucs2.c
@@ -90,7 +90,7 @@ static uchar to_upper_ucs2[] = {
};
-static int my_ucs2_uni (CHARSET_INFO *cs __attribute__((unused)) ,
+static int my_ucs2_uni (CHARSET_INFO *cs __attribute__((unused)),
my_wc_t * pwc, const uchar *s, const uchar *e)
{
if (s+2 > e) /* Need 2 characters */
@@ -1001,24 +1001,291 @@ uint my_charpos_ucs2(CHARSET_INFO *cs __attribute__((unused)),
return pos*2;
}
+static
+void my_fill_ucs2(CHARSET_INFO *cs __attribute__((unused)),
+ char *s, uint l, int fill)
+{
+ for ( ; l >= 2; s[0]= 0, s[1]= fill, s+=2, l-=2);
+}
+
+static
+uint my_lengthsp_ucs2(CHARSET_INFO *cs __attribute__((unused)),
+ const char *ptr, uint length)
+{
+ const char *end= ptr+length;
+ while (end > ptr+1 && end[-1] == ' ' && end[-2] == '\0')
+ end-=2;
+ return (uint) (end-ptr);
+}
+
+/*
+** Compare string against string with wildcard
+** 0 if matched
+** -1 if not matched with wildcard
+** 1 if matched with wildcard
+*/
+
+static
+int my_wildcmp_ucs2(CHARSET_INFO *cs,
+ const char *str,const char *str_end,
+ const char *wildstr,const char *wildend,
+ int escape, int w_one, int w_many,
+ MY_UNICASE_INFO **weights)
+{
+ int result= -1; /* Not found, using wildcards */
+ my_wc_t s_wc, w_wc;
+ int scan, plane;
+
+ while (wildstr != wildend)
+ {
+
+ while (1)
+ {
+ scan= my_ucs2_uni(cs,&w_wc, (const uchar*)wildstr, (const uchar*)wildend);
+ if (scan <= 0)
+ return 1;
+ wildstr+= scan;
+
+ if (w_wc == (my_wc_t)escape)
+ {
+ scan= my_ucs2_uni(cs,&w_wc, (const uchar*)wildstr, (const uchar*)wildend);
+ if (scan <= 0)
+ return 1;
+ wildstr+= scan;
+ }
+
+ if (w_wc == (my_wc_t)w_many)
+ {
+ result= 1; /* Found an anchor char */
+ break;
+ }
+
+ scan= my_ucs2_uni(cs, &s_wc, (const uchar*)str, (const uchar*)str_end);
+ if (scan <=0)
+ return 1;
+ str+= scan;
+
+ if (w_wc == (my_wc_t)w_one)
+ {
+ result= 1; /* Found an anchor char */
+ }
+ else
+ {
+ if (weights)
+ {
+ plane=(s_wc>>8) & 0xFF;
+ s_wc = weights[plane] ? weights[plane][s_wc & 0xFF].sort : s_wc;
+ plane=(w_wc>>8) & 0xFF;
+ w_wc = weights[plane] ? weights[plane][w_wc & 0xFF].sort : w_wc;
+ }
+ if (s_wc != w_wc)
+ return 1; /* No match */
+ }
+ if (wildstr == wildend)
+ return (str != str_end); /* Match if both are at end */
+ }
+
+
+ if (w_wc == (my_wc_t)w_many)
+ { /* Found w_many */
+
+ /* Remove any '%' and '_' from the wild search string */
+ for ( ; wildstr != wildend ; )
+ {
+ scan= my_ucs2_uni(cs,&w_wc, (const uchar*)wildstr, (const uchar*)wildend);
+ if (scan <= 0)
+ return 1;
+ wildstr+= scan;
+
+ if (w_wc == (my_wc_t)w_many)
+ continue;
+
+ if (w_wc == (my_wc_t)w_one)
+ {
+ scan= my_ucs2_uni(cs, &s_wc, (const uchar*)str, (const uchar*)str_end);
+ if (scan <=0)
+ return 1;
+ str+= scan;
+ continue;
+ }
+ break; /* Not a wild character */
+ }
+
+ if (wildstr == wildend)
+ return 0; /* Ok if w_many is last */
+
+ if (str == str_end)
+ return -1;
+
+ scan= my_ucs2_uni(cs,&w_wc, (const uchar*)wildstr, (const uchar*)wildend);
+ if (scan <= 0)
+ return 1;
+ wildstr+= scan;
+
+ if (w_wc == (my_wc_t)escape)
+ {
+ scan= my_ucs2_uni(cs,&w_wc, (const uchar*)wildstr, (const uchar*)wildend);
+ if (scan <= 0)
+ return 1;
+ wildstr+= scan;
+ }
+
+ do
+ {
+ /* Skip until the first character from wildstr is found */
+ while (str != str_end)
+ {
+ scan= my_ucs2_uni(cs,&s_wc, (const uchar*)str, (const uchar*)str_end);
+ if (scan <= 0)
+ return 1;
+ str+= scan;
+
+ if (weights)
+ {
+ plane=(s_wc>>8) & 0xFF;
+ s_wc = weights[plane] ? weights[plane][s_wc & 0xFF].sort : s_wc;
+ plane=(w_wc>>8) & 0xFF;
+ w_wc = weights[plane] ? weights[plane][w_wc & 0xFF].sort : w_wc;
+ }
+
+ if (s_wc == w_wc)
+ break;
+ }
+ if (str == str_end)
+ return -1;
+
+ result= my_wildcmp_ucs2(cs,str,str_end,wildstr,wildend,escape,
+ w_one,w_many,weights);
+ if (result <= 0)
+ return result;
+
+ } while (str != str_end && w_wc != (my_wc_t)w_many);
+ return -1;
+ }
+ }
+ return (str != str_end ? 1 : 0);
+}
+
-static MY_COLLATION_HANDLER my_collation_ci_handler =
+static
+int my_wildcmp_ucs2_ci(CHARSET_INFO *cs,
+ const char *str,const char *str_end,
+ const char *wildstr,const char *wildend,
+ int escape, int w_one, int w_many)
+{
+ return my_wildcmp_ucs2(cs,str,str_end,wildstr,wildend,
+ escape,w_one,w_many,uni_plane);
+}
+
+static
+int my_wildcmp_ucs2_bin(CHARSET_INFO *cs,
+ const char *str,const char *str_end,
+ const char *wildstr,const char *wildend,
+ int escape, int w_one, int w_many)
+{
+ return my_wildcmp_ucs2(cs,str,str_end,wildstr,wildend,
+ escape,w_one,w_many,NULL);
+}
+
+
+static
+int my_strnncoll_ucs2_bin(CHARSET_INFO *cs,
+ const uchar *s, uint slen,
+ const uchar *t, uint tlen)
+{
+ int s_res,t_res;
+ my_wc_t s_wc,t_wc;
+ const uchar *se=s+slen;
+ const uchar *te=t+tlen;
+
+ while ( s < se && t < te )
+ {
+ s_res=my_ucs2_uni(cs,&s_wc, s, se);
+ t_res=my_ucs2_uni(cs,&t_wc, t, te);
+
+ if ( s_res <= 0 || t_res <= 0 )
+ {
+ /* Incorrect string, compare by char value */
+ return ((int)s[0]-(int)t[0]);
+ }
+ if ( s_wc != t_wc )
+ {
+ return ((int) s_wc) - ((int) t_wc);
+ }
+
+ s+=s_res;
+ t+=t_res;
+ }
+ return ( (se-s) - (te-t) );
+}
+
+static
+int my_strcasecmp_ucs2_bin(CHARSET_INFO *cs, const char *s, const char *t)
+{
+ uint s_len=strlen(s);
+ uint t_len=strlen(t);
+ uint len = (s_len > t_len) ? s_len : t_len;
+ return my_strncasecmp_ucs2(cs, s, t, len);
+}
+
+static
+int my_strnxfrm_ucs2_bin(CHARSET_INFO *cs __attribute__((unused)),
+ uchar *dst, uint dstlen,
+ const uchar *src, uint srclen)
+{
+ if (dst != src)
+ memcpy(dst,src,srclen= min(dstlen,srclen));
+ return srclen;
+}
+
+static
+void my_hash_sort_ucs2_bin(CHARSET_INFO *cs __attribute__((unused)),
+ const uchar *key, uint len,ulong *nr1, ulong *nr2)
+{
+ const uchar *pos = key;
+
+ key+= len;
+
+ for (; pos < (uchar*) key ; pos++)
+ {
+ nr1[0]^=(ulong) ((((uint) nr1[0] & 63)+nr2[0]) *
+ ((uint)*pos)) + (nr1[0] << 8);
+ nr2[0]+=3;
+ }
+}
+
+
+static MY_COLLATION_HANDLER my_collation_ucs2_general_ci_handler =
{
my_strnncoll_ucs2,
my_strnncoll_ucs2,
my_strnxfrm_ucs2,
my_like_range_simple,
- my_wildcmp_mb,
+ my_wildcmp_ucs2_ci,
my_strcasecmp_ucs2,
+ my_instr_mb,
my_hash_sort_ucs2
};
-static MY_CHARSET_HANDLER my_charset_handler=
+static MY_COLLATION_HANDLER my_collation_ucs2_bin_handler =
+{
+ my_strnncoll_ucs2_bin,
+ my_strnncoll_ucs2_bin,
+ my_strnxfrm_ucs2_bin,
+ my_like_range_simple,
+ my_wildcmp_ucs2_bin,
+ my_strcasecmp_ucs2_bin,
+ my_instr_mb,
+ my_hash_sort_ucs2_bin
+};
+
+static MY_CHARSET_HANDLER my_charset_ucs2_handler=
{
my_ismbchar_ucs2, /* ismbchar */
my_mbcharlen_ucs2, /* mbcharlen */
my_numchars_ucs2,
my_charpos_ucs2,
+ my_lengthsp_ucs2,
my_ucs2_uni, /* mb_wc */
my_uni_ucs2, /* wc_mb */
my_caseup_str_ucs2,
@@ -1028,7 +1295,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
my_snprintf_ucs2,
my_l10tostr_ucs2,
my_ll10tostr_ucs2,
- my_fill_8bit,
+ my_fill_ucs2,
my_strntol_ucs2,
my_strntoul_ucs2,
my_strntoll_ucs2,
@@ -1057,8 +1324,8 @@ CHARSET_INFO my_charset_ucs2_general_ci=
1, /* strxfrm_multiply */
2, /* mbmaxlen */
0,
- &my_charset_handler,
- &my_collation_ci_handler
+ &my_charset_ucs2_handler,
+ &my_collation_ucs2_general_ci_handler
};
@@ -1080,8 +1347,8 @@ CHARSET_INFO my_charset_ucs2_bin=
1, /* strxfrm_multiply */
2, /* mbmaxlen */
0,
- &my_charset_handler,
- &my_collation_bin_handler
+ &my_charset_ucs2_handler,
+ &my_collation_ucs2_bin_handler
};
diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c
index c6cf6ff79ba..29375aca727 100644
--- a/strings/ctype-ujis.c
+++ b/strings/ctype-ujis.c
@@ -8434,6 +8434,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
my_like_range_simple,/* like_range */
my_wildcmp_mb, /* wildcmp */
my_strcasecmp_mb,
+ my_instr_mb,
my_hash_sort_simple,
};
@@ -8443,6 +8444,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
mbcharlen_ujis,
my_numchars_mb,
my_charpos_mb,
+ my_lengthsp_8bit,
my_mb_wc_euc_jp, /* mb_wc */
my_wc_mb_euc_jp, /* wc_mb */
my_caseup_str_mb,
@@ -8503,7 +8505,7 @@ CHARSET_INFO my_charset_ujis_bin=
3, /* mbmaxlen */
0,
&my_charset_handler,
- &my_collation_bin_handler
+ &my_collation_mb_bin_handler
};
diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c
index 4ac397c4c48..3ede1aa26f6 100644
--- a/strings/ctype-utf8.c
+++ b/strings/ctype-utf8.c
@@ -1959,6 +1959,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
my_like_range_simple,
my_wildcmp_mb,
my_strcasecmp_utf8,
+ my_instr_mb,
my_hash_sort_utf8
};
@@ -1968,6 +1969,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
my_mbcharlen_utf8,
my_numchars_mb,
my_charpos_mb,
+ my_lengthsp_8bit,
my_utf8_uni,
my_uni_utf8,
my_caseup_str_utf8,
@@ -2030,7 +2032,7 @@ CHARSET_INFO my_charset_utf8_bin=
3, /* mbmaxlen */
0,
&my_charset_handler,
- &my_collation_bin_handler
+ &my_collation_mb_bin_handler
};
diff --git a/strings/ctype-win1250ch.c b/strings/ctype-win1250ch.c
index 12a8edc4a8f..60a5737009f 100644
--- a/strings/ctype-win1250ch.c
+++ b/strings/ctype-win1250ch.c
@@ -652,6 +652,7 @@ static MY_COLLATION_HANDLER my_collation_czech_ci_handler =
my_like_range_win1250ch,
my_wildcmp_8bit,
my_strcasecmp_8bit,
+ my_instr_simple,
my_hash_sort_simple
};
diff --git a/strings/xml.c b/strings/xml.c
index 793c155ea63..7d7839e1603 100644
--- a/strings/xml.c
+++ b/strings/xml.c
@@ -255,7 +255,7 @@ int my_xml_parse(MY_XML_PARSER *p,const char *str, uint len)
if(MY_XML_EQ==(lex=my_xml_scan(p,&b)))
{
lex=my_xml_scan(p,&b);
- if ( (lex==MY_XML_IDENT) || (lex=MY_XML_STRING) )
+ if ( (lex==MY_XML_IDENT) || (lex==MY_XML_STRING) )
{
if((MY_XML_OK!=my_xml_enter(p,a.beg,a.end-a.beg)) ||
(MY_XML_OK!=my_xml_value(p,b.beg,b.end-b.beg)) ||
diff --git a/support-files/MacOSX/Makefile.am b/support-files/MacOSX/Makefile.am
index b8047942190..ff16fa3235a 100644
--- a/support-files/MacOSX/Makefile.am
+++ b/support-files/MacOSX/Makefile.am
@@ -22,7 +22,11 @@ EXTRA_DIST = Info.plist.sh \
StartupParameters.plist.sh \
postinstall.sh \
preinstall.sh \
- ReadMe.txt
+ ReadMe.txt \
+ MySQL \
+ StartupItem.Description.plist \
+ StartupItem.Info.plist \
+ StartupItem.postinstall
pkgdata_DATA = Info.plist \
Description.plist \
diff --git a/support-files/MacOSX/MySQL b/support-files/MacOSX/MySQL
new file mode 100755
index 00000000000..dfba5f8f982
--- /dev/null
+++ b/support-files/MacOSX/MySQL
@@ -0,0 +1,46 @@
+#!/bin/sh
+#
+# /Library/StartupItems/MySQL/MySQL
+#
+# A script to automatically start up MySQL on system bootup
+# for Mac OS X. This is actually just a wrapper script around
+# the standard mysql.server init script, which is included in
+# the binary distribution.
+#
+# (c) 2003 MySQL AB
+# Written by Lenz Grimmer <lenz@mysql.com>
+#
+
+# Source the common setup functions for startup scripts
+test -r /etc/rc.common || exit 1
+. /etc/rc.common
+
+# The path to the mysql.server init script. The official MySQL
+# Mac OS X packages are being installed into /usr/local/mysql.
+SCRIPT="/usr/local/mysql/support-files/mysql.server"
+
+StartService ()
+{
+ if [ "${MYSQLCOM:=-NO-}" = "-YES-" ] ; then
+ ConsoleMessage "Starting MySQL database server"
+ $SCRIPT start > /dev/null 2>&1
+ fi
+}
+
+StopService ()
+{
+ ConsoleMessage "Stopping MySQL database server"
+ $SCRIPT stop > /dev/null 2>&1
+}
+
+RestartService ()
+{
+ ConsoleMessage "Restarting MySQL database server"
+ $SCRIPT restart > /dev/null 2>&1
+}
+
+if test -x $SCRIPT ; then
+ RunService "$1"
+else
+ ConsoleMessage "Could not find MySQL startup script!"
+fi
diff --git a/support-files/MacOSX/StartupItem.Description.plist b/support-files/MacOSX/StartupItem.Description.plist
new file mode 100644
index 00000000000..1f0023bde0d
--- /dev/null
+++ b/support-files/MacOSX/StartupItem.Description.plist
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>IFPkgDescriptionDeleteWarning</key>
+ <string></string>
+ <key>IFPkgDescriptionDescription</key>
+ <string>This package enables MySQL to be started up automatically
+ on system bootup.</string>
+ <key>IFPkgDescriptionTitle</key>
+ <string>MySQL Startup Item</string>
+ <key>IFPkgDescriptionVersion</key>
+ <string>1.0</string>
+</dict>
+</plist>
diff --git a/support-files/MacOSX/StartupItem.Info.plist b/support-files/MacOSX/StartupItem.Info.plist
new file mode 100644
index 00000000000..f403fbe7e84
--- /dev/null
+++ b/support-files/MacOSX/StartupItem.Info.plist
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleGetInfoString</key>
+ <string>MySQL Startup Item</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.mysql.mysqlstartup</string>
+ <key>CFBundleName</key>
+ <string>MySQL Startup Item</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>IFMajorVersion</key>
+ <integer>1</integer>
+ <key>IFMinorVersion</key>
+ <integer>0</integer>
+ <key>IFPkgFlagAllowBackRev</key>
+ <false/>
+ <key>IFPkgFlagAuthorizationAction</key>
+ <string>RootAuthorization</string>
+ <key>IFPkgFlagDefaultLocation</key>
+ <string>/Library/StartupItems</string>
+ <key>IFPkgFlagInstallFat</key>
+ <false/>
+ <key>IFPkgFlagIsRequired</key>
+ <false/>
+ <key>IFPkgFlagRelocatable</key>
+ <false/>
+ <key>IFPkgFlagRestartAction</key>
+ <string>NoRestart</string>
+ <key>IFPkgFlagRootVolumeOnly</key>
+ <true/>
+ <key>IFPkgFlagUpdateInstalledLanguages</key>
+ <false/>
+ <key>IFPkgFormatVersion</key>
+ <real>0.10000000149011612</real>
+</dict>
+</plist>
diff --git a/support-files/MacOSX/StartupItem.postinstall b/support-files/MacOSX/StartupItem.postinstall
new file mode 100755
index 00000000000..f6f6f46f211
--- /dev/null
+++ b/support-files/MacOSX/StartupItem.postinstall
@@ -0,0 +1,36 @@
+#!/bin/sh
+#
+# postinstall script for the MySQL Startup Item Installation package
+#
+# This script modifies /etc/hostconfig in the following ways:
+#
+# - On Mac OS X Server, it disables the startup of the default MySQL
+# installation by changing the "MYSQL" start variable to "-NO-".
+# - If not existent already, it adds a "MYSQLCOM" start variable, which
+# defaults to "-YES-". An already existing MYSQLCOM variable will remain
+# untouched.
+#
+# (c) 2003 MySQL AB
+# Author: Lenz Grimmer <lenz@mysql.com>
+#
+
+CONFFILE="/etc/hostconfig"
+TMPFILE=`basename $CONFFILE` || exit 1
+TMPFILE=`mktemp -t $TMPFILE.tmp` || exit 1
+
+test -e $CONFFILE || exit 1
+
+# Disable the startup of the default MySQL installation that ships with
+# Mac OS X Server to avoid conflicts with our installation on bootup
+sed -e s/^MYSQL=-YES-/MYSQL=-NO-/g < $CONFFILE > $TMPFILE
+
+# Add our MYSQLCOM startup variable (enabled by default)
+grep -q "^MYSQLCOM" $CONFFILE > /dev/null 2>&1
+if [ $? -ne 0 ] ; then
+ echo "MYSQLCOM=-YES-" >> $TMPFILE
+fi
+
+# Install the modified file into the default location
+cp -f $CONFFILE $CONFFILE~ || exit 1
+mv -f $TMPFILE $CONFFILE || echo "Error while installing new $CONFFILE!"
+chmod 644 $CONFFILE
diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh
index 4afdac9914a..661748adab9 100644
--- a/support-files/mysql.spec.sh
+++ b/support-files/mysql.spec.sh
@@ -3,6 +3,10 @@
%define mysqld_user mysql
%define server_suffix -standard
+# We don't package all files installed into the build root by intention -
+# See BUG#998 for details.
+%define _unpackaged_files_terminate_build 0
+
%define see_base For a description of MySQL see the base MySQL RPM or http://www.mysql.com
Name: MySQL
@@ -562,18 +566,26 @@ fi
%files embedded
%attr(644, root, root) %{_libdir}/mysql/libmysqld.a
+# The spec file changelog only includes changes made to the spec file
+# itself
%changelog
+* Fri Aug 29 2003 Lenz Grimmer <lenz@mysql.com>
+
+- Fixed BUG 1162 (removed macro names from the changelog)
+- Really fixed BUG 998 (disable the checking for installed but
+ unpackaged files)
+
* Tue Aug 05 2003 Lenz Grimmer <lenz@mysql.com>
-- Fixed BUG#959 (libmysqld not being compiled properly)
-- Fixed BUG#998 (RPM build errors): added missing files to the
+- Fixed BUG 959 (libmysqld not being compiled properly)
+- Fixed BUG 998 (RPM build errors): added missing files to the
distribution (mysql_fix_extensions, mysql_tableinfo, mysqldumpslow,
- mysql_fix_privilege_tables.1), removed "-n" from %install section.
+ mysql_fix_privilege_tables.1), removed "-n" from install section.
* Wed Jul 09 2003 Lenz Grimmer <lenz@mysql.com>
- removed the GIF Icon (file was not included in the sources anyway)
-- removed unused variable %shared_lib_version
+- removed unused variable shared_lib_version
- do not run automake before building the standard binary
(should not be necessary)
- add server suffix '-standard' to standard binary (to be in line
@@ -594,7 +606,7 @@ fi
* Mon Mar 10 2003 Lenz Grimmer <lenz@mysql.com>
- added missing file mysql_secure_installation to server subpackage
- (bug #141)
+ (BUG 141)
* Tue Feb 11 2003 Lenz Grimmer <lenz@mysql.com>
diff --git a/tests/client_test.c b/tests/client_test.c
index 6aeb865aa20..388d5743cfb 100644
--- a/tests/client_test.c
+++ b/tests/client_test.c
@@ -412,7 +412,7 @@ uint my_process_stmt_result(MYSQL_STMT *stmt)
my_bool is_null[MAX_RES_FIELDS];
int rc, i;
- if (!(result= mysql_prepare_result(stmt))) /* No meta info */
+ if (!(result= mysql_get_metadata(stmt))) /* No meta info */
{
while (!mysql_fetch(stmt))
row_count++;
@@ -1017,7 +1017,7 @@ static void test_prepare_field_result()
verify_param_count(stmt,1);
- result = mysql_prepare_result(stmt);
+ result = mysql_get_metadata(stmt);
mytest(result);
my_print_result_metadata(result);
@@ -1717,7 +1717,7 @@ static void test_select()
rc = mysql_commit(mysql);
myquery(rc);
- /* now insert the second row, and rollback the transaction */
+ /* now insert the second row, and rollback the transaction */
rc = mysql_query(mysql,"INSERT INTO test_select VALUES(20,'mysql')");
myquery(rc);
@@ -1755,6 +1755,167 @@ static void test_select()
mysql_stmt_close(stmt);
}
+/*
+ test BUG#1115 (incorrect string parameter value allocation)
+*/
+static void test_bug1115()
+{
+ MYSQL_STMT *stmt;
+ int rc;
+ MYSQL_BIND bind[1];
+ ulong length[1];
+ char szData[11];
+
+ myheader("test_bug1115");
+
+ rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_select");
+ myquery(rc);
+
+ rc = mysql_query(mysql,"CREATE TABLE test_select(\
+session_id char(9) NOT NULL, \
+ a int(8) unsigned NOT NULL, \
+ b int(5) NOT NULL, \
+ c int(5) NOT NULL, \
+ d datetime NOT NULL)");
+ myquery(rc);
+ rc = mysql_query(mysql,"INSERT INTO test_select VALUES (\"abc\",1,2,3,2003-08-30), (\"abd\",1,2,3,2003-08-30), (\"abf\",1,2,3,2003-08-30), (\"abg\",1,2,3,2003-08-30), (\"abh\",1,2,3,2003-08-30), (\"abj\",1,2,3,2003-08-30), (\"abk\",1,2,3,2003-08-30), (\"abl\",1,2,3,2003-08-30), (\"abq\",1,2,3,2003-08-30), (\"abw\",1,2,3,2003-08-30), (\"abe\",1,2,3,2003-08-30), (\"abr\",1,2,3,2003-08-30), (\"abt\",1,2,3,2003-08-30), (\"aby\",1,2,3,2003-08-30), (\"abu\",1,2,3,2003-08-30), (\"abi\",1,2,3,2003-08-30), (\"abo\",1,2,3,2003-08-30), (\"abp\",1,2,3,2003-08-30), (\"abz\",1,2,3,2003-08-30), (\"abx\",1,2,3,2003-08-30)");
+ myquery(rc);
+
+ strmov(query,"SELECT * FROM test_select WHERE session_id = ?");
+ stmt = mysql_prepare(mysql, query, strlen(query));
+ mystmt_init(stmt);
+
+ verify_param_count(stmt,1);
+
+ strmov(szData,(char *)"abc");
+ bind[0].buffer_type=FIELD_TYPE_STRING;
+ bind[0].buffer=(char *)szData;
+ bind[0].buffer_length= 10;
+ bind[0].length= &length[0];
+ length[0]= 3;
+ bind[0].is_null=0;
+
+ rc = mysql_bind_param(stmt,bind);
+ mystmt(stmt, rc);
+
+ rc = mysql_execute(stmt);
+ mystmt(stmt, rc);
+
+ myassert(my_process_stmt_result(stmt) == 1);
+
+ strmov(szData,(char *)"venu");
+ bind[0].buffer_type=FIELD_TYPE_STRING;
+ bind[0].buffer=(char *)szData;
+ bind[0].buffer_length= 10;
+ bind[0].length= &length[0];
+ length[0]= 4;
+ bind[0].is_null=0;
+
+ rc = mysql_bind_param(stmt,bind);
+ mystmt(stmt, rc);
+
+ rc = mysql_execute(stmt);
+ mystmt(stmt, rc);
+
+ myassert(my_process_stmt_result(stmt) == 0);
+
+ strmov(szData,(char *)"abc");
+ bind[0].buffer_type=FIELD_TYPE_STRING;
+ bind[0].buffer=(char *)szData;
+ bind[0].buffer_length= 10;
+ bind[0].length= &length[0];
+ length[0]= 3;
+ bind[0].is_null=0;
+
+ rc = mysql_bind_param(stmt,bind);
+ mystmt(stmt, rc);
+
+ rc = mysql_execute(stmt);
+ mystmt(stmt, rc);
+
+ myassert(my_process_stmt_result(stmt) == 1);
+
+ mysql_stmt_close(stmt);
+}
+
+/*
+ test BUG#1180 (optimized away part of WHERE clause)
+*/
+static void test_bug1180()
+{
+ MYSQL_STMT *stmt;
+ int rc;
+ MYSQL_BIND bind[1];
+ ulong length[1];
+ char szData[11];
+ int nData=1;
+
+ myheader("test_select_bug");
+
+ rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_select");
+ myquery(rc);
+
+ rc = mysql_query(mysql,"CREATE TABLE test_select(session_id char(9) NOT NULL)");
+ myquery(rc);
+ rc = mysql_query(mysql,"INSERT INTO test_select VALUES (\"abc\")");
+ myquery(rc);
+
+ strmov(query,"SELECT * FROM test_select WHERE ?=\"1111\" and session_id = \"abc\"");
+ stmt = mysql_prepare(mysql, query, strlen(query));
+ mystmt_init(stmt);
+
+ verify_param_count(stmt,1);
+
+ strmov(szData,(char *)"abc");
+ bind[0].buffer_type=FIELD_TYPE_STRING;
+ bind[0].buffer=(char *)szData;
+ bind[0].buffer_length= 10;
+ bind[0].length= &length[0];
+ length[0]= 3;
+ bind[0].is_null=0;
+
+ rc = mysql_bind_param(stmt,bind);
+ mystmt(stmt, rc);
+
+ rc = mysql_execute(stmt);
+ mystmt(stmt, rc);
+
+ myassert(my_process_stmt_result(stmt) == 0);
+
+ strmov(szData,(char *)"1111");
+ bind[0].buffer_type=FIELD_TYPE_STRING;
+ bind[0].buffer=(char *)szData;
+ bind[0].buffer_length= 10;
+ bind[0].length= &length[0];
+ length[0]= 4;
+ bind[0].is_null=0;
+
+ rc = mysql_bind_param(stmt,bind);
+ mystmt(stmt, rc);
+
+ rc = mysql_execute(stmt);
+ mystmt(stmt, rc);
+
+ myassert(my_process_stmt_result(stmt) == 1);
+
+ strmov(szData,(char *)"abc");
+ bind[0].buffer_type=FIELD_TYPE_STRING;
+ bind[0].buffer=(char *)szData;
+ bind[0].buffer_length= 10;
+ bind[0].length= &length[0];
+ length[0]= 3;
+ bind[0].is_null=0;
+
+ rc = mysql_bind_param(stmt,bind);
+ mystmt(stmt, rc);
+
+ rc = mysql_execute(stmt);
+ mystmt(stmt, rc);
+
+ myassert(my_process_stmt_result(stmt) == 0);
+
+ mysql_stmt_close(stmt);
+}
/********************************************************
* to test simple select show *
@@ -3645,7 +3806,7 @@ static void test_prepare_resultset()
verify_param_count(stmt,0);
- result = mysql_prepare_result(stmt);
+ result = mysql_get_metadata(stmt);
mytest(result);
my_print_result_metadata(result);
mysql_stmt_close(stmt);
@@ -5843,7 +6004,7 @@ static void test_field_misc()
rc = mysql_execute(stmt);
mystmt(stmt,rc);
- result = mysql_prepare_result(stmt);
+ result = mysql_get_metadata(stmt);
mytest(result);
myassert(1 == my_process_stmt_result(stmt));
@@ -5884,7 +6045,7 @@ static void test_field_misc()
stmt = mysql_prepare(mysql, "SELECT @@table_type", 30);
mystmt_init(stmt);
- result = mysql_prepare_result(stmt);
+ result = mysql_get_metadata(stmt);
mytest(result);
rc = mysql_execute(stmt);
@@ -5896,7 +6057,7 @@ static void test_field_misc()
"@@table_type","", /* field and its org name */
MYSQL_TYPE_STRING, /* field type */
"", "", /* table and its org name */
- "",type_length,0); /* db name, length */
+ "",type_length*3,0); /* db name, length */
mysql_free_result(result);
mysql_stmt_close(stmt);
@@ -5904,7 +6065,7 @@ static void test_field_misc()
stmt = mysql_prepare(mysql, "SELECT @@max_error_count", 30);
mystmt_init(stmt);
- result = mysql_prepare_result(stmt);
+ result = mysql_get_metadata(stmt);
mytest(result);
rc = mysql_execute(stmt);
@@ -5924,7 +6085,7 @@ static void test_field_misc()
stmt = mysql_prepare(mysql, "SELECT @@max_allowed_packet", 30);
mystmt_init(stmt);
- result = mysql_prepare_result(stmt);
+ result = mysql_get_metadata(stmt);
mytest(result);
rc = mysql_execute(stmt);
@@ -5944,7 +6105,7 @@ static void test_field_misc()
stmt = mysql_prepare(mysql, "SELECT @@sql_warnings", 30);
mystmt_init(stmt);
- result = mysql_prepare_result(stmt);
+ result = mysql_get_metadata(stmt);
mytest(result);
rc = mysql_execute(stmt);
@@ -6335,7 +6496,7 @@ static void test_explain_bug()
myassert( 2 == my_process_stmt_result(stmt));
- result = mysql_prepare_result(stmt);
+ result = mysql_get_metadata(stmt);
mytest(result);
fprintf(stdout, "\n total fields in the result: %d",
@@ -6371,7 +6532,7 @@ static void test_explain_bug()
myassert( 1 == my_process_stmt_result(stmt));
- result = mysql_prepare_result(stmt);
+ result = mysql_get_metadata(stmt);
mytest(result);
fprintf(stdout, "\n total fields in the result: %d",
@@ -6680,7 +6841,7 @@ static void test_logs()
fprintf(stdout, "\n name : %s(%ld)", data, length);
myassert(id == 9876);
- myassert(length == 19);//Due to VARCHAR(20)
+ myassert(length == 19); /* Due to VARCHAR(20) */
myassert(strcmp(data,"MySQL - Open Source")==0);
rc = mysql_fetch(stmt);
@@ -7172,7 +7333,7 @@ static void test_mem_overun()
rc = mysql_execute(stmt);
mystmt(stmt,rc);
- field_res = mysql_prepare_result(stmt);
+ field_res = mysql_get_metadata(stmt);
mytest(field_res);
fprintf(stdout,"\n total fields : %d", mysql_num_fields(field_res));
@@ -7528,7 +7689,7 @@ static void test_ts()
stmt = mysql_prepare(mysql,"SELECT * FROM test_ts",50);
mystmt_init(stmt);
- prep_res = mysql_prepare_result(stmt);
+ prep_res = mysql_get_metadata(stmt);
mytest(prep_res);
rc = mysql_execute(stmt);
@@ -7814,6 +7975,8 @@ int main(int argc, char **argv)
test_fetch_column(); /* to test mysql_fetch_column */
test_sqlmode(); /* test for SQL_MODE */
test_ts(); /* test for timestamp BR#819 */
+ test_bug1115(); /* BUG#1115 */
+ test_bug1180(); /* BUG#1180 */
end_time= time((time_t *)0);
total_time+= difftime(end_time, start_time);
diff --git a/tools/mysqlmanager.c b/tools/mysqlmanager.c
index 70382c29735..f1efd3be3eb 100644
--- a/tools/mysqlmanager.c
+++ b/tools/mysqlmanager.c
@@ -818,7 +818,7 @@ HANDLE_DECL(handle_def_exec)
update_req_len(e);
hash_delete(&exec_hash,(byte*)old_e);
}
- hash_insert(&exec_hash,(byte*)e);
+ my_hash_insert(&exec_hash,(byte*)e);
pthread_mutex_unlock(&lock_exec_hash);
client_msg(&thd->net,MANAGER_OK,"Exec definition created");
return 0;
@@ -1666,7 +1666,7 @@ static void init_user_hash()
}
else
{
- hash_insert(&user_hash,(gptr)u);
+ my_hash_insert(&user_hash,(gptr)u);
}
}
my_fclose(f, MYF(0));
diff --git a/vio/Makefile.am b/vio/Makefile.am
index d5d26dec344..9c961025080 100644
--- a/vio/Makefile.am
+++ b/vio/Makefile.am
@@ -18,7 +18,7 @@ INCLUDES= -I$(top_srcdir)/include $(openssl_includes)
LDADD= @CLIENT_EXTRA_LDFLAGS@ $(openssl_libs)
pkglib_LIBRARIES= libvio.a
noinst_PROGRAMS = test-ssl test-sslserver test-sslclient
-noinst_HEADERS=
+noinst_HEADERS= vio_priv.h
test_ssl_SOURCES= test-ssl.c
test_ssl_LDADD= @CLIENT_EXTRA_LDFLAGS@ ../dbug/libdbug.a libvio.a \
../mysys/libmysys.a ../strings/libmystrings.a \
diff --git a/vio/vio.c b/vio/vio.c
index e629cd043b5..05bfb220986 100644
--- a/vio/vio.c
+++ b/vio/vio.c
@@ -21,13 +21,7 @@
the file descriptior.
*/
-#define DONT_MAP_VIO
-#include <my_global.h>
-#include <mysql_com.h>
-#include <my_sys.h>
-#include <m_string.h>
-#include <violite.h>
-#include <errno.h>
+#include "vio_priv.h"
/*
* Helper to fill most of the Vio* with defaults.
@@ -97,6 +91,7 @@ void vio_reset(Vio* vio, enum enum_vio_type type,
vio->in_addr =vio_ssl_in_addr;
vio->vioblocking =vio_ssl_blocking;
vio->is_blocking =vio_is_blocking;
+ vio->timeout =vio_ssl_timeout;
}
else /* default is VIO_TYPE_TCPIP */
#endif /* HAVE_OPENSSL */
@@ -113,6 +108,7 @@ void vio_reset(Vio* vio, enum enum_vio_type type,
vio->in_addr =vio_in_addr;
vio->vioblocking =vio_blocking;
vio->is_blocking =vio_is_blocking;
+ vio->timeout =vio_timeout;
}
#endif /* HAVE_VIO */
DBUG_VOID_RETURN;
diff --git a/vio/vio_priv.h b/vio/vio_priv.h
new file mode 100644
index 00000000000..66a9bde4e0d
--- /dev/null
+++ b/vio/vio_priv.h
@@ -0,0 +1,54 @@
+/* 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 */
+
+/* Structures and functions private to the vio package */
+
+#define DONT_MAP_VIO
+#include <my_global.h>
+#include <mysql_com.h>
+#include <my_sys.h>
+#include <m_string.h>
+#include <violite.h>
+
+#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 timeout);
+
+/* setsockopt TCP_NODELAY at IPPROTO_TCP level, when possible. */
+int vio_ssl_fastsend(Vio *vio);
+/* setsockopt SO_KEEPALIVE at SOL_SOCKET level, when possible. */
+int vio_ssl_keepalive(Vio *vio, my_bool onoff);
+/* Whenever we should retry the last read/write operation. */
+my_bool vio_ssl_should_retry(Vio *vio);
+/* When the workday is over... */
+int vio_ssl_close(Vio *vio);
+/* Return last error number */
+int vio_ssl_errno(Vio *vio);
+my_bool vio_ssl_peer_addr(Vio *vio, char *buf, uint16 *port);
+void vio_ssl_in_addr(Vio *vio, struct in_addr *in);
+int vio_ssl_blocking(Vio *vio, my_bool set_blocking_mode, my_bool *old_mode);
+
+/* Single copy for server */
+enum vio_ssl_acceptorfd_state
+{
+ state_connect = 1,
+ state_accept = 2
+};
+#endif /* HAVE_OPENSSL */
diff --git a/vio/viosocket.c b/vio/viosocket.c
index ac2f7939a4c..f631dca5268 100644
--- a/vio/viosocket.c
+++ b/vio/viosocket.c
@@ -21,19 +21,7 @@
the file descriptior.
*/
-#define DONT_MAP_VIO
-#include <my_global.h>
-#include <mysql_com.h>
-
-#include <errno.h>
-#include <my_sys.h>
-#include <violite.h>
-#include <my_net.h>
-#include <m_string.h>
-
-#ifndef __WIN__
-#define HANDLE void *
-#endif
+#include "vio_priv.h"
int vio_errno(Vio *vio __attribute__((unused)))
{
@@ -309,6 +297,18 @@ my_bool vio_poll_read(Vio *vio,uint timeout)
#endif
}
+
+void vio_timeout(Vio *vio __attribute__((unused)),
+ uint timeout __attribute__((unused)))
+{
+#ifdef __WIN__
+ ulong wait_timeout= (ulong) timeout * 1000;
+ (void) setsockopt(vio->sd, SOL_SOCKET, SO_RCVTIMEO, (char*) &wait_timeout,
+ sizeof(wait_timeout));
+#endif /* __WIN__ */
+}
+
+
#ifdef __WIN__
int vio_read_pipe(Vio * vio, gptr buf, int size)
{
@@ -458,5 +458,5 @@ int vio_close_shared_memory(Vio * vio)
vio->sd= -1;
DBUG_RETURN(r);
}
-#endif
-#endif
+#endif /* HAVE_SMEM */
+#endif /* __WIN__ */
diff --git a/vio/viossl.c b/vio/viossl.c
index fc95b0755ce..fafe48b7a84 100644
--- a/vio/viossl.c
+++ b/vio/viossl.c
@@ -21,23 +21,10 @@
the file descriptior.
*/
-#include <my_global.h>
+#include "vio_priv.h"
#ifdef HAVE_OPENSSL
-#include <mysql_com.h>
-
-#include <errno.h>
-#include <assert.h>
-#include <violite.h>
-#include <my_sys.h>
-#include <my_net.h>
-#include <m_string.h>
-
-#ifndef __WIN__
-#define HANDLE void *
-#endif
-
static void
report_errors()
{
@@ -88,11 +75,11 @@ int vio_ssl_read(Vio * vio, gptr buf, int size)
int r;
DBUG_ENTER("vio_ssl_read");
DBUG_PRINT("enter", ("sd=%d, buf=%p, size=%d, ssl_=%p",
- vio->sd, buf, size, vio->ssl_));
+ vio->sd, buf, size, vio->ssl_arg));
- if ((r= SSL_read(vio->ssl_, buf, size)) < 0)
+ if ((r= SSL_read((SSL*) vio->ssl_arg, buf, size)) < 0)
{
- int err= SSL_get_error(vio->ssl_, r);
+ int err= SSL_get_error((SSL*) vio->ssl_arg, r);
DBUG_PRINT("error",("SSL_read(): %d SSL_get_error(): %d", r, err));
report_errors();
}
@@ -107,7 +94,7 @@ int vio_ssl_write(Vio * vio, const gptr buf, int size)
DBUG_ENTER("vio_ssl_write");
DBUG_PRINT("enter", ("sd=%d, buf=%p, size=%d", vio->sd, buf, size));
- if ((r= SSL_write(vio->ssl_, buf, size)) < 0)
+ if ((r= SSL_write((SSL*) vio->ssl_arg, buf, size)) < 0)
report_errors();
DBUG_PRINT("exit", ("%d", r));
DBUG_RETURN(r);
@@ -171,11 +158,11 @@ int vio_ssl_close(Vio * vio)
int r;
DBUG_ENTER("vio_ssl_close");
r=0;
- if (vio->ssl_)
+ if ((SSL*) vio->ssl_arg)
{
- r = SSL_shutdown(vio->ssl_);
- SSL_free(vio->ssl_);
- vio->ssl_= 0;
+ r = SSL_shutdown((SSL*) vio->ssl_arg);
+ SSL_free((SSL*) vio->ssl_arg);
+ vio->ssl_arg= 0;
}
if (vio->sd >= 0)
{
@@ -273,8 +260,8 @@ int sslaccept(struct st_VioSSLAcceptorFd* ptr, Vio* vio, long timeout)
net_blocking = vio_is_blocking(vio);
vio_blocking(vio, 1, &unused); /* Must be called before reset */
vio_reset(vio,VIO_TYPE_SSL,vio->sd,0,FALSE);
- vio->ssl_=0;
- if (!(vio->ssl_ = SSL_new(ptr->ssl_context_)))
+ vio->ssl_arg= 0;
+ if (!(vio->ssl_arg= (void*) SSL_new(ptr->ssl_context)))
{
DBUG_PRINT("error", ("SSL_new failure"));
report_errors();
@@ -282,25 +269,25 @@ int sslaccept(struct st_VioSSLAcceptorFd* ptr, Vio* vio, long timeout)
vio_blocking(vio, net_blocking, &unused);
DBUG_RETURN(1);
}
- DBUG_PRINT("info", ("ssl_=%p timeout=%ld",vio->ssl_, timeout));
- SSL_clear(vio->ssl_);
- SSL_SESSION_set_timeout(SSL_get_session(vio->ssl_), timeout);
- SSL_set_fd(vio->ssl_,vio->sd);
- SSL_set_accept_state(vio->ssl_);
- if (SSL_do_handshake(vio->ssl_) < 1)
+ DBUG_PRINT("info", ("ssl_=%p timeout=%ld",(SSL*) vio->ssl_arg, timeout));
+ SSL_clear((SSL*) vio->ssl_arg);
+ SSL_SESSION_set_timeout(SSL_get_session((SSL*) vio->ssl_arg), timeout);
+ SSL_set_fd((SSL*) vio->ssl_arg,vio->sd);
+ SSL_set_accept_state((SSL*) vio->ssl_arg);
+ if (SSL_do_handshake((SSL*) vio->ssl_arg) < 1)
{
DBUG_PRINT("error", ("SSL_do_handshake failure"));
report_errors();
- SSL_free(vio->ssl_);
- vio->ssl_=0;
+ SSL_free((SSL*) vio->ssl_arg);
+ vio->ssl_arg= 0;
vio_reset(vio, old_type,vio->sd,0,FALSE);
vio_blocking(vio, net_blocking, &unused);
DBUG_RETURN(1);
}
#ifndef DBUF_OFF
DBUG_PRINT("info",("SSL_get_cipher_name() = '%s'"
- ,SSL_get_cipher_name(vio->ssl_)));
- client_cert = SSL_get_peer_certificate (vio->ssl_);
+ ,SSL_get_cipher_name((SSL*) vio->ssl_arg)));
+ client_cert = SSL_get_peer_certificate ((SSL*) vio->ssl_arg);
if (client_cert != NULL)
{
DBUG_PRINT("info",("Client certificate:"));
@@ -317,7 +304,7 @@ int sslaccept(struct st_VioSSLAcceptorFd* ptr, Vio* vio, long timeout)
else
DBUG_PRINT("info",("Client does not have certificate."));
- str=SSL_get_shared_ciphers(vio->ssl_, buf, sizeof(buf));
+ str=SSL_get_shared_ciphers((SSL*) vio->ssl_arg, buf, sizeof(buf));
if (str)
{
DBUG_PRINT("info",("SSL_get_shared_ciphers() returned '%s'",str));
@@ -340,14 +327,14 @@ int sslconnect(struct st_VioSSLConnectorFd* ptr, Vio* vio, long timeout)
my_bool net_blocking;
enum enum_vio_type old_type;
DBUG_ENTER("sslconnect");
- DBUG_PRINT("enter", ("sd=%d ptr=%p ctx: %p", vio->sd,ptr,ptr->ssl_context_));
+ DBUG_PRINT("enter", ("sd=%d ptr=%p ctx: %p", vio->sd,ptr,ptr->ssl_context));
old_type= vio->type;
net_blocking = vio_is_blocking(vio);
vio_blocking(vio, 1, &unused); /* Must be called before reset */
vio_reset(vio,VIO_TYPE_SSL,vio->sd,0,FALSE);
- vio->ssl_=0;
- if (!(vio->ssl_ = SSL_new(ptr->ssl_context_)))
+ vio->ssl_arg= 0;
+ if (!(vio->ssl_arg = SSL_new(ptr->ssl_context)))
{
DBUG_PRINT("error", ("SSL_new failure"));
report_errors();
@@ -355,25 +342,25 @@ int sslconnect(struct st_VioSSLConnectorFd* ptr, Vio* vio, long timeout)
vio_blocking(vio, net_blocking, &unused);
DBUG_RETURN(1);
}
- DBUG_PRINT("info", ("ssl_=%p timeout=%ld",vio->ssl_, timeout));
- SSL_clear(vio->ssl_);
- SSL_SESSION_set_timeout(SSL_get_session(vio->ssl_), timeout);
- SSL_set_fd (vio->ssl_, vio->sd);
- SSL_set_connect_state(vio->ssl_);
- if (SSL_do_handshake(vio->ssl_) < 1)
+ DBUG_PRINT("info", ("ssl_=%p timeout=%ld",(SSL*) vio->ssl_arg, timeout));
+ SSL_clear((SSL*) vio->ssl_arg);
+ SSL_SESSION_set_timeout(SSL_get_session((SSL*) vio->ssl_arg), timeout);
+ SSL_set_fd ((SSL*) vio->ssl_arg, vio->sd);
+ SSL_set_connect_state((SSL*) vio->ssl_arg);
+ if (SSL_do_handshake((SSL*) vio->ssl_arg) < 1)
{
DBUG_PRINT("error", ("SSL_do_handshake failure"));
report_errors();
- SSL_free(vio->ssl_);
- vio->ssl_=0;
+ SSL_free((SSL*) vio->ssl_arg);
+ vio->ssl_arg= 0;
vio_reset(vio, old_type,vio->sd,0,FALSE);
vio_blocking(vio, net_blocking, &unused);
DBUG_RETURN(1);
}
#ifndef DBUG_OFF
DBUG_PRINT("info",("SSL_get_cipher_name() = '%s'"
- ,SSL_get_cipher_name(vio->ssl_)));
- server_cert = SSL_get_peer_certificate (vio->ssl_);
+ ,SSL_get_cipher_name((SSL*) vio->ssl_arg)));
+ server_cert = SSL_get_peer_certificate ((SSL*) vio->ssl_arg);
if (server_cert != NULL)
{
DBUG_PRINT("info",("Server certificate:"));
@@ -407,4 +394,10 @@ int vio_ssl_blocking(Vio * vio __attribute__((unused)),
return set_blocking_mode ? 0 : 1;
}
+
+void vio_ssl_timeout(Vio *vio __attribute__((unused)),
+ uint timeout __attribute__((unused)))
+{
+ /* Not yet implemented (non critical) */
+}
#endif /* HAVE_OPENSSL */
diff --git a/vio/viosslfactories.c b/vio/viosslfactories.c
index 69d4f3007b8..0997e3909db 100644
--- a/vio/viosslfactories.c
+++ b/vio/viosslfactories.c
@@ -14,15 +14,10 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <my_global.h>
+#include "vio_priv.h"
#ifdef HAVE_OPENSSL
-#include <mysql_com.h>
-#include <my_sys.h>
-#include <violite.h>
-
-
static bool ssl_algorithms_added = FALSE;
static bool ssl_error_strings_loaded= FALSE;
static int verify_depth = 0;
@@ -203,8 +198,8 @@ new_VioSSLConnectorFd(const char* key_file,
my_malloc(sizeof(struct st_VioSSLConnectorFd),MYF(0)))))
DBUG_RETURN(0);
- ptr->ssl_context_= 0;
- ptr->ssl_method_= 0;
+ ptr->ssl_context= 0;
+ ptr->ssl_method= 0;
/* FIXME: constants! */
if (!ssl_algorithms_added)
@@ -219,10 +214,10 @@ new_VioSSLConnectorFd(const char* key_file,
ssl_error_strings_loaded = TRUE;
SSL_load_error_strings();
}
- ptr->ssl_method_ = TLSv1_client_method();
- ptr->ssl_context_ = SSL_CTX_new(ptr->ssl_method_);
- DBUG_PRINT("info", ("ssl_context_: %p",ptr->ssl_context_));
- if (ptr->ssl_context_ == 0)
+ ptr->ssl_method = TLSv1_client_method();
+ ptr->ssl_context = SSL_CTX_new(ptr->ssl_method);
+ DBUG_PRINT("info", ("ssl_context: %p",ptr->ssl_context));
+ if (ptr->ssl_context == 0)
{
DBUG_PRINT("error", ("SSL_CTX_new failed"));
report_errors();
@@ -234,20 +229,20 @@ new_VioSSLConnectorFd(const char* key_file,
*/
if (cipher)
{
- result=SSL_CTX_set_cipher_list(ptr->ssl_context_, cipher);
+ result=SSL_CTX_set_cipher_list(ptr->ssl_context, cipher);
DBUG_PRINT("info",("SSL_set_cipher_list() returned %d",result));
}
- SSL_CTX_set_verify(ptr->ssl_context_, verify, vio_verify_callback);
- if (vio_set_cert_stuff(ptr->ssl_context_, cert_file, key_file) == -1)
+ SSL_CTX_set_verify(ptr->ssl_context, verify, vio_verify_callback);
+ if (vio_set_cert_stuff(ptr->ssl_context, cert_file, key_file) == -1)
{
DBUG_PRINT("error", ("vio_set_cert_stuff failed"));
report_errors();
goto ctor_failure;
}
- if (SSL_CTX_load_verify_locations( ptr->ssl_context_, ca_file,ca_path) == 0)
+ if (SSL_CTX_load_verify_locations( ptr->ssl_context, ca_file,ca_path) == 0)
{
DBUG_PRINT("warning", ("SSL_CTX_load_verify_locations failed"));
- if (SSL_CTX_set_default_verify_paths(ptr->ssl_context_) == 0)
+ if (SSL_CTX_set_default_verify_paths(ptr->ssl_context) == 0)
{
DBUG_PRINT("error", ("SSL_CTX_set_default_verify_paths failed"));
report_errors();
@@ -257,7 +252,7 @@ new_VioSSLConnectorFd(const char* key_file,
/* DH stuff */
dh=get_dh512();
- SSL_CTX_set_tmp_dh(ptr->ssl_context_,dh);
+ SSL_CTX_set_tmp_dh(ptr->ssl_context,dh);
DH_free(dh);
DBUG_RETURN(ptr);
@@ -292,10 +287,10 @@ new_VioSSLAcceptorFd(const char *key_file,
ptr= ((struct st_VioSSLAcceptorFd*)
my_malloc(sizeof(struct st_VioSSLAcceptorFd),MYF(0)));
- ptr->ssl_context_=0;
- ptr->ssl_method_=0;
+ ptr->ssl_context=0;
+ ptr->ssl_method=0;
/* FIXME: constants! */
- ptr->session_id_context_ = ptr;
+ ptr->session_id_context= ptr;
if (!ssl_algorithms_added)
{
@@ -310,9 +305,9 @@ new_VioSSLAcceptorFd(const char *key_file,
ssl_error_strings_loaded = TRUE;
SSL_load_error_strings();
}
- ptr->ssl_method_= TLSv1_server_method();
- ptr->ssl_context_= SSL_CTX_new(ptr->ssl_method_);
- if (ptr->ssl_context_ == 0)
+ ptr->ssl_method= TLSv1_server_method();
+ ptr->ssl_context= SSL_CTX_new(ptr->ssl_method);
+ if (ptr->ssl_context == 0)
{
DBUG_PRINT("error", ("SSL_CTX_new failed"));
report_errors();
@@ -320,31 +315,31 @@ new_VioSSLAcceptorFd(const char *key_file,
}
if (cipher)
{
- result=SSL_CTX_set_cipher_list(ptr->ssl_context_, cipher);
+ result=SSL_CTX_set_cipher_list(ptr->ssl_context, cipher);
DBUG_PRINT("info",("SSL_set_cipher_list() returned %d",result));
}
/* SSL_CTX_set_quiet_shutdown(ctx,1); */
- SSL_CTX_sess_set_cache_size(ptr->ssl_context_,128);
+ SSL_CTX_sess_set_cache_size(ptr->ssl_context,128);
/* DH? */
- SSL_CTX_set_verify(ptr->ssl_context_, verify, vio_verify_callback);
- SSL_CTX_set_session_id_context(ptr->ssl_context_,
- (const uchar*) &(ptr->session_id_context_),
- sizeof(ptr->session_id_context_));
+ SSL_CTX_set_verify(ptr->ssl_context, verify, vio_verify_callback);
+ SSL_CTX_set_session_id_context(ptr->ssl_context,
+ (const uchar*) &(ptr->session_id_context),
+ sizeof(ptr->session_id_context));
/*
SSL_CTX_set_client_CA_list(ctx,SSL_load_client_CA_file(CAfile));
*/
- if (vio_set_cert_stuff(ptr->ssl_context_, cert_file, key_file) == -1)
+ if (vio_set_cert_stuff(ptr->ssl_context, cert_file, key_file) == -1)
{
DBUG_PRINT("error", ("vio_set_cert_stuff failed"));
report_errors();
goto ctor_failure;
}
- if (SSL_CTX_load_verify_locations( ptr->ssl_context_, ca_file, ca_path) == 0)
+ if (SSL_CTX_load_verify_locations( ptr->ssl_context, ca_file, ca_path) == 0)
{
DBUG_PRINT("warning", ("SSL_CTX_load_verify_locations failed"));
- if (SSL_CTX_set_default_verify_paths(ptr->ssl_context_)==0)
+ if (SSL_CTX_set_default_verify_paths(ptr->ssl_context)==0)
{
DBUG_PRINT("error", ("SSL_CTX_set_default_verify_paths failed"));
report_errors();
@@ -353,7 +348,7 @@ new_VioSSLAcceptorFd(const char *key_file,
}
/* DH stuff */
dh=get_dh512();
- SSL_CTX_set_tmp_dh(ptr->ssl_context_,dh);
+ SSL_CTX_set_tmp_dh(ptr->ssl_context,dh);
DH_free(dh);
DBUG_RETURN(ptr);
@@ -362,6 +357,4 @@ ctor_failure:
my_free((gptr) ptr,MYF(0));
DBUG_RETURN(0);
}
-
-
#endif /* HAVE_OPENSSL */